PageSourceSearch

https://silverdrive.nl/wp-content/plugins/udesly-wp-app/assets/frontend/js/wc-models-RHNLEW2E.js

js silverdrive.nl collected 2026-09-24 13:32:03 UTC 4,419 bytes, 1 lines download raw bytes

1import{b as h}from"./chunk-SAS2P6YR.js";import{b as y}from"./chunk-DLW5B6TR.js";import{a as n}from"./chunk-NIG36RGU.js";import"./chunk-MM5PEOWL.js";var C=document.getElementById("udesly-wc-mini-cart-elements"),u=JSON.parse(C.textContent),f,k=y()({state:{count:u.count||0,subtotal:u.subtotal||"",total:u.total||"",items:u.items||[],notices:u.notices||[],cartOpen:!1,checkout:u.checkout||{}},reducers:{toggleCart(e){return{...e,cartOpen:!e.cartOpen}},setCartOpen(e,o){return{...e,cartOpen:o}},cartChanged(e){let o=document.getElementById("udesly-wc-mini-cart-elements"),m=JSON.parse(o.textContent);return{...e,...m}},removedFromCart(e,o){return n("removed_from_cart",[o.fragments,o.cart_hash]),n("update_checkout"),n("wc_fragments_refresh"),e},ajaxError(e,o){return console.error(o),e},addedToCart(e,o){return n("added_to_cart",[o.fragments,o.cart_hash]),n("update_checkout"),n("wc_fragments_refresh"),e},appliedCoupon(e,o){if(n("applied_coupon_in_checkout",[o.coupon_code]),n("update_checkout",{update_shipping_method:!1}),e.checkout.coupons||(e.checkout.coupons=[]),e.checkout.coupons.push(o),e.checkout.coupons.length>0){let m=document.querySelector(".w-commerce-commercecheckoutordersummarywrapper");m&&m.scrollIntoView({behavior:"smooth",block:"center"})}return{...e}},updateCheckout(e){return document.body.classList.add("updating-checkout"),e},checkoutUpdated(e){return document.body.classList.remove("updating-checkout"),e},updatedCartQuantity(e,o){return n("added_to_cart",[o.fragments,o.cart_hash]),n("update_checkout"),e},checkoutNotice(e,o){return e},invalidCoupon(e,o){return console.log(o),e.checkout.coupons=[],{...e}}},effects:e=>({async removeFromCart(o,m){let c=new FormData;c.set("cart_item_key",o);let t=await fetch(window.udesly_frontend_options.wc.wc_ajax_url.replace("%%endpoint%%","remove_from_cart"),{method:"POST",body:c});if(t.ok){let r=await t.json();r.success&&r.success===!1?e.woocommerce.ajaxError(t.status):e.woocommerce.removedFromCart(r)}else e.woocommerce.ajaxError(t.status)},async applyCoupon(o,m){jQuery&&jQuery(".woocommerce-error, .woocommerce-message").remove();let c=new FormData;c.set("security",wc_checkout_params.apply_coupon_nonce),c.set("coupon_code",o.coupon_code);let t=await fetch(wc_checkout_params.wc_ajax_url.replace("%%endpoint%%","apply_coupon"),{method:"POST",body:c});if(t.ok){let r=await t.text();e.woocommerce.checkoutNotice(r),n("update_checkout",{update_shipping_method:!1}),e.woocommerce.appliedCoupon({coupon_code:o.coupon_code,resp:r})}else e.woocommerce.ajaxError(t.status)},async updateCartQuantity(o,m){let c=new FormData;c.set("key",o.key),c.set("quantity",o.quantity);let t=await fetch(window.udesly_frontend_options.wc.wc_ajax_url.replace("%%endpoint%%","udesly_change_cart_quantity"),{method:"POST",body:c});if(t.ok){let r=await t.json();r.success&&r.success===!1?e.woocommerce.ajaxError(t.status):e.woocommerce.removedFromCart(r)}else e.woocommerce.ajaxError(t.status)},async addToCart(o,m){let{type:c,variation_id:t,product_id:r,quantity:_,el:d,submitter:a,buyNow:g,...i}=o;if(f&&clearTimeout(f),d.parentElement.querySelectorAll(".w-commerce-commerceaddtocarterror").forEach(s=>s.style.display="none"),d.parentElement.classList.add("adding-to-cart"),a.disabled)return;a.tagName=="BUTTON"&&(a.dataset.default||(a.dataset.default=a.textContent),a.textContent=a.dataset.loadingText,a.disabled=!0),c=="variable"&&t!=="0"&&(r=t);let p=new FormData;if(_||_==1,p.set("quantity",_),p.set("product_id",r),i&&Object.keys(i).length)for(let s in i)p.set(s,i[s]);let w=await fetch(window.udesly_frontend_options.wc.wc_ajax_url.replace("%%endpoint%%","udesly_add_to_cart"),{method:"POST",body:p});if(w.ok){let s=await w.json();s.error&&s.error===!0?(e.woocommerce.ajaxError(s.error_message||s),d.parentElement.querySelectorAll('[data-node-type="commerce-add-to-cart-error"]').forEach(l=>l.innerHTML=s.error_message),d.parentElement.querySelectorAll(".w-commerce-commerceaddtocarterror").forEach(l=>l.style.display=""),f=setTimeout(()=>{d.parentElement.querySelectorAll(".w-commerce-commerceaddtocarterror").forEach(l=>l.style.display="none")},1e4)):g?window.location=window.udesly_frontend_options.wc.checkout_url:e.w
1oocommerce.addedToCart(s)}else e.woocommerce.ajaxError(w.status);d.parentElement.classList.remove("adding-to-cart"),a.tagName=="BUTTON"&&(a.textContent=a.dataset.default,a.disabled=!1)}})});var v={woocommerce:k,wordpress:h};export{v as models};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.