@funnelsgrove/cli 0.1.14 → 0.1.18

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 (293) hide show
  1. package/contracts/step-contract-v2.json +733 -0
  2. package/dist/analyticsOutput.d.ts +30 -15
  3. package/dist/analyticsOutput.js +45 -28
  4. package/dist/apiClient.d.ts +85 -0
  5. package/dist/apiClient.js +225 -8
  6. package/dist/cli.d.ts +149 -1
  7. package/dist/cli.js +1232 -71
  8. package/dist/diagnosticOutput.d.ts +42 -0
  9. package/dist/diagnosticOutput.js +83 -0
  10. package/dist/docsOutput.d.ts +19 -0
  11. package/dist/docsOutput.js +73 -0
  12. package/dist/docsTransaction.d.ts +81 -0
  13. package/dist/docsTransaction.js +1755 -0
  14. package/dist/funnelValidation.d.ts +14 -0
  15. package/dist/funnelValidation.js +297 -0
  16. package/dist/localSync.d.ts +79 -0
  17. package/dist/localSync.js +428 -53
  18. package/dist/projectValidator.d.ts +27 -0
  19. package/dist/projectValidator.js +208 -0
  20. package/dist/reskin.js +27 -1
  21. package/dist/stepContractMigration.d.ts +71 -0
  22. package/dist/stepContractMigration.js +1323 -0
  23. package/dist/templateDocs.js +8 -25
  24. package/docs-release-history.json +66 -0
  25. package/legacy-docs-catalog.json +1012 -0
  26. package/package.json +13 -4
  27. package/template_docs/.funnelsgrove-docs.json +144 -0
  28. package/template_docs/AGENTS.md +30 -58
  29. package/template_docs/CLAUDE.md +0 -2
  30. package/template_docs/docs/funnelsgrove/START-HERE.md +73 -0
  31. package/template_docs/docs/funnelsgrove/contracts/analytics-events.md +59 -0
  32. package/template_docs/docs/funnelsgrove/contracts/content-answers.md +44 -0
  33. package/template_docs/docs/funnelsgrove/contracts/flow-routing.md +41 -0
  34. package/template_docs/docs/funnelsgrove/contracts/payments.md +42 -0
  35. package/template_docs/docs/funnelsgrove/contracts/step-metadata.md +57 -0
  36. package/template_docs/docs/funnelsgrove/migrations/step-contract-v3.md +39 -0
  37. package/template_docs/docs/funnelsgrove/qa/analytics.md +43 -0
  38. package/template_docs/docs/funnelsgrove/qa/local.md +42 -0
  39. package/template_docs/docs/funnelsgrove/qa/paywall-checkout.md +55 -0
  40. package/template_docs/docs/funnelsgrove/qa/publish.md +32 -0
  41. package/template_docs/docs/funnelsgrove/recipes/add-experiment.md +34 -0
  42. package/template_docs/docs/funnelsgrove/recipes/add-step.md +33 -0
  43. package/template_docs/docs/funnelsgrove/recipes/edit-step.md +31 -0
  44. package/template_docs/docs/funnelsgrove/steps/INDEX.md +26 -0
  45. package/template_docs/docs/funnelsgrove/steps/cancellation_offer.md +112 -0
  46. package/template_docs/docs/funnelsgrove/steps/checkout.md +120 -0
  47. package/template_docs/docs/funnelsgrove/steps/form_input.md +115 -0
  48. package/template_docs/docs/funnelsgrove/steps/intro_hero.md +110 -0
  49. package/template_docs/docs/funnelsgrove/steps/multi_select_choice.md +123 -0
  50. package/template_docs/docs/funnelsgrove/steps/paywall_offer.md +115 -0
  51. package/template_docs/docs/funnelsgrove/steps/progress_interstitial.md +111 -0
  52. package/template_docs/docs/funnelsgrove/steps/purchase_completed.md +117 -0
  53. package/template_docs/docs/funnelsgrove/steps/single_step_choice.md +122 -0
  54. package/template_docs/docs/funnelsgrove/steps/single_step_choice_emoji.md +122 -0
  55. package/template_docs/docs/funnelsgrove/steps/social_proof.md +110 -0
  56. package/template_docs/docs/funnelsgrove/steps/subscription_handoff.md +113 -0
  57. package/template_docs/docs/funnelsgrove/steps/subscription_management.md +112 -0
  58. package/template_docs/docs/funnelsgrove/steps/summary_confirmation.md +110 -0
  59. package/template_docs/docs/funnelsgrove/steps/upsell_offer.md +112 -0
  60. package/template_docs/docs/funnelsgrove/steps/value_prop_story.md +110 -0
  61. package/template_docs/funnel-docs.config.json +43 -0
  62. package/template_scaffold/.env.example +41 -0
  63. package/template_scaffold/.funnelsgrove-contract-tools.json +19 -0
  64. package/template_scaffold/.funnelsgrove-docs.json +144 -0
  65. package/template_scaffold/.funnelsgrove-scaffold.json +1078 -0
  66. package/template_scaffold/AGENTS.md +42 -0
  67. package/template_scaffold/CLAUDE.md +1 -0
  68. package/template_scaffold/PLAN.md +81 -0
  69. package/template_scaffold/PRODUCT_SENSE.md +28 -0
  70. package/template_scaffold/context/build-context.md +34 -0
  71. package/template_scaffold/docs/AGENT_FUNNEL_IMPLEMENTATION_SPEC.md +5 -0
  72. package/template_scaffold/docs/ARCHITECTURE.md +5 -0
  73. package/template_scaffold/docs/FLOW_CONFIG_AND_ROUTING.md +5 -0
  74. package/template_scaffold/docs/PAYWALL_AND_PAYMENTS.md +5 -0
  75. package/template_scaffold/docs/README.md +5 -0
  76. package/template_scaffold/docs/funnelsgrove/START-HERE.md +73 -0
  77. package/template_scaffold/docs/funnelsgrove/contracts/analytics-events.md +59 -0
  78. package/template_scaffold/docs/funnelsgrove/contracts/content-answers.md +44 -0
  79. package/template_scaffold/docs/funnelsgrove/contracts/flow-routing.md +41 -0
  80. package/template_scaffold/docs/funnelsgrove/contracts/payments.md +42 -0
  81. package/template_scaffold/docs/funnelsgrove/contracts/step-metadata.md +57 -0
  82. package/template_scaffold/docs/funnelsgrove/migrations/step-contract-v3.md +39 -0
  83. package/template_scaffold/docs/funnelsgrove/qa/analytics.md +43 -0
  84. package/template_scaffold/docs/funnelsgrove/qa/local.md +42 -0
  85. package/template_scaffold/docs/funnelsgrove/qa/paywall-checkout.md +55 -0
  86. package/template_scaffold/docs/funnelsgrove/qa/publish.md +32 -0
  87. package/template_scaffold/docs/funnelsgrove/recipes/add-experiment.md +34 -0
  88. package/template_scaffold/docs/funnelsgrove/recipes/add-step.md +33 -0
  89. package/template_scaffold/docs/funnelsgrove/recipes/edit-step.md +31 -0
  90. package/template_scaffold/docs/funnelsgrove/steps/INDEX.md +26 -0
  91. package/template_scaffold/docs/funnelsgrove/steps/cancellation_offer.md +112 -0
  92. package/template_scaffold/docs/funnelsgrove/steps/checkout.md +120 -0
  93. package/template_scaffold/docs/funnelsgrove/steps/form_input.md +115 -0
  94. package/template_scaffold/docs/funnelsgrove/steps/intro_hero.md +110 -0
  95. package/template_scaffold/docs/funnelsgrove/steps/multi_select_choice.md +123 -0
  96. package/template_scaffold/docs/funnelsgrove/steps/paywall_offer.md +115 -0
  97. package/template_scaffold/docs/funnelsgrove/steps/progress_interstitial.md +111 -0
  98. package/template_scaffold/docs/funnelsgrove/steps/purchase_completed.md +117 -0
  99. package/template_scaffold/docs/funnelsgrove/steps/single_step_choice.md +122 -0
  100. package/template_scaffold/docs/funnelsgrove/steps/single_step_choice_emoji.md +122 -0
  101. package/template_scaffold/docs/funnelsgrove/steps/social_proof.md +110 -0
  102. package/template_scaffold/docs/funnelsgrove/steps/subscription_handoff.md +113 -0
  103. package/template_scaffold/docs/funnelsgrove/steps/subscription_management.md +112 -0
  104. package/template_scaffold/docs/funnelsgrove/steps/summary_confirmation.md +110 -0
  105. package/template_scaffold/docs/funnelsgrove/steps/upsell_offer.md +112 -0
  106. package/template_scaffold/docs/funnelsgrove/steps/value_prop_story.md +110 -0
  107. package/template_scaffold/docs/references/funnel-sdk-user-answers.md +5 -0
  108. package/template_scaffold/eslint.config.mjs +16 -0
  109. package/template_scaffold/funnel-agent-docs.test.ts +699 -0
  110. package/template_scaffold/funnel-docs.config.json +43 -0
  111. package/template_scaffold/funnel.config.json +5 -0
  112. package/template_scaffold/gitignore.template +5 -0
  113. package/template_scaffold/next-env.d.ts +6 -0
  114. package/template_scaffold/next.config.ts +53 -0
  115. package/template_scaffold/package-lock.json +7737 -0
  116. package/template_scaffold/package.json +37 -0
  117. package/template_scaffold/package.test.ts +23 -0
  118. package/template_scaffold/public/claimbee/bee.png +0 -0
  119. package/template_scaffold/public/claimbee/device-iphone.png +0 -0
  120. package/template_scaffold/public/claimbee/device-macbook.png +0 -0
  121. package/template_scaffold/public/claimbee/device-none.png +0 -0
  122. package/template_scaffold/public/claimbee/device-watch.png +0 -0
  123. package/template_scaffold/public/claimbee/glow.svg +3 -0
  124. package/template_scaffold/public/claimbee/steps-sprite-alt.png +0 -0
  125. package/template_scaffold/public/claimbee/steps-sprite-default.png +0 -0
  126. package/template_scaffold/public/claimbee/testimonial-avatar.png +0 -0
  127. package/template_scaffold/public/claimbee/testimonial-star.svg +3 -0
  128. package/template_scaffold/public/paywall/ai-claim-assistant.png +0 -0
  129. package/template_scaffold/public/paywall/claim-history.png +0 -0
  130. package/template_scaffold/public/paywall/clear-progress.png +0 -0
  131. package/template_scaffold/public/paywall/hero.png +0 -0
  132. package/template_scaffold/public/paywall/money-alerts.png +0 -0
  133. package/template_scaffold/public/paywall/money-back-badge.png +0 -0
  134. package/template_scaffold/public/paywall/paywall-image.png +0 -0
  135. package/template_scaffold/public/paywall/r1.png +0 -0
  136. package/template_scaffold/public/paywall/r2.png +0 -0
  137. package/template_scaffold/public/paywall/r3.png +0 -0
  138. package/template_scaffold/public/paywall/r4.png +0 -0
  139. package/template_scaffold/public/paywall/r5.png +0 -0
  140. package/template_scaffold/public/paywall/r6.png +0 -0
  141. package/template_scaffold/public/paywall/special-offer-gift.png +0 -0
  142. package/template_scaffold/public/please/bee.png +0 -0
  143. package/template_scaffold/public/please/device-iphone.png +0 -0
  144. package/template_scaffold/public/please/device-macbook.png +0 -0
  145. package/template_scaffold/public/please/device-none.png +0 -0
  146. package/template_scaffold/public/please/device-watch.png +0 -0
  147. package/template_scaffold/public/please/glow.svg +3 -0
  148. package/template_scaffold/public/please/steps-sprite-alt.png +0 -0
  149. package/template_scaffold/public/please/steps-sprite-default.png +0 -0
  150. package/template_scaffold/public/please/testimonial-avatar.png +0 -0
  151. package/template_scaffold/public/please/testimonial-star.svg +3 -0
  152. package/template_scaffold/public/upsell/upgrade-hero.png +0 -0
  153. package/template_scaffold/src/app/[stepId]/page.test.tsx +59 -0
  154. package/template_scaffold/src/app/[stepId]/page.tsx +62 -0
  155. package/template_scaffold/src/app/globals.css +49 -0
  156. package/template_scaffold/src/app/layout.test.ts +26 -0
  157. package/template_scaffold/src/app/layout.tsx +61 -0
  158. package/template_scaffold/src/app/page.tsx +8 -0
  159. package/template_scaffold/src/app/sdk/page.tsx +673 -0
  160. package/template_scaffold/src/app/subscription-dashboard/page.tsx +274 -0
  161. package/template_scaffold/src/assets/claimbee/bee.png +0 -0
  162. package/template_scaffold/src/assets/claimbee/device-iphone.png +0 -0
  163. package/template_scaffold/src/assets/claimbee/device-macbook.png +0 -0
  164. package/template_scaffold/src/assets/claimbee/device-none.png +0 -0
  165. package/template_scaffold/src/assets/claimbee/device-watch.png +0 -0
  166. package/template_scaffold/src/assets/claimbee/glow.svg +3 -0
  167. package/template_scaffold/src/assets/claimbee/steps-sprite-alt.png +0 -0
  168. package/template_scaffold/src/assets/claimbee/steps-sprite-default.png +0 -0
  169. package/template_scaffold/src/assets/claimbee/testimonial-avatar.png +0 -0
  170. package/template_scaffold/src/assets/claimbee/testimonial-star.svg +3 -0
  171. package/template_scaffold/src/components/FunnelEditorPanel.tsx +194 -0
  172. package/template_scaffold/src/components/FunnelFlow.test.tsx +17 -0
  173. package/template_scaffold/src/components/FunnelFlow.tsx +114 -0
  174. package/template_scaffold/src/components/FunnelStepImage.test.ts +15 -0
  175. package/template_scaffold/src/components/FunnelStepImage.tsx +28 -0
  176. package/template_scaffold/src/components/step/FunnelStepHeader.tsx +35 -0
  177. package/template_scaffold/src/config/billing.plans.test.ts +143 -0
  178. package/template_scaffold/src/config/billing.plans.ts +69 -0
  179. package/template_scaffold/src/config/billing.test.plans.ts +32 -0
  180. package/template_scaffold/src/config/experiments.generated.ts +4 -0
  181. package/template_scaffold/src/config/experiments.test.ts +12 -0
  182. package/template_scaffold/src/config/experiments.ts +9 -0
  183. package/template_scaffold/src/config/funnel.config.ts +12 -0
  184. package/template_scaffold/src/config/funnel.manifest.test.ts +166 -0
  185. package/template_scaffold/src/config/funnel.manifest.ts +139 -0
  186. package/template_scaffold/src/config/offer-sets.generated.ts +4 -0
  187. package/template_scaffold/src/contract/funnel-project.validation.test.ts +80 -0
  188. package/template_scaffold/src/contract/funnel-project.validation.ts +44 -0
  189. package/template_scaffold/src/contract/funnel-validator.vite.config.ts +11 -0
  190. package/template_scaffold/src/contract/golden/cancellation_offer.fixture.ts +29 -0
  191. package/template_scaffold/src/contract/golden/checkout.fixture.ts +37 -0
  192. package/template_scaffold/src/contract/golden/form_input.fixture.ts +28 -0
  193. package/template_scaffold/src/contract/golden/golden-fixtures.test.ts +190 -0
  194. package/template_scaffold/src/contract/golden/intro_hero.fixture.ts +27 -0
  195. package/template_scaffold/src/contract/golden/multi_select_choice.fixture.ts +37 -0
  196. package/template_scaffold/src/contract/golden/paywall_offer.fixture.ts +30 -0
  197. package/template_scaffold/src/contract/golden/progress_interstitial.fixture.ts +28 -0
  198. package/template_scaffold/src/contract/golden/purchase_completed.fixture.ts +33 -0
  199. package/template_scaffold/src/contract/golden/single_step_choice.fixture.ts +36 -0
  200. package/template_scaffold/src/contract/golden/single_step_choice_emoji.fixture.ts +36 -0
  201. package/template_scaffold/src/contract/golden/social_proof.fixture.ts +27 -0
  202. package/template_scaffold/src/contract/golden/subscription_handoff.fixture.ts +30 -0
  203. package/template_scaffold/src/contract/golden/subscription_management.fixture.ts +29 -0
  204. package/template_scaffold/src/contract/golden/summary_confirmation.fixture.ts +27 -0
  205. package/template_scaffold/src/contract/golden/upsell_offer.fixture.ts +29 -0
  206. package/template_scaffold/src/contract/golden/value_prop_story.fixture.ts +27 -0
  207. package/template_scaffold/src/contract/validate-funnel.cli.test.ts +180 -0
  208. package/template_scaffold/src/contract/validate-funnel.cli.ts +199 -0
  209. package/template_scaffold/src/runtime/checkout-runtime-config.test.ts +60 -0
  210. package/template_scaffold/src/runtime/checkout-runtime-config.ts +26 -0
  211. package/template_scaffold/src/runtime/funnel-runtime.test.ts +25 -0
  212. package/template_scaffold/src/runtime/funnel-runtime.ts +118 -0
  213. package/template_scaffold/src/runtime/step-content-context.test.ts +38 -0
  214. package/template_scaffold/src/runtime/step-content-context.ts +65 -0
  215. package/template_scaffold/src/runtime/step-registry.ts +66 -0
  216. package/template_scaffold/src/runtime/step-variable-values.ts +31 -0
  217. package/template_scaffold/src/runtime/use-funnel-flow-controller.integration.test.ts +203 -0
  218. package/template_scaffold/src/runtime/use-funnel-flow-controller.test.ts +76 -0
  219. package/template_scaffold/src/runtime/use-funnel-flow-controller.ts +53 -0
  220. package/template_scaffold/src/steps/content/email-capture.content.ts +29 -0
  221. package/template_scaffold/src/steps/content/manage-subscription.content.ts +62 -0
  222. package/template_scaffold/src/steps/content/paywall.content.ts +191 -0
  223. package/template_scaffold/src/steps/content/step-01.content.ts +23 -0
  224. package/template_scaffold/src/steps/content/step-02.content.ts +77 -0
  225. package/template_scaffold/src/steps/content/step-03.content.ts +40 -0
  226. package/template_scaffold/src/steps/content/step-04.content.ts +49 -0
  227. package/template_scaffold/src/steps/content/step-32-paywall.content.ts +352 -0
  228. package/template_scaffold/src/steps/content/subscription-started.content.ts +68 -0
  229. package/template_scaffold/src/steps/editor/email-capture.editor.ts +58 -0
  230. package/template_scaffold/src/steps/editor/manage-subscription.editor.ts +179 -0
  231. package/template_scaffold/src/steps/editor/paywall.editor.ts +232 -0
  232. package/template_scaffold/src/steps/editor/step-01.editor.ts +22 -0
  233. package/template_scaffold/src/steps/editor/step-02.editor.ts +41 -0
  234. package/template_scaffold/src/steps/editor/step-03.editor.ts +58 -0
  235. package/template_scaffold/src/steps/editor/step-04.editor.ts +98 -0
  236. package/template_scaffold/src/steps/editor/step-32-paywall.editor.ts +478 -0
  237. package/template_scaffold/src/steps/editor/subscription-started.editor.ts +131 -0
  238. package/template_scaffold/src/steps/index.ts +25 -0
  239. package/template_scaffold/src/steps/paywall-checkout-options.test.ts +104 -0
  240. package/template_scaffold/src/steps/paywall-checkout-options.ts +130 -0
  241. package/template_scaffold/src/steps/pricing/paywall-b.pricing.ts +12 -0
  242. package/template_scaffold/src/steps/pricing/paywall.pricing.ts +12 -0
  243. package/template_scaffold/src/steps/pricing/shared-plan-order.ts +17 -0
  244. package/template_scaffold/src/steps/pricing/upsell-form.pricing.ts +16 -0
  245. package/template_scaffold/src/steps/shared-header-contract.test.ts +27 -0
  246. package/template_scaffold/src/steps/step-01.test.ts +38 -0
  247. package/template_scaffold/src/steps/step-01.tsx +108 -0
  248. package/template_scaffold/src/steps/step-02.test.ts +43 -0
  249. package/template_scaffold/src/steps/step-02.tsx +140 -0
  250. package/template_scaffold/src/steps/step-03.test.ts +15 -0
  251. package/template_scaffold/src/steps/step-03.tsx +262 -0
  252. package/template_scaffold/src/steps/step-04.test.ts +32 -0
  253. package/template_scaffold/src/steps/step-04.tsx +673 -0
  254. package/template_scaffold/src/steps/step-31-email-capture.test.ts +22 -0
  255. package/template_scaffold/src/steps/step-31-email-capture.tsx +195 -0
  256. package/template_scaffold/src/steps/step-32-paywall.test.ts +770 -0
  257. package/template_scaffold/src/steps/step-32-paywall.tsx +2253 -0
  258. package/template_scaffold/src/steps/step-32b-paywall-b.tsx +35 -0
  259. package/template_scaffold/src/steps/step-33-subscription-started.test.ts +26 -0
  260. package/template_scaffold/src/steps/step-33-subscription-started.tsx +86 -0
  261. package/template_scaffold/src/steps/step-34-upsell-form.test.ts +27 -0
  262. package/template_scaffold/src/steps/step-35-manage-subscription.tsx +46 -0
  263. package/template_scaffold/src/steps/step-content.registry.ts +45 -0
  264. package/template_scaffold/src/steps/step-image-migration.test.ts +20 -0
  265. package/template_scaffold/src/steps/styles/index.css +2 -0
  266. package/template_scaffold/src/steps/styles/shared/final-flow-shared.css +55 -0
  267. package/template_scaffold/src/steps/styles/shared/funnel-base.css +543 -0
  268. package/template_scaffold/src/steps/styles/shared/info-shared.css +139 -0
  269. package/template_scaffold/src/steps/styles/shared/progress-shared.css +117 -0
  270. package/template_scaffold/src/steps/styles/shared/question-shared.css +76 -0
  271. package/template_scaffold/src/steps/styles/shared/responsive-container.css +176 -0
  272. package/template_scaffold/src/steps/types.ts +7 -0
  273. package/template_scaffold/src/steps/use-claimbee-step-content.ts +15 -0
  274. package/template_scaffold/src/theme/theme.ts +81 -0
  275. package/template_scaffold/tsconfig.json +38 -0
  276. package/template_scaffold/vitest.config.ts +32 -0
  277. package/template_validation/.funnelsgrove-contract-tools.json +19 -0
  278. package/template_validation/src/contract/funnel-project.validation.ts +44 -0
  279. package/template_validation/src/contract/funnel-validator.vite.config.ts +11 -0
  280. package/template_validation/src/contract/validate-funnel.cli.ts +199 -0
  281. package/template_docs/docs/ab-experiments.md +0 -55
  282. package/template_docs/docs/analytics.md +0 -65
  283. package/template_docs/docs/editing-flow.md +0 -125
  284. package/template_docs/docs/editing-step.md +0 -125
  285. package/template_docs/docs/editor-and-content.md +0 -58
  286. package/template_docs/docs/funnel-runtime-architecture.md +0 -125
  287. package/template_docs/docs/meta-pixel-conversions-api.md +0 -50
  288. package/template_docs/docs/payment-plans-and-discounts.md +0 -106
  289. package/template_docs/docs/publishing-and-versioning.md +0 -117
  290. package/template_docs/docs/qa-checklist.md +0 -80
  291. package/template_docs/docs/sdk-api-endpoints.md +0 -78
  292. package/template_docs/docs/step-ui-guidelines.md +0 -110
  293. package/template_docs/docs/theme.md +0 -35
@@ -0,0 +1,104 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ buildPaywallCheckoutBillingDetails,
4
+ buildPaywallCheckoutExpressOptions,
5
+ buildPaywallCheckoutPaymentElementOptions,
6
+ } from './paywall-checkout-options';
7
+
8
+ describe('paywall checkout options', () => {
9
+ it('prioritizes Link and stacked express checkout buttons for the checkout dialog', () => {
10
+ const options = buildPaywallCheckoutExpressOptions({
11
+ amountCents: 3599,
12
+ summaryLabel: 'ClaimBee Pro · 3 Months',
13
+ });
14
+
15
+ expect(options.paymentMethodOrder).toEqual(['link', 'apple_pay', 'google_pay']);
16
+ expect(options.buttonHeight).toBe(55);
17
+ expect(options.layout).toEqual({
18
+ maxColumns: 1,
19
+ maxRows: 0,
20
+ overflow: 'never',
21
+ });
22
+ expect(options.paymentMethods).toMatchObject({
23
+ applePay: 'always',
24
+ googlePay: 'always',
25
+ amazonPay: 'never',
26
+ klarna: 'never',
27
+ paypal: 'never',
28
+ });
29
+ expect(options.lineItems).toEqual([
30
+ {
31
+ name: 'ClaimBee Pro · 3 Months',
32
+ amount: 3599,
33
+ },
34
+ ]);
35
+ });
36
+
37
+ it('keeps the card form focused on manual card entry while prefilling the known email', () => {
38
+ const options = buildPaywallCheckoutPaymentElementOptions({
39
+ email: 'jane@example.com',
40
+ });
41
+
42
+ expect(options.paymentMethodOrder).toEqual(['card']);
43
+ expect(options.wallets).toEqual({
44
+ applePay: 'never',
45
+ googlePay: 'never',
46
+ link: 'never',
47
+ });
48
+ expect(options.fields).toEqual({
49
+ billingDetails: {
50
+ address: 'if_required',
51
+ email: 'never',
52
+ name: 'never',
53
+ phone: 'auto',
54
+ },
55
+ });
56
+ expect(options.defaultValues).toEqual({
57
+ billingDetails: {
58
+ email: 'jane@example.com',
59
+ },
60
+ });
61
+ expect(options.layout).toEqual({
62
+ type: 'tabs',
63
+ });
64
+ });
65
+
66
+ it('shows the email field when the funnel has not collected one yet', () => {
67
+ const options = buildPaywallCheckoutPaymentElementOptions({});
68
+
69
+ expect(options.fields).toEqual({
70
+ billingDetails: {
71
+ address: 'if_required',
72
+ email: 'auto',
73
+ name: 'never',
74
+ phone: 'auto',
75
+ },
76
+ });
77
+ expect(options.defaultValues).toBeUndefined();
78
+ });
79
+
80
+ it('supplies hidden billing details when the checkout form omits the name field', () => {
81
+ expect(
82
+ buildPaywallCheckoutBillingDetails({
83
+ email: 'jane.doe@example.com',
84
+ name: 'Jane Doe',
85
+ }),
86
+ ).toEqual({
87
+ email: 'jane.doe@example.com',
88
+ name: 'Jane Doe',
89
+ });
90
+
91
+ expect(
92
+ buildPaywallCheckoutBillingDetails({
93
+ email: 'jane.doe@example.com',
94
+ }),
95
+ ).toEqual({
96
+ email: 'jane.doe@example.com',
97
+ name: 'jane doe',
98
+ });
99
+
100
+ expect(buildPaywallCheckoutBillingDetails({})).toEqual({
101
+ name: 'Customer',
102
+ });
103
+ });
104
+ });
@@ -0,0 +1,130 @@
1
+ import type {
2
+ StripeExpressCheckoutElementOptions,
3
+ StripePaymentElementOptions,
4
+ } from '@stripe/stripe-js';
5
+
6
+ type PaywallCheckoutExpressOptionsInput = {
7
+ amountCents: number;
8
+ summaryLabel: string;
9
+ };
10
+
11
+ type PaywallCheckoutPaymentElementOptionsInput = {
12
+ email?: string | null;
13
+ };
14
+
15
+ type PaywallCheckoutBillingDetailsInput = {
16
+ email?: string | null;
17
+ name?: string | null;
18
+ };
19
+
20
+ const normalizePaywallCheckoutBillingName = ({
21
+ email,
22
+ name,
23
+ }: PaywallCheckoutBillingDetailsInput): string => {
24
+ const normalizedName = name?.trim();
25
+ if (normalizedName) {
26
+ return normalizedName;
27
+ }
28
+
29
+ const normalizedEmail = email?.trim();
30
+ if (normalizedEmail) {
31
+ const localPart = normalizedEmail
32
+ .split('@')[0]
33
+ ?.replace(/[._-]+/g, ' ')
34
+ .trim();
35
+ if (localPart) {
36
+ return localPart;
37
+ }
38
+ }
39
+
40
+ return 'Customer';
41
+ };
42
+
43
+ export function buildPaywallCheckoutExpressOptions({
44
+ amountCents,
45
+ summaryLabel,
46
+ }: PaywallCheckoutExpressOptionsInput): StripeExpressCheckoutElementOptions {
47
+ return {
48
+ buttonHeight: 55,
49
+ buttonTheme: {
50
+ applePay: 'black',
51
+ googlePay: 'black',
52
+ },
53
+ buttonType: {
54
+ applePay: 'check-out',
55
+ googlePay: 'checkout',
56
+ },
57
+ emailRequired: true,
58
+ layout: {
59
+ maxColumns: 1,
60
+ maxRows: 0,
61
+ overflow: 'never',
62
+ },
63
+ lineItems: [
64
+ {
65
+ name: summaryLabel.trim() || 'Selected plan',
66
+ amount: amountCents,
67
+ },
68
+ ],
69
+ paymentMethodOrder: ['link', 'apple_pay', 'google_pay'],
70
+ paymentMethods: {
71
+ amazonPay: 'never',
72
+ applePay: 'always',
73
+ googlePay: 'always',
74
+ klarna: 'never',
75
+ paypal: 'never',
76
+ },
77
+ };
78
+ }
79
+
80
+ export function buildPaywallCheckoutPaymentElementOptions({
81
+ email,
82
+ }: PaywallCheckoutPaymentElementOptionsInput): StripePaymentElementOptions {
83
+ const normalizedEmail = email?.trim() || '';
84
+ const emailFieldMode = normalizedEmail ? 'never' : 'auto';
85
+
86
+ return {
87
+ defaultValues: normalizedEmail
88
+ ? {
89
+ billingDetails: {
90
+ email: normalizedEmail,
91
+ },
92
+ }
93
+ : undefined,
94
+ fields: {
95
+ billingDetails: {
96
+ address: 'if_required',
97
+ email: emailFieldMode,
98
+ name: 'never',
99
+ phone: 'auto',
100
+ },
101
+ },
102
+ layout: {
103
+ type: 'tabs',
104
+ },
105
+ paymentMethodOrder: ['card'],
106
+ wallets: {
107
+ applePay: 'never',
108
+ googlePay: 'never',
109
+ link: 'never',
110
+ },
111
+ };
112
+ }
113
+
114
+ export function buildPaywallCheckoutBillingDetails({
115
+ email,
116
+ name,
117
+ }: PaywallCheckoutBillingDetailsInput): {
118
+ email?: string;
119
+ name: string;
120
+ } {
121
+ const normalizedEmail = email?.trim() || undefined;
122
+
123
+ return {
124
+ email: normalizedEmail,
125
+ name: normalizePaywallCheckoutBillingName({
126
+ email: normalizedEmail,
127
+ name,
128
+ }),
129
+ };
130
+ }
@@ -0,0 +1,12 @@
1
+ import type { CountryPricingProfile } from '@funnelsgrove/runtime';
2
+ import {
3
+ defaultPaywallPlanKey,
4
+ defaultPaywallPlanOrder,
5
+ paywallCountryOverrides,
6
+ } from './shared-plan-order';
7
+
8
+ export const paywallBPricing = {
9
+ defaultOfferOrder: defaultPaywallPlanOrder,
10
+ defaultOfferKey: defaultPaywallPlanKey,
11
+ countryOverrides: paywallCountryOverrides,
12
+ } as const satisfies CountryPricingProfile<string>;
@@ -0,0 +1,12 @@
1
+ import type { CountryPricingProfile } from '@funnelsgrove/runtime';
2
+ import {
3
+ defaultPaywallPlanKey,
4
+ defaultPaywallPlanOrder,
5
+ paywallCountryOverrides,
6
+ } from './shared-plan-order';
7
+
8
+ export const paywallPricing = {
9
+ defaultOfferOrder: defaultPaywallPlanOrder,
10
+ defaultOfferKey: defaultPaywallPlanKey,
11
+ countryOverrides: paywallCountryOverrides,
12
+ } as const satisfies CountryPricingProfile<string>;
@@ -0,0 +1,17 @@
1
+ const basePlanOrder = ['primary', 'secondary'] as const;
2
+ const secondaryFirstPlanOrder = ['secondary', 'primary'] as const;
3
+ const secondaryFirstCountries = ['PT', 'DE'] as const;
4
+
5
+ export const defaultPaywallPlanOrder = [...basePlanOrder];
6
+ export const defaultPaywallPlanKey = basePlanOrder[0];
7
+ export const secondaryFirstPaywallPlanOrder = [...secondaryFirstPlanOrder];
8
+ export const secondaryFirstPaywallPlanKey = secondaryFirstPlanOrder[0];
9
+ export const paywallCountryOverrides = Object.fromEntries(
10
+ secondaryFirstCountries.map((countryCode) => [
11
+ countryCode,
12
+ {
13
+ defaultOfferKey: secondaryFirstPaywallPlanKey,
14
+ offerOrder: secondaryFirstPaywallPlanOrder,
15
+ },
16
+ ]),
17
+ );
@@ -0,0 +1,16 @@
1
+ import type { CountryPricingProfile } from '@funnelsgrove/runtime';
2
+ import {
3
+ secondaryFirstPaywallPlanKey,
4
+ secondaryFirstPaywallPlanOrder,
5
+ } from './shared-plan-order';
6
+
7
+ export const upsellFormPricing = {
8
+ defaultOfferOrder: secondaryFirstPaywallPlanOrder,
9
+ defaultOfferKey: secondaryFirstPaywallPlanKey,
10
+ countryOverrides: {
11
+ US: {
12
+ defaultOfferKey: secondaryFirstPaywallPlanKey,
13
+ offerOrder: secondaryFirstPaywallPlanOrder,
14
+ },
15
+ },
16
+ } as const satisfies CountryPricingProfile<string>;
@@ -0,0 +1,27 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ const readStepSource = (fileName: string): string =>
6
+ readFileSync(path.resolve(__dirname, fileName), 'utf8');
7
+
8
+ describe('template shared header contract', () => {
9
+ it('renders template step headers through the shared FunnelStepHeader component', () => {
10
+ const sharedHeaderSource = readStepSource('../components/step/FunnelStepHeader.tsx');
11
+
12
+ expect(sharedHeaderSource).toContain('export type FunnelStepHeaderProps');
13
+ expect(sharedHeaderSource).toContain('export function FunnelStepHeader');
14
+
15
+ const headerStepFiles = [
16
+ 'step-01.tsx',
17
+ 'step-02.tsx',
18
+ 'step-04.tsx',
19
+ ];
20
+
21
+ headerStepFiles.forEach((fileName) => {
22
+ const stepSource = readStepSource(fileName);
23
+ expect(stepSource).toContain("from '@/components/step/FunnelStepHeader'");
24
+ expect(stepSource).toContain('<FunnelStepHeader');
25
+ });
26
+ });
27
+ });
@@ -0,0 +1,38 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { stepOneContent } from '@/steps/content/step-01.content';
3
+ import {
4
+ resolveStepOneArtworkSrc,
5
+ resolveStepOneImportedAssetSrc,
6
+ } from '@/steps/step-01';
7
+
8
+ describe('StepOne helpers', () => {
9
+ it('falls back to the bundled sprite when configured artwork failed to load', () => {
10
+ expect(
11
+ resolveStepOneArtworkSrc(
12
+ {
13
+ src: 'https://example.com/missing-step-one.png',
14
+ alt: 'Broken step one artwork',
15
+ },
16
+ '/claimbee/steps-sprite-default.png',
17
+ true,
18
+ ),
19
+ ).toBe('/claimbee/steps-sprite-default.png');
20
+ });
21
+
22
+ it('normalizes imported sprite assets from both preview and Next runtimes', () => {
23
+ expect(resolveStepOneImportedAssetSrc('/claimbee/steps-sprite-default.png')).toBe(
24
+ '/claimbee/steps-sprite-default.png',
25
+ );
26
+ expect(resolveStepOneImportedAssetSrc({ src: '/claimbee/steps-sprite-default.png' })).toBe(
27
+ '/claimbee/steps-sprite-default.png',
28
+ );
29
+ });
30
+
31
+ it('ships ClaimBee-style default headline copy', () => {
32
+ expect(stepOneContent.locales.en.headline).toEqual([
33
+ 'People getting',
34
+ 'free money',
35
+ 'know one secret',
36
+ ]);
37
+ });
38
+ });
@@ -0,0 +1,108 @@
1
+ import { useState } from 'react';
2
+ import { FunnelStepImage } from '@/components/FunnelStepImage';
3
+ import { FunnelStepHeader } from '@/components/step/FunnelStepHeader';
4
+ import {
5
+ usePreviewStepLocalizedContent,
6
+ useFunnel,
7
+ type StepImage,
8
+ type FunnelStepMeta,
9
+ } from '@funnelsgrove/runtime';
10
+ import stepsSpriteDefault from '@/assets/claimbee/steps-sprite-default.png';
11
+ import { getStepContentLocale } from '@/runtime/step-content-context';
12
+ import { stepOneContent } from '@/steps/content/step-01.content';
13
+
14
+ export const stepOneId = 'step-1';
15
+
16
+ type ImportedStepAsset = string | { src: string };
17
+
18
+ export const resolveStepOneImportedAssetSrc = (asset: ImportedStepAsset): string => {
19
+ return typeof asset === 'string' ? asset : asset.src;
20
+ };
21
+
22
+ export const resolveStepOneArtworkSrc = (
23
+ artwork: StepImage | null | undefined,
24
+ fallbackSrc: string,
25
+ hasLoadError = false,
26
+ ): string => {
27
+ const configuredSrc = artwork?.src?.trim() || '';
28
+ if (!hasLoadError && configuredSrc) {
29
+ return configuredSrc;
30
+ }
31
+
32
+ return fallbackSrc;
33
+ };
34
+
35
+ const stepOneFallbackArtworkSrc = resolveStepOneImportedAssetSrc(stepsSpriteDefault);
36
+
37
+ export const stepOne: FunnelStepMeta = {
38
+ id: stepOneId,
39
+ name: 'step-1',
40
+ type: 'intro_hero',
41
+ figmaNodeId: 'template-01-intro',
42
+ title: 'People getting free money know one secret',
43
+ description: 'ClaimBee-style opening hero with resilient sprite fallback.',
44
+ };
45
+
46
+ export function StepOne() {
47
+ const { attributes } = useFunnel();
48
+ const content = usePreviewStepLocalizedContent(
49
+ stepOneId,
50
+ stepOneContent,
51
+ getStepContentLocale(attributes),
52
+ );
53
+ const configuredArtworkSrc = content.artwork.src?.trim() || '';
54
+ const [failedArtworkSrc, setFailedArtworkSrc] = useState<string | null>(null);
55
+ const artworkSrc = resolveStepOneArtworkSrc(
56
+ content.artwork,
57
+ stepOneFallbackArtworkSrc,
58
+ Boolean(configuredArtworkSrc) && failedArtworkSrc === configuredArtworkSrc,
59
+ );
60
+
61
+ return (
62
+ <>
63
+ <section className="figma-step-screen step-one-screen" data-node-id="template:01-intro">
64
+ <FunnelStepHeader
65
+ className="figma-headline"
66
+ titleAs="div"
67
+ title={
68
+ <>
69
+ <p className="figma-headline-line">{content.headline[0]}</p>
70
+ <p className="figma-headline-line is-accent">{content.headline[1]}</p>
71
+ <p className="figma-headline-line">{content.headline[2]}</p>
72
+ </>
73
+ }
74
+ />
75
+
76
+ <div className="figma-artwork" aria-hidden>
77
+ <FunnelStepImage
78
+ src={artworkSrc}
79
+ alt={content.artwork.alt || ''}
80
+ width={stepsSpriteDefault.width}
81
+ height={stepsSpriteDefault.height}
82
+ className="figma-artwork-sprite"
83
+ draggable={false}
84
+ priority
85
+ onError={() => {
86
+ if (configuredArtworkSrc) {
87
+ setFailedArtworkSrc(configuredArtworkSrc);
88
+ }
89
+ }}
90
+ />
91
+ </div>
92
+ </section>
93
+
94
+ {stepOneStyles ? <style>{stepOneStyles}</style> : null}
95
+ </>
96
+ );
97
+ }
98
+
99
+ const stepOneStyles = `
100
+ .step-one-screen {
101
+ --sprite-offset-x: 0px;
102
+ background: var(--color-bg-warning);
103
+ }
104
+
105
+ .step-one-screen .figma-headline-line.is-accent {
106
+ color: var(--color-primary);
107
+ }
108
+ `;
@@ -0,0 +1,43 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { stepTwoContent, stepTwoOptions } from './content/step-02.content';
5
+ import { stepTwo } from './step-02';
6
+
7
+ const stepSource = readFileSync(path.resolve(__dirname, './step-02.tsx'), 'utf8');
8
+
9
+ describe('StepTwo', () => {
10
+ it('declares its typed multi-select answer contract and immutable option IDs', () => {
11
+ expect(stepTwo.choice).toEqual({
12
+ answerKey: 'selectedDevices',
13
+ allowEmpty: true,
14
+ });
15
+ expect(stepTwoOptions.map((option) => option.id)).toEqual([
16
+ 'iphone',
17
+ 'laptop',
18
+ 'watch',
19
+ 'none',
20
+ ]);
21
+ expect(Object.isFrozen(stepTwoOptions)).toBe(true);
22
+ expect(stepTwoOptions.every((option) => Object.isFrozen(option))).toBe(true);
23
+ });
24
+
25
+ it('owns explicit typed completion instead of writing choices continuously', () => {
26
+ expect(stepTwo.actionBar).toEqual({ hidden: true });
27
+ expect(stepTwoContent.locales.en.continueLabel).toBe('Continue');
28
+ expect(stepSource).toContain('useStepChoices(stepTwo, stepTwoOptions)');
29
+ expect(stepSource).toContain('<PrimaryButton');
30
+ expect(stepSource).toContain('{content.continueLabel}');
31
+ expect(stepSource).toContain('completeMulti(selectedIds)');
32
+ expect(stepSource).not.toContain('useEffect');
33
+ expect(stepSource).not.toContain('setAnswer');
34
+ });
35
+
36
+ it('exposes each native choice button and its selected state to assistive technology', () => {
37
+ expect(stepSource).toContain('role="group"');
38
+ expect(stepSource).not.toContain('role="list"');
39
+ expect(stepSource).not.toContain('role="listitem"');
40
+ expect(stepSource).toContain('aria-pressed={isSelected}');
41
+ expect(stepSource).toContain('aria-hidden="true"');
42
+ });
43
+ });
@@ -0,0 +1,140 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { FunnelStepImage } from '@/components/FunnelStepImage';
3
+ import { FunnelStepHeader } from '@/components/step/FunnelStepHeader';
4
+ import { getStepContentLocale } from '@/runtime/step-content-context';
5
+ import {
6
+ stepTwoContent,
7
+ stepTwoOptions,
8
+ type StepTwoOptionId,
9
+ } from '@/steps/content/step-02.content';
10
+ import {
11
+ PrimaryButton,
12
+ usePreviewStepLocalizedContent,
13
+ useFunnel,
14
+ useStepChoices,
15
+ type FunnelStepMeta,
16
+ } from '@funnelsgrove/runtime';
17
+
18
+ export const stepTwoId = 'step-2';
19
+
20
+ export const stepTwo: FunnelStepMeta = {
21
+ id: stepTwoId,
22
+ name: 'step-2',
23
+ type: 'multi_select_choice',
24
+ choice: {
25
+ answerKey: 'selectedDevices',
26
+ allowEmpty: true,
27
+ },
28
+ figmaNodeId: 'template-02-devices',
29
+ title: 'Step 2',
30
+ description: 'Device selection step with visual options.',
31
+ actionBar: {
32
+ hidden: true,
33
+ },
34
+ };
35
+
36
+ export function StepTwo() {
37
+ const { attributes } = useFunnel();
38
+ const { completeMulti } = useStepChoices(stepTwo, stepTwoOptions);
39
+ const [selectedIds, setSelectedIds] = useState<StepTwoOptionId[]>([]);
40
+ const content = usePreviewStepLocalizedContent(
41
+ stepTwoId,
42
+ stepTwoContent,
43
+ getStepContentLocale(attributes),
44
+ );
45
+
46
+ const selectedLookup = useMemo(() => new Set(selectedIds), [selectedIds]);
47
+
48
+ const toggleOption = (optionId: StepTwoOptionId) => {
49
+ setSelectedIds((prev) => {
50
+ const exists = prev.includes(optionId);
51
+ return exists ? prev.filter((id) => id !== optionId) : [...prev, optionId];
52
+ });
53
+ };
54
+
55
+ return (
56
+ <>
57
+ <section className="devices-step" data-node-id="template:02-devices">
58
+ <FunnelStepHeader
59
+ className="devices-header"
60
+ titleClassName="devices-title"
61
+ title={
62
+ <>
63
+ {content.title[0]}
64
+ <br />
65
+ <span className="is-accent">{content.title[1]}</span>
66
+ </>
67
+ }
68
+ subtitle={content.description}
69
+ subtitleClassName="devices-description"
70
+ />
71
+
72
+ <div className="devices-options" role="group" aria-label={content.optionsLabel}>
73
+ {content.options.map((option) => {
74
+ const isSelected = selectedLookup.has(option.id);
75
+
76
+ return (
77
+ <button
78
+ key={option.id}
79
+ type="button"
80
+ aria-pressed={isSelected}
81
+ className={
82
+ isSelected
83
+ ? 'device-option is-interactive is-selected'
84
+ : 'device-option is-interactive'
85
+ }
86
+ onClick={() => toggleOption(option.id)}
87
+ >
88
+ <span className="device-option-main">
89
+ <FunnelStepImage
90
+ src={option.image.src}
91
+ alt={option.image.alt || ''}
92
+ width={42}
93
+ height={42}
94
+ className="device-option-image"
95
+ draggable={false}
96
+ />
97
+ <span className="device-option-label">{option.label}</span>
98
+ </span>
99
+
100
+ <span
101
+ className={isSelected ? 'device-option-checkbox is-selected' : 'device-option-checkbox'}
102
+ aria-hidden="true"
103
+ >
104
+ {isSelected ? <span className="device-option-checkbox-icon">✓</span> : null}
105
+ </span>
106
+ </button>
107
+ );
108
+ })}
109
+ </div>
110
+ </section>
111
+
112
+ <footer className="action-bar">
113
+ <PrimaryButton onClick={() => completeMulti(selectedIds)}>
114
+ {content.continueLabel}
115
+ </PrimaryButton>
116
+ </footer>
117
+
118
+ {stepTwoStyles ? <style>{stepTwoStyles}</style> : null}
119
+ </>
120
+ );
121
+ }
122
+
123
+ const stepTwoStyles = `
124
+ .device-option {
125
+ cursor: pointer;
126
+ }
127
+
128
+ .device-option-image {
129
+ width: 42px;
130
+ height: 42px;
131
+ object-fit: contain;
132
+ border-radius: 8px;
133
+ }
134
+
135
+ .device-option-checkbox-icon {
136
+ font-size: 12px;
137
+ line-height: 1;
138
+ font-weight: 800;
139
+ }
140
+ `;
@@ -0,0 +1,15 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { resolveStepThreeAutoAdvanceMs, stepThree } from './step-03';
3
+
4
+ describe('StepThree', () => {
5
+ it('keeps the shell action bar hidden because the step owns its own auto-advance behavior', () => {
6
+ expect(stepThree.actionBar).toEqual({
7
+ hidden: true,
8
+ });
9
+ });
10
+
11
+ it('disables auto-advance when the funnel is rendered inside builder preview', () => {
12
+ expect(resolveStepThreeAutoAdvanceMs(true)).toBeNull();
13
+ expect(resolveStepThreeAutoAdvanceMs(false)).toBe(2200);
14
+ });
15
+ });