1import{av as C,E as A,r as i,j as e,P as E,w as j,a as I,L as a,A as k,y}from"./index-D-ZsJRgs.js";import{C as w}from"./circle-alert-DQgE_1Vd.js";import{R as P}from"./refresh-cw-DCWQuQOU.js";import{S as z}from"./shield-check-DVQKsOGR.js";import{L as N,U as v}from"./user-plus-uDXXPUg4.js";const m="rvp_marketplace_tracking";function R(){try{const c=sessionStorage.getItem(m)??localStorage.getItem(m);return c?JSON.parse(c):null}catch{return null}}function L(){localStorage.removeItem(m),sessionStorage.removeItem(m)}const F=["All 78 professional calculators â unlimited","Full AI tools suite (deal analyzer, rehab, rent, underwriting)","210+ templates & contracts","153+ phone scripts","All investor games â current & future","Education center, market insights & vault reports","Save, print & download all reports","Priority support for life","All future tools & features â no extra charge"];function $(){const[c]=C(),o=c.get("session_id"),{user:p}=A(),[s,n]=i.useState("checking"),[d,S]=i.useState(null),[u,x]=i.useState(0),f=i.useRef(null),h=i.useRef(!1);async function g(){if(!o){n("no_session");return}try{const{data:t,error:l}=await y.from("marketplace_sales").select("id, access_granted, stripe_verified, sale_status, email, stripe_payment_status").eq("stripe_session_id",o).maybeSingle();if(l)throw l;if(!t){x(r=>r+1);return}if(S(t),t.access_granted&&t.stripe_verified){if(n("verified"),!h.current){h.current=!0;const r=R();r&&y.from("marketplace_sales").update({utm_source:r.utmSource,utm_medium:r.utmMedium,utm_campaign:r.utmCampaign,referral_code:r.referralCode,partner_id:r.partnerId}).eq("id",t.id).then(()=>L())}}else t.sale_status==="failed"||t.stripe_payment_status==="failed"?n("failed"):x(r=>r+1)}catch{x(t=>t+1)}}i.useEffect(()=>{if(!o){n("no_session");return}g()},[o]),i.useEffect(()=>{if(!(s==="verified"||s==="failed"||s==="no_session")&&u!==0){if(u>=15){n("pending");return}return f.current=setTimeout(()=>{g()},3e3),()=>{f.current&&clearTimeout(f.current)}}},[u,s]);const b=d!=null&&d.email?d.email.replace(/(.{2})(.*)(@.*)/,(t,l,r,_)=>`${l}***${_}`):null;return e.jsxs("div",{className:"min-h-screen bg-dark-950 flex flex-col items-center justify-center px-4 py-16",children:[e.jsx(E,{title:"Marketplace Purchase Confirmed â REI Vault Pro",description:"Your discounted Lifetime Membership purchase is being verified.",canonical:"/marketplace-lifetime-success",robots:"noindex, nofollow"}),e.jsxs("div",{className:"w-full max-w-lg",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:`inline-flex items-center justify-center w-20 h-20 rounded-full mb-5 ${s==="verified"?"bg-success-500/15 border-2 border-success-400/30":s==="failed"?"bg-error-500/15 border-2 border-error-400/30":"bg-gold-500/15 border-2 border-gold-400/30"}`,children:[s==="verified"&&e.jsx(j,{size:38,className:"text-success-400"}),s==="failed"&&e.jsx(w,{size:38,className:"text-error-400"}),(s==="checking"||s==="pending")&&(s==="checking"?e.jsx(P,{size:38,className:"text-gold-400 animate-spin"}):e.jsx(z,{size:38,className:"text-gold-400"})),s==="no_session"&&e.jsx(w,{size:38,className:"text-warning-400"})]}),s==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"font-display text-3xl font-bold text-white mb-2",children:"Verifying Payment"}),e.jsx("p",{className:"text-dark-300 text-sm",children:"Confirming your purchase with Stripe. This takes a few secondsâ¦"})]}),s==="verified"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"font-display text-3xl font-bold text-white mb-2",children:"Purchase Confirmed!"}),e.jsxs("p",{className:"text-dark-300 text-sm",children:["Your Lifetime Membership is active.",b&&` Purchased with ${b}`]})]}),s==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"font-display text-3xl font-bold text-white mb-2",children:"Almost There"}),e.jsx("p",{className:"text-dark-300 text-sm",children:"Your payment is processing. Access will unlock automatically â sign in below and your membership will be waiting."})]}),s==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"font-display text-2xl font-bold text-white mb-2",children:"Payment Not Verified"}),e.jsx("p",{className:"text-dark-300 text-sm",children:"We could not confirm your payment. Please contact support so we can resolve this quickly."})]}),s==="no_session"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"font-display text-2xl font-bold text-white mb-2",children:"Missing Session"}),e.jsx("p",{className:"text-dark-300 text-sm",children:"No session ID found. If you completed a purchase, please use the link from your email confirmation or contact support."})]})]}),s==="verified"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl metallic-gold flex items-center justify-center shadow-gold flex-shrink-0",children:e.jsx(I,{size:22,className:"text-dark-950"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-display text-lg font-bold text-dark-900",children:"Lifetime Membership"}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-success-500"}),e.jsx("span",{className:"text-xs font-semibold text-success-600",children:"Access Active"}),e.jsx("span",{className:"ml-1 text-[10px] font-bold text-amber-700 bg-amber-50 border border-amber-200 px-1.5 py-0.5 rounded-full",children:"SaaS Marketplace"})]})]})]}),e.jsx("ul",{className:"space-y-2 mb-5",children:F.map((t,l)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-dark-700",children:[e.jsx(j,{size:14,className:"text-success-500 flex-shrink-0 mt-0.5"}),t]},l))})]}),p?e.jsxs(a,{to:"/marketplace-lifetime-welcome",className:"btn-gold w-full py-3.5 flex items-center justify-center gap-2 font-bold text-sm rounded-xl",children:["See Your Lifetime Features ",e.jsx(k,{size:16})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-dark-300 text-xs text-center",children:"Sign in with the email you used at checkout â your Lifetime access is already attached."}),e.jsxs(a,{to:"/login",state:{from:"/marketplace-lifetime-welcome"},className:"btn-gold w-full py-3.5 flex items-center justify-center gap-2 font-bold text-sm rounded-xl",children:[e.jsx(N,{size:16})," Sign In to Access Dashboard"]}),e.jsxs(a,{to:"/join",className:"w-full py-3.5 flex items-center justify-center gap-2 font-bold text-sm rounded-xl bg-dark-800 hover:bg-dark-700 text-white border border-dark-600 transition-all",children:[e.jsx(v,{size:16})," Create Your Account"]})]})]}),s==="pending"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"bg-dark-900 border border-dark-700 rounded-2xl p-5 text-center",children:[e.jsx("p",{className:"text-dark-200 text-sm mb-4",children:"Stripe webhooks typically fire within 30 seconds. Your membership will activate automatically. Sign in now â access will be waiting."}),e.jsx("div",{className:"space-y-3",children:p?e.jsxs(a,{to:"/marketplace-lifetime-welcome",className:"btn-gold w-full py-3 flex items-center justify-center gap-2 font-bold text-sm rounded-xl",children:["Check Dashboard ",e.jsx(k,{size:16})]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{to:"/login",state:{from:"/marketplace-lifetime-welcome"},className:"btn-gold w-full py-3 flex items-center justify-center gap-2 font-bold text-sm rounded-xl",children:[e.jsx(N,{size:16})," Sign In"]}),e.jsxs(a,{to:"/join",className:"w-full py-3 flex items-center justify-center gap-2 font-bold text-sm rounded-xl bg-dark-800 hover:bg-dark-700 text-white border border-dark-600 transition-all",children:[e.jsx(v,{size:16})," Create Account"]})]})})]})}),(s==="failed"||s==="no_session")&&e.jsx("div",{className:"bg-dark-900 border border-dark-700 rounded-2xl p-5",children:e.jsx(a,{to:"/marketplace-lifetime-error",className:"w-full py-3.5 flex items-center justify-center gap-2 font-bold text-sm rounded-xl bg-error-600 hover:bg-error-700 text-white transition-all",children:"View Error Details & Get Support"})}),e.jsxs("p",{className:"text-dark-400 text-xs text-center mt-6",children:["Questions?"," ",e.jsx(a,{to:"/support",className:"text-dark-200 hover:text-white underline",children:"Customer Support"})," ","or email"," ",e.jsx("a",{href:"mailto:[email protected]",className:"text-dark-200 hover:text-white underline",children:"[email protected]"})]})]})]})}export{$ 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.