PageSourceSearch

https://www.eps-vertrieb.de/theme/9ddc1d77a78480faa7914f6cfc7e8ab2…/wt-template.shopping-list.53cd28.js

js eps-vertrieb.de collected 2026-10-01 16:36:27 UTC 7,391 bytes, 12 lines download raw bytes

1"use strict";(self.webpackChunkwt_template=self.webpackChunkwt_template||[]).push([[54955],{4955(t,e,i){i.r(e),i.d(e,{default:()=>n});var s=i(7220);class a{static #t=this.key="compare-widget-added-products";static #e=this.maximumCompareProducts=4;static getAddedProductsList(){let t;try{t=JSON.parse(window.localStorage.getItem(this.key))||[]}catch{this.clear(),t={}}return this._checkCompareProductStorage(t)?t:(this.clear(),{})}static add(t){let e=this.getAddedProductsList(),i=e.length;return document.$emitter.publish("beforeAddProductCompare",{productCount:i}),!(i+1>this.maximumCompareProducts)&&(e.push(t),this.persist(e),!0)}static remove(t){let e=this.getAddedProductsList(),i=e.indexOf(t);return -1!==i&&(e.splice(i,1),this.persist(e),!0)}static persist(t){window.localStorage.setItem(this.key,JSON.stringify(t)),document.$emitter.publish("changedProductCompare",{products:t})}static clear(){window.localStorage.removeItem(this.key)}static _checkCompareProductStorage(t){return t.length<=this.maximumCompareProducts}}class n extends s.A{static #t=this.options={};init(){this.compareButton=this.el.parentElement.querySelector(".compare-add"),this.addedContainer=this.el.parentElement.querySelector(".already-added"),this._subscribeToWishlistData(),this._registerEvents()}_subscribeToWishlistData(){if(window.defaultShoppingList&&Object.keys(window.defaultShoppingList).length>0){this.handleCheckVisible(),this._updateButtonState(this.el.dataset.productId);return}let t=document.querySelector("[data-wishlist-badge]");if(t){let e=window.PluginManager.getPluginInstanceFromElement(t,"WishlistBadge");e&&e.$emitter.subscribe("Wishlist/onDataLoaded",this._onWishlistDataLoaded.bind(this))}}_onWishlistDataLoaded(){this.handleCheckVisible(),this._updateButtonState(this.el.dataset.productId)}_registerEvents(){this.el.addEventListener("click",this._onAddToCartButtonClick.bind(this))}handleMakeCompareVisible(){let t=this.el.dataset.productId;this.addedContainer&&this.addedContainer.classList.remove("not-visible"),this.compareButton&&(this.compareButton.classList.remove("d-none"),this.compareButton.onclick=()=>{a.remove(t),this.handleRemoveCompare()})}handleRemoveCompare(){this.compareButton&&this.compareButton.classList.add("d-none"),this.addedContainer&&!this.addedContainer.querySelector(".add-item:not(.d-none)")&&this.addedContainer.classList.add("not-visible")}handleCheckVisible(){let t=this.el.dataset.productId;a.getAddedProductsList().includes(t)&&this.handleMakeCompareVisible()}_triggerBadgeUpdate(){let t=document.querySelector("[data-wishlist-badge]");if(t){let e=window.PluginManager.getPluginInstanceFromElement(t,"WishlistBadge");e&&e.updateBadge()}}async _onAddToCartButtonClick(t){t.preventDefault();let e=this.el.dataset.productId,i=this.el.dataset.productName,s=[];try{let t=await fetch(`/eps/fetch-shopping-lists?productId=${e}`,{method:"GET",headers:{"X-Requested-With":"XMLHttpRequest"}});t.ok&&(s=await t.json())}catch(t){}let n=window.defaultShoppingList?.productIds?.includes(e),o=`<div class="d-flex flex-column gap-2" id="swal-button-group">
2  <button class="btn btn-primary btn-w-i justify-content-center gap-1" data-id="compare">
3    <i class="fa-solid fa-scale-balanced"></i> Zur Vergleichsliste hinzuf\xfcgen
4  </button>
5  <button class="btn ${n?"btn-secondary":"btn-primary"} btn-w-i justify-content-center gap-1" data-id="wishlist">
6    <i class="fa-solid fa-heart"></i> ${n?"Aus der Wunschliste entfernen":"Zur Wunschliste hinzufügen"}
7  </button>
8  <hr class="my-1">
9  <div class="text-muted small fw-semibold text-uppercase mb-1">Bestellliste</div>
10  <select id="swal-select" class="swal2-select" style="margin: 0">
11    <option value="">— Liste ausw\xe4hlen —</option>
12    <option value="newList"> Neue Liste </option>`;s.forEach(t=>{let e=t.disabled?"disabled":"";o+=`<option value="${t.id}" ${e}>${t.name}${t.disabled?" (Bereits hinzugefügt)":""}</option>`}),o+="</select></div>";let d=null;await Swal.fire({title:"Produkt speichern",html:o,focusConfirm:!1,showConfirmButton:!1,showCancelButton:!0,cancelButtonText:"Abbrechen",preConfirm:async()=>
12{if(!d)return Swal.showValidationMessage("Bitte eine gültige Option auswählen"),!1;if("newList"===d){let{value:t}=await Swal.fire({title:"Bestellliste erstellen",input:"text",inputLabel:"Name der Bestellliste",inputPlaceholder:"z. B. Bürobedarf",showCancelButton:!0,confirmButtonText:"Erstellen",cancelButtonText:"Abbrechen",inputValidator:t=>{if(!t)return"Bitte geben Sie einen Namen ein!"}});if(t)try{if(!(await fetch("/wt/shopping-list/create",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({name:t,productIds:JSON.stringify([e])})})).ok)throw Error("Fehler beim Erstellen");await Swal.fire({icon:"success",title:"Bestellliste erstellt",text:`Die Liste "${t}" wurde erfolgreich erstellt.`,timer:2e3,showConfirmButton:!1})}catch(t){await Swal.fire({icon:"error",title:"Fehler",text:t.message})}return}if("compare"===d){a.add(e),this.handleCheckVisible(),await Swal.fire({icon:"success",title:"Vergleich",text:"Produkt zur Vergleichsliste hinzugefügt.",timer:1500,showConfirmButton:!1});return}if("wishlist"===d){try{if(!(await fetch(`/eps/add-wishlist/${e}${n?"?delete=1":""}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error();n?(window.defaultShoppingList.productIds=window.defaultShoppingList.productIds.filter(t=>t!==e),window.defaultShoppingList.count--,window._paq?.push(["trackEvent","ShoppingList","Remove from default",i||e])):(window.defaultShoppingList||(window.defaultShoppingList={productIds:[],count:0}),window.defaultShoppingList.productIds.push(e),window.defaultShoppingList.count++,window._paq?.push(["trackEvent","ShoppingList","Add to default",i||e])),this._updateButtonState(e),this._triggerBadgeUpdate(),document.querySelectorAll(`[data-shopping-list-btn][data-product-id="${e}"]`).forEach(t=>{if(t!==this.el){let i=window.PluginManager.getPluginInstanceFromElement(t,"ShoppingList");i&&i._updateButtonState(e)}}),await Swal.fire({icon:"success",title:"Wunschliste",text:n?"Vom Wunschzettel entfernt":"Zum Wunschzettel hinzugefügt",timer:1500,showConfirmButton:!1})}catch{await Swal.fire({icon:"error",title:"Fehler",text:"Konnte nicht gespeichert werden"})}return}try{if(!(await fetch("/eps/shopping-lists/add",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({shoppingListId:d,productId:e,quantity:1})})).ok)throw Error();await Swal.fire({icon:"success",title:"Merkliste",text:"Produkt zur Merkliste hinzugefügt.",timer:1500,showConfirmButton:!1})}catch{return Swal.showValidationMessage("Produkt konnte nicht hinzugefügt werden."),!1}},didOpen:()=>{let t=document.getElementById("swal-button-group");t&&t.querySelectorAll("button").forEach(t=>{t.addEventListener("click",()=>{d=t.dataset.id,Swal.clickConfirm()})});let e=document.getElementById("swal-select");e&&e.addEventListener("change",()=>{e.value&&(d=e.value,Swal.clickConfirm())})}})}_updateButtonState(t){if(!window.defaultShoppingList)return;let e=window.defaultShoppingList.productIds?.includes(t),i=this.el.querySelector("i.fa-heart, i.fa-bookmark");i&&(e?(i.classList.remove("fa-regular"),i.classList.add("fa-solid")):(i.classList.remove("fa-solid"),i.classList.add("fa-regular"))),this.el.classList.toggle("is-active",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.