AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Change paywall default to monthly billing with caption (#13363)
Swifty8c6b4de697ae
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.tsindex b620869654..0a303d4daa 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/__tests__/store.test.ts@@ -17,9 +17,9 @@ describe("useOnboardingWizardStore", () => {expect(state.otherPainPoint).toBe("");});- it("defaults to yearly billing", () => {+ it("defaults to monthly billing", () => {expect(useOnboardingWizardStore.getState().selectedBilling).toBe(- "yearly",+ "monthly",);expect(useOnboardingWizardStore.getState().hasUserSelectedBilling).toBe(false,diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsxindex 9d2638e3ba..519031820d 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx@@ -82,6 +82,7 @@ export function SubscriptionStep() {onSelect={handlePlanSelect}loading={isUpdatingTier && selectedPlan === plan.key}disabled={isUpdatingTier && selectedPlan !== plan.key}+ priceCaption="billing-period"className={cn(plan.key === PLAN_KEYS.MAX && "order-1 md:order-none",plan.key === PLAN_KEYS.PRO && "order-2 md:order-none",diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/helpers.tsindex bf40ada685..4b394e912c 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/helpers.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/helpers.ts@@ -19,13 +19,16 @@ export type SubscriptionPricingExperimentVariant =interface SubscriptionPricingExperimentConfig {billing: BillingCycle;- highlightedPlan: HighlightedPlanKey;+ highlightedPlan: HighlightedPlanKey | null;variant: SubscriptionPricingExperimentVariant | "control";}+// Control (the flag isn't wired up yet) matches the paywall: monthly billing+// and no highlighted plan. Each PostHog variant below opts back into a specific+// billing cycle + highlighted plan when the experiment is live.const DEFAULT_EXPERIMENT_CONFIG: SubscriptionPricingExperimentConfig = {- billing: "yearly",- highlightedPlan: PLAN_KEYS.MAX,+ billing: "monthly",+ highlightedPlan: null,variant: "control",};@@ -75,13 +78,14 @@ export function getSubscriptionPricingExperimentConfig(}export function getSubscriptionPricingExperimentPlans(- highlightedPlan: HighlightedPlanKey,+ highlightedPlan: HighlightedPlanKey | null,plans: PlanDef[] = PLANS,) {return plans.map((plan) => {if (!isPaidExperimentPlan(plan)) return plan;- const highlighted = plan.key === highlightedPlan;+ const highlighted =+ highlightedPlan !== null && plan.key === highlightedPlan;return {...plan,highlighted,diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsxindex 391de14aac..047a5043d6 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx@@ -47,14 +47,31 @@ beforeEach(() => {});describe("subscription pricing experiment helpers", () => {- test("uses the current yearly Max experience as the default", () => {+ test("defaults to monthly billing with no highlighted plan (matches the paywall)", () => {expect(getSubscriptionPricingExperimentConfig(undefined)).toMatchObject({- billing: "yearly",- highlightedPlan: "MAX",+ billing: "monthly",+ highlightedPlan: null,variant: "control",});});+ test("highlights no plan when highlightedPlan is null", () => {+ const plans = getSubscriptionPricingExperimentPlans(null);+ const pro = plans.find((plan) => plan.key === "PRO");+ const max = plans.find((plan) => plan.key === "MAX");++ expect(pro).toMatchObject({+ highlighted: false,+ badge: null,+ buttonVariant: "secondary",+ });+ expect(max).toMatchObject({+ highlighted: false,+ badge: null,+ buttonVariant: "secondary",+ });+ });+test("maps PostHog variants to billing and highlighted plan config", () => {expect(getSubscriptionPricingExperimentConfig("monthly-pro")).toMatchObject({@@ -96,14 +113,18 @@ describe("SubscriptionStep", () => {expect(screen.getByRole("heading", { name: /^Team$/ })).toBeDefined();});- test("defaults to yearly billing with the monthly-equivalent price and the annual charge", () => {+ test("defaults to monthly billing with the full monthly price and a 'billed monthly' caption", () => {render(<SubscriptionStep />);- expect(useOnboardingWizardStore.getState().selectedBilling).toBe("yearly");- expect(screen.getByLabelText("$42.50")).toBeDefined();- expect(screen.getByLabelText("$272.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $510.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $3,264.00")).toBeDefined();- expect(screen.getAllByText(/Save 15%/).length).toBeGreaterThan(0);+ expect(useOnboardingWizardStore.getState().selectedBilling).toBe("monthly");+ expect(screen.getByLabelText("$50.00")).toBeDefined();+ expect(screen.getByLabelText("$320.00")).toBeDefined();+ expect(screen.getAllByText("billed monthly").length).toBe(2);+ expect(screen.queryByText(/Charged today/i)).toBeNull();+ });++ test("highlights no plan by default — no 'Best value' badge", () => {+ render(<SubscriptionStep />);+ expect(screen.queryByText(/Best value/i)).toBeNull();});test("PostHog monthly Pro variant starts on monthly billing", async () => {@@ -117,7 +138,7 @@ describe("SubscriptionStep", () => {);});expect(screen.getByLabelText("$50.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $50.00")).toBeDefined();+ expect(screen.getAllByText("billed monthly").length).toBe(2);});test("PostHog billing default does not override a user-selected cycle", async () => {@@ -134,14 +155,14 @@ describe("SubscriptionStep", () => {expect(screen.getByLabelText("$42.50")).toBeDefined();});- test("switching to monthly shows the full monthly price and matching charged-today", () => {+ test("switching to monthly shows the full monthly price and a 'billed monthly' caption", () => {render(<SubscriptionStep />);fireEvent.click(screen.getByRole("button", { name: /Monthly billing/i }));expect(useOnboardingWizardStore.getState().selectedBilling).toBe("monthly");expect(screen.getByLabelText("$50.00")).toBeDefined();expect(screen.getByLabelText("$320.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $50.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $320.00")).toBeDefined();+ expect(screen.getAllByText("billed monthly").length).toBe(2);+ expect(screen.queryByText(/Charged today/i)).toBeNull();});test("selecting Pro persists selectedPlan and redirects to Stripe Checkout (Welcome on success, paywall on cancel)", async () => {@@ -187,7 +208,7 @@ describe("SubscriptionStep", () => {expect(profileCalled).toBe(false);});- test("default yearly + selecting Pro forwards billing_cycle=yearly", async () => {+ test("switching to yearly + selecting Pro forwards billing_cycle=yearly", async () => {let capturedTierBody: {tier?: string;billing_cycle?: string;@@ -204,6 +225,7 @@ describe("SubscriptionStep", () => {);render(<SubscriptionStep />);+ fireEvent.click(screen.getByRole("button", { name: /Yearly billing/i }));fireEvent.click(screen.getByRole("button", { name: /Get Pro/i }));await waitFor(() => {diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.tsindex a836099900..98044ad850 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts@@ -59,7 +59,7 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(painPoints: [],otherPainPoint: "",selectedPlan: null,- selectedBilling: "yearly",+ selectedBilling: "monthly",hasUserSelectedBilling: false,selectedCountryCode: "US",setName(name) {@@ -122,7 +122,7 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>()(painPoints: [],otherPainPoint: "",selectedPlan: null,- selectedBilling: "yearly",+ selectedBilling: "monthly",hasUserSelectedBilling: false,selectedCountryCode: "US",});diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsxindex 3717fb95d9..a5d9ae3fa1 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/PaywallModal.tsx@@ -142,6 +142,7 @@ export function PaywallModal() {onSelect={() => handleSelectPlan(plan.key)}loading={isPending && selectedTier === plan.key}disabled={isPending && selectedTier !== plan.key}+ priceCaption="billing-period"/>))}</div>diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsxindex 4bbf417695..18825d5613 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx@@ -184,7 +184,7 @@ describe("PaywallModal — logout", () => {});describe("PaywallModal — Monthly/Yearly cycle toggle", () => {- it("defaults to yearly billing with the monthly-equivalent price and the annual total", () => {+ it("defaults to monthly billing with the full monthly prices and a 'billed monthly' caption", () => {setupMocks({subscription: {tier: "NO_TIER",@@ -195,15 +195,14 @@ describe("PaywallModal — Monthly/Yearly cycle toggle", () => {render(<PaywallModal />);- // PRO yearly = 51000 cents → $42.50/mo primary, $510.00 charged today.- // MAX yearly = 326400 cents → $272.00/mo primary, $3,264.00 charged today.- expect(screen.getByLabelText("$42.50")).toBeDefined();- expect(screen.getByLabelText("$272.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $510.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $3,264.00")).toBeDefined();+ // PRO monthly = 5000 cents = $50.00, MAX monthly = 32000 cents = $320.00.+ expect(screen.getByLabelText("$50.00")).toBeDefined();+ expect(screen.getByLabelText("$320.00")).toBeDefined();+ expect(screen.getAllByText("billed monthly").length).toBe(2);+ expect(screen.queryByText(/Charged today/i)).toBeNull();});- it("toggling Monthly switches displayed prices to the full monthly amounts", async () => {+ it("toggling Yearly switches to the discounted monthly-equivalent prices and a 'billed annually' caption", async () => {setupMocks({subscription: {tier: "NO_TIER",@@ -214,14 +213,13 @@ describe("PaywallModal — Monthly/Yearly cycle toggle", () => {render(<PaywallModal />);- fireEvent.click(screen.getByRole("radio", { name: /monthly/i }));+ fireEvent.click(screen.getByRole("radio", { name: /yearly/i }));- // PRO monthly = 5000 cents = $50.00 (primary), $50.00 charged today+ // PRO yearly = 51000 cents → $42.50/mo, MAX yearly = 326400 cents → $272.00/mo.await waitFor(() => {- expect(screen.getByLabelText("$50.00")).toBeDefined();- expect(screen.getByLabelText("$320.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $50.00")).toBeDefined();- expect(screen.getByLabelText("Charged today: $320.00")).toBeDefined();+ expect(screen.getByLabelText("$42.50")).toBeDefined();+ expect(screen.getByLabelText("$272.00")).toBeDefined();+ expect(screen.getAllByText("billed annually").length).toBe(2);});});});@@ -245,7 +243,7 @@ describe("PaywallModal — upgrade mutation", () => {});}- it("clicking Upgrade to Pro after switching to monthly fires {tier:PRO, billing_cycle:monthly}", async () => {+ it("clicking Upgrade to Pro with the default monthly toggle fires {tier:PRO, billing_cycle:monthly}", async () => {stubLocation();const { mutateFn } = setupMocks({subscription: {@@ -257,7 +255,6 @@ describe("PaywallModal — upgrade mutation", () => {render(<PaywallModal />);- fireEvent.click(screen.getByRole("radio", { name: /monthly/i }));fireEvent.click(screen.getByRole("button", { name: /upgrade to pro/i }));await waitFor(() => {@@ -268,7 +265,7 @@ describe("PaywallModal — upgrade mutation", () => {expect(args.data.billing_cycle).toBe("monthly");});- it("clicking Upgrade to Pro with the default yearly toggle fires {tier:PRO, billing_cycle:yearly}", async () => {+ it("clicking Upgrade to Pro after switching to yearly fires {tier:PRO, billing_cycle:yearly}", async () => {stubLocation();const { mutateFn } = setupMocks({subscription: {@@ -280,6 +277,7 @@ describe("PaywallModal — upgrade mutation", () => {render(<PaywallModal />);+ fireEvent.click(screen.getByRole("radio", { name: /yearly/i }));fireEvent.click(screen.getByRole("button", { name: /upgrade to pro/i }));await waitFor(() => {diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.tsindex 5a6456dc30..f1fc6c0796 100644--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/usePaywallModal.ts@@ -75,7 +75,7 @@ export function usePaywallModal() {void validateSession();});const [selectedCycle, setSelectedCycle] = useState<"monthly" | "yearly">(- "yearly",+ "monthly",);const [selectedTier, setSelectedTier] = useState<string | null>(null);// When the user already has an active Stripe subscription (admin overridediff --git a/autogpt_platform/frontend/src/components/molecules/PlanCard/PlanCard.tsx b/autogpt_platform/frontend/src/components/molecules/PlanCard/PlanCard.tsxindex a80e6738dd..c318063d2c 100644--- a/autogpt_platform/frontend/src/components/molecules/PlanCard/PlanCard.tsx+++ b/autogpt_platform/frontend/src/components/molecules/PlanCard/PlanCard.tsx@@ -21,6 +21,9 @@ interface Props {className?: string;loading?: boolean;disabled?: boolean;+ // "charged-today" shows the prorated amount billed now; "billing-period"+ // shows a plain "billed monthly/annually" caption instead (paywall surface).+ priceCaption?: "charged-today" | "billing-period";}export function PlanCard({@@ -31,6 +34,7 @@ export function PlanCard({className,loading = false,disabled = false,+ priceCaption = "charged-today",}: Props) {const { primaryPrice, chargedToday } = computePlanPricing({plan,@@ -178,20 +182,26 @@ export function PlanCard({)}</div>- {chargedToday !== null && (- <div- aria-label={`Charged today: ${moneyFormatter.format(chargedToday)}`}- className="mb-1 flex items-baseline gap-1 text-xs font-medium text-zinc-700"- >- <span>Charged today:</span>- <NumberFlow- value={chargedToday}- format={moneyFormat}- locales="en-US"- willChange- />- </div>- )}+ {priceCaption === "billing-period"+ ? primaryPrice !== null && (+ <div className="mb-1 text-xs font-medium text-zinc-400">+ {isYearly ? "billed annually" : "billed monthly"}+ </div>+ )+ : chargedToday !== null && (+ <div+ aria-label={`Charged today: ${moneyFormatter.format(chargedToday)}`}+ className="mb-1 flex items-baseline gap-1 text-xs font-medium text-zinc-700"+ >+ <span>Charged today:</span>+ <NumberFlow+ value={chargedToday}+ format={moneyFormat}+ locales="en-US"+ willChange+ />+ </div>+ )}<p className="mb-3.5 min-h-[30px] text-sm leading-relaxed text-zinc-800">{plan.description}diff --git a/autogpt_platform/frontend/src/components/molecules/PlanCard/plans.ts b/autogpt_platform/frontend/src/components/molecules/PlanCard/plans.tsindex 751e3c8540..0734ae26fe 100644--- a/autogpt_platform/frontend/src/components/molecules/PlanCard/plans.ts+++ b/autogpt_platform/frontend/src/components/molecules/PlanCard/plans.ts@@ -135,9 +135,9 @@ export const PLAN_METADATA: Record<"Help drive the roadmap for new features",],cta: "Upgrade to Max",- highlighted: true,- badge: "Best value",- buttonVariant: "primary",+ highlighted: false,+ badge: null,+ buttonVariant: "secondary",},BUSINESS: {key: PLAN_KEYS.BUSINESS,