{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/wYZwo4GtwGYiTl1E6oOV/WTjwsNKAkH81AlbsXrGH/Form.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DynamicForm({style,webhookURL,fields,borderColor,fillColor,textColor,cornerRadius,redirectURL}){const[formData,setFormData]=useState({});const[submitStatus,setSubmitStatus]=useState(null);const handleSubmit=async e=>{e.preventDefault();const emailField=fields.find(field=>field.type===\"email\");if(emailField){const email=formData[emailField.label];if(email){const domain=email.split(\"@\")[1];const forbiddenDomains=[\"gmail.com\",\"hotmail.com\",\"yahoo.com\",\"outlook.com\",\"icloud.com\",\"msn.com\"];if(forbiddenDomains.includes(domain)){setSubmitStatus(\"Please enter your work email.\");return;}}}const urlParams=new URLSearchParams(window.location.search);const utmParams={};urlParams.forEach((value,key)=>{if(key.startsWith(\"utm_\")){utmParams[key]=value;}});try{const dataToSend={...formData,...utmParams,userAgent:navigator.userAgent,pageURL:window.location.href};await fetch(webhookURL,{method:\"POST\",mode:\"no-cors\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify(dataToSend)});window.location.href=redirectURL// Redirecting the user\n;}catch(error){setSubmitStatus(\"Something went wrong. Please try again.\");}};const handleChange=(e,fieldName)=>{setFormData({...formData,[fieldName]:e.target.value});};return /*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{width:\"100%\"},children:[fields.map((field,index)=>{let inputElement;switch(field.type){case\"email\":case\"text\":inputElement=/*#__PURE__*/_jsx(\"input\",{type:field.type,required:field.required,placeholder:field.placeholder,name:field.label,onChange:e=>handleChange(e,field.label),style:{borderStyle:\"solid\",borderWidth:\"1px\",borderColor,backgroundColor:fillColor,color:textColor,borderRadius:cornerRadius+\"px\",width:\"100%\",padding:\"10px\",marginBottom:\"16px\"}});break;case\"phone\":inputElement=/*#__PURE__*/_jsx(\"input\",{type:\"tel\",pattern:\"^[+0-9]+$\",required:field.required,placeholder:field.placeholder,name:field.label,onChange:e=>handleChange(e,field.label),style:{borderStyle:\"solid\",borderWidth:\"1px\",borderColor,backgroundColor:fillColor,color:textColor,borderRadius:cornerRadius+\"px\",width:\"100%\",padding:\"10px\",marginBottom:\"16px\"}});break;case\"dropdown\":inputElement=/*#__PURE__*/_jsx(\"select\",{required:field.required,name:field.label,onChange:e=>handleChange(e,field.label),style:{borderWidth:\"1px\",borderColor,backgroundColor:fillColor,color:textColor,borderRadius:cornerRadius+\"px\",width:\"100%\",padding:\"10px\",marginBottom:\"16px\"},children:field.options.map(option=>/*#__PURE__*/_jsx(\"option\",{value:option,children:option}))});break;case\"textArea\":inputElement=/*#__PURE__*/_jsx(\"textarea\",{required:field.required,placeholder:field.placeholder,name:field.label,maxLength:150,onChange:e=>handleChange(e,field.label),style:{borderWidth:\"1px\",borderColor,backgroundColor:fillColor,color:textColor,borderRadius:cornerRadius+\"px\",width:\"100%\",padding:\"10px\",marginBottom:\"16px\",resize:\"vertical\"}});break;default:return null;}return /*#__PURE__*/_jsxs(\"div\",{style:style,children:[/*#__PURE__*/_jsx(\"label\",{style:{fontWeight:\"600\",marginBottom:\"8px\",display:\"block\",color:textColor},children:field.label}),field.description&&/*#__PURE__*/_jsx(\"div\",{style:{marginBottom:\"5px\",color:textColor},children:field.description}),inputElement]},index);}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{fontWeight:\"600\",border:\"none\",background:\"#0D0F42\",color:\"#fff\",borderRadius:cornerRadius+\"px\",padding:\"10px\",width:\"100%\",cursor:\"pointer\"},children:\"Submit\"})]}),submitStatus&&/*#__PURE__*/_jsx(\"p\",{style:{color:\"red\"},children:submitStatus})]});}DynamicForm.displayName=\"Form\";addPropertyControls(DynamicForm,{webhookURL:{type:ControlType.String,title:\"Webhook URL\"},redirectURL:{type:ControlType.String,title:\"Redirect URL\"},fields:{type:ControlType.Array,title:\"Fields\",propertyControl:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\"},type:{type:ControlType.Enum,options:[\"email\",\"dropdown\",\"phone\",\"textArea\",\"text\"],optionTitles:[\"Email\",\"Dropdown\",\"Phone Number\",\"Message (Text Area)\",\"Plain Text\"],title:\"Type\"},description:{type:ControlType.String,title:\"Description\",displayTextArea:true,optional:true},options:{type:ControlType.Array,title:\"Options\",control:{type:ControlType.String},optional:true},required:{type:ControlType.Boolean,title:\"Required\"},placeholder:{type:ControlType.String,title:\"Placeholder\",optional:true}}}},borderColor:{type:ControlType.Color,title:\"Border Color\"},fillColor:{type:ControlType.Color,title:\"Fill Color\"},textColor:{type:ControlType.Color,title:\"Text Color\"},cornerRadius:{type:ControlType.Number,title:\"Corner Radius\",min:0,max:100,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Form.map"],
  "mappings": "uJAGkB,SAARA,EAA6B,CAAC,MAAAC,EAAM,WAAAC,EAAW,OAAAC,EAAO,YAAAC,EAAY,UAAAC,EAAU,UAAAC,EAAU,aAAAC,EAAa,YAAAC,CAAW,EAAE,CAAC,GAAK,CAACC,EAASC,CAAW,EAAEC,EAAS,CAAC,CAAC,EAAO,CAACC,EAAaC,CAAe,EAAEF,EAAS,IAAI,EAAQG,EAAa,MAAM,GAAG,CAAC,EAAE,eAAe,EAAE,IAAMC,EAAWZ,EAAO,KAAKa,GAAOA,EAAM,OAAO,OAAO,EAAE,GAAGD,EAAW,CAAC,IAAME,EAAMR,EAASM,EAAW,KAAK,EAAE,GAAGE,EAAM,CAAC,IAAMC,EAAOD,EAAM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AAY,CAAC,KAAKA,EAAY,MAAM,MAAM,cAAc,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,MAAM,YAAY,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,MAAM,YAAY,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,MAAM,gBAAgB,IAAI,EAAE,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC",
  "names": ["DynamicForm", "style", "webhookURL", "fields", "borderColor", "fillColor", "textColor", "cornerRadius", "redirectURL", "formData", "setFormData", "ye", "submitStatus", "setSubmitStatus", "handleSubmit", "emailField", "field", "email", "domain", "urlParams", "window", "utmParams", "value", "key", "dataToSend", "navigator", "handleChange", "fieldName", "u", "index", "inputElement", "p", "e", "option", "addPropertyControls", "ControlType"]
}
