vviinn-widgets 2.2.2 → 2.3.0

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 (67) hide show
  1. package/dist/cjs/highlight-box_22.cjs.entry.js +1 -1
  2. package/dist/cjs/{index-c493804d.js → index-363cfe0b.js} +2 -2
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{vviinn-carousel_5.cjs.entry.js → vviinn-carousel_3.cjs.entry.js} +4 -90
  5. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +63 -0
  6. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +44 -0
  7. package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
  8. package/dist/cjs/vviinn-widgets.cjs.js +1 -1
  9. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +4 -0
  10. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +6 -3
  11. package/dist/collection/components/vviinn-icons/index.js +2 -2
  12. package/dist/collection/components/vviinn-product-card/stories/args.js +73 -0
  13. package/dist/collection/components/vviinn-product-card/stories/decorators.js +51 -0
  14. package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +105 -0
  15. package/dist/collection/components/vviinn-vpr-button/stories/args.js +207 -0
  16. package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +89 -0
  17. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +11 -4
  18. package/dist/collection/components/vviinn-vpr-widget/stories/args.js +190 -0
  19. package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +29 -0
  20. package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +212 -0
  21. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +1 -0
  22. package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +31 -0
  23. package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +33 -0
  24. package/dist/esm/highlight-box_22.entry.js +1 -1
  25. package/dist/esm/{index-8cb063df.js → index-9e125c6c.js} +3 -3
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/{vviinn-carousel_5.entry.js → vviinn-carousel_3.entry.js} +5 -89
  28. package/dist/esm/vviinn-recommendations-sidebar.entry.js +59 -0
  29. package/dist/esm/vviinn-vpr-button.entry.js +40 -0
  30. package/dist/esm/vviinn-vps-button.entry.js +1 -1
  31. package/dist/esm/vviinn-widgets.js +1 -1
  32. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +3 -0
  33. package/dist/types/components/vviinn-product-card/stories/args.d.ts +73 -0
  34. package/dist/types/components/vviinn-product-card/stories/decorators.d.ts +1 -0
  35. package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +80 -0
  36. package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +207 -0
  37. package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +214 -0
  38. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +3 -0
  39. package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +198 -0
  40. package/dist/types/components/vviinn-vpr-widget/stories/decorators.d.ts +2 -0
  41. package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +141 -0
  42. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -0
  43. package/dist/types/components/vviinn-vps-button/stories/vviinn-vps-button.stories.d.ts +12 -0
  44. package/dist/types/components/{vviinn-vpr-button/stories/kek.stories.d.ts → vviinn-vps-widget/stories/vviinn-vps-widget.stories.d.ts} +5 -2
  45. package/dist/vviinn-widgets/{p-56fc949a.js → p-126775a2.js} +1 -1
  46. package/dist/vviinn-widgets/p-1f0c8cf6.entry.js +1 -0
  47. package/dist/vviinn-widgets/p-3734a3ef.entry.js +1 -0
  48. package/{www/build/p-d085199d.entry.js → dist/vviinn-widgets/p-71809bed.entry.js} +1 -1
  49. package/dist/vviinn-widgets/p-9ea96a69.entry.js +1 -0
  50. package/dist/vviinn-widgets/p-a95c00c9.entry.js +1 -0
  51. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  52. package/package.json +1 -1
  53. package/www/build/{p-56fc949a.js → p-126775a2.js} +1 -1
  54. package/www/build/p-1f0c8cf6.entry.js +1 -0
  55. package/www/build/p-3734a3ef.entry.js +1 -0
  56. package/www/build/p-4379b1c2.js +1 -0
  57. package/{dist/vviinn-widgets/p-d085199d.entry.js → www/build/p-71809bed.entry.js} +1 -1
  58. package/www/build/p-9ea96a69.entry.js +1 -0
  59. package/www/build/p-a95c00c9.entry.js +1 -0
  60. package/www/build/vviinn-widgets.esm.js +1 -1
  61. package/www/index.html +4 -74
  62. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +0 -18
  63. package/dist/vviinn-widgets/p-04b06ea9.entry.js +0 -1
  64. package/dist/vviinn-widgets/p-400eb62f.entry.js +0 -1
  65. package/www/build/p-04b06ea9.entry.js +0 -1
  66. package/www/build/p-400eb62f.entry.js +0 -1
  67. package/www/build/p-7e4978d5.js +0 -1
@@ -1 +0,0 @@
1
- import{r as t,h as i,H as e,g as r,c as n}from"./p-e1ba8626.js";import{_ as s,O as o,S as a,a as l,E as c,i as h,s as d,c as u,m as p,f as m,g,b as v,d as b,A as f,e as w,T as x}from"./p-59edfbe2.js";import{C as y,a as k,V as C}from"./p-56fc949a.js";import{p as _}from"./p-f582db5c.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){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})}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=>this.renderRecommendation(t)))}renderGrid(){const t=this.renderRecommendationsElements(),i=s.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()},i(y,null)),i("div",{class:this.getContentClassMap(),onScroll:()=>this.processScrollbarWidth()},this.renderRecommendations()),i("button",{class:"next",onClick:()=>this.showNext()},i(y,null))),this.showBullets()?i("div",{class:"bullets"},this.renderBullets()):"")}get el(){return r(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.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 I{sendImpression(t){var i,e,r;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!==(r=t.price.sale)&&void 0!==r?r:1/0)}]})}sendClick(t){var i,e,r;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!==(r=t.price.sale)&&void 0!==r?r:1/0)}]})}}class S{constructor(){ga("require","ec")}convertProduct(t){var i,e,r;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!==(r=t.price.sale)&&void 0!==r?r:1/0)}}sendImpression(t){ga("ec:addImpression",this.convertProduct(t))}sendClick(t){var i,e,r;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!==(r=t.price.sale)&&void 0!==r?r:1/0)}),ga("ec:setAction","click",{list:"VI VPR View"})}}const P=o.getMonoid(a.first()).concat(l.pipe(o.fromNullable(window.gtag),o.map((()=>new I))),l.pipe(o.fromNullable(window.ga),o.map((()=>new S)))),F=/fit\/\d+\//,E=(t,i)=>l.pipe((t=>l.pipe(t.match(F),c.fromNullable(t),c.map((()=>t))))(t),c.map((t=>t.replace(F,`fit/${i}/`))),c.getOrElse((()=>t))),O=(t,e)=>t.deeplink?i("a",{class:t.part,part:t.part,href:t.deeplink},e):e,V=t=>{var e;const r=new Intl.NumberFormat(t.locale,{minimumFractionDigits:2}).format(t.price),n=`${null!==(e=t.prefix)&&void 0!==e?e:""} ${r} ${t.currency}`;return i("span",{class:"price-amount",part:"price-amount"},n)},z=t=>{const e=i(V,{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(V,{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 j=class{constructor(i){t(this,i),this.recommendationLoad=n(this,"recommendationLoad",7),this.recommendationView=n(this,"recommendationView",7),this.recommendationClick=n(this,"recommendationClick",7),this.productImageLoaded=n(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.imageLoaded=!1,this.intersectionObserver=new IntersectionObserver(this.intersectionCallback.bind(this),{threshold:1})}intersectionCallback(t){t.some((t=>t.isIntersecting))&&(l.pipe(P,o.map((t=>t.sendImpression(this.getProduct())))),this.recommendationView.emit(this.productId),this.intersectionObserver.disconnect())}componentDidLoad(){this.recommendationLoad.emit(this.productId),this.intersectionObserver.observe(this.el),this.el.shadowRoot.querySelectorAll("a").forEach((t=>t.addEventListener("mousedown",(t=>{this.recommendationClick.emit(this.productId),window.ga&&t.preventDefault(),l.pipe(P,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 h.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:E(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:E(t.src,t.width),alt:t.title,onLoad:e})))(t,(()=>this.kek()))}kek(){this.productImageLoaded.emit(this.productId)}render(){var t,r,n;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(O,{deeplink:this.deeplink,part:"image-link"},this.renderImage()),i(O,{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(z,{prefix:null!==(t=this.pricePrefix)&&void 0!==t?t:d.pricePrefix,currency:null!==(r=this.currency)&&void 0!==r?r:d.currencySign,price:this.price,salePrice:this.salePrice,locale:null!==(n=this.locale)&&void 0!==n?n:d.locale}))}get el(){return r(this)}};j.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}';let A=class{constructor(i){t(this,i),this.modalClosed=n(this,"modalClosed",7),this.position="bottom",this.sourceImage=null,this.widgetScrollbar=!1,this.state="idle"}bodyClickListener(t){const{clientX:i,clientY:e}=t,r=this.getSidebarRectangle();r&&(i>=r.left&&i<=r.right&&e>=r.top&&e<=r.bottom||(this.state="closed"))}getClassMap(){return{[this.position]:!0,[this.state]:!0}}getSidebarRectangle(){var t;return null===(t=this.el.shadowRoot.querySelector("aside"))||void 0===t?void 0:t.getBoundingClientRect()}render(){return i(e,{class:this.getClassMap()},i("aside",{class:"sidebar",part:"body",onAnimationEnd:t=>this.handleAnimationEnd(t)},i("header",{class:{"contains-source-img":this.isSourceImageValid()},part:"sidebar-header"},this.isSourceImageValid()?this.renderSourceImage():null,i("span",{class:"title",part:"title"},this.sidebarTitle),i("button",{class:"close-sidebar",onClick:()=>this.state="closed"},i(k,null))),i("main",{part:"sidebar-content"},i("vviinn-vpr-widget",{exportparts:"brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title",token:this.token,productId:this.productId,imageWidth:300,blockTitle:"",mode:"bottom"===this.position?"continuity":"grid",useCarousel:"bottom"===this.position,onRecommendationsLoaded:()=>this.state="open",showScroll:this.widgetScrollbar}))))}renderSourceImage(){return i("img",{class:"source-image",part:"source-image",src:this.sourceImage})}isSourceImageValid(){var t;return(null===(t=this.sourceImage)||void 0===t?void 0:t.length)>0}handleAnimationEnd({animationName:t}){t.includes("slideOut")&&this.modalClosed.emit()}get el(){return r(this)}};A.style=":host{--vviinn-carousel-columns:0;box-sizing:border-box;display:block;display:flex;height:100vh;left:0;position:fixed;top:0;transition:background 0.1s ease-in-out;width:100vw}:host(.open){background:rgba(0, 0, 0, 0.2)}:host(.bottom){flex-direction:column;justify-content:end}:host(.right){flex-direction:row;justify-content:flex-end}header{position:relative;text-align:center;padding:32px}header.contains-source-img{display:grid;justify-items:center;grid-gap:12px}img.source-image{width:64px;height:64px;border-radius:50%;box-shadow:0px 2px 4px rgba(0, 0, 0, 0.15);padding:8px}:host(.right) header{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.1)}main{padding:0 24px}:host(.right) main{overflow:auto}.sidebar{background:white;box-sizing:border-box;display:flex;flex-direction:column}:host(.bottom.idle) .sidebar,:host(.bottom.closed) .sidebar{transform:translateY(100%)}:host(.bottom.closed) .sidebar{-webkit-animation-name:slideOutFromBottom;animation-name:slideOutFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.bottom.open) .sidebar{-webkit-animation-name:slideInFromBottom;animation-name:slideInFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.idle) .sidebar{transform:translateX(100%)}:host(.right.closed) .sidebar{-webkit-animation-name:slideOutFromRight;animation-name:slideOutFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.open) .sidebar{-webkit-animation-name:slideInFromRight;animation-name:slideInFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right) .sidebar{max-width:480px}:host(.right) vviinn-vpr-widget::part(recommendations-grid){display:grid;grid-template-columns:repeat(2, 1fr);grid-gap:24px}:host(.right) vviinn-vpr-widget{overflow:auto}:host(.right) vviinn-vpr-widget::part(image){border:none}.title{font-style:normal;font-weight:500;font-size:28px;line-height:40px;text-align:center;color:#000000}vviinn-vpr-widget::part(title),vviinn-vpr-widget::part(brand),vviinn-vpr-widget::part(type){text-align:left}vviinn-vpr-widget::part(price-container){align-self:start}.close-sidebar{background:transparent;border:none;cursor:pointer;margin:0;padding:0;position:absolute;right:24px;top:24px}@-webkit-keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@-webkit-keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@-webkit-keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@-webkit-keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}";let B=class{constructor(i){t(this,i),this.position="bottom",this.sourceImage=null,this.sidebarTitle="Visually similar products",this.modalScrollbar=!1}render(){return i(e,null,i("button",{class:"open-button",part:"button",onClick:()=>this.handleClick()},i("slot",null,i(C,null))))}handleClick(){const t=document.createElement("vviinn-recommendations-sidebar");t.sidebarTitle=this.sidebarTitle,t.productId=this.productId,t.token=this.token,t.position=this.position,t.sourceImage=this.sourceImage,t.widgetScrollbar=this.modalScrollbar,t.addEventListener("modalClosed",(()=>{document.body.removeChild(t)})),document.body.append(t)}};B.style=":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#F4F4F4;outline:none}";const D=l.flow((t=>`Bearer ${t}`),(t=>new Headers({Authorization:t})),(t=>({headers:t}))),$=b(f),T=(t,i={})=>_($(g(),v),m,u(p(t,i))),L=t=>i=>T(`product/${t}/similar-products`,i),X=t=>i=>T(`product/${t}/cross-selling-products`,i);function M(t){return"function"==typeof t}function N(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 Y=N((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 W(t,i){if(t){const e=t.indexOf(i);0<=e&&t.splice(e,1)}}class G{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(M(e))try{e()}catch(i){t=i instanceof Y?i.errors:[i]}const{_finalizers:r}=this;if(r){this._finalizers=null;for(const i of r)try{H(i)}catch(i){t=null!=t?t:[],i instanceof Y?t=[...t,...i.errors]:t.push(i)}}if(t)throw new Y(t)}}add(t){var i;if(t&&t!==this)if(this.closed)H(t);else{if(t instanceof G){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)&&W(i,t)}remove(t){const{_finalizers:i}=this;i&&W(i,t),t instanceof G&&t._removeParent(this)}}G.EMPTY=(()=>{const t=new G;return t.closed=!0,t})();const U=G.EMPTY;function q(t){return t instanceof G||t&&"closed"in t&&M(t.remove)&&M(t.add)&&M(t.unsubscribe)}function H(t){M(t)?t():t.unsubscribe()}const J={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},K={setTimeout(t,i,...e){const{delegate:r}=K;return(null==r?void 0:r.setTimeout)?r.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 Z=tt("C",void 0,void 0);function tt(t,i,e){return{kind:t,value:i,error:e}}function it(t){t()}class et extends G{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,q(t)&&t.add(this)):this.destination=ct}static create(t,i,e){return new ot(t,i,e)}next(t){this.isStopped?lt(function(t){return tt("N",t,void 0)}(t),this):this._next(t)}error(t){this.isStopped?lt(tt("E",void 0,t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?lt(Z,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 rt=Function.prototype.bind;function nt(t,i){return rt.call(t,i)}class st{constructor(t){this.partialObserver=t}next(t){const{partialObserver:i}=this;if(i.next)try{i.next(t)}catch(t){at(t)}}error(t){const{partialObserver:i}=this;if(i.error)try{i.error(t)}catch(t){at(t)}else at(t)}complete(){const{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(t){at(t)}}}class ot extends et{constructor(t,i,e){let r;if(super(),M(t)||!t)r={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(),r={next:t.next&&nt(t.next,i),error:t.error&&nt(t.error,i),complete:t.complete&&nt(t.complete,i)}):r=t}this.destination=new st(r)}}function at(t){var i;i=t,K.setTimeout((()=>{const{onUnhandledError:t}=J;if(!t)throw i;t(i)}))}function lt(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 dt(t){return t}class ut{constructor(t){t&&(this._subscribe=t)}lift(t){const i=new ut;return i.source=this,i.operator=t,i}subscribe(t,i,e){const r=(n=t)&&n instanceof et||function(t){return t&&M(t.next)&&M(t.error)&&M(t.complete)}(n)&&q(n)?t:new ot(t,i,e);var n;return it((()=>{const{operator:t,source:i}=this;r.add(t?t.call(r,i):i?this._subscribe(r):this._trySubscribe(r))})),r}_trySubscribe(t){try{return this._subscribe(t)}catch(i){t.error(i)}}forEach(t,i){return new(i=pt(i))(((i,e)=>{const r=new ot({next:i=>{try{t(i)}catch(t){e(t),r.unsubscribe()}},error:e,complete:i});this.subscribe(r)}))}_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?dt:1===i.length?i[0]:function(t){return i.reduce(((t,i)=>i(t)),t)})(this);var i}toPromise(t){return new(t=pt(t))(((t,i)=>{let e;this.subscribe((t=>e=t),(t=>i(t)),(()=>t(e)))}))}}function pt(t){var i;return null!==(i=null!=t?t:J.Promise)&&void 0!==i?i:Promise}ut.create=t=>new ut(t);const mt=N((t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}));class gt extends ut{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 mt}next(t){it((()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const i of this.currentObservers)i.next(t)}}))}error(t){it((()=>{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(){it((()=>{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:r}=this;return i||e?U:(this.currentObservers=null,r.push(t),new G((()=>{this.currentObservers=null,W(r,t)})))}_checkFinalizedStatuses(t){const{hasError:i,thrownError:e,isStopped:r}=this;i?t.error(e):r&&t.complete()}asObservable(){const t=new ut;return t.source=this,t}}gt.create=(t,i)=>new vt(t,i);class vt extends gt{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:U}}let bt=class{constructor(i){t(this,i),this.recommendationsLoaded=n(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 gt}handleProductIdChange(){this.getRecommendations()}handleCampaignTypeChange(){this.getRecommendations()}handleApiPathChange(t){w.apiPath=t,this.getRecommendations()}lol({detail:t}){this.productImageLoadedSubject.next(t)}connectedCallback(){w.apiPath=this.apiPath,w.currencySign=this.currencySign,w.locale=this.locale}async componentWillLoad(){w.pricePrefix=this.pricePrefix,w.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=D(this.token),e=l.pipe(x.of((t=>{return l.pipe("VPR"===t?{_tag:"VPR"}:{_tag:"VCS"},(i=()=>L,e=()=>X,t=>(t=>"VPR"===t._tag)(t)?i():e()));var i,e})(t)),x.ap(x.of(this.productId)),x.ap(x.of(i)),x.flatten),r=await e();l.pipe(r,c.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,h.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,w.fallbackStyles),i("h2",{part:"recommendations-title"},this.blockTitle),this.useCarousel?this.renderCarousel():this.renderResults())}renderRecommendation(t){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()})}useDimmedBackgroundInCard(){return"continuity"===this.mode||!this.useCarousel}renderResults(){return i("div",{class:"recommendations-grid",part:"recommendations-grid"},this.recommendations.map((t=>this.renderRecommendation(t))))}renderCarousel(){return i("vviinn-carousel",{mode:this.mode,imageWidth:this.imageWidth,showScroll:this.showScroll,recommendations:this.recommendations})}get el(){return r(this)}static get watchers(){return{productId:["handleProductIdChange"],campaignType:["handleCampaignTypeChange"],apiPath:["handleApiPathChange"]}}};bt.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,j as vviinn_product_card,A as vviinn_recommendations_sidebar,B as vviinn_vpr_button,bt as vviinn_vpr_widget}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as i,H as s,g as r}from"./p-e1ba8626.js";import{b as n}from"./p-56fc949a.js";import{S as a}from"./p-e67cae57.js";let o=class{constructor(i){t(this,i),this.globalSlotsChanged=e(this,"globalSlotsChanged",7),this.currencySign="€",this.locale="de-DE",this.pressed=!1}handleModalClosed(){this.pressed=!1}componentDidLoad(){const t=this.el.querySelectorAll("[slot]");this.globalSlotsChanged.emit(Array.from(t))}handleKeyDown(t){"Enter"!==t.code&&"Space"!==t.code||(this.pressed=!0)}handleClick(){this.pressed=!0}render(){return i(s,{tabindex:"0",role:"button",pressed:this.pressed,onClick:()=>this.handleClick(),onKeyDown:t=>this.handleKeyDown(t)},i("slot",null,i(n,null)),i(a,null),i("vviinn-vps-widget",{active:this.pressed,"currency-sign":"€",token:this.token,locale:this.locale,apiPath:this.apiPath,exportparts:"brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, product-card"}))}get el(){return r(this)}};o.style="";export{o as vviinn_vps_button}
@@ -1 +0,0 @@
1
- import{p as e,b as i}from"./p-eeebf5c1.js";import{g as r}from"./p-14642ddc.js";(()=>{const i=import.meta.url,r={};return""!==i&&(r.resourcesUrl=new URL(".",i).href),e(r)})().then((e=>(r(),i([["p-a5ce3c24",[[1,"cropper-handler",{handler:[16],disabled:[4]}]]],["p-aa8b1a7c",[[1,"vviinn-error"]]],["p-8121aaaf",[[1,"vviinn-preloader"]]],["p-18ac2f3d",[[1,"vviinn-vpr-button",{token:[1],productId:[1,"product-id"],position:[1],sourceImage:[1,"source-image"],sidebarTitle:[1,"sidebar-title"],modalScrollbar:[4,"modal-scrollbar"]}],[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"]]],[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","lol"]]],[0,"vviinn-carousel",{mode:[1],imageWidth:[2,"image-width"],showScroll:[4,"show-scroll"],recommendations:[16],moveDirection:[32],contentGroups:[32],activeContentGroup:[32]}],[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"],imageLoaded:[32]}]]],["p-66eabc19",[[1,"vviinn-image-view"],[1,"vviinn-onboarding"],[1,"vviinn-example-images",null,[[0,"exampleImageSelected","handleImageSelection"],[0,"exampleImageError","handleImageSelectionError"]]],[1,"vviinn-overlayed-modal",{active:[4]}],[1,"vviinn-empty-results"],[1,"vviinn-image-selector"],[1,"vviinn-server-error"],[1,"vviinn-wrong-format"],[1,"search-filters",{filter:[16],selectedCategoryId:[32],hideFilters:[32]}],[1,"vviinn-privacy-badge"],[1,"vviinn-teaser"],[1,"image-cropper",{disabled:[4],handleMove:[32]}],[1,"vviinn-example-image",{src:[1],width:[2],height:[2],selected:[32]}],[1,"highlight-box"],[1,"vviinn-detected-object",{detectedObject:[16],position:[32]}],[1,"vviinn-modal",{active:[1540],slider:[32]}],[1,"vviinn-onboarding-card-1"],[1,"vviinn-onboarding-card-2"],[1,"vviinn-onboarding-card-3"],[1,"vviinn-overlay"],[1,"vviinn-slide"],[1,"vviinn-slider",{showBullets:[4,"show-bullets"],position:[514],showArrows:[4,"show-arrows"],elementsCount:[32],internalPosition:[32],swipeStartPosition:[32]}]]],["p-3e2d79ef",[[1,"vviinn-vps-widget",{token:[1],apiPath:[1,"api-path"],active:[1028],currencySign:[1,"currency-sign"],locale:[1],slidePosition:[32],width:[32],wrongImageFormat:[32]}]]],["p-1d6cbd1d",[[1,"vviinn-vps-button",{token:[1],currencySign:[1,"currency-sign"],locale:[1],apiPath:[1,"api-path"],pressed:[32]},[[0,"modalClosed","handleModalClosed"]]]]]],e))));