{"version":3,"file":"AB_Checkout.CO2f4uUI.mjs","names":["__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","init_jsx_runtime","ce","bookedFrom","saved","ref","loadHapanaScript","HAPANA_SRC","script","withHapanaCheckoutPage","w","from","Component","props","withIntroPurchase","init_AB_Checkout"],"sources":["https:/framerusercontent.com/modules/mFQyWJIY7HZg9GUqz3hJ/i27aAaU8d6fSoiOoJA9y/AB_Checkout.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";// Dedicated intro-offer checkout page (/intro-offer/checkout) and its thank-you page.\n// Loads Hapana's widget script so the in-page <hapana-widget> form renders, and\n// records one CheckoutPageView per page load on the Meta pixel and GA.\nconst HAPANA_SRC=\"https://widget.hapana.com/hapana_widget.js\";// Where the visitor came from: the page and button saved by Lead_Tracking on click,\n// or the previous page on this site, or \"direct\".\nfunction bookedFrom(){try{const saved=JSON.parse(sessionStorage.getItem(\"dpFrom\")||\"null\");if(saved?.page)return{from_page:saved.page,from_cta:saved.cta||\"unknown\"};}catch{}try{const ref=document.referrer?new URL(document.referrer):null;if(ref&&ref.host===window.location.host)return{from_page:ref.pathname,from_cta:\"untracked\"};if(ref)return{from_page:\"external:\"+ref.host,from_cta:\"none\"};}catch{}return{from_page:\"direct\",from_cta:\"none\"};}function loadHapanaScript(){if(typeof document===\"undefined\")return;if(document.querySelector(`script[src=\"${HAPANA_SRC}\"]`))return;const script=document.createElement(\"script\");script.src=HAPANA_SRC;script.async=true;document.head.appendChild(script);}export function withHapanaCheckoutPage(Component){return props=>{useEffect(()=>{loadHapanaScript();const w=window;if(w.__dpCheckoutViewSent)return;w.__dpCheckoutViewSent=true;const from=bookedFrom();try{sessionStorage.setItem(\"dpFrom\",JSON.stringify({page:from.from_page,cta:from.from_cta}));}catch{}w.fbq?.(\"trackCustom\",\"CheckoutPageView\",{variant:\"B\",...from});w.gtag?.(\"event\",\"begin_checkout\",{variant:\"B\",...from});},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// Thank-you page (/intro-offer/welcome). Hapana redirects here after a successful\n// purchase, so a view of this page is the conversion. Sent once per browser session\n// so a refresh or revisit doesn't count twice.\nexport function withIntroPurchase(Component){return props=>{useEffect(()=>{const w=window;try{if(sessionStorage.getItem(\"dpIntroPurchaseSent\"))return;sessionStorage.setItem(\"dpIntroPurchaseSent\",\"1\");}catch{if(w.__dpIntroPurchaseSent)return;w.__dpIntroPurchaseSent=true;}const from=bookedFrom();w.fbq?.(\"trackCustom\",\"IntroPurchase\",{value:50,currency:\"AUD\",...from});w.gtag?.(\"event\",\"purchase\",{value:50,currency:\"AUD\",items:[{item_name:\"Intro Offer\"}],...from});},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHapanaCheckoutPage\":{\"type\":\"reactHoc\",\"name\":\"withHapanaCheckoutPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withIntroPurchase\":{\"type\":\"reactHoc\",\"name\":\"withIntroPurchase\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AB_Checkout.map"],"mappings":"A,gIAKA,SAASO,GAAY,CAAC,GAAG,CAAC,IAAMC,EAAM,KAAK,MAAM,eAAe,QAAQ,QAAQ,GAAG,MAAM,EAAE,GAAGA,GAAO,KAAK,MAAM,CAAC,UAAUA,EAAM,KAAK,SAASA,EAAM,KAAK,SAAS,CAAE,MAAM,CAAC,CAAC,GAAG,CAAC,IAAMC,EAAI,SAAS,SAAS,IAAI,IAAI,SAAS,QAAQ,EAAE,KAAK,GAAGA,GAAKA,EAAI,OAAON,EAAO,SAAS,KAAK,MAAM,CAAC,UAAUM,EAAI,SAAS,SAAS,WAAW,EAAE,GAAGA,EAAI,MAAM,CAAC,UAAU,YAAYA,EAAI,KAAK,SAAS,MAAM,CAAE,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,SAAS,SAAS,MAAM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