PageSourceSearch

https://www.bodylab.fi/theme/82dac88ef5ee9e3f82f66f9590a6cc00/js/wexo-checkout/wexo-checkout.js?1791264046

js bodylab.fi collected 2026-10-06 13:56:50 UTC 17,689 bytes, 1 lines download raw bytes

1(()=>{"use strict";var e={857: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!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(Array.isArray(e)?[]:{},e,t):e}function n(e,t,r){return e.concat(t).map(function(e){return i(e,r)})}function s(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 a(e,r,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c,u,d=Array.isArray(r);return d!==Array.isArray(e)?i(r,l):d?l.arrayMerge(e,r,l):(u={},(c=l).isMergeableObject(e)&&s(e).forEach(function(t){u[t]=i(e[t],c)}),s(r).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&c.isMergeableObject(r[t])?u[t]=(function(e,t){if(!t.customMerge)return a;var r=t.customMerge(e);return"function"==typeof r?r:a})(t,c)(e[t],r[t],c):u[t]=i(r[t],c))}),u)}a.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return a(e,r,t)},{})},e.exports=a}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{var e=r(857),t=r.n(e);class i{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 r=i.toUpperCamelCase(e,t);return i.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>i.ucFirst(e.toLowerCase())).join(""):i.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class n{static isNode(e){return"object"==typeof e&&null!==e&&(e===document||e===window||e instanceof Node)}static hasAttribute(e,t){if(!n.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 r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===n.hasAttribute(e,t))throw Error('The required property "'.concat(t,'" does not exist!'));if("function"!=typeof e.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return e.getAttribute(t)}static getDataAttribute(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=t.replace(/^data(|-)/,""),o=i.toLowerCamelCase(s,"-");if(!n.isNode(e)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===e.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let a=e.dataset[o];if(void 0===a){if(r)throw Error('The required data attribute "'.concat(t,'" does not exist on ').concat(e,"!"));return a}return i.parsePrimitive(a)}static querySelector(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!n.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelector(t)||!1;if(r&&!1===i)throw Error('The required element "'.concat(t,'" does not exist in parent node!'));return i}static querySelectorAll(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!n.isNode(e))throw Error("The parent node is not a valid HTML Node!");let i=e.querySelectorAll(t);if(0===i.length&&(i=!1),r&&!1===i)throw Error('At least one item of "'.concat(t,'" must exist in parent node!'));return i}static getFocusableElements(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return e.querySelectorAll('\n            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),\n            select:not([tabindex^="-"]):not([disabled]),\n            textarea:not([tabindex^="-"]):not([disabled]),\n            button:not([tabindex^="-"]):not([disabled]),\n            a[href]:not([tabindex^="-"]):not([disabled]),\n            [tabindex]:not
1([tabindex^="-"]):not([disabled])\n        ')}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 s{publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(i),i}subscribe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this,n=e.split("."),s=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){let t=s;s=function(r){i.unsubscribe(e),t(r)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:r,cb:s}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),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}constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}}class o{init(){throw Error('The "init" method for the plugin "'.concat(this._pluginName,'" is not defined.'))}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let r=i.toDashCase(this._pluginName),s=n.getDataAttribute(this.el,"data-".concat(r,"-config"),!1),o=n.getAttribute(this.el,"data-".concat(r,"-options"),!1),a=[this.constructor.options,this.options,e];s&&a.push(window.PluginConfigManager.get(this._pluginName,s));try{o&&a.push(JSON.parse(o))}catch(e){throw console.error(this.el),Error('The data attribute "data-'.concat(r,'-options" could not be parsed to json: ').concat(e.message))}return t().all(a.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>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}constructor(e,t={},r=!1){if(!n.isNode(e))throw Error("There is no valid element given.");this.el=e,this.$emitter=new s(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(t),this._initialized=!1,this._registerInstance(),this._init()}}class a extends o{init(){for(let e of(this.inputs=n.querySelectorAll(document,this.options.inputSelector),this.inputs)){if("hidden"===e.type||e.name===this.options.surnameInput)continue;let t=document.createElement("span");t.classList.add(this.options.validationDot);let r=document.createElement("span");r.classList.add(this.options.validationDotImage),t.appendChild(r),e.insertAdjacentElement("afterend",t),e.addEventListener("blur",()=>{this.validateInputs(e)}),e.addEventListener("invalid",e=>{e.preventDefault()})}}validateInputs(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1],e.value=e.value.trim(),e.checkValidity()?this.setInputValid(e):this.setInputInvalid(e)}setInputValid(e){if(e.classList.remove(this.options.bsInvalid),e.classList.add(this.options.bsValid),n.querySelector(e.parentElement,this.options.wexoValidationMessageSelector,!1)&&e.parentElement.classList.remove(this.options.bsValidationClass),n.querySelector(e.parentElement,"label")){let t=n.querySelector(e.parentElement,"label");t.classList.remove(this.options.bsInvalid),t.classList.add(this.options.bsValid)}}setInputInvalid(e,t){if(e.classList.remove(this.options.bsValid),e.classList.add(this.options.bsInvalid),n.querySelector(e.parentElement,this.options.wexoValidationMessageSelector,!1)&&e.parentElement.classList.add(this.options.bsValidationClass),n.querySelector(e.parentElement,"label")){let t=n.querySelector(e.parentElement,"label");t.classList.remove(this.options.bsValid),t.classList.add(this.options.bsInvalid)}}}a.options={bsValidationClass:"was-validated",bsValid:"input-valid",bsInvalid:"input-invalid",wexoValidationMessageSelector:".wexo-checkout-validation-message",inputSelector:".checkout input:not(input[type=checkbox]), .checkout select:not(input[type=checkbox])",surnameInput:"shopware_surname_confirm",validationDot:"validation-dot",validationDotImage:"validation-dot-image"};class l{get(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,r);return this._sendRequest(i,null,t)}post(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let n=this._createPreparedRequest("POST",e,i);return this._sendRequest(n,t,r)}delete(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let n=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(n,t,r)}patch(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let n=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(n,t,r)}
1abort(){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 ".concat(e.responseURL," was aborted"))}),e.addEventListener("error",()=>{console.warn("the request to ".concat(e.responseURL," failed with status ").concat(e.status))}),e.addEventListener("timeout",()=>{console.warn("the request to ".concat(e.responseURL," timed out"))})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,r){return this._registerOnLoaded(e,r),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,r){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}class c{static iterate(e,t){if(e instanceof Map||Array.isArray(e))return e.forEach(t);if(e instanceof FormData){for(var r of e.entries())t(r[1],r[0]);return}if(e instanceof NodeList)return e.forEach(t);if(e instanceof HTMLCollection)return Array.from(e).forEach(t);if(e instanceof Object)return Object.keys(e).forEach(r=>{t(e[r],r)});throw Error("The element type ".concat(typeof e," is not iterable!"))}}class u{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],r=u.serialize(e,t);if(0===Object.keys(r).length)return{};let i={};return c.iterate(r,(e,t)=>i[t]=e),i}}let d="loader",h={BEFORE:"before",INNER:"inner"};class p{create(){if(!this.exists()){if(this.position===h.INNER){this.parent.innerHTML=p.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),p.getTemplate())}}remove(){let e=this.parent.querySelectorAll(".".concat(d));c.iterate(e,e=>e.remove())}exists(){return this.parent.querySelectorAll(".".concat(d)).length>0}_getPosition(){return this.position===h.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return'<div class="'.concat(d,'" role="status">\n                    <span class="').concat("visually-hidden",'">Loading...</span>\n                </div>')}static SELECTOR_CLASS(){return d}constructor(e,t=h.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}}let m="element-loader-backdrop";class g extends p{static create(e){e.classList.add("has-element-loader"),g.exists(e)||(g.appendLoader(e),setTimeout(()=>{let t=e.querySelector(".".concat(m));t&&t.classList.add("element-loader-backdrop-open")},1))}static remove(e){e.classList.remove("has-element-loader");let t=e.querySelector(".".concat(m));t&&t.remove()}static exists(e){return e.querySelectorAll(".".concat(m)).length>0}static getTemplate(){return'\n        <div class="'.concat(m,'">\n            <div class="loader" role="status">\n                <span class="').concat("visually-hidden",'">Loading...</span>\n            </div>\n        </div>\n        ')}static appendLoader(e){e.insertAdjacentHTML("beforeend",g.getTemplate())}}let f=Object.freeze(new class{replaceFromMarkup(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e;"string"==typeof i&&(i=this._createMarkupFromString(i)),"string"==typeof t&&(t=[t]),this._replaceSelectors(i,t,r)}replaceElement(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return("string"==typeof e&&(e=n.querySelectorAll(document,e,r)),"string"==typeof t&&(t=n.querySelectorAll(document,t,r)),e instanceof NodeList&&t instanceof NodeList&&t.length>e.length)?(c.iterate(t,t=>{c.iterate(e,e=>{e.innerHTML&&e.className===t.className&&(t.innerHTML=e.innerHTML)})}),!0):e instanceof NodeList?(c.iterate(e,(e,r)=>{e.innerHTML&&(t[r].innerHTML=e.innerHTML)}),!0):t instanceof NodeList?(c.iterate(t,t=>{e.innerHTML&&(t.innerHTML=e.innerHTML)}),!0):!!t&&!!e&&!!e.innerHTML&&(t.innerHTML=e.innerHTML,!0)}_replaceSelectors(e,t,r){c.iterate(t,t=>{let i=n.querySelectorAll(e,t,r),s=n.querySelectorAll(document,t,r);this.replaceElement(i,s,r)})}_createMarkupFromString(e){return this._domParser.parseFromString(e,"text/html")}constructor(){this._domParser=new DOMParser}});class b{static replaceFromMarkup(e,t,r){f.replaceFromMarkup(e,t,r)}static replaceElement(e,t,r){return f.replaceElement(e,t,r)}}let v=0,y=0,_=!1;class E extends o{init(){this._getForm()&&(window.addEventListener("pagehide",()=>{_=!0},{once:!0}),this.checkoutAsideContainer=document.querySelector(".checkout-aside-container"),this._client=new l,this._registerEvents())}_getForm(){return this.confirmForm=n.querySelector(document,"#confirmOrderForm"),this.confirmForm}_registerEvents(){this.el.querySelectorAll(':not(form) button[type="submit"], :not(form) button:not([type])').forEach(e
1=>{e.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation()})}),this.el.addEventListener("submit",this._handleSubmit.bind(this)),this.el.addEventListener("change",e=>{e.preventDefault(),e.stopImmediatePropagation();let t=e.currentTarget||e.target;t instanceof HTMLElement||(t=void 0),this.el.dispatchEvent(new SubmitEvent("submit",{submitter:t}))},{passive:!1})}_handleSubmit(e){e.preventDefault();let t=e.target;this._lockOrder(),this._updateContext(t),this._appendData()}_lockOrder(){document.querySelectorAll("#confirmFormSubmit, #confirmFormSubmitMain").forEach(e=>{e.disabled=!0}),this._blockOrderSubmit||(this._blockOrderSubmit=e=>{e.preventDefault(),e.stopImmediatePropagation()}),this.confirmForm.addEventListener("submit",this._blockOrderSubmit,!0)}_appendData(){let{dataPrefix:e}=this.options;if(!e)return;let t=this.el.querySelector('[name*="'.concat(e,'"]'));t&&t.remove();for(let t=0;t<this.el.children.length;t++){let r=this.el.children[t],i=document.createElement("input");i.type="hidden",i.name="".concat(e,"[").concat(r.name,"]"),i.value=r.value,this.confirmForm.a
1ppendChild(i)}}_updateContext(e){g.create(e),v++,y++;let t=n.getAttribute(e,"action"),r=u.serialize(e);r.delete("redirectTo"),this._client.post(t.toLowerCase(),r,(e,t)=>{if(y--,!this._isSuccessful(t)){this._recover();return}0===y&&this._reloadPage(v)})}_reloadPage(e){this.checkoutAsideContainer&&g.create(this.checkoutAsideContainer),this._client.get("".concat(window.router["frontend.checkout.confirm.page"],"?ajax=true"),(t,r)=>{if(e===v){if(!this._isSuccessful(r)||!t){this._recover();return}this._onPageReload(t)}})}_isSuccessful(e){return!!e&&e.status>=200&&e.status<400}_recover(){_||window.location.reload()}_onPageReload(e){try{b.replaceFromMarkup(e,[".container-main"],!1)}catch(e){this._recover();return}window.PluginManager.initializePlugins(),this.$emitter.publish("checkout-reloaded")}}class L extends E{}L.options={dataPrefix:"paymentData"};class S extends E{}S.options={dataPrefix:"shippingData"},PluginManager.register("InputValidation",a,".is-act-checkoutregisterpage"),PluginManager.register("CheckoutConfirm",class extends o{init(){this.el.addEventListener("submit",this._confirmOrderFormSubmit.bind(this))}_confirmOrderFormSubmit(){this.el.submit()}},".is-ctl-checkout #confirmOrderForm"),PluginManager.register("CheckoutConfirmPaymentHandler",L,".is-ctl-checkout #changePaymentForm"),PluginManager.register("CheckoutConfirmShippingHandler",S,".is-ctl-checkout #changeShippingForm"),PluginManager.register("proceedToShippingExtraBtn",class extends o{init(){this.el.addEventListener("click",this.onClick.bind(this))}onClick(){this.el.closest(".checkout").querySelector(".register-form").querySelector(".register-submit .btn").click()}},"body #customerInfoFormSubmit")})()})();

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.