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.
|
@@ -1 +0,0 @@
|
|
|
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:"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(){}}]);
|