{"version":3,"file":"HideOnFormSubmit.DNAySHqp.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/iBfAqj3DIFb3XmlxdStX/bTPeTtEuUKmy4DkC6FXl/HideOnFormSubmit.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";// Custom event name\nconst FORM_SUBMITTED_EVENT=\"hubspotFormSubmitted\";// Apply this to the HubSpot form component\nexport function hubSpotListener(){useEffect(()=>{const observer=new MutationObserver(mutations=>{const submittedMessage=document.querySelector(\".submitted-message\");if(submittedMessage){// Dispatch a custom event\nwindow.dispatchEvent(new CustomEvent(FORM_SUBMITTED_EVENT));observer.disconnect();}});observer.observe(document.body,{childList:true,subtree:true});// Check immediately\nif(document.querySelector(\".submitted-message\")){window.dispatchEvent(new CustomEvent(FORM_SUBMITTED_EVENT));}return()=>observer.disconnect();},[]);return{};}// Apply this to the title you want to hide\nexport function hideOnFormSubmit(){const[isHidden,setIsHidden]=useState(false);useEffect(()=>{const handleSubmit=()=>setIsHidden(true);window.addEventListener(FORM_SUBMITTED_EVENT,handleSubmit);// Check immediately if already submitted\nif(document.querySelector(\".submitted-message\")){setIsHidden(true);}return()=>window.removeEventListener(FORM_SUBMITTED_EVENT,handleSubmit);},[]);return{style:{opacity:isHidden?0:1,height:isHidden?0:\"auto\",width:\"100%\",overflow:\"hidden\",transition:\"opacity 0.3s ease-out, height 0.3s ease-out\"}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withhubSpotListener(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...hubSpotListener(props)});};}withhubSpotListener.displayName=\"hubSpotListener\";export function withhideOnFormSubmit(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...hideOnFormSubmit(props)});};}withhideOnFormSubmit.displayName=\"hideOnFormSubmit\";\nexport const __FramerMetadata__ = {\"exports\":{\"withhideOnFormSubmit\":{\"type\":\"reactHoc\",\"name\":\"withhideOnFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hubSpotListener\":{\"type\":\"override\",\"name\":\"hubSpotListener\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withhubSpotListener\":{\"type\":\"reactHoc\",\"name\":\"withhubSpotListener\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hideOnFormSubmit\":{\"type\":\"override\",\"name\":\"hideOnFormSubmit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideOnFormSubmit.map"],"mappings":"0LAEA,SAAgB,GAAiB,CAEmH,OAFlH,MAAc,CAAC,IAAM,EAAS,IAAI,iBAAiB,GAAW,CAAwB,SAAS,cAAc,oBAAwC,IACvL,EAAO,cAAc,IAAI,YAAY,CAAoB,CAAC,EAAE,EAAS,WAAW,EAAG,CAAC,EAC0B,OADxB,EAAS,QAAQ,SAAS,KAAK,CAAC,UAAU,GAAK,QAAQ,EAAI,CAAC,EAC/I,SAAS,cAAc,oBAAoB,GAAG,EAAO,cAAc,IAAI,YAAY,CAAoB,CAAC,MAAa,EAAS,WAAW,CAAE,EAAE,CAAC,CAAC,EAAQ,CAAC,CAAE,CAC7J,SAAgB,GAAkB,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAK,EACqE,OADnE,MAAc,CAAC,IAAM,MAAiB,EAAY,EAAI,EACjE,OADmE,EAAO,iBAAiB,EAAqB,CAAY,EAC7L,SAAS,cAAc,oBAAoB,GAAG,EAAY,EAAI,MAAa,EAAO,oBAAoB,EAAqB,CAAY,CAAE,EAAE,CAAC,CAAC,EAAQ,CAAC,MAAM,CAAC,QAAQ,IAAa,OAAO,EAAS,EAAE,OAAO,MAAM,OAAO,SAAS,SAAS,WAAW,6CAA6C,CAAC,CAAE,CA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