1import{p as je,r as a,j as e,q as ye,s as be,t as Ne,u as ve,f as we,M as Se,o as k,I as C,E as Pe,v as ke,B as y,L as se,e as n,w as z,x as te,D as Q,k as G,l as X,m as Z,n as K}from"./index-DAH87Q8z.js";import{E as Ce,l as ze,u as Ee,a as Ae,P as Ie}from"./react-stripe.esm-D9d503Gh.js";/** 2 * @license lucide-react v0.545.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Re=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Oe=je("shield-check",Re);var De=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fe=De.reduce((l,t)=>{const h=ye(`Primitive.${t}`),r=a.forwardRef((o,c)=>{const{asChild:m,...d}=o,u=m?h:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(u,{...d,ref:c})});return r.displayName=`Primitive.${t}`,{...l,[t]:r}},{}),Te="Separator",ee="horizontal",Me=["horizontal","vertical"],ae=a.forwardRef((l,t)=>{const{decorative:h,orientation:r=ee,...o}=l,c=$e(r)?r:ee,d=h?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return e.jsx(Fe.div,{"data-orientation":c,...d,...o,ref:t})});ae.displayName=Te;function $e(l){return Me.includes(l)}var re=ae;const ie=a.forwardRef(({className:l,orientation:t="horizontal",decorative:h=!0,...r},o)=>e.jsx(re,{ref:o,decorative:h,orientation:t,className:be("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...r}));ie.displayName=re.displayName;let F=null;async function Le(){if(!F){const l=await fetch("/api/stripe/publishable-key"),{publishableKey:t}=await l.json();F=ze(t)}return F}function _e({clientSecret:l,plan:t,billing:h,total:r}){const o=Ee(),c=Ae(),[m,d]=a.useState(!1),[u,g]=a.useState(null),E=async f=>{if(f.preventDefault(),!o||!c)return;d(!0),g(null);const{error:v}=await o.confirmPayment({elements:c,confirmParams:{return_url:`${window.location.origin}/onboarding?payment=success`}});v&&(g(v.message||"An error occurred during payment."),d(!1))};return e.jsxs("form",{onSubmit:E,className:"space-y-6",children:[e.jsx(Ie,{options:{layout:"tabs"}}),u&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-sm",children:u}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsx(te,{size:12}),"Payments are secure and encrypted by Stripe."]}),e.jsx(y,{type:"submit",disabled:!o||m,className:"w-full h-12 text-lg bg-primary hover:bg-primary/90 shadow-lg shadow-primary/20","data-testid":"button-complete-purchase",children:m?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"mr-2 h-5 w-5 animate-spin"}),"Processing..."]}):`Complete Purchase - $${r}`}),e.jsx("p",{className:"text-center text-xs text-gray-400",children:'By clicking "Complete Purchase", you agree to our Terms of Service and Privacy Policy. 30-day money-back guarantee.'})]})}function Be(){const[l]=Ne(),[t,h]=a.useState("pro"),[r,o]=a.useState("monthly"),[c,m]=a.useState(""),[d,u]=a.useState(""),[g,E]=a.useState(""),[f,v]=a.useState(""),[A,ne]=a.useState(!1),[T,le]=a.useState(null),[I,ce]=a.useState(null),[M,$]=a.useState(!1),[L,b]=a.useState(null),[_,oe]=a.useState("account"),[de,R]=a.use
6State(!1),[me,O]=a.useState(!1),[U,xe]=a.useState(!1),[W,he]=a.useState(!1),[B,pe]=a.useState(!1),w=299,S=99,{data:P}=ve({queryKey:["/api/subscription/plans"],queryFn:async()=>{const s=await fetch("/api/subscription/plans");if(!s.ok)throw new Error("Failed to fetch plans");return s.json()}});a.useEffect(()=>{const s=new URLSearchParams(window.location.search),i=s.get("plan"),p=s.get("billing");i&&h(i),p&&o(p);const N=localStorage.getItem("chattolead_demo_agent");if(N)try{const x=JSON.parse(N);if(x.ownerName&&x.ownerName.trim().length>=2){const j=x.ownerName.trim().split(/\s+/);j[0].length>=2&&(j.length>=2?(m(j[0]),u(j.slice(1).join(" "))):j.length===1&&m(j[0]))}}catch(x){console.error("Failed to parse saved demo config:",x)}le(Le())},[l]);const q=s=>{if(P?.plans){if(s==="basic"||s==="starter")return P.plans.find(i=>i.tier==="starter");if(s==="pro"||s==="growth")return P.plans.find(i=>i.tier==="growth");if(s==="agency")return P.plans.find(i=>i.tier==="agency")}},ue=()=>{const s=q(t);if(!s)return t==="basic"||t==="starter"?r==="annual"?39:49:t==="pro"||t==="growth"?r==="annual"?79:99:t==="agency"?r==="annual"?249:299:t==="custom"?0:99;const i=r==="annual",p=s.prices.find(x=>x.interval==="month"),N=s.prices.find(x=>x.interval==="year");return i&&N?Math.round(N.unitAmount/100/12):p?p.unitAmount/100:99},ge=()=>{const s=q(t);return s?s.tier==="agency"?"Unlimited":s.conversations.toString():t==="basic"||t==="starter"?"50":t==="pro"||t==="growth"?"200":"Unlimited"},V=ue(),H=r==="annual"?V*12:V,D=H+(U?w:0)+(W?S:0),fe=async s=>{if(s.preventDefault(),!c||!d||!g||!f){b("Please fill in all fields");return}if(f.length<6){b("Password must be at least 6 characters");return}b(null),R(!0)},J=s=>{R(!1),pe(s),O(!0)},Y=async s=>{O(!1),xe(B),he(s),$(!0),b(null);try{const i=await fetch("/api/subscription/create-embedded",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:g,firstName:c,lastName:d,password:f,plan:t,billing:r,includeAiReview:B,includeWebsiteSetup:s})}),p=await i.json();if(!i.ok)throw new Error(p.error||"Failed to initialize payment");ce(p.clientSecret),oe("payment")}catch(i){b(i.message||"Something went wrong")}finally{$(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50 font-sans selection:bg-primary/20 selection:text-primary-foreground",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:e.jsxs("div",{className:"container mx-auto px-6 h-16 flex items-center justify-between",children:[e.jsx(we,{href:"/",children:e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Se,{size:24,className:"text-primary fill-primary/20"}),e.jsxs("span",{className:"text-xl font-bold tracking-tight font-heading",children:["Chat",e.jsx("span",{className:"text-primary/40",children:"to"}),"Lead",e.jsx("span",{className:"text-primary",children:".ai"})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(Oe,{size:16,className:"text-green-500"}),"Secure Checkout"]})]})}),e.jsx("main",{className:"py-12",children:e.jsx("div",{className:"container mx-auto px-6 max-w-6xl",children:e.jsxs("div",{className:"grid lg:grid-cols-12 gap-12",children:[e.jsxs("div",{className:"lg:col-span-7 space-y-8",children:[_==="account"&&e.jsx("form",{onSubmit:fe,children:e.jsxs("div",{className:"bg-white p-8 rounded-2xl border border-gray-200 shadow-sm",children:[e.jsx("h2",{className:"text-xl font-bold font-heading mb-6",children:"1. Create your account"}),L&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-sm",children:L}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"first-name",children:"First Name"}),e.jsx(C,{id:"first-name",placeholder:"Jane",value:c,onChange:s=>m(s.target.value),"data-testid":"input-first-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:"last-name",children:"Last Name"}),e.jsx(C,{id:"last-name",placeholder:"Doe",value:d,onChange:s=>u(s.target.value),"data-testid":"input-last-name"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(k,{htmlFor:"email",children:"Email Address"}),e.jsx(C,{id:"email",type:"email",placeholder:"[email protected]",value:g,onChange:s=>E(s.target.value),"data-testid":"input-email"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(k,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{id:"password",type:A?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:f,onChange:s=>v(s.target.value),"data-testid":"input-password",className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>ne(!A),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,
6children:A?e.jsx(Pe,{size:18}):e.jsx(ke,{size:18})})]})]})]}),e.jsx(y,{type:"submit",disabled:M,className:"w-full h-12 text-lg mt-6 bg-primary hover:bg-primary/90","data-testid":"button-continue-to-payment",children:M?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"mr-2 h-5 w-5 animate-spin"}),"Setting up..."]}):"Continue to Payment"})]})}),_==="payment"&&I&&T&&e.jsxs("div",{className:"bg-white p-8 rounded-2xl border border-gray-200 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-100 flex items-center justify-center",children:e.jsx(n,{size:16,className:"text-green-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold font-heading",children:"2. Payment Method"}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Account: ",g]})]})]}),e.jsx(Ce,{stripe:T,options:{clientSecret:I,appearance:{theme:"stripe",variables:{colorPrimary:"#6366f1",borderRadius:"8px"}}},children:e.jsx(_e,{clientSecret:I,plan:t,billing:r,total:D})})]})]}),e.jsx("div",{className:"lg:col-span-5",children:e.jsxs("div",{className:"bg-white p-8 rounded-2xl border border-gray-200 shadow-lg sticky top-24",children:[e.jsx("h3",{className:"text-lg font-bold font-heading mb-6",children:"Order Summary"}),e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-bold text-primary capitalize","data-testid":"text-plan-name",children:[t," Plan"]}),e.jsxs("p",{className:"text-sm text-gray-500 capitalize","data-testid":"text-billing-type",children:[r," billing"]})]}),e.jsx("div",{className:"text-right",children:t==="custom"?e.jsx("p",{className:"font-bold text-lg",children:"Contact Sales"}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"font-bold text-lg","data-testid":"text-total-price",children:["$",D]}),e.jsxs("p",{className:"text-xs text-gray-400",children:["/",r==="annual"?"year":"month"]})]})})]}),e.jsxs("ul",{className:"space-y-3 mb-6",children:[e.jsxs("li",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(n,{size:16,className:"text-green-500"}),ge()," Conversations"]}),e.jsxs("li",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(n,{size:16,className:"text-green-500"}),"AI Agent Builder"]}),e.jsxs("li",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(n,{size:16,className:"text-green-500"}),"24/7 Support"]})]}),e.jsx(ie,{className:"my-6"}),t!=="custom"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-gray-600",children:[t.charAt(0).toUpperCase()+t.slice(1)," Plan (",r,")"]}),e.jsxs("span",{className:"font-medium",children:["$",H]})]}),U&&e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-gray-600 flex items-center gap-1",children:[e.jsx(z,{size:14,className:"text-amber-500"}),"AI Engineer Review"]}),e.jsxs("span",{className:"font-medium",children:["$",w]})]}),W&&e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"text-gray-600 flex items-center gap-1",children:[e.jsx(n,{size:14,className:"text-blue-500"}),"Website Setup Service"]}),e.jsxs("span",{className:"font-medium",children:["$",S]})]}),e.jsxs("div",{className:"flex justify-between items-center mb-4 pt-4 border-t border-gray-100",children:[e.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Total due today"}),e.jsxs("span",{className:"text-2xl font-bold text-primary","data-testid":"text-total-due",children:["$",D]})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 pt-4 border-t border-gray-100",children:[e.jsx("img",{src:"https://js.stripe.com/v3/fingerprinted/img/visa-729c05c240c4bdb47b03ac81d9945bfe.svg",alt:"Visa",className:"h-6"}),e.jsx("img",{src:"https://js.stripe.com/v3/fingerprinted/img/mastercard-4d8844094130711885b5e41b28c9848f.svg",alt:"Mastercard",className:"h-6"}),e.jsx("img",{src:"https://js.stripe.com/v3/fingerprinted/img/amex-a49b82f46c5cd6a96a6e418a6ca1717c.svg",alt:"Amex",className:"h-6"}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-400",children:[e.jsx(te,{size:10}),"Secured by Stripe"]})]})]})})]})})}),e.jsx(Q,{open:de,onOpenChange:R,children:e.jsx(G,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden p-0",children:e.jsxs("div",{className:"overflow-y-auto max-h-[90vh] p-6",children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"flex items-center gap-2 text-xl",children:[e.jsx(z,{className:"text-amber-500",size:24}),"Exclusive One-Time Offer"]}),e.jsx(K,{className:"text-base pt-2",children:"Available only during checkout - this offer won't be shown again."})]}),e.jsxs("div",{className:"py-4",children:[e.jsxs("div",{className:"bg-gradient-to-br from-amber-50 to-orange-50 border border-amber-200 rounded-xl p-6 mb-6",children:[e.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-3",children:"AI Engineer Review & Optimization"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Have one of our AI engineers personally review your agent configuration and fine-tune it based on insights from hundreds of successful businesses in your industry."}),e.jsxs("ul",{className:"space-y-2 mb-4",children:[e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Expert review of your agent's responses and goals"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Optimization based on industry best practices"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Higher conversion rates from day one"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Delivered within 48 hours of signup"})]})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-bold text-gray-900",children:["$",w]}),e.jsx("span",{className:"text-gray-500",children:"one-time"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(y,{onClick:()=>J(!0),className:"w-full h-12 bg-amber-500 hover:bg-amber-600 text-white shadow-lg","data-testid":"button-accept-upsell",children:[e.jsx(z,{className:"mr-2",size:18}),"Yes, Add AI Review (+$",w,")"]}),e.jsx(y,{onClick:()=>J(!1),variant:"ghost",className:"w-full text-gray-500 hover:text-gray-700","data-testid":"button-decline-upsell",children:"No thanks, continue without"})]})]})]})})}),e.jsx(Q,{open:me,onOpenChange:O,children:e.jsx(G,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden p-0",children:e.jsxs("div",{className:"overflow-y-auto max-h-[90vh] p-6",children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"flex items-center gap-2 text-xl",children:[e.jsx(z,{className:"text-blue-500",size:24}),"Wait, One More Thing!"]}),e.jsx(K,{className:"text-base pt-2",children:"This is a one-time offer - it won't be available again after checkout."})]}),e.jsxs("div",{className:"py-4",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 border border-blue-200 rounded-xl p-6 mb-6",children:[e.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-3",children:"Done-For-You Website Setup"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Not tech-savvy? No problem! Our team will install and configure your AI agent on your website so you don't have to lift a finger."}),e.jsxs("ul",{className:"space-y-2 mb-4",children:[e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Full installation on your website (WordPress, Wix, Shopify, etc.)"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Custom positioning and styling to match your brand"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Testing to ensure everything works perfectly"})]}),e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(n,{size:16,className:"text-green-500 mt-0.5 shrink-0"}),e.jsx("span",{children:"Completed within 24-48 hours"})]})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-bold text-gray-900",children:["$",S]}),e.jsx("span",{className:"text-gray-500",children:"one-time"})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(y,{onClick:()=>Y(!0),className:"w-full h-12 bg-blue-500 hover:bg-blue-600 text-white shadow-lg","data-testid":"button-accept-setup",children:[e.jsx(n,{className:"mr-2",size:18}),"Yes, Set It Up For Me (+$",S,")"]}),e.jsx(y,{onClick:()=>Y(!1),variant:"ghost",className:"w-full text-gray-500 hover:text-gray-700","data-testid":"button-decline-setup",children:"No thanks, I'll do it myself"})]})]})]})})})]})}export{Be 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.