{"version":3,"file":"WaitlisterComponent.C1o7bUPe.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/aG8ldMM45QOkFC4l81Ky/50k0oc6zlSPVq5FwX7wK/WaitlisterComponent.js"],"sourcesContent":["// WaitlisterComponent.tsx\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function WaitlisterForm({waitlistKey=\"\",formType=\"inline\",redirectOption=\"redirect\",primaryColor=\"#000000\",buttonTextColor=\"#ffffff\",buttonText=\"Join Waitlist\",placeholderText=\"Enter your email\",showNameField=true,showPhoneField=true}){const[email,setEmail]=useState(\"\");const[formData,setFormData]=useState({email:\"\",name:\"\",phone:\"\"});const[loading,setLoading]=useState(false);const[success,setSuccess]=useState(false);const[error,setError]=useState(\"\");const[referralCode,setReferralCode]=useState(null);// Extract referral code from URL on mount\nuseEffect(()=>{if(typeof window!==\"undefined\"){const params=new URLSearchParams(window.location.search);const ref=params.get(\"ref\");if(ref){setReferralCode(ref);}}},[]);const handleSubmit=async e=>{e.preventDefault();setLoading(true);setError(\"\");const endpoint=`https://waitlister.me/s/${waitlistKey}`;// For stacked form, only send fields that are shown\nlet dataToSend;if(formType===\"inline\"){dataToSend={email};}else{dataToSend={email:formData.email};if(showNameField)dataToSend.name=formData.name;if(showPhoneField)dataToSend.phone=formData.phone;}// Add referral code if present\nif(referralCode){dataToSend.ref=referralCode;}try{const response=await fetch(endpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(dataToSend)});if(response.ok){const data=await response.json();setSuccess(true);if(redirectOption===\"redirect\"&&data.redirectUrl){setTimeout(()=>{window.location.href=data.redirectUrl;},800);}else{if(formType===\"inline\"){setEmail(\"\");}else{setFormData({email:\"\",name:\"\",phone:\"\"});}setTimeout(()=>setSuccess(false),3e3);}}else{const data=await response.json().catch(()=>({}));setError(data.message||\"Something went wrong. Please try again.\");}}catch(err){setError(\"Failed to join waitlist. Please try again.\");}finally{setLoading(false);}};const handleChange=e=>{setFormData({...formData,[e.target.name]:e.target.value});};if(formType===\"inline\"){return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",maxWidth:\"600px\"},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",gap:\"0\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",placeholder:placeholderText,value:email,onChange:e=>setEmail(e.target.value),required:true,disabled:success,\"aria-label\":\"Email address\",style:{flex:1,padding:\"12px 16px\",fontSize:\"15px\",border:\"1px solid #d1d5db\",borderRight:\"none\",borderTopLeftRadius:\"8px\",borderBottomLeftRadius:\"8px\",outline:\"none\",transition:\"border 0.2s\"},onFocus:e=>e.target.style.borderColor=primaryColor,onBlur:e=>e.target.style.borderColor=\"#d1d5db\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading||success,style:{padding:\"12px 24px\",fontSize:\"15px\",fontWeight:\"600\",color:buttonTextColor,background:primaryColor,border:\"none\",borderTopRightRadius:\"8px\",borderBottomRightRadius:\"8px\",cursor:loading||success?\"default\":\"pointer\",transition:\"all 0.2s\",whiteSpace:\"nowrap\"},children:success?\"Success!\":loading?\"Loading...\":buttonText})]}),error&&/*#__PURE__*/_jsx(\"p\",{style:{color:\"#ef4444\",fontSize:\"13px\",margin:\"8px 0 0 0\"},children:error})]});}// Stacked/Multi-field form with conditional fields\nreturn /*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:\"12px\",width:\"100%\",maxWidth:\"480px\"},children:[showNameField&&/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:\"name\",placeholder:\"Full name\",value:formData.name,onChange:handleChange,\"aria-label\":\"Full name\",style:{padding:\"12px 16px\",fontSize:\"15px\",border:\"1px solid #d1d5db\",borderRadius:\"8px\",outline:\"none\"}}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:\"email\",placeholder:\"Email address\",value:formData.email,onChange:handleChange,required:true,\"aria-label\":\"Email address\",style:{padding:\"12px 16px\",fontSize:\"15px\",border:\"1px solid #d1d5db\",borderRadius:\"8px\",outline:\"none\"}}),showPhoneField&&/*#__PURE__*/_jsx(\"input\",{type:\"tel\",name:\"phone\",placeholder:\"Phone (optional)\",value:formData.phone,onChange:handleChange,\"aria-label\":\"Phone number\",style:{padding:\"12px 16px\",fontSize:\"15px\",border:\"1px solid #d1d5db\",borderRadius:\"8px\",outline:\"none\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:loading||success,style:{padding:\"12px 24px\",fontSize:\"15px\",fontWeight:\"600\",color:buttonTextColor,background:primaryColor,border:\"none\",borderRadius:\"8px\",cursor:loading||success?\"not-allowed\":\"pointer\"},children:success?\"Success!\":loading?\"Submitting...\":buttonText}),error&&/*#__PURE__*/_jsx(\"p\",{style:{color:\"#ef4444\",fontSize:\"13px\",margin:\"0\"},children:error})]});}// Add property controls so users can edit these in Framer\naddPropertyControls(WaitlisterForm,{waitlistKey:{type:ControlType.String,title:\"Waitlist Key\",defaultValue:\"\",placeholder:\"your-waitlist-key\"},formType:{type:ControlType.Enum,title:\"Form Type\",options:[\"inline\",\"stacked\"],optionTitles:[\"Inline (Email Only)\",\"Multi-Field\"],defaultValue:\"inline\"},showNameField:{type:ControlType.Boolean,title:\"Show Name Field\",defaultValue:true,hidden:props=>props.formType===\"inline\"},showPhoneField:{type:ControlType.Boolean,title:\"Show Phone Field\",defaultValue:true,hidden:props=>props.formType===\"inline\"},redirectOption:{type:ControlType.Enum,title:\"After Submission\",options:[\"inline\",\"redirect\"],optionTitles:[\"Success Message\",\"Redirect to Thank You\"],defaultValue:\"redirect\"},primaryColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#ffffff\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Join Waitlist\"},placeholderText:{type:ControlType.String,title:\"Placeholder Text\",defaultValue:\"Enter your email\",hidden:props=>props.formType===\"stacked\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WaitlisterForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WaitlisterComponent.map"],"mappings":"4LACmJ,SAAwB,EAAe,CAAC,cAAY,GAAG,WAAS,SAAS,iBAAe,WAAW,eAAa,UAAU,kBAAgB,UAAU,aAAW,gBAAgB,kBAAgB,mBAAmB,gBAAc,GAAK,iBAAe,IAAM,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAO,CAAC,EAAS,GAAaA,EAAS,CAAC,MAAM,GAAG,KAAK,GAAG,MAAM,EAAE,CAAC,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAO,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAO,CAAC,EAAa,GAAiBA,EAAS,IAAI,EAC3pB,MAAc,CAAC,GAAU,IAAS,OAAY,CAA0D,IAAM,EAAI,IAAlD,gBAAgB,EAAO,SAAS,MAAuB,CAAC,CAAC,IAAI,KAAK,EAAK,GAAK,EAAgB,CAAG,CAAG,CAAC,EAAE,CAAC,CAAC,EAAE,IAAM,EAAa,KAAM,IAAG,CAAC,EAAE,eAAe,EAAE,EAAW,EAAI,EAAE,EAAS,EAAE,EAAE,IAAM,EAAS,2BAA2B,IAC7R,EAAc,IAAW,SAAU,EAAW,CAAC,OAAK,GAAQ,EAAW,CAAC,MAAM,EAAS,KAAK,EAAK,IAAc,EAAW,KAAK,EAAS,MAAQ,IAAe,EAAW,MAAM,EAAS,QAC1L,IAAc,EAAW,IAAI,GAAc,GAAG,CAAC,IAAM,EAAS,MAAM,MAAM,EAAS,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,kBAAkB,EAA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