{"version":3,"file":"HubspotDemoForm.CcliVHT1.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/TxMef61WYJMrZTQK9ppz/UlVw4c3yAkgDCcdkAWOz/HubspotDemoForm.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function HubspotDemoForm(props){const retryTimerRef=useRef(null);const defaults={portalId:\"25036904\",formId:\"2cde4e7b-5e0f-4ed9-9d03-7572a61638fa\",region:\"eu1\",height:\"750px\",width:\"100%\",fontSize:\"14px\"};useEffect(()=>{// Load HubSpot script\nconst script=document.createElement(\"script\");script.src=`https://js-${defaults.region}.hsforms.net/forms/embed/developer/${defaults.portalId}.js`;script.defer=true;document.body.appendChild(script);const attachPostHogIdentifyListener=()=>{// Target HubSpot form\nconst forms=document.querySelectorAll(`form[action^=\"https://forms-eu1.hsforms.com\"]`);console.log(\"Looking for forms...\",forms.length);if(forms.length>0){forms.forEach(form=>{form.addEventListener(\"submit\",()=>{// Delay to ensure fields are filled\nsetTimeout(()=>{// Get form values safely with proper type assertions\nconst userEmail=document.querySelector('input[name=\"0-1/email\"]')?.value||\"\";const firstName=document.querySelector('input[name=\"0-1/firstname\"]')?.value||\"\";const lastName=document.querySelector('input[name=\"0-1/lastname\"]')?.value||\"\";const phone=document.querySelector('input[name=\"0-1/phone\"]')?.value||\"\";const company=document.querySelector('input[name=\"0-2/name\"]')?.value||\"\";// Capture dropdown values\nconst businessType=document.querySelector('select[name=\"0-1/business_type\"]')?.value||\"\";const numberOfLocations=document.querySelector('select[name=\"0-1/number_of_locations\"]')?.value||\"\";// Log captured data\nconsole.log(\"Captured Form Data:\",{userEmail,firstName,lastName,phone,company,businessType,numberOfLocations});// Identify user in PostHog if available\nif(typeof window.posthog!==\"undefined\"){window.posthog.identify(userEmail,{email:userEmail,firstName,lastName,phone,company,businessType,numberOfLocations});}else{console.error(\"PostHog is not available.\");}},100);});});// Clear retry timer if forms were found\nif(retryTimerRef.current!==null){clearTimeout(retryTimerRef.current);retryTimerRef.current=null;console.log(\"Forms found, polling stopped\");}}else{// Forms not found, retry after 200ms\nconsole.log(\"Forms not found, retrying in 200ms...\");retryTimerRef.current=window.setTimeout(attachPostHogIdentifyListener,200);}};// Start polling after window load\nif(document.readyState===\"complete\"){attachPostHogIdentifyListener();}else{window.addEventListener(\"load\",attachPostHogIdentifyListener);}// Cleanup\nreturn()=>{window.removeEventListener(\"load\",attachPostHogIdentifyListener);if(retryTimerRef.current!==null){clearTimeout(retryTimerRef.current);}document.body.removeChild(script);};},[defaults.portalId,defaults.region]);return /*#__PURE__*/_jsx(\"div\",{className:\"hs-form-html\",\"data-region\":defaults.region,\"data-form-id\":defaults.formId,\"data-portal-id\":defaults.portalId,style:{height:defaults.height,width:defaults.width,fontSize:defaults.fontSize,overflow:\"visible\"}});}addPropertyControls(HubspotDemoForm,{tint:{title:\"Tint\",type:ControlType.Color,defaultValue:\"#09F\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotDemoForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotDemoForm.map"],"mappings":"2LAIG,SAAwB,EAAgB,EAAM,CAAC,IAAM,EAAcA,EAAO,KAAK,CAAO,EAAS,CAAC,SAAS,WAAW,OAAO,uCAAuC,OAAO,MAAM,OAAO,QAAQ,MAAM,OAAO,SAAS,OAAO,CAWD,OAXE,MAAc,CAC7O,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,IAAI,cAAc,EAAS,OAAO,qCAAqC,EAAS,SAAS,KAAK,EAAO,MAAM,GAAK,SAAS,KAAK,YAA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