{"version":3,"file":"HubspotForm.CmXBoKym.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,uBAAqB,CAM4D,OAN3D,MAAc,CAAC,IAAM,MAAoB,CAAI,EAAO,OAAO,EAAO,MAAM,MAAM,OAAO,CAAU,WAAgB,SAAO,OAAO,eAAe,EAAsB,aAAa,SAAS,EAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,EAAO,SAAS,KAAK,GAAc,gBAAgB,CAC5e,GAAmB,EAAG,CAAC,EAAU,MAAsB,CAAkF,IAAM,EAArE,SAAS,eAAe,cAAc,IAAwB,CAA0B,qBAAqB,SAAS,CAAC,GAGjM,GAAG,EAAO,CAA2B,IAAM,EAAsC,EAAO,eAAmF,SAAS,GAAG,EAAe,CACtM,IAAM,EAAS,EAAe,cAAc,QAAQ,CAAC,EAAS,UAAU,GAAG,IAC3E,EAAe,KAAK,YAAY,EAAS,IAAW,EAAO,SAAS,cAAc,SAAS,CAAiH,MAAhH,GAAO,IAAI,qCAAqC,EAAO,OAAO,EAAgB,SAAS,KAAK,YAAY,EAAO,KAAW,CAAC,SAAS,KAAK,YAAY,EAAO,GAAK,CAAC,EAAS,EAAO,EAAY,CAAC,CAAqB,EAAK,MAAM,CAAC,GAAG,cAAc,IAAwB,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,CAAC,CAAC,sBAN9V,IAA6B,IAAoD,CAM+Q,EAAoB,EAAY,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,YAAY,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