{"version":3,"file":"appendUrlParams.DLFitYPI.mjs","names":[],"sources":["https:/framerusercontent.com/modules/D3BBMlOaHmj26uZGC87x/rBvJZx0mgjBZ8MWCBgQz/appendUrlParams.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({affiliate:null,via:null,returnTo:null,ctaButtonText:null,finalUrl:null});// Append \"via\", \"return_to\", \"cta_button_text\" into CTA\nexport function appendUrlParams(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{if(window){const searchParams=new URLSearchParams(window.location.search);const returnTo=searchParams.get(\"return_to\");const via=searchParams.get(\"via\");const affiliate=searchParams.get(\"affiliate\");const ctaButtonText=searchParams.get(\"cta_button_text\");if(returnTo){setStore({returnTo:returnTo});}if(via){setStore({via:via});}if(affiliate){setStore({affiliate:affiliate});}if(ctaButtonText){setStore({ctaButtonText:ctaButtonText});}}},[]);return /*#__PURE__*/_jsx(Component,{...props,onClick:()=>{event.preventDefault();const gotoUrl=new URL(props.link);if(store.returnTo){gotoUrl.searchParams.append(\"return_to\",store.returnTo);}if(store.via){gotoUrl.searchParams.append(\"via\",store.via);}if(store.affiliate){gotoUrl.searchParams.append(\"affiliate\",store.affiliate);}if(store.ctaButtonText){gotoUrl.searchParams.append(\"cta_button_text\",store.ctaButtonText);}window.location.href=gotoUrl.toString();}});};}export function checkoutModalEventWithParams(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{if(window){const url=new URL(props.link);const searchParams=new URLSearchParams(window.location.search);searchParams.forEach((value,key)=>{url.searchParams.append(key,value);});setStore({finalUrl:url.href});}},[props]);return /*#__PURE__*/_jsx(Component,{...props,link:store.finalUrl,onClick:event1=>{const url=new URL(store.finalUrl);const openCheckoutModalEventData={detail:{price_id:url.searchParams.get(\"price_id\"),utm_medium:\"web\",utm_source:\"pricing\",affiliate:store.affiliate,fallback_link:store.finalUrl,parent_event:event1}};const openCheckoutModalEvent=new CustomEvent(\"open-checkout-modal\",openCheckoutModalEventData);window.dispatchEvent(openCheckoutModalEvent);}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"checkoutModalEventWithParams\":{\"type\":\"reactHoc\",\"name\":\"checkoutModalEventWithParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"appendUrlParams\":{\"type\":\"reactHoc\",\"name\":\"appendUrlParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./appendUrlParams.map"],"mappings":"uLAEA,SAAgB,EAAgB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAM,GAAU,GAAU,CAAyc,OAAxc,MAAc,CAAC,GAAG,EAAO,CAAC,IAAM,EAAa,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAS,EAAa,IAAI,YAAY,CAAO,EAAI,EAAa,IAAI,MAAM,CAAO,EAAU,EAAa,IAAI,YAAY,CAAO,EAAc,EAAa,IAAI,kBAAkB,CAAI,GAAU,EAAS,CAAU,WAAS,CAAC,CAAK,GAAK,EAAS,CAAK,MAAI,CAAC,CAAK,GAAW,EAAS,CAAW,YAAU,CAAC,CAAK,GAAe,EAAS,CAAe,gBAAc,CAAC,GAAK,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,YAAY,CAAC,MAAM,gBAAgB,CAAC,IAAM,EAAQ,IAAI,IAAI,EAAM,KAAK,CAAI,EAAM,UAAU,EAAQ,aAAa,OAAO,YAAY,EAAM,SAAS,CAAK,EAAM,KAAK,EAAQ,aAAa,OAAO,MAAM,EAAM,IAAI,CAAK,EAAM,WAAW,EAAQ,aAAa,OAAO,YAAY,EAAM,UAAU,CAAK,EAAM,eAAe,EAAQ,aAAa,OAAO,kBAAkB,EAAM,cAAc,CAAE,EAAO,SAAS,KAAK,EAAQ,UAAU,EAAG,CAAC,yBAFx8B,IAA6B,IAAqE,CACvI,EAAS,EAAY,CAAC,UAAU,KAAK,IAAI,KAAK,SAAS,KAAK,cAAc,KAAK,SAAS,KAAK,CAAC"}