{"version":3,"file":"Hubspot_Form.DwpZ1Pna.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/T1mWEADn7MYBmf5Sgv0R/alLrjj9LqQd4UfAwXVaK/Hubspot_Form.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function HubspotFormWithRedirect({portalId,formId,region,redirectPath,spinnerColor=\"#2c3fd5\",wrapperId,formType,formLanguage}){const[isLoading,setIsLoading]=useState(true);useEffect(()=>{const script=document.createElement(\"script\");script.src=\"https://js.hsforms.net/forms/embed/v2.js\";script.async=true;script.onload=()=>{if(window.hbspt){window.hbspt.forms.create({...region&&{region},portalId,formId,target:`#${wrapperId}`,onFormReady:()=>{setIsLoading(false);},onFormSubmitted:function($form){const formEl=$form.get?$form.get(0):$form;const emailInput=formEl.querySelector('input[name=\"email\"]');const email=emailInput?.value||null;if(email){localStorage.setItem(\"conversionEmail\",email);window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"conversion\",email:email,formType:formType||formId,formLanguage:formLanguage||\"unknown\"});}setTimeout(()=>{if(window.framer?.navigate){window.framer.navigate(redirectPath);}else{window.location.href=redirectPath;}});}});}else{console.error(\"HubSpot script failed to load\");setIsLoading(false);}};document.body.appendChild(script);return()=>{document.body.removeChild(script);};},[portalId,formId,redirectPath,wrapperId,region,formType,formLanguage]);return /*#__PURE__*/_jsxs(_Fragment,{children:[isLoading&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100px\"},children:/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",style:{margin:\"auto\",background:\"none\",display:\"block\"},width:\"50px\",height:\"50px\",viewBox:\"0 0 100 100\",preserveAspectRatio:\"xMidYMid\",children:/*#__PURE__*/_jsx(\"circle\",{cx:\"50\",cy:\"50\",r:\"35\",stroke:spinnerColor,strokeWidth:\"10\",fill:\"none\",strokeLinecap:\"round\",children:/*#__PURE__*/_jsx(\"animateTransform\",{attributeName:\"transform\",type:\"rotate\",repeatCount:\"indefinite\",dur:\"1s\",values:\"0 50 50;360 50 50\",keyTimes:\"0;1\"})})})}),/*#__PURE__*/_jsx(\"div\",{id:wrapperId})]});}addPropertyControls(HubspotFormWithRedirect,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\"},region:{type:ControlType.String,title:\"Region (e.g. na1, eu1)\",defaultValue:\"\"},redirectPath:{type:ControlType.String,title:\"Redirect Path\",defaultValue:\"\"},spinnerColor:{type:ControlType.Color,title:\"Spinner Color\",defaultValue:\"#2c3fd5\"},wrapperId:{type:ControlType.String,title:\"Wrapper ID\",defaultValue:\"hubspot-form-wrapper\",placeholder:\"e.g. hubspot-form-wrapper-contact-form\"},formType:{type:ControlType.String,title:\"Form Type\",defaultValue:\"\",placeholder:\"e.g. contact-form, request-quote\"},formLanguage:{type:ControlType.String,title:\"Form Language\",defaultValue:\"\",placeholder:\"e.g. en, de, da\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotFormWithRedirect\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Hubspot_Form.map"],"mappings":"6MAAyK,SAAwB,EAAwB,CAAC,WAAS,SAAO,SAAO,eAAa,eAAa,UAAU,YAAU,WAAS,gBAAc,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,EAAI,EAAghC,OAA9gC,MAAc,CAAC,IAAM,EAAO,SAAS,cAAc,QAAQ,EAA21B,MAAz1B,GAAO,IAAI,2CAA2C,EAAO,MAAM,GAAK,EAAO,WAAW,CAAI,EAAO,MAAO,EAAO,MAAM,MAAM,OAAO,CAAC,GAAG,GAAQ,CAAC,QAAM,EAAE,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