{"version":3,"file":"CustomForm.Cfm0G235.mjs","names":["useState","restrictedDomains","_Fragment"],"sources":["https:/framerusercontent.com/modules/jZU9mmmml35g2nANfNSz/sUihqslzf7Fi1x92o6uG/CustomForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";const calendlyURL=`https://calendly.com/standardfusion-sales/quick-call`;const restrictedDomains=[\"gmail.com\",\"gmail.us\",\"yahoo.com\",\"hotmail.com\",\"aol.com\",\"hotmail.co.uk\",\"hotmail.fr\",\"msn.com\",\"yahoo.fr\",\"wanadoo.fr\",\"orange.fr\",\"comcast.net\",\"yahoo.co.uk\",\"yahoo.com.br\",\"yahoo.co.in\",\"live.com\",\"outlook.com\",\"live.ca\",\"yahoo.ca\",\"mailinator.com\",\"binkmail.com\",\"bobmail.info\",\"chammy.info\",\"devnullmail.com\",\"letthemeatspam.com\",\"mailinater.com\",\"mailinator.net\",\"mailinator2.com\",\"notmailinator.com\",\"reallymymail.com\",\"reconmail.com\",\"safetymail.info\",\"sendspamhere.com\",\"sogetthis.com\",\"spambooger.com\",\"spamherelots.com\",\"spamhereplease.com\",\"spamthisplease.com\",\"streetwisemail.com\",\"suremail.info\",\"thisisnotmyrealemail.com\",\"tradermail.info\",\"veryrealemail.com\",\"zippymail.info\"];const useCalendlyStore=createStore({calendlyInstance:null,submitData:null,name:null,email:null,company:null,phone:null});export function SFCustomForm(props){const[showDownload,setShowDownload]=useState(false);const[showCalendly,setShowCalendly]=useState(false);const[showForm,setShowForm]=useState(true);const[formKey,setFormKey]=useState(0);const breakpoints=props.breakpoints;const[emailError,setEmailError]=useState(\"\");function validateEmail(email){if(!email||email==\"\")return\"Invalid Email\";const domain=email.split(\"@\")[1].toLowerCase();if(restrictedDomains.includes(domain)){return\"Please use a business email.\";}return\"\";}function updateCalendly(data){if(!props.calendlyInstance||props.calendlyInstance.length<1)return;let calendly=props.calendlyInstance[0].props.children.props.children;let container=props.calendlyInstance[0].props.children.props;setTimeout(()=>{let containerElement=document.getElementsByClassName(container.className)[0];containerElement.style.width=\"auto\";},200);// Clear existing query params\nlet calendarUrl=calendly.props.calendar.split(\"?\")[0];calendarUrl+=`?name=${data.name}&email=${data.email}`;calendly.props.calendar=calendarUrl;setShowForm(false);setShowCalendly(true);}function triggerLuckyOrange(data){if(typeof LO==\"undefined\")return;LO.events.track(\"Form Submit\",data);}function triggerLeadBoxer(data){if(typeof OTMap!=\"undefined\"&&typeof OTLogService!==\"undefined\"){var map=new OTMap;map.put(\"name\",data.name);map.put(\"email\",data.email);// TODO: Company?\nmap.put(\"company\",data.company);OTLogService.sendEvent(\"Form Submit\",map);}}function triggerGTM(data){if(typeof dataLayer==\"undefined\")return;dataLayer.push({event:\"sf-framer-form-submitted\",detail:{form:window.location.href,name:data.name,email:data.email}});}function onFormSubmit(data){console.log(\"Custom form submit!\");const name=data.target[0].value;const email=data.target[1].value;const company=data.target[1].value;const error=validateEmail(email);const userData={name:name,email:email,company:company};if(error!=\"\"){console.log(\"Invalid email detected\");// setEmailError(error)\nreturn true;}setEmailError(\"\");// These needs to happen after form submits (this function returns true)\nsetTimeout(()=>{triggerGTM(userData);triggerLeadBoxer(userData);updateCalendly(userData);updateDownload();triggerLuckyOrange(userData);},100);return true;}function updateDownload(){if(!props.pdfPath||props.pdfPath==\"\")return;setShowDownload(true);}function bindForm(){var form=props.desktopForm[0];if(form){let formInst=document.querySelector(`#${props.id} form`);if(!formInst){console.error(\"Could not find form\");return;}formInst.addEventListener(\"submit\",onFormSubmit);console.log(\"Form bound\");}}useEffect(()=>{setTimeout(()=>{bindForm();},100);},[]);if(RenderTarget.current()==RenderTarget.canvas&&props.desktopForm.length<1){return /*#__PURE__*/_jsx(\"div\",{style:{padding:15,fontSize:20,border:2,borderWidth:2,borderColor:\"#333\",backgroundColor:\"rgba(3, 3, 3, .1)\"},children:\"Connect a Form to this Component\"});}function Form(){let currentForm=props.desktopForm;return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\"},id:\"sf-custom-form\",children:showForm&&currentForm});}useEffect(()=>{if(typeof window==\"undefined\"){setTimeout(()=>{setFormKey(k=>k+1);},50);}});return /*#__PURE__*/_jsxs(\"div\",{id:props.id,children:[/*#__PURE__*/_jsx(Form,{},formKey),/*#__PURE__*/_jsx(\"div\",{children:showCalendly&&props.calendlyInstance}),/*#__PURE__*/_jsx(\"div\",{id:\"sf-custom-form__download\",children:/*#__PURE__*/_jsx(\"a\",{hidden:!showDownload,target:\"_blank\",href:props.pdfPath,children:\"Download\"})})]});}SFCustomForm.defaultProps={id:\"\",desktopForm:null,breakpoints:{tablet:1400,phone:810},pdfPath:\"\",onFormSubmit:null};addPropertyControls(SFCustomForm,{id:{type:ControlType.String,description:\"ID of the wrapper\",defaultValue:\"sfcustomform\"},breakpoints:{type:ControlType.Object,optional:true,controls:{tablet:{type:ControlType.Number,defaultValue:1400},phone:{type:ControlType.Number,defaultValue:810}}},desktopForm:{type:ControlType.ComponentInstance,description:\"Form to bind on desktop size\"},tabletForm:{type:ControlType.ComponentInstance,description:\"Form to bind on tablet size\"},phoneForm:{type:ControlType.ComponentInstance,description:\"Form to bind on phone size\"},calendlyInstance:{type:ControlType.ComponentInstance,description:\"Calendly Instance\"},pdfPath:{type:ControlType.File,allowedFileTypes:[\"pdf\"]}});export function variantOverride(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,variant:\"Tablet\"});};}// const Overlay = ({ children, blockDocumentScrolling, enabled = true }) => {\n//     const [visible, setVisible] = useOverlayState({\n//         blockDocumentScrolling,\n//     })\n//     return children({\n//         hide: () => setVisible(false),\n//         show: () => setVisible(true),\n//         toggle: () => setVisible(!visible),\n//         visible: enabled && visible,\n//     })\n// }\nexport function withCustomOverlay(Component){return props=>{const[showOverlay,setShowOverlay]=useState(true);return /*#__PURE__*/_jsx(AnimatePresence,{children:/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:\"fixed\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundColor:\"rgba(0,0,0,0.5)\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(Component,{...props})})});};}export function withDefaultBehavor(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props});};}export function withAutoSizing(Component){return props=>{return /*#__PURE__*/_jsx(Component,{style:{width:\"100%\",position:\"relative\"},...props});};}// Validate email input in a form\nexport function withEmailValidation(Component){const restrictedDomains=[\"gmail.com\",\"yahoo.com\",\"hotmail.com\"];function validateEmail(email){if(!email||email==\"\")return\"\";const domain=email.split(\"@\")[1];if(restrictedDomains.includes(domain)){return\"Please use a business email\";}return\"\";}return props=>{function onInputChange(event){setErrorMsg(validateEmail(event.target.value));}const[errorMsg,setErrorMsg]=useState(\"\");return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(Component,{...props,onChange:onInputChange}),/*#__PURE__*/_jsx(\"div\",{hidden:errorMsg===\"\",children:/*#__PURE__*/_jsx(\"div\",{children:errorMsg})})]});};}export function withURLValue(Component){let url=window?window.location.href:\"\";return props=>{setTimeout(()=>{let targetInput=document.querySelector(`.${props.className} input`);if(targetInput&&targetInput.value){targetInput.value=url;}},50);return /*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsx(\"input\",{name:\"url\",type:\"hidden\",value:url})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"SFCustomForm\":{\"type\":\"reactComponent\",\"name\":\"SFCustomForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"withURLValue\":{\"type\":\"reactHoc\",\"name\":\"withURLValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDefaultBehavor\":{\"type\":\"reactHoc\",\"name\":\"withDefaultBehavor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEmailValidation\":{\"type\":\"reactHoc\",\"name\":\"withEmailValidation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoSizing\":{\"type\":\"reactHoc\",\"name\":\"withAutoSizing\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"variantOverride\":{\"type\":\"reactHoc\",\"name\":\"variantOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCustomOverlay\":{\"type\":\"reactHoc\",\"name\":\"withCustomOverlay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomForm.map"],"mappings":"sTAA+rC,SAAgB,EAAa,EAAM,CAAC,GAAK,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAK,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAmB,EAAM,YAAY,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAG,CAAC,SAAS,EAAc,EAAM,CAAC,GAAG,CAAC,GAAO,GAAO,GAAG,MAAM,gBAAgB,IAAM,EAAO,EAAM,MAAM,IAAI,CAAC,GAAG,aAAa,CAA8E,OAA1E,EAAkB,SAAS,EAAO,CAAQ,+BAAsC,GAAI,SAAS,EAAe,EAAK,CAAC,GAAG,CAAC,EAAM,kBAAkB,EAAM,iBAAiB,OAAO,EAAE,OAAO,IAAI,EAAS,EAAM,iBAAiB,GAAG,MAAM,SAAS,MAAM,SAAa,EAAU,EAAM,iBAAiB,GAAG,MAAM,SAAS,MAAM,eAAe,CAAC,IAAI,EAAiB,SAAS,uBAAuB,EAAU,UAAU,CAAC,GAAG,EAAiB,MAAM,MAAM,QAAS,IAAI,CACtiE,IAAI,EAAY,EAAS,MAAM,SAAS,MAAM,IAAI,CAAC,GAAG,GAAa,SAAS,EAAK,KAAK,SAAS,EAAK,QAAQ,EAAS,MAAM,SAAS,EAAY,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