whatmore-react-assets 1.0.400 → 1.0.401
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 k}});var r=n(7753),i=n(7313),a=n(2860),s=n(499),o=n(4897),c=n(5160),l=n(9854),u=n(6967),d=n(8984),h=n(58),g=n(4669),v=n(941),m=n(4136),p=n(7300),I=n(6524),f=n(7643),T=n(778),S=n(6417);const E=i.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)))),x=i.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)))),_=i.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)))),j=i.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)))),y=i.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(986)]).then(n.bind(n,1291)))),w=i.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),M=i.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(660),n.e(68)]).then(n.bind(n,1660)))),C=i.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)))),O=i.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)))),L=i.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(660),n.e(334)]).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"),[b]=(0,r.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:P}=(0,i.useContext)(m.I),[G]=(0,r.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:W}=(0,i.useContext)(m.I),V=(0,r.MO)("isLandingSharedLink"),k=(0,r.MO)("whatmoreShareTemplateId"),N=(0,r.MO)("whatmoreShareStoryId"),z=(0,r.MO)("whatmoreShareEventId"),[U,Z]=(0,i.useState)(-1),[F,K]=(0,i.useState)(null);var R=e.events,A=null;function B(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!r&&(0,h.QV)(),t||n||(async()=>{const t=A[e].events[0];(0,c.wh)(t),(0,g.Tc)(G,a.Xh,a.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var s=0;null!=i&&A[e].events.map(((e,t)=>{e.event_id==i&&(s=t)})),Z(s),K(e)}function H(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!r&&(0,h.QV)(),(0,p.B6)(e)||(0,p.WJ)(e))return t||n||(async()=>{(0,c.wh)(e),(0,g.Tc)(G,a.Xh,a.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void Z(e.index);const i=20;var{status:l,bannerText:v,timeToStartInMins:m}=o.Z.getEventStatus(e);m<=i&&l.name!==s.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):Z(e.index)}function X(e){return(0,S.jsx)(S.Fragment,{})}return P&&!A&&(A=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}(R)),(0,i.useEffect)((()=>{V&&W==(0,I.zv)(k)&&(null!=N&&P?A.forEach(((e,t)=>{N==e.id&&B(t,!0,z)})):null!=z&&R.forEach(((e,t)=>{z==e.event_id&&H(e,!0)})))}),[]),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{style:{marginTop:(P?b:D)+"px",marginBottom:(P?b:D)+"px"},children:"template-b"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(E,{events:R,onClick:H,heading:e.heading})}):"template-a-1"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(x,{events:R,onClick:H,heading:e.heading})}):"template-feed-a"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(O,{events:R,onClick:H,heading:e.heading})}):"template-collections-a"===W||"template-c"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(_,{events:R,onClick:H,heading:e.heading})})}):"template-collections-b"===W||"template-d"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(j,{events:R,onClick:H,heading:e.heading})})}):"template-collections-c"===W||"template-e"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(y,{events:R,onClick:H,heading:e.heading})})}):"template-collections-d"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(E,{events:R,onClick:H,heading:e.heading})})}):"template-collections-e"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(C,{events:R,onClick:H,heading:e.heading})})}):"template-banner-a"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.BANNER_WIDGET_VIEW,event:R[0],triggerFlag:!t&&!n,children:(0,S.jsx)(L,{events:R})})}):P?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(w,{eventsStories:A,onClick:B,template:W})})}):(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(C,{events:R,onClick:H,heading:e.heading})})})}),-1==U?(0,S.jsx)(X,{}):(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.EVENT_VIEW,event:R[U],productList:R[U].products,cta:R[U].cta,triggerFlag:!t&&!n,children:(0,S.jsx)(M,{events:R,index:U,onBack:function(e){(0,l.n2)(G)&&(0,r.MO)("whatmoreAddedToCart")&&(0,v.D)(G,(()=>{}),100,window.location.hostname),Z(-1)},slideDirection:P||"horizontal"===(0,l.e8)(G)?"horizontal":"vertical",eventsStories:A,initialStoryIndex:F,template:W})})})]})};const b=function(e,t,n){const i=(0,r.MO)("whatmoreShopId");var a=t.reduce(((e,t,n)=>(t.products.map((e=>e.client_product_id)).forEach((t=>{t in e||(e[t]=!0)})),e)),{}),s=Object.keys(a);if("60960964855"==i&&"undefined"!=typeof fera&&"function"===typeof fera.getRatings){var o={};fera.getRatings(s,(e=>{new Promise(((t,n)=>{e.forEach((e=>{o[e.external_product_id]={avgRating:e.average,totalRatings:e.count}})),t(o)})).then((e=>n(e)))}))}if("23114481744"==i){const e="1e6MQXxzYR19mpw9Km6Dcm86";o={};fetch("https://api.juniphq.com/v1/products?filter[remote_ids]="+s.toString(),{headers:{"Junip-Store-Key":e}}).then((e=>e.json())).then((e=>(e.products.forEach((e=>{o[e.remote_id]={avgRating:parseFloat(e.rating_average).toFixed(1),totalRatings:e.rating_count}})),o))).then((e=>n(e))).catch((e=>console.error(e)))}};var P=n(3388),G=n(7381),W=n(7376);var V=function(e){const[t,n]=(0,i.useState)(),[s,o]=(0,i.useState)(),{whatmoreIsStoriesTemplate:c}=(0,i.useContext)(m.I),{whatmoreIsCollectionsTemplate:g}=(0,i.useContext)(m.I),{whatmoreIsBannerTemplate:v}=(0,i.useContext)(m.I),[p]=(0,r.j1)("whatmoreShopId"),[f]=(0,r.j1)("whatmoreCollectionId"),E=(0,r.MO)("whatmoreLandingLocationType"),x=(0,r.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:_}=(0,i.useContext)(m.I),j=(0,l.cZ)(p)?window.location.href.split(/[?#]/)[0]:f,[y,w]=(0,r.j1)("productRatings");var M=(0,l.ef)(p)?a.Dm+"/v2/events/":a.Gc+"/v2/events/",C=(0,l.ef)(p)?a.Dm+"/get_eventset/":a.Gc+"/get_eventset/",O=(0,l.ef)(p)?a.Dm+"/v2/collection":a.Gc+"/v2/collection",L=(0,l.ef)(p)?a.Dm+"/v2/brand/"+p+"/product-events":a.Gc+"/v2/brand/"+p+"/product-events",V=e.shopId,k="live,upcoming";return(0,i.useEffect)((()=>{(0,u.hb)()}),[]),(0,i.useEffect)((()=>{null==t||0==t.length||s||!(0,d.KE)()||(0,r.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,i.useEffect)((()=>{var e;if(E.startsWith("product")){var t=(0,r.MO)("whatmoreProductId");t=(0,l.iX)(p)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=L.toString()+"?client_product_id="+t.toString()+"&status="+k.toString()+"&event_type=video"}else if(g)e=O.toString()+"?store_id="+V.toString()+"&client_collection_id="+j;else if(v){const t=I.ls,n=(0,I.H1)(E);e=C.toString()+V.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+p}else e=M.toString()+V.toString()+"?status="+k.toString()+"&is_active="+"true".toString()+(c?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(v){const t=I.ls;return(0,P.OC)(e,t)}return(0,P.kW)(e,g)})).then((e=>(x&&console.debug("initial received events size : "+e.length),c||v?e:(0,P.e8)(e,V)))).then((e=>(null!=e&&0!=e.length&&(0,l.LU)(p)&&function(e,t,n){const i=setInterval((()=>{null===(0,r.MO)("productRatings")&&b(e,t,n)}),1e3);setTimeout((()=>{clearInterval(i)}),1e4)}(p,e,(e=>{w(e)})),e))).then((e=>{null==e||0==e.length||c||(0,l.NO)(V,e),n(e)})).catch((e=>{o(e.message)}))}),[]),(0,i.useEffect)((()=>{"index"===E?t&&(0,W.PB)({userInteractionType:T.K.HOMEPAGE_VISITED,widgetSourceDetails:_}):"collection"===E&&t&&(0,W.PB)({userInteractionType:T.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:_})}),[t]),null==t||0==t.length||s?(0,S.jsx)("div",{}):(x&&(0,G.EI)(t),function(e,t){if(null!=e){var n=0;e.forEach((e=>{e.index=n++}))}}(t),x&&console.debug("final transformed events data : "+JSON.stringify(t)),x&&console.debug("valid events size : "+t.length),(0,S.jsx)("div",{children:(0,S.jsx)(D,{heading:e.heading,events:t})},"whatmore-main-coponent"))};var k=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[s]=(0,r.j1)("whatmoreShopId"),[o]=(0,r.j1)("whatmoreHeading"),[c]=(0,r.j1)("whatmorePrimaryColor"),[l]=(0,r.j1)("whatmoreSecondaryColor");return(0,i.useEffect)((()=>{(0,g.ll)(s)}),[]),(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("div",{children:t||n?(0,S.jsx)("div",{children:(0,S.jsx)(V,{heading:o,shopId:a.aA})}):(0,S.jsx)("div",{children:(0,S.jsx)(V,{heading:o,shopId:s})})})})}},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,i=e.scheduled_date,a=e.status,s=e.time_zone;if(a.toUpperCase()==r.Z.LIVE.name)return{status:r.Z.LIVE,bannerText:" "+r.Z.LIVE.name+" ",timeToStartInMins:0};if(a.toUpperCase()==r.Z.UPCOMING.name){var o=new Date(i+" "+t+" "+s),c=(new Date(i+" "+n+" "+s),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,i=n/60,a=i/60,s=a/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}:i<60?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" min ",timeToStartInMins:i}:a<24?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(a)+" hr ",timeToStartInMins:60*a}:s<7?{status:r.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*s*24}:{status:r.Z.UPCOMING,bannerText:"Upcoming",timeToStartInMins:2880}}(o));return{status:c.status,bannerText:c.bannerText,timeToStartInMins:c.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 o},e8:function(){return a},kT:function(){return r},kW:function(){return s},xg:function(){return i}});const r=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},i=function(e,t){return!(void 0==e.products||0==e.products.length)},a=function(e,t){if(null!=e)return e.filter((e=>1==r(e)))},s=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 o=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 i},PB:function(){return o},Z2:function(){return a},y4:function(){return s}});var r=n(795);function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function a(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}}}]);
|
|
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 k}});var r=n(7753),i=n(7313),a=n(2860),s=n(499),o=n(4897),c=n(5160),l=n(9854),u=n(6967),d=n(8984),h=n(58),g=n(4669),v=n(941),m=n(4136),p=n(7300),I=n(6524),f=n(7643),T=n(778),S=n(6417);const E=i.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)))),x=i.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)))),_=i.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)))),j=i.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)))),y=i.lazy((()=>Promise.all([n.e(302),n.e(819),n.e(13),n.e(367),n.e(926),n.e(950),n.e(986)]).then(n.bind(n,1291)))),w=i.lazy((()=>Promise.all([n.e(302),n.e(580)]).then(n.bind(n,3580)))),M=i.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(660),n.e(68)]).then(n.bind(n,1660)))),C=i.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)))),O=i.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)))),L=i.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(660),n.e(334)]).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"),[b]=(0,r.j1)("whatmoreStoriesTopBottomPadding"),{whatmoreIsStoriesTemplate:P}=(0,i.useContext)(m.I),[G]=(0,r.j1)("whatmoreShopId"),{whatmoreEventsBrowsingTemplate:W}=(0,i.useContext)(m.I),V=(0,r.MO)("isLandingSharedLink"),k=(0,r.MO)("whatmoreShareTemplateId"),N=(0,r.MO)("whatmoreShareStoryId"),U=(0,r.MO)("whatmoreShareEventId"),[z,Z]=(0,i.useState)(-1),[F,K]=(0,i.useState)(null);var R=e.events,A=null;function B(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(0,d.KE)()&&!r&&(0,h.QV)(),t||n||(async()=>{const t=A[e].events[0];(0,c.wh)(t),(0,g.Tc)(G,a.Xh,a.OW),(0,u.H4)(t.event_id,t.products,"homepage","stories")})();var s=0;null!=i&&A[e].events.map(((e,t)=>{e.event_id==i&&(s=t)})),Z(s),K(e)}function H(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,d.KE)()&&!r&&(0,h.QV)(),(0,p.B6)(e)||(0,p.WJ)(e))return t||n||(async()=>{(0,c.wh)(e),(0,g.Tc)(G,a.Xh,a.pR),(0,u.H4)(e.event_id,e.products,"homepage","carousel")})(),void Z(e.index);const i=20;var{status:l,bannerText:v,timeToStartInMins:m}=o.Z.getEventStatus(e);m<=i&&l.name!==s.Z.LIVE.name?console.debug(" TODO : show toast on upcoming live event."):Z(e.index)}function X(e){return(0,S.jsx)(S.Fragment,{})}return P&&!A&&(A=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}(R)),(0,i.useEffect)((()=>{V&&W==(0,I.zv)(k)&&(null!=N&&P?A.forEach(((e,t)=>{N==e.id&&B(t,!0,U)})):null!=U&&R.forEach(((e,t)=>{U==e.event_id&&H(e,!0)})))}),[]),(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{style:{marginTop:(P?b:D)+"px",marginBottom:(P?b:D)+"px"},children:"template-b"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(E,{events:R,onClick:H,heading:e.heading})}):"template-a-1"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(x,{events:R,onClick:H,heading:e.heading})}):"template-feed-a"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(O,{events:R,onClick:H,heading:e.heading})}):"template-collections-a"===W||"template-c"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(_,{events:R,onClick:H,heading:e.heading})})}):"template-collections-b"===W||"template-d"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(j,{events:R,onClick:H,heading:e.heading})})}):"template-collections-c"===W||"template-e"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.COLLECTION_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(y,{events:R,onClick:H,heading:e.heading})})}):"template-collections-d"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(E,{events:R,onClick:H,heading:e.heading})})}):"template-collections-e"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(C,{events:R,onClick:H,heading:e.heading})})}):"template-banner-a"===W?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.BANNER_WIDGET_VIEW,event:R[0],triggerFlag:!t&&!n,children:(0,S.jsx)(L,{events:R})})}):P?(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.STORIES_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(w,{eventsStories:A,onClick:B,template:W})})}):(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.HOMEPAGE_CAROUSEL_WIDGET_VIEW,triggerFlag:!t&&!n,children:(0,S.jsx)(C,{events:R,onClick:H,heading:e.heading})})})}),-1==z?(0,S.jsx)(X,{}):(0,S.jsx)(i.Suspense,{children:(0,S.jsx)(f.u,{userInteractionType:T.K.EVENT_VIEW,event:R[z],productList:R[z].products,cta:R[z].cta,triggerFlag:!t&&!n,children:(0,S.jsx)(M,{events:R,index:z,onBack:function(e){(0,l.n2)(G)&&(0,r.MO)("whatmoreAddedToCart")&&(0,v.D)(G,(()=>{}),100,window.location.hostname),Z(-1)},slideDirection:P||"horizontal"===(0,l.e8)(G)?"horizontal":"vertical",eventsStories:A,initialStoryIndex:F,template:W})})})]})};const b=function(e,t,n){const i=(0,r.MO)("whatmoreShopId");var a=t.reduce(((e,t,n)=>(t.products.map((e=>e.client_product_id)).forEach((t=>{t in e||(e[t]=!0)})),e)),{}),s=Object.keys(a);if("60960964855"==i&&"undefined"!=typeof fera&&"function"===typeof fera.getRatings){var o={};fera.getRatings(s,(e=>{new Promise(((t,n)=>{e.forEach((e=>{o[e.external_product_id]={avgRating:e.average,totalRatings:e.count}})),t(o)})).then((e=>n(e)))}))}if("23114481744"==i){const e="1e6MQXxzYR19mpw9Km6Dcm86";o={};fetch("https://api.juniphq.com/v1/products?filter[remote_ids]="+s.toString(),{headers:{"Junip-Store-Key":e}}).then((e=>e.json())).then((e=>(e.products.forEach((e=>{o[e.remote_id]={avgRating:parseFloat(e.rating_average).toFixed(1),totalRatings:e.rating_count}})),o))).then((e=>n(e))).catch((e=>console.error(e)))}};var P=n(3388),G=n(7381),W=n(7376);var V=function(e){const[t,n]=(0,i.useState)(),[s,o]=(0,i.useState)(),{whatmoreIsStoriesTemplate:c}=(0,i.useContext)(m.I),{whatmoreIsCollectionsTemplate:g}=(0,i.useContext)(m.I),{whatmoreIsBannerTemplate:v}=(0,i.useContext)(m.I),[p]=(0,r.j1)("whatmoreShopId"),[f]=(0,r.j1)("whatmoreCollectionId"),E=(0,r.MO)("whatmoreLandingLocationType"),x=(0,r.MO)("whatmoreLoggingActive"),{whatmoreWidgetSourceDetails:_}=(0,i.useContext)(m.I),{whatmoreCollectionUrl:j}=(0,i.useContext)(m.I),y=(0,l.cZ)(p)?(0,l._u)(p)?j:window.location.href.split(/[?#]/)[0]:f,[w,M]=(0,r.j1)("productRatings");var C=(0,l.ef)(p)?a.Dm+"/v2/events/":a.Gc+"/v2/events/",O=(0,l.ef)(p)?a.Dm+"/get_eventset/":a.Gc+"/get_eventset/",L=(0,l.ef)(p)?a.Dm+"/v2/collection":a.Gc+"/v2/collection",V=(0,l.ef)(p)?a.Dm+"/v2/brand/"+p+"/product-events":a.Gc+"/v2/brand/"+p+"/product-events",k=e.shopId,N="live,upcoming";return(0,i.useEffect)((()=>{(0,u.hb)()}),[]),(0,i.useEffect)((()=>{null==t||0==t.length||s||!(0,d.KE)()||(0,r.MO)("whatmoreVideoPlayerPoolInitiated")||(0,h.b5)(h.UD)}),[t]),(0,i.useEffect)((()=>{var e;if(E.startsWith("product")){var t=(0,r.MO)("whatmoreProductId");t=(0,l.iX)(p)?function(e){return e.split(/[?#]/)[0]}(window.location.href):t,e=V.toString()+"?client_product_id="+t.toString()+"&status="+N.toString()+"&event_type=video"}else if(g||"invalid-url"!==j)e=L.toString()+"?store_id="+k.toString()+"&client_collection_id="+y;else if(v){const t=I.ls,n=(0,I.H1)(E);e=O.toString()+k.toString()+"?eventset_type="+t+"&source="+n+"&source_id="+p}else e=C.toString()+k.toString()+"?status="+N.toString()+"&is_active="+"true".toString()+(c?"&template_type=stories":"");fetch(e).then((e=>e.json())).then((e=>{if(v){const t=I.ls;return(0,P.OC)(e,t)}return(0,P.kW)(e,g||"invalid-url"!==j)})).then((e=>(x&&console.debug("initial received events size : "+e.length),c||v?e:(0,P.e8)(e,k)))).then((e=>(null!=e&&0!=e.length&&(0,l.LU)(p)&&function(e,t,n){const i=setInterval((()=>{null===(0,r.MO)("productRatings")&&b(e,t,n)}),1e3);setTimeout((()=>{clearInterval(i)}),1e4)}(p,e,(e=>{M(e)})),e))).then((e=>{null==e||0==e.length||c||(0,l.NO)(k,e),n(e)})).catch((e=>{o(e.message)}))}),[]),(0,i.useEffect)((()=>{"index"===E?t&&(0,W.PB)({userInteractionType:T.K.HOMEPAGE_VISITED,widgetSourceDetails:_}):"collection"===E&&t&&(0,W.PB)({userInteractionType:T.K.COLLECTION_PAGE_VISITED,widgetSourceDetails:_})}),[t]),null==t||0==t.length||s?(0,S.jsx)("div",{}):(x&&(0,G.EI)(t),function(e,t){if(null!=e){var n=0;e.forEach((e=>{e.index=n++}))}}(t),x&&console.debug("final transformed events data : "+JSON.stringify(t)),x&&console.debug("valid events size : "+t.length),(0,S.jsx)("div",{children:(0,S.jsx)(D,{heading:e.heading,events:t})},"whatmore-main-coponent"))};var k=function(e){const[t]=(0,r.j1)("isInDesignMode"),[n]=(0,r.j1)("isDemoBrand"),[s]=(0,r.j1)("whatmoreShopId"),[o]=(0,r.j1)("whatmoreHeading"),[c]=(0,r.j1)("whatmorePrimaryColor"),[l]=(0,r.j1)("whatmoreSecondaryColor");return(0,i.useEffect)((()=>{(0,g.ll)(s)}),[]),(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("div",{children:t||n?(0,S.jsx)("div",{children:(0,S.jsx)(V,{heading:o,shopId:a.aA})}):(0,S.jsx)("div",{children:(0,S.jsx)(V,{heading:o,shopId:s})})})})}},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,i=e.scheduled_date,a=e.status,s=e.time_zone;if(a.toUpperCase()==r.Z.LIVE.name)return{status:r.Z.LIVE,bannerText:" "+r.Z.LIVE.name+" ",timeToStartInMins:0};if(a.toUpperCase()==r.Z.UPCOMING.name){var o=new Date(i+" "+t+" "+s),c=(new Date(i+" "+n+" "+s),function(e){var t=new Date,n=(e.getTime()-t.getTime())/1e3,i=n/60,a=i/60,s=a/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}:i<60?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(i)+" min ",timeToStartInMins:i}:a<24?{status:r.Z.UPCOMING,bannerText:"Starts in "+Math.round(a)+" hr ",timeToStartInMins:60*a}:s<7?{status:r.Z.UPCOMING,bannerText:" "+["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.getDay()]+" ",timeToStartInMins:60*s*24}:{status:r.Z.UPCOMING,bannerText:"Upcoming",timeToStartInMins:2880}}(o));return{status:c.status,bannerText:c.bannerText,timeToStartInMins:c.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 o},e8:function(){return a},kT:function(){return r},kW:function(){return s},xg:function(){return i}});const r=function(e,t){return!((void 0==e.products||0==e.products.length)&&(void 0==e.cta||0==e.cta.length))},i=function(e,t){return!(void 0==e.products||0==e.products.length)},a=function(e,t){if(null!=e)return e.filter((e=>1==r(e)))},s=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 o=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 i},PB:function(){return o},Z2:function(){return a},y4:function(){return s}});var r=n(795);function i(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function a(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function s(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}function o(e){let{userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o}=e;(0,r.s)({userInteractionType:t,userInteractionMetadata:n,widgetSourceDetails:i,event:a,productList:s,ctaList:o})}}}]);
|