{"version":3,"file":"HubSpotReportDownloadForm.CfbaDVMt.mjs","names":["React.useRef","React.useState","React.useCallback","React.useMemo","__esmMin","ne","init_ssg_sandbox_shims","init_npm_react_18_3_1","te","window","pe","ce","c","_e","de","addPropertyControls","ControlType","useIsStaticRenderer","init_framer_DKtAEkcX","loadHubSpotScript","resolve","existingScript","reject","script","HubSpotReportDownloadForm","props","containerRef","pendingReportTabRef","errorMessage","setErrorMessage","isSubmitted","setIsSubmitted","isStaticRenderer","openPendingReportTab","pendingTab","handleSuccessfulSubmission","downloadUrl","hubSpotConfig","portalId","formId","region","isCancelled","targetId","target","successMessage","error","init_HubSpotReportDownloadForm","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/Ru82sWi43p64g568tqDh/xPYGJ8Y7MhFDgfLdZzI1/HubSpotReportDownloadForm.js"],"sourcesContent":["// User request: Create a new self-contained Framer code component named HubSpotReportDownloadForm to replace the current HubSpot embed inside a centered popup. It must load HubSpot’s v2 forms script safely, render the form using portalId 5275236, formId 58406367-677c-4862-9bfc-e2fe923a9eea, region na2, and on a successful HubSpot form submission automatically trigger a download of https://assets.coingecko.com/reports/2026/Tokenized-Equities-Report-Aug-2026.pdf. Use HubSpot’s supported form success callback/event rather than polling. Keep the component responsive: width fills its parent, height naturally follows the form, and it must not clip validation messages. Expose portalId, formId, region, downloadUrl, and downloadFileName as editable controls. Avoid hardcoded page styling; the surrounding Framer modal supplies the surface and padding. Return a code component, not an override.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";function loadHubSpotScript(){return new Promise((resolve,reject)=>{if(typeof window===\"undefined\"){resolve();return;}if(window.hbspt?.forms?.create){resolve();return;}const existingScript=document.querySelector('script[src=\"https://js.hsforms.net/forms/embed/v2.js\"]');if(existingScript){if(window.hbspt?.forms?.create){resolve();return;}existingScript.addEventListener(\"load\",()=>resolve(),{once:true});existingScript.addEventListener(\"error\",()=>reject(new Error(\"Failed to load HubSpot forms script.\")),{once:true});return;}const script=document.createElement(\"script\");script.src=\"https://js.hsforms.net/forms/embed/v2.js\";script.async=true;script.defer=true;script.addEventListener(\"load\",()=>resolve(),{once:true});script.addEventListener(\"error\",()=>reject(new Error(\"Failed to load HubSpot forms script.\")),{once:true});document.head.appendChild(script);});}/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function HubSpotReportDownloadForm(props){const{portalId,formId,region,downloadUrl,successMessage}=props;const containerRef=React.useRef(null);const pendingReportTabRef=React.useRef(null);const[errorMessage,setErrorMessage]=React.useState(\"\");const[isSubmitted,setIsSubmitted]=React.useState(false);const isStaticRenderer=useIsStaticRenderer();const openPendingReportTab=React.useCallback(()=>{if(typeof window===\"undefined\")return;const pendingTab=window.open(\"about:blank\",\"_blank\");if(pendingTab){try{pendingTab.opener=null;}catch{// Ignore if the browser blocks changing opener.\n}}pendingReportTabRef.current=pendingTab;},[]);const handleSuccessfulSubmission=React.useCallback(()=>{if(typeof window===\"undefined\")return;const pendingTab=pendingReportTabRef.current;if(pendingTab&&!pendingTab.closed){try{pendingTab.location.href=downloadUrl;}catch{window.open(downloadUrl,\"_blank\");}pendingReportTabRef.current=null;}else{window.open(downloadUrl,\"_blank\");}React.startTransition(()=>{setIsSubmitted(true);});},[downloadUrl]);const hubSpotConfig=React.useMemo(()=>({portalId,formId,region}),[portalId,formId,region]);React.useEffect(()=>{if(isStaticRenderer)return;if(typeof window===\"undefined\")return;if(!containerRef.current)return;if(isSubmitted)return;let isCancelled=false;containerRef.current.innerHTML=\"\";loadHubSpotScript().then(()=>{if(isCancelled||!containerRef.current)return;if(!window.hbspt?.forms?.create){React.startTransition(()=>{setErrorMessage(\"HubSpot forms API is unavailable.\");});return;}React.startTransition(()=>{setErrorMessage(\"\");});const targetId=`hubspot-form-${Math.random().toString(36).slice(2)}`;const target=document.createElement(\"div\");target.id=targetId;containerRef.current.appendChild(target);window.hbspt.forms.create({...hubSpotConfig,target:`#${targetId}`,redirectUrl:\"\",inlineMessage:successMessage,onFormSubmit:()=>{openPendingReportTab();},onFormSubmitted:()=>{handleSuccessfulSubmission();}});}).catch(error=>{if(isCancelled)return;React.startTransition(()=>{setErrorMessage(error.message||\"Unable to load form.\");});});return()=>{isCancelled=true;if(containerRef.current){containerRef.current.innerHTML=\"\";}const pendingTab=pendingReportTabRef.current;if(pendingTab&&!pendingTab.closed){pendingTab.close();}pendingReportTabRef.current=null;};},[hubSpotConfig,isStaticRenderer,handleSuccessfulSubmission,openPendingReportTab,isSubmitted,successMessage]);if(isStaticRenderer){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"auto\",overflow:\"visible\"},children:/*#__PURE__*/_jsx(\"div\",{children:\"HubSpot form will render in preview/published mode.\"})});}return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"auto\",overflow:\"visible\"},children:[isSubmitted?/*#__PURE__*/_jsx(\"div\",{role:\"status\",\"aria-live\":\"polite\",style:{width:\"100%\",marginTop:20,textAlign:\"center\",color:\"#344054\",fontFamily:\"Inter, sans-serif\",fontSize:16,fontWeight:400,lineHeight:1.35},children:successMessage}):/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",overflow:\"visible\"}}),errorMessage?/*#__PURE__*/_jsx(\"div\",{role:\"status\",\"aria-live\":\"polite\",style:{marginTop:8},children:errorMessage}):null]});}addPropertyControls(HubSpotReportDownloadForm,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"5275236\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"58406367-677c-4862-9bfc-e2fe923a9eea\"},region:{type:ControlType.String,title:\"Region\",defaultValue:\"na2\"},downloadUrl:{type:ControlType.String,title:\"Download URL\",defaultValue:\"https://assets.coingecko.com/reports/2026/Tokenized-Equities-Report-Aug-2026.pdf\"},downloadFileName:{type:ControlType.String,title:\"File Name\",defaultValue:\"Tokenized-Equities-Report-Aug-2026.pdf\"},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"Thanks for your interest. Your report will open in a new tab.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubSpotReportDownloadForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubSpotReportDownloadForm.map"],"mappings":"A,gOAC6J,SAASmB,GAAmB,CAAC,OAAO,IAAI,SAAS,EAAQ,IAAS,CAAmD,GAAxCV,IAAS,QAAkCA,EAAO,OAAO,OAAO,OAAO,CAACW,EAAQ,EAAE,MAAO,CAAC,IAAMC,EAAe,SAAS,cAAc,wDAAwD,EAAE,GAAGA,EAAe,CAAC,GAAGZ,EAAO,OAAO,OAAO,OAAO,CAACW,EAAQ,EAAE,MAAO,CAACC,EAAe,iBAAiB,WAAWD,EAAQ,EAAE,CAAC,KAAK,EAAI,CAAC,EAAEC,EAAe,iBAAiB,YAAYC,EAAO,gBAAI,MAAM,sCAAsC,CAAC,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,MAAO,CAAC,IAAMC,EAAO,SAAS,cAAc,QAAQ,EAAE,EAAO,IAAI,2CAA2C,EAAO,MAAM,GAAK,EAAO,MAAM,GAAKA,EAAO,iBAAiB,WAAWH,EAAQ,EAAE,CAAC,KAAK,EAAI,CAAC,EAAEG,EAAO,iBAAiB,YAAYD,EAAO,gBAAI,MAAM,sCAAsC,CAAC,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,SAAS,KAAK,YAAYC,CAAM,CAAE,CAAC,CAAE,CAG3/B,SAAwBC,EAA0B,EAAM,CAAC,GAAK,CAAC,WAAS,SAAO,SAAO,cAAY,kBAAgBC,EAAYC,EAAa1B,EAAa,IAAI,EAAQ2B,EAAoB3B,EAAa,IAAI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