vviinn-widgets 2.4.3 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/{app-globals-474864e0.js → app-globals-af9e1c96.js} +1 -1
  2. package/dist/cjs/cropper-handler.cjs.entry.js +1 -1
  3. package/dist/cjs/{customized-slots-0aa6c3d6.js → customized-slots-dc70586b.js} +1 -1
  4. package/dist/cjs/highlight-box_22.cjs.entry.js +4 -4
  5. package/dist/cjs/{imageSearch.store-076370bf.js → imageSearch.store-e11fb912.js} +1 -1
  6. package/dist/cjs/{index-61403ab1.js → index-07d3d672.js} +1 -1
  7. package/dist/cjs/{index-34d20028.js → index-135d1612.js} +14 -1
  8. package/dist/cjs/{index-a87f1a44.js → index-7e558d0b.js} +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/vviinn-carousel_3.cjs.entry.js +15 -19
  11. package/dist/cjs/vviinn-error.cjs.entry.js +1 -1
  12. package/dist/cjs/vviinn-preloader.cjs.entry.js +2 -2
  13. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +2 -2
  14. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +2 -2
  15. package/dist/cjs/vviinn-vps-button.cjs.entry.js +3 -3
  16. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +11 -7
  17. package/dist/cjs/vviinn-widgets.cjs.js +2 -2
  18. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +4 -12
  19. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +8 -4
  20. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +8 -4
  21. package/dist/esm/{app-globals-3888cd41.js → app-globals-c988b07f.js} +1 -1
  22. package/dist/esm/cropper-handler.entry.js +1 -1
  23. package/dist/esm/{customized-slots-863113e2.js → customized-slots-62974f69.js} +1 -1
  24. package/dist/esm/highlight-box_22.entry.js +4 -4
  25. package/dist/esm/{imageSearch.store-b516d12e.js → imageSearch.store-5e2c3094.js} +1 -1
  26. package/dist/esm/{index-2f8fb0fe.js → index-412e5674.js} +13 -2
  27. package/dist/esm/{index-56c062df.js → index-4600de03.js} +1 -1
  28. package/dist/esm/{index-36978848.js → index-d0a661ce.js} +1 -1
  29. package/dist/esm/loader.js +2 -2
  30. package/dist/esm/vviinn-carousel_3.entry.js +15 -19
  31. package/dist/esm/vviinn-error.entry.js +1 -1
  32. package/dist/esm/vviinn-preloader.entry.js +2 -2
  33. package/dist/esm/vviinn-recommendations-sidebar.entry.js +2 -2
  34. package/dist/esm/vviinn-vpr-button.entry.js +2 -2
  35. package/dist/esm/vviinn-vps-button.entry.js +3 -3
  36. package/dist/esm/vviinn-vps-widget.entry.js +11 -7
  37. package/dist/esm/vviinn-widgets.js +2 -2
  38. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -1
  39. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +1 -1
  40. package/dist/vviinn-widgets/{p-c853cba8.js → p-11d26656.js} +1 -1
  41. package/dist/vviinn-widgets/{p-9cc6f0dd.entry.js → p-1bf0bfea.entry.js} +1 -1
  42. package/dist/vviinn-widgets/p-34d7d8fa.entry.js +1 -0
  43. package/dist/vviinn-widgets/p-521ba041.entry.js +1 -0
  44. package/dist/vviinn-widgets/{p-47183c9a.js → p-545ef9fd.js} +1 -1
  45. package/dist/vviinn-widgets/{p-f9410382.entry.js → p-62060afb.entry.js} +1 -1
  46. package/dist/vviinn-widgets/{p-0a9cee09.entry.js → p-79de17a4.entry.js} +1 -1
  47. package/{www/build/p-606ff863.js → dist/vviinn-widgets/p-7ec49ce4.js} +1 -1
  48. package/dist/vviinn-widgets/{p-2e6ecda7.entry.js → p-8ddb0d28.entry.js} +1 -1
  49. package/dist/vviinn-widgets/{p-d8d49616.entry.js → p-916817f8.entry.js} +1 -1
  50. package/{www/build/p-ac0a2989.js → dist/vviinn-widgets/p-9abc276d.js} +1 -1
  51. package/dist/vviinn-widgets/{p-b547a6d0.entry.js → p-b8932639.entry.js} +1 -1
  52. package/{www/build/p-535611cd.entry.js → dist/vviinn-widgets/p-c26d41ac.entry.js} +1 -1
  53. package/{www/build/p-28678772.js → dist/vviinn-widgets/p-d3b98fa3.js} +1 -1
  54. package/dist/vviinn-widgets/{p-b4caf042.js → p-eff93fbd.js} +1 -1
  55. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  56. package/package.json +1 -1
  57. package/www/build/{p-c853cba8.js → p-11d26656.js} +1 -1
  58. package/www/build/{p-9cc6f0dd.entry.js → p-1bf0bfea.entry.js} +1 -1
  59. package/www/build/p-34d7d8fa.entry.js +1 -0
  60. package/www/build/p-521ba041.entry.js +1 -0
  61. package/www/build/{p-47183c9a.js → p-545ef9fd.js} +1 -1
  62. package/www/build/{p-f9410382.entry.js → p-62060afb.entry.js} +1 -1
  63. package/www/build/{p-0a9cee09.entry.js → p-79de17a4.entry.js} +1 -1
  64. package/{dist/vviinn-widgets/p-606ff863.js → www/build/p-7ec49ce4.js} +1 -1
  65. package/www/build/p-8bfb73d1.js +1 -0
  66. package/www/build/{p-2e6ecda7.entry.js → p-8ddb0d28.entry.js} +1 -1
  67. package/www/build/{p-d8d49616.entry.js → p-916817f8.entry.js} +1 -1
  68. package/{dist/vviinn-widgets/p-ac0a2989.js → www/build/p-9abc276d.js} +1 -1
  69. package/www/build/p-a67898be.css +1 -0
  70. package/www/build/{p-b547a6d0.entry.js → p-b8932639.entry.js} +1 -1
  71. package/{dist/vviinn-widgets/p-535611cd.entry.js → www/build/p-c26d41ac.entry.js} +1 -1
  72. package/{dist/vviinn-widgets/p-28678772.js → www/build/p-d3b98fa3.js} +1 -1
  73. package/www/build/{p-b4caf042.js → p-eff93fbd.js} +1 -1
  74. package/www/build/vviinn-widgets.esm.js +1 -1
  75. package/www/index.html +1 -1
  76. package/dist/vviinn-widgets/p-ad29e9c5.entry.js +0 -1
  77. package/dist/vviinn-widgets/p-d2097302.entry.js +0 -1
  78. package/www/build/p-7c313f33.js +0 -125
  79. package/www/build/p-ad29e9c5.entry.js +0 -1
  80. package/www/build/p-d2097302.entry.js +0 -1
  81. package/www/build/p-e0153ae2.css +0 -6
@@ -1 +0,0 @@
1
- import{r as t,h as i,H as e,g as s,c as r}from"./p-47183c9a.js";import{_ as n,O as o,S as a,a as c,E as h,i as l,s as d,c as u,m as p,f as m,g as v,b as g,d as f,A as b,T as w}from"./p-606ff863.js";import{C as y}from"./p-b4caf042.js";import{p as x}from"./p-f582db5c.js";import{c as k,v as C,a as _,b as P}from"./p-28678772.js";let R=class{constructor(i){t(this,i),this.moveDirection="right",this.contentGroups=[],this.activeContentGroup=0,this.mode="continuity",this.imageWidth=140,this.showScroll=!0,this.recommendations=[],this.columns=0,this.resizeObserver=new ResizeObserver((()=>this.handleResize())),this.mutationObserver=new MutationObserver((()=>this.cloneSlottedContent()))}connectedCallback(){this.setItemWidth()}disconnectedCallback(){this.resizeObserver.disconnect()}componentDidLoad(){this.setWidth(),this.processScrollbarWidth(),this.columns=this.getColumnsNumber();const t=this.el.querySelector(".content");this.mutationObserver.observe(t,{subtree:!0,childList:!0}),this.resizeObserver.observe(this.getHostParent())}getItemWidthFromDocument(){return parseInt(getComputedStyle(document.body).getPropertyValue("--vviinn-carousel-image-width"))}setItemWidth(){const t=this.getItemWidthFromDocument(),i=isNaN(t)?this.imageWidth:t;this.el.style.setProperty("--vviinn-carousel-image-width",`${i}px`)}getContentClassMap(){return{content:!0,[this.moveDirection]:!0,[this.mode]:!0,"show-scrollbar":this.showScroll}}handleResize(){this.setWidth(),this.processScrollbarWidth(),this.setItemWidth();const t=this.getColumnsNumber();t!==this.columns&&(this.columns=t)}calculateMoveStep(){const t=this.getContent().map((t=>t.getBoundingClientRect().width));return t.reduce(((t,i)=>t+i),0)/t.length}getHostParent(){return this.el.parentNode.host.parentElement}setWidth(){const t=this.getHostParent();if(!t)return;const i=getComputedStyle(t),e=t.getBoundingClientRect().width-(parseInt(i["padding-right"])+parseInt(i["padding-left"]));this.el.style.setProperty("--vviinn-carousel-content-width",`${e}px`)}getParent(){return this.el.parentNode.host.parentElement}cloneSlottedContent(){this.setWidth()}getActiveGroupIndex(){var t,i;if(!(null===(i=null===(t=this.getContentNode())||void 0===t?void 0:t.getBoundingClientRect())||void 0===i?void 0:i.left))return 0;const e=this.getContentGroups().map((t=>t.getBoundingClientRect().left)).map(((t,i)=>[t,i])).filter((t=>t[0]>=0));return e.length>0?e[0][1]:0}getContentNode(){return this.el.querySelector(".content")}getContent(){const t=this.getContentNode().children;return Array.from(t).map((t=>t))}getColumnsNumber(){const t=getComputedStyle(this.el).getPropertyValue("--vviinn-carousel-columns-internal");return parseInt(t)}getContentGroups(){return Array.from(this.el.querySelectorAll(".items-group"))}showNext(){this.moveDirection="right";const t=this.getContentNode();requestAnimationFrame((()=>{t.scrollTo({top:0,left:t.scrollLeft+this.calculateMoveStep(),behavior:"smooth"})}))}showPrev(){this.moveDirection="left";const t=this.getContentNode();requestAnimationFrame((()=>{t.scrollTo({top:0,left:t.scrollLeft-this.calculateMoveStep(),behavior:"smooth"})}))}scroll(t){const i=this.getContentNode();requestAnimationFrame((()=>{i.scrollTo({top:0,left:this.calculateMoveStep()*t,behavior:"smooth"})}))}processScrollbarWidth(){const t=this.getContentNode();this.el.style.setProperty("--vviinn-progressbar-width",t.clientWidth*((t.scrollLeft+t.clientWidth)/t.scrollWidth)+"px"),this.activeContentGroup=this.getActiveGroupIndex()}showBullets(){return"grid"===this.mode&&this.showScroll}showScrollbar(){return"continuity"===this.mode&&this.showScroll}getClassMap(){return{[this.mode]:!0,"show-scrollbar":this.showScrollbar()}}renderRecommendation(t,e){return i("vviinn-product-card",{part:"product-part",productId:t.productId,productTitle:t.title,deeplink:t.deeplink,image:t.image.thumbnail,brand:t.brand,imageWidth:this.imageWidth,imageRatio:1,price:t.price.actual,salePrice:t.price.sale,responsive:"grid"===this.mode,dimmedBackground:"continuity"===this.mode,index:e})}renderRecommendationGroup(t){return i("div",{class:"items-group"},t)}renderRecommendationGroups(t){return t.map((t=>this.renderRecommendationGroup(t)))}renderRecommendations(){return"grid"===this.mode?this.renderGrid():this.renderRecommendationsElements()}renderRecommendationsElements(){return this.recommendations.map(((t,i)=>this.renderRecommendation(t,i)))}renderGrid(){const t=this.renderRecommendationsElements(),i=n.chunksOf(this.getColumnsNumber())(t);return this.renderRecommendationGroups(i)}renderBullets(){const t=Math.ceil(this.recommendations.length/this.getColumnsNumber());return Array.from(Array(t).keys()).map((t=>i("div",{class:{bullet:!0,active:this.activeContentGroup===t},onClick:()=>this.scroll(t)})))}render(){return i(e,{class:this.getClassMap()},i("div",{class:Object.assign({body:!0},this.getClassMap())},i("button",{class:"prev",onClick:()=>this.showPrev(),part:"carousel-button"},i(y,null)),i("div",{class:this.getContentClassMap(),onScroll:()=>this.processScrollbarWidth()},this.renderRecommendations()),i("button",{class:"next",onClick:()=>this.showNext(),part:"carousel-button"},i(y,null))),this.showBullets()?i("div",{class:"bullets"},this.renderBullets()):"")}get el(){return s(this)}};R.style=":host{--vviinn-progressbar-width:0;--vviinn-carousel-item-width:150px;--vviinn-carousel-columns-internal:var(--vviinn-carousel-columns, 4);--vviinn-carousel-image-width-system:140px}.body{display:flex;position:relative;width:var(--vviinn-carousel-content-width);flex-direction:column}.content-wrapper *{box-sizing:border-box}.content-wrapper{overflow-y:hidden;overflow-x:auto;flex-grow:1}.bullets{margin-top:16px;display:flex;flex-direction:row;grid-gap:24px;justify-content:center}.bullet{width:10px;height:10px;background:#E0E0E0;border-radius:50%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) button{border-radius:2px}:host(.grid) button{border-radius:50%}button{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}button{fill:#525252}button.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";class S{sendImpression(t){var i,e,s;gtag("event","view_item_list",{items:[{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list_name:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}]})}sendClick(t){var i,e,s;gtag("event","select_content",{content_type:"product",items:[{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list_name:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}]})}}class I{constructor(){ga("require","ec")}convertProduct(t){var i,e,s;return{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}}sendImpression(t){ga("ec:addImpression",this.convertProduct(t))}sendClick(t){var i,e,s;ga("ec:addProduct",{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}),ga("ec:setAction","click",{list:"VI VPR View"})}}const E=o.getMonoid(a.first()).concat(c.pipe(o.fromNullable(window.gtag),o.map((()=>new S))),c.pipe(o.fromNullable(window.ga),o.map((()=>new I)))),V=/fit\/\d+\//,j=(t,i)=>c.pipe((t=>c.pipe(t.match(V),h.fromNullable(t),h.map((()=>t))))(t),h.map((t=>t.replace(V,`fit/${i}/`))),h.getOrElse((()=>t))),A=(t,e)=>t.deeplink?i("a",{class:t.part,part:t.part,href:t.deeplink},e):e,z=t=>{var e;const s=new Intl.NumberFormat(t.locale,{minimumFractionDigits:2}).format(t.price),r=`${null!==(e=t.prefix)&&void 0!==e?e:""} ${s} ${t.currency}`;return i("span",{class:"price-amount",part:"price-amount"},r)},O=t=>{const e=i(z,{prefix:t.prefix,currency:t.currency,price:t.price,locale:t.locale});return i("span",{class:"price-container",part:"price-container"},t.salePrice?[i("span",{class:"price-sale",part:"price-sale"},i(z,{prefix:t.prefix,currency:t.currency,price:t.salePrice,locale:t.locale})),i("span",{class:"price-outdated",part:"price-outdated"},e)]:i("span",{class:"price-regular",part:"price-regular"},e))};let D=class{constructor(i){t(this,i),this.recommendationLoad=r(this,"recommendationLoad",7),this.recommendationView=r(this,"recommendationView",7),this.recommendationClick=r(this,"recommendationClick",7),this.productImageLoaded=r(this,"productImageLoaded",7),this.currency=void 0,this.imageRatio=1,this.imageWidth=200,this.locale=void 0,this.pricePrefix=void 0,this.responsive=!1,this.dimmedBackground=!1,this.index=0,this.imageLoaded=!1,this.productData=null,this.intersectionObserver=new IntersectionObserver(this.intersectionCallback.bind(this),{threshold:1})}connectedCallback(){this.productData={product:this.productId,rank:this.index}}intersectionCallback(t){t.some((t=>t.isIntersecting))&&(c.pipe(E,o.map((t=>t.sendImpression(this.getProduct())))),this.recommendationView.emit(this.productData),this.intersectionObserver.disconnect())}componentDidLoad(){this.recommendationLoad.emit(this.productData),this.intersectionObserver.observe(this.el),this.el.shadowRoot.querySelectorAll("a").forEach((t=>t.addEventListener("mousedown",(t=>{this.recommendationClick.emit(this.productData),window.ga&&t.preventDefault(),c.pipe(E,o.match((()=>null),(t=>t.sendClick(this.getProduct())))),window.ga&&ga("send","event","UX","click","Results",{hitCallback:function(){document.location.href=this.deeplink}})}))))}getProduct(){return l.results.find((t=>t.productId===this.productId))}renderImage(){const t={width:this.imageWidth,height:this.imageWidth*this.imageRatio,src:this.image,title:this.productTitle,lazy:!1};return this.responsive?((t,e=(()=>{}))=>i("picture",null,i("img",{loading:t.lazy?"lazy":"eager",part:"image",class:"image responsive",src:j(t.src,t.width),alt:t.title,onLoad:e})))(t,(()=>this.kek())):((t,e=(()=>{}))=>i("picture",null,i("img",{loading:t.lazy?"lazy":"eager",part:"image",class:"image",width:t.width,height:t.height,src:j(t.src,t.width),alt:t.title,onLoad:e})))(t,(()=>this.kek()))}kek(){this.productImageLoaded.emit(this.productId)}render(){var t,s,r;return i(e,{part:"product-card",class:{dimmed:this.dimmedBackground},exportparts:"brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title"},i(A,{deeplink:this.deeplink,part:"image-link"},this.renderImage()),i(A,{deeplink:this.deeplink,part:"deeplink"},i("span",{class:"title",part:"title"},this.productTitle)),i("span",{class:"brand",part:"brand"},this.brand),i("span",{class:"type",part:"type"},this.productType),i(O,{prefix:null!==(t=this.pricePrefix)&&void 0!==t?t:d.pricePrefix,currency:null!==(s=this.currency)&&void 0!==s?s:d.currencySign,price:this.price,salePrice:this.salePrice,locale:null!==(r=this.locale)&&void 0!==r?r:d.locale}))}get el(){return s(this)}};D.style=':host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:"";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}';const $=c.flow((t=>`Bearer ${t}`),(t=>new Headers({Authorization:t})),(t=>({headers:t}))),T=f(b),L=(t,i={})=>x(T(v(),g),m,u(p(t,i))),M=t=>i=>L(`product/${t}/similar-products`,i),N=t=>i=>L(`product/${t}/cross-selling-products`,i);function W(t){return"function"==typeof t}function F(t){const i=t((t=>{Error.call(t),t.stack=(new Error).stack}));return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}const B=F((t=>function(i){t(this),this.message=i?`${i.length} errors occurred during unsubscription:\n${i.map(((t,i)=>`${i+1}) ${t.toString()}`)).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=i}));function G(t,i){if(t){const e=t.indexOf(i);0<=e&&t.splice(e,1)}}class U{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;const{_parentage:i}=this;if(i)if(this._parentage=null,Array.isArray(i))for(const t of i)t.remove(this);else i.remove(this);const{initialTeardown:e}=this;if(W(e))try{e()}catch(i){t=i instanceof B?i.errors:[i]}const{_finalizers:s}=this;if(s){this._finalizers=null;for(const i of s)try{X(i)}catch(i){t=null!=t?t:[],i instanceof B?t=[...t,...i.errors]:t.push(i)}}if(t)throw new B(t)}}add(t){var i;if(t&&t!==this)if(this.closed)X(t);else{if(t instanceof U){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(i=this._finalizers)&&void 0!==i?i:[]).push(t)}}_hasParent(t){const{_parentage:i}=this;return i===t||Array.isArray(i)&&i.includes(t)}_addParent(t){const{_parentage:i}=this;this._parentage=Array.isArray(i)?(i.push(t),i):i?[i,t]:t}_removeParent(t){const{_parentage:i}=this;i===t?this._parentage=null:Array.isArray(i)&&G(i,t)}remove(t){const{_finalizers:i}=this;i&&G(i,t),t instanceof U&&t._removeParent(this)}}U.EMPTY=(()=>{const t=new U;return t.closed=!0,t})();const q=U.EMPTY;function H(t){return t instanceof U||t&&"closed"in t&&W(t.remove)&&W(t.add)&&W(t.unsubscribe)}function X(t){W(t)?t():t.unsubscribe()}const J={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},K={setTimeout(t,i,...e){const{delegate:s}=K;return(null==s?void 0:s.setTimeout)?s.setTimeout(t,i,...e):setTimeout(t,i,...e)},clearTimeout(t){const{delegate:i}=K;return((null==i?void 0:i.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Q(){}const Y=Z("C",void 0,void 0);function Z(t,i,e){return{kind:t,value:i,error:e}}function tt(t){t()}class it extends U{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,H(t)&&t.add(this)):this.destination=ct}static create(t,i,e){return new nt(t,i,e)}next(t){this.isStopped?at(function(t){return Z("N",t,void 0)}(t),this):this._next(t)}error(t){this.isStopped?at(Z("E",void 0,t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?at(Y,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const et=Function.prototype.bind;function st(t,i){return et.call(t,i)}class rt{constructor(t){this.partialObserver=t}next(t){const{partialObserver:i}=this;if(i.next)try{i.next(t)}catch(t){ot(t)}}error(t){const{partialObserver:i}=this;if(i.error)try{i.error(t)}catch(t){ot(t)}else ot(t)}complete(){const{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(t){ot(t)}}}class nt extends it{constructor(t,i,e){let s;if(super(),W(t)||!t)s={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=e?e:void 0};else{let i;this&&J.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),s={next:t.next&&st(t.next,i),error:t.error&&st(t.error,i),complete:t.complete&&st(t.complete,i)}):s=t}this.destination=new rt(s)}}function ot(t){var i;i=t,K.setTimeout((()=>{const{onUnhandledError:t}=J;if(!t)throw i;t(i)}))}function at(t,i){const{onStoppedNotification:e}=J;e&&K.setTimeout((()=>e(t,i)))}const ct={closed:!0,next:Q,error:function(t){throw t},complete:Q},ht="function"==typeof Symbol&&Symbol.observable||"@@observable";function lt(t){return t}class dt{constructor(t){t&&(this._subscribe=t)}lift(t){const i=new dt;return i.source=this,i.operator=t,i}subscribe(t,i,e){const s=(r=t)&&r instanceof it||function(t){return t&&W(t.next)&&W(t.error)&&W(t.complete)}(r)&&H(r)?t:new nt(t,i,e);var r;return tt((()=>{const{operator:t,source:i}=this;s.add(t?t.call(s,i):i?this._subscribe(s):this._trySubscribe(s))})),s}_trySubscribe(t){try{return this._subscribe(t)}catch(i){t.error(i)}}forEach(t,i){return new(i=ut(i))(((i,e)=>{const s=new nt({next:i=>{try{t(i)}catch(t){e(t),s.unsubscribe()}},error:e,complete:i});this.subscribe(s)}))}_subscribe(t){var i;return null===(i=this.source)||void 0===i?void 0:i.subscribe(t)}[ht](){return this}pipe(...t){return(0===(i=t).length?lt:1===i.length?i[0]:function(t){return i.reduce(((t,i)=>i(t)),t)})(this);var i}toPromise(t){return new(t=ut(t))(((t,i)=>{let e;this.subscribe((t=>e=t),(t=>i(t)),(()=>t(e)))}))}}function ut(t){var i;return null!==(i=null!=t?t:J.Promise)&&void 0!==i?i:Promise}dt.create=t=>new dt(t);const pt=F((t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}));class mt extends dt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){const i=new vt(this,this);return i.operator=t,i}_throwIfClosed(){if(this.closed)throw new pt}next(t){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const i of this.currentObservers)i.next(t)}}))}error(t){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;const{observers:i}=this;for(;i.length;)i.shift().error(t)}}))}complete(){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:t}=this;for(;t.length;)t.shift().complete()}}))}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){const{hasError:i,isStopped:e,observers:s}=this;return i||e?q:(this.currentObservers=null,s.push(t),new U((()=>{this.currentObservers=null,G(s,t)})))}_checkFinalizedStatuses(t){const{hasError:i,thrownError:e,isStopped:s}=this;i?t.error(e):s&&t.complete()}asObservable(){const t=new dt;return t.source=this,t}}mt.create=(t,i)=>new vt(t,i);class vt extends mt{constructor(t,i){super(),this.destination=t,this.source=i}next(t){var i,e;null===(e=null===(i=this.destination)||void 0===i?void 0:i.next)||void 0===e||e.call(i,t)}error(t){var i,e;null===(e=null===(i=this.destination)||void 0===i?void 0:i.error)||void 0===e||e.call(i,t)}complete(){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===i||i.call(t)}_subscribe(t){var i,e;return null!==(e=null===(i=this.source)||void 0===i?void 0:i.subscribe(t))&&void 0!==e?e:q}}let gt=class{constructor(i){t(this,i),this.recommendationsLoaded=r(this,"recommendationsLoaded",7),this.blockTitle="Recommended products",this.imageRatio=1,this.imageWidth=300,this.currencySign="€",this.mode="continuity",this.campaignType="VPR",this.locale="de-DE",this.apiPath="https://api.vviinn.com",this.useCarousel=!0,this.showScroll=!0,this.cssUrl=null,this.recommendations=[],this.loaded=!1,this.productImageLoadedSubject=new mt}handleProductIdChange(){this.getRecommendations()}handleCampaignTypeChange(){this.getRecommendations()}handleApiPathChange(t){d.apiPath=t,this.getRecommendations()}handleImageLoading({detail:t}){this.productImageLoadedSubject.next(t)}trackRecommendationView({detail:t}){const i=k(Object.assign({session_id:this.uiSessionId},t));this.trackingApi.trackEvent(i)}trackRecommendationClick({detail:t}){const i=k(Object.assign({session_id:this.uiSessionId},t));this.trackingApi.trackEvent(i)}connectedCallback(){d.apiPath=this.apiPath,d.currencySign=this.currencySign,d.locale=this.locale,this.uiSessionId=C(),this.trackingApi=_(this.apiPath,this.token);const t=P({action:"open",session_id:this.uiSessionId});this.trackingApi.trackEvent(t)}disconnectedCallback(){const t=P({action:"close",session_id:this.uiSessionId});this.trackingApi.trackEvent(t)}async componentWillLoad(){d.pricePrefix=this.pricePrefix,d.currencySign=this.currencySign,this.getRecommendations()}async getRecommendations(){if(void 0===this.productId||void 0===this.token)return;const t=this.campaignType.length>0?this.campaignType:"VPR",i=$(this.token),e=c.pipe(w.of((t=>{return c.pipe("VPR"===t?{_tag:"VPR"}:{_tag:"VCS"},(i=()=>M,e=()=>N,t=>(t=>"VPR"===t._tag)(t)?i():e()));var i,e})(t)),w.ap(w.of(this.productId)),w.ap(w.of(i)),w.flatten),s=await e();c.pipe(s,h.fold((t=>this.handleError(t)),(t=>this.handleRecommendationsSucces(t))))}handleError(t){console.log("ERROR:",t)}handleRecommendationsSucces(t){var i;this.recommendations=null!==(i=null==t?void 0:t.extended)&&void 0!==i?i:t,l.results=this.recommendations,this.loaded=!0,this.productIds=this.recommendations.map((t=>t.productId)),this.productImageLoadedSubject.subscribe((t=>{this.productIds=this.productIds.filter((i=>i!==t)),0===this.productIds.length&&this.recommendationsLoaded.emit()}))}isExternalCSS(){return this.cssUrl&&this.cssUrl.length>0}renderExternalCSS(){return this.isExternalCSS()?i("link",{href:this.cssUrl,rel:"stylesheet"}):""}render(){return i(e,{class:{loaded:this.loaded,empty:0==this.recommendations.length,[this.mode]:!0},"aria-hidden":this.loaded?"false":"true"},this.renderExternalCSS(),i("style",null,d.fallbackStyles),i("h2",{part:"recommendations-title"},this.blockTitle),this.useCarousel?this.renderCarousel():this.renderResults())}renderRecommendation(t,e){return i("vviinn-product-card",{part:"product-part",productId:t.productId,productTitle:t.title,deeplink:t.deeplink,image:t.image.thumbnail,brand:t.brand,imageWidth:this.imageWidth,imageRatio:1,price:t.price.actual,salePrice:t.price.sale,responsive:"grid"===this.mode,dimmedBackground:this.useDimmedBackgroundInCard(),index:e})}useDimmedBackgroundInCard(){return"continuity"===this.mode||!this.useCarousel}renderResults(){return i("div",{class:"recommendations-grid",part:"recommendations-grid"},this.recommendations.map(((t,i)=>this.renderRecommendation(t,i))))}renderCarousel(){return i("vviinn-carousel",{mode:this.mode,imageWidth:this.imageWidth,showScroll:this.showScroll,recommendations:this.recommendations})}get el(){return s(this)}static get watchers(){return{productId:["handleProductIdChange"],campaignType:["handleCampaignTypeChange"],apiPath:["handleApiPathChange"]}}};gt.style=":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.grid) vviinn-product-card::part(image){border:1px solid #DDDDDD;width:100%}h2{margin:0}vviinn-product-card::part(price-container){align-self:flex-start;text-align:left;display:flex}.results{display:grid;grid-gap:1rem}.visually-hidden{position:absolute;top:0;left:0;z-index:-1;height:0;width:0}h2{margin:0}:host(.grid) h2{justify-content:center}:host(.grid) vviinn-product-card::part(image){min-width:100%}:host(.grid) vviinn-product-card::part(image-link){width:100%}:host(.grid) vviinn-product-card::part(title),:host(.grid) vviinn-product-card::part(brand),:host(.grid) vviinn-product-card::part(type){text-align:center}:host(.grid) vviinn-product-card::part(price-container){align-self:center}:host(.continuity) vviinn-product-card::part(title),:host(.continuity) vviinn-product-card::part(brand),:host(.continuity) vviinn-product-card::part(type),:host(.continuity) vviinn-product-card::part(deeplink){text-align:left;max-width:unset;align-self:start}";export{R as vviinn_carousel,D as vviinn_product_card,gt as vviinn_vpr_widget}
@@ -1,125 +0,0 @@
1
- import { B as BUILD, c as consoleDevInfo, p as plt, w as win, H, d as doc, N as NAMESPACE, a as promiseResolve, b as bootstrapLazy } from './index-9f2e511a.js';
2
- import { g as globalScripts } from './app-globals-18f981cc.js';
3
-
4
- /*
5
- Stencil Client Patch Browser v2.9.0 | MIT Licensed | https://stenciljs.com
6
- */
7
- const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
8
- const patchBrowser = () => {
9
- // NOTE!! This fn cannot use async/await!
10
- if (BUILD.isDev && !BUILD.isTesting) {
11
- consoleDevInfo('Running in development mode.');
12
- }
13
- if (BUILD.cssVarShim) {
14
- // shim css vars
15
- plt.$cssShim$ = win.__cssshim;
16
- }
17
- if (BUILD.cloneNodeFix) {
18
- // opted-in to polyfill cloneNode() for slot polyfilled components
19
- patchCloneNodeFix(H.prototype);
20
- }
21
- if (BUILD.profile && !performance.mark) {
22
- // not all browsers support performance.mark/measure (Safari 10)
23
- performance.mark = performance.measure = () => {
24
- /*noop*/
25
- };
26
- performance.getEntriesByName = () => [];
27
- }
28
- // @ts-ignore
29
- const scriptElm = BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
30
- ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
31
- s.getAttribute('data-stencil-namespace') === NAMESPACE)
32
- : null;
33
- const importMeta = import.meta.url;
34
- const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
35
- if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
36
- // Safari < v11 support: This IF is true if it's Safari below v11.
37
- // This fn cannot use async/await since Safari didn't support it until v11,
38
- // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
39
- // so both the ESM file and nomodule file would get downloaded. Only Safari
40
- // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
41
- // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
42
- // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
43
- return {
44
- then() {
45
- /* promise noop */
46
- },
47
- };
48
- }
49
- if (!BUILD.safari10 && importMeta !== '') {
50
- opts.resourcesUrl = new URL('.', importMeta).href;
51
- }
52
- else if (BUILD.dynamicImportShim || BUILD.safari10) {
53
- opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
54
- if (BUILD.dynamicImportShim) {
55
- patchDynamicImport(opts.resourcesUrl, scriptElm);
56
- }
57
- if (BUILD.dynamicImportShim && !win.customElements) {
58
- // module support, but no custom elements support (Old Edge)
59
- // @ts-ignore
60
- return import(/* webpackChunkName: "polyfills-dom" */ './dom-db0073f0.js').then(() => opts);
61
- }
62
- }
63
- return promiseResolve(opts);
64
- };
65
- const patchDynamicImport = (base, orgScriptElm) => {
66
- const importFunctionName = getDynamicImportFunction(NAMESPACE);
67
- try {
68
- // test if this browser supports dynamic imports
69
- // There is a caching issue in V8, that breaks using import() in Function
70
- // By generating a random string, we can workaround it
71
- // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
72
- win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
73
- }
74
- catch (e) {
75
- // this shim is specifically for browsers that do support "esm" imports
76
- // however, they do NOT support "dynamic" imports
77
- // basically this code is for old Edge, v18 and below
78
- const moduleMap = new Map();
79
- win[importFunctionName] = (src) => {
80
- const url = new URL(src, base).href;
81
- let mod = moduleMap.get(url);
82
- if (!mod) {
83
- const script = doc.createElement('script');
84
- script.type = 'module';
85
- script.crossOrigin = orgScriptElm.crossOrigin;
86
- script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
87
- type: 'application/javascript',
88
- }));
89
- mod = new Promise((resolve) => {
90
- script.onload = () => {
91
- resolve(win[importFunctionName].m);
92
- script.remove();
93
- };
94
- });
95
- moduleMap.set(url, mod);
96
- doc.head.appendChild(script);
97
- }
98
- return mod;
99
- };
100
- }
101
- };
102
- const patchCloneNodeFix = (HTMLElementPrototype) => {
103
- const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
104
- HTMLElementPrototype.cloneNode = function (deep) {
105
- if (this.nodeName === 'TEMPLATE') {
106
- return nativeCloneNodeFn.call(this, deep);
107
- }
108
- const clonedNode = nativeCloneNodeFn.call(this, false);
109
- const srcChildNodes = this.childNodes;
110
- if (deep) {
111
- for (let i = 0; i < srcChildNodes.length; i++) {
112
- // Node.ATTRIBUTE_NODE === 2, and checking because IE11
113
- if (srcChildNodes[i].nodeType !== 2) {
114
- clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
115
- }
116
- }
117
- }
118
- return clonedNode;
119
- };
120
- };
121
-
122
- patchBrowser().then(options => {
123
- globalScripts();
124
- return bootstrapLazy([["vviinn-vps-widget",[[1,"vviinn-vps-widget",{"token":[1],"apiPath":[1,"api-path"],"active":[1028],"currencySign":[1,"currency-sign"],"locale":[1],"slidePosition":[32],"width":[32],"wrongImageFormat":[32]},[[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"],[0,"cropperChanged","trachSearchAreaChanges"],[0,"detectedObjectClicked","trackDetectedObject"],[0,"filterSelected","trackFilter"]]]]],["vviinn-vps-button",[[1,"vviinn-vps-button",{"token":[1],"currencySign":[1,"currency-sign"],"locale":[1],"apiPath":[1,"api-path"],"pressed":[32]},[[0,"modalClosed","handleModalClosed"]]]]],["vviinn-recommendations-sidebar",[[1,"vviinn-recommendations-sidebar",{"sidebarTitle":[1,"sidebar-title"],"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"widgetScrollbar":[4,"widget-scrollbar"],"state":[32]},[[16,"click","bodyClickListener"]]]]],["vviinn-vpr-button",[[1,"vviinn-vpr-button",{"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"sidebarTitle":[1,"sidebar-title"],"modalScrollbar":[4,"modal-scrollbar"]}]]],["vviinn-image-view",[[1,"vviinn-image-view"]]],["vviinn-onboarding",[[1,"vviinn-onboarding"]]],["vviinn-example-images",[[1,"vviinn-example-images",null,[[0,"exampleImageSelected","handleImageSelection"],[0,"exampleImageError","handleImageSelectionError"]]]]],["vviinn-overlayed-modal",[[1,"vviinn-overlayed-modal",{"active":[4]}]]],["vviinn-vpr-widget",[[1,"vviinn-vpr-widget",{"blockTitle":[1,"block-title"],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"productId":[1,"product-id"],"token":[1],"currencySign":[1,"currency-sign"],"pricePrefix":[1,"price-prefix"],"mode":[1],"campaignType":[1,"campaign-type"],"locale":[1],"apiPath":[1,"api-path"],"useCarousel":[4,"use-carousel"],"showScroll":[4,"show-scroll"],"cssUrl":[1,"css-url"],"recommendations":[32],"loaded":[32]},[[0,"productImageLoaded","handleImageLoading"],[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"]]]]],["vviinn-empty-results",[[1,"vviinn-empty-results"]]],["vviinn-image-selector",[[1,"vviinn-image-selector"]]],["vviinn-server-error",[[1,"vviinn-server-error"]]],["vviinn-wrong-format",[[1,"vviinn-wrong-format"]]],["search-filters",[[1,"search-filters",{"filter":[16],"selectedCategoryId":[32],"hideFilters":[32]}]]],["vviinn-privacy-badge",[[1,"vviinn-privacy-badge"]]],["vviinn-teaser",[[1,"vviinn-teaser"]]],["image-cropper",[[1,"image-cropper",{"disabled":[4],"handleMove":[32]}]]],["vviinn-carousel",[[0,"vviinn-carousel",{"mode":[1],"imageWidth":[2,"image-width"],"showScroll":[4,"show-scroll"],"recommendations":[16],"moveDirection":[32],"contentGroups":[32],"activeContentGroup":[32]}]]],["vviinn-example-image",[[1,"vviinn-example-image",{"src":[1],"width":[2],"height":[2],"selected":[32]}]]],["highlight-box",[[1,"highlight-box"]]],["vviinn-detected-object",[[1,"vviinn-detected-object",{"detectedObject":[16],"position":[32]}]]],["vviinn-modal",[[1,"vviinn-modal",{"active":[1540],"slider":[32]}]]],["vviinn-onboarding-card-1",[[1,"vviinn-onboarding-card-1"]]],["vviinn-onboarding-card-2",[[1,"vviinn-onboarding-card-2"]]],["vviinn-onboarding-card-3",[[1,"vviinn-onboarding-card-3"]]],["vviinn-overlay",[[1,"vviinn-overlay"]]],["vviinn-slide",[[1,"vviinn-slide"]]],["vviinn-slider",[[1,"vviinn-slider",{"showBullets":[4,"show-bullets"],"position":[514],"showArrows":[4,"show-arrows"],"elementsCount":[32],"internalPosition":[32],"swipeStartPosition":[32]}]]],["cropper-handler",[[1,"cropper-handler",{"handler":[16],"disabled":[4]}]]],["vviinn-error",[[1,"vviinn-error"]]],["vviinn-preloader",[[1,"vviinn-preloader"]]],["vviinn-product-card",[[1,"vviinn-product-card",{"brand":[1],"currency":[1],"deeplink":[1],"image":[1],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"locale":[1],"price":[2],"pricePrefix":[1,"price-prefix"],"productId":[1,"product-id"],"productTitle":[1,"product-title"],"productType":[1,"product-type"],"salePrice":[2,"sale-price"],"responsive":[4],"dimmedBackground":[4,"dimmed-background"],"index":[2],"imageLoaded":[32]}]]]], options);
125
- });
@@ -1 +0,0 @@
1
- import{r as i,h as t,H as e,g as r}from"./p-47183c9a.js";import{s as o,i as s,O as a}from"./p-606ff863.js";import{s as n}from"./p-c853cba8.js";import{d,e as l,f as p,v as c,a as g,g as h}from"./p-28678772.js";import"./p-f582db5c.js";let m=class{constructor(t){i(this,t),this.apiPath="https://api.vviinn.com",this.active=!1,this.currencySign="€",this.locale="de-DE",this.slidePosition=0,this.width=0,this.wrongImageFormat=!1,this.imageSource=null}activeWatcher(i){i?(this.overflow=document.body.style.overflow,document.body.style.overflow="hidden",this.trackOpenEvent()):document.body.style.overflow=this.overflow}trackRecommendationView({detail:i}){const t=d(Object.assign({session_id:this.uiSessionId},i));this.trackingApi.trackEvent(t)}trackRecommendationClick({detail:i}){const t=d(Object.assign({sessionId:this.uiSessionId},i));this.trackingApi.trackEvent(t)}trachSearchAreaChanges(){const i=l({session_id:this.uiSessionId,source:this.imageSource,search_area:"manual-selection"});this.trackingApi.trackEvent(i)}trackDetectedObject(){const i=l({session_id:this.uiSessionId,source:this.imageSource,search_area:"attention-point"});this.trackingApi.trackEvent(i)}trackFilter({detail:i}){const t=p({session_id:this.uiSessionId,source:this.imageSource,kind:"category",action:i});this.trackingApi.trackEvent(t)}componentWillLoad(){n(this,this.el)}connectedCallback(){o.apiPath=this.apiPath,o.currencySign=this.currencySign,o.locale=this.locale,s.token=this.token,this.uiSessionId=c()}trackOpenEvent(){this.trackingApi=g(this.apiPath,this.token);const i=h({action:"open",session_id:this.uiSessionId});this.trackingApi.trackEvent(i)}handleImageSelection(i){this.imageSource=i,this.slidePosition=1,this.el.shadowRoot.querySelector("vviinn-overlayed-modal").shadowRoot.querySelector("vviinn-overlay").querySelector("vviinn-modal").shadowRoot.querySelector(".body").scrollTop=0,this.trackInitialSearch()}trackInitialSearch(){const i=l({session_id:this.uiSessionId,source:this.imageSource,search_area:"full"});this.trackingApi.trackEvent(i)}resetState(){this.resetScroll("onboarding-block"),this.slidePosition=0,s.image=a.none,s.imageUrl=a.none,s.imageBounds=a.none,s.searchArea=a.none,s.results=[],s.filters=[],s.detectedObjects=[],s.activeIonLink=void 0,s.rectangleSearchForm=void 0,this.resetScroll("results-block")}haveErrors(){return this.wrongImageFormat||s.serverError}resetScroll(i,t="auto"){this.el.shadowRoot.getElementById(i).scroll({top:0,left:0,behavior:t})}handleModalClose(){this.active=!1,this.resetState(),["onboarding-block","results-block"].forEach((i=>this.resetScroll(i)));const i=h({action:"close",session_id:this.uiSessionId});this.trackingApi.trackEvent(i)}render(){return t(e,null,t("vviinn-overlayed-modal",{class:{"first-screen":0===this.slidePosition},active:this.active,onSecondaryActionClicked:()=>this.resetState(),onModalClosed:()=>this.handleModalClose(),exportparts:"secondary-action, title, close-button"},t("vviinn-slider",{showBullets:!1,position:this.slidePosition},t("vviinn-slide",{class:{"start-page":!0}},t("div",{class:{error:this.haveErrors(),"start-page_block":!0}},t("vviinn-wrong-format",{class:{hidden:!this.wrongImageFormat},onActionClick:()=>this.wrongImageFormat=!1}),t("vviinn-server-error",{class:{hidden:!s.serverError},onActionClick:()=>s.serverError=!1}),t("vviinn-teaser",{class:{hidden:this.haveErrors()}}),t("vviinn-image-selector",{class:{hidden:this.haveErrors()},onImageSelected:()=>this.handleImageSelection("upload"),onImageSelectedError:()=>this.wrongImageFormat=!0,part:"select-image_button"},t("span",{slot:"upload-button-text",class:"upload-button-content"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"29",height:"28",fill:"none"},t("defs",null),t("path",{fill:"#fff","fill-rule":"evenodd",d:"M10.271 3.89A.875.875 0 0111 3.5h7c.293 0 .566.146.728.39l1.49 2.235h3.033a2.625 2.625 0 012.625 2.625V21a2.625 2.625 0 01-2.625 2.625H5.75A2.625 2.625 0 013.125 21V8.75A2.625 2.625 0 015.75 6.125h3.031l1.49-2.235zm1.197 1.36l-1.49 2.235a.875.875 0 01-.729.39H5.75a.875.875 0 00-.875.875V21a.875.875 0 00.875.875h17.5a.875.875 0 00.875-.875V8.75a.875.875 0 00-.875-.875h-3.5a.875.875 0 01-.729-.39l-1.49-2.235h-6.063z","clip-rule":"evenodd"}),t("path",{fill:"#fff","fill-rule":"evenodd",d:"M14.5 11.375a3.062 3.062 0 100 6.125 3.062 3.062 0 000-6.125zm-4.813 3.063a4.812 4.812 0 119.625 0 4.812 4.812 0 01-9.625 0z","clip-rule":"evenodd"})),t("slot",{name:"vviinn-image-upload-button-text"},t("span",null,"Kamera oder Bild auswählen")))),t("vviinn-privacy-badge",{class:{hidden:this.haveErrors()}})),t("div",{id:"onboarding-block",class:"start-page_block"},t("div",{class:"onboarding-wrapper"},t("vviinn-onboarding",null),t("vviinn-example-images",{onImageSelected:()=>this.handleImageSelection("example"),onImageSelectedError:()=>this.resetScroll("onboarding-block","smooth")})))),t("vviinn-slide",{class:{"results-page":!0,active:1==this.slidePosition}},t("div",{class:"image-wrapper"},t("vviinn-image-view",null),t("div",{class:"filters-wrapper"},t("div",{class:"filters"},s.filters.map((i=>t("search-filters",{filter:i})))))),t("div",{id:"results-block",class:"products-wrapper"},t("div",{class:{"nothing-found":!0,hidden:s.results.length>0}},t("vviinn-empty-results",null),t("vviinn-onboarding",null)),t("div",{class:{hidden:s.results.length<=0,products:!0}},s.results.map(((i,e)=>{var r;return t("vviinn-product-card",{hidden:!0,productTitle:i.title,productId:i.productId,brand:i.brand,deeplink:i.deeplink,price:i.price.actual,salePrice:i.price.sale,imageWidth:160,image:null!==(r=i.image.thumbnail)&&void 0!==r?r:i.image.original,part:"product-card",index:e})}))))))))}get el(){return r(this)}static get watchers(){return{active:["activeWatcher"]}}};m.style=":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{display:block}.hidden{visibility:hidden;height:1px}vviinn-overlayed-modal.first-screen::part(title),vviinn-overlayed-modal.first-screen::part(secondary-action){visibility:hidden}.start-page{display:grid;grid-template-columns:repeat(2, 1fr);min-height:580px}.start-page_block{align-content:start;border-right:1px solid #F4F4F4;display:grid;padding:48px}.start-page_block.error{align-content:center}#onboarding-block{border-right:unset;box-sizing:border-box;grid-gap:24px;overflow-y:auto;position:relative;width:100%}vviinn-teaser{margin-bottom:32px;margin-top:-24px}vviinn-image-selector{align-items:center;background:var(--color-primary, var(--color-primary-system));border-color:var(--color-primary, var(--color-primary-system));border-radius:2px;color:white;display:grid;font-size:16px;font-weight:600;height:56px;justify-items:center;margin-bottom:16px;transition:background 0.1s ease-in-out}vviinn-image-selector:hover{background:var(--color-primary-hover, var(--color-primary-hover-system));border-color:var(--color-primary-hover, var(--color-primary-hover-system))}vviinn-image-selector:active{border-color:black}.upload-button-content{display:grid;align-items:center;justify-items:start;justify-content:center;grid-template-columns:-webkit-max-content auto;grid-template-columns:max-content auto;grid-gap:16px}.results-page{display:grid;grid-template-columns:336px auto;box-sizing:border-box}.results-page>*{padding:24px;box-sizing:border-box}.products{align-content:center;align-items:start;box-sizing:border-box;display:grid;grid-gap:32px 16px;grid-template-columns:repeat(auto-fill, minmax(152px, 1fr));justify-items:center;padding:24px;padding-right:0;position:absolute;width:calc(100% - 16px)}.products.hidden{display:none}vviinn-empty-results{width:280px;align-self:center;justify-self:center}.products-wrapper{display:grid;overflow-y:auto;overflow-x:hidden;padding:unset;position:relative;width:100%}.image-wrapper{border-right:1px solid #F4F4F4;display:grid;grid-template-rows:-webkit-min-content 170px;grid-template-rows:min-content 170px;grid-gap:24px;min-width:100%}.onboarding-wrapper{position:absolute;width:100%;padding:48px;box-sizing:border-box;display:grid;grid-gap:64px;padding-bottom:24px}vviinn-product-card{gap:0;width:100%}vviinn-product-card::part(image){border:1px solid #eaeaea;margin-bottom:8px}vviinn-product-card::part(price-container),vviinn-product-card::part(deeplink),vviinn-product-card::part(title){align-self:start}search-filters span{display:none}search-filters::part(filter){background:#F4F4F4;border-radius:4px;border:1px solid #F4F4F4;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px}search-filters::part(show-more-filters){border:1px solid #f4f4f4;border-radius:4px;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px;padding:6px 16px}search-filters::part(show-more-filters):hover{background:#EAEAEA}search-filters::part(filter):hover{background:#EAEAEA}search-filters::part(filter):focus{outline:none;border:1px solid var(--color-primary, var(--color-primary-system))}search-filters::part(filter active){background:rgba(15, 98, 254, 0.15);color:var(--color-primary, var(--color-primary-system))}.filters-wrapper{overflow:auto}.results-page:not(.active){display:none}.nothing-found{display:grid;grid-gap:64px;justify-self:center;padding-top:64px;padding-bottom:16px;position:absolute;width:60%}@media (max-width: 768px){.start-page_block{padding:24px}.onboarding-wrapper{padding:24px}}@media (max-width: 640px){.start-page{grid-template-rows:-webkit-min-content;grid-template-rows:min-content;grid-template-columns:unset;grid-gap:48px;padding:24px 0 48px 0}}@media (max-width: 640px) and (min-width: 415px){.onboarding-wrapper{position:unset}#onboarding-block{overflow:unset}.start-page.active{height:1px;overflow:auto}}@media (max-width: 415px){.results-page>*{box-sizing:border-box;padding:24px}vviinn-slide{padding-bottom:48px}.start-page_block:last-of-type{border-right:unset;overflow-y:unset;position:static;box-sizing:border-box;width:unset}.start-page_block{padding:0 24px}vviinn-teaser{margin-top:24px}.onboarding-wrapper{position:static;width:unset;padding:unset;box-sizing:border-box}.results-page{grid-template-columns:unset;grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto}.image{margin-bottom:8px}.image-wrapper{grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto;width:100%}.products-wrapper{align-content:start;position:static;overflow-y:unset;width:100%;padding-top:0}.products{position:static;padding:0;width:unset;grid-gap:32px 16px;justify-content:center}.nothing-found{position:static;grid-gap:64px;padding:unset;align-content:start;width:unset}}@media (max-width: 320px){.products{grid-template-columns:unset}}vviinn-wrong-format,vviinn-server-error{width:280px;align-self:center;justify-self:center}";export{m as vviinn_vps_widget}
@@ -1 +0,0 @@
1
- import{r as t,h as i,H as e,g as s,c as r}from"./p-47183c9a.js";import{_ as n,O as o,S as a,a as c,E as h,i as l,s as d,c as u,m as p,f as m,g as v,b as g,d as f,A as b,T as w}from"./p-606ff863.js";import{C as y}from"./p-b4caf042.js";import{p as x}from"./p-f582db5c.js";import{c as k,v as C,a as _,b as P}from"./p-28678772.js";let R=class{constructor(i){t(this,i),this.moveDirection="right",this.contentGroups=[],this.activeContentGroup=0,this.mode="continuity",this.imageWidth=140,this.showScroll=!0,this.recommendations=[],this.columns=0,this.resizeObserver=new ResizeObserver((()=>this.handleResize())),this.mutationObserver=new MutationObserver((()=>this.cloneSlottedContent()))}connectedCallback(){this.setItemWidth()}disconnectedCallback(){this.resizeObserver.disconnect()}componentDidLoad(){this.setWidth(),this.processScrollbarWidth(),this.columns=this.getColumnsNumber();const t=this.el.querySelector(".content");this.mutationObserver.observe(t,{subtree:!0,childList:!0}),this.resizeObserver.observe(this.getHostParent())}getItemWidthFromDocument(){return parseInt(getComputedStyle(document.body).getPropertyValue("--vviinn-carousel-image-width"))}setItemWidth(){const t=this.getItemWidthFromDocument(),i=isNaN(t)?this.imageWidth:t;this.el.style.setProperty("--vviinn-carousel-image-width",`${i}px`)}getContentClassMap(){return{content:!0,[this.moveDirection]:!0,[this.mode]:!0,"show-scrollbar":this.showScroll}}handleResize(){this.setWidth(),this.processScrollbarWidth(),this.setItemWidth();const t=this.getColumnsNumber();t!==this.columns&&(this.columns=t)}calculateMoveStep(){const t=this.getContent().map((t=>t.getBoundingClientRect().width));return t.reduce(((t,i)=>t+i),0)/t.length}getHostParent(){return this.el.parentNode.host.parentElement}setWidth(){const t=this.getHostParent();if(!t)return;const i=getComputedStyle(t),e=t.getBoundingClientRect().width-(parseInt(i["padding-right"])+parseInt(i["padding-left"]));this.el.style.setProperty("--vviinn-carousel-content-width",`${e}px`)}getParent(){return this.el.parentNode.host.parentElement}cloneSlottedContent(){this.setWidth()}getActiveGroupIndex(){var t,i;if(!(null===(i=null===(t=this.getContentNode())||void 0===t?void 0:t.getBoundingClientRect())||void 0===i?void 0:i.left))return 0;const e=this.getContentGroups().map((t=>t.getBoundingClientRect().left)).map(((t,i)=>[t,i])).filter((t=>t[0]>=0));return e.length>0?e[0][1]:0}getContentNode(){return this.el.querySelector(".content")}getContent(){const t=this.getContentNode().children;return Array.from(t).map((t=>t))}getColumnsNumber(){const t=getComputedStyle(this.el).getPropertyValue("--vviinn-carousel-columns-internal");return parseInt(t)}getContentGroups(){return Array.from(this.el.querySelectorAll(".items-group"))}showNext(){this.moveDirection="right";const t=this.getContentNode();requestAnimationFrame((()=>{t.scrollTo({top:0,left:t.scrollLeft+this.calculateMoveStep(),behavior:"smooth"})}))}showPrev(){this.moveDirection="left";const t=this.getContentNode();requestAnimationFrame((()=>{t.scrollTo({top:0,left:t.scrollLeft-this.calculateMoveStep(),behavior:"smooth"})}))}scroll(t){const i=this.getContentNode();requestAnimationFrame((()=>{i.scrollTo({top:0,left:this.calculateMoveStep()*t,behavior:"smooth"})}))}processScrollbarWidth(){const t=this.getContentNode();this.el.style.setProperty("--vviinn-progressbar-width",t.clientWidth*((t.scrollLeft+t.clientWidth)/t.scrollWidth)+"px"),this.activeContentGroup=this.getActiveGroupIndex()}showBullets(){return"grid"===this.mode&&this.showScroll}showScrollbar(){return"continuity"===this.mode&&this.showScroll}getClassMap(){return{[this.mode]:!0,"show-scrollbar":this.showScrollbar()}}renderRecommendation(t,e){return i("vviinn-product-card",{part:"product-part",productId:t.productId,productTitle:t.title,deeplink:t.deeplink,image:t.image.thumbnail,brand:t.brand,imageWidth:this.imageWidth,imageRatio:1,price:t.price.actual,salePrice:t.price.sale,responsive:"grid"===this.mode,dimmedBackground:"continuity"===this.mode,index:e})}renderRecommendationGroup(t){return i("div",{class:"items-group"},t)}renderRecommendationGroups(t){return t.map((t=>this.renderRecommendationGroup(t)))}renderRecommendations(){return"grid"===this.mode?this.renderGrid():this.renderRecommendationsElements()}renderRecommendationsElements(){return this.recommendations.map(((t,i)=>this.renderRecommendation(t,i)))}renderGrid(){const t=this.renderRecommendationsElements(),i=n.chunksOf(this.getColumnsNumber())(t);return this.renderRecommendationGroups(i)}renderBullets(){const t=Math.ceil(this.recommendations.length/this.getColumnsNumber());return Array.from(Array(t).keys()).map((t=>i("div",{class:{bullet:!0,active:this.activeContentGroup===t},onClick:()=>this.scroll(t)})))}render(){return i(e,{class:this.getClassMap()},i("div",{class:Object.assign({body:!0},this.getClassMap())},i("button",{class:"prev",onClick:()=>this.showPrev(),part:"carousel-button"},i(y,null)),i("div",{class:this.getContentClassMap(),onScroll:()=>this.processScrollbarWidth()},this.renderRecommendations()),i("button",{class:"next",onClick:()=>this.showNext(),part:"carousel-button"},i(y,null))),this.showBullets()?i("div",{class:"bullets"},this.renderBullets()):"")}get el(){return s(this)}};R.style=":host{--vviinn-progressbar-width:0;--vviinn-carousel-item-width:150px;--vviinn-carousel-columns-internal:var(--vviinn-carousel-columns, 4);--vviinn-carousel-image-width-system:140px}.body{display:flex;position:relative;width:var(--vviinn-carousel-content-width);flex-direction:column}.content-wrapper *{box-sizing:border-box}.content-wrapper{overflow-y:hidden;overflow-x:auto;flex-grow:1}.bullets{margin-top:16px;display:flex;flex-direction:row;grid-gap:24px;justify-content:center}.bullet{width:10px;height:10px;background:#E0E0E0;border-radius:50%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) button{border-radius:2px}:host(.grid) button{border-radius:50%}button{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}button{fill:#525252}button.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";class S{sendImpression(t){var i,e,s;gtag("event","view_item_list",{items:[{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list_name:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}]})}sendClick(t){var i,e,s;gtag("event","select_content",{content_type:"product",items:[{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list_name:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}]})}}class I{constructor(){ga("require","ec")}convertProduct(t){var i,e,s;return{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",list:"VI VPR View",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}}sendImpression(t){ga("ec:addImpression",this.convertProduct(t))}sendClick(t){var i,e,s;ga("ec:addProduct",{id:t.productId,name:t.title,brand:null!==(i=t.brand)&&void 0!==i?i:"",category:null!==(e=t.productType)&&void 0!==e?e:"",price:Math.min(t.price.actual,null!==(s=t.price.sale)&&void 0!==s?s:1/0)}),ga("ec:setAction","click",{list:"VI VPR View"})}}const E=o.getMonoid(a.first()).concat(c.pipe(o.fromNullable(window.gtag),o.map((()=>new S))),c.pipe(o.fromNullable(window.ga),o.map((()=>new I)))),V=/fit\/\d+\//,j=(t,i)=>c.pipe((t=>c.pipe(t.match(V),h.fromNullable(t),h.map((()=>t))))(t),h.map((t=>t.replace(V,`fit/${i}/`))),h.getOrElse((()=>t))),A=(t,e)=>t.deeplink?i("a",{class:t.part,part:t.part,href:t.deeplink},e):e,z=t=>{var e;const s=new Intl.NumberFormat(t.locale,{minimumFractionDigits:2}).format(t.price),r=`${null!==(e=t.prefix)&&void 0!==e?e:""} ${s} ${t.currency}`;return i("span",{class:"price-amount",part:"price-amount"},r)},O=t=>{const e=i(z,{prefix:t.prefix,currency:t.currency,price:t.price,locale:t.locale});return i("span",{class:"price-container",part:"price-container"},t.salePrice?[i("span",{class:"price-sale",part:"price-sale"},i(z,{prefix:t.prefix,currency:t.currency,price:t.salePrice,locale:t.locale})),i("span",{class:"price-outdated",part:"price-outdated"},e)]:i("span",{class:"price-regular",part:"price-regular"},e))};let D=class{constructor(i){t(this,i),this.recommendationLoad=r(this,"recommendationLoad",7),this.recommendationView=r(this,"recommendationView",7),this.recommendationClick=r(this,"recommendationClick",7),this.productImageLoaded=r(this,"productImageLoaded",7),this.currency=void 0,this.imageRatio=1,this.imageWidth=200,this.locale=void 0,this.pricePrefix=void 0,this.responsive=!1,this.dimmedBackground=!1,this.index=0,this.imageLoaded=!1,this.productData=null,this.intersectionObserver=new IntersectionObserver(this.intersectionCallback.bind(this),{threshold:1})}connectedCallback(){this.productData={product:this.productId,rank:this.index}}intersectionCallback(t){t.some((t=>t.isIntersecting))&&(c.pipe(E,o.map((t=>t.sendImpression(this.getProduct())))),this.recommendationView.emit(this.productData),this.intersectionObserver.disconnect())}componentDidLoad(){this.recommendationLoad.emit(this.productData),this.intersectionObserver.observe(this.el),this.el.shadowRoot.querySelectorAll("a").forEach((t=>t.addEventListener("mousedown",(t=>{this.recommendationClick.emit(this.productData),window.ga&&t.preventDefault(),c.pipe(E,o.match((()=>null),(t=>t.sendClick(this.getProduct())))),window.ga&&ga("send","event","UX","click","Results",{hitCallback:function(){document.location.href=this.deeplink}})}))))}getProduct(){return l.results.find((t=>t.productId===this.productId))}renderImage(){const t={width:this.imageWidth,height:this.imageWidth*this.imageRatio,src:this.image,title:this.productTitle,lazy:!1};return this.responsive?((t,e=(()=>{}))=>i("picture",null,i("img",{loading:t.lazy?"lazy":"eager",part:"image",class:"image responsive",src:j(t.src,t.width),alt:t.title,onLoad:e})))(t,(()=>this.kek())):((t,e=(()=>{}))=>i("picture",null,i("img",{loading:t.lazy?"lazy":"eager",part:"image",class:"image",width:t.width,height:t.height,src:j(t.src,t.width),alt:t.title,onLoad:e})))(t,(()=>this.kek()))}kek(){this.productImageLoaded.emit(this.productId)}render(){var t,s,r;return i(e,{part:"product-card",class:{dimmed:this.dimmedBackground},exportparts:"brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title"},i(A,{deeplink:this.deeplink,part:"image-link"},this.renderImage()),i(A,{deeplink:this.deeplink,part:"deeplink"},i("span",{class:"title",part:"title"},this.productTitle)),i("span",{class:"brand",part:"brand"},this.brand),i("span",{class:"type",part:"type"},this.productType),i(O,{prefix:null!==(t=this.pricePrefix)&&void 0!==t?t:d.pricePrefix,currency:null!==(s=this.currency)&&void 0!==s?s:d.currencySign,price:this.price,salePrice:this.salePrice,locale:null!==(r=this.locale)&&void 0!==r?r:d.locale}))}get el(){return s(this)}};D.style=':host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:"";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}';const $=c.flow((t=>`Bearer ${t}`),(t=>new Headers({Authorization:t})),(t=>({headers:t}))),T=f(b),L=(t,i={})=>x(T(v(),g),m,u(p(t,i))),M=t=>i=>L(`product/${t}/similar-products`,i),N=t=>i=>L(`product/${t}/cross-selling-products`,i);function W(t){return"function"==typeof t}function F(t){const i=t((t=>{Error.call(t),t.stack=(new Error).stack}));return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}const B=F((t=>function(i){t(this),this.message=i?`${i.length} errors occurred during unsubscription:\n${i.map(((t,i)=>`${i+1}) ${t.toString()}`)).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=i}));function G(t,i){if(t){const e=t.indexOf(i);0<=e&&t.splice(e,1)}}class U{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;const{_parentage:i}=this;if(i)if(this._parentage=null,Array.isArray(i))for(const t of i)t.remove(this);else i.remove(this);const{initialTeardown:e}=this;if(W(e))try{e()}catch(i){t=i instanceof B?i.errors:[i]}const{_finalizers:s}=this;if(s){this._finalizers=null;for(const i of s)try{X(i)}catch(i){t=null!=t?t:[],i instanceof B?t=[...t,...i.errors]:t.push(i)}}if(t)throw new B(t)}}add(t){var i;if(t&&t!==this)if(this.closed)X(t);else{if(t instanceof U){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(i=this._finalizers)&&void 0!==i?i:[]).push(t)}}_hasParent(t){const{_parentage:i}=this;return i===t||Array.isArray(i)&&i.includes(t)}_addParent(t){const{_parentage:i}=this;this._parentage=Array.isArray(i)?(i.push(t),i):i?[i,t]:t}_removeParent(t){const{_parentage:i}=this;i===t?this._parentage=null:Array.isArray(i)&&G(i,t)}remove(t){const{_finalizers:i}=this;i&&G(i,t),t instanceof U&&t._removeParent(this)}}U.EMPTY=(()=>{const t=new U;return t.closed=!0,t})();const q=U.EMPTY;function H(t){return t instanceof U||t&&"closed"in t&&W(t.remove)&&W(t.add)&&W(t.unsubscribe)}function X(t){W(t)?t():t.unsubscribe()}const J={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},K={setTimeout(t,i,...e){const{delegate:s}=K;return(null==s?void 0:s.setTimeout)?s.setTimeout(t,i,...e):setTimeout(t,i,...e)},clearTimeout(t){const{delegate:i}=K;return((null==i?void 0:i.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Q(){}const Y=Z("C",void 0,void 0);function Z(t,i,e){return{kind:t,value:i,error:e}}function tt(t){t()}class it extends U{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,H(t)&&t.add(this)):this.destination=ct}static create(t,i,e){return new nt(t,i,e)}next(t){this.isStopped?at(function(t){return Z("N",t,void 0)}(t),this):this._next(t)}error(t){this.isStopped?at(Z("E",void 0,t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?at(Y,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const et=Function.prototype.bind;function st(t,i){return et.call(t,i)}class rt{constructor(t){this.partialObserver=t}next(t){const{partialObserver:i}=this;if(i.next)try{i.next(t)}catch(t){ot(t)}}error(t){const{partialObserver:i}=this;if(i.error)try{i.error(t)}catch(t){ot(t)}else ot(t)}complete(){const{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(t){ot(t)}}}class nt extends it{constructor(t,i,e){let s;if(super(),W(t)||!t)s={next:null!=t?t:void 0,error:null!=i?i:void 0,complete:null!=e?e:void 0};else{let i;this&&J.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),s={next:t.next&&st(t.next,i),error:t.error&&st(t.error,i),complete:t.complete&&st(t.complete,i)}):s=t}this.destination=new rt(s)}}function ot(t){var i;i=t,K.setTimeout((()=>{const{onUnhandledError:t}=J;if(!t)throw i;t(i)}))}function at(t,i){const{onStoppedNotification:e}=J;e&&K.setTimeout((()=>e(t,i)))}const ct={closed:!0,next:Q,error:function(t){throw t},complete:Q},ht="function"==typeof Symbol&&Symbol.observable||"@@observable";function lt(t){return t}class dt{constructor(t){t&&(this._subscribe=t)}lift(t){const i=new dt;return i.source=this,i.operator=t,i}subscribe(t,i,e){const s=(r=t)&&r instanceof it||function(t){return t&&W(t.next)&&W(t.error)&&W(t.complete)}(r)&&H(r)?t:new nt(t,i,e);var r;return tt((()=>{const{operator:t,source:i}=this;s.add(t?t.call(s,i):i?this._subscribe(s):this._trySubscribe(s))})),s}_trySubscribe(t){try{return this._subscribe(t)}catch(i){t.error(i)}}forEach(t,i){return new(i=ut(i))(((i,e)=>{const s=new nt({next:i=>{try{t(i)}catch(t){e(t),s.unsubscribe()}},error:e,complete:i});this.subscribe(s)}))}_subscribe(t){var i;return null===(i=this.source)||void 0===i?void 0:i.subscribe(t)}[ht](){return this}pipe(...t){return(0===(i=t).length?lt:1===i.length?i[0]:function(t){return i.reduce(((t,i)=>i(t)),t)})(this);var i}toPromise(t){return new(t=ut(t))(((t,i)=>{let e;this.subscribe((t=>e=t),(t=>i(t)),(()=>t(e)))}))}}function ut(t){var i;return null!==(i=null!=t?t:J.Promise)&&void 0!==i?i:Promise}dt.create=t=>new dt(t);const pt=F((t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}));class mt extends dt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){const i=new vt(this,this);return i.operator=t,i}_throwIfClosed(){if(this.closed)throw new pt}next(t){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const i of this.currentObservers)i.next(t)}}))}error(t){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;const{observers:i}=this;for(;i.length;)i.shift().error(t)}}))}complete(){tt((()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:t}=this;for(;t.length;)t.shift().complete()}}))}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){const{hasError:i,isStopped:e,observers:s}=this;return i||e?q:(this.currentObservers=null,s.push(t),new U((()=>{this.currentObservers=null,G(s,t)})))}_checkFinalizedStatuses(t){const{hasError:i,thrownError:e,isStopped:s}=this;i?t.error(e):s&&t.complete()}asObservable(){const t=new dt;return t.source=this,t}}mt.create=(t,i)=>new vt(t,i);class vt extends mt{constructor(t,i){super(),this.destination=t,this.source=i}next(t){var i,e;null===(e=null===(i=this.destination)||void 0===i?void 0:i.next)||void 0===e||e.call(i,t)}error(t){var i,e;null===(e=null===(i=this.destination)||void 0===i?void 0:i.error)||void 0===e||e.call(i,t)}complete(){var t,i;null===(i=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===i||i.call(t)}_subscribe(t){var i,e;return null!==(e=null===(i=this.source)||void 0===i?void 0:i.subscribe(t))&&void 0!==e?e:q}}let gt=class{constructor(i){t(this,i),this.recommendationsLoaded=r(this,"recommendationsLoaded",7),this.blockTitle="Recommended products",this.imageRatio=1,this.imageWidth=300,this.currencySign="€",this.mode="continuity",this.campaignType="VPR",this.locale="de-DE",this.apiPath="https://api.vviinn.com",this.useCarousel=!0,this.showScroll=!0,this.cssUrl=null,this.recommendations=[],this.loaded=!1,this.productImageLoadedSubject=new mt}handleProductIdChange(){this.getRecommendations()}handleCampaignTypeChange(){this.getRecommendations()}handleApiPathChange(t){d.apiPath=t,this.getRecommendations()}handleImageLoading({detail:t}){this.productImageLoadedSubject.next(t)}trackRecommendationView({detail:t}){const i=k(Object.assign({session_id:this.uiSessionId},t));this.trackingApi.trackEvent(i)}trackRecommendationClick({detail:t}){const i=k(Object.assign({session_id:this.uiSessionId},t));this.trackingApi.trackEvent(i)}connectedCallback(){d.apiPath=this.apiPath,d.currencySign=this.currencySign,d.locale=this.locale,this.uiSessionId=C(),this.trackingApi=_(this.apiPath,this.token);const t=P({action:"open",session_id:this.uiSessionId});this.trackingApi.trackEvent(t)}disconnectedCallback(){const t=P({action:"close",session_id:this.uiSessionId});this.trackingApi.trackEvent(t)}async componentWillLoad(){d.pricePrefix=this.pricePrefix,d.currencySign=this.currencySign,this.getRecommendations()}async getRecommendations(){if(void 0===this.productId||void 0===this.token)return;const t=this.campaignType.length>0?this.campaignType:"VPR",i=$(this.token),e=c.pipe(w.of((t=>{return c.pipe("VPR"===t?{_tag:"VPR"}:{_tag:"VCS"},(i=()=>M,e=()=>N,t=>(t=>"VPR"===t._tag)(t)?i():e()));var i,e})(t)),w.ap(w.of(this.productId)),w.ap(w.of(i)),w.flatten),s=await e();c.pipe(s,h.fold((t=>this.handleError(t)),(t=>this.handleRecommendationsSucces(t))))}handleError(t){console.log("ERROR:",t)}handleRecommendationsSucces(t){var i;this.recommendations=null!==(i=null==t?void 0:t.extended)&&void 0!==i?i:t,l.results=this.recommendations,this.loaded=!0,this.productIds=this.recommendations.map((t=>t.productId)),this.productImageLoadedSubject.subscribe((t=>{this.productIds=this.productIds.filter((i=>i!==t)),0===this.productIds.length&&this.recommendationsLoaded.emit()}))}isExternalCSS(){return this.cssUrl&&this.cssUrl.length>0}renderExternalCSS(){return this.isExternalCSS()?i("link",{href:this.cssUrl,rel:"stylesheet"}):""}render(){return i(e,{class:{loaded:this.loaded,empty:0==this.recommendations.length,[this.mode]:!0},"aria-hidden":this.loaded?"false":"true"},this.renderExternalCSS(),i("style",null,d.fallbackStyles),i("h2",{part:"recommendations-title"},this.blockTitle),this.useCarousel?this.renderCarousel():this.renderResults())}renderRecommendation(t,e){return i("vviinn-product-card",{part:"product-part",productId:t.productId,productTitle:t.title,deeplink:t.deeplink,image:t.image.thumbnail,brand:t.brand,imageWidth:this.imageWidth,imageRatio:1,price:t.price.actual,salePrice:t.price.sale,responsive:"grid"===this.mode,dimmedBackground:this.useDimmedBackgroundInCard(),index:e})}useDimmedBackgroundInCard(){return"continuity"===this.mode||!this.useCarousel}renderResults(){return i("div",{class:"recommendations-grid",part:"recommendations-grid"},this.recommendations.map(((t,i)=>this.renderRecommendation(t,i))))}renderCarousel(){return i("vviinn-carousel",{mode:this.mode,imageWidth:this.imageWidth,showScroll:this.showScroll,recommendations:this.recommendations})}get el(){return s(this)}static get watchers(){return{productId:["handleProductIdChange"],campaignType:["handleCampaignTypeChange"],apiPath:["handleApiPathChange"]}}};gt.style=":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.grid) vviinn-product-card::part(image){border:1px solid #DDDDDD;width:100%}h2{margin:0}vviinn-product-card::part(price-container){align-self:flex-start;text-align:left;display:flex}.results{display:grid;grid-gap:1rem}.visually-hidden{position:absolute;top:0;left:0;z-index:-1;height:0;width:0}h2{margin:0}:host(.grid) h2{justify-content:center}:host(.grid) vviinn-product-card::part(image){min-width:100%}:host(.grid) vviinn-product-card::part(image-link){width:100%}:host(.grid) vviinn-product-card::part(title),:host(.grid) vviinn-product-card::part(brand),:host(.grid) vviinn-product-card::part(type){text-align:center}:host(.grid) vviinn-product-card::part(price-container){align-self:center}:host(.continuity) vviinn-product-card::part(title),:host(.continuity) vviinn-product-card::part(brand),:host(.continuity) vviinn-product-card::part(type),:host(.continuity) vviinn-product-card::part(deeplink){text-align:left;max-width:unset;align-self:start}";export{R as vviinn_carousel,D as vviinn_product_card,gt as vviinn_vpr_widget}
@@ -1,6 +0,0 @@
1
- :host {
2
- --color-primary-system: #0F62FE;
3
- --color-primary-hover-system: #014CDA;
4
- --color-icons-system: #2F8EDF;
5
- --spacer: 8px;
6
- }