{"version":3,"file":"HubSpot_Form.DQX9_xBa.mjs","names":[],"sources":["https:/framerusercontent.com/modules/e40uXZbiDF4v3OxInDmN/HnmiRf1QhOLZJFamt6CP/HubSpot_Form.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsOnFramerCanvas}from\"framer\";function EmbedHTML({html,style}){const ref=useRef();const onCanvas=useIsOnFramerCanvas();const[iframeHeight,setIframeHeight]=useState(0);const hasAutoHeight=!style.height;const hasScript=html.includes(\"</script>\");useEffect(()=>{var _this;const iframeWindow=(_this=ref.current)===null||_this===void 0?void 0:_this.contentWindow;function handleMessage(event){if(event.source!==iframeWindow)return;const data=event.data;if(typeof data!==\"object\"||data===null)return;const height=data.embedHeight;if(typeof height!==\"number\")return;setIframeHeight(height);}window.addEventListener(\"message\",handleMessage);iframeWindow===null||iframeWindow===void 0?void 0:iframeWindow.postMessage(\"getEmbedHeight\",\"*\");return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);if(hasScript){const srcDoc=`\n      <html>\n        <head>\n          <style>body { margin: 0; }</style>\n        </head>\n        <body>\n          ${html}\n          <script type=\"module\">\n            let height = 0\n\n            function sendEmbedHeight() {\n              window.parent.postMessage({\n                embedHeight: height\n              }, \"*\")\n            }\n\n            const observer = new ResizeObserver((entries) => {\n              if (entries.length !== 1) return\n              const entry = entries[0]\n              if (entry.target !== document.body) return\n\n              height = entry.contentRect.height\n              sendEmbedHeight()\n            })\n\n            observer.observe(document.body)\n\n            window.addEventListener(\"message\", (event) => {\n              if (event.source !== window.parent) returna\n              if (event.data !== \"getEmbedHeight\") return\n              sendEmbedHeight()\n            })\n          </script>\n        </body>\n      </html>\n    `;const currentStyle={width:\"100%\",height:\"100%\",border:\"none\",...style};if(hasAutoHeight){currentStyle.height=iframeHeight+\"px\";}return /*#__PURE__*/_jsx(\"iframe\",{ref:ref,style:currentStyle,srcDoc:srcDoc});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",...style},dangerouslySetInnerHTML:{__html:html}});}const Placeholder=()=>{const containerStyle={minWidth:\"100%\",minHeight:\"100%\",maxWidth:\"480px\",maxHeight:\"300px\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",border:\"1px dashed #FF7A59\",borderRadius:\"8px\",padding:\"20px\",boxSizing:\"border-box\",backgroundColor:\"rgba(255, 122, 89, 0.3)\"};const headingStyle={fontSize:\"12px\",fontWeight:600,margin:0,marginBottom:\"5px\",color:\"#FF7A59\"};const paragraphStyle={fontSize:\"12px\",margin:0,color:\"#FF7A59\",maxWidth:\"200px\",textAlign:\"center\"};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"h1\",{style:headingStyle,children:\"HubSpot\"}),/*#__PURE__*/_jsx(\"p\",{style:paragraphStyle,children:\"Set the HubSpot properties in the Properties panel.\"})]});};/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 500\n * @framerDisableUnlink\n */export default function HubSpot_Form({portalId,dataHostingLocation,formId}){const isAllPropertiesAdded=portalId&&dataHostingLocation&&formId;if(!isAllPropertiesAdded){return /*#__PURE__*/_jsx(Placeholder,{});}const html=`<script charset=\"utf-8\" type=\"text/javascript\" src=\"//js-${dataHostingLocation}.hsforms.net/forms/embed/v2.js\"></script><script>hbspt.forms.create({ region: \"${dataHostingLocation}\", portalId: \"${portalId}\", formId: \"${formId}\" }); </script>`;return /*#__PURE__*/_jsx(EmbedHTML,{html:html,style:{width:\"100%\",height:\"100%\"}});}HubSpot_Form.displayName=\"HubSpot Form\";addPropertyControls(HubSpot_Form,{portalId:{type:ControlType.String,title:\"Portal ID\"},dataHostingLocation:{type:ControlType.String,title:\"Location\"},formId:{type:ControlType.String,title:\"Form ID\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubSpot_Form\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"500\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubSpot_Form.map"],"mappings":"0VAA8K,SAAS,EAAU,CAAC,OAAK,QAAM,CAAC,CAAC,IAAM,EAAI,GAAQ,CAAO,EAAS,GAAqB,CAAM,CAAC,EAAa,EAAgB,CAAC,EAAS,EAAE,CAAO,GAAe,EAAM,OAAa,EAAU,EAAK,SAAS,YAAY,CAA8iB,GAA7iB,EAAU,IAAI,CAAC,IAAI,EAAM,IAAM,GAAc,EAAM,EAAI,UAA6C,cAAc,SAAS,EAAc,EAAM,CAAC,GAAG,EAAM,SAAS,EAAa,OAAO,IAAM,EAAK,EAAM,KAAK,UAAU,GAAO,WAAU,EAAY,OAAO,IAAM,EAAO,EAAK,YAAY,OAAU,GAAS,UAAgB,EAAgB,EAAO,AAAE,CAAkJ,SAA3I,iBAAiB,UAAU,EAAc,CAAmD,AAAlD,GAA+D,YAAY,iBAAiB,IAAI,CAAO,IAAI,CAAC,EAAO,oBAAoB,UAAU,EAAc,AAAE,CAAE,EAAC,CAAE,EAAC,CAAI,EAAU,CAAC,IAAM,GAAQ;;;;;;YAMj8B,EAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BL,EAAa,CAAC,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,GAAG,CAAM,EAA0D,OAAtD,IAAe,EAAa,OAAO,EAAa,MAA0B,EAAK,SAAS,CAAK,MAAI,MAAM,EAAoB,QAAO,EAAC,AAAE,OAAoB,GAAK,MAAM,CAAC,MAAM,CAAC,MAA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