{"version":3,"file":"PromoCodeComponent.Cju0H5Fy.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/RZlCalNh6qwwrYVWn74w/LAkvHmKqGDE3noFNuXhR/PromoCodeComponent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";// Helper: get the promo code from cookies\nfunction getPromoCookie(){console.log(\"All cookies:\",document.cookie);const match=document.cookie.match(/(^|;) *promoCode=([^;]*)/);console.log(\"Checking for promo code in cookie:\",match);return match?decodeURIComponent(match[2]):null;}// Component: updates all Stripe links on the page\nexport function UpdatePaymentLinks(){const[promoCode,setPromoCode]=useState(null);useEffect(()=>{console.log(\"useEffect running...\");const promo=getPromoCookie();console.log(\"Promo code found in cookie:\",promo);if(!promo)return;setPromoCode(promo);// Delay execution until after Framer renders\nsetTimeout(()=>{const paymentLinks=document.querySelectorAll('a[href*=\"/checkout?plan=\"]');console.log(\"Found payment links:\",paymentLinks);paymentLinks.forEach((link,index)=>{const url=new URL(link.href,window.location.origin)// safety for relative hrefs\n;url.searchParams.set(\"prefilled_promo_code\",promo);link.href=url.toString();console.log(`Updated link ${index+1}: ${link.href}`);});},250)// try 250ms or more\n;},[]);return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"},\"aria-hidden\":\"true\"});}\nexport const __FramerMetadata__ = {\"exports\":{\"UpdatePaymentLinks\":{\"type\":\"reactComponent\",\"name\":\"UpdatePaymentLinks\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PromoCodeComponent.map"],"mappings":"uIACA,SAAS,GAAgB,CAAC,QAAQ,IAAI,eAAe,SAAS,OAAO,CAAC,IAAM,EAAM,SAAS,OAAO,MAAM,2BAA2B,CAAyD,OAAxD,QAAQ,IAAI,qCAAqC,EAAM,CAAQ,EAAM,mBAAmB,EAAM,GAAG,CAAC,KACtO,SAAgB,GAAoB,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,KAAK,CAG1E,OAH2E,MAAc,CAAC,QAAQ,IAAI,uBAAuB,CAAC,IAAM,EAAM,GAAgB,CAAC,QAAQ,IAAI,8BAA8B,EAAM,CAAK,IAAa,EAAa,EAAM,CACvP,eAAe,CAAC,IAAM,EAAa,SAAS,iBAAiB,6BAA6B,CAAC,QAAQ,IAAI,uBAAuB,EAAa,CAAC,EAAa,SAAS,EAAK,IAAQ,CAAC,IAAM,EAAI,IAAI,IAAI,EAAK,KAAK,EAAO,SAAS,OAAO,CAClO,EAAI,aAAa,IAAI,uBAAuB,EAAM,CAAC,EAAK,KAAK,EAAI,UAAU,CAAC,QAAQ,IAAI,gBAAgB,EAAM,EAAE,IAAI,EAAK,OAAO,EAAG,EAAG,IAAI,GACxI,EAAE,CAAC,CAAqB,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,CAAC,cAAc,OAAO,CAAC,sBALzC,IAAsC"}