PageSourceSearch

https://snapshot9.ai/assets/SubscriptionTransition-DZeNQ0py.js

js snapshot9.ai collected 2026-10-05 14:42:01 UTC 10,616 bytes, 1 lines download raw bytes

1import{e,u as s,q as a,j as r}from"./index-BzykBEZi.js";import{h as t,b as i,r as l,L as n}from"./react-vendor-MSAyDDoi.js";import{R as d,a as o,J as c,C as m,B as x,U as p,av as h,h as u,o as b,A as j,a9 as g}from"./icons-vendor-DZcQ4_Wo.js";import"./auth-vendor-p9lNoiyd.js";import"./stripe-vendor-D4jxSIHn.js";function f(){const{code:f}=t(),y=i(),N=e(),{dbUser:v,isAuthenticated:w,isLoading:z,loginWithRedirect:C}=s(),[S,k]=l.useState(!0),[T,R]=l.useState(!0),[E,F]=l.useState(null),[$,A]=l.useState(null),[P,Y]=l.useState("professional"),[I,U]=l.useState(!1);l.useEffect(()=>{f&&L()},[f]),l.useEffect(()=>{$&&$.memberCount>0&&Y("enterprise")},[$]);const L=async()=>{var e,s,r;try{R(!0),F(null);const e=await a.get(`/referrals/${f}/validate`);e.data.success?e.data.valid?A(e.data):F(e.data.reason||"Invalid referral code"):F(e.data.error||"Failed to validate code")}catch(t){404===(null==(e=t.response)?void 0:e.status)?F("Referral code not found"):F((null==(r=null==(s=t.response)?void 0:s.data)?void 0:r.error)||"Failed to validate referral code")}finally{R(!1),k(!1)}},q=()=>{sessionStorage.setItem("pendingTransitionCode",f),C({appState:{returnTo:`/transition/${f}`}})};if(S||z)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 to-blue-50 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx(d,{className:"animate-spin text-primary-600 mx-auto mb-4",size:40}),r.jsx("p",{className:"text-gray-600",children:"Validating referral code..."})]})});if(E||!$)return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-red-50 to-orange-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl max-w-md w-full p-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-red-100 rounded-full mb-6",children:r.jsx(o,{className:"text-red-600",size:32})}),r.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-3",children:"Invalid Referral Code"}),r.jsx("p",{className:"text-gray-600 mb-6",children:E||"This referral code is not valid or has expired."}),r.jsxs(n,{to:"/",className:"inline-flex items-center space-x-2 px-6 py-3 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors",children:[r.jsx("span",{children:"Go to Homepage"}),r.jsx(c,{size:18})]})]})});const B=[{id:"professional",name:"Professional",price:"$29",period:"/month",description:"For individual professionals",features:["Unlimited snapshots","AI-powered insights","Strategic recommendations","Export & reporting"],disabled:$.memberCount>0,disabledReason:"Team members require Enterprise"},{id:"enterprise",name:"Enterprise",price:"$79",period:"/month",description:"For teams and organizations",features:["Everything in Professional","Team collaboration",`Transfer ${$.memberCount} team members`,"Admin dashboard","Priority support"],recommended:$.memberCount>0}];return r.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 via-white to-blue-50",children:[r.jsx("div",{className:"bg-white border-b border-gray-200",children:r.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(n,{to:"/",className:"text-2xl font-bold text-primary-600",children:"Snapshot9"}),!w&&r.jsx("button",{onClick:q,className:"text-sm text-primary-600 hover:text-primary-700 font-medium",children:"Already have an account? Sign in"})]})})}),r.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-12",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsxs("div",{className:"inline-flex items-center space-x-2 px-4 py-2 bg-green-100 text-green-700 rounded-full text-sm font-medium mb-6",children:[r.jsx(m,{size:16}),r.jsx("span",{children:"Valid Referral Code"})]}),r.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Complete Your Transition"}),r.jsx("p",{className:"text-xl text-gray-600 max-w-2xl mx-auto",children:"Your channel partner has set up your transition to a personal Snapshot9 subscription. Choose your plan to continue."})]}),r.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-lg p-8 mb-8",children:r.jsxs("div",{className:"flex items-start space-x-4",children:[r.jsx("div",{className:"bg-primary-100 rounded-xl p-4",children:r.jsx(x,{className:"text-primary-600",size:32})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-1",children:$.teamName}),r.jsx("p",{className:"text-gray-600 mb-4",children:"Transitioning to your personal subscription"}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 text-center",children:[r.jsx(p,{className:"text-primary-600 mx-auto mb-1",size:20}),r.jsx("p",{className:"text-2xl font-bold text-gray-900",children:$.memberCount}),r.jsx("p",{className:"text-xs text-gray-500",children:"Team Members"})]}),r.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 text-center",children:[r.jsx(h,{className:"text-green-600 mx-auto mb-1",size:20}),r.jsx("p",{className:"text-sm font-medium text-gray-900",children:"All Data"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Preserved"})]}),r.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 text-center",children:[r.jsx(u,{className:"text-amber-600 mx-auto mb-1",size:20}),r.jsx("p",{className:"text-sm font-medium text-gray-900",children:"Snapshots"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Transferred"})]}),r.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 text-center",children:[r.jsx(b,{className:"text-blue-600 mx-auto mb-1",size:20}),r.jsx("p",{className:"text-sm font-medium text-gray-900",children:$.daysUntilExpiration}),r.jsx("p",{className:"text-xs text-gray-500",children:"Days Left"})]})]})]})]})}),r.jsxs("div",{className:"mb-8",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Select Your Plan"}),r.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:B.map(e=>r.jsxs("button",{onClick:()=>!e.disabled&&Y(e.id),disabled:e.disabled,className:"relative text-left p-6 rounded-2xl border-2 transition-all "+(e.disabled?"border-gray-200 bg-gray-50 opacity-60 cursor-not-allowed":P===e.id?"border-primary-500 bg-primary-50 ring-2 ring-primary-200":"border-gray-200 hover:border-primary-300 bg-white"),children:[e.recommended&&r.jsx("span",{className:"absolute -top-3 left-4 px-3 py-1 bg-primary-600 text-white text-xs font-medium rounded-full",children:"Recommended"}),r.jsxs("div",{className:"flex items-start justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-lg font-bold text-gray-900",children:e.name}),r.jsx("p",{className:"text-sm text-gray-500",children:e.description})]}),r.jsx("div",{className:"w-5 h-5 rounded-full border-2 flex items-center justify-center "+(P!==e.id||e.disabled?"border-gray-300":"border-primary-600 bg-primary-600"),children:P===e.id&&!e.disabled&&r.jsx(m,{className:"text-white",size:14})})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("span",{className:"text-3xl font-bold text-gray-900",children:e.price}),r.jsx("span",{className:"text-gray-500",children:e.period})]}),r.jsx("ul",{className:"space-y-2",children:e.features.map((e,s)=>r.jsxs("li",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[r.jsx(m,{className:"text-green-500 flex-shrink-0",size:14}),r.jsx("span",{children:e})]},s))}),e.disabled&&e.disabledReason&&r.jsxs("div",{className:"mt-4 flex items-center space-x-2 text-amber-600 text-sm",children:[r.jsx(j,{size:14}),r.jsx("span",{children:e.disabledReason})]})]},e.id))})]}),r.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-6 mb-8",children:[r.jsx("h4",{className:"font-semibold text-blue-900 mb-3",children:"What happens when you subscribe:"}),r.jsxs("ul",{className:"space-y-2 text-sm text-blue-700",children:[r.jsxs("li",{className:"flex items-start space-x-2",children:[r.jsx(m,{className:"text-blue-500 flex-shrink-0 mt-0.5",size:14}),r.jsx("span",{children:"Your snapshots and assessments are transferred to your new account"})]}),$.memberCount>0&&r.jsxs("li",{className:"flex items-start space-x-2",children:[r.jsx(m,{className:"text-blue-500 flex-shrink-0 mt-0.5",size:14}),r.jsxs("span",{children:["Your ",$.memberCount," team members keep their access and data"]})]}),r.jsxs("li",{className:"flex items-start space-x-2",children:[r.jsx(m,{className:"text-blue-500 flex-shrink-0 mt-0.5",size:14}),r.jsx("span",{children:"You become the owner of your organization with full admin rights"})]}),r.jsxs("li",{className:"flex items-start space-x-2",children:[r.jsx(m,{className:"text-blue-500 flex-shrink-0 mt-0.5",size:14}),r.jsx("span",{children:"Billing starts immediately with monthly or annual options"})]})]})]}),r.jsxs("div",{className:"text-center",children:[w?r.jsx("button",{onClick:async()=>
1{if(w&&v)if($.managerEmail===v.email){U(!0);try{const e=await a.post(`/referrals/${f}/redeem`,{selectedTier:P});if(!e.data.success)throw new Error(e.data.error||"Failed to redeem code");N.success("Referral code redeemed! Redirecting to checkout..."),y(`/pricing?tier=${P}&referral=${f}`)}catch(e){N.error(e.message||"Failed to process transition")}finally{U(!1)}}else N.error("This referral code is not associated with your account");else q()},disabled:I,className:"inline-flex items-center space-x-3 px-8 py-4 bg-primary-600 text-white rounded-xl hover:bg-primary-700 transition-colors font-semibold text-lg disabled:opacity-50 disabled:cursor-not-allowed shadow-lg",children:I?r.jsxs(r.Fragment,{children:[r.jsx(d,{className:"animate-spin",size:20}),r.jsx("span",{children:"Processing..."})]}):r.jsxs(r.Fragment,{children:[r.jsx(g,{size:20}),r.jsx("span",{children:"Continue to Checkout"}),r.jsx(c,{size:20})]})}):r.jsxs("button",{onClick:q,className:"inline-flex items-center space-x-3 px-8 py-4 bg-primary-600 text-white rounded-xl hover:bg-primary-700 transition-colors font-semibold text-lg shadow-lg",children:[r.jsx("span",{children:"Sign In to Continue"}),r.jsx(c,{size:20})]}),r.jsx("p",{className:"mt-4 text-sm text-gray-500",children:"Secure payment powered by Stripe. Cancel anytime."})]})]}),r.jsx("div",{className:"border-t border-gray-200 mt-12 py-8",children:r.jsx("div",{className:"max-w-4xl mx-auto px-4 text-center text-sm text-gray-500",children:r.jsxs("p",{children:["Questions? Contact your channel partner or"," ",r.jsx("a",{href:"mailto:[email protected]",className:"text-primary-600 hover:underline",children:"our support team"})]})})})]})}export{f 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.