{"version":3,"file":"HubspotForm.DNfaacWz.mjs","names":["useRef","useState","style","_Fragment"],"sources":["https:/framerusercontent.com/modules/zsYGETgrUhR6TxueMCIf/GgokBuVjhMLImOdrR8Gc/HubspotForm.js"],"sourcesContent":["// HubSpot Form Embed Component for Framer\n// Allows Form ID and Redirect URL to be set via Framer property controls.\n// Submission state: form content blurs as one unit, spinner overlay sits centered on top\n// with rounded corners matching the container - no hard visual cuts.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}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,spinnerColor=\"#3498db\",overlayOpacity=.7,formPadding=16,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));}},onFormSubmitted:function(){// Hide spinner once HubSpot has accepted the submission\n// (ZeroBounce-rejected emails won't reach here, so spinner stays\n// up while the user fixes their email - exactly what we want)\nsetIsSubmitting(false);},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,borderRadius:12,boxSizing:\"border-box\",...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:containerRef,id:containerId,style:{width:\"100%\",minHeight:200,padding:formPadding,boxSizing:\"border-box\",filter:isSubmitting?\"blur(2px)\":\"none\",transition:\"filter 0.3s ease\",pointerEvents:isSubmitting?\"none\":\"auto\"},\"aria-live\":\"polite\"}),isSubmitting&&showSpinner&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:`rgba(255, 255, 255, ${overlayOpacity})`,borderRadius:\"inherit\",zIndex:8,animation:\"hubspot-overlay-fade-in 0.2s ease-out\",pointerEvents:\"auto\"},role:\"status\",\"aria-label\":\"Submitting form\",children:/*#__PURE__*/_jsx(\"div\",{style:{width:40,height:40,border:\"3px solid rgba(0, 0, 0, 0.1)\",borderTop:`3px solid ${spinnerColor}`,borderRadius:\"50%\",animation:\"hubspot-spinner 0.8s linear infinite\"}})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                            @keyframes hubspot-spinner {\n                                0% { transform: rotate(0deg); }\n                                100% { transform: rotate(360deg); }\n                            }\n                            @keyframes hubspot-overlay-fade-in {\n                                from { opacity: 0; }\n                                to { opacity: 1; }\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\"},spinnerColor:{type:ControlType.Color,title:\"Spinner Color\",defaultValue:\"#3498db\"},overlayOpacity:{type:ControlType.Number,title:\"Overlay Fade\",defaultValue:.7,min:0,max:1,step:.05,displayStepper:false},formPadding:{type:ControlType.Number,title:\"Form Padding\",description:\"Inner buffer inside the form. Gives the blur halo room to fade out cleanly during submission - increase this if you see hard cuts at the edges.\",defaultValue:16,min:0,max:64,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotForm.map"],"mappings":"sNASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,cAAY,GAAK,eAAa,UAAU,iBAAe,GAAG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