@revley/sandbox-checkout-package 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/iife/index.global.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var H=(c,l,p,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of U(l))!x.call(c,d)&&d!==p&&P(c,d,{get:()=>l[d],enumerable:!(y=M(l,d))||y.enumerable});return c};var j=c=>H(P({},"__esModule",{value:!0}),c);var N={};module.exports=j(N);var B=(c,l)=>{var R,T;if(window.__checkoutInterceptInstalled)return;window.__checkoutInterceptInstalled=!0;let p=[/^\/(?:cart\/)?checkout(?:[?#]|$)/i,/^\/checkouts(?:\/|$|\?|#)/i],y=!1,d=(...t)=>y?console.debug("[checkout-intercept]",...t):void 0,S=t=>t.replace(/\/+$/,""),A=t=>t.endsWith(".myshopify.com")||t===location.hostname;function w(t,e=location.origin){try{return t instanceof URL?t:new URL(String(t),e)}catch{return null}}function m(t){let e=w(t);if(!e||!A(e.hostname))return!1;let r=S(e.pathname),n=p.some(i=>i.test(r));return n&&d("detected checkout-like URL:",String(e)),n}function C(t){let e=t==null?void 0:t.getAttribute("variant-params");if(!e)return null;let r=e.includes(""")?e.replace(/"/g,'"'):e;try{let n=JSON.parse(r);return Array.isArray(n)?n:null}catch{return null}}async function I(t,e=1){let r=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(t),quantity:e}]}),credentials:"same-origin"});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`cart/add.js failed (${r.status}): ${n}`)}return r.json()}async function g(){let e=await(await fetch("/cart.js")).json(),r={},n=["_fbp","_fbc","_fbq","_ig_","_igbp","_igshid","_igsh","_ig_visitor_id","_gclid","_gcl_au","_gcl_aw","_gcl_dc","_gcl_gb","_ttp","_tt_enable_cookie","_scid","_sctr","_pin_unauth","_pin_id","_twitter_ads_id","_li_ss","_uetsid","_uetvid","_amzn","_amzn_ads_","_yclid","_ycl_","_rdt_uid","_quora_","_tb_","_ob_","_criteo_","_adobe_","_ttd_","_dv360_","_fbcv","_shopify_pixel_"],i=_=>n.some(h=>_===h||_.startsWith(h)||_.includes(h));document.cookie&&document.cookie.split(";").forEach(_=>{let h=_.trim();if(h){let[b,...O]=h.split("="),E=O.join("=");b&&E&&i(b)&&(r[b]=E)}});let o=`gid://shopify/Cart/${e.token}`,a=await(await fetch(`${l}/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storeId:c,cartId:o,cookies:r})})).text();if(console.log("checkoutUrl",a),!a){console.error("No checkout ID received from backend");return}let f=w(a);if(!f){console.error("Invalid checkout URL received from backend:",a);return}sessionStorage.setItem("__revley_checkout_redirect","1"),location.assign(f.href)}let v=!1;function s(t){return v||!m(t)?!1:(v=!0,g(),!0)}if(window.__isCheckoutLike=m,window.__maybeRedirect=s,(R=window.Shopify)!=null&&R.designMode)return;window.addEventListener("pageshow",t=>{t.persisted&&sessionStorage.getItem("__revley_checkout_redirect")&&(sessionStorage.removeItem("__revley_checkout_redirect"),location.reload())});{let t=window.location,e=t.assign.bind(t),r=t.replace.bind(t);try{Object.defineProperty(t,"assign",{value:n=>{s(n)||e(n)},writable:!0,configurable:!0}),Object.defineProperty(t,"replace",{value:n=>{s(n)||r(n)},writable:!0,configurable:!0})}catch(n){d("Could not override location methods, relying on Service Worker:",n)}}{let t=window.open;window.open=function(e,r,n){return e&&s(e)?null:t.call(window,e,r,n)}}{let t=history.pushState.bind(history),e=history.replaceState.bind(history);history.pushState=function(r,n,i){if(!(i!=null&&s(i)))return t(r,n,i)},history.replaceState=function(r,n,i){if(!(i!=null&&s(i)))return e(r,n,i)},addEventListener("popstate",()=>void s(location.href),!0)}{let t=e=>e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0;addEventListener("click",e=>{let r=e;if(r.defaultPrevented||t(r))return;let n=e.target;for(;n&&n.nodeType===1&&n.tagName!=="A";)n=n.parentElement;let i=n;!i||!i.href||m(i.href)&&(r.preventDefault(),r.stopPropagation(),g())},!0)}{let t=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){try{if(k(this))return t.call(this);let r=this.getAttribute("action")||"";if(s(r)||Array.from(this.elements).some(i=>(i==null?void 0:i.name)==="checkout")&&s("/checkout"))return}catch{}return t.call(this)},addEventListener("submit",e=>{try{let r=e.target;if(k(r))return;let n=(r==null?void 0:r.getAttribute("action"))||"",i=Array.from((r==null?void 0:r.elements)||[]);(m(n)||i.some(o=>(o==null?void 0:o.name)==="checkout"))&&(e.preventDefault(),e.stopPropagation(),g())}catch{}},!0)}{let t=location.href;setInterval(()=>{location.href!==t&&(t=location.href,s(t))},250)}{let t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(r,n,i,o,u){try{typeof n=="string"&&m(n)&&s(n)}catch{}return t.call(this,r,n,!!i,o,u)}}{let t=window.fetch.bind(window);window.fetch=function(r,n){try{let i=typeof r=="string"||r instanceof URL?String(r):r.url;i&&m(i)&&s(i)}catch{}return t(r,n)}}let k=t=>t?Array.from(t.elements).some(e=>{var n,i;let r=e;return((n=r.name)==null?void 0:n.includes("__kaching_bundles"))||((i=r.name)==null?void 0:i.includes("kaching"))||t.classList.contains("kaching-form")}):!1;document.addEventListener("click",async t=>{var i,o,u;let e=t.target,r=(i=e==null?void 0:e.closest)==null?void 0:i.call(e,"button.shopify-payment-button__button");if(!r)return;let n=r.closest("shopify-accelerated-checkout");if(n){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation();try{let a=C(n),f=(u=(o=a==null?void 0:a[0])==null?void 0:o.id)!=null?u:51504147202335;if(!f)throw new Error("Could not determine variant id");try{window.upcartOpenOnAddToCartOverride=!1,window.upcartShouldOpenOnAddToCartBackgroundNetworkCall=!1}catch{console.log("Failed to prevent upcart from opening")}await I(f,1),await g()}catch(a){console.error("Intercepted Buy It Now failed; falling back:",a),window.location.assign("/checkout")}}},!0);{let t={},e;(T=window.kachingCartApi)!=null&&T.updateTieredPromotionsBar&&(e=window.kachingCartApi.updateTieredPromotionsBar,Object.assign(t,window.kachingCartApi)),window.kachingCartApi=new Proxy(t,{get(r,n){return n==="updateTieredPromotionsBar"?async function(...i){throw document.querySelectorAll(".shop-add-to-cart-button.product-form_submit").forEach(o=>{var a;o.disabled=!0,o.style.pointerEvents="none",o.style.opacity="0.5";let u=o.cloneNode(!0);u.disabled=!0,u.style.pointerEvents="none",u.style.opacity="0.5",(a=o.parentNode)==null||a.replaceChild(u,o)}),e&&await e.apply(this,i),await Promise.all([new Promise(o=>setTimeout(o,1e4)),g()]),new Error("STOP")}:r[n]},set(r,n,i){return n==="updateTieredPromotionsBar"&&(e=i,d("Kaching updateTieredPromotionsBar captured")),r[n]=i,!0}})}function L(){var r;let t=document.querySelector("#kaching-cart__checkout-button");if(!t||t.dataset.revleyReplaced)return;let e=t.cloneNode(!0);e.querySelectorAll(".kaching-cart__loading-spinner").forEach(n=>n.remove()),e.dataset.revleyReplaced="true",e.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),e.disabled=!0,e.style.pointerEvents="none",e.style.opacity="0.5",g()}),(r=t.parentNode)==null||r.replaceChild(e,t)}L(),new MutationObserver(()=>L()).observe(document.body,{childList:!0,subtree:!0})},q=()=>{let c=document.currentScript;if(!c)return;let l=c.dataset.revleyStoreId,p=c.dataset.revleyCheckoutHost;l&&p&&B(l,p)};q();
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C=(d,m)=>{if(window.__checkoutInterceptInstalled)return;window.__checkoutInterceptInstalled=!0;let g=[/^\/(?:cart\/)?checkout(?:[?#]|$)/i,/^\/checkouts(?:\/|$|\?|#)/i],P=!1,f=(...t)=>P?console.debug("[checkout-intercept]",...t):void 0,R=t=>t.replace(/\/+$/,""),T=t=>t.endsWith(".myshopify.com")||t===location.hostname;function y(t,e=location.origin){try{return t instanceof URL?t:new URL(String(t),e)}catch{return null}}function c(t){let e=y(t);if(!e||!T(e.hostname))return!1;let n=R(e.pathname),r=g.some(i=>i.test(n));return r&&f("detected checkout-like URL:",String(e)),r}function E(t){let e=t?.getAttribute("variant-params");if(!e)return null;let n=e.includes(""")?e.replace(/"/g,'"'):e;try{let r=JSON.parse(n);return Array.isArray(r)?r:null}catch{return null}}async function S(t,e=1){let n=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(t),quantity:e}]}),credentials:"same-origin"});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`cart/add.js failed (${n.status}): ${r}`)}return n.json()}async function l(){let e=await(await fetch("/cart.js")).json(),n={},r=["_fbp","_fbc","_fbq","_ig_","_igbp","_igshid","_igsh","_ig_visitor_id","_gclid","_gcl_au","_gcl_aw","_gcl_dc","_gcl_gb","_ttp","_tt_enable_cookie","_scid","_sctr","_pin_unauth","_pin_id","_twitter_ads_id","_li_ss","_uetsid","_uetvid","_amzn","_amzn_ads_","_yclid","_ycl_","_rdt_uid","_quora_","_tb_","_ob_","_criteo_","_adobe_","_ttd_","_dv360_","_fbcv","_shopify_pixel_"],i=p=>r.some(u=>p===u||p.startsWith(u)||p.includes(u));document.cookie&&document.cookie.split(";").forEach(p=>{let u=p.trim();if(u){let[h,...A]=u.split("="),L=A.join("=");h&&L&&i(h)&&(n[h]=L)}});let o=`gid://shopify/Cart/${e.token}`,_=await(await fetch(`${m}/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storeId:d,cartId:o,cookies:n})})).text();if(console.log("checkoutUrl",_),!_){console.error("No checkout ID received from backend");return}let k=y(_);if(!k){console.error("Invalid checkout URL received from backend:",_);return}sessionStorage.setItem("__revley_checkout_redirect","1"),location.assign(k.href)}let b=!1;function a(t){return b||!c(t)?!1:(b=!0,l(),!0)}if(window.__isCheckoutLike=c,window.__maybeRedirect=a,window.Shopify?.designMode)return;window.addEventListener("pageshow",t=>{t.persisted&&sessionStorage.getItem("__revley_checkout_redirect")&&(sessionStorage.removeItem("__revley_checkout_redirect"),location.reload())});{let t=window.location,e=t.assign.bind(t),n=t.replace.bind(t);try{Object.defineProperty(t,"assign",{value:r=>{a(r)||e(r)},writable:!0,configurable:!0}),Object.defineProperty(t,"replace",{value:r=>{a(r)||n(r)},writable:!0,configurable:!0})}catch(r){f("Could not override location methods, relying on Service Worker:",r)}}{let t=window.open;window.open=function(e,n,r){return e&&a(e)?null:t.call(window,e,n,r)}}{let t=history.pushState.bind(history),e=history.replaceState.bind(history);history.pushState=function(n,r,i){if(!(i!=null&&a(i)))return t(n,r,i)},history.replaceState=function(n,r,i){if(!(i!=null&&a(i)))return e(n,r,i)},addEventListener("popstate",()=>void a(location.href),!0)}{let t=e=>e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0;addEventListener("click",e=>{let n=e;if(n.defaultPrevented||t(n))return;let r=e.target;for(;r&&r.nodeType===1&&r.tagName!=="A";)r=r.parentElement;let i=r;!i||!i.href||c(i.href)&&(n.preventDefault(),n.stopPropagation(),l())},!0)}{let t=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){try{if(w(this))return t.call(this);let n=this.getAttribute("action")||"";if(a(n)||Array.from(this.elements).some(i=>i?.name==="checkout")&&a("/checkout"))return}catch{}return t.call(this)},addEventListener("submit",e=>{try{let n=e.target;if(w(n))return;let r=n?.getAttribute("action")||"",i=Array.from(n?.elements||[]);(c(r)||i.some(o=>o?.name==="checkout"))&&(e.preventDefault(),e.stopPropagation(),l())}catch{}},!0)}{let t=location.href;setInterval(()=>{location.href!==t&&(t=location.href,a(t))},250)}{let t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(n,r,i,o,s){try{typeof r=="string"&&c(r)&&a(r)}catch{}return t.call(this,n,r,!!i,o,s)}}{let t=window.fetch.bind(window);window.fetch=function(n,r){try{let i=typeof n=="string"||n instanceof URL?String(n):n.url;i&&c(i)&&a(i)}catch{}return t(n,r)}}let w=t=>t?Array.from(t.elements).some(e=>{let n=e;return n.name?.includes("__kaching_bundles")||n.name?.includes("kaching")||t.classList.contains("kaching-form")}):!1;document.addEventListener("click",async t=>{let n=t.target?.closest?.("button.shopify-payment-button__button");if(!n)return;let r=n.closest("shopify-accelerated-checkout");if(r){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation();try{let o=E(r)?.[0]?.id??51504147202335;if(!o)throw new Error("Could not determine variant id");try{window.upcartOpenOnAddToCartOverride=!1,window.upcartShouldOpenOnAddToCartBackgroundNetworkCall=!1}catch{console.log("Failed to prevent upcart from opening")}await S(o,1),await l()}catch(i){console.error("Intercepted Buy It Now failed; falling back:",i),window.location.assign("/checkout")}}},!0);{let t={},e;window.kachingCartApi?.updateTieredPromotionsBar&&(e=window.kachingCartApi.updateTieredPromotionsBar,Object.assign(t,window.kachingCartApi)),window.kachingCartApi=new Proxy(t,{get(n,r){return r==="updateTieredPromotionsBar"?async function(...i){throw document.querySelectorAll(".shop-add-to-cart-button.product-form_submit").forEach(o=>{o.disabled=!0,o.style.pointerEvents="none",o.style.opacity="0.5";let s=o.cloneNode(!0);s.disabled=!0,s.style.pointerEvents="none",s.style.opacity="0.5",o.parentNode?.replaceChild(s,o)}),e&&await e.apply(this,i),await Promise.all([new Promise(o=>setTimeout(o,1e4)),l()]),new Error("STOP")}:n[r]},set(n,r,i){return r==="updateTieredPromotionsBar"&&(e=i,f("Kaching updateTieredPromotionsBar captured")),n[r]=i,!0}})}function v(){let t=document.querySelector("#kaching-cart__checkout-button");if(!t||t.dataset.revleyReplaced)return;let e=t.cloneNode(!0);e.querySelectorAll(".kaching-cart__loading-spinner").forEach(n=>n.remove()),e.dataset.revleyReplaced="true",e.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),e.disabled=!0,e.style.pointerEvents="none",e.style.opacity="0.5",l()}),t.parentNode?.replaceChild(e,t)}v(),new MutationObserver(()=>v()).observe(document.body,{childList:!0,subtree:!0})},I=()=>{let d=document.currentScript;if(!d)return;let m=d.dataset.revleyStoreId,g=d.dataset.revleyCheckoutHost;m&&g&&C(m,g)};I();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var SandboxCheckoutPkg=(()=>{var
|
|
1
|
+
"use strict";var SandboxCheckoutPkg=(()=>{var P=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var H=(c,l,p,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of U(l))!x.call(c,d)&&d!==p&&P(c,d,{get:()=>l[d],enumerable:!(y=M(l,d))||y.enumerable});return c};var j=c=>H(P({},"__esModule",{value:!0}),c);var N={};var B=(c,l)=>{var R,T;if(window.__checkoutInterceptInstalled)return;window.__checkoutInterceptInstalled=!0;let p=[/^\/(?:cart\/)?checkout(?:[?#]|$)/i,/^\/checkouts(?:\/|$|\?|#)/i],y=!1,d=(...t)=>y?console.debug("[checkout-intercept]",...t):void 0,S=t=>t.replace(/\/+$/,""),A=t=>t.endsWith(".myshopify.com")||t===location.hostname;function w(t,e=location.origin){try{return t instanceof URL?t:new URL(String(t),e)}catch(n){return null}}function m(t){let e=w(t);if(!e||!A(e.hostname))return!1;let n=S(e.pathname),r=p.some(i=>i.test(n));return r&&d("detected checkout-like URL:",String(e)),r}function C(t){let e=t==null?void 0:t.getAttribute("variant-params");if(!e)return null;let n=e.includes(""")?e.replace(/"/g,'"'):e;try{let r=JSON.parse(n);return Array.isArray(r)?r:null}catch(r){return null}}async function I(t,e=1){let n=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(t),quantity:e}]}),credentials:"same-origin"});if(!n.ok){let r=await n.text().catch(()=>"");throw new Error(`cart/add.js failed (${n.status}): ${r}`)}return n.json()}async function g(){let e=await(await fetch("/cart.js")).json(),n={},r=["_fbp","_fbc","_fbq","_ig_","_igbp","_igshid","_igsh","_ig_visitor_id","_gclid","_gcl_au","_gcl_aw","_gcl_dc","_gcl_gb","_ttp","_tt_enable_cookie","_scid","_sctr","_pin_unauth","_pin_id","_twitter_ads_id","_li_ss","_uetsid","_uetvid","_amzn","_amzn_ads_","_yclid","_ycl_","_rdt_uid","_quora_","_tb_","_ob_","_criteo_","_adobe_","_ttd_","_dv360_","_fbcv","_shopify_pixel_"],i=_=>r.some(h=>_===h||_.startsWith(h)||_.includes(h));document.cookie&&document.cookie.split(";").forEach(_=>{let h=_.trim();if(h){let[b,...O]=h.split("="),E=O.join("=");b&&E&&i(b)&&(n[b]=E)}});let o=`gid://shopify/Cart/${e.token}`,a=await(await fetch(`${l}/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storeId:c,cartId:o,cookies:n})})).text();if(console.log("checkoutUrl",a),!a){console.error("No checkout ID received from backend");return}let f=w(a);if(!f){console.error("Invalid checkout URL received from backend:",a);return}sessionStorage.setItem("__revley_checkout_redirect","1"),location.assign(f.href)}let v=!1;function s(t){return v||!m(t)?!1:(v=!0,g(),!0)}if(window.__isCheckoutLike=m,window.__maybeRedirect=s,(R=window.Shopify)!=null&&R.designMode)return;window.addEventListener("pageshow",t=>{t.persisted&&sessionStorage.getItem("__revley_checkout_redirect")&&(sessionStorage.removeItem("__revley_checkout_redirect"),location.reload())});{let t=window.location,e=t.assign.bind(t),n=t.replace.bind(t);try{Object.defineProperty(t,"assign",{value:r=>{s(r)||e(r)},writable:!0,configurable:!0}),Object.defineProperty(t,"replace",{value:r=>{s(r)||n(r)},writable:!0,configurable:!0})}catch(r){d("Could not override location methods, relying on Service Worker:",r)}}{let t=window.open;window.open=function(e,n,r){return e&&s(e)?null:t.call(window,e,n,r)}}{let t=history.pushState.bind(history),e=history.replaceState.bind(history);history.pushState=function(n,r,i){if(!(i!=null&&s(i)))return t(n,r,i)},history.replaceState=function(n,r,i){if(!(i!=null&&s(i)))return e(n,r,i)},addEventListener("popstate",()=>void s(location.href),!0)}{let t=e=>e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0;addEventListener("click",e=>{let n=e;if(n.defaultPrevented||t(n))return;let r=e.target;for(;r&&r.nodeType===1&&r.tagName!=="A";)r=r.parentElement;let i=r;!i||!i.href||m(i.href)&&(n.preventDefault(),n.stopPropagation(),g())},!0)}{let t=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){try{if(k(this))return t.call(this);let n=this.getAttribute("action")||"";if(s(n)||Array.from(this.elements).some(i=>(i==null?void 0:i.name)==="checkout")&&s("/checkout"))return}catch(n){}return t.call(this)},addEventListener("submit",e=>{try{let n=e.target;if(k(n))return;let r=(n==null?void 0:n.getAttribute("action"))||"",i=Array.from((n==null?void 0:n.elements)||[]);(m(r)||i.some(o=>(o==null?void 0:o.name)==="checkout"))&&(e.preventDefault(),e.stopPropagation(),g())}catch(n){}},!0)}{let t=location.href;setInterval(()=>{location.href!==t&&(t=location.href,s(t))},250)}{let t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(n,r,i,o,u){try{typeof r=="string"&&m(r)&&s(r)}catch(a){}return t.call(this,n,r,!!i,o,u)}}{let t=window.fetch.bind(window);window.fetch=function(n,r){try{let i=typeof n=="string"||n instanceof URL?String(n):n.url;i&&m(i)&&s(i)}catch(i){}return t(n,r)}}let k=t=>t?Array.from(t.elements).some(e=>{var r,i;let n=e;return((r=n.name)==null?void 0:r.includes("__kaching_bundles"))||((i=n.name)==null?void 0:i.includes("kaching"))||t.classList.contains("kaching-form")}):!1;document.addEventListener("click",async t=>{var i,o,u;let e=t.target,n=(i=e==null?void 0:e.closest)==null?void 0:i.call(e,"button.shopify-payment-button__button");if(!n)return;let r=n.closest("shopify-accelerated-checkout");if(r){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation();try{let a=C(r),f=(u=(o=a==null?void 0:a[0])==null?void 0:o.id)!=null?u:51504147202335;if(!f)throw new Error("Could not determine variant id");try{window.upcartOpenOnAddToCartOverride=!1,window.upcartShouldOpenOnAddToCartBackgroundNetworkCall=!1}catch(_){console.log("Failed to prevent upcart from opening")}await I(f,1),await g()}catch(a){console.error("Intercepted Buy It Now failed; falling back:",a),window.location.assign("/checkout")}}},!0);{let t={},e;(T=window.kachingCartApi)!=null&&T.updateTieredPromotionsBar&&(e=window.kachingCartApi.updateTieredPromotionsBar,Object.assign(t,window.kachingCartApi)),window.kachingCartApi=new Proxy(t,{get(n,r){return r==="updateTieredPromotionsBar"?async function(...i){throw document.querySelectorAll(".shop-add-to-cart-button.product-form_submit").forEach(o=>{var a;o.disabled=!0,o.style.pointerEvents="none",o.style.opacity="0.5";let u=o.cloneNode(!0);u.disabled=!0,u.style.pointerEvents="none",u.style.opacity="0.5",(a=o.parentNode)==null||a.replaceChild(u,o)}),e&&await e.apply(this,i),await Promise.all([new Promise(o=>setTimeout(o,1e4)),g()]),new Error("STOP")}:n[r]},set(n,r,i){return r==="updateTieredPromotionsBar"&&(e=i,d("Kaching updateTieredPromotionsBar captured")),n[r]=i,!0}})}function L(){var n;let t=document.querySelector("#kaching-cart__checkout-button");if(!t||t.dataset.revleyReplaced)return;let e=t.cloneNode(!0);e.querySelectorAll(".kaching-cart__loading-spinner").forEach(r=>r.remove()),e.dataset.revleyReplaced="true",e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),e.disabled=!0,e.style.pointerEvents="none",e.style.opacity="0.5",g()}),(n=t.parentNode)==null||n.replaceChild(e,t)}L(),new MutationObserver(()=>L()).observe(document.body,{childList:!0,subtree:!0})},q=()=>{let c=document.currentScript;if(!c)return;let l=c.dataset.revleyStoreId,p=c.dataset.revleyCheckoutHost;l&&p&&B(l,p)};q();return j(N);})();
|