1import{c as y,b as w,u as S,r,j as e}from"./vendor-react-DNzvc-wG.js";import{n as k}from"./index-76ZJ0hX8.js";import{u as P}from"./hooks-CJd8NYon.js";import{f as _}from"./billingSlice-B7w6CBia.js";import{l as D}from"./numberFormat-CV9kwBsp.js";import{L,C as A,f as C}from"./vendor-icons-Cfz49ngt.js";import"./vendor-i18n-CU4tDMqy.js";import"./vendor-redux-DA4mNhH6.js";const U=()=>{const[u]=y(),l=w(),{t,i18n:p}=S(),c=p.language==="ar",x=P(),[i,f]=r.useState(null),[o,d]=r.useState(""),[h,g]=r.useState(!1),[b,v]=r.useState(!0),j=u.get("session_id");return r.useEffect(()=>{try{localStorage.removeItem("midash_coupon")}catch{}},[]),r.useEffect(()=>{(async()=>{var n;try{let a="free",s=null;for(let m=0;m<5&&(await new Promise(N=>setTimeout(N,2e3)),s=await k(),a=s.plan||"free",!(a!=="free"||s.is_trial||s.subscription));m++);f((s==null?void 0:s.subscription)||null),d(a),g((s==null?void 0:s.is_trial)||((n=s==null?void 0:s.subscription)==null?void 0:n.status)==="trialing"),x(_())}catch(a){console.error("Failed to load subscription:",a)}finally{v(!1)}})()},[j]),b?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--surface-bg)]",dir:c?"rtl":"ltr",children:e.jsxs("div",{className:"text-center",children:[e.jsx(L,{size:48,className:"animate-spin text-[var(--accent-primary)] mx-auto mb-4"}),e.jsx("p",{className:"text-[var(--color-text)]",children:t("pricing.checkout.settingUp","Setting up your subscription...")})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--surface-bg)] p-4",dir:c?"rtl":"ltr",children:e.jsxs("div",{className:"max-w-md w-full bg-[var(--surface-panel)] rounded-xl border border-[var(--border-soft)] p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-500/10 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(A,{size:32,className:"text-green-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--color-text)] mb-2",children:o==="pro_plus"?t("pricing.checkout.welcomeProPlus","Welcome to MiDash Pro+!"):o==="lite"?t("pricing.checkout.welcomeLite","Welcome to MiDash Lite!"):o==="byoai"?t("pricing.checkout.welcomeByoai","Welcome to MiDash BYOAI!"):t("pricing.checkout.welcomePro","Welcome to MiDash Pro!")}),e.jsx("p",{className:"text-[var(--color-text-soft)] mb-6",children:h?t("pricing.checkout.trialActive","Your free trial is now active. Enjoy full access to all premium features!"):t("pricing.checkout.subscriptionActive","Your subscription is now active. You have full access to all premium features.")}),i&&e.jsxs("div",{className:"bg-[var(--surface-bg)] rounded-lg p-4 mb-6",style:{textAlign:c?"right":"left"},children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-[var(--color-text-soft)]",children:t("pricing.plans.free.name","Plan")}),e.jsx("span",{className:"font-semibold text-[var(--color-text)]",children:i.plan_name})]}),e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-[var(--color-text-soft)]",children:t("common.status","Status")}),e.jsx("span",{className:"text-green-500 font-medium capitalize",children:i.status})]}),i.current_period_end&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[var(--color-text-soft)]",children:t("pricing.billing.nextBilling","Next billing")}),e.jsx("span",{className:"text-[var(--color-text)]",children:new Date(i.current_period_end).toLocaleDateString(D(c?"ar-SA":"en-US"))})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:()=>l("/platform"),className:"w-full flex items-center justify-center gap-2 px-6 py-3 bg-[var(--accent-primary)] text-[var(--text-on-accent)] rounded-lg hover:brightness-110 transition-all font-medium",children:[t("pricing.checkout.goToPlatform","Go to Platform"),e.jsx(C,{size:18})]}),e.jsx("button",{onClick:()=>l("/billing"),className:"w-full px-6 py-3 border border-[var(--border-soft)] text-[var(--color-text)] rounded-lg hover:bg-[var(--surface-bg)] transition-all",children:t("pricing.checkout.manageSubscription","Manage Subscription")})]}),e.jsx("p",{className:"mt-6 text-xs text-[var(--color-text-soft)]",children:t("pricing.checkout.receiptNote","You'll receive a confirmation email shortly with your receipt.")})]})})};export{U as default}; 2//# sourceMappingURL=CheckoutSuccess-lX9hj-gy.js.map
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.