@funnelsgrove/cli 0.1.50 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +52 -0
- package/funnel-contract-compatibility.json +35 -35
- package/package.json +4 -4
- package/template_docs/.funnelsgrove-docs.json +4 -4
- package/template_docs/docs/funnelsgrove/migrations/step-contract-v3.md +1 -1
- package/template_docs/docs/funnelsgrove/recipes/add-experiment.md +13 -1
- package/template_docs/funnel-docs.config.json +1 -1
- package/template_scaffold/.funnelsgrove-docs.json +4 -4
- package/template_scaffold/.funnelsgrove-scaffold.json +14 -14
- package/template_scaffold/docs/funnelsgrove/migrations/step-contract-v3.md +1 -1
- package/template_scaffold/docs/funnelsgrove/recipes/add-experiment.md +13 -1
- package/template_scaffold/funnel-docs.config.json +1 -1
- package/template_scaffold/package-lock.json +14 -14
- package/template_scaffold/package.json +3 -3
- package/template_scaffold/src/components/FunnelFlow.tsx +26 -0
- package/template_scaffold/src/runtime/use-funnel-flow-controller.ts +15 -1
- package/template_scaffold/src/steps/step-32-paywall.tsx +47 -15
- package/template_scaffold/tests/funnel-agent-docs.test.ts +1 -1
- package/template_scaffold/tests/src/components/FunnelFlow.test.tsx +4 -0
- package/template_scaffold/tests/src/steps/step-32-paywall.test.ts +6 -3
package/README.md
CHANGED
|
@@ -48,6 +48,9 @@ Create an experiment draft from a strict JSON spec:
|
|
|
48
48
|
```bash
|
|
49
49
|
fgrove experiments create --spec experiment.json --dir .
|
|
50
50
|
fgrove experiments create --spec experiment.json --dir . --json
|
|
51
|
+
fgrove experiments start <experiment-uuid>
|
|
52
|
+
fgrove experiments stop <experiment-uuid>
|
|
53
|
+
fgrove experiments restart <experiment-uuid> --json
|
|
51
54
|
fgrove validate
|
|
52
55
|
```
|
|
53
56
|
|
package/dist/cli.d.ts
CHANGED
|
@@ -267,6 +267,14 @@ export declare const formatOfferSetSyncSuccess: (input: {
|
|
|
267
267
|
offerSetLabel: string;
|
|
268
268
|
generatedFileCount: number;
|
|
269
269
|
}) => string[];
|
|
270
|
+
type ExperimentLifecycleAction = 'start' | 'stop' | 'restart' | 'end';
|
|
271
|
+
type ExperimentLifecycleResult = {
|
|
272
|
+
id: string;
|
|
273
|
+
funnel_id: string;
|
|
274
|
+
name?: string | null;
|
|
275
|
+
status: string;
|
|
276
|
+
};
|
|
277
|
+
export declare const formatExperimentLifecycleSuccess: (action: ExperimentLifecycleAction, result: ExperimentLifecycleResult, json: boolean) => string;
|
|
270
278
|
export declare const program: Command;
|
|
271
279
|
type AnalyticsApiCall = (input: {
|
|
272
280
|
path: string;
|
package/dist/cli.js
CHANGED
|
@@ -1499,6 +1499,24 @@ export const formatOfferSetSyncSuccess = (input) => [
|
|
|
1499
1499
|
`Synced offer set ${input.offerSetLabel} to funnel draft`,
|
|
1500
1500
|
`Wrote ${formatGeneratedFileCount(input.generatedFileCount)}`,
|
|
1501
1501
|
];
|
|
1502
|
+
export const formatExperimentLifecycleSuccess = (action, result, json) => {
|
|
1503
|
+
const payload = {
|
|
1504
|
+
experimentId: result.id,
|
|
1505
|
+
funnelId: result.funnel_id,
|
|
1506
|
+
status: result.status,
|
|
1507
|
+
};
|
|
1508
|
+
if (json) {
|
|
1509
|
+
return `${JSON.stringify(payload)}\n`;
|
|
1510
|
+
}
|
|
1511
|
+
const verb = action === 'stop'
|
|
1512
|
+
? 'Stopped'
|
|
1513
|
+
: action === 'restart'
|
|
1514
|
+
? 'Restarted'
|
|
1515
|
+
: action === 'end'
|
|
1516
|
+
? 'Ended'
|
|
1517
|
+
: 'Started';
|
|
1518
|
+
return `${verb} experiment ${result.name?.trim() || result.id} (${result.status})\n`;
|
|
1519
|
+
};
|
|
1502
1520
|
/**
|
|
1503
1521
|
* @deprecated Compatibility path for fgrove generated-config sync only.
|
|
1504
1522
|
* Dashboard and analytics step discovery must use projects.funnelSteps/version stepMetadata.
|
|
@@ -1779,6 +1797,40 @@ addExamples(experimentsCommand
|
|
|
1779
1797
|
});
|
|
1780
1798
|
process.stdout.write(formatExperimentCreateSuccess(result, options.json === true));
|
|
1781
1799
|
});
|
|
1800
|
+
const registerExperimentLifecycleCommand = (action, description) => {
|
|
1801
|
+
addExamples(experimentsCommand
|
|
1802
|
+
.command(`${action} <id>`)
|
|
1803
|
+
.description(description)
|
|
1804
|
+
.option('--json', 'Emit one machine-readable success object'), [`fgrove experiments ${action} 22222222-2222-4222-8222-222222222222`])
|
|
1805
|
+
.action(async (id, options) => {
|
|
1806
|
+
const result = await callApi({
|
|
1807
|
+
path: `funnelExperiments.${action}`,
|
|
1808
|
+
type: 'mutation',
|
|
1809
|
+
token: await readAuthToken(),
|
|
1810
|
+
data: { id },
|
|
1811
|
+
});
|
|
1812
|
+
process.stdout.write(formatExperimentLifecycleSuccess(action, result, options.json === true));
|
|
1813
|
+
});
|
|
1814
|
+
};
|
|
1815
|
+
registerExperimentLifecycleCommand('start', 'Start a draft or stopped experiment');
|
|
1816
|
+
registerExperimentLifecycleCommand('stop', 'Stop traffic without ending the experiment');
|
|
1817
|
+
registerExperimentLifecycleCommand('restart', 'Stop and start an experiment, preserving its variants');
|
|
1818
|
+
registerExperimentLifecycleCommand('end', 'Permanently end and archive an experiment');
|
|
1819
|
+
addExamples(experimentsCommand
|
|
1820
|
+
.command('delete <id>')
|
|
1821
|
+
.description('Delete a draft experiment')
|
|
1822
|
+
.option('--json', 'Emit one machine-readable success object'), ['fgrove experiments delete 22222222-2222-4222-8222-222222222222'])
|
|
1823
|
+
.action(async (id, options) => {
|
|
1824
|
+
await callApi({
|
|
1825
|
+
path: 'funnelExperiments.delete',
|
|
1826
|
+
type: 'mutation',
|
|
1827
|
+
token: await readAuthToken(),
|
|
1828
|
+
data: { id },
|
|
1829
|
+
});
|
|
1830
|
+
process.stdout.write(options.json === true
|
|
1831
|
+
? `${JSON.stringify({ experimentId: id, deleted: true })}\n`
|
|
1832
|
+
: `Deleted experiment ${id}\n`);
|
|
1833
|
+
});
|
|
1782
1834
|
addExamples(experimentsCommand
|
|
1783
1835
|
.command('sync')
|
|
1784
1836
|
.description('Write generated experiment config for a funnel')
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"minimumCliVersion": "0.1.20",
|
|
5
5
|
"entries": [
|
|
6
6
|
{
|
|
7
|
-
"repositoryCliVersion": "0.1.
|
|
7
|
+
"repositoryCliVersion": "0.1.59",
|
|
8
8
|
"manifest": {
|
|
9
9
|
"schemaVersion": 1,
|
|
10
|
-
"bundleVersion": "2.0.
|
|
10
|
+
"bundleVersion": "2.0.48",
|
|
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": "
|
|
48
|
+
"sha256": "ad72376d6e98c3908bc57e6853387008dca3367f9dba2d7b43cdc4b90148ef4e"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
68
|
-
"sha256": "
|
|
68
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -145,16 +145,16 @@
|
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
"path": "funnel-docs.config.json",
|
|
148
|
-
"sha256": "
|
|
148
|
+
"sha256": "9d1cb3d86bb1eaa518d04151829b71bb72c21a13c175fcec5ad798393b2f4340"
|
|
149
149
|
}
|
|
150
150
|
]
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
|
-
"repositoryCliVersion": "0.1.
|
|
154
|
+
"repositoryCliVersion": "0.1.58",
|
|
155
155
|
"manifest": {
|
|
156
156
|
"schemaVersion": 1,
|
|
157
|
-
"bundleVersion": "2.0.
|
|
157
|
+
"bundleVersion": "2.0.47",
|
|
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": "
|
|
195
|
+
"sha256": "4ea96f97ccad5bd9b01f0eeb30936557dec46f9b272599f12f96ffc6bcdc1883"
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
198
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
215
|
-
"sha256": "
|
|
215
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -292,16 +292,16 @@
|
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
294
|
"path": "funnel-docs.config.json",
|
|
295
|
-
"sha256": "
|
|
295
|
+
"sha256": "acd7e0c21d82218ed385a5606c1824af2d452368e0e9857cf2b2ddf341f1b855"
|
|
296
296
|
}
|
|
297
297
|
]
|
|
298
298
|
}
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
|
-
"repositoryCliVersion": "0.1.
|
|
301
|
+
"repositoryCliVersion": "0.1.57",
|
|
302
302
|
"manifest": {
|
|
303
303
|
"schemaVersion": 1,
|
|
304
|
-
"bundleVersion": "2.0.
|
|
304
|
+
"bundleVersion": "2.0.46",
|
|
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": "
|
|
342
|
+
"sha256": "f7c68708397ff163bfbb29bf49d3e92a8d043100587efe9401478a2365f797c8"
|
|
343
343
|
},
|
|
344
344
|
{
|
|
345
345
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
},
|
|
360
360
|
{
|
|
361
361
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
362
|
-
"sha256": "
|
|
362
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
363
363
|
},
|
|
364
364
|
{
|
|
365
365
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -439,16 +439,16 @@
|
|
|
439
439
|
},
|
|
440
440
|
{
|
|
441
441
|
"path": "funnel-docs.config.json",
|
|
442
|
-
"sha256": "
|
|
442
|
+
"sha256": "00a3c1130a35be8d05380788e2d73444c78a65f661eb45963b929b5b7eda005a"
|
|
443
443
|
}
|
|
444
444
|
]
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
447
|
{
|
|
448
|
-
"repositoryCliVersion": "0.1.
|
|
448
|
+
"repositoryCliVersion": "0.1.56",
|
|
449
449
|
"manifest": {
|
|
450
450
|
"schemaVersion": 1,
|
|
451
|
-
"bundleVersion": "2.0.
|
|
451
|
+
"bundleVersion": "2.0.44",
|
|
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": "
|
|
489
|
+
"sha256": "3bec55a8b14cb0c308d83597af78a59e3c5e8056605a0edc11411ee4e9441c93"
|
|
490
490
|
},
|
|
491
491
|
{
|
|
492
492
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -506,7 +506,7 @@
|
|
|
506
506
|
},
|
|
507
507
|
{
|
|
508
508
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
509
|
-
"sha256": "
|
|
509
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
510
510
|
},
|
|
511
511
|
{
|
|
512
512
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -586,16 +586,16 @@
|
|
|
586
586
|
},
|
|
587
587
|
{
|
|
588
588
|
"path": "funnel-docs.config.json",
|
|
589
|
-
"sha256": "
|
|
589
|
+
"sha256": "bcfdb025c8123433ec0c8647fc7f4ce899b49479f91b10d06b354315854302cf"
|
|
590
590
|
}
|
|
591
591
|
]
|
|
592
592
|
}
|
|
593
593
|
},
|
|
594
594
|
{
|
|
595
|
-
"repositoryCliVersion": "0.1.
|
|
595
|
+
"repositoryCliVersion": "0.1.55",
|
|
596
596
|
"manifest": {
|
|
597
597
|
"schemaVersion": 1,
|
|
598
|
-
"bundleVersion": "2.0.
|
|
598
|
+
"bundleVersion": "2.0.43",
|
|
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": "
|
|
636
|
+
"sha256": "e5f8b97b447f2840a2cfdcec5805a8689aaf000bc79d7aa8a91bc2a780f99ae8"
|
|
637
637
|
},
|
|
638
638
|
{
|
|
639
639
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -653,7 +653,7 @@
|
|
|
653
653
|
},
|
|
654
654
|
{
|
|
655
655
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
656
|
-
"sha256": "
|
|
656
|
+
"sha256": "7b2d28d84042c7b22f1cc26f0407389c4bfc6d38f82b473cb128a822f750b0d8"
|
|
657
657
|
},
|
|
658
658
|
{
|
|
659
659
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -733,16 +733,16 @@
|
|
|
733
733
|
},
|
|
734
734
|
{
|
|
735
735
|
"path": "funnel-docs.config.json",
|
|
736
|
-
"sha256": "
|
|
736
|
+
"sha256": "e9c4a2a407ac624b55783886b2835bb6822c93ab9427fa979eb793a543879ab4"
|
|
737
737
|
}
|
|
738
738
|
]
|
|
739
739
|
}
|
|
740
740
|
},
|
|
741
741
|
{
|
|
742
|
-
"repositoryCliVersion": "0.1.
|
|
742
|
+
"repositoryCliVersion": "0.1.54",
|
|
743
743
|
"manifest": {
|
|
744
744
|
"schemaVersion": 1,
|
|
745
|
-
"bundleVersion": "2.0.
|
|
745
|
+
"bundleVersion": "2.0.42",
|
|
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": "
|
|
783
|
+
"sha256": "aa82f47c9f66d85c20ab909416d8dd92817787e5d14ff8e1149f2c50b73f6b57"
|
|
784
784
|
},
|
|
785
785
|
{
|
|
786
786
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -800,7 +800,7 @@
|
|
|
800
800
|
},
|
|
801
801
|
{
|
|
802
802
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
803
|
-
"sha256": "
|
|
803
|
+
"sha256": "7b2d28d84042c7b22f1cc26f0407389c4bfc6d38f82b473cb128a822f750b0d8"
|
|
804
804
|
},
|
|
805
805
|
{
|
|
806
806
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -880,16 +880,16 @@
|
|
|
880
880
|
},
|
|
881
881
|
{
|
|
882
882
|
"path": "funnel-docs.config.json",
|
|
883
|
-
"sha256": "
|
|
883
|
+
"sha256": "ec2b1694bc85fd38afd1a8d6eccebe1bde88a9dfddacfb589b351c43ae7f9d47"
|
|
884
884
|
}
|
|
885
885
|
]
|
|
886
886
|
}
|
|
887
887
|
},
|
|
888
888
|
{
|
|
889
|
-
"repositoryCliVersion": "0.1.
|
|
889
|
+
"repositoryCliVersion": "0.1.53",
|
|
890
890
|
"manifest": {
|
|
891
891
|
"schemaVersion": 1,
|
|
892
|
-
"bundleVersion": "2.0.
|
|
892
|
+
"bundleVersion": "2.0.41",
|
|
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": "
|
|
930
|
+
"sha256": "7993d09cd90636290a43ee9ed0cdebf62a4fea99c77625b7880d2641b6175ba0"
|
|
931
931
|
},
|
|
932
932
|
{
|
|
933
933
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -947,7 +947,7 @@
|
|
|
947
947
|
},
|
|
948
948
|
{
|
|
949
949
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
950
|
-
"sha256": "
|
|
950
|
+
"sha256": "7b2d28d84042c7b22f1cc26f0407389c4bfc6d38f82b473cb128a822f750b0d8"
|
|
951
951
|
},
|
|
952
952
|
{
|
|
953
953
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -1027,7 +1027,7 @@
|
|
|
1027
1027
|
},
|
|
1028
1028
|
{
|
|
1029
1029
|
"path": "funnel-docs.config.json",
|
|
1030
|
-
"sha256": "
|
|
1030
|
+
"sha256": "dd7eeb6a8028af400f7c28565b622a3ae824e67c9830b71f4c83fbb2487d2159"
|
|
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.
|
|
3
|
+
"version": "0.1.59",
|
|
4
4
|
"description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "vitest run"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@funnelsgrove/runtime": "0.
|
|
37
|
+
"@funnelsgrove/runtime": "0.6.0",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"typescript": "^5.8.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@funnelsgrove/analytics": "0.1.
|
|
43
|
-
"@funnelsgrove/payments": "0.
|
|
42
|
+
"@funnelsgrove/analytics": "0.1.48",
|
|
43
|
+
"@funnelsgrove/payments": "0.6.0",
|
|
44
44
|
"vitest": "^3.0.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"bundleVersion": "2.0.
|
|
3
|
+
"bundleVersion": "2.0.48",
|
|
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": "
|
|
41
|
+
"sha256": "ad72376d6e98c3908bc57e6853387008dca3367f9dba2d7b43cdc4b90148ef4e"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
61
|
-
"sha256": "
|
|
61
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"path": "funnel-docs.config.json",
|
|
141
|
-
"sha256": "
|
|
141
|
+
"sha256": "9d1cb3d86bb1eaa518d04151829b71bb72c21a13c175fcec5ad798393b2f4340"
|
|
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.
|
|
20
|
+
Release `@funnelsgrove/runtime` `0.6.0` first, then `@funnelsgrove/analytics` `0.1.48`, then `@funnelsgrove/payments` `0.6.0`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.59`. 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
|
|
@@ -150,7 +150,19 @@ Each pricing variant also requires a non-empty `offerSetKey`, and every `routeTo
|
|
|
150
150
|
|
|
151
151
|
The stable `id` becomes the experiment key. Keep it unchanged for an exact retry: an identical same-key draft is reused, while a different definition or non-draft experiment is rejected rather than overwritten.
|
|
152
152
|
|
|
153
|
-
Creation always produces a draft. It does not create or activate a PostHog flag, start traffic, or make unfinished variant steps or offer sets runnable.
|
|
153
|
+
Creation always produces a draft. It does not create or activate a PostHog flag, start traffic, or make unfinished variant steps or offer sets runnable. After QA, manage traffic through the lifecycle API exposed by the CLI:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
fgrove experiments start <experiment-uuid>
|
|
157
|
+
fgrove experiments stop <experiment-uuid>
|
|
158
|
+
fgrove experiments restart <experiment-uuid>
|
|
159
|
+
fgrove experiments end <experiment-uuid>
|
|
160
|
+
fgrove experiments delete <experiment-uuid>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`stop` is reversible: it pauses traffic and keeps the experiment, variants, and PostHog flag available for a later `start`. `restart` stops a running experiment when necessary and starts it again while preserving the existing definition. `end` permanently archives the experiment; `delete` removes a draft. Each command updates PostHog when required and commits the final experiment status to the hosted generated funnel config. Use `--json` for agent-readable output. Run `fgrove experiments sync` afterward when the local generated config also needs to reflect the lifecycle change.
|
|
164
|
+
|
|
165
|
+
The corresponding authenticated API mutations are agent-only. Normal browser sessions cannot call experiment lifecycle mutations.
|
|
154
166
|
|
|
155
167
|
The API creates the experiment and variants atomically, commits the matching generated snapshot to the hosted draft, and only then returns. The draft is immediately visible in the FunnelsGrove UI and hosted previews use the same snapshot. The CLI installs the exact returned bytes at `src/config/experiments.generated.ts` and `src/config/experiments.ts`, then updates the sync manifest last. `.funnelsgrove-sync.json` stays local and ignored; never commit or push it.
|
|
156
168
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"bundleVersion": "2.0.
|
|
3
|
+
"bundleVersion": "2.0.48",
|
|
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": "
|
|
41
|
+
"sha256": "ad72376d6e98c3908bc57e6853387008dca3367f9dba2d7b43cdc4b90148ef4e"
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"path": "docs/funnelsgrove/qa/analytics.md",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
61
|
-
"sha256": "
|
|
61
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"path": "docs/funnelsgrove/recipes/add-step.md",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"path": "funnel-docs.config.json",
|
|
141
|
-
"sha256": "
|
|
141
|
+
"sha256": "9d1cb3d86bb1eaa518d04151829b71bb72c21a13c175fcec5ad798393b2f4340"
|
|
142
142
|
}
|
|
143
143
|
]
|
|
144
144
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"sourceTreeHash": "
|
|
3
|
+
"sourceTreeHash": "41b6b7eec71315bd81596941c6852c36c4f895b01ba40a81111776aeecf16dea",
|
|
4
4
|
"stepContractVersion": 3,
|
|
5
|
-
"docsBundleVersion": "2.0.
|
|
5
|
+
"docsBundleVersion": "2.0.48",
|
|
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": "
|
|
19
|
+
"sha256": "c9fa3147885021a39952017eab26e7ec9e980b87416034d31ccb1e27733faf18",
|
|
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": "
|
|
104
|
+
"sha256": "ad72376d6e98c3908bc57e6853387008dca3367f9dba2d7b43cdc4b90148ef4e",
|
|
105
105
|
"mode": "100644"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"path": "docs/funnelsgrove/recipes/add-experiment.md",
|
|
129
|
-
"sha256": "
|
|
129
|
+
"sha256": "ccc216612e0d532790a81d556111417876b0408944cae0eb8cd13e758a196bb8",
|
|
130
130
|
"mode": "100644"
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
238
|
"path": "funnel-docs.config.json",
|
|
239
|
-
"sha256": "
|
|
239
|
+
"sha256": "9d1cb3d86bb1eaa518d04151829b71bb72c21a13c175fcec5ad798393b2f4340",
|
|
240
240
|
"mode": "100644"
|
|
241
241
|
},
|
|
242
242
|
{
|
|
@@ -261,12 +261,12 @@
|
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
263
|
"path": "package-lock.json",
|
|
264
|
-
"sha256": "
|
|
264
|
+
"sha256": "861dd7a1d9491dfb93a4e9e05ea8d56152981d065bf725254723a1cdd088a53a",
|
|
265
265
|
"mode": "100644"
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"path": "package.json",
|
|
269
|
-
"sha256": "
|
|
269
|
+
"sha256": "b1934c08371bb3f8308e73f25301c98f71c66f4c52ad8658801aaab1965e704c",
|
|
270
270
|
"mode": "100644"
|
|
271
271
|
},
|
|
272
272
|
{
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
},
|
|
532
532
|
{
|
|
533
533
|
"path": "src/components/FunnelFlow.tsx",
|
|
534
|
-
"sha256": "
|
|
534
|
+
"sha256": "80aa3d65ad9965b979a737f1c7b4a0f3da3351ee6b4b9dc5ed87f12ce58550ae",
|
|
535
535
|
"mode": "100644"
|
|
536
536
|
},
|
|
537
537
|
{
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
},
|
|
702
702
|
{
|
|
703
703
|
"path": "src/runtime/use-funnel-flow-controller.ts",
|
|
704
|
-
"sha256": "
|
|
704
|
+
"sha256": "12a9abc9ad0ca311abc4a9e2c2f909c6984d28417f46d7c9012e897c3d8f104f",
|
|
705
705
|
"mode": "100644"
|
|
706
706
|
},
|
|
707
707
|
{
|
|
@@ -851,7 +851,7 @@
|
|
|
851
851
|
},
|
|
852
852
|
{
|
|
853
853
|
"path": "src/steps/step-32-paywall.tsx",
|
|
854
|
-
"sha256": "
|
|
854
|
+
"sha256": "86407736b37dbaa88300ba270ea1b51b7ff27bdf2244365bbdb020e5f86004a4",
|
|
855
855
|
"mode": "100644"
|
|
856
856
|
},
|
|
857
857
|
{
|
|
@@ -926,7 +926,7 @@
|
|
|
926
926
|
},
|
|
927
927
|
{
|
|
928
928
|
"path": "tests/funnel-agent-docs.test.ts",
|
|
929
|
-
"sha256": "
|
|
929
|
+
"sha256": "8299048e12c24d702a0f6be1cbeabb6f481ba23f94982e3a04c719cbc9c2895a",
|
|
930
930
|
"mode": "100644"
|
|
931
931
|
},
|
|
932
932
|
{
|
|
@@ -946,7 +946,7 @@
|
|
|
946
946
|
},
|
|
947
947
|
{
|
|
948
948
|
"path": "tests/src/components/FunnelFlow.test.tsx",
|
|
949
|
-
"sha256": "
|
|
949
|
+
"sha256": "baf2607c8dcc29e4aad7a4ee95d932f7569887f7fbdf8dc8a9a3d7566a16e39e",
|
|
950
950
|
"mode": "100644"
|
|
951
951
|
},
|
|
952
952
|
{
|
|
@@ -1046,7 +1046,7 @@
|
|
|
1046
1046
|
},
|
|
1047
1047
|
{
|
|
1048
1048
|
"path": "tests/src/steps/step-32-paywall.test.ts",
|
|
1049
|
-
"sha256": "
|
|
1049
|
+
"sha256": "0306cbe4e10d1f7027d0ba114eb95c8b5b095dfad57472887a4b985f1482afda",
|
|
1050
1050
|
"mode": "100644"
|
|
1051
1051
|
},
|
|
1052
1052
|
{
|
|
@@ -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.
|
|
20
|
+
Release `@funnelsgrove/runtime` `0.6.0` first, then `@funnelsgrove/analytics` `0.1.48`, then `@funnelsgrove/payments` `0.6.0`. Deploy the API and funnel template, then confirm production `/health` reports the new docs identity. Only then publish `@funnelsgrove/cli` `0.1.59`. 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
|
|
@@ -150,7 +150,19 @@ Each pricing variant also requires a non-empty `offerSetKey`, and every `routeTo
|
|
|
150
150
|
|
|
151
151
|
The stable `id` becomes the experiment key. Keep it unchanged for an exact retry: an identical same-key draft is reused, while a different definition or non-draft experiment is rejected rather than overwritten.
|
|
152
152
|
|
|
153
|
-
Creation always produces a draft. It does not create or activate a PostHog flag, start traffic, or make unfinished variant steps or offer sets runnable.
|
|
153
|
+
Creation always produces a draft. It does not create or activate a PostHog flag, start traffic, or make unfinished variant steps or offer sets runnable. After QA, manage traffic through the lifecycle API exposed by the CLI:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
fgrove experiments start <experiment-uuid>
|
|
157
|
+
fgrove experiments stop <experiment-uuid>
|
|
158
|
+
fgrove experiments restart <experiment-uuid>
|
|
159
|
+
fgrove experiments end <experiment-uuid>
|
|
160
|
+
fgrove experiments delete <experiment-uuid>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`stop` is reversible: it pauses traffic and keeps the experiment, variants, and PostHog flag available for a later `start`. `restart` stops a running experiment when necessary and starts it again while preserving the existing definition. `end` permanently archives the experiment; `delete` removes a draft. Each command updates PostHog when required and commits the final experiment status to the hosted generated funnel config. Use `--json` for agent-readable output. Run `fgrove experiments sync` afterward when the local generated config also needs to reflect the lifecycle change.
|
|
164
|
+
|
|
165
|
+
The corresponding authenticated API mutations are agent-only. Normal browser sessions cannot call experiment lifecycle mutations.
|
|
154
166
|
|
|
155
167
|
The API creates the experiment and variants atomically, commits the matching generated snapshot to the hosted draft, and only then returns. The draft is immediately visible in the FunnelsGrove UI and hosted previews use the same snapshot. The CLI installs the exact returned bytes at `src/config/experiments.generated.ts` and `src/config/experiments.ts`, then updates the sync manifest last. `.funnelsgrove-sync.json` stays local and ignored; never commit or push it.
|
|
156
168
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"name": "funnel-template",
|
|
9
9
|
"version": "0.1.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@funnelsgrove/analytics": "^0.1.
|
|
12
|
-
"@funnelsgrove/payments": "^0.
|
|
13
|
-
"@funnelsgrove/runtime": "^0.
|
|
11
|
+
"@funnelsgrove/analytics": "^0.1.48",
|
|
12
|
+
"@funnelsgrove/payments": "^0.6.0",
|
|
13
|
+
"@funnelsgrove/runtime": "^0.6.0",
|
|
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,20 +891,20 @@
|
|
|
891
891
|
}
|
|
892
892
|
},
|
|
893
893
|
"node_modules/@funnelsgrove/analytics": {
|
|
894
|
-
"version": "0.1.
|
|
895
|
-
"resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.
|
|
896
|
-
"integrity": "sha512-
|
|
894
|
+
"version": "0.1.48",
|
|
895
|
+
"resolved": "https://registry.npmjs.org/@funnelsgrove/analytics/-/analytics-0.1.48.tgz",
|
|
896
|
+
"integrity": "sha512-jXpmKYPtXsn21VEgq80gn8QzIbJTqu3mH3NOZh9PpIMg1zTq6wt4OIfHg/0s4RFQ15/Cxxh0FWXj8r1mSTQ9vQ==",
|
|
897
897
|
"dependencies": {
|
|
898
|
-
"@funnelsgrove/runtime": "0.
|
|
898
|
+
"@funnelsgrove/runtime": "0.6.0"
|
|
899
899
|
}
|
|
900
900
|
},
|
|
901
901
|
"node_modules/@funnelsgrove/payments": {
|
|
902
|
-
"version": "0.
|
|
903
|
-
"resolved": "https://registry.npmjs.org/@funnelsgrove/payments/-/payments-0.
|
|
904
|
-
"integrity": "sha512-
|
|
902
|
+
"version": "0.6.0",
|
|
903
|
+
"resolved": "https://registry.npmjs.org/@funnelsgrove/payments/-/payments-0.6.0.tgz",
|
|
904
|
+
"integrity": "sha512-6fhiuC/fIHxdU6Dm7fsu0s4epfNp1u0Lss8ely3htJnQ6LlefUJAEIOp42/Ox3Bt9mO+uVMJHkAtvkPeU8m1uQ==",
|
|
905
905
|
"dependencies": {
|
|
906
906
|
"@funnelsgrove/analytics": "^0.1.28",
|
|
907
|
-
"@funnelsgrove/runtime": "^0.
|
|
907
|
+
"@funnelsgrove/runtime": "^0.6.0",
|
|
908
908
|
"@stripe/react-stripe-js": "^5.6.0",
|
|
909
909
|
"@stripe/stripe-js": "^8.7.0",
|
|
910
910
|
"react": "19.2.3",
|
|
@@ -913,9 +913,9 @@
|
|
|
913
913
|
}
|
|
914
914
|
},
|
|
915
915
|
"node_modules/@funnelsgrove/runtime": {
|
|
916
|
-
"version": "0.
|
|
917
|
-
"resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.
|
|
918
|
-
"integrity": "sha512-
|
|
916
|
+
"version": "0.6.0",
|
|
917
|
+
"resolved": "https://registry.npmjs.org/@funnelsgrove/runtime/-/runtime-0.6.0.tgz",
|
|
918
|
+
"integrity": "sha512-EhjVZm0p1HFSCi7PsTqCeSnM6EqpdWE0r7yVnxNlz32wjlPGF//IZ2CXkZ9VN/KmMEqtOi7Cgq94pO/we1iesw==",
|
|
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.
|
|
16
|
-
"@funnelsgrove/payments": "^0.
|
|
17
|
-
"@funnelsgrove/runtime": "^0.
|
|
15
|
+
"@funnelsgrove/analytics": "^0.1.48",
|
|
16
|
+
"@funnelsgrove/payments": "^0.6.0",
|
|
17
|
+
"@funnelsgrove/runtime": "^0.6.0",
|
|
18
18
|
"@stripe/react-stripe-js": "^5.6.0",
|
|
19
19
|
"@stripe/stripe-js": "^8.7.0",
|
|
20
20
|
"lucide-react": "^0.553.0",
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import { createElement, useMemo, useSyncExternalStore, type ComponentType } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
FunnelProvider,
|
|
6
|
+
FunnelRuntimeConfigBoundary,
|
|
6
7
|
PrimaryButton,
|
|
7
8
|
isPreviewFrameRuntime,
|
|
9
|
+
runtimePublicConfig,
|
|
8
10
|
usePreviewDefinitionOverrideRevision,
|
|
9
11
|
} from '@funnelsgrove/runtime';
|
|
10
12
|
import { FunnelEditorPanel, FunnelEditorPanelStyles } from './FunnelEditorPanel';
|
|
@@ -36,6 +38,30 @@ export function FunnelFlow({
|
|
|
36
38
|
() => isPreviewRuntime,
|
|
37
39
|
() => false,
|
|
38
40
|
);
|
|
41
|
+
return (
|
|
42
|
+
<FunnelRuntimeConfigBoundary
|
|
43
|
+
funnelId={runtimePublicConfig.funnelId}
|
|
44
|
+
funnelVersionId={runtimePublicConfig.funnelVersionId}
|
|
45
|
+
disabled={isPreviewRuntime}
|
|
46
|
+
>
|
|
47
|
+
<FunnelFlowRuntime
|
|
48
|
+
initialStepId={initialStepId}
|
|
49
|
+
lockToInitialStep={lockToInitialStep}
|
|
50
|
+
previewFrameMounted={previewFrameMounted}
|
|
51
|
+
isPreviewThumbnail={isPreviewThumbnail}
|
|
52
|
+
/>
|
|
53
|
+
</FunnelRuntimeConfigBoundary>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function FunnelFlowRuntime({
|
|
58
|
+
initialStepId,
|
|
59
|
+
lockToInitialStep,
|
|
60
|
+
previewFrameMounted,
|
|
61
|
+
isPreviewThumbnail,
|
|
62
|
+
}: FunnelFlowProps & {
|
|
63
|
+
previewFrameMounted: boolean;
|
|
64
|
+
}) {
|
|
39
65
|
const previewDefinitionRevision = usePreviewDefinitionOverrideRevision();
|
|
40
66
|
const controller = useFunnelFlowController({
|
|
41
67
|
initialStepId,
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
computeRenderSuspended,
|
|
5
|
+
toManifestExperiments,
|
|
6
|
+
useFunnelRuntimeConfig,
|
|
5
7
|
useFunnelFlowController as useSharedFunnelFlowController,
|
|
6
8
|
} from '@funnelsgrove/runtime';
|
|
7
9
|
import { publicAnalyticsSdk } from '@funnelsgrove/analytics';
|
|
@@ -32,6 +34,18 @@ export function useFunnelFlowController({
|
|
|
32
34
|
initialStepId = defaultFunnelStepId,
|
|
33
35
|
lockToInitialStep = false,
|
|
34
36
|
}: FunnelFlowControllerInput = {}) {
|
|
37
|
+
const publishedRuntime = useFunnelRuntimeConfig();
|
|
38
|
+
const activeFunnelExperiments = publishedRuntime.config
|
|
39
|
+
? toManifestExperiments(publishedRuntime.config.experiments).map((experiment) => ({
|
|
40
|
+
...experiment,
|
|
41
|
+
stepId: experiment.stepId as FunnelStepId,
|
|
42
|
+
variants: experiment.variants.map((variant) => ({
|
|
43
|
+
...variant,
|
|
44
|
+
routeToStepId: variant.routeToStepId as FunnelStepId,
|
|
45
|
+
})),
|
|
46
|
+
}))
|
|
47
|
+
: funnelExperiments;
|
|
48
|
+
|
|
35
49
|
return useSharedFunnelFlowController<FunnelStepId>({
|
|
36
50
|
analytics: publicAnalyticsSdk,
|
|
37
51
|
stepContractVersion: funnelManifest.stepContractVersion,
|
|
@@ -41,7 +55,7 @@ export function useFunnelFlowController({
|
|
|
41
55
|
stepSequence: funnelStepSequence,
|
|
42
56
|
stepById,
|
|
43
57
|
stepComponentById,
|
|
44
|
-
funnelExperiments,
|
|
58
|
+
funnelExperiments: activeFunnelExperiments,
|
|
45
59
|
getPathForStep,
|
|
46
60
|
getStepIdFromPath,
|
|
47
61
|
getSequentialNextStepId,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@/runtime/checkout-runtime-config';
|
|
10
10
|
import {
|
|
11
11
|
billingDiscountStorageKeys,
|
|
12
|
-
|
|
12
|
+
billingDiscountList,
|
|
13
13
|
claimbeePlansByMode,
|
|
14
14
|
} from '@/config/billing.plans';
|
|
15
15
|
import { stepPaywallContent } from '@/steps/content/step-32-paywall.content';
|
|
@@ -21,9 +21,12 @@ import {
|
|
|
21
21
|
collectCurrentFunnelAttribution,
|
|
22
22
|
readPaywallStateValue,
|
|
23
23
|
runtimePublicConfig,
|
|
24
|
+
resolveGeneratedOfferSetRuntime,
|
|
24
25
|
updatePaywallStateValue,
|
|
25
26
|
useFunnel,
|
|
27
|
+
useFunnelRuntimeConfig,
|
|
26
28
|
useRuntimeMode,
|
|
29
|
+
type GeneratedOfferSet,
|
|
27
30
|
type FunnelStepMeta,
|
|
28
31
|
} from '@funnelsgrove/runtime';
|
|
29
32
|
import { getPathForStep } from '@/runtime/funnel-runtime';
|
|
@@ -34,6 +37,7 @@ import {
|
|
|
34
37
|
SharedStripeCheckoutV2Dialog,
|
|
35
38
|
activateSecondPaywallDiscount,
|
|
36
39
|
advancePaywallDiscountState,
|
|
40
|
+
buildBillingDiscountCatalog,
|
|
37
41
|
buildConfigPaywallPlans,
|
|
38
42
|
buildDiscountedPaywallPlans,
|
|
39
43
|
buildPaywallRenewalDisclaimer,
|
|
@@ -43,6 +47,8 @@ import {
|
|
|
43
47
|
serializePaywallDiscountState,
|
|
44
48
|
usePlatformWalletPaymentMethods,
|
|
45
49
|
useStripeSubscriptionCheckoutSession,
|
|
50
|
+
type BillingFallbackPlanConfig,
|
|
51
|
+
type BillingPlanCatalog,
|
|
46
52
|
type PaywallDiscountState,
|
|
47
53
|
type PlatformWalletPaymentMethod,
|
|
48
54
|
} from '@funnelsgrove/payments';
|
|
@@ -93,7 +99,6 @@ const paywallDetailImageDimensions = {
|
|
|
93
99
|
},
|
|
94
100
|
} as const;
|
|
95
101
|
const defaultSelectedPlan = 'secondary';
|
|
96
|
-
const CLAIMBEE_PAYWALL_SECOND_COUPON_ID = billingDiscounts.second.couponId;
|
|
97
102
|
export const CLAIMBEE_PAYWALL_DISCOUNT_STORAGE_KEYS = billingDiscountStorageKeys;
|
|
98
103
|
const deferPaywallStateSync = (syncState: () => void): (() => void) => {
|
|
99
104
|
const timeoutId = window.setTimeout(syncState, 0);
|
|
@@ -133,16 +138,43 @@ function StepPaywallRuntime({
|
|
|
133
138
|
[runtimeMode],
|
|
134
139
|
);
|
|
135
140
|
const { user, setUser, attributes, featureFlags, completeStep } = useFunnel();
|
|
141
|
+
const publishedRuntime = useFunnelRuntimeConfig();
|
|
136
142
|
const content = useClaimbeeStepContent(stepPaywallId, stepPaywallContent);
|
|
137
143
|
const supportEmail = runtimePublicConfig.supportEmail;
|
|
138
144
|
const walletPaymentMethods = usePlatformWalletPaymentMethods();
|
|
145
|
+
const publishedOfferSetRuntime = useMemo(
|
|
146
|
+
() => publishedRuntime.config && publishedRuntime.config.offerSets.length > 0
|
|
147
|
+
? resolveGeneratedOfferSetRuntime<BillingFallbackPlanConfig>({
|
|
148
|
+
offerSets: publishedRuntime.config.offerSets as readonly GeneratedOfferSet[],
|
|
149
|
+
baseCatalogsByMode: claimbeePlansByMode,
|
|
150
|
+
fallbackDiscounts: billingDiscountList,
|
|
151
|
+
})
|
|
152
|
+
: null,
|
|
153
|
+
[publishedRuntime.config],
|
|
154
|
+
);
|
|
155
|
+
const activeBillingDiscounts = useMemo(
|
|
156
|
+
() => buildBillingDiscountCatalog(
|
|
157
|
+
publishedOfferSetRuntime?.getDiscountList(checkoutMode) ?? billingDiscountList,
|
|
158
|
+
),
|
|
159
|
+
[checkoutMode, publishedOfferSetRuntime],
|
|
160
|
+
);
|
|
161
|
+
const activePlanCatalog = useMemo<BillingPlanCatalog>(
|
|
162
|
+
() => publishedOfferSetRuntime?.getPlanCatalog(checkoutMode) as BillingPlanCatalog
|
|
163
|
+
|| (checkoutMode === 'test' ? claimbeePlansByMode.test : claimbeePlansByMode.live),
|
|
164
|
+
[checkoutMode, publishedOfferSetRuntime],
|
|
165
|
+
);
|
|
166
|
+
const activePlanKeys = useMemo(
|
|
167
|
+
() => publishedOfferSetRuntime?.planKeys.length
|
|
168
|
+
? publishedOfferSetRuntime.planKeys
|
|
169
|
+
: ['primary', 'secondary', 'tertiary'],
|
|
170
|
+
[publishedOfferSetRuntime],
|
|
171
|
+
);
|
|
139
172
|
const availablePlans = useMemo(
|
|
140
|
-
() =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
[checkoutMode],
|
|
173
|
+
() => buildConfigPaywallPlans(
|
|
174
|
+
activePlanCatalog,
|
|
175
|
+
activePlanKeys,
|
|
176
|
+
),
|
|
177
|
+
[activePlanCatalog, activePlanKeys],
|
|
146
178
|
);
|
|
147
179
|
const initialPlanId = useMemo(
|
|
148
180
|
() =>
|
|
@@ -168,7 +200,7 @@ function StepPaywallRuntime({
|
|
|
168
200
|
const [discountStateReady, setDiscountStateReady] = useState(false);
|
|
169
201
|
const [discountState, setDiscountState] = useState<PaywallDiscountState>(() =>
|
|
170
202
|
resolvePaywallDiscountState({
|
|
171
|
-
discounts:
|
|
203
|
+
discounts: activeBillingDiscounts,
|
|
172
204
|
nowMs: Date.now(),
|
|
173
205
|
storedValue: null,
|
|
174
206
|
}),
|
|
@@ -229,7 +261,7 @@ function StepPaywallRuntime({
|
|
|
229
261
|
const activeStory = storyOptions[activeStoryIndex] ?? storyOptions[0] ?? null;
|
|
230
262
|
const minutes = Math.floor(discountState.remainingSeconds / 60);
|
|
231
263
|
const seconds = discountState.remainingSeconds % 60;
|
|
232
|
-
const upgradedDiscountActive = activeCouponId ===
|
|
264
|
+
const upgradedDiscountActive = activeCouponId === activeBillingDiscounts.second.couponId;
|
|
233
265
|
const activeDiscountStartedAtMs =
|
|
234
266
|
discountState.stage === 'second'
|
|
235
267
|
? discountState.secondStartedAtMs
|
|
@@ -371,7 +403,7 @@ function StepPaywallRuntime({
|
|
|
371
403
|
return deferPaywallStateSync(() => {
|
|
372
404
|
setDiscountState(
|
|
373
405
|
resolvePaywallDiscountState({
|
|
374
|
-
discounts:
|
|
406
|
+
discounts: activeBillingDiscounts,
|
|
375
407
|
nowMs: Date.now(),
|
|
376
408
|
storedValue: readPaywallStateValue({
|
|
377
409
|
legacyKeys: CLAIMBEE_PAYWALL_DISCOUNT_STORAGE_KEYS,
|
|
@@ -380,7 +412,7 @@ function StepPaywallRuntime({
|
|
|
380
412
|
);
|
|
381
413
|
setDiscountStateReady(true);
|
|
382
414
|
});
|
|
383
|
-
}, []);
|
|
415
|
+
}, [activeBillingDiscounts]);
|
|
384
416
|
|
|
385
417
|
useEffect(() => {
|
|
386
418
|
return deferPaywallStateSync(() => {
|
|
@@ -396,7 +428,7 @@ function StepPaywallRuntime({
|
|
|
396
428
|
const timer = window.setInterval(() => {
|
|
397
429
|
setDiscountState((current) => {
|
|
398
430
|
const nextState = advancePaywallDiscountState({
|
|
399
|
-
discounts:
|
|
431
|
+
discounts: activeBillingDiscounts,
|
|
400
432
|
state: current,
|
|
401
433
|
nowMs: Date.now(),
|
|
402
434
|
});
|
|
@@ -409,7 +441,7 @@ function StepPaywallRuntime({
|
|
|
409
441
|
}, 1000);
|
|
410
442
|
|
|
411
443
|
return () => window.clearInterval(timer);
|
|
412
|
-
}, [discountStateReady]);
|
|
444
|
+
}, [activeBillingDiscounts, discountStateReady]);
|
|
413
445
|
|
|
414
446
|
useEffect(() => {
|
|
415
447
|
if (storyOptions.length < 2) {
|
|
@@ -567,7 +599,7 @@ function StepPaywallRuntime({
|
|
|
567
599
|
paywallStepRef.current?.scrollTo({ top: 0, behavior: 'smooth' });
|
|
568
600
|
setDiscountState((current) =>
|
|
569
601
|
activateSecondPaywallDiscount({
|
|
570
|
-
discounts:
|
|
602
|
+
discounts: activeBillingDiscounts,
|
|
571
603
|
state: current,
|
|
572
604
|
nowMs: Date.now(),
|
|
573
605
|
}),
|
|
@@ -362,7 +362,7 @@ describe('funnel agent documentation supply', () => {
|
|
|
362
362
|
|
|
363
363
|
expect(manifest).toMatchObject({
|
|
364
364
|
schemaVersion: 1,
|
|
365
|
-
bundleVersion: '2.0.
|
|
365
|
+
bundleVersion: '2.0.48',
|
|
366
366
|
stepContractVersion: contract.stepContractVersion,
|
|
367
367
|
contractHash: contract.contractHash,
|
|
368
368
|
});
|
|
@@ -13,6 +13,10 @@ describe('FunnelFlow lifecycle wiring', () => {
|
|
|
13
13
|
expect(flowSource).not.toContain('publicAnalyticsSdk');
|
|
14
14
|
expect(adapterSource.match(/analytics: publicAnalyticsSdk/g)).toHaveLength(1);
|
|
15
15
|
expect(adapterSource.match(/stepContractVersion: funnelManifest\.stepContractVersion/g)).toHaveLength(1);
|
|
16
|
+
expect(flowSource).toContain('<FunnelRuntimeConfigBoundary');
|
|
17
|
+
expect(flowSource).toContain('disabled={isPreviewRuntime}');
|
|
18
|
+
expect(adapterSource).toContain('toManifestExperiments(publishedRuntime.config.experiments)');
|
|
19
|
+
expect(adapterSource).toContain(': funnelExperiments');
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
it('keeps A/B editor controls without wiring a manual payment mode switch', () => {
|
|
@@ -210,9 +210,11 @@ describe('ClaimBee paywall source', () => {
|
|
|
210
210
|
);
|
|
211
211
|
|
|
212
212
|
expect(stepSource).toContain("from '@/config/billing.plans'");
|
|
213
|
-
expect(stepSource).toContain('
|
|
213
|
+
expect(stepSource).toContain('activeBillingDiscounts');
|
|
214
|
+
expect(stepSource).toContain('useFunnelRuntimeConfig');
|
|
215
|
+
expect(stepSource).toContain('resolveGeneratedOfferSetRuntime');
|
|
214
216
|
expect(stepSource).not.toContain("from '@/config/claimbee-paywall.config'");
|
|
215
|
-
expect(stepSource).toContain('
|
|
217
|
+
expect(stepSource).toContain('activeBillingDiscounts.second.couponId');
|
|
216
218
|
expect(stepSource).toContain('resolvePaywallDiscountState');
|
|
217
219
|
expect(stepSource).toContain('advancePaywallDiscountState');
|
|
218
220
|
expect(stepSource).toContain('serializePaywallDiscountState');
|
|
@@ -504,7 +506,8 @@ describe('ClaimBee paywall source', () => {
|
|
|
504
506
|
expect(stepSource).toContain('const availablePlans = useMemo(');
|
|
505
507
|
expect(stepSource).toContain('buildConfigPaywallPlans');
|
|
506
508
|
expect(stepSource).toContain("['primary', 'secondary', 'tertiary']");
|
|
507
|
-
expect(stepSource).toContain('[checkoutMode]');
|
|
509
|
+
expect(stepSource).toContain('[checkoutMode, publishedOfferSetRuntime]');
|
|
510
|
+
expect(stepSource).toContain('publishedOfferSetRuntime?.getPlanCatalog(checkoutMode)');
|
|
508
511
|
expect(stepSource).toContain("const defaultSelectedPlan = 'secondary'");
|
|
509
512
|
expect(stepSource).not.toContain('CLAIMBEE_PAYWALL_PLAN_ORDER');
|
|
510
513
|
expect(stepSource).not.toContain('getOrderedPaywallPlans');
|