diff options
| author | MaheshtheDev <[email protected]> | 2026-01-25 01:04:15 +0000 |
|---|---|---|
| committer | MaheshtheDev <[email protected]> | 2026-01-25 01:04:15 +0000 |
| commit | 6834bc687609ec28aff0280df367f5bec6d0e275 (patch) | |
| tree | 6dac32e6551cb2ea580df784decadad9aebd91c8 /packages/lib | |
| parent | feat: added advanced analytics events (#702) (diff) | |
| download | supermemory-6834bc687609ec28aff0280df367f5bec6d0e275.tar.xz supermemory-6834bc687609ec28aff0280df367f5bec6d0e275.zip | |
feat: onboarding config, reset onboarding, xai agentic migration (#701)01-24-feat_onboarding_config_reset_onboarding_xai_agentic_migration
- Created a new `useOrgOnboarding` hook that uses `org.metadata.isOnboarded` to track onboarding state
- Updated the home page to conditionally use either the old localStorage-based onboarding or the new DB-backed onboarding based on feature flag
- Added a "Restart Onboarding" option in the user dropdown menu
- Improved the onboarding chat sidebar with per-link loading indicators
- Enhanced the X/Twitter research API to better handle different URL formats
- Updated the integrations step to use the new onboarding completion method
- Added `updateOrgMetadata` function to the auth context for easier metadata updates
Diffstat (limited to 'packages/lib')
| -rw-r--r-- | packages/lib/auth-context.tsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/lib/auth-context.tsx b/packages/lib/auth-context.tsx index 4bfdc2d7..67e57d49 100644 --- a/packages/lib/auth-context.tsx +++ b/packages/lib/auth-context.tsx @@ -3,6 +3,7 @@ import { createContext, type ReactNode, + useCallback, useContext, useEffect, useState, @@ -17,6 +18,9 @@ interface AuthContextType { user: SessionData["user"] | null org: Organization | null setActiveOrg: (orgSlug: string) => Promise<void> + updateOrgMetadata: ( + partial: Record<string, unknown>, + ) => void } const AuthContext = createContext<AuthContextType | undefined>(undefined) @@ -35,6 +39,22 @@ export function AuthProvider({ children }: { children: ReactNode }) { setOrg(activeOrg) } + const updateOrgMetadata = useCallback( + (partial: Record<string, unknown>) => { + setOrg((prev) => { + if (!prev) return prev + return { + ...prev, + metadata: { + ...prev.metadata, + ...partial, + }, + } + }) + }, + [], + ) + // biome-ignore lint/correctness/useExhaustiveDependencies: ignoring the setActiveOrg dependency useEffect(() => { if (session?.session.activeOrganizationId) { @@ -99,6 +119,7 @@ export function AuthProvider({ children }: { children: ReactNode }) { session: session?.session ?? null, user: session?.user ?? null, setActiveOrg, + updateOrgMetadata, }} > {children} |