1import{a as x,u as p,r as u,j as e,L as i,h as b,b4 as g,b3 as h,b5 as f}from"./index-DNidg_Qc.js";import{u as y}from"./useSubscription-C5ij1Ie9.js";import{a as j}from"./payments.functions-BgXIHaqW.js";import{a as N}from"./stripe-BL9TlFig.js";function A(){const{subscription:t,loading:l}=y(),d=x(j),c=p(),[o,n]=u.useState(!1),a=t?.plan??"free",s=h[a],m=async()=>{n(!0);try{const r=await d({data:{environment:N(),returnUrl:`${window.location.origin}/billing`}});if("error"in r)throw new Error(r.error);window.open(r.url,"_blank")}catch(r){console.error(r),alert("Could not open billing portal")}finally{n(!1)}};return e.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-12",children:[e.jsxs(i,{to:"/dashboard",className:"inline-flex items-center text-sm text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(b,{className:"size-4 mr-1"})," Back to dashboard"]}),e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"text-xs font-mono text-primary mb-2",children:"// BILLING"}),e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Your plan"})]}),t?.status==="past_due"&&e.jsxs("div",{className:"mb-6 p-4 rounded-xl border border-destructive/40 bg-destructive/[0.06] text-sm",children:[e.jsx("strong",{className:"text-destructive",children:"Payment failed."})," ","We'll keep retrying, but please update your payment method in the billing portal to avoid losing access."]}),e.jsx("div",{className:"p-6 rounded-xl border border-border bg-card text-card-foreground mb-6",children:l?e.jsx("p",{className:"text-muted-foreground",children:"Loadingâ¦"}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-baseline justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:g[a]}),e.jsxs("p",{className:"text-sm text-muted-foreground capitalize",children:["Status: ",t?.status??"free",t?.cancelAtPeriodEnd&&" · cancels at period end"]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(i,{to:"/pricing",className:"px-4 py-2 bg-primary text-primary-foreground text-sm font-bold rounded-lg hover:opacity-90 transition-opacity",children:"Compare / Change Plan"}),a==="free"?e.jsx("button",{onClick:()=>c({to:"/pricing"}),className:"px-4 py-2 bg-primary text-primary-foreground text-sm font-bold rounded-lg hover:opacity-90 transition-opacity",children:"Upgrade"}):e.jsx("button",{onClick:m,disabled:o,className:"px-4 py-2 bg-primary text-primary-foreground text-sm font-bold rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50",children:o?"Openingâ¦":"Manage billing"})]})]})})}),e.jsxs("div",{className:"p-6 rounded-xl border border-border bg-card text-card-foreground",children:[e.jsx("h3",{className:"font-bold mb-1",children:"Plan allowance"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:'Base monthly quota for your plan. Any purchased top-ups are shown on the dashboard under "Available credits".'}),e.jsx("ul",{className:"space-y-2 text-sm",children:Object.keys(s).map(r=>e.jsxs("li",{className:"flex justify-between border-b border-border/60 py-2",children:[e.jsx("span",{children:f[r]}),e.jsx("span",{className:"font-mono text-muted-foreground",children:s[r]===-1?"Unlimited":s[r]===0?"Not included":`${s[r]} / mo`})]},r))})]})]})}export{A as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.