PageSourceSearch

https://www.fotowalser.com/theme/a5af882ef61d94f44d7f90cacbc83791/…/quick-order.listing.plugin.39f766.js

js fotowalser.com collected 2026-10-09 22:42:40 UTC 17,972 bytes, 3 lines download raw bytes

1"use strict";(self.webpackChunkquick_order=self.webpackChunkquick_order||[]).push([[15729],{68(e,t,i){i.d(t,{A:()=>r});class r{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",r=this._createPreparedRequest("GET",e,i);return this._sendRequest(r,null,t)}post(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(t,r);let s=this._createPreparedRequest("POST",e,r);return this._sendRequest(s,t,i)}delete(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(t,r);let s=this._createPreparedRequest("DELETE",e,r);return this._sendRequest(s,t,i)}patch(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(t,r);let s=this._createPreparedRequest("PATCH",e,r);return this._sendRequest(s,t,i)}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,i){return this._registerOnLoaded(e,i),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,i){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),i&&this._request.setRequestHeader("Content-type",i),this._request}}},154(e,t,i){i.d(t,{A:()=>r});class r{static iterate(e,t){if(e instanceof Map||Array.isArray(e))return e.forEach(t);if(e instanceof FormData){for(var i of e.entries())t(i[1],i[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(i=>{t(e[i],i)});throw Error(`The element type ${typeof e} is not iterable!`)}}},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!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(Array.isArray(e)?[]:{},e,t):e}function s(e,t,i){return e.concat(t).map(function(e){return r(e,i)})}function n(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,i,l){(l=l||{}).arrayMerge=l.arrayMerge||s,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=r;var c,u,d=Array.isArray(i);return d!==Array.isArray(e)?r(i,l):d?l.arrayMerge(e,i,l):(u={},(c=l).isMergeableObject(e)&&n(e).forEach(function(t){u[t]=r(e[t],c)}),n(i).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&c.isMergeableObject(i[t])?u[t]=(function(e,t){if(!t.customMerge)return a;var i=t.customMerge(e);return"function"==typeof i?i:a})(t,c)(e[t],i[t],c):u[t]=r(i[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,i){return a(e,i,t)},{})},e.exports=a},683(e,t,i){i.d(t,{A:()=>n});let r="loader",s={BEFORE:"before",INNER:"inner"};class n{constructor(e,t=s.BEFORE){this.parent=e instanceof Element?e:document.body.querySelector(e),this.position=t}create(){if(!this.exists()){if(this.position===s.INNER){this._previousHTML=this.parent.innerHTML,this.parent.innerHTML=n.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),n.getTemplate())}}remove(){if(this.position===s.INNER){this.parent.innerHTML=this._previousHTML;return}this.parent.querySelectorAll(`.${r}
1`).forEach(e=>e.remove())}exists(){return this.parent.querySelectorAll(`.${r}`).length>0}_getPosition(){return this.position===s.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return`<div class="${r}" role="status">
2                    <span class="visually-hidden">Loading...</span>
3                </div>`}static SELECTOR_CLASS(){return r}}},707(e,t,i){i.d(t,{A:()=>r});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 i=r.toUpperCamelCase(e,t);return r.lcFirst(i)}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()}}}},729(e,t,i){i.r(t),i.d(t,{default:()=>v});var r=i(737),s=i(68),n=i(154),o=i(683);class a{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return a.isIPhoneDevice()||a.isIPadDevice()}static isNativeWindowsBrowser(){return a.isIEBrowser()||a.isEdgeBrowser()}static isIPhoneDevice(){return!!navigator.userAgent.match(/iPhone/i)}static isIPadDevice(){return!!navigator.userAgent.match(/iPad/i)}static isIEBrowser(){return -1!==navigator.userAgent.toLowerCase().indexOf("msie")||!!navigator.userAgent.match(/Trident.*rv:\d+\./)}static isEdgeBrowser(){return!!navigator.userAgent.match(/Edge\/\d+/i)}static getList(){return{"is-touch":a.isTouchDevice(),"is-ios":a.isIOSDevice(),"is-native-windows":a.isNativeWindowsBrowser(),"is-iphone":a.isIPhoneDevice(),"is-ipad":a.isIPadDevice(),"is-ie":a.isIEBrowser(),"is-edge":a.isEdgeBrowser()}}}let l="modal-backdrop",c="modal-backdrop-open",u="no-scroll",d={ON_CLICK:"backdrop/onclick"};class h{constructor(){return h.instance||(h.instance=this),h.instance}create(e){this._removeExistingBackdrops(),document.body.insertAdjacentHTML("beforeend",this._getTemplate());let t=document.body.lastChild;document.documentElement.classList.add(u),setTimeout(function(){t.classList.add(c),"function"==typeof e&&e()},75),this._dispatchEvents()}remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;this._getBackdrops().forEach(e=>e.classList.remove(c)),setTimeout(this._removeExistingBackdrops.bind(this),e),document.documentElement.classList.remove(u)}_dispatchEvents(){let e=a.isTouchDevice()?"touchstart":"click";document.addEventListener(e,function(e){e.target.classList.contains(l)&&document.dispatchEvent(new CustomEvent(d.ON_CLICK))})}_getBackdrops(){return document.querySelectorAll(`.${l}`)}_removeExistingBackdrops(){!1!==this._exists()&&this._getBackdrops().forEach(e=>e.remove())}_exists(){return document.querySelectorAll(`.${l}`).length>0}_getTemplate(){return`<div class="${l}"></div>`}}let p=Object.freeze(new h);class m{static create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;p.create(e)}static remove(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;p.remove(e)}static SELECTOR_CLASS(){return l}}class g extends o.A{constructor(){super(document.body)}create(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];!this.exists()&&e&&(m.create(),document.querySelector(`.${m.SELECTOR_CLASS()}`).insertAdjacentHTML("beforeend",o.A.getTemplate()))}remove(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];super.remove(),e&&m.remove()}}let b=Object.freeze(new g);class f{static create(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];b.create(e)}static remove(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];b.remove(e)}}class _{static isSupported(){return"undefined"!==document.cookie}static setItem(e,t,i){if(null==e)throw Error("You must specify a key to set a cookie");let r=new Date;r.setTime(r.getTime()+864e5*i);let s="";"https:"===location.protocol&&(s="secure"),document.cookie=`${e}=${t};expires=${r.toUTCString()};path=/;sameSite=lax;${s}`}static getItem(e){if(!e)return!1;let t=e+"=",i=document.cookie.split(";");for(let e=0;e<i.length;e++){let r=i[e];for(;" "===r.charAt(0);)r=r.substring(1);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return!1}static removeItem(e){document.cookie=`${e}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT;path=/`}static key(){return""}static clear(){}}class v extends r.A{static #e=this.options={productItemsList:".quick-order-content-list",productItem:".quick-order-line-item",emptyItemClassName:"quick-order-empty-item",buttonConfirmAddToCart:".btn-confirm-ad
3d-to-cart",buttonAddToCart:".btn-add-to-cart",buttonRemoveList:".btn-clear-list",buttonConfirmRemove:".btn-confirm-remove",buttonUploadCSV:".btn-csv-upload",addToCartModal:".add-to-cart-modal",removeListModal:".remove-list-modal",notFoundItemsAlert:"#notFoundItemsAlert",duplicatedItemAlert:"#duplicatedItemAlert",itemAction:".quick-order-item-action",itemNameInput:".input-product-name",itemQuantityInput:".input-product-quantity",itemQuantityGroup:".line-item-quantity-group"};init(){this._addToCartModal=this.el.querySelector(this.options.addToCartModal),this._buttonAddToCart=this.el.querySelector(this.options.buttonAddToCart),this._buttonConfirmAddToCart=this.el.querySelector(this.options.buttonConfirmAddToCart),this._removeListModal=this.el.querySelector(this.options.removeListModal),this._buttonRemoveList=this.el.querySelectorAll(this.options.buttonRemoveList),this._buttonConfirmRemove=this.el.querySelector(this.options.buttonConfirmRemove),this._buttonUploadCSV=this.el.querySelector(this.options.buttonUploadCSV),this._emptyRow=this.el.querySelector(`.${this.options.emptyItemClassName}`).cloneNode(!0),this._notFoundItemsAlert=this.el.querySelector(this.options.notFoundItemsAlert).cloneNode(!0),this._duplicatedItemAlert=this.el.querySelector(this.options.duplicatedItemAlert).cloneNode(!0),this._client=new s.A,this._getBaseQuickOrder(),this._registerEvents()}_registerEvents(){this._buttonConfirmAddToCart.addEventListener("click",this._handleAddToCart.bind(this)),this._buttonConfirmRemove.addEventListener("click",this._clearList.bind(this)),document.$emitter.subscribe("QuickOrder/onProductsLoaded",this._renderProductList.bind(this)),this.$emitter.subscribe("QuickOrder/updateNotFoundProducts",this._showNotFoundItems.bind(this)),this.$emitter.subscribe("QuickOrder/updateDuplicatedItem",this._showDuplicatedItem.bind(this)),window.addEventListener("beforeunload",this._beforeUnloadListener.bind(this))}_beforeUnloadListener(e){if("true"===_.getItem("isAddedToShoppingList")||!this._baseQuickOrder.products.length){_.removeItem("isAddedToShoppingList");return}e.preventDefault();let t=this.options.reloadPageMessage;return f.remove(),e.returnValue=t,t}_hideNotFoundItemsAlert(){let e=document.querySelector(this.options.notFoundItemsAlert);e&&!e.classList.contains("d-none")&&e.classList.add("d-none")}_hideDuplicatedItemAlert(){let e=document.querySelector(this.options.duplicatedItemAlert);e&&!e.classList.contains("d-none")&&e.classList.add("d-none")}_showNotFoundItems(e){let t=e.detail.notFoundProducts;if(!t.length){this._hideNotFoundItemsAlert();return}let i=document.querySelector(this.options.notFoundItemsAlert);if(!i){let e=document.querySelector(".quick-order-alert");e.appendChild(this._notFoundItemsAlert.cloneNode(!0)),i=e.querySelector(this.options.notFoundItemsAlert)}i.classList.remove("d-none"),i.querySelector(".alert-content-content").textContent=t.join(", "),i.addEventListener("closed.bs.alert",()=>{this._baseQuickOrder.updateNotFoundProducts([])})}_showDuplicatedItem(e){let t=e.detail.duplicatedItem;if(!t){this._hideDuplicatedItemAlert();return}let i=document.querySelector(this.options.duplicatedItemAlert);if(!i){let e=document.querySelector(".quick-order-alert");e.appendChild(this._duplicatedItemAlert.cloneNode(!0)),i=e.querySelector(this.options.duplicatedItemAlert)}i.classList.remove("d-none"),i.querySelector(".alert-content-content").textContent=t,i.addEventListener("closed.bs.alert",()=>{this._baseQuickOrder.updateDuplicatedItem("")})}_clearList(){this._handleRemoveList(),this._hideNotFoundItemsAlert(),this._hideDuplicatedItemAlert()}_handleRemoveList(){this._baseQuickOrder.resetProductList(),bootstrap.Modal.getInstance(this._removeListModal).hide()}_handleAddToCart(){bootstrap.Modal.getInstance(this._addToCartModal).hide(),this._confirmAddToCart()}_onAfterAjaxSubmit(){f.remove(),this._openOffCanvasCarts()}_openOffCanvasCarts(){let e=window.PluginManager.getPluginInstances("OffCanvasCart");n.A.iterate(e,e=>this._openOffCanvasCart(e)),this._baseQuickOrder.resetProductList()}_openOffCanvasCart(e){e.openOffCanvas(this.options.openCartOffCanvasUrl,!1,()=>{this.$emitter.publish("openOffCanvasCart")})}_convertArrayToObject(){let e={};
3return this._baseQuickOrder.products.forEach(t=>{e[t.id]={id:t.id,quantity:t.quantity,referencedId:t.id,stackable:!0,removable:!0,type:"product"}}),e}_confirmAddToCart(){f.create();let e=this._convertArrayToObject();this._client.post(this.options.addToCartUrl,JSON.stringify({lineItems:e}),this._onAfterAjaxSubmit.bind(this))}_renderProductList(e){let t=e.detail.products,i=this.el.querySelector(this.options.productItemsList);if(i.innerHTML="",this._resetEmptyLine(),0===t.length){this._buttonAddToCart.disabled=!0,this._buttonRemoveList.forEach(e=>{e.disabled=!0}),this._baseQuickOrder.products=[],window.PluginManager.initializePlugins();return}t.map(e=>{let t=this._emptyRow.cloneNode(!0);t.classList.remove(this.options.emptyItemClassName);let r=t.querySelector(this.options.itemNameInput),s=t.querySelector(this.options.itemQuantityInput),n=t.querySelector(this.options.itemQuantityGroup);t.querySelector(this.options.itemAction).classList.remove("d-none"),n.removeAttribute("disabled"),s.tabIndex=0,r.innerHTML=`<strong>${e.productNumber}</strong> - ${e.name}`,s.value=e.quantity,t.setAttribute("data-id",e.id),s.setAttribute("min",e.minPurchase),s.setAttribute("max",e.calculatedMaxPurchase),s.setAttribute("step",e.purchaseSteps),i.appendChild(t)}),window.PluginManager.initializePlugins(),this._buttonAddToCart.disabled=!1,this._buttonRemoveList.forEach(e=>{e.disabled=!1})}_resetEmptyLine(){this.el.querySelector(`.${this.options.emptyItemClassName}`).replaceWith(this._emptyRow.cloneNode(!0)),this.el.querySelector(`.${this.options.emptyItemClassName} ${this.options.itemNameInput}`).focus()}_getBaseQuickOrder(){this._baseQuickOrder=window.PluginManager.getPluginInstanceFromElement(document.querySelector('[data-b2b-base-quick-order="true"]'),"B2bBaseQuickOrder")}}},737(e,t,i){i.d(t,{A:()=>a});var r=i(156),s=i.n(r),n=i(707);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]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(e,{detail:t,cancelable:i});return this.el.dispatchEvent(r),r}subscribe(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,s=e.split("."),n=i.scope?t.bind(i.scope):t;if(i.once&&!0===i.once){let t=n;n=function(i){r.unsubscribe(e),t(i)}}return this.el.addEventListener(s[0],n),this.listeners.push({splitEventName:s,opts:i,cb:n}),!0}unsubscribe(e){arguments.length>1&&"function"==typeof arguments[1]&&console.warn(`[NativeEventEmitter] Unsubscribing by passing the subscriber function as a second argument is not supported. By default, all listeners for the event will be removed. Use a suffix (separated by a dot) on the event name when subscribing/unsubscribing to identify/target your specific listener only, e.g. "${e}.MyCustomPlugin"`);let t=e.split(".");return this.listeners=this.listeners.reduce((e,i)=>([...i.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):e.push(i),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 a{constructor(e,t={},i=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${i}".`);return}this.el=e,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(i),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(){}destroy(){}_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()),s().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=n.A.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${t}-config`);return i?window.PluginConfigManager.get(this._pluginName,i):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=n.A.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${t}-options`);if(i)try{return JSON.parse(i)}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}}}}]);

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.