diff --git a/CHANGELOG.md b/CHANGELOG.md index a643c17..d946efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,4 +17,6 @@ - Add pixel statistics call # 1.1.0 - Add support for Shopware 6.5, drop support for 6.3 and lower +# 1.1.1 +- Raised time between virtual PI and add-to-cart request at product lists from 50ms to 500ms diff --git a/E2E/cypress.config.js b/E2E/cypress.config.js index 432d6c9..776ad7f 100644 --- a/E2E/cypress.config.js +++ b/E2E/cypress.config.js @@ -9,11 +9,11 @@ module.exports = defineConfig({ defaultCommandTimeout: 40000, pageLoadTimeout: 50000, video: false, - screenshotsFolder: '/results/screenshots', - videosFolder: '/results/videos', + screenshotsFolder: '/cypress/results/screenshots', + videosFolder: '/cypress/results/videos', reporter: 'junit', reporterOptions: { - mochaFile: '/results/output-[hash].xml', + mochaFile: '/cypress/results/output-[hash].xml', jenkinsMode: true, }, e2e: { diff --git a/E2E/cypress/e2e/07_product.cy.js b/E2E/cypress/e2e/07_product.cy.js index 940e147..b7d2ca7 100644 --- a/E2E/cypress/e2e/07_product.cy.js +++ b/E2E/cypress/e2e/07_product.cy.js @@ -2,12 +2,31 @@ beforeEach(() => { cy.consentMapp(); + cy.interceptTracking(); }); describe("Product detail datalayer", () => { it("normal product: view", () => { cy.visit("/MappIntelligence-product-aeoeue/MAPP10001"); let data; + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( + "shopware.test/MappIntelligence-product-aeoeue/MAPP10001" + ); + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MAPP10001"); + expect(track.co).to.equal("495.95"); + expect(track.qn).to.equal("1"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-product-äöü"); + expect(track.st).to.equal("view"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-product-aeoeue/MAPP10001" + ); + }); cy.window() .then((win) => { data = win._ti; @@ -44,50 +63,47 @@ describe("Product detail datalayer", () => { it("normal product: multiple add to cart", () => { let wts; let data; - cy.intercept({ - url: "/checkout/line-item/add", - method: "post", - }).as("addToCart"); cy.visit("/MappIntelligence-product-aeoeue/MAPP10001"); - cy.window().its("wts.push").should("exist"); - cy.window().then((win) => { - wts = cy - .stub(win.wts, "push", () => { - data = JSON.parse(JSON.stringify(win._ti)); - }) - .as("wts"); + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( + "shopware.test/MappIntelligence-product-aeoeue/MAPP10001" + ); + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MAPP10001"); + expect(track.co).to.equal("495.95"); + expect(track.qn).to.equal("1"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-product-äöü"); + expect(track.st).to.equal("view"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-product-aeoeue/MAPP10001" + ); }); cy.get(".product-detail-quantity-input").clear().type("5"); - cy.contains("Add to shopping cart").click(); - cy.wait("@addToCart").then(() => { - expect(wts).to.be.calledOnce; - expect(data.pageRequestType).to.equal("virtual"); - expect(data.contentCategory).to.equal("Catalogue"); - expect(data.contentSubcategory).to.equal("Product Detail"); - expect(data.currency).to.equal("EUR"); - expect(data.pageName).to.equal( + cy.get(".btn-buy").click(); + + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( "shopware.test/MappIntelligence-product-aeoeue/MAPP10001" ); - expect(data.pageTitle).to.equal( - "MappIntelligence-product-äöü | MAPP10001" - ); - expect(data.productCategories).to.deep.equal([ - "MappTestProducts", - "MappSubCategory", - ]); - expect(data.productCategory).to.equal("MappTestProducts"); - expect(data.productCost).to.equal("2479.75"); - expect(data.productId).to.equal("MAPP10001"); - expect(data.productName).to.equal("MappIntelligence-product-äöü"); - expect(data.productQuantity).to.equal("5"); - expect(data.productShopwareId).to.equal( - "222aee2d4ef6484f99e541a03976d867" + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MAPP10001"); + expect(track.co).to.equal("2479.75"); + expect(track.qn).to.equal("5"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-product-äöü"); + expect(track.st).to.equal("add"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-product-aeoeue/MAPP10001" ); - expect(data.productSoldOut).to.equal(""); - expect(data.productSubCategory).to.equal("MappSubCategory"); - expect(data.shoppingCartStatus).to.equal("add"); }); }); @@ -128,53 +144,47 @@ describe("Product detail datalayer", () => { }); it("soldout product: multiple add to cart", () => { - let wts; - let data; - cy.intercept({ - url: "/checkout/line-item/add", - method: "post", - }).as("addToCart"); - cy.visit("/MappIntelligence-product-soldout/MAPP100013"); - cy.window().its("wts.push").should("exist"); - cy.window().then((win) => { - wts = cy - .stub(win.wts, "push", () => { - data = JSON.parse(JSON.stringify(win._ti)); - }) - .as("wts"); + + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( + "shopware.test/MappIntelligence-product-soldout/MAPP100013" + ); + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MAPP100013"); + expect(track.co).to.equal("1.99"); + expect(track.qn).to.equal("1"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-product-soldout"); + expect(track.st).to.equal("view"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-product-soldout/MAPP100013" + ); }); cy.get(".product-detail-quantity-input").clear().type("5"); cy.contains("Add to shopping cart").click(); - cy.wait("@addToCart").then(() => { - expect(wts).to.be.calledOnce; - expect(data.pageRequestType).to.equal("virtual"); - expect(data.contentCategory).to.equal("Catalogue"); - expect(data.contentSubcategory).to.equal("Product Detail"); - expect(data.currency).to.equal("EUR"); - expect(data.pageName).to.equal( + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( "shopware.test/MappIntelligence-product-soldout/MAPP100013" ); - expect(data.pageTitle).to.equal( - "MappIntelligence-product-soldout | MAPP100013" - ); - expect(data.productCategories).to.deep.equal([ - "MappTestProducts", - "MappSubCategory", - ]); - expect(data.productCategory).to.equal("MappTestProducts"); - expect(data.productCost).to.equal("9.95"); - expect(data.productId).to.equal("MAPP100013"); - expect(data.productName).to.equal("MappIntelligence-product-soldout"); - expect(data.productQuantity).to.equal("5"); - expect(data.productShopwareId).to.equal( - "333aee2d4ef6484f99e541a03976d867" + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MAPP100013"); + expect(track.co).to.equal("9.95"); + expect(track.qn).to.equal("5"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-product-soldout"); + expect(track.st).to.equal("add"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-product-soldout/MAPP100013" ); - expect(data.productSoldOut).to.equal("1"); - expect(data.productSubCategory).to.equal("MappSubCategory"); - expect(data.shoppingCartStatus).to.equal("add"); }); }); @@ -253,58 +263,71 @@ describe("Product detail datalayer", () => { }); it("variable product: switch, then multiple add to cart", () => { - let wts; - let data; - cy.intercept({ - url: "/checkout/line-item/add", - method: "post", - }).as("addToCart"); - cy.visit( "/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Red" ); + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( + "shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Red" + ); + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MappIntelligence-Variant-product-Red"); + expect(track.co).to.equal("295.95"); + expect(track.qn).to.equal("1"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-Variant-product"); + expect(track.st).to.equal("view"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Red" + ); + }); cy.window().its("wts.push").should("exist"); cy.get(".product-detail-configurator-option input") .eq(0) .click({ force: true }); - cy.contains("MappIntelligence-Variant-product-Blue").should("be.visible"); - cy.window().its("wts.push").should("exist"); - - cy.window().then((win) => { - wts = cy - .stub(win.wts, "push", () => { - data = JSON.parse(JSON.stringify(win._ti)); - }) - .as("wts"); + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( + "shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Blue" + ); + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MappIntelligence-Variant-product-Blue"); + expect(track.co).to.equal("295.95"); + expect(track.qn).to.equal("1"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-Variant-product"); + expect(track.st).to.equal("view"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Blue" + ); }); + cy.contains("MappIntelligence-Variant-product-Blue").should("be.visible"); cy.get(".product-detail-quantity-input").clear().type("5"); cy.contains("Add to shopping cart").click(); - cy.wait("@addToCart").then(() => { - expect(wts).to.be.calledOnce; - expect(data.pageRequestType).to.equal("virtual"); - expect(data.contentCategory).to.equal("Catalogue"); - expect(data.contentSubcategory).to.equal("Product Detail"); - expect(data.currency).to.equal("EUR"); - expect(data.pageName).to.equal( + + cy.testTrackRequest().then((track) => { + expect(track.pageName).to.equal( "shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Blue" ); - expect(data.pageTitle).to.equal( - "MappIntelligence-Variant-product | Blue | MappIntelligence-Variant-product-Blue" + expect(track.cr).to.equal("EUR"); + expect(track.ba).to.equal("MappIntelligence-Variant-product-Blue"); + expect(track.co).to.equal("1479.75"); + expect(track.qn).to.equal("5"); + expect(track.ca1).to.equal("MappTestProducts"); + expect(track.ca2).to.equal("MappSubCategory"); + expect(track.ca3).to.equal("MappIntelligence-Variant-product"); + expect(track.st).to.equal("add"); + expect(track.cg1).to.equal("Catalogue"); + expect(track.cg2).to.equal("Product Detail"); + expect(track.pu).to.equal( + "http://shopware.test/MappIntelligence-Variant-product/MappIntelligence-Variant-product-Blue" ); - expect(data.productCategories).to.deep.equal([ - "MappTestProducts", - "MappSubCategory", - ]); - expect(data.productCategory).to.equal("MappTestProducts"); - expect(data.productCost).to.equal("1479.75"); - expect(data.productId).to.equal("MappIntelligence-Variant-product-Blue"); - expect(data.productName).to.equal("MappIntelligence-Variant-product"); - expect(data.productQuantity).to.equal("5"); - expect(data.productShopwareId).to.match(/^[0-9a-f]{32}$/); - expect(data.productSoldOut).to.equal(""); - expect(data.productSubCategory).to.equal("MappSubCategory"); - expect(data.shoppingCartStatus).to.equal("add"); }); }); }); diff --git a/composer.json b/composer.json index cd329cf..023c17d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mapp/intelligence", "description": "Add your Mapp Intelligence account ID and start tracking. The plugin adds the tracking script and data layer for your customer insights dashboard automatically.", - "version": "1.1.0", + "version": "1.1.1", "type": "shopware-platform-plugin", "license": "MIT", "authors": [ diff --git a/src/Resources/app/storefront/dist/storefront/js/mapp-intelligence.js b/src/Resources/app/storefront/dist/storefront/js/mapp-intelligence.js index 29442a3..45bcbe8 100644 --- a/src/Resources/app/storefront/dist/storefront/js/mapp-intelligence.js +++ b/src/Resources/app/storefront/dist/storefront/js/mapp-intelligence.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["mapp-intelligence"],{4848:(t,e,n)=>{var i=n(6285),o=n(3206),s=n(8553);class a extends i.Z{init(){this.subscribeEvents()}subscribeEvents(){document.$emitter.subscribe(s.D,this.loadTiLoader),window.PluginManager.getPluginInstances("ListingPagination").forEach((t=>{t.$emitter.subscribe("change",(t=>{this.paginationHandler(t)}))})),window.PluginManager.getPluginInstances("SearchWidget").forEach((t=>{t.$emitter.subscribe("afterSuggest",(t=>{this.searchWidgetHandler(t)}))}));let t=["FilterBoolean","FilterMultiSelect","FilterPropertySelect","FilterRange","FilterRating","FilterRatingSelect"];const e=window.PluginManager.getPluginList();t=t.filter((t=>e.hasOwnProperty(t))),t.forEach((t=>{window.PluginManager.getPluginInstances(t).forEach((t=>{t.$emitter.subscribe("change",(()=>{this.updateAddToCart();const t=document.querySelector(".filter-reset-all");t&&setTimeout((()=>{t.addEventListener("click",(()=>{this.updateAddToCart()}))}),500)}))}))})),this.subscribeAddToCart()}loadTiLoader(t){t.detail.sw_MappIntelligence&&function(t,e,n,i){t.wts=t.wts||[];if(-1===e.cookie.indexOf("wt_r=1")){var o=e.getElementsByTagName(n)[0];(n=e.createElement(n)).async=!0,n.onload=function(){if(void 0!==t.wt_r&&!isNaN(t.wt_r)){var n=new Date,i=n.getTime()+1e3*parseInt(t.wt_r);n.setTime(i),e.cookie="wt_r=1;path=/;expires="+n.toUTCString()}},n.onerror=function(){void 0!==t.wt_mcp_hide&&"function"==typeof t.wt_mcp_hide.show&&(t.wt_mcp_hide.show(),t.wt_mcp_hide.show=function(){})},n.src="//"+function(t){var n="";if(t.customDomain&&t.customPath?n=t.customDomain+"/"+t.customPath:t.tiDomain&&t.tiId&&(n=t.tiDomain+"/resp/api/get/"+t.tiId+"?url="+encodeURIComponent("https://"+e.location.host+"/")+"&v=5"),t.option)for(var i in t.option)n+="&"+i+"="+encodeURIComponent(t.option[i]);return n}(i),o.parentNode.insertBefore(n,o)}}(window,document,"script",_tiConfig)}subscribeAddToCart(){window.PluginManager.getPluginInstances("AddToCart").forEach((t=>{t.$emitter.subscribe("beforeFormSubmit",(t=>{this.addToCartHandler(t)}))}))}updateAddToCart(){var t=window.PluginManager.getPluginInstances("AddToCart").length,e=setInterval((()=>{window.PluginManager.getPluginInstances("AddToCart").length!==t&&(this.subscribeAddToCart(),clearInterval(e))}),500)}paginationHandler(t){const e=t.target.getAttribute("value");let n=null;if(t.target.options){const e=t.target.options.selectedIndex;n=t.target.options[e].innerText}this.updateAddToCart(),e?window.wts&&window._ti.pageNumber&&(window._ti.pageNumber=e,window.wts.push(["send","pageupdate"])):n&&window.wts&&window.wts.push(["send","click",{linkId:"Sorting: "+n}])}searchWidgetHandler(){window.wts&&window.wts.push(["linkTrackInstall"])}addToCartHandler(t){var e=JSON.stringify(window._ti),n={...o.Z.querySelector(t.target,".mapp-tracking-data",!0).dataset};if(n.productQuantity&&n.productShopwareId&&(n.productQuantity=t.target.elements["lineItems["+n.productShopwareId+"][quantity]"].value),n.productCost&&n.productQuantity&&(n.productCost=(n.productQuantity*n.productCost).toFixed(2)),n.productCategories&&(n.productCategories=JSON.parse(n.productCategories),n.productCategories[0]&&(n.productCategory=n.productCategories[0]),n.productCategories[1]&&(n.productSubCategory=n.productCategories[1])),window._ti={...window._ti,...n},window.wts){if(window._ti.hasOwnProperty("contentSubcategory")&&"Product Detail"!==window._ti.contentSubcategory){const t=JSON.stringify(window._ti);window._ti.shoppingCartStatus="view",window._ti.productQuantity="1",window.wts.push(["send","pageupdate"]),window._ti=JSON.parse(t)}setTimeout((()=>{window.wts.push(["send","pageupdate"]),window._ti=JSON.parse(e)}),50)}}}window.PluginManager.register("MappIntelligenceClientEvents",a)},8553:(t,e,n)=>{n.d(e,{D:()=>d,Z:()=>u});var i=n(6285),o=n(7606),s=n(2615),a=n(3637),r=n(7474),c=n(8254),l=n(4690);const d="CookieConfiguration_Update";class u extends i.Z{init(){this.lastState={active:[],inactive:[]},this._httpClient=new c.Z,this._registerEvents()}_registerEvents(){const{submitEvent:t,buttonOpenSelector:e,customLinkSelector:n,globalButtonAcceptAllSelector:i}=this.options;Array.from(document.querySelectorAll(e)).forEach((e=>{e.addEventListener(t,this.openOffCanvas.bind(this))})),Array.from(document.querySelectorAll(n)).forEach((e=>{e.addEventListener(t,this._handleCustomLink.bind(this))})),Array.from(document.querySelectorAll(i)).forEach((e=>{e.addEventListener(t,this._acceptAllCookiesFromCookieBar.bind(this))}))}_registerOffCanvasEvents(){const{submitEvent:t,buttonSubmitSelector:e,buttonAcceptAllSelector:n,wrapperToggleSelector:i}=this.options,s=this._getOffCanvas();if(s){const a=s.querySelector(e),r=s.querySelector(n),c=Array.from(s.querySelectorAll('input[type="checkbox"]')),l=Array.from(s.querySelectorAll(i));a&&a.addEventListener(t,this._handleSubmit.bind(this,o.Z)),r&&r.addEventListener(t,this._acceptAllCookiesFromOffCanvas.bind(this,o.Z)),c.forEach((e=>{e.addEventListener(t,this._handleCheckbox.bind(this))})),l.forEach((e=>{e.addEventListener(t,this._handleWrapperTrigger.bind(this))}))}}_handleCustomLink(t){t.preventDefault(),this.openOffCanvas()}_handleUpdateListener(t,e){const n=this._getUpdatedCookies(t,e);document.$emitter.publish(d,n)}_getUpdatedCookies(t,e){const{lastState:n}=this,i={};return t.forEach((t=>{n.inactive.includes(t)&&(i[t]=!0)})),e.forEach((t=>{n.active.includes(t)&&(i[t]=!1)})),i}openOffCanvas(t){const{offCanvasPosition:e}=this.options,n=window.router["frontend.cookie.offcanvas"],i=r.Z.isXS();this._hideCookieBar(),s.Z.open(n,!1,this._onOffCanvasOpened.bind(this,t),e,void 0,void 0,i)}closeOffCanvas(t){s.Z.close(),"function"==typeof t&&t()}_onOffCanvasOpened(t){this._registerOffCanvasEvents(),this._setInitialState(),this._setInitialOffcanvasState(),PluginManager.initializePlugins(),"function"==typeof t&&t()}_hideCookieBar(){const t=PluginManager.getPluginInstances("CookiePermission");t&&t[0]&&(t[0]._hideCookieBar(),t[0]._removeBodyPadding())}_setInitialState(t=null){const e=t||this._getCookies("all"),n=[],i=[];e.forEach((({cookie:t,required:e})=>{o.Z.getItem(t)||e?n.push(t):i.push(t)})),this.lastState={active:n,inactive:i}}_setInitialOffcanvasState(){const t=this.lastState.active,e=this._getOffCanvas();t.forEach((t=>{const n=e.querySelector(`[data-cookie="${t}"]`);n.checked=!0,this._childCheckboxEvent(n)}))}_handleWrapperTrigger(t){t.preventDefault();const{entriesActiveClass:e,entriesClass:n,groupClass:i}=this.options,{target:o}=t,s=this._findParentEl(o,n,i);if(s){s.classList.contains(e)?s.classList.remove(e):s.classList.add(e)}}_handleCheckbox(t){const{parentInputClass:e}=this.options,{target:n}=t;(n.classList.contains(e)?this._parentCheckboxEvent:this._childCheckboxEvent).call(this,n)}_findParentEl(t,e,n=null){for(;t&&!t.classList.contains(n);){if(t.classList.contains(e))return t;t=t.parentElement}return null}_isChecked(t){return!!t.checked}_parentCheckboxEvent(t){const{groupClass:e}=this.options,n=this._isChecked(t),i=this._findParentEl(t,e);this._toggleWholeGroup(n,i)}_childCheckboxEvent(t){const{groupClass:e}=this.options,n=this._isChecked(t),i=this._findParentEl(t,e);this._toggleParentCheckbox(n,i)}_toggleWholeGroup(t,e){Array.from(e.querySelectorAll("input")).forEach((e=>{e.checked=t}))}_toggleParentCheckbox(t,e){const{parentInputSelector:n}=this.options,i=Array.from(e.querySelectorAll(`input:not(${n})`)),o=Array.from(e.querySelectorAll(`input:not(${n}):checked`));if(i.length>0){const t=e.querySelector(n);if(t){const e=o.length>0,n=e&&o.length!==i.length;t.checked=e,t.indeterminate=n}}}_handleSubmit(){const t=this._getCookies("active"),e=this._getCookies("inactive"),{cookiePreference:n}=this.options,i=[],s=[];e.forEach((({cookie:t})=>{s.push(t),o.Z.getItem(t)&&o.Z.removeItem(t)})),t.forEach((({cookie:t,value:e,expiration:n})=>{i.push(t),t&&e&&o.Z.setItem(t,e,n)})),o.Z.setItem(n,"1","30"),this._handleUpdateListener(i,s),this.closeOffCanvas()}acceptAllCookies(t=!1){if(!t)return this._handleAcceptAll(),void this.closeOffCanvas();l.Z.create(this.el);const e=window.router["frontend.cookie.offcanvas"];this._httpClient.get(e,(t=>{const e=(new DOMParser).parseFromString(t,"text/html");this._handleAcceptAll(e),l.Z.remove(this.el),this._hideCookieBar()}))}_acceptAllCookiesFromCookieBar(){return this.acceptAllCookies(!0)}_acceptAllCookiesFromOffCanvas(){return this.acceptAllCookies()}_handleAcceptAll(t=null){const e=this._getCookies("all",t);this._setInitialState(e);const{cookiePreference:n}=this.options;e.forEach((({cookie:t,value:e,expiration:n})=>{t&&e&&o.Z.setItem(t,e,n)})),o.Z.setItem(n,"1","30"),this._handleUpdateListener(e.map((({cookie:t})=>t)),[])}_getCookies(t="all",e=null){const{cookieSelector:n}=this.options;return e||(e=this._getOffCanvas()),Array.from(e.querySelectorAll(n)).filter((e=>{switch(t){case"all":return!0;case"active":return this._isChecked(e);case"inactive":return!this._isChecked(e);default:return!1}})).map((t=>{const{cookie:e,cookieValue:n,cookieExpiration:i,cookieRequired:o}=t.dataset;return{cookie:e,value:n,expiration:i,required:o}}))}_getOffCanvas(){const t=a.Z?a.Z.getOffCanvas():[];return!!(t&&t.length>0)&&t[0]}}var f,h,p;f=u,h="options",p={offCanvasPosition:"left",submitEvent:"click",cookiePreference:"cookie-preference",cookieSelector:"[data-cookie]",buttonOpenSelector:".js-cookie-configuration-button button",buttonSubmitSelector:".js-offcanvas-cookie-submit",buttonAcceptAllSelector:".js-offcanvas-cookie-accept-all",globalButtonAcceptAllSelector:".js-cookie-accept-all-button",wrapperToggleSelector:".offcanvas-cookie-entries span",parentInputSelector:".offcanvas-cookie-parent-input",customLinkSelector:`[href="${window.router["frontend.cookie.offcanvas"]}"]`,entriesActiveClass:"offcanvas-cookie-entries--active",entriesClass:"offcanvas-cookie-entries",groupClass:"offcanvas-cookie-group",parentInputClass:"offcanvas-cookie-parent-input"},(h=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(h))in f?Object.defineProperty(f,h,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[h]=p},2615:(t,e,n)=>{n.d(e,{Z:()=>r});var i=n(3637),o=n(8254),s=n(7906);let a=null;class r extends i.Z{static open(t=!1,e=!1,n=null,o="left",s=!0,a=i.Z.REMOVE_OFF_CANVAS_DELAY(),r=!1,c=""){if(!t)throw new Error("A url must be given!");i.r._removeExistingOffCanvas();const l=i.r._createOffCanvas(o,r,c,s);this.setContent(t,e,n,s,a),i.r._openOffcanvas(l)}static setContent(t,e,n,i,c){const l=new o.Z;super.setContent(`