1import{readConfig,getCustomerKey,getSessionKey,getTouchpoint,requestVoyadoJson,createProductCardRenderer,buildSwatchStyle,syncCustomerKey,escapeHtml,escapeAttr,hasVoyadoConsent}from"voyado-elevate";const _syncOnce=syncCustomerKey();let _loadedWithoutConsent=!1;function getPageRecsMediaStyle(imageAspectRatio){return imageAspectRatio==="square"?"aspect-ratio: 1 / 1;":imageAspectRatio==="portrait"?"aspect-ratio: 3 / 4;":imageAspectRatio==="landscape"?"aspect-ratio: 4 / 3;":""}function getPageRecsImageHeight(imageAspectRatio){return imageAspectRatio==="portrait"?533:imageAspectRatio==="landscape"?300:400}function readSectionConfig(element){const data=element.dataset;return{sectionId:data.sectionId,pageId:data.pageId||"/",locale:data.voyadoLocale||"",limit:parseInt(data.limit||"8",10)||8,columnsDesktop:parseInt(data.columnsDesktop||"4",10)||4,columnsMobile:parseInt(data.columnsMobile||"2",10)||2,showImage:data.showImage!=="false",imageAspectRatio:data.imageAspectRatio||"natural",enableImageSlider:data.enableImageSlider==="true",showPrice:data.showPrice!=="false",showSwatch:!0,layout:data.layout==="slider"?"slider":"grid",headingLevel:["h2","h3","h4"].includes(data.headingLevel)?data.headingLevel:"h3",sectionHeading:data.sectionHeading||"",sectionHeadingLevel:["h2","h3","h4"].includes(data.sectionHeadingLevel)?data.sectionHeadingLevel:"h2",priceId:data.priceId||"",stores:data.stores||"",presentCustom:data.presentCustom||"",enableTab2:data.enableTabs==="true",tab1Heading:data.tab1Heading||"",tab2Heading:data.tab2Heading||""}}function extractOrderedLists(data){if(Array.isArray(data?.recommendationLists)&&data.recommendationLists.length>0)return data.recommendationLists;const primaryList=data?.primaryList??{},primaryProducts=Array.isArray(primaryList.productGroups)?primaryList.productGroups:[],recLists=Array.isArray(primaryList.recommendationLists)?primaryList.recommendationLists:[],combined=[];return primaryProducts.length>0&&combined.push({id:"primary",label:primaryList.label||"",productGroups:primaryProducts,visible:!0}),recLists.forEach(list=>combined.push(list)),combined}class VoyadoPageRecsSection{constructor(root,baseConfig){if(this._root=root,this._sectionConfig=readSectionConfig(root),this._baseConfig=baseConfig,Object.assign(this,createProductCardRenderer(()=>this._sectionConfig,{buildSwatchStyleFn:buildSwatchStyle,productInfoVariant:"product",getMediaStyle:getPageRecsMediaStyle,getImageHeight:getPageRecsImageHeight})),this._loading=document.getElementById(`voyado-page-recs-loading-${this._sectionConfig.sectionId}`),this._lists=document.getElementById(`voyado-page-recs-lists-${this._sectionConfig.sectionId}`),this._bindProductCardContainer(this._lists),this._lists2=null,this._sectionConfig.enableTab2){const sectionId=this._sectionConfig.sectionId;this._lists2=document.getElementById(`voyado-page-recs-lists-tab2-${sectionId}`),this._lists2&&this._bindProductCardContainer(this._lists2),this._bindTabButtons()}}get listSlots(){return this._sectionConfig.enableTab2?2:1}get pageId(){return this._sectionConfig.pageId}get locale(){return this._sectionConfig.locale}get priceId(){return this._sectionConfig.priceId}get stores(){return this._sectionConfig.stores}get presentCustom(){return this._sectionConfig.presentCustom}showLoading(){this._loading&&(this._root.hidden=!1,this._loading.hidden=!1),this._lists&&(this._lists.hidden=!0,this._lists.innerHTML=""),this._lists2&&(this._lists2.hidden=!0,this._lists2.innerHTML="")}hideSection(){this._lists&&(this._lists.hidden=!0,this._lists.innerHTML=""),this._loading&&(this._loading.hidden=!0),this._root.hidden=!0}render(list){if(this._loading&&(this._loading.hidden=!0),!this._lists){this.hideSection();return}if(!list||list.visible===!1){this.hideSection();return}const productGroups=this._normalizeProductGroups(list?.productGroups??list?.products??[]);if(productGroups.length===0){this.hideSection();return}const cardsHtml=productGroups.map(pg=>this._renderProductCard(pg)).filter(Boolean).join("");if(!cardsHtml){this.hideSection();return}const listHtml=` 2 <section class="voyado-rec__list"> 3 ${this._sectionConfig.layout==="slider"?this._renderSliderInner(cardsHtml):this._renderGridInner(cardsHtml)} 4 </section> 5 `,sectionHeading=this._sectionConfig.sectionHeading.trim(),sectionHeadingTag=this._sectionConfig.sectionHeadingLevel;this._lists.innerHTML=` 6 ${sectionHeading?`<div class="prose voyado-rec__section-heading"><${sectionHeadingTag}>${escapeHtml(sectionHeading)}</${sectionHeadingTag}></div>`:""} 7 ${listHtml} 8 `,this._lists.hidden=!1,this._root.hidden=!1}renderTab2(list){if(!this._lists2)return;if(!list||list.visible===!1){this._lists2.innerHTML="";return}const productGroups=this._normalizeProductGroups(list?.productGroups??list?.products??[]);if(productGroups.length===0){this._lists2.innerHTML="";return}const cardsHtml=productGroups.map(pg=>
8this._renderProductCard(pg)).filter(Boolean).join("");if(!cardsHtml){this._lists2.innerHTML="";return}const isSlider=this._sectionConfig.layout==="slider",sectionHeading=this._sectionConfig.sectionHeading.trim(),sectionHeadingTag=this._sectionConfig.sectionHeadingLevel;this._lists2.innerHTML=` 9 ${sectionHeading?`<div class="prose voyado-rec__section-heading"><${sectionHeadingTag}>${escapeHtml(sectionHeading)}</${sectionHeadingTag}></div>`:""} 10 <section class="voyado-rec__list"> 11 ${isSlider?this._renderSliderInner(cardsHtml,"-tab2"):this._renderGridInner(cardsHtml)} 12 </section> 13 `,this._lists2.hidden=!1}_bindTabButtons(){const buttons=Array.from(this._root.querySelectorAll('[role="tablist"] [role="tab"]')),panels=Array.from(this._root.querySelectorAll("[data-voyado-tab-panel]"));buttons.length<2||buttons.forEach((btn,i)=>{btn.addEventListener("click",()=>{buttons.forEach((b,j)=>b.setAttribute("aria-selected",i===j?"true":"false")),panels.forEach((p,j)=>{p.hidden=i!==j})})})}_renderGridInner(cardsHtml){const cols=escapeAttr(String(this._sectionConfig.columnsDesktop)),colsMobile=escapeAttr(String(this._sectionConfig.columnsMobile));return`<div class="voyado-search__grid" style="--columns-desktop:${cols};--columns-mobile:${colsMobile}">${cardsHtml}</div>`}_renderSliderInner(cardsHtml,idSuffix=""){const sliderId=escapeAttr(`voyado-page-recs-slider-${this._sectionConfig.sectionId}${idSuffix}`);return` 14 <div class="floating-controls-container floating-controls-container--inside floating-controls-container--on-hover"> 15 <scroll-carousel id="${sliderId}" group-cells allow-drag class="product-list product-list--carousel scroll-area bleed md:unbleed" style="--product-list-items-per-row:${this._sectionConfig.columnsDesktop}"> 16 ${cardsHtml} 17 </scroll-carousel> 18 <button is="carousel-prev-button" type="button" class="prev-next-button prev-next-button--prev circle-button hover:animate-icon-inline" aria-controls="${sliderId}" disabled> 19 <span class="sr-only">Zur\xFCck</span> 20 <svg aria-hidden="true" focusable="false" fill="none" width="16" viewB
20ox="0 0 16 18"><path d="M11 1 3 9l8 8" stroke="currentColor" stroke-linecap="square"/></svg> 21 </button> 22 <button is="carousel-next-button" type="button" class="prev-next-button prev-next-button--next circle-button hover:animate-icon-inline" aria-controls="${sliderId}"> 23 <span class="sr-only">Weiter</span> 24 <svg aria-hidden="true" focusable="false" fill="none" width="16" viewBox="0 0 16 18"><path d="m5 17 8-8-8-8" stroke="currentColor" stroke-linecap="square"/></svg> 25 </button> 26 </div> 27 `}_canRenderSwatches(){return this._sectionConfig.showSwatch&&this._baseConfig.showSwatches}}async function initializeVoyadoPageRecs(){if(window.__voyadoPageRecsRunning)return;window.__voyadoPageRecsRunning=!0;const elements=document.querySelectorAll("[data-voyado-page-recs]");if(elements.length===0)return;const baseConfig=readConfig(),sections=Array.from(elements).filter(el=>el instanceof HTMLElement).map(el=>{try{return new VoyadoPageRecsSection(el,baseConfig)}catch{return el.hidden=!0,null}}).filter(Boolean);if(sections.length!==0){if(sections.forEach(s=>s.showLoading()),await _syncOnce,!window.__voyadoPageRecsPromise){const firstSection=sections[0],locale=firstSection.locale||baseConfig.locale,params={pageReference:firstSection.pageId,customerKey:getCustomerKey(),sessionKey:getSessionKey(),market:baseConfig.market,locale,touchpoint:getTouchpoint()};firstSection.priceId&&(params.priceId=firstSection.priceId),firstSection.stores&&(params.stores=firstSection.stores),firstSection.presentCustom&&(params.presentCustom=firstSection.presentCustom),window.__voyadoPageRecsPromise=requestVoyadoJson(baseConfig.cluster,"/api/storefront/v3/queries/landing-page",params)}try{const data=await window.__voyadoPageRecsPromise;hasVoyadoConsent()||(_loadedWithoutConsent=!0);const lists=extractOrderedLists(data);let listIndex=0;sections.forEach(section=>{section.render(lists[listIndex]??null),section._sectionConfig.enableTab2?(section.renderTab2(lists[listIndex+1]??null),listIndex+=2):listIndex+=1})}catch{sections.forEach(s=>s.hideSection())}}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initializeVoyadoPageRecs,{once:!0}):initializeVoyadoPageRecs(),document.addEventListener("visitorConsentCollected",()=>{_loadedWithoutConsent&&(_loadedWithoutConsent=!1,window.__voyadoPageRecsRunning=!1,window.__voyadoPageRecsPromise=null,initializeVoyadoPageRecs())},{once:!0}); 28//# sourceMappingURL=/cdn/shop/t/53/assets/voyado-page-recs.js.map?v=85718921128333570191781103422
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.