{"version":3,"file":"MailChimpForm.DIVAbsp7.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Z4iCc0wjyYpBQm3Qv8ws/WQDJtLJoD2fm58kViEzy/MailChimpForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const formStyle={display:\"flex\",flexDirection:\"column\",width:\"100%\",gap:\"10px\"};const inputStyle={padding:\"12px\",borderRadius:\"8px\",border:\"1px solid #CCC\",fontSize:\"16px\",outline:\"none\",fontFamily:\"Manrope\"};const buttonStyle={padding:\"12px\",borderRadius:\"32px\",border:\"none\",backgroundColor:\"#000\",color:\"#FFF\",cursor:\"pointer\",fontFamily:\"IBM Plex Mono\"};const messageContainerStyle={padding:\"12px\",borderRadius:\"8px\",border:\"1px solid #CCC\",backgroundColor:\"#EEE\",textAlign:\"left\",fontSize:\"16px\",fontFamily:\"Manrope\"};const errorMessageStyle={color:\"#FF4444\",fontSize:\"16px\",marginTop:\"8px\",fontFamily:\"Manrope\"};export default function MailchimpForm(props){const{url,placeholder,buttonText,successBody,errorText,botField}=props;// Form states: \"input\", \"wait\", \"success\", \"error\"\nconst[formState,setFormState]=useState(\"input\");const handleSubmit=async e=>{e.preventDefault();const formData=new FormData(e.currentTarget);const email=formData.get(\"EMAIL\");const honey=formData.get(botField);if(honey){setFormState(\"success\");return;}setFormState(\"wait\");const endpoint=url.replace(\"/post?\",\"/post-json?\");const callbackName=`jsonp_callback_${Math.round(1e5*Math.random())}`;const script=document.createElement(\"script\");window[callbackName]=data=>{delete window[callbackName];document.body.removeChild(script);if(data.result===\"success\"){setFormState(\"success\");}else{setFormState(\"error\");}};script.src=`${endpoint}&EMAIL=${encodeURIComponent(email)}&c=${callbackName}`;document.body.appendChild(script);};// Show success\nif(formState===\"success\"){return /*#__PURE__*/_jsxs(\"div\",{style:formStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:messageContainerStyle,children:/*#__PURE__*/_jsx(\"p\",{style:{margin:0,opacity:.8},children:successBody})}),/*#__PURE__*/_jsx(\"button\",{onClick:()=>setFormState(\"input\"),style:buttonStyle,children:\"← BACK\"})]});}// Show form\nreturn /*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:formStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"-5000px\"},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"input\",{type:\"text\",name:\"b_4eb87432a21f298074d807439_2af42dd078\",tabIndex:\"-1\"})}),/*#__PURE__*/_jsx(\"input\",{name:\"EMAIL\",type:\"email\",placeholder:placeholder,required:true,style:inputStyle}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:formState===\"wait\",style:buttonStyle,children:formState===\"wait\"?\"...\":buttonText}),formState===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:errorMessageStyle,children:errorText})]});}MailchimpForm.defaultProps={url:\"https://epiclife.us18.list-manage.com/subscribe/post?u=4eb87432a21f298074d807439&id=2af42dd078&f_id=00e1b6e6f0\",placeholder:\"Your email address\",buttonText:\"SUBSCRIBE\",successBody:\"Check your inbox to confirm your subscription.\",errorText:\"Oops! Please check your email and try again.\"};addPropertyControls(MailchimpForm,{url:{type:ControlType.String,title:\"Mailchimp URL\"},placeholder:{type:ControlType.String,title:\"Placeholder\"},buttonText:{type:ControlType.String,title:\"Button Text\"},successBody:{type:ControlType.String,title:\"Success Body\"},errorText:{type:ControlType.String,title:\"Error Text\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MailchimpForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MailChimpForm.map"],"mappings":"0LAAmvB,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,MAAI,cAAY,aAAW,cAAY,YAAU,YAAU,EAC51B,CAAC,EAAU,GAAcA,E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