{"version":3,"file":"AuthUtility.CiXM40KA.mjs","names":[],"sources":["https:/framerusercontent.com/modules/K2WMRiI0IgCCCV5XrT58/Wyn7PzZa4vO3tVYZmqpT/AuthUtility.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";function parseCookies(cookieString){return cookieString.split(\"; \").reduce((cookies,cookie)=>{const[name,value]=cookie.split(\"=\");cookies[name]=decodeURIComponent(value);return cookies;},{});}export function withShareCodeText(Component){return function WrappedComponent(props){const[sharecode,setSharecode]=useState(\"No sharecode\");useEffect(()=>{const referralCode=localStorage.getItem(\"personal_referral_code\");const qrLink=localStorage.getItem(\"qr_link\");if(qrLink){setSharecode(qrLink);}else if(referralCode){setSharecode(`jazari.money/rewards?code=${referralCode}`);}},[]);return /*#__PURE__*/_jsx(Component,{...props,text:sharecode});};}export function withEmailText(Component){return function WrappedComponent(props){const[email,setEmail]=useState(\"\");useEffect(()=>{const storedEmail=localStorage.getItem(\"user_email\");if(storedEmail){setEmail(storedEmail);}},[]);return /*#__PURE__*/_jsx(Component,{...props,text:email||\"\"});};}export function withLoginText(Component){return function WrappedComponent(props){const[loginText,setLoginText]=useState(\"\");const buttonRef=useRef();const source=window.location.search;useEffect(()=>{const clickHandler=function(){const storedEmail=localStorage.getItem(\"user_email\");if(storedEmail){window.location.replace(\"https://whatsapp.jazari.money/web/Logout\");}else{window.location.replace(\"https://whatsapp.jazari.money/web/Login\");}};if(buttonRef?.current){buttonRef.current.addEventListener(\"click\",clickHandler);}return()=>{window.removeEventListener(\"click\",clickHandler);};},[buttonRef]);useEffect(()=>{const storedEmail=localStorage.getItem(\"user_email\");if(storedEmail){setLoginText(\"Logout\");}},[]);return /*#__PURE__*/_jsx(Component,{...props,text:loginText,ref:buttonRef});};}export function withMockRewardList(Component){return props=>{const rewards=[{image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_join.png\",is_completed:true,title:\"Join the Waitlist\"},{image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_1.png\",is_completed:true,title:\"Invite 1 friend\"},{title:\"Invite 2 friends\",image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_2.png\",is_completed:true},{title:\"Invite 3 friends\",image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_3.png\",is_completed:false},{title:\"Invite 4 friends\",image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_4.png\",is_completed:false},{title:\"Invite 5 friends\",image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_5.png\",is_completed:false},{title:\"Invite 6 friends\",image_url:\"https://storage.googleapis.com/jazaricdn/static/waitlist/reward_6.png\",is_completed:false}];const rewardCounter=rewards.filter(rw=>rw.is_completed).length;return /*#__PURE__*/_jsx(Component,{...props,rewards:rewards,rewardCounter:rewardCounter});};}function getCachedRewards(){const rawRewards=localStorage.getItem(\"user_rewards\");if(rawRewards){const rwds=JSON.parse(rawRewards)[\"rewards\"];return rwds;}return[];}export function withRewardList(Component){return props=>{const[rewards,setRewards]=useState([]);const setRewardsHandler=()=>{setRewards(getCachedRewards());};useEffect(()=>{setRewardsHandler();const interval=setInterval(()=>{if(rewards.length===0){console.log(\"check rewards\");setRewardsHandler();}},1e3);return()=>{clearInterval(interval);};},[rewards.length]);const rewardCounter=rewards.filter(rw=>rw.is_completed).length;return /*#__PURE__*/_jsx(Component,{...props,rewards:rewards,rewardCounter:rewardCounter});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withMockRewardList\":{\"type\":\"reactHoc\",\"name\":\"withMockRewardList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShareCodeText\":{\"type\":\"reactHoc\",\"name\":\"withShareCodeText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRewardList\":{\"type\":\"reactHoc\",\"name\":\"withRewardList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLoginText\":{\"type\":\"reactHoc\",\"name\":\"withLoginText\",\"annotations\":{\"framerContractVersion\":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