1import{u as R,c as _,a as Y,b as M,r as d,f as w,j as e,H as z,B as o,Y as C,w as E}from"./index-OmeXQM1s.js";import{H as I}from"./Header-BmvPIPwR.js";import{P as D}from"./PageMessageBanner-B1nAk3sD.js";import{F as H}from"./Footer-Cb6UIHBd.js";import{t as W}from"./brandingTitle-Ch5yNT07.js";import{C as S}from"./circle-x-DkRptdqY.js";import{R as k}from"./refresh-cw-DWazxcgp.js";import{L as B}from"./loader-circle-BlmWrMeC.js";import{C as G}from"./clock-D2JoSvvJ.js";import{A as P}from"./arrow-right-CdUFuKu9.js";import"./triangle-alert-B6AByDSQ.js";import"./BrandNameText-BIA-D1PI.js";const A=10,O=3e3;function x({tone:r,children:s,spin:i}){const c={success:"bg-emerald-50 text-emerald-600 ring-emerald-100",danger:"bg-rose-50 text-rose-600 ring-rose-100",warning:"bg-amber-50 text-amber-600 ring-amber-100",info:"bg-sky-50 text-sky-600 ring-sky-100"};return e.jsx("div",{className:E("mx-auto mb-8 flex h-20 w-20 items-center justify-center rounded-full ring-8",c[r],i&&"animate-pulse"),children:s})}function u({items:r}){return e.jsx("ul",{className:"mb-8 space-y-3 rounded-xl border border-border/80 bg-muted/80 px-5 py-4 text-left",children:r.map(s=>e.jsxs("li",{className:"flex items-start gap-3 text-sm text-foreground",children:[s.pending?e.jsx(B,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-sky-500"}):s.done===!1?e.jsx(S,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-500"}):e.jsx(C,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-500"}),e.jsx("span",{className:s.pending?"text-muted-foreground":void 0,children:s.label})]},s.label))})}const ne=()=>{const{brandDisplayName:r,isLoading:s}=R(),i=_(),{refreshUserData:c}=Y(),[n]=M(),a=(n.get("status")||n.get("type")||"success")==="success",p=n.get("error")?decodeURIComponent(n.get("error")):null,[m,g]=d.useState(a?"checking":"failed"),[h,L]=d.useState(null),f=d.useCallback(async()=>{var N;if(!a)return;const j=n.get("session_id");if(j)try{await w.verifySubscription({session_id:j})}catch(l){console.error("Agency Stripe session verify failed, falling back to polling.",l)}for(let l=0;l<A;l++){try{const t=await w.getAgencyBilling();if(t.success&&t.data){L(t.data.name||null);const v=(N=t.data.subscription)==null?void 0:N.status;if(v==="active"||v==="provisional_active"){g("active"),await c();return}}}catch{}l<A-1&&await new Promise(t=>setTimeout(t,O))}g("pending")},[a,c,n]);d.useEffect(()=>{f()},[]);const T=()=>i("/projects"),b=()=>i("/agency/billing"),F=()=>i("/agency/billing"),y=a?m==="active"?"Agency Plan Activated":"Payment Processing":"Payment Failed";return e.jsxs("div",{className:"flex min-h-screen flex-col bg-[hsl(217,100%,98.4%)]",children:[e.jsxs(z,{children:[e.jsx("title",{children:s?y:W(y,!1,r)}),e.jsx("meta",{name:"description",content:a?"Your agency subscription is being activated.":"Agency payment could not be processed. Please try again."})]}),e.jsx(I,{}),e.jsxs("main",{className:"flex-1",children:[e.jsx("div",{className:"container mx-auto max-w-lg px-4 pt-6",children:e.jsx(D,{className:"mb-4"})}),e.jsx("div",{className:"container mx-auto flex max-w-lg justify-center px-4 py-12 sm:py-20",children:e.jsxs("div",{className:"w-full rounded-2xl border border-border/90 bg-card px-6 py-10 text-center shadow-sm sm:px-10 sm:py-12",children:[!a&&e.jsxs(e.Fragment,{children:[e.jsx(x,{tone:"danger",children:e.jsx(S,{className:"h-10 w-10"})}),e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-rose-600",children:"Payment failed"}),e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-foreground",children:"We couldn't activate your agency plan"}),e.jsx("p",{className:"mb-8 text-base leading-relaxed text-muted-foreground",children:"No charge was made. You can return to billing and try again when you're ready."}),p&&e.jsxs("div",{className:"mb-6 rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-left",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-rose-700",children:"Reason"}),e.jsx("p",{className:"mt-1 text-sm text-rose-700",children:p})]}),e.jsx("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:e.jsxs(o,{onClick:F,size:"lg",className:"h-12 px-6 font-semibold bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm",children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Back to billing"]})})]}),a&&m==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{tone:"info",spin:!0,children:e.jsx(B,{className:"h-10 w-10 animate-spin"})}),e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-sky-600",children:"Confirming payment"}),e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-foreground",children:"Activating your agency plan"}),e.jsx("p",{className:"mb-8 text-base leading-relaxed text-muted-foreground",children:"Payment received. We're confirming your agency subscription â this usually takes a few seconds."}),e.jsx(u,{items:[{done:!0,label:"Payment processed successfully"},{pending:!0,label:"Confirming with payment providerâ¦"}]})]}),a&&m==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{tone:"warning",children:e.jsx(G,{className:"h-10 w-10"})}),e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-amber-600",children:"Almost ready"}),e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-foreground",children:"Activation still pending"}),e.jsx("p",{className:"mb-8 text-base leading-relaxed text-muted-foreground",children:"Your payment went through. Final confirmation is taking a bit longer than usual."}),e.jsx(u,{items:[{done:!0,label:"Payment received"},{pending:!0,label:"Agency plan activation pending"}]}),e.jsx("p",{className:"mb-8 rounded-xl border border-amber-200/80 bg-amber-50/80 px-4 py-3 text-left text-sm leading-relaxed text-amber-900/80",children:"Wait a couple of minutes, then open Plan & Billing and refresh. If nothing updates after about 10 minutes, contact support with your payment receipt."}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:[e.jsxs(o,{onClick:b,size:"lg",className:"h-12 px-6 font-semibold bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm",children:["Billing",e.jsx(P,{className:"ml-2 h-4 w-4"})]}),e.jsxs(o,{onClick:()=>{g("checking"),f()},size:"lg",variant:"outline",className:"h-12 px-6 font-semibold",children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Check again"]})]})]}),a&&m==="active"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{tone:"success",children:e.jsx(C,{className:"h-10 w-10"})}),e.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.14em] text-emerald-600",children:"All set"}),e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-foreground",children:"Thank y
1ou"}),e.jsxs("p",{className:"mb-8 text-base leading-relaxed text-muted-foreground",children:[h?`Your agency plan for ${h} is now active.`:"Your agency plan is now active."," ","You can manage projects and billing right away."]}),e.jsx(u,{items:[{done:!0,label:"Payment processed successfully"},{done:!0,label:"Agency subscription activated"},{done:!0,label:"Plan limits and features unlocked"}]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:[e.jsxs(o,{onClick:T,size:"lg",className:"h-12 px-6 font-semibold bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm",children:["Agency Dashboard",e.jsx(P,{className:"ml-2 h-4 w-4"})]}),e.jsx(o,{onClick:b,size:"lg",variant:"outline",className:"h-12 px-6 font-semibold",children:"Manage Billing"})]})]}),e.jsxs("p",{className:"mt-10 text-sm text-muted-foreground",children:["Need help?"," ",e.jsx("a",{href:"mailto:[email protected]",className:"font-medium text-foreground underline-offset-4 hover:underline",children:"[email protected]"})]})]})})]}),e.jsx(H,{})]})};export{ne as default};
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.