1(()=>{"use strict";var t=function(t){return Math.round(100*t)/100};function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}var r=function(){return e=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.api_namespace="WC_Gateway_Buckaroo_applepay",this.url=buckaroo_global.ajax_url,void 0===this.url&&(this.url="/")},(o=[{key:"getItems",value:function(e){if(jQuery(".applepay-button-container").hasClass("is-detail-page")){var n=this.getCurrentShownProduct(),o={"wc-api":"".concat(this.api_namespace,"-get-items-from-detail-page"),product_id:n.product_id,variation_id:n.variation_id,quantity:jQuery(".cart .quantity input").val()||1,country_code:e},r=[];return jQuery.ajax({url:this.url,data:o,async:!1,dataType:"json"}).done((function(e){r=e.map((function(e){return{id:e.id,name:e.name,price:t(e.price),quantity:e.quantity,type:e.type,attributes:e.attributes}}))})),r}var i=[];return jQuery.ajax({url:this.url,data:{"wc-api":"".concat(this.api_namespace,"-get-items-from-cart")},async:!1,dataType:"json"}).done((function(e){i=e.map((function(e){return{id:e.id,name:e.name,price:t(e.price),quantity:e.quantity,type:e.type,attributes:e.attributes}}))})),i}},{key:"getShippingMethods",value:function(t){var e,n=this,o=function(){if(jQuery(".applepay-button-container").hasClass("is-detail-page")){var t=n.getCurrentShownProduct();return{product_id:t.product_id,variation_id:t.variation_id,quantity:jQuery(".cart .quantity input").val()||1}}return{}}(),r={"wc-api":"".concat(this.api_namespace,"-get-shipping-methods"),country_code:t};return jQuery.ajax({url:this.url,data:Object.assign(r,o),dataType:"json",async:!1}).done((function(t){e=t})),e}},{key:"getStoreInformation",value:function(){var t=[];return jQuery.ajax({url:this.url,data:{"wc-api":"".concat(this.api_namespace,"-get-shop-information")},async:!1,dataType:"json"}).done((function(e){t=e})),t}},{key:"getCurrentShownProduct",value:function(){var t=jQuery('[name="add-to-cart"]').val();return{product_id:t,variation_id:jQuery('[name="variation_id"]')[0]&&0!=jQuery('[name="variation_id"]').val()&&""!=jQuery('[name="variation_id"]')[0]?jQuery('[name="variation_id"]').val():t}}},{key:"displayErrorMessage",value:function(t){var e=' \n <div class="woocommerce-message" role="alert">\n '.concat(t,"\n </div>\n ");jQuery(".woocommerce-notices-wrapper").first().prepend(e),jQuery("html, body").scrollTop(0)}},{key:"canOrderAmount",value:function(){if(jQuery(".checkout.woocommerce-checkout").length)return!0;var t=parseInt(jQuery(".cart .quantity input.qty").val()),e=parseInt(jQuery(".cart .quantity input.qty").attr("max"));return isNaN(e)?t>0:t>0&&t<=e}}])&&n(e.prototype,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,o}();function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,u(o.key),o)}}function u(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}var c=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.woocommerce=new r},(e=[{key:"createTransaction",value:function(t,e,n,o){var r=this;jQuery.ajax({url:"/?wc-api=WC_Gateway_Buckaroo_applepay-create-transaction",method:"post",data:{selected_shipping_method:n,paymentData:t,amount:e,items:o},dataType:"json",async:!1}).done((function(t){if("success"==t.result)window.location.replace(t.redirect);else{var e="Something went wrong while processing your payment.";t.message&&(e=t.message),r.woocommerce.displayErrorMessage(e)}})).fail((function(){r.woocommerce.displayErrorMessage("Something went wrong while processing your payment.")}))}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function p(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,l(o.key),o)}}function l(t){var e=function(t){if("object"!=s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}var y=function(){return e=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.buckaroo=new c,this.woocommerce=new r,this.store_info=this.woocommerce.getStoreInformation(),this.selected_shipping_method=null,this.selected_shipping_amount=null,this.total_price=null,this.country_code=this.store_info.country_code},(n=[{key:"rebuild",value:function(){jQuery(".applepay-button-container div").remove(),jQuery(".applepay-button-container").append("<div>")}},{key:"init",value:function(){var t=this;BuckarooSdk.ApplePay.checkApplePaySupport(this.store_info.merchant_id).then((function(e){if(e){var n=t.getItems(),o=t.woocommerce.getShippingMethods(t.country_code),r=t.getFirstShippingItem(o),i=null!==r?[].concat(n,r):n,a=t.sumTotalAmount(i),u={label:"Totaal",amount:a,type:"final"};o.length>0&&(t.selected_shipping_method=o[0].identifier,t.selected_shipping_amount=o[0].amount),t.total_price=a;var c=["name","email","postalAddress","phone"],s=new BuckarooSdk.ApplePay.ApplePayOptions(t.store_info.store_name,t.store_info.country_code,t.store_info.currency_code,t.store_info.culture_code,t.store_info.merchant_id,i,u,"shipping",o,t.processApplepayCallback.bind(t),t.processShippingMethodsCallback.bind(t),t.processChangeContactInfoCallback.bind(t),c,c);new BuckarooSdk.ApplePay.ApplePayPayment(".applepay-button-container div",s).showPayButton("black")}}))}},{key:"processChangeContactInfoCallback",value:function(t){this.country_code=t.countryCode;var e=this.getItems(),n=this.woocommerce.getShippingMethods(this.country_code),o=this.getFirstShippingItem(n),r=null!==o?[].concat(e,o):e,i=this.sumTotalAmount(r),a={newShippingMethods:n,newTotal:{label:"Totaal",amount:i,type:"final"},newLineItems:r};if(n.length>0){var u={};this.selected_shipping_method=n[0].identifier,this.selected_shipping_amount=n[0].amount}else u=this.shippingCountryError(t);return this.total_price=i,Promise.resolve(Object.assign(a,u))}},{key:"processShippingMethodsCallback",value:function(e){var n=this.getItems(),o={type:"final",label:e.label,amount:t(e.amount)||0,qty:1}
1,r=[].concat(n,o),i=this.sumTotalAmount(r),a={label:"Totaal",amount:i,type:"final"};return this.selected_shipping_method=e.identifier,this.selected_shipping_amount=e.amount,this.total_price=i,Promise.resolve({status:ApplePaySession.STATUS_SUCCESS,newTotal:a,newLineItems:r})}},{key:"processApplepayCallback",value:function(t){var e={status:ApplePaySession.STATUS_SUCCESS,errors:[]};if(e.status===ApplePaySession.STATUS_SUCCESS)this.buckaroo.createTransaction(t,this.total_price,this.selected_shipping_method,this.woocommerce.getItems(this.country_code));else{var n=e.errors.map((function(t){return t.message})).join(" ");this.woocommerce.displayErrorMessage("Your payment could not be processed. ".concat(n))}return Promise.resolve(e)}},{key:"sumTotalAmount",value:function(e){var n=e.reduce((function(t,e){return t+e.amount}),0);return t(n)}},{key:"getFirstShippingItem",value:function(t){return t.length>0?{type:"final",label:t[0].label,amount:t[0].amount||0,qty:1}:null}},{key:"getItems",value:function(){return this.woocommerce.getItems(this.country_code).map((function(e){var n;return{type:"final",label:(n="".concat(e.quantity," x ").concat(e.name),n.length>25?"".concat(n.slice(0,25),"..."):n),amount:t(e.price),qty:e.quantity}}))}},{key:"shippingCountryError",value:function(t){return{errors:[new ApplePayError("shippingContactInvalid","country","Shipping is not available for the selected country")]}}}])&&p(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n}();window.BuckarooInitApplePay=function(){if("undefined"!=typeof jQuery){var t=new y,e=function(t){if(void 0!==t)return function(){t.rebuild(),t.init()}}(t);e&&(t.rebuild(),t.init(),document.removeEventListener("applepayRefresh",e),document.addEventListener("applepayRefresh",e))}else console.error("Cannot initialize ApplePay missing jquery")},jQuery((function(){if(document.dispatchEvent(new Event("bk-jquery-loaded")),jQuery(".applepay-button-container")[0]){var t=new y,e=new r,n=(o=function(){t.rebuild(),e.canOrderAmount()&&t.init()},function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=this;clearTimeout(a),i&&!a&&o.apply(r,e),a=setTimeout((function(){a=null,i||o.apply(r,e)}),250)});0===jQuery(".variations_form").length&&(n(),jQuery(".cart .quantity input").change((function(){n()}))),jQuery(".variations_form").on("show_variation",(function(){n(),jQuery(".cart .quantity input").change((function(){n()}))})),jQuery(".variations_form").on("hide_variation",(function(){t.rebuild()})),jQuery(document.body).on("wc_fragments_refreshed",(function(){n()})),jQuery(document.body).on("updated_shipping_method",(function(){t.rebuild(),t.init()}))}var o,i,a}))})();
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.