whatmore-react-assets 1.0.606 → 1.0.608
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([[554],{9085:function(t,e,o){o.r(e),o.d(e,{default:function(){return E}});var n=o(7313),r=(o(3439),o(6090)),i=o(9039),l=o(7616),s=(o(6143),o(7850),o(4444),o(7244),o(123),o(5892),o(1811),o(9302)),a=o(2575),c=o(9821),d=o(8866),p=o(2279),h=o.n(p),u=o(7753),x=o(7129),m=o(1855),y=o(9854),f=o(7376),v=o(778),g=o(4892),w=o(5945),j=o(9219),M=o(6805),C=o(8984),P=o(6417);var b=function(t){var e,o,r,l,s,a,d,p,h,m;const[f,v,b,S,k]=(0,c.Z)(),I=(0,u.MO)("whatmoreShopId"),O="portrait"===k[M.YP],E=(O?1.076*v*(0,y.pEd)(I):v*(0,y.H4g)(I))+"px",N=(O?1.076*v*(0,y.pEd)(I):v*(0,y.H4g)(I))+"px",Z=(O?.965*v*(0,y.pEd)(I):.859*v*(0,y.H4g)(I))+"px",[R,z]=(0,n.useState)(t.event),F=(0,u.MO)("whatmoreSecondaryColor");var T=(0,n.useContext)(x.V);const W=null===(e=t.isOnFocus)||void 0===e||e,Y=null!==(o=t.playOnUnfocus)&&void 0!==o&&o,_=t.onClick,{whatmoreUITheme:D}=(0,n.useContext)(i.I),L=null!==(r=t.animateOnFocus&&(0,y.iWI)(I))&&void 0!==r&&r,[U,A]=(0,n.useState)(!(0,y.N8M)(I)),B=(0,u.MO)("whatmorePrimaryFont"),H=Math.round(+(null===(l=R.products[0])||void 0===l?void 0:l.price)),X=Math.round(+(null===(s=R.products[0])||void 0===s?void 0:s.compare_price)),G=X&&0!=X&&X>H?Math.ceil((X-H)/X*100):NaN,[V,q]=(0,n.useState)(G);return(0,n.useEffect)((()=>{(0,y.N8M)(I)&&(0,j.p_)(R,(0,y.Ipo)(I),I).then((t=>{var e,o,n;z(t),(null===t||void 0===t||null===(e=t.products)||void 0===e||null===(o=e[0])||void 0===o?void 0:o.discount)&&q(null===t||void 0===t||null===(n=t.products[0])||void 0===n?void 0:n.discount),A(!0)}))}),[]),(0,P.jsxs)("div",{ref:t=>{t&&(t.style.setProperty("margin-top",T.tileTopMargin+"px","important"),t.style.setProperty("margin-bottom",T.tileBottomMMargin+"px","important"))},className:L&&!O?W?"whatmore-event-tile-scale-out-animation":"whatmore-event-tile-scale-in-animation":"none",style:{margin:"0 auto",cursor:"pointer",width:v},onClick:()=>{_(R)},children:[(0,P.jsx)("div",{style:{borderRadius:"round"==D?"5%":"0px",boxShadow:"round"==D?"0px 0px 5px 0px #B0B0B0":null,height:f,borderWidth:(0,y.alU)(I),borderColor:(0,y.qPe)(I),overflow:"hidden"},children:(0,P.jsx)(g.Z,{height:"100%",width:"100%",url:R.thumbnail_image,isPlaying:W||Y||(0,C.gE)(),event:R})}),(0,P.jsxs)("div",{style:{display:"flex",flexDirection:"column",padding:"12px 4px",gap:"5px"},children:[(0,P.jsx)("p",{ref:t=>{t&&(t.style.setProperty("font-size",E,"important"),t.style.setProperty("line-height","120%","important"),t.style.setProperty("font-family",B,"important"),t.style.setProperty("-webkit-line-clamp",1,"important"),t.style.setProperty("line-clamp",1,"important"),t.style.setProperty("-webkit-box-orient","vertical","important"),t.style.setProperty("display","-webkit-box","important"),t.style.setProperty("overflow","hidden","important"),t.style.setProperty("text-overflow","ellipsis","important"))},children:(0,w.s)(null===(a=R.products[0])||void 0===a?void 0:a.title)}),U&&(0,P.jsxs)("div",{style:{display:"flex",gap:"12px",flexDirection:(0,y.$zZ)(I)?"row":"row-reverse",justifyContent:(0,y.$zZ)(I)?"flex-start":"flex-end"},children:[(0,P.jsx)("p",{ref:t=>{t&&(t.style.setProperty("color",(0,y.Uyp)(I),"important"),t.style.setProperty("font-size",N,"important"),t.style.setProperty("font-family",B,"important"),t.style.setProperty("overflow","hidden","important"))},style:{textAlign:"left",fontWeight:"bold"},children:(0,j.jx)(parseFloat(null===(d=R.products[0])||void 0===d?void 0:d.price)," ",I,null===(p=R.products[0])||void 0===p?void 0:p.currency)}),!isNaN(X)&&X>H&&(0,P.jsx)("p",{ref:t=>{t&&(t.style.setProperty("color",(0,y.kPs)(I),"important"),t.style.setProperty("font-size",N,"important"),t.style.setProperty("font-family",B,"important"),t.style.setProperty("overflow","hidden","important"))},style:{textDecoration:"line-through"},children:(0,j.jx)(parseFloat(null===(h=R.products[0])||void 0===h?void 0:h.compare_price)," ",I,null===(m=R.products[0])||void 0===m?void 0:m.currency)})]}),!isNaN(V)&&0!=V&&U&&(0,P.jsx)("div",{style:{display:"flex",backgroundColor:"green"==(0,y.ZJm)(I)?"#343434"==F?(0,y.ZJm)(I):F:(0,y.ZJm)(I),alignItems:"center",borderRadius:"84084818211"==I?"4rem":"4px",width:"fit-content",padding:"3px 6px"},children:(0,P.jsx)("p",{ref:t=>{t&&(t.style.setProperty("color",(0,y.mso)(I),"important"),t.style.setProperty("font-size",Z,"important"),t.style.setProperty("font-family",B,"important"))},children:"".concat(V,"% Off")})})]})]})},S=o(7381);const k=(0,a.Z)({key:"whatmore-css-hv"});function I(t){const[e,o,r]=(0,c.Z)(),l=(0,u.MO)("whatmoreShopId"),s=t.events,a=t.onClick,{whatmoreWidgetSourceDetails:d}=(0,n.useContext)(i.I),p=Math.ceil(r),h=2*p,[x,g]=(0,n.useState)(h),[w,j]=(0,n.useState)(2*p),M=0===(0,y.WGf)(l)?24:(0,y.WGf)(l),[C,S]=(0,n.useState)({touchX:0,touchY:0}),k=()=>(0,P.jsx)("div",{style:{width:"50px",borderRadius:"50%",height:"50px",backgroundColor:"rgba(0, 0, 0, 0.3)"},children:(0,P.jsx)("div",{style:{display:"flex"},className:"whatmore-arrow-right-portrait"})}),I=()=>(0,P.jsx)("div",{style:{width:"50px",borderRadius:"50%",height:"50px",backgroundColor:"rgba(0, 0, 0, 0.3)"},children:(0,P.jsx)("div",{style:{display:"flex"},className:"whatmore-arrow-left-portrait"})}),O=t=>{if("next"===t){const t=2;j((t=>Math.min(t+Math.floor(r),s.length+p+1))),g((e=>Math.min(e+t,s.length+p+1)))}else j((t=>Math.max(t-Math.floor(r),h)));(0,f.y4)({userInteractionType:v.K.HOMEPAGE_CAROUSEL_SWIPED,widgetSourceDetails:d})};return(0,P.jsxs)("div",{className:"whatmore-events-carousel-portrait",style:{display:"flex",justifyContent:"flex-start",paddingLeft:"12px",overflow:"hidden",position:"relative"},onTouchStart:t=>{S({touchX:t.touches[0].clientX,touchY:t.touches[0].clientY})},onTouchEnd:t=>{var e,o,n,r;const i=(null===(e=t.changedTouches)||void 0===e||null===(o=e[0])||void 0===o?void 0:o.clientX)-C.touchX,l=(null===(n=t.changedTouches)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.clientY)-C.touchY;Math.sqrt(i**2+l**2)>10&&Math.abs(i)>Math.abs(l)&&O(i>0?"prev":"next")},children:[(0,y.Yxs)(l)&&(0,P.jsxs)(P.Fragment,{children:[w<=s.length+p&&(0,P.jsx)("div",{onClick:()=>O("next"),style:{position:"absolute",zIndex:1,top:"50%",right:"0",transform:"translateY(-100%)"},children:(0,P.jsx)(k,{})}),w>2*p&&(0,P.jsx)("div",{onClick:()=>O("prev"),style:{position:"absolute",left:"0",zIndex:1,top:"50%",transform:"translateY(-100%)"},children:(0,P.jsx)(I,{})})]}),(0,P.jsx)("div",{style:{display:"flex",gap:M,transform:"translateX(-".concat((w-h)*(o+M),"px)"),transition:"transform 0.4s ease-in-out"},children:s.map(((t,e)=>e<x?(0,P.jsx)("div",{children:(0,P.jsx)(b,{isOnFocus:e<=w-p-1&&e>=Math.max(0,w-h),playOnUnfocus:!1,animateOnFocus:!0,event:t,onClick:()=>a(t)})},"whatmore-carousel-tile-".concat(e)):(0,P.jsx)(m.Z,{})))})]})}function O(t){const[e,o,r,l]=(0,c.Z)(),[s,a]=(0,n.useState)(-1),d=(0,u.MO)("whatmoreShopId"),[p,x]=(0,n.useState)("next"),m=t.onClick,g=t.events,{whatmoreWidgetSourceDetails:w}=(0,n.useContext)(i.I),j=Math.min(Math.ceil(r),g.length),[M,C]=(0,n.useState)(0),S=0===(0,y.WGf)(d)?24:(0,y.WGf)(d),k=()=>(0,P.jsx)("div",{children:(0,P.jsx)("button",{onClick:N,style:{width:"50px",borderRadius:"6px",height:"100px",backgroundColor:"rgba(0, 0, 0, 0.3)"},children:(0,P.jsx)("div",{style:{display:"flex"},className:"whatmore-arrow-right"})})}),I=()=>(0,P.jsx)("div",{children:(0,P.jsx)("button",{onClick:E,style:{width:"50px",borderRadius:"6px",height:"100px",backgroundColor:"rgba(0, 0, 0, 0.3)"},children:(0,P.jsx)("div",{style:{display:"flex"},className:"whatmore-arrow-left"})})});(0,n.useEffect)((()=>{M<=j&&C((t=>t+j))}),[j]);const O=()=>{a(-1)},E=()=>{M!==j&&(x("prev"),C((t=>Math.max(Math.ceil(t-r),j))),(0,f.y4)({userInteractionType:v.K.HOMEPAGE_CAROUSEL_SWIPED,widgetSourceDetails:w}))},N=()=>{M>g.length+r||(x("next"),C((t=>Math.floor(t+r))),(0,f.y4)({userInteractionType:v.K.HOMEPAGE_CAROUSEL_SWIPED,widgetSourceDetails:w}))},Z=M>g.length?g.length-j+1:M-j,R=M>=g.length?g.length:Z+j,z=g.slice(Z,R);return(0,P.jsxs)("div",{className:"whatmore-events-carousel-landscape",style:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",paddingLeft:"".concat(l,"px"),paddingRight:"".concat(l,"px")},children:[g.length>=r-1&&(0,P.jsx)("div",{style:{position:"absolute",left:"0",zIndex:1,top:"50%",transform:"translateX(50%) translateY(-65%)"},children:M!==j&&(0,P.jsx)(I,{})}),(0,P.jsx)("div",{style:{display:"flex",gap:S+"px",width:"".concat(o*r*(0,y.Su5)(d),"px"),paddingLeft:"8px",justifyContent:g.length<=r-1?"center":"flex-start",overflow:"hidden"},children:z.map(((t,e)=>{const o="whatmore-event-tile-landscape-".concat(t.index).concat(e===j-1?"-last":""),n=e===s;return(0,P.jsx)("div",{className:"whatmore-event-tile-horizontal-swipe-animation-".concat("next"===p?"next":"prev"),onMouseEnter:()=>(t=>{const e=h()((()=>a(t)),300);return e(),e.cancel})(e),onMouseLeave:O,children:(0,P.jsx)(b,{isOnFocus:n,playOnUnfocus:!0,animateOnFocus:!0,event:t,onClick:()=>(t=>{m(t)})(t)})},o)}))}),g.length>=r-1&&(0,P.jsx)("div",{style:{position:"absolute",zIndex:1,top:"50%",right:l+"px",transform:"translateY(-65%)"},children:M<=g.length&&(0,P.jsx)(k,{})})]})}var E=function(t){var e;const[o,a,c]=(0,d.Z)(),[p]=(0,u.j1)("whatmoreShopId"),[h]=(0,u.j1)("whatmorePrimaryColor"),[m]=(0,u.j1)("whatmoreSecondaryColor"),[f]=(0,u.j1)("whatmoreTitleFont"),v="portrait"==o?(0,u.MO)("whatmoreTitleFontSizePortrait"):(0,u.MO)("whatmoreTitleFontSize"),{whatmoreRootId:g}=(0,n.useContext)(i.I),w=t.events,j=t.onClick,M=null!==(e=(0,y.aRS)(p))&&void 0!==e?e:f;function C(t){j(t)}return(0,n.useEffect)((()=>{(0,S.Oo)("Video shopping powered by Whatmore!")}),[]),(0,n.useEffect)((()=>{i.$.forEach((t=>{var e;const o=null!==(e=t.querySelector('.whatmore-template-type[data-wh="template-f"]'))&&void 0!==e?e:t.querySelector('.whatmore-template-type[data="template-f"]');if(!o)return;o&&t&&(t.style.minHeight="0px")}))}),[]),delete l.ZP.styles.global,(0,P.jsx)(s.C,{value:k,children:(0,P.jsx)("div",{children:(0,P.jsx)(r.x,{theme:l.ZP,cssVarsRoot:g,resetCSS:!1,children:(0,P.jsxs)(x.V.Provider,{value:{tileTopMargin:25,tileBottomMMargin:25,tileLeftMargin:4,tileRightMargin:4,showPlayButton:!0},children:[t.heading.trim().length>0?(0,P.jsx)("div",{className:"whatmore-events-carousel",style:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,P.jsx)("p",{ref:t=>{t&&(t.style.setProperty("font-family",M,"important"),t.style.setProperty("font-size",v+"px","important"))},style:{color:h,backgroundClip:"text",textAlign:"center",fontWeight:(0,y.wOV)(p),lineHeight:(0,y.vY4)(p),letterSpacing:(0,y.X2K)(p)},children:t.heading})}):(0,P.jsx)(P.Fragment,{}),"landscape"===o?(0,P.jsx)(O,{events:w,onClick:C}):(0,P.jsx)(I,{events:w,onClick:C})]})})})})}},7129:function(t,e,o){o.d(e,{V:function(){return n}});const n=(0,o(7313).createContext)({tileTopMargin:10,tileBottomMMargin:10,tileLeftMargin:10,tileRightMargin:10,showPlayButton:!0})},1855:function(t,e,o){var n=o(7313),r=o(9821),i=o(7129),l=o(6417);e.Z=function(t){var[e,o]=(0,r.Z)();return(0,n.useContext)(i.V),t.event,(0,l.jsx)("div",{style:{margin:"0 auto",width:o,height:e,overflow:"hidden"}})}},3439:function(){},5892:function(){},4444:function(){},1811:function(){},7850:function(){}}]);
|
|
@@ -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(941),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(210),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(210),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(210),n.e(926),n.e(950),n.e(959)]).then(n.bind(n,4048)))),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(554)]).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(67)]).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(210),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||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)<100?t=!1:(r=!0,u(a=[n>e?"scrolled-down":"scrolled-up",n]),a[1]>100&&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(941),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(210),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(210),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(210),n.e(926),n.e(950),n.e(959)]).then(n.bind(n,4048)))),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(554)]).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(67)]).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(210),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)<100?t=!1:(r=!0,u(a=[n>e?"scrolled-down":"scrolled-up",n]),a[1]>100&&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})}}}]);
|