@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.
- package/contracts/step-contract-v2.json +733 -0
- package/dist/analyticsOutput.d.ts +30 -15
- package/dist/analyticsOutput.js +45 -28
- package/dist/apiClient.d.ts +85 -0
- package/dist/apiClient.js +225 -8
- package/dist/cli.d.ts +149 -1
- package/dist/cli.js +1232 -71
- package/dist/diagnosticOutput.d.ts +42 -0
- package/dist/diagnosticOutput.js +83 -0
- package/dist/docsOutput.d.ts +19 -0
- package/dist/docsOutput.js +73 -0
- package/dist/docsTransaction.d.ts +81 -0
- package/dist/docsTransaction.js +1755 -0
- package/dist/funnelValidation.d.ts +14 -0
- package/dist/funnelValidation.js +297 -0
- package/dist/localSync.d.ts +79 -0
- package/dist/localSync.js +428 -53
- package/dist/projectValidator.d.ts +27 -0
- package/dist/projectValidator.js +208 -0
- package/dist/reskin.js +27 -1
- package/dist/stepContractMigration.d.ts +71 -0
- package/dist/stepContractMigration.js +1323 -0
- package/dist/templateDocs.js +8 -25
- package/docs-release-history.json +66 -0
- package/legacy-docs-catalog.json +1012 -0
- package/package.json +13 -4
- package/template_docs/.funnelsgrove-docs.json +144 -0
- package/template_docs/AGENTS.md +30 -58
- package/template_docs/CLAUDE.md +0 -2
- package/template_docs/docs/funnelsgrove/START-HERE.md +73 -0
- package/template_docs/docs/funnelsgrove/contracts/analytics-events.md +59 -0
- package/template_docs/docs/funnelsgrove/contracts/content-answers.md +44 -0
- package/template_docs/docs/funnelsgrove/contracts/flow-routing.md +41 -0
- package/template_docs/docs/funnelsgrove/contracts/payments.md +42 -0
- package/template_docs/docs/funnelsgrove/contracts/step-metadata.md +57 -0
- package/template_docs/docs/funnelsgrove/migrations/step-contract-v3.md +39 -0
- package/template_docs/docs/funnelsgrove/qa/analytics.md +43 -0
- package/template_docs/docs/funnelsgrove/qa/local.md +42 -0
- package/template_docs/docs/funnelsgrove/qa/paywall-checkout.md +55 -0
- package/template_docs/docs/funnelsgrove/qa/publish.md +32 -0
- package/template_docs/docs/funnelsgrove/recipes/add-experiment.md +34 -0
- package/template_docs/docs/funnelsgrove/recipes/add-step.md +33 -0
- package/template_docs/docs/funnelsgrove/recipes/edit-step.md +31 -0
- package/template_docs/docs/funnelsgrove/steps/INDEX.md +26 -0
- package/template_docs/docs/funnelsgrove/steps/cancellation_offer.md +112 -0
- package/template_docs/docs/funnelsgrove/steps/checkout.md +120 -0
- package/template_docs/docs/funnelsgrove/steps/form_input.md +115 -0
- package/template_docs/docs/funnelsgrove/steps/intro_hero.md +110 -0
- package/template_docs/docs/funnelsgrove/steps/multi_select_choice.md +123 -0
- package/template_docs/docs/funnelsgrove/steps/paywall_offer.md +115 -0
- package/template_docs/docs/funnelsgrove/steps/progress_interstitial.md +111 -0
- package/template_docs/docs/funnelsgrove/steps/purchase_completed.md +117 -0
- package/template_docs/docs/funnelsgrove/steps/single_step_choice.md +122 -0
- package/template_docs/docs/funnelsgrove/steps/single_step_choice_emoji.md +122 -0
- package/template_docs/docs/funnelsgrove/steps/social_proof.md +110 -0
- package/template_docs/docs/funnelsgrove/steps/subscription_handoff.md +113 -0
- package/template_docs/docs/funnelsgrove/steps/subscription_management.md +112 -0
- package/template_docs/docs/funnelsgrove/steps/summary_confirmation.md +110 -0
- package/template_docs/docs/funnelsgrove/steps/upsell_offer.md +112 -0
- package/template_docs/docs/funnelsgrove/steps/value_prop_story.md +110 -0
- package/template_docs/funnel-docs.config.json +43 -0
- package/template_scaffold/.env.example +41 -0
- package/template_scaffold/.funnelsgrove-contract-tools.json +19 -0
- package/template_scaffold/.funnelsgrove-docs.json +144 -0
- package/template_scaffold/.funnelsgrove-scaffold.json +1078 -0
- package/template_scaffold/AGENTS.md +42 -0
- package/template_scaffold/CLAUDE.md +1 -0
- package/template_scaffold/PLAN.md +81 -0
- package/template_scaffold/PRODUCT_SENSE.md +28 -0
- package/template_scaffold/context/build-context.md +34 -0
- package/template_scaffold/docs/AGENT_FUNNEL_IMPLEMENTATION_SPEC.md +5 -0
- package/template_scaffold/docs/ARCHITECTURE.md +5 -0
- package/template_scaffold/docs/FLOW_CONFIG_AND_ROUTING.md +5 -0
- package/template_scaffold/docs/PAYWALL_AND_PAYMENTS.md +5 -0
- package/template_scaffold/docs/README.md +5 -0
- package/template_scaffold/docs/funnelsgrove/START-HERE.md +73 -0
- package/template_scaffold/docs/funnelsgrove/contracts/analytics-events.md +59 -0
- package/template_scaffold/docs/funnelsgrove/contracts/content-answers.md +44 -0
- package/template_scaffold/docs/funnelsgrove/contracts/flow-routing.md +41 -0
- package/template_scaffold/docs/funnelsgrove/contracts/payments.md +42 -0
- package/template_scaffold/docs/funnelsgrove/contracts/step-metadata.md +57 -0
- package/template_scaffold/docs/funnelsgrove/migrations/step-contract-v3.md +39 -0
- package/template_scaffold/docs/funnelsgrove/qa/analytics.md +43 -0
- package/template_scaffold/docs/funnelsgrove/qa/local.md +42 -0
- package/template_scaffold/docs/funnelsgrove/qa/paywall-checkout.md +55 -0
- package/template_scaffold/docs/funnelsgrove/qa/publish.md +32 -0
- package/template_scaffold/docs/funnelsgrove/recipes/add-experiment.md +34 -0
- package/template_scaffold/docs/funnelsgrove/recipes/add-step.md +33 -0
- package/template_scaffold/docs/funnelsgrove/recipes/edit-step.md +31 -0
- package/template_scaffold/docs/funnelsgrove/steps/INDEX.md +26 -0
- package/template_scaffold/docs/funnelsgrove/steps/cancellation_offer.md +112 -0
- package/template_scaffold/docs/funnelsgrove/steps/checkout.md +120 -0
- package/template_scaffold/docs/funnelsgrove/steps/form_input.md +115 -0
- package/template_scaffold/docs/funnelsgrove/steps/intro_hero.md +110 -0
- package/template_scaffold/docs/funnelsgrove/steps/multi_select_choice.md +123 -0
- package/template_scaffold/docs/funnelsgrove/steps/paywall_offer.md +115 -0
- package/template_scaffold/docs/funnelsgrove/steps/progress_interstitial.md +111 -0
- package/template_scaffold/docs/funnelsgrove/steps/purchase_completed.md +117 -0
- package/template_scaffold/docs/funnelsgrove/steps/single_step_choice.md +122 -0
- package/template_scaffold/docs/funnelsgrove/steps/single_step_choice_emoji.md +122 -0
- package/template_scaffold/docs/funnelsgrove/steps/social_proof.md +110 -0
- package/template_scaffold/docs/funnelsgrove/steps/subscription_handoff.md +113 -0
- package/template_scaffold/docs/funnelsgrove/steps/subscription_management.md +112 -0
- package/template_scaffold/docs/funnelsgrove/steps/summary_confirmation.md +110 -0
- package/template_scaffold/docs/funnelsgrove/steps/upsell_offer.md +112 -0
- package/template_scaffold/docs/funnelsgrove/steps/value_prop_story.md +110 -0
- package/template_scaffold/docs/references/funnel-sdk-user-answers.md +5 -0
- package/template_scaffold/eslint.config.mjs +16 -0
- package/template_scaffold/funnel-agent-docs.test.ts +699 -0
- package/template_scaffold/funnel-docs.config.json +43 -0
- package/template_scaffold/funnel.config.json +5 -0
- package/template_scaffold/gitignore.template +5 -0
- package/template_scaffold/next-env.d.ts +6 -0
- package/template_scaffold/next.config.ts +53 -0
- package/template_scaffold/package-lock.json +7737 -0
- package/template_scaffold/package.json +37 -0
- package/template_scaffold/package.test.ts +23 -0
- package/template_scaffold/public/claimbee/bee.png +0 -0
- package/template_scaffold/public/claimbee/device-iphone.png +0 -0
- package/template_scaffold/public/claimbee/device-macbook.png +0 -0
- package/template_scaffold/public/claimbee/device-none.png +0 -0
- package/template_scaffold/public/claimbee/device-watch.png +0 -0
- package/template_scaffold/public/claimbee/glow.svg +3 -0
- package/template_scaffold/public/claimbee/steps-sprite-alt.png +0 -0
- package/template_scaffold/public/claimbee/steps-sprite-default.png +0 -0
- package/template_scaffold/public/claimbee/testimonial-avatar.png +0 -0
- package/template_scaffold/public/claimbee/testimonial-star.svg +3 -0
- package/template_scaffold/public/paywall/ai-claim-assistant.png +0 -0
- package/template_scaffold/public/paywall/claim-history.png +0 -0
- package/template_scaffold/public/paywall/clear-progress.png +0 -0
- package/template_scaffold/public/paywall/hero.png +0 -0
- package/template_scaffold/public/paywall/money-alerts.png +0 -0
- package/template_scaffold/public/paywall/money-back-badge.png +0 -0
- package/template_scaffold/public/paywall/paywall-image.png +0 -0
- package/template_scaffold/public/paywall/r1.png +0 -0
- package/template_scaffold/public/paywall/r2.png +0 -0
- package/template_scaffold/public/paywall/r3.png +0 -0
- package/template_scaffold/public/paywall/r4.png +0 -0
- package/template_scaffold/public/paywall/r5.png +0 -0
- package/template_scaffold/public/paywall/r6.png +0 -0
- package/template_scaffold/public/paywall/special-offer-gift.png +0 -0
- package/template_scaffold/public/please/bee.png +0 -0
- package/template_scaffold/public/please/device-iphone.png +0 -0
- package/template_scaffold/public/please/device-macbook.png +0 -0
- package/template_scaffold/public/please/device-none.png +0 -0
- package/template_scaffold/public/please/device-watch.png +0 -0
- package/template_scaffold/public/please/glow.svg +3 -0
- package/template_scaffold/public/please/steps-sprite-alt.png +0 -0
- package/template_scaffold/public/please/steps-sprite-default.png +0 -0
- package/template_scaffold/public/please/testimonial-avatar.png +0 -0
- package/template_scaffold/public/please/testimonial-star.svg +3 -0
- package/template_scaffold/public/upsell/upgrade-hero.png +0 -0
- package/template_scaffold/src/app/[stepId]/page.test.tsx +59 -0
- package/template_scaffold/src/app/[stepId]/page.tsx +62 -0
- package/template_scaffold/src/app/globals.css +49 -0
- package/template_scaffold/src/app/layout.test.ts +26 -0
- package/template_scaffold/src/app/layout.tsx +61 -0
- package/template_scaffold/src/app/page.tsx +8 -0
- package/template_scaffold/src/app/sdk/page.tsx +673 -0
- package/template_scaffold/src/app/subscription-dashboard/page.tsx +274 -0
- package/template_scaffold/src/assets/claimbee/bee.png +0 -0
- package/template_scaffold/src/assets/claimbee/device-iphone.png +0 -0
- package/template_scaffold/src/assets/claimbee/device-macbook.png +0 -0
- package/template_scaffold/src/assets/claimbee/device-none.png +0 -0
- package/template_scaffold/src/assets/claimbee/device-watch.png +0 -0
- package/template_scaffold/src/assets/claimbee/glow.svg +3 -0
- package/template_scaffold/src/assets/claimbee/steps-sprite-alt.png +0 -0
- package/template_scaffold/src/assets/claimbee/steps-sprite-default.png +0 -0
- package/template_scaffold/src/assets/claimbee/testimonial-avatar.png +0 -0
- package/template_scaffold/src/assets/claimbee/testimonial-star.svg +3 -0
- package/template_scaffold/src/components/FunnelEditorPanel.tsx +194 -0
- package/template_scaffold/src/components/FunnelFlow.test.tsx +17 -0
- package/template_scaffold/src/components/FunnelFlow.tsx +114 -0
- package/template_scaffold/src/components/FunnelStepImage.test.ts +15 -0
- package/template_scaffold/src/components/FunnelStepImage.tsx +28 -0
- package/template_scaffold/src/components/step/FunnelStepHeader.tsx +35 -0
- package/template_scaffold/src/config/billing.plans.test.ts +143 -0
- package/template_scaffold/src/config/billing.plans.ts +69 -0
- package/template_scaffold/src/config/billing.test.plans.ts +32 -0
- package/template_scaffold/src/config/experiments.generated.ts +4 -0
- package/template_scaffold/src/config/experiments.test.ts +12 -0
- package/template_scaffold/src/config/experiments.ts +9 -0
- package/template_scaffold/src/config/funnel.config.ts +12 -0
- package/template_scaffold/src/config/funnel.manifest.test.ts +166 -0
- package/template_scaffold/src/config/funnel.manifest.ts +139 -0
- package/template_scaffold/src/config/offer-sets.generated.ts +4 -0
- package/template_scaffold/src/contract/funnel-project.validation.test.ts +80 -0
- package/template_scaffold/src/contract/funnel-project.validation.ts +44 -0
- package/template_scaffold/src/contract/funnel-validator.vite.config.ts +11 -0
- package/template_scaffold/src/contract/golden/cancellation_offer.fixture.ts +29 -0
- package/template_scaffold/src/contract/golden/checkout.fixture.ts +37 -0
- package/template_scaffold/src/contract/golden/form_input.fixture.ts +28 -0
- package/template_scaffold/src/contract/golden/golden-fixtures.test.ts +190 -0
- package/template_scaffold/src/contract/golden/intro_hero.fixture.ts +27 -0
- package/template_scaffold/src/contract/golden/multi_select_choice.fixture.ts +37 -0
- package/template_scaffold/src/contract/golden/paywall_offer.fixture.ts +30 -0
- package/template_scaffold/src/contract/golden/progress_interstitial.fixture.ts +28 -0
- package/template_scaffold/src/contract/golden/purchase_completed.fixture.ts +33 -0
- package/template_scaffold/src/contract/golden/single_step_choice.fixture.ts +36 -0
- package/template_scaffold/src/contract/golden/single_step_choice_emoji.fixture.ts +36 -0
- package/template_scaffold/src/contract/golden/social_proof.fixture.ts +27 -0
- package/template_scaffold/src/contract/golden/subscription_handoff.fixture.ts +30 -0
- package/template_scaffold/src/contract/golden/subscription_management.fixture.ts +29 -0
- package/template_scaffold/src/contract/golden/summary_confirmation.fixture.ts +27 -0
- package/template_scaffold/src/contract/golden/upsell_offer.fixture.ts +29 -0
- package/template_scaffold/src/contract/golden/value_prop_story.fixture.ts +27 -0
- package/template_scaffold/src/contract/validate-funnel.cli.test.ts +180 -0
- package/template_scaffold/src/contract/validate-funnel.cli.ts +199 -0
- package/template_scaffold/src/runtime/checkout-runtime-config.test.ts +60 -0
- package/template_scaffold/src/runtime/checkout-runtime-config.ts +26 -0
- package/template_scaffold/src/runtime/funnel-runtime.test.ts +25 -0
- package/template_scaffold/src/runtime/funnel-runtime.ts +118 -0
- package/template_scaffold/src/runtime/step-content-context.test.ts +38 -0
- package/template_scaffold/src/runtime/step-content-context.ts +65 -0
- package/template_scaffold/src/runtime/step-registry.ts +66 -0
- package/template_scaffold/src/runtime/step-variable-values.ts +31 -0
- package/template_scaffold/src/runtime/use-funnel-flow-controller.integration.test.ts +203 -0
- package/template_scaffold/src/runtime/use-funnel-flow-controller.test.ts +76 -0
- package/template_scaffold/src/runtime/use-funnel-flow-controller.ts +53 -0
- package/template_scaffold/src/steps/content/email-capture.content.ts +29 -0
- package/template_scaffold/src/steps/content/manage-subscription.content.ts +62 -0
- package/template_scaffold/src/steps/content/paywall.content.ts +191 -0
- package/template_scaffold/src/steps/content/step-01.content.ts +23 -0
- package/template_scaffold/src/steps/content/step-02.content.ts +77 -0
- package/template_scaffold/src/steps/content/step-03.content.ts +40 -0
- package/template_scaffold/src/steps/content/step-04.content.ts +49 -0
- package/template_scaffold/src/steps/content/step-32-paywall.content.ts +352 -0
- package/template_scaffold/src/steps/content/subscription-started.content.ts +68 -0
- package/template_scaffold/src/steps/editor/email-capture.editor.ts +58 -0
- package/template_scaffold/src/steps/editor/manage-subscription.editor.ts +179 -0
- package/template_scaffold/src/steps/editor/paywall.editor.ts +232 -0
- package/template_scaffold/src/steps/editor/step-01.editor.ts +22 -0
- package/template_scaffold/src/steps/editor/step-02.editor.ts +41 -0
- package/template_scaffold/src/steps/editor/step-03.editor.ts +58 -0
- package/template_scaffold/src/steps/editor/step-04.editor.ts +98 -0
- package/template_scaffold/src/steps/editor/step-32-paywall.editor.ts +478 -0
- package/template_scaffold/src/steps/editor/subscription-started.editor.ts +131 -0
- package/template_scaffold/src/steps/index.ts +25 -0
- package/template_scaffold/src/steps/paywall-checkout-options.test.ts +104 -0
- package/template_scaffold/src/steps/paywall-checkout-options.ts +130 -0
- package/template_scaffold/src/steps/pricing/paywall-b.pricing.ts +12 -0
- package/template_scaffold/src/steps/pricing/paywall.pricing.ts +12 -0
- package/template_scaffold/src/steps/pricing/shared-plan-order.ts +17 -0
- package/template_scaffold/src/steps/pricing/upsell-form.pricing.ts +16 -0
- package/template_scaffold/src/steps/shared-header-contract.test.ts +27 -0
- package/template_scaffold/src/steps/step-01.test.ts +38 -0
- package/template_scaffold/src/steps/step-01.tsx +108 -0
- package/template_scaffold/src/steps/step-02.test.ts +43 -0
- package/template_scaffold/src/steps/step-02.tsx +140 -0
- package/template_scaffold/src/steps/step-03.test.ts +15 -0
- package/template_scaffold/src/steps/step-03.tsx +262 -0
- package/template_scaffold/src/steps/step-04.test.ts +32 -0
- package/template_scaffold/src/steps/step-04.tsx +673 -0
- package/template_scaffold/src/steps/step-31-email-capture.test.ts +22 -0
- package/template_scaffold/src/steps/step-31-email-capture.tsx +195 -0
- package/template_scaffold/src/steps/step-32-paywall.test.ts +770 -0
- package/template_scaffold/src/steps/step-32-paywall.tsx +2253 -0
- package/template_scaffold/src/steps/step-32b-paywall-b.tsx +35 -0
- package/template_scaffold/src/steps/step-33-subscription-started.test.ts +26 -0
- package/template_scaffold/src/steps/step-33-subscription-started.tsx +86 -0
- package/template_scaffold/src/steps/step-34-upsell-form.test.ts +27 -0
- package/template_scaffold/src/steps/step-35-manage-subscription.tsx +46 -0
- package/template_scaffold/src/steps/step-content.registry.ts +45 -0
- package/template_scaffold/src/steps/step-image-migration.test.ts +20 -0
- package/template_scaffold/src/steps/styles/index.css +2 -0
- package/template_scaffold/src/steps/styles/shared/final-flow-shared.css +55 -0
- package/template_scaffold/src/steps/styles/shared/funnel-base.css +543 -0
- package/template_scaffold/src/steps/styles/shared/info-shared.css +139 -0
- package/template_scaffold/src/steps/styles/shared/progress-shared.css +117 -0
- package/template_scaffold/src/steps/styles/shared/question-shared.css +76 -0
- package/template_scaffold/src/steps/styles/shared/responsive-container.css +176 -0
- package/template_scaffold/src/steps/types.ts +7 -0
- package/template_scaffold/src/steps/use-claimbee-step-content.ts +15 -0
- package/template_scaffold/src/theme/theme.ts +81 -0
- package/template_scaffold/tsconfig.json +38 -0
- package/template_scaffold/vitest.config.ts +32 -0
- package/template_validation/.funnelsgrove-contract-tools.json +19 -0
- package/template_validation/src/contract/funnel-project.validation.ts +44 -0
- package/template_validation/src/contract/funnel-validator.vite.config.ts +11 -0
- package/template_validation/src/contract/validate-funnel.cli.ts +199 -0
- package/template_docs/docs/ab-experiments.md +0 -55
- package/template_docs/docs/analytics.md +0 -65
- package/template_docs/docs/editing-flow.md +0 -125
- package/template_docs/docs/editing-step.md +0 -125
- package/template_docs/docs/editor-and-content.md +0 -58
- package/template_docs/docs/funnel-runtime-architecture.md +0 -125
- package/template_docs/docs/meta-pixel-conversions-api.md +0 -50
- package/template_docs/docs/payment-plans-and-discounts.md +0 -106
- package/template_docs/docs/publishing-and-versioning.md +0 -117
- package/template_docs/docs/qa-checklist.md +0 -80
- package/template_docs/docs/sdk-api-endpoints.md +0 -78
- package/template_docs/docs/step-ui-guidelines.md +0 -110
- package/template_docs/docs/theme.md +0 -35
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type FunnelStepHeaderProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
kicker?: ReactNode;
|
|
6
|
+
kickerAs?: ElementType;
|
|
7
|
+
kickerClassName?: string;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
titleAs?: ElementType;
|
|
10
|
+
titleClassName?: string;
|
|
11
|
+
subtitle?: ReactNode;
|
|
12
|
+
subtitleAs?: ElementType;
|
|
13
|
+
subtitleClassName?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function FunnelStepHeader({
|
|
17
|
+
className,
|
|
18
|
+
kicker,
|
|
19
|
+
kickerAs: KickerTag = 'p',
|
|
20
|
+
kickerClassName,
|
|
21
|
+
title,
|
|
22
|
+
titleAs: TitleTag = 'h2',
|
|
23
|
+
titleClassName,
|
|
24
|
+
subtitle,
|
|
25
|
+
subtitleAs: SubtitleTag = 'p',
|
|
26
|
+
subtitleClassName,
|
|
27
|
+
}: FunnelStepHeaderProps) {
|
|
28
|
+
return (
|
|
29
|
+
<header className={className}>
|
|
30
|
+
{kicker ? <KickerTag className={kickerClassName}>{kicker}</KickerTag> : null}
|
|
31
|
+
<TitleTag className={titleClassName}>{title}</TitleTag>
|
|
32
|
+
{subtitle ? <SubtitleTag className={subtitleClassName}>{subtitle}</SubtitleTag> : null}
|
|
33
|
+
</header>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { buildConfigPaywallPlans } from '@funnelsgrove/payments';
|
|
3
|
+
|
|
4
|
+
const CLAIMBEE_PROJECT_PLAN_IDS = {
|
|
5
|
+
weekly: '32b31f69-5907-4736-89c7-76d3acb38813',
|
|
6
|
+
monthly: 'ce0a0022-7bf0-41f2-a707-edc5e6113a07',
|
|
7
|
+
yearly: 'fb623ebc-c2fd-4e6a-8eb6-b8ed92db1b21',
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
const CLAIMBEE_TEST_PROVIDER_PLAN_IDS = {
|
|
11
|
+
weekly: 'price_1TOQ2fPEfkEVo5khumapOSsI',
|
|
12
|
+
monthly: 'price_1TSgPZPEfkEVo5khMbtAlqsG',
|
|
13
|
+
yearly: 'price_1TBgcaPEfkEVo5khbGnGhrBA',
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
const CLAIMBEE_LIVE_PROVIDER_PLAN_IDS = {
|
|
17
|
+
weekly: 'price_1T9WL2PPRN41Ty94g2NNOgif',
|
|
18
|
+
monthly: 'price_1TP0IIPPRN41Ty94npkzVeDR',
|
|
19
|
+
yearly: 'price_1T06AEPPRN41Ty94zvVt5xrk',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
const stubRuntimeMode = (mode: 'test' | 'live') => {
|
|
23
|
+
vi.stubGlobal('window', {
|
|
24
|
+
location: {
|
|
25
|
+
hostname: mode === 'test' ? 'claimbee-preview.funnelsgrove.org' : 'check.claimbee.app',
|
|
26
|
+
search: mode === 'test' ? '?mode=test' : '?mode=prod',
|
|
27
|
+
},
|
|
28
|
+
localStorage: {
|
|
29
|
+
getItem: vi.fn(() => null),
|
|
30
|
+
setItem: vi.fn(),
|
|
31
|
+
},
|
|
32
|
+
dispatchEvent: vi.fn(),
|
|
33
|
+
addEventListener: vi.fn(),
|
|
34
|
+
removeEventListener: vi.fn(),
|
|
35
|
+
});
|
|
36
|
+
vi.stubGlobal('document', {
|
|
37
|
+
cookie: '',
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
describe('claimbee billing contract', () => {
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
vi.unstubAllGlobals();
|
|
44
|
+
vi.resetModules();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('exports minimal live billing config and normalized discounts', async () => {
|
|
48
|
+
const billingModule = await import('./billing.plans');
|
|
49
|
+
const {
|
|
50
|
+
billing,
|
|
51
|
+
billingDiscountList,
|
|
52
|
+
billingDiscounts,
|
|
53
|
+
billingPlans,
|
|
54
|
+
} = billingModule;
|
|
55
|
+
|
|
56
|
+
expect(Object.keys(billing.plans)).toEqual(['primary', 'secondary', 'tertiary']);
|
|
57
|
+
expect(billing.plans.primary).toEqual({
|
|
58
|
+
projectPlanId: CLAIMBEE_PROJECT_PLAN_IDS.weekly,
|
|
59
|
+
title: '1-Week Plan',
|
|
60
|
+
providerPlanId: CLAIMBEE_LIVE_PROVIDER_PLAN_IDS.weekly,
|
|
61
|
+
priceLabel: '$7.99/week',
|
|
62
|
+
perDayAmount: '$1.14',
|
|
63
|
+
amountCents: 799,
|
|
64
|
+
checkoutSummaryLabel: '$7.99 today',
|
|
65
|
+
});
|
|
66
|
+
expect(billing.plans.secondary).toEqual({
|
|
67
|
+
projectPlanId: CLAIMBEE_PROJECT_PLAN_IDS.monthly,
|
|
68
|
+
title: '1-Month Plan',
|
|
69
|
+
providerPlanId: CLAIMBEE_LIVE_PROVIDER_PLAN_IDS.monthly,
|
|
70
|
+
featuredTag: '🔥 Most Popular Choice',
|
|
71
|
+
priceLabel: '$29.99/month',
|
|
72
|
+
perDayAmount: '$1.00',
|
|
73
|
+
amountCents: 2999,
|
|
74
|
+
checkoutSummaryLabel: '$29.99 today',
|
|
75
|
+
});
|
|
76
|
+
expect(billingPlans).toBe(billing.plans);
|
|
77
|
+
expect('id' in billing.plans.primary).toBe(false);
|
|
78
|
+
expect('oldPriceLabel' in billing.plans.primary).toBe(false);
|
|
79
|
+
expect('perDayLabel' in billing.plans.primary).toBe(false);
|
|
80
|
+
expect('billingInterval' in billing.plans.primary).toBe(false);
|
|
81
|
+
expect('isDefault' in billing.plans.secondary).toBe(false);
|
|
82
|
+
expect(billing.discounts.map((discount) => discount.stage)).toEqual(['first', 'second']);
|
|
83
|
+
expect(billingDiscounts.first.couponId).toBe('fg_30_off_one');
|
|
84
|
+
expect(billingDiscounts.second.couponId).toBe('fg_46_off_once');
|
|
85
|
+
expect(billingDiscountList).toBe(billing.discounts);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('uses test provider price ids when Stripe mode is test', async () => {
|
|
89
|
+
stubRuntimeMode('test');
|
|
90
|
+
const { billing } = await import('./billing.plans');
|
|
91
|
+
|
|
92
|
+
expect(billing.plans.primary.projectPlanId).toBe(CLAIMBEE_PROJECT_PLAN_IDS.weekly);
|
|
93
|
+
expect(billing.plans.primary.providerPlanId).toBe(CLAIMBEE_TEST_PROVIDER_PLAN_IDS.weekly);
|
|
94
|
+
expect(billing.plans.secondary.projectPlanId).toBe(CLAIMBEE_PROJECT_PLAN_IDS.monthly);
|
|
95
|
+
expect(billing.plans.secondary.providerPlanId).toBe(CLAIMBEE_TEST_PROVIDER_PLAN_IDS.monthly);
|
|
96
|
+
expect(billing.plans.tertiary.projectPlanId).toBe(CLAIMBEE_PROJECT_PLAN_IDS.yearly);
|
|
97
|
+
expect(billing.plans.tertiary.providerPlanId).toBe(CLAIMBEE_TEST_PROVIDER_PLAN_IDS.yearly);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('exports the split test plan catalog under the generic billingTestPlans name', async () => {
|
|
101
|
+
const billingTestModule = await import('./billing.test.plans') as Record<string, unknown>;
|
|
102
|
+
|
|
103
|
+
expect(billingTestModule.billingTestPlans).toEqual({
|
|
104
|
+
primary: expect.objectContaining({
|
|
105
|
+
projectPlanId: CLAIMBEE_PROJECT_PLAN_IDS.weekly,
|
|
106
|
+
providerPlanId: CLAIMBEE_TEST_PROVIDER_PLAN_IDS.weekly,
|
|
107
|
+
}),
|
|
108
|
+
secondary: expect.objectContaining({
|
|
109
|
+
projectPlanId: CLAIMBEE_PROJECT_PLAN_IDS.monthly,
|
|
110
|
+
providerPlanId: CLAIMBEE_TEST_PROVIDER_PLAN_IDS.monthly,
|
|
111
|
+
}),
|
|
112
|
+
tertiary: expect.objectContaining({
|
|
113
|
+
projectPlanId: CLAIMBEE_PROJECT_PLAN_IDS.yearly,
|
|
114
|
+
providerPlanId: CLAIMBEE_TEST_PROVIDER_PLAN_IDS.yearly,
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('lets payments helpers derive ordered paywall plans from semantic keys', async () => {
|
|
120
|
+
const { billingPlans } = await import('./billing.plans');
|
|
121
|
+
|
|
122
|
+
expect(buildConfigPaywallPlans(billingPlans, ['primary', 'secondary', 'tertiary'])).toEqual([
|
|
123
|
+
expect.objectContaining({
|
|
124
|
+
id: 'primary',
|
|
125
|
+
providerPlanId: CLAIMBEE_LIVE_PROVIDER_PLAN_IDS.weekly,
|
|
126
|
+
perDayLabel: 'per day',
|
|
127
|
+
billingInterval: 'week',
|
|
128
|
+
source: 'config',
|
|
129
|
+
}),
|
|
130
|
+
expect.objectContaining({
|
|
131
|
+
id: 'secondary',
|
|
132
|
+
providerPlanId: CLAIMBEE_LIVE_PROVIDER_PLAN_IDS.monthly,
|
|
133
|
+
featuredTag: '🔥 Most Popular Choice',
|
|
134
|
+
billingInterval: 'month',
|
|
135
|
+
}),
|
|
136
|
+
expect.objectContaining({
|
|
137
|
+
id: 'tertiary',
|
|
138
|
+
providerPlanId: CLAIMBEE_LIVE_PROVIDER_PLAN_IDS.yearly,
|
|
139
|
+
billingInterval: 'year',
|
|
140
|
+
}),
|
|
141
|
+
]);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildBillingDiscountCatalog,
|
|
3
|
+
createRuntimeModeBillingPlanCatalog,
|
|
4
|
+
type BillingConfig,
|
|
5
|
+
type BillingDiscountList,
|
|
6
|
+
type BillingPlanCatalog,
|
|
7
|
+
} from '@funnelsgrove/payments';
|
|
8
|
+
import { billingTestPlans } from './billing.test.plans';
|
|
9
|
+
|
|
10
|
+
const claimbeeLivePlans = {
|
|
11
|
+
primary: {
|
|
12
|
+
projectPlanId: '32b31f69-5907-4736-89c7-76d3acb38813',
|
|
13
|
+
title: '1-Week Plan',
|
|
14
|
+
providerPlanId: 'price_1T9WL2PPRN41Ty94g2NNOgif',
|
|
15
|
+
priceLabel: '$7.99/week',
|
|
16
|
+
perDayAmount: '$1.14',
|
|
17
|
+
amountCents: 799,
|
|
18
|
+
checkoutSummaryLabel: '$7.99 today',
|
|
19
|
+
},
|
|
20
|
+
secondary: {
|
|
21
|
+
projectPlanId: 'ce0a0022-7bf0-41f2-a707-edc5e6113a07',
|
|
22
|
+
title: '1-Month Plan',
|
|
23
|
+
providerPlanId: 'price_1TP0IIPPRN41Ty94npkzVeDR',
|
|
24
|
+
featuredTag: '🔥 Most Popular Choice',
|
|
25
|
+
priceLabel: '$29.99/month',
|
|
26
|
+
perDayAmount: '$1.00',
|
|
27
|
+
amountCents: 2999,
|
|
28
|
+
checkoutSummaryLabel: '$29.99 today',
|
|
29
|
+
},
|
|
30
|
+
tertiary: {
|
|
31
|
+
projectPlanId: 'fb623ebc-c2fd-4e6a-8eb6-b8ed92db1b21',
|
|
32
|
+
title: '1-Year Plan',
|
|
33
|
+
providerPlanId: 'price_1T06AEPPRN41Ty94zvVt5xrk',
|
|
34
|
+
priceLabel: '$59.99/year',
|
|
35
|
+
perDayAmount: '$0.16',
|
|
36
|
+
amountCents: 5999,
|
|
37
|
+
checkoutSummaryLabel: '$59.99 today',
|
|
38
|
+
},
|
|
39
|
+
} satisfies BillingPlanCatalog;
|
|
40
|
+
|
|
41
|
+
export const claimbeePlansByMode = {
|
|
42
|
+
test: billingTestPlans,
|
|
43
|
+
live: claimbeeLivePlans,
|
|
44
|
+
} satisfies Record<'test' | 'live', BillingPlanCatalog>;
|
|
45
|
+
|
|
46
|
+
export const billing = {
|
|
47
|
+
plans: createRuntimeModeBillingPlanCatalog(claimbeePlansByMode),
|
|
48
|
+
discounts: [
|
|
49
|
+
{
|
|
50
|
+
stage: 'first',
|
|
51
|
+
couponId: 'fg_30_off_one',
|
|
52
|
+
discountPercent: 30,
|
|
53
|
+
durationSeconds: 600,
|
|
54
|
+
previousDiscountPercent: null,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
stage: 'second',
|
|
58
|
+
couponId: 'fg_46_off_once',
|
|
59
|
+
discountPercent: 46,
|
|
60
|
+
durationSeconds: 600,
|
|
61
|
+
previousDiscountPercent: 30,
|
|
62
|
+
},
|
|
63
|
+
] satisfies BillingDiscountList,
|
|
64
|
+
} satisfies BillingConfig;
|
|
65
|
+
|
|
66
|
+
export const billingPlans = billing.plans;
|
|
67
|
+
export const billingDiscounts = buildBillingDiscountCatalog(billing.discounts);
|
|
68
|
+
export const billingDiscountList = billing.discounts;
|
|
69
|
+
export const billingDiscountStorageKeys = ['claimbee-paywall-discount-v1'] as const;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BillingPlanCatalog } from '@funnelsgrove/payments';
|
|
2
|
+
|
|
3
|
+
export const billingTestPlans = {
|
|
4
|
+
primary: {
|
|
5
|
+
projectPlanId: '32b31f69-5907-4736-89c7-76d3acb38813',
|
|
6
|
+
title: '1-Week Plan',
|
|
7
|
+
providerPlanId: 'price_1TOQ2fPEfkEVo5khumapOSsI',
|
|
8
|
+
priceLabel: '$9.99/week',
|
|
9
|
+
perDayAmount: '$1.43',
|
|
10
|
+
amountCents: 999,
|
|
11
|
+
checkoutSummaryLabel: '$9.99 today',
|
|
12
|
+
},
|
|
13
|
+
secondary: {
|
|
14
|
+
projectPlanId: 'ce0a0022-7bf0-41f2-a707-edc5e6113a07',
|
|
15
|
+
title: '1-Month Plan',
|
|
16
|
+
providerPlanId: 'price_1TSgPZPEfkEVo5khMbtAlqsG',
|
|
17
|
+
featuredTag: '🔥 Most Popular Choice',
|
|
18
|
+
priceLabel: '$29.99/month',
|
|
19
|
+
perDayAmount: '$1.00',
|
|
20
|
+
amountCents: 2999,
|
|
21
|
+
checkoutSummaryLabel: '$29.99 today',
|
|
22
|
+
},
|
|
23
|
+
tertiary: {
|
|
24
|
+
projectPlanId: 'fb623ebc-c2fd-4e6a-8eb6-b8ed92db1b21',
|
|
25
|
+
title: '1-Year Plan',
|
|
26
|
+
providerPlanId: 'price_1TBgcaPEfkEVo5khbGnGhrBA',
|
|
27
|
+
priceLabel: '$59.99/year',
|
|
28
|
+
perDayAmount: '$0.16',
|
|
29
|
+
amountCents: 5999,
|
|
30
|
+
checkoutSummaryLabel: '$59.99 today',
|
|
31
|
+
},
|
|
32
|
+
} satisfies BillingPlanCatalog;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { experiments, manifestExperiments } from './experiments';
|
|
3
|
+
|
|
4
|
+
describe('funnel experiments config', () => {
|
|
5
|
+
it('ships the generic template without brand-specific experiments', () => {
|
|
6
|
+
expect(experiments).toEqual([]);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('maps code-defined experiments into the runtime manifest shape', () => {
|
|
10
|
+
expect(manifestExperiments).toEqual([]);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineFunnelExperiments,
|
|
3
|
+
toManifestExperiments,
|
|
4
|
+
} from '@funnelsgrove/runtime';
|
|
5
|
+
import { generatedExperiments } from './experiments.generated';
|
|
6
|
+
|
|
7
|
+
export const experiments = defineFunnelExperiments(generatedExperiments);
|
|
8
|
+
|
|
9
|
+
export const manifestExperiments = toManifestExperiments(experiments);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { funnelManifest } from '@/config/funnel.manifest';
|
|
2
|
+
import { defaultFunnelStepId, funnelStepSequence } from '@/runtime/funnel-runtime';
|
|
3
|
+
|
|
4
|
+
export const funnelConfig = {
|
|
5
|
+
meta: funnelManifest.meta,
|
|
6
|
+
viewport: funnelManifest.viewport,
|
|
7
|
+
breakpoints: funnelManifest.breakpoints,
|
|
8
|
+
assets: funnelManifest.assets,
|
|
9
|
+
defaultStepId: defaultFunnelStepId,
|
|
10
|
+
stepSequence: funnelStepSequence,
|
|
11
|
+
templateArchitectureVersion: funnelManifest.templateArchitectureVersion,
|
|
12
|
+
} as const;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
CURRENT_STEP_CONTRACT_HASH,
|
|
4
|
+
CURRENT_STEP_CONTRACT_VERSION,
|
|
5
|
+
validateFunnelStepContractSnapshot,
|
|
6
|
+
type FunnelStepContractProjectSnapshot,
|
|
7
|
+
} from '@funnelsgrove/runtime';
|
|
8
|
+
import { stepRegistry } from '@/runtime/step-registry';
|
|
9
|
+
import { stepTwoContent, stepTwoOptions } from '@/steps/content/step-02.content';
|
|
10
|
+
import { contentOptionsByStepId } from '@/steps/step-content.registry';
|
|
11
|
+
import { funnelManifest } from './funnel.manifest';
|
|
12
|
+
|
|
13
|
+
describe('funnel manifest breakpoints', () => {
|
|
14
|
+
it('ships the four default QA breakpoints for new funnels', () => {
|
|
15
|
+
expect(funnelManifest.breakpoints).toEqual({
|
|
16
|
+
small: { width: 375, height: 667 },
|
|
17
|
+
medium: { width: 393, height: 852 },
|
|
18
|
+
large: { width: 402, height: 874 },
|
|
19
|
+
'desktop-small': { width: 1280, height: 800 },
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('funnel step contract metadata', () => {
|
|
25
|
+
it('authors the canonical version 3 reserved identities', () => {
|
|
26
|
+
expect(funnelManifest.stepContractVersion).toBe(3);
|
|
27
|
+
expect(
|
|
28
|
+
funnelManifest.steps.map(({ id, name, type, kind, choice }) => ({
|
|
29
|
+
id,
|
|
30
|
+
name,
|
|
31
|
+
type,
|
|
32
|
+
kind,
|
|
33
|
+
choice,
|
|
34
|
+
})),
|
|
35
|
+
).toEqual([
|
|
36
|
+
{ id: 'step-1', name: 'step-1', type: 'intro_hero', kind: undefined, choice: undefined },
|
|
37
|
+
{
|
|
38
|
+
id: 'step-2',
|
|
39
|
+
name: 'step-2',
|
|
40
|
+
type: 'multi_select_choice',
|
|
41
|
+
kind: undefined,
|
|
42
|
+
choice: { answerKey: 'selectedDevices', allowEmpty: true },
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'step-3',
|
|
46
|
+
name: 'step-3',
|
|
47
|
+
type: 'progress_interstitial',
|
|
48
|
+
kind: undefined,
|
|
49
|
+
choice: undefined,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'step-4',
|
|
53
|
+
name: 'scratchpad-entry',
|
|
54
|
+
type: 'progress_interstitial',
|
|
55
|
+
kind: undefined,
|
|
56
|
+
choice: undefined,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'email-capture',
|
|
60
|
+
name: 'email-capture',
|
|
61
|
+
type: 'form_input',
|
|
62
|
+
kind: undefined,
|
|
63
|
+
choice: undefined,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'paywall',
|
|
67
|
+
name: 'paywall',
|
|
68
|
+
type: 'paywall_offer',
|
|
69
|
+
kind: 'paywall',
|
|
70
|
+
choice: undefined,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'paywall-b',
|
|
74
|
+
name: 'paywall-b',
|
|
75
|
+
type: 'paywall_offer',
|
|
76
|
+
kind: 'paywall',
|
|
77
|
+
choice: undefined,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'manage-subscription',
|
|
81
|
+
name: 'manage-subscription',
|
|
82
|
+
type: 'subscription_management',
|
|
83
|
+
kind: 'manage-subscription',
|
|
84
|
+
choice: undefined,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'subscription-started',
|
|
88
|
+
name: 'subscription-started',
|
|
89
|
+
type: 'purchase_completed',
|
|
90
|
+
kind: 'subscription-handoff',
|
|
91
|
+
choice: undefined,
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('classifies only plan-offer screens as paywalls', () => {
|
|
97
|
+
expect(
|
|
98
|
+
funnelManifest.steps
|
|
99
|
+
.filter((step) => step.type === 'paywall_offer')
|
|
100
|
+
.map((step) => step.id),
|
|
101
|
+
).toEqual(['paywall', 'paywall-b']);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('keeps component metadata and registered keys aligned with the manifest', () => {
|
|
105
|
+
expect(Object.keys(stepRegistry)).toEqual(funnelManifest.steps.map((step) => step.componentKey));
|
|
106
|
+
|
|
107
|
+
for (const step of funnelManifest.steps) {
|
|
108
|
+
const componentMeta = stepRegistry[step.componentKey].meta;
|
|
109
|
+
expect({
|
|
110
|
+
id: componentMeta.id,
|
|
111
|
+
name: componentMeta.name,
|
|
112
|
+
type: componentMeta.type,
|
|
113
|
+
kind: componentMeta.kind,
|
|
114
|
+
choice: componentMeta.choice,
|
|
115
|
+
}).toEqual({
|
|
116
|
+
id: step.id,
|
|
117
|
+
name: step.name,
|
|
118
|
+
type: step.type,
|
|
119
|
+
kind: step.kind,
|
|
120
|
+
choice: step.choice,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('keeps Step Two option IDs immutable', () => {
|
|
126
|
+
expect(contentOptionsByStepId['step-2']).toBe(stepTwoOptions);
|
|
127
|
+
expect(Object.isFrozen(stepTwoOptions)).toBe(true);
|
|
128
|
+
expect(stepTwoOptions.every((option) => Object.isFrozen(option))).toBe(true);
|
|
129
|
+
expect(stepTwoOptions).toEqual([
|
|
130
|
+
{ id: 'iphone', label: 'Smartphone', imageSrc: '/claimbee/device-iphone.png' },
|
|
131
|
+
{ id: 'laptop', label: 'Laptop', imageSrc: '/claimbee/device-macbook.png' },
|
|
132
|
+
{ id: 'watch', label: 'Smart watch', imageSrc: '/claimbee/device-watch.png' },
|
|
133
|
+
{ id: 'none', label: 'None of these', imageSrc: '/claimbee/device-none.png' },
|
|
134
|
+
]);
|
|
135
|
+
expect(stepTwoContent.locales.en.options.map((option) => option.id)).toEqual([
|
|
136
|
+
'iphone',
|
|
137
|
+
'laptop',
|
|
138
|
+
'watch',
|
|
139
|
+
'none',
|
|
140
|
+
]);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('passes the complete authoring snapshot contract without diagnostics', () => {
|
|
144
|
+
const snapshot = {
|
|
145
|
+
manifest: funnelManifest,
|
|
146
|
+
componentMetaByKey: Object.fromEntries(
|
|
147
|
+
Object.entries(stepRegistry).map(([componentKey, entry]) => [componentKey, entry.meta]),
|
|
148
|
+
),
|
|
149
|
+
registeredComponentKeys: Object.keys(stepRegistry),
|
|
150
|
+
contentOptionsByStepId,
|
|
151
|
+
edgesByStepId: funnelManifest.edgesByStepId,
|
|
152
|
+
experiments: funnelManifest.experiments,
|
|
153
|
+
docs: {
|
|
154
|
+
schemaVersion: 1,
|
|
155
|
+
bundleVersion: '2.0.0',
|
|
156
|
+
stepContractVersion: CURRENT_STEP_CONTRACT_VERSION,
|
|
157
|
+
contractHash: CURRENT_STEP_CONTRACT_HASH,
|
|
158
|
+
missing: [],
|
|
159
|
+
changed: [],
|
|
160
|
+
conflicts: [],
|
|
161
|
+
},
|
|
162
|
+
} satisfies FunnelStepContractProjectSnapshot;
|
|
163
|
+
|
|
164
|
+
expect(validateFunnelStepContractSnapshot(snapshot, { mode: 'authoring' })).toEqual([]);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { FunnelManifest } from '@funnelsgrove/runtime';
|
|
2
|
+
import {
|
|
3
|
+
CURRENT_STEP_CONTRACT_VERSION,
|
|
4
|
+
DEFAULT_FUNNEL_BREAKPOINTS,
|
|
5
|
+
} from '@funnelsgrove/runtime';
|
|
6
|
+
import { manifestExperiments } from './experiments';
|
|
7
|
+
|
|
8
|
+
export const templateArchitectureVersion = 1;
|
|
9
|
+
|
|
10
|
+
export const rawFunnelManifest = {
|
|
11
|
+
templateArchitectureVersion,
|
|
12
|
+
stepContractVersion: CURRENT_STEP_CONTRACT_VERSION,
|
|
13
|
+
meta: {
|
|
14
|
+
title: 'Funnel Project',
|
|
15
|
+
description: 'Domain-agnostic funnel runtime with graph routing and paywall handoff.',
|
|
16
|
+
},
|
|
17
|
+
viewport: {
|
|
18
|
+
width: 430,
|
|
19
|
+
height: 932,
|
|
20
|
+
},
|
|
21
|
+
breakpoints: DEFAULT_FUNNEL_BREAKPOINTS,
|
|
22
|
+
assets: {},
|
|
23
|
+
steps: [
|
|
24
|
+
{
|
|
25
|
+
id: 'step-1',
|
|
26
|
+
path: '/step-1',
|
|
27
|
+
filePath: 'src/steps/step-01.tsx',
|
|
28
|
+
componentKey: 'stepOne',
|
|
29
|
+
name: 'step-1',
|
|
30
|
+
type: 'intro_hero',
|
|
31
|
+
title: 'Step 1',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'step-2',
|
|
35
|
+
path: '/step-2',
|
|
36
|
+
filePath: 'src/steps/step-02.tsx',
|
|
37
|
+
componentKey: 'stepTwo',
|
|
38
|
+
name: 'step-2',
|
|
39
|
+
type: 'multi_select_choice',
|
|
40
|
+
choice: {
|
|
41
|
+
answerKey: 'selectedDevices',
|
|
42
|
+
allowEmpty: true,
|
|
43
|
+
},
|
|
44
|
+
title: 'Step 2',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'step-3',
|
|
48
|
+
path: '/step-3',
|
|
49
|
+
filePath: 'src/steps/step-03.tsx',
|
|
50
|
+
componentKey: 'stepThree',
|
|
51
|
+
name: 'step-3',
|
|
52
|
+
type: 'progress_interstitial',
|
|
53
|
+
title: 'Step 3',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'step-4',
|
|
57
|
+
path: '/step-4',
|
|
58
|
+
filePath: 'src/steps/step-04.tsx',
|
|
59
|
+
componentKey: 'stepFour',
|
|
60
|
+
name: 'scratchpad-entry',
|
|
61
|
+
type: 'progress_interstitial',
|
|
62
|
+
title: 'Scratchcard Entry',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'email-capture',
|
|
66
|
+
path: '/email-capture',
|
|
67
|
+
filePath: 'src/steps/step-31-email-capture.tsx',
|
|
68
|
+
componentKey: 'stepEmailCapture',
|
|
69
|
+
name: 'email-capture',
|
|
70
|
+
type: 'form_input',
|
|
71
|
+
title: 'Email Capture',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'paywall',
|
|
75
|
+
path: '/paywall',
|
|
76
|
+
filePath: 'src/steps/step-32-paywall.tsx',
|
|
77
|
+
componentKey: 'stepPaywall',
|
|
78
|
+
name: 'paywall',
|
|
79
|
+
type: 'paywall_offer',
|
|
80
|
+
kind: 'paywall',
|
|
81
|
+
title: 'Paywall',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'paywall-b',
|
|
85
|
+
path: '/paywall-b',
|
|
86
|
+
filePath: 'src/steps/step-32b-paywall-b.tsx',
|
|
87
|
+
componentKey: 'stepPaywallB',
|
|
88
|
+
name: 'paywall-b',
|
|
89
|
+
type: 'paywall_offer',
|
|
90
|
+
kind: 'paywall',
|
|
91
|
+
title: 'Paywall B',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'manage-subscription',
|
|
95
|
+
path: '/manage-subscription',
|
|
96
|
+
filePath: 'src/steps/step-35-manage-subscription.tsx',
|
|
97
|
+
componentKey: 'stepManageSubscription',
|
|
98
|
+
name: 'manage-subscription',
|
|
99
|
+
type: 'subscription_management',
|
|
100
|
+
kind: 'manage-subscription',
|
|
101
|
+
title: 'Manage Subscription',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'subscription-started',
|
|
105
|
+
path: '/subscription-started',
|
|
106
|
+
filePath: 'src/steps/step-33-subscription-started.tsx',
|
|
107
|
+
componentKey: 'stepSubscriptionStarted',
|
|
108
|
+
name: 'subscription-started',
|
|
109
|
+
type: 'purchase_completed',
|
|
110
|
+
kind: 'subscription-handoff',
|
|
111
|
+
title: 'Subscription Started',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
edgesByStepId: {
|
|
115
|
+
'step-1': [{ toStepId: 'step-2' }],
|
|
116
|
+
'step-2': [{ toStepId: 'step-3' }],
|
|
117
|
+
'step-3': [{ toStepId: 'step-4' }],
|
|
118
|
+
'step-4': [{ toStepId: 'email-capture' }],
|
|
119
|
+
'email-capture': [{ toStepId: 'paywall' }],
|
|
120
|
+
paywall: [{ toStepId: 'subscription-started' }],
|
|
121
|
+
'paywall-b': [{ toStepId: 'subscription-started' }],
|
|
122
|
+
'manage-subscription': [{ toStepId: 'step-1' }],
|
|
123
|
+
},
|
|
124
|
+
experiments: manifestExperiments,
|
|
125
|
+
} as const satisfies FunnelManifest;
|
|
126
|
+
|
|
127
|
+
// Keep the authored object readable by the project validator. Eager validation
|
|
128
|
+
// would throw while this module imports and turn an actionable contract error
|
|
129
|
+
// into an opaque runner failure.
|
|
130
|
+
type TemplateFunnelManifest = Omit<typeof rawFunnelManifest, 'steps'> & {
|
|
131
|
+
readonly steps: readonly (
|
|
132
|
+
(typeof rawFunnelManifest.steps)[number] & FunnelManifest['steps'][number]
|
|
133
|
+
)[];
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const funnelManifest = rawFunnelManifest as TemplateFunnelManifest;
|
|
137
|
+
|
|
138
|
+
export type FunnelStepId = (typeof funnelManifest.steps)[number]['id'];
|
|
139
|
+
export type FunnelStepComponentKey = (typeof funnelManifest.steps)[number]['componentKey'];
|