Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Implement user-based tutorial visibility for new users

Muhammad Hamza Khana07cd836c183
diff --git a/packages/app/src/builder-ui/tutorials/index.ts b/packages/app/src/builder-ui/tutorials/index.ts
index 42a0de65..b2801a65 100644
--- a/packages/app/src/builder-ui/tutorials/index.ts
+++ b/packages/app/src/builder-ui/tutorials/index.ts
@@ -1,10 +1,21 @@
+import { authStore } from '@shared/state_stores/auth';
import { userSettingKeys } from '@shared/userSettingKeys';
import { getUserSettings, saveUserSettings } from '@src/react/shared/hooks/useUserSettings';
+import { TUTORIAL_CUTOFF_DATE } from '@src/shared/constants/tutorial';
import { Analytics } from '@src/shared/posthog/services/analytics';
export const builderPageTutorialWorkflow = async () => {
+ const userInfo = authStore.getState().userInfo;
+ const isNewUser = userInfo?.user?.createdAt
+ ? new Date(userInfo.user.createdAt) > TUTORIAL_CUTOFF_DATE
+ : false;
+
+ // Only show tutorial to new users
+ if (!isNewUser) return null;
+
const tutorialSeen = await getUserSettings(userSettingKeys.SEEN_BUILDER_PAGE_TUTORIAL);
+ // Check if user has already seen the tutorial
if (tutorialSeen === 'true') return null;
const Tutorial = (window as any)?.Tutorial;
diff --git a/packages/app/src/react/features/agents/hooks/useAgentsPageTutorial.ts b/packages/app/src/react/features/agents/hooks/useAgentsPageTutorial.ts
index 051c1c3a..cac389e7 100644
--- a/packages/app/src/react/features/agents/hooks/useAgentsPageTutorial.ts
+++ b/packages/app/src/react/features/agents/hooks/useAgentsPageTutorial.ts
@@ -1,4 +1,6 @@
+import { useAuthCtx } from '@react/shared/contexts/auth.context';
import { useGetUserSettings, useStoreUserSettings } from '@react/shared/hooks/useUserSettings';
+import { TUTORIAL_CUTOFF_DATE } from '@src/shared/constants/tutorial';
import { Analytics } from '@src/shared/posthog/services/analytics';
import { userSettingKeys } from '@src/shared/userSettingKeys';
import { useEffect, useRef } from 'react';
@@ -10,8 +12,8 @@ type UseAgentsPageTutorialOptions = {
};
/**
- * Triggers the in-app tutorial on the Agents page for first-time visitors.
- * Uses user settings to ensure it shows only once per user.
+ * Triggers the in-app tutorial on the Agents page for new users only.
+ * Uses user account creation timestamp to determine if user is new.
*/
export function useAgentsPageTutorial(options: UseAgentsPageTutorialOptions = {}): void {
const {
@@ -23,14 +25,21 @@ export function useAgentsPageTutorial(options: UseAgentsPageTutorialOptions = {}
const { data: tutorialSeen, isLoading } = useGetUserSettings(
userSettingKeys.SEEN_AGENTS_PAGE_TUTORIAL,
);
+
const storeUserSettings = useStoreUserSettings(userSettingKeys.SEEN_AGENTS_PAGE_TUTORIAL);
+ const { userInfo } = useAuthCtx();
const hasStartedRef = useRef(false);
+ // Check if user is new based on account creation date
+ const isNewUser = userInfo?.user?.createdAt
+ ? new Date(userInfo.user.createdAt) > TUTORIAL_CUTOFF_DATE
+ : false;
+
useEffect(() => {
if (!enabled || isLoading) return;
- // Check if user has already seen the tutorial or if tutorial has already been started
- if (tutorialSeen === 'true' || hasStartedRef.current) return;
+ // Check if user is new and hasn't seen the tutorial, or if tutorial has already been started
+ if (!isNewUser || tutorialSeen === 'true' || hasStartedRef.current) return;
let attempts = 0;
@@ -131,5 +140,5 @@ export function useAgentsPageTutorial(options: UseAgentsPageTutorialOptions = {}
return () => {
if (interval) window.clearInterval(interval);
};
- }, [enabled, maxAttempts, intervalMs, tutorialSeen, storeUserSettings]);
+ }, [enabled, maxAttempts, intervalMs, tutorialSeen, storeUserSettings, isNewUser]);
}
diff --git a/packages/app/src/shared/constants/tutorial.ts b/packages/app/src/shared/constants/tutorial.ts
new file mode 100644
index 00000000..013ffc33
--- /dev/null
+++ b/packages/app/src/shared/constants/tutorial.ts
@@ -0,0 +1,2 @@
+// Show tutorials to users created after August 1, 2025
+export const TUTORIAL_CUTOFF_DATE = new Date('2025-08-01T00:00:00Z');