PageSourceSearch

https://www.riedel.com/theme/504069af8927954a2acfb9b16e2cce61/js/a…/adyen-payment-shopware6.js?1790779745

js riedel.com collected 2026-10-02 05:19:36 UTC 59,510 bytes, 16 lines download raw bytes

1(()=>{"use strict";var e={156(e){var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==n},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s(Array.isArray(e)?[]:{},e,t):e}function i(e,t,n){return e.concat(t).map(function(e){return a(e,n)})}function r(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function o(e,t){try{return t in e}catch(e){return!1}}function s(e,n,d){(d=d||{}).arrayMerge=d.arrayMerge||i,d.isMergeableObject=d.isMergeableObject||t,d.cloneUnlessOtherwiseSpecified=a;var l,c,h=Array.isArray(n);return h!==Array.isArray(e)?a(n,d):h?d.arrayMerge(e,n,d):(c={},(l=d).isMergeableObject(e)&&r(e).forEach(function(t){c[t]=a(e[t],l)}),r(n).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&l.isMergeableObject(n[t])?c[t]=(function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s})(t,l)(e[t],n[t],l):c[t]=a(n[t],l))}),c)}s.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,n){return s(e,n,t)},{})},e.exports=s}},t={};function n(a){var i=t[a];if(void 0!==i)return i.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a=n(156),i=n.n(a);class r{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let n=r.toUpperCamelCase(e,t);return r.lcFirst(n)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>r.ucFirst(e.toLowerCase())).join(""):r.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class o{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=new CustomEvent(e,{detail:t,cancelable:n});return this.el.dispatchEvent(a),a}subscribe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this,i=e.split("."),r=n.scope?t.bind(n.scope):t;if(n.once&&!0===n.once){let t=r;r=function(n){a.unsubscribe(e),t(n)}}return this.el.addEventListener(i[0],r),this.listeners.push({splitEventName:i,opts:n,cb:r}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,n)=>([...n.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(n.splitEventName[0],n.cb):e.push(n),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}class s{constructor(e,t={},n=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${n}".`);return}this.el=e,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(n),this.options=this._mergeOptions(t),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let t=[this.constructor.options,this.options,e];return t.push(this._getConfigFromDataAttribute()),t.push(this._getOptionsFromDataAttribute()),i().all(t.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=r.toDashCase(this._pluginName),n=this.el.getAttribute(`data-${t}-config`);return n?window.PluginConfigManager.get(this._pluginName,n):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=r.toDashCase(this._pluginName),n=this.el.getAttribute(`data-${t}-options`);if(n)try{return JSON.parse(n)}catch(e){console.error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}class d{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!d.isNode(e))throw Error("The element must be a valid HTML Node!");return"function"==typeof e.hasAttribute&&e.hasAttribute(t)}static getAttribute(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(n&&!1===d.hasAttribute(e,t))throw Error(`The required property "${t}" does not exist!`);
1if("function"!=typeof e.getAttribute){if(n)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=t.replace(/^data(|-)/,""),i=r.toLowerCamelCase(a,"-");if(!d.isNode(e)){if(n)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(n)throw Error("This node doesn't support the dataset attribute!");return}let o=e.dataset[i];if(void 0===o){if(n)throw Error(`The required data attribute "${t}" does not exist on ${e}!`);return o}return r.parsePrimitive(o)}static querySelector(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(n&&!d.isNode(e))throw Error("The parent node is not a valid HTML Node!");let a=e.querySelector(t)||!1;if(n&&!1===a)throw Error(`The required element "${t}" does not exist in parent node!`);return a}static querySelectorAll(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(n&&!d.isNode(e))throw Error("The parent node is not a valid HTML Node!");let a=e.querySelectorAll(t);if(0===a.length&&(a=!1),n&&!1===a)throw Error(`At least one item of "${t}" must exist in parent node!`);return a}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,t=`
2            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),
3            select:not([tabindex^="-"]):not([disabled]),
4            textarea:not([tabindex^="-"]):not([disabled]),
5            button:not([tabindex^="-"]):not([disabled]),
6            a[href]:not([tabindex^="-"]):not([disabled]),
7            [tabindex]:not([tabindex^="-"]):not([disabled])
8        `;return e.querySelectorAll(t)}static getFirstFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(e)[0]}static getLastFocusableElement(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=this.getFocusableElements(e);return t[t.length-1]}}class l{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",a=this._createPreparedRequest("GET",e,n);return this._sendRequest(a,null,t)}post(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(t,a);let i=this._createPreparedRequest("POST",e,a);return this._sendRequest(i,t,n)}delete(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(t,a);let i=this._createPreparedRequest("DELETE",e,a);return this._sendRequest(i,t,n)}patch(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(t,a);let i=this._createPreparedRequest("PATCH",e,a);return this._sendRequest(i,t,n)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn(`the request to ${e.responseURL} was aborted`)}),e.addEventListener("error",()=>{console.warn(`the request to ${e.responseURL} failed with status ${e.status}`)}),e.addEventListener("timeout",()=>{console.warn(`the request to ${e.responseURL} timed out`)})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,n){return this._registerOnLoaded(e,n),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,n){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),n&&this._request.setRequestHeader("Content-type",n),this._request}}let c="loader",h={BEFORE:"before",INNER:"inner"};class p{constructor(e,t=h.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){if(!this.exists()){if(this.position===h.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=p.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),p.getTemplate())}}remove(){if(this.position===h.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${c}
8`).forEach(e=>e.remove())}exists(){return this.parent.querySelectorAll(`.${c}`).length>0}_getPosition(){return this.position===h.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${c}" role="status">
9                    <span class="visually-hidden">Loading...</span>
10                </div>`}static SELECTOR_CLASS(){return c}}let y="element-loader-backdrop";class u extends p{static create(e){e.classList.add("has-element-loader"),u.exists(e)||(u.appendLoader(e),setTimeout(()=>{let t=e.querySelector(`.${y}`);t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(`.${y}`);t&&t.remove()}static exists(e){return e.querySelectorAll(`.${y}`).length>0}static getTemplate(){return`
11        <div class="${y}">
12            <div class="loader" role="status">
13                <span class="visually-hidden">Loading...</span>
14            </div>
15        </div>
16        `}static appendLoader(e){e.insertAdjacentHTML("beforeend",u.getTemplate())}}class m{static serialize(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if("FORM"!==e.nodeName){if(t)throw Error("The passed element is not a form!");return{}}return new FormData(e)}static serializeJson(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=m.serialize(e,t);if(!(n instanceof FormData)&&0===Object.keys(n).length||n instanceof FormData&&0===Array.from(n.entries()).length)return{};let a={};for(let[e,t]of n.entries())a[e]=t;return a}}function g(e){for(let e of document.querySelectorAll("input[required]"))if(!e.checkValidity())return e.scrollIntoView({behavior:"smooth",block:"center"}),e.focus(),e.reportValidity(),!1;return!!e.confirmOrderForm.checkValidity()||(e.confirmOrderForm.reportValidity(),!1)}let f={updatablePaymentMethods:["scheme","ideal","sepadirectdebit","oneclick","bcmc","bcmc_mobile","blik","klarna_b2b","eps","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","afterpay_default","ratepay","ratepay_directdebit","giftcard","paybright","affirm","multibanco","mbway","vipps","mobilepay","wechatpayQR","wechatpayWeb","paybybank"],componentsWithPayButton:{applepay:{extra:{},onClick:(e,t,n)=>g(n)&&n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},googlepay:{extra:{buttonSizeMode:"fill"},onClick:function(e,t,n){return g(n)&&n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:function(e,t,n){"CANCELED"!==e.statusCode&&("statusMessage"in e?console.log(e.statusMessage):console.log(e.statusCode))}},paypal:{extra:{},onClick:function(e,t,n){return g(n)},onError:function(e,t,n){t.setStatus("ready"),window.location.href=n.errorUrl.toString()},responseHandler:function(e,t){try{if((t=JSON.parse(t)).isFinal){window.location.href=e.returnUrl;return}if(!t.action){window.location.reload();return}t.pspReference&&(e.pspReference=t.pspReference),e.paymentData=null,t.action.paymentData&&(e.paymentData=t.action.paymentData),this.handleAction(t.action)}catch(e){console.error(e)}}},amazonpay:{extra:{productType:"PayAndShip",checkoutMode:"ProcessOrder",returnUrl:location.href},prePayRedirect:!0,sessionKey:"amazonCheckoutSessionId",onClick:function(e,t,n){return g(n)&&n.confirmOrderForm.checkValidity()?(e(),!0):(t(),!1)},onError:(e,t)=>{console.log(e),t.setStatus("ready")}}},paymentMethodTypeHandlers:{scheme:"handler_adyen_cardspaymentmethodhandler",ideal:"handler_adyen_idealpaymentmethodhandler",klarna:"handler_adyen_klarnapaylaterpaymentmethodhandler",klarna_account:"handler_adyen_klarnapayovertimepaymentmethodhandler",klarna_paynow:"handler_adyen_klarnapaynowpaymentmethodhandler",ratepay:"handler_adyen_ratepaypaymentmethodhandler",ratepay_directdebit:"handler_adyen_ratepaydirectdebitpaymentmethodhandler",sepadirectdebit:"handler_adyen_sepapaymentmethodhandler",directEbanking:"handler_adyen_klarnadebitriskpaymentmethodhandler",paypal:"handler_adyen_paypalpaymentmethodhandler",oneclick:"handler_adyen_oneclickpaymentmethodhandler",giropay:"handler_adyen_giropaypaymentmethodhandler",applepay:"handler_adyen_applepaypaymentmethodhandler",googlepay:"handler_adyen_googlepaypaymentmethodhandler",bcmc:"handler_adyen_bancontactcardpaymentmethodhandler",bcmc_mobile:"handler_adyen_bancontactmobilepaymentmethodhandler",amazonpay:"handler_adyen_amazonpaypaymentmethodhandler",twint:"handler_adyen_twintpaymentmethodhandler",eps:"handler_adyen_epspaymentmethodhandler",swish:"handler_adyen_swishpaymentmethodhandler",alipay:"handler_adyen_alipaypaymentmethodhandler",alipay_hk:"handler_adyen_alipayhkpaymentmethodhandler",blik:"handler_adyen_blikpaymentmethodhandler",clearpay:"handler_adyen_clearpaypaymentmethodhandler",facilypay_3x:"handler_adyen_facilypay3xpaymentmethodhandler",facilypay_4x:"handler_adyen_facilypay4xpaymentmethodhandler",facilypay_6x:"handler_adyen_facilypay6xpaymentmethodhandler",facilypay_10x:"handler_adyen_facilypay10xpaymentmethodhandler",facilypay_12x:"handler_adyen_facilypay12xpaymentmethodhandler",afterpay_default:"handler_adyen_afterpaydefaultpaymentmethodhandler",trustly:"handler_adyen_trustlypaymentmethodhandler",paysafecard:"handler_adyen_paysafecardpaymentmethodhandler",giftcard:"handler_adyen_giftcardpaymentmethodhandler",mbway:"handler_adyen_mbwaypaymentmethodhandler",multibanco:"handler_adyen_multibancopaymentmethodhandler",wechatpayQR:"handler_adyen_wechatpayqrpaymentmethodhandler",wechatpayWeb:"handler_adyen_wechatpaywebpaymentmethodhandler",mobilepay:"handler_adyen_mobilepaypaymentmethodhandler",vipps:"handler_adyen_vippspaymentmethodhandler",affirm:"handler_adyen_affirmpaymentmethodhandler",paybright:"handler_adyen_paybrightpaymentmethodhandler",paybybank:"handler_adyen_openbankingpaymentmethodhandler",klarna_b2b:"handler_adyen_billiepaymentmethodhandler",ebanking_FI:"handler_adyen_onlinebankingfinlandpaymentmethodhandler",onlineBanking_PL:"handler_adyen_onlinebankingpolandpaymentmethodhandler"}},C=window.PluginManager;C.register("CartPlugin",class extends s{init(){let e=this;this._client=new l,this.adyenCheckout=Promise,this.paymentMethodInstance=null,this.selectedGiftcard=null,this.initializeCheckoutComponent().then((function(){this.observeGiftcardSelection()}).bind(this)),this.adyenGiftcardDropDown=d.querySelectorAll(document,"#giftcardDropdown"),this.adyenGiftcard=d.querySelectorAll(document,".adyen-giftcard"),this.giftcardHeader=d.querySelector(document,".adyen-giftcard-header"),this.giftcardItem=d.querySelector(document,".adyen-giftcard-item"),this.giftcardComponentClose=d.querySelector(document,".adyen-close-giftcard-component"),this.minorUnitsQuotient=adyenGiftcardsConfiguration.totalInMinorUnits/adyenGiftcardsConfiguration.totalPrice,this.giftcardDiscount=adyenGiftcardsConfiguration.giftcardDiscount,this.remainingAmou
16nt=(adyenGiftcardsConfiguration.totalPrice-this.giftcardDiscount).toFixed(2),this.remainingGiftcardBalance=(adyenGiftcardsConfiguration.giftcardBalance/this.minorUnitsQuotient).toFixed(2),this.shoppingCartSummaryBlock=d.querySelectorAll(document,".checkout-aside-summary-list"),this.offCanvasSummaryDetails=null,this.shoppingCartSummaryDetails=null,this.giftcardComponentClose.onclick=function(t){t.currentTarget.style.display="none",e.selectedGiftcard=null,e.giftcardItem.innerHTML="",e.giftcardHeader.innerHTML=" ",e.paymentMethodInstance&&e.paymentMethodInstance.unmount()},this.giftcardsAddOption=adyenGiftcardsConfiguration.addGiftcardOption,this.giftcardsBlockPosition=adyenGiftcardsConfiguration.giftcardBlockPosition,this.giftcardsShowSeparately="true"===adyenGiftcardsConfiguration.giftcardShowSeparately,this.redeemedGiftcards=[];let t=document.getElementById("showGiftcardButton"),n=document.getElementById("giftcardDropdown");t.addEventListener("click",e=>{e.preventDefault(),t.style.display="none",n.style.display="block"}),"showFields"===this.giftcardsAddOption?(t.style.display="none",n.style.display="block"):(n.style.display="block",n.style.display="none"),"interactive"==document.readyState?(this.fetchGiftcardsOnPageLoad(),this.setGiftcardsRemovalEvent()):(window.addEventListener("DOMContentLoaded",this.fetchGiftcardsOnPageLoad()),window.addEventListener("DOMContentLoaded",this.setGiftcardsRemovalEvent()))}fetchGiftcardsOnPageLoad(){parseInt(adyenGiftcardsConfiguration.giftcardDiscount,10)&&this.fetchRedeemedGiftcards()}setGiftcardsRemovalEvent(){document.getElementById("giftcardsContainer").addEventListener("click",e=>{if(e.target.classList.contains("adyen-remove-giftcard")){let t=e.target.getAttribute("dataid");this.removeGiftcard(t)}})}async initializeCheckoutComponent(){let{AdyenCheckout:e}=window.AdyenWeb,{locale:t,clientKey:n,environment:a}=adyenCheckoutConfiguration,i={locale:t,clientKey:n,environment:a,countryCode:adyenCheckoutConfiguration.countryCode,amount:{currency:adyenGiftcardsConfiguration.currency,value:adyenGiftcardsConfiguration.totalInMinorUnits}};this.adyenCheckout=await e(i)}observeGiftcardSelection(){let e=this,t=document.getElementById("giftcardDropdown"),n=document.getElementById("showGiftcardButton");t.addEventListener("change",function(){t.value&&(e.selectedGiftcard=JSON.parse(event.currentTarget.options[event.currentTarget.selectedIndex].dataset.giftcard),e.mountGiftcardComponent(e.selectedGiftcard),t.value="",n.style.display="none")})}mountGiftcardComponent(e){this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardItem.innerHTML="",u.create(d.querySelector(document,"#adyen-giftcard-component"));var t=document.createElement("img");t.src="https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/"+e.brand+".svg",t.alt=e.brand+" logo",t.classList.add("adyen-giftcard-logo"),this.giftcardItem.insertBefore(t,this.giftcardItem.firstChild),this.giftcardHeader.innerHTML=e.name,this.giftcardComponentClose.style.display="block";let n=Object.assign({},e,{showPayButton:!0,onBalanceCheck:this.handleBalanceCheck.bind(this,e)});try{this.paymentMethodInstance=new AdyenWeb.Giftcard(this.adyenCheckout,n),this.paymentMethodInstance.mount("#adyen-giftcard-component-mount")}catch(e){console.log("giftcard not available")}u.remove(d.querySelector(document,"#adyen-giftcard-component"))}handleBalanceCheck(e,t,n,a){let i={};i.paymentMethod=JSON.stringify(a.paymentMethod),i.amount=JSON.stringify({currency:adyenGiftcardsConfiguration.currency,value:adyenGiftcardsConfiguration.totalInMinorUnits}),this._client.post(`${adyenGiftcardsConfiguration.checkBalanceUrl}`,JSON.stringify(i),(function(t){if((t=JSON.parse(t)).hasOwnProperty("pspReference")){let n=t.transactionLimit?parseFloat(t.transactionLimit.value):parseFloat(t.balance.value);a.giftcard={currency:adyenGiftcardsConfiguration.currency,value:(n/this.minorUnitsQuotient).toFixed(2),title:e.name},this.saveGiftcardStateData(a)}else n(t.resultCode)}).bind(this))}fetchRedeemedGiftcards(){this._client.get(adyenGiftcardsConfiguration.fetchRedeemedGiftcardsUrl,(function(e){e=JSON.parse(e),this.redeemedGiftcards=e.redeemedGiftcards&&e.redeemedGiftcards.giftcards||[];let t=document.getElementById("giftcardsContainer"),n=document.getElementById("showGiftcardButton"),a=document.getElementById("giftcardDropdown");t.innerHTML="",e.redeemedGiftcards.giftcards.forEach(function(e){let n=parseFloat(e.deductedAmount);n=n.toFixed(2);let a=adyenGiftcardsConfiguration.translationAdyenGiftcardDeductedBalance+": "+adyenGiftcardsConfiguration.currencySymbol+n,i=document.createElement("div");var r=document.createElement("img");r.src="https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/"+e.brand+".svg",r.alt=e.brand+" logo",r.classList.add("adyen-giftcard-logo");let o=document.createElement("a");o.href="#",o.textContent="×",o.setAttribute("dataid",e.stateDataId),o.classList.add("adyen-remove-giftcard"),o.style.display="block",i.appendChild(r),i.innerHTML+=`<span>${e.title}</span>`,i.appendChild(o),i.innerHTML+=`<p class="adyen-giftcard-summary">${a}</p> <hr>`,t.appendChild(i)}
16),this.remainingAmount=e.redeemedGiftcards.remainingAmount,this.giftcardDiscount=e.redeemedGiftcards.totalDiscount,this.paymentMethodInstance&&this.paymentMethodInstance.unmount(),this.giftcardComponentClose.style.display="none",this.giftcardItem.innerHTML="",this.giftcardHeader.innerHTML=" ",this.appendGiftcardSummary(),this.remainingAmount>0?"showFields"===this.giftcardsAddOption?(n.style.display="none",a.style.display="block"):(n.style.display="block",a.style.display="none"):(this.adyenGiftcardDropDown.length>0&&(this.adyenGiftcardDropDown[0].style.display="none"),n.style.display="none",a.style.display="none"),document.getElementById("giftcardsContainer")}).bind(this))}saveGiftcardStateData(e){e=JSON.stringify(e),this._client.post(adyenGiftcardsConfiguration.setGiftcardUrl,JSON.stringify({stateData:e}),(function(e){"token"in(e=JSON.parse(e))&&(this.fetchRedeemedGiftcards(),u.remove(document.body))}).bind(this))}removeGiftcard(e){u.create(document.body),this._client.post(adyenGiftcardsConfiguration.removeGiftcardUrl,JSON.stringify({stateDataId:e}),e=>{"token"in(e=JSON.parse(e))&&(this.fetchRedeemedGiftcards(),u.remove(document.body))})}appendGiftcardSummary(){if(!this.shoppingCartSummaryBlock.length)return;let e=this.shoppingCartSummaryBlock[0],t=adyenGiftcardsConfiguration.currencySymbol||"";e.querySelectorAll(".adyen-giftcard-summary").forEach(e=>e.remove());let n=function(e,n){let{total:i=!1,strongValue:r=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement("dt");o.classList.add("col-7","checkout-aside-summary-label","adyen-giftcard-summary"),i&&o.classList.add("checkout-aside-summary-total");let s=document.createElement("dd");s.classList.add("col-5","checkout-aside-summary-value","adyen-giftcard-summary"),i&&s.classList.add("checkout-aside-summary-total"),r&&s.classList.add("adyen-giftcard-value-strong"),"string"==typeof e?o.textContent=e:o.appendChild(e);let d=Number(n||0).toFixed(2);s.textContent=`${t}${d}`,a.appendChild(o),a.appendChild(s)},a=document.createDocumentFragment(),i=!!this.giftcardsShowSeparately,r=Array.isArray(this.redeemedGiftcards)?this.redeemedGiftcards:[];i?r.forEach(e=>{let t=document.createElement("div");t.classList.add("adyen-giftcard-line");let a=document.createElement("img");a.src=`https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/${encodeURIComponent(e.brand)}.svg`,a.alt=e.brand,a.classList.add("adyen-giftcard-logo");let i=document.createElement("strong");i.classList.add("adyen-giftcard-title"),i.textContent=`${e.title} giftcard`,t.append(a,i),n(t,e.deductedAmount,{strongValue:!0})}):n(adyenGiftcardsConfiguration.translationAdyenGiftcardDiscount,this.giftcardDiscount,{total:!0}),n(adyenGiftcardsConfiguration.translationAdyenGiftcardRemainingAmount,this.remainingAmount,{total:!0}),e.appendChild(a)}},"#adyen-giftcards-container"),C.register("ConfirmOrderPlugin",class extends s{init(){this._client=new l,this.selectedAdyenPaymentMethod=this.getSelectedPaymentMethodKey(),this.confirmOrderForm=d.querySelector(document,"#confirmOrderForm"),this.checkoutMainContent=d.querySelector(document,"#content-main"),this.shoppingCartSummaryBlock=d.querySelectorAll(document,".checkout-aside-summary-list"),this.minorUnitsQuotient=adyenCheckoutOptions.amount/adyenCheckoutOptions.totalPrice,this.giftcardDiscount=adyenCheckoutOptions.giftcardDiscount,this.remainingAmount=adyenCheckoutOptions.totalPrice-this.giftcardDiscount,this.responseHandler=this.handlePaymentAction,this.adyenCheckout=Promise,this.setupPaymentMethodSwitchHandler(),this.initializeCheckoutComponent().then((function(){if(adyenCheckoutOptions.selectedPaymentMethodPluginId===adyenCheckoutOptions.adyenPluginId){if(!adyenCheckoutOptions||!adyenCheckoutOptions.paymentStatusUrl||!adyenCheckoutOptions.checkoutOrderUrl||!adyenCheckoutOptions.paymentHandleUrl){console.error("Adyen payment configuration missing.");return}if(this.selectedAdyenPaymentMethod in f.componentsWithPayButton&&this.initializeCustomPayButton(),"klarna_b2b"===this.selectedAdyenPaymentMethod){this.checkoutMainContent.addEventListener("click",this.onConfirmOrderSubmit.bind(this));return}f.updatablePaymentMethods.includes(this.selectedAdyenPaymentMethod)&&!this.stateData?this.renderPaymentComponent(this.selectedAdyenPaymentMethod):this.checkoutMainContent.addEventListener("click",this.onConfirmOrderSubmit.bind(this))}}).bind(this)),adyenCheckoutOptions.payInFullWithGiftcard>0?parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&this.appendGiftcardSummary():this.appendGiftcardSummary()}_buildPayloadWithFormData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={...t,stateData:JSON.stringify(e)};if(this.confirmOrderForm)for(let[e,t]of new FormData(this.confirmOrderForm).entries())e in n||(n[e]=t);return n}setupPaymentMethodSwitchHandler(){document.addEventListener("change",e=>{"paymentMethodId"===e.target.name&&(this.temporarilyDisableAdyenValidation(),setTimeout(()=>{this.restoreAdyenValidation()},100))},!0)}temporarilyDisableAdyenValidation(){let e=document.querySelector("#adyen-payment-checkout-mask");
16e&&e.querySelectorAll("input, select, textarea").forEach(e=>{e.setAttribute("data-original-required",e.hasAttribute("required")?"true":"false"),e.removeAttribute("required"),e.setAttribute("novalidate","true"),e.setAttribute("data-validation-skipped","true")})}restoreAdyenValidation(){document.querySelectorAll("[data-validation-skipped]").forEach(e=>{"true"===e.getAttribute("data-original-required")&&e.setAttribute("required","true"),e.removeAttribute("novalidate"),e.removeAttribute("data-validation-skipped"),e.removeAttribute("data-original-required")})}async initializeCheckoutComponent(){let{AdyenCheckout:e}=window.AdyenWeb,{locale:t,clientKey:n,environment:a,merchantAccount:i}=adyenCheckoutConfiguration,r=adyenCheckoutOptions.paymentMethodsResponse,o={locale:t,clientKey:n,environment:a,showPayButton:this.selectedAdyenPaymentMethod in f.componentsWithPayButton,paymentMethodsResponse:JSON.parse(r),onAdditionalDetails:this.handleOnAdditionalDetails.bind(this),countryCode:activeShippingAddress.country};this.adyenCheckout=await e(o)}handleOnAdditionalDetails(e){this._client.post(`${adyenCheckoutOptions.paymentDetailsUrl}`,JSON.stringify({orderId:this.orderId,stateData:JSON.stringify(e.data)}),(function(e){if(200!==this._client._request.status){location.href=this.errorUrl.toString();return}this.responseHandler(e)}).bind(this))}onConfirmOrderSubmit(e){if(!e.target.closest('#confirmOrderForm button[type="submit"]'))return;this.restoreAdyenValidation();let t=d.querySelector(document,"#confirmOrderForm",!1);if(!t.checkValidity()){t.reportValidity();return}if("klarna_b2b"===this.selectedAdyenPaymentMethod){let t=d.querySelector(document,"#adyen-company-name"),n=t?t.value.trim():"",a=d.querySelector(document,"#adyen-company-name-error"),i=d.querySelector(document,"#adyen-registration-number"),r=i?i.value.trim():"",o=d.querySelector(document,"#adyen-company-number-error");a.style.display="none",o.style.display="none";let s=!1;if(n||(a.style.display="block",s=!0),r||"NL"!==activeBillingAddress.country&&"SE"!==activeBillingAddress.country||(o.style.display="block",s=!0),s){e.preventDefault();return}}e.preventDefault(),u.create(document.body);let n=m.serialize(t);this.confirmOrder(n)}renderPaymentComponent(e){if("oneclick"===e){this.renderStoredPaymentMethodComponents();return}if("giftcard"===e)return;let t=JSON.parse(adyenCheckoutOptions.paymentMethodsResponse).paymentMethods.filter(function(t){return t.type===e});if(0===t.length){"test"===this.adyenCheckout.options.environment&&console.error("Payment method configuration not found. ",e);return}let n=t[0];this.mountPaymentComponent(n,!1)}renderStoredPaymentMethodComponents(){this.adyenCheckout.paymentMethodsResponse.storedPaymentMethods.forEach(e=>{let t=`[data-adyen-stored-payment-method-id="${e.id}"]`;this.mountPaymentComponent(e,!0,t)}),this.hideStorePaymentMethodComponents();let e=null;d.querySelectorAll(document,"[name=adyenStoredPaymentMethodId]").forEach(t=>{e||(e=t.value),t.addEventListener("change",this.showSelectedStoredPaymentMethod.bind(this))}),this.showSelectedStoredPaymentMethod(null,e)}showSelectedStoredPaymentMethod(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.hideStorePaymentMethodComponents(),t=e?e.target.value:t;let n=`[data-adyen-stored-payment-method-id="${t}"]`;d.querySelector(document,n).style.display="block"}hideStorePaymentMethodComponents(){d.querySelectorAll(document,".stored-payment-component").forEach(e=>{e.style.display="none"})}confirmOrder(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=adyenCheckoutOptions.orderId;e.set("affiliateCode",adyenCheckoutOptions.affiliateCode),e.set("campaignCode",adyenCheckoutOptions.campaignCode),a?this.updatePayment(e,a,t,n):this.createOrder(e,t,n)}updatePayment(e,t,n,a){e.set("orderId",t);try{this._client.post(adyenCheckoutOptions.updatePaymentUrl,e,this.afterSetPayment.bind(this,n,a))}catch(e){console.log(e),a.reject&&a.reject({})}}paypalOrder(e,t){try{this._client.post(adyenCheckoutOptions.paypalOrderUrl,JSON.stringify(e),this.responseHandler.bind(this))}catch(e){console.log(e),t.reject&&t.reject({})}}paypalOrderFinalize(e,t){try{this._client.post(`${adyenCheckoutOptions.paypalOrderFinalizeUrl}`,JSON.stringify(this._buildPayloadWithFormData(e.data)),function(e){let n=JSON.parse(e);if(n.redirectUrl){window.location.href=n.redirectUrl;return}t.reject&&t.reject({}),window.location.reload()})}catch(e){console.log(e),t.reject&&t.reject({})}}createOrder(e,t,n){this._client.post(adyenCheckoutOptions.checkoutOrderUrl,e,this.afterCreateOrder.bind(this,t,n))}afterCreateOrder(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;try{e=JSON.parse(a)}catch(e){u.remove(document.body),console.log(e),n.reject&&n.reject({});return}if(e.url){location.href=e.url;return}if(this.orderId=e.id,this.errorUrl=new URL(location.origin+adyenCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",e.id),"handler_adyen_billiepaymentmethodhandler"===adyenCheckoutOptions.selectedPaymentMethodHandler){let e=d.querySelector(document,"#adyen-company-name"),n=e?e.value:"",a=d.querySelector(document,"#adyen-registration-number"),i=a?a.value:"";t.companyName=n,t.registrationNumber=i}let i={orderId:this.orderId};for(let e in t)i[e]=t[e];try{this._client.post(adyenCheckoutOptions.paymentHandleUrl,JSON.stringify(i),this.afterPayOrder.bind(this,this.orderId,n))}catch(e){console.error("Error in afterCreateOrder:",e),n.reject&&n.reject({})}}afterSetPayment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;try{JSON.parse(n).success&&this.afterCreateOrder(e,t,JSON.stringify({id:adyenCheckoutOptions.orderId}))}catch(e){u.remove(document.body),console.log(e),t.reject&&t.reject({});return}}afterPayOrder(e,t,n){try{n=JSON.parse(n),this.returnUrl=n.redirectUrl}catch(e){u.remove(document.body),console.log(e),t.reject&&t.reject({});return}n.paymentFailed&&(t.reject&&t.reject({}),location.href=this.returnUrl),t.resolve&&t.resolve({});try{this._client.post(`${adyenCheckoutOptions.paymentStatusUrl}`,JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e)}}handlePaymentAction(e){try{let t=JSON.parse(e);if((t.isFinal||"voucher"===t.action.type)&&(location.href=this.returnUrl),t.action){let e={};if("threeDS2"===t.action.type&&(e.challengeWindowSize="05"),this.adyenCheckout.createFromAction(t.action,e).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(t.action.type)){let e=window.jQuery&&$.fn.tooltip&&$.fn.tooltip.Constructor&&$.fn.tooltip.Constructor.VERSION,t=e&&e.startsWith("4");window.jQuery&&t?$("[data-adyen-payment-action-modal]").modal({show:!0}):new bootstrap.Modal(document.getElementById("adyen-payment-action-modal"),{keyboard:!1}).show()}}}catch(e){console.log(e)}}initializeCustomPayButton(){let e=f.componentsWithPayButton[this.selectedAdyenPaymentMethod];this.completePendingPayment(this.selectedAdyenPaymentMethod,e);let t=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter(e=>e.type===this.selectedAdyenPaymentMethod);if(t.length<1&&"googlepay"===this.selectedAdyenPaymentMethod&&(t=this.adyenCheckout.paymentMethodsResponse.paymentMethods.filter(e=>"paywithgoogle"===e.type)),t.length<1)return;let n=t[0];if(!adyenCheckoutOptions.amount){console.error("Failed to fetch Cart/Order total amount.");return}if(e.prePayRedirect){this.renderPrePaymentButton(e,n);return}let a={amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onClick:(t,n)=>{if(!e.onClick(t,n,this))return!1;u.create(document.body)},onCancel:(t,n)=>{u.remove(document.body),e.onCancel(t,n,this)},onError:(t,n)=>{u.remove(document.body),"PayPal"!==n.props.name&&(e.onError(t,n,this),console.log(t))}};"paypal"===this.selectedAdyenPaymentMethod?(a.onSubmit=(function(t,n,a){if(t.isValid){let i=this._buildPayloadWithFormData(t.data);"responseHandler"in e&&(this.responseHandler=e.responseHandler.bind(n,this)),this.paypalOrder(i,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",t)}).bind(this),a.onAdditionalDetails=(function(e,t){this.paypalOrderFinalize(e,t)}).bind(this)):a.onSubmit=(function(t,n,a){if(t.isValid){let i={stateData:JSON.stringify(t.data)},r=m.serialize(this.confirmOrderForm);"responseHandler"in e&&(this.responseHandler=e.responseHandler.bind(n,this)),this.confirmOrder(r,i,a)}else n.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",t)}).bind(this);let i=Object.assign(e.extra,n,a);if("paywithgoogle"===n.type||"googlepay"===n.type){let{googlepayButtonType:e,googlepayButtonColor:t,googlepayButtonSize:n,googleMerchantId:a,gatewayMerchantId:r}=adyenCheckoutOptions;i={...i,...e&&{buttonType:e},...t&&{buttonColor:t},...n&&{buttonSizeMode:n},configuration:{...a&&{merchantId:a},...r&&{gatewayMerchantId:r}}}}if("paypal"===n.type){let{paypalButtonColor:e,paypalButtonShape:t,paypalButtonLabel:n,paypalButtonInstallmentsMexico:a,paypalButtonInstallmentsBrazil:r}
16=adyenCheckoutOptions,o={...e&&{color:e},...t&&{shape:t},...n&&{label:n},..."installment"===n&&activeBillingAddress?.country==="MX"&&{period:a},..."installment"===n&&activeBillingAddress?.country==="BR"&&{period:r}};Object.keys(o).length>0&&(i.style=o)}if("applepay"===n.type){let{applepayButtonType:e,applepayButtonColor:t}=adyenCheckoutOptions;i={...i,...e&&{buttonType:e},...t&&{buttonColor:t}}}let r=AdyenWeb.createComponent(n.type,this.adyenCheckout,i);try{"isAvailable"in r?r.isAvailable().then((function(){this.mountCustomPayButton(r)}).bind(this)).catch(e=>{console.log(n.type+" is not available",e)}):this.mountCustomPayButton(r)}catch(e){console.log(e)}}renderPrePaymentButton(e,t){"amazonpay"===t.type&&(e.extra=this.setAddressDetails(e.extra));let n=Object.assign(e.extra,t,{configuration:t.configuration,amount:{value:adyenCheckoutOptions.amount,currency:adyenCheckoutOptions.currency},onClick:(t,n)=>{if(!e.onClick(t,n,this))return!1;u.create(document.body)},onError:(t,n)=>{u.remove(document.body),e.onError(t,n,this),console.log(t)}}),a=AdyenWeb.createComponent(t.type,this.adyenCheckout,n);this.mountCustomPayButton(a)}completePendingPayment(e,t){let n=new URL(location.href);if(n.searchParams.has(t.sessionKey)){u.create(document.body);let a=AdyenWeb.createComponent(e,this.adyenCheckout,{[t.sessionKey]:n.searchParams.get(t.sessionKey),showOrderButton:!1,onSubmit:(function(e,t,n){if(e.isValid){let t={stateData:JSON.stringify(e.data)},a=m.serialize(this.confirmOrderForm);this.confirmOrder(a,t,n)}}).bind(this)});this.mountCustomPayButton(a),a.submit()}}getSelectedPaymentMethodKey(){return Object.keys(f.paymentMethodTypeHandlers).find(e=>f.paymentMethodTypeHandlers[e]===adyenCheckoutOptions.selectedPaymentMethodHandler)}mountCustomPayButton(e){let t=document.querySelector("#confirmOrderForm");if(t){let n=t.querySelector("button[type=submit]");if(n&&!n.disabled){let a=document.createElement("div");a.id="adyen-confirm-button",a.setAttribute("data-adyen-confirm-button",""),t.appendChild(a),e.mount(a),n.remove()}}}mountPaymentComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=Object.assign({},e,{data:{personalDetails:shopperDetails,billingAddress:activeBillingAddress,deliveryAddress:activeShippingAddress},onSubmit:(function(n,a,i){if(n.isValid){t&&(n.data.paymentMethod.holderName=e.holderName??"");let a={stateData:JSON.stringify(n.data)},r=m.serialize(this.confirmOrderForm);u.create(document.body),this.confirmOrder(r,a,i)}else a.showValidation(),"test"===this.adyenCheckout.options.environment&&console.log("Payment failed: ",n)}).bind(this)});"scheme"===e.type&&(a.hasHolderName=!0,a.holderNameRequired=!0,a.clickToPayConfiguration={merchantDisplayName:adyenCheckoutConfiguration.merchantAccount,shopperEmail:shopperDetails.shopperEmail}),("ratepay"===e.type||"affirm"===e.type||"facilypay_3x"===e.type||"facilypay_4x"===e.type||"facilypay_6x"===e.type||"facilypay_10x"===e.type||"facilypay_12x"===e.type)&&(a.visibility={personalDetails:"editable",billingAddress:adyenCheckoutOptions.billingAddressReadOnly?"readOnly":"editable",deliveryAddress:adyenCheckoutOptions.shippingAddressReadOnly?"readOnly":"editable"}),!t&&"scheme"===e.type&&adyenCheckoutOptions.displaySaveCreditCardOption&&(a.enableStoreDetails=!0);let i=t?n:"#"+this.el.id;try{let n=AdyenWeb.createComponent(e.type,this.adyenCheckout,a);n.mount(i),this.checkoutMainContent.addEventListener("click",(function(e){if(!e.target.closest('#confirmOrderForm button[type="submit"]'))return;e.preventDefault();let i=d.querySelector(document,"#confirmOrderForm",!1);if(!i.checkValidity()){i.reportValidity();return}if(e.preventDefault(),this.el.parentNode.scrollIntoView({behavior:"smooth",block:"start"}),t){let e=n.data||{};a.onSubmit({isValid:!0,data:e},n,{});return}n.submit()}).bind(this))}catch(t){return console.error(e.type,t),!1}}appendGiftcardSummary(){if(parseInt(adyenCheckoutOptions.giftcardDiscount,10)&&this.shoppingCartSummaryBlock.length){let e=parseFloat(this.giftcardDiscount).toFixed(2),t=parseFloat(this.remainingAmou
16nt).toFixed(2),n='<dt class="col-7 checkout-aside-summary-label checkout-aside-summary-total adyen-giftcard-summary">'+adyenCheckoutOptions.translationAdyenGiftcardDiscount+'</dt><dd class="col-5 checkout-aside-summary-value checkout-aside-summary-total adyen-giftcard-summary">'+adyenCheckoutOptions.currencySymbol+e+'</dd><dt class="col-7 checkout-aside-summary-label checkout-aside-summary-total adyen-giftcard-summary">'+adyenCheckoutOptions.translationAdyenGiftcardRemainingAmount+'</dt><dd class="col-5 checkout-aside-summary-value checkout-aside-summary-total adyen-giftcard-summary">'+adyenCheckoutOptions.currencySymbol+t+"</dd>";this.shoppingCartSummaryBlock[0].innerHTML+=n}}setAddressDetails(e){return""!==activeShippingAddress.phoneNumber?e.addressDetails={name:shopperDetails.firstName+" "+shopperDetails.lastName,addressLine1:activeShippingAddress.street,city:activeShippingAddress.city,postalCode:activeShippingAddress.postalCode,countryCode:activeShippingAddress.country,phoneNumber:activeShippingAddress.phoneNumber}:e.productType="PayOnly",e}},"#adyen-payment-checkout-mask"),C.register("ExpressCheckoutPlugin",class extends s{init(){let e;this._client=new l,this.paymentMethodInstance=null,this.responseHandler=this.handlePaymentAction,this.userLoggedIn="true"===adyenExpressCheckoutOptions.userLoggedIn,this.formattedHandlerIdentifier="",this.newAddress={},this.newShippingMethod={},this.email="",this.pspReference="",this.paymentData=null,this.blockPayPalShippingOptionChange=!1,this.stateData={},this.googlePayComponent=null,this.checkoutInstances={},this.activePaymentType=null;let{googlepayButtonType:t,googlepayButtonColor:n,googlepayButtonSize:a}=adyenExpressCheckoutOptions,i={...t&&{buttonType:t},...n&&{buttonColor:n},...a&&{buttonSizeMode:a},onClick:(e,t)=>{this.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.googlepay,this.activePaymentType="googlepay",e()},isExpress:!0,callbackIntents:this.userLoggedIn?[]:["SHIPPING_ADDRESS","PAYMENT_AUTHORIZATION","SHIPPING_OPTION"],shippingAddressRequired:!this.userLoggedIn,emailRequired:!this.userLoggedIn,shippingAddressParameters:{allowedCountryCodes:[],phoneNumberRequired:!0},shippingOptionRequired:!this.userLoggedIn,onAuthorized:(e,t)=>{try{let n=this.paymentMethodSpecificConfig&&this.paymentMethodSpecificConfig.paywithgoogle&&this.paymentMethodSpecificConfig.paywithgoogle.paymentDataCallbacks,a=n&&"function"==typeof n.onPaymentAuthorized?n.onPaymentAuthorized:null;a?Promise.resolve(a(e.authorizedEvent)).then(e=>t.resolve(e)).catch(()=>t.reject()):t.resolve({transactionState:"SUCCESS"})}catch(e){console.error("onAuthorized error:",e),t.reject()}},paymentDataCallbacks:this.userLoggedIn?{}:{onPaymentDataChanged:e=>new Promise(async t=>{try{let{callbackTrigger:n,shippingAddress:a,shippingOptionData:i}=e,r={};if("INITIALIZE"===n||"SHIPPING_ADDRESS"===n){let e={};a&&(this.newAddress=e.newAddress=a),e.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.googlepay;let t=await this.fetchExpressCheckoutConfig(adyenExpressCheckoutOptions.expressCheckoutConfigUrl,e),n=t.shippingMethodsResponse,i=[];n.forEach(e=>{i.push({id:e.id,label:e.label,description:e.description})}),r.newShippingOptionParameters={defaultSelectedOptionId:i[0].id,shippingOptions:i},r.newTransactionInfo={currencyCode:t.currency,totalPriceStatus:"FINAL",totalPrice:(parseInt(t.amount)/100).toString(),totalPriceLabel:"Total",countryCode:t.countryCode}}if("SHIPPING_OPTION"===n){let e={};a&&(this.newAddress=e.newAddress=a),i&&(this.newShippingMethod=e.newShippingMethod=i),e.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.googlepay;let t=await this.fetchExpressCheckoutConfig(adyenExpressCheckoutOptions.expressCheckoutConfigUrl,e);r.newTransactionInfo={currencyCode:t.currency,totalPriceStatus:"FINAL",totalPrice:(parseInt(t.amount)/100).toString(),totalPriceLabel:"Total",countryCode:t.countryCode}}t(r)}catch(e){console.error("Error in onPaymentDataChanged:",e),t({error:e.error})}}),onPaymentAuthorized:e=>{var t=(e&&e.shippingAddress&&e.shippingAddress.name||"").trim().split(/\s+/).filter(Boolean),n=t[0]||"",a=t.length>1?t.slice(1).join(" "):".";let i={state:e.shippingAddress.administrativeArea,zipcode:e.shippingAddress.postalCode,street:e.shippingAddress.address1,address2:e.shippingAddress.address2,address3:e.shippingAddress.address3,city:e.shippingAddress.locality,countryCode:e.shippingAddress.countryCode,firstName:n,lastName:a};return this.email=e.email,this.newAddress=i,this.newShippingMethod=e.shippingOptionData,new Promise(e=>{e({transactionState:"SUCCESS"})})}}},{paypalButtonColor:r,paypalButtonShape:o,paypalButtonLabel:s,paypalButtonInstallmentsMexico:d,paypalButtonInstallmentsBrazil:c,countryCode:h}=adyenExpressCheckoutOptions,p={...r&&{color:r},...o&&{shape:o},...s&&{label:s},..."installment"===s&&"MX"===h&&{period:d},..."installment"===s&&"BR"===h&&{period:c}};Object.keys(p).length>0&&(e={style:p});let{applepayButtonType:y,applepayButtonColor:u}=adyenExpressCheckoutOptions,m={...y&&{buttonType:y},...u&&{buttonColor:u}};this.paymentMethodSpecificConfig={paywithgoogle:i,googlepay:i,...e&&{paypal:e},...m&&{applepay:m}},this.userLoggedIn||(this.paymentMethodSpecificConfig.paypal={...this.paymentMethodSpecificConfig.paypal,isExpress:!0,onAuthorized:this.onShopperDetails.bind(this),blockPayPalCreditButton:!0,blockPayPalPayLaterButton:!0,onShippingAddressChange:this.onShippingAddressChanged.bind(this),onShippingOptionsChange:this.onShippingOptionsChange.bind(this)},this.paymentMethodSpecificConfig.applepay={...this.paymentMethodSpecificConfig.applepay,isExpress:!0,requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:["postalAddress","name","phone","email"],onAuthorized:this.handleApplePayAuthorization.bind(this),onShippingContactSelected:this.onShippingContactSelected.bind(this),onShippingMethodSelected:this.onShippingMethodSelected.bind(this)}
16),this.productDetailPageBuyProductForm=document.getElementById("productDetailPageBuyProductForm"),this.productDetailPageBuyProductForm&&(this.quantityInput=this.productDetailPageBuyProductForm.querySelector(".js-quantity-selector")),this.listenOnQuantityChange(),this.mountExpressCheckoutComponents({countryCode:adyenExpressCheckoutOptions.countryCode,amount:adyenExpressCheckoutOptions.amount,currency:adyenExpressCheckoutOptions.currency,paymentMethodsResponse:JSON.parse(adyenExpressCheckoutOptions.paymentMethodsResponse)})}async fetchExpressCheckoutConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.querySelector('meta[itemprop="productID"]'),a=n?n.content:"-1";return new Promise((n,i)=>{this._client.post(e,JSON.stringify({quantity:this.quantityInput?this.quantityInput.value:-1,productId:a,...t}),e=>{try{let t=JSON.parse(e);if(this._client._request.status>=400){i({error:t.error});return}n(t)}catch(e){i({status:500,message:"Failed to parse server response."})}})})}mountExpressCheckoutComponents(e){if(!document.getElementById("adyen-express-checkout"))return;let t=document.getElementsByClassName("adyen-express-checkout-element");if(0===t.length)return;let n=[],a=e.paymentMethodsResponse.paymentMethods||[];for(let e=0;e<a.length;e++)n[e]=a[e].type;for(let a=0;a<t.length;a++){let i=t[a].getElementsByClassName("adyen-type")[0].value;n.includes(i)&&this.initializeCheckoutComponent(e,i).then((function(e){this.mountElement(i,e,t[a])}).bind(this))}}mountElement(e,t,n){let a=this.paymentMethodSpecificConfig[e]||null,i=t.paymentMethodsResponse.paymentMethods.filter(t=>t.type===e)[0];a&&i&&i.configuration&&(a.configuration=i.configuration),"applepay"===e&&a&&(a.countryCode=t.options.countryCode),("paywithgoogle"===e||"googlepay"===e)&&""!==adyenExpressCheckoutOptions.googleMerchantId&&""!==adyenExpressCheckoutOptions.gatewayMerchantId&&(a.configuration={merchantId:adyenExpressCheckoutOptions.googleMerchantId,gatewayMerchantId:adyenExpressCheckoutOptions.gatewayMerchantId}),("paywithgoogle"===e||"googlepay"===e)&&this.googlePayComponent&&this.googlePayComponent.unmount();let r=AdyenWeb.createComponent(e,t,a);("paywithgoogle"===e||"googlepay"===e)&&(this.googlePayComponent=r),r.mount(n)}async initializeCheckoutComponent(e,t){let{AdyenCheckout:n}=window.AdyenWeb,{locale:a,clientKey:i,environment:r}=adyenCheckoutConfiguration,o={locale:a,clientKey:i,environment:r,showPayButton:!0,countryCode:e.countryCode,amount:{value:e.amount,currency:e.currency},paymentMethodsResponse:e.paymentMethodsResponse,onAdditionalDetails:this.handleOnAdditionalDetails.bind(this),onError:(e,t)=>{let n=f.componentsWithPayButton.googlepay;u.remove(document.body),n.onError(e,t,this),console.log(e)}};"paypal"===t?(o.onSubmit=(function(e,t,n){this.activePaymentType="paypal",this.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.paypal;let a=f.componentsWithPayButton.paypal;this.responseHandler=a.responseHandler.bind(t,this),this.paypalExpressOrder(this.getExpressRequestData(e),n)}).bind(this),o.onAdditionalDetails=(function(e,t){this.paypalExpressOrderFinalize(e,t)}).bind(this)):o.onSubmit=(function(e,t,n){if(!e.isValid)return;let a=e.data.paymentMethod.type;this.activePaymentType=a,"applepay"===a&&(this.userLoggedIn||(this.stateData=e.data),this.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.applepay);let i={stateData:JSON.stringify(e.data)};this.createOrder(JSON.stringify(this.getExpressRequestData()),i,n)}).bind(this);let s=await n(o);return this.checkoutInstances[t]=s,s}getExpressRequestData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=document.querySelector('meta[itemprop="productID"]');return{productId:t?t.content:"-1",quantity:this.quantityInput?this.quantityInput.value:-1,formattedHandlerIdentifier:this.formattedHandlerIdentifier,newAddress:this.newAddress,newShippingMethod:this.newShippingMethod,email:this.email,affiliateCode:adyenExpressCheckoutOptions.affiliateCode,campaignCode:adyenExpressCheckoutOptions.campaignCode,stateData:JSON.stringify(e.data)}}paypalExpressOrderFinalize(e,t){try{this._client.post(`${adyenExpressCheckoutOptions.paypalExpressOrderFinalizeUrl}`,JSON.stringify({stateData:JSON.stringify(e.data),newAddress:this.newAddress}),function(e){let n=JSON.parse(e);if(n.redirectUrl){window.location.href=n.redirectUrl;return}t.reject&&t.reject({}),window.location.reload()})}catch(e){console.log(e),t.reject&&t.reject({})}}createOrder(e,t,n){try{this._client.post(adyenExpressCheckoutOptions.checkoutOrderExpressUrl,e,this.afterCreateOrder.bind(this,t,n))}catch(e){console.error("Error in createOrder:",e),n.reject({})}}afterCreateOrder(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;try{e=JSON.parse(a)}catch(e){u.remove(document.body),console.log(e),n.reject({});return}if(e.url){location.href=e.url;return}this.orderId=e.id,this.errorUrl=new URL(location.origin+adyenExpressCheckoutOptions.paymentErrorUrl),this.errorUrl.searchParams.set("orderId",this.orderId);let i={orderId:this.orderId};for(let e in t)i[e]=t[e];try{this._client.post(adyenExpressCheckoutOptions.paymentHandleExpressUrl,JSON.stringify(i),this.afterPayOrder.bind(this,this.orderId,n))}catch(e){console.error("Error in afterCreateOrder:",e),n.reject({})}}afterPayOrder(e,t,n){try{n=JSON.parse(n),this.returnUrl=n.redirectUrl}catch(e){u.remove(document.body),console.log(e),t.reject({});return}n.paymentFailed&&(t.reject({}),location.href=this.returnUrl),t.resolve({});try{this._client.post(`${adyenExpressCheckoutOptions.paymentStatusUrl}`,JSON.stringify({orderId:e}),this.responseHandler.bind(this))}catch(e){console.log(e),t.reject({})}}handlePaymentAction(e){try{let t=JSON.parse(e);if(t.isFinal||"voucher"===t.action.type){location.href=this.returnUrl;return}if(t.action){let e={};"threeDS2"===t.action.type&&(e.challengeWindowSize="05"),(this.checkoutInstances[this.activePaymentType]||this.checkoutInstances[Object.keys(this.checkoutInstances)[0]]).createFromAction(t.action,e).mount("[data-adyen-payment-action-container]"),["threeDS2","qrCode"].includes(t.action.type)&&("undefined"!=typeof bootstrap&&"function"==typeof bootstrap.Modal?new bootstrap.Modal(document.getElementById("adyen-payment-action-modal"),{keyboard:!1}).show():window.jQuery&&"function"==typeof $.fn.modal&&$("[data-adyen-payment-action-modal]").modal({show:!0}))}}catch(e){console.log(e)}}handleOnAdditionalDetails(e,t,n){this._client.post(`${adyenExpressCheckoutOptions.paymentDetailsUrl}`,JSON.stringify({orderId:this.orderId,stateData:JSON.stringify(e.data),newAddress:this.newAddress,newShipping:this.newShippingMethod}),(function(e){if(200!==this._client._request.status){location.href=this.errorUrl.toString(),n.reject({});return}n.resolve({}),this.responseHandler(e)}).bind(this))}listenOnQuantityChange(){this.quantityInput&&this.quantityInput.addEventListener("change",e=>{let t=e.target.value,n=document.querySelector('meta[itemprop="productID"]'),a=n?
16n.content:"-1";this._client.post(adyenExpressCheckoutOptions.expressCheckoutConfigUrl,JSON.stringify({quantity:t,productId:a}),this.afterQuantityUpdated.bind(this))})}afterQuantityUpdated(e){try{let t=JSON.parse(e);this.mountExpressCheckoutComponents({countryCode:t.countryCode,amount:t.amount,currency:t.currency,paymentMethodsResponse:JSON.parse(t.paymentMethodsResponse)})}catch(e){window.location.reload()}}async onShippingAddressChanged(e,t,n){this.blockPayPalShippingOptionChange=!1,this.newShippingMethod={};let a=n.paymentData,i=e.shippingAddress,r=this.getDataForPayPalCallbacks();return r.currentPaymentData=a,r.email=this.email,i&&(this.newAddress=r.newAddress=i),new Promise((t,a)=>{this._client.post(`${adyenExpressCheckoutOptions.expressCheckoutUpdatePaypalOrderUrl}`,JSON.stringify(r),(function(i){try{let r=JSON.parse(i);r&&200===this._client._request.status?(n.updatePaymentData(r.paymentData),t()):(this.blockPayPalShippingOptionChange=!0,a(e.errors.COUNTRY_ERROR))}catch(t){this.blockPayPalShippingOptionChange=!0,a(e.errors.COUNTRY_ERROR)}}).bind(this))})}async onShippingOptionsChange(e,t,n){if(!0===this.blockPayPalShippingOptionChange)return t.reject(e.errors.METHOD_UNAVAILABLE);let a=n.paymentData,i=e.selectedShippingOption,r=this.getDataForPayPalCallbacks();return r.currentPaymentData=a,r.email=this.email,i&&(this.newShippingMethod=r.newShippingMethod=i),new Promise((t,a)=>{this._client.post(`${adyenExpressCheckoutOptions.expressCheckoutUpdatePaypalOrderUrl}`,JSON.stringify(r),(function(i){try{let r=JSON.parse(i);r&&200===this._client._request.status?(n.updatePaymentData(r.paymentData),t()):a(e.errors.METHOD_UNAVAILABLE)}catch(t){a(e.errors.METHOD_UNAVAILABLE)}}).bind(this))})}onShopperDetails(e,t){let{authorizedEvent:n,billingAddress:a,deliveryAddress:i}=e;this.newAddress={firstName:i.firstName.split(" ")[0],lastName:i.firstName.split(" ")[1],street:i.street,postalCode:i.postalCode,city:i.city,countryCode:i.country,phoneNumber:n.payer.phone.phone_number.national_number,email:n.payer.email_address},t.resolve()}getDataForPayPalCallbacks(){let e={};return e.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.paypal,e.pspReference=this.pspReference,e.orderId=this.orderId,e}handleApplePayAuthorization(e,t){let{authorizedEvent:n,billingAddress:a,deliveryAddress:i}=e,r={firstName:i.firstName,lastName:i.lastName,street:i.street,zipcode:i.postalCode,city:i.city,countryCode:i.country,phoneNumber:n.payment.shippingContact.phoneNumber,email:n.payment.shippingContact.emailAddress};r&&(this.newAddress=r,this.email=r.email),t.resolve()}async onShippingContactSelected(e,t,n){let a=n.shippingContact,i={firstName:"Temp",lastName:"Temp",street:"Street 123",city:a.locality,state:a.administrativeArea,countryCode:a.countryCode,postalCode:a.postalCode},r=this.getDataForApplePayCallbacks();i&&(this.newAddress=r.newAddress=i),this.getApplePayExpressCheckoutConfiguration(e,t,r)}async onShippingMethodSelected(e,t,n){let a={id:n.shippingMethod.identifier},i=this.getDataForApplePayCallbacks();a&&(this.newShippingMethod=i.newShippingMethod=a),this.getApplePayExpressCheckoutConfiguration(e,t,i)}getApplePayExpressCheckoutConfiguration(e,t,n){let a=0,i={};this._client.post(adyenExpressCheckoutOptions.expressCheckoutConfigUrl,JSON.stringify({...n}),(function(t){try{let n=JSON.parse(t);if(n&&200===this._client._request.status){a=parseInt(n.amount)/100,i.newTotal={type:"final",label:"Total amount",amount:a.toString()};let t=n.shippingMethodsResponse,r=[];t.forEach(e=>{r.push({identifier:e.id,label:e.label,detail:e.description,amount:parseInt(e.value)/100,selected:e.selected})}),i.newShippingMethods=r,e(i)}else{let t={newTotal:{type:"final",label:"Total amount",amount:a.toString()},errors:[new ApplePayError("shippingContactInvalid","countryCode","Error message")]};e(t)}}catch(t){e({newTotal:{type:"final",label:"Total amount",amount:a.toString()},errors:[new ApplePayError("shippingContactInvalid","countryCode","Error message")]})}}).bind(this))}getDataForApplePayCallbacks(){let e={},t=document.querySelector('meta[itemprop="productID"]'),n=t?t.content:"-1",a=this.quantityInput?this.quantityInput.value:-1;return e.formattedHandlerIdentifier=f.paymentMethodTypeHandlers.applepay,e.productId=n,e.quantity=a,e}paypalExpressOrder(e,t){try{this._client.post(adyenExpressCheckoutOptions.paypalExpressOrderUrl,JSON.stringify(e),this.responseHandler.bind(this))}catch(e){console.log(e),t.reject&&t.reject({})}}},"#adyen-express-checkout"),C.register("AdyenGivingPlugin",class extends s{init(){this._client=new l,this.adyenCheckout=Promise,this.initializeCheckoutComponent.bind(this)()}async initializeCheckoutComponent(){let{AdyenCheckout:e}=window.AdyenWeb,{locale:t,clientKey:n,environment:a}=adyenCheckoutConfiguration,{currency:i,values:r,backgroundUrl:o,logoUrl:s,name:d,description:l,url:c,termsAndConditionsUrl:h}=adyenGivingConfiguration,p={locale:t,clientKey:n,environment:a,countryCode:adyenCheckoutConfiguration.countryCode},y={donation:{currency:i,donationType:"fixedAmounts",values:r.split(",").map(Number)},bannerUrl:o,logoUrl:s,nonprofitDescription:l,nonprofitName:d,nonprofitUrl:c,termsAndConditionsUrl:h,showCancelButton:!0,onDonate:this.handleOnDonate.bind(this),onCancel:this.handleOnCancel.bind(this)};this.adyenCheckout=await e(p),new AdyenWeb.Donation(this.adyenCheckout,y).mount("#donation-container")}handleOnDonate(e,t){let n=adyenGivingConfiguration.orderId,a={stateData:JSON.stringify(e.data),orderId:n};a.returnUrl=window.location.href,this._client.post(`${adyenGivingConfiguration.donationEndpointUrl}`,JSON.stringify({...a}),(function(e){200!==this._client._request.status?t.setStatus("error"):t.setStatus("success")}).bind(this))}handleOnCancel(){let e=adyenGivingConfiguration.continueActionUrl;window.location=e}},"#adyen-giving-container"),C.register("AdyenSuccessAction",class extends s{init(){this.adyenCheckout=Promise,this.initializeCheckoutComponent.bind(this)()}async initializeCheckoutComponent(){let{AdyenCheckout:e}=window.AdyenWeb,{locale:t,clientKey:n,environment:a}=adyenCheckoutConfiguration,{action:i}=adyenSuccessActionConfiguration,r={locale:t,clientKey:n,environment:a,countryCode:adyenCheckoutConfiguration.countryCode};this.adyenCheckout=await e(r),this.adyenCheckout.createFromAction(JSON.parse(i)).mount("#success-action-container")}},"#adyen-success-action-container")})();

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.