1import{r as n,j as e}from"./vendor-query-BqeRHL1O.js";import"./vendor-react-qkC6yhPU.js";const g="#31363F",s="#FFFFFF",u="rgba(255,255,255,0.6)",A="#16A34A",P="rgba(255,255,255,0.07)",T="rgba(255,255,255,0.15)",O="01KS2QAC0ZSMFVFGHA9XB8SGK9";function q(){const[c,y]=n.useState("gate"),[r,f]=n.useState(""),[o,h]=n.useState(""),[x,b]=n.useState(""),[S,R]=n.useState(!1),[j,m]=n.useState(()=>new URLSearchParams(window.location.search).get("booking_token")||new URLSearchParams(window.location.search).get("payment_intent")?"checking":"not-needed"),w=n.useRef(o),v=n.useRef(r);n.useEffect(()=>{w.current=o},[o]),n.useEffect(()=>{v.current=r},[r]),n.useEffect(()=>{const t=new URLSearchParams(window.location.search);h(t.get("email")??""),f(t.get("name")??"")},[]),n.useEffect(()=>{const t=new URLSearchParams(window.location.search),a=t.get("booking_token");if(!a){t.get("payment_intent")&&m("denied");return}fetch(`/api/business-ideas-session/booking-access?token=${encodeURIComponent(a)}`).then(i=>i.ok?i.json():Promise.reject(new Error("Payment verification failed"))).then(i=>{if(!i.allowed)return m("denied");f(i.name??""),h(i.email??""),m("allowed")}).catch(()=>m("denied"))},[]);function C(t){t.preventDefault();const a=o.trim();if(r.trim(),!a||!a.includes("@")){b("Please enter a valid email address.");return}b(""),y("form")}if(n.useEffect(()=>{if(c!=="form")return;const t=window,a=setTimeout(()=>{typeof t.tf?.load=="function"&&t.tf.load()},150);async function i(p){try{const l=typeof p.data=="string"?JSON.parse(p.data):p.data;if((l?.type==="form-submit"||l?.type==="form-submitted"||l?.["form-submit"]||l?.event&&String(l.event).includes("submit"))&&!S){R(!0);const F=w.current.trim(),z=v.current.trim().split(" ")[0]||void 0;await fetch("/api/questionnaire/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:F,firstName:z})}).catch(()=>{}),y("done")}}catch{}}return window.addEventListener("message",i),()=>{clearTimeout(a),window.removeEventListener("message",i)}},[c,S]),j==="checking")return e.jsx("div",{style:d,children:e.jsx("p",{style:{color:s},children:"Confirming your session accessâ¦"})});if(j==="denied")return e.jsx("div",{style:d,children:e.jsxs("div",{style:{textAlign:"center",maxWidth:440,padding:"2rem 1.5rem"},children:[e.jsx("h1",{style:{color:s,fontFamily:"'Outfit', sans-serif",fontWeight:900,fontSize:"1.8rem",margin:"0 0 0.6rem"},children:"Payment confirmation required"}),e.jsx("p",{style:{color:u,fontSize:"1rem",lineHeight:1.6,margin:0},children:"This preparation is available after booking a completed Business Ideas Session."})]})});if(c==="done")return e.jsx("div",{style:d,children:e.jsxs("div",{style:{textAlign:"center",maxWidth:440,padding:"2rem 1.5rem"},children:[e.jsx("div",{style:B,children:e.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:A,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsx("h1",{style:{color:s,fontFamily:"'Outfit', sans-serif",fontWeight:900,fontSize:"1.8rem",margin:"1.2rem 0 0.6rem"},children:"Questionnaire complete!"}),e.jsxs("p",{style:{color:u,fontSize:"1rem",lineHeight:1.6,margin:0},children:["Thank you",r.trim()?`, ${r.trim().split(" ")[0]}`:"",". We'll be in touch at ",e.jsx("strong",{style:{color:s},children:o.trim()})," with your next steps."]})]})});if(c==="form"){const t=`https://form.typeform.com/to/${O}?email=${encodeURIComponent(o.trim())}&name=${encodeURIComponent(r.trim())}`;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"html, body, #root { margin: 0; padding: 0; height: 100%; }"}),e.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:g},children:e.jsx("iframe",{src:t,style:{width:"100%",height:"100%",border:"none",display:"block"},title:"Business Master Questionnaire",allow:"camera; microphone","data-testid":"iframe-typeform-questionnaire"})})]})}return e.jsx("div",{style:d,children:e.jsxs("div",{style:{width:"100%",maxWidth:420,padding:"2rem 1.5rem"},children:[e.jsxs("div",{style:{marginBottom:"2rem",textAlign:"center"},children:[e.jsx("span",{style:{fontFamily:"'Paytone One', sans-serif",color:s,fontSize:"1.3rem",letterSpacing:"-0.01em"},children:"BUSINESS MASTER"}),e.jsx("h1",{style:{color:s,fontFamily:"'Outfit', sans-serif",fontWeight:900,fontSize:"clamp(1.5rem,4vw,2rem)",margin:"0.8rem 0 0.4rem"},children:"Business Master Preparation"}),e.jsx("p",{style:{color:u,fontSize:"0.95rem",margin:0},children:"Enter your details below to begin."})]}),e.jsxs("form",{onSubmit:C,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:k,children:"Your name"}),e.jsx("input",{type:"text",value:r,onChange:t=>f(t.target.value),placeholder:"Jane Smith",style:E,"data-testid":"input-questionnaire-name",autoComplete:"name"})]}),e.jsxs("div",{children:[e.jsx("label",{style:k,children:"Email address"}),e.jsx("input",{type:"email",value:o,onChange:t=>h(t.target.value),placeholder:"[email protected]",required:!0,style:E,"data-testid":"input-questionnaire-email",autoComplete:"email"})]}),x&&e.jsx("p",{style:{color:"#F87171",fontSize:"0.85rem",margin:0},children:x}),e.jsx("button",{type:"submit",style:W,"data-testid":"button-questionnaire-start",children:"Start Questionnaire â"})]})]})})}const d={minHeight:"100dvh",backgroundColor:g,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"'Outfit', sans-serif",padding:"2rem 1rem"}
1,k={display:"block",color:u,fontSize:"0.8rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"0.4rem"},E={width:"100%",padding:"0.75rem 1rem",borderRadius:8,border:`1px solid ${T}`,backgroundColor:P,color:s,fontSize:"1rem",fontFamily:"'Outfit', sans-serif",outline:"none",boxSizing:"border-box"},W={width:"100%",padding:"0.85rem",borderRadius:8,border:"none",backgroundColor:s,color:g,fontWeight:800,fontSize:"1rem",fontFamily:"'Outfit', sans-serif",cursor:"pointer",marginTop:"0.5rem"},B={width:72,height:72,borderRadius:"50%",backgroundColor:"rgba(22,163,74,0.15)",border:"2px solid rgba(22,163,74,0.35)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto"};export{q 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.