PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | assets/orderbump.js +1 -1 1.3.21 → 1.6.5 View file →
@@ -1 +1 @@
1 -import{U as g}from"./chunks/Url.js?ver=1.3.21";import"./chunks/Str.js?ver=1.3.21";import"./chunks/Arr.js?ver=1.3.21";import"./chunks/vue-router.js?ver=1.3.21";import"./chunks/vue.esm-bundler.js?ver=1.3.21";document.addEventListener("DOMContentLoaded",function(){const u=document.querySelectorAll("[data-fct_order_bump]");u&&u.forEach(t=>{t.addEventListener("input",function(s){var o,p;s.preventDefault();let c=t.getAttribute("data-upgrade_to"),i=t.getAttribute("data-upgrade_form"),_=t.getAttribute("data-fct_bump_id");const d=s.target.checked;if(d||(i=t.getAttribute("data-upgrade_to"),c=t.getAttribute("data-upgrade_form")),(!c||!i)&&!_)return;(p=(o=window.fluent_cart_checkout_ui_service)==null?void 0:o.disableCheckoutButton)==null||p.call(o);let l=window.fluentcart_checkout_vars.ajaxurl+"?action=fluent_cart_checkout_routes&fc_checkout_action=apply_order_bump";const h=new URLSearchParams(window.location.search),a={};h.has("fct_cart_hash")&&(a.fct_cart_hash=h.get("fct_cart_hash")),a.upgrade_to=c,a.upgrade_form=i,a.is_upgraded=d?"yes":"no",a.bump_id=_;const f=g.appendQueryParams(l,a);fetch(f,{method:"POST",headers:{"X-WP-Nonce":window.fluentCartRestVars.rest.nonce,"Content-Type":"application/json"},credentials:"include"}).then(r=>{let e=r.json(),n=r.ok;return e.then(m=>({isOk:n,data:m}))}).then(r=>{var e;if(!r.isOk)throw new Error(r.data.message||"Something went wrong");if((e=r.data)!=null&&e.shipping_changed){window.location.reload();return}window.dispatchEvent(new Event("fluentCartNotifyCartDrawerItemChanged"))}).catch(r=>{var e,n;t.checked=!d,(n=(e=window.fluent_cart_checkout_ui_service)==null?void 0:e.enableCheckoutButton)==null||n.call(e)})})})});
1 +import{U as g}from"./chunks/Url.js?ver=1.6.5";import"./chunks/Str.js?ver=1.6.5";import"./chunks/Arr.js?ver=1.6.5";import"./chunks/vue-router.js?ver=1.6.5";import"./chunks/vue.esm-bundler.js?ver=1.6.5";document.addEventListener("DOMContentLoaded",function(){const s=document.querySelectorAll("[data-fct_order_bump]");s&&s.forEach(a=>{a.addEventListener("input",function(u){var n,f;u.preventDefault();let c=a.getAttribute("data-upgrade_to"),i=a.getAttribute("data-upgrade_form"),_=a.getAttribute("data-fct_bump_id");const d=u.target.checked;if(d||(i=a.getAttribute("data-upgrade_to"),c=a.getAttribute("data-upgrade_form")),(!c||!i)&&!_)return;(f=(n=window.fluent_cart_checkout_ui_service)==null?void 0:n.disableCheckoutButton)==null||f.call(n);let p=window.fluentcart_checkout_vars.ajaxurl+"?action=fluent_cart_checkout_routes&fc_checkout_action=apply_order_bump";const h=new URLSearchParams(window.location.search),r={};h.has("fct_cart_hash")&&(r.fct_cart_hash=h.get("fct_cart_hash")),r.upgrade_to=c,r.upgrade_form=i,r.is_upgraded=d?"yes":"no",r.bump_id=_;const l=g.appendQueryParams(p,r);fetch(l,{method:"POST",headers:{"X-WP-Nonce":window.fluentCartRestVars.rest.nonce,"Content-Type":"application/json"},credentials:"include"}).then(t=>{let e=t.json(),o=t.ok;return e.then(m=>({isOk:o,data:m}))}).then(t=>{var e;if(!t.isOk)throw new Error(t.data.message||"Something went wrong");if((e=t.data)!=null&&e.shipping_changed){window.location.reload();return}window.dispatchEvent(new Event("fluentCartNotifyCartDrawerItemChanged"))}).catch(t=>{var e,o;a.checked=!d,(o=(e=window.fluent_cart_checkout_ui_service)==null?void 0:e.enableCheckoutButton)==null||o.call(e),typeof Toastify<"u"&&new Toastify({text:t.message,className:"warning",duration:3e3}).showToast()})})})});