module.exports=[35327,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944);function e(){return(0,b.jsx)(c.Suspense,{fallback:(0,b.jsx)("div",{className:"py-12 text-center text-[var(--color-text-secondary)]",children:"Loading..."}),children:(0,b.jsx)(f,{})})}function f(){let a=(0,d.useSearchParams)(),e=a.get("success"),f=a.get("canceled"),[g,h]=(0,c.useState)(null);async function i(a){h(a);try{let b=await fetch("/api/billing/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:a})}),c=await b.json();c.url?window.location.href=c.url:alert(c.error)}catch{alert("Failed to create checkout")}h(null)}async function j(){h("portal");try{let a=await fetch("/api/billing/portal",{method:"POST"}),b=await a.json();b.url?window.location.href=b.url:alert(b.error)}catch{alert("Failed to open portal")}h(null)}return(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Billing"}),(0,b.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Billing & subscriptions"}),(0,b.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Manage your plan, payment method, and invoices."})]}),e&&(0,b.jsx)("div",{className:"rounded-xl bg-green-50 px-4 py-3 text-sm text-green-700",children:"Payment successful! Your plan has been upgraded."}),f&&(0,b.jsx)("div",{className:"rounded-xl bg-yellow-50 px-4 py-3 text-sm text-yellow-700",children:"Checkout was canceled. No changes were made."}),(0,b.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-6 shadow-sm",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Starter"}),(0,b.jsxs)("p",{className:"mt-1 text-3xl font-bold",children:["$19",(0,b.jsx)("span",{className:"text-sm font-normal text-[var(--color-text-secondary)]",children:"/mo"})]}),(0,b.jsxs)("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-text-secondary)]",children:[(0,b.jsx)("li",{children:"10 bots + team seats"}),(0,b.jsx)("li",{children:"Knowledge base + lead capture"}),(0,b.jsx)("li",{children:"WhatsApp integration"})]}),(0,b.jsx)("button",{onClick:()=>i("starter"),disabled:"starter"===g,className:"mt-4 w-full rounded-xl bg-[var(--color-bg-brand)] py-2.5 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:"starter"===g?"Loading...":"Subscribe to Starter"})]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-bg-brand)] bg-white p-6 shadow-card",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Pro"}),(0,b.jsxs)("p",{className:"mt-1 text-3xl font-bold",children:["$49",(0,b.jsx)("span",{className:"text-sm font-normal text-[var(--color-text-secondary)]",children:"/mo"})]}),(0,b.jsxs)("ul",{className:"mt-3 space-y-2 text-sm text-[var(--color-text-secondary)]",children:[(0,b.jsx)("li",{children:"Unlimited bots"}),(0,b.jsx)("li",{children:"Advanced analytics"}),(0,b.jsx)("li",{children:"Priority support"})]}),(0,b.jsx)("button",{onClick:()=>i("pro"),disabled:"pro"===g,className:"mt-4 w-full rounded-xl bg-[var(--color-bg-brand)] py-2.5 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:"pro"===g?"Loading...":"Subscribe to Pro"})]})]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-6 shadow-sm",children:[(0,b.jsx)("p",{className:"font-semibold",children:"Manage existing subscription"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-[var(--color-text-secondary)]",children:"Update payment method, view invoices, or cancel via the Stripe Billing Portal."}),(0,b.jsx)("button",{onClick:j,disabled:"portal"===g,className:"mt-3 inline-flex items-center rounded-xl border border-[var(--color-border-subtle)] px-4 py-2 text-sm font-semibold transition hover:bg-[var(--color-bg-soft)] disabled:opacity-50",children:"portal"===g?"Loading...":"Open billing portal"})]})]})}a.s(["default",()=>e])}];

//# sourceMappingURL=src_app_%28app%29_dashboard_billing_page_tsx_58843514._.js.map