@funnelsgrove/cli 0.1.394 → 0.1.398

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/README.md CHANGED
@@ -215,6 +215,7 @@ fgrove setup check meta_pixel --test-event-code TEST12345
215
215
  fgrove setup complete legal_support
216
216
  fgrove setup meta-traffic off # the project does not buy Meta traffic
217
217
  fgrove setup domain go.yourapp.com # attach your domain to the funnel and its route; prints the DNS record
218
+ fgrove setup prices --plan month=29.99 --intro month=14.99 # Stripe prices + one Offer Set, made the funnel default
218
219
  fgrove setup secrets stripe-test # single-use link to a FunnelsGrove form for Stripe keys
219
220
  ```
220
221
 
@@ -325,6 +326,15 @@ workspace, project and funnel chosen with `fgrove use`). `--log` attaches the
325
326
  last 20,000 characters of a log file as-is, so remove secrets first. The
326
327
  command prints the reference of the filed report.
327
328
 
329
+ Request a feature the same way:
330
+
331
+ ```bash
332
+ fgrove feature request "export funnel analytics as CSV" --dry-run # show what would be sent
333
+ fgrove feature request "export funnel analytics as CSV"
334
+ ```
335
+
336
+ A feature request carries the same context, without a log.
337
+
328
338
  Use `--api-url` or `FUNNELSGROVE_API_URL` for non-production APIs.
329
339
  Use `--config` or `FUNNELSGROVE_CONFIG` to keep test credentials separate from the default `~/.funnelsgrove/config.json`.
330
340
 
@@ -6,6 +6,7 @@ type CallApi = <T>(input: {
6
6
  }) => Promise<T>;
7
7
  export declare const BUG_REPORT_MAX_LOG_CHARS = 20000;
8
8
  export type BugReport = {
9
+ kind?: 'feature';
9
10
  message: string;
10
11
  logs?: string;
11
12
  cliVersion: string;
@@ -29,6 +30,7 @@ export declare const resolveBugReportContext: (input: {
29
30
  active: BugReportContext | null;
30
31
  }) => BugReportContext;
31
32
  export declare const buildBugReport: (input: {
33
+ kind?: "feature";
32
34
  message: string;
33
35
  logPath?: string;
34
36
  cliVersion: string;
@@ -13,14 +13,18 @@ export const resolveBugReportContext = (input) => {
13
13
  };
14
14
  export const buildBugReport = async (input) => {
15
15
  const message = input.message.trim();
16
- if (!message)
17
- throw new Error('Describe the bug: fgrove bug report "what happened".');
16
+ if (!message) {
17
+ throw new Error(input.kind === 'feature'
18
+ ? 'Describe the feature: fgrove feature request "what you need".'
19
+ : 'Describe the bug: fgrove bug report "what happened".');
20
+ }
18
21
  const readText = input.readText ?? ((path) => readFile(path, 'utf8'));
19
22
  const logs = input.logPath ? tailLog(await readText(input.logPath)) : undefined;
20
- return { message, ...(logs ? { logs } : {}), cliVersion: input.cliVersion, environment: input.environment, ...input.context };
23
+ return { ...(input.kind ? { kind: input.kind } : {}), message, ...(logs ? { logs } : {}), cliVersion: input.cliVersion, environment: input.environment, ...input.context };
21
24
  };
22
25
  export const submitBugReport = (input, report) => (input.callApi({ path: 'bugReports.create', type: 'mutation', token: input.token, data: report }));
23
26
  export const formatBugReportPreview = (report) => [
27
+ ...(report.kind === 'feature' ? ['Type\tfeature request'] : []),
24
28
  `CLI\t${report.cliVersion} (${report.environment})`,
25
29
  `Workspace\t${report.workspaceId ?? 'not set'}`,
26
30
  `Project\t${report.projectId ?? 'not set'}`,
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { executeProjectCreate, executeOfferSetAssign, executeOfferSetCreate } from './projectSetupCommands.js';
2
+ import { executeProjectCreate, executeOfferSetAssign, executeOfferSetCreate, executeOfferSetPublishToFunnel } from './projectSetupCommands.js';
3
3
  import { createHash, randomUUID } from 'node:crypto';
4
4
  import { constants as fsConstants, realpathSync } from 'node:fs';
5
5
  import { cp, link, lstat, mkdir, mkdtemp, open, readFile, readdir, rmdir, rm, unlink, writeFile, } from 'node:fs/promises';
@@ -21,7 +21,7 @@ import { exportFunnelSource } from './sourceExport.js';
21
21
  import { executeFastDraftPatchSync, uploadDirectAssetWithFetch } from './draftPatchSync.js';
22
22
  import { updateCliInstallations } from './selfUpdate.js';
23
23
  import { executeExpensePublish, executeExpensePull } from './expenseCommands.js';
24
- import { assignSetupDomain, createSetupSecretLink, formatSetupDomain, formatSetupStatus, formatStepDocs, readSetupGuide, readSetupStatus, runSetupCheck, setSetupMetaTraffic, setSetupStepCompleted, } from './setupCommands.js';
24
+ import { assignSetupDomain, createSetupSecretLink, formatSetupDomain, formatSetupStatus, formatStepDocs, readSetupGuide, readSetupStatus, runSetupCheck, saveSetupPrices, setSetupMetaTraffic, setSetupStepCompleted, } from './setupCommands.js';
25
25
  import { buildAlertStatisticsReport, fetchAlertStatistics, fetchPreventSummary, formatAlertRows, formatAlertStatistics, formatPreventRows, formatPreventSummary, listAlerts, listPreventSearches, parseAlertMonth, toAlertJsonRow, } from './alertCommands.js';
26
26
  import { cancelUserSubscription, findUser, formatUserCancellation, formatUserFind, formatUserLookup, formatUserRefunds, formatRefundPreview, lookupUser, parseUserSelector, previewRefund, refundUserPayments, } from './userCommands.js';
27
27
  import { buildBugReport, formatBugReportPreview, resolveBugReportContext, submitBugReport, } from './bugReportCommands.js';
@@ -2157,6 +2157,7 @@ addExpenseScopeOptions(expensesCommand
2157
2157
  console.log(`Published expenses: ${result.created} created, ${result.updated} updated.`);
2158
2158
  });
2159
2159
  registerCreativeCommands(program, { resolveScope: resolveProjectCommandScope });
2160
+ const collectSetupOption = (value, previous) => [...previous, value];
2160
2161
  const addSetupScopeOptions = (command) => command
2161
2162
  .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
2162
2163
  .option('--project <id-or-slug-or-name>', 'Project id, slug, or name')
@@ -2179,6 +2180,7 @@ const setupCommand = addExamples(program.command('setup').description('Follow th
2179
2180
  'fgrove setup complete legal_support',
2180
2181
  'fgrove setup meta-traffic off',
2181
2182
  'fgrove setup domain go.yourapp.com',
2183
+ 'fgrove setup prices --plan month=29.99 --intro month=14.99 --plan year=99.99 --default month',
2182
2184
  'fgrove setup secrets stripe-test',
2183
2185
  ]);
2184
2186
  addSetupScopeOptions(setupCommand
@@ -2243,6 +2245,18 @@ addSetupScopeOptions(setupCommand
2243
2245
  const result = await assignSetupDomain(scope, hostname, { funnelId });
2244
2246
  printSetupResult(options, result, formatSetupDomain(result));
2245
2247
  });
2248
+ addSetupScopeOptions(setupCommand
2249
+ .command('prices')
2250
+ .description('Create weekly, monthly or yearly Stripe prices, keep them in one Offer Set and make it the funnel default')
2251
+ .option('--plan <period=amount>', 'Price for week, month or year (repeatable), for example month=29.99', collectSetupOption, [])
2252
+ .option('--intro <period=amount[/periods]>', 'Discounted first charge for a listed period (repeatable), for example month=14.99', collectSetupOption, [])
2253
+ .option('--default <period>', 'Default plan period (default: first listed)')
2254
+ .option('--currency <iso>', 'ISO currency code', 'usd'))
2255
+ .action(async (options) => {
2256
+ const { scope, funnelId } = await resolveSetupScope(options);
2257
+ const result = await saveSetupPrices(scope, { ...options, funnelId });
2258
+ printSetupResult(options, result, `prices\tsaved\tOffer Set ${result.offerSetId} is the default of funnel ${result.funnelId}`);
2259
+ });
2246
2260
  addSetupScopeOptions(setupCommand
2247
2261
  .command('secrets <stripe-test|stripe-live|meta>')
2248
2262
  .description('Create a single-use link to a FunnelsGrove form for Stripe keys or the Meta token; values never pass through the CLI'))
@@ -2349,8 +2363,8 @@ const offerSetsCommand = addExamples(program.command('offer-sets').alias('offers
2349
2363
  'fgrove offer-sets prices --project claimbee --env live',
2350
2364
  'fgrove offer-sets publish --project claimbee --dry-run',
2351
2365
  'fgrove offer-sets publish --project claimbee',
2366
+ 'fgrove offer-sets publish --project claimbee --funnel main --offer-set intro',
2352
2367
  ]);
2353
- const collectSetupOption = (value, previous) => [...previous, value];
2354
2368
  const setupScopeOptions = (command) => command
2355
2369
  .option('--project <id-or-slug-or-name>', 'Project id, slug, or name')
2356
2370
  .option('--workspace <id-or-slug-or-name>', 'Workspace id, slug, or name')
@@ -2398,17 +2412,28 @@ addOfferSetScopeOptions(offerSetsCommand
2398
2412
  addOfferSetScopeOptions(offerSetsCommand
2399
2413
  .command('publish')
2400
2414
  .description('Create, update, archive, and reactivate offer sets from an edited JSON file')
2415
+ .option('--funnel <id-or-slug>', 'Then make the listed offer sets this funnel’s offer sets (needs --offer-set)')
2416
+ .option('--offer-set <key-or-id>', 'Offer set to assign with --funnel (repeatable; the first is the default)', collectSetupOption, [])
2401
2417
  .option('--dry-run', 'Print the changes without saving them'))
2402
2418
  .action(async (options) => {
2403
2419
  const scope = await resolveExpenseCommandScope(options);
2404
- const changes = await executeOfferSetPublish({ ...scope, dryRun: options.dryRun });
2420
+ const funnelId = options.funnel ? await resolveFunnelId(scope.token, scope.workspaceId, options.funnel) : undefined;
2421
+ const { changes, assignment } = await executeOfferSetPublishToFunnel({
2422
+ ...scope, funnelId, offerSets: options.offerSet, dryRun: options.dryRun,
2423
+ publish: () => executeOfferSetPublish({ ...scope, dryRun: options.dryRun }),
2424
+ });
2405
2425
  if (changes.length === 0) {
2406
2426
  console.log('No offer set changes to publish.');
2407
- return;
2408
2427
  }
2409
- console.log(options.dryRun ? 'Would publish:' : 'Published:');
2410
- for (const change of changes)
2411
- console.log(` ${change}`);
2428
+ else {
2429
+ console.log(options.dryRun ? 'Would publish:' : 'Published:');
2430
+ for (const change of changes)
2431
+ console.log(` ${change}`);
2432
+ }
2433
+ if (funnelId && options.dryRun)
2434
+ console.log(`Would make ${options.offerSet.join(', ')} the offer sets of funnel ${funnelId}, default ${options.offerSet[0]}.`);
2435
+ if (assignment)
2436
+ console.log(`Assigned to funnel ${funnelId}: default offer set ${assignment.defaultOfferSetId}.`);
2412
2437
  });
2413
2438
  offerSetsCommand
2414
2439
  .command('prices')
@@ -2791,7 +2816,7 @@ supportCommand
2791
2816
  supportCommand
2792
2817
  .command('close <ticket>')
2793
2818
  .description('Close the ticket; the customer\'s next message starts a new one')
2794
- .option('--note <text>', 'Why the ticket is closed')
2819
+ .option('--note <text>', 'Why the ticket is closed; required for a Support Agent closing an Unassigned Ticket')
2795
2820
  .action(async (ticket, options) => {
2796
2821
  const result = await closeSupportTicket(await supportScope(), parseTicketNumber(ticket), options.note);
2797
2822
  console.log(`${result.id} closed.`);
@@ -2865,16 +2890,10 @@ const bugCommand = addExamples(program.command('bug').description('Report a Funn
2865
2890
  'fgrove bug report "publish hangs at image optimization" --log ./publish.log --dir ./claimbee-ios',
2866
2891
  'fgrove bug report "users find misses a project" --dry-run',
2867
2892
  ]);
2868
- bugCommand
2869
- .command('report <message>')
2870
- .description('Send a bug report with your CLI version, environment and current workspace, project and funnel; --log attaches the last 20,000 characters of a log file')
2871
- .option('--log <file>', 'Log file to attach (sent as-is; remove secrets first)')
2872
- .option('--dir <path>', 'Local funnel directory whose sync manifest names the funnel', '.')
2873
- .option('--dry-run', 'Print what would be sent without sending it')
2874
- .option('--json', 'Print machine-readable JSON')
2875
- .action(async (message, options) => {
2893
+ const sendBugReport = async (kind, message, options) => {
2876
2894
  const [manifest, active] = await Promise.all([loadManifestForDir(options.dir), loadActiveContext(getConfigPath())]);
2877
2895
  const report = await buildBugReport({
2896
+ kind,
2878
2897
  message,
2879
2898
  logPath: options.log && path.resolve(process.cwd(), options.log),
2880
2899
  cliVersion: cliReleaseIdentity.cliVersion,
@@ -2893,8 +2912,27 @@ bugCommand
2893
2912
  console.log(JSON.stringify(result, null, 2));
2894
2913
  return;
2895
2914
  }
2896
- console.log(`Bug report sent\t${result.reference}`);
2897
- });
2915
+ console.log(`${kind === 'feature' ? 'Feature request' : 'Bug report'} sent\t${result.reference}`);
2916
+ };
2917
+ bugCommand
2918
+ .command('report <message>')
2919
+ .description('Send a bug report with your CLI version, environment and current workspace, project and funnel; --log attaches the last 20,000 characters of a log file')
2920
+ .option('--log <file>', 'Log file to attach (sent as-is; remove secrets first)')
2921
+ .option('--dir <path>', 'Local funnel directory whose sync manifest names the funnel', '.')
2922
+ .option('--dry-run', 'Print what would be sent without sending it')
2923
+ .option('--json', 'Print machine-readable JSON')
2924
+ .action((message, options) => sendBugReport(undefined, message, options));
2925
+ const featureCommand = addExamples(program.command('feature').description('Request a FunnelsGrove feature from the FunnelsGrove team'), [
2926
+ 'fgrove feature request "export funnel analytics as CSV"',
2927
+ 'fgrove feature request "bulk-edit prices across funnels" --dry-run',
2928
+ ]);
2929
+ featureCommand
2930
+ .command('request <message>')
2931
+ .description('Send a feature request with your CLI version, environment and current workspace, project and funnel')
2932
+ .option('--dir <path>', 'Local funnel directory whose sync manifest names the funnel', '.')
2933
+ .option('--dry-run', 'Print what would be sent without sending it')
2934
+ .option('--json', 'Print machine-readable JSON')
2935
+ .action((message, options) => sendBugReport('feature', message, options));
2898
2936
  const funnelsCommand = addExamples(program.command('funnels').description('Manage funnels'), [
2899
2937
  'fgrove funnels list',
2900
2938
  'fgrove funnels clone --funnel claimbee --name claimbee-ios',
@@ -30,6 +30,23 @@ export declare const executeOfferSetAssign: (input: Scope & {
30
30
  offerSetIds: string[];
31
31
  defaultOfferSetId: string;
32
32
  }>;
33
+ /** FUN-559: `offer-sets publish --funnel --offer-set` publishes, then makes the listed sets the funnel's (first is default). */
34
+ export declare const executeOfferSetPublishToFunnel: (input: Scope & {
35
+ funnelId?: string;
36
+ offerSets: string[];
37
+ dryRun?: boolean;
38
+ publish: () => Promise<string[]>;
39
+ }) => Promise<{
40
+ changes: string[];
41
+ assignment?: undefined;
42
+ } | {
43
+ changes: string[];
44
+ assignment: {
45
+ funnelId: string;
46
+ offerSetIds: string[];
47
+ defaultOfferSetId: string;
48
+ };
49
+ }>;
33
50
  export type OfferSetCreateOptions = {
34
51
  key: string;
35
52
  name: string;
@@ -35,6 +35,17 @@ export const executeOfferSetAssign = async (input) => {
35
35
  await input.callApi({ path: 'projects.replaceFunnelMonetization', type: 'mutation', token: input.token, data: { workspaceId: input.workspaceId, projectId: input.projectId, ...assignment } });
36
36
  return assignment;
37
37
  };
38
+ /** FUN-559: `offer-sets publish --funnel --offer-set` publishes, then makes the listed sets the funnel's (first is default). */
39
+ export const executeOfferSetPublishToFunnel = async (input) => {
40
+ if (Boolean(input.funnelId) !== input.offerSets.length > 0) {
41
+ throw new Error('--funnel and --offer-set go together.');
42
+ }
43
+ const changes = await input.publish();
44
+ if (!input.funnelId || input.dryRun) {
45
+ return { changes };
46
+ }
47
+ return { changes, assignment: await executeOfferSetAssign({ ...input, funnelId: input.funnelId }) };
48
+ };
38
49
  export const executeOfferSetCreate = async (input) => {
39
50
  if (input.env !== 'test' && input.env !== 'live') {
40
51
  throw new Error('--env must be test or live.');
@@ -131,5 +131,16 @@ export declare const assignSetupDomain: (scope: SetupScope, domain: string, opti
131
131
  funnelId: string;
132
132
  domain: SetupDomain;
133
133
  }>;
134
+ /** ONB-BR-042: the console's "Choose your prices"; the Offer Set becomes the funnel's default at once. */
135
+ export declare const saveSetupPrices: (scope: SetupScope, options: {
136
+ plan: string[];
137
+ intro?: string[];
138
+ default?: string;
139
+ currency?: string;
140
+ funnelId?: string;
141
+ }) => Promise<{
142
+ funnelId: string;
143
+ offerSetId: string;
144
+ }>;
134
145
  export declare const formatSetupDomain: ({ funnelId, domain }: Awaited<ReturnType<typeof assignSetupDomain>>) => string;
135
146
  export {};
@@ -184,6 +184,52 @@ export const assignSetupDomain = async (scope, domain, options) => {
184
184
  throw new Error(`FunnelsGrove did not return ${hostname} after assigning it.`);
185
185
  return { funnelId, domain: assigned };
186
186
  };
187
+ const parseIntervalAmount = (value, flag, periods) => {
188
+ const match = (periods ? /^(week|month|year)=(\d+(?:\.\d+)?)(?:\/(\d+))?$/ : /^(week|month|year)=(\d+(?:\.\d+)?)$/).exec(value);
189
+ if (!match)
190
+ throw new Error(`Invalid ${flag} "${value}"; use month=${periods ? '14.99 or month=14.99/3' : '29.99'}.`);
191
+ return { interval: match[1], amount: Number(match[2]), periods: Number(match[3] || 1) };
192
+ };
193
+ /** ONB-BR-042: the console's "Choose your prices"; the Offer Set becomes the funnel's default at once. */
194
+ export const saveSetupPrices = async (scope, options) => {
195
+ if (options.plan.length === 0)
196
+ throw new Error('Pass at least one --plan, for example --plan month=29.99.');
197
+ const currency = (options.currency || 'usd').toLowerCase();
198
+ if (!/^[a-z]{3}$/.test(currency))
199
+ throw new Error('--currency must be an ISO currency code.');
200
+ const digits = new Intl.NumberFormat('en', { style: 'currency', currency }).resolvedOptions().maximumFractionDigits ?? 2;
201
+ const plans = options.plan.map((value) => parseIntervalAmount(value, '--plan', false));
202
+ if (new Set(plans.map(({ interval }) => interval)).size !== plans.length)
203
+ throw new Error('Each period can have one price.');
204
+ const intros = new Map((options.intro || []).map((value) => {
205
+ const intro = parseIntervalAmount(value, '--intro', true);
206
+ if (!plans.some(({ interval }) => interval === intro.interval))
207
+ throw new Error(`--intro ${intro.interval} needs a --plan ${intro.interval}.`);
208
+ return [intro.interval, { amount: intro.amount, periods: intro.periods }];
209
+ }));
210
+ const defaultInterval = options.default || plans[0].interval;
211
+ if (!plans.some(({ interval }) => interval === defaultInterval))
212
+ throw new Error('--default must be the period of a listed --plan.');
213
+ const funnelId = options.funnelId || (await readSetupGuide(scope)).selectedFunnelId;
214
+ if (!funnelId)
215
+ throw new Error('Create your funnel first, then run fgrove setup prices again.');
216
+ const { offerSetId } = await scope.callApi({
217
+ path: 'onboarding.savePrices',
218
+ type: 'mutation',
219
+ token: scope.token,
220
+ data: {
221
+ ...projectScope(scope),
222
+ funnelId,
223
+ plans: plans.map(({ interval, amount }) => ({
224
+ interval,
225
+ isDefault: interval === defaultInterval,
226
+ price: { kind: 'create', amountMinor: Math.round(amount * 10 ** digits), currency },
227
+ intro: intros.get(interval) || null,
228
+ })),
229
+ },
230
+ });
231
+ return { funnelId, offerSetId };
232
+ };
187
233
  export const formatSetupDomain = ({ funnelId, domain }) => {
188
234
  const records = [
189
235
  ...(domain.cnameTarget ? [`CNAME\t${domain.domain}\t${domain.cnameTarget}`] : []),
@@ -99,7 +99,7 @@ export declare const writeSupportWorkflow: (dir: string, workflow: SupportWorkfl
99
99
  }>;
100
100
  export declare const formatSupportWorkflowLoaded: (project: SupportProject, workflow: SupportWorkflow, entryPath: string, previous?: LoadedVersions | null) => string[];
101
101
  /** The support folder's CLAUDE.md: the same for every agent, reviewed with the CLI, never edited per project. */
102
- export declare const SUPPORT_FOLDER_INSTRUCTIONS = "# FunnelsGrove support folder\n\nThis folder is for working FunnelsGrove Support Tickets with the `fgrove support` CLI. Each project has its own Support Workflow, which `fgrove` writes to `fgrove-support/<project-id>/`.\n\nWhen the person asks to work, check or decide support tickets, in any wording or language, or a task prompt starts with `Support Routine run`, `Support decisions tick` or `Support loop tick`:\n\n1. `fgrove support projects` lists the projects you may work and whether support is on for each.\n2. Work the projects the person or the prompt names; otherwise every project with support on, one at a time.\n3. For each project, run `fgrove support workflow --project <id> --out <this folder's absolute path>/fgrove-support/<id>` (from any folder), read the WORKFLOW.md it names in full, and follow it for that project's tickets only.\n4. Finish one project before loading the next. Never apply one project's workflow to another project's ticket. A ticket that is clearly about another product of the same organization moves there with `fgrove support assign-project TCK-N --project <id>`; load that project's workflow before working it.\n\nUnassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: `fgrove support queue --take 5` without `--project`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and `fgrove support billing --project <id> --email <customer> --json` finds the customer there. Then run `fgrove support assign-project TCK-N --project <id>` and follow that project's workflow. Otherwise escalate it with the note \"Project unclear:\" and the candidates and evidence. Never reply to an Unassigned Ticket.\n\n## Support every hour\n\nWhen the person asks to keep support running (every hour, a loop), set up two things, each named in the person's language so they see what it is:\n\n1. **The automatic queue**, a Claude Desktop scheduled task (the scheduled-tasks tool): taskId `fgrove-support-queue`, a title meaning \"Support: automatic queue\" (in Russian: \"\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430: \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0439 \u0440\u0430\u0437\u0431\u043E\u0440\"), hourly at a minute other than :00 and :30, `notifyOnCompletion` false, and the prompt `Support Routine run. Talk to me in <the person's language>. Work the support queue of every project in my Support Access that has support on: read <this folder's absolute path>/CLAUDE.md and follow it. Nobody is present to answer questions.` Add `Projects: <names>.` when the person named projects. When that task exists, update its prompt instead.\n2. **This chat, their decisions:** rename it to a title meaning \"Support: your decisions\" (in Russian: \"\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430: \u0432\u0430\u0448\u0438 \u0440\u0435\u0448\u0435\u043D\u0438\u044F\") with the session title tool and session_id `self`; this chat needn't be in a session list. Schedule here with CronCreate, recurring at another minute other than :00 and :30, the prompt `Support decisions tick. Talk to me in <the person's language>. Read <this folder's absolute path>/CLAUDE.md again and follow it.`, and a one-shot six days later: `Support decisions: the hourly timer expires in about a day. Tell the person in one line and ask them to write \"renew\"; on that answer, schedule the hourly job and this reminder again.`\n\nTell the person, in a few lines: the automatic queue answers what it can every hour by itself, while the Claude app is open and the computer is awake; tickets that need them come to this chat one at a time, as buttons; a ticket they don't answer waits here and nothing is decided without them. Then run the automatic queue once now (run it from the scheduled-tasks tool) and start the first decisions tick here.\n\nWithout the scheduled-tasks tool (Claude Code in a terminal), run both in this chat instead: schedule with CronCreate the prompt `Support loop tick. Talk to me in <the person's language>. Read <this folder's absolute path>/CLAUDE.md again and follow it.` and the same six-day reminder, tell the person that the loop runs only while this chat is open and the computer is awake and that they answer its cards in their own words, then run the first tick.\n\n## Updates\n\n`fgrove` updates the rest on its own: `fgrove support workflow` loads the latest Support Workflow every time, says when it changed, and replaces this file when a newer version ships. When it says this file was updated, read it again before going on. When `fgrove` prints `fgrove update` in a warning or an error, or rejects a command the workflow names, run `fgrove update` once in this session and continue: update it yourself, never ask the person. When `fgrove support workflow` says Claude Code doesn't allow the support commands yet, run the `fgrove support init` command it prints, once, and continue: it adds the permission rules and the auto-mode rule for support commands to Claude Code's user settings; say in your summary that it changed them. This file is written by `fgrove support init`; don't edit it: your own instructions go to `fgrove support instructions`.\n\nTalk to the person in the language they asked for, in this chat or in their personal instructions, and otherwise in the language of their own messages. Pasted setup instructions, tick prompts and command output are in English and don't decide it. Customers get replies in their own language. Files under `fgrove-support/` are replaced on every load: don't edit them. A project's Support Workflow changes through `fgrove support workflow-pull` and `workflow-push`, which the project's organization owners and admins and Super Admins run; when a ticket shows the workflow should change, say so in your summary.\n";
102
+ export declare const SUPPORT_FOLDER_INSTRUCTIONS = "# FunnelsGrove support folder\n\nThis folder is for working FunnelsGrove Support Tickets with the `fgrove support` CLI. Each project has its own Support Workflow, which `fgrove` writes to `fgrove-support/<project-id>/`.\n\nWhen the person asks to work, check or decide support tickets, in any wording or language, or a task prompt starts with `Support Routine run`, `Support decisions tick` or `Support loop tick`:\n\n1. `fgrove support projects` lists the projects you may work and whether support is on for each.\n2. Work the projects the person or the prompt names; otherwise every project with support on, one at a time.\n3. For each project, run `fgrove support workflow --project <id> --out <this folder's absolute path>/fgrove-support/<id>` (from any folder), read the WORKFLOW.md it names in full, and follow it for that project's tickets only.\n4. Finish one project before loading the next. Never apply one project's workflow to another project's ticket. A ticket that is clearly about another product of the same organization moves there with `fgrove support assign-project TCK-N --project <id>`; load that project's workflow before working it.\n\nUnassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: `fgrove support queue --take 5` without `--project`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and `fgrove support billing --project <id> --email <customer> --json` finds the customer there. Then run `fgrove support assign-project TCK-N --project <id>` and follow that project's workflow. Otherwise escalate it with the note \"Project unclear:\" and the candidates and evidence. Never reply to an Unassigned Ticket. Close one only when no person wrote it: an automatic notice from a service, a newsletter or spam. Run `fgrove support close TCK-N --note \"<what it is and who sent it>\"`; the note is required. Anything a person wrote stays open, even about a product none of your projects covers: escalate it.\n\n## Support every hour\n\nWhen the person asks to keep support running (every hour, a loop), set up two things, each named in the person's language so they see what it is:\n\n1. **The automatic queue**, a Claude Desktop scheduled task (the scheduled-tasks tool): taskId `fgrove-support-queue`, a title meaning \"Support: automatic queue\" (in Russian: \"\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430: \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0439 \u0440\u0430\u0437\u0431\u043E\u0440\"), hourly at a minute other than :00 and :30, `notifyOnCompletion` false, and the prompt `Support Routine run. Talk to me in <the person's language>. Work the support queue of every project in my Support Access that has support on: read <this folder's absolute path>/CLAUDE.md and follow it. Nobody is present to answer questions.` Add `Projects: <names>.` when the person named projects. When that task exists, update its prompt instead.\n2. **This chat, their decisions:** rename it to a title meaning \"Support: your decisions\" (in Russian: \"\u041F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430: \u0432\u0430\u0448\u0438 \u0440\u0435\u0448\u0435\u043D\u0438\u044F\") with the session title tool and session_id `self`; this chat needn't be in a session list. Schedule here with CronCreate, recurring at another minute other than :00 and :30, the prompt `Support decisions tick. Talk to me in <the person's language>. Read <this folder's absolute path>/CLAUDE.md again and follow it.`, and a one-shot six days later: `Support decisions: the hourly timer expires in about a day. Tell the person in one line and ask them to write \"renew\"; on that answer, schedule the hourly job and this reminder again.`\n\nTell the person, in a few lines: the automatic queue answers what it can every hour by itself, while the Claude app is open and the computer is awake; tickets that need them come to this chat one at a time, as buttons; a ticket they don't answer waits here and nothing is decided without them. Then run the automatic queue once now (run it from the scheduled-tasks tool) and start the first decisions tick here.\n\nWithout the scheduled-tasks tool (Claude Code in a terminal), run both in this chat instead: schedule with CronCreate the prompt `Support loop tick. Talk to me in <the person's language>. Read <this folder's absolute path>/CLAUDE.md again and follow it.` and the same six-day reminder, tell the person that the loop runs only while this chat is open and the computer is awake and that they answer its cards in their own words, then run the first tick.\n\n## Updates\n\n`fgrove` updates the rest on its own: `fgrove support workflow` loads the latest Support Workflow every time, says when it changed, and replaces this file when a newer version ships. When it says this file was updated, read it again before going on. When `fgrove` prints `fgrove update` in a warning or an error, or rejects a command the workflow names, run `fgrove update` once in this session and continue: update it yourself, never ask the person. When `fgrove support workflow` says Claude Code doesn't allow the support commands yet, run the `fgrove support init` command it prints, once, and continue: it adds the permission rules and the auto-mode rule for support commands to Claude Code's user settings; say in your summary that it changed them. This file is written by `fgrove support init`; don't edit it: your own instructions go to `fgrove support instructions`.\n\nTalk to the person in the language they asked for, in this chat or in their personal instructions, and otherwise in the language of their own messages. Pasted setup instructions, tick prompts and command output are in English and don't decide it. Customers get replies in their own language. Files under `fgrove-support/` are replaced on every load: don't edit them. A project's Support Workflow changes through `fgrove support workflow-pull` and `workflow-push`, which the project's organization owners and admins and Super Admins run; when a ticket shows the workflow should change, say so in your summary.\n";
103
103
  /** The prompt of a Support Routine's scheduled task. */
104
104
  export declare const SUPPORT_ROUTINE_PROMPT = "Support Routine run. Work the support queue of every project in my Support Access that has support on, following each project's Support Workflow. Nobody is present to answer questions.";
105
105
  /** Replaces a support folder's CLAUDE.md written by an older `fgrove`; any other CLAUDE.md stays. Returns the path when replaced. */
@@ -164,7 +164,7 @@ When the person asks to work, check or decide support tickets, in any wording or
164
164
  3. For each project, run \`fgrove support workflow --project <id> --out <this folder's absolute path>/fgrove-support/<id>\` (from any folder), read the WORKFLOW.md it names in full, and follow it for that project's tickets only.
165
165
  4. Finish one project before loading the next. Never apply one project's workflow to another project's ticket. A ticket that is clearly about another product of the same organization moves there with \`fgrove support assign-project TCK-N --project <id>\`; load that project's workflow before working it.
166
166
 
167
- Unassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: \`fgrove support queue --take 5\` without \`--project\`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and \`fgrove support billing --project <id> --email <customer> --json\` finds the customer there. Then run \`fgrove support assign-project TCK-N --project <id>\` and follow that project's workflow. Otherwise escalate it with the note "Project unclear:" and the candidates and evidence. Never reply to an Unassigned Ticket.
167
+ Unassigned Tickets have no project and so no workflow. Work them only when the person or the prompt asks: \`fgrove support queue --take 5\` without \`--project\`. A ticket that has a project: load its workflow first (step 3). An Unassigned one: assign it only when its Support Address alias or the product it names points to exactly one of your projects, and \`fgrove support billing --project <id> --email <customer> --json\` finds the customer there. Then run \`fgrove support assign-project TCK-N --project <id>\` and follow that project's workflow. Otherwise escalate it with the note "Project unclear:" and the candidates and evidence. Never reply to an Unassigned Ticket. Close one only when no person wrote it: an automatic notice from a service, a newsletter or spam. Run \`fgrove support close TCK-N --note "<what it is and who sent it>"\`; the note is required. Anything a person wrote stays open, even about a product none of your projects covers: escalate it.
168
168
 
169
169
  ## Support every hour
170
170
 
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.394",
7
+ "repositoryCliVersion": "0.1.398",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.387",
10
+ "bundleVersion": "2.0.391",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "831c1168ae9f1def454e495a92e19974ff8de7b54b8e6665f4f8d427ee1f0154"
48
+ "sha256": "502d91c2c9ca9a3b41b3b46b3e965a5651ec14bde6a5ff4e617df62e873b835b"
49
49
  },
50
50
  {
51
51
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -145,16 +145,16 @@
145
145
  },
146
146
  {
147
147
  "path": "funnel-docs.config.json",
148
- "sha256": "bdedcb98d0fabb5c659eb9105e1b10306bbd3cbee58897c3a05ccda7d2f06fff"
148
+ "sha256": "cbcba371bd3082cd467a40a6dfb11c181ab0a77caaafc6b28d4512ae8fb6770b"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.393",
154
+ "repositoryCliVersion": "0.1.397",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.386",
157
+ "bundleVersion": "2.0.390",
158
158
  "stepContractVersion": 3,
159
159
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
160
160
  "managedFiles": [
@@ -192,7 +192,7 @@
192
192
  },
193
193
  {
194
194
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
195
- "sha256": "7ce50d62b61683fa35a54f61d0ce5b5add484676d6eea75704b24d5e0ffba678"
195
+ "sha256": "31a69ec0c7ed48cba36e7b470f499b3bd484bd78550fd5248ce1efc0af472348"
196
196
  },
197
197
  {
198
198
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -292,16 +292,16 @@
292
292
  },
293
293
  {
294
294
  "path": "funnel-docs.config.json",
295
- "sha256": "b0d2b5fc0cfc06cfbb29f4845b520349cd09bfca5cad8aaa2da463adaf41a9ad"
295
+ "sha256": "75ef0d4be50021d59c15097ee33f467bb30f0862ad11fa5447cf7a9ede50e38a"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.392",
301
+ "repositoryCliVersion": "0.1.396",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.385",
304
+ "bundleVersion": "2.0.389",
305
305
  "stepContractVersion": 3,
306
306
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
307
307
  "managedFiles": [
@@ -339,7 +339,7 @@
339
339
  },
340
340
  {
341
341
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
342
- "sha256": "d5606e76d2e25344d0d67f2443772722ef85c1104416b58ed6433f7a5ce798ba"
342
+ "sha256": "7ab93d7a8f249494fa0c2d7bae90ad9dd58e8f292cdf80662a824efe18cb682d"
343
343
  },
344
344
  {
345
345
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -439,16 +439,16 @@
439
439
  },
440
440
  {
441
441
  "path": "funnel-docs.config.json",
442
- "sha256": "dd341d481aff2f0fe7431b8747fb11325f8cfba1b9f1cc77659fbcc481f6c86f"
442
+ "sha256": "e305826722a12102979fbd7dec46471875f09f8397cb97917109f090f505443f"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.391",
448
+ "repositoryCliVersion": "0.1.395",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.384",
451
+ "bundleVersion": "2.0.388",
452
452
  "stepContractVersion": 3,
453
453
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
454
454
  "managedFiles": [
@@ -486,7 +486,7 @@
486
486
  },
487
487
  {
488
488
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
489
- "sha256": "ecb816a88f07dc802885f0f0ac6120c48d56990af6ec55e71cf8907c581cde82"
489
+ "sha256": "d1eddcd89db6e20b6a054dbe8c43282fd9b0c4988e1e01f05c4a7c69081e1093"
490
490
  },
491
491
  {
492
492
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -586,16 +586,16 @@
586
586
  },
587
587
  {
588
588
  "path": "funnel-docs.config.json",
589
- "sha256": "f49123bec51ad0d6c17aaefc49c8f1b94958763ae52625360477de39ab9df091"
589
+ "sha256": "bef986565046d4615b543a21cbe7e0de64567ee3a777a385a0a7072b94c55b5d"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.390",
595
+ "repositoryCliVersion": "0.1.394",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.383",
598
+ "bundleVersion": "2.0.387",
599
599
  "stepContractVersion": 3,
600
600
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
601
601
  "managedFiles": [
@@ -633,7 +633,7 @@
633
633
  },
634
634
  {
635
635
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
636
- "sha256": "f48822c5e06a270bc43e7f3608a86ec2ad091267ffc672f45c52bf7d4cc6ae1f"
636
+ "sha256": "831c1168ae9f1def454e495a92e19974ff8de7b54b8e6665f4f8d427ee1f0154"
637
637
  },
638
638
  {
639
639
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -733,16 +733,16 @@
733
733
  },
734
734
  {
735
735
  "path": "funnel-docs.config.json",
736
- "sha256": "7193d345b5cfce4343a0de55a6a4457941c2c9c0b1ad9e6c7ebcf0dd613ba275"
736
+ "sha256": "bdedcb98d0fabb5c659eb9105e1b10306bbd3cbee58897c3a05ccda7d2f06fff"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.389",
742
+ "repositoryCliVersion": "0.1.393",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.382",
745
+ "bundleVersion": "2.0.386",
746
746
  "stepContractVersion": 3,
747
747
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
748
748
  "managedFiles": [
@@ -780,7 +780,7 @@
780
780
  },
781
781
  {
782
782
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
783
- "sha256": "5bee507543f9e8b4bfe33f85be213b63cf9d00f0028d3561fe6dfd42b9e99205"
783
+ "sha256": "7ce50d62b61683fa35a54f61d0ce5b5add484676d6eea75704b24d5e0ffba678"
784
784
  },
785
785
  {
786
786
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -880,16 +880,16 @@
880
880
  },
881
881
  {
882
882
  "path": "funnel-docs.config.json",
883
- "sha256": "42889ded15fee14db792363bfe7bdd5e6084486f5d69912e81fa965b1ddaee19"
883
+ "sha256": "b0d2b5fc0cfc06cfbb29f4845b520349cd09bfca5cad8aaa2da463adaf41a9ad"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.388",
889
+ "repositoryCliVersion": "0.1.392",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.381",
892
+ "bundleVersion": "2.0.385",
893
893
  "stepContractVersion": 3,
894
894
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
895
895
  "managedFiles": [
@@ -927,7 +927,7 @@
927
927
  },
928
928
  {
929
929
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
930
- "sha256": "bfb57e2f162ac699af453849b607c5f76e29b5b8d2a1d8137a40e67cb901f626"
930
+ "sha256": "d5606e76d2e25344d0d67f2443772722ef85c1104416b58ed6433f7a5ce798ba"
931
931
  },
932
932
  {
933
933
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -1027,7 +1027,7 @@
1027
1027
  },
1028
1028
  {
1029
1029
  "path": "funnel-docs.config.json",
1030
- "sha256": "e644eb7e5bfa6cbba595b8971efd26edc213cfccac95f0ae5478ee261fec4869"
1030
+ "sha256": "dd341d481aff2f0fe7431b8747fb11325f8cfba1b9f1cc77659fbcc481f6c86f"
1031
1031
  }
1032
1032
  ]
1033
1033
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/cli",
3
- "version": "0.1.394",
3
+ "version": "0.1.398",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.387",
3
+ "bundleVersion": "2.0.391",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "831c1168ae9f1def454e495a92e19974ff8de7b54b8e6665f4f8d427ee1f0154"
41
+ "sha256": "502d91c2c9ca9a3b41b3b46b3e965a5651ec14bde6a5ff4e617df62e873b835b"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "bdedcb98d0fabb5c659eb9105e1b10306bbd3cbee58897c3a05ccda7d2f06fff"
141
+ "sha256": "cbcba371bd3082cd467a40a6dfb11c181ab0a77caaafc6b28d4512ae8fb6770b"
142
142
  }
143
143
  ]
144
144
  }
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/sdk` `0.5.0` first, then `@funnelsgrove/runtime` `0.49.0`, then `@funnelsgrove/analytics` `0.32.0`, then `@funnelsgrove/payments` `0.79.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.394`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/sdk` `0.5.0` first, then `@funnelsgrove/runtime` `0.49.0`, then `@funnelsgrove/analytics` `0.32.0`, then `@funnelsgrove/payments` `0.80.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.398`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.387",
3
+ "bundleVersion": "2.0.391",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.387",
3
+ "bundleVersion": "2.0.391",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "831c1168ae9f1def454e495a92e19974ff8de7b54b8e6665f4f8d427ee1f0154"
41
+ "sha256": "502d91c2c9ca9a3b41b3b46b3e965a5651ec14bde6a5ff4e617df62e873b835b"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "bdedcb98d0fabb5c659eb9105e1b10306bbd3cbee58897c3a05ccda7d2f06fff"
141
+ "sha256": "cbcba371bd3082cd467a40a6dfb11c181ab0a77caaafc6b28d4512ae8fb6770b"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "cbb46a951421bf29ecb4a9ea26c85229b6c0c0ff85d70fa1a6726ac8ed000114",
3
+ "sourceTreeHash": "3579a9b174411cc83f237e3f2dd1e7fccc3402d1aee699f2f5e13e87d6fee666",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.387",
5
+ "docsBundleVersion": "2.0.391",
6
6
  "files": [
7
7
  {
8
8
  "path": ".env.example",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  {
18
18
  "path": ".funnelsgrove-docs.json",
19
- "sha256": "954cd53a04741dea087d3106c18b0bb2940c79b5a809f175f1d230c86c83bb54",
19
+ "sha256": "0a0672b5c47df989063c86b32c9ef1bf5f7755ac7e2e4b159cc4920dc391b5bd",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -76,7 +76,7 @@
76
76
  },
77
77
  {
78
78
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
79
- "sha256": "831c1168ae9f1def454e495a92e19974ff8de7b54b8e6665f4f8d427ee1f0154",
79
+ "sha256": "502d91c2c9ca9a3b41b3b46b3e965a5651ec14bde6a5ff4e617df62e873b835b",
80
80
  "mode": "100644"
81
81
  },
82
82
  {
@@ -206,7 +206,7 @@
206
206
  },
207
207
  {
208
208
  "path": "funnel-docs.config.json",
209
- "sha256": "bdedcb98d0fabb5c659eb9105e1b10306bbd3cbee58897c3a05ccda7d2f06fff",
209
+ "sha256": "cbcba371bd3082cd467a40a6dfb11c181ab0a77caaafc6b28d4512ae8fb6770b",
210
210
  "mode": "100644"
211
211
  },
212
212
  {
@@ -216,7 +216,7 @@
216
216
  },
217
217
  {
218
218
  "path": "funnel.runtime-capabilities.json",
219
- "sha256": "50024a9d997506468094a938db5b34ed8d4c6d27e44de76b3417363c51b2c042",
219
+ "sha256": "190b64b86782bb5e9cfed0ef66688ef14310182f8a8a64e58bc08aef76f19bf8",
220
220
  "mode": "100644"
221
221
  },
222
222
  {
@@ -531,7 +531,7 @@
531
531
  },
532
532
  {
533
533
  "path": "src/steps/step-32-paywall.tsx",
534
- "sha256": "fc7b4eeddc91a832ced8e4d73e8e30a024b2cb51a6b9d80b8c3cad5f0ab05712",
534
+ "sha256": "234af980716f9092ccf1557ca04ad2ec53c35f7b1fbde67329b4e562f552ab5b",
535
535
  "mode": "100644"
536
536
  },
537
537
  {
@@ -17,7 +17,7 @@ Supported read versions: `1`, `2`, `3`. Authoring and publish target version `3`
17
17
 
18
18
  ### Package release order
19
19
 
20
- Release `@funnelsgrove/sdk` `0.5.0` first, then `@funnelsgrove/runtime` `0.49.0`, then `@funnelsgrove/analytics` `0.32.0`, then `@funnelsgrove/payments` `0.79.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.394`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/sdk` `0.5.0` first, then `@funnelsgrove/runtime` `0.49.0`, then `@funnelsgrove/analytics` `0.32.0`, then `@funnelsgrove/payments` `0.80.0`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.398`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.387",
3
+ "bundleVersion": "2.0.391",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "moneyContractVersion": 1,
3
3
  "localeContractVersion": 1,
4
- "paypalCheckoutVersion": 1
4
+ "paypalCheckoutVersion": 1,
5
+ "paddleCheckoutVersion": 1
5
6
  }
@@ -36,6 +36,9 @@ import {
36
36
  PayPalCheckout,
37
37
  PayPalCheckoutDialog,
38
38
  readPendingPayPalCheckout,
39
+ PaddleCheckout,
40
+ PaddleCheckoutDialog,
41
+ readPendingPaddleCheckout,
39
42
  SharedStripeCheckoutV2Dialog,
40
43
  StripeSubscriptionWalletSurface,
41
44
  activateSecondPaywallDiscount,
@@ -182,7 +185,7 @@ function StepPaywallRuntime({
182
185
  activeBillingRuntime.sourceVersionId,
183
186
  ]);
184
187
  const activeBillingDiscounts = useMemo(
185
- () => activeBillingRuntime.provider === 'paypal' ? inactiveBillingDiscounts : activeBillingRuntime.discounts ?? (
188
+ () => activeBillingRuntime.provider === 'paypal' || activeBillingRuntime.provider === 'paddle' ? inactiveBillingDiscounts : activeBillingRuntime.discounts ?? (
186
189
  activeBillingRuntime.provider === 'stripe'
187
190
  ? buildBillingDiscountCatalog(billingDiscountList)
188
191
  : inactiveBillingDiscounts
@@ -225,11 +228,17 @@ function StepPaywallRuntime({
225
228
  );
226
229
  const pendingPayPal = readPendingPayPalCheckout({ environment: checkoutMode, funnelEndUserId: user.id, runtimeConfig: activeCheckoutRuntimeConfig });
227
230
  const hasPendingPayPal = Boolean(pendingPayPal);
228
- const selectedPlanId = pendingPayPal
229
- ? availablePlans.find(plan => plan.funnelPlanKey === pendingPayPal.funnelPlanKey)?.id ?? null
231
+ // A paid Paddle checkout awaiting server confirmation keeps its plan, like a pending PayPal approval.
232
+ const pendingPaddle = readPendingPaddleCheckout({ environment: checkoutMode, funnelEndUserId: user.id, runtimeConfig: activeCheckoutRuntimeConfig });
233
+ const hasPendingPaddle = Boolean(pendingPaddle);
234
+ const pendingPlanKey = pendingPayPal?.funnelPlanKey || pendingPaddle?.funnelPlanKey;
235
+ const selectedPlanId = pendingPlanKey
236
+ ? availablePlans.find(plan => plan.funnelPlanKey === pendingPlanKey)?.id ?? null
230
237
  : requestedPlanId;
231
- const [checkoutDialogOpen, setCheckoutDialogOpen] = useState(Boolean(pendingPayPal));
238
+ const [checkoutDialogOpen, setCheckoutDialogOpen] = useState(Boolean(pendingPlanKey));
232
239
  const [paypalPending, setPayPalPending] = useState(false);
240
+ const [paddlePending, setPaddlePending] = useState(false);
241
+ const nativeCheckoutPending = hasPendingPayPal || paypalPending || hasPendingPaddle || paddlePending;
233
242
  const [solidgateAttemptKey, setSolidgateAttemptKey] = useState<string | null>(null);
234
243
  const [specialOfferDialogOpen, setSpecialOfferDialogOpen] = useState(() => {
235
244
  if (typeof window === 'undefined') {
@@ -297,6 +306,8 @@ function StepPaywallRuntime({
297
306
  selectedDisplayPlan?.checkoutSummaryLabel?.trim() || selectedDisplayPlan?.title || content.selectedPlanLabel;
298
307
  const checkoutProvider = activeBillingRuntime.provider;
299
308
  const paypalOption = pendingPayPal?.option || (selectedPlan?.funnelPlanKey ? activeBillingRuntime.paypalOptionsByPlanKey?.[selectedPlan.funnelPlanKey] : null);
309
+ // Paddle is the only checkout of a Paddle-owned Offer Set, never an alternative next to Stripe.
310
+ const paddleOption = pendingPaddle?.option || (checkoutProvider === 'paddle' && selectedPlan?.funnelPlanKey ? activeBillingRuntime.paddleOptionsByPlanKey?.[selectedPlan.funnelPlanKey] : null);
300
311
  const storyOptions = useMemo<readonly StoryOption[]>(
301
312
  () =>
302
313
  content.stories.items.map((item, index) => ({
@@ -493,10 +504,11 @@ function StepPaywallRuntime({
493
504
  && activeBillingRuntime.offerSetId.trim()
494
505
  && selectedPlan?.funnelPlanKey?.trim(),
495
506
  );
496
- const checkoutDisabled = Boolean(pendingPayPal) || paypalPending || !checkoutSelectionReady || !userBootstrapped || !selectedPlan || !selectedDisplayPlan || (
507
+ const checkoutDisabled = nativeCheckoutPending || !checkoutSelectionReady || !userBootstrapped || !selectedPlan || !selectedDisplayPlan || (
497
508
  checkoutProvider === 'solidgate'
498
509
  ? !solidgateCheckoutConfigured
499
- : checkoutProvider === 'paypal' ? !paypalOption : !checkoutSession.configured
510
+ : checkoutProvider === 'paypal' ? !paypalOption
511
+ : checkoutProvider === 'paddle' ? !paddleOption : !checkoutSession.configured
500
512
  );
501
513
  const checkoutDialogReady =
502
514
  checkoutProvider === 'stripe' &&
@@ -554,10 +566,10 @@ function StepPaywallRuntime({
554
566
  }, [user.email]);
555
567
 
556
568
  useEffect(() => {
557
- setCheckoutDialogOpen(hasPendingPayPal);
569
+ setCheckoutDialogOpen(hasPendingPayPal || hasPendingPaddle);
558
570
  setSolidgateAttemptKey(null);
559
571
  setError(null);
560
- }, [selectedPlanId, hasPendingPayPal]);
572
+ }, [selectedPlanId, hasPendingPayPal, hasPendingPaddle]);
561
573
 
562
574
  useEffect(() => {
563
575
  if (
@@ -648,7 +660,7 @@ function StepPaywallRuntime({
648
660
  paywallWalletMethodWrapperClassNames[method];
649
661
 
650
662
  const startCheckout = async () => {
651
- if (pendingPayPal || paypalPending) { setCheckoutDialogOpen(true); return; }
663
+ if (nativeCheckoutPending) { setCheckoutDialogOpen(true); return; }
652
664
  if (checkoutDisabled) {
653
665
  return;
654
666
  }
@@ -660,6 +672,13 @@ function StepPaywallRuntime({
660
672
 
661
673
  if (checkoutProvider === 'paypal') { setCheckoutDialogOpen(true); return; }
662
674
 
675
+ if (checkoutProvider === 'paddle') {
676
+ // Mounting the checkout prepares the attempt, so the published snapshot is pinned first.
677
+ billingSelection.pin();
678
+ setCheckoutDialogOpen(true);
679
+ return;
680
+ }
681
+
663
682
  if (checkoutProvider === 'solidgate') {
664
683
  setSolidgateAttemptKey(crypto.randomUUID());
665
684
  setCheckoutDialogOpen(true);
@@ -702,7 +721,7 @@ function StepPaywallRuntime({
702
721
  };
703
722
 
704
723
  const openCardCheckoutFromUnavailableWallet = async () => {
705
- if (pendingPayPal || paypalPending) { setCheckoutDialogOpen(true); return; }
724
+ if (nativeCheckoutPending) { setCheckoutDialogOpen(true); return; }
706
725
  if (checkoutDisabled) {
707
726
  return;
708
727
  }
@@ -794,6 +813,31 @@ function StepPaywallRuntime({
794
813
  />
795
814
  ) : undefined;
796
815
 
816
+ const closePaddleCheckout = () => {
817
+ if (!paddlePending && !pendingPaddle) billingSelection.reset();
818
+ setCheckoutDialogOpen(false);
819
+ };
820
+
821
+ const paddleCheckout = (checkoutSelectionReady || pendingPaddle) && userBootstrapped && paddleOption && (selectedPlan?.funnelPlanKey || pendingPaddle) ? (
822
+ <PaddleCheckout
823
+ key={`${paddleOption.paymentProfileId}:${paddleOption.providerPlanId}:${checkoutMode}:${pendingPaddle?.funnelPlanKey || selectedPlan?.funnelPlanKey}`}
824
+ option={paddleOption}
825
+ environment={checkoutMode}
826
+ funnelEndUserId={user.id}
827
+ offerSetId={pendingPaddle?.offerSetId || activeBillingRuntime.offerSetId}
828
+ funnelPlanKey={pendingPaddle?.funnelPlanKey || selectedPlan?.funnelPlanKey || ''}
829
+ checkoutType={selectedPlan && !selectedPlan.billingInterval ? 'one_time' : 'subscription'}
830
+ runtimeConfig={activeCheckoutRuntimeConfig}
831
+ customerEmail={checkoutEmail || user.email}
832
+ onPendingChange={setPaddlePending}
833
+ onClose={closePaddleCheckout}
834
+ onSuccess={() => {
835
+ completeStep(analyticsStepId, { planId: selectedDisplayPlan?.id ?? pendingPaddle?.funnelPlanKey });
836
+ goNext();
837
+ }}
838
+ />
839
+ ) : undefined;
840
+
797
841
  const closeCheckoutDialog = () => {
798
842
  if (checkoutProvider === 'stripe') checkoutSession.reset();
799
843
  else billingSelection.reset();
@@ -948,6 +992,11 @@ function StepPaywallRuntime({
948
992
  onClose={() => setCheckoutDialogOpen(false)}>{paypalCheckout}</PayPalCheckoutDialog>
949
993
  ) : null}
950
994
 
995
+ {checkoutDialogOpen && paddleCheckout ? (
996
+ <PaddleCheckoutDialog title={content.checkout.title} closeAriaLabel={content.checkout.closeAriaLabel}
997
+ onClose={closePaddleCheckout}>{paddleCheckout}</PaddleCheckoutDialog>
998
+ ) : null}
999
+
951
1000
  {checkoutDialogOpen &&
952
1001
  checkoutProvider === 'stripe' &&
953
1002
  checkoutSession.activeClientSecret &&
@@ -1005,7 +1054,7 @@ function StepPaywallRuntime({
1005
1054
  />
1006
1055
  ) : null}
1007
1056
 
1008
- {specialOfferDialogOpen ? (
1057
+ {specialOfferDialogOpen && checkoutProvider !== 'paddle' ? (
1009
1058
  <SharedCheckoutSpecialOfferDialog
1010
1059
  buttonColor='var(--color-secondary-text)'
1011
1060
  buttonLabel={content.checkout.specialOffer.buttonLabel}
@@ -1147,7 +1196,7 @@ function StepPaywallRuntime({
1147
1196
  ]
1148
1197
  .filter(Boolean)
1149
1198
  .join(' ')}
1150
- disabled={paypalPending || Boolean(pendingPayPal)}
1199
+ disabled={nativeCheckoutPending}
1151
1200
  onClick={() => setSelectedPlanId(plan.id)}
1152
1201
  >
1153
1202
  {plan.featuredTag ? <span className='paywall-v2-plan-tag'>{plan.featuredTag}</span> : null}
@@ -1218,11 +1267,11 @@ function StepPaywallRuntime({
1218
1267
  type='button'
1219
1268
  className='paywall-v2-card-button paywall-v2-vibe-cta'
1220
1269
  onClick={() => void startCheckout()}
1221
- disabled={checkoutDisabled && !pendingPayPal && !paypalPending}
1270
+ disabled={checkoutDisabled && !nativeCheckoutPending}
1222
1271
  >
1223
1272
  {content.plans.cardButtonLabel}
1224
1273
  </button>
1225
- {checkoutProvider !== 'paypal' && !pendingPayPal ? (
1274
+ {checkoutProvider !== 'paypal' && checkoutProvider !== 'paddle' && !pendingPayPal && !pendingPaddle ? (
1226
1275
  <div aria-label='Card and wallet billing terms'>
1227
1276
  {paypalOption ? <p className='paywall-v2-alt-meta'>Card and wallet terms</p> : null}
1228
1277
  <PaywallRenewalDisclaimer plan={selectedPlan} hasActiveDiscount={Boolean(activeCouponId)} copy={content.checkout} catalogLabels={content.catalogLabels} />