whatmore-react-assets 1.0.660 → 1.0.662
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/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkwhatmorelive_react=self.webpackChunkwhatmorelive_react||[]).push([[292],{2784:function(e,t,n){n.d(t,{D:function(){return r}});const o=function(){fetch("/cart.json").then((e=>e.json())).then((e=>{fetch("/cart?view=item").then((e=>e.text())).then((t=>{const n=(new DOMParser).parseFromString(t,"text/html"),o=n.getElementById("CartDrawer"),r=document.getElementById("CartDrawer");o&&r&&(r.innerHTML=o.innerHTML);n.querySelector("#CartDrawer .totals__subtotal-value");const c=document.querySelector("cart-drawer");c&&c.classList.remove("is-empty");const i=document.querySelector("cart-drawer-items");i&&i.classList.remove("is-empty");const a=document.getElementById("cart-icon-bubble");if(a.querySelector(".cart-count-bubble")){a.querySelectorAll('.cart-count-bubble span[aria-hidden="true"]').forEach((t=>{t.textContent=e.item_count}))}else{const t=document.createElement("div");t.className="cart-count-bubble",t.innerHTML='\n <span aria-hidden="true">'.concat(e.item_count,'</span>\n <span class="visually-hidden">').concat(e.item_count," items</span>\n "),a.appendChild(t)}a.click();document.getElementById("CartDrawer-Overlay").addEventListener("click",(()=>{const e=document.querySelector("cart-drawer");e&&e.classList.remove("active"),document.body.classList.remove("overflow-hidden")}))}))}))},r=async function(e,t,n,r){if("STRNV8MHJTF"!=e&&"STR6HU283UZ"!=e&&"STR9T3LLEJB"!=e&&"STRWJMIOJNX"!=e&&"STRUDQ36YAC"!=e&&"STR1D5ONOZX"!=e){var c=await fetch("https://"+window.location.hostname+"/cart.js",{cache:"reload"}).then((e=>e.json()));if("57939755089"==e||"27358003275"==e||"63748341981"==e||"68237558034"==e||"63046287536"==e||"9734029408"==e||"83411075365"==e||"36300750986"==e||"16957273"==e||"9483952"==e||"57265094752"==e||"58538459329"==e||"80266658086"==e||"46784020646"==e)document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{cart:c,openMiniCart:!0}}));else if("19506115"==e)window.PXUTheme.jsAjaxCart.showDrawer(),window.PXUTheme.jsAjaxCart.updateView();else if("54465429691"==e||"41096085665"==e)refreshCart(c),window.setTimeout((function(){$.fancybox.close(),$(".cart-button").click()}),500);else if("25427564"==e||"4243849314"==e||"57708314789"==e){(new theme.CartDrawer).open()}else if("62602182872"==e||"57362710572"==e)CartJS.getCart(),$(".block-cart").addClass("active");else if("83096174866"==e||"63791857821"==e||"70963003672"==e||"20157815"==e||"60492578980"==e||"12183765088"==e||"58546946211"==e||"42070737058"==e||"71321583919"==e||"68492624171"==e||"74541891876"==e||"21187677"==e||"74021110038"==e||"58193838255"==e||"25151799349"==e||"72651899165"==e||"52022313149"==e)document.documentElement.dispatchEvent(new CustomEvent("ajaxProduct:added",{bubbles:!0,detail:{}})),document.documentElement.dispatchEvent(new CustomEvent("cart:open",{bubbles:!0,detail:{}}));else if("2665447536"==e||"51364757670"==e)fetch("/?section_id=cart-drawer").then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"text/html").getElementById("cart-drawer").innerHTML;$("#cart-drawer").html(t),$('[aria-controls="cart-drawer"]')[0].click(),$(".header__cart-count .count-bubble ").html(cart.item_count).css("opacity",1)}));else if("57824805033"==e||"59504656436"==e||"58112966749"==e||"9989358"==e||"26958037078"==e)o();else if("80856187185"==e||"71256211737"==e)fetch("/cart?section_id=mini-cart").then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"text/html").querySelector(".mini-cart__inner").innerHTML;$(".mini-cart__inner").html(t).addClass("active__drawer")})).catch((e=>{console.error(e)})),o();else if("61094723750"==e||"45034766485"==e)SLIDECART&&(SLIDECART_UPDATE(),SLIDECART_OPEN());else if("10272035"==e){const e=document.querySelector(".cart-drawer"),t=e.parentNode;t.classList.add("menu-opening"),t.setAttribute("open","open"),e.style.visibility="visible",e.style.transform="translate(0)"}else"1972174947"==e||"55194878152"==e?document.documentElement.dispatchEvent(new CustomEvent("cart:refresh:opend",{bubbles:!0,detail:{}})):"64463667449"==e||"63897370681"==e||"81998840121"==e||"70964478228"==e?(document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})),document.documentElement.dispatchEvent(new CustomEvent("cart:updated",{bubbles:!0,detail:{cart:c}})),document.getElementById("mini-cart").open=!0):"81545986363"==e?(document.dispatchEvent(new CustomEvent("theme:cartchanged",{bubbles:!0})),document.dispatchEvent(new CustomEvent("theme:open-cart-drawer",{bubbles:!0}))):"41346334884"==e||"74448077083"==e||"26562420"==e||"26759856318"==e?(document.dispatchEvent(new CustomEvent("dispatch:cart-drawer:refresh")),document.dispatchEvent(new CustomEvent("dispatch:cart-drawer:open"))):"6873415750"==e?(document.dispatchEvent(new CustomEvent("cart:change",{bubbles:!0,detail:{cart:c}})),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0}))):"59547517063"==e?(()=>{var e=document.querySelector("cart-notification")||document.querySelector("cart-drawer"),t=window.location.origin?window.location.origin+"/":window.location.protocol+"//"+window.location.host+"/";Shopify.locale.length>0&&(t+=Shopify.locale+"/"),null!==e&&"function"===typeof e.renderContents&&fetch(t+"cart?sections=cart-drawer,cart-icon-bubble",{method:"GET",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"}}).then((function(t){var n=document.querySelector("cart-drawer.drawer.is-empty");null!==n&&n.classList.remove("is-empty");try{return t.clone().json().then((function(t){try{var n={sections:t};e.renderContents(n)}catch(o){console.error(o)}}))}catch(o){console.error(o)}}))})():document.documentElement.dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{}}));setTimeout(t,n)}else{console.log("Executing cart refresh script..");document.getElementById("whatsmorecart").value=Math.random()}}},58:function(e,t,n){n.d(t,{Bi:function(){return a},P7:function(){return u},QV:function(){return s},UD:function(){return r},b5:function(){return i}});var o=n(7753);const r=6;function c(){const e=(0,o.MO)("whatmoreVideoPlayerPool");var t=document.createElement("video");return t.setAttribute("class","whatmore-video-player whatmore-main-video-player-from-pool"),t.setAttribute("width","100%"),t.setAttribute("src","https://whatmore-other-assets.b-cdn.net/whatmore/dummy_for_video_pool_3s_muted_11kb.mp4"),t.muted=!0,t.setAttribute("height","100%"),t.setAttribute("preload","metadata"),t.setAttribute("loop",""),t.setAttribute("playsinline",""),t.setAttribute("x-webkit-airplay","allow"),t.controls=!1,e.appendChild(t),t}const i=function(e){for(let t=1;t<=e;t++)c();(0,o.bU)("whatmoreVideoPlayerPoolInitiated",!0)};const a=function(e,t,n,r){(0,o.MO)("whatmoreVideoPlayerPool");const c=function(e,t,n){var r=(c=(0,o.MO)("whatmoreVideoPlayerPool").children,c.length>0?c[0]:null);var c;if(!r)throw new Error("Whatmore :: not enough blessed videos available in video pool.");return r.setAttribute("src",e),r.muted=t,r.play().then((()=>{!n&&r.pause()})).catch((e=>{})),r}(t,n,r);return e.innerHTML="",e.appendChild(c),c},s=async function(){const e=(0,o.MO)("whatmoreVideoPlayerPool"),t=(0,o.MO)("whatmoreVideoPlayerPoolInitiated");t||i(r);var n=[];for(let o of e.children){o.muted=!0;var c=o.play().then((e=>(!t&&o.pause(),e)));n.push(c)}await Promise.all(n).then((e=>{(0,o.bU)("whatmoreVideoPlayerPoolBlessed",!0)})).catch((e=>{console.error("Whatmore :: Error while blessing "+e.message)}))},u=function(e){const t=(0,o.MO)("whatmoreVideoPlayerPool"),n=e.children[0];n.muted=!0,!n.paused&&n.pause(),t.appendChild(n)}},8984:function(e,t,n){n.d(t,{KE:function(){return c},gE:function(){return r}});var o=n(4862);const r=function(){return o.gn},c=function(){return r()||o.Q5}},7300:function(e,t,n){n.d(t,{B6:function(){return o},WJ:function(){return r},yC:function(){return c}});const o=function(e){return"video"===e.event_type},r=function(e){return"image"===e.event_type},c=function(e){return"livestream"===e.event_type}},5160:function(e,t,n){n.d(t,{$L:function(){return p},JX:function(){return l},Z6:function(){return a},lY:function(){return u},rp:function(){return h},uD:function(){return m},wh:function(){return i},wz:function(){return d},x0:function(){return s}});var o,r=n(2860);const c=null!==(o="true"==localStorage.getItem("whatmoreActivateLogs"))&&void 0!==o&&o;function i(e){c&&console.debug("updating user view count for event.");const t={event_id:e.event_id,increase_by:1};fetch(r.Gc+"/event/metrics/views",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>(c&&console.debug("updating user view count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating user view count response : "+JSON.stringify(e))})).catch((e=>{console.error("error updating user view count user for event : ",e)}))}function a(e,t){c&&console.debug("updating like count for event.");const n={event_id:e.event_id,increase_by:t};fetch(r.Gc+"/event/metrics/like",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>(c&&console.debug("updating like count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating like count response : "+JSON.stringify(e))})).catch((e=>{console.error("error updating like count user for event : ",e)}))}function s(e){c&&console.debug("updating share count for event.");const t={event_id:e.event_id,increase_by:1};fetch(r.Gc+"/event/metrics/share",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>(c&&console.debug("updating share count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating share count response : "+JSON.stringify(e))})).catch((e=>{console.error("error updating share count user for event : ",e)}))}function u(e,t){c&&console.debug("updating wa click count for event.");const n={event_id:e.event_id,increase_by:t};fetch(r.Gc+"/event/metrics/whatsapp",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>(c&&console.debug("updating whatsapp click count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating whatsapp click count response : "+JSON.stringify(e))})).catch((e=>{console.error("error updating whatsapp click count user for event : ",e)}))}function d(e,t){c&&console.debug("updating event-product click count for event {} and product {}.",e.event_id,t.product_id);const n={event_id:e.event_id,product_id:t.product_id,increase_by:1};fetch(r.Gc+"/event/metrics/clicks",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>(c&&console.debug("updating user event-product click count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating user event-product click count response : "+JSON.stringify(e))})).catch((t=>{console.error("error updating user event-product click count for event {} : ",e.event_id,t)}))}function l(e,t,n){c&&console.debug("updating event-product add to cart count for event {} and product {}.",e.event_id,t.product_id);const o={event_id:e.event_id,product_id:t.product_id,increase_by:n};fetch(r.Gc+"/event/metrics/add_to_cart",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>(c&&console.debug("updating user event-product add to cart count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating user event-product add to cart count response : "+JSON.stringify(e))})).catch((t=>{console.error("error updating user event-product add to cart count for event {} : ",e.event_id,t)}))}function p(e,t){c&&console.debug("updating event-product buy now count for event {} and product {}.",e.event_id,t.product_id);const n={event_id:e.event_id,product_id:t.product_id,increase_by:1};fetch(r.Gc+"/event/metrics/buy_now",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>(c&&console.debug("updating user event-product buy now count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating user event-product buy now count response : "+JSON.stringify(e))})).catch((t=>{console.error("error updating user event-product buy now count for event {} : ",e.event_id,t)}))}async function h(){let{storeId:e="",eventId:t=0,productId:n="",variantId:o="",cartToken:i="",checkoutToken:a="",quantity:s=0,price:u="",actionType:d="",trackingId:l=""}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},p={event_id:t,product_id:n,cart_token:i,checkout_token:a,quantity:s,price:u,variant_id:o,action_type:d,tracking_id:l};c&&console.debug("initiating ATC metadata event for eventId {}, productId {}, variantId {} ",t,n,o);const h=await fetch(r.Gc+"/cart-metadata/"+e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(p)}).then((e=>(c&&console.debug("initiating ATC metadata event for eventId {}, productId {}, variantId {} : HTTP "+e.status),e.json()))).catch((e=>{console.error("error initiating ATC metadata event for eventId {}, productId {}, variantId {} : ",t,n,o)}));return h}function m(e){const t={event_id:e.event.event_id,cta_id:e.cta.cta_id,increase_by:1};fetch(r.Gc+"/event/metrics/cta/clicks",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)}).then((e=>(c&&console.debug("updating user cta click count response : HTTP "+e.status),e.json()))).then((e=>{c&&console.debug("updating user cta click count response : "+JSON.stringify(e))})).catch((e=>{console.error("error updating cta click count : ",e)}))}},4669:function(e,t,n){n.d(t,{Tc:function(){return h},ll:function(){return p}});var o,r=n(1824),c=n(7786),i=n(9854);const a="Whatmore Video Shopping",s=null!==(o="true"==localStorage.getItem("whatmoreActivateLogs"))&&void 0!==o&&o,u="Video View",d={carousel:"Carousel",stories:"Stories",video_popup:"Video Popup"},l={homepage:"Home Page",product_page:"Product Page"};async function p(e){if((0,i.DvX)(e)&&null!==(0,i.hfN)(e)&&(c.ZP.initialize((0,i.hfN)(e)),s&&console.debug("Whatmore: initialized GA4")),(0,i.hvq)(e)&&null!==(0,i.BHj)(e)){const t=(0,i.OQz)(e);r.ZP.initialize((0,i.BHj)(e),{useExistingGa:t}),s&&console.debug("Whatmore: initialized GA3")}}async function h(e,t,n){(0,i.hvq)(e)&&null!==(0,i.BHj)(e)&&(r.ZP.event({category:a,action:u,label:l[t]+":"+d[n]}),s&&console.debug("Whatmore: pushed view event to GA3")),(0,i.DvX)(e)&&null!==(0,i.hfN)(e)&&(c.ZP.event({category:a,action:u+":"+l[t]+":"+d[n],value:1,nonInteraction:!1}),s&&console.debug("Whatmore: pushed view event to GA4"))}},733:function(e,t,n){n.d(t,{s:function(){return p}});var o=n(7381),r=n(9854),c=n(7753),i=n(7008);const a=function(e,t,n,o){var r;return{landing_location_type:t.landingLocationType,template_type:t.templateType,whatmore_event:{id:e.event_id,eventset_id:null!==(r=e.eventset_id)&&void 0!==r?r:null,cta_list:o.map((e=>e.cta_id)),product_list:n.map((e=>e.product_id))}}};var s=n(778),u=n(2751),d=n(6967);const l=function(){return{user_id:(0,d.hb)(),session_id:(0,d.sQ)(),user_group:"group-a",user_agent:navigator.userAgent,store_id:(0,c.MO)("whatmoreShopId"),hostname:window.location.hostname,page_path:window.location.pathname,event_id:(0,u.x0)(),event_timestamp:Math.round((new Date).getTime()/1e3)}},p=function(){let{userInteractionType:e="",userInteractionMetadata:t={},widgetSourceDetails:n={},event:u="",productList:d=[],ctaList:p=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const h=(0,c.MO)("isInDesignMode"),m=(0,c.MO)("isDemoBrand"),v=(0,c.MO)("whatmoreShopId");if(!(0,r.AAS)(v)||m||h)return;const g="_whatmore_bulk_events",f=l(),_=(0,s.r)(e,t),w=a(u,n,d,p),b=(0,c.MO)("whatmoreLoggingActive"),y={...f,interaction_data:_,data:w},E=JSON.parse(localStorage.getItem(g))||[];if(E.push(y),localStorage.setItem(g,JSON.stringify(E)),b&&(0,o.EI)(y),clearTimeout(localStorage.getItem("_whatmore_bulk_timer_id")),E.length>=10)(0,i.K)(E),localStorage.removeItem(g);else if(E.length>0){let e=setTimeout((()=>{(0,i.K)(E),localStorage.removeItem(g)}),14e3);localStorage.setItem("_whatmore_bulk_timer_id",e)}}},778:function(e,t,n){n.d(t,{K:function(){return o},r:function(){return r}});const o=Object.freeze({EVENT_VIEW:"event-view",PRODUCT_CTA_VIEW:"product-cta-view",SHOPNOW_ATC_CLICKED:"shop-now-atc-clicked",SHOPNOW_BUYNOW_CLICKED:"shop-now-buy-now-clicked",PRODUCT_TILE_ATC_CLICKED:"product-tile-atc-clicked",PRODUCT_TILE_SHOPNOW_CLICKED:"product-tile-shopnow-clicked",VIDEO_LIKED:"video-liked",VIDEO_UNLIKED:"video-unliked",VIDEO_SHARE_CTA_CLICKED:"video-share-cta-clicked",VIDEO_MUTED:"video-muted",HOMEPAGE_CAROUSEL_SWIPED:"homepage-carousel-swiped",HOMEPAGE_VISITED:"homepage-visited",COLLECTION_PAGE_VISITED:"collection-page-visited",PDP_VISITED:"product-page-visited",HOMEPAGE_CAROUSEL_WIDGET_VIEW:"homepage-carousel-widget-view",BANNER_WIDGET_VIEW:"banner-widget-view",STORIES_WIDGET_VIEW:"stories-widget-view",COLLECTION_WIDGET_VIEW:"collection-widget-view",SPOTLIGHT_WIDGET_VIEW:"spotlight-widget-view",PDP_POPUP_WIDGET_VIEW:"pdp-popup-widget-view",VIDEO_PLAYBACK:"video-playback",SHOPNOW_CLICKED:"shopnow-clicked",WHATSAPP_ICON_CLICKED:"whatsapp-icon-clicked",BANNER_WIDGET_CLICKED:"banner-widget-clicked"}),r=function(e,t){return{name:e,metadata:JSON.stringify(t)}}},7643:function(e,t,n){n.d(t,{u:function(){return s}});var o=n(3933),r=n(9039),c=n(7313),i=n(733),a=n(6417);const s=function(e){var t;const{ref:n,inView:s,entry:u}=(0,o.YD)({triggerOnce:!1,threshold:null!==(t=e.threshold)&&void 0!==t?t:1}),{whatmoreWidgetSourceDetails:d}=(0,c.useContext)(r.I);return(0,c.useEffect)((()=>{var t,n,o,r;s&&null!==(t=e.triggerFlag)&&void 0!==t&&t&&(0,i.s)({userInteractionType:e.userInteractionType,userInteractionMetadata:null!==(n=e.userInteractionMetadata)&&void 0!==n?n:{},widgetSourceDetails:d,event:e.event,productList:null!==(o=e.productList)&&void 0!==o?o:[],ctaList:null!==(r=e.ctaList)&&void 0!==r?r:[]})}),[s]),(0,a.jsx)("div",{ref:n,children:e.children})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkwhatmorelive_react=self.webpackChunkwhatmorelive_react||[]).push([[972],{3972:function(e,t,n){n.r(t),n.d(t,{default:function(){return F}});var a=n(7753),r=n(7313),i=n(2860),o=n(499),s=n(4897),l=n(5160),c=n(9854),u=n(6967),d=n(8984),h=n(58),p=n(4669),m=n(2784),g=n(9039),v=n(7300),I=n(6524),S=n(7643),f=n(778),y=n(6417);const w=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(351),n.e(926),n.e(950),n.e(303),n.e(891)]).then(n.bind(n,4095)))),E=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(576),n.e(950),n.e(364),n.e(530)]).then(n.bind(n,5523)))),x=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(249),n.e(622)]).then(n.bind(n,3827)))),T=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(249),n.e(965)]).then(n.bind(n,6071)))),_=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(708)]).then(n.bind(n,1291)))),j=r.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),L=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(351),n.e(955),n.e(926),n.e(303),n.e(91),n.e(790)]).then(n.bind(n,6091)))),M=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(351),n.e(926),n.e(950),n.e(303),n.e(197)]).then(n.bind(n,1492)))),O=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(303),n.e(189)]).then(n.bind(n,9085)))),C=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(576),n.e(950),n.e(303),n.e(364),n.e(299)]).then(n.bind(n,4362)))),b=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(351),n.e(955),n.e(926),n.e(303),n.e(91),n.e(196)]).then(n.bind(n,4658)))),D=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(84)]).then(n.bind(n,8767))));var P=function(e){const[t]=(0,a.j1)("isInDesignMode"),[n]=(0,a.j1)("isDemoBrand"),[P]=(0,a.j1)("whatmoreTopBottomPadding"),[G]=(0,a.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:W}=(0,r.useContext)(g.I),[V]=(0,a.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:k}=(0,r.useContext)(g.I),q=(0,a.MO)("isLandingSharedLink"),z=(0,a.MO)("whatmoreShareTemplateId"),N=(0,a.MO)("whatmoreShareStoryId"),F=(0,a.MO)("whatmoreShareEventId"),[R,U]=(0,r.useState)(-1),[Z,K]=(0,r.useState)(null);let A=e.events,B=[];if("template-banner-a"!==k){let e=0;for(let t=0;t<(null===A||void 0===A?void 0:A.length);t++){var H,Y,J,X;const n=(null===A||void 0===A||null===(H=A[t])||void 0===H||null===(Y=H.products)||void 0===Y?void 0:Y.length)>0&&(null===A||void 0===A||null===(J=A[t])||void 0===J||null===(X=J.products)||void 0===X?void 0:X.every((e=>"oos"===(null===e||void 0===e?void 0:e.product_status))));if(!(0,v.B6)(A[t])&&!(0,v.WJ)(A[t])||n){if((0,v.yC)(null===A||void 0===A?void 0:A[t])){var{status:Q,bannerText:$,timeToStartInMins:ee}=s.Z.getEventStatus(A[t]);Q.name===o.Z.LIVE.name&&(B.push({...null===A||void 0===A?void 0:A[t],index:e}),e++)}}else B.push({...null===A||void 0===A?void 0:A[t],index:e}),e++}}var te=null;function ne(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!a&&(0,h.QV)(),t||n||(async()=>{const t=te[e].events[0];(0,l.wh)(t),(0,p.Tc)(V,i.Xh,i.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var o=0;null!=r&&te[e].events.map(((e,t)=>{e.event_id==r&&(o=t)})),U(o),K(e)}function ae(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!a&&(0,h.QV)(),(0,v.B6)(e)||(0,v.WJ)(e))return t||n||(async()=>{(0,l.wh)(e),(0,p.Tc)(V,i.Xh,i.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void U(e.index);const r=20;var{status:c,bannerText:m,timeToStartInMins:g}=s.Z.getEventStatus(e);g<=r&&c.name!==o.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):U(e.index)}function re(e){return(0,y.jsx)(y.Fragment,{})}return W&&!te&&(te=function(e){var t=e.reduce(((e,t,n)=>{var a=t.storyset_id;return a in e?(e[a].total_events=e[a].total_events+1,e[a].events.push(t)):e[a]={id:t.storyset_id,title:t.storyset_name,thumbnail_image:t.storyset_thumbnail_image,total_events:1,start_event_index:n,events:[t]},e}),{}),n=Object.values(t);return n.sort(((e,t)=>e.start_event_index-t.start_event_index)),n}(B)),(0,r.useEffect)((()=>{q&&k==(0,I.zv)(z)&&(null!=N&&W?te.forEach(((e,t)=>{N==e.id&&ne(t,!0,F)})):null!=F&&A.forEach(((e,t)=>{F==e.event_id&&ae(e,!0)})))}),[]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{style:{marginTop:(W?G:P)+"px",marginBottom:(W?G:P)+"px"},children:"template-b"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(w,{events:B,onClick:ae,heading:e.heading})}):"template-a-1"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(E,{events:B,onClick:ae,heading:e.heading})}):"template-feed-a"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(C,{events:B,onClick:ae,heading:e.heading})}):"template-collections-a"===k||"template-c"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(x,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-b"===k||"template-d"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(T,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-c"===k||"template-e"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(_,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-d"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(w,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-e"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(M,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-stories"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(D,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-f"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(O,{events:B,onClick:ae,heading:e.heading})})}):"template-banner-a"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.BANNER_WIDGET_VIEW,event:A[0],triggerFlag:!t&&!n,children:(0,y.jsx)(b,{events:A})})}):W?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(j,{eventsStories:te,onClick:ne,template:k})})}):(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(M,{events:B,onClick:ae,heading:e.heading})})})}),-1==R||-2==R?(0,y.jsx)(re,{}):(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.EVENT_VIEW,event:A[R],productList:A[R].products,cta:A[R].cta,triggerFlag:!t&&!n,children:(0,y.jsx)(L,{events:B,index:R,onBack:function(e){(0,c.n2L)(V)&&(0,a.MO)("whatmoreAddedToCart")&&(0,m.D)(V,(()=>{}),100,window.location.hostname),U(-1)},slideDirection:W||"horizontal"===(0,c.e8z)(V)?"horizontal":"vertical",eventsStories:te,initialStoryIndex:Z,template:k})})})]})};const G=function(e,t,n){const r=(0,a.MO)("whatmoreShopId");var i=t.reduce(((e,t,n)=>(t.products.map((e=>e.client_product_id)).forEach((t=>{t in e||(e[t]=!0)})),e)),{}),o=Object.keys(i);if("60960964855"==r&&"undefined"!=typeof fera&&"function"===typeof fera.getRatings){var s={};fera.getRatings(o,(e=>{new Promise(((t,n)=>{e.forEach((e=>{s[e.external_product_id]={avgRating:e.average,totalRatings:e.count}})),t(s)})).then((e=>n(e)))}))}if("23114481744"==r){const e="1e6MQXxzYR19mpw9Km6Dcm86";s={};fetch("https://api.juniphq.com/v1/products?filter[remote_ids]="+o.toString(),{headers:{"Junip-Store-Key":e}}).then((e=>e.json())).then((e=>(e.products.forEach((e=>{s[e.remote_id]={avgRating:parseFloat(e.rating_average).toFixed(1),totalRatings:e.rating_count}})),s))).then((e=>n(e))).catch((e=>console.error(e)))}};var W=n(3388),V=n(7381),k=n(7376),q=n(7008);var z=function(e){const[t,n]=(0,r.useState)(),[o,s]=(0,r.useState)(),{whatmoreIsStoriesTemplate:l}=(0,r.useContext)(g.I),{whatmoreIsCollectionsTemplate:p}=(0,r.useContext)(g.I),{whatmoreIsBannerTemplate:m}=(0,r.useContext)(g.I),[v]=(0,a.j1)("whatmoreShopId"),[S]=(0,a.j1)("whatmoreCollectionId"),w=(0,a.MO)("whatmoreLandingLocationType"),E=(0,a.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:x}=(0,r.useContext)(g.I),{whatmoreCollectionUrl:T}=(0,r.useContext)(g.I),_=(0,c.cZT)(v)?(0,c._uv)(v)?T:window.location.href.split(/[?#]/)[0]:S,[j,L]=(0,a.j1)("productRatings"),[M,O]=(0,r.useState)(!1);var C=(0,c.efR)(v)?i.Dm+"/v2/events/":i.Gc+"/v2/events/",b=(0,c.efR)(v)?i.Dm+"/get_eventset/":i.Gc+"/get_eventset/",D=(0,c.efR)(v)?i.Dm+"/v2/collection":i.Gc+"/v2/collection",z=(0,c.efR)(v)?i.Dm+"/v2/brand/"+v+"/product-events":i.Gc+"/v2/brand/"+v+"/product-events",N=e.shopId,F="live,upcoming";return(0,r.useEffect)((()=>{(0,u.hb)();const e=()=>{const e="_whatmore_bulk_events",t=JSON.parse(localStorage.getItem(e))||[];t&&t.length>0&&((0,q.K)(t),localStorage.removeItem(e))};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]),(0,r.useEffect)((()=>{null==t||0==t.length||o||!(0,d.KE)()||(0,a.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,r.useEffect)((()=>{var e;if(w.startsWith("product")){var t=(0,a.MO)("whatmoreProductId");t=(0,c.iXA)(v)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=z.toString()+"?client_product_id="+t.toString()+"&status="+F.toString()+"&event_type=video"}else if(p||"invalid-url"!==T)e=D.toString()+"?store_id="+N.toString()+"&client_collection_id="+_;else if(m){const t=I.ls,n=(0,I.H1)(w);e=b.toString()+N.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+v}else e=C.toString()+N.toString()+"?status="+F.toString()+"&is_active="+"true".toString()+(l?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(m){const t=I.ls;return(0,W.OC)(e,t)}return(0,W.kW)(e,p||"invalid-url"!==T)})).then((e=>(E&&console.debug("initial received events size : "+e.length),l||p||m?e:(0,W.e8)(e,N)))).then((e=>(null!=e&&0!=e.length&&(0,c.LUY)(v)&&function(e,t,n){const r=setInterval((()=>{null===(0,a.MO)("productRatings")&&G(e,t,n)}),1e3);setTimeout((()=>{clearInterval(r)}),1e4)}(v,e,(e=>{L(e)})),e))).then((e=>{null==e||0==e.length||l||m||(0,c.NOv)(N,e),n(e),O(!0)})).catch((e=>{s(e.message)}))}),[]),(0,r.useEffect)((()=>{"index"===w?t&&t.length>0&&(0,k.PB)({userInteractionType:f.K.HOMEPAGE_VISITED,widgetSourceDetails:x}):"collection"===w&&(t&&t.length>0||(0,c.miB)(v))&&(0,k.PB)({userInteractionType:f.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:x})}),[t]),(M&&(null==t||0==t.length)||o)&&g.$.forEach((e=>{var t,n,a,r;const i=null!==(t=e.querySelector('.whatmore-template-type[data-wh="template-stories-a"]'))&&void 0!==t?t:e.querySelector('.whatmore-template-type[data="template-stories-a"]'),o=null!==(n=e.querySelector('.whatmore-template-type[data-wh="template-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-b"]')||e.querySelector('.whatmore-template-type[data-wh="template-f"]')||e.querySelector('.whatmore-template-type[data-wh="template-e"]'))&&void 0!==n?n:e.querySelector('.whatmore-template-type[data="template-a"]')||e.querySelector('.whatmore-template-type[data="template-b"]')||e.querySelector('.whatmore-template-type[data="template-f"]')||e.querySelector('.whatmore-template-type[data="template-e"]'),s=null!==(a=e.querySelector('.whatmore-template-type[data-wh="template-collections-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-b"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-c"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-stories"]'))&&void 0!==a?a:e.querySelector('.whatmore-template-type[data="template-collections-a"]')||e.querySelector('.whatmore-template-type[data="template-collections-b"]')||e.querySelector('.whatmore-template-type[data="template-collections-c"]')||e.querySelector('.whatmore-template-type[data="template-collections-stories"]'),l=null!==(r=e.querySelector('.whatmore-template-type[data-wh="template-banner-a"]'))&&void 0!==r?r:e.querySelector('.whatmore-template-type[data="template-banner-a"]'),c=e;(l||s||o||i)&&(o&&c||i&&c||l&&c||s&&c)&&(c.style.minHeight="0px")})),null==t||0==t.length||o?(0,y.jsx)("div",{}):(E&&(0,V.EI)(t),function(e){if(null!=e){var t=0;e.forEach((e=>{e.index=t++}))}}(t),E&&console.debug("final transformed events data : "+JSON.stringify(t)),E&&console.debug("valid events size : "+t.length),(0,y.jsx)(P,{heading:e.heading,events:t}))},N=n(3933);var F=function(e){const[t]=(0,a.j1)("isInDesignMode"),[n]=(0,a.j1)("isDemoBrand"),[o]=(0,a.j1)("whatmoreShopId"),[s]=(0,a.j1)("whatmoreHeading"),[l,u]=(0,r.useState)(["initial",window.pageYOffset]),[d,h]=(0,r.useState)(!1),m=(0,a.MO)("isLandingSharedLink");(0,r.useEffect)((()=>{if((0,p.ll)(o),!(0,c.wc0)(o))return;let e=window.pageYOffset,t=!1;const n=()=>{const n=window.pageYOffset;var a,r;Math.abs(n-e)<10?t=!1:(r=!0,u(a=[n>e?"scrolled-down":"scrolled-up",n]),a[1]>10&&h(r),e=n>0?n:0,t=!1)},a=()=>{t||(window.requestAnimationFrame(n),t=!0)};return window.addEventListener("scroll",a),()=>window.removeEventListener("scroll",a)}),[]);const[g,v,I]=(0,N.YD)({triggerOnce:!0});return(0,y.jsx)("div",{ref:g,style:{display:"block"},children:d||v||m||!(0,c.wc0)(o)?t||n?(0,y.jsx)(z,{heading:s,shopId:i.aA}):(0,y.jsx)(z,{heading:s,shopId:o}):(0,y.jsx)("div",{})})}},499:function(e,t){t.Z={LIVE:{name:"LIVE",color:"gray.600"},UPCOMING:{name:"UPCOMING",color:"gray.600"},DEFAULT:{name:"LIVE EVENT",color:"gray.600"},COMPLETED:{name:"ENDED",color:"gray.600"}}},4897:function(e,t,n){var a=n(499);t.Z=class{static getEventStatus(e){e.time_zone="GMT+5:30";var t=e.start_time+":00",n=e.end_time,r=e.scheduled_date,i=e.status,o=e.time_zone;if(i.toUpperCase()==a.Z.LIVE.name)return{status:a.Z.LIVE,bannerText:" "+a.Z.LIVE.name+" ",timeToStartInMins:0};if(i.toUpperCase()==a.Z.UPCOMING.name){var s=new Date(r+" "+t+" "+o),l=(new Date(r+" "+n+" "+o),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,r=n/60,i=r/60,o=i/24;return n<=0?{status:a.Z.COMPLETED,bannerText:" "+a.Z.COMPLETED.name+" ",timeToStartInMins:0}:n>=1&&n<=30?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(n)+" sec ",timeToStartInMins:n/60}:r<60?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(r)+" min ",timeToStartInMins:r}:i<24?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" hr ",timeToStartInMins:60*i}:o<7?{status:a.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*o*24}:{status:a.Z.UPCOMING,bannerText:"Upcoming",timeToStartInMins:2880}}(s));return{status:l.status,bannerText:l.bannerText,timeToStartInMins:l.timeToStartInMins}}return console.error("invalid status for event :: id : "+e.event_id+", status : "+e.status),{status:a.Z.DEFAULT,bannerText:"live event",timeToStartInMins:2880}}}},3388:function(e,t,n){n.d(t,{OC:function(){return s},e8:function(){return i},kT:function(){return a},kW:function(){return o},xg:function(){return r}});const a=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},r=function(e,t){return!(void 0==e.products||0==e.products.length)},i=function(e,t){if(null!=e)return e.filter((e=>1==a(e)))},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null!=e)return t?e.events[0].events:e.events};const s=function(e,t){var n;if(null==e)return[];if(!("eventsets"in e))return[];const a=null!==(n=e.eventsets[t])&&void 0!==n?n:null;return a?function(e){if(null==e||0==e.length)return[];let t=[];return e.forEach((e=>{e.events.forEach((e=>{t.push(e)}))})),t}(a):[]}},7376:function(e,t,n){n.d(t,{GF:function(){return r},PB:function(){return s},Z2:function(){return i},y4:function(){return o}});var a=n(733);function r(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkwhatmorelive_react=self.webpackChunkwhatmorelive_react||[]).push([[972],{3972:function(e,t,n){n.r(t),n.d(t,{default:function(){return F}});var a=n(7753),r=n(7313),i=n(2860),o=n(499),s=n(4897),l=n(5160),c=n(9854),u=n(6967),d=n(8984),h=n(58),p=n(4669),m=n(2784),g=n(9039),v=n(7300),I=n(6524),S=n(7643),f=n(778),y=n(6417);const w=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(351),n.e(926),n.e(950),n.e(303),n.e(891)]).then(n.bind(n,4095)))),E=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(576),n.e(950),n.e(364),n.e(530)]).then(n.bind(n,5523)))),x=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(249),n.e(622)]).then(n.bind(n,3827)))),T=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(249),n.e(965)]).then(n.bind(n,6071)))),_=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(708)]).then(n.bind(n,1291)))),j=r.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),L=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(351),n.e(955),n.e(926),n.e(303),n.e(91),n.e(790)]).then(n.bind(n,6091)))),M=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(351),n.e(926),n.e(950),n.e(303),n.e(197)]).then(n.bind(n,1492)))),O=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(303),n.e(189)]).then(n.bind(n,9085)))),C=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(576),n.e(950),n.e(303),n.e(364),n.e(299)]).then(n.bind(n,4362)))),b=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(351),n.e(955),n.e(926),n.e(303),n.e(91),n.e(196)]).then(n.bind(n,4658)))),D=r.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(367),n.e(423),n.e(926),n.e(950),n.e(84)]).then(n.bind(n,8767))));var P=function(e){const[t]=(0,a.j1)("isInDesignMode"),[n]=(0,a.j1)("isDemoBrand"),[P]=(0,a.j1)("whatmoreTopBottomPadding"),[G]=(0,a.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:W}=(0,r.useContext)(g.I),[V]=(0,a.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:k}=(0,r.useContext)(g.I),q=(0,a.MO)("isLandingSharedLink"),z=(0,a.MO)("whatmoreShareTemplateId"),N=(0,a.MO)("whatmoreShareStoryId"),F=(0,a.MO)("whatmoreShareEventId"),[R,U]=(0,r.useState)(-1),[Z,K]=(0,r.useState)(null);let A=e.events,B=[];if("template-banner-a"!==k){let e=0;for(let t=0;t<(null===A||void 0===A?void 0:A.length);t++){var H,Y,J,X;const n=(null===A||void 0===A||null===(H=A[t])||void 0===H||null===(Y=H.products)||void 0===Y?void 0:Y.length)>0&&(null===A||void 0===A||null===(J=A[t])||void 0===J||null===(X=J.products)||void 0===X?void 0:X.every((e=>"oos"===(null===e||void 0===e?void 0:e.product_status))));if(!(0,v.B6)(A[t])&&!(0,v.WJ)(A[t])||n){if((0,v.yC)(null===A||void 0===A?void 0:A[t])){var{status:Q,bannerText:$,timeToStartInMins:ee}=s.Z.getEventStatus(A[t]);Q.name===o.Z.LIVE.name&&(B.push({...null===A||void 0===A?void 0:A[t],index:e}),e++)}}else B.push({...null===A||void 0===A?void 0:A[t],index:e}),e++}}var te=null;function ne(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!a&&(0,h.QV)(),t||n||(async()=>{const t=te[e].events[0];(0,l.wh)(t),(0,p.Tc)(V,i.Xh,i.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var o=0;null!=r&&te[e].events.map(((e,t)=>{e.event_id==r&&(o=t)})),U(o),K(e)}function ae(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!a&&(0,h.QV)(),(0,v.B6)(e)||(0,v.WJ)(e))return t||n||(async()=>{(0,l.wh)(e),(0,p.Tc)(V,i.Xh,i.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void U(e.index);const r=20;var{status:c,bannerText:m,timeToStartInMins:g}=s.Z.getEventStatus(e);g<=r&&c.name!==o.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):U(e.index)}function re(e){return(0,y.jsx)(y.Fragment,{})}return W&&!te&&(te=function(e){var t=e.reduce(((e,t,n)=>{var a=t.storyset_id;return a in e?(e[a].total_events=e[a].total_events+1,e[a].events.push(t)):e[a]={id:t.storyset_id,title:t.storyset_name,thumbnail_image:t.storyset_thumbnail_image,total_events:1,start_event_index:n,events:[t]},e}),{}),n=Object.values(t);return n.sort(((e,t)=>e.start_event_index-t.start_event_index)),n}(B)),(0,r.useEffect)((()=>{q&&k==(0,I.zv)(z)&&(null!=N&&W?te.forEach(((e,t)=>{N==e.id&&ne(t,!0,F)})):null!=F&&B.forEach(((e,t)=>{F==e.event_id&&ae(e,!0)})))}),[]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{style:{marginTop:(W?G:P)+"px",marginBottom:(W?G:P)+"px"},children:"template-b"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(w,{events:B,onClick:ae,heading:e.heading})}):"template-a-1"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(E,{events:B,onClick:ae,heading:e.heading})}):"template-feed-a"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(C,{events:B,onClick:ae,heading:e.heading})}):"template-collections-a"===k||"template-c"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(x,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-b"===k||"template-d"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(T,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-c"===k||"template-e"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(_,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-d"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(w,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-e"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(M,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-collections-stories"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(D,{events:B,index:R,setScreen:U,onClick:ae,heading:e.heading})})}):"template-f"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(O,{events:B,onClick:ae,heading:e.heading})})}):"template-banner-a"===k?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.BANNER_WIDGET_VIEW,event:A[0],triggerFlag:!t&&!n,children:(0,y.jsx)(b,{events:A})})}):W?(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(j,{eventsStories:te,onClick:ne,template:k})})}):(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,y.jsx)(M,{events:B,onClick:ae,heading:e.heading})})})}),-1==R||-2==R?(0,y.jsx)(re,{}):(0,y.jsx)(r.Suspense,{children:(0,y.jsx)(S.u,{userInteractionType:f.K.EVENT_VIEW,event:A[R],productList:A[R].products,cta:A[R].cta,triggerFlag:!t&&!n,children:(0,y.jsx)(L,{events:B,index:R,onBack:function(e){(0,c.n2L)(V)&&(0,a.MO)("whatmoreAddedToCart")&&(0,m.D)(V,(()=>{}),100,window.location.hostname),U(-1)},slideDirection:W||"horizontal"===(0,c.e8z)(V)?"horizontal":"vertical",eventsStories:te,initialStoryIndex:Z,template:k})})})]})};const G=function(e,t,n){const r=(0,a.MO)("whatmoreShopId");var i=t.reduce(((e,t,n)=>(t.products.map((e=>e.client_product_id)).forEach((t=>{t in e||(e[t]=!0)})),e)),{}),o=Object.keys(i);if("60960964855"==r&&"undefined"!=typeof fera&&"function"===typeof fera.getRatings){var s={};fera.getRatings(o,(e=>{new Promise(((t,n)=>{e.forEach((e=>{s[e.external_product_id]={avgRating:e.average,totalRatings:e.count}})),t(s)})).then((e=>n(e)))}))}if("23114481744"==r){const e="1e6MQXxzYR19mpw9Km6Dcm86";s={};fetch("https://api.juniphq.com/v1/products?filter[remote_ids]="+o.toString(),{headers:{"Junip-Store-Key":e}}).then((e=>e.json())).then((e=>(e.products.forEach((e=>{s[e.remote_id]={avgRating:parseFloat(e.rating_average).toFixed(1),totalRatings:e.rating_count}})),s))).then((e=>n(e))).catch((e=>console.error(e)))}};var W=n(3388),V=n(7381),k=n(7376),q=n(7008);var z=function(e){const[t,n]=(0,r.useState)(),[o,s]=(0,r.useState)(),{whatmoreIsStoriesTemplate:l}=(0,r.useContext)(g.I),{whatmoreIsCollectionsTemplate:p}=(0,r.useContext)(g.I),{whatmoreIsBannerTemplate:m}=(0,r.useContext)(g.I),[v]=(0,a.j1)("whatmoreShopId"),[S]=(0,a.j1)("whatmoreCollectionId"),w=(0,a.MO)("whatmoreLandingLocationType"),E=(0,a.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:x}=(0,r.useContext)(g.I),{whatmoreCollectionUrl:T}=(0,r.useContext)(g.I),_=(0,c.cZT)(v)?(0,c._uv)(v)?T:window.location.href.split(/[?#]/)[0]:S,[j,L]=(0,a.j1)("productRatings"),[M,O]=(0,r.useState)(!1);var C=(0,c.efR)(v)?i.Dm+"/v2/events/":i.Gc+"/v2/events/",b=(0,c.efR)(v)?i.Dm+"/get_eventset/":i.Gc+"/get_eventset/",D=(0,c.efR)(v)?i.Dm+"/v2/collection":i.Gc+"/v2/collection",z=(0,c.efR)(v)?i.Dm+"/v2/brand/"+v+"/product-events":i.Gc+"/v2/brand/"+v+"/product-events",N=e.shopId,F="live,upcoming";return(0,r.useEffect)((()=>{(0,u.hb)();const e=()=>{const e="_whatmore_bulk_events",t=JSON.parse(localStorage.getItem(e))||[];t&&t.length>0&&((0,q.K)(t),localStorage.removeItem(e))};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]),(0,r.useEffect)((()=>{null==t||0==t.length||o||!(0,d.KE)()||(0,a.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,r.useEffect)((()=>{var e;if(w.startsWith("product")){var t=(0,a.MO)("whatmoreProductId");t=(0,c.iXA)(v)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=z.toString()+"?client_product_id="+t.toString()+"&status="+F.toString()+"&event_type=video"}else if(p||"invalid-url"!==T)e=D.toString()+"?store_id="+N.toString()+"&client_collection_id="+_;else if(m){const t=I.ls,n=(0,I.H1)(w);e=b.toString()+N.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+v}else e=C.toString()+N.toString()+"?status="+F.toString()+"&is_active="+"true".toString()+(l?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(m){const t=I.ls;return(0,W.OC)(e,t)}return(0,W.kW)(e,p||"invalid-url"!==T)})).then((e=>(E&&console.debug("initial received events size : "+e.length),l||p||m?e:(0,W.e8)(e,N)))).then((e=>(null!=e&&0!=e.length&&(0,c.LUY)(v)&&function(e,t,n){const r=setInterval((()=>{null===(0,a.MO)("productRatings")&&G(e,t,n)}),1e3);setTimeout((()=>{clearInterval(r)}),1e4)}(v,e,(e=>{L(e)})),e))).then((e=>{null==e||0==e.length||l||m||(0,c.NOv)(N,e),n(e),O(!0)})).catch((e=>{s(e.message)}))}),[]),(0,r.useEffect)((()=>{"index"===w?t&&t.length>0&&(0,k.PB)({userInteractionType:f.K.HOMEPAGE_VISITED,widgetSourceDetails:x}):"collection"===w&&(t&&t.length>0||(0,c.miB)(v))&&(0,k.PB)({userInteractionType:f.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:x})}),[t]),(M&&(null==t||0==t.length)||o)&&g.$.forEach((e=>{var t,n,a,r;const i=null!==(t=e.querySelector('.whatmore-template-type[data-wh="template-stories-a"]'))&&void 0!==t?t:e.querySelector('.whatmore-template-type[data="template-stories-a"]'),o=null!==(n=e.querySelector('.whatmore-template-type[data-wh="template-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-b"]')||e.querySelector('.whatmore-template-type[data-wh="template-f"]')||e.querySelector('.whatmore-template-type[data-wh="template-e"]'))&&void 0!==n?n:e.querySelector('.whatmore-template-type[data="template-a"]')||e.querySelector('.whatmore-template-type[data="template-b"]')||e.querySelector('.whatmore-template-type[data="template-f"]')||e.querySelector('.whatmore-template-type[data="template-e"]'),s=null!==(a=e.querySelector('.whatmore-template-type[data-wh="template-collections-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-b"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-c"]')||e.querySelector('.whatmore-template-type[data-wh="template-collections-stories"]'))&&void 0!==a?a:e.querySelector('.whatmore-template-type[data="template-collections-a"]')||e.querySelector('.whatmore-template-type[data="template-collections-b"]')||e.querySelector('.whatmore-template-type[data="template-collections-c"]')||e.querySelector('.whatmore-template-type[data="template-collections-stories"]'),l=null!==(r=e.querySelector('.whatmore-template-type[data-wh="template-banner-a"]'))&&void 0!==r?r:e.querySelector('.whatmore-template-type[data="template-banner-a"]'),c=e;(l||s||o||i)&&(o&&c||i&&c||l&&c||s&&c)&&(c.style.minHeight="0px")})),null==t||0==t.length||o?(0,y.jsx)("div",{}):(E&&(0,V.EI)(t),function(e){if(null!=e){var t=0;e.forEach((e=>{e.index=t++}))}}(t),E&&console.debug("final transformed events data : "+JSON.stringify(t)),E&&console.debug("valid events size : "+t.length),(0,y.jsx)(P,{heading:e.heading,events:t}))},N=n(3933);var F=function(e){const[t]=(0,a.j1)("isInDesignMode"),[n]=(0,a.j1)("isDemoBrand"),[o]=(0,a.j1)("whatmoreShopId"),[s]=(0,a.j1)("whatmoreHeading"),[l,u]=(0,r.useState)(["initial",window.pageYOffset]),[d,h]=(0,r.useState)(!1),m=(0,a.MO)("isLandingSharedLink");(0,r.useEffect)((()=>{if((0,p.ll)(o),!(0,c.wc0)(o))return;let e=window.pageYOffset,t=!1;const n=()=>{const n=window.pageYOffset;var a,r;Math.abs(n-e)<10?t=!1:(r=!0,u(a=[n>e?"scrolled-down":"scrolled-up",n]),a[1]>10&&h(r),e=n>0?n:0,t=!1)},a=()=>{t||(window.requestAnimationFrame(n),t=!0)};return window.addEventListener("scroll",a),()=>window.removeEventListener("scroll",a)}),[]);const[g,v,I]=(0,N.YD)({triggerOnce:!0});return(0,y.jsx)("div",{ref:g,style:{display:"block"},children:d||v||m||!(0,c.wc0)(o)?t||n?(0,y.jsx)(z,{heading:s,shopId:i.aA}):(0,y.jsx)(z,{heading:s,shopId:o}):(0,y.jsx)("div",{})})}},499:function(e,t){t.Z={LIVE:{name:"LIVE",color:"gray.600"},UPCOMING:{name:"UPCOMING",color:"gray.600"},DEFAULT:{name:"LIVE EVENT",color:"gray.600"},COMPLETED:{name:"ENDED",color:"gray.600"}}},4897:function(e,t,n){var a=n(499);t.Z=class{static getEventStatus(e){e.time_zone="GMT+5:30";var t=e.start_time+":00",n=e.end_time,r=e.scheduled_date,i=e.status,o=e.time_zone;if(i.toUpperCase()==a.Z.LIVE.name)return{status:a.Z.LIVE,bannerText:" "+a.Z.LIVE.name+" ",timeToStartInMins:0};if(i.toUpperCase()==a.Z.UPCOMING.name){var s=new Date(r+" "+t+" "+o),l=(new Date(r+" "+n+" "+o),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,r=n/60,i=r/60,o=i/24;return n<=0?{status:a.Z.COMPLETED,bannerText:" "+a.Z.COMPLETED.name+" ",timeToStartInMins:0}:n>=1&&n<=30?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(n)+" sec ",timeToStartInMins:n/60}:r<60?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(r)+" min ",timeToStartInMins:r}:i<24?{status:a.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" hr ",timeToStartInMins:60*i}:o<7?{status:a.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*o*24}:{status:a.Z.UPCOMING,bannerText:"Upcoming",timeToStartInMins:2880}}(s));return{status:l.status,bannerText:l.bannerText,timeToStartInMins:l.timeToStartInMins}}return console.error("invalid status for event :: id : "+e.event_id+", status : "+e.status),{status:a.Z.DEFAULT,bannerText:"live event",timeToStartInMins:2880}}}},3388:function(e,t,n){n.d(t,{OC:function(){return s},e8:function(){return i},kT:function(){return a},kW:function(){return o},xg:function(){return r}});const a=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},r=function(e,t){return!(void 0==e.products||0==e.products.length)},i=function(e,t){if(null!=e)return e.filter((e=>1==a(e)))},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null!=e)return t?e.events[0].events:e.events};const s=function(e,t){var n;if(null==e)return[];if(!("eventsets"in e))return[];const a=null!==(n=e.eventsets[t])&&void 0!==n?n:null;return a?function(e){if(null==e||0==e.length)return[];let t=[];return e.forEach((e=>{e.events.forEach((e=>{t.push(e)}))})),t}(a):[]}},7376:function(e,t,n){n.d(t,{GF:function(){return r},PB:function(){return s},Z2:function(){return i},y4:function(){return o}});var a=n(733);function r(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s}=e;(0,a.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:r,event:i,productList:o,ctaList:s})}}}]);
|