@funnelsgrove/cli 0.1.229 → 0.1.233

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.
Files changed (29) hide show
  1. package/README.md +9 -0
  2. package/dist/cli.js +10 -0
  3. package/dist/locales.d.ts +6 -0
  4. package/dist/locales.js +126 -0
  5. package/funnel-contract-compatibility.json +32 -32
  6. package/package.json +4 -4
  7. package/template_docs/.funnelsgrove-docs.json +5 -5
  8. package/template_docs/AGENTS.md +1 -0
  9. package/template_docs/docs/funnelsgrove/contracts/content-answers.md +50 -0
  10. package/template_docs/docs/funnelsgrove/migrations/step-contract-v3.md +1 -1
  11. package/template_docs/funnel-docs.config.json +1 -1
  12. package/template_scaffold/.funnelsgrove-docs.json +5 -5
  13. package/template_scaffold/.funnelsgrove-scaffold.json +35 -15
  14. package/template_scaffold/AGENTS.md +1 -0
  15. package/template_scaffold/docs/funnelsgrove/contracts/content-answers.md +50 -0
  16. package/template_scaffold/docs/funnelsgrove/migrations/step-contract-v3.md +1 -1
  17. package/template_scaffold/funnel-docs.config.json +1 -1
  18. package/template_scaffold/package-lock.json +15 -15
  19. package/template_scaffold/package.json +3 -3
  20. package/template_scaffold/src/app/subscription-dashboard/page.tsx +22 -19
  21. package/template_scaffold/src/components/FunnelFlow.tsx +11 -5
  22. package/template_scaffold/src/components/paywall/PaywallRenewalDisclaimer.tsx +23 -0
  23. package/template_scaffold/src/components/paywall/localize-paywall-plan-labels.ts +15 -0
  24. package/template_scaffold/src/config/billing.plans.ts +11 -10
  25. package/template_scaffold/src/config/billing.test.plans.ts +11 -10
  26. package/template_scaffold/src/steps/content/runtime.content.ts +22 -0
  27. package/template_scaffold/src/steps/content/step-32-paywall.content.ts +41 -1
  28. package/template_scaffold/src/steps/content/subscription-dashboard.content.ts +54 -0
  29. package/template_scaffold/src/steps/step-32-paywall.tsx +12 -22
package/README.md CHANGED
@@ -150,3 +150,12 @@ rows changed since the last pull. Pull again to resolve a concurrent edit.
150
150
 
151
151
  Use `--api-url` or `FUNNELSGROVE_API_URL` for non-production APIs.
152
152
  Use `--config` or `FUNNELSGROVE_CONFIG` to keep test credentials separate from the default `~/.funnelsgrove/config.json`.
153
+
154
+ ### Add a content locale
155
+
156
+ Run `fgrove locales add ru --dir ./my-funnel` to copy every default content
157
+ object into the new locale without translation. Existing translations are kept.
158
+ Translate the new entries, review `?locale=ru` and the live builder Preview language
159
+ selector, then sync and publish through the normal workflow. Run `fgrove docs`
160
+ for the full localization guide. The funnel must use a runtime release supporting
161
+ URL locale selection; this command does not upgrade dependencies.
package/dist/cli.js CHANGED
@@ -7,6 +7,7 @@ import { createInterface } from 'node:readline/promises';
7
7
  import path from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { Command } from 'commander';
10
+ import { addFunnelLocale } from './locales.js';
10
11
  import { CURRENT_STEP_CONTRACT_VERSION, FUNNEL_CONTRACT_DIAGNOSTIC_CODES, PREVIOUS_STEP_CONTRACT_VERSION, createFunnelContractDiagnostic, } from '@funnelsgrove/runtime';
11
12
  import { abortFunnelSourceCandidate, applyFunnelDraftPatch, beginFunnelSourceCandidate, callTrpcProcedure, createFunnelExperimentFromSpec, finalizeFunnelDirectAssetUpload, finalizeFunnelSourceCandidate, prepareFunnelDirectAssetUpload, stageFunnelSourceCandidate, } from './apiClient.js';
12
13
  import { cliReleaseIdentity } from './cliIdentity.js';
@@ -2980,6 +2981,15 @@ addExamples(githubCommand
2980
2981
  });
2981
2982
  printValueRows(formatGitHubJobRows(result));
2982
2983
  });
2984
+ program.command('locales')
2985
+ .description('Manage local funnel content languages')
2986
+ .command('add <locale>')
2987
+ .description('Copy default content into a locale without translating or overwriting existing entries')
2988
+ .option('--dir <path>', 'Local funnel directory', '.')
2989
+ .action(async (locale, options) => {
2990
+ const result = await addFunnelLocale(path.resolve(options.dir), locale);
2991
+ console.log(`${result.locale}\t${result.added.length} added\t${result.existing.length} already present`);
2992
+ });
2983
2993
  addExamples(program
2984
2994
  .command('validate')
2985
2995
  .description('Validate a local funnel against the current authoring contract')
@@ -0,0 +1,6 @@
1
+ /** Prepare every edit before writing so unsupported content cannot leave a partly added locale. */
2
+ export declare function addFunnelLocale(directory: string, requestedLocale: string): Promise<{
3
+ locale: string;
4
+ added: string[];
5
+ existing: string[];
6
+ }>;
@@ -0,0 +1,126 @@
1
+ import { readFile, readdir, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import ts from 'typescript';
4
+ function canonicalLocale(value) {
5
+ try {
6
+ const [locale] = Intl.getCanonicalLocales(value);
7
+ if (locale)
8
+ return locale;
9
+ }
10
+ catch { /* Report the invalid input below. */ }
11
+ throw new Error(`Invalid locale: ${value}. Use a language tag such as ru or pt-BR.`);
12
+ }
13
+ async function contentFiles(directory) {
14
+ const entries = await readdir(directory, { withFileTypes: true });
15
+ const files = [];
16
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
17
+ const file = path.join(directory, entry.name);
18
+ if (entry.isDirectory())
19
+ files.push(...await contentFiles(file));
20
+ else if (entry.isFile() && entry.name.endsWith('.content.ts'))
21
+ files.push(file);
22
+ }
23
+ return files;
24
+ }
25
+ function property(object, name) {
26
+ return object.properties.find((node) => ts.isPropertyAssignment(node) &&
27
+ (ts.isIdentifier(node.name) || ts.isStringLiteral(node.name)) && node.name.text === name);
28
+ }
29
+ function copyLocaleContent(content, parsed, locale) {
30
+ const localDefinitions = new Map();
31
+ for (const statement of parsed.statements) {
32
+ if (!ts.isVariableStatement(statement))
33
+ continue;
34
+ for (const declaration of statement.declarationList.declarations) {
35
+ let value = declaration.initializer;
36
+ while (value && (ts.isAsExpression(value) || ts.isSatisfiesExpression(value) || ts.isParenthesizedExpression(value)))
37
+ value = value.expression;
38
+ if (!value || !ts.isObjectLiteralExpression(value) || !ts.isIdentifier(declaration.name))
39
+ continue;
40
+ const defaultLocale = property(value, 'defaultLocale')?.initializer;
41
+ if (defaultLocale && ts.isStringLiteral(defaultLocale) && property(value, 'locales')) {
42
+ localDefinitions.set(declaration.name.text, defaultLocale.text);
43
+ }
44
+ }
45
+ }
46
+ const replacements = [];
47
+ const visit = (node) => {
48
+ const key = ts.isPropertyAccessExpression(node) ? node.name.text
49
+ : ts.isElementAccessExpression(node) && ts.isStringLiteral(node.argumentExpression) ? node.argumentExpression.text : null;
50
+ if (key && (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node))) {
51
+ const map = node.expression;
52
+ if (ts.isPropertyAccessExpression(map) && map.name.text === 'locales' && ts.isIdentifier(map.expression)
53
+ && localDefinitions.get(map.expression.text) === key) {
54
+ replacements.push({ start: node.getStart(parsed), end: node.end, text: `${map.getText(parsed)}[${JSON.stringify(locale)}]` });
55
+ return;
56
+ }
57
+ }
58
+ ts.forEachChild(node, visit);
59
+ };
60
+ visit(content);
61
+ const offset = content.getStart(parsed);
62
+ let source = content.getText(parsed);
63
+ for (const replacement of replacements.sort((a, b) => b.start - a.start)) {
64
+ source = source.slice(0, replacement.start - offset) + replacement.text + source.slice(replacement.end - offset);
65
+ }
66
+ return source;
67
+ }
68
+ /** Prepare every edit before writing so unsupported content cannot leave a partly added locale. */
69
+ export async function addFunnelLocale(directory, requestedLocale) {
70
+ const locale = canonicalLocale(requestedLocale);
71
+ const edits = [];
72
+ const existing = [];
73
+ const files = await contentFiles(path.join(directory, 'src'));
74
+ if (!files.length)
75
+ throw new Error('No src/**/*.content.ts files found. Move translatable copy into content definitions first.');
76
+ for (const file of files) {
77
+ const source = await readFile(file, 'utf8');
78
+ const parsed = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
79
+ const relative = path.relative(directory, file).split(path.sep).join('/');
80
+ const insertions = [];
81
+ let definitions = 0;
82
+ const visit = (node) => {
83
+ if (ts.isObjectLiteralExpression(node)) {
84
+ const defaultLocale = property(node, 'defaultLocale');
85
+ const locales = property(node, 'locales');
86
+ if (defaultLocale && locales) {
87
+ definitions++;
88
+ if (!ts.isStringLiteral(defaultLocale.initializer) || !ts.isObjectLiteralExpression(locales.initializer)) {
89
+ throw new Error(`${relative}: defaultLocale and locales must be literals.`);
90
+ }
91
+ const map = locales.initializer;
92
+ if (map.properties.some((item) => !ts.isPropertyAssignment(item) ||
93
+ !(ts.isIdentifier(item.name) || ts.isStringLiteral(item.name)))) {
94
+ throw new Error(`${relative}: locale entries must be explicit properties, without spreads or computed names.`);
95
+ }
96
+ const keys = map.properties;
97
+ if (keys.some((item) => canonicalLocale(item.name.text) === locale))
98
+ return;
99
+ const base = property(map, defaultLocale.initializer.text);
100
+ if (!base || !ts.isObjectLiteralExpression(base.initializer)) {
101
+ throw new Error(`${relative}: default locale content must be an object literal.`);
102
+ }
103
+ const separator = map.properties.hasTrailingComma ? '' : ',';
104
+ insertions.push({ offset: map.end - 1, text: `${separator}\n ${JSON.stringify(locale)}: ${copyLocaleContent(base.initializer, parsed, locale)},\n ` });
105
+ return;
106
+ }
107
+ }
108
+ ts.forEachChild(node, visit);
109
+ };
110
+ visit(parsed);
111
+ if (!definitions)
112
+ throw new Error(`${relative}: no localized content definition found.`);
113
+ if (!insertions.length)
114
+ existing.push(relative);
115
+ else {
116
+ let nextSource = source;
117
+ for (const insertion of insertions.sort((a, b) => b.offset - a.offset)) {
118
+ nextSource = nextSource.slice(0, insertion.offset) + insertion.text + nextSource.slice(insertion.offset);
119
+ }
120
+ edits.push({ file, source: nextSource });
121
+ }
122
+ }
123
+ for (const edit of edits)
124
+ await writeFile(edit.file, edit.source);
125
+ return { locale, added: edits.map(({ file }) => path.relative(directory, file).split(path.sep).join('/')), existing };
126
+ }
@@ -4,16 +4,16 @@
4
4
  "minimumCliVersion": "0.1.20",
5
5
  "entries": [
6
6
  {
7
- "repositoryCliVersion": "0.1.229",
7
+ "repositoryCliVersion": "0.1.233",
8
8
  "manifest": {
9
9
  "schemaVersion": 1,
10
- "bundleVersion": "2.0.221",
10
+ "bundleVersion": "2.0.225",
11
11
  "stepContractVersion": 3,
12
12
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
13
13
  "managedFiles": [
14
14
  {
15
15
  "path": "AGENTS.md",
16
- "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
16
+ "sha256": "3860d21f4a3f9b0c25ca54f7a87762d801f14b82a181b4c0b941c57187908f99"
17
17
  },
18
18
  {
19
19
  "path": "CLAUDE.md",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  {
31
31
  "path": "docs/funnelsgrove/contracts/content-answers.md",
32
- "sha256": "403b286060dd6cda33757df7c55c5b0e17395f2d90aad0fc133d6ba1919a04b3"
32
+ "sha256": "44686934b2a6837142a12e76f9fc84bd5181179bcd3bf82d636a8ad26b72ce01"
33
33
  },
34
34
  {
35
35
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
48
- "sha256": "d86fab03c5a3bb31b2b62302a4fba47422c7f39d049decf4604b052cd55ae363"
48
+ "sha256": "02e1409d391497b8860b5c2942bc07881853f53480daa4fb2972f561e8baa047"
49
49
  },
50
50
  {
51
51
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -145,22 +145,22 @@
145
145
  },
146
146
  {
147
147
  "path": "funnel-docs.config.json",
148
- "sha256": "d59565cd958ed65a1794437e1c69ba5b1d2a0d4465b30e52073374caf0130095"
148
+ "sha256": "6767f2a0ee02bc43a4fd4b1b9c07e938099fac90976796636ebc66202050fe54"
149
149
  }
150
150
  ]
151
151
  }
152
152
  },
153
153
  {
154
- "repositoryCliVersion": "0.1.228",
154
+ "repositoryCliVersion": "0.1.232",
155
155
  "manifest": {
156
156
  "schemaVersion": 1,
157
- "bundleVersion": "2.0.220",
157
+ "bundleVersion": "2.0.224",
158
158
  "stepContractVersion": 3,
159
159
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
160
160
  "managedFiles": [
161
161
  {
162
162
  "path": "AGENTS.md",
163
- "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
163
+ "sha256": "3860d21f4a3f9b0c25ca54f7a87762d801f14b82a181b4c0b941c57187908f99"
164
164
  },
165
165
  {
166
166
  "path": "CLAUDE.md",
@@ -176,7 +176,7 @@
176
176
  },
177
177
  {
178
178
  "path": "docs/funnelsgrove/contracts/content-answers.md",
179
- "sha256": "403b286060dd6cda33757df7c55c5b0e17395f2d90aad0fc133d6ba1919a04b3"
179
+ "sha256": "44686934b2a6837142a12e76f9fc84bd5181179bcd3bf82d636a8ad26b72ce01"
180
180
  },
181
181
  {
182
182
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -192,7 +192,7 @@
192
192
  },
193
193
  {
194
194
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
195
- "sha256": "16343b066ffd8a56f9490f8c54ec724528166d41b812665565dca507aa4a65b1"
195
+ "sha256": "cd4e0392bc88e2c24459a5132b8c7573bdb3e5a01aa7d9684139c30de39e4813"
196
196
  },
197
197
  {
198
198
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -292,16 +292,16 @@
292
292
  },
293
293
  {
294
294
  "path": "funnel-docs.config.json",
295
- "sha256": "9f2ca1c4b99902f065c3588df9662403708ae732388668200141cfd95cdd6282"
295
+ "sha256": "fd3117529acd5a83faf9ffb7bc004d5c1166ba783bcc57c2457ffc5e83c936f4"
296
296
  }
297
297
  ]
298
298
  }
299
299
  },
300
300
  {
301
- "repositoryCliVersion": "0.1.227",
301
+ "repositoryCliVersion": "0.1.231",
302
302
  "manifest": {
303
303
  "schemaVersion": 1,
304
- "bundleVersion": "2.0.219",
304
+ "bundleVersion": "2.0.223",
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": "3456a7f44a9b1e76adba665588a13a65e923e64bfa599199067196031731799e"
342
+ "sha256": "b77101d16260357a891c26a6f0e6298f5763b3a8d76b38ba94378064a753e9f0"
343
343
  },
344
344
  {
345
345
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -439,16 +439,16 @@
439
439
  },
440
440
  {
441
441
  "path": "funnel-docs.config.json",
442
- "sha256": "b40f461f4d0ee96592a9d2de99cef14c8eb809b6e315d7524e9ef89c217f04e7"
442
+ "sha256": "e111086760618c659a1f72b0e463bf2aa4c67ba9ebc1b4728c84e0d6b20b6510"
443
443
  }
444
444
  ]
445
445
  }
446
446
  },
447
447
  {
448
- "repositoryCliVersion": "0.1.226",
448
+ "repositoryCliVersion": "0.1.230",
449
449
  "manifest": {
450
450
  "schemaVersion": 1,
451
- "bundleVersion": "2.0.218",
451
+ "bundleVersion": "2.0.222",
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": "57c5cd1d7d6cf333738d71eec5b9ec16ff28b69aae9619c38c16a804e1c19a2f"
489
+ "sha256": "1447228902ae180df9db9a7b3778558bd1e2837ba63b20d66207b83cfd36772b"
490
490
  },
491
491
  {
492
492
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -586,16 +586,16 @@
586
586
  },
587
587
  {
588
588
  "path": "funnel-docs.config.json",
589
- "sha256": "b9c1bf3bb96fbc188469c2670db166c06714a8a5037cc3f137791e1229dc0a36"
589
+ "sha256": "eac90701cb7c2ae42d90b23f8cd7d7f7b3abd5b64b09a754fa4e61af910cd334"
590
590
  }
591
591
  ]
592
592
  }
593
593
  },
594
594
  {
595
- "repositoryCliVersion": "0.1.225",
595
+ "repositoryCliVersion": "0.1.229",
596
596
  "manifest": {
597
597
  "schemaVersion": 1,
598
- "bundleVersion": "2.0.217",
598
+ "bundleVersion": "2.0.221",
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": "90fd6a334c715f4a3623cba69fef89bec33e8c77d41a66b2b56145a5a67f0a77"
636
+ "sha256": "d86fab03c5a3bb31b2b62302a4fba47422c7f39d049decf4604b052cd55ae363"
637
637
  },
638
638
  {
639
639
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -733,16 +733,16 @@
733
733
  },
734
734
  {
735
735
  "path": "funnel-docs.config.json",
736
- "sha256": "1b7c8003831619dc7bec1e63523783fc65306eb3cca721bd006aaa6575fe5e34"
736
+ "sha256": "d59565cd958ed65a1794437e1c69ba5b1d2a0d4465b30e52073374caf0130095"
737
737
  }
738
738
  ]
739
739
  }
740
740
  },
741
741
  {
742
- "repositoryCliVersion": "0.1.223",
742
+ "repositoryCliVersion": "0.1.228",
743
743
  "manifest": {
744
744
  "schemaVersion": 1,
745
- "bundleVersion": "2.0.215",
745
+ "bundleVersion": "2.0.220",
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": "ce781cf22929d6e1ff1c74c04d12ad9c2be06e1b1171e62da09ec7b277d3867f"
783
+ "sha256": "16343b066ffd8a56f9490f8c54ec724528166d41b812665565dca507aa4a65b1"
784
784
  },
785
785
  {
786
786
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -880,16 +880,16 @@
880
880
  },
881
881
  {
882
882
  "path": "funnel-docs.config.json",
883
- "sha256": "2a8e04f9a0e36ea5248dbade1259f8328bbea8e67c7a7e7d33ef1ff9094809fb"
883
+ "sha256": "9f2ca1c4b99902f065c3588df9662403708ae732388668200141cfd95cdd6282"
884
884
  }
885
885
  ]
886
886
  }
887
887
  },
888
888
  {
889
- "repositoryCliVersion": "0.1.222",
889
+ "repositoryCliVersion": "0.1.227",
890
890
  "manifest": {
891
891
  "schemaVersion": 1,
892
- "bundleVersion": "2.0.214",
892
+ "bundleVersion": "2.0.219",
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": "a0575e85660e8b1d5b51e1527740e02c267fb4b632aa10d9f17fa83324a8ccf7"
930
+ "sha256": "3456a7f44a9b1e76adba665588a13a65e923e64bfa599199067196031731799e"
931
931
  },
932
932
  {
933
933
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -1027,7 +1027,7 @@
1027
1027
  },
1028
1028
  {
1029
1029
  "path": "funnel-docs.config.json",
1030
- "sha256": "f7ed68bd91966f1fc77fab35315eff8f04987d4d2f841319722cd4f720e458ef"
1030
+ "sha256": "b40f461f4d0ee96592a9d2de99cef14c8eb809b6e315d7524e9ef89c217f04e7"
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.229",
3
+ "version": "0.1.233",
4
4
  "description": "FunnelsGrove command-line tools for editing, syncing, and publishing funnels",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,14 +34,14 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@funnelsgrove/runtime": "0.12.0",
37
+ "@funnelsgrove/runtime": "0.14.4",
38
38
  "commander": "^12.0.0",
39
39
  "ignore": "^7.0.8",
40
40
  "typescript": "^5.8.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@funnelsgrove/analytics": "0.1.97",
44
- "@funnelsgrove/payments": "0.12.0",
43
+ "@funnelsgrove/analytics": "0.1.106",
44
+ "@funnelsgrove/payments": "0.15.11",
45
45
  "vitest": "^3.0.0"
46
46
  }
47
47
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.221",
3
+ "bundleVersion": "2.0.225",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
7
7
  {
8
8
  "path": "AGENTS.md",
9
- "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
9
+ "sha256": "3860d21f4a3f9b0c25ca54f7a87762d801f14b82a181b4c0b941c57187908f99"
10
10
  },
11
11
  {
12
12
  "path": "CLAUDE.md",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
25
- "sha256": "403b286060dd6cda33757df7c55c5b0e17395f2d90aad0fc133d6ba1919a04b3"
25
+ "sha256": "44686934b2a6837142a12e76f9fc84bd5181179bcd3bf82d636a8ad26b72ce01"
26
26
  },
27
27
  {
28
28
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "d86fab03c5a3bb31b2b62302a4fba47422c7f39d049decf4604b052cd55ae363"
41
+ "sha256": "02e1409d391497b8860b5c2942bc07881853f53480daa4fb2972f561e8baa047"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "d59565cd958ed65a1794437e1c69ba5b1d2a0d4465b30e52073374caf0130095"
141
+ "sha256": "6767f2a0ee02bc43a4fd4b1b9c07e938099fac90976796636ebc66202050fe54"
142
142
  }
143
143
  ]
144
144
  }
@@ -9,6 +9,7 @@ This file is generated from the FunnelsGrove step contract. Start at [the agent
9
9
  | Add a step | [Add a step](docs/funnelsgrove/recipes/add-step.md) |
10
10
  | Edit a step | [Edit a step](docs/funnelsgrove/recipes/edit-step.md) |
11
11
  | Change metadata or routing | [Step metadata](docs/funnelsgrove/contracts/step-metadata.md) and [flow routing](docs/funnelsgrove/contracts/flow-routing.md) |
12
+ | Add a locale or translate visitor copy | [Localization](docs/funnelsgrove/contracts/content-answers.md#localization) |
12
13
  | Add or edit choices | [Content and answers](docs/funnelsgrove/contracts/content-answers.md) |
13
14
  | Edit product strategy, plan, or copy | [Content and answers](docs/funnelsgrove/contracts/content-answers.md) |
14
15
  | Add an experiment | [Add an experiment](docs/funnelsgrove/recipes/add-experiment.md) |
@@ -42,3 +42,53 @@ Keep builder-editable values in content definitions, expose matching editor sect
42
42
  - Update the owning artifact in the same change. Never implement a step absent from `PLAN.md`.
43
43
 
44
44
  See the exact choice and form pages in the [step-type index](../steps/INDEX.md). Run `fgrove validate` and test reload persistence before completion.
45
+
46
+ ## Localization
47
+
48
+ All funnel-authored visitor copy belongs in `src/**/*.content.ts` localized
49
+ content definitions: headings, options, CTA labels, placeholders, validation and
50
+ error messages, loading/empty states, accessible labels, shared shell copy, and
51
+ paywall/legal copy. JSX renders resolved content; metadata IDs, answer keys,
52
+ provider IDs, prices and billing rules retain their existing owners. Provider-hosted
53
+ payment fields and messages are configured through that provider's locale support.
54
+
55
+ 1. Run `fgrove locales add ru --dir .` to copy each definition's `defaultLocale`
56
+ into `locales.ru`. Use BCP 47 tags such as `pt-BR`. The command edits local source
57
+ only, requires no login, and never translates, syncs or publishes. Repeating it
58
+ keeps existing translations and fills only missing locale entries.
59
+ 2. Translate the new entries in **every** content module, including shared shell
60
+ and returning-subscriber content. Preserve object keys, option IDs, placeholders
61
+ such as `{amount}`, URLs and variable tokens. Same-file references to another
62
+ definition's base locale are copied as references to its new locale. Imported
63
+ content and other expressions remain references: inspect them and move any
64
+ remaining visitor copy into locale-owned definitions before completion.
65
+ 3. Keep `defaultLocale` and `locales` as explicit literal properties. Locale maps
66
+ use explicit keys; CLI rejects dynamic maps, spreads at the locale-map level,
67
+ and non-object base content before writing files. Nested content may contain
68
+ expressions. A new step must include every supported funnel locale.
69
+ 4. Resolve step copy with `usePreviewStepLocalizedContent(stepId, definition,
70
+ getStepContentLocale(attributes))`. Runtime versions supporting localization
71
+ give `?locale=ru` priority; otherwise the requested/browser language applies.
72
+ Lookup uses exact match, base language (`pt-BR` → `pt`), then `defaultLocale`.
73
+ The override persists in step URLs and never changes country, currency or offers.
74
+ 5. Review each language with `?locale=ru`, including direct step links, reload,
75
+ next/back, validation errors, long text and checkout. Builder **Preview language**
76
+ selects languages announced by its live frame and carries the choice into the
77
+ external preview link. Static screenshots cannot switch language. Older
78
+ published runtimes need an SDK update and republish before exposing this control.
79
+ 6. Run `fgrove validate`, sync through the funnel's normal CLI/GitHub workflow,
80
+ then publish preview. Existing funnels keep their own source and package pins;
81
+ adding a locale does not upgrade their SDK or migrate hard-coded JSX. Update
82
+ those explicitly and review the diff. Refresh this managed guide with `fgrove docs`.
83
+
84
+ New funnel code must route shell buttons and custom action-bar text through
85
+ content too. `src/steps/content/runtime.content.ts` owns the starter's shared
86
+ Continue/loading/unavailable messages. Server-returned display labels need
87
+ locale-owned presentation overrides; changing copy must not change plan IDs,
88
+ amounts, billing intervals or provider configuration.
89
+
90
+ The starter paywall's `catalogLabels` maps exact catalog display text to localized
91
+ text. Keep its keys unchanged and translate the values, preserving monetary
92
+ amounts. Add mappings for new admin-authored labels as needed. Unrecognized
93
+ catalog labels remain unchanged; translation never substitutes one offer for
94
+ another or alters payment identifiers and amounts.
@@ -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.14.2` first, then `@funnelsgrove/analytics` `0.1.104`, then `@funnelsgrove/payments` `0.15.8`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.229`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
20
+ Release `@funnelsgrove/runtime` `0.14.4` first, then `@funnelsgrove/analytics` `0.1.106`, then `@funnelsgrove/payments` `0.15.11`. The production deploy verifies the zero-traffic API candidate, publishes and verifies `@funnelsgrove/cli` `0.1.233`, and only then promotes the candidate to production traffic. The serving API must never advertise an unpublished preferred CLI. Publishing packages and deploying production remain separately approved operational actions.
21
21
  <!-- funnelsgrove:generated:end contract-v3/migration/step-contract-v3 -->
22
22
 
23
23
  ## Version-last policy
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.221",
3
+ "bundleVersion": "2.0.225",
4
4
  "contractSource": "funnelsgrove-repository://apps/funnel-runtime/contracts/step-contract-v2.json",
5
5
  "fullyGenerated": [
6
6
  ".funnelsgrove-docs.json",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "bundleVersion": "2.0.221",
3
+ "bundleVersion": "2.0.225",
4
4
  "stepContractVersion": 3,
5
5
  "contractHash": "d761e91d5ac6ff9e72c6d49c5bcd014270912473a66f99c49d726c65998085cf",
6
6
  "managedFiles": [
7
7
  {
8
8
  "path": "AGENTS.md",
9
- "sha256": "22118f0f909a747f8a27f4eed16ceb5ec2a9283fd9645114fda961c0405a2a6b"
9
+ "sha256": "3860d21f4a3f9b0c25ca54f7a87762d801f14b82a181b4c0b941c57187908f99"
10
10
  },
11
11
  {
12
12
  "path": "CLAUDE.md",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "path": "docs/funnelsgrove/contracts/content-answers.md",
25
- "sha256": "403b286060dd6cda33757df7c55c5b0e17395f2d90aad0fc133d6ba1919a04b3"
25
+ "sha256": "44686934b2a6837142a12e76f9fc84bd5181179bcd3bf82d636a8ad26b72ce01"
26
26
  },
27
27
  {
28
28
  "path": "docs/funnelsgrove/contracts/flow-routing.md",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "path": "docs/funnelsgrove/migrations/step-contract-v3.md",
41
- "sha256": "d86fab03c5a3bb31b2b62302a4fba47422c7f39d049decf4604b052cd55ae363"
41
+ "sha256": "02e1409d391497b8860b5c2942bc07881853f53480daa4fb2972f561e8baa047"
42
42
  },
43
43
  {
44
44
  "path": "docs/funnelsgrove/qa/analytics.md",
@@ -138,7 +138,7 @@
138
138
  },
139
139
  {
140
140
  "path": "funnel-docs.config.json",
141
- "sha256": "d59565cd958ed65a1794437e1c69ba5b1d2a0d4465b30e52073374caf0130095"
141
+ "sha256": "6767f2a0ee02bc43a4fd4b1b9c07e938099fac90976796636ebc66202050fe54"
142
142
  }
143
143
  ]
144
144
  }