PageSourceSearch

https://quiz-smart--mike0723.replit.app/assets/Checkout-BLh37YMU.js

js quiz-smart--mike0723.replit.app collected 2026-10-03 03:58:30 UTC 10,943 bytes, 1 lines download raw bytes

1import{bm as T,r as o,j as e,d as P,B as F,ap as k,aj as E,m as S,Z as L,I as C,b9 as _,a5 as A,aq as R,T as $,M as q,U as O,bn as U}from"./index-9JAl2JWO.js";import{l as z,E as B,u as M,a as D,C as I}from"./react-stripe.esm-x8pSxLvu.js";import{C as J}from"./credit-card-hIfFTyZH.js";import{C as g}from"./check-B3dYsTTu.js";import{C as W}from"./chart-column-BWcQ6g2g.js";const K={style:{base:{fontSize:"16px",color:"#1e293b","::placeholder":{color:"#94a3b8"},fontFamily:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},invalid:{color:"#ef4444"}}};function Z({selectedPlan:c,setSelectedPlan:m,ghlLocationId:d}){const[,N]=k(),{toast:l}=E(),n=M(),p=D(),[b,r]=o.useState(!1),[s,f]=o.useState({email:"",name:""}),v=[{icon:R,title:"Unlimited AI Quizzes",desc:"Launch in 60 seconds, not 6 hours"},{icon:$,title:"Smart Lead Scoring",desc:"Know who's hot before you call"},{icon:q,title:"14-Email Sequences",desc:"Nurture leads while you sleep"},{icon:W,title:"Analytics Dashboard",desc:"See what's working, fix what's not"}
1,{icon:O,title:"The Collective Sync",desc:"Leads land in your CRM instantly"}],i=async a=>{if(a.preventDefault(),!n||!p){l({title:"Payment system loading...",description:"Please wait a moment and try again.",variant:"destructive"});return}if(!s.email||!s.name){l({title:"Please fill in all fields",variant:"destructive"});return}r(!0);try{const t=await(await fetch("/api/billing/create-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s.email,name:s.name,ghlLocationId:d||void 0,planType:c})})).json();if(!t.success){l({title:t.message||"Failed to process payment",variant:"destructive"}),r(!1);return}const w=p.getElement(I);if(!w){l({title:"Card element not found",variant:"destructive"}),r(!1);return}let x,j;if(t.intentType==="setup_intent"){const{error:h,setupIntent:u}=await n.confirmCardSetup(t.clientSecret,{payment_method:{card:w,billing_details:{name:s.name,email:s.email}}});x={error:h,succeeded:u?.status==="succeeded"},j=u?.id}else{const{error:h,paymentIntent:u}=await n.confirmCardPayment(t.clientSecret,{payment_method:{card:w,billing_details:{name:s.name,email:s.email}}});x={error:h,succeeded:u?.status==="succeeded"},j=u?.id}if(x.error){l({title:x.error.message||"Payment failed",variant:"destructive"}),r(!1);return}if(x.succeeded){await fetch("/api/billing/confirm-payment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t.sessionId,paymentIntentId:t.intentType==="payment_intent"?j:void 0,setupIntentId:t.intentType==="setup_intent"?j:void 0,customerId:t.customerId,priceId:t.priceId,ghlLocationId:d||void 0})}),l({title:"Payment successful!",description:"Welcome to Smart Coach. Setting up your account..."});const h=d?`/checkout/success?session=${t.sessionId}&locationId=${d}`:`/checkout/success?session=${t.sessionId}`;N(h)}}catch(y){console.error("Payment error:",y),l({title:"Something went wrong. Please try again.",variant:"destructive"}),r(!1)}};return e.jsx("div",{className:"min-h-screen bg-[#F8FAFC]",children:e.jsxs("div",{className:"grid lg:grid-cols-12 min-h-screen",children:[e.jsx("div",{className:"lg:col-span-7 bg-white",children:e.jsx("div",{className:"max-w-lg mx-auto px-6 py-12 lg:py-16 lg:pr-12",children:e.jsxs(S.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-blue-600 to-indigo-600 flex items-center justify-center",children:e.jsx(L,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Smart Coach"}),e.jsx("p",{className:"text-sm text-slate-500",children:"by The Collective"})]})]}),e.jsx("h2",{className:"text-2xl font-semibold text-slate-900 mb-2",children:"Turn visitors into qualified leads"}),e.jsx("p",{className:"text-slate-500 mb-8",children:"Create your first AI quiz in 60 seconds. No tech skills needed."}),e.jsxs("div",{className:"mb-8",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 mb-3",children:"Select your plan"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>m("monthly"),className:`flex-1 p-4 rounded-xl border-2 transition-all ${c==="monthly"?"border-blue-500 bg-blue-50/50":"border-slate-200 hover:border-slate-300"}`,"data-testid":"plan-monthly",children:[e.jsx("div",{className:"text-sm text-slate-500 mb-1",children:"Monthly"}),e.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:["$97",e.jsx("span",{className:"text-base font-normal text-slate-400",children:"/mo"})]})]}),e.jsxs("button",{type:"button",onClick:()=>m("yearly"),className:`flex-1 p-4 rounded-xl border-2 transition-all relative ${c==="yearly"?"border-emerald-500 bg-emerald-50/50":"border-slate-200 hover:border-slate-300"}`,"data-testid":"plan-yearly",children:[e.jsx("div",{className:"absolute -top-2.5 left-4 px-2 py-0.5 rounded-full bg-emerald-500 text-white text-xs font-semibold",children:"Save $167"}),e.jsx("div",{className:"text-sm text-slate-500 mb-1",children:"Yearly"}),e.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:["$997",e.
1jsx("span",{className:"text-base font-normal text-slate-400",children:"/yr"})]})]})]})]}),e.jsxs("form",{onSubmit:i,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 mb-3",children:"Account"}),e.jsx(C,{type:"email",placeholder:"Email address",value:s.email,onChange:a=>f({...s,email:a.target.value}),required:!0,className:"h-12 text-base","data-testid":"input-email"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 mb-3",children:"Payment"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{type:"text",placeholder:"Name on card",value:s.name,onChange:a=>f({...s,name:a.target.value}),required:!0,className:"h-12 text-base","data-testid":"input-name"}),e.jsx("div",{className:"p-4 border border-slate-200 rounded-xl bg-white",children:e.jsx(I,{options:K})})]})]}),e.jsx(F,{type:"submit",size:"lg",disabled:b||!n,className:"w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold h-14 rounded-xl text-base shadow-lg shadow-blue-600/25","data-testid":"button-pay",children:b?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"h-5 w-5 animate-spin"}),"Processing payment..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(_,{className:"h-4 w-4"}),"Pay $",c==="monthly"?"97":"997"," — Get instant access"]})}),e.jsxs("div",{className:"flex items-center justify-center gap-6 text-sm text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(A,{className:"h-4 w-4"}),"Secure checkout"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(g,{className:"h-4 w-4"}),"30-day refund"]})]})]})]})})}),e.jsx("div",{className:"lg:col-span-5 bg-[#F8FAFC] border-l border-slate-200",children:e.jsx("div",{className:"max-w-md mx-auto px-6 py-12 lg:py-16 lg:pl-12",children:e.jsxs(S.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-6",children:"What's included"}),e.jsx("div",{className:"space-y-5",children:v.map((a,y)=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white border border-slate-200 flex items-center justify-center flex-shrink-0",children:e.jsx(a.icon,{className:"h-5 w-5 text-slate-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:a.title}),e.jsx("p",{className:"text-sm text-slate-500",children:a.desc})]})]},y))}),e.jsx("div",{className:"mt-10 pt-8 border-t border-slate-200",children:e.jsxs("div",{className:"p-5 rounded-xl bg-white border border-slate-200",children:[e.jsx("div",{className:"flex gap-1 mb-3",children:[1,2,3,4,5].map(a=>e.jsx(U,{className:"h-4 w-4 text-amber-400 fill-amber-400"},a))}),e.jsx("p",{className:"text-slate-700 text-sm leading-relaxed mb-4",children:`"Had my quiz live in 10 minutes. 47 tagged leads in my pipeline within a week. Best ROI I've seen."`}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-200 flex items-center justify-center text-xs font-medium text-slate-600",children:"JR"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Jessica R."}),e.jsx("p",{className:"text-xs text-slate-500",children:"Business Coach"})]})]})]})}),e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(g,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{children:"Cancel anytime, no contracts"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(g,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{children:"Works seamlessly with The Collective"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(g,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{children:"Priority support included"})]})]})]})})})]})})}function X(){const c=T(),[m,d]=o.useState(null),[N,l]=o.useState(!0),n=new URLSearchParams(c),p=n.get("locationId"),b=n.get("plan"),r=typeof window<"u"?localStorage.getItem("ghl_location_id"):null,s=p||r,[f,v]=o.useState(b==="monthly"?"monthly":"yearly");return o.useEffect(()=>{fetch("/api/billing/stripe-config").then(i=>i.json()).then(i=>{i.publishableKey&&d(z(i.publishableKey)),l(!1)}).catch(i=>{console.error("Failed to load Stripe config:",i),l(!1)})},[]),N?e.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(P,{className:"h-8 w-8 animate-spin text-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-500",children:"Loading checkout..."})]})}):m?e.jsx(B,{stripe:m,children:e.jsx(Z,{selectedPlan:f,setSelectedPlan:v,ghlLocationId:s})}):e.jsx("div",{className:"min-h-screen bg-[#F8FAFC] flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md w-full bg-white rounded-2xl shadow-xl p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-100 flex items-center justify-center mx-auto mb-6",children:e.jsx(J,{className:"h-8 w-8 text-red-600"})}),e.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Payment System Unavailable"}),e.jsx("p",{className:"text-slate-500 mb-6",children:"We're having trouble connecting to our payment system. Please try again in a few moments."}),e.jsx(F,{onClick:()=>window.location.reload(),className:"w-full bg-blue-600 hover:bg-blue-700 text-white",children:"Try Again"})]})})}export{X 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.