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.
feat(onboarding): add subscription plan selection step (#12935)
John Ababseh28ae7ebac856
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 f28d1fc2cb..2d57f9cdbc 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@@ -106,10 +106,10 @@ describe("useOnboardingWizardStore", () => {expect(useOnboardingWizardStore.getState().currentStep).toBe(2);});- it("clamps at step 4", () => {- useOnboardingWizardStore.getState().goToStep(4);+ it("clamps at step 5", () => {+ useOnboardingWizardStore.getState().goToStep(5);useOnboardingWizardStore.getState().nextStep();- expect(useOnboardingWizardStore.getState().currentStep).toBe(4);+ expect(useOnboardingWizardStore.getState().currentStep).toBe(5);});});diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsxindex 163dba8f30..d13f2ca2be 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/page.tsx@@ -6,6 +6,7 @@ import { StepIndicator } from "./components/StepIndicator";import { PainPointsStep } from "./steps/PainPointsStep";import { PreparingStep } from "./steps/PreparingStep";import { RoleStep } from "./steps/RoleStep";+import { SubscriptionStep } from "./steps/SubscriptionStep/SubscriptionStep";import { WelcomeStep } from "./steps/WelcomeStep";import { useOnboardingWizardStore } from "./store";import { useOnboardingPage } from "./useOnboardingPage";@@ -17,11 +18,12 @@ export default function OnboardingPage() {if (isLoading) return null;+ // ProgressBar + StepIndicator track only the user-interactive steps (1-4).+ // Step 5 (PreparingStep) is a transition view that hides both indicators.const totalSteps = 4;- const showDots = currentStep <= 3;- const showBack = currentStep > 1 && currentStep <= 3;-- const showProgressBar = currentStep <= 3;+ const showDots = currentStep <= totalSteps;+ const showBack = currentStep > 1 && currentStep <= totalSteps;+ const showProgressBar = currentStep <= totalSteps;return (<div className="flex min-h-screen w-full flex-col items-center">@@ -44,14 +46,15 @@ export default function OnboardingPage() {{currentStep === 1 && <WelcomeStep />}{currentStep === 2 && <RoleStep />}{currentStep === 3 && <PainPointsStep />}- {currentStep === 4 && (+ {currentStep === 4 && <SubscriptionStep />}+ {currentStep === 5 && (<PreparingStep onComplete={handlePreparingComplete} />)}</div>{showDots && (<div className="pb-8">- <StepIndicator totalSteps={3} currentStep={currentStep} />+ <StepIndicator totalSteps={totalSteps} currentStep={currentStep} /></div>)}</div>diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsxindex 2f8dd75e75..78fdd9421c 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/PainPointsStep.tsx@@ -147,7 +147,7 @@ export function PainPointsStep() {disabled={!canContinue}className="w-full max-w-xs">- Launch AutoPilot+ Continue</Button></div></FadeIn>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.tsxnew file mode 100644index 0000000000..68c5bd2413--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx@@ -0,0 +1,105 @@+"use client";++import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";+import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";+import { Text } from "@/components/atoms/Text/Text";+import { cn } from "@/lib/utils";+import { CountrySelector } from "./components/CountrySelector/CountrySelector";+import { PlanCard } from "./components/PlanCard/PlanCard";+import { PLAN_KEYS, PLANS } from "./helpers";+import { useSubscriptionStep } from "./useSubscriptionStep";++export function SubscriptionStep() {+ const {+ billing,+ setBilling,+ countryIdx,+ setCountryIdx,+ country,+ isYearly,+ handlePlanSelect,+ } = useSubscriptionStep();++ return (+ <FadeIn>+ <div className="-mt-[2.2rem] flex w-full flex-col items-center gap-4 px-4">+ <AutoGPTLogo className="relative right-[2rem] h-14 w-[9rem]" hideText />++ <div className="flex flex-col items-center gap-1 text-center">+ <Text+ variant="h3"+ className="!text-[1.375rem] !leading-[1.6rem] md:!text-[1.75rem] md:!leading-[2.5rem]"+ >+ Choose the plan that's right for{" "}+ <span className="bg-gradient-to-r from-purple-500 to-indigo-500 bg-clip-text text-transparent">+ you+ </span>+ </Text>+ <Text variant="body" className="!text-zinc-500">+ Upgrade, downgrade, or change plans anytime. All plans include core+ features to get you started.+ </Text>+ </div>++ <div className="relative flex w-full max-w-[960px] flex-col items-center md:flex-row md:justify-center">+ <div className="inline-flex rounded-full border border-[#d8d8d8] bg-zinc-100 p-[3px]">+ {(["monthly", "yearly"] as const).map((cycle) => (+ <button+ key={cycle}+ type="button"+ onClick={() => setBilling(cycle)}+ className={cn(+ "rounded-full border-none px-4 py-1.5 text-xs font-medium transition-all",+ billing === cycle+ ? "bg-white text-zinc-900 shadow-sm"+ : "bg-transparent text-zinc-500 hover:text-zinc-700",+ )}+ >+ {cycle === "monthly" ? (+ "Monthly billing"+ ) : (+ <>+ Yearly billing{" "}+ <span className="ml-1.5 bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 bg-clip-text text-[11px] font-semibold text-transparent">+ Save 15%+ </span>+ </>+ )}+ </button>+ ))}+ </div>+ <div className="mb-0 mt-4 md:absolute md:right-0 md:my-0">+ <CountrySelector selected={countryIdx} onSelect={setCountryIdx} />+ </div>+ </div>++ <div className="mt-2 grid w-full max-w-[960px] grid-cols-1 gap-4 px-[1rem] md:grid-cols-3 md:px-0">+ {PLANS.map((plan) => (+ <PlanCard+ key={plan.key}+ plan={plan}+ country={country}+ isYearly={isYearly}+ onSelect={handlePlanSelect}+ className={cn(+ plan.key === PLAN_KEYS.MAX && "order-1 md:order-none",+ plan.key === PLAN_KEYS.PRO && "order-2 md:order-none",+ plan.key === PLAN_KEYS.TEAM && "order-3 md:order-none",+ )}+ />+ ))}+ </div>++ <Text variant="body" className="!text-zinc-500">+ Need something custom?{" "}+ <a+ href="mailto:[email protected]"+ className="font-medium text-purple-500 no-underline hover:text-purple-600"+ >+ Talk to sales.+ </a>+ </Text>+ </div>+ </FadeIn>+ );+}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsxnew file mode 100644index 0000000000..fc298f2a92--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsx@@ -0,0 +1,125 @@+"use client";++import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/molecules/Popover/Popover";+import { useMountEffect } from "@/hooks/useMountEffect";+import { cn } from "@/lib/utils";+import { MagnifyingGlass } from "@phosphor-icons/react";+import { useRef, useState } from "react";+import { COUNTRIES } from "../../countries";++interface Props {+ selected: number;+ onSelect: (idx: number) => void;+}++export function CountrySelector({ selected, onSelect }: Props) {+ const [open, setOpen] = useState(false);+ const country = COUNTRIES[selected];++ function handleOpenChange(next: boolean) {+ setOpen(next);+ }++ return (+ <Popover open={open} onOpenChange={handleOpenChange}>+ <PopoverTrigger asChild>+ <button+ type="button"+ className="flex min-w-[150px] items-center gap-1.5 px-2.5 py-1.5 text-sm text-zinc-600 transition-colors hover:text-zinc-900"+ >+ <span className="text-base">{country.flag}</span>+ <span>{country.name}</span>+ <span>({country.symbol.trim()})</span>+ <span className="ml-auto text-[10px] text-zinc-400">▾</span>+ </button>+ </PopoverTrigger>+ <PopoverContent+ side="top"+ align="end"+ sideOffset={8}+ collisionPadding={16}+ className="flex max-h-[340px] w-[260px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border-0 bg-zinc-900 p-0 text-white shadow-xl"+ >+ <CountryList+ selected={selected}+ onSelect={(idx) => {+ onSelect(idx);+ handleOpenChange(false);+ }}+ />+ </PopoverContent>+ </Popover>+ );+}++interface ListProps {+ selected: number;+ onSelect: (idx: number) => void;+}++function CountryList({ selected, onSelect }: ListProps) {+ const [search, setSearch] = useState("");+ const inputRef = useRef<HTMLInputElement>(null);++ useMountEffect(() => {+ inputRef.current?.focus();+ });++ const query = search.toLowerCase();+ const filtered = COUNTRIES.map((c, idx) => ({ c, idx })).filter(+ ({ c }) =>+ c.name.toLowerCase().includes(query) ||+ c.countryCode.toLowerCase().includes(query) ||+ c.currencyCode.toLowerCase().includes(query),+ );++ return (+ <>+ <div className="px-3 pb-1.5 pt-2.5">+ <div className="flex items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-2.5 py-1.5">+ <MagnifyingGlass+ size={12}+ className="shrink-0 text-white/40"+ weight="bold"+ />+ <input+ ref={inputRef}+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search country…"+ aria-label="Search country"+ className="w-full bg-transparent text-xs text-white outline-none placeholder:text-white/35"+ />+ </div>+ </div>++ <div className="max-h-[270px] overflow-y-auto px-0 py-1">+ {filtered.length === 0 && (+ <div className="px-3.5 py-3 text-xs text-white/40">+ No matching countries+ </div>+ )}+ {filtered.map(({ c, idx }) => (+ <button+ key={c.countryCode}+ type="button"+ onClick={() => onSelect(idx)}+ className={cn(+ "flex w-full items-center justify-between px-3.5 py-2 text-xs text-white transition-colors",+ idx === selected ? "bg-purple-500/15" : "hover:bg-white/[0.08]",+ )}+ >+ <span>+ {c.flag} {c.name}+ </span>+ <span className="text-[10px] text-white/35">{c.currencyCode}</span>+ </button>+ ))}+ </div>+ </>+ );+}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/PlanCard.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/PlanCard.tsxnew file mode 100644index 0000000000..f688ed42ba--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/PlanCard.tsx@@ -0,0 +1,177 @@+"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Text } from "@/components/atoms/Text/Text";+import { cn } from "@/lib/utils";+import { Check, Info, Star } from "@phosphor-icons/react";+import { type Country, formatPrice } from "../../countries";+import { type PlanDef, type PlanKey } from "../../helpers";+import { computePlanPricing } from "./helpers";++interface Props {+ plan: PlanDef;+ country: Country;+ isYearly: boolean;+ onSelect: (key: PlanKey) => void;+ className?: string;+}++export function PlanCard({+ plan,+ country,+ isYearly,+ onSelect,+ className,+}: Props) {+ const { displayPrice, monthlyEquiv, perLabel } = computePlanPricing({+ plan,+ country,+ isYearly,+ });+ const hl = plan.highlighted;++ return (+ <div+ className={cn(+ "relative rounded-2xl p-px",+ hl+ ? "bg-gradient-to-br from-purple-500 via-fuchsia-500 to-indigo-500 shadow-[0_10px_32px_-8px_rgba(119,51,245,0.25)]"+ : "bg-gradient-to-br from-zinc-300 via-zinc-400 to-zinc-500 md:my-5",+ className,+ )}+ >+ {plan.badge && hl && (+ <span className="absolute -top-3 right-5 z-10 inline-flex overflow-hidden rounded-full p-px shadow-[0_10px_28px_-6px_rgba(124,58,237,0.55)]">+ <span+ aria-hidden+ className="absolute -inset-[150%] animate-[spin_4s_linear_infinite] bg-[conic-gradient(from_0deg,#a855f7,#7c3aed,#4f46e5,#1e40af,#4f46e5,#7c3aed,#a855f7)]"+ />+ <span className="relative inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-indigo-600 via-blue-600 to-blue-500 px-2.5 py-1 text-[10px] font-semibold text-white">+ <Star+ size={10}+ weight="fill"+ aria-hidden="true"+ className="text-yellow-300"+ />+ {plan.badge}+ </span>+ </span>+ )}++ <div+ className={cn(+ "relative flex h-full flex-col overflow-hidden rounded-[15px] bg-white",+ hl ? "p-6" : "p-5",+ )}+ >+ <div+ aria-hidden+ className={cn(+ "pointer-events-none absolute inset-0",+ hl+ ? "bg-[radial-gradient(120%_60%_at_0%_0%,rgba(168,85,247,0.10),transparent_60%),radial-gradient(120%_60%_at_100%_100%,rgba(99,102,241,0.08),transparent_60%)]"+ : "bg-[radial-gradient(140%_70%_at_0%_0%,rgba(244,244,245,0.7),transparent_60%)]",+ )}+ />++ <div className="relative flex h-full flex-col">+ <div className="mb-2 flex items-center gap-2">+ <Text+ variant="h5"+ as="h2"+ className="font-poppins !text-[17px] !font-semibold !text-zinc-800"+ >+ {plan.name}+ </Text>+ {plan.usage && (+ <span className="inline-flex items-center gap-1 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] font-medium text-purple-700">+ {plan.usage} usage+ </span>+ )}+ {plan.badge && !hl && (+ <span className="inline-flex items-center gap-1 rounded-full bg-zinc-100 px-2 py-0.5 text-[10px] font-medium text-zinc-500">+ {plan.badge}+ </span>+ )}+ </div>++ <div className="mb-1 flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5">+ {displayPrice !== null ? (+ <>+ <span+ className={cn(+ "font-poppins font-medium leading-none text-zinc-800",+ hl ? "text-[32px]" : "text-[26px]",+ )}+ >+ {formatPrice(+ displayPrice,+ country.currencyCode,+ country.symbol,+ )}+ </span>+ <span className="text-xs text-zinc-400">{perLabel}</span>+ {monthlyEquiv !== null && (+ <span className="text-xs text-zinc-800">+ (+ {formatPrice(+ monthlyEquiv,+ country.currencyCode,+ country.symbol,+ )}+ /month)+ </span>+ )}+ </>+ ) : (+ <span+ className={cn(+ "font-poppins font-medium leading-none text-zinc-800",+ hl ? "text-[32px]" : "text-[26px]",+ )}+ >+ Contact us+ </span>+ )}+ </div>++ <p className="mb-3.5 min-h-[30px] text-sm leading-relaxed text-zinc-800">+ {plan.description}+ </p>++ <div className="mb-3 h-px bg-zinc-100" />++ <div className="mb-4 flex flex-1 flex-col gap-2">+ {plan.features.map((f) => (+ <div key={f} className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <span+ aria-hidden="true"+ className="flex h-4 w-4 items-center justify-center rounded-full bg-purple-50"+ >+ <Check+ size={10}+ weight="bold"+ className="text-purple-500"+ />+ </span>+ <span className="text-[13px] text-zinc-800">{f}</span>+ </div>+ <Info size={13} className="text-zinc-300" aria-hidden="true" />+ </div>+ ))}+ </div>++ <Button+ variant={plan.buttonVariant}+ size={hl ? "large" : "small"}+ onClick={() => onSelect(plan.key)}+ className="w-full"+ >+ {plan.cta}+ </Button>+ </div>+ </div>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.test.tsnew file mode 100644index 0000000000..ccec48a8f5--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.test.ts@@ -0,0 +1,98 @@+import { describe, expect, test } from "vitest";+import { type Country } from "../../countries";+import { type PlanDef, PLAN_KEYS, YEARLY_PRICE_FACTOR } from "../../helpers";+import { computePlanPricing } from "./helpers";++const usdCountry: Country = {+ name: "United States",+ flag: "🇺🇸",+ countryCode: "US",+ currencyCode: "USD",+ symbol: "$",+ rate: 1,+};++const brlCountry: Country = {+ name: "Brazil",+ flag: "🇧🇷",+ countryCode: "BR",+ currencyCode: "BRL",+ symbol: "R$",+ rate: 5,+};++function makePlan(overrides: Partial<PlanDef> = {}): PlanDef {+ return {+ key: PLAN_KEYS.PRO,+ name: "Pro",+ usage: "1x",+ usdMonthly: 50,+ description: "",+ features: [],+ cta: "Get Pro",+ highlighted: false,+ badge: null,+ buttonVariant: "secondary",+ ...overrides,+ };+}++describe("computePlanPricing", () => {+ test("monthly USD passes through the country rate", () => {+ const { displayPrice, monthlyEquiv, perLabel } = computePlanPricing({+ plan: makePlan(),+ country: usdCountry,+ isYearly: false,+ });+ expect(displayPrice).toBe(50);+ expect(monthlyEquiv).toBeNull();+ expect(perLabel).toBe("/ month");+ });++ test("yearly applies the price factor and multiplies by 12", () => {+ const { displayPrice, monthlyEquiv, perLabel } = computePlanPricing({+ plan: makePlan(),+ country: usdCountry,+ isYearly: true,+ });+ expect(displayPrice).toBe(50 * YEARLY_PRICE_FACTOR * 12);+ expect(monthlyEquiv).toBe(50 * YEARLY_PRICE_FACTOR);+ expect(perLabel).toBe("/ year");+ });++ test("non-USD currency multiplies by the country rate", () => {+ const { displayPrice } = computePlanPricing({+ plan: makePlan({ usdMonthly: 50 }),+ country: brlCountry,+ isYearly: false,+ });+ expect(displayPrice).toBe(250);+ });++ test("usdMonthly === null returns null prices for both branches", () => {+ const monthly = computePlanPricing({+ plan: makePlan({ usdMonthly: null }),+ country: usdCountry,+ isYearly: false,+ });+ const yearly = computePlanPricing({+ plan: makePlan({ usdMonthly: null }),+ country: usdCountry,+ isYearly: true,+ });+ expect(monthly.displayPrice).toBeNull();+ expect(monthly.monthlyEquiv).toBeNull();+ expect(yearly.displayPrice).toBeNull();+ expect(yearly.monthlyEquiv).toBeNull();+ });++ test("usdMonthly === 0 renders 0, not 'Contact us'", () => {+ const { displayPrice, monthlyEquiv } = computePlanPricing({+ plan: makePlan({ usdMonthly: 0 }),+ country: usdCountry,+ isYearly: true,+ });+ expect(displayPrice).toBe(0);+ expect(monthlyEquiv).toBe(0);+ });+});diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.tsnew file mode 100644index 0000000000..0b978ea6c4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/PlanCard/helpers.ts@@ -0,0 +1,30 @@+import { type Country } from "../../countries";+import { type PlanDef, YEARLY_PRICE_FACTOR } from "../../helpers";++interface PriceComputationArgs {+ plan: PlanDef;+ country: Country;+ isYearly: boolean;+}++export function computePlanPricing({+ plan,+ country,+ isYearly,+}: PriceComputationArgs) {+ const monthlyLocal =+ plan.usdMonthly !== null ? plan.usdMonthly * country.rate : null;+ const displayPrice =+ monthlyLocal !== null+ ? isYearly+ ? monthlyLocal * YEARLY_PRICE_FACTOR * 12+ : monthlyLocal+ : null;+ const monthlyEquiv =+ isYearly && monthlyLocal !== null+ ? monthlyLocal * YEARLY_PRICE_FACTOR+ : null;+ const perLabel = isYearly ? "/ year" : "/ month";++ return { displayPrice, monthlyEquiv, perLabel };+}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.test.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.test.tsnew file mode 100644index 0000000000..c29ba03823--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.test.ts@@ -0,0 +1,29 @@+import { describe, expect, test } from "vitest";+import { formatPrice } from "./countries";++describe("formatPrice", () => {+ test("USD shows two decimals for sub-100 amounts", () => {+ expect(formatPrice(50, "USD", "$")).toBe("$50.00");+ expect(formatPrice(9.5, "USD", "$")).toBe("$9.50");+ });++ test("USD preserves cents for amounts >= 100 (no rounding)", () => {+ expect(formatPrice(249.45, "BRL", "R$")).toBe("R$249.45");+ expect(formatPrice(3264.99, "BRL", "R$")).toBe("R$3,264.99");+ expect(formatPrice(1000, "USD", "$")).toBe("$1,000.00");+ });++ test("zero-decimal currencies (JPY, KRW, HUF) show no decimals", () => {+ expect(formatPrice(7976, "JPY", "¥")).toBe("¥7,976");+ expect(formatPrice(1473.4, "KRW", "₩")).toBe("₩1,473");+ });++ test("rounds zero-decimal currencies to integers (Stripe rule)", () => {+ expect(formatPrice(1473.7, "KRW", "₩")).toBe("₩1,474");+ });++ test("zero is rendered as a real price, not skipped", () => {+ expect(formatPrice(0, "USD", "$")).toBe("$0.00");+ expect(formatPrice(0, "JPY", "¥")).toBe("¥0");+ });+});diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.tsnew file mode 100644index 0000000000..8956eb7842--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/countries.ts@@ -0,0 +1,265 @@+/**+ * Stripe-supported billing countries with exchange rates.+ * Rates sourced from x-rates.com (Apr 28, 2026 09:03 UTC).+ */++export interface Country {+ name: string;+ flag: string;+ // ISO 3166-1 alpha-2 (or "EU" for the European Union grouping). This is the+ // identity field — selection and persistence are keyed by countryCode.+ countryCode: string;+ // ISO 4217 currency. Used for pricing math, formatting, and Stripe.+ currencyCode: string;+ symbol: string;+ rate: number;+}++export const COUNTRIES: Country[] = [+ {+ name: "United States",+ flag: "🇺🇸",+ countryCode: "US",+ currencyCode: "USD",+ symbol: "$",+ rate: 1,+ },+ {+ name: "United Kingdom",+ flag: "🇬🇧",+ countryCode: "GB",+ currencyCode: "GBP",+ symbol: "£",+ rate: 0.7406,+ },+ {+ name: "European Union",+ flag: "🇪🇺",+ countryCode: "EU",+ currencyCode: "EUR",+ symbol: "€",+ rate: 0.8547,+ },+ {+ name: "Canada",+ flag: "🇨🇦",+ countryCode: "CA",+ currencyCode: "CAD",+ symbol: "CA$",+ rate: 1.3649,+ },+ {+ name: "Australia",+ flag: "🇦🇺",+ countryCode: "AU",+ currencyCode: "AUD",+ symbol: "A$",+ rate: 1.3938,+ },+ {+ name: "Japan",+ flag: "🇯🇵",+ countryCode: "JP",+ currencyCode: "JPY",+ symbol: "¥",+ rate: 159.52,+ },+ {+ name: "Singapore",+ flag: "🇸🇬",+ countryCode: "SG",+ currencyCode: "SGD",+ symbol: "S$",+ rate: 1.2763,+ },+ {+ name: "Switzerland",+ flag: "🇨🇭",+ countryCode: "CH",+ currencyCode: "CHF",+ symbol: "CHF ",+ rate: 0.7889,+ },+ {+ name: "New Zealand",+ flag: "🇳🇿",+ countryCode: "NZ",+ currencyCode: "NZD",+ symbol: "NZ$",+ rate: 1.698,+ },+ {+ name: "Brazil",+ flag: "🇧🇷",+ countryCode: "BR",+ currencyCode: "BRL",+ symbol: "R$",+ rate: 4.9889,+ },+ {+ name: "Mexico",+ flag: "🇲🇽",+ countryCode: "MX",+ currencyCode: "MXN",+ symbol: "MX$",+ rate: 17.4206,+ },+ {+ name: "India",+ flag: "🇮🇳",+ countryCode: "IN",+ currencyCode: "INR",+ symbol: "₹",+ rate: 94.5316,+ },+ {+ name: "South Korea",+ flag: "🇰🇷",+ countryCode: "KR",+ currencyCode: "KRW",+ symbol: "₩",+ rate: 1473.35,+ },+ {+ name: "Denmark",+ flag: "🇩🇰",+ countryCode: "DK",+ currencyCode: "DKK",+ symbol: "kr ",+ rate: 6.3866,+ },+ {+ name: "Norway",+ flag: "🇳🇴",+ countryCode: "NO",+ currencyCode: "NOK",+ symbol: "kr ",+ rate: 9.2951,+ },+ {+ name: "Sweden",+ flag: "🇸🇪",+ countryCode: "SE",+ currencyCode: "SEK",+ symbol: "kr ",+ rate: 9.255,+ },+ {+ name: "Poland",+ flag: "🇵🇱",+ countryCode: "PL",+ currencyCode: "PLN",+ symbol: "zł",+ rate: 3.6298,+ },+ {+ name: "Czech Republic",+ flag: "🇨🇿",+ countryCode: "CZ",+ currencyCode: "CZK",+ symbol: "Kč",+ rate: 20.829,+ },+ {+ name: "Romania",+ flag: "🇷🇴",+ countryCode: "RO",+ currencyCode: "RON",+ symbol: "lei ",+ rate: 4.353,+ },+ {+ name: "Hungary",+ flag: "🇭🇺",+ countryCode: "HU",+ currencyCode: "HUF",+ symbol: "Ft ",+ rate: 311.94,+ },+ {+ name: "Hong Kong",+ flag: "🇭🇰",+ countryCode: "HK",+ currencyCode: "HKD",+ symbol: "HK$",+ rate: 7.836,+ },+ {+ name: "Thailand",+ flag: "🇹🇭",+ countryCode: "TH",+ currencyCode: "THB",+ symbol: "฿",+ rate: 32.487,+ },+ {+ name: "Malaysia",+ flag: "🇲🇾",+ countryCode: "MY",+ currencyCode: "MYR",+ symbol: "RM ",+ rate: 3.951,+ },+ {+ name: "Israel",+ flag: "🇮🇱",+ countryCode: "IL",+ currencyCode: "ILS",+ symbol: "₪",+ rate: 2.9848,+ },+ {+ name: "South Africa",+ flag: "🇿🇦",+ countryCode: "ZA",+ currencyCode: "ZAR",+ symbol: "R ",+ rate: 16.5825,+ },+ {+ name: "UAE",+ flag: "🇦🇪",+ countryCode: "AE",+ currencyCode: "AED",+ symbol: "AED ",+ rate: 3.6725,+ },+ {+ name: "Turkey",+ flag: "🇹🇷",+ countryCode: "TR",+ currencyCode: "TRY",+ symbol: "₺",+ rate: 45.049,+ },+ {+ name: "Philippines",+ flag: "🇵🇭",+ countryCode: "PH",+ currencyCode: "PHP",+ symbol: "₱",+ rate: 61.286,+ },+];++const ZERO_DECIMAL_CODES = new Set(["JPY", "KRW", "HUF", "CLP"]);++// Zero-decimal currencies show no decimals (Stripe convention).+// All other currencies always show two decimals so cents aren't dropped on+// large amounts (e.g. yearly Max in BRL).+export function formatPrice(+ value: number,+ currencyCode: string,+ symbol: string,+): string {+ if (ZERO_DECIMAL_CODES.has(currencyCode)) {+ return symbol + Math.round(value).toLocaleString("en-US");+ }+ return (+ symbol ++ value.toLocaleString("en-US", {+ minimumFractionDigits: 2,+ maximumFractionDigits: 2,+ })+ );+}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.tsnew file mode 100644index 0000000000..c54deb0b81--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/helpers.ts@@ -0,0 +1,88 @@+export const PRO_USD_MONTHLY = 50;+export const MAX_USD_MONTHLY = 320;+// Fraction of the full monthly price paid when billed yearly. 0.85 = 15% off.+export const YEARLY_PRICE_FACTOR = 0.85;+export const TEAM_INTAKE_FORM_URL = "https://tally.so/r/2Eb9zj";++export const PLAN_KEYS = {+ PRO: "PRO",+ MAX: "MAX",+ TEAM: "TEAM",+} as const;+export type PlanKey = (typeof PLAN_KEYS)[keyof typeof PLAN_KEYS];++export interface PlanDef {+ key: PlanKey;+ name: string;+ usage: string | null;+ usdMonthly: number | null;+ description: string;+ features: string[];+ cta: string;+ highlighted: boolean;+ badge: string | null;+ buttonVariant: "primary" | "secondary";+}++export const PLANS: PlanDef[] = [+ {+ key: PLAN_KEYS.PRO,+ name: "Pro",+ usage: "1x",+ usdMonthly: PRO_USD_MONTHLY,+ description:+ "For individuals getting started with dependable everyday automation.",+ features: [+ "1x usage allowance",+ "Up to 1,000 agent runs / month",+ "Access to core models",+ "Core agent library",+ "Standard support",+ ],+ cta: "Get Pro",+ highlighted: false,+ badge: null,+ buttonVariant: "secondary",+ },+ {+ key: PLAN_KEYS.MAX,+ name: "Max",+ usage: "7x",+ usdMonthly: MAX_USD_MONTHLY,+ description:+ "For power users running more workflows and higher-volume automations.",+ features: [+ "7x usage allowance",+ "Up to 10,000 agent runs / month",+ "Access to premium models",+ "Advanced workflows & tools",+ "Priority processing",+ "Faster support",+ "Custom integrations (beta)",+ ],+ cta: "Upgrade to Max",+ highlighted: true,+ badge: "Best value",+ buttonVariant: "primary",+ },+ {+ key: PLAN_KEYS.TEAM,+ name: "Team",+ usage: null,+ usdMonthly: null,+ description:+ "For teams that need collaboration, controls, and custom usage.",+ features: [+ "Multi-user workspaces",+ "Admin controls & roles",+ "Shared billing & usage pools",+ "Collaboration & approvals",+ "Security & compliance options",+ "Premium support",+ ],+ cta: "Contact sales",+ highlighted: false,+ badge: "Coming soon",+ buttonVariant: "secondary",+ },+];diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.tsnew file mode 100644index 0000000000..22155a4b8c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts@@ -0,0 +1,50 @@+import { useOnboardingWizardStore } from "../../store";+import { COUNTRIES } from "./countries";+import { PLAN_KEYS, type PlanKey, TEAM_INTAKE_FORM_URL } from "./helpers";++export function useSubscriptionStep() {+ const billing = useOnboardingWizardStore((s) => s.selectedBilling);+ const setSelectedBilling = useOnboardingWizardStore(+ (s) => s.setSelectedBilling,+ );+ const selectedCountryCode = useOnboardingWizardStore(+ (s) => s.selectedCountryCode,+ );+ const setSelectedCountryCode = useOnboardingWizardStore(+ (s) => s.setSelectedCountryCode,+ );+ const setSelectedPlan = useOnboardingWizardStore((s) => s.setSelectedPlan);+ const nextStep = useOnboardingWizardStore((s) => s.nextStep);++ const countryIdx = Math.max(+ 0,+ COUNTRIES.findIndex((c) => c.countryCode === selectedCountryCode),+ );+ const country = COUNTRIES[countryIdx];+ const isYearly = billing === "yearly";++ function setCountryIdx(idx: number) {+ const next = COUNTRIES[idx];+ if (!next) return;+ setSelectedCountryCode(next.countryCode);+ }++ function handlePlanSelect(planKey: PlanKey) {+ if (planKey === PLAN_KEYS.TEAM) {+ window.open(TEAM_INTAKE_FORM_URL, "_blank", "noopener,noreferrer");+ return;+ }+ setSelectedPlan(planKey);+ nextStep();+ }++ return {+ billing,+ setBilling: setSelectedBilling,+ countryIdx,+ setCountryIdx,+ country,+ isYearly,+ handlePlanSelect,+ };+}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsxindex f6843f7998..43bd29c4a6 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx@@ -27,7 +27,7 @@ function clickCard(name: RegExp) {}function getLaunchButton() {- return screen.getByRole("button", { name: /launch autopilot/i });+ return screen.getByRole("button", { name: /continue/i });}afterEach(cleanup);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.tsxnew file mode 100644index 0000000000..e528e9468b--- /dev/null+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx@@ -0,0 +1,81 @@+import {+ cleanup,+ fireEvent,+ render,+ screen,+} from "@/tests/integrations/test-utils";+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";+import { useOnboardingWizardStore } from "../../store";+import { SubscriptionStep } from "../SubscriptionStep/SubscriptionStep";++vi.mock("@/components/atoms/FadeIn/FadeIn", () => ({+ FadeIn: ({ children }: { children: React.ReactNode }) => (+ <div>{children}</div>+ ),+}));++vi.mock("@/components/atoms/AutoGPTLogo/AutoGPTLogo", () => ({+ AutoGPTLogo: () => <span>AutoGPTLogo</span>,+}));++afterEach(cleanup);++beforeEach(() => {+ useOnboardingWizardStore.getState().reset();+ useOnboardingWizardStore.getState().goToStep(4);+});++describe("SubscriptionStep", () => {+ test("renders the three plan cards by display name", () => {+ render(<SubscriptionStep />);+ expect(screen.getByRole("heading", { name: /^Pro$/ })).toBeDefined();+ expect(screen.getByRole("heading", { name: /^Max$/ })).toBeDefined();+ expect(screen.getByRole("heading", { name: /^Team$/ })).toBeDefined();+ });++ test("monthly USD prices render with two decimals", () => {+ render(<SubscriptionStep />);+ expect(screen.getByText(/\$50\.00/)).toBeDefined();+ expect(screen.getByText(/\$320\.00/)).toBeDefined();+ });++ test("toggling yearly billing updates the store and shows /year", () => {+ render(<SubscriptionStep />);+ fireEvent.click(screen.getByRole("button", { name: /Yearly billing/i }));+ expect(useOnboardingWizardStore.getState().selectedBilling).toBe("yearly");+ expect(screen.getAllByText(/\/ year/i).length).toBeGreaterThan(0);+ });++ test("selecting Pro persists selectedPlan and advances to step 5", () => {+ render(<SubscriptionStep />);+ fireEvent.click(screen.getByRole("button", { name: /Get Pro/i }));+ const state = useOnboardingWizardStore.getState();+ expect(state.selectedPlan).toBe("PRO");+ expect(state.currentStep).toBe(5);+ });++ test("selecting Team opens the intake form and does not advance", () => {+ const openSpy = vi.spyOn(window, "open").mockImplementation(() => null);+ try {+ render(<SubscriptionStep />);+ fireEvent.click(screen.getByRole("button", { name: /Contact sales/i }));+ expect(openSpy).toHaveBeenCalledWith(+ expect.stringContaining("tally.so"),+ "_blank",+ "noopener,noreferrer",+ );+ const state = useOnboardingWizardStore.getState();+ expect(state.selectedPlan).toBeNull();+ expect(state.currentStep).toBe(4);+ } finally {+ openSpy.mockRestore();+ }+ });++ test("changing country persists the country code", () => {+ render(<SubscriptionStep />);+ fireEvent.click(screen.getByRole("button", { name: /United States/i }));+ fireEvent.click(screen.getByRole("button", { name: /European Union/i }));+ expect(useOnboardingWizardStore.getState().selectedCountryCode).toBe("EU");+ });+});diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.tsindex fe5e52b8c1..4c64f43d4c 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/store.ts@@ -1,7 +1,7 @@import { create } from "zustand";export const MAX_PAIN_POINT_SELECTIONS = 3;-export type Step = 1 | 2 | 3 | 4;+export type Step = 1 | 2 | 3 | 4 | 5;interface OnboardingWizardState {currentStep: Step;@@ -10,11 +10,17 @@ interface OnboardingWizardState {otherRole: string;painPoints: string[];otherPainPoint: string;+ selectedPlan: string | null;+ selectedBilling: "monthly" | "yearly";+ selectedCountryCode: string;setName(name: string): void;setRole(role: string): void;setOtherRole(otherRole: string): void;togglePainPoint(painPoint: string): void;setOtherPainPoint(otherPainPoint: string): void;+ setSelectedPlan(plan: string): void;+ setSelectedBilling(billing: "monthly" | "yearly"): void;+ setSelectedCountryCode(code: string): void;nextStep(): void;prevStep(): void;goToStep(step: Step): void;@@ -29,6 +35,9 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>(otherRole: "",painPoints: [],otherPainPoint: "",+ selectedPlan: null,+ selectedBilling: "monthly",+ selectedCountryCode: "US",setName(name) {set({ name });},@@ -53,9 +62,18 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>(setOtherPainPoint(otherPainPoint) {set({ otherPainPoint });},+ setSelectedPlan(plan) {+ set({ selectedPlan: plan });+ },+ setSelectedBilling(billing) {+ set({ selectedBilling: billing });+ },+ setSelectedCountryCode(code) {+ set({ selectedCountryCode: code });+ },nextStep() {set((state) => ({- currentStep: Math.min(4, state.currentStep + 1) as Step,+ currentStep: Math.min(5, state.currentStep + 1) as Step,}));},prevStep() {@@ -74,6 +92,9 @@ export const useOnboardingWizardStore = create<OnboardingWizardState>(otherRole: "",painPoints: [],otherPainPoint: "",+ selectedPlan: null,+ selectedBilling: "monthly",+ selectedCountryCode: "US",});},}),diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.tsindex 285aed9dcb..41930d6126 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/useOnboardingPage.ts@@ -11,7 +11,7 @@ import { Step, useOnboardingWizardStore } from "./store";function parseStep(value: string | null): Step {const n = Number(value);- if (n >= 1 && n <= 4) return n as Step;+ if (n >= 1 && n <= 5) return n as Step;return 1;}@@ -63,9 +63,9 @@ export function useOnboardingPage() {checkCompletion();}, [isLoggedIn, router]);- // Submit profile when entering step 4+ // Submit profile when entering step 5 (Preparing)useEffect(() => {- if (currentStep !== 4 || hasSubmitted.current) return;+ if (currentStep !== 5 || hasSubmitted.current) return;hasSubmitted.current = true;const { name, role, otherRole, painPoints, otherPainPoint } =diff --git a/autogpt_platform/frontend/src/playwright/utils/onboarding.ts b/autogpt_platform/frontend/src/playwright/utils/onboarding.tsindex b5fa79abda..1d2ff27808 100644--- a/autogpt_platform/frontend/src/playwright/utils/onboarding.ts+++ b/autogpt_platform/frontend/src/playwright/utils/onboarding.ts@@ -45,7 +45,7 @@ export async function skipOnboardingIfPresent(}/**- * Walk through the full 4-step onboarding wizard in the browser.+ * Walk through the full 5-step onboarding wizard in the browser.* Returns the data that was entered so tests can verify it was submitted.*/export async function completeOnboardingWizard(@@ -54,11 +54,13 @@ export async function completeOnboardingWizard(name?: string;role?: string;painPoints?: string[];+ plan?: "pro" | "max";},) {const name = options?.name ?? "TestUser";const role = options?.role ?? "Engineering";const painPoints = options?.painPoints ?? ["Research", "Reports & data"];+ const plan = options?.plan ?? "pro";// Step 1: Welcome — enter nameawait expect(page.getByText("Welcome to AutoGPT")).toBeVisible({@@ -80,9 +82,17 @@ export async function completeOnboardingWizard(for (const point of painPoints) {await page.getByText(point, { exact: true }).click();}- await page.getByRole("button", { name: "Launch Autopilot" }).click();+ await page.getByRole("button", { name: "Continue" }).click();++ // Step 4: Subscription — pick a plan to advance.+ // (The "Team" CTA opens an external intake form and does not advance.)+ await expect(page.getByText(/choose the plan that.s right/i)).toBeVisible({+ timeout: 5000,+ });+ const planCta = plan === "max" ? "Upgrade to Max" : "Get Pro";+ await page.getByRole("button", { name: planCta }).click();- // Step 4: Preparing — require the real transition state to appear first,+ // Step 5: Preparing — require the real transition state to appear first,// then wait for the app shell on /copilot rather than racing the redirect.await expect(page.getByText("Preparing your workspace...", { exact: false }),@@ -92,5 +102,5 @@ export async function completeOnboardingWizard(timeout: 15000,});- return { name, role, painPoints };+ return { name, role, painPoints, plan };}