@fayz-ai/plugin-getting-started 0.0.0-stage → 0.2.0-canary.20261027164140
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/LICENSE +21 -0
- package/dist/chunk-QAYRR3A4.js +2964 -0
- package/dist/chunk-QAYRR3A4.js.map +1 -0
- package/dist/components/ProgressRing.d.ts +16 -0
- package/dist/components/ProgressRing.d.ts.map +1 -0
- package/dist/components/StartTrialAction.d.ts +70 -0
- package/dist/components/StartTrialAction.d.ts.map +1 -0
- package/dist/components/StartTrialCta.d.ts +12 -0
- package/dist/components/StartTrialCta.d.ts.map +1 -0
- package/dist/components/StoreLiveCard.d.ts +21 -0
- package/dist/components/StoreLiveCard.d.ts.map +1 -0
- package/dist/components/TrialEndBanner.d.ts +12 -0
- package/dist/components/TrialEndBanner.d.ts.map +1 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/context.d.ts +33 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/mock.d.ts +27 -0
- package/dist/data/mock.d.ts.map +1 -0
- package/dist/data/supabase.d.ts +10 -0
- package/dist/data/supabase.d.ts.map +1 -0
- package/dist/data/tables.d.ts +15 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/types.d.ts +24 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/host.d.ts +93 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +78 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agent-tools.d.ts +143 -0
- package/dist/lib/agent-tools.d.ts.map +1 -0
- package/dist/lib/journey-steps.d.ts +152 -0
- package/dist/lib/journey-steps.d.ts.map +1 -0
- package/dist/lib/program.d.ts +37 -0
- package/dist/lib/program.d.ts.map +1 -0
- package/dist/lib/store-profile.d.ts +75 -0
- package/dist/lib/store-profile.d.ts.map +1 -0
- package/dist/lib/store-settings.d.ts +70 -0
- package/dist/lib/store-settings.d.ts.map +1 -0
- package/dist/lib/tour.d.ts +86 -0
- package/dist/lib/tour.d.ts.map +1 -0
- package/dist/lib/trial-clock.d.ts +14 -0
- package/dist/lib/trial-clock.d.ts.map +1 -0
- package/dist/lib/trial-source-bridge.d.ts +17 -0
- package/dist/lib/trial-source-bridge.d.ts.map +1 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/index.d.ts +2 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/pt-BR.d.ts +2 -0
- package/dist/locales/pt-BR.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +10 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/main.browser.js +11 -0
- package/dist/migrations/main.browser.js.map +1 -0
- package/dist/migrations/main.js +992 -0
- package/dist/migrations/main.js.map +1 -0
- package/dist/settings/TrialSettingsTab.d.ts +23 -0
- package/dist/settings/TrialSettingsTab.d.ts.map +1 -0
- package/dist/store.d.ts +23 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +74 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type PluginManifest } from '@fayz-ai/core';
|
|
2
|
+
import { type GettingStartedPluginOptions } from './config';
|
|
3
|
+
export declare const STORE_LIVE_WIDGET_ID = "getting-started.store-live";
|
|
4
|
+
export declare const STORE_LIVE_RAIL_WIDGET_ID = "getting-started.store-live.rail";
|
|
5
|
+
export declare function createGettingStartedPlugin(options?: GettingStartedPluginOptions): PluginManifest;
|
|
6
|
+
export type { GettingStartedPluginOptions, ResolvedGettingStartedConfig, JourneyOverride, GettingStartedRoutes } from './config';
|
|
7
|
+
export { getActiveConfig, noteTrialDaysDivergence, resolveConfig, resolveRoutes, DEFAULT_ROUTES } from './config';
|
|
8
|
+
export type { Journey, JourneyPhase, JourneyMinimums, JourneyEvent, StartTrialResult, RequestContractResult, StoreHours, HoursRange, Weekday, PaymentMethod, } from './types';
|
|
9
|
+
export { MINIMUM_IDS, PAYMENT_METHODS, WEEKDAYS, type MinimumId } from './types';
|
|
10
|
+
export { T, RPC, GettingStartedError, isForbidden, isMissingClock, createSupabaseGettingStartedProvider, createMockGettingStartedProvider, derivePhase, type GettingStartedDataProvider, type MockGettingStartedOptions, type MockGettingStartedProvider, } from './data';
|
|
11
|
+
export { buildStoreLiveProgram, withoutStoreProfileStep, hasOpeningHours, hasPaymentMethods, PROGRAM_ID as STORE_LIVE_PROGRAM_ID, type BuildStoreLiveProgramInput, } from './lib/program';
|
|
12
|
+
export { journeyTour, buildOwnJourneyTour, buildJourneyTour, buildJourneyClosingStop, JOURNEY_TOUR_ID } from './lib/tour';
|
|
13
|
+
export { STORE_PROFILE_STEP_KEY, configureStoreProfile, getStoreProfileProvider, businessProfileStoreProfileProvider, storeProfileFrom, storeProfileFromAnswers, storeProfileToAnswers, storeProfileAnswered, type StoreProfile, type StoreProfileProvider, type SaveStoreProfileWriteResult, type StoreOperation, type StoreServiceMode, type StoreDeliveryMethod, type StoreTableBand, } from './lib/store-profile';
|
|
14
|
+
export { gettingStartedAiTools } from './lib/agent-tools';
|
|
15
|
+
export { toTrialSource, formatTrialDate } from './lib/trial-source-bridge';
|
|
16
|
+
export { useJourneyStore, type JourneyState } from './store';
|
|
17
|
+
export { StartTrialCta } from './components/StartTrialCta';
|
|
18
|
+
export { StartTrialAction, useStartTrial, type StartTrialActionProps, type StartTrialState, type StartTrialMissing, } from './components/StartTrialAction';
|
|
19
|
+
export { TrialEndBanner } from './components/TrialEndBanner';
|
|
20
|
+
export { StoreLiveCard, type StoreLiveCardProps } from './components/StoreLiveCard';
|
|
21
|
+
export { ProgressRing } from './components/ProgressRing';
|
|
22
|
+
export { SENSOR_RULED_KEYS, declareJourney, currentJourney, useJourneyDeclaration, minimumSlotOf, minimumLines, rowDone, selectJourneySteps, toStepInputs, countJourney, countMinimums, clientJourney, nowStepKey, type JourneyDeclaration, type JourneySelection, type MinimumLine, type MinimumsCount, type CatalogStepLike, type ActivationRowLike, } from './lib/journey-steps';
|
|
23
|
+
export { trialEndsToday, formatEndTime } from './lib/trial-clock';
|
|
24
|
+
export { readStoreSettings, saveStoreSetting, loadStoreSettings, STORE_SETTINGS_SAVED_EVENT, configureStoreSettings, getStoreSettingsProvider, supabaseStoreSettingsProvider, type StoreSettingsProvider, type StoreSettingKey, type SaveStoreSettingResult, type SaveStoreSettingVia, } from './lib/store-settings';
|
|
25
|
+
export { TrialSettingsTab } from './settings/TrialSettingsTab';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAInH,OAAO,EAAkC,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAA;AAgB3F,eAAO,MAAM,oBAAoB,+BAA+B,CAAA;AAChE,eAAO,MAAM,yBAAyB,oCAAoC,CAAA;AAM1E,wBAAgB,0BAA0B,CAAC,OAAO,CAAC,EAAE,2BAA2B,GAAG,cAAc,CAsHhG;AAED,YAAY,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAChI,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACjH,YAAY,EACV,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAC7F,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAC/C,MAAM,S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6BAA6B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EACL,iBAAiB,EACjB,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAC3F,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EACxF,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EACpF,KAAK,eAAe,EAAE,KAAK,iBAAiB,GAC7C,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EACL,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,0BAA0B,EAClF,sBAAsB,EAAE,wBAAwB,EAAE,6BAA6B,EAC/E,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,KAAK,mBAAmB,GACxG,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { resolveConfig, setActiveConfig, setJourneyOverride, gettingStartedLocales, createSupabaseGettingStartedProvider, createMockGettingStartedProvider, useJourneyStore, registerGettingStartedToolHandlers, withGettingStartedContext, withJourneyDeclaration, StartTrialCta, TrialEndBanner, TrialSettingsTab, StoreLiveCard, gettingStartedAiTools, buildOwnJourneyTour, buildStoreLiveProgram } from './chunk-QAYRR3A4.js';
|
|
2
|
+
export { DEFAULT_ROUTES, GettingStartedError, JOURNEY_TOUR_ID, MINIMUM_IDS, PAYMENT_METHOD_IDS as PAYMENT_METHODS, ProgressRing, RPC, SENSOR_RULED_KEYS, PROGRAM_ID as STORE_LIVE_PROGRAM_ID, STORE_PROFILE_STEP_KEY, STORE_SETTINGS_SAVED_EVENT, StartTrialAction, StartTrialCta, StoreLiveCard, T, TrialEndBanner, TrialSettingsTab, WEEKDAYS, buildJourneyClosingStop, buildJourneyTour, buildOwnJourneyTour, buildStoreLiveProgram, businessProfileStoreProfileProvider, clientJourney, configureStoreProfile, configureStoreSettings, countJourney, countMinimums, createMockGettingStartedProvider, createSupabaseGettingStartedProvider, currentJourney, declareJourney, derivePhase, formatEndTime, formatTrialDate, getActiveConfig, getStoreProfileProvider, getStoreSettingsProvider, gettingStartedAiTools, hasOpeningHours, hasPaymentMethods, isForbidden, isMissingClock, journeyTour, loadStoreSettings, minimumLines, minimumSlotOf, noteTrialDaysDivergence, nowStepKey, readStoreSettings, resolveConfig, resolveRoutes, rowDone, saveStoreSetting, selectJourneySteps, storeProfileAnswered, storeProfileFrom, storeProfileFromAnswers, storeProfileToAnswers, supabaseStoreSettingsProvider, toStepInputs, toTrialSource, trialEndsToday, useJourneyDeclaration, useJourneyStore, useStartTrial, withoutStoreProfileStep } from './chunk-QAYRR3A4.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { registerTranslations, createSafeDataProvider, definePlugin, tl } from '@fayz-ai/core';
|
|
5
|
+
import { defineOnboardingWidget } from '@fayz-ai/ui';
|
|
6
|
+
import { ASSISTANT_TASKS_TOP_ZONE } from '@fayz-ai/admin/host';
|
|
7
|
+
import { MIGRATIONS } from '#migrations/main';
|
|
8
|
+
|
|
9
|
+
var VERSION = "0.1.0";
|
|
10
|
+
var STORE_LIVE_WIDGET_ID = "getting-started.store-live";
|
|
11
|
+
var STORE_LIVE_RAIL_WIDGET_ID = "getting-started.store-live.rail";
|
|
12
|
+
function StoreLiveRail() {
|
|
13
|
+
return React.createElement(StoreLiveCard, { variant: "rail" });
|
|
14
|
+
}
|
|
15
|
+
function createGettingStartedPlugin(options) {
|
|
16
|
+
const config = resolveConfig(options);
|
|
17
|
+
setActiveConfig(config);
|
|
18
|
+
setJourneyOverride(config.journey);
|
|
19
|
+
registerTranslations(gettingStartedLocales);
|
|
20
|
+
const provider = options?.dataProvider ?? createSafeDataProvider(
|
|
21
|
+
() => createSupabaseGettingStartedProvider(),
|
|
22
|
+
() => createMockGettingStartedProvider()
|
|
23
|
+
);
|
|
24
|
+
useJourneyStore.getState().bind(provider);
|
|
25
|
+
registerGettingStartedToolHandlers(useJourneyStore);
|
|
26
|
+
const scope = { config, provider };
|
|
27
|
+
const Cta = withGettingStartedContext(withJourneyDeclaration(StartTrialCta), scope);
|
|
28
|
+
const Banner = withGettingStartedContext(withJourneyDeclaration(TrialEndBanner), scope);
|
|
29
|
+
const Settings = withGettingStartedContext(withJourneyDeclaration(TrialSettingsTab), scope);
|
|
30
|
+
const Card = withGettingStartedContext(withJourneyDeclaration(StoreLiveCard), scope);
|
|
31
|
+
const RailCard = withGettingStartedContext(withJourneyDeclaration(StoreLiveRail), scope);
|
|
32
|
+
return definePlugin({
|
|
33
|
+
id: "getting-started",
|
|
34
|
+
name: tl("Getting started", "Primeiros passos"),
|
|
35
|
+
icon: "Rocket",
|
|
36
|
+
version: VERSION,
|
|
37
|
+
scope: "core",
|
|
38
|
+
defaultEnabled: true,
|
|
39
|
+
// The shell switches this on for every new food workspace (see
|
|
40
|
+
// `ensureDefaultModules`); it does not know this plugin's id.
|
|
41
|
+
installOn: { verticals: ["food"] },
|
|
42
|
+
defaultAgentRole: "setup",
|
|
43
|
+
navigation: [],
|
|
44
|
+
routes: [],
|
|
45
|
+
migrations: MIGRATIONS.map((m) => ({
|
|
46
|
+
id: `getting-started-${m.id}`,
|
|
47
|
+
version: VERSION,
|
|
48
|
+
sql: m.sql,
|
|
49
|
+
description: `plugin-getting-started ${m.id}`
|
|
50
|
+
})),
|
|
51
|
+
onboarding: { program: buildStoreLiveProgram({ provider, config }), tour: buildOwnJourneyTour(config.routes) },
|
|
52
|
+
widgets: [
|
|
53
|
+
// Rail slot only to be mounted; the pill is a portal (decision 11). Publishes the journey to setTrialSource (decision 10).
|
|
54
|
+
{ id: "getting-started.start-trial-cta", zone: "shell.sidebar.footer", component: Cta, order: 0 },
|
|
55
|
+
{ id: "getting-started.trial-end-banner", zone: "shell.topbar.start", component: Banner, order: 0 },
|
|
56
|
+
// The same card at the top of the assistant's Tarefas tab; the list below drops the steps it claims.
|
|
57
|
+
{ id: STORE_LIVE_RAIL_WIDGET_ID, zone: ASSISTANT_TASKS_TOP_ZONE, component: RailCard, order: 0 }
|
|
58
|
+
],
|
|
59
|
+
// The journey as a dashboard card (UX spec moment 3): the nine steps, the
|
|
60
|
+
// n/9 ring, one "AGORA". An app mounts it in place of its generic checklist.
|
|
61
|
+
dashboardWidgets: [
|
|
62
|
+
defineOnboardingWidget({
|
|
63
|
+
id: STORE_LIVE_WIDGET_ID,
|
|
64
|
+
title: tl("Your store, live", "Sua loja no ar"),
|
|
65
|
+
icon: "Rocket",
|
|
66
|
+
domain: "getting-started",
|
|
67
|
+
span: 2,
|
|
68
|
+
// First thing on the home of a house still setting up: the card is the
|
|
69
|
+
// reason the painel exists until the trial starts. An app that wants it
|
|
70
|
+
// elsewhere overrides the order in its layout.
|
|
71
|
+
defaultOrder: 0,
|
|
72
|
+
surfaces: ["home"],
|
|
73
|
+
component: Card
|
|
74
|
+
})
|
|
75
|
+
],
|
|
76
|
+
aiTools: gettingStartedAiTools,
|
|
77
|
+
events: [
|
|
78
|
+
{ name: "getting_started.trial_started", title: "Teste iniciado", description: "A casa iniciou o teste gr\xE1tis.", audit: true },
|
|
79
|
+
{ name: "getting_started.wants_contract", title: "Quer contratar", description: "A casa pediu para contratar.", audit: true },
|
|
80
|
+
{ name: "getting_started.converted", title: "Convertido", description: "Plano pago aplicado.", audit: true },
|
|
81
|
+
{ name: "getting_started.expired", title: "Teste vencido", description: "Fim do teste sem convers\xE3o." },
|
|
82
|
+
{ name: "getting_started.step_done", title: "Passo conclu\xEDdo", description: "Um passo do checklist fechou." },
|
|
83
|
+
{ name: "getting_started.minimums_ready", title: "M\xEDnimos prontos", description: "Os tr\xEAs m\xEDnimos do teste ficaram verdes." },
|
|
84
|
+
{ name: "getting_started.tour_done", title: "Tour conclu\xEDdo", description: "A casa terminou (ou pulou) o tour da loja." }
|
|
85
|
+
],
|
|
86
|
+
subscribesTo: [
|
|
87
|
+
{ event: "getting_started.trial_started", handler: "plg_getting_started_on_trial_started", description: "Lead no CRM da Faya", maxAttempts: 5 },
|
|
88
|
+
{ event: "getting_started.wants_contract", handler: "plg_getting_started_on_wants_contract", description: "Lead quer contratar", maxAttempts: 5 }
|
|
89
|
+
],
|
|
90
|
+
declaredRpcs: [
|
|
91
|
+
{ name: "agent_getting_started_start_trial", kind: "write", description: "Inicia o teste gr\xE1tis quando os m\xEDnimos est\xE3o prontos.", audits: true },
|
|
92
|
+
{ name: "getting_started_trial_set", kind: "write", description: "Plataforma prorroga, encerra, converte ou lembra o teste de uma casa (operador da plataforma).", audits: true }
|
|
93
|
+
],
|
|
94
|
+
diagnostics: [
|
|
95
|
+
{
|
|
96
|
+
id: "getting-started.rpcs",
|
|
97
|
+
requires: {
|
|
98
|
+
rpcs: [
|
|
99
|
+
"getting_started_journey",
|
|
100
|
+
"getting_started_start_trial",
|
|
101
|
+
"getting_started_request_contract",
|
|
102
|
+
"getting_started_platform_journeys",
|
|
103
|
+
"getting_started_trial_set"
|
|
104
|
+
],
|
|
105
|
+
views: ["v_getting_started_journey"]
|
|
106
|
+
},
|
|
107
|
+
level: "error"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
// `trialDays` has one source in the app (billing.trialDays) and one in
|
|
111
|
+
// the pool (this table). Existence is all a diagnostic can check; the
|
|
112
|
+
// value comparison happens once the journey loads (noteTrialDaysDivergence).
|
|
113
|
+
id: "getting-started.trial-config",
|
|
114
|
+
description: "plg_getting_started_config.trial_days is the trial length the clock runs on.",
|
|
115
|
+
requires: { tables: ["plg_getting_started_config"] },
|
|
116
|
+
level: "warn"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
settings: [
|
|
120
|
+
{
|
|
121
|
+
id: "trial",
|
|
122
|
+
label: tl("Free trial", "Teste gr\xE1tis"),
|
|
123
|
+
icon: "Clock",
|
|
124
|
+
component: Settings,
|
|
125
|
+
order: 90
|
|
126
|
+
// No `permission`: `settings` is not a feature any plugin declares, so
|
|
127
|
+
// the grants-based check denied everybody but the literal owner and
|
|
128
|
+
// the tab vanished from the menu and the search. The shell already
|
|
129
|
+
// gates the settings area; the server gates the write (settings.manage).
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
locales: gettingStartedLocales
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { STORE_LIVE_RAIL_WIDGET_ID, STORE_LIVE_WIDGET_ID, createGettingStartedPlugin };
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAoBA,IAAM,OAAA,GAAU,OAAA;AACT,IAAM,oBAAA,GAAuB;AAC7B,IAAM,yBAAA,GAA4B;AAEzC,SAAS,aAAA,GAAgB;AACvB,EAAA,OAAa,KAAA,CAAA,aAAA,CAAc,aAAA,EAAe,EAAE,OAAA,EAAS,QAAQ,CAAA;AAC/D;AAEO,SAAS,2BAA2B,OAAA,EAAuD;AAChG,EAAA,MAAM,MAAA,GAAS,cAAc,OAAO,CAAA;AACpC,EAAA,eAAA,CAAgB,MAAM,CAAA;AACtB,EAAA,kBAAA,CAAmB,OAAO,OAAO,CAAA;AACjC,EAAA,oBAAA,CAAqB,qBAAqB,CAAA;AAC1C,EAAA,MAAM,QAAA,GAAW,SAAS,YAAA,IAAgB,sBAAA;AAAA,IACxC,MAAM,oCAAA,EAAqC;AAAA,IAC3C,MAAM,gCAAA;AAAiC,GACzC;AACA,EAAA,eAAA,CAAgB,QAAA,EAAS,CAAE,IAAA,CAAK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,8BAAA;AAAA,QACJ,WAAA,EAAa,8EAAA;AAAA,QACb,QAAA,EAAU,EAAE,MAAA,EAAQ,CAAC,4BAA4B,CAAA,EAAE;AAAA,QACnD,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,QAAA,EAAU;AAAA,MACR;AAAA,QACE,EAAA,EAAI,OAAA;AAAA,QACJ,KAAA,EAAO,EAAA,CAAG,YAAA,EAAc,iBAAc,CAAA;AAAA,QACtC,IAAA,EAAM,OAAA;AAAA,QACN,SAAA,EAAW,QAAA;AAAA,QACX,KAAA,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAKT,KACF;AAAA,IACA,OAAA,EAAS;AAAA,GACV,CAAA;AACH","file":"index.js","sourcesContent":["import * as React from 'react'\nimport { createSafeDataProvider, definePlugin, registerTranslations, tl, type PluginManifest } from '@fayz-ai/core'\nimport { defineOnboardingWidget } from '@fayz-ai/ui'\nimport { ASSISTANT_TASKS_TOP_ZONE } from '@fayz-ai/admin/host'\nimport { MIGRATIONS } from './migrations'\nimport { resolveConfig, setActiveConfig, type GettingStartedPluginOptions } from './config'\nimport { withGettingStartedContext, withJourneyDeclaration } from './context'\nimport { setJourneyOverride } from './lib/journey-steps'\nimport { useJourneyStore } from './store'\nimport { createSupabaseGettingStartedProvider } from './data/supabase'\nimport { createMockGettingStartedProvider } from './data/mock'\nimport { buildStoreLiveProgram } from './lib/program'\nimport { buildOwnJourneyTour } from './lib/tour'\nimport { gettingStartedAiTools, registerGettingStartedToolHandlers } from './lib/agent-tools'\nimport { StartTrialCta } from './components/StartTrialCta'\nimport { TrialEndBanner } from './components/TrialEndBanner'\nimport { StoreLiveCard } from './components/StoreLiveCard'\nimport { TrialSettingsTab } from './settings/TrialSettingsTab'\nimport { gettingStartedLocales } from './locales'\n\nconst VERSION = '0.1.0'\nexport const STORE_LIVE_WIDGET_ID = 'getting-started.store-live'\nexport const STORE_LIVE_RAIL_WIDGET_ID = 'getting-started.store-live.rail'\n\nfunction StoreLiveRail() {\n return React.createElement(StoreLiveCard, { variant: 'rail' })\n}\n\nexport function createGettingStartedPlugin(options?: GettingStartedPluginOptions): PluginManifest {\n const config = resolveConfig(options)\n setActiveConfig(config)\n setJourneyOverride(config.journey)\n registerTranslations(gettingStartedLocales)\n const provider = options?.dataProvider ?? createSafeDataProvider(\n () => createSupabaseGettingStartedProvider(),\n () => createMockGettingStartedProvider(),\n )\n useJourneyStore.getState().bind(provider)\n registerGettingStartedToolHandlers(useJourneyStore)\n\n const scope = { config, provider }\n const Cta = withGettingStartedContext(withJourneyDeclaration(StartTrialCta), scope)\n const Banner = withGettingStartedContext(withJourneyDeclaration(TrialEndBanner), scope)\n const Settings = withGettingStartedContext(withJourneyDeclaration(TrialSettingsTab), scope)\n const Card = withGettingStartedContext(withJourneyDeclaration(StoreLiveCard), scope)\n const RailCard = withGettingStartedContext(withJourneyDeclaration(StoreLiveRail), scope)\n\n return definePlugin({\n id: 'getting-started',\n name: tl('Getting started', 'Primeiros passos'),\n icon: 'Rocket',\n version: VERSION,\n scope: 'core',\n defaultEnabled: true,\n // The shell switches this on for every new food workspace (see\n // `ensureDefaultModules`); it does not know this plugin's id.\n installOn: { verticals: ['food'] },\n defaultAgentRole: 'setup',\n navigation: [],\n routes: [],\n migrations: MIGRATIONS.map((m) => ({\n id: `getting-started-${m.id}`,\n version: VERSION,\n sql: m.sql,\n description: `plugin-getting-started ${m.id}`,\n })),\n onboarding: { program: buildStoreLiveProgram({ provider, config }), tour: buildOwnJourneyTour(config.routes) },\n widgets: [\n // Rail slot only to be mounted; the pill is a portal (decision 11). Publishes the journey to setTrialSource (decision 10).\n { id: 'getting-started.start-trial-cta', zone: 'shell.sidebar.footer', component: Cta as React.ComponentType<unknown>, order: 0 },\n { id: 'getting-started.trial-end-banner', zone: 'shell.topbar.start', component: Banner as React.ComponentType<unknown>, order: 0 },\n // The same card at the top of the assistant's Tarefas tab; the list below drops the steps it claims.\n { id: STORE_LIVE_RAIL_WIDGET_ID, zone: ASSISTANT_TASKS_TOP_ZONE, component: RailCard as React.ComponentType<unknown>, order: 0 },\n ],\n // The journey as a dashboard card (UX spec moment 3): the nine steps, the\n // n/9 ring, one \"AGORA\". An app mounts it in place of its generic checklist.\n dashboardWidgets: [\n defineOnboardingWidget({\n id: STORE_LIVE_WIDGET_ID,\n title: tl('Your store, live', 'Sua loja no ar'),\n icon: 'Rocket',\n domain: 'getting-started',\n span: 2,\n // First thing on the home of a house still setting up: the card is the\n // reason the painel exists until the trial starts. An app that wants it\n // elsewhere overrides the order in its layout.\n defaultOrder: 0,\n surfaces: ['home'],\n component: Card as React.ComponentType<unknown>,\n }),\n ],\n aiTools: gettingStartedAiTools,\n events: [\n { name: 'getting_started.trial_started', title: 'Teste iniciado', description: 'A casa iniciou o teste grátis.', audit: true },\n { name: 'getting_started.wants_contract', title: 'Quer contratar', description: 'A casa pediu para contratar.', audit: true },\n { name: 'getting_started.converted', title: 'Convertido', description: 'Plano pago aplicado.', audit: true },\n { name: 'getting_started.expired', title: 'Teste vencido', description: 'Fim do teste sem conversão.' },\n { name: 'getting_started.step_done', title: 'Passo concluído', description: 'Um passo do checklist fechou.' },\n { name: 'getting_started.minimums_ready', title: 'Mínimos prontos', description: 'Os três mínimos do teste ficaram verdes.' },\n { name: 'getting_started.tour_done', title: 'Tour concluído', description: 'A casa terminou (ou pulou) o tour da loja.' },\n ],\n subscribesTo: [\n { event: 'getting_started.trial_started', handler: 'plg_getting_started_on_trial_started', description: 'Lead no CRM da Faya', maxAttempts: 5 },\n { event: 'getting_started.wants_contract', handler: 'plg_getting_started_on_wants_contract', description: 'Lead quer contratar', maxAttempts: 5 },\n ],\n declaredRpcs: [\n { name: 'agent_getting_started_start_trial', kind: 'write', description: 'Inicia o teste grátis quando os mínimos estão prontos.', audits: true },\n { name: 'getting_started_trial_set', kind: 'write', description: 'Plataforma prorroga, encerra, converte ou lembra o teste de uma casa (operador da plataforma).', audits: true },\n ],\n diagnostics: [\n {\n id: 'getting-started.rpcs',\n requires: {\n rpcs: [\n 'getting_started_journey', 'getting_started_start_trial', 'getting_started_request_contract',\n 'getting_started_platform_journeys', 'getting_started_trial_set',\n ],\n views: ['v_getting_started_journey'],\n },\n level: 'error',\n },\n {\n // `trialDays` has one source in the app (billing.trialDays) and one in\n // the pool (this table). Existence is all a diagnostic can check; the\n // value comparison happens once the journey loads (noteTrialDaysDivergence).\n id: 'getting-started.trial-config',\n description: 'plg_getting_started_config.trial_days is the trial length the clock runs on.',\n requires: { tables: ['plg_getting_started_config'] },\n level: 'warn',\n },\n ],\n settings: [\n {\n id: 'trial',\n label: tl('Free trial', 'Teste grátis'),\n icon: 'Clock',\n component: Settings as React.ComponentType<unknown>,\n order: 90,\n // No `permission`: `settings` is not a feature any plugin declares, so\n // the grants-based check denied everybody but the literal owner and\n // the tab vanished from the menu and the search. The shell already\n // gates the settings area; the server gates the write (settings.manage).\n },\n ],\n locales: gettingStartedLocales,\n })\n}\n\nexport type { GettingStartedPluginOptions, ResolvedGettingStartedConfig, JourneyOverride, GettingStartedRoutes } from './config'\nexport { getActiveConfig, noteTrialDaysDivergence, resolveConfig, resolveRoutes, DEFAULT_ROUTES } from './config'\nexport type {\n Journey, JourneyPhase, JourneyMinimums, JourneyEvent, StartTrialResult, RequestContractResult,\n StoreHours, HoursRange, Weekday, PaymentMethod,\n} from './types'\nexport { MINIMUM_IDS, PAYMENT_METHODS, WEEKDAYS, type MinimumId } from './types'\nexport {\n T, RPC, GettingStartedError, isForbidden, isMissingClock,\n createSupabaseGettingStartedProvider, createMockGettingStartedProvider, derivePhase,\n type GettingStartedDataProvider, type MockGettingStartedOptions, type MockGettingStartedProvider,\n} from './data'\nexport {\n buildStoreLiveProgram, withoutStoreProfileStep, hasOpeningHours, hasPaymentMethods,\n PROGRAM_ID as STORE_LIVE_PROGRAM_ID, type BuildStoreLiveProgramInput,\n} from './lib/program'\nexport { journeyTour, buildOwnJourneyTour, buildJourneyTour, buildJourneyClosingStop, JOURNEY_TOUR_ID } from './lib/tour'\nexport {\n STORE_PROFILE_STEP_KEY, configureStoreProfile, getStoreProfileProvider, businessProfileStoreProfileProvider,\n storeProfileFrom, storeProfileFromAnswers, storeProfileToAnswers, storeProfileAnswered,\n type StoreProfile, type StoreProfileProvider, type SaveStoreProfileWriteResult,\n type StoreOperation, type StoreServiceMode, type StoreDeliveryMethod, type StoreTableBand,\n} from './lib/store-profile'\nexport { gettingStartedAiTools } from './lib/agent-tools'\nexport { toTrialSource, formatTrialDate } from './lib/trial-source-bridge'\nexport { useJourneyStore, type JourneyState } from './store'\nexport { StartTrialCta } from './components/StartTrialCta'\nexport {\n StartTrialAction, useStartTrial, type StartTrialActionProps, type StartTrialState, type StartTrialMissing,\n} from './components/StartTrialAction'\nexport { TrialEndBanner } from './components/TrialEndBanner'\nexport { StoreLiveCard, type StoreLiveCardProps } from './components/StoreLiveCard'\nexport { ProgressRing } from './components/ProgressRing'\nexport {\n SENSOR_RULED_KEYS,\n declareJourney, currentJourney, useJourneyDeclaration, minimumSlotOf, minimumLines, rowDone,\n selectJourneySteps, toStepInputs, countJourney, countMinimums, clientJourney, nowStepKey,\n type JourneyDeclaration, type JourneySelection, type MinimumLine, type MinimumsCount,\n type CatalogStepLike, type ActivationRowLike,\n} from './lib/journey-steps'\nexport { trialEndsToday, formatEndTime } from './lib/trial-clock'\nexport {\n readStoreSettings, saveStoreSetting, loadStoreSettings, STORE_SETTINGS_SAVED_EVENT,\n configureStoreSettings, getStoreSettingsProvider, supabaseStoreSettingsProvider,\n type StoreSettingsProvider, type StoreSettingKey, type SaveStoreSettingResult, type SaveStoreSettingVia,\n} from './lib/store-settings'\nexport { TrialSettingsTab } from './settings/TrialSettingsTab'\n"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type PluginAITool } from '@fayz-ai/core';
|
|
2
|
+
import { PAYMENT_METHOD_IDS, type DayKey, type HoursShift, type HoursValue, type PaymentMethodId } from '@fayz-ai/ui';
|
|
3
|
+
import type { JourneyState } from '../store';
|
|
4
|
+
import { type Journey, type JourneyMinimums, type MinimumId, type StoreHours } from '../types';
|
|
5
|
+
import { type SaveStoreSettingVia } from './store-settings';
|
|
6
|
+
import { DELIVERY_METHODS, OPERATIONS, PROFILE_KEYS, SERVICE_MODES, TABLE_BANDS, type StoreServiceMode } from './store-profile';
|
|
7
|
+
/** The minimums still open, in the words the assistant says them. */
|
|
8
|
+
export declare function missingMinimums(minimums: JourneyMinimums): MinimumId[];
|
|
9
|
+
export declare function describeJourney(journey: Journey): {
|
|
10
|
+
phase: import("..").JourneyPhase;
|
|
11
|
+
trialDays: number;
|
|
12
|
+
trialStartedAt: string | null;
|
|
13
|
+
trialEndsAt: string | null;
|
|
14
|
+
setupDeadlineAt: string | null;
|
|
15
|
+
wantsContractAt: string | null;
|
|
16
|
+
minimums: JourneyMinimums;
|
|
17
|
+
missing: string[];
|
|
18
|
+
ready: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const HOURS_TEMPLATE_IDS: readonly ["lunch", "dinner", "lunch-dinner", "weekend"];
|
|
21
|
+
export type HoursTemplateId = (typeof HOURS_TEMPLATE_IDS)[number];
|
|
22
|
+
export interface StoreHoursTemplate {
|
|
23
|
+
id: HoursTemplateId;
|
|
24
|
+
label: string;
|
|
25
|
+
hint: string;
|
|
26
|
+
hours: HoursValue;
|
|
27
|
+
}
|
|
28
|
+
/** The four one-click models the chat offers; same as Brendi's, in a kitchen's words. */
|
|
29
|
+
export declare const HOURS_TEMPLATES: ReadonlyArray<StoreHoursTemplate>;
|
|
30
|
+
export declare const HOURS_TEMPLATE_CHOICE = "store-hours-template";
|
|
31
|
+
/** The fifth row of the hours card: no model, the person says the week. */
|
|
32
|
+
export declare const HOURS_CUSTOM_OPTION = "custom";
|
|
33
|
+
/**
|
|
34
|
+
* A pt-BR sentence about the week → the days and shifts it names.
|
|
35
|
+
*
|
|
36
|
+
* Covers how a kitchen actually says it: "seg a sex 11h às 15h e 18h às 23h,
|
|
37
|
+
* sáb 18h à meia-noite", "todo dia das 18 às 23", "de terça a domingo
|
|
38
|
+
* 11:00-23:00, fecha segunda". Times apply to the last days named before them;
|
|
39
|
+
* times before any day apply to the whole week; a day named with "fechado" is
|
|
40
|
+
* closed. Anything it cannot read is `null` — the card is where the person
|
|
41
|
+
* corrects, never a guess that lands in the row.
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseHoursText(raw: string): HoursValue | null;
|
|
44
|
+
export interface LabelledDay {
|
|
45
|
+
day: DayKey;
|
|
46
|
+
/** The line the confirmation card shows: "seg 11:00–15:00 e 18:00–23:00". */
|
|
47
|
+
label: string;
|
|
48
|
+
shifts: HoursShift[];
|
|
49
|
+
}
|
|
50
|
+
/** Open days, one labelled line each — what `saveStoreHours` is called with. */
|
|
51
|
+
export declare function labelWeek(hours: HoursValue): LabelledDay[];
|
|
52
|
+
/** What the model handed over, in order of trust: a model, the rows, a week object, the sentence. */
|
|
53
|
+
export declare function hoursFromArgs(args: Record<string, unknown>): {
|
|
54
|
+
hours: HoursValue;
|
|
55
|
+
template?: HoursTemplateId;
|
|
56
|
+
} | null;
|
|
57
|
+
/** What `store.hours` keeps: the open days only, every shift of each. */
|
|
58
|
+
export declare function storeHoursOf(hours: HoursValue): StoreHours;
|
|
59
|
+
export declare const PROPOSE_HOURS_TOOL = "proposeStoreHours";
|
|
60
|
+
export declare const SAVE_HOURS_TOOL = "saveStoreHours";
|
|
61
|
+
export type ProposeStoreHoursResult = {
|
|
62
|
+
ok: false;
|
|
63
|
+
reason: 'not_understood';
|
|
64
|
+
hint: string;
|
|
65
|
+
} | {
|
|
66
|
+
ok: true;
|
|
67
|
+
saved: false;
|
|
68
|
+
template?: HoursTemplateId;
|
|
69
|
+
week: LabelledDay[];
|
|
70
|
+
summary: string;
|
|
71
|
+
next: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Phase 1 of hours by conversation: a model or a sentence in, the week out,
|
|
75
|
+
* labelled for the card and summarised for the reply. Writes nothing and asks
|
|
76
|
+
* nothing — the confirmation is the native card in front of `saveStoreHours`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function proposeStoreHours(args: Record<string, unknown>): ProposeStoreHoursResult;
|
|
79
|
+
export type SaveStoreHoursResult = {
|
|
80
|
+
ok: false;
|
|
81
|
+
reason: 'not_understood' | 'offline' | 'no-tenant' | 'error';
|
|
82
|
+
message?: string;
|
|
83
|
+
hint?: string;
|
|
84
|
+
} | {
|
|
85
|
+
ok: true;
|
|
86
|
+
saved: true;
|
|
87
|
+
summary: string;
|
|
88
|
+
via: SaveStoreSettingVia;
|
|
89
|
+
};
|
|
90
|
+
/** Phase 2: the week lands in `store.hours` through the same door the Teste grátis tab uses. */
|
|
91
|
+
export declare function saveStoreHours(args: Record<string, unknown>): Promise<SaveStoreHoursResult>;
|
|
92
|
+
export { PAYMENT_METHOD_IDS };
|
|
93
|
+
export type { PaymentMethodId };
|
|
94
|
+
export declare const PAYMENT_METHOD_LABELS: Record<PaymentMethodId, string>;
|
|
95
|
+
export declare const PAYMENT_METHODS_CHOICE = "store-payment-methods";
|
|
96
|
+
export declare const SAVE_PAYMENT_METHODS_TOOL = "savePaymentMethods";
|
|
97
|
+
/** Ids, labels or a sentence → the ids, in the catalogue's order, no repeats. */
|
|
98
|
+
export declare function methodsFromArgs(args: Record<string, unknown>): PaymentMethodId[];
|
|
99
|
+
export declare function describeMethods(ids: readonly PaymentMethodId[]): string;
|
|
100
|
+
export type SavePaymentMethodsResult = {
|
|
101
|
+
ok: false;
|
|
102
|
+
reason: 'not_understood' | 'offline' | 'no-tenant' | 'error';
|
|
103
|
+
message?: string;
|
|
104
|
+
hint?: string;
|
|
105
|
+
} | {
|
|
106
|
+
ok: true;
|
|
107
|
+
saved: true;
|
|
108
|
+
methods: PaymentMethodId[];
|
|
109
|
+
summary: string;
|
|
110
|
+
via: SaveStoreSettingVia;
|
|
111
|
+
};
|
|
112
|
+
export declare function savePaymentMethods(args: Record<string, unknown>): Promise<SavePaymentMethodsResult>;
|
|
113
|
+
export { PROFILE_KEYS, OPERATIONS, SERVICE_MODES, DELIVERY_METHODS, TABLE_BANDS };
|
|
114
|
+
export declare const SERVICE_MODE_LABELS: Record<StoreServiceMode, string>;
|
|
115
|
+
export declare const SERVICE_MODES_CHOICE = "store-service-modes";
|
|
116
|
+
export declare const SAVE_PROFILE_TOOL = "saveStoreProfile";
|
|
117
|
+
export declare const STORE_PROFILE_SAVED_EVENT = "getting_started.store_profile_saved";
|
|
118
|
+
/** The arguments that are answers, keyed as the wizard keyed them. Unknown values are dropped. */
|
|
119
|
+
export declare function profilePatchFromArgs(args: Record<string, unknown>): Record<string, unknown>;
|
|
120
|
+
/** The profile step closes when the house said how it serves (the wizard or the conversation). */
|
|
121
|
+
export declare function profileAnswered(answers: Record<string, unknown> | undefined | null): boolean;
|
|
122
|
+
export type SaveStoreProfileResult = {
|
|
123
|
+
ok: false;
|
|
124
|
+
reason: 'not_understood' | 'no-tenant' | 'no-user' | 'offline' | 'write-failed';
|
|
125
|
+
message?: string;
|
|
126
|
+
} | {
|
|
127
|
+
ok: true;
|
|
128
|
+
saved: true;
|
|
129
|
+
answers: Record<string, unknown>;
|
|
130
|
+
summary: string;
|
|
131
|
+
};
|
|
132
|
+
export declare function saveStoreProfile(args: Record<string, unknown>): Promise<SaveStoreProfileResult>;
|
|
133
|
+
export declare const gettingStartedAiTools: PluginAITool[];
|
|
134
|
+
/** The tools a surface offers: without a store profile, `saveStoreProfile` is left out. */
|
|
135
|
+
export declare function gettingStartedAiToolsFor(opts?: {
|
|
136
|
+
profile?: boolean;
|
|
137
|
+
}): PluginAITool[];
|
|
138
|
+
export declare function registerGettingStartedToolHandlers(store: {
|
|
139
|
+
getState: () => JourneyState;
|
|
140
|
+
}, opts?: {
|
|
141
|
+
profile?: boolean;
|
|
142
|
+
}): void;
|
|
143
|
+
//# sourceMappingURL=agent-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tools.d.ts","sourceRoot":"","sources":["../../src/lib/agent-tools.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E;IAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;CAAE,EACvC,IAAI,CAAC,EAAE;IAAiG,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1H,IAAI,CA2CN"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type OnboardingProgramDef } from '@fayz-ai/core';
|
|
2
|
+
import type { OnboardingStepInput } from '@fayz-ai/ui';
|
|
3
|
+
import { type JourneyOverride } from '../config';
|
|
4
|
+
import { type Journey, type JourneyMinimums, type MinimumId } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* The journey is DECLARED, not enumerated here. Each program tags its own
|
|
7
|
+
* steps (`OnboardingStepDef.journey`, contract §5.1) and `journeySteps()` lists
|
|
8
|
+
* them in program order with their namespaced keys; the app adds what it wants
|
|
9
|
+
* on top (`createGettingStartedPlugin({ journey })`): a base-list step such as
|
|
10
|
+
* `team`, a line outside the total, a minimum no program tags. This plugin only
|
|
11
|
+
* orders and composes — it knows none of the other owners' keys.
|
|
12
|
+
*/
|
|
13
|
+
export interface JourneyDeclaration {
|
|
14
|
+
launch: string[];
|
|
15
|
+
later: string[];
|
|
16
|
+
extra: string[];
|
|
17
|
+
/** Catalog keys of the steps the trial cannot start without, in order. */
|
|
18
|
+
minimums: string[];
|
|
19
|
+
/** The step that stands for each of the server's slots, when one can be told. */
|
|
20
|
+
slots: Partial<Record<MinimumId, string>>;
|
|
21
|
+
/** True when at least one program tagged a step (the override alone does not count). */
|
|
22
|
+
declared: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function minimumSlotOf(key: string): MinimumId | undefined;
|
|
25
|
+
export declare function declareJourney(programs: ReadonlyArray<OnboardingProgramDef>, override?: JourneyOverride): JourneyDeclaration;
|
|
26
|
+
export declare function setJourneyOverride(override: JourneyOverride | undefined): JourneyDeclaration;
|
|
27
|
+
/** Recomputes only when the programs list is another object — the runtime is stable per app. */
|
|
28
|
+
export declare function syncJourneyPrograms(programs: ReadonlyArray<OnboardingProgramDef> | undefined): JourneyDeclaration;
|
|
29
|
+
export declare function currentJourney(): JourneyDeclaration;
|
|
30
|
+
/**
|
|
31
|
+
* The programs of a host with no plugin runtime (`createGettingStartedHost`).
|
|
32
|
+
* Read by `useJourneyDeclaration` when no runtime is in context; `undefined`
|
|
33
|
+
* hands it back to the runtime alone.
|
|
34
|
+
*/
|
|
35
|
+
export declare function setHostJourneyPrograms(programs: ReadonlyArray<OnboardingProgramDef> | undefined): JourneyDeclaration;
|
|
36
|
+
/**
|
|
37
|
+
* The declaration from the plugin runtime in context, kept in sync for the
|
|
38
|
+
* selectors' default. Called during render on purpose: the sync is idempotent
|
|
39
|
+
* and the card below reads the result in the same pass.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useJourneyDeclaration(): JourneyDeclaration;
|
|
42
|
+
export interface ActivationRowLike {
|
|
43
|
+
sourceKey: string | null;
|
|
44
|
+
status: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
dueDate?: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface CatalogStepLike {
|
|
49
|
+
key: string;
|
|
50
|
+
title: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
route?: string;
|
|
54
|
+
dueInDays?: number;
|
|
55
|
+
check?: () => Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
export interface JourneySelection<S extends CatalogStepLike = CatalogStepLike> {
|
|
58
|
+
launch: S[];
|
|
59
|
+
later: S[];
|
|
60
|
+
extra: S[];
|
|
61
|
+
/** True when nothing to launch was declared and the head of the catalog was used instead. */
|
|
62
|
+
fallback: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The journey out of the shell's activation catalog (already filtered by
|
|
66
|
+
* vertical, answers and routes): the declared keys in declared order, each one
|
|
67
|
+
* present only if the catalog has it — a house without delivery shows n/8.
|
|
68
|
+
*
|
|
69
|
+
* A declaration with nothing to launch is a journey not declared yet (programs
|
|
70
|
+
* still untagged, another app): the catalog is in program order, so its head
|
|
71
|
+
* stands in, as it always did.
|
|
72
|
+
*/
|
|
73
|
+
export declare function selectJourneySteps<S extends CatalogStepLike>(catalog: readonly S[], declaration?: JourneyDeclaration): JourneySelection<S>;
|
|
74
|
+
export declare function rowDone(rows: readonly ActivationRowLike[] | null | undefined, key: string): boolean;
|
|
75
|
+
export declare function rowOpen(rows: readonly ActivationRowLike[] | null | undefined, key: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Steps whose sensor outranks the row — this plugin's own two. For these the
|
|
78
|
+
* row is a memo of the data, not the fact: a "done" row with zero payment
|
|
79
|
+
* methods behind it (a step closed by a visit, a sweep that read an empty
|
|
80
|
+
* memory) is reopened by the sensor instead of drawn struck through.
|
|
81
|
+
*/
|
|
82
|
+
export declare const SENSOR_RULED_KEYS: readonly string[];
|
|
83
|
+
/**
|
|
84
|
+
* Steps as `useOnboardingProgress` wants them, sensors latched.
|
|
85
|
+
*
|
|
86
|
+
* The latch re-reads the ROW AT THE MOMENT THE SENSOR ANSWERS, through
|
|
87
|
+
* `onSensorDone`, not the row captured when the list was built. The rows of a
|
|
88
|
+
* fresh workspace arrive in two waves (the wizard's base list, then the
|
|
89
|
+
* programs' top-up a mount later); a sensor that fired against the first wave
|
|
90
|
+
* found no row for `getting-started.hours`, said "done" to the card and wrote
|
|
91
|
+
* nothing — which is how the painel counted a step the Tarefas tab still listed
|
|
92
|
+
* as open.
|
|
93
|
+
*
|
|
94
|
+
* A closed row of a sensor-ruled step still probes; a "no" there reaches
|
|
95
|
+
* `onSensorOpen`, so the caller can reopen the row the sensor contradicted.
|
|
96
|
+
*/
|
|
97
|
+
export declare function toStepInputs(steps: readonly CatalogStepLike[], rows: readonly ActivationRowLike[] | null | undefined, onSensorDone?: (key: string) => void, onSensorOpen?: (key: string) => void): OnboardingStepInput[];
|
|
98
|
+
/**
|
|
99
|
+
* The journey's own count, from the rows alone — what the floating pill and
|
|
100
|
+
* the card's ring both say. One selection (launch + later), one total; the
|
|
101
|
+
* rest of the catalog is the Tarefas tab's business, not this number.
|
|
102
|
+
*/
|
|
103
|
+
export declare function countJourney(catalog: readonly CatalogStepLike[], rows: readonly ActivationRowLike[] | null | undefined, declaration?: JourneyDeclaration): {
|
|
104
|
+
done: number;
|
|
105
|
+
total: number;
|
|
106
|
+
};
|
|
107
|
+
export interface MinimumsCount {
|
|
108
|
+
count: number;
|
|
109
|
+
total: number;
|
|
110
|
+
/** Server slots green — said by the server OR by the row of the step that stands for the slot. */
|
|
111
|
+
done: MinimumId[];
|
|
112
|
+
missing: MinimumId[];
|
|
113
|
+
/** Declared minimum keys still open on the client (slotted or not). */
|
|
114
|
+
missingKeys: string[];
|
|
115
|
+
ready: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A minimum is green when the server says so OR the checklist already ticked
|
|
119
|
+
* the step that stands for it. The count is over the server's slots — the
|
|
120
|
+
* server is what unlocks the trial — and `ready` also waits for any declared
|
|
121
|
+
* minimum the server has no slot for.
|
|
122
|
+
*/
|
|
123
|
+
export declare function countMinimums(journey: Journey | null, rows: readonly ActivationRowLike[] | null | undefined, declaration?: JourneyDeclaration): MinimumsCount;
|
|
124
|
+
export declare function minimumsFromRows(rows: readonly ActivationRowLike[] | null | undefined, declaration?: JourneyDeclaration): JourneyMinimums;
|
|
125
|
+
/**
|
|
126
|
+
* The journey as the client can tell it when the pool has no clock yet
|
|
127
|
+
* (`getting_started_journey` missing — migration not applied). Phase is
|
|
128
|
+
* "setup" by definition: nothing could have started a trial. Dates are unknown,
|
|
129
|
+
* never invented; the surfaces that show them read `null` and say nothing.
|
|
130
|
+
*/
|
|
131
|
+
export declare function clientJourney(input: {
|
|
132
|
+
tenantId: string;
|
|
133
|
+
trialDays: number;
|
|
134
|
+
rows: readonly ActivationRowLike[] | null | undefined;
|
|
135
|
+
declaration?: JourneyDeclaration;
|
|
136
|
+
}): Journey;
|
|
137
|
+
/** The one step that carries "AGORA": the first still open, launch group first. */
|
|
138
|
+
export declare function nowStepKey(selection: Pick<JourneySelection, 'launch' | 'later'>, completed: Record<string, boolean>): string | undefined;
|
|
139
|
+
export interface MinimumLine {
|
|
140
|
+
key: string;
|
|
141
|
+
slot?: MinimumId;
|
|
142
|
+
/** The catalog step, when this app has it. */
|
|
143
|
+
step?: CatalogStepLike;
|
|
144
|
+
done: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The minimums as a list to draw: every declared minimum key (with its catalog
|
|
148
|
+
* step when the app has it), plus any server slot nothing in this app stands
|
|
149
|
+
* for — those carry only the slot, and the caller words them.
|
|
150
|
+
*/
|
|
151
|
+
export declare function minimumLines(catalog: readonly CatalogStepLike[], rows: readonly ActivationRowLike[] | null | undefined, journey: Journey | null, declaration?: JourneyDeclaration): MinimumLine[];
|
|
152
|
+
//# sourceMappingURL=journey-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-steps.d.ts","sourceRoot":"","sources":["../../src/lib/journey-steps.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACjG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AACxE,OAAO,EAAe,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AAE1F;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,iFAAiF;IACjF,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,wFAAwF;IACxF,QAAQ,EAAE,OAAO,CAAA;CAClB;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AAqC,GACjD,WAAW,EAAE,CAcf"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type OnboardingProgramDef } from '@fayz-ai/core';
|
|
2
|
+
import { type ResolvedGettingStartedConfig } from '../config';
|
|
3
|
+
import type { GettingStartedDataProvider } from '../data/types';
|
|
4
|
+
export declare const PROGRAM_ID = "getting-started";
|
|
5
|
+
export declare const PROGRAM_ORDER = 10;
|
|
6
|
+
export declare function readStoreSetting<T>(settings: Record<string, unknown> | undefined, path: string[]): T | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* `store.hours` has at least one day that is actually open: a day whose list
|
|
9
|
+
* of ranges is empty is a closed day, and a week of closed days is no schedule.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasOpeningHours(settings: Record<string, unknown> | undefined): boolean;
|
|
12
|
+
export declare function hasPaymentMethods(settings: Record<string, unknown> | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The routing the model needs for the steps that are a conversation, not a
|
|
15
|
+
* form. Without a store profile (`profile: false`) the profile line is left
|
|
16
|
+
* out — the tool it names is not offered.
|
|
17
|
+
*/
|
|
18
|
+
export declare function storeSetupRouting(opts?: {
|
|
19
|
+
profile?: boolean;
|
|
20
|
+
}): string;
|
|
21
|
+
export interface BuildStoreLiveProgramInput {
|
|
22
|
+
/** Kept for symmetry with the plugin factory; the steps' sensors do not read it. */
|
|
23
|
+
provider?: GettingStartedDataProvider;
|
|
24
|
+
/** Trial length (copy), verticals and the trial route the hours/payments steps open. Default: the active config. */
|
|
25
|
+
config?: Pick<ResolvedGettingStartedConfig, 'trialDays' | 'verticals' | 'trialRoute'>;
|
|
26
|
+
/**
|
|
27
|
+
* Include the "how the house serves" step (written through the
|
|
28
|
+
* StoreProfileProvider). Default true; a host without a store profile
|
|
29
|
+
* passes false and the step, and its routing line, are left out.
|
|
30
|
+
*/
|
|
31
|
+
profile?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** The store-live program: profile (optional), hours, payment methods. A host composes its own program from these steps. */
|
|
34
|
+
export declare function buildStoreLiveProgram(input?: BuildStoreLiveProgramInput): OnboardingProgramDef;
|
|
35
|
+
/** The program without the profile step (a host that has no store profile). Other programs pass through. */
|
|
36
|
+
export declare function withoutStoreProfileStep(program: OnboardingProgramDef): OnboardingProgramDef;
|
|
37
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/lib/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,oBAAoB,EAA0B,MAAM,eAAe,CAAA;AAEzH,OAAO,EAAmB,KAAK,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAC9E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAS/D,eAAO,MAAM,UAAU,oBAAoB,CAAA;AAC3C,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAIhH;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,CAMtF;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,CAGxF;AAWD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAWtE;AAaD,MAAM,WAAW,0BAA0B;IACzC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,0BAA0B,CAAA;IACrC,oHAAoH;IACpH,MAAM,CAAC,EAAE,IAAI,CAAC,4BAA4B,EA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