@funnelsgrove/cli 0.1.78 → 0.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import { buildCommittedSyncManifest, buildDownloadedSyncManifest, buildSourceCan
15
15
  import { mergeTextSourceWithGit } from './sourceRebase.js';
16
16
  import { executeExperimentCreate, formatExperimentCreateSuccess, recoverExperimentCreateTransaction, } from './experimentCreate.js';
17
17
  import { pullEnvFile } from './envSync.js';
18
- import { executeEmailPull, executeEmailPush, executeEmailSequencePublish, executeEmailTemplatePublish, executeEmailValidate, } from './emailCommands.js';
18
+ import { executeEmailPull, executeEmailPush, executeEmailSend, executeEmailSequenceAddStep, executeEmailSequenceCreate, executeEmailSequencePublish, executeEmailSequenceSetActive, executeEmailTemplatePublish, executeEmailValidate, parseEmailVariablesJson, } from './emailCommands.js';
19
19
  import { formatGitHubConnectRows, formatGitHubJobRows, formatGitHubStatusRows, } from './githubOutput.js';
20
20
  import { GitHubSyncTimeoutError, syncGitHubDraftIfConnected, } from './githubSyncFlow.js';
21
21
  import { reskinFunnel } from './reskin.js';
@@ -1707,8 +1707,41 @@ const emailCommand = addExamples(program.command('email').description('Manage pr
1707
1707
  'fgrove email pull',
1708
1708
  'fgrove email validate',
1709
1709
  'fgrove email push',
1710
+ 'fgrove email send --template welcome --to delivered@example.com',
1710
1711
  'fgrove email template publish welcome',
1711
1712
  ]);
1713
+ emailCommand
1714
+ .command('send')
1715
+ .description('Send a published email template with a private project token')
1716
+ .requiredOption('--template <slug>', 'Published email template slug')
1717
+ .requiredOption('--to <email>', 'Recipient email address')
1718
+ .option('--variables <json>', 'Template variables as a JSON object', '{}')
1719
+ .option('--idempotency-key <key>', 'Stable key used to deduplicate retries')
1720
+ .option('--api-url <url>', 'Emails SDK API URL', process.env.FUNNELSGROVE_EMAILS_API_URL || 'https://sdk-api.funnelsgrove.com')
1721
+ .option('--private-token <token>', 'Private project token (defaults to FUNNELSGROVE_PRIVATE_TOKEN)', process.env.FUNNELSGROVE_PRIVATE_TOKEN)
1722
+ .option('--no-wait', 'Return after the email is queued')
1723
+ .option('--timeout-seconds <seconds>', 'Maximum time to wait for delivery', '120')
1724
+ .action(async (options) => {
1725
+ const timeoutSeconds = Number(options.timeoutSeconds);
1726
+ if (!Number.isInteger(timeoutSeconds) || timeoutSeconds <= 0) {
1727
+ throw new Error('--timeout-seconds must be a positive integer.');
1728
+ }
1729
+ const result = await executeEmailSend({
1730
+ apiUrl: options.apiUrl,
1731
+ privateToken: options.privateToken || '',
1732
+ template: options.template,
1733
+ to: options.to,
1734
+ variables: parseEmailVariablesJson(options.variables),
1735
+ idempotencyKey: options.idempotencyKey,
1736
+ wait: options.wait,
1737
+ timeoutMs: timeoutSeconds * 1_000,
1738
+ pollIntervalMs: 2_000,
1739
+ });
1740
+ console.log(JSON.stringify(result, null, 2));
1741
+ if (result.status === 'failed' || result.status === 'unknown') {
1742
+ throw new Error(`Email delivery ${result.id} finished with status ${result.status}.`);
1743
+ }
1744
+ });
1712
1745
  addEmailScopeOptions(emailCommand
1713
1746
  .command('pull')
1714
1747
  .description('Pull project email drafts into local files'))
@@ -1752,6 +1785,63 @@ addEmailScopeOptions(emailTemplateCommand
1752
1785
  console.log(`Published email template ${slug}.`);
1753
1786
  });
1754
1787
  const emailSequenceCommand = emailCommand.command('sequence').description('Manage email sequences');
1788
+ const parseEmailSequenceDelay = (options) => {
1789
+ const hasHours = options.delayHours !== undefined;
1790
+ const hasDays = options.delayDays !== undefined;
1791
+ if (hasHours === hasDays)
1792
+ throw new Error('Provide exactly one of --delay-hours or --delay-days.');
1793
+ const value = Number(hasHours ? options.delayHours : options.delayDays);
1794
+ if (!Number.isInteger(value) || value < 0)
1795
+ throw new Error('Delay must be a non-negative integer.');
1796
+ return value * (hasDays ? 86_400 : 3_600);
1797
+ };
1798
+ addEmailScopeOptions(emailSequenceCommand
1799
+ .command('create <slug>')
1800
+ .description('Create a local email sequence with its first published-template step')
1801
+ .requiredOption('--name <name>', 'Sequence display name')
1802
+ .requiredOption('--template <slug>', 'Published email template slug')
1803
+ .requiredOption('--key <key>', 'Unique first-step key')
1804
+ .option('--trigger <event>', 'Trigger event: email_captured, purchase_completed, or registration_completed', 'email_captured')
1805
+ .option('--funnel-id <uuid>', 'Limit the sequence to one project funnel')
1806
+ .option('--all-funnels', 'Apply the sequence to every funnel in the project')
1807
+ .option('--delay-hours <hours>', 'First-step delay in hours')
1808
+ .option('--delay-days <days>', 'First-step delay in days'))
1809
+ .action(async (slug, options) => {
1810
+ if (Boolean(options.funnelId) === Boolean(options.allFunnels)) {
1811
+ throw new Error('Provide exactly one of --funnel-id or --all-funnels.');
1812
+ }
1813
+ if (!['email_captured', 'purchase_completed', 'registration_completed'].includes(options.trigger)) {
1814
+ throw new Error('--trigger must be email_captured, purchase_completed, or registration_completed.');
1815
+ }
1816
+ await executeEmailSequenceCreate({
1817
+ ...await resolveEmailCommandScope(options),
1818
+ slug,
1819
+ name: options.name,
1820
+ triggerEventType: options.trigger,
1821
+ funnelId: options.funnelId || null,
1822
+ firstStepKey: options.key,
1823
+ templateSlug: options.template,
1824
+ delaySeconds: parseEmailSequenceDelay(options),
1825
+ });
1826
+ console.log(`Created local email sequence ${slug}.`);
1827
+ });
1828
+ addEmailScopeOptions(emailSequenceCommand
1829
+ .command('add-step <slug>')
1830
+ .description('Add a published-template step to a local email sequence')
1831
+ .requiredOption('--key <key>', 'Unique step key')
1832
+ .requiredOption('--template <slug>', 'Published email template slug')
1833
+ .option('--delay-hours <hours>', 'Delay after the previous step in hours')
1834
+ .option('--delay-days <days>', 'Delay after the previous step in days'))
1835
+ .action(async (slug, options) => {
1836
+ await executeEmailSequenceAddStep({
1837
+ ...await resolveEmailCommandScope(options),
1838
+ slug,
1839
+ key: options.key,
1840
+ templateSlug: options.template,
1841
+ delaySeconds: parseEmailSequenceDelay(options),
1842
+ });
1843
+ console.log(`Added email sequence step ${options.key} to ${slug}.`);
1844
+ });
1755
1845
  addEmailScopeOptions(emailSequenceCommand
1756
1846
  .command('publish <slug>')
1757
1847
  .description('Publish one email sequence explicitly'))
@@ -1762,6 +1852,20 @@ addEmailScopeOptions(emailSequenceCommand
1762
1852
  });
1763
1853
  console.log(`Published email sequence ${slug}.`);
1764
1854
  });
1855
+ for (const active of [true, false]) {
1856
+ const action = active ? 'enable' : 'disable';
1857
+ addEmailScopeOptions(emailSequenceCommand
1858
+ .command(`${action} <slug>`)
1859
+ .description(`${active ? 'Enable' : 'Disable'} one published email sequence`))
1860
+ .action(async (slug, options) => {
1861
+ await executeEmailSequenceSetActive({
1862
+ ...await resolveEmailCommandScope(options),
1863
+ slug,
1864
+ active,
1865
+ });
1866
+ console.log(`${active ? 'Enabled' : 'Disabled'} email sequence ${slug}.`);
1867
+ });
1868
+ }
1765
1869
  const projectsCommand = addExamples(program.command('projects').description('Manage projects'), [
1766
1870
  'fgrove projects list',
1767
1871
  'fgrove projects list --workspace acme',
@@ -1,4 +1,4 @@
1
- import { type EmailFilesResult } from './emailFiles.js';
1
+ import { type EmailFilesResult, type EmailEventType } from './emailFiles.js';
2
2
  export type EmailCallApi = <T>(input: {
3
3
  path: string;
4
4
  type: 'query' | 'mutation';
@@ -12,6 +12,32 @@ type EmailCommandScope = {
12
12
  projectId: string;
13
13
  sourceDir: string;
14
14
  };
15
+ export type EmailSendStatus = {
16
+ id: string;
17
+ status: 'queued' | 'sent' | 'failed' | 'unknown';
18
+ terminalReason?: string | null;
19
+ createdAt?: string;
20
+ updatedAt?: string;
21
+ sentAt?: string | null;
22
+ failedAt?: string | null;
23
+ };
24
+ type EmailSendFetch = typeof globalThis.fetch;
25
+ export declare const parseEmailVariablesJson: (value: string) => Record<string, string | number | boolean>;
26
+ export declare function executeEmailSend(input: {
27
+ apiUrl: string;
28
+ privateToken: string;
29
+ template: string;
30
+ to: string;
31
+ variables: Record<string, string | number | boolean>;
32
+ idempotencyKey?: string;
33
+ wait: boolean;
34
+ timeoutMs: number;
35
+ pollIntervalMs: number;
36
+ }, dependencies?: {
37
+ fetchImpl?: EmailSendFetch;
38
+ sleep?: (durationMs: number) => Promise<void>;
39
+ now?: () => number;
40
+ }): Promise<EmailSendStatus>;
15
41
  export declare function executeEmailPull(scope: EmailCommandScope): Promise<{
16
42
  templates: number;
17
43
  sequences: number;
@@ -23,6 +49,25 @@ export declare function executeEmailPush(scope: EmailCommandScope): Promise<{
23
49
  templates: number;
24
50
  sequences: number;
25
51
  }>;
52
+ export declare function executeEmailSequenceAddStep(input: EmailCommandScope & {
53
+ slug: string;
54
+ key: string;
55
+ templateSlug: string;
56
+ delaySeconds: number;
57
+ }): Promise<void>;
58
+ export declare function executeEmailSequenceCreate(input: EmailCommandScope & {
59
+ slug: string;
60
+ name: string;
61
+ triggerEventType: EmailEventType;
62
+ funnelId: string | null;
63
+ firstStepKey: string;
64
+ templateSlug: string;
65
+ delaySeconds: number;
66
+ }): Promise<void>;
67
+ export declare function executeEmailSequenceSetActive(input: EmailCommandScope & {
68
+ slug: string;
69
+ active: boolean;
70
+ }): Promise<void>;
26
71
  export declare function executeEmailTemplatePublish(scope: EmailCommandScope & {
27
72
  slug: string;
28
73
  }): Promise<unknown>;
@@ -1,6 +1,89 @@
1
+ import { randomUUID } from 'node:crypto';
1
2
  import { readEmailFiles, replaceEmailFiles, writeEmailFiles, writeEmailSequenceFile, writeEmailTemplateFile, } from './emailFiles.js';
2
3
  const isRecord = (value) => (typeof value === 'object' && value !== null && !Array.isArray(value));
3
4
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
5
+ const STEP_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
6
+ const TERMINAL_EMAIL_STATUSES = new Set(['sent', 'failed', 'unknown']);
7
+ export const parseEmailVariablesJson = (value) => {
8
+ let parsed;
9
+ try {
10
+ parsed = JSON.parse(value);
11
+ }
12
+ catch {
13
+ throw new Error('--variables must be a JSON object.');
14
+ }
15
+ if (!isRecord(parsed))
16
+ throw new Error('--variables must be a JSON object.');
17
+ if (Object.values(parsed).some((item) => (typeof item !== 'string'
18
+ && typeof item !== 'number'
19
+ && typeof item !== 'boolean'))) {
20
+ throw new Error('--variables must contain only string, number, or boolean values.');
21
+ }
22
+ return parsed;
23
+ };
24
+ const emailApiRequest = async (input) => {
25
+ const response = await input.fetchImpl(`${input.apiUrl.replace(/\/+$/, '')}${input.path}`, {
26
+ method: input.method || 'GET',
27
+ headers: {
28
+ authorization: `Bearer ${input.privateToken}`,
29
+ accept: 'application/json',
30
+ ...(input.body ? { 'content-type': 'application/json' } : {}),
31
+ ...(input.idempotencyKey ? { 'idempotency-key': input.idempotencyKey } : {}),
32
+ },
33
+ ...(input.body ? { body: JSON.stringify(input.body) } : {}),
34
+ });
35
+ const body = await response.json().catch(() => ({}));
36
+ if (!response.ok) {
37
+ const message = isRecord(body) && typeof body.error === 'string'
38
+ ? body.error
39
+ : 'Email API request failed';
40
+ throw new Error(`${message} (HTTP ${response.status})`);
41
+ }
42
+ if (!isRecord(body))
43
+ throw new Error('Email API returned an invalid response.');
44
+ return body;
45
+ };
46
+ const parseEmailSendStatus = (value) => {
47
+ if (typeof value.id !== 'string'
48
+ || !UUID.test(value.id)
49
+ || !['queued', 'sent', 'failed', 'unknown'].includes(String(value.status))) {
50
+ throw new Error('Email API returned an invalid delivery status.');
51
+ }
52
+ return value;
53
+ };
54
+ export async function executeEmailSend(input, dependencies = {}) {
55
+ if (!input.privateToken.trim())
56
+ throw new Error('A private project token is required.');
57
+ const fetchImpl = dependencies.fetchImpl || fetch;
58
+ const sleep = dependencies.sleep || ((durationMs) => new Promise((resolve) => {
59
+ setTimeout(resolve, durationMs);
60
+ }));
61
+ const now = dependencies.now || Date.now;
62
+ const receipt = parseEmailSendStatus(await emailApiRequest({
63
+ apiUrl: input.apiUrl,
64
+ privateToken: input.privateToken,
65
+ path: '/sdk/private/emails/send',
66
+ method: 'POST',
67
+ idempotencyKey: input.idempotencyKey || `email-cli:${randomUUID()}`,
68
+ body: { template: input.template, to: input.to, variables: input.variables },
69
+ fetchImpl,
70
+ }));
71
+ if (!input.wait || TERMINAL_EMAIL_STATUSES.has(receipt.status))
72
+ return receipt;
73
+ const deadline = now() + input.timeoutMs;
74
+ while (now() < deadline) {
75
+ await sleep(Math.min(input.pollIntervalMs, Math.max(0, deadline - now())));
76
+ const status = parseEmailSendStatus(await emailApiRequest({
77
+ apiUrl: input.apiUrl,
78
+ privateToken: input.privateToken,
79
+ path: `/sdk/private/emails/${encodeURIComponent(receipt.id)}`,
80
+ fetchImpl,
81
+ }));
82
+ if (TERMINAL_EMAIL_STATUSES.has(status.status))
83
+ return status;
84
+ }
85
+ throw new Error(`Timed out waiting for email delivery ${receipt.id}.`);
86
+ }
4
87
  const hasDraft = (value) => (isRecord(value) && isRecord(value.draft));
5
88
  const assertRemoteResource = (value, resource) => {
6
89
  if (!isRecord(value)
@@ -211,6 +294,95 @@ export async function executeEmailPush(scope) {
211
294
  });
212
295
  return { templates: files.templates.length, sequences: files.sequences.length };
213
296
  }
297
+ export async function executeEmailSequenceAddStep(input) {
298
+ const files = await readEmailFiles(input.sourceDir);
299
+ assertValidFiles(files);
300
+ const sequence = files.sequences.find((item) => item.slug === input.slug);
301
+ if (!sequence)
302
+ throw new Error(`Email sequence "${input.slug}" was not found locally.`);
303
+ if (sequence.draft.steps.some((step) => step.key === input.key)) {
304
+ throw new Error(`Email sequence step "${input.key}" already exists.`);
305
+ }
306
+ const templateVersionId = await resolvePublishedTemplateVersionId(input, input.templateSlug);
307
+ sequence.draft.steps.push({
308
+ key: input.key,
309
+ delaySeconds: input.delaySeconds,
310
+ templateVersionId,
311
+ });
312
+ await writeEmailSequenceFile(input.sourceDir, sequence);
313
+ }
314
+ const resolvePublishedTemplateVersionId = async (scope, templateSlug) => {
315
+ const templates = await scope.callApi({
316
+ path: 'emailTemplates.list',
317
+ type: 'query',
318
+ token: scope.token,
319
+ data: projectData(scope),
320
+ });
321
+ const template = templates.find((item) => item.slug === templateSlug);
322
+ if (!template?.currentPublishedVersionId) {
323
+ throw new Error(`Published email template "${templateSlug}" was not found.`);
324
+ }
325
+ return template.currentPublishedVersionId;
326
+ };
327
+ export async function executeEmailSequenceCreate(input) {
328
+ const files = await readEmailFiles(input.sourceDir);
329
+ assertValidFiles(files);
330
+ if (files.sequences.some((item) => item.slug === input.slug)) {
331
+ throw new Error(`Email sequence "${input.slug}" already exists locally.`);
332
+ }
333
+ const name = input.name.trim();
334
+ if (!name || name.length > 120)
335
+ throw new Error('Sequence name must be 1 to 120 characters.');
336
+ if (!STEP_KEY.test(input.firstStepKey) || input.firstStepKey.length > 64) {
337
+ throw new Error('Sequence step key must be lowercase kebab-case up to 64 characters.');
338
+ }
339
+ if (!Number.isInteger(input.delaySeconds) || input.delaySeconds < 0 || input.delaySeconds > 7_776_000) {
340
+ throw new Error('Sequence delay must be an integer from 0 to 7776000 seconds.');
341
+ }
342
+ if (input.funnelId !== null && !UUID.test(input.funnelId)) {
343
+ throw new Error('--funnel-id must be a UUID.');
344
+ }
345
+ const templateVersionId = await resolvePublishedTemplateVersionId(input, input.templateSlug);
346
+ await writeEmailSequenceFile(input.sourceDir, {
347
+ id: null,
348
+ slug: input.slug,
349
+ name,
350
+ draft: {
351
+ triggerEventType: input.triggerEventType,
352
+ funnelIds: input.funnelId === null ? [] : [input.funnelId],
353
+ steps: [{
354
+ key: input.firstStepKey,
355
+ delaySeconds: input.delaySeconds,
356
+ templateVersionId,
357
+ }],
358
+ exitEventTypes: input.triggerEventType === 'purchase_completed'
359
+ ? []
360
+ : ['purchase_completed'],
361
+ },
362
+ });
363
+ }
364
+ export async function executeEmailSequenceSetActive(input) {
365
+ const files = await readEmailFiles(input.sourceDir);
366
+ assertValidFiles(files);
367
+ const sequence = files.sequences.find((item) => item.slug === input.slug);
368
+ if (!sequence)
369
+ throw new Error(`Email sequence "${input.slug}" was not found locally.`);
370
+ if (!sequence.id)
371
+ throw new Error(`Push email sequence "${input.slug}" before changing activation.`);
372
+ await assertRemoteIdentities(input, {
373
+ resource: 'emailSequences',
374
+ local: [{ id: sequence.id, slug: sequence.slug }],
375
+ });
376
+ await input.callApi({
377
+ path: `emailSequences.${input.active ? 'enable' : 'disable'}`,
378
+ type: 'mutation',
379
+ token: input.token,
380
+ data: {
381
+ ...projectData(input),
382
+ sequenceId: sequence.id,
383
+ },
384
+ });
385
+ }
214
386
  export async function executeEmailTemplatePublish(scope) {
215
387
  return executeEmailPublish(scope, {
216
388
  kind: 'template',
@@ -226,8 +226,8 @@ const validateSequence = (value, pathSlug, file, diagnostics) => {
226
226
  if (!EMAIL_EVENTS.has(value.triggerEventType)) {
227
227
  diagnostics.push(schemaDiagnostic(file, 'triggerEventType', [...EMAIL_EVENTS], value.triggerEventType));
228
228
  }
229
- if (!Array.isArray(value.funnelIds) || value.funnelIds.length < 1 || value.funnelIds.length > 50) {
230
- diagnostics.push(schemaDiagnostic(file, 'funnelIds', '1 to 50 UUIDs', value.funnelIds));
229
+ if (!Array.isArray(value.funnelIds) || value.funnelIds.length > 50) {
230
+ diagnostics.push(schemaDiagnostic(file, 'funnelIds', '0 to 50 UUIDs; empty means all funnels', value.funnelIds));
231
231
  }
232
232
  else {
233
233
  value.funnelIds.forEach((id, index) => {
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.78",
7
+ "repositoryCliVersion": "0.1.86",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.67",
10
+ "bundleVersion": "2.0.75",
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": "4f588258cea6bffac880bde94e7861d26f0a62f50622ed1387828c3192a585ca"
48
+ "sha256": "a50e601c2ed9351b5322fc71cdb5a8e58dc2826d0a17cf0a5763c6c80ccfb28b"
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": "1ac549608dffb179c9029914dc56e8f02d6fa9be92d798a85945b68b0ce750fd"
148
+ "sha256": "2979bb06b0823bf925e99fc2ec5f4bb52ec5dfca103c57d391e4e82521d64feb"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.77",
154
+ "repositoryCliVersion": "0.1.85",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.66",
157
+ "bundleVersion": "2.0.74",
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": "0a76f7f6a26bfbce6a0ae2b9ccbb20f58b99783963e3a3d619b98b1c96868106"
195
+ "sha256": "5bc3de862b0824a2bbeb324d5aa0a097f2b93c9d8a250b292e1002e1f10f127a"
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": "2c5bd7e557878d1cc1ab724c14246c2c762eeb4be07c834108c5a4ec7e5d75d2"
295
+ "sha256": "7d9ebfea22bb7e47c3233f1229c8924da048c27253755ec4ce2cdc280f576400"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.76",
301
+ "repositoryCliVersion": "0.1.84",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.65",
304
+ "bundleVersion": "2.0.73",
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": "753d4bd01a3f05d3165cbe19510564b44a80d0f8392b72582222b771bc7045e0"
342
+ "sha256": "0dfaf22828481cb206164304c15d06f5900ca47cf37d38a4e650facd0ad84ec8"
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": "d085f9a552809b085d6b6cd1a5237ad5fcc0d88a8d4384d185638bc3bc99c90f"
442
+ "sha256": "79d08c93ffa111b31c8b5ed95b022ea5ce800d1e31b1ee1b7c957bffc18dc336"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.75",
448
+ "repositoryCliVersion": "0.1.83",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.64",
451
+ "bundleVersion": "2.0.72",
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": "e73eba7d01d41d4d87be8a6170835c84b7c4f64792bbafb59201130a380250ec"
489
+ "sha256": "ff879b9479fa097459e9527a99b1d267e0a35b6cc056dace34a3b1ed640bdc5e"
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": "fd64ef085f6037e92d596ef958d4118e671285dd3561e22881eed0d7da1bba82"
589
+ "sha256": "1011fadb554a1bbc28110119ee43417c5e75d8b6c71482e21ca6014a9a66716a"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.74",
595
+ "repositoryCliVersion": "0.1.81",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.63",
598
+ "bundleVersion": "2.0.70",
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": "f025610f7c1d91188a67f50e7511a47642b3606170700e11cef0e7a49c8cd997"
636
+ "sha256": "9da61fe189a9b34001c3c73a0abb217d3db109f512fc0a80187123c2c07b356c"
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": "7852876ec227cb893db0315a00627cd609afe14ac5ffac5fdba0fe585a56fbbf"
736
+ "sha256": "3bff17f060f71f221c36703b668b601d1f80fac5ff43c55b99cdb5a1d6136962"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.73",
742
+ "repositoryCliVersion": "0.1.80",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.62",
745
+ "bundleVersion": "2.0.69",
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": "54e982ca3f199113646be0d6de1f8e2b8dde87744df82d6d7452d8e33b2b5258"
783
+ "sha256": "00b0089ec0997a0ef095e1216a4b2322d4e4e00816e0fa7eea6bfc1238e9e459"
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": "7f343fd806a932abcb3cac6463ae84a7532b7c9f583540e6fa06fd7ff7721ddf"
883
+ "sha256": "f66d2e8d39c457cbc30a9fe120b72df3a15f31259f1ac03afb829d87c7679e40"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.72",
889
+ "repositoryCliVersion": "0.1.79",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.61",
892
+ "bundleVersion": "2.0.68",
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": "217b719ef163d485c7a740906b3a1d551f5af37faf9fb721fc61d1fecf5fa9e6"
930
+ "sha256": "cb4bbcd69c41a211407165ee69f6b8c882ea4f85fe7dc10e6e02f0456dd04213"
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": "f9be1a58ba8548ecbf51b2676479964dca89a04a63c9de53f6f805a6ed090fd0"
1030
+ "sha256": "a8e43e7908bdf3be2634ee7fb64b429e1aeb11e51dc5f1eb72b51d126bb477f2"
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.78",
3
+ "version": "0.1.86",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,12 +34,12 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@funnelsgrove/runtime": "0.7.6",
37
+ "@funnelsgrove/runtime": "0.7.9",
38
38
  "commander": "^12.0.0",
39
39
  "typescript": "^5.8.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@funnelsgrove/analytics": "0.1.55",
42
+ "@funnelsgrove/analytics": "0.1.58",
43
43
  "@funnelsgrove/payments": "0.7.3",
44
44
  "vitest": "^3.0.0"
45
45
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.67",
3
+ "bundleVersion": "2.0.75",
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": "4f588258cea6bffac880bde94e7861d26f0a62f50622ed1387828c3192a585ca"
41
+ "sha256": "a50e601c2ed9351b5322fc71cdb5a8e58dc2826d0a17cf0a5763c6c80ccfb28b"
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": "1ac549608dffb179c9029914dc56e8f02d6fa9be92d798a85945b68b0ce750fd"
141
+ "sha256": "2979bb06b0823bf925e99fc2ec5f4bb52ec5dfca103c57d391e4e82521d64feb"
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/runtime` `0.7.6` first, then `@funnelsgrove/analytics` `0.1.55`, then `@funnelsgrove/payments` `0.7.3`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.78`. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.7.9` first, then `@funnelsgrove/analytics` `0.1.58`, then `@funnelsgrove/payments` `0.7.3`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.86`. 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.67",
3
+ "bundleVersion": "2.0.75",
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.67",
3
+ "bundleVersion": "2.0.75",
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": "4f588258cea6bffac880bde94e7861d26f0a62f50622ed1387828c3192a585ca"
41
+ "sha256": "a50e601c2ed9351b5322fc71cdb5a8e58dc2826d0a17cf0a5763c6c80ccfb28b"
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": "1ac549608dffb179c9029914dc56e8f02d6fa9be92d798a85945b68b0ce750fd"
141
+ "sha256": "2979bb06b0823bf925e99fc2ec5f4bb52ec5dfca103c57d391e4e82521d64feb"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "e87926c04ef311b0dd8e18ace4874ef42ae792af88f0ded13309f10929034674",
3
+ "sourceTreeHash": "ada91ddf280aa113c83e0ce869a657fcff6ee1e48d8fbc50d9afca3e2bc630bf",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.67",
5
+ "docsBundleVersion": "2.0.75",
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": "b1ea1636455086e8b3ff78a2f61819ff4b46ea70aad1e1c29bc4c5f6a17f3b0b",
19
+ "sha256": "cd1687669bbad96d04bbeeb5747beb4535e821112fff66de531e76f7c2e95ccb",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -101,7 +101,7 @@
101
101
  },
102
102
  {
103
103
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
104
- "sha256": "4f588258cea6bffac880bde94e7861d26f0a62f50622ed1387828c3192a585ca",
104
+ "sha256": "a50e601c2ed9351b5322fc71cdb5a8e58dc2826d0a17cf0a5763c6c80ccfb28b",
105
105
  "mode": "100644"
106
106
  },
107
107
  {
@@ -236,7 +236,7 @@
236
236
  },
237
237
  {
238
238
  "path": "funnel-docs.config.json",
239
- "sha256": "1ac549608dffb179c9029914dc56e8f02d6fa9be92d798a85945b68b0ce750fd",
239
+ "sha256": "2979bb06b0823bf925e99fc2ec5f4bb52ec5dfca103c57d391e4e82521d64feb",
240
240
  "mode": "100644"
241
241
  },
242
242
  {
@@ -261,12 +261,12 @@
261
261
  },
262
262
  {
263
263
  "path": "package-lock.json",
264
- "sha256": "7aba9c8a0e5919b31b70f7eaeb684b718708b2c2afdb8d919476edbe6a09e588",
264
+ "sha256": "6310cad764c6569cfdbb91e7472bfc5817a725588190d61d167bbb3c297dbc86",
265
265
  "mode": "100644"
266
266
  },
267
267
  {
268
268
  "path": "package.json",
269
- "sha256": "15cf7b7514c3837d3740f825adbf1b76a1d275c1cceda073cadcb690ef8351b7",
269
+ "sha256": "f82ef00e2cb053b2bd4c3d3e07e905676f384aee6b1c5a0266acb1295c79fd5e",
270
270
  "mode": "100644"
271
271
  },
272
272
  {
@@ -736,7 +736,7 @@
736
736
  },
737
737
  {
738
738
  "path": "src/steps/content/subscription-started.content.ts",
739
- "sha256": "1b50bdd85c3f5999891b43ba604adf4135129c1e9ef82ce42433e4a6c2969e1d",
739
+ "sha256": "7abd10868249d4da2281678c57a11a1cf92a804398bc7f02d615c1aae62cec18",
740
740
  "mode": "100644"
741
741
  },
742
742
  {
@@ -851,7 +851,7 @@
851
851
  },
852
852
  {
853
853
  "path": "src/steps/step-33-subscription-started.tsx",
854
- "sha256": "a9c9a58b9a2cb03ea5e7b1110557819ddeb83ceada956448215b759b68c167a2",
854
+ "sha256": "c5120ebc8bc7ea04443d85b3c1c3014535c3c7380ee855ceed2b3a7b78dc9cd4",
855
855
  "mode": "100644"
856
856
  },
857
857
  {
@@ -916,7 +916,7 @@
916
916
  },
917
917
  {
918
918
  "path": "tests/funnel-agent-docs.test.ts",
919
- "sha256": "fb520e7197704b22be56f77c36600f3557edcec9e4698393a1245b708215fa2a",
919
+ "sha256": "0dfc60cd22732d6d7642aa2681f1002f471def2a3633ec45933250538c67eb2f",
920
920
  "mode": "100644"
921
921
  },
922
922
  {
@@ -1036,7 +1036,7 @@
1036
1036
  },
1037
1037
  {
1038
1038
  "path": "tests/src/steps/step-33-subscription-started.test.ts",
1039
- "sha256": "64795d72a03b0ede1a6d42f9fcf575eadb88eb170266f1aa418ce966d0dc57b7",
1039
+ "sha256": "a3547ccca96132eff97c4c1c0b082fbd7e071d6ad59c8df86e9d26bae224d607",
1040
1040
  "mode": "100644"
1041
1041
  },
1042
1042
  {
@@ -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/runtime` `0.7.6` first, then `@funnelsgrove/analytics` `0.1.55`, then `@funnelsgrove/payments` `0.7.3`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.78`. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.7.9` first, then `@funnelsgrove/analytics` `0.1.58`, then `@funnelsgrove/payments` `0.7.3`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.86`. 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.67",
3
+ "bundleVersion": "2.0.75",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -8,9 +8,9 @@
8
8
  "name": "funnel-template",
9
9
  "version": "0.1.0",
10
10
  "dependencies": {
11
- "@funnelsgrove/analytics": "^0.1.55",
11
+ "@funnelsgrove/analytics": "^0.1.58",
12
12
  "@funnelsgrove/payments": "^0.7.3",
13
- "@funnelsgrove/runtime": "^0.7.6",
13
+ "@funnelsgrove/runtime": "^0.7.9",
14
14
  "@stripe/react-stripe-js": "^5.6.0",
15
15
  "@stripe/stripe-js": "^8.7.0",
16
16
  "lucide-react": "^0.553.0",
@@ -891,11 +891,11 @@
891
891
  }
892
892
  },
893
893
  "node_modules/@funnelsgrove/analytics": {
894
- "version": "0.1.55",
895
- "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.55.tgz",
896
- "integrity": "sha512-+JlX1OWL81XcSAGd3clUENKiloPPMFUNSfLnfnOIs+iXJbXPX5MlEbVmkLAuQUOMRT4yMZzGDQe9OIpxO++2Yg==",
894
+ "version": "0.1.58",
895
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.58.tgz",
896
+ "integrity": "sha512-bTSq7SO7CuicexEXUKIc3WMW7RQV1VI9pQfCOn79E6ygHa/1shoY7GZyzB/9n5Pn2pAOdZzNIy+erPPHaQROQQ==",
897
897
  "dependencies": {
898
- "@funnelsgrove/runtime": "0.7.6"
898
+ "@funnelsgrove/runtime": "0.7.9"
899
899
  }
900
900
  },
901
901
  "node_modules/@funnelsgrove/payments": {
@@ -913,9 +913,9 @@
913
913
  }
914
914
  },
915
915
  "node_modules/@funnelsgrove/runtime": {
916
- "version": "0.7.6",
917
- "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.6.tgz",
918
- "integrity": "sha512-olumRPhnx5VcSb+SG/LqxbiKkJoQIIcMm4DFYlPe7QVD4g18sModuHAEfR3qeFtuZfV4Na5hA9hUPicD0M45kg==",
916
+ "version": "0.7.9",
917
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.7.9.tgz",
918
+ "integrity": "sha512-j6T7n2YZ5CaQc1IPc+2HX/gBq7U/rtNKKrBEttMMNtrC/ip1PcLdoj7qBgsyh6dgjpg+eYi6lExr8I1g5gA/ew==",
919
919
  "dependencies": {
920
920
  "posthog-js": "^1.369.2",
921
921
  "react": "19.2.3",
@@ -12,9 +12,9 @@
12
12
  "validate:funnel": "vite-node --config src/contract/funnel-validator.vite.config.ts src/contract/validate-funnel.cli.ts"
13
13
  },
14
14
  "dependencies": {
15
- "@funnelsgrove/analytics": "^0.1.55",
15
+ "@funnelsgrove/analytics": "^0.1.58",
16
16
  "@funnelsgrove/payments": "^0.7.3",
17
- "@funnelsgrove/runtime": "^0.7.6",
17
+ "@funnelsgrove/runtime": "^0.7.9",
18
18
  "@stripe/react-stripe-js": "^5.6.0",
19
19
  "@stripe/stripe-js": "^8.7.0",
20
20
  "lucide-react": "^0.553.0",
@@ -66,3 +66,19 @@ export const subscriptionStartedContent = {
66
66
  },
67
67
  },
68
68
  } as const satisfies LocalizedStepContent<SubscriptionStartedLocaleContent>;
69
+
70
+ export const returningSubscriberContent = {
71
+ defaultLocale: 'en',
72
+ locales: {
73
+ en: {
74
+ ...subscriptionStartedContent.locales.en,
75
+ kicker: 'Welcome back',
76
+ title: 'You already have access.',
77
+ copyWithQr:
78
+ 'Your subscription is active. Open the app and sign in with this email to continue.',
79
+ copyWithoutQr:
80
+ 'Your subscription is active. Open the app and sign in with this email to continue.',
81
+ note: 'We’ll send you a verification code when you sign in.',
82
+ },
83
+ },
84
+ } as const satisfies LocalizedStepContent<SubscriptionStartedLocaleContent>;
@@ -8,7 +8,11 @@ import {
8
8
  type FunnelStepMeta,
9
9
  } from '@funnelsgrove/runtime';
10
10
  import { getStepContentLocale } from '@/runtime/step-content-context';
11
- import { subscriptionStartedContent } from '@/steps/content/subscription-started.content';
11
+ import {
12
+ returningSubscriberContent,
13
+ subscriptionStartedContent,
14
+ type SubscriptionStartedLocaleContent,
15
+ } from '@/steps/content/subscription-started.content';
12
16
 
13
17
  export const stepSubscriptionStartedId = 'subscription-started';
14
18
 
@@ -26,10 +30,10 @@ export const stepSubscriptionStarted: FunnelStepMeta = {
26
30
  };
27
31
 
28
32
  export function StepSubscriptionStarted() {
29
- const { attributes } = useFunnel();
30
- const content = usePreviewStepLocalizedContent(
33
+ const { attributes, isReturningSubscriber } = useFunnel();
34
+ const content = usePreviewStepLocalizedContent<SubscriptionStartedLocaleContent>(
31
35
  stepSubscriptionStartedId,
32
- subscriptionStartedContent,
36
+ isReturningSubscriber ? returningSubscriberContent : subscriptionStartedContent,
33
37
  getStepContentLocale(attributes),
34
38
  );
35
39
 
@@ -363,7 +363,7 @@ describe('funnel agent documentation supply', () => {
363
363
 
364
364
  expect(manifest).toMatchObject({
365
365
  schemaVersion: 1,
366
- bundleVersion: '2.0.67',
366
+ bundleVersion: '2.0.75',
367
367
  stepContractVersion: contract.stepContractVersion,
368
368
  contractHash: contract.contractHash,
369
369
  });
@@ -10,6 +10,9 @@ describe('template subscription-started source', () => {
10
10
  );
11
11
 
12
12
  expect(stepSource).toContain('SubscriptionHandoffScreen');
13
+ expect(stepSource.match(/<SubscriptionHandoffScreen/g)).toHaveLength(1);
14
+ expect(stepSource).toContain('isReturningSubscriber');
15
+ expect(stepSource).toContain('returningSubscriberContent');
13
16
  expect(stepSource).toContain("completionMode='funnel'");
14
17
  expect(stepSource).toContain("type: 'purchase_completed'");
15
18
  expect(stepSource).not.toContain('@funnelsgrove/analytics');
@@ -22,4 +25,20 @@ describe('template subscription-started source', () => {
22
25
  expect(stepSource).not.toContain('api.qrserver.com');
23
26
  expect(stepSource).not.toContain('NEXT_PUBLIC_IOS_APP_STORE_URL');
24
27
  });
28
+
29
+ it('defines the approved returning-subscriber copy', () => {
30
+ const contentSource = readFileSync(
31
+ path.resolve(__dirname, '../../../src/steps/content/subscription-started.content.ts'),
32
+ 'utf8',
33
+ );
34
+
35
+ expect(contentSource).toContain("kicker: 'Welcome back'");
36
+ expect(contentSource).toContain("title: 'You already have access.'");
37
+ expect(contentSource).toContain(
38
+ "'Your subscription is active. Open the app and sign in with this email to continue.'",
39
+ );
40
+ expect(contentSource).toContain(
41
+ "'We’ll send you a verification code when you sign in.'",
42
+ );
43
+ });
25
44
  });