{"version":3,"file":"HubspotForm.Be0rR67f.mjs","names":[],"sources":["https:/framerusercontent.com/modules/f7SIqZdJkKHDa6N8CxRP/m24K5Unm1KvmcqFOaXPY/HubspotForm.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function HubSpotForm({portalId,formId,redirectUrl,hubspotFormSelectorId,hubspotCustomStyles}){useEffect(()=>{const loadHubSpotForm=()=>{if(window.hbspt){window.hbspt.forms.create({portalId:portalId,formId:formId,target:\"#hubspotForm\"+hubspotFormSelectorId,onFormSubmit:function(response){console.log(\"submit\");window.location.href=redirectUrl;},onFormReady:()=>{// Wait until the form is ready, then apply styles\napplyCustomStyles();}});}};const applyCustomStyles=()=>{const hubspotForm=document.getElementById(`hubspotForm${hubspotFormSelectorId}`);const iframe=hubspotForm.getElementsByTagName(\"iframe\")[0];// const iframe = document.getElementById(\n//     `hubspotForm${hubspotFormSelectorId}`\n// ) as HTMLIFrameElement\nif(iframe){var _iframe_contentWindow;const iframeDocument=(_iframe_contentWindow=iframe.contentWindow)===null||_iframe_contentWindow===void 0?void 0:_iframe_contentWindow.document;if(iframeDocument){// Add custom styles to the iframe's document\nconst styleTag=iframeDocument.createElement(\"style\");styleTag.innerHTML=`${hubspotCustomStyles}`;// Append the style tag to the iframe's head\niframeDocument.head.appendChild(styleTag);}}};const script=document.createElement(\"script\");script.src=\"https://js.hsforms.net/forms/v2.js\";script.onload=loadHubSpotForm;document.body.appendChild(script);return()=>{document.body.removeChild(script);};},[portalId,formId,redirectUrl]);return /*#__PURE__*/_jsx(\"div\",{id:`hubspotForm${hubspotFormSelectorId}`,style:{width:\"100%\",height:\"100%\"}});}addPropertyControls(HubSpotForm,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"YOUR_PORTAL_ID\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"YOUR_FORM_ID\"},redirectUrl:{type:ControlType.String,title:\"Redirect URL\",defaultValue:\"https://stllrgold.com\"},hubspotFormSelectorId:{type:ControlType.String,title:\"Form Selector Id\",defaultValue:\"1\"},hubspotCustomStyles:{type:ControlType.String,title:\"Form Custom Styles\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"HubSpotForm\":{\"type\":\"reactComponent\",\"name\":\"HubSpotForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotForm.map"],"mappings":"0SAA4H,SAAgB,EAAY,CAAC,WAAS,SAAO,cAAY,wBAAsB,sBAAoB,CAAC,CAM4D,MAN3D,GAAU,IAAI,CAAC,IAAM,EAAgB,IAAI,CAAC,AAAG,EAAO,OAAO,EAAO,MAAM,MAAM,OAAO,CAAU,WAAgB,SAAO,OAAO,eAAe,EAAsB,aAAa,SAAS,EAAS,CAAuB,AAAtB,QAAQ,IAAI,SAAS,CAAC,EAAO,SAAS,KAAK,CAAa,EAAC,YAAY,IAAI,CAC5e,GAAmB,AAAE,CAAC,EAAC,AAAG,EAAO,EAAkB,IAAI,CAAC,IAAM,EAAY,SAAS,gBAAgB,aAAa,IAAwB,CAAO,EAAO,EAAY,qBAAqB,SAAS,CAAC,GAGjM,GAAG,EAAO,CAAC,IAAI,EAAsB,IAAM,GAAgB,EAAsB,EAAO,gBAAmF,SAAS,GAAG,EAAe,CACtM,IAAM,EAAS,EAAe,cAAc,QAAQ,CACpD,AADqD,EAAS,aAAa,IAC3E,EAAe,KAAK,YAAY,EAAS,AAAE,CAAC,CAAC,EAAO,EAAO,SAAS,cAAc,SAAS,CAAiH,OAAhH,EAAO,IAAI,qCAAqC,EAAO,OAAO,EAAgB,SAAS,KAAK,YAAY,EAAO,CAAO,IAAI,CAAC,SAAS,KAAK,YAAY,EAAO,AAAE,CAAE,EAAC,CAAC,EAAS,EAAO,CAAY,EAAC,CAAqB,EAAK,MAAM,CAAC,IAAI,aAAa,IAAwB,MAAM,CAAC,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