whatmore-react-assets 1.0.526 → 1.0.528

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.
@@ -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 N}});var r=n(7753),a=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),m=n(4669),p=n(941),g=n(9039),v=n(7300),I=n(6524),f=n(7643),S=n(778),E=n(6417);const T=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(210),n.e(926),n.e(950),n.e(303),n.e(891)]).then(n.bind(n,4095)))),y=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(576),n.e(950),n.e(364),n.e(530)]).then(n.bind(n,5523)))),x=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(358)]).then(n.bind(n,3827)))),_=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(607)]).then(n.bind(n,6071)))),w=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(708)]).then(n.bind(n,1291)))),j=a.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),M=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(210),n.e(803),n.e(926),n.e(303),n.e(209),n.e(790)]).then(n.bind(n,4209)))),C=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(210),n.e(926),n.e(950),n.e(959)]).then(n.bind(n,4048)))),L=a.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(554)]).then(n.bind(n,9085)))),O=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(576),n.e(950),n.e(303),n.e(364),n.e(67)]).then(n.bind(n,4362)))),b=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(210),n.e(803),n.e(926),n.e(303),n.e(209),n.e(196)]).then(n.bind(n,4658))));var D=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[D]=(0,r.j1)("whatmoreTopBottomPadding"),[P]=(0,r.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:G}=(0,a.useContext)(g.I),[W]=(0,r.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:V}=(0,a.useContext)(g.I),k=(0,r.MO)("isLandingSharedLink"),z=(0,r.MO)("whatmoreShareTemplateId"),N=(0,r.MO)("whatmoreShareStoryId"),R=(0,r.MO)("whatmoreShareEventId"),[U,F]=(0,a.useState)(-1),[K,Z]=(0,a.useState)(null);var A=e.events,B=null;function q(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!r&&(0,h.QV)(),t||n||(async()=>{const t=B[e].events[0];(0,l.wh)(t),(0,m.Tc)(W,i.Xh,i.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var o=0;null!=a&&B[e].events.map(((e,t)=>{e.event_id==a&&(o=t)})),F(o),Z(e)}function H(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!r&&(0,h.QV)(),(0,v.B6)(e)||(0,v.WJ)(e))return t||n||(async()=>{(0,l.wh)(e),(0,m.Tc)(W,i.Xh,i.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void F(e.index);const a=20;var{status:c,bannerText:p,timeToStartInMins:g}=s.Z.getEventStatus(e);g<=a&&c.name!==o.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):F(e.index)}function J(e){return(0,E.jsx)(E.Fragment,{})}return G&&!B&&(B=function(e){var t=e.reduce(((e,t,n)=>{var r=t.storyset_id;return r in e?(e[r].total_events=e[r].total_events+1,e[r].events.push(t)):e[r]={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}(A)),(0,a.useEffect)((()=>{k&&V==(0,I.zv)(z)&&(null!=N&&G?B.forEach(((e,t)=>{N==e.id&&q(t,!0,R)})):null!=R&&A.forEach(((e,t)=>{R==e.event_id&&H(e,!0)})))}),[]),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{style:{marginTop:(G?P:D)+"px",marginBottom:(G?P:D)+"px"},children:"template-b"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(T,{events:A,onClick:H,heading:e.heading})}):"template-a-1"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(y,{events:A,onClick:H,heading:e.heading})}):"template-feed-a"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(O,{events:A,onClick:H,heading:e.heading})}):"template-collections-a"===V||"template-c"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(x,{events:A,onClick:H,heading:e.heading})})}):"template-collections-b"===V||"template-d"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(_,{events:A,onClick:H,heading:e.heading})})}):"template-collections-c"===V||"template-e"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(w,{events:A,onClick:H,heading:e.heading})})}):"template-collections-d"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(T,{events:A,onClick:H,heading:e.heading})})}):"template-collections-e"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(C,{events:A,onClick:H,heading:e.heading})})}):"template-f"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(L,{events:A,onClick:H,heading:e.heading})})}):"template-banner-a"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.BANNER_WIDGET_VIEW,event:A[0],triggerFlag:!t&&!n,children:(0,E.jsx)(b,{events:A})})}):G?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(j,{eventsStories:B,onClick:q,template:V})})}):(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(C,{events:A,onClick:H,heading:e.heading})})})}),-1==U?(0,E.jsx)(J,{}):(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.EVENT_VIEW,event:A[U],productList:A[U].products,cta:A[U].cta,triggerFlag:!t&&!n,children:(0,E.jsx)(M,{events:A,index:U,onBack:function(e){(0,c.n2L)(W)&&(0,r.MO)("whatmoreAddedToCart")&&(0,p.D)(W,(()=>{}),100,window.location.hostname),F(-1)},slideDirection:G||"horizontal"===(0,c.e8z)(W)?"horizontal":"vertical",eventsStories:B,initialStoryIndex:K,template:V})})})]})};const P=function(e,t,n){const a=(0,r.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"==a&&"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"==a){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 G=n(3388),W=n(7381),V=n(7376),k=n(7008);var z=function(e){const[t,n]=(0,a.useState)(),[o,s]=(0,a.useState)(),{whatmoreIsStoriesTemplate:l}=(0,a.useContext)(g.I),{whatmoreIsCollectionsTemplate:m}=(0,a.useContext)(g.I),{whatmoreIsBannerTemplate:p}=(0,a.useContext)(g.I),[v]=(0,r.j1)("whatmoreShopId"),[f]=(0,r.j1)("whatmoreCollectionId"),T=(0,r.MO)("whatmoreLandingLocationType"),y=(0,r.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:x}=(0,a.useContext)(g.I),{whatmoreCollectionUrl:_}=(0,a.useContext)(g.I),w=(0,c.cZT)(v)?(0,c._uv)(v)?_:window.location.href.split(/[?#]/)[0]:f,[j,M]=(0,r.j1)("productRatings");var C=(0,c.efR)(v)?i.Dm+"/v2/events/":i.Gc+"/v2/events/",L=(0,c.efR)(v)?i.Dm+"/get_eventset/":i.Gc+"/get_eventset/",O=(0,c.efR)(v)?i.Dm+"/v2/collection":i.Gc+"/v2/collection",b=(0,c.efR)(v)?i.Dm+"/v2/brand/"+v+"/product-events":i.Gc+"/v2/brand/"+v+"/product-events",z=e.shopId,N="live,upcoming";return(0,a.useEffect)((()=>{(0,u.hb)();const e=()=>{const e="_whatmore_bulk_events",t=JSON.parse(localStorage.getItem(e))||[];t&&t.length>0&&((0,k.K)(t),localStorage.removeItem(e))};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]),(0,a.useEffect)((()=>{null==t||0==t.length||o||!(0,d.KE)()||(0,r.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,a.useEffect)((()=>{var e;if(T.startsWith("product")){var t=(0,r.MO)("whatmoreProductId");t=(0,c.iXA)(v)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=b.toString()+"?client_product_id="+t.toString()+"&status="+N.toString()+"&event_type=video"}else if(m||"invalid-url"!==_)e=O.toString()+"?store_id="+z.toString()+"&client_collection_id="+w;else if(p){const t=I.ls,n=(0,I.H1)(T);e=L.toString()+z.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+v}else e=C.toString()+z.toString()+"?status="+N.toString()+"&is_active="+"true".toString()+(l?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(p){const t=I.ls;return(0,G.OC)(e,t)}return(0,G.kW)(e,m||"invalid-url"!==_)})).then((e=>(y&&console.debug("initial received events size : "+e.length),l||p?e:(0,G.e8)(e,z)))).then((e=>(null!=e&&0!=e.length&&(0,c.LUY)(v)&&function(e,t,n){const a=setInterval((()=>{null===(0,r.MO)("productRatings")&&P(e,t,n)}),1e3);setTimeout((()=>{clearInterval(a)}),1e4)}(v,e,(e=>{M(e)})),e))).then((e=>{e&&0!=e.length||g.$.forEach((e=>{var t,n,r;const a=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"]'),i=null!==(n=e.querySelector('.whatmore-template-type[data-wh="template-banner-a"]'))&&void 0!==n?n:e.querySelector('.whatmore-template-type[data="template-banner-a"]'),o=null!==(r=e.querySelector('.whatmore-template-type[data-wh="template-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-f"]')||e.querySelector('.whatmore-template-type[data-wh="template-b"]'))&&void 0!==r?r:e.querySelector('.whatmore-template-type[data="template-a"]')||e.querySelector('.whatmore-template-type[data="template-f"]')||e.querySelector('.whatmore-template-type[data="template-b"]');if(!a&&!i&&!o)return;const s=e.querySelector(".whatmore-render-root");(a&&s||i&&s||o&&s)&&(s.style.minHeight="0px")})),null==e||0==e.length||l||p||(0,c.NOv)(z,e),n(e)})).catch((e=>{s(e.message)}))}),[]),(0,a.useEffect)((()=>{"index"===T?t&&t.length>0&&(0,V.PB)({userInteractionType:S.K.HOMEPAGE_VISITED,widgetSourceDetails:x}):"collection"===T&&t&&t.length>0&&(0,V.PB)({userInteractionType:S.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:x})}),[t]),null==t||0==t.length||o?(0,E.jsx)("div",{}):(y&&(0,W.EI)(t),function(e){if(null!=e){var t=0;e.forEach((e=>{e.index=t++}))}}(t),y&&console.debug("final transformed events data : "+JSON.stringify(t)),y&&console.debug("valid events size : "+t.length),(0,E.jsx)("div",{children:(0,E.jsx)(D,{heading:e.heading,events:t})},"whatmore-main-coponent"))};var N=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[o]=(0,r.j1)("whatmoreShopId"),[s]=(0,r.j1)("whatmoreHeading");return(0,a.useEffect)((()=>{(0,m.ll)(o)}),[]),(0,E.jsx)(E.Fragment,{children:(0,E.jsx)("div",{children:t||n?(0,E.jsx)("div",{children:(0,E.jsx)(z,{heading:s,shopId:i.aA})}):(0,E.jsx)("div",{children:(0,E.jsx)(z,{heading:s,shopId:o})})})})}},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 r=n(499);t.Z=class{static getEventStatus(e){e.time_zone="GMT+5:30";var t=e.start_time+":00",n=e.end_time,a=e.scheduled_date,i=e.status,o=e.time_zone;if(i.toUpperCase()==r.Z.LIVE.name)return{status:r.Z.LIVE,bannerText:" "+r.Z.LIVE.name+" ",timeToStartInMins:0};if(i.toUpperCase()==r.Z.UPCOMING.name){var s=new Date(a+" "+t+" "+o),l=(new Date(a+" "+n+" "+o),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,a=n/60,i=a/60,o=i/24;return n<=0?{status:r.Z.COMPLETED,bannerText:" "+r.Z.COMPLETED.name+" ",timeToStartInMins:0}:n>=1&&n<=30?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(n)+" sec ",timeToStartInMins:n/60}:a<60?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(a)+" min ",timeToStartInMins:a}:i<24?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" hr ",timeToStartInMins:60*i}:o<7?{status:r.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*o*24}:{status:r.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:r.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 r},kW:function(){return o},xg:function(){return a}});const r=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},a=function(e,t){return!(void 0==e.products||0==e.products.length)},i=function(e,t){if(null!=e)return e.filter((e=>1==r(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 r=null!==(n=e.eventsets[t])&&void 0!==n?n:null;return r?function(e){if(null==e||0==e.length)return[];let t=[];return e.forEach((e=>{e.events.forEach((e=>{t.push(e)}))})),t}(r):[]}},7376:function(e,t,n){n.d(t,{GF:function(){return a},PB:function(){return s},Z2:function(){return i},y4:function(){return o}});var r=n(733);function a(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,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 N}});var r=n(7753),a=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),m=n(4669),p=n(941),g=n(9039),v=n(7300),I=n(6524),f=n(7643),S=n(778),E=n(6417);const T=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(210),n.e(926),n.e(950),n.e(303),n.e(891)]).then(n.bind(n,4095)))),y=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(576),n.e(950),n.e(364),n.e(530)]).then(n.bind(n,5523)))),x=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(358)]).then(n.bind(n,3827)))),_=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(607)]).then(n.bind(n,6071)))),w=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(708)]).then(n.bind(n,1291)))),j=a.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),M=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(210),n.e(955),n.e(926),n.e(303),n.e(209),n.e(790)]).then(n.bind(n,4209)))),C=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(210),n.e(926),n.e(950),n.e(959)]).then(n.bind(n,4048)))),L=a.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(554)]).then(n.bind(n,9085)))),O=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(240),n.e(576),n.e(950),n.e(303),n.e(364),n.e(67)]).then(n.bind(n,4362)))),b=a.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(240),n.e(576),n.e(210),n.e(955),n.e(926),n.e(303),n.e(209),n.e(196)]).then(n.bind(n,4658))));var D=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[D]=(0,r.j1)("whatmoreTopBottomPadding"),[P]=(0,r.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:G}=(0,a.useContext)(g.I),[W]=(0,r.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:V}=(0,a.useContext)(g.I),k=(0,r.MO)("isLandingSharedLink"),z=(0,r.MO)("whatmoreShareTemplateId"),N=(0,r.MO)("whatmoreShareStoryId"),R=(0,r.MO)("whatmoreShareEventId"),[U,F]=(0,a.useState)(-1),[K,Z]=(0,a.useState)(null);var A=e.events,B=null;function q(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!r&&(0,h.QV)(),t||n||(async()=>{const t=B[e].events[0];(0,l.wh)(t),(0,m.Tc)(W,i.Xh,i.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var o=0;null!=a&&B[e].events.map(((e,t)=>{e.event_id==a&&(o=t)})),F(o),Z(e)}function H(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!r&&(0,h.QV)(),(0,v.B6)(e)||(0,v.WJ)(e))return t||n||(async()=>{(0,l.wh)(e),(0,m.Tc)(W,i.Xh,i.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void F(e.index);const a=20;var{status:c,bannerText:p,timeToStartInMins:g}=s.Z.getEventStatus(e);g<=a&&c.name!==o.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):F(e.index)}function J(e){return(0,E.jsx)(E.Fragment,{})}return G&&!B&&(B=function(e){var t=e.reduce(((e,t,n)=>{var r=t.storyset_id;return r in e?(e[r].total_events=e[r].total_events+1,e[r].events.push(t)):e[r]={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}(A)),(0,a.useEffect)((()=>{k&&V==(0,I.zv)(z)&&(null!=N&&G?B.forEach(((e,t)=>{N==e.id&&q(t,!0,R)})):null!=R&&A.forEach(((e,t)=>{R==e.event_id&&H(e,!0)})))}),[]),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{style:{marginTop:(G?P:D)+"px",marginBottom:(G?P:D)+"px"},children:"template-b"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(T,{events:A,onClick:H,heading:e.heading})}):"template-a-1"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(y,{events:A,onClick:H,heading:e.heading})}):"template-feed-a"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(O,{events:A,onClick:H,heading:e.heading})}):"template-collections-a"===V||"template-c"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(x,{events:A,onClick:H,heading:e.heading})})}):"template-collections-b"===V||"template-d"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(_,{events:A,onClick:H,heading:e.heading})})}):"template-collections-c"===V||"template-e"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(w,{events:A,onClick:H,heading:e.heading})})}):"template-collections-d"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(T,{events:A,onClick:H,heading:e.heading})})}):"template-collections-e"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(C,{events:A,onClick:H,heading:e.heading})})}):"template-f"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(L,{events:A,onClick:H,heading:e.heading})})}):"template-banner-a"===V?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.BANNER_WIDGET_VIEW,event:A[0],triggerFlag:!t&&!n,children:(0,E.jsx)(b,{events:A})})}):G?(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(j,{eventsStories:B,onClick:q,template:V})})}):(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,E.jsx)(C,{events:A,onClick:H,heading:e.heading})})})}),-1==U?(0,E.jsx)(J,{}):(0,E.jsx)(a.Suspense,{children:(0,E.jsx)(f.u,{userInteractionType:S.K.EVENT_VIEW,event:A[U],productList:A[U].products,cta:A[U].cta,triggerFlag:!t&&!n,children:(0,E.jsx)(M,{events:A,index:U,onBack:function(e){(0,c.n2L)(W)&&(0,r.MO)("whatmoreAddedToCart")&&(0,p.D)(W,(()=>{}),100,window.location.hostname),F(-1)},slideDirection:G||"horizontal"===(0,c.e8z)(W)?"horizontal":"vertical",eventsStories:B,initialStoryIndex:K,template:V})})})]})};const P=function(e,t,n){const a=(0,r.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"==a&&"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"==a){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 G=n(3388),W=n(7381),V=n(7376),k=n(7008);var z=function(e){const[t,n]=(0,a.useState)(),[o,s]=(0,a.useState)(),{whatmoreIsStoriesTemplate:l}=(0,a.useContext)(g.I),{whatmoreIsCollectionsTemplate:m}=(0,a.useContext)(g.I),{whatmoreIsBannerTemplate:p}=(0,a.useContext)(g.I),[v]=(0,r.j1)("whatmoreShopId"),[f]=(0,r.j1)("whatmoreCollectionId"),T=(0,r.MO)("whatmoreLandingLocationType"),y=(0,r.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:x}=(0,a.useContext)(g.I),{whatmoreCollectionUrl:_}=(0,a.useContext)(g.I),w=(0,c.cZT)(v)?(0,c._uv)(v)?_:window.location.href.split(/[?#]/)[0]:f,[j,M]=(0,r.j1)("productRatings");var C=(0,c.efR)(v)?i.Dm+"/v2/events/":i.Gc+"/v2/events/",L=(0,c.efR)(v)?i.Dm+"/get_eventset/":i.Gc+"/get_eventset/",O=(0,c.efR)(v)?i.Dm+"/v2/collection":i.Gc+"/v2/collection",b=(0,c.efR)(v)?i.Dm+"/v2/brand/"+v+"/product-events":i.Gc+"/v2/brand/"+v+"/product-events",z=e.shopId,N="live,upcoming";return(0,a.useEffect)((()=>{(0,u.hb)();const e=()=>{const e="_whatmore_bulk_events",t=JSON.parse(localStorage.getItem(e))||[];t&&t.length>0&&((0,k.K)(t),localStorage.removeItem(e))};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]),(0,a.useEffect)((()=>{null==t||0==t.length||o||!(0,d.KE)()||(0,r.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,a.useEffect)((()=>{var e;if(T.startsWith("product")){var t=(0,r.MO)("whatmoreProductId");t=(0,c.iXA)(v)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=b.toString()+"?client_product_id="+t.toString()+"&status="+N.toString()+"&event_type=video"}else if(m||"invalid-url"!==_)e=O.toString()+"?store_id="+z.toString()+"&client_collection_id="+w;else if(p){const t=I.ls,n=(0,I.H1)(T);e=L.toString()+z.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+v}else e=C.toString()+z.toString()+"?status="+N.toString()+"&is_active="+"true".toString()+(l?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(p){const t=I.ls;return(0,G.OC)(e,t)}return(0,G.kW)(e,m||"invalid-url"!==_)})).then((e=>(y&&console.debug("initial received events size : "+e.length),l||p?e:(0,G.e8)(e,z)))).then((e=>(null!=e&&0!=e.length&&(0,c.LUY)(v)&&function(e,t,n){const a=setInterval((()=>{null===(0,r.MO)("productRatings")&&P(e,t,n)}),1e3);setTimeout((()=>{clearInterval(a)}),1e4)}(v,e,(e=>{M(e)})),e))).then((e=>{e&&0!=e.length||g.$.forEach((e=>{var t,n,r;const a=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"]'),i=null!==(n=e.querySelector('.whatmore-template-type[data-wh="template-banner-a"]'))&&void 0!==n?n:e.querySelector('.whatmore-template-type[data="template-banner-a"]'),o=null!==(r=e.querySelector('.whatmore-template-type[data-wh="template-a"]')||e.querySelector('.whatmore-template-type[data-wh="template-f"]')||e.querySelector('.whatmore-template-type[data-wh="template-b"]'))&&void 0!==r?r:e.querySelector('.whatmore-template-type[data="template-a"]')||e.querySelector('.whatmore-template-type[data="template-f"]')||e.querySelector('.whatmore-template-type[data="template-b"]');if(!a&&!i&&!o)return;const s=e.querySelector(".whatmore-render-root");(a&&s||i&&s||o&&s)&&(s.style.minHeight="0px")})),null==e||0==e.length||l||p||(0,c.NOv)(z,e),n(e)})).catch((e=>{s(e.message)}))}),[]),(0,a.useEffect)((()=>{"index"===T?t&&t.length>0&&(0,V.PB)({userInteractionType:S.K.HOMEPAGE_VISITED,widgetSourceDetails:x}):"collection"===T&&t&&t.length>0&&(0,V.PB)({userInteractionType:S.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:x})}),[t]),null==t||0==t.length||o?(0,E.jsx)("div",{}):(y&&(0,W.EI)(t),function(e){if(null!=e){var t=0;e.forEach((e=>{e.index=t++}))}}(t),y&&console.debug("final transformed events data : "+JSON.stringify(t)),y&&console.debug("valid events size : "+t.length),(0,E.jsx)("div",{children:(0,E.jsx)(D,{heading:e.heading,events:t})},"whatmore-main-coponent"))};var N=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[o]=(0,r.j1)("whatmoreShopId"),[s]=(0,r.j1)("whatmoreHeading");return(0,a.useEffect)((()=>{(0,m.ll)(o)}),[]),(0,E.jsx)(E.Fragment,{children:(0,E.jsx)("div",{children:t||n?(0,E.jsx)("div",{children:(0,E.jsx)(z,{heading:s,shopId:i.aA})}):(0,E.jsx)("div",{children:(0,E.jsx)(z,{heading:s,shopId:o})})})})}},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 r=n(499);t.Z=class{static getEventStatus(e){e.time_zone="GMT+5:30";var t=e.start_time+":00",n=e.end_time,a=e.scheduled_date,i=e.status,o=e.time_zone;if(i.toUpperCase()==r.Z.LIVE.name)return{status:r.Z.LIVE,bannerText:" "+r.Z.LIVE.name+" ",timeToStartInMins:0};if(i.toUpperCase()==r.Z.UPCOMING.name){var s=new Date(a+" "+t+" "+o),l=(new Date(a+" "+n+" "+o),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,a=n/60,i=a/60,o=i/24;return n<=0?{status:r.Z.COMPLETED,bannerText:" "+r.Z.COMPLETED.name+" ",timeToStartInMins:0}:n>=1&&n<=30?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(n)+" sec ",timeToStartInMins:n/60}:a<60?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(a)+" min ",timeToStartInMins:a}:i<24?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" hr ",timeToStartInMins:60*i}:o<7?{status:r.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*o*24}:{status:r.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:r.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 r},kW:function(){return o},xg:function(){return a}});const r=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},a=function(e,t){return!(void 0==e.products||0==e.products.length)},i=function(e,t){if(null!=e)return e.filter((e=>1==r(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 r=null!==(n=e.eventsets[t])&&void 0!==n?n:null;return r?function(e){if(null==e||0==e.length)return[];let t=[];return e.forEach((e=>{e.events.forEach((e=>{t.push(e)}))})),t}(r):[]}},7376:function(e,t,n){n.d(t,{GF:function(){return a},PB:function(){return s},Z2:function(){return i},y4:function(){return o}});var r=n(733);function a(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:a,event:i,productList:o,ctaList:s})}}}]);