PageSourceSearch

https://www.notarverlag.de/theme/cd19931b5c46789c1fcd2551375fb215/…torefront.persist-wishlist.plugin.ec9300.js

js notarverlag.de collected 2026-09-24 11:20:26 UTC 6,158 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[78824],{1369(t,e,s){s.d(e,{A:()=>i});var r=s(1452);class o{constructor(){this._storage={}}setItem(t,e){return this._storage[t]=e}getItem(t){return Object.prototype.hasOwnProperty.call(this._storage,t)?this._storage[t]:null}removeItem(t){return delete this._storage[t]}key(t){return Object.values(this._storage)[t]||null}clear(){return this._storage={}}}class n{constructor(){this._storage=null,this._chooseStorage(),this._validateStorage()}_chooseStorage(){return n._isSupported("localStorage")?this._storage=window.localStorage:n._isSupported("sessionStorage")?this._storage=window.sessionStorage:r.A.isSupported()?this._storage=r.A:this._storage=new o}static _isSupported(t){try{let e="__storage_test";return window[t].setItem(e,"1"),window[t].removeItem(e),!0}catch(t){return!1}}_validateStorage(){if("function"!=typeof this._storage.setItem)throw Error('The storage must have a "setItem" function');if("function"!=typeof this._storage.getItem)throw Error('The storage must have a "getItem" function');if("function"!=typeof this._storage.removeItem)throw Error('The storage must have a "removeItem" function');if("function"!=typeof this._storage.key)throw Error('The storage must have a "key" function');if("function"!=typeof this._storage.clear)throw Error('The storage must have a "clear" function')}getStorage(){return this._storage}}let i=Object.freeze(new n).getStorage()},6917(t,e,s){s.d(e,{A:()=>o});var r=s(4335);class o extends r.A{init(){this.products={}}load(){this.$emitter.publish("Wishlist/onProductsLoaded",{products:this.products})}has(t){return!!this.products[t]}add(t){this.products[t]=new Date().toISOString(),this.$emitter.publish("Wishlist/onProductAdded",{products:this.products,productId:t})}remove(t){delete this.products[t],this.$emitter.publish("Wishlist/onProductRemoved",{products:this.products,productId:t})}getCurrentCounter(){return this.products?Object.keys(this.products).length:0}getProducts(){return this.products}}},8824(t,e,s){s.r(e),s.d(e,{default:()=>i});var r=s(6917),o=s(1369),n=s(9068);class i extends r.A{init(){super.init(),this.httpClient=new n.A,this.httpClient.setErrorHandlingInternal(!0)}load(){this._merge(()=>this._loadProducts()).catch(t=>this._handleRequestError(t))}add(t,e){this._fetchJson(e.path,{method:"POST"}).then(e=>{if(null!==e){if(e.success){super.add(t);return}console.warn("unable to add product to wishlist")}}).catch(t=>this._handleRequestError(t))}remove(t,e){this._fetchJson(e.path,{method:"POST"}).then(e=>{null!==e&&Object.prototype.hasOwnProperty.call(e,"success")&&(!1===e.success&&console.warn("unable to remove product to wishlist"),super.remove(t))}).catch(t=>this._handleRequestError(t))}async _merge(t){this.storage=o.A;let e="wishlist-"+(window.salesChannelId||""),s=JSON.parse(this.storage.getItem(e)),r=Promise.resolve();s&&(r=this._mergeProducts(s,e,t)),await t(),await r}async _pagelet(){try{let t=await this._fetchText(this.options.pageletPath,{method:"POST"});if(null===t||""===t)return;this._block=document.querySelector(".cms-listing-row"),this._block.innerHTML=t}catch(t){this._handleRequestError(t)}}async _loadProducts(){try{let t=await this._fetchJson(this.options.listPath);if(null===t)return;this.products=t,super.load()}catch(t){this._handleRequestError(t)}}async _mergeProducts(t,e,s){try{let r=await this._fetchText(this.options.mergePath,{method:"POST",body:JSON.stringify({productIds:Object.keys(t)})});if(null===r)return;if(""===r)throw Error("Unable to merge product wishlist from anonymous user");this.$emitter.publish("Wishlist/onProductMerged",{products:t}),this.storage.removeItem(e),this._block=document.querySelector(".flashbags"),this._block.innerHTML=r,await this._pagelet(),await s()}catch(t){this._handleRequestError(t)}}async _fetchJson(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=await fetch(t,this._createRequestOptions(e));return s.ok?s.json():null}async _fetchText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=await fetch(t,this._createRequestOptions(e));return s.ok?s.text():null}_createRequestOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...t,headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json",...t.headers}}}_handleRequestError(t){console.warn(t)}}},9068(t,e,s){s.d(e,{A:()=>r});
1class r{constructor(){this._request=null,this._errorHandlingInternal=!1}get(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",r=this._createPreparedRequest("GET",t,s);return this._sendRequest(r,null,e)}post(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let o=this._createPreparedRequest("POST",t,r);return this._sendRequest(o,e,s)}delete(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let o=this._createPreparedRequest("DELETE",t,r);return this._sendRequest(o,e,s)}patch(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let o=this._createPreparedRequest("PATCH",t,r);return this._sendRequest(o,e,s)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(t){this._errorHandlingInternal=t}_registerOnLoaded(t,e){e&&(!0===this._errorHandlingInternal?(t.addEventListener("load",()=>{e(t.responseText,t)}),t.addEventListener("abort",()=>{console.warn(`the request to ${t.responseURL} was aborted`)}),t.addEventListener("error",()=>{console.warn(`the request to ${t.responseURL} failed with status ${t.status}`)}),t.addEventListener("timeout",()=>{console.warn(`the request to ${t.responseURL} timed out`)})):t.addEventListener("loadend",()=>{e(t.responseText,t)}))}_sendRequest(t,e,s){return this._registerOnLoaded(t,s),t.send(e),t}_getContentType(t,e){return t instanceof FormData&&(e=!1),e}_createPreparedRequest(t,e,s){return this._request=new XMLHttpRequest,this._request.open(t,e),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),s&&this._request.setRequestHeader("Content-type",s),this._request}}}}]);

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.