{"version":3,"file":"IFramePostMessage.BH2Bbc13.mjs","names":[],"sources":["https:/framerusercontent.com/modules/nXVJ6DLyYAImgccw3id0/snY1zz4w6yU2zM1so4vb/IFramePostMessage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";import{store}from\"https://framerusercontent.com/modules/czl0DZVYKB9RgO6fCD8U/IrmKPvCS1qmrongyWiId/store.js\";function getQueryParams(){const params=new URLSearchParams(window.location.search);return{utm_source:params.get(\"utm_source\")||\"\",utm_medium:params.get(\"utm_medium\")||\"\",utm_campaign:params.get(\"utm_campaign\")||\"\",utm_content:params.get(\"utm_content\")||\"\",utm_term:params.get(\"utm_term\")||\"\"};}export function withPostMessage(Component){const Wrapped=/*#__PURE__*/forwardRef((props,ref)=>{const[state,setState]=store();useEffect(()=>{const listener=event=>{if(event.data?.type===\"REDIRECT\"&&typeof event.data.url===\"string\"){window.location.href=event.data.url;}};window.addEventListener(\"message\",listener);return()=>window.removeEventListener(\"message\",listener);},[]);useEffect(()=>{const iframe=document.querySelectorAll(\"iframe\")[0];if(iframe){iframe.onload=()=>{setTimeout(()=>{const params=getQueryParams();const variantName=state.variantName??localStorage.getItem(\"variantName\");iframe.contentWindow?.postMessage({type:\"UPDATE_VARIANT_NAME\",variantName,...params},\"https://kpi-crm.digienskampus.com\");},2e3);};}},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});Wrapped.displayName=`WithPostMessage(${Component.displayName||Component.name||\"Component\"})`;return Wrapped;}\nexport const __FramerMetadata__ = {\"exports\":{\"withPostMessage\":{\"type\":\"reactHoc\",\"name\":\"withPostMessage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./IFramePostMessage.map"],"mappings":"uLAA+L,SAAS,GAAgB,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAC,MAAM,CAAC,WAAW,EAAO,IAAI,aAAa,EAAE,GAAG,WAAW,EAAO,IAAI,aAAa,EAAE,GAAG,aAAa,EAAO,IAAI,eAAe,EAAE,GAAG,YAAY,EAAO,IAAI,cAAc,EAAE,GAAG,SAAS,EAAO,IAAI,WAAW,EAAE,GAAG,CAAE,SAAgB,EAAgB,EAAU,CAAC,IAAM,EAAqB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAM,GAAU,GAAO,CAA+lB,OAA9lB,MAAc,CAAC,IAAM,EAAS,GAAO,CAAI,EAAM,MAAM,OAAO,YAAY,OAAO,EAAM,KAAK,KAAM,WAAU,EAAO,SAAS,KAAK,EAAM,KAAK,MAAmD,OAA5C,EAAO,iBAAiB,UAAU,EAAS,KAAW,EAAO,oBAAoB,UAAU,EAAS,EAAG,EAAE,CAAC,CAAC,MAAc,CAAC,IAAM,EAAO,SAAS,iBAAiB,SAAS,CAAC,GAAM,IAAQ,EAAO,WAAW,CAAC,eAAe,CAAC,IAAM,EAAO,GAAgB,CAAO,EAAY,EAAM,aAAa,aAAa,QAAQ,cAAc,CAAC,EAAO,eAAe,YAAY,CAAC,KAAK,sBAAsB,cAAY,GAAG,EAAO,CAAC,oCAAoC,EAAG,IAAI,IAAM,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,CAAC,EAAG,CAA8F,MAA7F,GAAQ,YAAY,mBAAmB,EAAU,aAAa,EAAU,MAAM,YAAY,GAAU,uBAAnzC,IAAwC,IAA4G"}