{"version":3,"file":"DownloadForm.Byb1I7_0.mjs","names":["useState","email","error","startTransition"],"sources":["https:/framerusercontent.com/modules/HypCRnbfdiIhse9hgAec/QGSjqZfQJYWySs5NNJzd/DownloadForm.js"],"sourcesContent":["// File download component with email capture and Google Sheets integration\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * File Download with Email Capture\n * \n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 500\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function DownloadForm(props){const{title,description,emailLabel,nameLabel,phoneLabel,buttonText,fileName,fileUrl=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",googleSheetsUrl,showNameField,showPhoneField,backgroundColor,textColor,buttonColor,buttonTextColor,inputBackgroundColor,inputBorderColor,titleFont,bodyFont,buttonFont,borderRadius}=props;const[email,setEmail]=useState(\"\");const[name,setName]=useState(\"\");const[phone,setPhone]=useState(\"\");const[isSubmitting,setIsSubmitting]=useState(false);const[isSubmitted,setIsSubmitted]=useState(false);const[error,setError]=useState(\"\");const isValidEmail=email=>{return/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);};const submitToGoogleSheets=async data=>{if(!googleSheetsUrl)return true;try{const response=await fetch(googleSheetsUrl,{method:\"POST\",mode:\"no-cors\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(data)});return true;}catch(error){console.error(\"Error submitting to Google Sheets:\",error);return false;}};const downloadFile=()=>{if(typeof window!==\"undefined\"){const link=document.createElement(\"a\");link.href=fileUrl;link.download=fileName;document.body.appendChild(link);link.click();document.body.removeChild(link);}};const handleSubmit=async e=>{e.preventDefault();if(!isValidEmail(email)){startTransition(()=>setError(\"Please enter a valid email address\"));return;}startTransition(()=>{setIsSubmitting(true);setError(\"\");});const formData={email,name:showNameField?name:\"\",phone:showPhoneField?phone:\"\",timestamp:new Date().toISOString(),fileName};const success=await submitToGoogleSheets(formData);if(success){downloadFile();startTransition(()=>{setIsSubmitted(true);setIsSubmitting(false);});}else{startTransition(()=>{setError(\"Something went wrong. Please try again.\");setIsSubmitting(false);});}};const inputStyle={width:\"100%\",padding:\"12px 16px\",border:`1px solid ${inputBorderColor}`,borderRadius:borderRadius/2,backgroundColor:inputBackgroundColor,color:textColor,fontSize:\"14px\",outline:\"none\",transition:\"border-color 0.2s ease\"};if(isSubmitted){return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,backgroundColor,borderRadius,padding:\"32px\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",textAlign:\"center\",gap:\"16px\",minHeight:\"200px\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"48px\",marginBottom:\"8px\"},children:\"✅\"}),/*#__PURE__*/_jsx(\"h3\",{style:{...titleFont,color:textColor,margin:0},children:\"Download Started!\"}),/*#__PURE__*/_jsx(\"p\",{style:{...bodyFont,color:textColor,margin:0,opacity:.8},children:\"Your file should start downloading shortly. Thank you for providing your information!\"})]});}return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,backgroundColor,borderRadius,padding:\"32px\",display:\"flex\",flexDirection:\"column\",gap:\"24px\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{textAlign:\"center\",marginBottom:\"8px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{...titleFont,color:textColor,margin:\"0 0 12px 0\"},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{...bodyFont,color:textColor,margin:0,opacity:.8},children:description})]}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:\"16px\"},children:[showNameField&&/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{style:{...bodyFont,color:textColor,display:\"block\",marginBottom:\"6px\",fontSize:\"14px\"},children:nameLabel}),/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:name,onChange:e=>startTransition(()=>setName(e.target.value)),style:inputStyle,placeholder:\"Enter your name\"})]}),/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsxs(\"label\",{style:{...bodyFont,color:textColor,display:\"block\",marginBottom:\"6px\",fontSize:\"14px\"},children:[emailLabel,\" *\"]}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",value:email,onChange:e=>startTransition(()=>setEmail(e.target.value)),style:inputStyle,placeholder:\"Enter your email\",required:true})]}),showPhoneField&&/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"label\",{style:{...bodyFont,color:textColor,display:\"block\",marginBottom:\"6px\",fontSize:\"14px\"},children:phoneLabel}),/*#__PURE__*/_jsx(\"input\",{type:\"tel\",value:phone,onChange:e=>startTransition(()=>setPhone(e.target.value)),style:inputStyle,placeholder:\"Enter your phone number\"})]}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF5588\",fontSize:\"14px\",textAlign:\"center\",padding:\"8px\",backgroundColor:\"rgba(255, 85, 136, 0.1)\",borderRadius:borderRadius/2},children:error}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isSubmitting||!email,style:{...buttonFont,backgroundColor:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:borderRadius/2,padding:\"14px 24px\",cursor:isSubmitting||!email?\"not-allowed\":\"pointer\",opacity:isSubmitting||!email?.6:1,transition:\"all 0.2s ease\",marginTop:\"8px\"},children:isSubmitting?\"Processing...\":buttonText})]}),/*#__PURE__*/_jsx(\"p\",{style:{...bodyFont,color:textColor,fontSize:\"12px\",textAlign:\"center\",margin:0,opacity:.6},children:\"* Required field\"})]});}addPropertyControls(DownloadForm,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Download Our Free Guide\"},description:{type:ControlType.String,title:\"Description\",defaultValue:\"Enter your details below to download the file instantly.\",displayTextArea:true},emailLabel:{type:ControlType.String,title:\"Email Label\",defaultValue:\"Email Address\"},nameLabel:{type:ControlType.String,title:\"Name Label\",defaultValue:\"Full Name\",hidden:({showNameField})=>!showNameField},phoneLabel:{type:ControlType.String,title:\"Phone Label\",defaultValue:\"Phone Number\",hidden:({showPhoneField})=>!showPhoneField},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Download Now\"},fileName:{type:ControlType.String,title:\"File Name\",defaultValue:\"guide.pdf\"},fileUrl:{type:ControlType.File,title:\"File to Download\",allowedFileTypes:[\"pdf\",\"doc\",\"docx\",\"zip\",\"mp3\",\"mp4\",\"jpg\",\"png\"]},googleSheetsUrl:{type:ControlType.String,title:\"Google Sheets URL\",placeholder:\"https://script.google.com/macros/s/...\",description:\"Web app URL from Google Apps Script\"},showNameField:{type:ControlType.Boolean,title:\"Show Name Field\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showPhoneField:{type:ControlType.Boolean,title:\"Show Phone Field\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#FFFFFF\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#EEEEEE\"},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},bodyFont:{type:ControlType.Font,title:\"Body Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{variant:\"Semibold\",fontSize:\"14px\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DownloadForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"500\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadForm.map"],"mappings":"sMASG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,QAAM,cAAY,aAAW,YAAU,aAAW,aAAW,WAAS,UAAQ,qEAAqE,kBAAgB,gBAAc,iBAAe,kBAAgB,YAAU,cAAY,kBAAgB,uBAAqB,mBAAiB,YAAU,WAAS,aAAW,gBAAc,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAK,GAASA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAO,EAAa,GAAc,6BAA6B,KAAKC,EAAM,CAAS,EAAqB,KAAM,IAAM,CAAC,GAAG,CAAC,EAAgB,MAAO,GAAK,GAAG,CAAkJ,OAAlI,MAAM,MAAM,EAAgB,CAAC,OAAO,OAAO,KAAK,UAAU,QAAQ,CAAC,eAAe,mBAAmB,CAAC,KAAK,KAAK,UAAU,EAAK,CAAC,CAAC,CAAQ,SAAYC,EAAM,CAA2D,OAA1D,QAAQ,MAAM,qCAAqCA,EAAM,CAAQ,KAAe,MAAiB,C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