{"version":3,"file":"GetWaitlistForm.7beO8TF7.mjs","names":["useState","email","useCallback"],"sources":["https:/framerusercontent.com/modules/ALP6aduKEQBFUBAOBk6C/WjWPkxlwyHVxo4oYmfQx/GetWaitlistForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * GetWaitlist Form\n *\n * A waitlist signup form that integrates with GetWaitlist.com API.\n * Opens redirect URL synchronously before API call to bypass mobile popup blockers.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function GetWaitlistForm(props){const{waitlistId=\"28766\",redirectUrl=\"https://example.com\",inputPlaceholder=\"Enter your email\",buttonText=\"Join Waitlist\",successAction=\"open_link\",successMessage=\"Thanks for joining!\",layout=\"horizontal\",gap=12,referralCode=\"\",inputBgColor=\"#FFFFFF\",inputTextColor=\"#000000\",inputBorderColor=\"#CCCCCC\",inputBorderRadius=8,inputPadding=12,buttonBgColor=\"#000000\",buttonTextColor=\"#FFFFFF\",buttonBorderRadius=8,buttonPadding=12,errorColor=\"#FF5588\",inputFont,buttonFont}=props;const[email,setEmail]=useState(\"\");const[error,setError]=useState(\"\");const[isSubmitting,setIsSubmitting]=useState(false);const[isSuccess,setIsSuccess]=useState(false);const isHorizontal=layout===\"horizontal\";const validateEmail=email=>{const emailRegex=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;return emailRegex.test(email);};const handleSubmit=useCallback(async e=>{e.preventDefault();// Clear previous errors\nstartTransition(()=>setError(\"\"));// Validate email\nif(!email.trim()){startTransition(()=>setError(\"Please enter your email\"));return;}if(!validateEmail(email)){startTransition(()=>setError(\"Please enter a valid email\"));return;}startTransition(()=>setIsSubmitting(true));// CRITICAL: Open window SYNCHRONOUSLY before async API call\n// This bypasses mobile popup blockers\nlet newWindow=null;if(successAction===\"open_link\"&&typeof window!==\"undefined\"){newWindow=window.open(redirectUrl,\"_blank\");}try{const requestBody={email:email.trim(),waitlist_id:parseInt(waitlistId,10)};if(referralCode){requestBody.referral_link=referralCode;}const response=await fetch(\"https://api.getwaitlist.com/api/v1/signup\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(requestBody)});const data=await response.json();if(!response.ok){throw new Error(data.message||\"Failed to join waitlist\");}// Success - window already opened\nstartTransition(()=>{setIsSuccess(true);setEmail(\"\");});}catch(err){// API failed - close the pre-opened window\nif(newWindow&&!newWindow.closed){newWindow.close();}startTransition(()=>{setError(err.message||\"Something went wrong. Please try again.\");});}finally{startTransition(()=>setIsSubmitting(false));}},[email,waitlistId,redirectUrl,referralCode,successAction]);if(isSuccess&&successAction===\"show_message\"){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"20px\",textAlign:\"center\"},children:/*#__PURE__*/_jsx(\"span\",{style:{...inputFont,color:inputTextColor},children:successMessage})});}return /*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{...props.style,display:\"flex\",flexDirection:isHorizontal?\"row\":\"column\",gap:`${gap}px`,width:\"100%\",alignItems:\"flex-start\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",flex:isHorizontal?1:undefined,width:isHorizontal?\"auto\":\"100%\",minWidth:isHorizontal?\"200px\":undefined},children:[/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>{setEmail(e.target.value);if(error)startTransition(()=>setError(\"\"));},placeholder:inputPlaceholder,disabled:isSubmitting,style:{...inputFont,width:\"100%\",padding:`${inputPadding}px`,borderRadius:`${inputBorderRadius}px`,border:`1px solid ${error?errorColor:inputBorderColor}`,backgroundColor:inputBgColor,color:inputTextColor,outline:\"none\",boxSizing:\"border-box\",opacity:isSubmitting?.6:1},\"aria-label\":\"Email address\",\"aria-invalid\":!!error,\"aria-describedby\":error?\"error-message\":undefined}),error&&/*#__PURE__*/_jsx(\"span\",{id:\"error-message\",style:{color:errorColor,fontSize:\"12px\",marginTop:\"4px\",...inputFont},children:error})]}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isSubmitting,style:{...buttonFont,padding:`${buttonPadding}px ${buttonPadding*2}px`,borderRadius:`${buttonBorderRadius}px`,backgroundColor:buttonBgColor,color:buttonTextColor,border:\"none\",cursor:isSubmitting?\"wait\":\"pointer\",whiteSpace:\"nowrap\",opacity:isSubmitting?.8:1,width:isHorizontal?\"auto\":\"100%\",transition:\"opacity 0.2s\"},children:isSubmitting?\"Joining...\":buttonText})]});}addPropertyControls(GetWaitlistForm,{waitlistId:{type:ControlType.String,title:\"Waitlist ID\",defaultValue:\"28766\",placeholder:\"Enter waitlist ID\"},redirectUrl:{type:ControlType.Link,title:\"Redirect URL\",defaultValue:\"https://example.com\"},inputPlaceholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your email\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Join Waitlist\"},successAction:{type:ControlType.Enum,title:\"On Success\",options:[\"open_link\",\"show_message\"],optionTitles:[\"Open Link\",\"Show Message\"],defaultValue:\"open_link\",displaySegmentedControl:true},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"Thanks for joining!\",displayTextArea:true,hidden:({successAction})=>successAction!==\"show_message\"},layout:{type:ControlType.Enum,title:\"Layout\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\",displaySegmentedControl:true},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:12,min:0,max:50,unit:\"px\"},referralCode:{type:ControlType.String,title:\"Referral Code\",defaultValue:\"\",placeholder:\"Optional tracking code\"},inputBgColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#FFFFFF\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#000000\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#CCCCCC\"},inputBorderRadius:{type:ControlType.Number,title:\"Input Radius\",defaultValue:8,min:0,max:50,unit:\"px\"},inputPadding:{type:ControlType.Number,title:\"Input Padding\",defaultValue:12,min:4,max:40,unit:\"px\"},buttonBgColor:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},buttonBorderRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:8,min:0,max:50,unit:\"px\"},buttonPadding:{type:ControlType.Number,title:\"Button Padding\",defaultValue:12,min:4,max:40,unit:\"px\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#FF5588\"},inputFont:{type:ControlType.Font,title:\"Input Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GetWaitlistForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicHeight\":\"60\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GetWaitlistForm.map"],"mappings":"6MAWG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,aAAW,QAAQ,cAAY,sBAAsB,mBAAiB,mBAAmB,aAAW,gBAAgB,gBAAc,YAAY,iBAAe,sBAAsB,SAAO,aAAa,MAAI,GAAG,eAAa,GAAG,eAAa,UAAU,iBAAe,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