{"version":3,"file":"LoginButton.DWMf7wKb.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Njgb3VnWpZqN6hkWSHQz/foXjzoe7usZWa9dvyHf6/LoginButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";import{useEffect,useState}from\"react\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withTracking(Component){return props=>{// Utilisation des hooks useState pour stocker l'URL complète\nconst[fullUrl,setFullUrl]=useState(\"\");// Utilisation de useEffect pour capturer tous les paramètres de l'URL lors du chargement du composant\nuseEffect(()=>{const currentUrl=new URL(window.location.href);const params=new URLSearchParams(currentUrl.search);const loginUrl=new URL(\"https://app.magicpost.in/login\");if(!params.toString()){// Aucun paramètre existant, donc on génère les paramètres UTM selon le referrer\nconst utmParams=getUTMParametersBasedOnReferrer();Object.entries(utmParams).forEach(([key,value])=>{loginUrl.searchParams.append(key,value);});}else{// Ajout de tous les paramètres existants\nparams.forEach((value,key)=>{loginUrl.searchParams.append(key,value);});}// Mise à jour de l'URL complète dans l'état\nsetFullUrl(loginUrl.toString());},[]);return /*#__PURE__*/_jsx(Component,{...props,href:fullUrl});};}function getUTMParametersBasedOnReferrer(){const referrer=document.referrer||window.location.hostname;const currentHost=window.location.hostname;let utmSource=\"direct\"// Valeur par défaut si aucun referrer\n;let regex=new RegExp(`https?://${currentHost}([^?]*)`);let match=referrer.match(regex);let utmMedium=match?match[1]:\"none\";let currentPathName=window.location.pathname;let utmTerm=window.location.pathname;if(!sessionStorage.getItem(\"firstPage\")){// If not, set the key with the current URL\nsessionStorage.setItem(\"firstPage\",currentPathName);}// Retrieve the first page visited\nconst firstPage=sessionStorage.getItem(\"firstPage\");let utmContent=firstPage;// Gérer les référents externes\nconst refDomains={\"google.\":[\"google\",\"organic\"],\"facebook.\":[\"facebook\",\"social\"],\"twitter.\":[\"twitter\",\"social\"],\"linkedin.\":[\"linkedin\",\"social\"]};let found=false;for(const domain in refDomains){if(referrer.includes(domain)){[utmSource,utmMedium]=refDomains[domain];found=true;break;}}return{utm_source:utmSource,utm_medium:utmMedium,utm_campaign:\"referral_tracking\",utm_content:utmContent,utm_term:utmTerm};}// Fonction pour ajouter un ID à un composant\nexport function withId(Component){return props=>{// Assurez-vous d'assigner un nouvel objet props pour éviter de modifier directement les props originales\nconst newProps={...props,id:\"loginButton\"}// Remplacez \"yourCustomId\" par l'ID que vous souhaitez ajouter\n;return /*#__PURE__*/_jsx(Component,{...newProps});};}export function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}export function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}export function withRandomColor(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withId\":{\"type\":\"reactHoc\",\"name\":\"withId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTracking\":{\"type\":\"reactHoc\",\"name\":\"withTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LoginButton.map"],"mappings":"+SACmD,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CACzG,GAAK,CAAC,EAAQ,GAAYA,EAAS,GAAG,CAIA,OAHtC,MAAc,CAAC,IAAM,EAAW,IA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