PageSourceSearch

https://oxo-good-grips.nl/wp-content/plugins/merchant-pro/assets/j…/volume-discounts.min.js?ver=2.3.2

js oxo-good-grips.nl collected 2026-10-09 01:36:56 UTC 10,632 bytes, 1 lines download raw bytes

1"use strict";!function(d){var a={init:function(t){var e,a=this;d(t).each(function(){a.initializeForm(d(this))}),d(window).on("scroll resize",function(){clearTimeout(e),e=setTimeout(function(){a.recordImpression()},150)})},isElementInViewport:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,a=d(window),t=d(t),i=t.offset().top,t=i+t.outerHeight(),n=a.scrollTop()+e,a=a.scrollTop()+a.height()-e;return n<t&&i<a},recordImpression:function(){var e,t;merchant_volume_discounts.analytics_toggle&&(e=this,0!==(t=d('.merchant-volume-discounts-item:not([data-mark-as-viewed="true"])')).length)&&t.each(function(){var t=d(this);e.isElementInViewport(t,100)&&(t.attr("data-mark-as-viewed","true"),t={campaign_id:t.attr("data-flexible-id"),product_id:t.attr("data-product-id"),nonce:merchant_volume_discounts.nonce,action:"merchant_volume_discounts_record_impression"},d.post(merchant_volume_discounts.ajax_url,t))})},initializeForm:function(t){var e={offerForm:t,$variationDropdowns:t.find("select"),submitButton:t.find(".offer-submit button"),productId:t.attr("data-product-id"),offerId:t.attr("data-offer-id"),discountTarget:t.attr("data-discount-target"),quantityInput:t.find(".quantity input"),messageElement:t.find(".user-message"),messageElementText:t.find(".user-message .message-text"),variationId:0,variations:t.data("variations"),isVariableProduct:!1,tieredRadio:d(".merchant-volume-discounts").hasClass("radio-style")};e.isVariableProduct=0<e.$variationDropdowns.length,t.data("formInstance",e),this.bindEvents(e),this.initializeButtonState(e)},bindEvents:function(t){t.isVariableProduct&&t.$variationDropdowns.on("change",this.handleVariationChange.bind(this,t)),t.submitButton.on("click",this.handleFormSubmit.bind(this,t)),t.offerForm.find(".offer-quantity-input input").on("change",this.handleQuantityChange.bind(this,t))},initializeButtonState:function(t){t.isVariableProduct&&this.updateSubmitButtonState(t)},handleVariationChange:function(t,e){var a={name:d(e.target).data("attribute_name"),value:d(e.target).val()},i=[],n=t.variations.filter(function(t){return void 0!==t.attributes[a.name.toLowerCase()]&&t.attributes[a.name.toLowerCase()]===a.value});t.$variationDropdowns.each(function(){var t=d(this),e=t.data("attribute_name");n.forEach(function(t){t=t.attributes[e.toLowerCase()];void 0===t||""===t||i.includes(t)||i.push(t)}),a.name.toLowerCase()!==e.toLowerCase()&&t.find("option").each(function(){var t=d(this).attr("value");""!==t&&(i.includes(t)?d(this).show():d(this).hide())})}),this.isVariationSelectionComplete(t)?(e=this.getSelectedAttributes(t),this.fetchVariationDetails(t,e)):this.resetVariationDetails(t),this.updateSubmitButtonState(t)},updateSubmitButtonState:function(t){var e=this.isVariationSelectionComplete(t);t.submitButton.prop("disabled",!e),e?t.submitButton.removeClass("disabled"):t.submitButton.addClass("disabled")},isVariationSelectionComplete:function(t){var e=!0;return t.$variationDropdowns.each(function(){if(""===d(this).val())return e=!1}),e},resetVariationDetails:function(t){t.submitButton.prop("disabled",!0).addClass("disabled")},handleFormSubmit:function(t,e){var a;e.preventDefault(),t.submitButton.prop("disabled")||(e=this.getSelectedAttributes(t),a=null!=(a=t.offerForm.find(".offer-quantity-input input").val())?a:0,this.addToCart(t,e,a,this))},handleQuantityChange:function(t,e){var e=d(e.target),e=parseInt(e.val()),a=this.getSelectedAttributes(t),a=(a&&0<Object.keys(a).length&&Object.values(a).every(function(t){return""!==t&&null!==t}),parseFloat(t.offerForm.find(".merchant-volume-discounts-item-price").attr("data-item-price")));t.offerForm.find(".merchant-volume-discounts-item-price-total strong").html(this.formatWooCommercePrice(a*e))},getSelectedAttributes:function(t){var e={};return t.$variationDropdowns.each(function(){e[d(this).attr("name")]=d(this).val()}),e},fetchVariationDetails:function(t,e){null!=t&&t.offerForm.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),d.ajax({type:"POST",url:merchant_volume_discounts.ajax_url,data:{action:"merchant_get_variation_data",product_id:t.productId,discount_target:t.discountTarget,offer_key:t.offerId,nonce:merchant_volume_discounts.variation_info_nonce,attributes:e,module_id:merchant_volume_discounts.module_id}
1,success:this.handleVariationDetailsSuccess.bind(this,t),error:this.handleAjaxError.bind(this,t),complete:function(){null!=t&&t.offerForm.unblock()}})},handleVariationDetailsSuccess:function(t,e){e.success?(this.updateUI(t,e),t.submitButton.prop("disabled",!1).removeClass("disabled")):this.handleInvalidVariation(t,e)},handleInvalidVariation:function(t,e){t.offerForm.removeClass("valid"),t.submitButton.prop("disabled",!0).addClass("disabled"),this.showUserMessage(t,e.data.message,"error"),this.updateCartBtnState()},updateUI:function(t,e){var a=t.offerForm,e=(null==e?void 0:e.data)||{},i=e.id,n=e.price,e=e.price_html,o=parseInt(null!=(o=a.find(".offer-quantity-input input").val())?o:0);a.addClass("valid"),t.variationId=i,e&&(t=d(e).find("del"),a.find(".merchant-volume-discounts-item-price-strikethrough").html(t)),n&&(a.find(".merchant-volume-discounts-item-price strong").html(this.formatWooCommercePrice(n)),a.find(".merchant-volume-discounts-item-price-total strong").html(this.formatWooCommercePrice(n*o)),a.find(".merchant-volume-discounts-item-price").attr("data-item-price",n)),this.updateCartBtnState()},addToCart:function(t,e,a,i){d.ajax({type:"POST",url:merchant_volume_discounts.ajax_url,data:{action:"merchant_volume_discounts_add_to_cart",product_id:t.productId,variation_id:t.variationId,offer_id:t.offerId,quantity:a,variation_attributes:e,nonce:null==(a=merchant_volume_discounts)?void 0:a.nonce},success:i.handleAddToCartSuccess.bind(i,t),error:i.handleAjaxError.bind(i,t)})},handleAddToCartSuccess:function(t,e){e.success?(e.data.fragments&&d.each(e.fragments,function(t,e){d(t).replaceWith(e)}),t.quantityInput.val(e.data.remaining_quantity),a.showUserMessage(t,e.data.message),d(document.body).trigger("added_to_cart",[e.data.fragments,e.data.cart_hash]),d(document).trigger("merchant-volume-discounts-item-ad
1ded-to-cart",[e,t])):a.showUserMessage(t,e.data.message,"error")},showUserMessage:function(t,e){var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"success";t.messageElementText.text(e),t.messageElement.addClass(a+" show"),setTimeout(function(){t.messageElement.removeClass(a+" show")},3e3)},handleAjaxError:function(t,e,a,i){console.error("AJAX error:",a,i)},formatWooCommercePrice:function(t){var e,a,i,n,o;return t=parseFloat(t),isNaN(t)?"":(e=(n=merchant_volume_discounts.wc_settings).currency_symbol,a=n.decimal_sep,i=n.thousand_sep,o=n.decimals,n=n.price_format,t=t.toFixed(o).replace(".",a).replace(/\B(?=(\d{3})+(?!\d))/g,i),o=n.replace("%1$s",e).replace("%2$s",t),'<span class="woocommerce-Price-amount amount"><bdi>'.concat(o,"</bdi></span>"))},disableCartBtn:function(){d(".add-to-cart-wrapper .merchant-blk-discounts-add-to-cart").addClass("disabled").attr("disabled","disabled")},enableCartBtn:function(){d(".add-to-cart-wrapper .merchant-blk-discounts-add-to-cart").removeClass("disabled").removeAttr("disabled")},updateCartBtnState:function(){var t=d(".merchant-selected-offer:checked").closest(".merchant-volume-discounts-item");
1this.disableCartBtn(),t.length&&t.hasClass("valid")?this.enableCartBtn():this.disableCartBtn()},updateOfferFormVisibility:function(){d(".merchant-volume-discounts-item").each(function(){var t=d(this),e=t.find(".merchant-selected-offer"),a=t.find(".offer-form");e.is(":checked")?(t.addClass("visible"),a.addClass("visible")):(t.removeClass("visible"),a.removeClass("visible"))})},handleAddToCartSubmit:function(t){var t=d(t.target),e=d(".merchant-selected-offer:checked").closest(".merchant-volume-discounts-item");!t.hasClass("disabled")&&0<e.length&&(t=e.data("formInstance"),e={productId:e.data("product-id"),offerQuantity:e.data("offer-quantity"),offerId:e.data("offer-id"),$offerItem:e},t&&t.isVariableProduct&&t.variationId&&(e.variationId=t.variationId,e.variationAttributes=this.getSelectedAttributes(t)),d(document).trigger("merchant-volume-discounts-item-add-to-cart",[e]))}};d(document).on("click",".add-to-cart-wrapper .merchant-blk-discounts-add-to-cart",function(t){a.handleAddToCartSubmit(t)}),d("body").on("applied_coupon",function(t,e){var a=d('[data-class="hidden"]');a.removeAttr("data-class"),a.siblings(".woocommerce-error").remove()}),d(document).on("reset_data",".variations_form",function(t){d(".merchant-volume-discounts-item:not(.merchant-volume-discounts-item-simple)").removeClass("clickable")}),d(document).on("click",".merchant-volume-discounts-item.clickable",function(){var t=d(this);t.removeClass("clickable"),d(document).trigger("merchant-volume-discounts-item-ad
1d-to-cart",[{productId:t.data("product-id"),offerQuantity:t.data("offer-quantity"),offerId:t.data("offer-id"),$offerItem:t}])}),d(document).on("merchant-volume-discounts-item-add-to-cart",function(t,e){var a=e.productId,i=e.offerId,n=e.offerQuantity,o=e.$offerItem,r=e.variationId,s=e.variationAttributes,i=(o.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),{action:"merchant_volume_discounts_add_to_cart",product_id:a,offer_id:i,quantity:n,nonce:null==(a=merchant_volume_discounts)?void 0:a.nonce});r&&(i.variation_id=r),s&&(i.variation_attributes=s),d.ajax({url:null==(n=merchant_volume_discounts)?void 0:n.ajax_url,type:"POST",data:i,success:function(t){null!=t&&t.success&&(d(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash,o,"volume-discounts"]),d(document).trigger("merchant-volume-discounts-item-added-to-cart",[t,e]))},complete:function(){o.unblock()}})}),d(document).on("merchant-volume-discounts-item-added-to-cart",function(t,e,a){var i=d(".woocommerce-notices-wrapper");i.length&&(i.empty().append(null==e||null==(e=e.data)?void 0:e.notice),(null!=a&&null!=(e=a.$offerItem)&&e.closest(".merchant-quick-view-content").length||null!=a&&null!=(e=a.offerForm)&&e.closest(".merchant-quick-view-content").length)&&((a=d(".merchant-quick-view-modal")).removeClass("merchant-show"),a.find(".merchant-quick-view-inner").removeClass("merchant-show")),d("html, body").animate({scrollTop:(null==i?void 0:i.offset().top)-90},500))}),d(document).ready(function(){a.updateCartBtnState(),a.updateOfferFormVisibility(),d(".merchant-selected-offer").on("change",function(){a.updateCartBtnState(),a.updateOfferFormVisibility()}),a.init(".merchant-volume-discounts-item"),window.addEventListener("merchant.quickview.ajax.loaded",function(t){a.init(d(".merchant-quick-view-modal").find(".merchant-volume-discounts-item"))})})}(jQuery);

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.