@letscooee/web-sdk 12.1.1 → 12.1.2
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/{chunk-ND7UMDP2.js → chunk-ACXDHGSB.js} +1 -1
- package/dist/{chunk-4GP7KHZX.js → chunk-V7PYPZW6.js} +1 -1
- package/dist/{chunk-OYCLWHYU.js → chunk-XJGHCCKJ.js} +1 -1
- package/dist/main.min.js +14 -14
- package/dist/{share-dialog.component-B5XF6QPR.js → share-dialog.component-4O5TGGTQ.js} +1 -1
- package/dist/{video-detail-dialog.component-WR37GPM5.js → video-detail-dialog.component-I6PISB4Z.js} +1 -1
- package/dist/widget.min.js +14 -14
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b}from"./chunk-
|
|
1
|
+
import{a as C,b}from"./chunk-V7PYPZW6.js";import{e as g,f as h,i as u,l as f}from"./chunk-XJGHCCKJ.js";import{Ba as l,Qa as c,X as m,na as n,oa as i,pa as r,v as s}from"./chunk-I62LO6BZ.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(this.triggerData,this.eventData.video,o!=="Clipboard");switch(o){case"Whatsapp":window.open(`https://wa.me/?text=${a}%20${t}`,"_blank","noopener,noreferrer");break;case"X(Twitter)":window.open(`https://x.com/intent/post?text=${a}&url=${t}`,"_blank","noopener,noreferrer");break;case"Clipboard":navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)});break;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({type:d,selectors:[["cooee-share-dialog"]],decls:19,vars:0,consts:[[1,"share-dialog"],[1,"share-dialog-header"],["type","button","aria-label","Close",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"share-options"],["type","button","aria-label","Share on WhatsApp",1,"share-option",3,"click"],["name","whatsapp","aria-hidden","true"],["type","button","aria-label","Share on X",1,"share-option",3,"click"],["name","x-twitter","aria-hidden","true"],["type","button","aria-label","Copy link",1,"share-option",3,"click"],["name","copy","aria-hidden","true"]],template:function(o,t){o&1&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],styles:["@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}"]})};export{_ as ShareDialogComponent};
|
package/dist/{video-detail-dialog.component-WR37GPM5.js → video-detail-dialog.component-I6PISB4Z.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{A as Pe,B as Me,C as Re,a as _e,c as O,d as Ce,f as U,k as Q,r as R,s as De,t as be,u as Te,v as Ie,w as Ee,y as Se,z as ke}from"./chunk-
|
|
1
|
+
import{A as Pe,B as Me,C as Re,a as _e,c as O,d as Ce,f as U,k as Q,r as R,s as De,t as be,u as Te,v as Ie,w as Ee,y as Se,z as ke}from"./chunk-ACXDHGSB.js";import{a as Oe,b as Ne}from"./chunk-V7PYPZW6.js";import{c as we,e as fe,f as N,g as H,i as xe,j as Ve,k as ye,l as F}from"./chunk-XJGHCCKJ.js";import"./chunk-SBONG2TS.js";import{$a as me,Ba as g,D as Y,Da as a,E as f,Ga as $,Ha as j,I as T,Ia as W,Ja as ae,Ka as de,L as J,La as b,M as X,Ma as S,O as s,Ta as se,Ua as le,V as Z,Va as ce,X as w,Za as pe,ba as I,fb as ue,ga as E,ha as x,ia as V,ib as k,ja as ee,jb as P,ka as y,kb as M,la as D,lb as ge,ma as u,na as l,oa as d,pa as _,qa as te,ra as ie,sa as oe,sb as he,ta as ne,ua as re,ub as ve,v as m,va as B,x as c,y as p,za as v}from"./chunk-I62LO6BZ.js";import"./chunk-V7UGKYBN.js";var A=class n{dialogState=P();dialog=m(ye);triggerData=m(fe)().triggerData;eventData=m(N);containerRef=m(Z);async share(t){t.stopPropagation(),t.preventDefault(),R()&&De()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let t=Ne(this.triggerData,this.eventData.video,!1);await navigator.share(t),Oe(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let t=await import("./share-dialog.component-4O5TGGTQ.js");this.dialogState.emit(!0),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(e,i){e&1&&(l(0,"button",0),g("click",function(r){return i.share(r)}),_(1,"cooee-icon",1),d())},dependencies:[F],styles:["button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}"]})};var z=class n{video=M.required();progress=f(0);constructor(){k(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100)};e.addEventListener("timeupdate",i),t(()=>{e.removeEventListener("timeupdate",i)})})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(e,i){e&1&&(te(0,"div",0)(1,"div",1),oe(2,"div"),ie()()),e&2&&(s(),S("width",i.progress(),"%"),E("aria-valuenow",i.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var Ae=["swiperContainer"],ze=(n,t)=>t.id;function Le(n,t){if(n&1){let e=v();l(0,"div",3)(1,"cooee-item-card",4),g("buttonClick",function(o){c(e);let r=a();return p(r.onButtonClick(o))})("click",function(){let o=c(e).$implicit,r=a();return p(r.cardClick.emit(o))}),d()()}if(n&2){let e=t.$implicit;s(),u("item",e)}}var L=class n{items=M.required();cardClick=P();destroyRef=m(Y);elementRef=m(T);engagementService=m(U);swiperContainerRef=ge.required("swiperContainer");swiperInstance;constructor(){k(()=>{this.initSwiper()}),this.destroyRef.onDestroy(()=>{this.swiperInstance?.destroy()})}ngOnInit(){O(this.elementRef.nativeElement.shadowRoot)}onButtonClick(t){let e=_e.get().website?.canChangeVariantInCart;if(this.items()?.length>1||t.hasVariants()&&!e){this.cardClick.emit(t);return}this.engagementService.executeCTA(Ce.ADD_TO_CART,{item:t})}initSwiper(){this.swiperInstance=new window.CooeeSDK.Swiper(this.swiperContainerRef().nativeElement,{direction:"horizontal",effect:"slide",slidesPerView:1.2,nested:!0,centeredSlides:!0,spaceBetween:12,mousewheel:{enabled:!0,thresholdDelta:10,thresholdTime:200}})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-promoted-items"]],viewQuery:function(e,i){e&1&&ae(i.swiperContainerRef,Ae,5),e&2&&de()},hostAttrs:[1,"letscooee-widget"],inputs:{items:[1,"items"]},outputs:{cardClick:"cardClick"},features:[me([U])],decls:5,vars:0,consts:[["swiperContainer",""],[1,"swiper-container"],[1,"swiper-wrapper"],[1,"swiper-slide"],["tabindex","0",3,"buttonClick","click","item"]],template:function(e,i){e&1&&(l(0,"div",1,0)(2,"div",2),y(3,Le,2,1,"div",3,ze),d()()),e&2&&(s(3),D(i.items()))},dependencies:[Re],styles:[`:host{display:block;width:100%}cooee-item-card{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:rgba(var(--lc-card-bg-color));cursor:pointer;border-radius:var(--lc-card-radius)}
|
|
2
2
|
`],encapsulation:3})};var Be=["swiperComp"],$e=["videoEl"],je=(n,t)=>t.url;function We(n,t){n&1&&(l(0,"div",11),_(1,"div",15),d())}function He(n,t){if(n&1&&_(0,"source",13),n&2){let e=t.$implicit;u("type",pe(e.mimeType))("src",e.url,J)}}function Ue(n,t){n&1&&B(0)}function Qe(n,t){if(n&1){let e=v();l(0,"cooee-video-promoted-items",24),g("cardClick",function(o){c(e);let r=a(2).$implicit,C=a();return p(C.productCardClicked(o,r))}),d()}if(n&2){let e=a(2).$implicit;u("items",e.items)}}function Ke(n,t){if(n&1&&_(0,"cooee-video-card",23),n&2){let e=a(2).$implicit;u("card",e.card)}}function qe(n,t){if(n&1){let e=v();_(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ce("mutedChange",function(o){c(e);let r=a(2);return le(r.muted,o)||(r.muted=o),p(o)}),g("toggled",function(){c(e);let o=a(2);return p(o.muteToggled())}),d(),I(3,Ue,1,0,"ng-container",8),d(),l(4,"div",19)(5,"cooee-share-button",20),g("dialogState",function(o){c(e);let r=a(2);return p(r.shareDialogOpen.set(o))}),d()(),l(6,"div",21),x(7,Qe,1,1,"cooee-video-promoted-items",22)(8,Ke,1,1,"cooee-video-card",23),d()}if(n&2){let e=a().$implicit,i=b(5),o=a(),r=b(9);u("video",i),s(2),se("muted",o.muted),u("videoEl",i),s(),u("ngTemplateOutlet",r),s(4),V(e.items.length&&o.footerContent===o.VideoConfigFooterContent.FIRST_ITEM?7:e.card&&o.footerContent===o.VideoConfigFooterContent.CARD?8:-1)}}function Ge(n,t){if(n&1){let e=v();l(0,"cooee-item-detail",25),g("closeClick",function(){c(e);let o=a(2);return p(o.productModalClosed())}),d()}if(n&2){let e=a(2);u("item",e.selectedItem)("similarItems",e.selectedVideo.items)}}function Ye(n,t){if(n&1){let e=v();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,We,2,0,"div",11),l(4,"video",12,2),g("click",function(){let o=c(e).$index,r=a();return p(r.currentIndex===o&&r.toggleMute())})("ended",function(){c(e);let o=b(5),r=a();return p(r.onVideoEnded(o))})("loadstart",function(){let o=c(e).$index,r=a();return p(r.onVideoLoadStart(o))})("canplay",function(){let o=c(e).$index,r=a();return p(r.onVideoCanPlay(o))}),y(6,He,1,3,"source",13,je),d(),x(8,qe,9,5),d(),x(9,Ge,1,2,"cooee-item-detail",14),d()()}if(n&2){let e=t.$implicit,i=t.$index,o=a();s(2),S("background-image",e.thumbnail?"url("+e.thumbnail+")":null),s(),V(o.shouldShowVideoSpinner(i)?3:-1),s(),u("ngClass",o.viewTemplateClassName)("muted",!0),E("preload",o.isVideoVisible(i)?"metadata":"none")("data-video-id",e.id)("autoplay",null),s(2),D(e.sources),s(2),V(o.currentIndex===i?8:-1),s(),V(o.selectedItem&&o.currentIndex===i?9:-1)}}function Je(n,t){n&1&&B(0)}function Xe(n,t){if(n&1){let e=v();l(0,"button",26),g("click",function(){c(e);let o=a();return p(o.close())}),_(1,"cooee-icon",27),d()}}var Fe=class n{swiperComponent;videoElements;VideoConfigFooterContent=Se;currentIndex=0;muted=f(!1);selectedItem=null;selectedVideo;detailPopupTemplate;footerContent;viewTemplateClassName="lc-video-only-view";shareDialogOpen=f(!1);data=m(Ve);elementRef=m(T);eventData=m(N);dialogRef=m(xe);swiperInitialized=f(!1);swiperOptions=f(null);videos=[];triggerContext;engagementTrigger;isMobile=R();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.navigationConfig=new Ee({enabled:!0,size:50,color:new Ie({h:"#000000"})}),this.cssLoadedPromise=O(this.elementRef.nativeElement.shadowRoot)}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close()}async ngOnInit(){this.muted.set(await Q.get("muted",!1));let t=this.engagementTrigger?.content?.videoConfig;switch(this.detailPopupTemplate=t?.detailPopup.template??"VIDEO_ONLY_VIEW",this.footerContent=t?.footerContent??"FIRST_ITEM",this.detailPopupTemplate){case"PRODUCT_DETAIL_VIEW":this.selectItemForDetailView(),this.viewTemplateClassName="lc-product-detail-view";break;case"VIDEO_ONLY_VIEW":this.viewTemplateClassName="lc-video-only-view";break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions()}ngOnDestroy(){this.resizeDebouncer?.destroy()}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(!1)}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:t?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(t=>t.nativeElement.pause())}toggleMute(){this.muted.update(t=>!t)}async muteToggled(){await Q.set("muted",this.muted());let e=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e)}playActiveVideo(t=!0){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e)}playVideo(t){t.currentTime=0,t.play().catch(e=>we.error(e))}onVideoEnded(t){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else{let e=this.getPreviousVideoDataForEvent(),i=["CE Last Video Ended",{previous:e},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t)}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"?this.selectItemForDetailView():this.selectedItem=null;let i=this.currentVideoProps(),o={previous:e,current:i},r=new H("CE Video Changed",o,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(t,e){let i={videoID:e.id,videoIndex:this.currentIndex},o=new H("CE More Item Info Clicked",{current:i},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t}onVideoLoadStart(t){this.videoLoadingStates.set(t,!0)}onVideoCanPlay(t){this.videoLoadingStates.set(t,!1)}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===!0&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:"auto",e=0;this.isProductDetailView()&&(t="auto",e=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:i=>{this.swiperInitialized.set(!0),setTimeout(()=>{i.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.detailPopupTemplate==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height)}calculateOptimalVideoDimensions(){let t=this.videos.map(h=>h.sources?.[0]).filter(h=>h?.width&&h?.height).map(h=>({width:h.width,height:h.height,aspectRatio:h.width/h.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,C=o/e.height,G=Math.min(r,C);return{width:Math.floor(e.width*G),height:Math.floor(e.height*G)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty("--video-container-width",`${t}px`),i.style.setProperty("--video-container-height",`${e}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(e,i){if(e&1&&($(Be,7),$($e,5)),e&2){let o;j(o=W())&&(i.swiperComponent=o.first),j(o=W())&&(i.videoElements=o)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(e,i){e&1&&g("keydown.escape",function(r){return i.onKeyDown(r)},X)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(e,i){if(e&1){let o=v();l(0,"div",3)(1,"cooee-swiper",4,0),g("slideChange",function(C){return c(o),p(i.onSlideChange(C))}),ne(3,5),y(4,Ye,10,10,"div",6,ee),re(),d(),l(6,"div",7),I(7,Je,1,0,"ng-container",8),d()(),I(8,Xe,2,0,"ng-template",null,1,ue)}if(e&2){let o=b(9);u("ngClass",i.viewTemplateClassName),s(),u("options",i.swiperOptions())("navigationConfig",i.navigationConfig),s(3),D(i.videos),s(3),u("ngTemplateOutlet",o)}},dependencies:[L,Te,Me,A,z,ve,he,Pe,ke,F],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media (min-width: 768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media (min-width: 768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media (max-width: 768px){.video-swiper>.swiper-button-prev,.video-swiper>.swiper-button-next{display:none!important}}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media (min-width: 768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media (max-width: 768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media (min-width: 768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media (min-width: 768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media (max-width: 768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media (min-width: 768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media (min-width: 768px){.lc-product-detail-view .lc-video-container{width:50%}}@media (min-width: 768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media (max-width: 768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media (max-width: 768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
|
|
3
3
|
`],encapsulation:3})};export{Fe as VideoDetailDialogComponent};
|
package/dist/widget.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{A as
|
|
1
|
+
import{A as Fi,B as Ri,C as Oi,a as mi,b as fi,d as tt,e as dt,g as ie,h as hi,i as me,j as vi,k as yi,l as Ci,m as bi,n as Ue,o as xi,p as Vi,q as Ti,r as Ei,u as Ii,x as Mi,y as Mt,z as Ai}from"./chunk-ACXDHGSB.js";import{c as Y,d as ui,g as gi,i as _i,j as wi,k as pt,l as Si,m as Pi,n as ki,q as Di}from"./chunk-XJGHCCKJ.js";import{a as ut}from"./chunk-QG5GD32H.js";import{a as qe}from"./chunk-SBONG2TS.js";import{$,$a as te,A as zt,Aa as de,B as Ut,Ba as H,Da as S,E as _e,F as qt,Ga as He,Ha as je,I as Zt,Ia as $e,K as oe,L as lt,La as pe,Ma as Xe,N as Qt,O as I,P as Wt,Pa as oi,Q as Gt,Qa as se,Ra as ri,S as St,Sa as ze,Wa as et,X as j,Xa as De,Ya as ye,Z as Jt,_ as Yt,aa as Kt,ab as ai,b as Lt,bb as si,cb as ue,da as Xt,db as Ce,e as Nt,eb as li,fa as ei,ga as Ke,gb as ci,ha as z,ia as U,ib as di,ja as ti,k as Bt,ka as we,kb as It,la as Ve,ma as B,na as k,oa as D,p as Ht,pa as re,qa as Ne,ra as Be,s as jt,sa as Te,sb as ct,ta as ii,ua as ni,v as ne,x as O,xb as pi,y as L,z as $t,za as ae}from"./chunk-I62LO6BZ.js";import{a as ve,b as Ot,e as Ui,f as qi}from"./chunk-V7UGKYBN.js";var Hi=Ui((mt,Bi)=>{"use strict";(function(o,e){typeof mt=="object"&&typeof Bi<"u"?e(mt):typeof define=="function"&&define.amd?define(["exports"],e):e((o=typeof globalThis<"u"?globalThis:o||self).Sqrl={})})(mt,function(o){"use strict";function e(a){var l,d,u=new Error(a);return l=u,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,u}function t(a,l,d){var u=l.slice(0,d).split(/\n/),n=u.length,i=u[n-1].length+1;throw e(a+=" at line "+n+" col "+i+`:
|
|
2
2
|
|
|
3
3
|
`+l.split(/\n/)[n-1]+`
|
|
4
|
-
`+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=new Function("return this")().Promise,
|
|
5
|
-
`).replace(/^\s+|\s+$/gm,"")),_.lastIndex=0,
|
|
6
|
-
`)}}return n}var
|
|
4
|
+
`+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=new Function("return this")().Promise,s=!1;try{s=new Function("return (async function(){}).constructor")()}catch(a){if(!(a instanceof SyntaxError))throw a}function c(a,l){return Object.prototype.hasOwnProperty.call(a,l)}function m(a,l,d){for(var u in l)c(l,u)&&(l[u]==null||typeof l[u]!="object"||u!=="storage"&&u!=="prefixes"||d?a[u]=l[u]:a[u]=m({},l[u]));return a}var g=/^async +/,_=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,A=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,W=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,be=/[.*+\-?^${}()|[\]\\]/g;function xe(a){return be.test(a)?a.replace(be,"\\$&"):a}function it(a,l){l.rmWhitespace&&(a=a.replace(/[\r\n]+/g,`
|
|
5
|
+
`).replace(/^\s+|\s+$/gm,"")),_.lastIndex=0,A.lastIndex=0,W.lastIndex=0;var d=l.prefixes,u=[d.h,d.b,d.i,d.r,d.c,d.e].reduce(function(b,v){return b&&v?b+"|"+xe(v):v?xe(v):b},""),n=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+xe(l.tags[1])+")","g"),i=new RegExp("([^]*?)"+xe(l.tags[0])+"(-|_)?\\s*("+u+")?\\s*","g"),p=0,f=!1;function y(b,v){var V,w={f:[]},P=0,E="c";function T(Me){var Pe=a.slice(p,Me),Z=Pe.trim();if(E==="f")Z==="safe"?w.raw=!0:l.async&&g.test(Z)?(Z=Z.replace(g,""),w.f.push([Z,"",!0])):w.f.push([Z,""]);else if(E==="fp")w.f[w.f.length-1][1]+=Z;else if(E==="err"){if(Z){var le=Pe.search(/\S/);t("invalid syntax",a,p+le)}}else w[E]=Z;p=Me+1}for(v==="h"||v==="b"||v==="c"?E="n":v==="r"&&(w.raw=!0,v="i"),n.lastIndex=p;(V=n.exec(a))!==null;){var F=V[1],N=V[2],q=V[3],G=V[4],X=V[5],M=V.index;if(F)F==="("?(P===0&&(E==="n"?(T(M),E="p"):E==="f"&&(T(M),E="fp")),P++):F===")"?--P===0&&E!=="c"&&(T(M),E="err"):P===0&&F==="|"?(T(M),E="f"):F==="=>"&&(T(M),p+=1,E="res");else if(N)if(N==="/*"){var he=a.indexOf("*/",n.lastIndex);he===-1&&t("unclosed comment",a,V.index),n.lastIndex=he+2}else N==="'"?(A.lastIndex=V.index,A.exec(a)?n.lastIndex=A.lastIndex:t("unclosed string",a,V.index)):N==='"'?(W.lastIndex=V.index,W.exec(a)?n.lastIndex=W.lastIndex:t("unclosed string",a,V.index)):N==="`"&&(_.lastIndex=V.index,_.exec(a)?n.lastIndex=_.lastIndex:t("unclosed string",a,V.index));else if(q)return T(M),p=M+V[0].length,i.lastIndex=p,f=X,G&&v==="h"&&(v="s"),w.t=v,w}return t("unclosed tag",a,b),w}var C=(function b(v,V){v.b=[],v.d=[];var w,P=!1,E=[];function T(le,st){le&&(le=(function(J,ke,Oe,Le){var ee,ce;return typeof ke.autoTrim=="string"?ee=ce=ke.autoTrim:Array.isArray(ke.autoTrim)&&(ee=ke.autoTrim[1],ce=ke.autoTrim[0]),(Oe||Oe===!1)&&(ee=Oe),(Le||Le===!1)&&(ce=Le),ee==="slurp"&&ce==="slurp"?J.trim():(ee==="_"||ee==="slurp"?J=String.prototype.trimLeft?J.trimLeft():J.replace(/^[\s\uFEFF\xA0]+/,""):ee!=="-"&&ee!=="nl"||(J=J.replace(/^(?:\n|\r|\r\n)/,"")),ce==="_"||ce==="slurp"?J=String.prototype.trimRight?J.trimRight():J.replace(/[\s\uFEFF\xA0]+$/,""):ce!=="-"&&ce!=="nl"||(J=J.replace(/(?:\n|\r|\r\n)$/,"")),J)})(le,l,f,st))&&(le=le.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),E.push(le))}for(;(w=i.exec(a))!==null;){var F,N=w[1],q=w[2],G=w[3]||"";for(var X in d)if(d[X]===G){F=X;break}T(N,q),p=w.index+w[0].length,F||t("unrecognized tag type: "+G,a,p);var M=y(w.index,F),he=M.t;if(he==="h"){var Me=M.n||"";l.async&&g.test(Me)&&(M.a=!0,M.n=Me.replace(g,"")),M=b(M),E.push(M)}else if(he==="c"){if(v.n===M.n)return P?(P.d=E,v.b.push(P)):v.d=E,v;t("Helper start and end don't match",a,w.index+w[0].length)}else if(he==="b"){P?(P.d=E,v.b.push(P)):v.d=E;var Pe=M.n||"";l.async&&g.test(Pe)&&(M.a=!0,M.n=Pe.replace(g,"")),P=M,E=[]}else if(he==="s"){var Z=M.n||"";l.async&&g.test(Z)&&(M.a=!0,M.n=Z.replace(g,"")),E.push(M)}else E.push(M)}if(!V)throw e('unclosed helper "'+v.n+'"');return T(a.slice(p,a.length),!1),v.d=E,v})({f:[]},!0);if(l.plugins)for(var x=0;x<l.plugins.length;x++){var h=l.plugins[x];h.processAST&&(C.d=h.processAST(C.d,l))}return C.d}function Qe(a,l){var d=it(a,l),u="var tR='';"+(l.useWith?"with("+l.varName+"||{}){":"")+K(d,l)+"if(cb){cb(null,tR)} return tR"+(l.useWith?"}":"");if(l.plugins)for(var n=0;n<l.plugins.length;n++){var i=l.plugins[n];i.processFnString&&(u=i.processFnString(u,l))}return u}function We(a,l){for(var d=0;d<l.length;d++){var u=l[d][0],n=l[d][1];a=(l[d][2]?"await ":"")+"c.l('F','"+u+"')("+a,n&&(a+=","+n),a+=")"}return a}function R(a,l,d,u,n,i){var p="{exec:"+(n?"async ":"")+Ge(d,l,a)+",params:["+u+"]";return i&&(p+=",name:'"+i+"'"),n&&(p+=",async:true"),p+="}"}function Vt(a,l){for(var d="[",u=0;u<a.length;u++){var n=a[u];d+=R(l,n.res||"",n.d,n.p||"",n.a,n.n),u<a.length&&(d+=",")}return d+="]"}function Ge(a,l,d){return"function("+l+"){var tR='';"+K(a,d)+"return tR}"}function K(a,l){for(var d=0,u=a.length,n="";d<u;d++){var i=a[d];if(typeof i=="string")n+="tR+='"+i+"';";else{var p=i.t,f=i.c||"",y=i.f,C=i.n||"",x=i.p||"",h=i.res||"",b=i.b,v=!!i.a;if(p==="i"){l.defaultFilter&&(f="c.l('F','"+l.defaultFilter+"')("+f+")");var V=We(f,y);!i.raw&&l.autoEscape&&(V="c.l('F','e')("+V+")"),n+="tR+="+V+";"}else if(p==="h")if(l.storage.nativeHelpers.get(C))n+=l.storage.nativeHelpers.get(C)(i,l);else{var w=(v?"await ":"")+"c.l('H','"+C+"')("+R(l,h,i.d,x,v);w+=b?","+Vt(b,l):",[]",n+="tR+="+We(w+=",c)",y)+";"}else p==="s"?n+="tR+="+We((v?"await ":"")+"c.l('H','"+C+"')({params:["+x+"]},[],c)",y)+";":p==="e"&&(n+=f+`
|
|
6
|
+
`)}}return n}var Fe=(function(){function a(l){this.cache=l}return a.prototype.define=function(l,d){this.cache[l]=d},a.prototype.get=function(l){return this.cache[l]},a.prototype.remove=function(l){delete this.cache[l]},a.prototype.reset=function(){this.cache={}},a.prototype.load=function(l){m(this.cache,l,!0)},a})();function ge(a,l,d,u){if(l&&l.length>0)throw e((u?"Native":"")+"Helper '"+a+"' doesn't accept blocks");if(d&&d.length>0)throw e((u?"Native":"")+"Helper '"+a+"' doesn't accept filters")}var Tt={"&":"&","<":"<",">":">",'"':""","'":"'"};function Et(a){return Tt[a]}var nt=new Fe({}),ot=new Fe({each:function(a,l){var d="",u=a.params[0];if(ge("each",l,!1),a.async)return new Promise(function(i){(function p(f,y,C,x,h){C(f[y],y).then(function(b){x+=b,y===f.length-1?h(x):p(f,y+1,C,x,h)})})(u,0,a.exec,d,i)});for(var n=0;n<u.length;n++)d+=a.exec(u[n],n);return d},foreach:function(a,l){var d=a.params[0];if(ge("foreach",l,!1),a.async)return new Promise(function(i){(function p(f,y,C,x,h,b){x(y[C],f[y[C]]).then(function(v){h+=v,C===y.length-1?b(h):p(f,y,C+1,x,h,b)})})(d,Object.keys(d),0,a.exec,"",i)});var u="";for(var n in d)c(d,n)&&(u+=a.exec(n,d[n]));return u},include:function(a,l,d){ge("include",l,!1);var u=d.storage.templates.get(a.params[0]);if(!u)throw e('Could not fetch template "'+a.params[0]+'"');return u(a.params[1],d)},extends:function(a,l,d){var u=a.params[1]||{};u.content=a.exec();for(var n=0;n<l.length;n++){var i=l[n];u[i.name]=i.exec()}var p=d.storage.templates.get(a.params[0]);if(!p)throw e('Could not fetch template "'+a.params[0]+'"');return p(u,d)},useScope:function(a,l){return ge("useScope",l,!1),a.exec(a.params[0])}}),rt=new Fe({if:function(a,l){ge("if",!1,a.f,!0);var d="if("+a.p+"){"+K(a.d,l)+"}";if(a.b)for(var u=0;u<a.b.length;u++){var n=a.b[u];n.n==="else"?d+="else{"+K(n.d,l)+"}":n.n==="elif"&&(d+="else if("+n.p+"){"+K(n.d,l)+"}")}return d},try:function(a,l){if(ge("try",!1,a.f,!0),!a.b||a.b.length!==1||a.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var d="try{"+K(a.d,l)+"}",u=a.b[0];return d+="catch"+(u.res?"("+u.res+")":"")+"{"+K(u.d,l)+"}"},block:function(a,l){return ge("block",a.b,a.f,!0),"if(!"+l.varName+"["+a.p+"]){tR+=("+Ge(a.d,"",l)+")()}else{tR+="+l.varName+"["+a.p+"]}"}}),at=new Fe({e:function(a){var l=String(a);return/[&<>"']/.test(l)?l.replace(/[&<>"']/g,Et):l}}),Re={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(a,l){if(a==="H"){var d=this.storage.helpers.get(l);if(d)return d;throw e("Can't find helper '"+l+"'")}if(a==="F"){var u=this.storage.filters.get(l);if(u)return u;throw e("Can't find filter '"+l+"'")}},async:!1,storage:{helpers:ot,nativeHelpers:rt,filters:at,templates:nt},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function Je(a,l){var d={};return m(d,Re),l&&m(d,l),a&&m(d,a),d.l.bind(d),d}function Ye(a,l){var d,u=Je(l||{}),n=Function;if(u.async){if(!s)throw e("This environment doesn't support async/await");n=s}if(u.varName&&(d=u.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(d)===!1))throw e("options.varName must be a valid JS identifier");try{return new n(u.varName,"c","cb",Qe(a,u))}catch(i){throw i instanceof SyntaxError?e(`Bad template syntax
|
|
7
7
|
|
|
8
8
|
`+i.message+`
|
|
9
9
|
`+Array(i.message.length+1).join("=")+`
|
|
10
|
-
`+
|
|
11
|
-
`);try{n=new Worker(URL.createObjectURL(new Blob([y])))}catch(C){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",C),null}f(n)}return n}})(),nt={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function We(n,i){return i?i(n):n}function Ge(n){return n!=null}function R(n,i,p){return We(n&&Ge(n[i])?n[i]:nt[i],p)}function Vt(n){return n<0?0:Math.floor(n)}function Je(n,i){return Math.floor(Math.random()*(i-n))+n}function te(n){return parseInt(n,16)}function Oe(n){return n.map(ve)}function ve(n){var i=String(n).replace(/[^0-9a-f]/gi,"");return i.length<6&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),{r:te(i.substring(0,2)),g:te(i.substring(2,4)),b:te(i.substring(4,6))}}function Tt(n){var i=R(n,"origin",Object);return i.x=R(i,"x",Number),i.y=R(i,"y",Number),i}function Et(n){n.width=document.documentElement.clientWidth,n.height=document.documentElement.clientHeight}function ot(n){var i=n.getBoundingClientRect();n.width=i.width,n.height=i.height}function rt(n){var i=document.createElement("canvas");return i.style.position="fixed",i.style.top="0px",i.style.left="0px",i.style.pointerEvents="none",i.style.zIndex=n,i}function at(n,i,p,f,y,C,x,h,b){n.save(),n.translate(i,p),n.rotate(C),n.scale(f,y),n.arc(0,0,1,x,h,b),n.restore()}function st(n){var i=n.angle*(Math.PI/180),p=n.spread*(Math.PI/180);return{x:n.x,y:n.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:n.startVelocity*.5+Math.random()*n.startVelocity,angle2D:-i+(.5*p-Math.random()*p),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:n.color,shape:n.shape,tick:0,totalTicks:n.ticks,decay:n.decay,drift:n.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:n.gravity*3,ovalScalar:.6,scalar:n.scalar,flat:n.flat}}function Le(n,i){i.x+=Math.cos(i.angle2D)*i.velocity+i.drift,i.y+=Math.sin(i.angle2D)*i.velocity+i.gravity,i.velocity*=i.decay,i.flat?(i.wobble=0,i.wobbleX=i.x+10*i.scalar,i.wobbleY=i.y+10*i.scalar,i.tiltSin=0,i.tiltCos=0,i.random=1):(i.wobble+=i.wobbleSpeed,i.wobbleX=i.x+10*i.scalar*Math.cos(i.wobble),i.wobbleY=i.y+10*i.scalar*Math.sin(i.wobble),i.tiltAngle+=.1,i.tiltSin=Math.sin(i.tiltAngle),i.tiltCos=Math.cos(i.tiltAngle),i.random=Math.random()+2);var p=i.tick++/i.totalTicks,f=i.x+i.random*i.tiltCos,y=i.y+i.random*i.tiltSin,C=i.wobbleX+i.random*i.tiltCos,x=i.wobbleY+i.random*i.tiltSin;if(n.fillStyle="rgba("+i.color.r+", "+i.color.g+", "+i.color.b+", "+(1-p)+")",n.beginPath(),u&&i.shape.type==="path"&&typeof i.shape.path=="string"&&Array.isArray(i.shape.matrix))n.fill(l(i.shape.path,i.shape.matrix,i.x,i.y,Math.abs(C-f)*.1,Math.abs(x-y)*.1,Math.PI/10*i.wobble));else if(i.shape.type==="bitmap"){var h=Math.PI/10*i.wobble,b=Math.abs(C-f)*.1,v=Math.abs(x-y)*.1,V=i.shape.bitmap.width*i.scalar,w=i.shape.bitmap.height*i.scalar,P=new DOMMatrix([Math.cos(h)*b,Math.sin(h)*b,-Math.sin(h)*v,Math.cos(h)*v,i.x,i.y]);P.multiplySelf(new DOMMatrix(i.shape.matrix));var E=n.createPattern(Q.transform(i.shape.bitmap),"no-repeat");E.setTransform(P),n.globalAlpha=1-p,n.fillStyle=E,n.fillRect(i.x-V/2,i.y-w/2,V,w),n.globalAlpha=1}else if(i.shape==="circle")n.ellipse?n.ellipse(i.x,i.y,Math.abs(C-f)*i.ovalScalar,Math.abs(x-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI):at(n,i.x,i.y,Math.abs(C-f)*i.ovalScalar,Math.abs(x-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI);else if(i.shape==="star")for(var T=Math.PI/2*3,F=4*i.scalar,N=8*i.scalar,U=i.x,W=i.y,ie=5,M=Math.PI/ie;ie--;)U=i.x+Math.cos(T)*N,W=i.y+Math.sin(T)*N,n.lineTo(U,W),T+=M,U=i.x+Math.cos(T)*F,W=i.y+Math.sin(T)*F,n.lineTo(U,W),T+=M;else n.moveTo(Math.floor(i.x),Math.floor(i.y)),n.lineTo(Math.floor(i.wobbleX),Math.floor(y)),n.lineTo(Math.floor(C),Math.floor(x)),n.lineTo(Math.floor(f),Math.floor(i.wobbleY));return n.closePath(),n.fill(),i.tick<i.totalTicks}function Ye(n,i,p,f,y){var C=i.slice(),x=n.getContext("2d"),h,b,v=D(function(V){function w(){h=b=null,x.clearRect(0,0,f.width,f.height),Q.clear(),y(),V()}function P(){r&&!(f.width===a.width&&f.height===a.height)&&(f.width=n.width=a.width,f.height=n.height=a.height),!f.width&&!f.height&&(p(n),f.width=n.width,f.height=n.height),x.clearRect(0,0,f.width,f.height),C=C.filter(function(E){return Le(x,E)}),C.length?h=Te.frame(P):w()}h=Te.frame(P),b=w});return{addFettis:function(V){return C=C.concat(V),v},canvas:n,promise:v,reset:function(){h&&Te.cancel(h),b&&b()}}}function Ke(n,i){var p=!n,f=!!R(i||{},"resize"),y=!1,C=R(i,"disableForReducedMotion",Boolean),x=c&&!!R(i||{},"useWorker"),h=x?Ee():null,b=p?Et:ot,v=n&&h?!!n.__confetti_initialized:!1,V=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,w;function P(T,F,N){for(var U=R(T,"particleCount",Vt),W=R(T,"angle",Number),ie=R(T,"spread",Number),M=R(T,"startVelocity",Number),ye=R(T,"decay",Number),ke=R(T,"gravity",Number),De=R(T,"drift",Number),q=R(T,"colors",Oe),me=R(T,"ticks",Number),lt=R(T,"shapes"),G=R(T,"scalar"),Ae=!!R(T,"flat"),Ne=Tt(T),Be=U,ne=[],ue=n.width*Ne.x,Hi=n.height*Ne.y;Be--;)ne.push(st({x:ue,y:Hi,angle:W,spread:ie,startVelocity:M,color:q[Be%q.length],shape:lt[Je(0,lt.length)],ticks:me,decay:ye,gravity:ke,drift:De,scalar:G,flat:Ae}));return w?w.addFettis(ne):(w=Ye(n,ne,b,F,N),w.promise)}function E(T){var F=C||R(T,"disableForReducedMotion",Boolean),N=R(T,"zIndex",Number);if(F&&V)return D(function(M){M()});p&&w?n=w.canvas:p&&!n&&(n=rt(N),document.body.appendChild(n)),f&&!v&&b(n);var U={width:n.width,height:n.height};h&&!v&&h.init(n),v=!0,h&&(n.__confetti_initialized=!0);function W(){if(h){var M={getBoundingClientRect:function(){if(!p)return n.getBoundingClientRect()}};b(M),h.postMessage({resize:{width:M.width,height:M.height}});return}U.width=U.height=null}function ie(){w=null,f&&(y=!1,e.removeEventListener("resize",W)),p&&n&&(document.body.contains(n)&&document.body.removeChild(n),n=null,v=!1)}return f&&!y&&(y=!0,e.addEventListener("resize",W,!1)),h?h.fire(T,U,ie):P(T,U,ie)}return E.reset=function(){h&&h.reset(),w&&w.reset()},E}var Pe;function s(){return Pe||(Pe=Ke(null,{useWorker:!0,resize:!0})),Pe}function l(n,i,p,f,y,C,x){var h=new Path2D(n),b=new Path2D;b.addPath(h,new DOMMatrix(i));var v=new Path2D;return v.addPath(b,new DOMMatrix([Math.cos(x)*y,Math.sin(x)*y,-Math.sin(x)*C,Math.cos(x)*C,p,f])),v}function d(n){if(!u)throw new Error("path confetti are not supported in this browser");var i,p;typeof n=="string"?i=n:(i=n.path,p=n.matrix);var f=new Path2D(i),y=document.createElement("canvas"),C=y.getContext("2d");if(!p){for(var x=1e3,h=x,b=x,v=0,V=0,w,P,E=0;E<x;E+=2)for(var T=0;T<x;T+=2)C.isPointInPath(f,E,T,"nonzero")&&(h=Math.min(h,E),b=Math.min(b,T),v=Math.max(v,E),V=Math.max(V,T));w=v-h,P=V-b;var F=10,N=Math.min(F/w,F/P);p=[N,0,0,N,-Math.round(w/2+h)*N,-Math.round(P/2+b)*N]}return{type:"path",path:i,matrix:p}}function m(n){var i,p=1,f="#000000",y='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof n=="string"?i=n:(i=n.text,p="scalar"in n?n.scalar:p,y="fontFamily"in n?n.fontFamily:y,f="color"in n?n.color:f);var C=10*p,x=""+C+"px "+y,h=new OffscreenCanvas(C,C),b=h.getContext("2d");b.font=x;var v=b.measureText(i),V=Math.ceil(v.actualBoundingBoxRight+v.actualBoundingBoxLeft),w=Math.ceil(v.actualBoundingBoxAscent+v.actualBoundingBoxDescent),P=2,E=v.actualBoundingBoxLeft+P,T=v.actualBoundingBoxAscent+P;V+=P+P,w+=P+P,h=new OffscreenCanvas(V,w),b=h.getContext("2d"),b.font=x,b.fillStyle=f,b.fillText(i,E,T);var F=1/p;return{type:"bitmap",bitmap:h.transferToImageBitmap(),matrix:[F,0,0,F,-V*F/2,-w*F/2]}}t.exports=function(){return s().apply(this,arguments)},t.exports.reset=function(){s().reset()},t.exports.create=Ke,t.exports.shapeFromPath=d,t.exports.shapeFromText=m})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Rt,!1);var Ni=Rt.exports,eo=Rt.exports.create;var gt=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:["circle","circle","square"],colors:["#f51c8f","#2179e2","#d52dc8","#01a9d9","#78ff44","#fdff6a"]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}})}static async leftRight(e=100){let t=[],r=Date.now()+2e3,a=()=>{t.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<r&&e>0&&(requestAnimationFrame(a),e--)};a(),await Promise.all(t)}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})])}static async fire(e){Object.assign(e,this.DEFAULTS,e),e.particleCount=e.particleCount??this.DEFAULTS.colors.length,await Ni(e)}static async realisticFire(e,t){let a={origin:{y:.7}};await this.fire(Object.assign({},a,t,{particleCount:Math.floor(200*e)}))}};var tn=(o,e)=>e.minValue;function nn(o,e){if(o&1&&(ee(0,"div",7),ge(1,"safeHtml")),o&2){let t=S().$implicit;J("innerHTML",we(1,1,t.minValue+" Products"),le)}}function on(o,e){if(o&1&&(ee(0,"div",7),ge(1,"cooeeCurrency"),ge(2,"safeHtml")),o&2){let t=S().$implicit;J("innerHTML",we(2,3,we(1,1,t.minValue)),le)}}function rn(o,e){if(o&1&&(X(0,"li",6)(1,"div"),j(2,nn,2,3,"div",7)(3,on,3,5,"div",7),ee(4,"img",8),X(5,"div",9),pe(6),ce()()()),o&2){let t=e.$implicit,r=S(2);et("left",t.calculatedAlignment+"%"),I(2),$((r.progressBarConfig==null?null:r.progressBarConfig.rewardBasis)===r.RewardBasis.ITEM_COUNT?2:3),I(2),J("src",r.getIconURL(t),xe),I(2),ni(t.label)}}function an(o,e){if(o&1&&(ee(0,"div",0),ge(1,"cooeeDynamicVariables"),ge(2,"safeHtml"),X(3,"div",1)(4,"ul",2)(5,"div",3),ee(6,"div",4),ce(),oe(7,rn,7,5,"li",5,tn),ce()()),o&2){let t=S(),r=t.calculatedState(),a=r.nextMilestone?r.nextMilestone.reachingText:r.lastMilestone.reachedText;J("innerHTML",we(2,6,ai(1,3,a,t.localDynamicVariables())),le),I(6),et("width",r.cartValuePercentage+"%"),I(),re(r.milestones)}}var ht=class o extends he{cart;localDynamicVariables=Ie({});calculatedState=Ie({});progressBarConfig;RewardBasis=Ft;constructor(){super()}engagementTriggerReceived(e){this.progressBarConfig=e.progressBarConfig}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently()}update(){this.calculateMilestonesSilently()}getIconURL(e){return e.rewardType===dt.FREE_SHIPPING?"https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png":e.rewardType===dt.DISCOUNT?"https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png":e.rewardType===dt.FREE_AUTO_GIFT?"https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png":""}calculateMilestonesSilently(){this.calculateMilestones().catch(e=>K.error(e))}async calculateMilestones(){let e=this.engagementTrigger,t=this.progressBarConfig;if(!t?.milestones?.length){K.warn("Milestones not available in progress bar config",e);return}let r=await this.cart.getNormalisedCart(),a=t.milestones.at(-1),c=t?.reachedAmountOrCount??r.originalAmount,u=t.totalProgress??0;K.verbose("Cart value:",c,`, percentage: ${u}%`),this.celebrate(e,c);let g={milestonesReady:!0,cartValuePercentage:u,milestones:t.milestones},_=t.milestones.find(D=>!D.reached);if(_){let D=qe(_.minValue-c);if(t.rewardBasis==="ITEM_COUNT"){let Q=_.minValue-c;D=`${Q} ${Q===1?"product":"products"}`}this.localDynamicVariables.set({amount_left:D}),g.nextMilestone=_,this.calculatedState.set(g);return}g.lastMilestone=a,this.calculatedState.set(g)}celebrate(e,t){let c=[...e.progressBarConfig.milestones].reverse().find(_=>_.minValue<t);if(!c)return;let u=`lc/en/${e.shortID}/${c.minValue}`;sessionStorage.getItem(u)||(sessionStorage.setItem(u,"1"),this.progressBarConfig?.noConfetti||gt.realistic())}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-progressbar"]],inputs:{cart:"cart"},features:[ae(se()),H],decls:1,vars:1,consts:[[1,"heading",3,"innerHTML"],[1,"milestone-container"],[1,"milestone-list"],[1,"untracked-path"],[1,"tracked-path"],[1,"milestone-list-item",3,"left"],[1,"milestone-list-item"],[1,"milestone-value",3,"innerHTML"],["width","20","height","20","alt","milestone icon",1,"milestone-icon",3,"src"],[1,"milestone-label"]],template:function(t,r){t&1&&j(0,an,9,8),t&2&&$(r.calculatedState().milestonesReady?0:-1)},dependencies:[ft,Ze,yi],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
|
|
12
|
-
`],encapsulation:3})};var
|
|
13
|
-
`],encapsulation:3})};var yt=class o extends
|
|
14
|
-
`],encapsulation:3})};var Ct=class o{dialog=
|
|
15
|
-
`),t=e.length===1?null:setInterval(()=>{this.featureSlider.update(r=>Ot(
|
|
16
|
-
`],encapsulation:3})};var gn=["videoEl"];async function Bi(){return(await import("./video-detail-dialog.component-WR37GPM5.js")).VideoDetailDialogComponent}var Me=class o extends he{videoElements;videos;videoConfig;dialogRef=null;dialog=be(pt);isMobile=wi();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Bi()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,a){e?.stopPropagation(),e?.preventDefault();let c=t.items?.[0];if(this.sendTriggerClicked(t,c),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,r)}sendEvent(e,t,r,a){let c=new mi(e,t,this.engagementTrigger);c.setVideos(r),a&&(c.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{K.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(a=>{let c=a.target,u=c.dataset.videoId;u&&(a.isIntersecting?(this.visibleVideos.add(u),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(u),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Mi();if(!e||!this.videos)return;let t=Si();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Ii)return;let r=this.videos.findIndex(a=>a.shortID===+e);if(r!==-1){let a=this.videos[r];await gi.set("muted",!0),await this.openDialog(a,r)}}async openDialog(e,t){await pi();let r={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await Bi();this.dialogRef=this.dialog.open(a,{width:"100vw",height:"100vh",data:r,providers:ui(this.triggerContext,{video:e,index:t}),disableClose:!0});let c={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:c},e),this.dialogRef.closed.subscribe(u=>{if(this.dialogRef=null,!u)return;let g=u.lastVideoDuration*1e3,_={videoID:u.lastVideo.id,videoIndex:u.lastVideoIndex,playedTillMS:g,playedTillPercent:g/u.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:_},u.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&He(gn,5),t&2){let a;je(a=$e())&&(r.videoElements=a)}},features:[H],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var hn=(o,e)=>e.id,vn=(o,e)=>e.url;function yn(o,e){if(o&1&&(Se(0,"div",1),ge(1,"safeHtml")),o&2){let t=S();z("innerHTML",we(1,1,t.videoConfig.heading),le)}}function Cn(o,e){o&1&&(k(0,"div",6),Se(1,"div",14),A())}function bn(o,e){if(o&1&&Se(0,"source",8),o&2){let t=e.$implicit;z("type",Ue(t.mimeType))("src",t.url,xe)}}function xn(o,e){if(o&1){let t=de();k(0,"cooee-mute-toggle",15),Y("toggled",function(a){O(t),S();let c=fe(6),u=S();return L(u.onMuteToggled(a,c))}),A()}if(o&2){S();let t=fe(6);z("muted",t.muted)("videoEl",t)}}function _n(o,e){if(o&1){let t=de();k(0,"cooee-item-card",16),Y("buttonClick",function(){O(t);let a=S(),c=a.$implicit,u=a.$index,g=fe(6),_=S();return L(_.addToCartClicked(null,c,u,g))})("click",function(a){O(t);let c=S(),u=c.$implicit,g=c.$index,_=fe(6),D=S();return L(D.onVideoTap(a,u,g,_))}),A()}if(o&2){S();let t=_e(0);z("item",t)}}function wn(o,e){if(o&1){let t=de();k(0,"cooee-video-card",17),Y("linkClicked",function(){O(t);let a=S().$implicit,c=S();return L(c.sendTriggerClicked(a))}),A()}if(o&2){S();let t=_e(1);z("card",t)}}function Vn(o,e){if(o&1){let t=de();tt(0)(1),k(2,"div",4)(3,"div",5),Y("click",function(a){let c=O(t),u=c.$implicit,g=c.$index,_=fe(6),D=S();return L(D.onVideoTap(a,u,g,_))})("keydown.enter",function(a){let c=O(t),u=c.$implicit,g=c.$index,_=fe(6),D=S();return L(D.onVideoTap(a,u,g,_))})("keydown.space",function(a){let c=O(t),u=c.$implicit,g=c.$index,_=fe(6),D=S();return L(D.onVideoTap(a,u,g,_))}),j(4,Cn,2,0,"div",6),k(5,"video",7,0),Y("mouseenter",function(){O(t);let a=fe(6);S();let c=_e(1);return L(c&&a.play())})("mouseleave",function(){O(t);let a=fe(6);S();let c=_e(1);return L(c&&a.pause())})("loadstart",function(){let a=O(t).$implicit,c=S();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=S();return L(c.onVideoCanPlay(a.id))}),oe(7,bn,1,3,"source",8,vn),A(),k(9,"div",9),j(10,xn,1,2,"cooee-mute-toggle",10),A()(),k(11,"div",11),j(12,_n,1,1,"cooee-item-card",12)(13,wn,1,1,"cooee-video-card",13),A()()}if(o&2){let t=e.$implicit,r=S(),a=_e(0),c=Fe(t.items[0]);I();let u=Fe(t.card),g=c&&r.videoConfig.footerContent==r.VideoConfigFooterContent.FIRST_ITEM,_=u&&r.videoConfig.footerContent==r.VideoConfigFooterContent.CARD;I(2),et("background-image",t.thumbnail?"url("+t.thumbnail+")":null),I(),$(r.isVideoLoading(t.id)?4:-1),I(),z("muted",!0),Xe("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),I(2),re(t.sources),I(3),$(r.videoConfig.showMuteButton?10:-1),I(2),$(g?12:_?13:-1)}}var xt=class o extends Me{VideoConfigFooterContent=Mt;VideoConfigAutoPlay=Ei;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig?.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,r,a){let c=t.items?.[0],u=di.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!u){this.onVideoTap(e,t,r,a);return}this.engagementService.executeCTA(it.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(it.GO_TO_PRODUCT,{item:r,video:t})}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=B({type:o,selectors:[["cooee-video-playlist"]],features:[ae(se()),H],decls:7,vars:6,consts:[["videoEl",""],[1,"heading-text",3,"innerHTML"],[3,"options","navigationConfig","paginationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-card"],["role","button","tabindex","0","aria-label","Play video","aria-haspopup","dialog",1,"video-wrapper",3,"click","keydown.enter","keydown.space"],[1,"video-loading-overlay"],["width","100%","playsinline","","loop","",3,"mouseenter","mouseleave","loadstart","canplay","muted"],[3,"src","type"],[1,"video-controls"],[3,"muted","videoEl"],["role","region","aria-label","Video details",1,"video-footer"],["role","button","tabindex","0","aria-label","Product detail",3,"item"],[3,"card"],[1,"loading-spinner"],[3,"toggled","muted","videoEl"],["role","button","tabindex","0","aria-label","Product detail",3,"buttonClick","click","item"],[3,"linkClicked","card"]],template:function(t,r){if(t&1&&(tt(0)(1),j(2,yn,2,3,"div",1),k(3,"cooee-swiper",2),ei(4,3),oe(5,Vn,14,11,"div",4,hn),ti(),A()),t&2){Fe(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),I(),Fe(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),I(),$(r.videoConfig.heading?2:-1);let a=r.videoConfig.playlistConfig==null?null:r.videoConfig.playlistConfig.videoSwiper;I(),z("options",r.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),I(2),re(r.videos)}},dependencies:[Di,ki,Pi,Ai,Ze],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media (max-width: 768px),(prefers-reduced-motion: reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-info{font-size:14px;line-height:normal}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
|
|
17
|
-
`],encapsulation:3})};var
|
|
18
|
-
`],encapsulation:3})};var
|
|
19
|
-
`],encapsulation:3})};
|
|
10
|
+
`+Qe(a,u)):i}}function Ie(a,l){var d;return l.cache&&l.name&&l.storage.templates.get(l.name)?l.storage.templates.get(l.name):(d=typeof a=="function"?a:Ye(a,l),l.cache&&l.name&&l.storage.templates.define(l.name,d),d)}Re.l.bind(Re),o.compile=Ye,o.compileScope=K,o.compileScopeIntoFunction=Ge,o.compileToString=Qe,o.defaultConfig=Re,o.filters=at,o.getConfig=Je,o.helpers=ot,o.nativeHelpers=rt,o.parse=it,o.render=function(a,l,d,u){var n=Je(d||{});if(!n.async)return Ie(a,n)(l,n);if(!u){if(typeof r=="function")return new r(function(i,p){try{i(Ie(a,n)(l,n))}catch(f){p(f)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{Ie(a,n)(l,n,u)}catch(i){return u(i)}},o.templates=nt,Object.defineProperty(o,"__esModule",{value:!0})})});var Zi={schedule(o,e){let t=setTimeout(o,e);return()=>clearTimeout(t)}};function Qi(o){return o.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Wi(o){return!!o&&o.nodeType===Node.ELEMENT_NODE}var Pt;function Gi(o,e){if(!Pt){let t=Element.prototype;Pt=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}return o.nodeType===Node.ELEMENT_NODE?Pt.call(o,e):!1}function Ji(o){let e={};return o.forEach(({propName:t,templateName:r,transform:s})=>{e[Qi(r)]=[t,s]}),e}function Yi(o,e){return e.get(St).resolveComponentFactory(o).inputs}function Ki(o,e){let t=o.childNodes,r=e.map(()=>[]),s=-1;e.some((c,m)=>c==="*"?(s=m,!0):!1);for(let c=0,m=t.length;c<m;++c){let g=t[c],_=Xi(g,e,s);_!==-1&&r[_].push(g)}return r}function Xi(o,e,t){let r=t;return Wi(o)&&e.some((s,c)=>s!=="*"&&Gi(o,s)?(r=c,!0):!1),r}var en=10,kt=class{componentFactory;inputMap=new Map;constructor(e,t){this.componentFactory=t.get(St).resolveComponentFactory(e);for(let r of this.componentFactory.inputs)this.inputMap.set(r.propName,r.templateName)}create(e){return new Dt(this.componentFactory,e,this.inputMap)}},Dt=class{componentFactory;injector;inputMap;eventEmitters=new Nt(1);events=this.eventEmitters.pipe(Ht(e=>Bt(...e)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(e,t,r){this.componentFactory=e,this.injector=t,this.inputMap=r,this.ngZone=this.injector.get(Xt),this.appRef=this.injector.get(ei),this.cdScheduler=t.get(qt),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(e){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(e)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=Zi.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},en))})}getInputValue(e){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(e):this.componentRef.instance[e])}setInputValue(e,t){if(this.componentRef===null){this.initialInputValues.set(e,t);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(e)??e,t),Wt(this.componentRef.hostView)&&(Gt(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(e){let t=Ut.create({providers:[],parent:this.injector}),r=Ki(e,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(t,r,e),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[e,t]of this.initialInputValues)this.setInputValue(e,t);this.initialInputValues.clear()}initializeOutputs(e){let t=this.componentFactory.outputs.map(({propName:r,templateName:s})=>{let c=e.instance[r];return new Lt(m=>{let g=c.subscribe(_=>m.next({name:s,value:_}));return()=>g.unsubscribe()})});this.eventEmitters.next(t)}runInZone(e){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(e):e()}},At=class extends HTMLElement{ngElementEventsSubscription=null};function Li(o,e){let t=Yi(o,e.injector),r=e.strategyFactory||new kt(o,e.injector),s=Ji(t);class c extends At{injector;static observedAttributes=Object.keys(s);get ngElementStrategy(){if(!this._ngElementStrategy){let g=this._ngElementStrategy=r.create(this.injector||e.injector);t.forEach(({propName:_,transform:A})=>{if(!this.hasOwnProperty(_))return;let W=this[_];delete this[_],g.setInputValue(_,W,A)})}return this._ngElementStrategy}_ngElementStrategy;constructor(g){super(),this.injector=g}attributeChangedCallback(g,_,A,W){let[be,xe]=s[g];this.ngElementStrategy.setInputValue(be,A,xe)}connectedCallback(){let g=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),g=!0),this.ngElementStrategy.connect(this),g||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(g=>{let _=new CustomEvent(g.name,{detail:g.value});this.dispatchEvent(_)})}}return t.forEach(({propName:m,transform:g})=>{Object.defineProperty(c.prototype,m,{get(){return this.ngElementStrategy.getInputValue(m)},set(_){this.ngElementStrategy.setInputValue(m,_,g)},configurable:!0,enumerable:!0})}),c}var Ni={providers:[ci()]};var Ft=(t=>(t.CART_AMOUNT="CART_AMOUNT",t.ITEM_COUNT="ITEM_COUNT",t))(Ft||{});var Q=qi(Hi());Q.filters.define("default",function(o){return typeof o>"u"||o==null?"":nn(o)});+Q.filters.define("max",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t>r?e:o});Q.filters.define("min",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t<r?e:o});Q.filters.define("fallback",(o,e)=>o==null||o===""?e:o);Q.filters.define("manipulate_quantity",(o,e,t)=>{if(e??=1,t??=100,e>t)return Y.error("Invalid range: min should be less than or equal to max."),o;if(o>=e&&o<=t)return o;let r=o%t;return r<e?e:r});Q.filters.define("apply_discount_perc",(o,e,t=1/0)=>{if(o=+o,isNaN(o))return Y.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return Y.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let r=o*e/100;return o-Math.min(t,r)});Q.filters.define("apply_discount_fixed",(o,e)=>(o=+o,isNaN(o)?(Y.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,o-e)));Q.filters.define("currency",o=>(o=+o,isNaN(o)?(Y.error("Need value as a number for `currency` filter"),NaN):Ue(o)));Q.defaultConfig.defaultFilter="default";Q.defaultConfig.useWith=!0;Q.defaultConfig.autoEscape=!1;var tn={'"':""","\\":"\","\n":"\\n"};function nn(o){return String(o).replace(/["\\\n]/g,e=>tn[e])}function on(o){if(!o)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return o.replace(e,(t,r,s,c)=>`{{ ${(s||c||"").trim()} }}`)}var Ze=(o,e,t)=>{e=ve({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Q.render(on(o),e)}catch(r){throw Ci(r,"squirrelly-render",{extra:{template:o,values:e},triggerContext:t}),r}};var ft=class o{transform(e,t){return e?Ze(e,ve({},t)):null}static \u0275fac=function(t){return new(t||o)};static \u0275pipe=Yt({name:"cooeeDynamicVariables",type:o,pure:!0})};var Rt={};(function o(e,t,r,s){var c=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),m=typeof Path2D=="function"&&typeof DOMMatrix=="function",g=(function(){if(!e.OffscreenCanvas)return!1;var n=new OffscreenCanvas(1,1),i=n.getContext("2d");i.fillRect(0,0,1,1);var p=n.transferToImageBitmap();try{i.createPattern(p,"no-repeat")}catch{return!1}return!0})();function _(){}function A(n){var i=t.exports.Promise,p=i!==void 0?i:e.Promise;return typeof p=="function"?new p(n):(n(_,_),null)}var W=(function(n,i){return{transform:function(p){if(n)return p;if(i.has(p))return i.get(p);var f=new OffscreenCanvas(p.width,p.height),y=f.getContext("2d");return y.drawImage(p,0,0),i.set(p,f),f},clear:function(){i.clear()}}})(g,new Map),be=(function(){var n=Math.floor(16.666666666666668),i,p,f={},y=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(i=function(C){var x=Math.random();return f[x]=requestAnimationFrame(function h(b){y===b||y+n-1<b?(y=b,delete f[x],C()):f[x]=requestAnimationFrame(h)}),x},p=function(C){f[C]&&cancelAnimationFrame(f[C])}):(i=function(C){return setTimeout(C,n)},p=function(C){return clearTimeout(C)}),{frame:i,cancel:p}})(),xe=(function(){var n,i,p={};function f(y){function C(x,h){y.postMessage({options:x||{},callback:h})}y.init=function(h){var b=h.transferControlToOffscreen();y.postMessage({canvas:b},[b])},y.fire=function(h,b,v){if(i)return C(h,null),i;var V=Math.random().toString(36).slice(2);return i=A(function(w){function P(E){E.data.callback===V&&(delete p[V],y.removeEventListener("message",P),i=null,W.clear(),v(),w())}y.addEventListener("message",P),C(h,V),p[V]=P.bind(null,{data:{callback:V}})}),i},y.reset=function(){y.postMessage({reset:!0});for(var h in p)p[h](),delete p[h]}}return function(){if(n)return n;if(!r&&c){var y=["var CONFETTI, SIZE = {}, module = {};","("+o.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
|
|
11
|
+
`);try{n=new Worker(URL.createObjectURL(new Blob([y])))}catch(C){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",C),null}f(n)}return n}})(),it={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function Qe(n,i){return i?i(n):n}function We(n){return n!=null}function R(n,i,p){return Qe(n&&We(n[i])?n[i]:it[i],p)}function Vt(n){return n<0?0:Math.floor(n)}function Ge(n,i){return Math.floor(Math.random()*(i-n))+n}function K(n){return parseInt(n,16)}function Fe(n){return n.map(ge)}function ge(n){var i=String(n).replace(/[^0-9a-f]/gi,"");return i.length<6&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),{r:K(i.substring(0,2)),g:K(i.substring(2,4)),b:K(i.substring(4,6))}}function Tt(n){var i=R(n,"origin",Object);return i.x=R(i,"x",Number),i.y=R(i,"y",Number),i}function Et(n){n.width=document.documentElement.clientWidth,n.height=document.documentElement.clientHeight}function nt(n){var i=n.getBoundingClientRect();n.width=i.width,n.height=i.height}function ot(n){var i=document.createElement("canvas");return i.style.position="fixed",i.style.top="0px",i.style.left="0px",i.style.pointerEvents="none",i.style.zIndex=n,i}function rt(n,i,p,f,y,C,x,h,b){n.save(),n.translate(i,p),n.rotate(C),n.scale(f,y),n.arc(0,0,1,x,h,b),n.restore()}function at(n){var i=n.angle*(Math.PI/180),p=n.spread*(Math.PI/180);return{x:n.x,y:n.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:n.startVelocity*.5+Math.random()*n.startVelocity,angle2D:-i+(.5*p-Math.random()*p),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:n.color,shape:n.shape,tick:0,totalTicks:n.ticks,decay:n.decay,drift:n.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:n.gravity*3,ovalScalar:.6,scalar:n.scalar,flat:n.flat}}function Re(n,i){i.x+=Math.cos(i.angle2D)*i.velocity+i.drift,i.y+=Math.sin(i.angle2D)*i.velocity+i.gravity,i.velocity*=i.decay,i.flat?(i.wobble=0,i.wobbleX=i.x+10*i.scalar,i.wobbleY=i.y+10*i.scalar,i.tiltSin=0,i.tiltCos=0,i.random=1):(i.wobble+=i.wobbleSpeed,i.wobbleX=i.x+10*i.scalar*Math.cos(i.wobble),i.wobbleY=i.y+10*i.scalar*Math.sin(i.wobble),i.tiltAngle+=.1,i.tiltSin=Math.sin(i.tiltAngle),i.tiltCos=Math.cos(i.tiltAngle),i.random=Math.random()+2);var p=i.tick++/i.totalTicks,f=i.x+i.random*i.tiltCos,y=i.y+i.random*i.tiltSin,C=i.wobbleX+i.random*i.tiltCos,x=i.wobbleY+i.random*i.tiltSin;if(n.fillStyle="rgba("+i.color.r+", "+i.color.g+", "+i.color.b+", "+(1-p)+")",n.beginPath(),m&&i.shape.type==="path"&&typeof i.shape.path=="string"&&Array.isArray(i.shape.matrix))n.fill(l(i.shape.path,i.shape.matrix,i.x,i.y,Math.abs(C-f)*.1,Math.abs(x-y)*.1,Math.PI/10*i.wobble));else if(i.shape.type==="bitmap"){var h=Math.PI/10*i.wobble,b=Math.abs(C-f)*.1,v=Math.abs(x-y)*.1,V=i.shape.bitmap.width*i.scalar,w=i.shape.bitmap.height*i.scalar,P=new DOMMatrix([Math.cos(h)*b,Math.sin(h)*b,-Math.sin(h)*v,Math.cos(h)*v,i.x,i.y]);P.multiplySelf(new DOMMatrix(i.shape.matrix));var E=n.createPattern(W.transform(i.shape.bitmap),"no-repeat");E.setTransform(P),n.globalAlpha=1-p,n.fillStyle=E,n.fillRect(i.x-V/2,i.y-w/2,V,w),n.globalAlpha=1}else if(i.shape==="circle")n.ellipse?n.ellipse(i.x,i.y,Math.abs(C-f)*i.ovalScalar,Math.abs(x-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI):rt(n,i.x,i.y,Math.abs(C-f)*i.ovalScalar,Math.abs(x-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI);else if(i.shape==="star")for(var T=Math.PI/2*3,F=4*i.scalar,N=8*i.scalar,q=i.x,G=i.y,X=5,M=Math.PI/X;X--;)q=i.x+Math.cos(T)*N,G=i.y+Math.sin(T)*N,n.lineTo(q,G),T+=M,q=i.x+Math.cos(T)*F,G=i.y+Math.sin(T)*F,n.lineTo(q,G),T+=M;else n.moveTo(Math.floor(i.x),Math.floor(i.y)),n.lineTo(Math.floor(i.wobbleX),Math.floor(y)),n.lineTo(Math.floor(C),Math.floor(x)),n.lineTo(Math.floor(f),Math.floor(i.wobbleY));return n.closePath(),n.fill(),i.tick<i.totalTicks}function Je(n,i,p,f,y){var C=i.slice(),x=n.getContext("2d"),h,b,v=A(function(V){function w(){h=b=null,x.clearRect(0,0,f.width,f.height),W.clear(),y(),V()}function P(){r&&!(f.width===s.width&&f.height===s.height)&&(f.width=n.width=s.width,f.height=n.height=s.height),!f.width&&!f.height&&(p(n),f.width=n.width,f.height=n.height),x.clearRect(0,0,f.width,f.height),C=C.filter(function(E){return Re(x,E)}),C.length?h=be.frame(P):w()}h=be.frame(P),b=w});return{addFettis:function(V){return C=C.concat(V),v},canvas:n,promise:v,reset:function(){h&&be.cancel(h),b&&b()}}}function Ye(n,i){var p=!n,f=!!R(i||{},"resize"),y=!1,C=R(i,"disableForReducedMotion",Boolean),x=c&&!!R(i||{},"useWorker"),h=x?xe():null,b=p?Et:nt,v=n&&h?!!n.__confetti_initialized:!1,V=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,w;function P(T,F,N){for(var q=R(T,"particleCount",Vt),G=R(T,"angle",Number),X=R(T,"spread",Number),M=R(T,"startVelocity",Number),he=R(T,"decay",Number),Me=R(T,"gravity",Number),Pe=R(T,"drift",Number),Z=R(T,"colors",Fe),le=R(T,"ticks",Number),st=R(T,"shapes"),J=R(T,"scalar"),ke=!!R(T,"flat"),Oe=Tt(T),Le=q,ee=[],ce=n.width*Oe.x,zi=n.height*Oe.y;Le--;)ee.push(at({x:ce,y:zi,angle:G,spread:X,startVelocity:M,color:Z[Le%Z.length],shape:st[Ge(0,st.length)],ticks:le,decay:he,gravity:Me,drift:Pe,scalar:J,flat:ke}));return w?w.addFettis(ee):(w=Je(n,ee,b,F,N),w.promise)}function E(T){var F=C||R(T,"disableForReducedMotion",Boolean),N=R(T,"zIndex",Number);if(F&&V)return A(function(M){M()});p&&w?n=w.canvas:p&&!n&&(n=ot(N),document.body.appendChild(n)),f&&!v&&b(n);var q={width:n.width,height:n.height};h&&!v&&h.init(n),v=!0,h&&(n.__confetti_initialized=!0);function G(){if(h){var M={getBoundingClientRect:function(){if(!p)return n.getBoundingClientRect()}};b(M),h.postMessage({resize:{width:M.width,height:M.height}});return}q.width=q.height=null}function X(){w=null,f&&(y=!1,e.removeEventListener("resize",G)),p&&n&&(document.body.contains(n)&&document.body.removeChild(n),n=null,v=!1)}return f&&!y&&(y=!0,e.addEventListener("resize",G,!1)),h?h.fire(T,q,X):P(T,q,X)}return E.reset=function(){h&&h.reset(),w&&w.reset()},E}var Ie;function a(){return Ie||(Ie=Ye(null,{useWorker:!0,resize:!0})),Ie}function l(n,i,p,f,y,C,x){var h=new Path2D(n),b=new Path2D;b.addPath(h,new DOMMatrix(i));var v=new Path2D;return v.addPath(b,new DOMMatrix([Math.cos(x)*y,Math.sin(x)*y,-Math.sin(x)*C,Math.cos(x)*C,p,f])),v}function d(n){if(!m)throw new Error("path confetti are not supported in this browser");var i,p;typeof n=="string"?i=n:(i=n.path,p=n.matrix);var f=new Path2D(i),y=document.createElement("canvas"),C=y.getContext("2d");if(!p){for(var x=1e3,h=x,b=x,v=0,V=0,w,P,E=0;E<x;E+=2)for(var T=0;T<x;T+=2)C.isPointInPath(f,E,T,"nonzero")&&(h=Math.min(h,E),b=Math.min(b,T),v=Math.max(v,E),V=Math.max(V,T));w=v-h,P=V-b;var F=10,N=Math.min(F/w,F/P);p=[N,0,0,N,-Math.round(w/2+h)*N,-Math.round(P/2+b)*N]}return{type:"path",path:i,matrix:p}}function u(n){var i,p=1,f="#000000",y='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof n=="string"?i=n:(i=n.text,p="scalar"in n?n.scalar:p,y="fontFamily"in n?n.fontFamily:y,f="color"in n?n.color:f);var C=10*p,x=""+C+"px "+y,h=new OffscreenCanvas(C,C),b=h.getContext("2d");b.font=x;var v=b.measureText(i),V=Math.ceil(v.actualBoundingBoxRight+v.actualBoundingBoxLeft),w=Math.ceil(v.actualBoundingBoxAscent+v.actualBoundingBoxDescent),P=2,E=v.actualBoundingBoxLeft+P,T=v.actualBoundingBoxAscent+P;V+=P+P,w+=P+P,h=new OffscreenCanvas(V,w),b=h.getContext("2d"),b.font=x,b.fillStyle=f,b.fillText(i,E,T);var F=1/p;return{type:"bitmap",bitmap:h.transferToImageBitmap(),matrix:[F,0,0,F,-V*F/2,-w*F/2]}}t.exports=function(){return a().apply(this,arguments)},t.exports.reset=function(){a().reset()},t.exports.create=Ye,t.exports.shapeFromPath=d,t.exports.shapeFromText=u})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Rt,!1);var ji=Rt.exports,Yn=Rt.exports.create;var gt=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:["circle","circle","square"],colors:["#f51c8f","#2179e2","#d52dc8","#01a9d9","#78ff44","#fdff6a"]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}})}static async leftRight(e=100){let t=[],r=Date.now()+2e3,s=()=>{t.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<r&&e>0&&(requestAnimationFrame(s),e--)};s(),await Promise.all(t)}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})])}static async fire(e){Object.assign(e,this.DEFAULTS,e),e.particleCount=e.particleCount??this.DEFAULTS.colors.length,await ji(e)}static async realisticFire(e,t){let s={origin:{y:.7}};await this.fire(Object.assign({},s,t,{particleCount:Math.floor(200*e)}))}};var rn=(o,e)=>e.minValue;function an(o,e){if(o&1&&(Te(0,"div",7),ue(1,"safeHtml")),o&2){let t=S().$implicit;de("innerHTML",Ce(1,1,t.minValue+" Products"),oe)}}function sn(o,e){if(o&1&&(Te(0,"div",7),ue(1,"cooeeCurrency"),ue(2,"safeHtml")),o&2){let t=S().$implicit;de("innerHTML",Ce(2,3,Ce(1,1,t.minValue)),oe)}}function ln(o,e){if(o&1&&(Ne(0,"li",6)(1,"div"),z(2,an,2,3,"div",7)(3,sn,3,5,"div",7),Te(4,"img",8),Ne(5,"div",9),se(6),Be()()()),o&2){let t=e.$implicit,r=S(2);Xe("left",t.calculatedAlignment+"%"),I(2),U((r.progressBarConfig==null?null:r.progressBarConfig.rewardBasis)===r.RewardBasis.ITEM_COUNT?2:3),I(2),de("src",r.getIconURL(t),lt),I(2),ri(t.label)}}function cn(o,e){if(o&1&&(Te(0,"div",0),ue(1,"cooeeDynamicVariables"),ue(2,"safeHtml"),Ne(3,"div",1)(4,"ul",2)(5,"div",3),Te(6,"div",4),Be(),we(7,ln,7,5,"li",5,rn),Be()()),o&2){let t=S(),r=t.calculatedState(),s=r.nextMilestone?r.nextMilestone.reachingText:r.lastMilestone.reachedText;de("innerHTML",Ce(2,6,li(1,3,s,t.localDynamicVariables())),oe),I(6),Xe("width",r.cartValuePercentage+"%"),I(),Ve(r.milestones)}}var ht=class o extends me{cart;localDynamicVariables=_e({});calculatedState=_e({});progressBarConfig;RewardBasis=Ft;constructor(){super()}engagementTriggerReceived(e){this.progressBarConfig=e.progressBarConfig}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently()}update(){this.calculateMilestonesSilently()}getIconURL(e){return e.rewardType===dt.FREE_SHIPPING?"https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png":e.rewardType===dt.DISCOUNT?"https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png":e.rewardType===dt.FREE_AUTO_GIFT?"https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png":""}calculateMilestonesSilently(){this.calculateMilestones().catch(e=>Y.error(e))}async calculateMilestones(){let e=this.engagementTrigger,t=this.progressBarConfig;if(!t?.milestones?.length){Y.warn("Milestones not available in progress bar config",e);return}let r=await this.cart.getNormalisedCart(),s=t.milestones.at(-1),c=t?.reachedAmountOrCount??r.originalAmount,m=t.totalProgress??0;Y.verbose("Cart value:",c,`, percentage: ${m}%`),this.celebrate(e,c);let g={milestonesReady:!0,cartValuePercentage:m,milestones:t.milestones},_=t.milestones.find(A=>!A.reached);if(_){let A=Ue(_.minValue-c);if(t.rewardBasis==="ITEM_COUNT"){let W=_.minValue-c;A=`${W} ${W===1?"product":"products"}`}this.localDynamicVariables.set({amount_left:A}),g.nextMilestone=_,this.calculatedState.set(g);return}g.lastMilestone=s,this.calculatedState.set(g)}celebrate(e,t){let c=[...e.progressBarConfig.milestones].reverse().find(_=>_.minValue<t);if(!c)return;let m=`lc/en/${e.shortID}/${c.minValue}`;sessionStorage.getItem(m)||(sessionStorage.setItem(m,"1"),this.progressBarConfig?.noConfetti||gt.realistic())}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-progressbar"]],inputs:{cart:"cart"},features:[te(ie()),$],decls:1,vars:1,consts:[[1,"heading",3,"innerHTML"],[1,"milestone-container"],[1,"milestone-list"],[1,"untracked-path"],[1,"tracked-path"],[1,"milestone-list-item",3,"left"],[1,"milestone-list-item"],[1,"milestone-value",3,"innerHTML"],["width","20","height","20","alt","milestone icon",1,"milestone-icon",3,"src"],[1,"milestone-label"]],template:function(t,r){t&1&&z(0,cn,9,8),t&2&&U(r.calculatedState().milestonesReady?0:-1)},dependencies:[ft,qe,xi],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
|
|
12
|
+
`],encapsulation:3})};var dn=["numberVariable"],vt=class o extends me{numberSlot;savingsBarConfig;textParts=_e({start:"",end:""});globalIntervals=[];constructor(){super()}ngAfterViewInit(){this.updateUIVars()}engagementTriggerReceived(e){this.savingsBarConfig=e.content.savingsBarConfig,this.elementRef.nativeElement.classList.add("lc_"+e.entryAnimation?.toLowerCase()),this.savingsBarConfig.iconURL&&this.elementRef.nativeElement.style.setProperty("--lc-discount-icon",this.savingsBarConfig.iconURL)}update(){this.updateUIVars()}updateUIVars(){let e=ve(ve({},this.engagementTrigger.getCartMagicVariables()),bi("total_savings",this.savingsBarConfig.totalSavings)),t=Ze(this.savingsBarConfig.text,{cart:e},this.triggerContext),r=t.match(/[\d.,]+/)?.[0];if(!r){Y.error("No amount found in text",t);return}let[s,c]=t.split(r);this.textParts.set({start:s,end:c}),this.savingsBarConfig.animateNumber?this.runAnimation(r):this.numberSlot.nativeElement.innerHTML=r}runSlotMachineAnimation(e="0"){let t=this.numberSlot.nativeElement;t.innerHTML="";let r=this.savingsBarConfig.animationDuration/e.length;this.clearPreviousIntervals();for(let s=0;s<e.length;s++){let c=document.createElement("div");c.className="digit",c.style.display="inline-block",t.appendChild(c);let m=setInterval(()=>{let g=Math.floor(Math.random()*10);c.innerHTML=`<div>${g}</div>`},50);this.globalIntervals.push(m),setTimeout(()=>{clearInterval(m);let g=e?.[s]??Math.floor(Math.random()*10);c.innerHTML=`${g}`},(s+1)*r)}}clearPreviousIntervals(){this.globalIntervals.forEach(clearInterval),this.globalIntervals=[]}runIncrementalAnimation(e){let t=performance.now(),r=s=>{let c=Math.min((s-t)/this.savingsBarConfig.animationDuration,1);this.numberSlot.nativeElement.innerHTML=Math.floor(e*c).toString(),c<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}runAnimation(e){this.savingsBarConfig.animation==="SLOT_MACHINE"?this.runSlotMachineAnimation(e):this.savingsBarConfig.animation==="INCREMENTAL"&&this.runIncrementalAnimation(Number(e))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-savings-bar"]],viewQuery:function(t,r){if(t&1&&He(dn,5),t&2){let s;je(s=$e())&&(r.numberSlot=s.first)}},features:[$],decls:6,vars:2,consts:[["numberVariable",""],[1,"container"],[1,"icon"],[1,"primary-text",3,"innerHTML"],[1,"counter-text"],[1,"final-text",3,"innerHTML"]],template:function(t,r){t&1&&(Ne(0,"div",1),Te(1,"div",2)(2,"div",3)(3,"div",4,0)(5,"div",5),Be()),t&2&&(I(2),de("innerHTML",r.textParts().start,oe),I(3),de("innerHTML",r.textParts().end,oe))},styles:[`:host{display:block}.container{white-space:pre;display:flex;justify-content:center;align-items:center;background-color:rgba(var(--lc-primary-button-bg-color, 0 162 81));color:rgba(var(--lc-primary-button-color, 255 255 255));padding:8px;border-radius:4px 4px 0 0;overflow:hidden}.container .icon{background-image:var(--lc-discount-icon, url(https://img.icons8.com/ios-glyphs/30/FFFFFF/discount--v1.png));background-position:center;background-size:cover;height:20px;width:20px;margin-right:2px}
|
|
13
|
+
`],encapsulation:3})};var yt=class o extends me{item;data=ne(wi);dialogRef=ne(_i);ItemDetailLayout=Vi;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item}close(){this.dialogRef.close()}engagementTriggerReceived(e){}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-item-quick-view"]],features:[te(ie()),$],decls:1,vars:2,consts:[[3,"closeClick","item","layout"]],template:function(t,r){t&1&&(k(0,"cooee-item-detail",0),H("closeClick",function(){return r.close()}),D()),t&2&&B("item",r.item)("layout",r.ItemDetailLayout.TWO_PANE)},dependencies:[Ii],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media (min-width: 768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
|
|
14
|
+
`],encapsulation:3})};var Ct=class o{dialog=ne(pt);dialogRef;constructor(){}showItemQuickView(e,t){this.dialogRef=this.dialog.open(yt,{width:"100vw",height:"100dvh",backdropClass:["letscooee-backdrop"],data:{item:t,triggerContext:e}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=jt({token:o,factory:o.\u0275fac,providedIn:"root"})};var pn=(o,e)=>({enter:o,exit:e});function un(o,e){if(o&1&&(k(0,"div",7),se(1),D(),k(2,"div",8),se(3),D()),o&2){let t=S(2);I(),ze(" ",t.getCurrency(t.selectedVariant().price.cmp)," "),I(2),ze(" ",t.getDiscountPercentage(t.selectedVariant().price),"% off ")}}function mn(o,e){if(o&1&&(k(0,"div",6),se(1),D()),o&2){let t=S(2);I(),ze(" ",t.stickyATCConfig.leftText," ")}}function fn(o,e){if(o&1&&(k(0,"div",1)(1,"div",5),se(2),D(),z(3,un,4,2),z(4,mn,2,1,"div",6),D()),o&2){let t=S();I(2),ze(" ",t.getCurrency(t.selectedVariant().price.d)," "),I(),U(t.selectedVariant().price.cmp?3:-1),I(),U(t.stickyATCConfig.leftText?4:-1)}}function gn(o,e){if(o&1&&(k(0,"div",9),se(1),D()),o&2){let t=e.$implicit,r=e.$index;S(2);let s=ye(5);B("ngClass",si(2,pn,r===s.currentIndex,r===s.previousIndex)),I(),ze(" ",t," ")}}function hn(o,e){if(o&1&&(k(0,"div",4),we(1,gn,2,5,"div",9,ti),D()),o&2){S();let t=ye(5);I(),Ve(t.features)}}var bt=class o extends me{currentItem;stickyATCConfig;selectedVariant=_e(void 0);featureSlider=_e({features:[],currentIndex:0});constructor(){super()}onVariantChange(e){this.currentItem&&(this.currentItem.setSelectedVariantByID(e.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value))}engagementTriggerReceived(e){this.stickyATCConfig=e.stickyATCConfig??{},this.currentItem=e.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation()}update(){}getCurrency(e){return Ue(e)}getDiscountPercentage(e){return((e.cmp-e.d)/e.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(tt.ADD_TO_CART,{item:this.currentItem})}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let e=this.stickyATCConfig.rightText.split(`
|
|
15
|
+
`),t=e.length===1?null:setInterval(()=>{this.featureSlider.update(r=>Ot(ve({},r),{previousIndex:r.currentIndex,currentIndex:(r.currentIndex+1)%r.features.length}))},3e3);this.featureSlider.set({intervalRef:t,currentIndex:0,features:e})}replaceVariables(e){return e?Ze(e,this.currentItem.getTemplateVariables(),this.triggerContext):""}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-sticky-atc"]],hostBindings:function(t,r){t&1&&H("letscooee:variant-change",function(c){return r.onVariantChange(c)},Qt)},features:[te(ie()),$],decls:7,vars:3,consts:[[1,"lc-wrapper"],[1,"lc-prices"],[1,"lc-button-wrapper"],["type","button",1,"lc-button","lc-button-atc",3,"click"],[1,"lc-features"],[1,"lc-sale-price"],[1,"lc-additional-text"],[1,"lc-compare-price"],[1,"lc-discount-label"],[1,"lc-feature",3,"ngClass"]],template:function(t,r){if(t&1){let s=ae();k(0,"div",0),z(1,fn,5,3,"div",1),k(2,"div",2)(3,"button",3),H("click",function(){return O(s),L(r.addToCart())}),se(4,"Add To Cart"),D(),et(5),z(6,hn,3,0,"div",4),D()()}if(t&2){I(),U(r.selectedVariant()&&r.stickyATCConfig.showProductInfo?1:-1),I(4);let s=De(r.featureSlider());I(),U(s.features.length?6:-1)}},dependencies:[ct],styles:[`:host{display:flex;justify-content:center;padding:10px;background-color:#fff;width:100%;box-shadow:4px 0 10px #0006;line-height:normal}.lc-wrapper{display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:1100px;width:100%}.lc-prices{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px}@media (min-width: 768px){.lc-prices{gap:8px}}.lc-sale-price{font-size:24px;font-weight:600}.lc-compare-price{font-size:18px;font-weight:600;color:red;text-decoration:line-through}.lc-discount-label{font-size:12px;font-weight:500;color:green}.lc-button-wrapper{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;align-items:center}.lc-button{background-color:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.lc-additional-text,.lc-feature{font-size:12px;color:#666}.lc-features{position:relative;overflow:hidden;height:16px;text-align:center;width:100%}.lc-features .lc-feature{position:absolute;width:100%;opacity:0;transform:translateY(100%);transition:transform .5s ease,opacity .5s ease}.lc-features .lc-feature.enter{opacity:1;transform:translateY(0);z-index:2}.lc-features .lc-feature.exit{opacity:0;transform:translateY(-100%);z-index:1}
|
|
16
|
+
`],encapsulation:3})};var yn=["videoEl"];async function $i(){return(await import("./video-detail-dialog.component-I6PISB4Z.js")).VideoDetailDialogComponent}var Ee=class o extends me{videoElements;videos;videoConfig;dialogRef=null;dialog=ne(pt);isMobile=Ei();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),$i()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,s){e?.stopPropagation(),e?.preventDefault();let c=t.items?.[0];if(this.sendTriggerClicked(t,c),this.videoConfig.footerContent==="NONE"){s&&(s.muted=!1,s.play(),this.onMuteToggled(!1,s));return}await this.openDialog(t,r)}sendEvent(e,t,r,s){let c=new gi(e,t,this.engagementTrigger);c.setVideos(r),s&&(c.items=[s.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{Y.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(s=>{let c=s.target,m=c.dataset.videoId;m&&(s.isIntersecting?(this.visibleVideos.add(m),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(m),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Di();if(!e||!this.videos)return;let t=ki();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==Pi)return;let r=this.videos.findIndex(s=>s.shortID===+e);if(r!==-1){let s=this.videos[r];await yi.set("muted",!0),await this.openDialog(s,r)}}async openDialog(e,t){await fi();let r={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let s=await $i();this.dialogRef=this.dialog.open(s,{width:"100vw",height:"100vh",data:r,providers:hi(this.triggerContext,{video:e,index:t}),disableClose:!0});let c={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:c},e),this.dialogRef.closed.subscribe(m=>{if(this.dialogRef=null,!m)return;let g=m.lastVideoDuration*1e3,_={videoID:m.lastVideo.id,videoIndex:m.lastVideoIndex,playedTillMS:g,playedTillPercent:g/m.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:_},m.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&He(yn,5),t&2){let s;je(s=$e())&&(r.videoElements=s)}},features:[$],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var Se=class o{video=It.required({alias:"cooeeVideoSources"});prioritySource=It("high");elementRef=ne(Zt);constructor(){di(()=>{this.updateSources()})}updateSources(){let e=this.elementRef.nativeElement,t=this.video(),r=this.prioritySource();e.querySelectorAll("source").forEach(c=>c.remove()),r==="best"?(this.addSource(t.bestSource),this.addSource(t.highSource),this.addSource(t.lowSource)):r==="low"?(this.addSource(t.lowSource),this.addSource(t.highSource),this.addSource(t.bestSource)):(this.addSource(t.highSource),this.addSource(t.bestSource),this.addSource(t.lowSource)),this.addSource(t.m3u8Source),e.load()}addSource(e){if(!e)return;let t=document.createElement("source");t.src=e.url,t.type=e.mimeType,this.elementRef.nativeElement.appendChild(t)}static \u0275fac=function(t){return new(t||o)};static \u0275dir=Jt({type:o,selectors:[["video","cooeeVideoSources",""]],inputs:{video:[1,"cooeeVideoSources","video"],prioritySource:[1,"prioritySource"]}})};var Cn=(o,e)=>e.id;function bn(o,e){if(o&1&&(re(0,"div",1),ue(1,"safeHtml")),o&2){let t=S();B("innerHTML",Ce(1,1,t.videoConfig.heading),oe)}}function xn(o,e){o&1&&(k(0,"div",6),re(1,"div",13),D())}function _n(o,e){if(o&1){let t=ae();k(0,"cooee-mute-toggle",14),H("toggled",function(s){O(t),S();let c=pe(6),m=S();return L(m.onMuteToggled(s,c))}),D()}if(o&2){S();let t=pe(6);B("muted",t.muted)("videoEl",t)}}function wn(o,e){if(o&1){let t=ae();k(0,"cooee-item-card",15),H("buttonClick",function(){O(t);let s=S(),c=s.$implicit,m=s.$index,g=pe(6),_=S();return L(_.addToCartClicked(null,c,m,g))})("click",function(s){O(t);let c=S(),m=c.$implicit,g=c.$index,_=pe(6),A=S();return L(A.onVideoTap(s,m,g,_))}),D()}if(o&2){S();let t=ye(0);B("item",t)}}function Vn(o,e){if(o&1){let t=ae();k(0,"cooee-video-card",16),H("linkClicked",function(){O(t);let s=S().$implicit,c=S();return L(c.sendTriggerClicked(s))}),D()}if(o&2){S();let t=ye(1);B("card",t)}}function Tn(o,e){if(o&1){let t=ae();et(0)(1),k(2,"div",4)(3,"div",5),H("click",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=pe(6),A=S();return L(A.onVideoTap(s,m,g,_))})("keydown.enter",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=pe(6),A=S();return L(A.onVideoTap(s,m,g,_))})("keydown.space",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=pe(6),A=S();return L(A.onVideoTap(s,m,g,_))}),z(4,xn,2,0,"div",6),k(5,"video",7,0),H("mouseenter",function(){O(t);let s=pe(6);S();let c=ye(1);return L(c&&s.play())})("mouseleave",function(){O(t);let s=pe(6);S();let c=ye(1);return L(c&&s.pause())})("loadstart",function(){let s=O(t).$implicit,c=S();return L(c.onVideoLoadStart(s.id))})("canplay",function(){let s=O(t).$implicit,c=S();return L(c.onVideoCanPlay(s.id))}),D(),k(7,"div",8),z(8,_n,1,2,"cooee-mute-toggle",9),D()(),k(9,"div",10),z(10,wn,1,1,"cooee-item-card",11)(11,Vn,1,1,"cooee-video-card",12),D()()}if(o&2){let t=e.$implicit,r=S(),s=ye(0),c=De(t.items[0]);I();let m=De(t.card),g=c&&r.videoConfig.footerContent==r.VideoConfigFooterContent.FIRST_ITEM,_=m&&r.videoConfig.footerContent==r.VideoConfigFooterContent.CARD;I(2),Xe("background-image",t.thumbnail?"url("+t.thumbnail+")":null),I(),U(r.isVideoLoading(t.id)?4:-1),I(),B("cooeeVideoSources",t)("muted",!0),Ke("preload",s?"metadata":"none")("autoplay",null)("data-video-id",t.id),I(3),U(r.videoConfig.showMuteButton?8:-1),I(2),U(g?10:_?11:-1)}}var xt=class o extends Ee{VideoConfigFooterContent=Mt;VideoConfigAutoPlay=Mi;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig?.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,r,s){let c=t.items?.[0],m=mi.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!m){this.onVideoTap(e,t,r,s);return}this.engagementService.executeCTA(tt.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(tt.GO_TO_PRODUCT,{item:r,video:t})}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-video-playlist"]],features:[te(ie()),$],decls:7,vars:6,consts:[["videoEl",""],[1,"heading-text",3,"innerHTML"],[3,"options","navigationConfig","paginationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-card"],["role","button","tabindex","0","aria-label","Play video","aria-haspopup","dialog",1,"video-wrapper",3,"click","keydown.enter","keydown.space"],[1,"video-loading-overlay"],["width","100%","playsinline","","loop","",3,"mouseenter","mouseleave","loadstart","canplay","cooeeVideoSources","muted"],[1,"video-controls"],[3,"muted","videoEl"],["role","region","aria-label","Video details",1,"video-footer"],["role","button","tabindex","0","aria-label","Product detail",3,"item"],[3,"card"],[1,"loading-spinner"],[3,"toggled","muted","videoEl"],["role","button","tabindex","0","aria-label","Product detail",3,"buttonClick","click","item"],[3,"linkClicked","card"]],template:function(t,r){if(t&1&&(et(0)(1),z(2,bn,2,3,"div",1),k(3,"cooee-swiper",2),ii(4,3),we(5,Tn,12,12,"div",4,Cn),ni(),D()),t&2){De(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),I(),De(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),I(),U(r.videoConfig.heading?2:-1);let s=r.videoConfig.playlistConfig==null?null:r.videoConfig.playlistConfig.videoSwiper;I(),B("options",r.swiperOptions)("navigationConfig",s==null?null:s.navigation)("paginationConfig",s==null?null:s.pagination),I(2),Ve(r.videos)}},dependencies:[Ri,Fi,Ai,Oi,Se,qe],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media (max-width: 768px),(prefers-reduced-motion: reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-info{font-size:14px;line-height:normal}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
|
|
17
|
+
`],encapsulation:3})};var En=["videoElement"],Sn=o=>({"cursor-grab":o}),_t=class o extends Ee{videoElement;video;isDragging=!1;hidden=!1;cdkDrag=ne(ut,{self:!0});untilDestroyed=Ti();constructor(){super()}get popupClasses(){return this.hidden?["hidden"]:["visible"]}onClick(e){e.stopPropagation(),e.preventDefault(),this.onVideoClick()}ngOnInit(){super.ngOnInit();let e=this.elementRef.nativeElement.closest(".letscooee-engagement");e&&(e.style.zIndex="10000"),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=!0)}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay()},100)}onVideoClick(){if(this.isDragging){this.isDragging=!1;return}this.hidden=!0,this.onVideoTap(null,this.video,0)}close(){this.hidden=!0;let e=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent("CE Trigger Closed",{duration:e})}engagementTriggerReceived(e){super.engagementTriggerReceived(e),this.video=this.videos[0]}update(){}onDialogClosed(){this.hidden=!1}autoPlay(){let e=this.videoElement.nativeElement;this.hidden||this.playVideo(e)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-video-popup"]],viewQuery:function(t,r){if(t&1&&He(En,5),t&2){let s;je(s=$e())&&(r.videoElement=s.first)}},hostAttrs:["role","button","tabindex","0","aria-label","Open video popup "],hostVars:3,hostBindings:function(t,r){t&1&&H("keydown.enter",function(c){return r.onClick(c)})("keydown.space",function(c){return r.onClick(c)})("click",function(c){return r.onClick(c)}),t&2&&(de("cdkDragBoundary","body"),oi(r.popupClasses))},features:[te(ie()),Kt([{directive:ut,inputs:["cdkDragBoundary","cdkDragBoundary"]}]),$],decls:9,vars:5,consts:[["videoElement",""],[1,"popup-inner",3,"ngClass"],["type","button","aria-label","Close video popup",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"play-button"],["name","unmute","aria-hidden","true"],[1,"text"],["loop","","preload","metadata","playsinline","",3,"muted","cooeeVideoSources"]],template:function(t,r){if(t&1){let s=ae();k(0,"div",1)(1,"button",2),H("click",function(m){return O(s),m.stopPropagation(),L(r.close())}),re(2,"cooee-icon",3),D(),k(3,"div",4),re(4,"cooee-icon",5),k(5,"div",6),se(6,"Tap to unmute"),D()(),re(7,"video",7,0),D()}t&2&&(B("ngClass",ai(3,Sn,r.isDragging)),I(7),B("muted",!0)("cooeeVideoSources",r.video))},dependencies:[ct,Si,Se],styles:[`:host{position:fixed;display:block;right:24px;bottom:24px;min-height:150px;max-width:150px;box-shadow:0 25px 50px -12px #00000040}:host(.hidden){display:none}.popup-inner{display:flex;justify-content:center;align-items:center;position:relative}video{width:100%;border-radius:8px;background-color:#fff}.close-button{position:absolute;top:-14px;right:-14px;background-color:#00000080;border-radius:9999px;width:32px;height:32px;border:none;z-index:10;display:flex;justify-content:center;align-items:center}.play-button{display:flex;justify-content:center;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(1);transition:all .1s ease-in-out;z-index:999;flex-wrap:wrap;width:100%;max-width:130px;border-radius:5px;padding:5px 10px;background-color:#97979761;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.play-button cooee-icon{width:14px;height:14px}.play-button .text{font-size:11px;line-height:1;color:#fff;font-weight:400;margin-left:5px;text-align:center}
|
|
18
|
+
`],encapsulation:3})};var In=(o,e)=>e.id;function Mn(o,e){if(o&1&&(re(0,"div",1),ue(1,"safeHtml")),o&2){let t=S();B("innerHTML",Ce(1,1,t.videoConfig.heading),oe)}}function Pn(o,e){o&1&&(k(0,"div",9),re(1,"div",11),D())}function kn(o,e){if(o&1){let t=ae();k(0,"div",4),H("click",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=S();return L(_.onVideoTap(s,m,g))})("keydown.enter",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=S();return L(_.onVideoTap(s,m,g))})("keydown.space",function(s){let c=O(t),m=c.$implicit,g=c.$index,_=S();return L(_.onVideoTap(s,m,g))}),$t(),k(1,"svg",5),re(2,"circle",6)(3,"circle",7),D(),zt(),k(4,"div",8),z(5,Pn,2,0,"div",9),k(6,"video",10,0),H("loadstart",function(){let s=O(t).$implicit,c=S();return L(c.onVideoLoadStart(s.id))})("canplay",function(){let s=O(t).$implicit,c=S();return L(c.onVideoCanPlay(s.id))}),D()()()}if(o&2){let t=e.$implicit,r=e.$index,s=S();Ke("aria-label","Open video story "+(r+1)),I(5),U(s.isVideoLoading(t.id)?5:-1),I(),B("poster",t.thumbnail,lt)("cooeeVideoSources",t)("prioritySource","low")("muted",!0),Ke("data-video-id",t.id)}}var wt=class o extends Ee{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=j({type:o,selectors:[["cooee-video-stories"]],features:[te(ie()),$],decls:4,vars:1,consts:[["videoEl",""],[1,"heading-text",3,"innerHTML"],[1,"video-stories"],["role","button","tabindex","0",1,"video-story"],["role","button","tabindex","0",1,"video-story",3,"click","keydown.enter","keydown.space"],["viewBox","0 0 100 100"],["cx","50","cy","50","r","48","fill","none","stroke-width","4"],["cx","50","cy","50","r","48","fill","none","stroke-width","4","stroke-linecap","round","stroke-dasharray","301.6","stroke-dashoffset","301.6",1,"video-story-circle"],[1,"video-wrapper"],[1,"video-loading-overlay"],["loop","","playsinline","","preload","metadata",3,"loadstart","canplay","poster","cooeeVideoSources","prioritySource","muted"],[1,"loading-spinner"]],template:function(t,r){t&1&&(z(0,Mn,2,3,"div",1),k(1,"div",2),we(2,kn,8,7,"div",3,In),D()),t&2&&(U(r.videoConfig.heading?0:-1),I(2),Ve(r.videos))},dependencies:[Se,qe],styles:[`:host{display:block}.video-stories{display:flex;overflow:auto;margin:.75rem;gap:.75rem;justify-content:center;align-items:center;scrollbar-width:none}.video-stories::-webkit-scrollbar{display:none}@media (max-width: 768px){.video-stories{justify-content:start!important}}.video-story{position:relative;width:5rem;height:5rem;cursor:pointer;flex-shrink:0}.video-story svg{position:absolute;top:0;left:0;width:100%;height:100%}.video-story svg circle:first-child{stroke:#d1d5db}.video-story svg circle:last-child{stroke:#3b82f6}.video-story .video-wrapper{position:relative;width:100%;height:100%;border-radius:9999px;overflow:hidden}.video-story .video-wrapper video{width:100%;height:100%;object-fit:cover;border-radius:9999px;position:relative;z-index:1}.video-story .video-wrapper .video-loading-overlay{border-radius:9999px}
|
|
19
|
+
`],encapsulation:3})};ui("CooeeWidgetSDK");(async()=>{let o=await pi(Ni),e=(t,r)=>{let s=Li(t,{injector:o.injector});customElements.define(r,s)};e(bt,"cooee-sticky-atc"),e(vt,"cooee-savings-bar"),e(ht,"cooee-progressbar"),e(xt,"cooee-video-playlist"),e(_t,"cooee-video-popup"),e(wt,"cooee-video-stories"),e(vi,"cooee-product-options-picker"),sessionStorage.cooeeDebug&&import("./debugger.component-BLNLSLZS.js").then(t=>{e(t.DebuggerComponent,"cooee-debugger")}),window.cooeeShowQuickItem=(t,r)=>{o.injector.get(Ct).showItemQuickView(t,r)}})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letscooee/web-sdk",
|
|
3
3
|
"description": "Engage uniquely and boost conversions with AI-powered customer journeys driven by real-time intent",
|
|
4
|
-
"version": "12.1.
|
|
4
|
+
"version": "12.1.2",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "ng lint",
|
|
7
7
|
"integrity": "./scripts/validate-integrity.sh",
|