{"version":3,"file":"IFrameContainer.Bvm9tLDy.mjs","names":["React","Cookies"],"sources":["https:/framerusercontent.com/modules/9e6LflC3LaVSCtpSWioL/Se39Ojda8tE0HG4jeO6I/IFrameContainer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";import Cookies from\"js-cookie\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */addPropertyControls(IFrameContainer,{visible:{type:ControlType.Boolean,title:\"Visible\"},targetUrl:{type:ControlType.String,title:\"iFrame URL\"}});IFrameContainer.defaultProps={targetUrl:\"https://portal.drem.se/widgets/sign-up\"};export default function IFrameContainer(props){const ref=React.useRef(null);const[loading,setLoading]=React.useState(true);const onIframeLoaded=e=>{setLoading(false);};React.useEffect(()=>{const targetUrlSegments=props.targetUrl.split(\"?\");const currentUrlSegments=window.location.search.split(\"?\");const searchParams=new URLSearchParams({...targetUrlSegments.length>1?Object.fromEntries(new URLSearchParams(targetUrlSegments.pop())):{},...currentUrlSegments.length>1?Object.fromEntries(new URLSearchParams(currentUrlSegments.pop())):{}});const referrer=document.referrer;if(referrer)searchParams.set(\"referrer\",referrer);if(Cookies.get(\"original_source\")===\"tibber\"){searchParams.set(\"utm_source\",\"tibber\");}if(searchParams.has(\"gl\")&&!searchParams.has(\"utm_source\")){searchParams.set(\"utm_source\",\"google\");searchParams.set(\"utm_medium\",\"cpc\");}if(searchParams.has(\"gclid\")&&!searchParams.has(\"utm_source\")){searchParams.set(\"utm_source\",\"google\");searchParams.set(\"utm_medium\",\"cpc\");}if(!searchParams.has(\"utm_source\")){if(Cookies.get(\"original_campaign\")===\"pmax\"){searchParams.set(\"utm_source\",Cookies.get(\"original_source\"));searchParams.set(\"utm_campaign\",Cookies.get(\"original_campaign\"));}else{searchParams.set(\"utm_source\",referrer?\"organic\":\"direct\");}}//iframe.hasChildNodes()\nconst iframe=document.createElement(\"iframe\");iframe.onload=onIframeLoaded;iframe.width=\"100%\";iframe.height=\"100%\";iframe.style.border=\"none\";iframe.style.background=\"none transparent\";iframe.style.backgroundColor=\"none transparent\";iframe.id=\"drem-signup-frame\";iframe.frameBorder=\"0\";searchParams.set(\"location\",window.location.href);/*iframe.onload = function () {\n            console.log(\"loading iframe\")\n            const doc = iframe.contentWindow.document\n            const head = doc.querySelector(\"head\")\n            const style = doc.createElement(\"style\")\n\n            style.setAttribute(\"type\", \"text/css\")\n            style.innerHTML = \"body { background: transparent!important; }\"\n\n            head.appendChild(style)\n        }*/iframe.src=targetUrlSegments[0]+\"?\"+searchParams.toString();ref.current.appendChild(iframe);},[]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:containerStyle,children:loading&&/*#__PURE__*/_jsx(\"p\",{})});}const containerStyle={height:\"100%\",display:\"flex\",background:\"none transparent\",justifyContent:\"center\",alignItems:\"center\",overflow:\"visible\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"IFrameContainer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./IFrameContainer.map"],"mappings":"yOAGsO,SAAwB,EAAgB,EAAM,CAAC,IAAM,EAAIA,EAAM,OAAO,KAAK,CAAM,CAAC,EAAQ,GAAYA,EAAM,SAAS,GAAK,CAAO,EAAe,GAAG,CAAC,EAAW,GAAM,EAW9R,OAXiS,EAAM,cAAc,CAAC,IAAM,EAAkB,EAAM,UAAU,MAAM,IAAI,CAAO,EAAmB,EAAO,SAAS,OAAO,MAAM,IAAI,CAAO,EAAa,IAAI,gBAAgB,CAAC,GAAG,EAAkB,OAAO,EAAE,OAAO,YAAY,IAAI,gBAAgB,EAAkB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAmB,OAAO,EAAE,OAAO,YAAY,IAAI,gBAAgB,EAAmB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAO,EAAS,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