1import { useCallback } from "react";
2
3import { ensureClientSettingsHydrated, persistClientSettingsUpdate } from "../hooks/useSettings";
4
5/**
6 * Marks first-run onboarding finished (or skipped) so FirstRunGate never
7 * routes to the welcome wizard again. The gate itself lives in
8 * `components/onboarding/FirstRunGate.tsx`.
9 */
10export function useCompleteOnboarding(): () => Promise<void> {
11 return useCallback(async () => {
12 await ensureClientSettingsHydrated();
13 const onboardingCompletedAt = new Date().toISOString();
14 await persistClientSettingsUpdate((current) => ({ ...current, onboardingCompletedAt }));
15 }, []);
16}