PageSourceSearch

https://www.deubaxxl.de/theme/89e6742440a68b3629d75b8c6296bd29/js/…/deuba-klaviyo2.add-to-cart.ts.b1ac69.js

js deubaxxl.de collected 2026-09-26 06:51:02 UTC 13,119 bytes, 8 lines download raw bytes

1"use strict";(self.webpackChunkdeuba_klaviyo2=self.webpackChunkdeuba_klaviyo2||[]).push([[28007],{7(t,e,r){r.r(e),r.d(e,{default:()=>u});var i=r(220);class n{static serialize(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if("FORM"!==t.nodeName){if(e)throw Error("The passed element is not a form!");return{}}return new FormData(t)}static serializeJson(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=n.serialize(t,e);if(!(r instanceof FormData)&&0===Object.keys(r).length||r instanceof FormData&&0===Array.from(r.entries()).length)return{};let i={};for(let[t,e]of r.entries())i[t]=e;return i}}class s extends i.A{static #t=this.options={redirectSelector:'[name="redirectTo"]',redirectParamSelector:'[data-redirect-parameters="true"]',redirectTo:"frontend.cart.offcanvas",alertTemplateSelector:".js-add-to-cart-alert-template",alertDismissDelay:3e3,stockAlertTemplateSelector:".js-quantity-stock-adjusted-template",stockAlertClass:"quantity-stock-adjusted-alert",stockAdjustedText:null,outOfStockText:null,buyButtonSelector:'button[type="submit"].btn-buy'};init(){if(this._getForm(),!this._form)throw Error(`No form found for the plugin: ${this.constructor.name}`);this._prepareFormRedirect(),this._registerEvents()}_prepareFormRedirect(){try{let t=this._form.querySelector(this.options.redirectSelector),e=this._form.querySelector(this.options.redirectParamSelector);t.value=this.options.redirectTo,e.disabled=!0}catch(t){}}_getForm(){this.el&&"FORM"===this.el.nodeName?this._form=this.el:this._form=this.el.closest("form")}_registerEvents(){this.el.addEventListener("submit",this._formSubmit.bind(this)),this._form.addEventListener("QuantitySelector/StockAdjusted",this._handleStockAdjusted.bind(this)),this._form.addEventListener("QuantitySelector/OutOfStock",this._handleOutOfStock.bind(this))}_formSubmit(t){t.preventDefault();let e=this._form.getAttribute("action"),r=n.serialize(this._form);this.$emitter.publish("beforeFormSubmit",r),this._shouldOpenOffcanvas()?this._openOffCanvasCarts(e,r):this._addToCartWithoutOffcanvas(e,r)}_shouldOpenOffcanvas(){return"0"!==window.openOffcanvasAfterAddToCart}_addToCartWithoutOffcanvas(t,e){fetch(t,{method:"POST",body:e}).then(t=>{if(!t.ok)throw Error("Add to cart failed");window.PluginManager.getPluginInstances("CartWidget")?.forEach(t=>{t.fetch()}),this._showSuccessAlert(),this.$emitter.publish("addToCartWithoutOffcanvas")}).catch(()=>{this._openOffCanvasCarts(t,e)})}_showSuccessAlert(){let t=document.querySelector(this.options.alertTemplateSelector);if(!t||!this._form)return;let e=this._form.parentElement.querySelector(".add-to-cart-alert");e&&e.remove();let r=t.content.firstElementChild.cloneNode(!0);r.classList.add("show","add-to-cart-alert"),this._form.insertAdjacentElement("afterend",r),setTimeout(()=>{r.addEventListener("transitionend",()=>r.remove(),{once:!0}),r.classList.remove("show")},this.options.alertDismissDelay)}_openOffCanvasCarts(t,e){window.PluginManager.getPluginInstances("OffCanvasCart").forEach(r=>{this._openOffCanvasCart(r,t,e)})}_openOffCanvasCart(t,e,r){t.openOffCanvas(e,r,()=>{this.$emitter.publish("openOffCanvasCart")})}_handleStockAdjusted(t){let e=this.options.stockAdjustedText||"";e=e.replace("%quantity%",t.detail.quantity),this._showStockAlert(e)}_handleOutOfStock(){this._showStockAlert(this.options.outOfStockText||"");let t=this._form.querySelector(this.options.buyButtonSelector);t&&(t.disabled=!0)}_showStockAlert(t){let e=this._form.querySelector(this.options.stockAlertTemplateSelector);if(!e)return;let r=e.parentElement.querySelector(`.${this.options.stockAlertClass}`);r&&r.remove();let i=e.content.firstElementChild.cloneNode(!0);i.classList.add(this.options.stockAlertClass);let n=i.querySelector(".alert-content-container");n&&(n.textContent=t),e.insertAdjacentElement("afterend",i)}}var o=r(707);class a{static isNode(t){return"object"==typeof t&&null!==t&&(t===document||t===window||t instanceof Node)}static hasAttribute(t,e){if(!a.isNode(t))throw Error("The element must be a valid HTML Node!");return"function"==typeof t.hasAttribute&&t.hasAttribute(e)}static getAttribute(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===a.hasAttribute(t,e))throw Error(`The required property "${e}" does not exist!`);
1if("function"!=typeof t.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return t.getAttribute(e)}static getDataAttribute(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e.replace(/^data(|-)/,""),n=o.A.toLowerCamelCase(i,"-");if(!a.isNode(t)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===t.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let s=t.dataset[n];if(void 0===s){if(r)throw Error(`The required data attribute "${e}" does not exist on ${t}!`);return s}return o.A.parsePrimitive(s)}static querySelector(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!a.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelector(e)||!1;if(r&&!1===i)throw Error(`The required element "${e}" does not exist in parent node!`);return i}static querySelectorAll(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!a.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelectorAll(e);if(0===i.length&&(i=!1),r&&!1===i)throw Error(`At least one item of "${e}" must exist in parent node!`);return i}static getFocusableElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,e=`
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 t.querySelectorAll(e)}static getFirstFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(t)[0]}static getLastFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=this.getFocusableElements(t);return e[e.length-1]}}var l=r(424),c=r(224);class u extends s{init(){super.init(),this.$emitter.subscribe("beforeFormSubmit",this._beforeFormSubmit.bind(this))}_beforeFormSubmit(t){let e=a.querySelector(document,"script[data-gtm-send]",!1);if(!e)return;let r=(0,l.T)(e.innerText.trim()),i=this._findProductId(t.detail),n=r.data.products[0],s=t.detail.get("lineItems["+i+"][quantity]");null!==s&&(s=parseInt(s.toString(),10));let o={event:"deuba_add_to_cart",google_analytics:{...r.google_analytics,event:"add_to_cart",items:[{...r.google_analytics.items[0],quantity:s}]},google_analytics_4:{...r.google_analytics_4,event:"add_to_cart",items:[{...r.google_analytics_4.items[0],quantity:s}]},google_ads:{...r.google_ads},facebook:{...r.facebook,event:"AddToCart",contents:[{...r.facebook.contents[0],quantity:s}]},pinterest:{event:"AddToCart",line_items:[{product_id:n.number,product_name:n.name,product_price:n.price,product_currency:n.currency,product_quantity:s,product_variant:n.variant}]},data:{...r.data,products:[{...r.data.products[0],quantity:s}]}};console.log("DeubaKlaviyo2SendGTM[add-to-cart]",o),c.E.push(o)}_findProductId(t){let e=null;return t.forEach((t,r)=>{r.endsWith("[id]")&&(e=t)}),e||console.warn("[Google Tag Manager Cloud Plugin] Product ID could not be fetched. Skipping."),e}}},156(t){var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function n(t,e,r){return t.concat(e).map(function(t){return i(t,r)})}function s(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function o(t,e){try{return e in t}catch(t){return!1}}function a(t,r,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=i;var c,u,d=Array.isArray(r);return d!==Array.isArray(t)?i(r,l):d?l.arrayMerge(t,r,l):(u={},(c=l).isMergeableObject(t)&&s(t).forEach(function(e){u[e]=i(t[e],c)}),s(r).forEach(function(e){(!o(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(o(t,e)&&c.isMergeableObject(r[e])?u[e]=(function(t,e){if(!e.customMerge)return a;var r=e.customMerge(t);return"function"==typeof r?r:a})(e,c)(t[e],r[e],c):u[e]=i(r[e],c))}),u)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,r){return a(t,r,e)}
8,{})},t.exports=a},220(t,e,r){r.d(e,{A:()=>a});var i=r(156),n=r.n(i),s=r(707),o=r(308);class a{constructor(t,e={},r=!1){if(!(t instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=t,this.$emitter=new o.A(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(e),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(t){let e=[this.constructor.options,this.options,t];return e.push(this._getConfigFromDataAttribute()),e.push(this._getOptionsFromDataAttribute()),n().all(e.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_getConfigFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=s.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${e}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):t}_getOptionsFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=s.A.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${e}-options`);if(r)try{return JSON.parse(r)}catch(t){console.error(`The data attribute "data-${e}-options" could not be parsed to json: ${t.message}`)}return t}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}}},224(t,e,r){r.d(e,{E:()=>i});class i{static push(t){if(!window.dataLayer){console.error("no data GTM layer found. Maybe the container ID is missing.");return}window.dataLayer.push(t)}}},308(t,e,r){r.d(e,{A:()=>i});class i{constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new CustomEvent(t,{detail:e,cancelable:r});return this.el.dispatchEvent(i),i}subscribe(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this,n=t.split("."),s=r.scope?e.bind(r.scope):e;if(r.once&&!0===r.once){let e=s;s=function(r){i.unsubscribe(t),e(r)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:r,cb:s}),!0}unsubscribe(t){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. "${t}.MyCustomPlugin"`);let e=t.split(".");return this.listeners=this.listeners.reduce((t,r)=>([...r.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):t.push(r),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}}},424(t,e,r){r.d(e,{T:()=>i});let i=t=>{if(!t||0===t.lenght)return null;let e=JSON.parse(t);return e?n(e):null},n=t=>(void 0!==t.apiAlias&&delete t.apiAlias,void 0!==t.extensions&&delete t.extensions,t)},707(t,e,r){r.d(e,{A:()=>i});class i{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let r=i.toUpperCamelCase(t,e);return i.lcFirst(r)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>i.ucFirst(t.toLowerCase())).join(""):i.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}}}]);

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.