{"version":3,"file":"Hubspot_Form.DX8NFoRp.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,GAAK,CAA+gC,OAA9gC,MAAc,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAA01B,MAAz1B,GAAO,IAAI,2CAA2C,EAAO,MAAM,GAAK,EAAO,WAAW,CAAI,EAAO,MAAO,EAAO,MAAM,MAAM,OAAO,CAAC,GAAG,GAAQ,CAAC,SAAO,CAAC,W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