@pablo2410/shared-ui 0.25.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-T3W42HMO.js → chunk-LUQAR6NB.js} +98 -37
- package/dist/chunk-LUQAR6NB.js.map +1 -0
- package/dist/{chunk-Z4P7V5SL.js → chunk-UQUMDBCZ.js} +2 -2
- package/dist/layout/index.js +2 -2
- package/dist/shell/index.js +2 -2
- package/dist/shell/oplytics-shell.css +1 -1
- package/dist/tour/index.js +1 -1
- package/package.json +9 -3
- package/dist/chunk-T3W42HMO.js.map +0 -1
- /package/dist/{chunk-Z4P7V5SL.js.map → chunk-UQUMDBCZ.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tour/tourStore.ts","../src/tour/tourProgress.ts","../src/tour/tourNarration.ts","../src/tour/TourProvider.tsx","../src/tour/TakeTheTourButton.tsx","../src/tour/useSpotlight.ts","../src/tour/spotlightMath.ts","../src/tour/TourShell.tsx","../src/tour/useTour.ts","../src/tour/tourMachine.ts","../src/tour/OpiTourHost.tsx"],"sourcesContent":["/**\n * The tour registry + launcher store — the one place a module's tour\n * definition and the \"is a tour open right now\" flag live, so the header's\n * \"Take the tour\" trigger, the tour host, and the module's own page code\n * never talk to each other directly.\n *\n * A module's whole integration is a definition object (see\n * TourDefinition) passed to `useRegisterTour`, plus `data-tour-target`\n * attributes on the elements its spotlight steps point at. Everything else\n * — progress storage, the header trigger, the overlay, narration — is shared.\n *\n * Plain functions, no React import: testable in a Node environment (this\n * package has no jsdom set up — see tour.test.ts), same split as\n * tourMachine.ts. TourProvider.tsx is the React binding.\n */\nimport type { TourStep, TourStepKind } from \"./types\";\n\n/** Portal caps `lastStepId` at 120 chars (onboarding.setUserTourState). */\nconst MAX_STEP_ID_LENGTH = 120;\n/** Tour ids are a key in Portal's progress store, so keep them short and plain. */\nconst MAX_TOUR_ID_LENGTH = 60;\nconst TOUR_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;\nconst STEP_KINDS: readonly TourStepKind[] = [\"intro\", \"service\", \"outro\"];\n\nexport interface TourDefinition {\n /** Stable, lowercase-kebab id, e.g. \"policy-deployment\". It is the key\n * progress is stored under in Portal, so never rename a shipped tour's\n * id — users' progress and \"done\" state would reset. */\n id: string;\n /** The steps, in order. A step that should highlight a live element sets\n * `spotlight.selector` to the value of a `data-tour-target` attribute in\n * the module's DOM. */\n steps: TourStep[];\n /** Open the tour by itself for a user who has never seen it or left it\n * part-way (resuming at their last step). Off by default. Never fires\n * when the user's progress couldn't be read, and never for a tour they\n * finished or dismissed — those only reopen from \"Take the tour\". */\n autoStart?: boolean;\n}\n\nexport class InvalidTourDefinitionError extends Error {\n readonly problems: string[];\n constructor(tourId: string, problems: string[]) {\n super(`Invalid tour definition \"${tourId}\": ${problems.join(\"; \")}`);\n this.name = \"InvalidTourDefinitionError\";\n this.problems = problems;\n }\n}\n\n/** Returns a list of problems; empty means the definition is usable. */\nexport function validateTourDefinition(def: TourDefinition): string[] {\n const problems: string[] = [];\n\n if (typeof def.id !== \"string\" || def.id.length === 0) {\n problems.push(\"id is required\");\n } else {\n if (def.id.length > MAX_TOUR_ID_LENGTH) {\n problems.push(`id is longer than ${MAX_TOUR_ID_LENGTH} characters`);\n }\n if (!TOUR_ID_PATTERN.test(def.id)) {\n problems.push(\"id must be lowercase letters, digits and hyphens\");\n }\n }\n\n if (!Array.isArray(def.steps) || def.steps.length === 0) {\n problems.push(\"at least one step is required\");\n return problems;\n }\n\n const seen = new Set<string>();\n def.steps.forEach((step, i) => {\n const at = `step ${i + 1}`;\n if (!step.id) {\n problems.push(`${at} has no id`);\n } else {\n if (step.id.length > MAX_STEP_ID_LENGTH) {\n problems.push(\n `${at} id is longer than ${MAX_STEP_ID_LENGTH} characters`\n );\n }\n if (seen.has(step.id)) problems.push(`duplicate step id \"${step.id}\"`);\n seen.add(step.id);\n }\n if (!STEP_KINDS.includes(step.kind)) {\n problems.push(`${at} has an unknown kind \"${String(step.kind)}\"`);\n }\n if (!step.label) problems.push(`${at} has no label`);\n if (!step.fallbackText) problems.push(`${at} has no fallbackText`);\n if (step.spotlight && !step.spotlight.selector) {\n problems.push(`${at} has a spotlight with no selector`);\n }\n });\n\n return problems;\n}\n\nexport interface TourSession {\n /** True = start at step 1 regardless of saved progress (the header's\n * \"Take the tour\" replay). False = resume from the saved step. */\n restart: boolean;\n}\n\nexport interface TourStoreState {\n /** The tour the header trigger and host act on: the most recently\n * registered one still mounted (a page-level tour wins over a\n * module-level one while its page is open). */\n active: TourDefinition | null;\n /** Non-null while the tour overlay is open. */\n session: TourSession | null;\n}\n\nexport interface TourStore {\n /** Registers (or replaces, by id) a tour. Throws InvalidTourDefinitionError\n * for an unusable definition. Returns the unregister function. */\n register(def: TourDefinition): () => void;\n /** Opens the active tour. No-op when none is registered. */\n open(session?: TourSession): void;\n close(): void;\n getState(): TourStoreState;\n subscribe(listener: () => void): () => void;\n}\n\nexport function createTourStore(): TourStore {\n // Insertion order = registration order; the last entry is the active tour.\n const tours = new Map<string, TourDefinition>();\n let session: TourSession | null = null;\n let state: TourStoreState = { active: null, session: null };\n const listeners = new Set<() => void>();\n\n const recompute = () => {\n const last = [...tours.values()].pop() ?? null;\n // An overlay can't outlive the tour it was opened for.\n if (state.active && last?.id !== state.active.id) session = null;\n // Keep object identity stable when nothing changed, so\n // useSyncExternalStore doesn't re-render on no-op notifications.\n if (last !== state.active || session !== state.session) {\n state = { active: last, session };\n }\n listeners.forEach(l => l());\n };\n\n return {\n register(def) {\n const problems = validateTourDefinition(def);\n if (problems.length > 0) {\n throw new InvalidTourDefinitionError(def?.id ?? \"(no id)\", problems);\n }\n // Re-registering an id moves it to the end (becomes active), which is\n // also what React StrictMode's mount/unmount/mount needs.\n tours.delete(def.id);\n tours.set(def.id, def);\n recompute();\n return () => {\n // Only remove our own registration — if the same id was registered\n // again meanwhile, that newer one must survive this cleanup.\n if (tours.get(def.id) === def) {\n tours.delete(def.id);\n recompute();\n }\n };\n },\n open(next = { restart: true }) {\n if (!state.active) return;\n session = next;\n recompute();\n },\n close() {\n if (session === null) return;\n session = null;\n recompute();\n },\n getState: () => state,\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\n/** The store modules share by default. `TourProvider` can swap in another\n * (tests, or an app that wants isolation). */\nexport const defaultTourStore: TourStore = createTourStore();\n","/**\n * Tour progress — read/write of a user's progress through one tour, stored\n * once in Portal (`onboarding.userTourState` / `onboarding.setUserTourState`,\n * server/routers/onboarding.ts in oplytics-portal) so it follows the user\n * across every module. No module keeps its own copy and none has its own\n * table.\n *\n * Two layers, both free of React so they're testable in Node:\n * - TourProgressTransport: how progress reaches Portal. The default is a\n * plain cross-origin fetch with the session cookie, the same way every\n * module already calls `ai.askOpi` (see each app's lib/opiClient.ts).\n * - TourProgressController: the per-tour state (load, optimistic record,\n * in-order writes) the `useTourProgress` hook wraps.\n *\n * PER-TOUR STORAGE NEEDS A PORTAL CHANGE. Today Portal keeps one progress\n * row per user (the Service Hub tour) and its endpoints take no tour id.\n * This transport sends `tourId`; a Portal that supports it echoes `tourId`\n * back on reads. A Portal that does not would silently drop the field and\n * write every module's progress over the Service Hub tour's, so for any\n * tour other than the Service Hub's the transport only writes once a read\n * has proven the echo — until then reads fail (so nothing auto-opens) and\n * progress isn't persisted, but the tour itself and its header replay still\n * work. See the [Portal] Epic linked from shared-ui#106.\n */\nimport { portalUrl } from \"../services/platformDomain\";\nimport type { TourProgress, TourStatus } from \"./types\";\n\n/** The id Portal's existing, tour-id-less state belongs to. */\nexport const SERVICE_HUB_TOUR_ID = \"service-hub\";\n\nexport interface TourProgressUpdate {\n status: Exclude<TourStatus, \"unseen\">;\n lastStepId: string | null;\n}\n\nexport interface TourProgressTransport {\n read(tourId: string): Promise<TourProgress>;\n write(tourId: string, update: TourProgressUpdate): Promise<void>;\n}\n\nexport class TourProgressError extends Error {\n readonly status?: number;\n constructor(message: string, status?: number) {\n super(message);\n this.name = \"TourProgressError\";\n this.status = status;\n }\n}\n\nconst UNSEEN = (): TourProgress => ({\n status: \"unseen\",\n lastStepId: null,\n updatedAt: new Date(0).toISOString(),\n});\n\nexport interface PortalTransportOptions {\n /** Portal origin. Defaults to the platform Portal (`localhost:3000` on the\n * local sandbox) — see services/platformDomain. */\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\n/** tRPC + superjson wraps results as `{ result: { data: { json, meta? } } }`.\n * Tour progress holds only strings and null, so `json` is the value. */\nfunction unwrapTrpc<T>(body: unknown): T {\n const data = (body as { result?: { data?: { json?: T } } })?.result?.data;\n if (data === undefined || data.json === undefined) {\n throw new TourProgressError(\"Unexpected response from Portal\");\n }\n return data.json;\n}\n\nconst STATUSES: readonly TourStatus[] = [\n \"unseen\",\n \"in-progress\",\n \"done\",\n \"dismissed\",\n];\n\nexport function createPortalTourProgressTransport(\n opts: PortalTransportOptions = {}\n): TourProgressTransport {\n const doFetch: typeof fetch =\n opts.fetchImpl ?? ((input, init) => fetch(input, init));\n const base = () => (opts.baseUrl ?? portalUrl(\"\")).replace(/\\/$/, \"\");\n // undefined = not yet known; set by the first read.\n let perTourSupported: boolean | undefined;\n\n const read = async (tourId: string): Promise<TourProgress> => {\n const input = encodeURIComponent(JSON.stringify({ json: { tourId } }));\n const res = await doFetch(\n `${base()}/api/trpc/onboarding.userTourState?input=${input}`,\n { method: \"GET\", credentials: \"include\" }\n );\n if (!res.ok) {\n throw new TourProgressError(\n `Couldn't read tour progress (${res.status})`,\n res.status\n );\n }\n const json = unwrapTrpc<{\n tourId?: string;\n status?: string;\n lastStepId?: string | null;\n updatedAt?: string;\n }>(await res.json());\n\n perTourSupported = json.tourId === tourId;\n // A Portal without per-tour support answered with the Service Hub tour's\n // row — that is not this tour's progress. Report it as a failed read\n // (not \"unseen\") so callers don't auto-open the tour on every page load\n // for progress that can never be saved.\n if (tourId !== SERVICE_HUB_TOUR_ID && !perTourSupported) {\n throw new TourProgressError(\n \"Portal does not store per-tour progress yet\"\n );\n }\n\n return {\n status: STATUSES.includes(json.status as TourStatus)\n ? (json.status as TourStatus)\n : \"unseen\",\n lastStepId: json.lastStepId ?? null,\n updatedAt: json.updatedAt ?? UNSEEN().updatedAt,\n };\n };\n\n return {\n read,\n async write(tourId, update) {\n if (tourId !== SERVICE_HUB_TOUR_ID) {\n if (perTourSupported === undefined) await read(tourId);\n if (!perTourSupported) return;\n }\n const res = await doFetch(\n `${base()}/api/trpc/onboarding.setUserTourState`,\n {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ json: { tourId, ...update } }),\n }\n );\n if (!res.ok) {\n throw new TourProgressError(\n `Couldn't save tour progress (${res.status})`,\n res.status\n );\n }\n },\n };\n}\n\nexport interface TourProgressSnapshot {\n /** \"loading\" until the first read settles. A failed read is \"error\" with\n * `progress` falling back to unseen, so the tour is still usable. */\n phase: \"loading\" | \"ready\" | \"error\";\n progress: TourProgress;\n error: Error | null;\n}\n\nexport interface TourProgressController {\n getSnapshot(): TourProgressSnapshot;\n subscribe(listener: () => void): () => void;\n load(): Promise<void>;\n /** Updates local state at once, then persists. Writes go out in the order\n * they were recorded, so rapid Next clicks can't land reversed. A failed\n * write never throws — the tour must not block on storage. */\n record(update: TourProgressUpdate): Promise<void>;\n}\n\nexport function createTourProgressController(\n transport: TourProgressTransport,\n tourId: string\n): TourProgressController {\n let snapshot: TourProgressSnapshot = {\n phase: \"loading\",\n progress: UNSEEN(),\n error: null,\n };\n const listeners = new Set<() => void>();\n let writeChain: Promise<void> = Promise.resolve();\n // A write recorded before the first read lands must not be overwritten by\n // that (older) read.\n let recordedLocally = false;\n\n const set = (next: TourProgressSnapshot) => {\n snapshot = next;\n listeners.forEach(l => l());\n };\n\n return {\n getSnapshot: () => snapshot,\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n async load() {\n try {\n const progress = await transport.read(tourId);\n if (recordedLocally) return;\n set({ phase: \"ready\", progress, error: null });\n } catch (err) {\n if (recordedLocally) return;\n set({\n phase: \"error\",\n progress: UNSEEN(),\n error: err instanceof Error ? err : new Error(String(err)),\n });\n }\n },\n record(update) {\n recordedLocally = true;\n set({\n phase: snapshot.phase === \"loading\" ? \"ready\" : snapshot.phase,\n progress: { ...update, updatedAt: new Date().toISOString() },\n error: snapshot.error,\n });\n writeChain = writeChain\n .then(() => transport.write(tourId, update))\n .catch(err => {\n set({\n ...snapshot,\n error: err instanceof Error ? err : new Error(String(err)),\n });\n });\n return writeChain;\n },\n };\n}\n\n/** Whether to open the tour on its own when the module loads: only for a\n * user who has never seen it or left it part-way. Done and dismissed tours\n * only reopen from the header's \"Take the tour\". */\nexport function shouldAutoOpen(status: TourStatus): boolean {\n return status === \"unseen\" || status === \"in-progress\";\n}\n\n/** The full auto-open decision, made once when the first read settles.\n * A failed read (\"error\") never auto-opens: its fallback \"unseen\" is not\n * real, and opening on every page load for progress that can't be saved\n * would nag. */\nexport function decideAutoOpen(\n autoStart: boolean | undefined,\n snapshot: Pick<TourProgressSnapshot, \"phase\" | \"progress\">\n): boolean {\n return (\n autoStart === true &&\n snapshot.phase === \"ready\" &&\n shouldAutoOpen(snapshot.progress.status)\n );\n}\n","/**\n * Tour narration — the one call every module's tour makes to Portal's\n * `ai.askOpi`, so Opi's voice is identical everywhere.\n *\n * The persona is not defined here. Portal selects ONBOARDING_CONCIERGE_PERSONA\n * (server/routers/ai.ts) whenever `service` is the reserved value\n * \"onboarding\", and grounds it on the `insights` payload below — so a module\n * can't drift the voice, and shared-ui carries no copy of the prompt. The\n * payload keys and the user message match what Portal's own Service Hub tour\n * (UserTour.tsx) sends.\n *\n * Narration is an enhancement, never a dependency: callers render the step's\n * `fallbackText` first and treat any failure here (AI gated off, rate limit,\n * network) as \"keep the scripted text\".\n */\nimport { portalUrl } from \"../services/platformDomain\";\nimport type { TourStep } from \"./types\";\n\n/** Reserved `service` value that makes Portal use the onboarding persona. */\nexport const ONBOARDING_NARRATION_SERVICE = \"onboarding\";\n\nexport const NARRATION_PROMPT =\n \"Narrate this onboarding step for me in 2-3 sentences.\";\n\nexport interface NarrationRequestInput {\n service: typeof ONBOARDING_NARRATION_SERVICE;\n insights: {\n hook: string;\n highlights?: string[];\n features?: { name: string; detail: string }[];\n };\n messages: { role: \"user\"; content: string }[];\n}\n\nexport function buildNarrationInput(step: TourStep): NarrationRequestInput {\n return {\n service: ONBOARDING_NARRATION_SERVICE,\n insights: {\n hook: step.fallbackText,\n highlights: step.highlights,\n features: step.features,\n },\n messages: [{ role: \"user\", content: NARRATION_PROMPT }],\n };\n}\n\n/** Resolves with Opi's narration for the step, or rejects. */\nexport type TourNarrator = (step: TourStep) => Promise<string>;\n\nexport interface PortalNarratorOptions {\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\nexport function createPortalNarrator(\n opts: PortalNarratorOptions = {}\n): TourNarrator {\n const doFetch: typeof fetch =\n opts.fetchImpl ?? ((input, init) => fetch(input, init));\n return async step => {\n const base = (opts.baseUrl ?? portalUrl(\"\")).replace(/\\/$/, \"\");\n const res = await doFetch(`${base}/api/trpc/ai.askOpi`, {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ json: buildNarrationInput(step) }),\n });\n if (!res.ok) throw new Error(`Opi narration failed (${res.status})`);\n const body = (await res.json()) as {\n result?: { data?: { json?: { content?: unknown } } };\n };\n const content = body.result?.data?.json?.content;\n if (typeof content !== \"string\" || content.trim() === \"\") {\n throw new Error(\"Opi narration returned no text\");\n }\n return content;\n };\n}\n","/**\n * React binding for the shared tour architecture: the context that carries\n * the tour store, the progress transport and the narrator, and the hooks a\n * module (or the shared header/host) uses.\n *\n * Every piece has a working default, so a module needs NO provider:\n *\n * useRegisterTour(myTour); // one line, plus data-tour-target attributes\n *\n * `TourProvider` exists to override the defaults (tests, an app that needs\n * an isolated store or a different Portal origin).\n */\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\nimport {\n InvalidTourDefinitionError,\n defaultTourStore,\n type TourDefinition,\n type TourSession,\n type TourStore,\n type TourStoreState,\n} from \"./tourStore\";\nimport {\n createPortalTourProgressTransport,\n createTourProgressController,\n type TourProgressSnapshot,\n type TourProgressTransport,\n type TourProgressUpdate,\n} from \"./tourProgress\";\nimport { createPortalNarrator, type TourNarrator } from \"./tourNarration\";\n\ninterface TourContextValue {\n store: TourStore;\n transport: TourProgressTransport;\n narrator: TourNarrator;\n}\n\n// Created on first use rather than at import time, so importing the tour\n// entry point stays side-effect free (and safe during SSR).\nlet defaultTransport: TourProgressTransport | undefined;\nlet defaultNarrator: TourNarrator | undefined;\n\nconst TourContext = createContext<Partial<TourContextValue>>({});\n\nfunction useTourContext(): TourContextValue {\n const ctx = useContext(TourContext);\n return {\n store: ctx.store ?? defaultTourStore,\n // The default transport is shared app-wide: it remembers whether Portal\n // supports per-tour storage after the first read.\n transport:\n ctx.transport ??\n (defaultTransport ??= createPortalTourProgressTransport()),\n narrator: ctx.narrator ?? (defaultNarrator ??= createPortalNarrator()),\n };\n}\n\nexport interface TourProviderProps {\n store?: TourStore;\n transport?: TourProgressTransport;\n narrator?: TourNarrator;\n children: ReactNode;\n}\n\nexport function TourProvider({\n store,\n transport,\n narrator,\n children,\n}: TourProviderProps) {\n const value = useMemo(\n () => ({ store, transport, narrator }),\n [store, transport, narrator]\n );\n return <TourContext.Provider value={value}>{children}</TourContext.Provider>;\n}\n\n/**\n * Registers the module's tour for as long as the calling component is\n * mounted. That is all a module does to get the header's \"Take the tour\"\n * trigger, the overlay, saved progress and narration.\n *\n * Pass a definition that is stable across renders (module scope, or\n * useMemo) — a new object every render re-registers every render. Pass\n * null/undefined to register nothing (e.g. while data is loading). An\n * invalid definition is logged and ignored rather than thrown: a broken\n * tour must never take down the page it sits on.\n */\nexport function useRegisterTour(def: TourDefinition | null | undefined): void {\n const { store } = useTourContext();\n useEffect(() => {\n if (!def) return;\n try {\n return store.register(def);\n } catch (err) {\n if (err instanceof InvalidTourDefinitionError) {\n console.error(err.message);\n return;\n }\n throw err;\n }\n }, [store, def]);\n}\n\nexport function useTourState(): TourStoreState {\n const { store } = useTourContext();\n return useSyncExternalStore(store.subscribe, store.getState, store.getState);\n}\n\n/** The tour the header trigger would open now, or null when the current\n * module has registered none. */\nexport function useActiveTour(): TourDefinition | null {\n return useTourState().active;\n}\n\n/** Imperative open/close for the active tour — what the header trigger uses. */\nexport function useTourLauncher(): {\n /** Opens from step 1, regardless of saved progress. */\n start: () => void;\n /** Opens with an explicit session (e.g. resume from saved progress). */\n open: (session: TourSession) => void;\n close: () => void;\n available: boolean;\n} {\n const { store } = useTourContext();\n const available = useTourState().active !== null;\n return {\n start: () => store.open({ restart: true }),\n open: session => store.open(session),\n close: () => store.close(),\n available,\n };\n}\n\nexport interface UseTourProgressResult extends TourProgressSnapshot {\n record: (update: TourProgressUpdate) => Promise<void>;\n}\n\n/** The user's saved progress through one tour, read from and written to\n * Portal (see tourProgress.ts). */\nexport function useTourProgress(tourId: string): UseTourProgressResult {\n const { transport } = useTourContext();\n const controller = useMemo(\n () => createTourProgressController(transport, tourId),\n [transport, tourId]\n );\n useEffect(() => {\n void controller.load();\n }, [controller]);\n const snapshot = useSyncExternalStore(\n controller.subscribe,\n controller.getSnapshot,\n controller.getSnapshot\n );\n return { ...snapshot, record: controller.record };\n}\n\n/** The narrator the tour host uses — exposed so a module's own tour UI can\n * narrate in the same voice. */\nexport function useTourNarrator(): TourNarrator {\n return useTourContext().narrator;\n}\n","/**\n * TakeTheTourButton — the shared header's \"Take the tour\" entry.\n *\n * Renders nothing unless the current module has registered a tour (see\n * useRegisterTour), so it is safe to mount unconditionally in a shared\n * header: modules without a tour are unchanged. Clicking it opens the\n * module's tour from step 1 whatever the user's saved progress, i.e. it is\n * the \"replay on demand\" control. DashboardLayout mounts it; a module\n * with its own header can drop it in the same way.\n */\nimport { Sparkles } from \"lucide-react\";\nimport { cn } from \"../utils/cn\";\nimport { useTourLauncher } from \"./TourProvider\";\n\nexport interface TakeTheTourButtonProps {\n /** Defaults to \"Take the tour\". */\n label?: string;\n className?: string;\n}\n\nexport function TakeTheTourButton({\n label = \"Take the tour\",\n className,\n}: TakeTheTourButtonProps) {\n const { available, start } = useTourLauncher();\n if (!available) return null;\n return (\n <button\n type=\"button\"\n onClick={start}\n title={label}\n aria-label={label}\n className={cn(\n \"flex items-center gap-1 px-2 py-1 rounded-md text-[10px]\",\n \"text-[#8890A0] hover:text-[#E2E8F0] hover:bg-[#1E2738] transition-colors cursor-pointer\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[#8C34E9]\",\n className\n )}\n >\n <Sparkles className=\"h-3 w-3 text-[#8C34E9]\" />\n <span className=\"shell-hidden shell-sm:inline\">{label}</span>\n </button>\n );\n}\n","/**\n * useSpotlight — resolves a `data-tour-target` element and keeps its\n * measured rect fresh across resize/scroll/layout-shift, for TourShell's\n * spotlight render path.\n *\n * This is the DOM-touching half of the spotlight primitive; the actual\n * placement geometry is pure functions in spotlightMath.ts. This package has\n * no jsdom/@testing-library/react (see tourMachine.ts's own note on the same\n * gap), so this hook's correctness is exercised for real once a consumer\n * wires it up against real markup — see the R1 plan's step 3 manual-\n * verification checkpoint, not a unit test here.\n */\nimport { useEffect, useRef, useState } from \"react\";\nimport type { Rect } from \"./spotlightMath\";\n\nexport interface UseSpotlightResult {\n /** The target's current viewport-relative rect, or null while unresolved. */\n rect: Rect | null;\n /** False if no element in the DOM currently carries this selector —\n * callers must fall back to the non-spotlight rendering path, never\n * throw or render a spotlight around nothing. */\n found: boolean;\n}\n\nconst RESIZE_DEBOUNCE_MS = 100;\n\n/**\n * @param selector The `data-tour-target` attribute value to look for\n * (e.g. \"service-card-policy-deployment\"). Pass `null` to disable\n * resolution entirely (e.g. the current step has no spotlight).\n */\nexport function useSpotlight(selector: string | null): UseSpotlightResult {\n const [rect, setRect] = useState<Rect | null>(null);\n const [found, setFound] = useState(false);\n // Guards the one-time scroll-into-view per selector, per useSpotlight's own\n // doc comment: re-measuring on resize/scroll must never re-trigger a scroll.\n const scrolledForSelector = useRef<string | null>(null);\n\n useEffect(() => {\n if (!selector) {\n setRect(null);\n setFound(false);\n return;\n }\n\n let resizeTimer: ReturnType<typeof setTimeout> | undefined;\n let cancelled = false;\n\n const measure = () => {\n if (cancelled) return;\n const el = document.querySelector<HTMLElement>(\n `[data-tour-target=\"${selector}\"]`\n );\n if (!el) {\n setRect(null);\n setFound(false);\n return;\n }\n const domRect = el.getBoundingClientRect();\n setRect({\n top: domRect.top,\n left: domRect.left,\n width: domRect.width,\n height: domRect.height,\n });\n setFound(true);\n\n if (scrolledForSelector.current !== selector) {\n scrolledForSelector.current = selector;\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n }\n };\n\n // Initial measure. A freshly-mounted target may not have painted yet on\n // the very first tick (e.g. right after the tour opens) — one microtask\n // deferral covers that without a fixed arbitrary delay.\n measure();\n const initialFrame = requestAnimationFrame(measure);\n\n const onResize = () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(measure, RESIZE_DEBOUNCE_MS);\n };\n // Capture phase: catches scroll on any ancestor scroll container, not\n // just document-level scroll (document-level is what ServiceHub.tsx\n // actually uses today, per the R1 plan's grounding, but capture-phase\n // costs nothing extra and keeps this hook correct if that changes).\n const onScroll = () => measure();\n\n window.addEventListener(\"resize\", onResize);\n window.addEventListener(\"scroll\", onScroll, { capture: true });\n\n // Layout shifts with no resize/scroll event — e.g. a conditionally\n // rendered sibling card appearing above the target, or the target\n // itself not existing yet at mount (e.g. the tour opened before\n // ServiceHub's card grid finished loading its services query) and\n // appearing moments later. Observing document.body rather than the\n // target's own (possibly not-yet-existent) parent means both cases are\n // covered by the same subscription with no race between \"did the\n // target exist when we looked\" and \"attach the observer\" — `measure`\n // itself is what re-checks `found` on every mutation, so a target that\n // doesn't exist yet is simply re-resolved the moment it does.\n const observer = new MutationObserver(measure);\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n\n return () => {\n cancelled = true;\n cancelAnimationFrame(initialFrame);\n if (resizeTimer) clearTimeout(resizeTimer);\n window.removeEventListener(\"resize\", onResize);\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n observer?.disconnect();\n };\n }, [selector]);\n\n return { rect, found };\n}\n","/**\n * Pure geometry behind the spotlight rendering mode — no React, no DOM\n * access, just numbers in and numbers out. Factored out so it's testable\n * without jsdom (this package has none — see tourMachine.ts for the same\n * split/precedent on the step-index state machine).\n *\n * TourShell is the consumer: given a target element's measured rect (from\n * useSpotlight.ts) and the current viewport size, it needs to know (a) the\n * four backdrop-frame rectangles that surround the target without ever\n * covering it, and (b) where to place the explanation panel so it doesn't\n * overflow the viewport, honoring a preferred placement when there's room.\n */\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport type Placement = \"top\" | \"bottom\" | \"left\" | \"right\" | \"auto\";\n\n/** The four backdrop segments that frame a target rect without covering it.\n * Each is a plain rect in viewport (fixed-position) coordinates. A segment\n * with zero width or height (e.g. the target touches a viewport edge) is\n * still returned — the caller can skip rendering a degenerate rect, but\n * the geometry itself doesn't special-case it. */\nexport interface SpotlightFrame {\n top: Rect;\n bottom: Rect;\n left: Rect;\n right: Rect;\n}\n\n/** Frames `target` within a `viewport` sized 0,0 to width,height. */\nexport function computeSpotlightFrame(\n target: Rect,\n viewport: Size\n): SpotlightFrame {\n const targetBottom = target.top + target.height;\n const targetRight = target.left + target.width;\n\n return {\n // Full-width strip above the target.\n top: {\n top: 0,\n left: 0,\n width: viewport.width,\n height: Math.max(0, target.top),\n },\n // Full-width strip below the target.\n bottom: {\n top: targetBottom,\n left: 0,\n width: viewport.width,\n height: Math.max(0, viewport.height - targetBottom),\n },\n // Strip to the left of the target, spanning only the target's own row\n // (the top/bottom strips already cover the rest of those rows).\n left: {\n top: target.top,\n left: 0,\n width: Math.max(0, target.left),\n height: target.height,\n },\n // Strip to the right of the target, same row-only span as `left`.\n right: {\n top: target.top,\n left: targetRight,\n width: Math.max(0, viewport.width - targetRight),\n height: target.height,\n },\n };\n}\n\ntype ConcretePlacement = Exclude<Placement, \"auto\">;\n\nconst FALLBACK_ORDER: Record<ConcretePlacement, ConcretePlacement[]> = {\n bottom: [\"bottom\", \"top\", \"right\", \"left\"],\n top: [\"top\", \"bottom\", \"right\", \"left\"],\n right: [\"right\", \"left\", \"bottom\", \"top\"],\n left: [\"left\", \"right\", \"bottom\", \"top\"],\n};\n// \"auto\" tries the same order as the default \"bottom\" preference.\nconst AUTO_ORDER: ConcretePlacement[] = FALLBACK_ORDER.bottom;\n\nconst PANEL_GAP = 12;\n\nexport interface PanelPosition {\n top: number;\n left: number;\n placement: ConcretePlacement;\n}\n\n/**\n * Where to place a panel of `panelSize` next to `target`, preferring\n * `placement` but falling back through the other three sides (then finally\n * clamping into the viewport) if the preferred side doesn't have room.\n */\nexport function computePanelPosition(\n target: Rect,\n panelSize: Size,\n viewport: Size,\n placement: Placement = \"auto\"\n): PanelPosition {\n const order = placement === \"auto\" ? AUTO_ORDER : FALLBACK_ORDER[placement];\n\n for (const candidate of order) {\n const pos = placeAt(candidate, target, panelSize);\n if (fits(pos, panelSize, viewport)) {\n return { ...pos, placement: candidate };\n }\n }\n\n // Nothing fit cleanly (a very small viewport, or a target close to every\n // edge at once) — fall back to the first candidate's position, clamped\n // into the viewport rather than left overflowing.\n const fallback = order[0];\n const pos = placeAt(fallback, target, panelSize);\n return {\n top: clamp(pos.top, 0, Math.max(0, viewport.height - panelSize.height)),\n left: clamp(pos.left, 0, Math.max(0, viewport.width - panelSize.width)),\n placement: fallback,\n };\n}\n\nfunction placeAt(\n side: ConcretePlacement,\n target: Rect,\n panelSize: Size\n): { top: number; left: number } {\n const targetCenterX = target.left + target.width / 2;\n const targetCenterY = target.top + target.height / 2;\n\n switch (side) {\n case \"bottom\":\n return {\n top: target.top + target.height + PANEL_GAP,\n left: targetCenterX - panelSize.width / 2,\n };\n case \"top\":\n return {\n top: target.top - panelSize.height - PANEL_GAP,\n left: targetCenterX - panelSize.width / 2,\n };\n case \"right\":\n return {\n top: targetCenterY - panelSize.height / 2,\n left: target.left + target.width + PANEL_GAP,\n };\n case \"left\":\n return {\n top: targetCenterY - panelSize.height / 2,\n left: target.left - panelSize.width - PANEL_GAP,\n };\n }\n}\n\nfunction fits(\n pos: { top: number; left: number },\n panelSize: Size,\n viewport: Size\n): boolean {\n return (\n pos.top >= 0 &&\n pos.left >= 0 &&\n pos.top + panelSize.height <= viewport.height &&\n pos.left + panelSize.width <= viewport.width\n );\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n","/**\n * TourShell — the Opi onboarding tour overlay chrome.\n *\n * Deliberately shell-only, same split as OpiInsightsShell: this owns the\n * overlay, orb, narration area, step dots, and Back/Next/Skip controls.\n * The consumer (Portal) owns the step list, narration fetching (falling\n * back to the step's scripted text), and persistence. Hand-rolled overlay\n * (no Radix Dialog) to stay dependency-free, matching OpiInsightsShell's\n * own precedent rather than pulling in /primitives.\n *\n * Two render modes, chosen automatically per step:\n * - Centered modal (original, unchanged) — used for intro/outro steps, any\n * \"service\" step authored without `step.spotlight`, and as the fallback\n * when a spotlight target can't be resolved on the page at all.\n * - Spotlight — used when `step.spotlight` is present AND useSpotlight\n * resolves a real element for it. The backdrop is drawn as four\n * rectangles framing the target (never a single element covering it),\n * so the real page element underneath stays exactly as clickable,\n * hoverable, and focusable as it already was — no coordination needed\n * with whatever onClick the consumer's own element already has. See\n * spotlightMath.ts for the geometry and useSpotlight.ts for the DOM\n * measurement this mode is built on.\n */\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport {\n X,\n ChevronLeft,\n ChevronRight,\n ArrowRight,\n ExternalLink,\n} from \"lucide-react\";\nimport type { TourStep } from \"./types\";\nimport { useSpotlight } from \"./useSpotlight\";\nimport { computeSpotlightFrame, computePanelPosition } from \"./spotlightMath\";\n\nexport interface TourShellSkin {\n accent: string;\n overlayBg: string;\n panelBg: string;\n panelBorder: string;\n mutedText: string;\n bodyText: string;\n softText: string;\n}\n\nconst defaultSkin: TourShellSkin = {\n accent: \"#8C34E9\",\n overlayBg: \"rgba(10,14,26,0.72)\",\n panelBg: \"#0e1624\",\n panelBorder: \"1px solid #1e2738\",\n mutedText: \"#596475\",\n bodyText: \"#c0c6d0\",\n softText: \"#8890a0\",\n};\n\n/** Panel size assumed for spotlight placement math — the spotlight panel is\n * narrower/shorter than the centered modal's max-w-md, since it sits next\n * to a card rather than owning the whole screen. Kept as a constant (not\n * measured live via ref) because spotlightMath needs a size up front to\n * compute placement before the panel has painted — the panel's own CSS\n * width/height below must match this or the two drift apart. */\nconst SPOTLIGHT_PANEL_SIZE = { width: 320, height: 280 };\n\nexport interface TourShellProps {\n step: TourStep;\n index: number;\n total: number;\n isFirst: boolean;\n isLast: boolean;\n onNext: () => void;\n onBack: () => void;\n onDismiss: () => void;\n /** Narration to render — pass the live AI reply once resolved; while\n * pending or on failure, pass `step.fallbackText` so the tour never\n * shows a blank state. */\n narration: string;\n /** True while an AI narration pass is in flight — shows a subtle pulse, never blocks Next. */\n narrationPending?: boolean;\n /** Rendered below the narration/highlights — e.g. a docked OpiAskBar. */\n children?: ReactNode;\n skin?: TourShellSkin;\n /** Orb / avatar mark shown in the header — pass OpiOrb from the consumer. */\n orb?: ReactNode;\n /**\n * Fires when the user activates the spotlighted element itself (a\n * document-level capture-phase listener scoped to the resolved target —\n * see useSpotlight.ts), alongside — never instead of — whatever the\n * consumer's own element does on click. Only meaningful when the current\n * step has `spotlight` and a target was found; ignored otherwise. Opt-in\n * per step via the consumer wiring it up, not a built-in auto-advance —\n * a later in-app spotlight (inside a subdomain) may want \"just look\n * here,\" no navigation expected.\n */\n onSpotlightTargetActivated?: () => void;\n}\n\n/**\n * Full-viewport dismissible overlay. Esc always dismisses. In centered\n * mode, clicking the backdrop dismisses too; in spotlight mode, each of the\n * four backdrop segments independently dismisses on click, same behavior,\n * just split across four elements instead of one.\n */\nexport function TourShell({\n step,\n index,\n total,\n isFirst,\n isLast,\n onNext,\n onBack,\n onDismiss,\n narration,\n narrationPending,\n children,\n skin = defaultSkin,\n orb,\n onSpotlightTargetActivated,\n}: TourShellProps) {\n const panelRef = useRef<HTMLDivElement>(null);\n const { rect, found } = useSpotlight(step.spotlight?.selector ?? null);\n const isSpotlight = Boolean(step.spotlight) && found && rect !== null;\n\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onDismiss();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [onDismiss]);\n\n useEffect(() => {\n panelRef.current?.focus();\n }, [step.id]);\n\n // Document-level capture listener for onSpotlightTargetActivated — fires\n // alongside the target's own click handling (never stopPropagation'd),\n // so it never fights whatever onClick the consumer's element already has.\n useEffect(() => {\n if (!isSpotlight || !onSpotlightTargetActivated || !step.spotlight) return;\n const selector = step.spotlight.selector;\n const onClickCapture = (e: MouseEvent) => {\n const target = e.target as Element | null;\n if (target?.closest(`[data-tour-target=\"${selector}\"]`)) {\n onSpotlightTargetActivated();\n }\n };\n document.addEventListener(\"click\", onClickCapture, { capture: true });\n return () =>\n document.removeEventListener(\"click\", onClickCapture, {\n capture: true,\n });\n }, [isSpotlight, onSpotlightTargetActivated, step.spotlight]);\n\n if (isSpotlight && rect) {\n const viewport = { width: window.innerWidth, height: window.innerHeight };\n const frame = computeSpotlightFrame(rect, viewport);\n const panelPos = computePanelPosition(\n rect,\n SPOTLIGHT_PANEL_SIZE,\n viewport,\n step.spotlight?.placement ?? \"auto\"\n );\n\n return (\n <>\n {([\"top\", \"bottom\", \"left\", \"right\"] as const).map(side => {\n const segment = frame[side];\n if (segment.width <= 0 || segment.height <= 0) return null;\n return (\n <div\n key={side}\n className=\"fixed z-50\"\n style={{\n top: segment.top,\n left: segment.left,\n width: segment.width,\n height: segment.height,\n background: skin.overlayBg,\n }}\n onClick={onDismiss}\n />\n );\n })}\n {/* Ring around the target — never covers it, pointer-events none so\n it can't intercept the click meant for the real element. */}\n <div\n className=\"fixed z-50 rounded-xl pointer-events-none transition-all\"\n style={{\n top: rect.top - 4,\n left: rect.left - 4,\n width: rect.width + 8,\n height: rect.height + 8,\n boxShadow: `0 0 0 2px ${skin.accent}, 0 0 24px 4px ${skin.accent}66`,\n }}\n />\n <div\n ref={panelRef}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.label}\n className=\"fixed z-50 rounded-xl overflow-hidden flex flex-col outline-none\"\n style={{\n top: panelPos.top,\n left: panelPos.left,\n width: SPOTLIGHT_PANEL_SIZE.width,\n maxHeight: SPOTLIGHT_PANEL_SIZE.height,\n background: skin.panelBg,\n border: skin.panelBorder,\n }}\n >\n <TourShellHeader step={step} orb={orb} onDismiss={onDismiss} />\n <TourShellStepDots total={total} index={index} skin={skin} />\n <div className=\"overflow-y-auto px-4 py-3 space-y-3\">\n <TourShellBody\n step={step}\n narration={narration}\n narrationPending={narrationPending}\n skin={skin}\n children={children}\n />\n </div>\n <TourShellFooter\n isFirst={isFirst}\n isLast={isLast}\n onNext={onNext}\n onBack={onBack}\n onDismiss={onDismiss}\n skin={skin}\n />\n </div>\n </>\n );\n }\n\n return (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center p-4\"\n style={{ background: skin.overlayBg }}\n onClick={e => {\n if (e.target === e.currentTarget) onDismiss();\n }}\n >\n <div\n ref={panelRef}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.label}\n className=\"w-full max-w-md rounded-xl overflow-hidden flex flex-col max-h-[85vh] outline-none\"\n style={{ background: skin.panelBg, border: skin.panelBorder }}\n >\n <TourShellHeader step={step} orb={orb} onDismiss={onDismiss} />\n <TourShellStepDots total={total} index={index} skin={skin} />\n <div className=\"overflow-y-auto px-5 py-4 space-y-4\">\n <TourShellBody\n step={step}\n narration={narration}\n narrationPending={narrationPending}\n skin={skin}\n children={children}\n />\n </div>\n <TourShellFooter\n isFirst={isFirst}\n isLast={isLast}\n onNext={onNext}\n onBack={onBack}\n onDismiss={onDismiss}\n skin={skin}\n />\n </div>\n </div>\n );\n}\n\nfunction TourShellHeader({\n step,\n orb,\n onDismiss,\n}: {\n step: TourStep;\n orb: ReactNode;\n onDismiss: () => void;\n}) {\n return (\n <div\n className=\"flex items-center justify-between gap-3 px-5 py-4 shrink-0\"\n style={{\n background: \"linear-gradient(135deg, #2a1450 0%, #1a0e33 100%)\",\n }}\n >\n <div className=\"flex items-center gap-2.5 min-w-0\">\n {orb}\n <span className=\"text-sm font-bold text-white truncate\">\n {step.label}\n </span>\n </div>\n <button\n onClick={onDismiss}\n className=\"p-1 rounded hover:bg-white/10 transition-colors shrink-0\"\n title=\"Skip tour\"\n >\n <X size={16} className=\"text-white/70\" />\n </button>\n </div>\n );\n}\n\nfunction TourShellStepDots({\n total,\n index,\n skin,\n}: {\n total: number;\n index: number;\n skin: TourShellSkin;\n}) {\n return (\n <div\n className=\"flex items-center gap-1.5 px-5 py-3 shrink-0\"\n style={{ borderBottom: skin.panelBorder }}\n >\n {Array.from({ length: total }, (_, i) => (\n <span\n key={i}\n className=\"h-1.5 rounded-full transition-all\"\n style={{\n width: i === index ? 20 : 8,\n background: i === index ? skin.accent : skin.mutedText,\n opacity: i === index ? 1 : 0.4,\n }}\n />\n ))}\n </div>\n );\n}\n\nfunction TourShellBody({\n step,\n narration,\n narrationPending,\n skin,\n children,\n}: {\n step: TourStep;\n narration: string;\n narrationPending?: boolean;\n skin: TourShellSkin;\n children?: ReactNode;\n}) {\n return (\n <>\n <p\n className=\"text-[13px] leading-relaxed transition-opacity\"\n style={{\n color: skin.bodyText,\n opacity: narrationPending ? 0.7 : 1,\n }}\n >\n {narration}\n </p>\n\n {step.features && step.features.length > 0 ? (\n <ul className=\"space-y-2\">\n {step.features.map((f, i) => (\n <li key={i} className=\"text-[12.5px] leading-relaxed\">\n <span className=\"font-semibold\" style={{ color: skin.accent }}>\n {f.name}\n </span>\n <span style={{ color: skin.softText }}> — {f.detail}</span>\n </li>\n ))}\n </ul>\n ) : (\n step.highlights &&\n step.highlights.length > 0 && (\n <ul className=\"space-y-1.5\">\n {step.highlights.map((h, i) => (\n <li\n key={i}\n className=\"text-[12.5px] leading-relaxed pl-3 relative\"\n style={{ color: skin.softText }}\n >\n <span\n className=\"absolute left-0\"\n style={{ color: skin.mutedText }}\n >\n •\n </span>\n {h}\n </li>\n ))}\n </ul>\n )\n )}\n\n {step.action && (\n <a\n href={step.action.href}\n target={step.action.external ? \"_blank\" : undefined}\n rel={step.action.external ? \"noopener noreferrer\" : undefined}\n className=\"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-[13px] font-semibold transition-opacity hover:opacity-90\"\n style={{ background: `${skin.accent}20`, color: skin.accent }}\n >\n {step.action.label}\n {step.action.external ? (\n <ExternalLink size={13} />\n ) : (\n <ArrowRight size={13} />\n )}\n </a>\n )}\n\n {children}\n </>\n );\n}\n\nfunction TourShellFooter({\n isFirst,\n isLast,\n onNext,\n onBack,\n onDismiss,\n skin,\n}: {\n isFirst: boolean;\n isLast: boolean;\n onNext: () => void;\n onBack: () => void;\n onDismiss: () => void;\n skin: TourShellSkin;\n}) {\n return (\n <div\n className=\"flex items-center justify-between gap-2 px-5 py-3.5 shrink-0\"\n style={{ borderTop: skin.panelBorder }}\n >\n <button\n onClick={onDismiss}\n className=\"text-[12px] font-medium transition-colors hover:underline\"\n style={{ color: skin.mutedText }}\n >\n Skip tour\n </button>\n <div className=\"flex items-center gap-2\">\n {!isFirst && (\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 px-3 py-1.5 rounded-md text-[12.5px] font-medium transition-colors\"\n style={{ color: skin.bodyText, border: skin.panelBorder }}\n >\n <ChevronLeft size={13} />\n Back\n </button>\n )}\n <button\n onClick={onNext}\n className=\"flex items-center gap-1 px-3.5 py-1.5 rounded-md text-[12.5px] font-bold text-white transition-opacity hover:opacity-90\"\n style={{\n background: \"linear-gradient(135deg, #8C34E9 0%, #5B1FA6 100%)\",\n }}\n >\n {isLast ? \"Done\" : \"Next\"}\n {!isLast && <ChevronRight size={13} />}\n </button>\n </div>\n </div>\n );\n}\n","/**\n * useTour — pure step-index state machine for the onboarding tour.\n *\n * Deliberately dumb: it doesn't fetch steps, doesn't call any AI endpoint,\n * doesn't persist anything itself. The consumer (Portal) owns all of that\n * and is told about every state change via the on* callbacks so it can\n * write to user_settings however it likes. See OpiInsightsShell for the\n * same shell-owns-chrome/consumer-owns-data split.\n *\n * The actual transitions live in tourMachine.ts as plain functions (no\n * React import) so they're testable without a DOM renderer — this package\n * has no jsdom/@testing-library/react set up (see src/hooks/hooks.test.ts).\n * This file is just the useState wrapper around them.\n */\nimport { useCallback, useState } from \"react\";\nimport type { TourStep } from \"./types\";\nimport {\n backIndex,\n gotoIndex,\n nextIndex,\n resolveInitialIndex,\n} from \"./tourMachine\";\n\nexport interface UseTourOptions {\n /** Called whenever the current step changes (not on initial mount). */\n onStepChange?: (step: TourStep, index: number) => void;\n /** Called once when the user reaches the last step and advances past it. */\n onComplete?: () => void;\n /** Called when the user dismisses the tour before completion. */\n onDismiss?: () => void;\n /** Step id to resume on, if the tour was already in progress. */\n initialStepId?: string | null;\n}\n\nexport interface UseTourResult {\n step: TourStep;\n index: number;\n total: number;\n isFirst: boolean;\n isLast: boolean;\n next: () => void;\n back: () => void;\n goto: (stepId: string) => void;\n dismiss: () => void;\n}\n\nexport function useTour(\n steps: TourStep[],\n opts: UseTourOptions = {}\n): UseTourResult {\n if (steps.length === 0) {\n throw new Error(\"useTour requires at least one step\");\n }\n\n const [index, setIndex] = useState(() =>\n resolveInitialIndex(steps, opts.initialStepId)\n );\n\n const next = useCallback(() => {\n const result = nextIndex(steps, index);\n if (result.completed) {\n opts.onComplete?.();\n return;\n }\n setIndex(result.index);\n opts.onStepChange?.(steps[result.index], result.index);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- opts callbacks read fresh via closure; steps identity is expected stable per mount\n }, [index, steps]);\n\n const back = useCallback(() => {\n const target = backIndex(index);\n if (target === index) return;\n setIndex(target);\n opts.onStepChange?.(steps[target], target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [index, steps]);\n\n const goto = useCallback(\n (stepId: string) => {\n const target = gotoIndex(steps, stepId, index);\n if (target === index) return;\n setIndex(target);\n opts.onStepChange?.(steps[target], target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n },\n [steps, index]\n );\n\n const dismiss = useCallback(() => {\n opts.onDismiss?.();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n step: steps[index],\n index,\n total: steps.length,\n isFirst: index === 0,\n isLast: index === steps.length - 1,\n next,\n back,\n goto,\n dismiss,\n };\n}\n","/**\n * Pure step-index transitions behind useTour — factored out so the actual\n * state machine logic is testable in a plain Node environment, without a\n * React renderer (this package has no jsdom/@testing-library/react set up;\n * see src/hooks/hooks.test.ts's note on the same limitation). useTour.ts is\n * the thin useState wrapper; this file has no React import at all.\n */\nimport type { TourStep } from \"./types\";\n\nexport interface TourMachineResult {\n index: number;\n /** True if this call reached the end and should fire onComplete instead of moving. */\n completed: boolean;\n}\n\nexport function resolveInitialIndex(\n steps: TourStep[],\n initialStepId: string | null | undefined\n): number {\n if (!initialStepId) return 0;\n const found = steps.findIndex(s => s.id === initialStepId);\n return found === -1 ? 0 : found;\n}\n\nexport function nextIndex(\n steps: TourStep[],\n current: number\n): TourMachineResult {\n if (current >= steps.length - 1) {\n return { index: current, completed: true };\n }\n return { index: current + 1, completed: false };\n}\n\nexport function backIndex(current: number): number {\n return Math.max(0, current - 1);\n}\n\nexport function gotoIndex(\n steps: TourStep[],\n stepId: string,\n current: number\n): number {\n const target = steps.findIndex(s => s.id === stepId);\n return target === -1 ? current : target;\n}\n","/**\n * OpiTourHost — runs the active tour: loads the user's saved progress from\n * Portal, shows TourShell when the tour is opened (by the header's\n * \"Take the tour\", or on its own when the definition sets `autoStart`), narrates each step in\n * Opi's voice, and records progress as the user moves.\n *\n * Mounted once by DashboardLayout — modules don't mount their own (two hosts\n * would stack two overlays); renders nothing while the module has no\n * registered tour. Same behaviour as Portal's Service Hub tour (UserTour):\n * scripted text first with live narration replacing it when it arrives,\n * resume from the last step on auto-open, restart from step 1 on replay.\n *\n * The inner runner is mounted only once progress has loaded, because\n * useTour reads `initialStepId` at mount and would otherwise lock onto\n * step 1 whatever the saved progress says.\n */\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Sparkles } from \"lucide-react\";\nimport { TourShell, type TourShellSkin } from \"./TourShell\";\nimport { useTour } from \"./useTour\";\nimport {\n useTourProgress,\n useTourNarrator,\n useTourState,\n useTourLauncher,\n} from \"./TourProvider\";\nimport { decideAutoOpen, type TourProgressUpdate } from \"./tourProgress\";\nimport type { TourDefinition } from \"./tourStore\";\nimport type { TourStep } from \"./types\";\n\nexport interface OpiTourHostProps {\n /** Orb/avatar shown in the tour header. Defaults to a plain mark. */\n orb?: ReactNode;\n skin?: TourShellSkin;\n}\n\nexport function OpiTourHost(props: OpiTourHostProps) {\n const { active } = useTourState();\n if (!active) return null;\n // Keyed by id so moving between pages with different tours starts clean.\n return <ActiveTourHost key={active.id} tour={active} {...props} />;\n}\n\nfunction ActiveTourHost({\n tour,\n orb,\n skin,\n}: OpiTourHostProps & { tour: TourDefinition }) {\n const { session } = useTourState();\n const { open } = useTourLauncher();\n const { phase, progress, record } = useTourProgress(tour.id);\n\n // Decide once, when the first read settles, whether to open by itself.\n const decided = useRef(false);\n useEffect(() => {\n if (phase === \"loading\" || decided.current) return;\n decided.current = true;\n if (decideAutoOpen(tour.autoStart, { phase, progress })) {\n open({ restart: false });\n }\n }, [phase, progress, tour.autoStart, open]);\n\n if (!session || phase === \"loading\") return null;\n\n return (\n <TourRunner\n steps={tour.steps}\n initialStepId={session.restart ? null : progress.lastStepId}\n onProgress={record}\n orb={orb ?? <DefaultOrb />}\n skin={skin}\n />\n );\n}\n\nfunction DefaultOrb() {\n return (\n <span\n className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-full\"\n style={{\n background: \"linear-gradient(135deg, #8C34E9 0%, #5B1FA6 100%)\",\n }}\n >\n <Sparkles className=\"h-4 w-4 text-white\" />\n </span>\n );\n}\n\nfunction TourRunner({\n steps,\n initialStepId,\n onProgress,\n orb,\n skin,\n}: {\n steps: TourStep[];\n initialStepId: string | null;\n onProgress: (update: TourProgressUpdate) => Promise<void>;\n orb: ReactNode;\n skin?: TourShellSkin;\n}) {\n const { close } = useTourLauncher();\n const narrate = useTourNarrator();\n const [narrationByStep, setNarrationByStep] = useState<\n Record<string, string>\n >({});\n const [pendingStepId, setPendingStepId] = useState<string | null>(null);\n const requested = useRef(new Set<string>());\n // useTour keeps the opts it was first given for `dismiss`, so read the\n // current step from a ref rather than from `tour` inside onDismiss.\n const currentStepId = useRef(\n steps.find(s => s.id === initialStepId)?.id ?? steps[0].id\n );\n\n const requestNarration = (step: TourStep) => {\n if (requested.current.has(step.id)) return;\n requested.current.add(step.id);\n setPendingStepId(step.id);\n narrate(step)\n .then(text => setNarrationByStep(prev => ({ ...prev, [step.id]: text })))\n // Any failure (AI gated off, rate limit, offline) just leaves the\n // scripted text in place — the tour never needs to say why.\n .catch(() => {})\n .finally(() => setPendingStepId(cur => (cur === step.id ? null : cur)));\n };\n\n const tour = useTour(steps, {\n initialStepId,\n onStepChange: step => {\n currentStepId.current = step.id;\n void onProgress({ status: \"in-progress\", lastStepId: step.id });\n requestNarration(step);\n },\n onComplete: () => {\n void onProgress({ status: \"done\", lastStepId: null });\n close();\n },\n onDismiss: () => {\n void onProgress({\n status: \"dismissed\",\n lastStepId: currentStepId.current,\n });\n close();\n },\n });\n\n // onStepChange only fires on moves, so narrate the step the tour opens on.\n // Progress is deliberately not recorded here: peeking at a replay must not\n // turn a finished tour back into \"in progress\".\n useEffect(() => {\n requestNarration(tour.step);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- once per open\n }, []);\n\n return (\n <TourShell\n step={tour.step}\n index={tour.index}\n total={tour.total}\n isFirst={tour.isFirst}\n isLast={tour.isLast}\n onNext={tour.next}\n onBack={tour.back}\n onDismiss={tour.dismiss}\n narration={narrationByStep[tour.step.id] ?? tour.step.fallbackText}\n narrationPending={pendingStepId === tour.step.id}\n orb={orb}\n skin={skin}\n />\n );\n}\n"],"mappings":";;;;;;;;AAkBA,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB;AAC3B,IAAM,kBAAkB;AACxB,IAAM,aAAsC,CAAC,SAAS,WAAW,OAAO;AAkBjE,IAAM,6BAAN,cAAyC,MAAM;AAAA,EAC3C;AAAA,EACT,YAAY,QAAgB,UAAoB;AAC9C,UAAM,4BAA4B,MAAM,MAAM,SAAS,KAAK,IAAI,CAAC,EAAE;AACnE,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;AAGO,SAAS,uBAAuB,KAA+B;AACpE,QAAM,WAAqB,CAAC;AAE5B,MAAI,OAAO,IAAI,OAAO,YAAY,IAAI,GAAG,WAAW,GAAG;AACrD,aAAS,KAAK,gBAAgB;AAAA,EAChC,OAAO;AACL,QAAI,IAAI,GAAG,SAAS,oBAAoB;AACtC,eAAS,KAAK,qBAAqB,kBAAkB,aAAa;AAAA,IACpE;AACA,QAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE,GAAG;AACjC,eAAS,KAAK,kDAAkD;AAAA,IAClE;AAAA,EACF;AAEA,MAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,KAAK,IAAI,MAAM,WAAW,GAAG;AACvD,aAAS,KAAK,+BAA+B;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,oBAAI,IAAY;AAC7B,MAAI,MAAM,QAAQ,CAAC,MAAM,MAAM;AAC7B,UAAM,KAAK,QAAQ,IAAI,CAAC;AACxB,QAAI,CAAC,KAAK,IAAI;AACZ,eAAS,KAAK,GAAG,EAAE,YAAY;AA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AS,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,EAGvE,MAAM,MAAM;AAAA,IAAC,CAAC,EACd,QAAQ,MAAM,iBAAiB,SAAQ,QAAQ,KAAK,KAAK,OAAO,GAAI,CAAC;AAAA,EAC1E;AAEA,QAAM,OAAO,QAAQ,OAAO;AAAA,IAC1B;AAAA,IACA,cAAc,UAAQ;AACpB,oBAAc,UAAU,KAAK;AAC7B,WAAK,WAAW,EAAE,QAAQ,eAAe,YAAY,KAAK,GAAG,CAAC;AAC9D,uBAAiB,IAAI;AAAA,IACvB;AAAA,IACA,YAAY,MAAM;AAChB,WAAK,WAAW,EAAE,QAAQ,QAAQ,YAAY,KAAK,CAAC;AACpD,YAAM;AAAA,IACR;AAAA,IACA,WAAW,MAAM;AACf,WAAK,WAAW;AAAA,QACd,QAAQ;AAAA,QACR,YAAY,cAAc;AAAA,MAC5B,CAAC;AACD,YAAM;AAAA,IACR;AAAA,EACF,CAAC;AAKD,EAAAC,WAAU,MAAM;AACd,qBAAiB,KAAK,IAAI;AAAA,EAE5B,GAAG,CAAC,CAAC;AAEL,SACE,gBAAAF;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,KAAK;AAAA,MACX,OAAO,KAAK;AAAA,MACZ,OAAO,KAAK;AAAA,MACZ,SAAS,KAAK;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,WAAW,KAAK;AAAA,MAChB,WAAW,gBAAgB,KAAK,KAAK,EAAE,KAAK,KAAK,KAAK;AAAA,MACtD,kBAAkB,kBAAkB,KAAK,KAAK;AAAA,MAC9C;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["jsx","useEffect","pos","useEffect","useRef","jsx","jsxs","useRef","useEffect","useState","useState","useEffect","useRef","useState","Sparkles","jsx","useRef","useEffect","Sparkles","useState"]}
|
|
File without changes
|