{"version":3,"file":"HubspotForm.BH5Bha-R.mjs","names":["useRef","useState","style"],"sources":["https:/framerusercontent.com/modules/zsYGETgrUhR6TxueMCIf/ZQ0qhXMvRK402Xrv8JXh/HubspotForm.js"],"sourcesContent":["// HubSpot Form Embed Component for Framer\n// Allows Form ID and Redirect URL to be set via Framer property controls\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * HubSpot Form Embed\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function HubspotForm(props){const{formId,showSpinner=true,style}=props;const containerRef=useRef(null);const[isSubmitting,setIsSubmitting]=useState(false);const PORTAL_ID=\"24432600\";const ZEROBOUNCE_API_KEY=\"8134cbee87174cbe8e52d30b859e2fd2\";useEffect(()=>{if(typeof window===\"undefined\"||!formId)return;// Load HubSpot script if not already present\nif(!document.querySelector('script[src*=\"js.hsforms.net/forms/embed/v2.js\"]')){const script=document.createElement(\"script\");script.src=\"//js.hsforms.net/forms/embed/v2.js\";script.async=true;script.charset=\"utf-8\";document.body.appendChild(script);script.onload=createForm;}else{createForm();}function createForm(){// @ts-ignore\nif(!window[\"hbspt\"]||!containerRef.current)return;// Remove any previous form\ncontainerRef.current.innerHTML=\"\";// @ts-ignore\nwindow[\"hbspt\"].forms.create({portalId:PORTAL_ID,formId:formId,region:\"na1\",target:`#${containerRef.current.id}`,onFormSubmit:function(){console.log(\"Form submitted.\");// Show loading state\nif(showSpinner){startTransition(()=>setIsSubmitting(true));}},onFormReady:function($form){// Add global style for full width\nconst styleId=\"global-hubspot-form-style\";if(!document.getElementById(styleId)){const style=document.createElement(\"style\");style.id=styleId;style.textContent=`\n              .hbspt-form, .hbspt-form form, .hbspt-form .hs-form {\n                width: 100% !important;\n                max-width: 100% !important;\n              }\n              .hbspt-form .form-columns-2 fieldset {\n                display: flex;\n                flex-wrap: wrap;\n                gap: 1rem;\n              }\n              .hbspt-form .form-columns-2 .hs-form-field {\n                flex: 1 1 48%;\n                box-sizing: border-box;\n              }\n              @media (max-width: 768px) {\n                .hbspt-form .hs-form-field {\n                  flex: 1 1 100%;\n                }\n              }\n            `;document.head.appendChild(style);}// ZeroBounce Validation\nconst config={apiKey:ZEROBOUNCE_API_KEY,disableSubmitOnError:true,hubspotFormId:formId};const zbScript=document.createElement(\"script\");zbScript.src=\"https://www.zerobounce.net/widget/ZeroBounceHubSpotValidationWidget.js\";zbScript.async=true;zbScript.onload=function(){// @ts-ignore\nif(typeof initializeZeroBounce===\"function\"){// @ts-ignore\ninitializeZeroBounce(config);}else{console.error(\"initializeZeroBounce function not found.\");}};document.head.appendChild(zbScript);}});}// Cleanup on unmount\nreturn()=>{if(containerRef.current)containerRef.current.innerHTML=\"\";};},[formId,showSpinner]);// Unique ID for the container\nconst containerId=`hubspot-form-container-${formId||\"default\"}`;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",minHeight:200,...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:containerRef,id:containerId,style:{width:\"100%\",minHeight:200,filter:isSubmitting?\"blur(2px)\":\"none\",transition:\"filter 0.3s ease\"},\"aria-live\":\"polite\"}),isSubmitting&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:1e3},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:40,height:40,border:\"4px solid #f3f3f3\",borderTop:\"4px solid #3498db\",borderRadius:\"50%\",animation:\"spin 1s linear infinite\"}}),/*#__PURE__*/_jsx(\"style\",{children:`\n              @keyframes spin {\n                0% { transform: rotate(0deg); }\n                100% { transform: rotate(360deg); }\n              }\n            `})]})]});}addPropertyControls(HubspotForm,{formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"Paste HubSpot Form ID\"},showSpinner:{type:ControlType.Boolean,title:\"Spinner\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotForm.map"],"mappings":"oNAOG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,cAAY,GAAK,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAa,GAAiBC,EAAS,GAAM,CAAwF,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAO,OAC3T,GAAI,SAAS,cAAc,kDAAkD,CAA0M,GAAY,KAArN,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,IAAI,qCAAqC,EAAO,MAAM,GAAK,EAAO,QAAQ,QAAQ,SAAS,KAAK,YAAY,EAAO,CAAC,EAAO,OAAO,EAA+B,SAAS,GAAY,CACvT,CAAC,EAAO,OAAU,CAAC,EAAa,UACnC,EAAa,QAAQ,UAAU,GAC/B,EAAO,MAAS,MAAM,OAAO,CAAC,SAAS,WAAiB,SAAO,OAAO,MAAM,OAAO,IAAI,EAAa,QAAQ,KAAK,aAAa,UAAU,CAAC,QAAQ,IAAI,kBAAkB,CACpK,GAAa,MAAoB,EAAgB,GAAK,CAAC,EAAI,YAAY,SAAS,EAAM,CACzF,IAAM,EAAQ,4BAA4B,GAAG,CAAC,SAAS,eAAe,EAAQ,CAAC,CAAC,IAAMC,EAAM,SAAS,cAAc,QAAQ,CAAC,EAAM,GAAG,EAAQ,EAAM,YAAY;;;;;;;;;;;;;;;;;;;cAmBjJ,SAAS,KAAK,YAAYA,EAAM,CAC9C,IAAM,EAAO,CAAC,OAAO,mCAAmB,qBAAqB,GAAK,cAAc,EAAO,CAAO,EAAS,SAAS,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