@funnelsgrove/cli 0.1.35 → 0.1.43

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.d.ts CHANGED
@@ -197,6 +197,50 @@ export declare function buildGeneratedConfigSyncInput(input: {
197
197
  };
198
198
  export declare function selectGeneratedConfigFiles(files: SourceFile[], kinds: GeneratedConfigKind[]): SourceFile[];
199
199
  export declare function assertCanDraftSyncSource(status: GitHubStatusResponse): void;
200
+ type PublishDeploymentStatus = {
201
+ id: string;
202
+ state: string;
203
+ qa_summary?: string | null;
204
+ deployment_url?: string | null;
205
+ version_id?: string | null;
206
+ metadata?: unknown;
207
+ };
208
+ type PublishAcknowledgement = {
209
+ deploymentUrl: string;
210
+ publishedVersionId: string | null;
211
+ publishedVersionSeq: number | null;
212
+ };
213
+ export declare const formatPublishTerminalSuccess: (input: {
214
+ acknowledgement: PublishAcknowledgement;
215
+ deployment: PublishDeploymentStatus;
216
+ }) => string;
217
+ type FunnelDetailResponse = {
218
+ deployments: PublishDeploymentStatus[];
219
+ };
220
+ type PublishCommandBackend = {
221
+ publish: (input: {
222
+ token: string;
223
+ workspaceId: string;
224
+ funnelId: string;
225
+ message?: string;
226
+ domains?: string[];
227
+ }) => Promise<PublishAcknowledgement & {
228
+ deploymentId: string;
229
+ }>;
230
+ detail: (input: {
231
+ token: string;
232
+ workspaceId: string;
233
+ funnelId: string;
234
+ }) => Promise<FunnelDetailResponse>;
235
+ };
236
+ export declare const executePublishAndWait: (input: {
237
+ token: string;
238
+ workspaceId: string;
239
+ funnelId: string;
240
+ message?: string;
241
+ domains?: string[];
242
+ backend?: PublishCommandBackend;
243
+ }) => Promise<string>;
200
244
  export type GitHubSyncTimeoutPolicy = 'strict' | 'continue';
201
245
  export declare const PUBLISH_GITHUB_SYNC_TIMEOUT_POLICY: GitHubSyncTimeoutPolicy;
202
246
  export declare const OFFER_SETS_GITHUB_SYNC_TIMEOUT_POLICY: GitHubSyncTimeoutPolicy;
package/dist/cli.js CHANGED
@@ -1135,6 +1135,26 @@ export function assertCanDraftSyncSource(status) {
1135
1135
  throw new Error('This funnel is connected to GitHub. Commit and push changes with git, then run `fgrove github pull` to sync the hosted draft. Do not use `fgrove sync up` for the same change.');
1136
1136
  }
1137
1137
  }
1138
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
1139
+ export const formatPublishTerminalSuccess = (input) => {
1140
+ const versionId = input.deployment.version_id?.trim();
1141
+ if (!versionId) {
1142
+ throw new Error(`Ready publish deployment ${input.deployment.id} is missing a bound version_id.`);
1143
+ }
1144
+ const metadata = input.deployment.metadata;
1145
+ const publishPreparation = isRecord(metadata) ? metadata.publishPreparation : undefined;
1146
+ const publishedVersionSeq = isRecord(publishPreparation)
1147
+ ? publishPreparation.publishedVersionSeq
1148
+ : undefined;
1149
+ if (typeof publishedVersionSeq !== 'number'
1150
+ || !Number.isInteger(publishedVersionSeq)
1151
+ || publishedVersionSeq <= 0) {
1152
+ throw new Error(`Ready publish deployment ${input.deployment.id} has invalid metadata.publishPreparation.publishedVersionSeq.`);
1153
+ }
1154
+ const deploymentUrl = input.deployment.deployment_url?.trim()
1155
+ || input.acknowledgement.deploymentUrl;
1156
+ return `${deploymentUrl}\tv${publishedVersionSeq}\t${versionId}`;
1157
+ };
1138
1158
  const getApiUrl = () => {
1139
1159
  const options = program.opts();
1140
1160
  return options.apiUrl || process.env.FUNNELSGROVE_API_URL || DEFAULT_API_URL;
@@ -1170,15 +1190,17 @@ const isTerminalDeploymentState = (state) => {
1170
1190
  const waitForPublishDeployment = async (input) => {
1171
1191
  const deadline = Date.now() + PUBLISH_WAIT_TIMEOUT_MS;
1172
1192
  while (Date.now() <= deadline) {
1173
- const detail = await callApi({
1174
- path: 'funnels.detail',
1175
- type: 'query',
1176
- token: input.token,
1177
- data: {
1178
- workspaceId: input.workspaceId,
1179
- funnelId: input.funnelId,
1180
- },
1181
- });
1193
+ const detail = input.detail
1194
+ ? await input.detail(input)
1195
+ : await callApi({
1196
+ path: 'funnels.detail',
1197
+ type: 'query',
1198
+ token: input.token,
1199
+ data: {
1200
+ workspaceId: input.workspaceId,
1201
+ funnelId: input.funnelId,
1202
+ },
1203
+ });
1182
1204
  const deployment = detail.deployments.find((item) => item.id === input.deploymentId);
1183
1205
  if (deployment && isTerminalDeploymentState(deployment.state)) {
1184
1206
  if (deployment.state === 'failed') {
@@ -1193,6 +1215,45 @@ const waitForPublishDeployment = async (input) => {
1193
1215
  }
1194
1216
  throw new Error(`Timed out waiting for publish deployment ${input.deploymentId}.`);
1195
1217
  };
1218
+ export const executePublishAndWait = async (input) => {
1219
+ const backend = input.backend ?? {
1220
+ publish: async (request) => callApi({
1221
+ path: 'funnels.publish',
1222
+ type: 'mutation',
1223
+ token: request.token,
1224
+ data: {
1225
+ workspaceId: request.workspaceId,
1226
+ funnelId: request.funnelId,
1227
+ message: request.message,
1228
+ domains: request.domains,
1229
+ },
1230
+ }),
1231
+ detail: async (request) => callApi({
1232
+ path: 'funnels.detail',
1233
+ type: 'query',
1234
+ token: request.token,
1235
+ data: {
1236
+ workspaceId: request.workspaceId,
1237
+ funnelId: request.funnelId,
1238
+ },
1239
+ }),
1240
+ };
1241
+ const acknowledgement = await backend.publish({
1242
+ token: input.token,
1243
+ workspaceId: input.workspaceId,
1244
+ funnelId: input.funnelId,
1245
+ message: input.message,
1246
+ domains: input.domains,
1247
+ });
1248
+ const deployment = await waitForPublishDeployment({
1249
+ token: input.token,
1250
+ workspaceId: input.workspaceId,
1251
+ funnelId: input.funnelId,
1252
+ deploymentId: acknowledgement.deploymentId,
1253
+ detail: backend.detail,
1254
+ });
1255
+ return formatPublishTerminalSuccess({ acknowledgement, deployment });
1256
+ };
1196
1257
  const readCodeFromStdin = async () => {
1197
1258
  const rl = createInterface({
1198
1259
  input: process.stdin,
@@ -2273,24 +2334,13 @@ addExamples(program
2273
2334
  timeoutPolicy: PUBLISH_GITHUB_SYNC_TIMEOUT_POLICY,
2274
2335
  });
2275
2336
  }
2276
- const result = await callApi({
2277
- path: 'funnels.publish',
2278
- type: 'mutation',
2279
- token,
2280
- data: {
2281
- workspaceId: target.workspaceId,
2282
- funnelId: target.funnelId,
2283
- message: options.message,
2284
- domains: publishEnv === 'production' && options.domain ? [options.domain] : undefined,
2285
- },
2286
- });
2287
- const readyDeployment = await waitForPublishDeployment({
2337
+ console.log(await executePublishAndWait({
2288
2338
  token,
2289
2339
  workspaceId: target.workspaceId,
2290
2340
  funnelId: target.funnelId,
2291
- deploymentId: result.deploymentId,
2292
- });
2293
- console.log(`${readyDeployment.deployment_url || result.deploymentUrl}\tv${result.publishedVersionSeq}\t${result.publishedVersionId}`);
2341
+ message: options.message,
2342
+ domains: publishEnv === 'production' && options.domain ? [options.domain] : undefined,
2343
+ }));
2294
2344
  });
2295
2345
  const githubCommand = addExamples(program.command('github').description('Manage GitHub funnel sync'), [
2296
2346
  'fgrove github status --funnel claimbee-general',
@@ -4,10 +4,10 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.35",
7
+ "repositoryCliVersion": "0.1.43",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.23",
10
+ "bundleVersion": "2.0.31",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
@@ -21,11 +21,11 @@
21
21
  },
22
22
  {
23
23
  "path": "docs/funnelsgrove/START-HERE.md",
24
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
24
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
25
25
  },
26
26
  {
27
27
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
28
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
28
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
29
29
  },
30
30
  {
31
31
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  {
39
39
  "path": "docs/funnelsgrove/contracts/payments.md",
40
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
40
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
41
41
  },
42
42
  {
43
43
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -45,11 +45,11 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "bd7ae81ac8617e8d297268a1091e1bea5fb6b412346f6e891a0f08ab49520686"
48
+ "sha256": "ba0ca2563f34ffb8ab23da1600ffbbaa225e9aa1fb2e87b5404a356edd2ae0fc"
49
49
  },
50
50
  {
51
51
  "path": "docs/funnelsgrove/qa/analytics.md",
52
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
52
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
53
53
  },
54
54
  {
55
55
  "path": "docs/funnelsgrove/qa/local.md",
@@ -145,16 +145,16 @@
145
145
  },
146
146
  {
147
147
  "path": "funnel-docs.config.json",
148
- "sha256": "5c2a6798dd3e13269526d43af4a3db1e4c85c748f49f768417f8dcb827803603"
148
+ "sha256": "b5ff393f6429e787a599fe1b3a1a9e3e06346de5654acb9094741ee0089206f8"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.34",
154
+ "repositoryCliVersion": "0.1.42",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.22",
157
+ "bundleVersion": "2.0.30",
158
158
  "stepContractVersion": 3,
159
159
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
160
160
  "managedFiles": [
@@ -168,11 +168,11 @@
168
168
  },
169
169
  {
170
170
  "path": "docs/funnelsgrove/START-HERE.md",
171
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
171
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
172
172
  },
173
173
  {
174
174
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
175
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
175
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
176
176
  },
177
177
  {
178
178
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -184,7 +184,7 @@
184
184
  },
185
185
  {
186
186
  "path": "docs/funnelsgrove/contracts/payments.md",
187
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
187
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
188
188
  },
189
189
  {
190
190
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -192,11 +192,11 @@
192
192
  },
193
193
  {
194
194
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
195
- "sha256": "849a3a60cbe89e30e667ab77dcd6459fa2374ec73223182cbf837d5ae0cf3c78"
195
+ "sha256": "1f2981c692dd0454fa69aa5381478adfbfe7951e032309344e0e1edb99cb60ea"
196
196
  },
197
197
  {
198
198
  "path": "docs/funnelsgrove/qa/analytics.md",
199
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
199
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
200
200
  },
201
201
  {
202
202
  "path": "docs/funnelsgrove/qa/local.md",
@@ -292,16 +292,16 @@
292
292
  },
293
293
  {
294
294
  "path": "funnel-docs.config.json",
295
- "sha256": "f5399c6e73f637684b8ce470aca7449b5f90c43efbe2fc88d444759cf1647de1"
295
+ "sha256": "85762fb469f1bcd929536f2c5fbe2418a489bae327f100ac9fba49d95eda58fa"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.33",
301
+ "repositoryCliVersion": "0.1.41",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.21",
304
+ "bundleVersion": "2.0.29",
305
305
  "stepContractVersion": 3,
306
306
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
307
307
  "managedFiles": [
@@ -315,11 +315,11 @@
315
315
  },
316
316
  {
317
317
  "path": "docs/funnelsgrove/START-HERE.md",
318
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
318
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
319
319
  },
320
320
  {
321
321
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
322
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
322
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
323
323
  },
324
324
  {
325
325
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -331,7 +331,7 @@
331
331
  },
332
332
  {
333
333
  "path": "docs/funnelsgrove/contracts/payments.md",
334
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
334
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
335
335
  },
336
336
  {
337
337
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -339,11 +339,11 @@
339
339
  },
340
340
  {
341
341
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
342
- "sha256": "28443021c76a8744a7a1bbd07ecdc8f3ee72053e3c40fceb7a359cedf786d943"
342
+ "sha256": "4ba56674e8297aec8977e6fe0e3bb472513603accfe7b6361f78a2d6ac96c8ee"
343
343
  },
344
344
  {
345
345
  "path": "docs/funnelsgrove/qa/analytics.md",
346
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
346
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
347
347
  },
348
348
  {
349
349
  "path": "docs/funnelsgrove/qa/local.md",
@@ -439,16 +439,16 @@
439
439
  },
440
440
  {
441
441
  "path": "funnel-docs.config.json",
442
- "sha256": "1d3c3cd2fd3aef9faf5f0d1b3a11b6d019f02d7056a20408083361da8e1db0d3"
442
+ "sha256": "38801a3066a005dd3151e4c77fbb1dabc0cff901a6db02ae98dd3f890adb1e66"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.32",
448
+ "repositoryCliVersion": "0.1.40",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.20",
451
+ "bundleVersion": "2.0.28",
452
452
  "stepContractVersion": 3,
453
453
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
454
454
  "managedFiles": [
@@ -462,11 +462,11 @@
462
462
  },
463
463
  {
464
464
  "path": "docs/funnelsgrove/START-HERE.md",
465
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
465
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
466
466
  },
467
467
  {
468
468
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
469
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
469
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
470
470
  },
471
471
  {
472
472
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -478,7 +478,7 @@
478
478
  },
479
479
  {
480
480
  "path": "docs/funnelsgrove/contracts/payments.md",
481
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
481
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
482
482
  },
483
483
  {
484
484
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -486,11 +486,11 @@
486
486
  },
487
487
  {
488
488
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
489
- "sha256": "1254e4fb9cdf2e470c5997d9df92dffb9fd4276abab955de247b297eaac0a585"
489
+ "sha256": "3c7f166a28b5b66498630c41e2930f4592a836d0d2c90847fedf0ee5656cc612"
490
490
  },
491
491
  {
492
492
  "path": "docs/funnelsgrove/qa/analytics.md",
493
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
493
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
494
494
  },
495
495
  {
496
496
  "path": "docs/funnelsgrove/qa/local.md",
@@ -586,16 +586,16 @@
586
586
  },
587
587
  {
588
588
  "path": "funnel-docs.config.json",
589
- "sha256": "4f59ba03061e03db39b8b13f044be7a9012ebde01a825e0385fddfe3130ce4e1"
589
+ "sha256": "a7d4ddf4971f4d7e9ae4f0751c0e208cc41d5bdb6ebee292f42727482fcb9a6b"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.31",
595
+ "repositoryCliVersion": "0.1.39",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.19",
598
+ "bundleVersion": "2.0.27",
599
599
  "stepContractVersion": 3,
600
600
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
601
601
  "managedFiles": [
@@ -609,11 +609,11 @@
609
609
  },
610
610
  {
611
611
  "path": "docs/funnelsgrove/START-HERE.md",
612
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
612
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
613
613
  },
614
614
  {
615
615
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
616
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
616
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
617
617
  },
618
618
  {
619
619
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -625,7 +625,7 @@
625
625
  },
626
626
  {
627
627
  "path": "docs/funnelsgrove/contracts/payments.md",
628
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
628
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
629
629
  },
630
630
  {
631
631
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -633,11 +633,11 @@
633
633
  },
634
634
  {
635
635
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
636
- "sha256": "4c8843a38778d6a445195e7c46fc71aafd60056ac225c061892fb66003862636"
636
+ "sha256": "ff280739dacf549dca60ca7ca6ce6188081dada4ad8f3ae6dd80865e574d6863"
637
637
  },
638
638
  {
639
639
  "path": "docs/funnelsgrove/qa/analytics.md",
640
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
640
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
641
641
  },
642
642
  {
643
643
  "path": "docs/funnelsgrove/qa/local.md",
@@ -733,16 +733,16 @@
733
733
  },
734
734
  {
735
735
  "path": "funnel-docs.config.json",
736
- "sha256": "3367ba96679da38fbdbeace2952fa6a5df6e16c9e7014f7231156e851f135614"
736
+ "sha256": "205aa6a5afbf15e411e8d9916f44ed0792957f916640afa9e9a1a92c55b89971"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.30",
742
+ "repositoryCliVersion": "0.1.38",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.18",
745
+ "bundleVersion": "2.0.26",
746
746
  "stepContractVersion": 3,
747
747
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
748
748
  "managedFiles": [
@@ -756,11 +756,11 @@
756
756
  },
757
757
  {
758
758
  "path": "docs/funnelsgrove/START-HERE.md",
759
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
759
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
760
760
  },
761
761
  {
762
762
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
763
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
763
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
764
764
  },
765
765
  {
766
766
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -772,7 +772,7 @@
772
772
  },
773
773
  {
774
774
  "path": "docs/funnelsgrove/contracts/payments.md",
775
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
775
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
776
776
  },
777
777
  {
778
778
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -780,11 +780,11 @@
780
780
  },
781
781
  {
782
782
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
783
- "sha256": "e39e33c49ad2669ccc88016df2ca803e0860ec58972956b1a72020fb3a83939c"
783
+ "sha256": "287760126630942ff35929b6ede25f5601a21f3cfce8a170de280934c51f5572"
784
784
  },
785
785
  {
786
786
  "path": "docs/funnelsgrove/qa/analytics.md",
787
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
787
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
788
788
  },
789
789
  {
790
790
  "path": "docs/funnelsgrove/qa/local.md",
@@ -880,16 +880,16 @@
880
880
  },
881
881
  {
882
882
  "path": "funnel-docs.config.json",
883
- "sha256": "64d969e839025d3d6956c0cd0a7632c5a3e887d52425fddd0b1a54f1a5a48440"
883
+ "sha256": "45b8fc9ae7c6174dff17344a36fa11fa9496bb091249bd4ef4945ae96e203e87"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.29",
889
+ "repositoryCliVersion": "0.1.37",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.17",
892
+ "bundleVersion": "2.0.25",
893
893
  "stepContractVersion": 3,
894
894
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
895
895
  "managedFiles": [
@@ -903,11 +903,11 @@
903
903
  },
904
904
  {
905
905
  "path": "docs/funnelsgrove/START-HERE.md",
906
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
906
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
907
907
  },
908
908
  {
909
909
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
910
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
910
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
911
911
  },
912
912
  {
913
913
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -919,7 +919,7 @@
919
919
  },
920
920
  {
921
921
  "path": "docs/funnelsgrove/contracts/payments.md",
922
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
922
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
923
923
  },
924
924
  {
925
925
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -927,11 +927,11 @@
927
927
  },
928
928
  {
929
929
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
930
- "sha256": "bf7171b1101096ac3b205aa8f251379de1c66e16c20b5ca6054e84fd0ab17862"
930
+ "sha256": "b2e68b9471c2237037a166dfaaa81d5489a1ce7298f3c75205fa173c47d893aa"
931
931
  },
932
932
  {
933
933
  "path": "docs/funnelsgrove/qa/analytics.md",
934
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
934
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
935
935
  },
936
936
  {
937
937
  "path": "docs/funnelsgrove/qa/local.md",
@@ -1027,7 +1027,7 @@
1027
1027
  },
1028
1028
  {
1029
1029
  "path": "funnel-docs.config.json",
1030
- "sha256": "87d325180a8e9e501cf5c2a00174f99fae58a612b7a93cfe9753bf1f149e46a4"
1030
+ "sha256": "c503890f0244c45a0b0a8799e5241dedd2d3180bcd0b939e6aeb1d6bba7017e9"
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.35",
3
+ "version": "0.1.43",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,12 +34,13 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@funnelsgrove/runtime": "0.1.62",
37
+ "@funnelsgrove/runtime": "0.1.63",
38
38
  "commander": "^12.0.0",
39
39
  "typescript": "^5.8.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@funnelsgrove/analytics": "0.1.39",
42
+ "@funnelsgrove/analytics": "0.1.41",
43
+ "@funnelsgrove/payments": "0.1.58",
43
44
  "vitest": "^3.0.0"
44
45
  }
45
46
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.23",
3
+ "bundleVersion": "2.0.31",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -14,11 +14,11 @@
14
14
  },
15
15
  {
16
16
  "path": "docs/funnelsgrove/START-HERE.md",
17
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
17
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
18
18
  },
19
19
  {
20
20
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
21
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
21
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  {
32
32
  "path": "docs/funnelsgrove/contracts/payments.md",
33
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
33
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
34
34
  },
35
35
  {
36
36
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -38,11 +38,11 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "bd7ae81ac8617e8d297268a1091e1bea5fb6b412346f6e891a0f08ab49520686"
41
+ "sha256": "ba0ca2563f34ffb8ab23da1600ffbbaa225e9aa1fb2e87b5404a356edd2ae0fc"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
45
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
45
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
46
46
  },
47
47
  {
48
48
  "path": "docs/funnelsgrove/qa/local.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "5c2a6798dd3e13269526d43af4a3db1e4c85c748f49f768417f8dcb827803603"
141
+ "sha256": "b5ff393f6429e787a599fe1b3a1a9e3e06346de5654acb9094741ee0089206f8"
142
142
  }
143
143
  ]
144
144
  }
@@ -54,7 +54,10 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
54
54
  - A paywall presents purchasable plans. A loading, reveal, or “ready” screen is an interstitial.
55
55
  - Every choice declares `choice.answerKey`, stores stable option IDs in the exact scalar/array shape, and uses `useStepChoices`.
56
56
  - Email capture uses `submitEmailCapture`; it never manually sends analytics or hard-codes paywall navigation.
57
- - `subscription-started` is the `purchase_completed` terminal. Browser terminal reach is not Quiz completed; only the trusted backend records `purchase_completed` after verifying an initial purchase.
57
+ - Quiz completed counts each unique user who reaches a paywall step.
58
+ - `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed.
59
+ - Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
60
+ - `subscription-started` remains the contract-v3 `purchase_completed` terminal type, and only the trusted backend records the purchase event after verifying an initial purchase.
58
61
  - Let the controller distinguish completion from exit and suppress provider delivery in preview.
59
62
 
60
63
  ## Standard workflow
@@ -24,7 +24,9 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
24
24
  | `step_exited` | `step_exited` | `step_exit` | `any` | `any` | `controller` | `true` | `step-visit` | `funnelId`, `funnelVersionId`, `environment`, `stepContractVersion`, `stepId`, `stepName`, `stepType` |
25
25
  | `step_started` | `step_started` | `step_start` | `any` | `any` | `controller` | `true` | `step-visit` | `funnelId`, `funnelVersionId`, `environment`, `stepContractVersion`, `stepId`, `stepName`, `stepType` |
26
26
 
27
- The `purchase_completed` event is owned by `trusted-server` and is recorded only after the backend verifies a successful initial purchase. Entering the browser terminal or emitting `funnel_completed` does not create this business conversion. The separate `registration_completed` event remains owned by `trusted-server` for the later app-link claim. The `email_captured` event is owned by `transactional-server` and uses `logical-email-conversion` deduplication.
27
+ Quiz completed counts each unique user who reaches a paywall step. `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed. Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
28
+
29
+ The `purchase_completed` event is owned by `trusted-server` and is recorded only after the backend verifies a successful initial purchase. The separate `registration_completed` event remains owned by `trusted-server` for the later app-link claim. The `email_captured` event is owned by `transactional-server` and uses `logical-email-conversion` deduplication.
28
30
  <!-- funnelsgrove:generated:end contract-v3/contract/analytics-events -->
29
31
 
30
32
  ## Ownership rules
@@ -34,7 +36,7 @@ The `purchase_completed` event is owned by `trusted-server` and is recorded only
34
36
  - `submitEmailCapture` creates `email_captured` transactionally, then routes only after success.
35
37
  - Named payment helpers emit checkout semantic events at real payment boundaries.
36
38
  - The terminal helper owns funnel completion.
37
- - A trusted backend owns `purchase_completed` after verifying an initial subscription or one-time payment; browser code never emits it, and terminal reach does not count as Quiz completed.
39
+ - A trusted backend owns `purchase_completed` after verifying an initial subscription or one-time payment; browser code never emits it. This purchase event is independent from the paywall-reach definition of Quiz completed.
38
40
  - A separate trusted server claim owns `registration_completed` when the purchased subscription is later linked in the app.
39
41
  - Provider adapters and the durable outbox own PostHog and server Meta delivery.
40
42
 
@@ -37,6 +37,8 @@ A paywall presents purchasable plans. A reveal, loading state, calculation, or
37
37
 
38
38
  ## Purchase completion separation
39
39
 
40
- The canonical `subscription-started` route keeps its stable identity but uses the `purchase_completed` terminal type in contract v3. It may emit lifecycle-only `funnel_completed`, but entering it never counts as Quiz completed. Only the trusted backend emits `purchase_completed` after verifying an initial subscription or one-time payment; renewals, pending payments, and browser checkout returns do not qualify. `registration_completed` remains the later app-link conversion.
40
+ Quiz completed counts each unique user who reaches a paywall step. `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed. Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
41
+
42
+ The canonical `subscription-started` route keeps its stable identity and remains the `purchase_completed` terminal type in contract v3. Only the trusted backend emits the purchase event after verifying an initial subscription or one-time payment; renewals, pending payments, and browser checkout returns do not qualify. `registration_completed` remains the later app-link conversion.
41
43
 
42
44
  Before publishing, complete [paywall/checkout QA](../qa/paywall-checkout.md) and [publish QA](../qa/publish.md).
@@ -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.1.62` first, then `@funnelsgrove/analytics` `0.1.39`, then `@funnelsgrove/payments` `0.1.56`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.35`. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.1.63` first, then `@funnelsgrove/analytics` `0.1.41`, then `@funnelsgrove/payments` `0.1.58`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.43`. 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
@@ -32,7 +32,9 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
32
32
  - Choice steps save the exact stable ID shape before completion.
33
33
  - Email success creates one server conversion; duplicate capture skips browser fanout; failure changes no state/lifecycle/route.
34
34
  - Checkout helpers fire only at real boundaries with complete metadata and stable event IDs.
35
- - Quiz completed requires trusted-server `purchase_completed`, deduplicated by `provider-payment`; browser `funnel_completed` is lifecycle-only and never satisfies it.
35
+ - Quiz completed counts each unique user who reaches a paywall step.
36
+ - `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed.
37
+ - Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
36
38
  - `registration_completed` remains the separate later app-link claim.
37
39
  - Preview sends no API/provider analytics.
38
40
  - No component sends PostHog or server Meta directly.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.23",
3
+ "bundleVersion": "2.0.31",
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.23",
3
+ "bundleVersion": "2.0.31",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
@@ -14,11 +14,11 @@
14
14
  },
15
15
  {
16
16
  "path": "docs/funnelsgrove/START-HERE.md",
17
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d"
17
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5"
18
18
  },
19
19
  {
20
20
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
21
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6"
21
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9"
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  {
32
32
  "path": "docs/funnelsgrove/contracts/payments.md",
33
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60"
33
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d"
34
34
  },
35
35
  {
36
36
  "path": "docs/funnelsgrove/contracts/step-metadata.md",
@@ -38,11 +38,11 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "bd7ae81ac8617e8d297268a1091e1bea5fb6b412346f6e891a0f08ab49520686"
41
+ "sha256": "ba0ca2563f34ffb8ab23da1600ffbbaa225e9aa1fb2e87b5404a356edd2ae0fc"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
45
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d"
45
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab"
46
46
  },
47
47
  {
48
48
  "path": "docs/funnelsgrove/qa/local.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "5c2a6798dd3e13269526d43af4a3db1e4c85c748f49f768417f8dcb827803603"
141
+ "sha256": "b5ff393f6429e787a599fe1b3a1a9e3e06346de5654acb9094741ee0089206f8"
142
142
  }
143
143
  ]
144
144
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sourceTreeHash": "e00d4d9300d169131cf55df1d9ff45ddb43f369da52d96db47b2a8ee00c0705e",
3
+ "sourceTreeHash": "248b8b8dab9727597328fa39d488a5a015c985a6e8db0b1f8cf0da373fe325e5",
4
4
  "stepContractVersion": 3,
5
- "docsBundleVersion": "2.0.23",
5
+ "docsBundleVersion": "2.0.31",
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": "777509183cdfb38967f70038bbf70737da8321fc52cc82ac60954374b10ea18d",
19
+ "sha256": "1ed236d8cef95a216c5def1abe7cdeee368c35363be3487ff0aaae0d61d98a81",
20
20
  "mode": "100644"
21
21
  },
22
22
  {
@@ -71,12 +71,12 @@
71
71
  },
72
72
  {
73
73
  "path": "docs/funnelsgrove/START-HERE.md",
74
- "sha256": "638615b66f771a36015d747fd8e8a1bf0af311ed24631c3dd041388e8e73c09d",
74
+ "sha256": "ef7525739aa0cd5ea42906fca2ae6ca0327465e6939956f9567e3029148a0bd5",
75
75
  "mode": "100644"
76
76
  },
77
77
  {
78
78
  "path": "docs/funnelsgrove/contracts/analytics-events.md",
79
- "sha256": "743ca0d6b3a19b3b9e0bd489b228dab7be73d26073a86aab513a90477da481c6",
79
+ "sha256": "496ebab7c1fd00b40f9a5b29a5d3f8b6605549bf5927eb4280ccdc3023acd3c9",
80
80
  "mode": "100644"
81
81
  },
82
82
  {
@@ -91,7 +91,7 @@
91
91
  },
92
92
  {
93
93
  "path": "docs/funnelsgrove/contracts/payments.md",
94
- "sha256": "1a003f83fa01dba60bd4bb3365fd0a753dadd73d13fed84fd16b70d1df3d2b60",
94
+ "sha256": "3614a2c6e4d48411c9eba21400ce2699a49782d802aa08acc72335ed4ef2421d",
95
95
  "mode": "100644"
96
96
  },
97
97
  {
@@ -101,12 +101,12 @@
101
101
  },
102
102
  {
103
103
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
104
- "sha256": "bd7ae81ac8617e8d297268a1091e1bea5fb6b412346f6e891a0f08ab49520686",
104
+ "sha256": "ba0ca2563f34ffb8ab23da1600ffbbaa225e9aa1fb2e87b5404a356edd2ae0fc",
105
105
  "mode": "100644"
106
106
  },
107
107
  {
108
108
  "path": "docs/funnelsgrove/qa/analytics.md",
109
- "sha256": "5ac36e547155546be230b9f1df144c7875824686627859c97b43e33d6e3e116d",
109
+ "sha256": "1a42fcb7fccfb35f41fe2df297aadd67d6ea86fa3a9de2960c861664f32cf9ab",
110
110
  "mode": "100644"
111
111
  },
112
112
  {
@@ -236,7 +236,7 @@
236
236
  },
237
237
  {
238
238
  "path": "funnel-docs.config.json",
239
- "sha256": "5c2a6798dd3e13269526d43af4a3db1e4c85c748f49f768417f8dcb827803603",
239
+ "sha256": "b5ff393f6429e787a599fe1b3a1a9e3e06346de5654acb9094741ee0089206f8",
240
240
  "mode": "100644"
241
241
  },
242
242
  {
@@ -261,12 +261,12 @@
261
261
  },
262
262
  {
263
263
  "path": "package-lock.json",
264
- "sha256": "4107cec6df7d25471893b22de2ed514e2e9c381a9f3faa861e6642cd7ed5ceed",
264
+ "sha256": "1753c85db32177e3eb0341a0ff5c4b2d658924a10c156a94f2fc69fc3e678578",
265
265
  "mode": "100644"
266
266
  },
267
267
  {
268
268
  "path": "package.json",
269
- "sha256": "2b9dc1e23e4cab876849b7f4c9abb5ae1cd2769129ccb970268cf8791e0886d9",
269
+ "sha256": "d116d70fb57dc62fff99e9aa673e423cc995e972c634453635fead6d19f02b77",
270
270
  "mode": "100644"
271
271
  },
272
272
  {
@@ -926,7 +926,7 @@
926
926
  },
927
927
  {
928
928
  "path": "tests/funnel-agent-docs.test.ts",
929
- "sha256": "6005c77980962cdf41beff3ba7554e389684e19d218a4c88441d28769b75f60e",
929
+ "sha256": "050d253bcdd9de14d2310574faeaa58cfd06243ffc6f4246ad942b2063c9c4f5",
930
930
  "mode": "100644"
931
931
  },
932
932
  {
@@ -1069,6 +1069,11 @@
1069
1069
  "sha256": "d8886cd69d1895576e821ca1c1c8fc2d6e75b9741390b3a3a57b123f18695be3",
1070
1070
  "mode": "100644"
1071
1071
  },
1072
+ {
1073
+ "path": "vercel.json",
1074
+ "sha256": "b2ca3677c797f6006864cf604eee0ad15713d2d2b5f8b8b8b6f74a683095f428",
1075
+ "mode": "100644"
1076
+ },
1072
1077
  {
1073
1078
  "path": "vitest.config.ts",
1074
1079
  "sha256": "60019594865106f483d16e204d47e894fdc0f12d6c759a0d40a2b24af480117d",
@@ -54,7 +54,10 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
54
54
  - A paywall presents purchasable plans. A loading, reveal, or “ready” screen is an interstitial.
55
55
  - Every choice declares `choice.answerKey`, stores stable option IDs in the exact scalar/array shape, and uses `useStepChoices`.
56
56
  - Email capture uses `submitEmailCapture`; it never manually sends analytics or hard-codes paywall navigation.
57
- - `subscription-started` is the `purchase_completed` terminal. Browser terminal reach is not Quiz completed; only the trusted backend records `purchase_completed` after verifying an initial purchase.
57
+ - Quiz completed counts each unique user who reaches a paywall step.
58
+ - `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed.
59
+ - Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
60
+ - `subscription-started` remains the contract-v3 `purchase_completed` terminal type, and only the trusted backend records the purchase event after verifying an initial purchase.
58
61
  - Let the controller distinguish completion from exit and suppress provider delivery in preview.
59
62
 
60
63
  ## Standard workflow
@@ -24,7 +24,9 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
24
24
  | `step_exited` | `step_exited` | `step_exit` | `any` | `any` | `controller` | `true` | `step-visit` | `funnelId`, `funnelVersionId`, `environment`, `stepContractVersion`, `stepId`, `stepName`, `stepType` |
25
25
  | `step_started` | `step_started` | `step_start` | `any` | `any` | `controller` | `true` | `step-visit` | `funnelId`, `funnelVersionId`, `environment`, `stepContractVersion`, `stepId`, `stepName`, `stepType` |
26
26
 
27
- The `purchase_completed` event is owned by `trusted-server` and is recorded only after the backend verifies a successful initial purchase. Entering the browser terminal or emitting `funnel_completed` does not create this business conversion. The separate `registration_completed` event remains owned by `trusted-server` for the later app-link claim. The `email_captured` event is owned by `transactional-server` and uses `logical-email-conversion` deduplication.
27
+ Quiz completed counts each unique user who reaches a paywall step. `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed. Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
28
+
29
+ The `purchase_completed` event is owned by `trusted-server` and is recorded only after the backend verifies a successful initial purchase. The separate `registration_completed` event remains owned by `trusted-server` for the later app-link claim. The `email_captured` event is owned by `transactional-server` and uses `logical-email-conversion` deduplication.
28
30
  <!-- funnelsgrove:generated:end contract-v3/contract/analytics-events -->
29
31
 
30
32
  ## Ownership rules
@@ -34,7 +36,7 @@ The `purchase_completed` event is owned by `trusted-server` and is recorded only
34
36
  - `submitEmailCapture` creates `email_captured` transactionally, then routes only after success.
35
37
  - Named payment helpers emit checkout semantic events at real payment boundaries.
36
38
  - The terminal helper owns funnel completion.
37
- - A trusted backend owns `purchase_completed` after verifying an initial subscription or one-time payment; browser code never emits it, and terminal reach does not count as Quiz completed.
39
+ - A trusted backend owns `purchase_completed` after verifying an initial subscription or one-time payment; browser code never emits it. This purchase event is independent from the paywall-reach definition of Quiz completed.
38
40
  - A separate trusted server claim owns `registration_completed` when the purchased subscription is later linked in the app.
39
41
  - Provider adapters and the durable outbox own PostHog and server Meta delivery.
40
42
 
@@ -37,6 +37,8 @@ A paywall presents purchasable plans. A reveal, loading state, calculation, or
37
37
 
38
38
  ## Purchase completion separation
39
39
 
40
- The canonical `subscription-started` route keeps its stable identity but uses the `purchase_completed` terminal type in contract v3. It may emit lifecycle-only `funnel_completed`, but entering it never counts as Quiz completed. Only the trusted backend emits `purchase_completed` after verifying an initial subscription or one-time payment; renewals, pending payments, and browser checkout returns do not qualify. `registration_completed` remains the later app-link conversion.
40
+ Quiz completed counts each unique user who reaches a paywall step. `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed. Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
41
+
42
+ The canonical `subscription-started` route keeps its stable identity and remains the `purchase_completed` terminal type in contract v3. Only the trusted backend emits the purchase event after verifying an initial subscription or one-time payment; renewals, pending payments, and browser checkout returns do not qualify. `registration_completed` remains the later app-link conversion.
41
43
 
42
44
  Before publishing, complete [paywall/checkout QA](../qa/paywall-checkout.md) and [publish QA](../qa/publish.md).
@@ -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.1.62` first, then `@funnelsgrove/analytics` `0.1.39`, then `@funnelsgrove/payments` `0.1.56`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.35`. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.1.63` first, then `@funnelsgrove/analytics` `0.1.41`, then `@funnelsgrove/payments` `0.1.58`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.43`. 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
@@ -32,7 +32,9 @@ Contract hash: `d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf
32
32
  - Choice steps save the exact stable ID shape before completion.
33
33
  - Email success creates one server conversion; duplicate capture skips browser fanout; failure changes no state/lifecycle/route.
34
34
  - Checkout helpers fire only at real boundaries with complete metadata and stable event IDs.
35
- - Quiz completed requires trusted-server `purchase_completed`, deduplicated by `provider-payment`; browser `funnel_completed` is lifecycle-only and never satisfies it.
35
+ - Quiz completed counts each unique user who reaches a paywall step.
36
+ - `purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed.
37
+ - Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.
36
38
  - `registration_completed` remains the separate later app-link claim.
37
39
  - Preview sends no API/provider analytics.
38
40
  - No component sends PostHog or server Meta directly.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.23",
3
+ "bundleVersion": "2.0.31",
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.39",
12
- "@funnelsgrove/payments": "^0.1.56",
13
- "@funnelsgrove/runtime": "^0.1.62",
11
+ "@funnelsgrove/analytics": "^0.1.41",
12
+ "@funnelsgrove/payments": "^0.1.58",
13
+ "@funnelsgrove/runtime": "^0.1.63",
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,17 +891,17 @@
891
891
  }
892
892
  },
893
893
  "node_modules/@funnelsgrove/analytics": {
894
- "version": "0.1.39",
895
- "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.39.tgz",
896
- "integrity": "sha512-c7cBRHrq7FYOJLPJWCRH778ccWLAIK+4ArgD9xrjwSOcHBHeBpt87DMMtvL6vnD/kPSJIu4oLucD3eF3CZ900g==",
894
+ "version": "0.1.41",
895
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.41.tgz",
896
+ "integrity": "sha512-RrAlBajsJawxpG1ijthRhGcuyqoPCP29r4XNu3K980zrtkWidYu0E4TqBPdPHTmhBb6WNnMcfVHV6H7XaqkQ8A==",
897
897
  "dependencies": {
898
- "@funnelsgrove/runtime": "0.1.62"
898
+ "@funnelsgrove/runtime": "0.1.63"
899
899
  }
900
900
  },
901
901
  "node_modules/@funnelsgrove/payments": {
902
- "version": "0.1.56",
903
- "resolved": "https://registry.npmjs.org/@funnelsgrove/payments/-/payments-0.1.56.tgz",
904
- "integrity": "sha512-3I+LlKKPOJOc/cL2NeqENyFrXiQSjtHbtqXbMRAYoxFK1Zrt3z8kkCq5JPDzOfD/In5xOaDUnxorVuuMXMvXog==",
902
+ "version": "0.1.58",
903
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/payments/-/payments-0.1.58.tgz",
904
+ "integrity": "sha512-y1caUil8SFNiuYf/TxptheEf/cnK2urafy2eF2gFdfugfaybFiqUiyTzEVen+K+uKtX8tDCk2UtNeyWMO8inAA==",
905
905
  "dependencies": {
906
906
  "@funnelsgrove/analytics": "^0.1.28",
907
907
  "@funnelsgrove/runtime": "^0.1.54",
@@ -913,9 +913,9 @@
913
913
  }
914
914
  },
915
915
  "node_modules/@funnelsgrove/runtime": {
916
- "version": "0.1.62",
917
- "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.1.62.tgz",
918
- "integrity": "sha512-S27kA3f7Y30CsqNxajcGwfkdyz19UOlWtjlqYLiM8Mn0HzJoyxGpU4xpMopROqrpArhmy/S9dzvF250pSpgeBw==",
916
+ "version": "0.1.63",
917
+ "resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.1.63.tgz",
918
+ "integrity": "sha512-D0y7l/GwVc519CBr3TCxsXvr3H+B9RmcvebBUKks+FqdDx5j2AO5qdUbB838bqkBNCCjHOtcbs3u2Gsm4Qhk4w==",
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.39",
16
- "@funnelsgrove/payments": "^0.1.56",
17
- "@funnelsgrove/runtime": "^0.1.62",
15
+ "@funnelsgrove/analytics": "^0.1.41",
16
+ "@funnelsgrove/payments": "^0.1.58",
17
+ "@funnelsgrove/runtime": "^0.1.63",
18
18
  "@stripe/react-stripe-js": "^5.6.0",
19
19
  "@stripe/stripe-js": "^8.7.0",
20
20
  "lucide-react": "^0.553.0",
@@ -300,21 +300,31 @@ describe('funnel agent documentation supply', () => {
300
300
  }
301
301
  });
302
302
 
303
- it('requires trusted purchase completion for the Quiz completed QA assertion', async () => {
304
- const content = await readFile(
305
- join(templateRoot, 'docs/funnelsgrove/qa/analytics.md'),
306
- 'utf8',
307
- );
308
-
309
- expect(content).toContain(
310
- 'Quiz completed requires trusted-server `purchase_completed`, deduplicated by `provider-payment`',
311
- );
312
- expect(content).toContain(
313
- 'browser `funnel_completed` is lifecycle-only and never satisfies it',
314
- );
315
- expect(content).toContain(
316
- '`registration_completed` remains the separate later app-link claim',
317
- );
303
+ it('defines Quiz completed by unique paywall reach without conflating purchase verification', async () => {
304
+ const paths = [
305
+ 'docs/funnelsgrove/qa/analytics.md',
306
+ 'docs/funnelsgrove/contracts/analytics-events.md',
307
+ 'docs/funnelsgrove/START-HERE.md',
308
+ 'docs/funnelsgrove/contracts/payments.md',
309
+ ];
310
+ const contents = await Promise.all(paths.map(async (path) => ({
311
+ path,
312
+ content: await readFile(join(templateRoot, path), 'utf8'),
313
+ })));
314
+
315
+ for (const { path, content } of contents) {
316
+ expect(content, path).toContain(
317
+ 'Quiz completed counts each unique user who reaches a paywall step.',
318
+ );
319
+ expect(content, path).toContain(
320
+ '`purchase_completed` remains trusted-server-only purchase verification and does not define Quiz completed.',
321
+ );
322
+ expect(content, path).toContain(
323
+ 'Browser terminal reach and `funnel_completed` remain lifecycle-only and are not purchase conversions.',
324
+ );
325
+ expect(content, path).not.toMatch(/Quiz completed requires[^.]*purchase_completed/i);
326
+ expect(content, path).not.toMatch(/terminal reach[^.]*not (?:count|counts) as Quiz completed/i);
327
+ }
318
328
  });
319
329
 
320
330
  it('preserves the implementation-owned visitor metric while linking event ownership', async () => {
@@ -340,7 +350,7 @@ describe('funnel agent documentation supply', () => {
340
350
 
341
351
  expect(manifest).toMatchObject({
342
352
  schemaVersion: 1,
343
- bundleVersion: '2.0.23',
353
+ bundleVersion: '2.0.31',
344
354
  stepContractVersion: contract.stepContractVersion,
345
355
  contractHash: contract.contractHash,
346
356
  });
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://openapi.vercel.sh/vercel.json",
3
+ "git": {
4
+ "deploymentEnabled": false
5
+ }
6
+ }