@fayz-ai/plugin-getting-started 0.2.0-canary.20261028153856 → 0.2.0
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-IDU6T6QU.js → chunk-4ATBLO6S.js} +18 -12
- package/dist/chunk-4ATBLO6S.js.map +1 -0
- package/dist/data/mock.d.ts +2 -2
- package/dist/data/mock.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/host.js +2 -2
- package/dist/index.js +2 -2
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +2 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +249 -2
- package/dist/migrations/main.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-IDU6T6QU.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts","../src/types.ts","../src/lib/journey-steps.ts","../src/lib/tour.ts","../src/store.ts","../src/context.tsx","../src/data/types.ts","../src/data/tables.ts","../src/data/supabase.ts","../src/data/mock.ts","../src/lib/store-settings.ts","../src/lib/store-profile.ts","../src/lib/agent-tools.ts","../src/lib/program.ts","../src/lib/trial-source-bridge.ts","../src/components/ProgressRing.tsx","../src/components/StartTrialAction.tsx","../src/components/StartTrialCta.tsx","../src/lib/trial-clock.ts","../src/components/TrialEndBanner.tsx","../src/components/RequestContractLink.tsx","../src/components/StoreLiveCard.tsx","../src/settings/TrialSettingsTab.tsx","../src/locales/en.ts","../src/locales/pt-BR.ts","../src/locales/index.ts"],"names":["key","React","keys","usePluginRuntimeOptional","React2","create","emitDomainEvent","React3","message","code","getActiveTenantId","useOrganizationStore","getSupabaseClientOptional","text","normalizePaymentMethods","PAYMENT_METHOD_IDS","jsx","DAY_MS","React4","useActivationStore","route","jsxs","cn","useTranslation","Fragment","Button","journeySteps","adminNavigateTo","Check","getCurrentLocale","useSdkPermission","SDK_PERMISSIONS","React6","React7","React8","tl","Rocket","fireConfetti","toast","ConfirmDialog","normalizeHours","isHoursValue","React9","AlertTriangle","rows","Lock","Clock","Compass","Circle"],"mappings":";;;;;;;;;;;AA+DO,IAAM,kBAAA,GAAqB,EAAA;AAC3B,IAAM,WAAA,GAAc,iBAAA;AACpB,IAAM,kBAAA,GAAqB,wBAAA;AAC3B,IAAM,UAAA,GAAa,GAAA;AAEnB,IAAM,cAAA,GAA2D,OAAO,MAAA,CAAO;AAAA,EACpF,IAAA,EAAM,UAAA;AAAA,EACN,KAAA,EAAO,WAAA;AAAA,EACP,YAAA,EAAc;AAChB,CAAC;AAED,IAAM,KAAA,GAAQ,CAAC,KAAA,EAAgB,QAAA,KAC7B,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,IAAA,EAAK,CAAE,MAAA,GAAS,CAAA,GAAI,KAAA,CAAM,MAAK,GAAI,QAAA;AAEjE,SAAS,cAAc,MAAA,EAA+D;AAC3F,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,KAAA,CAAM,MAAA,EAAQ,IAAA,EAAM,eAAe,IAAI,CAAA;AAAA,IAC7C,KAAA,EAAO,KAAA,CAAM,MAAA,EAAQ,KAAA,EAAO,eAAe,KAAK,CAAA;AAAA,IAChD,YAAA,EAAc,KAAA,CAAM,MAAA,EAAQ,YAAA,EAAc,eAAe,YAAY;AAAA,GACvE;AACF;AAEA,IAAM,IAAA,GAAO,CAAC,IAAA,KACZ,CAAC,GAAG,IAAI,GAAA,CAAA,CAAK,IAAA,IAAQ,EAAC,EAAG,MAAA,CAAO,CAAC,CAAA,KAAM,OAAO,MAAM,QAAA,IAAY,CAAA,CAAE,MAAK,CAAE,MAAA,GAAS,CAAC,CAAC,CAAC,CAAA;AAEhF,SAAS,uBAAuB,OAAA,EAAsD;AAC3F,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,IAAA,CAAK,OAAA,EAAS,MAAM,CAAA;AAAA,IAC5B,KAAA,EAAO,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qC,QAAA;AAAA,EACrC,oCAAA,EAAsC,QAAA;AAAA,EACtC,uCAAA,EAAyC,QAAA;AAAA,EACzC,uCAAA,EAAyC,QAAA;AAAA,EACzC,0CAAA,EAA4C,aAAA;AAAA,EAC5C,oCAAA,EAAsC,OAAA;AAAA,EACtC,6CAAA,EAA+C,iBAAA;AAAA,EAC/C,4CAAA,EAA8C,wBAAA;AAAA,EAC9C,uCAAA,EAAyC,cAAA;AAAA,EACzC,4CAAA,EAA8C,QAAA;AAAA,EAC9C,qCAAA,EAAuC,QAAA;AAAA,EACvC,iCAAA,EAAmC;AACrC,CAAA;;;ACrJO,IAAM,qBAAA,GAAgE;AAAA,EAC3E,EAAA;AAAA,EACA,OAAA,EAAS;AACX","file":"chunk-IDU6T6QU.js","sourcesContent":["import type { GettingStartedDataProvider } from './data/types'\n\n/**\n * What the app adds to the journey the programs already declared.\n *\n * The journey is tagged at the source (`OnboardingStepDef.journey`, by the\n * plugin that owns each step); this is the app's composition on top of it,\n * by catalog key: a base-list step it wants counted (`team`), a line it wants\n * outside the total, a minimum the server requires that no program tags.\n * Everything here is additive and ordered after the tagged steps.\n */\nexport interface JourneyOverride {\n launch?: string[]\n later?: string[]\n extra?: string[]\n /** Catalog keys of the steps the trial cannot start without. */\n minimums?: string[]\n}\n\n/**\n * The screens the plugin's surfaces open. Every path the plugin navigates to\n * comes from here; an app (or a host with its own router) overrides any of them.\n */\nexport interface GettingStartedRoutes {\n /** Where the store-live card lives — the tour's first stop. Default `/`. */\n home?: string\n /** The trial settings (hours, payment methods, the clock): the hours/payments steps and the tour's last stop. Default `/settings/trial`. */\n trial?: string\n /** Where \"see the plans\" / \"subscribe\" go (trial-end banner, trial settings). Default `/settings/subscription`. */\n subscription?: string\n}\n\nexport interface GettingStartedPluginOptions {\n /**\n * Trial length shown in copy before the journey loads. One source in the app\n * (`billing.trialDays`, the same number the sign-up promises); the pool config\n * (`plg_getting_started_config.trial_days`) is the truth once it answers, and\n * a disagreement between the two is reported once per session (see\n * `noteTrialDaysDivergence`).\n */\n trialDays?: number\n /** Verticals the program is seeded for. Default: food. */\n verticals?: string[]\n /** The app's composition of the journey. See {@link JourneyOverride}. */\n journey?: JourneyOverride\n /** Data provider override (tests, storybook). */\n dataProvider?: GettingStartedDataProvider\n /** Overrides of the screens the surfaces open. See {@link GettingStartedRoutes}. */\n routes?: GettingStartedRoutes\n}\n\nexport interface ResolvedGettingStartedConfig {\n trialDays: number\n verticals: string[]\n journey: Required<JourneyOverride>\n /** Every screen the surfaces open, defaults filled. */\n routes: Required<GettingStartedRoutes>\n /** The plugin's own settings tab — where hours and payment methods are edited. Same as `routes.trial`. */\n trialRoute: string\n /** Where \"see the plans\" goes. Same as `routes.subscription`. */\n subscriptionRoute: string\n}\n\nexport const DEFAULT_TRIAL_DAYS = 14\nexport const TRIAL_ROUTE = '/settings/trial'\nexport const SUBSCRIPTION_ROUTE = '/settings/subscription'\nexport const HOME_ROUTE = '/'\n\nexport const DEFAULT_ROUTES: Readonly<Required<GettingStartedRoutes>> = Object.freeze({\n home: HOME_ROUTE,\n trial: TRIAL_ROUTE,\n subscription: SUBSCRIPTION_ROUTE,\n})\n\nconst route = (value: unknown, fallback: string): string =>\n typeof value === 'string' && value.trim().length > 0 ? value.trim() : fallback\n\nexport function resolveRoutes(routes?: GettingStartedRoutes): Required<GettingStartedRoutes> {\n return {\n home: route(routes?.home, DEFAULT_ROUTES.home),\n trial: route(routes?.trial, DEFAULT_ROUTES.trial),\n subscription: route(routes?.subscription, DEFAULT_ROUTES.subscription),\n }\n}\n\nconst keys = (list: readonly string[] | undefined): string[] =>\n [...new Set((list ?? []).filter((k) => typeof k === 'string' && k.trim().length > 0))]\n\nexport function resolveJourneyOverride(journey?: JourneyOverride): Required<JourneyOverride> {\n return {\n launch: keys(journey?.launch),\n later: keys(journey?.later),\n extra: keys(journey?.extra),\n minimums: keys(journey?.minimums),\n }\n}\n\nexport function resolveConfig(options?: GettingStartedPluginOptions): ResolvedGettingStartedConfig {\n const days = Number(options?.trialDays)\n const routes = resolveRoutes(options?.routes)\n return {\n trialDays: Number.isFinite(days) && days > 0 ? Math.floor(days) : DEFAULT_TRIAL_DAYS,\n verticals: options?.verticals?.length ? [...options.verticals] : ['food'],\n journey: resolveJourneyOverride(options?.journey),\n routes,\n trialRoute: routes.trial,\n subscriptionRoute: routes.subscription,\n }\n}\n\nlet activeConfig: ResolvedGettingStartedConfig | null = null\n\n/**\n * The config of the manifest in force, for the surfaces an app composes\n * outside the plugin's own context (`useStartTrial`, `<StartTrialAction/>`).\n * Set by `createGettingStartedPlugin`; defaults when nothing built one yet.\n */\nexport function setActiveConfig(config: ResolvedGettingStartedConfig): void {\n activeConfig = config\n}\n\nexport function getActiveConfig(): ResolvedGettingStartedConfig {\n return activeConfig ?? resolveConfig()\n}\n\nlet divergenceNoted: string | null = null\n\n/**\n * The app's `trialDays` and the pool's disagree: say so once, in the console,\n * so the number in the copy and the number the clock runs on are reconciled by\n * someone instead of silently differing. A manifest `diagnostics` entry can\n * only check that something EXISTS (the table is checked there); comparing\n * values needs the journey loaded, so it lives here.\n */\nexport function noteTrialDaysDivergence(config: Pick<ResolvedGettingStartedConfig, 'trialDays'>, poolTrialDays: number | null | undefined): void {\n if (!poolTrialDays || poolTrialDays === config.trialDays) return\n const signature = `${config.trialDays}:${poolTrialDays}`\n if (divergenceNoted === signature) return\n divergenceNoted = signature\n if (typeof console !== 'undefined') {\n console.warn(\n `[getting-started] trialDays: the app says ${config.trialDays}, plg_getting_started_config.trial_days says ${poolTrialDays}. The pool wins; align billing.trialDays.`,\n )\n }\n}\n","export type JourneyPhase = 'setup' | 'trial' | 'expired' | 'converted'\n\n/** What the server says is green. `ready` is the only thing that unlocks \"Iniciar teste\". */\nexport interface JourneyMinimums {\n menu: boolean\n hours: boolean\n testOrder: boolean\n ready: boolean\n}\n\nexport interface Journey {\n tenantId: string\n phase: JourneyPhase\n /** Pool config (plg_getting_started_config.trial_days), or the days frozen on the journey row once started. */\n trialDays: number\n readyAt: string | null\n trialStartedAt: string | null\n /** tenants.trial_ends_at — the truth about the end, whatever the phase. */\n trialEndsAt: string | null\n /** tenants.trial_ends_at while the trial has not started: the preparation window. */\n setupDeadlineAt: string | null\n convertedAt: string | null\n wantsContractAt: string | null\n source: string | null\n utm: Record<string, unknown>\n minimums: JourneyMinimums\n}\n\n/**\n * Why the server would not start the clock (migration 003):\n * `minimums_missing` — the three minimums are not all there;\n * `no_trial_window` — `tenants.trial_ends_at` is NULL (legacy or paying tenant);\n * `already_converted` — the journey is converted; `already_paid` — the tenant is on a paid plan.\n */\nexport type StartTrialRefusal = 'minimums_missing' | 'no_trial_window' | 'already_converted' | 'already_paid'\n\nexport type StartTrialResult =\n | { ok: true; alreadyStarted: boolean; trialStartedAt: string; trialEndsAt: string; trialDays?: number }\n | { ok: false; reason: StartTrialRefusal; minimums: JourneyMinimums }\n\nexport interface RequestContractResult {\n ok: true\n alreadyRequestedToday: boolean\n}\n\nexport interface JourneyEvent {\n id: string\n tenantId: string\n kind: string\n day: string\n channel: string | null\n payload: Record<string, unknown>\n actorId: string | null\n createdAt: string\n}\n\nexport const WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] as const\nexport type Weekday = (typeof WEEKDAYS)[number]\n\nexport interface HoursRange {\n open: string\n close: string\n}\n\n/** `tenants.settings.store.hours` — a day absent or empty is a closed day. */\nexport type StoreHours = Partial<Record<Weekday, HoursRange[]>>\n\n/**\n * The payment-method vocabulary is the UI kit's (`payment-methods.ts`): the\n * wizard writes it at birth, this plugin's tab edits it, the sensor reads it.\n */\nexport { PAYMENT_METHOD_IDS as PAYMENT_METHODS } from '@fayz-ai/ui'\nexport type { PaymentMethodId as PaymentMethod } from '@fayz-ai/ui'\n\n/**\n * The three slots the server's `getting_started_minimums` answers for. These\n * are the SERVER's names, not step keys: which checklist step stands for each\n * slot is declared by the programs (`OnboardingStepDef.journey.minimum`) and\n * resolved in `journey-steps.ts`, never enumerated here.\n */\nexport const MINIMUM_IDS = ['menu', 'hours', 'testOrder'] as const\nexport type MinimumId = (typeof MINIMUM_IDS)[number]\n","import * as React from 'react'\nimport { journeySteps, usePluginRuntimeOptional, type OnboardingProgramDef } from '@fayz-ai/core'\nimport type { OnboardingStepInput } from '@fayz-ai/ui'\nimport { resolveJourneyOverride, type JourneyOverride } from '../config'\nimport { MINIMUM_IDS, type Journey, type JourneyMinimums, type MinimumId } from '../types'\n\n/**\n * The journey is DECLARED, not enumerated here. Each program tags its own\n * steps (`OnboardingStepDef.journey`, contract §5.1) and `journeySteps()` lists\n * them in program order with their namespaced keys; the app adds what it wants\n * on top (`createGettingStartedPlugin({ journey })`): a base-list step such as\n * `team`, a line outside the total, a minimum no program tags. This plugin only\n * orders and composes — it knows none of the other owners' keys.\n */\nexport interface JourneyDeclaration {\n launch: string[]\n later: string[]\n extra: string[]\n /** Catalog keys of the steps the trial cannot start without, in order. */\n minimums: string[]\n /** The step that stands for each of the server's slots, when one can be told. */\n slots: Partial<Record<MinimumId, string>>\n /** True when at least one program tagged a step (the override alone does not count). */\n declared: boolean\n}\n\n/**\n * The server's `getting_started_minimums` answers for three named slots and the\n * tag only says `minimum: true`, so the slot is read off the step's own key —\n * the last segment: `…hours`, `…menu`, `…test-order`. A tagged minimum outside\n * these three still blocks the client (\"falta X\") but only the server can say\n * it is green.\n */\nconst SLOT_BY_SUFFIX: Record<string, MinimumId> = { hours: 'hours', menu: 'menu', 'test-order': 'testOrder' }\n\nexport function minimumSlotOf(key: string): MinimumId | undefined {\n const suffix = key.slice(key.lastIndexOf('.') + 1)\n return SLOT_BY_SUFFIX[suffix]\n}\n\nconst unique = (list: readonly string[]): string[] => [...new Set(list)]\n\nexport function declareJourney(\n programs: ReadonlyArray<OnboardingProgramDef>,\n override?: JourneyOverride,\n): JourneyDeclaration {\n const tagged = journeySteps(programs)\n const extra = resolveJourneyOverride(override)\n const launch = unique([...tagged.filter((s) => s.group === 'launch').map((s) => s.key), ...extra.launch])\n const later = unique([...tagged.filter((s) => s.group === 'later').map((s) => s.key), ...extra.later])\n const extraKeys = unique([...tagged.filter((s) => s.group === 'extra').map((s) => s.key), ...extra.extra])\n const minimums = unique([...tagged.filter((s) => s.minimum).map((s) => s.key), ...extra.minimums])\n const slots: Partial<Record<MinimumId, string>> = {}\n for (const key of minimums) {\n const slot = minimumSlotOf(key)\n if (slot && !slots[slot]) slots[slot] = key\n }\n return { launch, later, extra: extraKeys, minimums, slots, declared: tagged.length > 0 }\n}\n\n// ---------------------------------------------------------------------------\n// The declaration in force.\n//\n// Components that are not ours (the dashboard card) call the selectors with\n// the catalog alone, so the declaration they fall back on lives here: the\n// app's override is set once when the manifest is built; the programs arrive\n// with the plugin runtime and are synced by the plugin's own surfaces\n// (`useJourneyDeclaration`) before anything under them renders.\n// ---------------------------------------------------------------------------\n\nconst EMPTY_PROGRAMS: ReadonlyArray<OnboardingProgramDef> = []\nlet activeOverride: JourneyOverride | undefined\nlet activePrograms: ReadonlyArray<OnboardingProgramDef> = EMPTY_PROGRAMS\nlet active: JourneyDeclaration = declareJourney(EMPTY_PROGRAMS)\n\nexport function setJourneyOverride(override: JourneyOverride | undefined): JourneyDeclaration {\n activeOverride = override\n active = declareJourney(activePrograms, activeOverride)\n return active\n}\n\n/** Recomputes only when the programs list is another object — the runtime is stable per app. */\nexport function syncJourneyPrograms(programs: ReadonlyArray<OnboardingProgramDef> | undefined): JourneyDeclaration {\n const next = programs ?? EMPTY_PROGRAMS\n if (next !== activePrograms) {\n activePrograms = next\n active = declareJourney(activePrograms, activeOverride)\n }\n return active\n}\n\nexport function currentJourney(): JourneyDeclaration {\n return active\n}\n\nlet hostPrograms: ReadonlyArray<OnboardingProgramDef> | undefined\n\n/**\n * The programs of a host with no plugin runtime (`createGettingStartedHost`).\n * Read by `useJourneyDeclaration` when no runtime is in context; `undefined`\n * hands it back to the runtime alone.\n */\nexport function setHostJourneyPrograms(programs: ReadonlyArray<OnboardingProgramDef> | undefined): JourneyDeclaration {\n hostPrograms = programs\n return syncJourneyPrograms(programs)\n}\n\n/**\n * The declaration from the plugin runtime in context, kept in sync for the\n * selectors' default. Called during render on purpose: the sync is idempotent\n * and the card below reads the result in the same pass.\n */\nexport function useJourneyDeclaration(): JourneyDeclaration {\n const runtime = usePluginRuntimeOptional()\n const programs = runtime?.onboardingPrograms ?? hostPrograms\n return React.useMemo(() => syncJourneyPrograms(programs), [programs])\n}\n\n/** How many steps the fallback takes when nothing is declared yet. */\nconst FALLBACK_SIZE = 9\nconst FALLBACK_LAUNCH = 6\n\nexport interface ActivationRowLike {\n sourceKey: string | null\n status: string\n title?: string\n dueDate?: string | null\n}\n\nexport interface CatalogStepLike {\n key: string\n title: string\n description?: string\n icon?: string\n route?: string\n dueInDays?: number\n check?: () => Promise<boolean>\n}\n\nexport interface JourneySelection<S extends CatalogStepLike = CatalogStepLike> {\n launch: S[]\n later: S[]\n extra: S[]\n /** True when nothing to launch was declared and the head of the catalog was used instead. */\n fallback: boolean\n}\n\n/**\n * The journey out of the shell's activation catalog (already filtered by\n * vertical, answers and routes): the declared keys in declared order, each one\n * present only if the catalog has it — a house without delivery shows n/8.\n *\n * A declaration with nothing to launch is a journey not declared yet (programs\n * still untagged, another app): the catalog is in program order, so its head\n * stands in, as it always did.\n */\nexport function selectJourneySteps<S extends CatalogStepLike>(\n catalog: readonly S[],\n declaration: JourneyDeclaration = currentJourney(),\n): JourneySelection<S> {\n const byKey = new Map(catalog.map((s) => [s.key, s] as const))\n const pick = (keys: readonly string[]) => keys.map((k) => byKey.get(k)).filter((s): s is S => !!s)\n const launch = pick(declaration.launch)\n const later = pick(declaration.later)\n const extra = pick(declaration.extra).slice(0, 1)\n if (launch.length > 0) return { launch, later, extra, fallback: false }\n const head = catalog.slice(0, FALLBACK_SIZE)\n return { launch: head.slice(0, FALLBACK_LAUNCH), later: head.slice(FALLBACK_LAUNCH), extra, fallback: true }\n}\n\nexport function rowDone(rows: readonly ActivationRowLike[] | null | undefined, key: string): boolean {\n return !!rows?.some((r) => r.sourceKey === key && (r.status === 'done' || r.status === 'cancelled'))\n}\n\nexport function rowOpen(rows: readonly ActivationRowLike[] | null | undefined, key: string): boolean {\n return !!rows?.some((r) => r.sourceKey === key && r.status === 'todo')\n}\n\n/**\n * Steps whose sensor outranks the row — this plugin's own two. For these the\n * row is a memo of the data, not the fact: a \"done\" row with zero payment\n * methods behind it (a step closed by a visit, a sweep that read an empty\n * memory) is reopened by the sensor instead of drawn struck through.\n */\nexport const SENSOR_RULED_KEYS: readonly string[] = ['getting-started.hours', 'getting-started.payment-methods']\n\n/**\n * Steps as `useOnboardingProgress` wants them, sensors latched.\n *\n * The latch re-reads the ROW AT THE MOMENT THE SENSOR ANSWERS, through\n * `onSensorDone`, not the row captured when the list was built. The rows of a\n * fresh workspace arrive in two waves (the wizard's base list, then the\n * programs' top-up a mount later); a sensor that fired against the first wave\n * found no row for `getting-started.hours`, said \"done\" to the card and wrote\n * nothing — which is how the painel counted a step the Tarefas tab still listed\n * as open.\n *\n * A closed row of a sensor-ruled step still probes; a \"no\" there reaches\n * `onSensorOpen`, so the caller can reopen the row the sensor contradicted.\n */\nexport function toStepInputs(\n steps: readonly CatalogStepLike[],\n rows: readonly ActivationRowLike[] | null | undefined,\n onSensorDone?: (key: string) => void,\n onSensorOpen?: (key: string) => void,\n): OnboardingStepInput[] {\n return steps.map((step) => {\n const closed = rowDone(rows, step.key)\n const ruled = !!step.check && SENSOR_RULED_KEYS.includes(step.key)\n const trustRow = closed && !ruled\n return {\n id: step.key,\n title: step.title,\n description: step.description,\n icon: step.icon,\n action: step.route,\n done: trustRow ? true : undefined,\n check: trustRow || !step.check\n ? undefined\n : async () => {\n const ok = await step.check!()\n if (ok) onSensorDone?.(step.key)\n else if (closed) onSensorOpen?.(step.key)\n return ok\n },\n }\n })\n}\n\n/**\n * The journey's own count, from the rows alone — what the floating pill and\n * the card's ring both say. One selection (launch + later), one total; the\n * rest of the catalog is the Tarefas tab's business, not this number.\n */\nexport function countJourney(\n catalog: readonly CatalogStepLike[],\n rows: readonly ActivationRowLike[] | null | undefined,\n declaration: JourneyDeclaration = currentJourney(),\n): { done: number; total: number } {\n const { launch, later } = selectJourneySteps(catalog, declaration)\n const counted = [...launch, ...later]\n return { done: counted.filter((s) => rowDone(rows, s.key)).length, total: counted.length }\n}\n\nexport interface MinimumsCount {\n count: number\n total: number\n /** Server slots green — said by the server OR by the row of the step that stands for the slot. */\n done: MinimumId[]\n missing: MinimumId[]\n /** Declared minimum keys still open on the client (slotted or not). */\n missingKeys: string[]\n ready: boolean\n}\n\n/**\n * A minimum is green when the server says so OR the checklist already ticked\n * the step that stands for it. The count is over the server's slots — the\n * server is what unlocks the trial — and `ready` also waits for any declared\n * minimum the server has no slot for.\n */\nexport function countMinimums(\n journey: Journey | null,\n rows: readonly ActivationRowLike[] | null | undefined,\n declaration: JourneyDeclaration = currentJourney(),\n): MinimumsCount {\n const done = MINIMUM_IDS.filter((id) => {\n if (journey?.minimums[id]) return true\n const key = declaration.slots[id]\n return !!key && rowDone(rows, key)\n })\n const missing = MINIMUM_IDS.filter((id) => !done.includes(id))\n const slotted = new Set(Object.values(declaration.slots))\n const missingKeys = declaration.minimums.filter((key) => {\n const slot = minimumSlotOf(key)\n if (slot && slotted.has(key)) return missing.includes(slot)\n return !rowDone(rows, key)\n })\n return {\n count: done.length,\n total: MINIMUM_IDS.length,\n done,\n missing,\n missingKeys,\n ready: missing.length === 0 && missingKeys.length === 0,\n }\n}\n\nexport function minimumsFromRows(\n rows: readonly ActivationRowLike[] | null | undefined,\n declaration: JourneyDeclaration = currentJourney(),\n): JourneyMinimums {\n const { done, ready } = countMinimums(null, rows, declaration)\n return {\n menu: done.includes('menu'),\n hours: done.includes('hours'),\n testOrder: done.includes('testOrder'),\n ready,\n }\n}\n\n/**\n * The journey as the client can tell it when the pool has no clock yet\n * (`getting_started_journey` missing — migration not applied). Phase is\n * \"setup\" by definition: nothing could have started a trial. Dates are unknown,\n * never invented; the surfaces that show them read `null` and say nothing.\n */\nexport function clientJourney(input: {\n tenantId: string\n trialDays: number\n rows: readonly ActivationRowLike[] | null | undefined\n declaration?: JourneyDeclaration\n}): Journey {\n return {\n tenantId: input.tenantId,\n phase: 'setup',\n trialDays: input.trialDays,\n readyAt: null,\n trialStartedAt: null,\n trialEndsAt: null,\n setupDeadlineAt: null,\n convertedAt: null,\n wantsContractAt: null,\n source: 'client',\n utm: {},\n minimums: minimumsFromRows(input.rows, input.declaration ?? currentJourney()),\n }\n}\n\n/** The one step that carries \"AGORA\": the first still open, launch group first. */\nexport function nowStepKey(\n selection: Pick<JourneySelection, 'launch' | 'later'>,\n completed: Record<string, boolean>,\n): string | undefined {\n return [...selection.launch, ...selection.later].find((s) => !completed[s.key])?.key\n}\n\nexport interface MinimumLine {\n key: string\n slot?: MinimumId\n /** The catalog step, when this app has it. */\n step?: CatalogStepLike\n done: boolean\n}\n\n/**\n * The minimums as a list to draw: every declared minimum key (with its catalog\n * step when the app has it), plus any server slot nothing in this app stands\n * for — those carry only the slot, and the caller words them.\n */\nexport function minimumLines(\n catalog: readonly CatalogStepLike[],\n rows: readonly ActivationRowLike[] | null | undefined,\n journey: Journey | null,\n declaration: JourneyDeclaration = currentJourney(),\n): MinimumLine[] {\n const byKey = new Map(catalog.map((s) => [s.key, s] as const))\n const counted = countMinimums(journey, rows, declaration)\n const lines: MinimumLine[] = declaration.minimums.map((key) => {\n const inferred = minimumSlotOf(key)\n const slot = inferred && declaration.slots[inferred] === key ? inferred : undefined\n const done = slot ? counted.done.includes(slot) : !counted.missingKeys.includes(key)\n return { key, slot, step: byKey.get(key), done }\n })\n for (const slot of MINIMUM_IDS) {\n if (declaration.slots[slot]) continue\n lines.push({ key: `minimum:${slot}`, slot, done: counted.done.includes(slot) })\n }\n return lines\n}\n","import * as React from 'react'\nimport { create } from 'zustand'\nimport {\n emitDomainEvent, getActiveTenantId, onDomainEvent, tl, usePluginRuntimeOptional,\n type OnboardingTourDef, type PluginRuntime, type ResolvedTour, type TourDef, type TourStopDef,\n} from '@fayz-ai/core'\nimport { registerTourAction, useTourStore, type TourActionResult } from '@fayz-ai/ui'\nimport { useActivationStore } from '@fayz-ai/admin/host'\nimport { DEFAULT_ROUTES, getActiveConfig, type GettingStartedRoutes } from '../config'\nimport type { JourneyState } from '../store'\nimport { countMinimums } from './journey-steps'\n\n/**\n * The closing tour of the store-live journey: a walk through the data the\n * house just created, in the screens that hold it. Every plugin contributes\n * its own stops (`onboarding.tour` in its manifest); this module only orders\n * and composes — it opens on the journey card and closes on the trial tab.\n */\n\nexport const JOURNEY_TOUR_ID = 'getting-started.journey'\nexport const CARD_ANCHOR = 'getting-started.card'\nexport const TRIAL_TAB_ANCHOR = 'getting-started.trial-tab'\nexport const DESCRIBE_CARD_ACTION = 'getting-started.describe-card'\nexport const DESCRIBE_TRIAL_TAB_ACTION = 'getting-started.describe-trial-tab'\nexport const TRIAL_STARTED_EVENT = 'getting_started.trial_started'\nexport const MINIMUMS_READY_EVENT = 'getting_started.minimums_ready'\nexport const TOUR_DONE_EVENT = 'getting_started.tour_done'\n/** How long a start waits for the dialog or takeover that fired it to close. */\nexport const TRIAL_START_SETTLE_MS = 600\nconst OWN_PLUGIN_ID = 'getting-started'\n\nexport type JourneyTourMoment = 'trial_started' | 'minimums_ready' | 'manual'\n\n/**\n * This plugin's own contribution: the card, first, on the app's home route.\n * Goes in the manifest as `onboarding.tour`.\n */\nexport function buildOwnJourneyTour(routes?: Pick<GettingStartedRoutes, 'home'>): OnboardingTourDef {\n return {\n id: OWN_PLUGIN_ID,\n order: 0,\n when: 'trial_started',\n stops: [\n {\n anchor: CARD_ANCHOR,\n route: routes?.home ?? DEFAULT_ROUTES.home,\n action: DESCRIBE_CARD_ACTION,\n title: tl('Your store, live', 'Sua loja no ar'),\n body: tl(\n 'What is ready and what is still open live here. Each line opens its screen.',\n 'O que já está pronto e o que falta fica aqui. Cada linha abre a tela dela.',\n ),\n skipIfMissing: true,\n },\n ],\n }\n}\n\n/** The contribution on the default routes. */\nexport const journeyTour: OnboardingTourDef = buildOwnJourneyTour()\n\n/** The last stop, always: where the clock, the hours and the payment methods live (the app's trial route). */\nexport function buildJourneyClosingStop(routes?: Pick<GettingStartedRoutes, 'trial'>): TourStopDef {\n return {\n anchor: TRIAL_TAB_ANCHOR,\n route: routes?.trial ?? DEFAULT_ROUTES.trial,\n action: DESCRIBE_TRIAL_TAB_ACTION,\n title: tl('Free trial', 'Teste grátis'),\n body: tl(\n 'Your hours, payment methods and the trial clock live in this tab.',\n 'Seus horários, formas de pagamento e o relógio do teste moram nesta aba.',\n ),\n skipIfMissing: true,\n }\n}\n\n/** The closing stop on the default routes. */\nexport const journeyClosingStop: TourStopDef = buildJourneyClosingStop()\n\n/**\n * Card → the contributed stops, by their `order` → trial tab. A contribution\n * that asked for `manual` is left out (it wants to be shown on its own); every\n * stop is skippable unless it said otherwise, so a module that is off in this\n * app costs the person nothing.\n */\nexport function buildJourneyTour(\n runtime?: Pick<PluginRuntime, 'onboardingTours'> | null,\n routes: Pick<Required<GettingStartedRoutes>, 'home' | 'trial'> = getActiveConfig().routes,\n): TourDef {\n const tours: ResolvedTour[] = (runtime?.onboardingTours ?? []).filter((t) => t.when !== 'manual')\n const own = tours.find((t) => t.pluginId === OWN_PLUGIN_ID)\n const opening = own ? own.stops : buildOwnJourneyTour(routes).stops\n const others = tours.filter((t) => t !== own).sort((a, b) => a.order - b.order)\n const seen = new Set<string>()\n const stops: TourStopDef[] = []\n for (const stop of [...opening, ...others.flatMap((t) => t.stops), buildJourneyClosingStop(routes)]) {\n const key = `${stop.anchor}|${stop.action ?? ''}`\n if (seen.has(key)) continue\n seen.add(key)\n stops.push({ ...stop, skipIfMissing: stop.skipIfMissing ?? true })\n }\n // The start-trial button owns the journey's confetti; the walk ends quietly.\n return { id: JOURNEY_TOUR_ID, title: tl('A tour of your store', 'Um tour pela sua loja'), stops, onEnd: 'none' }\n}\n\n// ---------------------------------------------------------------------------\n// Once per tenant. localStorage, not a table: the tour is a courtesy of this\n// browser, and a second owner on another machine deserves it too.\n// ---------------------------------------------------------------------------\n\nconst memory = new Map<string, string>()\nconst key = (what: string, tenantId: string) => `fayz:getting-started:${what}:${tenantId}`\nfunction flagged(what: string, tenantId: string): boolean {\n try {\n if (typeof localStorage !== 'undefined') return localStorage.getItem(key(what, tenantId)) !== null\n } catch { /* private mode: fall through to memory */ }\n return memory.has(key(what, tenantId))\n}\nfunction flag(what: string, tenantId: string): void {\n memory.set(key(what, tenantId), '1')\n try {\n if (typeof localStorage !== 'undefined') localStorage.setItem(key(what, tenantId), new Date().toISOString())\n } catch { /* memory already has it */ }\n}\nfunction unflag(what: string, tenantId: string): void {\n memory.delete(key(what, tenantId))\n try {\n if (typeof localStorage !== 'undefined') localStorage.removeItem(key(what, tenantId))\n } catch { /* nothing to remove */ }\n}\n\nexport function journeyTourDone(tenantId: string | null | undefined): boolean {\n return !!tenantId && flagged('journey-tour', tenantId)\n}\nexport function markJourneyTourDone(tenantId: string): void {\n flag('journey-tour', tenantId)\n}\n/** Tests and support: lets the tour fire again for a tenant. */\nexport function forgetJourneyTour(tenantId: string): void {\n unflag('journey-tour', tenantId)\n unflag('minimums-ready', tenantId)\n}\n\n// ---------------------------------------------------------------------------\n// Runtime state the surfaces read: the moment waiting to start, and the plugin\n// runtime (for the contributed stops), remembered by whichever surface last\n// rendered inside the provider — the triggers run outside React.\n// ---------------------------------------------------------------------------\n\nexport interface JourneyTourState {\n /** A start that is waiting for the right screen (the card, uncovered). */\n pending: JourneyTourMoment | null\n runtime: Pick<PluginRuntime, 'onboardingTours'> | null\n rememberRuntime: (runtime: Pick<PluginRuntime, 'onboardingTours'> | null) => void\n}\n\nexport const useJourneyTourStore = create<JourneyTourState>((set) => ({\n pending: null,\n runtime: null,\n rememberRuntime: (runtime) => set((s) => (s.runtime === runtime ? s : { runtime })),\n}))\n\nlet boundStore: { getState: () => JourneyState } | null = null\nfunction currentTenant(): string | null {\n return boundStore?.getState().tenantId ?? getActiveTenantId() ?? null\n}\n\n/**\n * Starts the tour now. Without `force`, only once per tenant and never over a\n * tour already running (the pill and the app's screen may both react to the\n * same event — the second caller finds the flag set). Returns whether it ran.\n */\nexport function startJourneyTour(opts?: {\n moment?: JourneyTourMoment\n force?: boolean\n runtime?: Pick<PluginRuntime, 'onboardingTours'> | null\n}): boolean {\n const moment = opts?.moment ?? 'manual'\n const tenantId = currentTenant()\n if (!opts?.force) {\n if (!tenantId || journeyTourDone(tenantId)) return false\n if (useTourStore.getState().tour) return false\n }\n const tour = buildJourneyTour(opts?.runtime ?? useJourneyTourStore.getState().runtime)\n if (tenantId) markJourneyTourDone(tenantId)\n useJourneyTourStore.setState({ pending: null })\n useTourStore.getState().start(tour)\n reportEnd(tenantId, moment)\n return true\n}\n\n/** One `tour_done` per run, when the overlay closes — finished or skipped. */\nfunction reportEnd(tenantId: string | null, moment: JourneyTourMoment): void {\n const off = useTourStore.subscribe((state) => {\n if (state.tour || state.lastOutcome?.tourId !== JOURNEY_TOUR_ID) return\n off()\n emitDomainEvent(TOUR_DONE_EVENT, { completed: state.lastOutcome.completed, moment }, { tenantId })\n })\n}\n\n/** Lets the dialog or takeover that fired the event close before the overlay opens. */\nexport function startJourneyTourSoon(moment: JourneyTourMoment, delayMs = TRIAL_START_SETTLE_MS): void {\n setTimeout(() => { startJourneyTour({ moment }) }, delayMs)\n}\n\n/**\n * The minimums turned green: say so once per tenant (the funnel listens) and\n * leave the tour waiting for the card — it must not open over the PDV where\n * the last minimum, the test order, was just paid.\n */\nfunction minimumsCheck(): void {\n if (!boundStore) return\n const { journey, error } = boundStore.getState()\n const tenantId = currentTenant()\n const rows = useActivationStore.getState().rows\n if (!tenantId || !rows || rows.length === 0) return\n // No journey yet: wait for it, unless the pool has no clock (then setup by definition).\n const phase = journey?.phase ?? (error ? 'setup' : null)\n if (phase !== 'setup') return\n if (!countMinimums(journey, rows).ready) return\n if (flagged('minimums-ready', tenantId)) return\n flag('minimums-ready', tenantId)\n emitDomainEvent(MINIMUMS_READY_EVENT, {}, { tenantId })\n if (!journeyTourDone(tenantId)) useJourneyTourStore.setState({ pending: 'minimums_ready' })\n}\n\nlet uninstall: (() => void) | null = null\n\n/**\n * Wires the two moments. Idempotent: the plugin factory calls it on every\n * bind, and a second install replaces the first.\n */\nexport function installJourneyTourTriggers(store: { getState: () => JourneyState; subscribe: (fn: () => void) => () => void }): () => void {\n uninstall?.()\n boundStore = store\n const offs = [\n onDomainEvent(TRIAL_STARTED_EVENT, () => {\n useJourneyTourStore.setState({ pending: null })\n startJourneyTourSoon('trial_started')\n }),\n store.subscribe(minimumsCheck),\n useActivationStore.subscribe(minimumsCheck),\n ]\n minimumsCheck()\n uninstall = () => {\n for (const off of offs) off()\n if (boundStore === store) boundStore = null\n uninstall = null\n }\n return uninstall\n}\n\n// ---------------------------------------------------------------------------\n// Hooks for the surfaces that carry an anchor.\n// ---------------------------------------------------------------------------\n\n/** Hands the plugin runtime to the triggers, which run outside React. */\nexport function useRememberJourneyRuntime(): Pick<PluginRuntime, 'onboardingTours'> | null {\n const runtime = usePluginRuntimeOptional()\n const remember = useJourneyTourStore((s) => s.rememberRuntime)\n React.useEffect(() => {\n if (runtime) remember(runtime)\n }, [runtime, remember])\n return runtime\n}\n\n/**\n * Registers the stop's action as \"describe me\": the copy is written at the\n * moment the stop shows, over whatever the surface knows then — not when the\n * component mounted.\n */\nexport function useTourDescription(action: string, describe: () => TourActionResult): void {\n const latest = React.useRef(describe)\n latest.current = describe\n React.useEffect(() => registerTourAction(action, () => latest.current()), [action])\n}\n\n/**\n * Starts a waiting tour once this element is on screen and uncovered: not\n * under the PDV takeover, not under a dialog, not scrolled away. Polled while\n * something is pending, and only then.\n */\nexport function useJourneyTourAutostart(\n ref: React.RefObject<HTMLElement | null>,\n enabled: boolean,\n runtime: Pick<PluginRuntime, 'onboardingTours'> | null,\n): void {\n const pending = useJourneyTourStore((s) => s.pending)\n React.useEffect(() => {\n if (!pending || !enabled) return\n const attempt = () => {\n const el = ref.current\n if (!el || typeof document === 'undefined' || !document.elementFromPoint) return\n const r = el.getBoundingClientRect()\n if (r.width === 0 || r.height === 0) return\n const x = Math.min(Math.max(r.left + r.width / 2, 0), window.innerWidth - 1)\n const y = Math.min(Math.max(r.top + 24, 0), window.innerHeight - 1)\n const hit = document.elementFromPoint(x, y)\n if (!hit || !el.contains(hit)) return\n startJourneyTour({ moment: pending, runtime })\n }\n attempt()\n const id = window.setInterval(attempt, 800)\n return () => window.clearInterval(id)\n }, [pending, enabled, runtime, ref])\n}\n","import { create } from 'zustand'\nimport { emitDomainEvent, registerTenantScopedStore } from '@fayz-ai/core'\nimport type { GettingStartedDataProvider } from './data/types'\nimport type { Journey, RequestContractResult, StartTrialResult } from './types'\nimport { installJourneyTourTriggers } from './lib/tour'\n\n/**\n * The journey, once, for every surface that reads it: the floating CTA, the\n * end-of-trial banner, the settings tab and the agent's tools. One store so a\n * trial started from the chat is what the rail shows a moment later.\n */\nexport interface JourneyState {\n provider: GettingStartedDataProvider | null\n tenantId: string | undefined\n /** null = never loaded for this tenant (render nothing, never \"0 dias\"). */\n journey: Journey | null\n loading: boolean\n starting: boolean\n error: string | null\n bind: (provider: GettingStartedDataProvider) => void\n load: (tenantId?: string) => Promise<Journey | null>\n startTrial: () => Promise<StartTrialResult>\n requestContract: (note?: string) => Promise<RequestContractResult>\n reset: () => void\n}\n\nconst message = (e: unknown) => (e instanceof Error ? e.message : String(e))\n\nexport const useJourneyStore = create<JourneyState>((set, get) => ({\n provider: null,\n tenantId: undefined,\n journey: null,\n loading: false,\n starting: false,\n error: null,\n\n bind: (provider) => {\n set({ provider })\n // The closing tour listens to this store (trial started, minimums green)\n // from here on; binding again just rewires it.\n installJourneyTourTriggers(useJourneyStore)\n },\n\n load: async (tenantId) => {\n const { provider } = get()\n if (!provider) return null\n // Switching workspaces must not show the previous one's journey.\n if (tenantId !== undefined && tenantId !== get().tenantId) set({ tenantId, journey: null, error: null })\n set({ loading: true })\n try {\n const journey = await provider.getJourney()\n // A late answer from the workspace we just left is not our answer.\n if (tenantId !== undefined && get().tenantId !== tenantId) return null\n set({ journey, loading: false, error: null })\n return journey\n } catch (e) {\n set({ loading: false, error: message(e) })\n return null\n }\n },\n\n startTrial: async () => {\n const { provider } = get()\n if (!provider) throw new Error('getting-started: no data provider bound')\n set({ starting: true })\n try {\n const result = await provider.startTrial()\n await get().load()\n // Local fact so the activation sweeps and the shell clock wake up at once.\n if (result.ok && !result.alreadyStarted) {\n emitDomainEvent(\n 'getting_started.trial_started',\n { trialEndsAt: result.trialEndsAt, trialDays: result.trialDays ?? null },\n { tenantId: get().tenantId ?? null },\n )\n }\n return result\n } finally {\n set({ starting: false })\n }\n },\n\n requestContract: async (note) => {\n const { provider } = get()\n if (!provider) throw new Error('getting-started: no data provider bound')\n const result = await provider.requestContract(note)\n await get().load()\n if (!result.alreadyRequestedToday) {\n emitDomainEvent('getting_started.wants_contract', { note: note ?? null }, { tenantId: get().tenantId ?? null })\n }\n return result\n },\n\n reset: () => set({ tenantId: undefined, journey: null, loading: false, starting: false, error: null }),\n}))\n\nregisterTenantScopedStore('getting-started.journey', () => useJourneyStore.getState().reset())\n","import * as React from 'react'\nimport { createPluginContext, useOrganizationStore } from '@fayz-ai/admin/host'\nimport type { ResolvedGettingStartedConfig } from './config'\nimport type { GettingStartedDataProvider } from './data/types'\nimport { useJourneyStore, type JourneyState } from './store'\nimport { useJourneyDeclaration } from './lib/journey-steps'\n\nconst ctx = createPluginContext<ResolvedGettingStartedConfig, GettingStartedDataProvider, JourneyState>('GettingStarted')\n\nexport const GettingStartedContextProvider = ctx.ContextProvider\nexport const useGettingStartedConfig = ctx.useConfig\nexport const useGettingStartedProvider = ctx.useProvider\nexport const useGettingStartedStore = ctx.useStore\n\nexport interface GettingStartedScope {\n config: ResolvedGettingStartedConfig\n provider: GettingStartedDataProvider\n}\n\n/**\n * The plugin has no page: its surfaces are mounted by the shell (widget zones,\n * the settings area), so each one is wrapped in the context trio here instead\n * of under a plugin route.\n */\nexport function withGettingStartedContext<P extends object>(\n Component: React.ComponentType<P>,\n scope: GettingStartedScope,\n): React.ComponentType<P> {\n const Wrapped = (props: P) => (\n <GettingStartedContextProvider config={scope.config} provider={scope.provider} store={useJourneyStore}>\n <Component {...props} />\n </GettingStartedContextProvider>\n )\n Wrapped.displayName = `GettingStarted(${Component.displayName ?? Component.name ?? 'Component'})`\n return Wrapped\n}\n\n/** Loads the journey for the active tenant once; again when the tenant changes. */\nexport function useEnsureJourney(): void {\n const tenantId = useOrganizationStore((s) => s.currentOrg?.id)\n const load = useGettingStartedStore((s) => s.load)\n const known = useGettingStartedStore((s) => s.tenantId)\n const journey = useGettingStartedStore((s) => s.journey)\n const loading = useGettingStartedStore((s) => s.loading)\n const error = useGettingStartedStore((s) => s.error)\n React.useEffect(() => {\n if (!tenantId) return\n // A failed read stays failed until something else asks again — no retry loop on a dead pool.\n if (tenantId === known && (journey || loading || error)) return\n void load(tenantId)\n }, [tenantId, known, journey, loading, error, load])\n}\n\n/**\n * Every surface of the plugin reads the journey declaration (the tagged steps\n * of the active programs + the app's override) and syncs it before rendering,\n * so the selectors' default is current even in a surface that only hands them\n * the catalog.\n */\nexport function withJourneyDeclaration<P extends object>(Component: React.ComponentType<P>): React.ComponentType<P> {\n const Synced = (props: P) => {\n useJourneyDeclaration()\n return <Component {...props} />\n }\n Synced.displayName = `JourneyDeclared(${Component.displayName ?? Component.name ?? 'Component'})`\n return Synced\n}\n","import type { Journey, JourneyEvent, RequestContractResult, StartTrialResult } from '../types'\n\nexport interface GettingStartedDataProvider {\n /** Phase, dates and minimums for the active tenant. `null` when there is no tenant in scope. */\n getJourney(): Promise<Journey | null>\n /** Idempotent: a trial already running answers `alreadyStarted` without touching the date. */\n startTrial(): Promise<StartTrialResult>\n /** \"Quero contratar\". Once a day per tenant — the second call answers `alreadyRequestedToday`. */\n requestContract(note?: string): Promise<RequestContractResult>\n /** The tenant's timeline, newest first. */\n listEvents(limit?: number): Promise<JourneyEvent[]>\n}\n\n/** Thrown by the Supabase provider; `code` is the SQLSTATE when the pool refused. */\nexport class GettingStartedError extends Error {\n code?: string\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'GettingStartedError'\n this.code = code\n }\n}\n\nexport function isForbidden(error: unknown): boolean {\n return error instanceof GettingStartedError && error.code === '42501'\n}\n\n/**\n * The pool has no clock yet: `getting_started_journey` / `getting_started_start_trial`\n * are not there (migration 000/001 not applied). PostgREST answers PGRST202,\n * Postgres 42883; a mock or a proxy may only carry the sentence.\n */\nexport function isMissingClock(error: unknown): boolean {\n if (error instanceof GettingStartedError && (error.code === 'PGRST202' || error.code === '42883')) return true\n const message = error instanceof Error ? error.message : typeof error === 'string' ? error : ''\n return /could not find the function|function .* does not exist|schema cache/i.test(message)\n}\n","// Physical names for plugin-getting-started. Providers import T/RPC and never\n// hardcode the strings, so a rename touches one file.\nexport const T = {\n config: 'plg_getting_started_config',\n journeys: 'plg_getting_started_journeys',\n events: 'plg_getting_started_events',\n journeyView: 'v_getting_started_journey',\n} as const\n\nexport const RPC = {\n journey: 'getting_started_journey',\n startTrial: 'getting_started_start_trial',\n requestContract: 'getting_started_request_contract',\n // 002_platform_operator.sql — the platform reads every tenant's journey and acts on one trial.\n isPlatformOperator: 'getting_started_is_platform_operator',\n platformJourneys: 'getting_started_platform_journeys',\n trialSet: 'getting_started_trial_set',\n} as const\n","import { getActiveTenantId, getSupabaseClientOptional } from '@fayz-ai/core'\nimport type { Journey, JourneyEvent, JourneyMinimums, RequestContractResult, StartTrialRefusal, StartTrialResult } from '../types'\nimport { GettingStartedError, type GettingStartedDataProvider } from './types'\nimport { RPC, T } from './tables'\n\ntype Row = Record<string, unknown>\n\nfunction client(): any {\n const c = getSupabaseClientOptional()\n if (!c) throw new GettingStartedError('getting-started: no Supabase client registered')\n return c\n}\n\nfunction raise(error: unknown): never {\n const e = (error ?? {}) as { message?: unknown; code?: unknown }\n throw new GettingStartedError(\n typeof e.message === 'string' ? e.message : 'getting-started: request failed',\n typeof e.code === 'string' ? e.code : undefined,\n )\n}\n\nconst str = (v: unknown): string | null => (typeof v === 'string' ? v : null)\n\nexport function mapMinimums(raw: unknown): JourneyMinimums {\n const m = (raw ?? {}) as Row\n const menu = m.menu === true\n const hours = m.hours === true\n const testOrder = m.test_order === true\n return { menu, hours, testOrder, ready: m.ready === true || (menu && hours && testOrder) }\n}\n\n/** The jsonb `getting_started_journey()` answers, as the plugin reads it. */\nexport function mapJourney(raw: Row): Journey {\n const phase = str(raw.phase)\n return {\n tenantId: String(raw.tenant_id ?? ''),\n phase: phase === 'trial' || phase === 'expired' || phase === 'converted' ? phase : 'setup',\n trialDays: Number(raw.trial_days ?? 0) || 0,\n readyAt: str(raw.ready_at),\n trialStartedAt: str(raw.trial_started_at),\n trialEndsAt: str(raw.trial_ends_at),\n setupDeadlineAt: str(raw.setup_deadline_at),\n convertedAt: str(raw.converted_at),\n wantsContractAt: str(raw.wants_contract_at),\n source: str(raw.source),\n utm: (raw.utm && typeof raw.utm === 'object' ? raw.utm : {}) as Record<string, unknown>,\n minimums: mapMinimums(raw.minimums),\n }\n}\n\nexport function mapStartTrial(raw: Row): StartTrialResult {\n if (raw.ok === true) {\n return {\n ok: true,\n alreadyStarted: raw.already_started === true,\n trialStartedAt: String(raw.trial_started_at ?? ''),\n trialEndsAt: String(raw.trial_ends_at ?? ''),\n trialDays: raw.trial_days == null ? undefined : Number(raw.trial_days),\n }\n }\n return { ok: false, reason: refusal(raw.reason), minimums: mapMinimums(raw.minimums) }\n}\n\nconst REFUSALS: readonly StartTrialRefusal[] = ['minimums_missing', 'no_trial_window', 'already_converted', 'already_paid']\nfunction refusal(raw: unknown): StartTrialRefusal {\n return REFUSALS.find((r) => r === raw) ?? 'minimums_missing'\n}\n\nfunction mapEvent(r: Row): JourneyEvent {\n return {\n id: String(r.id),\n tenantId: String(r.tenant_id),\n kind: String(r.kind),\n day: String(r.day),\n channel: str(r.channel),\n payload: (r.payload && typeof r.payload === 'object' ? r.payload : {}) as Record<string, unknown>,\n actorId: str(r.actor_id),\n createdAt: String(r.created_at),\n }\n}\n\nexport function createSupabaseGettingStartedProvider(): GettingStartedDataProvider {\n return {\n async getJourney() {\n const { data, error } = await client().rpc(RPC.journey)\n if (error) raise(error)\n return data && typeof data === 'object' ? mapJourney(data as Row) : null\n },\n\n async startTrial() {\n // No p_tenant: the RPC resolves the tenant from the session, like tenant_setting_set.\n const { data, error } = await client().rpc(RPC.startTrial)\n if (error) raise(error)\n return mapStartTrial((data ?? {}) as Row)\n },\n\n async requestContract(note) {\n const { data, error } = await client().rpc(RPC.requestContract, { p_note: note ?? null })\n if (error) raise(error)\n const r = (data ?? {}) as Row\n return { ok: true, alreadyRequestedToday: r.already_requested_today === true } satisfies RequestContractResult\n },\n\n async listEvents(limit = 20) {\n let query = client().from(T.events).select('*').order('created_at', { ascending: false }).limit(limit)\n const tenantId = getActiveTenantId()\n if (tenantId) query = query.eq('tenant_id', tenantId)\n const { data, error } = await query\n if (error) raise(error)\n return ((data ?? []) as Row[]).map(mapEvent)\n },\n }\n}\n","import type { Journey, JourneyEvent, JourneyMinimums, JourneyPhase, RequestContractResult, StartTrialResult } from '../types'\nimport type { GettingStartedDataProvider } from './types'\n\nexport interface MockGettingStartedOptions {\n tenantId?: string\n /** plg_getting_started_config.trial_days */\n trialDays?: number\n /** The spine DEFAULT on tenants.trial_ends_at (db 044): the preparation window. */\n setupWindowDays?: number\n minimums?: Partial<Omit<JourneyMinimums, 'ready'>>\n /** Injectable clock, so a test can walk through the phases without waiting. */\n now?: () => Date\n}\n\nexport interface MockGettingStartedProvider extends GettingStartedDataProvider {\n /** What the sensors would have found. */\n setMinimums(patch: Partial<Omit<JourneyMinimums, 'ready'>>): void\n /** Marks the tenant as paying — the phase becomes `converted`. */\n markConverted(): void\n}\n\nconst DAY_MS = 86_400_000\nconst isoDay = (d: Date) => d.toISOString().slice(0, 10)\n\n/** The same rules as v_getting_started_journey, so the mock and the pool agree. */\nexport function derivePhase(input: {\n now: Date\n trialEndsAt: string | null\n trialStartedAt: string | null\n convertedAt: string | null\n}): JourneyPhase {\n if (input.convertedAt) return 'converted'\n if (input.trialEndsAt && new Date(input.trialEndsAt).getTime() <= input.now.getTime()) return 'expired'\n if (input.trialStartedAt) return 'trial'\n return 'setup'\n}\n\nexport function createMockGettingStartedProvider(options: MockGettingStartedOptions = {}): MockGettingStartedProvider {\n const now = options.now ?? (() => new Date())\n const tenantId = options.tenantId ?? 'mock-tenant'\n const trialDays = options.trialDays ?? 14\n const createdAt = now()\n\n const state = {\n trialEndsAt: new Date(createdAt.getTime() + (options.setupWindowDays ?? 30) * DAY_MS).toISOString() as string | null,\n readyAt: null as string | null,\n trialStartedAt: null as string | null,\n trialDays: null as number | null,\n convertedAt: null as string | null,\n wantsContractAt: null as string | null,\n minimums: { menu: false, hours: false, testOrder: false, ...options.minimums },\n events: [] as JourneyEvent[],\n }\n\n const minimums = (): JourneyMinimums => ({\n ...state.minimums,\n ready: state.minimums.menu && state.minimums.hours && state.minimums.testOrder,\n })\n\n // Same lock as the table: (tenant, kind, day) once.\n const recordEvent = (kind: string, payload: Record<string, unknown>): boolean => {\n const day = isoDay(now())\n if (state.events.some((e) => e.kind === kind && e.day === day)) return false\n state.events.unshift({\n id: `evt-${state.events.length + 1}`,\n tenantId, kind, day, channel: null, payload, actorId: null,\n createdAt: now().toISOString(),\n })\n return true\n }\n\n return {\n async getJourney(): Promise<Journey> {\n const current = now()\n return {\n tenantId,\n phase: derivePhase({ now: current, ...state }),\n trialDays: state.trialDays ?? trialDays,\n readyAt: state.readyAt,\n trialStartedAt: state.trialStartedAt,\n trialEndsAt: state.trialEndsAt,\n setupDeadlineAt: state.trialStartedAt ? null : state.trialEndsAt,\n convertedAt: state.convertedAt,\n wantsContractAt: state.wantsContractAt,\n source: null,\n utm: {},\n minimums: minimums(),\n }\n },\n\n async startTrial(): Promise<StartTrialResult> {\n if (state.trialStartedAt) {\n return { ok: true, alreadyStarted: true, trialStartedAt: state.trialStartedAt, trialEndsAt: state.trialEndsAt ?? '' }\n }\n const m = minimums()\n if (!m.ready) return { ok: false, reason: 'minimums_missing', minimums: m }\n const started = now()\n const ends = new Date(started.getTime() + trialDays * DAY_MS)\n state.readyAt = state.readyAt ?? started.toISOString()\n state.trialStartedAt = started.toISOString()\n state.trialDays = trialDays\n state.trialEndsAt = ends.toISOString()\n recordEvent('trial_started', { trial_days: trialDays, ends_at: state.trialEndsAt })\n return { ok: true, alreadyStarted: false, trialStartedAt: state.trialStartedAt, trialEndsAt: state.trialEndsAt, trialDays }\n },\n\n async requestContract(note?: string): Promise<RequestContractResult> {\n const inserted = recordEvent('wants_contract', { note: (note ?? '').slice(0, 500) })\n if (!inserted) return { ok: true, alreadyRequestedToday: true }\n state.wantsContractAt = state.wantsContractAt ?? now().toISOString()\n return { ok: true, alreadyRequestedToday: false }\n },\n\n async listEvents(limit = 20) {\n return state.events.slice(0, limit)\n },\n\n setMinimums(patch) {\n state.minimums = { ...state.minimums, ...patch }\n },\n\n markConverted() {\n state.convertedAt = now().toISOString()\n },\n }\n}\n","import { emitDomainEvent, getActiveTenantId, getSupabaseClientOptional } from '@fayz-ai/core'\nimport { useOrganizationStore } from '@fayz-ai/admin/host'\nimport { normalizePaymentMethods } from '@fayz-ai/ui'\nimport { WEEKDAYS, type HoursRange, type PaymentMethod, type StoreHours } from '../types'\n\nexport type StoreSettingKey = 'hours' | 'payment_methods'\n\n/** Local fact the shell's activation sweep wakes on (any domain event does). */\nexport const STORE_SETTINGS_SAVED_EVENT = 'getting_started.store_settings_saved'\n\nexport function asHours(value: unknown): StoreHours {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return {}\n const out: StoreHours = {}\n for (const day of WEEKDAYS) {\n const ranges = (value as Record<string, unknown>)[day]\n if (Array.isArray(ranges)) {\n out[day] = ranges\n .filter((r): r is HoursRange => !!r && typeof r === 'object' && typeof (r as HoursRange).open === 'string' && typeof (r as HoursRange).close === 'string')\n .map((r) => ({ open: r.open, close: r.close }))\n }\n }\n return out\n}\n\n/** The UI kit's vocabulary (the wizard's ids); legacy ids map, unknown ones drop. */\nexport function asMethods(value: unknown): PaymentMethod[] {\n return normalizePaymentMethods(value)\n}\n\nfunction storeOf(settings: Record<string, unknown> | undefined): Record<string, unknown> {\n const store = settings?.store\n return store && typeof store === 'object' && !Array.isArray(store) ? (store as Record<string, unknown>) : {}\n}\n\n/**\n * `tenants.settings.store.*` as the workspace in memory has it — the same row\n * the wizard wrote at birth and the sensors read (tech design, decision 5).\n */\nexport function readStoreSettings(settings: Record<string, unknown> | undefined = useOrganizationStore.getState().currentOrg?.settings): {\n hours: StoreHours\n methods: PaymentMethod[]\n} {\n const store = storeOf(settings)\n return { hours: asHours(store.hours), methods: asMethods(store.payment_methods) }\n}\n\n/** Repaints the workspace in memory and raises the local fact the sweep listens to. */\nexport function reflectInWorkspace(key: StoreSettingKey, value: unknown): void {\n const org = useOrganizationStore.getState().currentOrg\n if (!org) return\n const store = { ...storeOf(org.settings), [key]: value }\n useOrganizationStore.getState().paintCurrentOrg({ ...org, settings: { ...(org.settings ?? {}), store } })\n emitDomainEvent(STORE_SETTINGS_SAVED_EVENT, { key: `store.${key}` }, { tenantId: org.id })\n}\n\nexport type SaveStoreSettingVia = 'rpc' | 'row' | 'provider'\n\nexport type SaveStoreSettingResult =\n | { ok: true; via: SaveStoreSettingVia }\n | { ok: false; reason: 'offline' | 'no-tenant' | 'error'; message?: string }\n\n/**\n * Where the store's own settings (hours, payment methods) live. The default\n * writes `tenants.settings.store` on the platform; a host with its own schema\n * installs one with `configureStoreSettings`. Both methods resolve — a failure\n * is `{ ok: false }` / `undefined`, never a throw.\n */\nexport interface StoreSettingsProvider {\n /** The tenant's `store` branch (`{ hours, payment_methods }`), `undefined` when unknown. */\n read(tenantId: string): Promise<Record<string, unknown> | undefined>\n save(tenantId: string, key: StoreSettingKey, value: unknown): Promise<SaveStoreSettingResult>\n}\n\nconst text = (e: unknown): string => (e instanceof Error ? e.message : typeof (e as { message?: unknown })?.message === 'string' ? String((e as { message: string }).message) : String(e))\nconst code = (e: unknown): string | undefined => (typeof (e as { code?: unknown })?.code === 'string' ? String((e as { code: string }).code) : undefined)\n\n/** `tenant_setting_set` refuses a key its registry does not know — the pool has not run migration 000. */\nfunction isUnknownKey(error: unknown): boolean {\n return code(error) === '22023' || /unknown key/i.test(text(error))\n}\n\n/**\n * The platform: `tenant_setting_set` the way the settings registry wants it,\n * falling back to the row when the registry does not know the key yet.\n *\n * Both paths land in the same place — `tenant_setting_set` is an UPDATE on\n * `tenants.settings` — so the fallback is not a second store, only a second\n * door to the same one, for the pool that has not applied the plugin's\n * migration.\n */\nexport const supabaseStoreSettingsProvider: StoreSettingsProvider = {\n async read(tenantId) {\n const supabase = getSupabaseClientOptional() as any\n if (!supabase) return undefined\n const { data, error } = await supabase.from('tenants').select('settings').eq('id', tenantId).maybeSingle()\n if (error) throw error\n return storeBranch((data?.settings ?? undefined) as Record<string, unknown> | undefined)\n },\n\n async save(tenantId, key, value) {\n const supabase = getSupabaseClientOptional() as any\n if (!supabase) return { ok: false, reason: 'offline' }\n const { error } = await supabase.rpc('tenant_setting_set', { p_key: `store.${key}`, p_value: value ?? null })\n if (!error) return { ok: true, via: 'rpc' }\n if (!isUnknownKey(error)) return { ok: false, reason: 'error', message: text(error) }\n\n // Same merge the memory got, written whole under `settings.store` only: the\n // other branches of `settings` are kept as the row has them right now.\n const fresh = useOrganizationStore.getState().currentOrg\n const base = fresh?.id === tenantId ? fresh.settings ?? {} : {}\n const settings = { ...base, store: { ...storeOf(base), [key]: value } }\n const { error: rowError } = await supabase.from('tenants').update({ settings }).eq('id', tenantId)\n if (rowError) return { ok: false, reason: 'error', message: text(rowError) }\n return { ok: true, via: 'row' }\n },\n}\n\nlet activeProvider: StoreSettingsProvider = supabaseStoreSettingsProvider\n\n/** `null` restores the platform default. */\nexport function configureStoreSettings(provider: StoreSettingsProvider | null): void {\n activeProvider = provider ?? supabaseStoreSettingsProvider\n branchCache = null\n}\n\nexport function getStoreSettingsProvider(): StoreSettingsProvider {\n return activeProvider\n}\n\nfunction storeBranch(settings: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n return settings && 'store' in settings ? storeOf(settings) : undefined\n}\n\n/**\n * Writes `store.<key>` through the provider. The in-memory workspace is\n * repainted first either way: the checklist closes the step the moment the\n * owner saves, not on the next reload.\n */\nexport async function saveStoreSetting(key: StoreSettingKey, value: unknown): Promise<SaveStoreSettingResult> {\n const org = useOrganizationStore.getState().currentOrg\n if (!org) return { ok: false, reason: 'no-tenant' }\n reflectInWorkspace(key, value)\n branchCache = null\n let result: SaveStoreSettingResult\n try {\n result = await activeProvider.save(org.id, key, value)\n } catch (e) {\n result = { ok: false, reason: 'error', message: text(e) }\n }\n if (result.ok) landed(org.id, key)\n return result\n}\n\n/** Raised again once the row has it: a sensor that reads the database (the\n * server's minimums) only agrees after the write, not after the repaint. */\nfunction landed(tenantId: string, key: StoreSettingKey): void {\n emitDomainEvent(STORE_SETTINGS_SAVED_EVENT, { key: `store.${key}`, persisted: true }, { tenantId })\n}\n\nconst READ_CACHE_MS = 10_000\nlet branchCache: { tenantId: string; at: number; store: Record<string, unknown> | undefined } | null = null\n\n/**\n * `tenants.settings` (as the sensors read it) for the active tenant: the\n * workspace in memory when it already carries `store`, the provider when it\n * does not.\n *\n * The org store does paint `settings`, but a fresh workspace reaches the first\n * sweep by a path that may not have it yet (the org handed back by the wizard,\n * a switch mid-load, a host that paints no settings at all). A sensor that\n * answers \"no\" from a memory that was merely empty leaves the step open until\n * some other event happens to re-run it — so when memory has no `store`, the\n * provider is asked, once per ten seconds per tenant.\n */\nexport async function loadStoreSettings(): Promise<Record<string, unknown> | undefined> {\n const org = useOrganizationStore.getState().currentOrg\n const inMemory = org?.settings\n if (inMemory && 'store' in inMemory) return inMemory\n const tenantId = org?.id ?? getActiveTenantId()\n if (!tenantId) return inMemory\n const now = Date.now()\n let store: Record<string, unknown> | undefined\n if (branchCache && branchCache.tenantId === tenantId && now - branchCache.at < READ_CACHE_MS) {\n store = branchCache.store\n } else {\n try {\n store = await activeProvider.read(tenantId)\n } catch {\n store = undefined\n }\n branchCache = { tenantId, at: now, store }\n }\n if (!store) return inMemory\n // Paint what the provider knows so the next sensor, and the tab, read memory.\n const current = useOrganizationStore.getState().currentOrg\n if (current && current.id === tenantId) {\n useOrganizationStore.getState().paintCurrentOrg({ ...current, settings: { ...(current.settings ?? {}), store } })\n }\n return { ...(inMemory ?? {}), store }\n}\n","import { useBusinessProfileStore } from '@fayz-ai/admin/host'\n\n// ---------------------------------------------------------------------------\n// The store profile — how the house works (service modes, tables, delivery\n// apps…). On the platform it is written where the wizard's answers live\n// (`plg_onboarding_responses`, through the business-profile store) so every\n// `appliesWhen` reads it; a host with its own schema injects a\n// `StoreProfileProvider`.\n// ---------------------------------------------------------------------------\n\n/** Answer keys other readers depend on (plugin-orders' delivery step, the handbook). */\nexport const PROFILE_KEYS = {\n operation: 'food.operation',\n serviceModes: 'food.serviceModes',\n deliveryMethod: 'food.deliveryMethod',\n tables: 'food.tables',\n marketplaceApps: 'food.marketplaceApps',\n welcomeArticle: 'workspace.welcomeArticle',\n} as const\n\nexport const OPERATIONS = ['restaurant', 'snack-bar', 'pizzeria', 'cafe', 'bar', 'dark-kitchen', 'food-truck', 'bakery', 'other'] as const\nexport const SERVICE_MODES = ['counter', 'own-delivery', 'dine-in', 'aggregator'] as const\nexport const DELIVERY_METHODS = ['radius', 'neighborhood'] as const\nexport const TABLE_BANDS = ['lt10', '10-25', '25-50', 'gt50'] as const\nexport const WELCOME_ARTICLES = ['a', 'o'] as const\n\nexport type StoreOperation = (typeof OPERATIONS)[number]\nexport type StoreServiceMode = (typeof SERVICE_MODES)[number]\nexport type StoreDeliveryMethod = (typeof DELIVERY_METHODS)[number]\nexport type StoreTableBand = (typeof TABLE_BANDS)[number]\n\n/** The step key of the profile step in the store-live program. */\nexport const STORE_PROFILE_STEP_KEY = 'profile'\n\n/** What the profile step asks and the `saveStoreProfile` tool writes. Every field optional: a save is a patch. */\nexport interface StoreProfile {\n /** The kind of place. */\n operation?: StoreOperation\n /** How people order. The step is done once this has at least one mode. */\n serviceModes?: StoreServiceMode[]\n /** How delivery is charged. */\n deliveryMethod?: StoreDeliveryMethod\n /** How many tables (band). */\n tables?: StoreTableBand\n /** Delivery apps the orders arrive through, lower-case ids (`ifood`, `rappi`…). */\n marketplaceApps?: string[]\n /** The article of the greeting (\"a Cantina\", \"o Bar\"). */\n welcomeArticle?: (typeof WELCOME_ARTICLES)[number]\n}\n\nexport type SaveStoreProfileWriteResult =\n | { ok: true }\n | { ok: false; reason: 'no-user' | 'offline' | 'write-failed'; message?: string }\n\n/**\n * Where the store profile lives. The platform default reads and writes the\n * business-profile store (`plg_onboarding_responses`); a host installs its own\n * through `createGettingStartedHost({ storeProfile })`. Both methods resolve —\n * a failure is `null` / `{ ok: false }`, never a throw.\n */\nexport interface StoreProfileProvider {\n /** The tenant's profile, `null` when never answered or unknown. */\n read(tenantId: string): Promise<StoreProfile | null>\n /** Merges `patch` into the tenant's profile. `businessName` is the org's name, for providers that keep it. */\n save(tenantId: string, patch: StoreProfile, context: { businessName?: string }): Promise<SaveStoreProfileWriteResult>\n}\n\nfunction oneOf<T extends string>(value: unknown, allowed: readonly T[]): T | undefined {\n return typeof value === 'string' && (allowed as readonly string[]).includes(value) ? (value as T) : undefined\n}\n\nexport function someOf<T extends string>(value: unknown, allowed: readonly T[]): T[] {\n const list = Array.isArray(value) ? value : typeof value === 'string' ? [value] : []\n return allowed.filter((id) => list.includes(id))\n}\n\n/** The fields that are answers from the catalogue; unknown values are dropped. */\nexport function storeProfileFrom(source: Record<string, unknown> | null | undefined): StoreProfile {\n const out: StoreProfile = {}\n if (!source) return out\n const operation = oneOf(source.operation, OPERATIONS)\n if (operation) out.operation = operation\n const modes = someOf(source.serviceModes, SERVICE_MODES)\n if (modes.length > 0) out.serviceModes = modes\n const delivery = oneOf(source.deliveryMethod, DELIVERY_METHODS)\n if (delivery) out.deliveryMethod = delivery\n const tables = oneOf(source.tables, TABLE_BANDS)\n if (tables) out.tables = tables\n if (Array.isArray(source.marketplaceApps)) {\n const apps = source.marketplaceApps.filter((a): a is string => typeof a === 'string' && a.trim() !== '').map((a) => a.trim().toLowerCase())\n if (apps.length > 0) out.marketplaceApps = [...new Set(apps)]\n }\n const article = oneOf(source.welcomeArticle, WELCOME_ARTICLES)\n if (article) out.welcomeArticle = article\n return out\n}\n\n/** A profile as the wizard keyed its answers (`food.serviceModes`, …). */\nexport function storeProfileToAnswers(profile: StoreProfile): Record<string, unknown> {\n const answers: Record<string, unknown> = {}\n for (const [field, key] of Object.entries(PROFILE_KEYS) as Array<[keyof StoreProfile, string]>) {\n if (profile[field] !== undefined) answers[key] = profile[field]\n }\n return answers\n}\n\n/** The wizard's answers read back as a profile. */\nexport function storeProfileFromAnswers(answers: Record<string, unknown> | null | undefined): StoreProfile {\n if (!answers) return {}\n const source: Record<string, unknown> = {}\n for (const [field, key] of Object.entries(PROFILE_KEYS)) source[field] = answers[key]\n return storeProfileFrom(source)\n}\n\n/** The profile step closes when the house said how it serves. */\nexport function storeProfileAnswered(profile: StoreProfile | null | undefined): boolean {\n return (profile?.serviceModes?.length ?? 0) > 0\n}\n\n/**\n * The platform's store profile: the business-profile store, which paints the\n * answers in memory first (every `appliesWhen` re-reads at once) and then\n * writes a new `plg_onboarding_responses` row.\n */\nexport const businessProfileStoreProfileProvider: StoreProfileProvider = {\n read: async () => {\n const answers = useBusinessProfileStore.getState().profile?.answers\n return answers ? storeProfileFromAnswers(answers) : null\n },\n save: (tenantId, patch, context) =>\n useBusinessProfileStore.getState().record({ tenantId, answers: storeProfileToAnswers(patch), businessName: context.businessName }),\n}\n\nlet activeProfileProvider: StoreProfileProvider = businessProfileStoreProfileProvider\n\n/** Installs the host's store profile; `null` restores the platform default. */\nexport function configureStoreProfile(provider: StoreProfileProvider | null): void {\n activeProfileProvider = provider ?? businessProfileStoreProfileProvider\n}\n\nexport function getStoreProfileProvider(): StoreProfileProvider {\n return activeProfileProvider\n}\n","import { emitDomainEvent, type PluginAITool } from '@fayz-ai/core'\nimport {\n DAY_KEYS, HOURS_FORMAT_PT_BR, PAYMENT_METHOD_IDS, PAYMENT_METHOD_LABELS_PT_BR, formatHours, formatShifts, isHoursValue,\n normalizeHours, normalizePaymentMethods, openDays, type DayKey, type HoursShift, type HoursValue, type PaymentMethodId,\n} from '@fayz-ai/ui'\nimport {\n hasAIToolHandler, registerAIToolHandler, unregisterAIToolHandler, useOrganizationStore, type AIToolHandler,\n} from '@fayz-ai/admin/host'\nimport { isForbidden } from '../data/types'\nimport type { JourneyState } from '../store'\nimport { MINIMUM_IDS, type Journey, type JourneyMinimums, type MinimumId, type StoreHours } from '../types'\nimport { saveStoreSetting, type SaveStoreSettingVia } from './store-settings'\nimport {\n DELIVERY_METHODS, OPERATIONS, PROFILE_KEYS, SERVICE_MODES, TABLE_BANDS, getStoreProfileProvider, storeProfileAnswered,\n storeProfileFrom, storeProfileFromAnswers, storeProfileToAnswers, type SaveStoreProfileWriteResult, type StoreServiceMode,\n} from './store-profile'\n\nconst MINIMUM_WORDS: Record<MinimumId, string> = {\n menu: 'cardápio com ao menos um produto',\n hours: 'horário de funcionamento',\n testOrder: 'um pedido de teste',\n}\n\n/** The minimums still open, in the words the assistant says them. */\nexport function missingMinimums(minimums: JourneyMinimums): MinimumId[] {\n return MINIMUM_IDS.filter((id) => !minimums[id])\n}\n\nexport function describeJourney(journey: Journey) {\n const missing = missingMinimums(journey.minimums)\n return {\n phase: journey.phase,\n trialDays: journey.trialDays,\n trialStartedAt: journey.trialStartedAt,\n trialEndsAt: journey.trialEndsAt,\n setupDeadlineAt: journey.setupDeadlineAt,\n wantsContractAt: journey.wantsContractAt,\n minimums: journey.minimums,\n missing: missing.map((id) => MINIMUM_WORDS[id]),\n ready: journey.minimums.ready,\n }\n}\n\n// ---------------------------------------------------------------------------\n// Opening hours — a sentence or a one-click model becomes `store.hours`.\n// ---------------------------------------------------------------------------\n\nexport const HOURS_TEMPLATE_IDS = ['lunch', 'dinner', 'lunch-dinner', 'weekend'] as const\nexport type HoursTemplateId = (typeof HOURS_TEMPLATE_IDS)[number]\n\nexport interface StoreHoursTemplate {\n id: HoursTemplateId\n label: string\n hint: string\n hours: HoursValue\n}\n\nconst EVERY_DAY = (shifts: HoursShift[]): HoursValue => ({\n mon: shifts, tue: shifts, wed: shifts, thu: shifts, fri: shifts, sat: shifts, sun: shifts,\n})\n\n/** The four one-click models the chat offers; same as Brendi's, in a kitchen's words. */\nexport const HOURS_TEMPLATES: ReadonlyArray<StoreHoursTemplate> = [\n { id: 'lunch', label: 'Almoço', hint: 'todo dia · 11:00–15:00', hours: EVERY_DAY([{ open: '11:00', close: '15:00' }]) },\n { id: 'dinner', label: 'Jantar', hint: 'todo dia · 18:00–23:00', hours: EVERY_DAY([{ open: '18:00', close: '23:00' }]) },\n {\n id: 'lunch-dinner',\n label: 'Almoço e jantar',\n hint: 'todo dia · 11–15 e 18–23',\n hours: EVERY_DAY([{ open: '11:00', close: '15:00' }, { open: '18:00', close: '23:00' }]),\n },\n {\n id: 'weekend',\n label: 'Fim de semana',\n hint: 'sex a dom · 18:00–00:00',\n hours: {\n mon: [], tue: [], wed: [], thu: [],\n fri: [{ open: '18:00', close: '00:00' }],\n sat: [{ open: '18:00', close: '00:00' }],\n sun: [{ open: '18:00', close: '00:00' }],\n },\n },\n]\n\nexport const HOURS_TEMPLATE_CHOICE = 'store-hours-template'\n/** The fifth row of the hours card: no model, the person says the week. */\nexport const HOURS_CUSTOM_OPTION = 'custom'\n\nfunction stripAccents(text: string): string {\n return text.normalize('NFD').replace(/[̀-ͯ]/g, '')\n}\n\nconst DAY_WORDS: Array<[RegExp, DayKey]> = [\n [/\\bsegunda(?:-feira)?\\b|\\bseg\\b/, 'mon'],\n [/\\bterca(?:-feira)?\\b|\\bter\\b/, 'tue'],\n [/\\bquarta(?:-feira)?\\b|\\bqua\\b/, 'wed'],\n [/\\bquinta(?:-feira)?\\b|\\bqui\\b/, 'thu'],\n [/\\bsexta(?:-feira)?\\b|\\bsex\\b/, 'fri'],\n [/\\bsabado\\b|\\bsab\\b/, 'sat'],\n [/\\bdomingo\\b|\\bdom\\b/, 'sun'],\n]\n\nconst ALL_DAYS = /\\btodos? (?:os )?dias?\\b|\\bdiariamente\\b|\\ba semana (?:toda|inteira)\\b|\\btoda semana\\b|\\bsempre\\b/\nconst WEEKEND = /\\bfi(?:m|nal) de semana\\b|\\bfds\\b/\nconst WEEKDAYS_ONLY = /\\bdias? uteis\\b|\\bde segunda a sexta\\b/\nconst CLOSED = /\\bfechad[oa]s?\\b|\\bnao abr(?:e|imos)\\b|\\bfecha(?:mos)?\\b|\\bfolga\\b/\n\ntype Token =\n | { at: number; kind: 'days'; days: DayKey[]; closed: boolean }\n | { at: number; kind: 'shift'; shift: HoursShift }\n\nfunction hhmm(hour: string, minute: string | undefined): string | null {\n const h = Number(hour)\n const m = Number(minute ?? '0')\n if (!Number.isInteger(h) || h < 0 || h > 24 || !Number.isInteger(m) || m < 0 || m > 59) return null\n return `${String(h === 24 ? 0 : h).padStart(2, '0')}:${String(m).padStart(2, '0')}`\n}\n\n/** `seg a sex` → the run of days between, wrapping past Sunday. */\nfunction dayRun(from: DayKey, to: DayKey): DayKey[] {\n const a = DAY_KEYS.indexOf(from)\n const b = DAY_KEYS.indexOf(to)\n const out: DayKey[] = []\n for (let i = a; ; i = (i + 1) % 7) {\n out.push(DAY_KEYS[i]!)\n if (i === b) break\n if (out.length > 7) break\n }\n return out\n}\n\n/**\n * A pt-BR sentence about the week → the days and shifts it names.\n *\n * Covers how a kitchen actually says it: \"seg a sex 11h às 15h e 18h às 23h,\n * sáb 18h à meia-noite\", \"todo dia das 18 às 23\", \"de terça a domingo\n * 11:00-23:00, fecha segunda\". Times apply to the last days named before them;\n * times before any day apply to the whole week; a day named with \"fechado\" is\n * closed. Anything it cannot read is `null` — the card is where the person\n * corrects, never a guess that lands in the row.\n */\nexport function parseHoursText(raw: string): HoursValue | null {\n if (!raw || typeof raw !== 'string') return null\n const text = stripAccents(raw.toLowerCase())\n .replace(/meia[- ]noite/g, '00:00')\n .replace(/meio[- ]dia/g, '12:00')\n const tokens: Token[] = []\n\n const SHIFT = /(\\d{1,2})(?:[:h](\\d{2}))?\\s*(?:h|hs|horas)?\\s*(?:as|a|ate|-|–|—|\\/)\\s*(?:as\\s+)?(\\d{1,2})(?:[:h](\\d{2}))?\\s*(?:h|hs|horas)?/g\n for (const m of text.matchAll(SHIFT)) {\n const open = hhmm(m[1]!, m[2])\n const close = hhmm(m[3]!, m[4])\n if (!open || !close || open === close) continue\n tokens.push({ at: m.index ?? 0, kind: 'shift', shift: { open, close } })\n }\n // Day ranges first (\"seg a sex\", \"de terca a domingo\"); single days after,\n // skipping the ones already inside a range.\n const covered: Array<[number, number]> = []\n const inRange = (i: number) => covered.some(([a, b]) => i >= a && i < b)\n const dayAlt = DAY_WORDS.map(([re]) => re.source).join('|')\n const RANGE = new RegExp(`(?:de\\\\s+)?(${dayAlt})\\\\s*(?:a|as|ate|-|–|—)\\\\s*(${dayAlt})`, 'g')\n for (const m of text.matchAll(RANGE)) {\n const from = DAY_WORDS.find(([re]) => re.test(m[1]!))?.[1]\n const to = DAY_WORDS.find(([re]) => re.test(m[2]!))?.[1]\n if (!from || !to) continue\n // A shift (\"11 as 15\") is not a day range, but \"sex a dom\" is — the day\n // words settle it, the regexp above does not see digits.\n const at = m.index ?? 0\n covered.push([at, at + m[0].length])\n tokens.push({ at, kind: 'days', days: dayRun(from, to), closed: false })\n }\n for (const [re, day] of DAY_WORDS) {\n for (const m of text.matchAll(new RegExp(re.source, 'g'))) {\n const at = m.index ?? 0\n if (inRange(at)) continue\n tokens.push({ at, kind: 'days', days: [day], closed: false })\n }\n }\n for (const m of text.matchAll(new RegExp(ALL_DAYS.source, 'g'))) tokens.push({ at: m.index ?? 0, kind: 'days', days: [...DAY_KEYS], closed: false })\n for (const m of text.matchAll(new RegExp(WEEKEND.source, 'g'))) tokens.push({ at: m.index ?? 0, kind: 'days', days: ['sat', 'sun'], closed: false })\n for (const m of text.matchAll(new RegExp(WEEKDAYS_ONLY.source, 'g'))) {\n if (inRange(m.index ?? 0)) continue\n tokens.push({ at: m.index ?? 0, kind: 'days', days: ['mon', 'tue', 'wed', 'thu', 'fri'], closed: false })\n }\n // \"fecha segunda\" / \"segunda fechado\": the closed word marks the nearest day group.\n for (const m of text.matchAll(new RegExp(CLOSED.source, 'g'))) {\n const at = m.index ?? 0\n const groups = tokens.filter((t): t is Extract<Token, { kind: 'days' }> => t.kind === 'days')\n const nearest = groups.reduce<Extract<Token, { kind: 'days' }> | null>((best, t) => {\n const d = Math.abs(t.at - at)\n return !best || d < Math.abs(best.at - at) ? t : best\n }, null)\n if (nearest && Math.abs(nearest.at - at) <= 24) nearest.closed = true\n }\n\n tokens.sort((a, b) => a.at - b.at)\n if (!tokens.some((t) => t.kind === 'shift')) return null\n\n // Walk in reading order: a day group opens a segment; the shifts after it\n // belong to it; two day groups in a row (\"seg a sex, sab e dom das 18 as 23\")\n // are one segment.\n const segments: Array<{ days: DayKey[]; shifts: HoursShift[]; closed: boolean }> = []\n for (const token of tokens) {\n const last = segments[segments.length - 1]\n if (token.kind === 'days') {\n if (last && last.shifts.length === 0 && !last.closed && !token.closed) {\n last.days = [...new Set([...last.days, ...token.days])]\n } else {\n segments.push({ days: token.days, shifts: [], closed: token.closed })\n }\n continue\n }\n if (!last) segments.push({ days: [...DAY_KEYS], shifts: [token.shift], closed: false })\n else last.shifts.push(token.shift)\n }\n\n const week: HoursValue = {}\n for (const day of DAY_KEYS) week[day] = []\n for (const segment of segments) {\n // Days named after the times (\"11 às 23 todo dia\") add nothing of their\n // own; they must not wipe what the implicit whole-week segment set.\n if (!segment.closed && segment.shifts.length === 0) continue\n for (const day of segment.days) week[day] = segment.closed ? [] : segment.shifts.map((s) => ({ ...s }))\n }\n if (!isHoursValue(week) || openDays(week).length === 0) return null\n return week\n}\n\nconst PT_DAYS = HOURS_FORMAT_PT_BR.days\n\nexport interface LabelledDay {\n day: DayKey\n /** The line the confirmation card shows: \"seg 11:00–15:00 e 18:00–23:00\". */\n label: string\n shifts: HoursShift[]\n}\n\n/** Open days, one labelled line each — what `saveStoreHours` is called with. */\nexport function labelWeek(hours: HoursValue): LabelledDay[] {\n const week = normalizeHours(hours)\n return openDays(week).map((day) => ({\n day,\n label: `${PT_DAYS[day]} ${formatShifts(week[day], HOURS_FORMAT_PT_BR)}`,\n shifts: (week[day] ?? []).map((s) => ({ open: s.open, close: s.close })),\n }))\n}\n\n/** `week` rows (from a proposal) → the week. Rows with a bad day or shift are dropped. */\nfunction weekFromRows(rows: unknown): HoursValue | null {\n if (!Array.isArray(rows)) return null\n const week: HoursValue = {}\n for (const day of DAY_KEYS) week[day] = []\n let any = false\n for (const raw of rows) {\n const row = (raw ?? {}) as { day?: unknown; shifts?: unknown }\n if (typeof row.day !== 'string' || !DAY_KEYS.includes(row.day as DayKey) || !Array.isArray(row.shifts)) continue\n const shifts = row.shifts.filter((s): s is HoursShift => isHoursValue({ mon: [s] }))\n week[row.day as DayKey] = shifts.map((s) => ({ open: s.open, close: s.close }))\n if (shifts.length > 0) any = true\n }\n return any ? week : null\n}\n\n/** What the model handed over, in order of trust: a model, the rows, a week object, the sentence. */\nexport function hoursFromArgs(args: Record<string, unknown>): { hours: HoursValue; template?: HoursTemplateId } | null {\n const templateId = typeof args.template === 'string' ? (args.template as HoursTemplateId) : undefined\n const template = templateId ? HOURS_TEMPLATES.find((t) => t.id === templateId) : undefined\n if (template) return { hours: normalizeHours(template.hours), template: template.id }\n const rows = weekFromRows(args.week)\n if (rows) return { hours: rows }\n if (isHoursValue(args.hours) && openDays(args.hours).length > 0) return { hours: normalizeHours(args.hours) }\n const parsed = typeof args.text === 'string' ? parseHoursText(args.text) : null\n return parsed ? { hours: parsed } : null\n}\n\n/** What `store.hours` keeps: the open days only, every shift of each. */\nexport function storeHoursOf(hours: HoursValue): StoreHours {\n const week = normalizeHours(hours)\n const out: StoreHours = {}\n for (const day of DAY_KEYS) {\n const shifts = week[day] ?? []\n if (shifts.length > 0) out[day] = shifts.map((s) => ({ open: s.open, close: s.close }))\n }\n return out\n}\n\nexport const PROPOSE_HOURS_TOOL = 'proposeStoreHours'\nexport const SAVE_HOURS_TOOL = 'saveStoreHours'\n\nconst HOURS_NOT_UNDERSTOOD = 'Não consegui montar a semana com isso. Peça assim: \"seg a sex 11h às 15h e 18h às 23h, sáb 18h à meia-noite\", ou ofereça os modelos (Almoço, Jantar, Almoço e jantar, Fim de semana).'\n\nexport type ProposeStoreHoursResult =\n | { ok: false; reason: 'not_understood'; hint: string }\n | { ok: true; saved: false; template?: HoursTemplateId; week: LabelledDay[]; summary: string; next: string }\n\n/**\n * Phase 1 of hours by conversation: a model or a sentence in, the week out,\n * labelled for the card and summarised for the reply. Writes nothing and asks\n * nothing — the confirmation is the native card in front of `saveStoreHours`.\n */\nexport function proposeStoreHours(args: Record<string, unknown>): ProposeStoreHoursResult {\n const found = hoursFromArgs(args)\n if (!found) return { ok: false, reason: 'not_understood', hint: HOURS_NOT_UNDERSTOOD }\n const summary = formatHours(found.hours, HOURS_FORMAT_PT_BR)\n return {\n ok: true,\n saved: false,\n ...(found.template ? { template: found.template } : {}),\n week: labelWeek(found.hours),\n summary,\n next: `Nada foi gravado. Comece o texto da resposta pelo summary (\"${summary}\") e, NESTA MESMA resposta, chame ${SAVE_HOURS_TOOL} com este week e este summary. O card nativo dela é onde a pessoa confirma ou ajusta — não pergunte \"posso gravar?\" em texto. Se ela cancelar, pergunte o que mudar.`,\n }\n}\n\nexport type SaveStoreHoursResult =\n | { ok: false; reason: 'not_understood' | 'offline' | 'no-tenant' | 'error'; message?: string; hint?: string }\n | { ok: true; saved: true; summary: string; via: SaveStoreSettingVia }\n\n/** Phase 2: the week lands in `store.hours` through the same door the Teste grátis tab uses. */\nexport async function saveStoreHours(args: Record<string, unknown>): Promise<SaveStoreHoursResult> {\n const found = hoursFromArgs(args)\n if (!found) return { ok: false, reason: 'not_understood', message: 'Nenhum dia aberto para gravar.', hint: HOURS_NOT_UNDERSTOOD }\n const result = await saveStoreSetting('hours', storeHoursOf(found.hours))\n if (!result.ok) return { ok: false, reason: result.reason, message: result.message }\n return { ok: true, saved: true, summary: formatHours(found.hours, HOURS_FORMAT_PT_BR), via: result.via }\n}\n\n// ---------------------------------------------------------------------------\n// Payment methods — the set the house takes, as `store.payment_methods`.\n// ---------------------------------------------------------------------------\n\n// One list for every reader of `store.payment_methods`: the wizard card, the\n// Teste grátis tab, the SQL minimums and this tool (`@fayz-ai/ui`).\nexport { PAYMENT_METHOD_IDS }\nexport type { PaymentMethodId }\nexport const PAYMENT_METHOD_LABELS: Record<PaymentMethodId, string> = PAYMENT_METHOD_LABELS_PT_BR.label\n\nexport const PAYMENT_METHODS_CHOICE = 'store-payment-methods'\nexport const SAVE_PAYMENT_METHODS_TOOL = 'savePaymentMethods'\n\nconst METHOD_WORDS: Array<[RegExp, PaymentMethodId]> = [\n [/\\bpix\\b/, 'pix'],\n [/\\bdinheiro\\b|\\bespecie\\b|\\bcash\\b/, 'cash'],\n [/\\bcart(?:ao|oes)\\b|\\bmaquininha\\b|\\bcredito\\b|\\bdebito\\b|\\bcard\\b/, 'card'],\n [/\\bvale\\b|\\bvr\\b|\\bva\\b|\\balelo\\b|\\bsodexo\\b|\\bticket\\b|\\brefeicao\\b|\\bmeal-voucher\\b|\\bvoucher\\b/, 'meal-voucher'],\n [/\\bonline\\b|\\blink\\b/, 'online'],\n]\n\n/** Ids, labels or a sentence → the ids, in the catalogue's order, no repeats. */\nexport function methodsFromArgs(args: Record<string, unknown>): PaymentMethodId[] {\n const raw = Array.isArray(args.methods) ? args.methods : typeof args.methods === 'string' ? [args.methods] : []\n const text = typeof args.text === 'string' ? args.text : ''\n const picked = new Set<PaymentMethodId>(normalizePaymentMethods(raw))\n for (const item of raw) {\n if (typeof item !== 'string' || picked.has(item as PaymentMethodId)) continue\n // A label or a word instead of an id (\"Cartão\", \"maquininha\").\n const hit = METHOD_WORDS.find(([re]) => re.test(stripAccents(item.toLowerCase())))\n if (hit) picked.add(hit[1])\n }\n if (text) {\n const plain = stripAccents(text.toLowerCase())\n for (const [re, id] of METHOD_WORDS) if (re.test(plain)) picked.add(id)\n }\n return PAYMENT_METHOD_IDS.filter((id) => picked.has(id))\n}\n\nexport function describeMethods(ids: readonly PaymentMethodId[]): string {\n const labels = ids.map((id) => PAYMENT_METHOD_LABELS[id])\n if (labels.length <= 1) return labels[0] ?? ''\n return `${labels.slice(0, -1).join(', ')} e ${labels[labels.length - 1]}`\n}\n\nexport type SavePaymentMethodsResult =\n | { ok: false; reason: 'not_understood' | 'offline' | 'no-tenant' | 'error'; message?: string; hint?: string }\n | { ok: true; saved: true; methods: PaymentMethodId[]; summary: string; via: SaveStoreSettingVia }\n\nexport async function savePaymentMethods(args: Record<string, unknown>): Promise<SavePaymentMethodsResult> {\n const methods = methodsFromArgs(args)\n if (methods.length === 0) {\n return {\n ok: false,\n reason: 'not_understood',\n message: 'Nenhuma forma de pagamento reconhecida.',\n hint: `Peça para marcar entre: ${Object.values(PAYMENT_METHOD_LABELS).join(', ')}.`,\n }\n }\n const result = await saveStoreSetting('payment_methods', methods)\n if (!result.ok) return { ok: false, reason: result.reason, message: result.message }\n return { ok: true, saved: true, methods, summary: describeMethods(methods), via: result.via }\n}\n\n// ---------------------------------------------------------------------------\n// The store profile — how the house works. Where it is written is the\n// StoreProfileProvider's business (lib/store-profile.ts): the platform's\n// questionnaire by default, the host's own schema when one is installed.\n// ---------------------------------------------------------------------------\n\nexport { PROFILE_KEYS, OPERATIONS, SERVICE_MODES, DELIVERY_METHODS, TABLE_BANDS }\n\nexport const SERVICE_MODE_LABELS: Record<StoreServiceMode, string> = {\n counter: 'Balcão e retirada',\n 'own-delivery': 'Entrega própria',\n 'dine-in': 'Salão',\n aggregator: 'Apps de entrega',\n}\n\nexport const SERVICE_MODES_CHOICE = 'store-service-modes'\nexport const SAVE_PROFILE_TOOL = 'saveStoreProfile'\nexport const STORE_PROFILE_SAVED_EVENT = 'getting_started.store_profile_saved'\n\n/** The arguments that are answers, keyed as the wizard keyed them. Unknown values are dropped. */\nexport function profilePatchFromArgs(args: Record<string, unknown>): Record<string, unknown> {\n return storeProfileToAnswers(storeProfileFrom(args))\n}\n\n/** The profile step closes when the house said how it serves (the wizard or the conversation). */\nexport function profileAnswered(answers: Record<string, unknown> | undefined | null): boolean {\n return storeProfileAnswered(storeProfileFromAnswers(answers))\n}\n\nexport type SaveStoreProfileResult =\n | { ok: false; reason: 'not_understood' | 'no-tenant' | 'no-user' | 'offline' | 'write-failed'; message?: string }\n | { ok: true; saved: true; answers: Record<string, unknown>; summary: string }\n\nexport async function saveStoreProfile(args: Record<string, unknown>): Promise<SaveStoreProfileResult> {\n const profile = storeProfileFrom(args)\n const patch = storeProfileToAnswers(profile)\n if (Object.keys(patch).length === 0) {\n return { ok: false, reason: 'not_understood', message: 'Nenhuma resposta reconhecida: use os ids do catálogo (serviceModes: counter, own-delivery, dine-in, aggregator; tables: lt10, 10-25, 25-50, gt50).' }\n }\n const org = useOrganizationStore.getState().currentOrg\n if (!org) return { ok: false, reason: 'no-tenant' }\n let result: SaveStoreProfileWriteResult\n try {\n result = await getStoreProfileProvider().save(org.id, profile, { businessName: org.name })\n } catch (e) {\n result = { ok: false, reason: 'write-failed', message: e instanceof Error ? e.message : String(e) }\n }\n if (!result.ok) return { ok: false, reason: result.reason, message: result.message }\n // The sweep re-runs the sensors on any event; the profile step is one of them.\n emitDomainEvent(STORE_PROFILE_SAVED_EVENT, { keys: Object.keys(patch) }, { tenantId: org.id })\n const modes = profile.serviceModes ?? []\n const summary = modes.length > 0 ? modes.map((m) => SERVICE_MODE_LABELS[m]).join(', ') : Object.keys(patch).join(', ')\n return { ok: true, saved: true, answers: patch, summary }\n}\n\n// ---------------------------------------------------------------------------\n// Tools\n// ---------------------------------------------------------------------------\n\n// Tech design §5.3. `startTrial` also runs server-side (agent_getting_started_start_trial)\n// for browserless channels; the client handler below is the in-app path.\nexport const gettingStartedAiTools: PluginAITool[] = [\n {\n id: 'getting-started.read-journey',\n name: 'readTrialJourney',\n title: 'Ver a configuração da loja',\n description:\n 'Reads where the store is in its trial journey: the phase (setup, trial, expired, converted), the dates and which of the three minimums are green (menu with a product, opening hours, a completed test order). Read it before talking about the trial.',\n icon: 'Rocket',\n mode: 'read',\n category: 'Getting started',\n execution: { plane: 'client' },\n parameters: { type: 'object', properties: {} },\n // The journey's openers (UX spec, moment 3). The plugin that leads the\n // journey composes the chips; each prompt is routed by the model to\n // whichever module owns the step, so no key of theirs is named here.\n suggestions: [\n { label: 'Configurar entrega', prompt: 'Quero configurar a entrega da minha loja.' },\n { label: 'Importar cardápio', prompt: 'Quero importar o meu cardápio.' },\n { label: 'Fazer pedido de teste', prompt: 'Quero fazer um pedido de teste.' },\n { label: 'Como está a configuração da loja?' },\n ],\n },\n {\n id: 'getting-started.propose-hours',\n name: PROPOSE_HOURS_TOOL,\n title: 'Montar horário de funcionamento',\n description:\n 'HORÁRIO DE FUNCIONAMENTO por conversa, fase 1: a escolha de um modelo (template: lunch, dinner, lunch-dinner, weekend) ou uma frase com dias e horas (\"seg a sex 11h às 15h e 18h às 23h, sáb até meia-noite\", \"todo dia das 18 às 23\", \"fecha segunda\") vira a semana. NUNCA grava e não pergunta nada: devolve week (um item por dia aberto, com label) e summary. Passe text EXATAMENTE como veio. Em seguida chame saveStoreHours na mesma resposta.',\n icon: 'Clock',\n mode: 'read',\n category: 'Getting started',\n execution: { plane: 'client' },\n parameters: {\n type: 'object',\n properties: {\n template: { type: 'string', enum: [...HOURS_TEMPLATE_IDS], description: 'Um dos quatro modelos, quando a pessoa escolheu um.' },\n text: { type: 'string', description: 'A frase da pessoa, tal qual, quando ela disse a semana com palavras.' },\n week: {\n type: 'array',\n description: 'Alternativa estruturada: um item por dia aberto.',\n items: {\n type: 'object',\n properties: {\n day: { type: 'string', enum: [...DAY_KEYS] },\n shifts: { type: 'array', items: { type: 'object', properties: { open: { type: 'string' }, close: { type: 'string' } }, required: ['open', 'close'] } },\n },\n required: ['day', 'shifts'],\n },\n },\n },\n },\n suggestions: [{ label: 'Revisar horário', prompt: 'Quero ajustar o horário de funcionamento.' }],\n },\n {\n id: 'getting-started.save-hours',\n name: SAVE_HOURS_TOOL,\n title: 'Gravar horário de funcionamento',\n description:\n 'HORÁRIO DE FUNCIONAMENTO, fase 2: grava a semana proposta em store.hours. Chame com o week e o summary que proposeStoreHours devolveu; o card nativo desta ferramenta é a ÚNICA confirmação — nunca pergunte \"posso gravar?\" em texto, nunca confirme duas vezes.',\n icon: 'Clock',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n // Settled in the conversation already (a proposal accepted, a choice card\n // ticked) and undone by saying it again — a card would ask twice. Still a\n // write: the trace seals it and the owner can revoke it.\n autoApproveByDefault: true,\n // No `permission`: `settings` is no plugin's feature (see index.ts on the\n // trial tab); the server gates the write.\n execution: { plane: 'client' },\n parameters: {\n type: 'object',\n properties: {\n week: {\n type: 'array',\n description: 'Os dias abertos, como proposeStoreHours devolveu (day, label, shifts).',\n items: {\n type: 'object',\n properties: {\n day: { type: 'string', enum: [...DAY_KEYS] },\n label: { type: 'string' },\n shifts: { type: 'array', items: { type: 'object', properties: { open: { type: 'string' }, close: { type: 'string' } }, required: ['open', 'close'] } },\n },\n required: ['day', 'shifts'],\n },\n },\n summary: { type: 'string', description: 'A semana em uma linha, como proposeStoreHours devolveu.' },\n template: { type: 'string', enum: [...HOURS_TEMPLATE_IDS] },\n },\n required: ['week', 'summary'],\n },\n },\n {\n id: 'getting-started.save-payment-methods',\n name: SAVE_PAYMENT_METHODS_TOOL,\n title: 'Gravar formas de pagamento',\n description:\n 'FORMAS DE PAGAMENTO por conversa: grava o que a casa aceita em store.payment_methods. A resposta do card \"Como você recebe?\" ou qualquer frase com pix, dinheiro, cartão/maquininha, vale-refeição ou pagamento online é esta ferramenta (ids: pix, cash, card, meal-voucher, online). O card nativo é a única confirmação.',\n icon: 'Wallet',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n // Settled in the conversation already (a proposal accepted, a choice card\n // ticked) and undone by saying it again — a card would ask twice. Still a\n // write: the trace seals it and the owner can revoke it.\n autoApproveByDefault: true,\n execution: { plane: 'client' },\n parameters: {\n type: 'object',\n properties: {\n methods: { type: 'array', items: { type: 'string', enum: [...PAYMENT_METHOD_IDS] }, description: 'As formas aceitas.' },\n summary: { type: 'string', description: 'As formas em uma linha, como a pessoa lê: \"Pix, Dinheiro e Cartão na maquininha\".' },\n },\n required: ['methods', 'summary'],\n },\n suggestions: [{ label: 'Revisar pagamentos', prompt: 'Quero revisar as formas de pagamento que aceito.' }],\n },\n {\n id: 'getting-started.save-profile',\n name: SAVE_PROFILE_TOOL,\n title: 'Gravar perfil da casa',\n description:\n 'PERFIL DA CASA por conversa: como as pessoas pedem (serviceModes: counter, own-delivery, dine-in, aggregator), quantas mesas (tables: lt10, 10-25, 25-50, gt50), quais apps de entrega (marketplaceApps), como cobra a entrega (deliveryMethod: radius, neighborhood), o tipo de casa (operation) e o artigo da saudação (welcomeArticle: a, o). Grava uma nova resposta do questionário e religa o checklist (a entrega aparece quando a casa entrega). O card nativo é a única confirmação.',\n icon: 'Store',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n // Settled in the conversation already (a proposal accepted, a choice card\n // ticked) and undone by saying it again — a card would ask twice. Still a\n // write: the trace seals it and the owner can revoke it.\n autoApproveByDefault: true,\n execution: { plane: 'client' },\n parameters: {\n type: 'object',\n properties: {\n serviceModes: { type: 'array', items: { type: 'string', enum: [...SERVICE_MODES] } },\n tables: { type: 'string', enum: [...TABLE_BANDS] },\n marketplaceApps: { type: 'array', items: { type: 'string' }, description: 'ifood, rappi, aiqfome, uber-eats, 99food, keeta…' },\n deliveryMethod: { type: 'string', enum: [...DELIVERY_METHODS] },\n operation: { type: 'string', enum: [...OPERATIONS] },\n welcomeArticle: { type: 'string', enum: ['a', 'o'] },\n summary: { type: 'string', description: 'O perfil em uma linha, como a pessoa lê: \"Balcão, entrega própria e salão com até 10 mesas\".' },\n },\n required: ['summary'],\n },\n },\n {\n id: 'getting-started.start-trial',\n name: 'startTrial',\n title: 'Iniciar o teste grátis',\n description:\n 'Starts the free trial. Only works when the three minimums are ready; otherwise it answers which ones are missing. The trial days start counting now and cannot be paused — confirm with the owner first.',\n icon: 'Play',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n permission: { feature: 'settings', action: 'manage' },\n execution: { plane: 'server', kind: 'rpc', rpc: 'agent_getting_started_start_trial' },\n parameters: { type: 'object', properties: {} },\n suggestions: [{ label: 'Iniciar teste' }],\n },\n {\n id: 'getting-started.request-contract',\n name: 'requestContract',\n title: 'Pedir para contratar',\n description:\n 'Tells Faya the store wants to contract a plan; someone calls back within one business day. Available from day 0 — during setup (before the trial starts), during the trial and after it ends. Accepted once a day per store.',\n icon: 'PhoneCall',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n permission: { feature: 'settings', action: 'manage' },\n execution: { plane: 'client' },\n parameters: {\n type: 'object',\n properties: {\n note: { type: 'string', description: 'Anything the owner wants the sales team to know (optional, 500 chars).' },\n },\n },\n suggestions: [{ label: 'Quero contratar' }],\n },\n {\n id: 'getting-started.seed-demo',\n name: 'exploreWithDemoData',\n title: 'Criar cardápio de exemplo',\n description:\n 'Fills the menu with sample items marked as demo (removable in one click) so the store can see the product working before typing its own menu. Demo items never count as \"menu ready\".',\n icon: 'Sparkles',\n mode: 'persist',\n category: 'Getting started',\n requiresConfirmation: true,\n execution: { plane: 'client' },\n parameters: { type: 'object', properties: {} },\n suggestions: [{ label: 'Ver com dados de exemplo' }],\n },\n]\n\nconst DEMO_TOOL = 'seedDemoCatalog'\n\nfunction failure(e: unknown) {\n return {\n ok: false as const,\n reason: isForbidden(e) ? 'forbidden' : 'error',\n message: e instanceof Error ? e.message : String(e),\n }\n}\n\n/** The tools a surface offers: without a store profile, `saveStoreProfile` is left out. */\nexport function gettingStartedAiToolsFor(opts?: { profile?: boolean }): PluginAITool[] {\n return opts?.profile === false ? gettingStartedAiTools.filter((t) => t.name !== SAVE_PROFILE_TOOL) : gettingStartedAiTools\n}\n\nexport function registerGettingStartedToolHandlers(\n store: { getState: () => JourneyState },\n opts?: { /** Register `saveStoreProfile`. Default true; a host without a store profile passes false. */ profile?: boolean },\n): void {\n const handlers: Record<string, AIToolHandler> = {\n readTrialJourney: async () => {\n const journey = (await store.getState().load()) ?? store.getState().journey\n return journey ? { ok: true, ...describeJourney(journey) } : { ok: false, reason: 'no_journey' }\n },\n\n [PROPOSE_HOURS_TOOL]: (args) => proposeStoreHours(args),\n [SAVE_HOURS_TOOL]: (args) => saveStoreHours(args),\n [SAVE_PAYMENT_METHODS_TOOL]: (args) => savePaymentMethods(args),\n [SAVE_PROFILE_TOOL]: (args) => saveStoreProfile(args),\n\n startTrial: async () => {\n try {\n const result = await store.getState().startTrial()\n if (!result.ok) return { ...result, missing: missingMinimums(result.minimums).map((id) => MINIMUM_WORDS[id]) }\n return result\n } catch (e) {\n return failure(e)\n }\n },\n\n requestContract: async (args) => {\n const note = typeof args.note === 'string' ? args.note.slice(0, 500) : undefined\n try {\n return await store.getState().requestContract(note)\n } catch (e) {\n return failure(e)\n }\n },\n\n // The catalogue belongs to plugin-menu (tech design §8); this tool only points at it.\n exploreWithDemoData: async () => {\n if (!hasAIToolHandler(DEMO_TOOL)) return { ok: false, reason: 'menu_plugin_missing' }\n return { ok: true, next: DEMO_TOOL, hint: `Call ${DEMO_TOOL} to create the sample menu; call clearDemoCatalog to remove it.` }\n },\n }\n if (opts?.profile === false) {\n // A previous registration (another host, the plugin) must not keep writing to a profile this host does not have.\n delete handlers[SAVE_PROFILE_TOOL]\n unregisterAIToolHandler(SAVE_PROFILE_TOOL)\n }\n for (const [name, handler] of Object.entries(handlers)) registerAIToolHandler(name, handler)\n}\n","import { getActiveTenantId, type OnboardingMove, type OnboardingProgramDef, type OnboardingStepDef } from '@fayz-ai/core'\nimport { useOrganizationStore } from '@fayz-ai/admin/host'\nimport { getActiveConfig, type ResolvedGettingStartedConfig } from '../config'\nimport type { GettingStartedDataProvider } from '../data/types'\nimport {\n HOURS_CUSTOM_OPTION, HOURS_TEMPLATES, HOURS_TEMPLATE_CHOICE, PAYMENT_METHODS_CHOICE, PAYMENT_METHOD_IDS,\n PAYMENT_METHOD_LABELS, PROPOSE_HOURS_TOOL, SAVE_HOURS_TOOL, SAVE_PAYMENT_METHODS_TOOL, SAVE_PROFILE_TOOL,\n SERVICE_MODES_CHOICE,\n} from './agent-tools'\nimport { loadStoreSettings } from './store-settings'\nimport { STORE_PROFILE_STEP_KEY, getStoreProfileProvider, storeProfileAnswered } from './store-profile'\n\nexport const PROGRAM_ID = 'getting-started'\nexport const PROGRAM_ORDER = 10\n\nexport function readStoreSetting<T>(settings: Record<string, unknown> | undefined, path: string[]): T | undefined {\n let node: unknown = settings\n for (const key of path) node = (node as Record<string, unknown> | undefined)?.[key]\n return node as T | undefined\n}\n\n/**\n * `store.hours` has at least one day that is actually open: a day whose list\n * of ranges is empty is a closed day, and a week of closed days is no schedule.\n */\nexport function hasOpeningHours(settings: Record<string, unknown> | undefined): boolean {\n const hours = readStoreSetting<unknown>(settings, ['store', 'hours'])\n if (!hours || typeof hours !== 'object' || Array.isArray(hours)) return false\n return Object.values(hours as Record<string, unknown>).some((day) =>\n Array.isArray(day) ? day.length > 0 : !!day && typeof day === 'object',\n )\n}\n\nexport function hasPaymentMethods(settings: Record<string, unknown> | undefined): boolean {\n const methods = readStoreSetting<unknown>(settings, ['store', 'payment_methods'])\n return Array.isArray(methods) && methods.length > 0\n}\n\n// The workspace in memory when it carries `store`; the tenants row when it\n// does not yet (see loadStoreSettings) — never \"no\" from an empty memory.\nconst currentSettings = loadStoreSettings\n\n/** A `choose` whose answer is a SET — several rows and a confirm button. */\nfunction chooseMany(move: Extract<OnboardingMove, { kind: 'choose' }>): OnboardingMove {\n return { ...move, multi: true }\n}\n\n/**\n * The routing the model needs for the steps that are a conversation, not a\n * form. Without a store profile (`profile: false`) the profile line is left\n * out — the tool it names is not offered.\n */\nexport function storeSetupRouting(opts?: { profile?: boolean }): string {\n const profile = opts?.profile !== false\n return [\n profile\n ? `ROTEAMENTO — horário, pagamentos e perfil se resolvem AQUI, por conversa, nunca mandando a pessoa para Configurações (a aba Teste grátis é para revisar depois):`\n : `ROTEAMENTO — horário e pagamentos se resolvem AQUI, por conversa, nunca mandando a pessoa para Configurações (a aba Teste grátis é para revisar depois):`,\n profile && `- Perfil da casa: a resposta do card \"Como as pessoas pedem?\" ou qualquer frase sobre balcão/retirada, entrega própria, salão/mesas ou apps de entrega (iFood, Rappi, aiqfome…) é ${SAVE_PROFILE_TOOL} (serviceModes com os ids counter, own-delivery, dine-in, aggregator). Se marcou salão e não disse quantas mesas, pergunte antes (tables: lt10, 10-25, 25-50, gt50); se marcou apps, pergunte quais (marketplaceApps). O card nativo é a única confirmação. Depois que gravar, a entrega entra no checklist quando a casa entrega.`,\n `- Horário: a escolha de um modelo (Almoço, Jantar, Almoço e jantar, Fim de semana) ou qualquer frase com dias e horas (\"seg a sex 11h às 15h e 18h às 23h\", \"todo dia das 18 às 23\", \"fecha segunda\") é ${PROPOSE_HOURS_TOOL} — passe template ou text EXATAMENTE como veio. Ela não grava: devolve week e summary. Comece a resposta pelo summary e, NA MESMA resposta, chame ${SAVE_HOURS_TOOL} com week e summary; o card nativo dela é a única confirmação. \"Eu digo\" significa pedir a frase. Se a pessoa cancelar o card, pergunte o que mudar.`,\n `- Pagamentos: a resposta do card \"Como você recebe?\" ou qualquer frase com pix, dinheiro, cartão/maquininha, vale-refeição ou pagamento online é ${SAVE_PAYMENT_METHODS_TOOL} (methods com os ids pix, cash, card, meal-voucher, online; summary em palavras).`,\n `- Nunca pergunte em texto \"posso gravar?\": a pergunta é o card.`,\n ].filter((line): line is string => typeof line === 'string').join('\\n')\n}\n\n/** The profile sensor: the installed StoreProfileProvider says whether the house told how it serves. */\nasync function profileStepDone(): Promise<boolean> {\n const tenantId = useOrganizationStore.getState().currentOrg?.id ?? getActiveTenantId()\n if (!tenantId) return false\n try {\n return storeProfileAnswered(await getStoreProfileProvider().read(tenantId))\n } catch {\n return false\n }\n}\n\nexport interface BuildStoreLiveProgramInput {\n /** Kept for symmetry with the plugin factory; the steps' sensors do not read it. */\n provider?: GettingStartedDataProvider\n /** Trial length (copy), verticals and the trial route the hours/payments steps open. Default: the active config. */\n config?: Pick<ResolvedGettingStartedConfig, 'trialDays' | 'verticals' | 'trialRoute'>\n /**\n * Include the \"how the house serves\" step (written through the\n * StoreProfileProvider). Default true; a host without a store profile\n * passes false and the step, and its routing line, are left out.\n */\n profile?: boolean\n}\n\n/** The store-live program: profile (optional), hours, payment methods. A host composes its own program from these steps. */\nexport function buildStoreLiveProgram(input: BuildStoreLiveProgramInput = {}): OnboardingProgramDef {\n const { trialDays, verticals, trialRoute } = input.config ?? getActiveConfig()\n const profile = input.profile !== false\n const program: OnboardingProgramDef = {\n id: PROGRAM_ID,\n title: 'Sua loja no ar',\n // Before the workspace base (50) — programs.ts orders by this.\n order: PROGRAM_ORDER,\n role: 'setup',\n verticals,\n instructions: `Você conduz a casa até o primeiro pedido. Os mínimos para iniciar o teste são: cardápio com ao menos um produto, horário de funcionamento e um pedido de teste. Banco, WhatsApp e impressora NÃO travam nada — ofereça depois. Quando os três mínimos estiverem verdes, ofereça \"Iniciar teste\" (ferramenta startTrial) e explique que os ${trialDays} dias começam só agora.\n${storeSetupRouting({ profile })}`,\n steps: [\n {\n key: STORE_PROFILE_STEP_KEY,\n title: 'Como a casa atende',\n description: 'Balcão, entrega própria, salão, apps — é o que liga cada parte do sistema.',\n icon: 'Store',\n priority: 'high',\n journey: { group: 'launch' },\n howTo: 'Conte para a assistente como as pessoas pedem (balcão e retirada, entrega própria, salão, apps de entrega), quantas mesas tem e por quais apps o pedido chega. Ela grava e liga só o que a casa usa.',\n agentHint: `Pergunte como a casa atende e grave com ${SAVE_PROFILE_TOOL}; pergunte mesas e apps só quando a resposta pedir. Nunca pergunte o que o cadastro já respondeu.`,\n celebrate: 'Perfil da casa salvo.',\n script: [\n { kind: 'say', text: 'Primeiro, me conta como a casa atende — é isso que liga cada parte do sistema.' },\n chooseMany({\n kind: 'choose',\n id: SERVICE_MODES_CHOICE,\n question: 'Como as pessoas pedem?',\n options: [\n { id: 'counter', label: 'Balcão e retirada' },\n { id: 'own-delivery', label: 'Entrega própria', meta: 'Você mesmo entrega' },\n { id: 'dine-in', label: 'Salão', meta: 'Mesas e comandas' },\n { id: 'aggregator', label: 'Apps de entrega', meta: 'O pedido chega por eles' },\n ],\n }),\n { kind: 'await' },\n ],\n // The wizard used to answer this; now the conversation does, and the\n // profile store carries both — so an older tenant is born closed.\n check: profileStepDone,\n },\n {\n key: 'hours',\n title: 'Horário de funcionamento',\n description: 'Quando a casa abre e fecha — o cardápio digital mostra aberto/fechado por ele.',\n icon: 'Clock',\n route: trialRoute,\n priority: 'high',\n journey: { group: 'launch', minimum: true },\n howTo: 'Diga à assistente (\"seg a sex 11h às 15h e 18h às 23h\") ou escolha um modelo no card e confirme. Para revisar depois: Configurações › Teste grátis › Horários.',\n agentHint: `Ofereça os quatro modelos ou a frase; ${PROPOSE_HOURS_TOOL} monta a semana e ${SAVE_HOURS_TOOL} grava atrás do card nativo.`,\n celebrate: 'Horário salvo ⏰',\n script: [\n { kind: 'say', text: 'Seus horários: que tal um modelo?' },\n {\n kind: 'choose',\n id: HOURS_TEMPLATE_CHOICE,\n question: 'Quando a casa abre?',\n options: [\n ...HOURS_TEMPLATES.map((t) => ({ id: t.id, label: t.label, meta: t.hint })),\n { id: HOURS_CUSTOM_OPTION, label: 'Eu digo', meta: 'Escreva do seu jeito: \"seg a sex 11h às 15h…\"' },\n ],\n },\n { kind: 'await', text: 'Pode mandar do seu jeito — eu monto a semana e você confirma.' },\n ],\n // Born closed when the wizard answered: the sensor runs on the first mount (decision 4).\n check: async () => hasOpeningHours(await currentSettings()),\n },\n {\n key: 'payment-methods',\n title: 'Formas de pagamento',\n description: 'Dinheiro, Pix, cartão — o que a casa aceita no balcão e na entrega.',\n icon: 'Wallet',\n route: trialRoute,\n priority: 'high',\n journey: { group: 'launch' },\n howTo: 'Marque no card o que a casa aceita e confirme; a maquininha e o Pix integrados ficam em Conectores, quando quiser. Para revisar depois: Configurações › Teste grátis › Pagamentos.',\n agentHint: `A resposta do card ou a frase vira ${SAVE_PAYMENT_METHODS_TOOL}; o card nativo é a única confirmação.`,\n celebrate: 'Pagamentos definidos 💳',\n script: [\n chooseMany({\n kind: 'choose',\n id: PAYMENT_METHODS_CHOICE,\n question: 'Como você recebe?',\n options: PAYMENT_METHOD_IDS.map((id) => ({ id, label: PAYMENT_METHOD_LABELS[id] })),\n }),\n { kind: 'await', text: 'Marque o que você aceita. Dá para mudar depois.' },\n ],\n check: async () => hasPaymentMethods(await currentSettings()),\n },\n ],\n }\n return profile ? program : withoutStoreProfileStep(program)\n}\n\n/** The program without the profile step (a host that has no store profile). Other programs pass through. */\nexport function withoutStoreProfileStep(program: OnboardingProgramDef): OnboardingProgramDef {\n if (program.id !== PROGRAM_ID) return program\n const steps: OnboardingStepDef[] = program.steps.filter((s) => s.key !== STORE_PROFILE_STEP_KEY)\n if (steps.length === program.steps.length) return program\n const instructions = program.instructions?.replace(storeSetupRouting(), storeSetupRouting({ profile: false }))\n return { ...program, steps, instructions }\n}\n","import { setTrialSource, type TrialSourceState } from '@fayz-ai/admin/host'\nimport { getCurrentLocale } from '@fayz-ai/core'\nimport type { Journey } from '../types'\n\nexport interface TrialSourceInput {\n journey: Journey | null\n /** Minimums already green, as the CTA counts them. */\n readyCount: number\n readyTotal: number\n onStart?: () => Promise<void>\n onRequestContract?: () => Promise<void>\n}\n\n/** The journey as the shell's clock wants it. `null` hands the shell back its default behaviour. */\nexport function toTrialSource(input: TrialSourceInput): TrialSourceState | null {\n const { journey } = input\n if (!journey) return null\n return {\n phase: journey.phase,\n startedAt: journey.trialStartedAt ?? undefined,\n // The end as the server last told THIS plugin — the date the card and the\n // tab print. The shell's clock counts from it, not from its login-time copy.\n endsAt: journey.trialEndsAt ?? undefined,\n totalDays: journey.trialDays > 0 ? journey.trialDays : undefined,\n setupDeadlineAt: journey.setupDeadlineAt ?? undefined,\n readyCount: input.readyCount,\n readyTotal: input.readyTotal,\n onStart: input.onStart,\n onRequestContract: input.onRequestContract,\n }\n}\n\nexport function publishTrialSource(input: TrialSourceInput): void {\n setTrialSource(toTrialSource(input))\n}\n\nexport function clearTrialSource(): void {\n setTrialSource(null)\n}\n\n/** \"9 de novembro\" in the app's locale — the date the copy of the CTA, the banner and the tab say. */\nexport function formatTrialDate(iso: string | null | undefined, locale: string = getCurrentLocale()): string {\n if (!iso) return ''\n const date = new Date(iso)\n if (Number.isNaN(date.getTime())) return ''\n try {\n return new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long' }).format(date)\n } catch {\n return date.toLocaleDateString()\n }\n}\n","import * as React from 'react'\nimport { Check } from 'lucide-react'\nimport { cn } from '@fayz-ai/ui'\n\nexport interface ProgressRingProps {\n value: number\n max: number\n /** 40 on the card, 28 on the floating CTA, 20 on the phone chip (UX spec §2.1). */\n size?: number\n label: string\n /** The whole ring turns success with a check in the middle. */\n complete?: boolean\n /** Drawn over a primary background (the ready pill). */\n onPrimary?: boolean\n className?: string\n}\n\n/** UX spec §2.1 — the n/N ring. Real text in the middle, never only the stroke. */\nexport function ProgressRing({ value, max, size = 28, label, complete, onPrimary, className }: ProgressRingProps) {\n const stroke = 3\n const r = (size - stroke) / 2\n const circumference = 2 * Math.PI * r\n const pct = max > 0 ? Math.min(1, value / max) : 0\n const textSize = size >= 40 ? 'text-[11px]' : 'text-[9px]'\n return (\n <span\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={value}\n aria-label={label}\n className={cn('relative inline-flex shrink-0 items-center justify-center', className)}\n style={{ width: size, height: size }}\n >\n <svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} aria-hidden=\"true\" className=\"-rotate-90\">\n <circle cx={size / 2} cy={size / 2} r={r} fill=\"none\" stroke=\"currentColor\" strokeWidth={stroke}\n className={onPrimary ? 'text-primary-foreground/30' : 'text-border'} />\n <circle cx={size / 2} cy={size / 2} r={r} fill=\"none\" stroke=\"currentColor\" strokeWidth={stroke} strokeLinecap=\"round\"\n strokeDasharray={circumference} strokeDashoffset={circumference * (1 - pct)}\n className={cn(\n 'transition-[stroke-dashoffset] duration-300 ease-out motion-reduce:transition-none',\n onPrimary ? 'text-primary-foreground' : complete ? 'text-success' : 'text-primary',\n )} />\n </svg>\n <span className={cn('absolute font-mono font-medium leading-none tabular-nums', textSize, complete && !onPrimary && 'text-success')}>\n {complete ? <Check className={size >= 40 ? 'h-4 w-4' : 'h-3 w-3'} aria-hidden=\"true\" /> : `${value}/${max}`}\n </span>\n </span>\n )\n}\n","import * as React from 'react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { Button, cn, toast } from '@fayz-ai/ui'\nimport { SDK_PERMISSIONS, adminNavigateTo, useActivationStore, useOrganizationStore, useSdkPermission } from '@fayz-ai/admin/host'\nimport { getActiveConfig, noteTrialDaysDivergence } from '../config'\nimport { isMissingClock } from '../data/types'\nimport {\n clientJourney, countMinimums, minimumLines, useJourneyDeclaration, type MinimumLine, type MinimumsCount,\n} from '../lib/journey-steps'\nimport { formatTrialDate } from '../lib/trial-source-bridge'\nimport { useJourneyStore } from '../store'\nimport type { Journey, StartTrialResult } from '../types'\n\nconst DAY_MS = 86_400_000\n\n/** What is still missing, worded for a screen: \"Falta o horário para iniciar o teste.\" + where to go. */\nexport interface StartTrialMissing {\n key: string\n /** The step's own title when this app has the step; the slot's words otherwise. */\n title: string\n text: string\n route?: string\n}\n\nexport interface StartTrialState {\n /**\n * The journey is in setup and the trial has not started: the action means\n * something. False while the journey is unknown, after the trial started, or\n * when the plugin is not on in this app (no programs declare a journey and\n * the server never answered).\n */\n available: boolean\n ready: boolean\n starting: boolean\n trialDays: number\n /** \"Iniciar teste · 14 dias\" */\n label: string\n /** The projected end, worded, for a confirmation line. */\n projectedEnd: string\n journey: Journey | null\n minimums: MinimumsCount\n lines: MinimumLine[]\n /** The first open minimum, or null when ready. */\n missing: StartTrialMissing | null\n /** The last error or server disagreement, in the house's words. */\n notice: string | null\n /** Runs the RPC through the plugin's store (event emitted there). Resolves null on error, with `notice` set. */\n start: () => Promise<StartTrialResult | null>\n /** The host's permissions allow starting the trial / asking to contract (`SDK_PERMISSIONS.trialManage`). Always true without a host adapter. */\n allowed: boolean\n /** The host's emulator attributes for the start/contract buttons. */\n markProps: Record<string, string>\n}\n\n/** Loads the journey for the active tenant once; again when the tenant changes. Same rule as the plugin's context hook. */\nfunction useEnsureJourneyStandalone(): void {\n const tenantId = useOrganizationStore((s) => s.currentOrg?.id)\n const load = useJourneyStore((s) => s.load)\n const known = useJourneyStore((s) => s.tenantId)\n const journey = useJourneyStore((s) => s.journey)\n const loading = useJourneyStore((s) => s.loading)\n const error = useJourneyStore((s) => s.error)\n React.useEffect(() => {\n if (!tenantId) return\n if (tenantId === known && (journey || loading || error)) return\n void load(tenantId)\n }, [tenantId, known, journey, loading, error, load])\n}\n\n/**\n * \"Iniciar teste\" as a hook: the minimums still missing (declared by the\n * programs, read from the rows and the server), the copy, the route to the\n * first missing one, the RPC and the event (through the plugin's store) and the\n * trial length. An app composes this where it celebrates — the test order's\n * \"Funcionou.\" pane — without knowing a key, an RPC or an event name.\n */\nexport function useStartTrial(): StartTrialState {\n useEnsureJourneyStandalone()\n const t = useTranslation()\n const config = getActiveConfig()\n const declaration = useJourneyDeclaration()\n const loaded = useJourneyStore((s) => s.journey)\n const journeyError = useJourneyStore((s) => s.error)\n const starting = useJourneyStore((s) => s.starting)\n const startTrial = useJourneyStore((s) => s.startTrial)\n const load = useJourneyStore((s) => s.load)\n const tenantId = useOrganizationStore((s) => s.currentOrg?.id)\n const rows = useActivationStore((s) => s.rows)\n const catalog = useActivationStore((s) => s.catalog)\n const [notice, setNotice] = React.useState<string | null>(null)\n const { allowed, markProps } = useSdkPermission(SDK_PERMISSIONS.trialManage)\n\n React.useEffect(() => { noteTrialDaysDivergence(config, loaded?.trialDays) }, [config, loaded?.trialDays])\n\n // No clock on the server: the phase is setup by definition and the rows say what is left.\n const journey: Journey | null = React.useMemo(\n () => loaded ?? (journeyError && tenantId && declaration.declared\n ? clientJourney({ tenantId, trialDays: config.trialDays, rows, declaration })\n : null),\n [loaded, journeyError, tenantId, declaration, config.trialDays, rows],\n )\n const minimums = React.useMemo(() => countMinimums(journey, rows, declaration), [journey, rows, declaration])\n const lines = React.useMemo(() => minimumLines(catalog, rows, journey, declaration), [catalog, rows, journey, declaration])\n\n // A minimum ticked on the client asks the server again, so `ready` follows the data.\n const doneSignature = minimums.done.join('|')\n const first = React.useRef(true)\n React.useEffect(() => {\n if (first.current) { first.current = false; return }\n void load()\n }, [doneSignature, load])\n\n const ready = !!journey && (journey.minimums.ready || minimums.ready)\n const trialDays = journey?.trialDays || config.trialDays\n const available = !!journey && journey.phase === 'setup' && !journey.trialStartedAt\n\n const missing = React.useMemo<StartTrialMissing | null>(() => {\n if (ready) return null\n const line = lines.find((l) => !l.done)\n if (!line) return null\n const title = line.step?.title ?? (line.slot ? t(`gettingStarted.settings.minimums.${line.slot}`) : line.key)\n const what = line.slot ? t(`gettingStarted.minimum.${line.slot}`) : title\n return { key: line.key, title, text: t('gettingStarted.action.missing', { what }), route: line.step?.route }\n }, [ready, lines, t])\n\n const start = React.useCallback(async (): Promise<StartTrialResult | null> => {\n setNotice(null)\n let result: StartTrialResult\n try {\n result = await startTrial()\n } catch (e) {\n setNotice(isMissingClock(e) ? t('gettingStarted.start.noClock') : t('gettingStarted.start.error'))\n return null\n }\n if (result.ok) {\n toast.success(t('gettingStarted.start.done', { date: formatTrialDate(result.trialEndsAt) }))\n return result\n }\n // The server disagreed with the client (a race): say what is missing; the list already refreshed.\n const still = (['menu', 'hours', 'testOrder'] as const).filter((id) => !result.minimums[id])\n const what = still.map((id) => t(`gettingStarted.minimum.${id}`)).join(t('gettingStarted.minimum.join'))\n setNotice(t('gettingStarted.start.missing', { what }))\n return result\n }, [startTrial, t])\n\n return {\n available,\n ready,\n starting,\n trialDays,\n label: t('gettingStarted.cta.ready', { days: trialDays }),\n projectedEnd: formatTrialDate(new Date(Date.now() + trialDays * DAY_MS).toISOString()),\n journey,\n minimums,\n lines,\n missing,\n notice,\n start,\n allowed,\n markProps,\n }\n}\n\nexport interface StartTrialActionProps {\n /** After the trial started (not on \"already started\"). The app leaves its screen here. */\n onStarted?: (result: Extract<StartTrialResult, { ok: true }>) => void\n /** Before navigating to the first missing step. Return false to keep the screen. */\n onNavigate?: (route: string) => boolean | void\n /**\n * `inline` (default) asks once, in the same surface — this action is composed\n * inside dialogs and a dialog must not stack on a dialog. `none` starts on\n * the first click.\n */\n confirm?: 'inline' | 'none'\n className?: string\n}\n\n/**\n * The \"Iniciar teste · N dias\" button an app composes into its own screen, with\n * the \"falta X\" line and the way to X when the trial cannot start yet. Draws\n * nothing while the journey is unknown or once the trial has started.\n */\nexport function StartTrialAction({ onStarted, onNavigate, confirm = 'inline', className }: StartTrialActionProps) {\n const t = useTranslation()\n const state = useStartTrial()\n const [confirming, setConfirming] = React.useState(false)\n\n if (!state.available) return null\n\n const go = (route: string) => {\n if (onNavigate?.(route) === false) return\n adminNavigateTo(route)\n }\n\n const run = async () => {\n const result = await state.start()\n setConfirming(false)\n if (result?.ok) onStarted?.(result)\n }\n\n return (\n <div className={cn('flex flex-col gap-2', className)} data-tour=\"getting-started.start-trial\">\n {state.missing && (\n <p className=\"text-sm text-muted-foreground\">{state.missing.text}</p>\n )}\n {state.notice && (\n <p role=\"alert\" className=\"text-sm text-destructive\">{state.notice}</p>\n )}\n {confirming && (\n <p role=\"status\" className=\"text-sm text-foreground\">\n {t('gettingStarted.confirm.body', { date: state.projectedEnd })}\n </p>\n )}\n <div className=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n {state.missing ? (\n state.missing.route ? (\n <Button type=\"button\" onClick={() => go(state.missing!.route!)} className=\"min-h-[44px]\">\n {state.missing.title}\n </Button>\n ) : null\n ) : confirming ? (\n <>\n <Button type=\"button\" variant=\"outline\" onClick={() => setConfirming(false)} className=\"min-h-[44px]\">\n {t('gettingStarted.confirm.cancel')}\n </Button>\n <Button type=\"button\" onClick={() => { void run() }} disabled={state.starting || !state.allowed} {...state.markProps} className=\"min-h-[44px]\">\n {state.starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.confirm.ok')}\n </Button>\n </>\n ) : (\n <Button\n type=\"button\"\n onClick={() => (confirm === 'inline' ? setConfirming(true) : void run())}\n disabled={state.starting || !state.allowed}\n {...state.markProps}\n className=\"min-h-[44px]\"\n >\n {state.starting ? t('gettingStarted.confirm.starting') : state.label}\n </Button>\n )}\n </div>\n </div>\n )\n}\n","import * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { Check, ChevronDown, ChevronRight, Circle, Rocket } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport {\n BottomSheet, Button, ConfirmDialog, Sheet, SheetContent, SheetHeader, SheetTitle, cn, fireConfetti,\n} from '@fayz-ai/ui'\nimport { adminNavigateTo, useActivationStore, useRightRailStore } from '@fayz-ai/admin/host'\nimport { useEnsureJourney, useGettingStartedStore } from '../context'\nimport {\n countJourney, rowDone, selectJourneySteps, useJourneyDeclaration, type JourneyDeclaration, type MinimumLine,\n} from '../lib/journey-steps'\nimport { clearTrialSource, publishTrialSource } from '../lib/trial-source-bridge'\nimport { ProgressRing } from './ProgressRing'\nimport { useStartTrial, type StartTrialState } from './StartTrialAction'\n\nexport { countMinimums } from '../lib/journey-steps'\n\nconst MINIMIZED_KEY = 'fayz:getting-started:cta-minimized'\n\ntype ActivationState = ReturnType<typeof useActivationStore.getState>\ntype Rows = ActivationState['rows']\ntype Catalog = ActivationState['catalog']\n\n/** The pill and the card count the same nine steps: the journey, not the whole catalog. */\nfunction countChecklist(catalog: Catalog, rows: Rows, declaration: JourneyDeclaration): { done: number; total: number } {\n if (!catalog.length) return { done: 0, total: 0 }\n return countJourney(catalog, rows, declaration)\n}\n\nfunction useMatchMedia(query: string): boolean {\n const [matches, setMatches] = React.useState(() => typeof window !== 'undefined' && window.matchMedia?.(query).matches)\n React.useEffect(() => {\n if (typeof window === 'undefined' || !window.matchMedia) return\n const mq = window.matchMedia(query)\n const on = () => setMatches(mq.matches)\n on()\n mq.addEventListener('change', on)\n return () => mq.removeEventListener('change', on)\n }, [query])\n return !!matches\n}\n\n/** Left edge of the content area, so the pill sits beside the rail whatever its width. */\nfunction useContentLeft(): number {\n const [left, setLeft] = React.useState(0)\n React.useEffect(() => {\n if (typeof document === 'undefined') return\n const measure = () => setLeft(document.querySelector('main')?.getBoundingClientRect().left ?? 0)\n measure()\n window.addEventListener('resize', measure)\n const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(measure) : null\n observer?.observe(document.body)\n return () => { window.removeEventListener('resize', measure); observer?.disconnect() }\n }, [])\n return left\n}\n\nfunction useMinimized(): [boolean, (next: boolean) => void] {\n const [minimized, setState] = React.useState(() => {\n try { return globalThis.localStorage?.getItem(MINIMIZED_KEY) === '1' } catch { return false }\n })\n const set = React.useCallback((next: boolean) => {\n setState(next)\n try { globalThis.localStorage?.setItem(MINIMIZED_KEY, next ? '1' : '0') } catch { /* private mode */ }\n }, [])\n return [minimized, set]\n}\n\n/**\n * The floating \"set up your operation\" pill of the journey (UX spec §2.3, tech design §7).\n *\n * Registered in `shell.sidebar.footer` only to be mounted: it draws nothing in\n * the rail (the shell's TrialWidget reads the source this widget publishes) and\n * puts the pill on `document.body` through a portal, because the shell does not\n * draw `shell.floating` yet (decision 11).\n */\nexport function StartTrialCta() {\n useEnsureJourney()\n const trial = useStartTrial()\n const declaration = useJourneyDeclaration()\n const loaded = useGettingStartedStore((s) => s.journey)\n const requestContract = useGettingStartedStore((s) => s.requestContract)\n const rows = useActivationStore((s) => s.rows)\n const catalog = useActivationStore((s) => s.catalog)\n const checklist = React.useMemo(() => countChecklist(catalog, rows, declaration), [catalog, rows, declaration])\n const { start, minimums, allowed } = trial\n\n React.useEffect(() => {\n // Only a journey the server told: a client-side guess must not drive the rail clock.\n publishTrialSource({\n journey: loaded,\n readyCount: minimums.count,\n readyTotal: minimums.total,\n // A role the host does not let start the trial gets the clock without the buttons.\n onStart: allowed ? async () => { await start() } : undefined,\n onRequestContract: allowed ? async () => { await requestContract() } : undefined,\n })\n }, [loaded, minimums.count, minimums.total, start, requestContract, allowed])\n React.useEffect(() => () => clearTrialSource(), [])\n\n if (!trial.available) return null\n if (typeof document === 'undefined') return null\n return createPortal(\n <FloatingCta trial={trial} checklist={checklist} catalog={catalog} rows={rows} declaration={declaration} />,\n document.body,\n )\n}\n\nfunction FloatingCta({ trial, checklist, catalog, rows, declaration }: {\n trial: StartTrialState\n checklist: { done: number; total: number }\n catalog: Catalog\n rows: Rows\n declaration: JourneyDeclaration\n}) {\n const t = useTranslation()\n const { ready, trialDays, minimums, starting, notice, projectedEnd } = trial\n const mobile = useMatchMedia('(max-width: 767px)')\n const contentLeft = useContentLeft()\n const [minimized, setMinimized] = useMinimized()\n const [listOpen, setListOpen] = React.useState(false)\n const [confirmOpen, setConfirmOpen] = React.useState(false)\n const pillRef = React.useRef<HTMLButtonElement>(null)\n\n const ringDone = checklist.total ? checklist.done : minimums.count\n const ringTotal = checklist.total || minimums.total\n const ringLabel = t('gettingStarted.cta.ring', { done: ringDone, total: ringTotal })\n const remaining = minimums.total - minimums.count\n const remainingText = remaining === 1\n ? t('gettingStarted.cta.remaining.one')\n : t('gettingStarted.cta.remaining.many', { count: remaining })\n const readyText = t('gettingStarted.cta.ready', { days: trialDays })\n const pillLabel = ready ? readyText : `${t('gettingStarted.cta.title')} · ${remainingText}`\n\n // One surface for the list: the assistant's Tarefas tab carries the same card.\n // The sheet stays only for a shell without the rail.\n const openList = () => {\n const rail = useRightRailStore.getState()\n if (rail.mounted && rail.panels.some((p) => p.id === 'tasks')) rail.openPanel('tasks')\n else setListOpen(true)\n }\n\n const handleStart = async () => {\n const result = await trial.start()\n setConfirmOpen(false)\n if (result?.ok) {\n const rect = pillRef.current?.getBoundingClientRect()\n fireConfetti(rect ? { origin: { x: (rect.left + rect.width / 2) / window.innerWidth, y: rect.top / window.innerHeight } } : undefined)\n }\n }\n\n const pillClass = cn(\n 'group inline-flex h-11 items-center gap-2.5 rounded-full border text-sm font-medium shadow-md transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n ready\n ? 'border-primary bg-primary text-primary-foreground hover:bg-primary/90'\n : 'border-border bg-card text-foreground hover:bg-muted',\n mobile ? 'w-full justify-between rounded-none border-x-0 px-4' : 'px-3 pr-4',\n )\n\n const pill = (\n <button\n ref={pillRef}\n type=\"button\"\n aria-label={pillLabel}\n aria-haspopup={ready ? 'dialog' : 'dialog'}\n aria-expanded={ready ? confirmOpen : listOpen}\n data-tour=\"getting-started.cta\"\n onClick={() => (ready && trial.allowed ? setConfirmOpen(true) : openList())}\n {...(ready ? trial.markProps : {})}\n className={pillClass}\n >\n <span className=\"inline-flex min-w-0 items-center gap-2.5\">\n <ProgressRing value={ringDone} max={ringTotal} label={ringLabel} complete={ready} onPrimary={ready} />\n {ready ? (\n <span className=\"truncate\">{readyText}</span>\n ) : (\n <span className=\"truncate\">\n <span>{t('gettingStarted.cta.title')}</span>\n <span className=\"mx-1.5 text-muted-foreground\" aria-hidden=\"true\">·</span>\n <span className=\"text-muted-foreground\">{remainingText}</span>\n </span>\n )}\n </span>\n <ChevronRight className={cn('h-4 w-4 shrink-0', ready ? 'text-primary-foreground/80' : 'text-muted-foreground')} aria-hidden=\"true\" />\n </button>\n )\n\n return (\n <>\n <div\n className={cn(\n 'pointer-events-none fixed z-40 flex flex-col items-start gap-2',\n // Above the tab bar AND the mascot button that rises out of it: at\n // 3.5rem the pill's text sat right under the mascot. And above the\n // shell's bottom notice strip (`--fz-shell-banner`), which it used\n // to sit on top of, hiding the notice's text.\n mobile\n ? 'inset-x-0 bottom-[calc(env(safe-area-inset-bottom)+6.25rem+var(--fz-shell-banner,0px))]'\n : 'bottom-[calc(var(--fz-shell-banner,0px)+1.5rem)]',\n )}\n style={mobile ? undefined : { left: contentLeft + 24 }}\n >\n {notice && (\n <p role=\"status\" className=\"pointer-events-auto mx-4 max-w-sm rounded-card border border-border bg-card px-3 py-2 text-xs text-foreground shadow-sm md:mx-0\">\n {notice}\n </p>\n )}\n {mobile && minimized ? (\n <Button\n type=\"button\"\n variant=\"bare\"\n size=\"bare\"\n aria-label={t('gettingStarted.cta.expand')}\n onClick={() => setMinimized(false)}\n className=\"pointer-events-auto ml-4 inline-flex h-11 w-11 items-center justify-center rounded-full border border-border bg-card shadow-md\"\n >\n <ProgressRing value={ringDone} max={ringTotal} size={20} label={ringLabel} complete={ready} />\n </Button>\n ) : (\n <div className={cn('pointer-events-auto flex items-center', mobile && 'w-full bg-card')}>\n {pill}\n {mobile && (\n <Button\n type=\"button\"\n variant=\"bare\"\n size=\"bare\"\n aria-label={t('gettingStarted.cta.minimize')}\n onClick={() => setMinimized(true)}\n className={cn('inline-flex h-11 w-11 shrink-0 items-center justify-center', ready ? 'bg-primary text-primary-foreground' : 'text-muted-foreground')}\n >\n <ChevronDown className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n )}\n </div>\n )}\n </div>\n\n {listOpen && mobile && (\n <BottomSheet title={t('gettingStarted.cta.title')} onClose={() => setListOpen(false)}>\n <StepList catalog={catalog} rows={rows} lines={trial.lines} declaration={declaration} onNavigate={() => setListOpen(false)} />\n </BottomSheet>\n )}\n {!mobile && (\n <Sheet open={listOpen} onOpenChange={setListOpen}>\n <SheetContent>\n <SheetHeader>\n <SheetTitle className=\"flex items-center gap-2\">\n <Rocket className=\"h-4 w-4 text-primary\" aria-hidden=\"true\" />\n {t('gettingStarted.cta.title')}\n </SheetTitle>\n </SheetHeader>\n <StepList catalog={catalog} rows={rows} lines={trial.lines} declaration={declaration} onNavigate={() => setListOpen(false)} />\n </SheetContent>\n </Sheet>\n )}\n\n <ConfirmDialog\n open={confirmOpen}\n title={t('gettingStarted.confirm.title', { days: trialDays })}\n description={t('gettingStarted.confirm.body', { date: projectedEnd })}\n confirmLabel={starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.confirm.ok')}\n cancelLabel={t('gettingStarted.confirm.cancel')}\n loading={starting}\n onConfirm={() => { void handleStart() }}\n onCancel={() => setConfirmOpen(false)}\n />\n </>\n )\n}\n\n/** The checklist as the sheet shows it: minimums first, the rest under \"Quando quiser\" (UX spec §2.2). */\nfunction StepList({ catalog, rows, lines, declaration, onNavigate }: {\n catalog: Catalog\n rows: Rows\n lines: MinimumLine[]\n declaration: JourneyDeclaration\n onNavigate: () => void\n}) {\n const t = useTranslation()\n // The same selection the card draws (launch + later): the sheet is the pill\n // opened, not the Tarefas tab.\n const journeySteps = React.useMemo(() => {\n const { launch, later } = selectJourneySteps(catalog, declaration)\n return [...launch, ...later]\n }, [catalog, declaration])\n const minimumKeys = new Set(lines.map((l) => l.key))\n const minimumSteps = lines.map((l) => ({\n key: l.key,\n title: l.step?.title ?? (l.slot ? t(`gettingStarted.settings.minimums.${l.slot}`) : l.key),\n route: l.step?.route,\n done: l.done,\n }))\n const laterSteps = journeySteps\n .filter((s) => !minimumKeys.has(s.key))\n .map((s) => ({ key: s.key, title: s.title, route: s.route, done: rowDone(rows, s.key) }))\n const firstOpen = [...minimumSteps, ...laterSteps].find((s) => !s.done)?.key\n\n const row = (step: { key: string; title: string; route?: string; done: boolean }) => {\n const now = step.key === firstOpen\n const state = step.done ? t('gettingStarted.cta.sheet.done') : now ? t('gettingStarted.cta.sheet.now') : t('gettingStarted.cta.sheet.open')\n return (\n <li key={step.key}>\n <button\n type=\"button\"\n aria-label={`${step.title}, ${state}`}\n onClick={() => { if (step.route) adminNavigateTo(step.route); onNavigate() }}\n className={cn(\n 'flex min-h-[44px] w-full items-center gap-3 rounded-button px-2 text-left text-sm transition-colors hover:bg-muted',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n now && 'bg-accent',\n )}\n >\n {step.done\n ? <Check className=\"h-4 w-4 shrink-0 text-success\" aria-hidden=\"true\" />\n : <Circle className={cn('h-3 w-3 shrink-0', now ? 'fill-primary text-primary' : 'text-muted-foreground')} aria-hidden=\"true\" />}\n <span className={cn('min-w-0 flex-1 truncate', step.done && 'text-muted-foreground line-through')}>{step.title}</span>\n {now && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground\">\n {t('gettingStarted.cta.sheet.now')}\n </span>\n )}\n {step.route && (\n <span className=\"inline-flex items-center gap-0.5 text-xs text-muted-foreground\">\n {step.done ? t('gettingStarted.cta.sheet.review') : t('gettingStarted.cta.sheet.configure')}\n <ChevronRight className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n </span>\n )}\n </button>\n </li>\n )\n }\n\n return (\n <div className=\"space-y-4 py-2\">\n <p className=\"text-xs text-muted-foreground\" aria-live=\"polite\">\n {t('gettingStarted.cta.ring', { done: minimumSteps.filter((s) => s.done).length + laterSteps.filter((s) => s.done).length, total: minimumSteps.length + laterSteps.length })}\n </p>\n <div>\n <h4 className=\"px-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\">{t('gettingStarted.cta.sheet.minimums')}</h4>\n <ol className=\"space-y-0.5\">{minimumSteps.map(row)}</ol>\n </div>\n {laterSteps.length > 0 && (\n <div>\n <h4 className=\"px-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\">{t('gettingStarted.cta.sheet.later')}</h4>\n <ol className=\"space-y-0.5\">{laterSteps.map(row)}</ol>\n </div>\n )}\n </div>\n )\n}\n","import { getCurrentLocale } from '@fayz-ai/core'\n\nconst HOUR_MS = 3_600_000\nconst DAY_MS = 86_400_000\n\n/**\n * D0 as the UX spec defines it (§2.4, moment 10): only under 24 hours does the\n * clock stop saying \"days\" and start saying \"hoje às HH:mm\". 23 hours is still\n * \"1 dia\" everywhere else; here it is the last day.\n */\nexport function trialEndsToday(trialEndsAt: string | null | undefined, now: Date = new Date()): boolean {\n if (!trialEndsAt) return false\n const ends = Date.parse(trialEndsAt)\n if (Number.isNaN(ends)) return false\n const remaining = ends - now.getTime()\n return remaining > 0 && remaining < DAY_MS\n}\n\n/** \"23:59\" in the app's locale — the hour the copy of the D0 banner says. */\nexport function formatEndTime(iso: string | null | undefined, locale: string = getCurrentLocale()): string {\n if (!iso) return ''\n const date = new Date(iso)\n if (Number.isNaN(date.getTime())) return ''\n try {\n return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date)\n } catch {\n return `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`\n }\n}\n\nexport const D0_DISMISS_KEY = 'fayz:getting-started:d0-dismissed-until'\nexport const D0_DISMISS_HOURS = 8\n\n/** The banner is dismissable for 8 h (spec, moment 10) — per browser, never per server. */\nexport function isD0Dismissed(now: Date = new Date(), storage: Pick<Storage, 'getItem'> | undefined = safeStorage()): boolean {\n try {\n const until = Number(storage?.getItem(D0_DISMISS_KEY) ?? 0)\n return Number.isFinite(until) && until > now.getTime()\n } catch {\n return false\n }\n}\n\nexport function dismissD0(now: Date = new Date(), storage: Pick<Storage, 'setItem'> | undefined = safeStorage()): void {\n try {\n storage?.setItem(D0_DISMISS_KEY, String(now.getTime() + D0_DISMISS_HOURS * HOUR_MS))\n } catch {\n /* private mode */\n }\n}\n\nfunction safeStorage(): Storage | undefined {\n try {\n return globalThis.localStorage\n } catch {\n return undefined\n }\n}\n","import * as React from 'react'\nimport { Check, Clock, Lock, X } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { Button, PhoneField } from '@fayz-ai/ui'\nimport { SDK_PERMISSIONS, adminNavigateTo, useSdkPermission } from '@fayz-ai/admin/host'\nimport { useEnsureJourney, useGettingStartedConfig, useGettingStartedStore } from '../context'\nimport { formatTrialDate } from '../lib/trial-source-bridge'\nimport { dismissD0, formatEndTime, isD0Dismissed, trialEndsToday } from '../lib/trial-clock'\n\ntype Mode = 'idle' | 'phone' | 'done'\n\n/** The strip: edge to edge of the content card, ruled off from the page above.\n * `md:flex-nowrap` keeps the actions on the text's row from tablet up — the\n * text wraps inside its own box instead of pushing them down. The trailing\n * padding clears the assistant button parked in the bottom-right corner. */\nconst STRIP = 'flex w-full flex-wrap items-center gap-x-3 gap-y-2 border-t px-4 py-1.5 text-sm text-foreground md:flex-nowrap md:pl-6 md:pr-[calc(2rem+var(--fz-fab-clearance,0px))]'\n/** Full-width row of buttons on a phone, right-aligned beside the text above. */\nconst ACTIONS = 'flex w-full items-center gap-2 sm:w-auto sm:shrink-0'\n\n/**\n * Lives in the shell's `shell.banner` zone: a full-width strip pinned to the\n * bottom of the content card, under the page's scroll area. It used to sit in\n * `shell.topbar.start` — the fixed-height app band — where a two-line notice\n * either floated over the page title (wide) or squeezed beside the search in\n * four lines (narrow). Here it is in the flow: one line on desktop (icon · text\n * · actions on the right), and on a phone the actions take their own row.\n *\n * UX spec, moments 10 and 11. Two lines, never at the same time:\n *\n * - D0 (phase `trial`, under 24 h left): the last-day notice, small, dismissable\n * for 8 h. The first and only banner before the end — the rail clock carries\n * the days until then.\n * - `expired`: the plan gates already deny on their own; this is the line that\n * says why, and the one click to \"Quero contratar\", inline, never a modal.\n */\nexport function TrialEndBanner() {\n useEnsureJourney()\n const t = useTranslation()\n const config = useGettingStartedConfig()\n const journey = useGettingStartedStore((s) => s.journey)\n const requestContract = useGettingStartedStore((s) => s.requestContract)\n const { allowed, markProps } = useSdkPermission(SDK_PERMISSIONS.trialManage)\n const [mode, setMode] = React.useState<Mode>('idle')\n const [busy, setBusy] = React.useState(false)\n const [phone, setPhone] = React.useState('')\n const [notice, setNotice] = React.useState<string | null>(null)\n const [d0Hidden, setD0Hidden] = React.useState(() => isD0Dismissed())\n\n const requestedAt = journey?.wantsContractAt\n React.useEffect(() => { if (requestedAt) setMode('done') }, [requestedAt])\n\n if (!journey) return null\n\n if (journey.phase === 'trial') {\n if (d0Hidden || !trialEndsToday(journey.trialEndsAt)) return null\n return (\n <section\n role=\"region\"\n aria-label={t('gettingStarted.d0.region')}\n className={STRIP + ' border-destructive/30 bg-destructive/10'}\n >\n <Clock className=\"h-4 w-4 shrink-0 text-destructive\" aria-hidden=\"true\" />\n <p className=\"min-w-0 flex-1\">{t('gettingStarted.d0.title', { time: formatEndTime(journey.trialEndsAt) })}</p>\n <div className={ACTIONS}>\n <Button type=\"button\" size=\"sm\" className=\"flex-1 max-sm:h-9 sm:flex-none\" onClick={() => adminNavigateTo(config.routes.subscription)}>\n {t('gettingStarted.d0.subscribe')}\n </Button>\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"flex-1 max-sm:h-9 sm:flex-none\" onClick={() => adminNavigateTo(config.routes.subscription)}>\n {t('gettingStarted.d0.seeChanges')}\n </Button>\n <Button\n type=\"button\"\n size=\"bare\"\n variant=\"bare\"\n aria-label={t('gettingStarted.d0.dismiss')}\n title={t('gettingStarted.d0.dismiss')}\n onClick={() => { dismissD0(); setD0Hidden(true) }}\n className=\"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-button text-muted-foreground hover:bg-muted hover:text-foreground\"\n >\n <X className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n </Button>\n </div>\n </section>\n )\n }\n\n if (journey.phase !== 'expired') return null\n\n const submit = async () => {\n setBusy(true)\n setNotice(null)\n try {\n const result = await requestContract(phone ? `whatsapp:${phone}` : undefined)\n if (result.alreadyRequestedToday) setNotice(t('gettingStarted.banner.rateLimited'))\n setMode('done')\n } catch {\n setNotice(t('gettingStarted.banner.error'))\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <section\n role=\"region\"\n aria-label={t('gettingStarted.banner.region')}\n // A notice below takes its own row, so the strip may wrap again.\n className={STRIP + ' border-primary/20 bg-primary/10' + (notice ? ' md:flex-wrap' : '')}\n >\n <Lock className=\"h-4 w-4 shrink-0 text-primary\" aria-hidden=\"true\" />\n {mode === 'done' ? (\n <p className=\"flex min-w-0 flex-1 items-center gap-2\">\n <Check className=\"h-4 w-4 shrink-0 text-success\" aria-hidden=\"true\" />\n <span>{t('gettingStarted.banner.done')}</span>\n </p>\n ) : mode === 'phone' ? (\n <form\n onSubmit={(e) => { e.preventDefault(); void submit() }}\n className=\"flex min-w-0 flex-1 flex-wrap items-center gap-2\"\n >\n <span>{t('gettingStarted.banner.phonePrompt')}</span>\n <PhoneField value={phone} onChange={setPhone} aria-label={t('gettingStarted.banner.phoneLabel')} className=\"w-44\" autoFocus />\n <Button type=\"submit\" size=\"sm\" disabled={busy || !allowed} {...markProps}>\n {busy ? t('gettingStarted.banner.sending') : t('gettingStarted.banner.confirm')}\n </Button>\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" onClick={() => setMode('idle')} disabled={busy}>\n {t('gettingStarted.banner.back')}\n </Button>\n </form>\n ) : (\n <>\n <p className=\"min-w-0 flex-1\">{t('gettingStarted.banner.title', { date: formatTrialDate(journey.trialEndsAt) })}</p>\n <div className={ACTIONS}>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" className=\"flex-1 max-sm:h-9 sm:flex-none\" onClick={() => adminNavigateTo(config.routes.subscription)}>\n {t('gettingStarted.banner.seeChanges')}\n </Button>\n <Button type=\"button\" size=\"sm\" className=\"flex-1 max-sm:h-9 sm:flex-none\" onClick={() => setMode('phone')} disabled={!allowed} {...markProps}>\n {t('gettingStarted.banner.contract')}\n </Button>\n </div>\n </>\n )}\n {notice && <p role=\"status\" className=\"basis-full text-xs text-muted-foreground\">{notice}</p>}\n </section>\n )\n}\n","import * as React from 'react'\nimport { Check } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { Button, cn } from '@fayz-ai/ui'\nimport { SDK_PERMISSIONS, useSdkPermission } from '@fayz-ai/admin/host'\nimport { useGettingStartedStore } from '../context'\n\ntype ContractRequest = 'idle' | 'pending' | 'done' | 'error'\n\n/**\n * \"Quero contratar\" from day 0 (UX spec §2.5): a quiet secondary action — never\n * the primary button, never competing with \"AGORA\" or \"Iniciar teste\". Shown\n * in setup and during the trial; after the end the banner carries it, and a\n * paying tenant sees nothing. Once asked (now or any earlier day, as the\n * journey's `wantsContractAt` says) it turns into the \"we will call you\" line.\n */\nexport function RequestContractLink({ className }: { className?: string }) {\n const t = useTranslation()\n const journey = useGettingStartedStore((s) => s.journey)\n const requestContract = useGettingStartedStore((s) => s.requestContract)\n const { allowed, markProps } = useSdkPermission(SDK_PERMISSIONS.trialManage)\n const [state, setState] = React.useState<ContractRequest>('idle')\n const [rateLimited, setRateLimited] = React.useState(false)\n\n // Only a journey the server told: a client-side guess has nowhere to send the request.\n if (!journey || (journey.phase !== 'setup' && journey.phase !== 'trial')) return null\n\n const submit = async () => {\n if (state === 'pending') return\n setState('pending')\n try {\n const result = await requestContract()\n setRateLimited(result.alreadyRequestedToday === true)\n setState('done')\n } catch {\n setState('error')\n }\n }\n\n if (state === 'done' || journey.wantsContractAt) {\n return (\n <p data-contract=\"sent\" aria-live=\"polite\" className={cn('flex items-center gap-2 text-xs text-muted-foreground', className)}>\n <Check className=\"h-3.5 w-3.5 shrink-0 text-success\" aria-hidden=\"true\" />\n {rateLimited ? t('gettingStarted.banner.rateLimited') : t('gettingStarted.settings.contract.done')}\n </p>\n )\n }\n\n return (\n <div aria-live=\"polite\" className={cn('flex flex-wrap items-center gap-x-2', className)}>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n data-contract=\"request\"\n className=\"min-h-[44px] text-muted-foreground sm:min-h-9\"\n disabled={state === 'pending' || !allowed}\n onClick={() => { void submit() }}\n {...markProps}\n >\n {state === 'pending' ? t('gettingStarted.banner.sending') : t('gettingStarted.banner.contract')}\n </Button>\n {state === 'error' && <span role=\"alert\" className=\"text-xs text-destructive\">{t('gettingStarted.banner.error')}</span>}\n </div>\n )\n}\n","import * as React from 'react'\nimport { AlertTriangle, Compass, Rocket, WandSparkles } from 'lucide-react'\nimport { tl, useTranslation } from '@fayz-ai/core'\nimport {\n Button, Card, CardContent, CardHeader, ConfirmDialog, cn, fireConfetti, toast, useOnboardingProgress,\n type OnboardingStepInput, type TourActionResult,\n} from '@fayz-ai/ui'\nimport {\n OnboardingStepRow, SDK_PERMISSIONS, adminNavigateTo, closeRightRailOnPhone, startGuidedRun, useActivationStore,\n useClaimOnboardingTasks, useOrganizationStore, useSdkPermission,\n} from '@fayz-ai/admin/host'\nimport { useEnsureJourney, useGettingStartedConfig, useGettingStartedStore } from '../context'\nimport { isMissingClock } from '../data/types'\nimport {\n clientJourney, countMinimums, nowStepKey, selectJourneySteps, toStepInputs, type CatalogStepLike,\n} from '../lib/journey-steps'\nimport { formatTrialDate } from '../lib/trial-source-bridge'\nimport {\n CARD_ANCHOR, DESCRIBE_CARD_ACTION, startJourneyTour, useJourneyTourAutostart, useRememberJourneyRuntime, useTourDescription,\n} from '../lib/tour'\nimport { MINIMUM_IDS, type Journey, type MinimumId, type StartTrialResult } from '../types'\nimport { ProgressRing } from './ProgressRing'\nimport { RequestContractLink } from './RequestContractLink'\n\nconst DAY_MS = 86_400_000\n\ntype ActivationState = ReturnType<typeof useActivationStore.getState>\ntype Rows = ActivationState['rows']\ntype Catalog = ActivationState['catalog']\n\n/** The sensor said yes: close the row as it is NOW, not as it was when the list was built. */\nfunction latch(key: string): void {\n const state = useActivationStore.getState()\n const row = state.rows?.find((r) => r.sourceKey === key)\n if (row && row.status === 'todo') void state.complete(key, 'sensor')\n}\n\n/**\n * The sensor said no to a row marked done: the row is reopened in memory, so\n * the card, the pill and the Tarefas tab agree again this session. The data\n * is the fact; once it is there the latch above closes the row for good.\n */\nfunction reopen(key: string): void {\n const state = useActivationStore.getState()\n if (!state.rows?.some((r) => r.sourceKey === key && r.status === 'done')) return\n useActivationStore.setState({\n rows: state.rows.map((r) => (r.sourceKey === key ? { ...r, status: 'todo', completedAt: null } : r)),\n })\n}\n\n/**\n * \"Sua loja no ar\" — the journey as a dashboard card (UX spec §2.1–2.2, moment 3).\n *\n * Nine steps and no more: the ones picked by key out of the shell's activation\n * catalog, the ring counting what is really there, one \"AGORA\", the done ones\n * struck through, \"Quando quiser\" below a separator, and the one call to\n * action the phase allows. Reads the same rows the Tarefas tab and the\n * assistant read, so the three never disagree about what is done.\n */\nexport interface StoreLiveCardProps {\n className?: string\n /**\n * `rail` is the same card at the width of the assistant's Tarefas tab: tighter\n * padding, no tour anchor (the dashboard card is the tour's stop), and rows\n * that get out of the way of the screen they open on a phone.\n */\n variant?: 'card' | 'rail'\n}\n\nexport function StoreLiveCard({ className, variant = 'card' }: StoreLiveCardProps) {\n const rail = variant === 'rail'\n useEnsureJourney()\n const t = useTranslation()\n const config = useGettingStartedConfig()\n const journey = useGettingStartedStore((s) => s.journey)\n const journeyError = useGettingStartedStore((s) => s.error)\n const rows = useActivationStore((s) => s.rows)\n const catalog = useActivationStore((s) => s.catalog)\n const tenantId = useOrganizationStore((s) => s.currentOrg?.id)\n // The hours and payments sensors read the workspace in memory: when it is\n // repainted (the tab saved, the row arrived) the sensors run again.\n const storeSettings = useOrganizationStore((s) => (s.currentOrg?.settings as { store?: unknown } | undefined)?.store)\n\n const selection = React.useMemo(() => selectJourneySteps(catalog as CatalogStepLike[]), [catalog])\n const counted = React.useMemo(() => [...selection.launch, ...selection.later], [selection])\n const steps = React.useMemo<OnboardingStepInput[]>(\n () => toStepInputs([...counted, ...selection.extra], rows, latch, reopen),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- storeSettings only re-arms the sensors\n [counted, selection.extra, rows, storeSettings],\n )\n const onNavigate = React.useCallback((path: string) => adminNavigateTo(path), [])\n const { completed, resolved } = useOnboardingProgress(steps, onNavigate)\n\n const total = counted.length\n const done = counted.filter((s) => completed[s.key]).length\n const minimums = React.useMemo(() => countMinimums(journey, rows), [journey, rows])\n // Without the clock on the server, the client still knows the phase: setup.\n const effective: Journey | null = journey ?? (journeyError && tenantId\n ? clientJourney({ tenantId, trialDays: config.trialDays, rows })\n : null)\n const phase = effective?.phase ?? 'setup'\n const inSetup = phase === 'setup'\n const now = inSetup ? nowStepKey(selection, completed) : undefined\n\n // The closing tour: this card is its first stop. The stop's copy is the\n // card's own numbers at the moment it shows; a tour left waiting by the\n // minimums turning green starts here, once the card is on screen uncovered.\n const runtime = useRememberJourneyRuntime()\n const cardRef = React.useRef<HTMLDivElement>(null)\n const describe = (): TourActionResult => ({\n title: t('gettingStarted.card.title'),\n body: phase === 'trial'\n ? tl(\n `${done} of ${total} steps done. The trial runs until ${formatTrialDate(effective?.trialEndsAt)}; what is left waits here, at your pace.`,\n `${done} de ${total} passos prontos. O teste vai até ${formatTrialDate(effective?.trialEndsAt)}; o que falta espera aqui, no seu ritmo.`,\n )\n : minimums.ready\n ? tl(\n `${done} of ${total} steps done — everything the trial needs is in. The button is right below.`,\n `${done} de ${total} passos prontos — tudo o que o teste precisa já está aqui. O botão fica logo abaixo.`,\n )\n : tl(\n `${done} of ${total} steps done. Each line opens its screen.`,\n `${done} de ${total} passos prontos. Cada linha abre a tela dela.`,\n ),\n })\n\n // A tenant with no checklist rows (predates this, or no Supabase) gets no card — not \"0/0\".\n const drawn = !!rows && rows.length > 0 && total > 0\n const claimed = React.useMemo(\n () => (drawn ? [...counted, ...selection.extra].map((s) => s.key) : []),\n [drawn, counted, selection.extra],\n )\n // In the Tarefas tab, the list below leaves these steps out (no-op elsewhere).\n useClaimOnboardingTasks(claimed)\n\n if (!drawn) return null\n\n const ringLabel = t('gettingStarted.card.aria', { done, total })\n const subtitle = phase === 'trial'\n ? t('gettingStarted.card.subtitle.trial', { date: formatTrialDate(effective?.trialEndsAt) })\n : phase === 'expired'\n ? t('gettingStarted.card.subtitle.expired', { date: formatTrialDate(effective?.trialEndsAt) })\n : phase === 'converted'\n ? t('gettingStarted.card.subtitle.converted')\n : minimums.ready\n ? t('gettingStarted.card.subtitle.ready')\n : minimums.missing.length === 1\n ? t('gettingStarted.card.subtitle.setup.one')\n : t('gettingStarted.card.subtitle.setup.many', { count: minimums.missing.length })\n\n const afterNavigate = rail ? closeRightRailOnPhone : undefined\n\n return (\n <Card\n ref={cardRef}\n data-tour={rail ? undefined : CARD_ANCHOR}\n data-variant={variant}\n className={className}\n aria-busy={!resolved || undefined}\n >\n {!rail && (\n <CardTour cardRef={cardRef} describe={describe} autostart={inSetup && minimums.ready} runtime={runtime} />\n )}\n <CardHeader className={cn('pb-2', rail && 'p-3')}>\n <div className=\"flex items-start gap-3\">\n <div className=\"flex flex-col items-center\">\n <ProgressRing value={done} max={total} size={40} label={ringLabel} complete={done === total} />\n <span className=\"mt-0.5 text-[10px] text-muted-foreground\">{t('gettingStarted.card.steps')}</span>\n </div>\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"flex items-center gap-2 text-base font-semibold leading-tight\">\n <Rocket className=\"h-4 w-4 text-primary\" aria-hidden=\"true\" />\n {t('gettingStarted.card.title')}\n </h3>\n <p className=\"mt-0.5 text-sm text-muted-foreground\" aria-live=\"polite\">{subtitle}</p>\n {!journey && journeyError && (\n <p className=\"mt-1 flex items-center gap-1.5 text-xs text-muted-foreground\">\n <AlertTriangle className=\"h-3.5 w-3.5 shrink-0 text-warning\" aria-hidden=\"true\" />\n {t('gettingStarted.card.noClock')}\n </p>\n )}\n </div>\n </div>\n </CardHeader>\n <CardContent className={cn('space-y-3 pt-0', rail && 'px-2 pb-3')}>\n <ol aria-label={ringLabel} className=\"space-y-0.5\">\n {selection.launch.length > 0 && !selection.fallback && (\n <li className=\"flex items-center gap-2 px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\" aria-hidden=\"true\">\n {t('gettingStarted.card.group.launch')}\n </li>\n )}\n {selection.launch.map((step) => (\n <StepRow key={step.key} step={step} done={!!completed[step.key]} now={step.key === now} afterNavigate={afterNavigate} />\n ))}\n {selection.later.length > 0 && (\n <li className=\"flex items-center gap-2 px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\" role=\"separator\">\n <span className=\"h-px flex-1 bg-border\" aria-hidden=\"true\" />\n {t('gettingStarted.card.group.later')}\n <span className=\"h-px flex-1 bg-border\" aria-hidden=\"true\" />\n </li>\n )}\n {selection.later.map((step) => (\n <StepRow key={step.key} step={step} done={!!completed[step.key]} now={step.key === now} afterNavigate={afterNavigate} />\n ))}\n {selection.extra.map((step) => (\n <StepRow key={step.key} step={step} done={!!completed[step.key]} now={false} optional afterNavigate={afterNavigate} />\n ))}\n </ol>\n {inSetup && <SetupActions journey={effective} minimums={minimums} nowKey={now} />}\n {phase === 'trial' && (\n <div className=\"flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"min-h-[44px] sm:min-h-9\"\n onClick={() => { startJourneyTour({ force: true, moment: 'manual', runtime }) }}\n >\n <Compass className=\"h-4 w-4 text-primary\" aria-hidden=\"true\" />\n {tl('Take the tour again', 'Fazer o tour de novo')}\n </Button>\n <RequestContractLink />\n </div>\n )}\n </CardContent>\n </Card>\n )\n}\n\nfunction StepRow({ step, done, now, optional, afterNavigate }: {\n step: CatalogStepLike\n done: boolean\n now: boolean\n optional?: boolean\n afterNavigate?: () => void\n}) {\n const t = useTranslation()\n const go = () => {\n if (step.route) { adminNavigateTo(step.route); afterNavigate?.() }\n else if (!done) void startGuidedRun(step.key)\n }\n return (\n <OnboardingStepRow\n title={step.title}\n done={done}\n now={now}\n nowLabel={t('gettingStarted.cta.sheet.now')}\n note={optional ? t('gettingStarted.card.optional') : undefined}\n stateLabel={done ? t('gettingStarted.cta.sheet.done') : now ? t('gettingStarted.cta.sheet.now') : t('gettingStarted.cta.sheet.open')}\n action={step.route ? (done ? t('gettingStarted.cta.sheet.review') : t('gettingStarted.cta.sheet.configure')) : undefined}\n onClick={go}\n />\n )\n}\n\n/** The closing tour's hooks: only the dashboard card is a tour stop, never its copy in the rail. */\nfunction CardTour({ cardRef, describe, autostart, runtime }: {\n cardRef: React.RefObject<HTMLDivElement | null>\n describe: () => TourActionResult\n autostart: boolean\n runtime: ReturnType<typeof useRememberJourneyRuntime>\n}) {\n useTourDescription(DESCRIBE_CARD_ACTION, describe)\n useJourneyTourAutostart(cardRef, autostart, runtime)\n return null\n}\n\n/** The one action of the setup phase (start the trial, or what is still missing + the assistant), and the quiet \"Quero contratar\". */\nfunction SetupActions({ journey, minimums, nowKey }: {\n journey: Journey | null\n minimums: ReturnType<typeof countMinimums>\n nowKey: string | undefined\n}) {\n const t = useTranslation()\n const config = useGettingStartedConfig()\n const starting = useGettingStartedStore((s) => s.starting)\n const startTrial = useGettingStartedStore((s) => s.startTrial)\n const { allowed, markProps } = useSdkPermission(SDK_PERMISSIONS.trialManage)\n const [confirmOpen, setConfirmOpen] = React.useState(false)\n const [notice, setNotice] = React.useState<string | null>(null)\n const anchor = React.useRef<HTMLButtonElement>(null)\n\n const trialDays = journey?.trialDays || config.trialDays\n const ready = journey?.minimums.ready || minimums.ready\n const missingWords = (ids: MinimumId[]) => ids.map((id) => t(`gettingStarted.minimum.${id}`)).join(t('gettingStarted.minimum.join'))\n\n const handleStart = async () => {\n setNotice(null)\n let result: StartTrialResult\n try {\n result = await startTrial()\n } catch (e) {\n setConfirmOpen(false)\n setNotice(isMissingClock(e) ? t('gettingStarted.start.noClock') : t('gettingStarted.start.error'))\n return\n }\n setConfirmOpen(false)\n if (result.ok) {\n const rect = anchor.current?.getBoundingClientRect()\n fireConfetti(rect ? { origin: { x: (rect.left + rect.width / 2) / window.innerWidth, y: rect.top / window.innerHeight } } : undefined)\n toast.success(t('gettingStarted.start.done', { date: formatTrialDate(result.trialEndsAt) }))\n return\n }\n setNotice(t('gettingStarted.start.missing', { what: missingWords(MINIMUM_IDS.filter((id) => !result.minimums[id])) }))\n }\n\n return (\n <div className=\"space-y-2 border-t border-border pt-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n {ready ? (\n <Button ref={anchor} type=\"button\" size=\"sm\" className=\"min-h-[44px] sm:min-h-9\" onClick={() => setConfirmOpen(true)} disabled={starting || !allowed} {...markProps}>\n {starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.cta.ready', { days: trialDays })}\n </Button>\n ) : (\n <span className=\"text-xs text-muted-foreground\">{t('gettingStarted.start.missingLabel', { what: missingWords(minimums.missing) })}</span>\n )}\n {nowKey && (\n <Button type=\"button\" size=\"sm\" variant={ready ? 'ghost' : 'outline'} className=\"min-h-[44px] sm:min-h-9\" onClick={() => { void startGuidedRun(nowKey) }}>\n <WandSparkles className=\"h-4 w-4 text-primary\" aria-hidden=\"true\" />\n {t('gettingStarted.card.withAssistant')}\n </Button>\n )}\n {/* Day 0 on: the quiet way out of the trial, pushed to the far end of the footer. */}\n <RequestContractLink className=\"ml-auto\" />\n </div>\n {notice && <p role=\"alert\" className=\"text-xs text-foreground\">{notice}</p>}\n <ConfirmDialog\n open={confirmOpen}\n title={t('gettingStarted.confirm.title', { days: trialDays })}\n description={t('gettingStarted.confirm.body', { date: formatTrialDate(new Date(Date.now() + trialDays * DAY_MS).toISOString()) })}\n confirmLabel={starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.confirm.ok')}\n cancelLabel={t('gettingStarted.confirm.cancel')}\n loading={starting}\n onConfirm={() => { void handleStart() }}\n onCancel={() => setConfirmOpen(false)}\n />\n </div>\n )\n}\n","import * as React from 'react'\nimport { AlertTriangle, Check, Circle, Clock, Compass, Crown, Lock } from 'lucide-react'\nimport { tl, useTranslation } from '@fayz-ai/core'\nimport {\n Button, Checkbox, ConfirmDialog, HoursField, Input, Skeleton, cn, isHoursValue, normalizeHours,\n type HoursLabels, type HoursTemplate, type HoursValue,\n} from '@fayz-ai/ui'\nimport { SDK_PERMISSIONS, SettingsGroup, adminNavigateTo, useActivationStore, useOrganizationStore, useSdkPermission } from '@fayz-ai/admin/host'\nimport { useEnsureJourney, useGettingStartedConfig, useGettingStartedStore } from '../context'\nimport { isMissingClock } from '../data/types'\nimport { clientJourney, countMinimums } from '../lib/journey-steps'\nimport { loadStoreSettings, readStoreSettings, saveStoreSetting } from '../lib/store-settings'\nimport { formatTrialDate } from '../lib/trial-source-bridge'\nimport {\n DESCRIBE_TRIAL_TAB_ACTION, TRIAL_TAB_ANCHOR, startJourneyTour, useRememberJourneyRuntime, useTourDescription,\n} from '../lib/tour'\nimport {\n MINIMUM_IDS, PAYMENT_METHODS, WEEKDAYS,\n type HoursRange, type Journey, type MinimumId, type PaymentMethod, type StoreHours, type Weekday,\n} from '../types'\n\nconst DEFAULT_RANGE: HoursRange = { open: '11:00', close: '23:00' }\nconst DAY_MS = 86_400_000\n\nexport type HoursTemplateId = 'weekdays' | 'everyday' | 'weekend'\nconst TEMPLATES: Record<HoursTemplateId, Weekday[]> = {\n weekdays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat'],\n everyday: [...WEEKDAYS],\n weekend: ['sat', 'sun'],\n}\n\n/** The three models of the tab as the shared editor's templates: one 11–23 shift on the listed days. */\nexport function hoursTemplates(label: (id: HoursTemplateId) => string): HoursTemplate[] {\n return (Object.keys(TEMPLATES) as HoursTemplateId[]).map((id) => {\n const hours: HoursValue = {}\n for (const day of TEMPLATES[id]) hours[day] = [{ ...DEFAULT_RANGE }]\n return { id, label: label(id), hours }\n })\n}\n\n/**\n * What the editor emits → what `store.hours` keeps. The editor hands back\n * every day (closed ones as `[]`); the row — and the sensor that counts its\n * keys — wants only the open days. Every shift of every day survives: this\n * is the whole function, and the reason the tab lost \"18:00–23:00\" once.\n */\nexport function toStoreHours(value: HoursValue | StoreHours | undefined): StoreHours {\n const week = normalizeHours(value as HoursValue | undefined)\n const out: StoreHours = {}\n for (const day of WEEKDAYS) {\n const shifts = week[day] ?? []\n if (shifts.length > 0 && isHoursValue({ [day]: shifts })) out[day] = shifts.map((s) => ({ open: s.open, close: s.close }))\n }\n return out\n}\n\ntype SaveState = { saving: number; error: string | null; offline: boolean; viaRow: boolean }\n\n/**\n * Hours and payment methods are read from `tenants.settings.store` as the\n * workspace in memory has it — the row the wizard wrote and the sensors read —\n * and written through `tenant_setting_set`, falling back to the row itself when\n * the pool has not registered the keys yet (migration 000). Neither depends on\n * the journey RPCs: the tab works before the clock exists on the server.\n */\nexport function TrialSettingsTab() {\n useEnsureJourney()\n const t = useTranslation()\n const settings = useOrganizationStore((s) => s.currentOrg?.settings)\n const orgId = useOrganizationStore((s) => s.currentOrg?.id)\n const { hours, methods } = React.useMemo(() => readStoreSettings(settings), [settings])\n // Memory may have no `store` yet: a host paints no settings, and once the hours\n // and payment steps are done no sensor asks the provider again. Ask it here, or\n // the tab shows an empty week over hours that are saved (V1 e2e, 27/10).\n React.useEffect(() => { if (orgId) void loadStoreSettings() }, [orgId])\n const [state, setState] = React.useState<SaveState>({ saving: 0, error: null, offline: false, viaRow: false })\n\n const save = React.useCallback(async (key: 'hours' | 'payment_methods', value: unknown) => {\n setState((s) => ({ ...s, saving: s.saving + 1, error: null }))\n const result = await saveStoreSetting(key, value)\n setState((s) => ({\n saving: Math.max(0, s.saving - 1),\n error: result.ok ? null : result.reason === 'error' ? (result.message ?? '') : s.error,\n offline: !result.ok && result.reason === 'offline',\n viaRow: result.ok ? result.via === 'row' : s.viaRow,\n }))\n }, [])\n const saveHours = (next: StoreHours) => { void save('hours', next) }\n const saveMethods = (next: PaymentMethod[]) => { void save('payment_methods', next) }\n const templates = React.useMemo(() => hoursTemplates((id) => t(`gettingStarted.settings.hours.template.${id}`)), [t])\n const hoursLabels = React.useMemo<Partial<HoursLabels>>(() => ({\n days: Object.fromEntries(WEEKDAYS.map((day) => [day, t(`gettingStarted.settings.day.${day}`)])) as HoursLabels['days'],\n }), [t])\n\n return (\n <div className=\"space-y-6\">\n <JourneyCard />\n\n {state.offline && (\n <p className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <AlertTriangle className=\"h-3.5 w-3.5 text-warning\" aria-hidden=\"true\" />\n {t('gettingStarted.settings.offline')}\n </p>\n )}\n {state.error && (\n <p role=\"alert\" className=\"flex items-center gap-2 text-xs text-foreground\">\n <AlertTriangle className=\"h-3.5 w-3.5 text-destructive\" aria-hidden=\"true\" />\n {t('gettingStarted.settings.saveError', { message: state.error })}\n </p>\n )}\n\n <SettingsGroup title={t('gettingStarted.settings.hours.title')} description={t('gettingStarted.settings.hours.description')}>\n {/* The wizard's editor, not a second one: every shift of the day is on\n screen (add, remove, \"Igual a seg\"), so nothing is lost on save. */}\n <HoursField\n className=\"py-2\"\n aria-label={t('gettingStarted.settings.hours.title')}\n value={hours}\n templates={templates}\n labels={hoursLabels}\n onChange={(next) => saveHours(toStoreHours(next))}\n />\n </SettingsGroup>\n\n <SettingsGroup title={t('gettingStarted.settings.payments.title')} description={t('gettingStarted.settings.payments.description')}>\n <ul className=\"divide-y divide-border\">\n {PAYMENT_METHODS.map((method) => {\n const checked = methods.includes(method)\n return (\n <li key={method}>\n <label className=\"flex min-h-[44px] cursor-pointer items-center gap-3 py-2 text-sm\">\n <Checkbox\n checked={checked}\n onChange={(next) => saveMethods(next ? [...methods, method] : methods.filter((m) => m !== method))}\n />\n <span>{t(`gettingStarted.settings.payments.${method}`)}</span>\n </label>\n </li>\n )\n })}\n </ul>\n </SettingsGroup>\n\n <p className=\"text-xs text-muted-foreground\" aria-live=\"polite\">\n {state.saving > 0 ? t('gettingStarted.settings.saving') : !state.error && !state.offline ? t('gettingStarted.settings.saved') : ''}\n </p>\n </div>\n )\n}\n\n/** Phase, dates, the three minimums and the one action the phase allows. */\nfunction JourneyCard() {\n const t = useTranslation()\n const config = useGettingStartedConfig()\n const journey = useGettingStartedStore((s) => s.journey)\n const loading = useGettingStartedStore((s) => s.loading)\n const error = useGettingStartedStore((s) => s.error)\n const starting = useGettingStartedStore((s) => s.starting)\n const load = useGettingStartedStore((s) => s.load)\n const startTrial = useGettingStartedStore((s) => s.startTrial)\n const requestContract = useGettingStartedStore((s) => s.requestContract)\n const { allowed, markProps } = useSdkPermission(SDK_PERMISSIONS.trialManage)\n const tenantId = useOrganizationStore((s) => s.currentOrg?.id)\n const rows = useActivationStore((s) => s.rows)\n const [confirmOpen, setConfirmOpen] = React.useState(false)\n const [note, setNote] = React.useState('')\n const [busy, setBusy] = React.useState(false)\n const [notice, setNotice] = React.useState<string | null>(null)\n\n // No clock on the server yet: the phase is setup by definition and the\n // minimums are what the checklist already ticked — computed here, never \"0 dias\".\n const serverless = !journey && !!error && !loading\n const effective: Journey | null = journey ?? (serverless && tenantId\n ? clientJourney({ tenantId, trialDays: config.trialDays, rows })\n : null)\n\n // The closing tour ends here; the stop reads the clock as it is now.\n const runtime = useRememberJourneyRuntime()\n useTourDescription(DESCRIBE_TRIAL_TAB_ACTION, () => ({\n title: t(`gettingStarted.settings.phase.${effective?.phase ?? 'setup'}`),\n body: effective?.phase === 'trial'\n ? tl(\n `Your trial runs until ${formatTrialDate(effective.trialEndsAt)}. Hours and payment methods are edited right below; the plans live here too.`,\n `Seu teste vai até ${formatTrialDate(effective.trialEndsAt)}. Horários e formas de pagamento se editam logo abaixo; os planos também ficam aqui.`,\n )\n : tl(\n 'Hours, payment methods and the trial clock live in this tab. When everything is ready, the trial starts from here.',\n 'Horários, formas de pagamento e o relógio do teste moram nesta aba. Com tudo pronto, o teste começa daqui.',\n ),\n }))\n\n if (!effective) {\n if (loading) {\n return (\n <div className=\"space-y-4\" aria-busy=\"true\" aria-label={t('gettingStarted.settings.loading')}>\n {[3, 4, 2].map((rows, i) => (\n <div key={i} className=\"space-y-3 rounded-card border border-border bg-card p-4\">\n <Skeleton className=\"h-4 w-40\" />\n {Array.from({ length: rows }, (_, j) => <Skeleton key={j} className=\"h-9 w-full\" />)}\n </div>\n ))}\n </div>\n )\n }\n return (\n <div className=\"rounded-card border border-border bg-card p-4 text-sm text-muted-foreground\">\n {error ? (\n <span className=\"flex flex-wrap items-center gap-2\">\n {t('gettingStarted.settings.loadError')}\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={() => { void load(tenantId) }}>{t('gettingStarted.settings.retry')}</Button>\n </span>\n ) : null}\n </div>\n )\n }\n\n const minimums = countMinimums(journey, rows)\n const ready = effective.minimums.ready || minimums.ready\n const missing = ready ? [] : MINIMUM_IDS.filter((id) => !(effective.minimums[id] || minimums.done.includes(id)))\n const trialDays = effective.trialDays || config.trialDays\n const missingWords = (ids: MinimumId[]) => ids.map((id) => t(`gettingStarted.minimum.${id}`)).join(t('gettingStarted.minimum.join'))\n\n const handleStart = async () => {\n setNotice(null)\n try {\n const result = await startTrial()\n setConfirmOpen(false)\n if (!result.ok) {\n const still = MINIMUM_IDS.filter((id) => !result.minimums[id])\n setNotice(t('gettingStarted.start.missing', { what: missingWords(still) }))\n }\n } catch (e) {\n setConfirmOpen(false)\n setNotice(isMissingClock(e) ? t('gettingStarted.start.noClock') : t('gettingStarted.start.error'))\n }\n }\n\n const handleContract = async () => {\n setBusy(true)\n setNotice(null)\n try {\n const result = await requestContract(note.trim() || undefined)\n setNotice(result.alreadyRequestedToday ? t('gettingStarted.banner.rateLimited') : t('gettingStarted.settings.contract.done'))\n } catch {\n setNotice(t('gettingStarted.banner.error'))\n } finally {\n setBusy(false)\n }\n }\n\n const phase = effective.phase\n const headline = t(`gettingStarted.settings.phase.${phase}`)\n const line = phase === 'setup'\n ? ready\n ? t('gettingStarted.settings.phase.setup.ready')\n : missing.length === 1\n ? t('gettingStarted.settings.phase.setup.line.one')\n : t('gettingStarted.settings.phase.setup.line.many', { count: missing.length })\n : phase === 'trial'\n ? t('gettingStarted.settings.phase.trial.line', { date: formatTrialDate(effective.trialEndsAt) })\n : phase === 'expired'\n ? t('gettingStarted.settings.phase.expired.line', { date: formatTrialDate(effective.trialEndsAt) })\n : t('gettingStarted.settings.phase.converted.line')\n const Icon = phase === 'converted' ? Crown : phase === 'expired' ? Lock : Clock\n // \"Quero contratar\" from day 0 to the end — in setup only with the server's\n // journey (a client-side guess has nowhere to send it), and there as a\n // secondary button: \"Iniciar teste\" stays the one primary of the phase.\n const canContract = phase === 'trial' || phase === 'expired' || (phase === 'setup' && !!journey)\n\n return (\n <div data-tour={TRIAL_TAB_ANCHOR} className=\"rounded-card border border-border bg-card p-4\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-3\">\n <Icon className={cn('mt-0.5 h-5 w-5 shrink-0', phase === 'expired' ? 'text-destructive' : 'text-primary')} aria-hidden=\"true\" />\n <div className=\"min-w-0\">\n <h3 className=\"text-sm font-semibold\">{headline}</h3>\n <p className=\"text-sm text-muted-foreground\">{line}</p>\n {phase === 'setup' && effective.setupDeadlineAt && (\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {t('gettingStarted.settings.phase.setup.deadline', { date: formatTrialDate(effective.setupDeadlineAt) })}\n </p>\n )}\n {serverless && (\n <p className=\"mt-1 flex items-center gap-1.5 text-xs text-muted-foreground\">\n <AlertTriangle className=\"h-3.5 w-3.5 shrink-0 text-warning\" aria-hidden=\"true\" />\n {t('gettingStarted.settings.phase.setup.offline')}\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" className=\"h-6 px-2 text-xs\" onClick={() => { void load(tenantId) }}>\n {t('gettingStarted.settings.retry')}\n </Button>\n </p>\n )}\n </div>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {phase === 'setup' && ready && (\n <Button type=\"button\" size=\"sm\" onClick={() => setConfirmOpen(true)} disabled={starting || !allowed} {...markProps}>\n {starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.confirm.ok')}\n </Button>\n )}\n {phase === 'setup' && !ready && (\n <span className=\"text-xs text-muted-foreground\">{t('gettingStarted.start.missingLabel', { what: missingWords(missing) })}</span>\n )}\n {(phase === 'trial' || phase === 'expired') && (\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={() => adminNavigateTo(config.routes.subscription)}>\n {t('gettingStarted.settings.plans')}\n </Button>\n )}\n {(phase === 'setup' || phase === 'trial') && (\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" onClick={() => { startJourneyTour({ force: true, moment: 'manual', runtime }) }}>\n <Compass className=\"h-4 w-4 text-primary\" aria-hidden=\"true\" />\n {tl('Take the tour again', 'Fazer o tour de novo')}\n </Button>\n )}\n </div>\n </div>\n\n {phase === 'setup' && (\n <ul className=\"mt-4 space-y-1\" aria-label={t('gettingStarted.settings.minimums.title')}>\n {MINIMUM_IDS.map((id) => {\n const done = effective.minimums[id] || minimums.done.includes(id)\n return (\n <li key={id} className=\"flex items-center gap-2 text-sm\">\n {done\n ? <Check className=\"h-4 w-4 text-success\" aria-hidden=\"true\" />\n : <Circle className=\"h-3 w-3 text-muted-foreground\" aria-hidden=\"true\" />}\n <span className={cn(done && 'text-muted-foreground line-through')}>{t(`gettingStarted.settings.minimums.${id}`)}</span>\n <span className=\"sr-only\">{done ? t('gettingStarted.settings.minimums.done') : t('gettingStarted.settings.minimums.pending')}</span>\n </li>\n )\n })}\n <li className=\"pt-1 text-xs text-muted-foreground\">{t('gettingStarted.settings.minimums.description')}</li>\n </ul>\n )}\n\n {canContract && !effective.wantsContractAt && (\n <form\n onSubmit={(e) => { e.preventDefault(); void handleContract() }}\n className=\"mt-4 flex flex-wrap items-center gap-2\"\n >\n <Input\n value={note}\n onChange={(e) => setNote(e.target.value)}\n placeholder={t('gettingStarted.settings.contract.note')}\n maxLength={500}\n className=\"w-full sm:w-72\"\n />\n <Button type=\"submit\" size=\"sm\" variant={phase === 'setup' ? 'outline' : 'default'} disabled={busy || !allowed} {...markProps}>\n {busy ? t('gettingStarted.banner.sending') : t('gettingStarted.banner.contract')}\n </Button>\n </form>\n )}\n {canContract && effective.wantsContractAt && !notice && (\n <p className=\"mt-3 flex items-center gap-2 text-sm text-muted-foreground\">\n <Check className=\"h-4 w-4 text-success\" aria-hidden=\"true\" />\n {t('gettingStarted.settings.contract.done')}\n </p>\n )}\n\n {notice && <p role=\"alert\" className=\"mt-3 text-xs text-foreground\">{notice}</p>}\n\n <ConfirmDialog\n open={confirmOpen}\n title={t('gettingStarted.confirm.title', { days: trialDays })}\n description={t('gettingStarted.confirm.body', { date: formatTrialDate(new Date(Date.now() + trialDays * DAY_MS).toISOString()) })}\n confirmLabel={starting ? t('gettingStarted.confirm.starting') : t('gettingStarted.confirm.ok')}\n cancelLabel={t('gettingStarted.confirm.cancel')}\n loading={starting}\n onConfirm={() => { void handleStart() }}\n onCancel={() => setConfirmOpen(false)}\n />\n </div>\n )\n}\n\nexport type { Journey }\n","export const en: Record<string, string> = {\n 'gettingStarted.name': 'Getting started',\n 'gettingStarted.settings.tab': 'Free trial',\n\n 'gettingStarted.cta.title': 'Your store, live',\n 'gettingStarted.cta.remaining.one': '1 step left before the trial',\n 'gettingStarted.cta.remaining.many': '{{count}} steps left before the trial',\n 'gettingStarted.cta.ready': 'Start trial · {{days}} days',\n 'gettingStarted.cta.ring': 'Your store, live: {{done}} of {{total}} store steps',\n 'gettingStarted.cta.openList': 'Open the list of steps',\n 'gettingStarted.cta.minimize': 'Minimize',\n 'gettingStarted.cta.expand': 'Show the store progress',\n 'gettingStarted.cta.sheet.minimums': 'To start the trial',\n 'gettingStarted.cta.sheet.later': 'Whenever you want',\n 'gettingStarted.cta.sheet.review': 'Review',\n 'gettingStarted.cta.sheet.configure': 'Set up',\n 'gettingStarted.cta.sheet.done': 'done',\n 'gettingStarted.cta.sheet.open': 'to do',\n 'gettingStarted.cta.sheet.now': 'now',\n\n 'gettingStarted.confirm.title': 'Start the {{days}}-day trial?',\n 'gettingStarted.confirm.body': 'From now on the clock runs: until {{date}}. Everything unlocked, no card. It cannot be paused.',\n 'gettingStarted.confirm.cancel': 'Not yet',\n 'gettingStarted.confirm.ok': 'Start trial',\n 'gettingStarted.confirm.starting': 'Starting…',\n\n 'gettingStarted.start.done': 'Trial started. Everything is unlocked until {{date}}.',\n 'gettingStarted.start.error': 'Could not start. Nothing changed — try again.',\n 'gettingStarted.start.missing': 'Still missing {{what}} to start. The list is up to date.',\n 'gettingStarted.start.missingLabel': 'Missing: {{what}}',\n 'gettingStarted.action.missing': 'Still missing {{what}} to start the trial.',\n 'gettingStarted.start.refused.no_trial_window': 'This account has no trial window to start. Contact support.',\n 'gettingStarted.start.refused.already_converted': 'This account is already a subscriber — the trial does not apply.',\n 'gettingStarted.start.refused.already_paid': 'This account is already on a paid plan — the trial does not apply.',\n\n 'gettingStarted.minimum.menu': 'a menu with at least one product',\n 'gettingStarted.minimum.hours': 'opening hours',\n 'gettingStarted.minimum.testOrder': 'a test order',\n 'gettingStarted.minimum.join': ' and ',\n\n 'gettingStarted.banner.region': 'End of the trial period',\n 'gettingStarted.banner.title': 'Your trial ended on {{date}}. The store and your data stay; what belongs to the Pro plan is locked.',\n 'gettingStarted.banner.seeChanges': 'See what changes',\n 'gettingStarted.banner.contract': 'I want to subscribe',\n 'gettingStarted.banner.phonePrompt': 'Someone from Faya calls you today. Confirm your WhatsApp:',\n 'gettingStarted.banner.phoneLabel': 'WhatsApp for contact',\n 'gettingStarted.banner.confirm': 'Confirm',\n 'gettingStarted.banner.sending': 'Sending…',\n 'gettingStarted.banner.back': 'Back',\n 'gettingStarted.banner.done': 'Deal. We call you within 1 business day. Meanwhile, nothing is lost.',\n 'gettingStarted.banner.error': 'Could not register it. Try again.',\n 'gettingStarted.banner.rateLimited': 'We already got your request today. We will call you.',\n\n 'gettingStarted.settings.phase.setup': 'Setting up',\n 'gettingStarted.settings.phase.setup.line.one': '1 step left to start the trial',\n 'gettingStarted.settings.phase.setup.line.many': '{{count}} steps left to start the trial',\n 'gettingStarted.settings.phase.setup.ready': 'Ready to start the trial',\n 'gettingStarted.settings.phase.setup.deadline': 'If you do not start by {{date}}, the trial starts on its own.',\n 'gettingStarted.settings.phase.trial': 'On trial',\n 'gettingStarted.settings.phase.trial.line': 'Everything unlocked until {{date}}.',\n 'gettingStarted.settings.phase.expired': 'Your trial ended',\n 'gettingStarted.settings.phase.expired.line': 'Ended on {{date}}. The store and your data stay.',\n 'gettingStarted.settings.phase.converted': 'Plan active',\n 'gettingStarted.settings.phase.converted.line': 'Thank you for staying with us.',\n 'gettingStarted.settings.loading': 'Loading your journey…',\n 'gettingStarted.settings.loadError': 'Could not load your journey. Try again.',\n 'gettingStarted.settings.retry': 'Try again',\n 'gettingStarted.settings.plans': 'See plans',\n 'gettingStarted.settings.contract.note': 'Anything you want to tell us? (optional)',\n 'gettingStarted.settings.contract.done': 'Deal. We call you within 1 business day.',\n\n 'gettingStarted.settings.minimums.title': 'To start the trial',\n 'gettingStarted.settings.minimums.description': 'Bank, WhatsApp and printer block nothing — they wait for whenever you want.',\n 'gettingStarted.settings.minimums.menu': 'A menu with at least one product',\n 'gettingStarted.settings.minimums.hours': 'Opening hours',\n 'gettingStarted.settings.minimums.testOrder': 'A test order',\n 'gettingStarted.settings.minimums.done': 'done',\n 'gettingStarted.settings.minimums.pending': 'to do',\n\n 'gettingStarted.settings.hours.title': 'Opening hours',\n 'gettingStarted.settings.hours.description': 'When the store opens and closes. The digital menu shows open/closed from them.',\n 'gettingStarted.settings.hours.template.weekdays': 'Mon–Sat, 11am to 11pm',\n 'gettingStarted.settings.hours.template.everyday': 'Every day, 11am to 11pm',\n 'gettingStarted.settings.hours.template.weekend': 'Weekends only, 11am to 11pm',\n\n 'gettingStarted.settings.day.mon': 'Monday',\n 'gettingStarted.settings.day.tue': 'Tuesday',\n 'gettingStarted.settings.day.wed': 'Wednesday',\n 'gettingStarted.settings.day.thu': 'Thursday',\n 'gettingStarted.settings.day.fri': 'Friday',\n 'gettingStarted.settings.day.sat': 'Saturday',\n 'gettingStarted.settings.day.sun': 'Sunday',\n\n 'gettingStarted.settings.payments.title': 'Payment methods',\n 'gettingStarted.settings.payments.description': 'What the store accepts at the counter and on delivery. Card terminal and integrated Pix live in Connectors, whenever you want.',\n 'gettingStarted.settings.payments.pix': 'Pix',\n 'gettingStarted.settings.payments.cash': 'Cash',\n 'gettingStarted.settings.payments.card': 'Card on the terminal',\n 'gettingStarted.settings.payments.meal-voucher': 'Meal voucher',\n 'gettingStarted.settings.payments.online': 'Online payment',\n\n 'gettingStarted.settings.saving': 'Saving…',\n 'gettingStarted.settings.saved': 'Saved',\n 'gettingStarted.settings.saveError': 'Could not save: {{message}}',\n 'gettingStarted.settings.offline': 'No database connection: what you change here is not saved.',\n\n 'gettingStarted.card.title': 'Your store, live',\n 'gettingStarted.card.steps': 'steps',\n 'gettingStarted.card.aria': 'Your store, live: {{done}} of {{total}} steps done',\n 'gettingStarted.card.subtitle.setup.one': '1 step left before the trial',\n 'gettingStarted.card.subtitle.setup.many': '{{count}} steps left before the trial',\n 'gettingStarted.card.subtitle.ready': 'Ready to start the trial',\n 'gettingStarted.card.subtitle.trial': 'On trial until {{date}}',\n 'gettingStarted.card.subtitle.expired': 'Your trial ended on {{date}}',\n 'gettingStarted.card.subtitle.converted': 'Plan active',\n 'gettingStarted.card.group.launch': 'To start the trial',\n 'gettingStarted.card.group.later': 'Whenever you want',\n 'gettingStarted.card.optional': 'optional',\n 'gettingStarted.card.withAssistant': 'Do it with the assistant',\n 'gettingStarted.card.noClock': 'The server has no trial clock yet; progress here is computed on the spot.',\n\n 'gettingStarted.start.noClock': 'The server has no trial clock yet; tell support.',\n 'gettingStarted.settings.phase.setup.offline': 'No trial clock on the server: phase and steps are computed here. Tell support.',\n\n 'gettingStarted.d0.region': 'Last day of the trial',\n 'gettingStarted.d0.title': 'Last day of the trial — it ends today at {{time}}. After that the Pro plan locks; your data stays.',\n 'gettingStarted.d0.subscribe': 'Subscribe',\n 'gettingStarted.d0.seeChanges': 'See what changes',\n 'gettingStarted.d0.dismiss': 'Dismiss for today',\n\n // The assistant's cards and trace: chat.tool.<name> is the title, chat.field.<tool>.<param> the field label.\n 'chat.tool.readTrialJourney': 'See the store setup',\n 'chat.tool.proposeStoreHours': 'Draft opening hours',\n 'chat.tool.saveStoreHours': 'Save opening hours',\n 'chat.tool.savePaymentMethods': 'Save payment methods',\n 'chat.tool.saveStoreProfile': 'Save store profile',\n 'chat.tool.startTrial': 'Start the free trial',\n 'chat.tool.requestContract': 'Ask to subscribe',\n 'chat.tool.exploreWithDemoData': 'Create a sample menu',\n 'chat.field.saveStoreHours.week': 'Days',\n 'chat.field.saveStoreHours.summary': 'Summary',\n 'chat.field.saveStoreHours.template': 'Template',\n 'chat.field.savePaymentMethods.methods': 'Methods',\n 'chat.field.savePaymentMethods.summary': 'Summary',\n 'chat.field.saveStoreProfile.serviceModes': 'Service modes',\n 'chat.field.saveStoreProfile.tables': 'Tables',\n 'chat.field.saveStoreProfile.marketplaceApps': 'Delivery apps',\n 'chat.field.saveStoreProfile.deliveryMethod': 'Delivery pricing',\n 'chat.field.saveStoreProfile.operation': 'Kind of place',\n 'chat.field.saveStoreProfile.welcomeArticle': 'Article',\n 'chat.field.saveStoreProfile.summary': 'Summary',\n 'chat.field.requestContract.note': 'Note',\n}\n","export const ptBR: Record<string, string> = {\n 'gettingStarted.name': 'Primeiros passos',\n 'gettingStarted.settings.tab': 'Teste grátis',\n\n 'gettingStarted.cta.title': 'Sua loja no ar',\n 'gettingStarted.cta.remaining.one': 'Falta 1 passo para o teste',\n 'gettingStarted.cta.remaining.many': 'Faltam {{count}} passos para o teste',\n 'gettingStarted.cta.ready': 'Iniciar teste · {{days}} dias',\n 'gettingStarted.cta.ring': 'Sua loja no ar: {{done}} de {{total}} passos da loja',\n 'gettingStarted.cta.openList': 'Abrir a lista de passos',\n 'gettingStarted.cta.minimize': 'Minimizar',\n 'gettingStarted.cta.expand': 'Mostrar o progresso da loja',\n 'gettingStarted.cta.sheet.minimums': 'Para iniciar o teste',\n 'gettingStarted.cta.sheet.later': 'Quando quiser',\n 'gettingStarted.cta.sheet.review': 'Revisar',\n 'gettingStarted.cta.sheet.configure': 'Configurar',\n 'gettingStarted.cta.sheet.done': 'feito',\n 'gettingStarted.cta.sheet.open': 'a fazer',\n 'gettingStarted.cta.sheet.now': 'agora',\n\n 'gettingStarted.confirm.title': 'Começar os {{days}} dias de teste?',\n 'gettingStarted.confirm.body': 'A partir de agora o prazo corre: até {{date}}. Tudo liberado, sem cartão. Não dá para pausar.',\n 'gettingStarted.confirm.cancel': 'Ainda não',\n 'gettingStarted.confirm.ok': 'Iniciar teste',\n 'gettingStarted.confirm.starting': 'Iniciando…',\n\n 'gettingStarted.start.done': 'Teste iniciado. Até {{date}} você tem tudo liberado.',\n 'gettingStarted.start.error': 'Não consegui iniciar. Nada mudou — tenta de novo.',\n 'gettingStarted.start.missing': 'Falta {{what}} para iniciar. Já atualizei a lista.',\n 'gettingStarted.start.missingLabel': 'Falta: {{what}}',\n 'gettingStarted.action.missing': 'Falta {{what}} para iniciar o teste.',\n 'gettingStarted.start.refused.no_trial_window': 'Esta conta não tem período de teste para iniciar. Fale com o suporte.',\n 'gettingStarted.start.refused.already_converted': 'Esta conta já é assinante — o teste não se aplica.',\n 'gettingStarted.start.refused.already_paid': 'Esta conta já está num plano pago — o teste não se aplica.',\n\n 'gettingStarted.minimum.menu': 'cardápio com ao menos um produto',\n 'gettingStarted.minimum.hours': 'horário de funcionamento',\n 'gettingStarted.minimum.testOrder': 'um pedido de teste',\n 'gettingStarted.minimum.join': ' e ',\n\n 'gettingStarted.banner.region': 'Fim do período de teste',\n 'gettingStarted.banner.title': 'Seu teste terminou em {{date}}. A loja e seus dados continuam; o que é do plano Pro ficou com cadeado.',\n 'gettingStarted.banner.seeChanges': 'Ver o que muda',\n 'gettingStarted.banner.contract': 'Quero contratar',\n 'gettingStarted.banner.phonePrompt': 'Alguém da Faya te chama hoje. Confirma o WhatsApp:',\n 'gettingStarted.banner.phoneLabel': 'WhatsApp para contato',\n 'gettingStarted.banner.confirm': 'Confirmar',\n 'gettingStarted.banner.sending': 'Enviando…',\n 'gettingStarted.banner.back': 'Voltar',\n 'gettingStarted.banner.done': 'Combinado. A gente te chama em até 1 dia útil. Enquanto isso, nada se perde.',\n 'gettingStarted.banner.error': 'Não consegui registrar. Tenta de novo.',\n 'gettingStarted.banner.rateLimited': 'Já recebemos seu pedido hoje. A gente te chama.',\n\n 'gettingStarted.settings.phase.setup': 'Em configuração',\n 'gettingStarted.settings.phase.setup.line.one': 'Falta 1 passo para iniciar o teste',\n 'gettingStarted.settings.phase.setup.line.many': 'Faltam {{count}} passos para iniciar o teste',\n 'gettingStarted.settings.phase.setup.ready': 'Pronto para iniciar o teste',\n 'gettingStarted.settings.phase.setup.deadline': 'Se não iniciar até {{date}}, o teste começa sozinho.',\n 'gettingStarted.settings.phase.trial': 'Em teste',\n 'gettingStarted.settings.phase.trial.line': 'Tudo liberado até {{date}}.',\n 'gettingStarted.settings.phase.expired': 'Seu teste terminou',\n 'gettingStarted.settings.phase.expired.line': 'Terminou em {{date}}. A loja e seus dados continuam.',\n 'gettingStarted.settings.phase.converted': 'Plano ativo',\n 'gettingStarted.settings.phase.converted.line': 'Obrigado por ficar com a gente.',\n 'gettingStarted.settings.loading': 'Carregando a sua jornada…',\n 'gettingStarted.settings.loadError': 'Não consegui carregar a sua jornada. Tenta de novo.',\n 'gettingStarted.settings.retry': 'Tentar de novo',\n 'gettingStarted.settings.plans': 'Ver planos',\n 'gettingStarted.settings.contract.note': 'Quer dizer algo para a gente? (opcional)',\n 'gettingStarted.settings.contract.done': 'Combinado. A gente te chama em até 1 dia útil.',\n\n 'gettingStarted.settings.minimums.title': 'Para iniciar o teste',\n 'gettingStarted.settings.minimums.description': 'Banco, WhatsApp e impressora não travam nada — ficam para quando quiser.',\n 'gettingStarted.settings.minimums.menu': 'Cardápio com ao menos um produto',\n 'gettingStarted.settings.minimums.hours': 'Horário de funcionamento',\n 'gettingStarted.settings.minimums.testOrder': 'Um pedido de teste',\n 'gettingStarted.settings.minimums.done': 'feito',\n 'gettingStarted.settings.minimums.pending': 'a fazer',\n\n 'gettingStarted.settings.hours.title': 'Horários',\n 'gettingStarted.settings.hours.description': 'Quando a casa abre e fecha. O cardápio digital mostra aberto/fechado por eles.',\n 'gettingStarted.settings.hours.template.weekdays': 'Seg–sáb, 11h às 23h',\n 'gettingStarted.settings.hours.template.everyday': 'Todos os dias, 11h às 23h',\n 'gettingStarted.settings.hours.template.weekend': 'Só fim de semana, 11h às 23h',\n\n 'gettingStarted.settings.day.mon': 'Segunda',\n 'gettingStarted.settings.day.tue': 'Terça',\n 'gettingStarted.settings.day.wed': 'Quarta',\n 'gettingStarted.settings.day.thu': 'Quinta',\n 'gettingStarted.settings.day.fri': 'Sexta',\n 'gettingStarted.settings.day.sat': 'Sábado',\n 'gettingStarted.settings.day.sun': 'Domingo',\n\n 'gettingStarted.settings.payments.title': 'Formas de pagamento',\n 'gettingStarted.settings.payments.description': 'O que a casa aceita no balcão e na entrega. Maquininha e Pix integrados ficam em Conectores, quando quiser.',\n 'gettingStarted.settings.payments.pix': 'Pix',\n 'gettingStarted.settings.payments.cash': 'Dinheiro',\n 'gettingStarted.settings.payments.card': 'Cartão na maquininha',\n 'gettingStarted.settings.payments.meal-voucher': 'Vale-refeição',\n 'gettingStarted.settings.payments.online': 'Pagamento online',\n\n 'gettingStarted.settings.saving': 'Salvando…',\n 'gettingStarted.settings.saved': 'Salvo',\n 'gettingStarted.settings.saveError': 'Não consegui salvar: {{message}}',\n 'gettingStarted.settings.offline': 'Sem conexão com o banco: o que você mudar aqui não fica gravado.',\n\n 'gettingStarted.card.title': 'Sua loja no ar',\n 'gettingStarted.card.steps': 'passos',\n 'gettingStarted.card.aria': 'Sua loja no ar, {{done}} de {{total}} passos feitos',\n 'gettingStarted.card.subtitle.setup.one': 'Falta 1 passo para iniciar o teste',\n 'gettingStarted.card.subtitle.setup.many': 'Faltam {{count}} passos para iniciar o teste',\n 'gettingStarted.card.subtitle.ready': 'Pronto para iniciar o teste',\n 'gettingStarted.card.subtitle.trial': 'Em teste até {{date}}',\n 'gettingStarted.card.subtitle.expired': 'Seu teste terminou em {{date}}',\n 'gettingStarted.card.subtitle.converted': 'Plano ativo',\n 'gettingStarted.card.group.launch': 'Para iniciar o teste',\n 'gettingStarted.card.group.later': 'Quando quiser',\n 'gettingStarted.card.optional': 'opcional',\n 'gettingStarted.card.withAssistant': 'Fazer com o assistente',\n 'gettingStarted.card.noClock': 'O servidor ainda não tem o relógio do teste; o progresso aqui é calculado na hora.',\n\n 'gettingStarted.start.noClock': 'O servidor ainda não tem o relógio do teste; avise o suporte.',\n 'gettingStarted.settings.phase.setup.offline': 'Sem o relógio do teste no servidor: fase e passos calculados aqui. Avise o suporte.',\n\n 'gettingStarted.d0.region': 'Último dia do teste',\n 'gettingStarted.d0.title': 'Último dia do teste — termina hoje às {{time}}. Depois, o que é do plano Pro fica com cadeado; seus dados ficam.',\n 'gettingStarted.d0.subscribe': 'Assinar',\n 'gettingStarted.d0.seeChanges': 'Ver o que muda',\n 'gettingStarted.d0.dismiss': 'Dispensar por hoje',\n\n // The assistant's cards and trace: chat.tool.<name> is the title, chat.field.<tool>.<param> the field label.\n 'chat.tool.readTrialJourney': 'Ver a configuração da loja',\n 'chat.tool.proposeStoreHours': 'Montar horário de funcionamento',\n 'chat.tool.saveStoreHours': 'Gravar horário de funcionamento',\n 'chat.tool.savePaymentMethods': 'Gravar formas de pagamento',\n 'chat.tool.saveStoreProfile': 'Gravar perfil da casa',\n 'chat.tool.startTrial': 'Iniciar o teste grátis',\n 'chat.tool.requestContract': 'Pedir para contratar',\n 'chat.tool.exploreWithDemoData': 'Criar cardápio de exemplo',\n 'chat.field.saveStoreHours.week': 'Dias',\n 'chat.field.saveStoreHours.summary': 'Resumo',\n 'chat.field.saveStoreHours.template': 'Modelo',\n 'chat.field.savePaymentMethods.methods': 'Formas',\n 'chat.field.savePaymentMethods.summary': 'Resumo',\n 'chat.field.saveStoreProfile.serviceModes': 'Como atende',\n 'chat.field.saveStoreProfile.tables': 'Mesas',\n 'chat.field.saveStoreProfile.marketplaceApps': 'Apps de entrega',\n 'chat.field.saveStoreProfile.deliveryMethod': 'Cobrança da entrega',\n 'chat.field.saveStoreProfile.operation': 'Tipo de casa',\n 'chat.field.saveStoreProfile.welcomeArticle': 'Artigo',\n 'chat.field.saveStoreProfile.summary': 'Resumo',\n 'chat.field.requestContract.note': 'Observação',\n}\n","import { en } from './en'\nimport { ptBR } from './pt-BR'\n\nexport const gettingStartedLocales: Record<string, Record<string, string>> = {\n en,\n 'pt-BR': ptBR,\n}\n"]}
|