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.
- package/dist/cjs/{app-globals-474864e0.js → app-globals-af9e1c96.js} +1 -1
- package/dist/cjs/cropper-handler.cjs.entry.js +1 -1
- package/dist/cjs/{customized-slots-0aa6c3d6.js → customized-slots-dc70586b.js} +1 -1
- package/dist/cjs/highlight-box_22.cjs.entry.js +4 -4
- package/dist/cjs/{imageSearch.store-076370bf.js → imageSearch.store-e11fb912.js} +1 -1
- package/dist/cjs/{index-61403ab1.js → index-07d3d672.js} +1 -1
- package/dist/cjs/{index-34d20028.js → index-135d1612.js} +14 -1
- package/dist/cjs/{index-a87f1a44.js → index-7e558d0b.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/vviinn-carousel_3.cjs.entry.js +15 -19
- package/dist/cjs/vviinn-error.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-preloader.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +3 -3
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +11 -7
- package/dist/cjs/vviinn-widgets.cjs.js +2 -2
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +4 -12
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +8 -4
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +8 -4
- package/dist/esm/{app-globals-3888cd41.js → app-globals-c988b07f.js} +1 -1
- package/dist/esm/cropper-handler.entry.js +1 -1
- package/dist/esm/{customized-slots-863113e2.js → customized-slots-62974f69.js} +1 -1
- package/dist/esm/highlight-box_22.entry.js +4 -4
- package/dist/esm/{imageSearch.store-b516d12e.js → imageSearch.store-5e2c3094.js} +1 -1
- package/dist/esm/{index-2f8fb0fe.js → index-412e5674.js} +13 -2
- package/dist/esm/{index-56c062df.js → index-4600de03.js} +1 -1
- package/dist/esm/{index-36978848.js → index-d0a661ce.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/vviinn-carousel_3.entry.js +15 -19
- package/dist/esm/vviinn-error.entry.js +1 -1
- package/dist/esm/vviinn-preloader.entry.js +2 -2
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +2 -2
- package/dist/esm/vviinn-vpr-button.entry.js +2 -2
- package/dist/esm/vviinn-vps-button.entry.js +3 -3
- package/dist/esm/vviinn-vps-widget.entry.js +11 -7
- package/dist/esm/vviinn-widgets.js +2 -2
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -1
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +1 -1
- package/dist/vviinn-widgets/{p-c853cba8.js → p-11d26656.js} +1 -1
- package/dist/vviinn-widgets/{p-9cc6f0dd.entry.js → p-1bf0bfea.entry.js} +1 -1
- package/dist/vviinn-widgets/p-34d7d8fa.entry.js +1 -0
- package/dist/vviinn-widgets/p-521ba041.entry.js +1 -0
- package/dist/vviinn-widgets/{p-47183c9a.js → p-545ef9fd.js} +1 -1
- package/dist/vviinn-widgets/{p-f9410382.entry.js → p-62060afb.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-0a9cee09.entry.js → p-79de17a4.entry.js} +1 -1
- package/{www/build/p-606ff863.js → dist/vviinn-widgets/p-7ec49ce4.js} +1 -1
- package/dist/vviinn-widgets/{p-2e6ecda7.entry.js → p-8ddb0d28.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-d8d49616.entry.js → p-916817f8.entry.js} +1 -1
- package/{www/build/p-ac0a2989.js → dist/vviinn-widgets/p-9abc276d.js} +1 -1
- package/dist/vviinn-widgets/{p-b547a6d0.entry.js → p-b8932639.entry.js} +1 -1
- package/{www/build/p-535611cd.entry.js → dist/vviinn-widgets/p-c26d41ac.entry.js} +1 -1
- package/{www/build/p-28678772.js → dist/vviinn-widgets/p-d3b98fa3.js} +1 -1
- package/dist/vviinn-widgets/{p-b4caf042.js → p-eff93fbd.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/{p-c853cba8.js → p-11d26656.js} +1 -1
- package/www/build/{p-9cc6f0dd.entry.js → p-1bf0bfea.entry.js} +1 -1
- package/www/build/p-34d7d8fa.entry.js +1 -0
- package/www/build/p-521ba041.entry.js +1 -0
- package/www/build/{p-47183c9a.js → p-545ef9fd.js} +1 -1
- package/www/build/{p-f9410382.entry.js → p-62060afb.entry.js} +1 -1
- package/www/build/{p-0a9cee09.entry.js → p-79de17a4.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-606ff863.js → www/build/p-7ec49ce4.js} +1 -1
- package/www/build/p-8bfb73d1.js +1 -0
- package/www/build/{p-2e6ecda7.entry.js → p-8ddb0d28.entry.js} +1 -1
- package/www/build/{p-d8d49616.entry.js → p-916817f8.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-ac0a2989.js → www/build/p-9abc276d.js} +1 -1
- package/www/build/p-a67898be.css +1 -0
- package/www/build/{p-b547a6d0.entry.js → p-b8932639.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-535611cd.entry.js → www/build/p-c26d41ac.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-28678772.js → www/build/p-d3b98fa3.js} +1 -1
- package/www/build/{p-b4caf042.js → p-eff93fbd.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/vviinn-widgets/p-ad29e9c5.entry.js +0 -1
- package/dist/vviinn-widgets/p-d2097302.entry.js +0 -1
- package/www/build/p-7c313f33.js +0 -125
- package/www/build/p-ad29e9c5.entry.js +0 -1
- package/www/build/p-d2097302.entry.js +0 -1
- package/www/build/p-e0153ae2.css +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as e,g as s,c as r}from"./p-545ef9fd.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-7ec49ce4.js";import{C as y}from"./p-eff93fbd.js";import{p as x}from"./p-f582db5c.js";import{c as k,a as C,v as _,b as P,d as R}from"./p-d3b98fa3.js";let S=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)}};S.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 I{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 E{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 V=o.getMonoid(a.first()).concat(c.pipe(o.fromNullable(window.gtag),o.map((()=>new I))),c.pipe(o.fromNullable(window.ga),o.map((()=>new E)))),j=/fit\/\d+\//,A=(t,i)=>c.pipe((t=>c.pipe(t.match(j),h.fromNullable(t),h.map((()=>t))))(t),h.map((t=>t.replace(j,`fit/${i}/`))),h.getOrElse((()=>t))),z=(t,e)=>t.deeplink?i("a",{class:t.part,part:t.part,href:t.deeplink},e):e,O=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)},D=t=>{const e=i(O,{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(O,{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 $=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(V,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("click",(t=>{t.preventDefault(),t.stopImmediatePropagation(),this.recommendationClick.emit(this.productData),c.pipe(V,o.match((()=>null),(t=>t.sendClick(this.getProduct()))))}))))}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:A(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:A(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(z,{deeplink:this.deeplink,part:"image-link"},this.renderImage()),i(z,{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(D,{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)}};$.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 T=c.flow((t=>`Bearer ${t}`),(t=>new Headers({Authorization:t})),(t=>({headers:t}))),L=f(b),M=(t,i={})=>x(L(v(),g),m,u(p(t,i))),N=t=>i=>M(`product/${t}/similar-products`,i),W=t=>i=>M(`product/${t}/cross-selling-products`,i);function F(t){return"function"==typeof t}function B(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 G=B((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 q(t,i){if(t){const e=t.indexOf(i);0<=e&&t.splice(e,1)}}class H{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(F(e))try{e()}catch(i){t=i instanceof G?i.errors:[i]}const{_finalizers:s}=this;if(s){this._finalizers=null;for(const i of s)try{K(i)}catch(i){t=null!=t?t:[],i instanceof G?t=[...t,...i.errors]:t.push(i)}}if(t)throw new G(t)}}add(t){var i;if(t&&t!==this)if(this.closed)K(t);else{if(t instanceof H){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)&&q(i,t)}remove(t){const{_finalizers:i}=this;i&&q(i,t),t instanceof H&&t._removeParent(this)}}H.EMPTY=(()=>{const t=new H;return t.closed=!0,t})();const U=H.EMPTY;function J(t){return t instanceof H||t&&"closed"in t&&F(t.remove)&&F(t.add)&&F(t.unsubscribe)}function K(t){F(t)?t():t.unsubscribe()}const Q={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},X={setTimeout(t,i,...e){const{delegate:s}=X;return(null==s?void 0:s.setTimeout)?s.setTimeout(t,i,...e):setTimeout(t,i,...e)},clearTimeout(t){const{delegate:i}=X;return((null==i?void 0:i.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Y(){}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 H{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,J(t)&&t.add(this)):this.destination=ht}static create(t,i,e){return new ot(t,i,e)}next(t){this.isStopped?ct(function(t){return tt("N",t,void 0)}(t),this):this._next(t)}error(t){this.isStopped?ct(tt("E",void 0,t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?ct(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 st=Function.prototype.bind;function rt(t,i){return st.call(t,i)}class nt{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 s;if(super(),F(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&&Q.useDeprecatedNextContext?(i=Object.create(t),i.unsubscribe=()=>this.unsubscribe(),s={next:t.next&&rt(t.next,i),error:t.error&&rt(t.error,i),complete:t.complete&&rt(t.complete,i)}):s=t}this.destination=new nt(s)}}function at(t){var i;i=t,X.setTimeout((()=>{const{onUnhandledError:t}=Q;if(!t)throw i;t(i)}))}function ct(t,i){const{onStoppedNotification:e}=Q;e&&X.setTimeout((()=>e(t,i)))}const ht={closed:!0,next:Y,error:function(t){throw t},complete:Y},lt="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 s=(r=t)&&r instanceof et||function(t){return t&&F(t.next)&&F(t.error)&&F(t.complete)}(r)&&J(r)?t:new ot(t,i,e);var r;return it((()=>{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=pt(i))(((i,e)=>{const s=new ot({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)}[lt](){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:Q.Promise)&&void 0!==i?i:Promise}ut.create=t=>new ut(t);const mt=B((t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}));class vt 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 gt(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:s}=this;return i||e?U:(this.currentObservers=null,s.push(t),new H((()=>{this.currentObservers=null,q(s,t)})))}_checkFinalizedStatuses(t){const{hasError:i,thrownError:e,isStopped:s}=this;i?t.error(e):s&&t.complete()}asObservable(){const t=new ut;return t.source=this,t}}vt.create=(t,i)=>new gt(t,i);class gt extends vt{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 ft=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 vt}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)}async trackRecommendationClick({detail:t}){const i=C(Object.assign({session_id:this.uiSessionId},t));await this.trackingApi.trackEvent(i);const e=this.recommendations.find((i=>i.productId===t.product));e&&e.deeplink&&(window.location.href=e.deeplink)}connectedCallback(){d.apiPath=this.apiPath,d.currencySign=this.currencySign,d.locale=this.locale,this.uiSessionId=_(),this.trackingApi=P(this.apiPath,this.token);const t=R({action:"open",session_id:this.uiSessionId});this.trackingApi.trackEvent(t)}disconnectedCallback(){const t=R({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=T(this.token),e=c.pipe(w.of((t=>{return c.pipe("VPR"===t?{_tag:"VPR"}:{_tag:"VCS"},(i=()=>N,e=()=>W,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"]}}};ft.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{S as vviinn_carousel,$ as vviinn_product_card,ft as vviinn_vpr_widget}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,h as t,H as e,g as r}from"./p-545ef9fd.js";import{i as o,s,O as a}from"./p-7ec49ce4.js";import{s as n}from"./p-11d26656.js";import{e as d,f as l,g as p,h as c,v as h,b as g,i as m}from"./p-d3b98fa3.js";import"./p-f582db5c.js";let v=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)}async trackRecommendationClick({detail:i}){const t=l(Object.assign({sessionId:this.uiSessionId},i));await this.trackingApi.trackEvent(t);const e=o.results.find((t=>t.productId===i.product));e&&e.deeplink&&(window.location.href=e.deeplink)}trachSearchAreaChanges(){const i=p({session_id:this.uiSessionId,source:this.imageSource,search_area:"manual-selection"});this.trackingApi.trackEvent(i)}trackDetectedObject(){const i=p({session_id:this.uiSessionId,source:this.imageSource,search_area:"attention-point"});this.trackingApi.trackEvent(i)}trackFilter({detail:i}){const t=c({session_id:this.uiSessionId,source:this.imageSource,kind:"category",action:i});this.trackingApi.trackEvent(t)}componentWillLoad(){n(this,this.el)}connectedCallback(){s.apiPath=this.apiPath,s.currencySign=this.currencySign,s.locale=this.locale,o.token=this.token,this.uiSessionId=h()}trackOpenEvent(){this.trackingApi=g(this.apiPath,this.token);const i=m({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=p({session_id:this.uiSessionId,source:this.imageSource,search_area:"full"});this.trackingApi.trackEvent(i)}resetState(){this.resetScroll("onboarding-block"),this.slidePosition=0,o.image=a.none,o.imageUrl=a.none,o.imageBounds=a.none,o.searchArea=a.none,o.results=[],o.filters=[],o.detectedObjects=[],o.activeIonLink=void 0,o.rectangleSearchForm=void 0,this.resetScroll("results-block")}haveErrors(){return this.wrongImageFormat||o.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=m({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:!o.serverError},onActionClick:()=>o.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"},o.filters.map((i=>t("search-filters",{filter:i})))))),t("div",{id:"results-block",class:"products-wrapper"},t("div",{class:{"nothing-found":!0,hidden:o.results.length>0}},t("vviinn-empty-results",null),t("vviinn-onboarding",null)),t("div",{class:{hidden:o.results.length<=0,products:!0}},o.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"]}}};v.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{v as vviinn_vps_widget}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={packageVersion:"2.4.
|
|
1
|
+
const t={packageVersion:"2.4.4",packageName:"vviinn-widgets",environment:"local"};let e,n,l=!1,s=null,o=!1;const c="undefined"!=typeof window?window:{},i=c.document||{head:{}},r={t:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l),ce:(t,e)=>new CustomEvent(t,e)},a=t=>Promise.resolve(t),u=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),f=(t,e,n)=>{n&&n.map((([n,l,s])=>{const o=h(t,n),c=d(e,s),i=p(n);r.ael(o,l,c,i),(e.o=e.o||[]).push((()=>r.rel(o,l,c,i)))}))},d=(t,e)=>n=>{try{256&t.t?t.i[e](n):(t.u=t.u||[]).push([e,n])}catch(t){lt(t)}},h=(t,e)=>16&e?i.body:t,p=t=>0!=(2&t),y=new WeakMap,m=t=>"sc-"+t.h,$={},w=t=>"object"==(t=typeof t)||"function"===t,b=(t,e,...n)=>{let l=null,s=!1,o=!1,c=[];const i=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!w(l))&&(l+=""),s&&o?c[c.length-1].p+=l:c.push(s?g(null,l):l),o=s)};if(i(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}if("function"==typeof t)return t(null===e?{}:e,c,j);const r=g(t,null);return r.m=e,c.length>0&&(r.$=c),r},g=(t,e)=>({t:0,g:t,p:e,v:null,$:null,m:null}),v={},j={forEach:(t,e)=>t.map(S).forEach(e),map:(t,e)=>t.map(S).map(e).map(k)},S=t=>({vattrs:t.m,vchildren:t.$,vkey:t.j,vname:t.S,vtag:t.g,vtext:t.p}),k=t=>{if("function"==typeof t.vtag){const e=Object.assign({},t.vattrs);return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),b(t.vtag,e,...t.vchildren||[])}const e=g(t.vtag,t.vtext);return e.m=t.vattrs,e.$=t.vchildren,e.j=t.vkey,e.S=t.vname,e},O=(t,e,n,l,s,o)=>{if(n!==l){let i=nt(t,e),a=e.toLowerCase();if("class"===e){const e=t.classList,s=M(n),o=M(l);e.remove(...s.filter((t=>t&&!o.includes(t)))),e.add(...o.filter((t=>t&&!s.includes(t))))}else if("style"===e){for(const e in n)l&&null!=l[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in l)n&&l[e]===n[e]||(e.includes("-")?t.style.setProperty(e,l[e]):t.style[e]=l[e])}else if(i||"o"!==e[0]||"n"!==e[1]){const c=w(l);if((i||c&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]=l;else{let s=null==l?"":l;"list"===e?i=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&o||s)&&!c&&t.setAttribute(e,l=!0===l?"":l)}else e="-"===e[2]?e.slice(3):nt(c,a)?a.slice(2):a[2]+e.slice(3),n&&r.rel(t,e,n,!1),l&&r.ael(t,e,l,!1)}},C=/\s/,M=t=>t?t.split(C):[],x=(t,e,n,l)=>{const s=11===e.v.nodeType&&e.v.host?e.v.host:e.v,o=t&&t.m||$,c=e.m||$;for(l in o)l in c||O(s,l,o[l],void 0,n,e.t);for(l in c)O(s,l,o[l],c[l],n,e.t)},E=(t,n,s)=>{let o,c,r=n.$[s],a=0;if(null!==r.p)o=r.v=i.createTextNode(r.p);else{if(l||(l="svg"===r.g),o=r.v=i.createElementNS(l?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",r.g),l&&"foreignObject"===r.g&&(l=!1),x(null,r,l),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.$)for(a=0;a<r.$.length;++a)c=E(t,r,a),c&&o.appendChild(c);"svg"===r.g?l=!1:"foreignObject"===o.tagName&&(l=!0)}return o},L=(t,e,l,s,o,c)=>{let i,r=t;for(r.shadowRoot&&r.tagName===n&&(r=r.shadowRoot);o<=c;++o)s[o]&&(i=E(null,l,o),i&&(s[o].v=i,r.insertBefore(i,e)))},P=(t,e,n,l)=>{for(;e<=n;++e)(l=t[e])&&l.v.remove()},T=(t,e)=>t.g===e.g,W=(t,e)=>{const n=e.v=t.v,s=t.$,o=e.$,c=e.g,i=e.p;null===i?(l="svg"===c||"foreignObject"!==c&&l,"slot"===c||x(t,e,l),null!==s&&null!==o?((t,e,n,l)=>{let s,o=0,c=0,i=e.length-1,r=e[0],a=e[i],u=l.length-1,f=l[0],d=l[u];for(;o<=i&&c<=u;)null==r?r=e[++o]:null==a?a=e[--i]:null==f?f=l[++c]:null==d?d=l[--u]:T(r,f)?(W(r,f),r=e[++o],f=l[++c]):T(a,d)?(W(a,d),a=e[--i],d=l[--u]):T(r,d)?(W(r,d),t.insertBefore(r.v,a.v.nextSibling),r=e[++o],d=l[--u]):T(a,f)?(W(a,f),t.insertBefore(a.v,r.v),a=e[--i],f=l[++c]):(s=E(e&&e[c],n,c),f=l[++c],s&&r.v.parentNode.insertBefore(s,r.v));o>i?L(t,null==l[u+1]?null:l[u+1].v,n,l,c,u):c>u&&P(e,o,i)})(n,s,e,o):null!==o?(null!==t.p&&(n.textContent=""),L(n,null,e,o,0,o.length-1)):null!==s&&P(s,0,s.length-1),l&&"svg"===c&&(l=!1)):t.p!==i&&(n.data=i)},A=t=>Z(t).k,F=(t,e,n)=>{const l=A(t);return{emit:t=>H(l,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t})}},H=(t,e,n)=>{const l=r.ce(e,n);return t.dispatchEvent(l),l},N=(t,e)=>{e&&!t.O&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.O=e)))},R=(t,e)=>{if(t.t|=16,!(4&t.t))return N(t,t.C),ht((()=>U(t,e)));t.t|=512},U=(t,e)=>{const n=t.i;let l;return e&&(t.t|=256,t.u&&(t.u.map((([t,e])=>G(n,t,e))),t.u=null),l=G(n,"componentWillLoad")),I(l,(()=>V(t,n,e)))},V=async(t,e,n)=>{const l=t.k,s=l["s-rc"];n&&(t=>{const e=t.M,n=t.k,l=e.t,s=((t,e)=>{let n=m(e),l=ct.get(n);if(t=11===t.nodeType?t:i,l)if("string"==typeof l){let e,s=y.get(t=t.head||t);s||y.set(t,s=new Set),s.has(n)||(e=i.createElement("style"),e.innerHTML=l,t.insertBefore(e,t.querySelector("link")),s&&s.add(n))}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(t);q(t,e),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=l["s-p"],n=()=>_(t);0===e.length?n():(Promise.all(e).then(n),t.t|=4,e.length=0)}},q=(t,l)=>{try{s=l,l=l.render(),t.t&=-17,t.t|=2,((t,l)=>{const s=t.k,o=t.M,c=t.L||g(null,null),i=(t=>t&&t.g===v)(l)?l:b(null,null,l);n=s.tagName,o.P&&(i.m=i.m||{},o.P.map((([t,e])=>i.m[e]=s[t]))),i.g=null,i.t|=4,t.L=i,i.v=c.v=s.shadowRoot||s,e=s["s-sc"],W(c,i)})(t,l)}catch(e){lt(e,t.k)}return s=null,null},D=()=>s,_=t=>{const e=t.k,n=t.i,l=t.C;64&t.t||(t.t|=64,J(e),G(n,"componentDidLoad"),t.T(e),l||B()),t.O&&(t.O(),t.O=void 0),512&t.t&&dt((()=>R(t,!1))),t.t&=-517},z=t=>{{const e=Z(t),n=e.k.isConnected;return n&&2==(18&e.t)&&R(e,!1),n}},B=()=>{J(i.documentElement),dt((()=>H(c,"appload",{detail:{namespace:"vviinn-widgets"}})))},G=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){lt(t)}},I=(t,e)=>t&&t.then?t.then(e):e(),J=t=>t.classList.add("hydrated"),K=(t,e,n)=>{if(e.W){t.watchers&&(e.A=t.watchers);const l=Object.entries(e.W),s=t.prototype;if(l.map((([t,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,t,{get(){return((t,e)=>Z(this).F.get(e))(0,t)},set(n){((t,e,n,l)=>{const s=Z(t),o=s.k,c=s.F.get(e),i=s.t,r=s.i;if(n=((t,e)=>null==t||w(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?t+"":t)(n,l.W[e][0]),!(8&i&&void 0!==c||n===c)&&(s.F.set(e,n),r)){if(l.A&&128&i){const t=l.A[e];t&&t.map((t=>{try{r[t](n,c,e)}catch(t){lt(t,o)}}))}2==(18&i)&&R(s,!1)}})(this,t,n,e)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(t,e,l){r.jmp((()=>{const e=n.get(t);this.hasOwnProperty(e)&&(l=this[e],delete this[e]),this[e]=(null!==l||"boolean"!=typeof this[e])&&l}))},t.observedAttributes=l.filter((([t,e])=>15&e[0])).map((([t,l])=>{const s=l[1]||t;return n.set(s,t),512&l[0]&&e.P.push([t,s]),s}))}}return t},Q=t=>{G(t,"connectedCallback")},X=(t,e={})=>{const n=[],l=e.exclude||[],s=c.customElements,o=i.head,a=o.querySelector("meta[charset]"),d=i.createElement("style"),h=[];let p,y=!0;Object.assign(r,e),r.l=new URL(e.resourcesUrl||"./",i.baseURI).href,t.map((t=>t[1].map((e=>{const o={t:e[0],h:e[1],W:e[2],H:e[3]};o.W=e[2],o.H=e[3],o.P=[],o.A={};const c=o.h,i=class extends HTMLElement{constructor(t){super(t),et(t=this,o),1&o.t&&t.attachShadow({mode:"open"})}connectedCallback(){p&&(clearTimeout(p),p=null),y?h.push(this):r.jmp((()=>(t=>{if(0==(1&r.t)){const e=Z(t),n=e.M,l=()=>{};if(1&e.t)f(t,e,n.H),Q(e.i);else{e.t|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){N(e,e.C=n);break}}n.W&&Object.entries(n.W).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n,l,s)=>{if(0==(32&e.t)){{if(e.t|=32,(s=ot(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(n.A=s.watchers,K(s,n,2),s.isProxied=!0);const t=()=>{};e.t|=8;try{new s(e)}catch(t){lt(t)}e.t&=-9,e.t|=128,t(),Q(e.i)}if(s.style){let t=s.style;const e=m(n);if(!ct.has(e)){const l=()=>{};((t,e,n)=>{let l=ct.get(t);u&&n?(l=l||new CSSStyleSheet,l.replace(e)):l=e,ct.set(t,l)})(e,t,!!(1&n.t)),l()}}}const o=e.C,c=()=>R(e,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,e,n)}l()}})(this)))}disconnectedCallback(){r.jmp((()=>(()=>{if(0==(1&r.t)){const t=Z(this),e=t.i;t.o&&(t.o.map((t=>t())),t.o=void 0),G(e,"disconnectedCallback")}})()))}componentOnReady(){return Z(this).N}};o.R=t[0],l.includes(c)||s.get(c)||(n.push(c),s.define(c,K(i,o,1)))})))),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),o.insertBefore(d,a?a.nextSibling:o.firstChild),y=!1,h.length?h.map((t=>t.connectedCallback())):r.jmp((()=>p=setTimeout(B,30)))},Y=new WeakMap,Z=t=>Y.get(t),tt=(t,e)=>Y.set(e.i=t,e),et=(t,e)=>{const n={t:0,k:t,M:e,F:new Map};return n.N=new Promise((t=>n.T=t)),t["s-p"]=[],t["s-rc"]=[],f(t,n,e.H),Y.set(t,n)},nt=(t,e)=>e in t,lt=(t,e)=>(0,console.error)(t,e),st=new Map,ot=t=>{const e=t.h.replace(/-/g,"_"),n=t.R,l=st.get(n);return l?l[e]:import(`./${n}.entry.js`).then((t=>(st.set(n,t),t[e])),lt)},ct=new Map,it=[],rt=[],at=(t,e)=>n=>{t.push(n),o||(o=!0,e&&4&r.t?dt(ft):r.raf(ft))},ut=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){lt(t)}t.length=0},ft=()=>{ut(it),ut(rt),(o=it.length>0)&&r.raf(ft)},dt=t=>a().then(t),ht=at(rt,!0);export{t as E,v as H,D as a,X as b,F as c,z as f,A as g,b as h,a as p,tt as r}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as
|
|
1
|
+
import{r as t,c as i,h as e,H as o,g as r}from"./p-545ef9fd.js";import{b as a}from"./p-eff93fbd.js";let n=class{constructor(e){t(this,e),this.modalClosed=i(this,"modalClosed",7),this.position="bottom",this.sourceImage=null,this.widgetScrollbar=!1,this.state="idle"}bodyClickListener(t){const{clientX:i,clientY:e}=t,o=this.getSidebarRectangle();o&&(i>=o.left&&i<=o.right&&e>=o.top&&e<=o.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 e(o,{class:this.getClassMap()},e("aside",{class:"sidebar",part:"body",onAnimationEnd:t=>this.handleAnimationEnd(t)},e("header",{class:{"contains-source-img":this.isSourceImageValid()},part:"sidebar-header"},this.isSourceImageValid()?this.renderSourceImage():null,e("span",{class:"title",part:"title"},this.sidebarTitle),e("button",{class:"close-sidebar",onClick:()=>this.state="closed"},e(a,null))),e("main",{part:"sidebar-content"},e("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 e("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)}};n.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%)}}";export{n as vviinn_recommendations_sidebar}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as o,H as s}from"./p-
|
|
1
|
+
import{r as t,h as o,H as s}from"./p-545ef9fd.js";import{V as i}from"./p-eff93fbd.js";let n=class{constructor(o){t(this,o),this.position="bottom",this.sourceImage=null,this.sidebarTitle="Visually similar products",this.modalScrollbar=!1,this.sidebar=null,this.sidebarCloseListener=()=>{document.body.removeChild(this.sidebar)}}render(){return o(s,null,o("button",{class:"open-button",part:"button",onClick:()=>this.handleClick()},o("slot",null,o(i,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,this.sidebar=t,t.addEventListener("modalClosed",this.sidebarCloseListener),document.body.append(this.sidebar)}disconnectedCallback(){this.sidebar.removeEventListener("modalCLosed",this.sidebarCloseListener),document.body.removeChild(this.sidebar)}};n.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}";export{n as vviinn_vpr_button}
|