From 6834bc687609ec28aff0280df367f5bec6d0e275 Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Sun, 25 Jan 2026 01:04:15 +0000 Subject: feat: onboarding config, reset onboarding, xai agentic migration (#701) - 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 --- packages/lib/auth-context.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'packages/lib') 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 + updateOrgMetadata: ( + partial: Record, + ) => void } const AuthContext = createContext(undefined) @@ -35,6 +39,22 @@ export function AuthProvider({ children }: { children: ReactNode }) { setOrg(activeOrg) } + const updateOrgMetadata = useCallback( + (partial: Record) => { + 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} -- cgit v1.2.3