@streamlayer/react 0.40.2 → 0.40.3
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/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +47 -47
- package/lib/cjs/useSdkFeature.js +1 -1
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/dist/cjs/index.js +199 -1
- package/lib/dist/es/index.js +43362 -7
- package/lib/dist/index.d.ts +101 -24
- package/lib/dist/style.css +1 -1
- package/lib/es/gamification-feature.js +10 -1365
- package/lib/es/masters.js +8 -6
- package/lib/es/masters2.js +12810 -11394
- package/lib/es/useSdkFeature.js +145 -80
- package/lib/es/useStreamLayerApp.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +13 -13
- package/lib/dist/cjs/gamification-feature.js +0 -1
- package/lib/dist/cjs/masters.js +0 -200
- package/lib/dist/es/gamification-feature.js +0 -1636
- package/lib/dist/es/masters.js +0 -43278
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./useSdkFeature.js"),k=require("@nanostores/react"),h=require("react"),x=require("./masters2.js"),u=require("@streamlayer/sdk-web-types");require("react-countup");const de=require("react-countdown-circle-timer"),S=require("./index2.js"),ce=require("react-infinite-scroller");require("lodash.throttle");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");const ue=n.styled_default("div")({name:"Container",class:"c1vwopgc",propsAsIs:!1}),pe=n.styled_default("div")({name:"QuestionTypeWrap",class:"qyktpt0",propsAsIs:!1}),me=()=>n.c1,he=n.styled_default(me())({name:"QuestionTypeIcon",class:"q951jdx",propsAsIs:!0}),xe=n.styled_default("span")({name:"QuestionTypeTitle",class:"qss5f0e",propsAsIs:!1}),fe=n.styled_default("div")({name:"CloseIconWrap",class:"c1ao1jtv",propsAsIs:!1}),Ie=()=>n.c1,ye=n.styled_default(Ie())({name:"CloseIcon",class:"cvsl7l3",propsAsIs:!0}),se=({type:s,close:t,label:i})=>{const o=s?x.o[s]:{label:i,iconName:void 0};return e.jsxs(ue,{children:[e.jsxs(pe,{children:[(o==null?void 0:o.iconName)&&e.jsx(he,{"data-type-trivia":s===u.QuestionType.TRIVIA,"data-type-poll":s===u.QuestionType.POLL,name:o.iconName}),(o==null?void 0:o.label)&&e.jsx(xe,{children:o.label})]}),e.jsx(fe,{onClick:t,children:e.jsx(ye,{name:"icon-cross"})})]})},ve=n.styled_default("div")({name:"Container",class:"c1zy8a",propsAsIs:!1}),je=n.styled_default("div")({name:"Title",class:"t1vih9p5",propsAsIs:!1}),Ce=n.styled_default("div")({name:"Indicator",class:"i1fbnvpb",propsAsIs:!1}),Y=({indicator:s,title:t})=>e.jsxs(ve,{children:[e.jsx(je,{children:t}),e.jsx(Ce,{children:s})]}),Ae=n.styled_default("div")({name:"Container",class:"ctmhwyc",propsAsIs:!1}),ge=n.styled_default("div")({name:"Indicator",class:"i1jri200",propsAsIs:!1}),_e=n.styled_default("div")({name:"Title",class:"t8s05oq",propsAsIs:!1}),L=({indicator:s,title:t})=>e.jsxs(Ae,{children:[e.jsx(ge,{children:s}),e.jsx(_e,{children:t})]}),be=n.styled_default("div")({name:"Container",class:"c1yrpn9o",propsAsIs:!1}),Te=n.styled_default("div")({name:"TopInfo",class:"t17fwahh",propsAsIs:!1}),$e=n.styled_default("div")({name:"BottomInfo",class:"by6w7e9",propsAsIs:!1}),ke=n.styled_default("div")({name:"User",class:"u1g7arbm",propsAsIs:!1}),Re=n.styled_default("img")({name:"Avatar",class:"a1ldeata",propsAsIs:!1}),Se=n.styled_default("div")({name:"UserInfo",class:"u10d4koz",propsAsIs:!1}),we=n.styled_default("div")({name:"UserName",class:"u1q6roj0",propsAsIs:!1}),qe=n.styled_default("div")({name:"UserRating",class:"ui0m425",propsAsIs:!1}),Qe=n.styled_default("img")({name:"TrophyIcon",class:"t1el3mrn",propsAsIs:!1}),Ee=n.styled_default("div")({name:"Rts",class:"r2vgnxv",propsAsIs:!1}),Ne=n.styled_default("div")({name:"RtsIndicator",class:"roqn06j",propsAsIs:!1}),Ve=n.styled_default("div")({name:"RtsLabel",class:"r15adx7c",propsAsIs:!1}),De=n.styled_default("div")({name:"Divider",class:"dv59lta",propsAsIs:!1}),Pe=n.styled_default("div")({name:"Ranks",class:"r55lotb",propsAsIs:!1}),Le=n.styled_default("div")({name:"Statistics",class:"s1knfgqt",propsAsIs:!1}),Oe=n.styled_default("div")({name:"AvatarPlaceholder",class:"a1mqo824",propsAsIs:!1}),Me=n.styled_default("button")({name:"UserAccountBtn",class:"uxareh6",propsAsIs:!1}),Ue="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Trophy'%3e%3cpath%20id='Combined%20Shape'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.69197%204.66662C3.69197%205.99705%203.92914%207.17787%204.4035%208.20912C3.49966%208.02451%202.74487%207.66486%202.1391%207.13014C1.53333%206.59542%201.23046%206.0798%201.23046%205.58328V4.66662H3.69197ZM14.7686%204.66662V5.58328C14.7686%206.0798%2014.4658%206.59542%2013.86%207.13014C13.2542%207.66486%2012.4994%208.02451%2011.5956%208.20912C12.0699%207.17787%2012.3071%205.99705%2012.3071%204.66662H14.7686ZM15.9998%205.58329V4.36108C15.9998%204.10645%2015.9101%203.89002%2015.7306%203.71178C15.5511%203.53354%2015.3332%203.44442%2015.0768%203.44442H12.3076V2.52776C12.3076%202.10763%2012.1569%201.74797%2011.8556%201.44878C11.5544%201.14959%2011.1922%201%2010.7691%201H5.23072C4.80764%201%204.44547%201.14959%204.14419%201.44878C3.84291%201.74797%203.69227%202.10763%203.69227%202.52776V3.44442H0.923068C0.666659%203.44442%200.448714%203.53354%200.269228%203.71178C0.0897418%203.89002%200%204.10645%200%204.36108V5.58329C0%206.03525%200.13301%206.49039%200.399034%206.94872C0.665059%207.40705%201.02403%207.82082%201.47595%208.19003C1.92787%208.55924%202.48234%208.86957%203.13939%209.12101C3.79644%209.37246%204.48713%209.51409%205.21149%209.54592C5.48071%209.88967%205.7852%2010.192%206.12494%2010.453C6.36853%2010.6695%206.53679%2010.9002%206.62974%2011.1453C6.72269%2011.3904%206.76916%2011.6752%206.76916%2011.9999C6.76916%2012.3436%206.67141%2012.6333%206.4759%2012.8688C6.28038%2013.1043%205.96789%2013.2221%205.53841%2013.2221C5.05764%2013.2221%204.62976%2013.3669%204.25476%2013.6566C3.87977%2013.9462%203.69227%2014.3106%203.69227%2014.7499V15.361C3.69227%2015.4501%203.72112%2015.5233%203.77881%2015.5806C3.8365%2015.6379%203.91022%2015.6665%203.99996%2015.6665H11.9999C12.0896%2015.6665%2012.1633%2015.6379%2012.221%2015.5806C12.2787%2015.5233%2012.3076%2015.4501%2012.3076%2015.361V14.7499C12.3076%2014.3106%2012.1201%2013.9462%2011.7451%2013.6566C11.3701%2013.3669%2010.9422%2013.2221%2010.4614%2013.2221C10.0319%2013.2221%209.71945%2013.1043%209.52394%2012.8688C9.32843%2012.6333%209.23068%2012.3436%209.23068%2011.9999C9.23068%2011.6752%209.27715%2011.3904%209.3701%2011.1453C9.46305%2010.9002%209.63131%2010.6695%209.8749%2010.453C10.2146%2010.192%2010.5191%209.88967%2010.7884%209.54592C11.5127%209.51409%2012.2034%209.37246%2012.8604%209.12101C13.5175%208.86957%2014.072%208.55924%2014.5239%208.19003C14.9758%207.82082%2015.3348%207.40705%2015.6008%206.94872C15.8668%206.49039%2015.9998%206.03525%2015.9998%205.58329ZM6.76047%207.1798L8.05109%206.49997L9.3417%207.1798L9.09521%205.73989L10.1393%204.72015L8.69639%204.51007L8.05109%203.2L7.40578%204.51007L5.96283%204.72015L7.00696%205.73989L6.76047%207.1798Z'%20fill='%23F2C94C'/%3e%3c/g%3e%3c/svg%3e",te=({avatar:s,name:t,points:i,friendsRank:o,rank:a,streak:d,correct:c,incorrect:l,inTop:r,successRate:p})=>e.jsxs(be,{children:[e.jsx(Te,{children:e.jsxs(ke,{children:[e.jsxs(Me,{children:[s&&e.jsx(Re,{alt:"avatar",src:s}),!s&&e.jsx(Oe,{children:x.I(t||"")})]}),e.jsxs(Se,{children:[e.jsx(we,{children:t}),e.jsxs(qe,{children:[e.jsxs(Ee,{children:[e.jsx(Qe,{alt:"rank-icon",src:Ue}),e.jsxs(Ne,{children:[x.s(i),e.jsx(Ve,{children:"PTS"})]})]}),e.jsx(De,{}),e.jsxs("div",{children:["TOP ",r||0,"%"]})]})]})]})}),e.jsxs($e,{children:[e.jsxs(Pe,{children:[e.jsx(Y,{indicator:o||0,title:"Friends rank"}),e.jsx(Y,{indicator:a||0,title:"Global rank"})]}),e.jsxs(Le,{children:[e.jsx(L,{indicator:d||0,title:"Win streak"}),e.jsx(L,{indicator:c||0,title:"Correct"}),e.jsx(L,{indicator:l||0,title:"Incorrect"}),e.jsx(L,{indicator:`${p||0}%`,title:"Succ. rate"})]})]})]}),Be=n.styled_default("div")({name:"SponsorLogoWrap",class:"s8p5v5z",propsAsIs:!1}),Fe=()=>n.c1,ze=n.styled_default(Fe())({name:"SponsorLogo",class:"s755yti",propsAsIs:!0}),He=()=>e.jsx(Be,{children:e.jsx(ze,{name:"mastersLogo"})}),We=n.styled_default("div")({name:"Container",class:"c38csyt",propsAsIs:!1}),Ze=n.styled_default("div")({name:"Title",class:"ty221rx",propsAsIs:!1}),Ye=n.styled_default("div")({name:"Description",class:"dlaj9xp",propsAsIs:!1}),Ge=({title:s,description:t})=>e.jsxs(We,{children:[e.jsx(n.c1,{name:"icon-check-circle"}),e.jsx(Ze,{children:s}),e.jsx(Ye,{children:t})]}),Je=n.styled_default("div")({name:"Container",class:"c16sbdnm",propsAsIs:!1}),Ke=()=>n.c1,Xe=n.styled_default(Ke())({name:"IconPrediction",class:"ibhorgl",propsAsIs:!0}),D=n.styled_default("div")({name:"FeedbackIconWrap",class:"f1g20ja7",propsAsIs:!1}),O=n.styled_default("div")({name:"FeedbackHeader",class:"f455ozj",propsAsIs:!1}),es=n.styled_default("span")({name:"FeedbackTitle",class:"f1913njx",propsAsIs:!1}),E=n.styled_default("span")({name:"FeedbackDescription",class:"fzfk69z",propsAsIs:!1}),H=n.styled_default("div")({name:"FeedbackText",class:"fx87qaj",propsAsIs:!1}),ss=({feedbackMessages:s,questionVotedCorrectly:t,questionVoted:i,questionType:o,hasCorrectAnswer:a,questionStatus:d,showExpiredNotification:c,showClosedNotificationTrivia:l,votedInCurrentRender:r,votedAfterQuestionClosed:p,enteredAnActiveQuestion:m,marketClosed:y})=>{const f=i&&(o===u.QuestionType.TRIVIA||o===u.QuestionType.PREDICTION)&&r&&d!==u.QuestionStatus.RESOLVED,v=o===u.QuestionType.PREDICTION&&!a,T=y&&o===u.QuestionType.PREDICTION&&!i&&!m||o===u.QuestionType.PREDICTION&&p&&r&&m,C=f&&v,b=f&&a,A=o===u.QuestionType.PREDICTION&&i&&r&&a,w=i&&o===u.QuestionType.POLL&&r;if(!c&&!l&&!C&&!b&&!T&&!w&&!A)return null;const R=t?"correct":"incorrect",$=t?s==null?void 0:s.correctFeedback:s==null?void 0:s.incorrectFeedback;return e.jsxs(Je,{"data-isPrediction":v,children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(D,{children:e.jsx(n.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Expired"})}),e.jsx(H,{children:"You can still answer to see if you're correct, but no points are awarded for expired questions."})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(D,{children:e.jsx(n.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This question was answered after the moderator closed the question. So the points for this answer won’t tally."})]})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx(D,{children:e.jsx(n.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This event has already taken place, so the ability to make a prediction on its outcome is no longer available."})]})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx(Xe,{name:"icon-prediction"}),e.jsx(E,{children:"Stay tuned to see if your prediction was correct."})]}),w&&e.jsxs(e.Fragment,{children:[e.jsx(D,{"data-feedback-type":"correct",children:e.jsx(n.c1,{name:"correct"})}),e.jsx(E,{children:"Thanks for answering. Please stay tuned for the next question."})]}),(b||A)&&e.jsxs(e.Fragment,{children:[e.jsx(D,{"data-feedback-type":R,children:e.jsx(n.c1,{name:R})}),e.jsx("div",{children:e.jsxs(O,{children:[e.jsx(es,{"data-feedback-type":R,children:$==null?void 0:$.title}),e.jsx(E,{children:$==null?void 0:$.description})]})})]})]})},ts=n.styled_default("div")({name:"Container",class:"c14ielyq",propsAsIs:!1}),ns=()=>x.c,os=n.styled_default(ns())({name:"QuestionScrollContainer",class:"q1tlqx57",propsAsIs:!0}),is=n.styled_default("div")({name:"Content",class:"c1hq58md",propsAsIs:!1}),as=n.styled_default("div")({name:"Title",class:"t1c8nxcx",propsAsIs:!1}),ls=n.styled_default("div")({name:"Options",class:"oiozuc3",propsAsIs:!1}),rs=n.styled_default("button")({name:"ButtonContainer",class:"b1b6dl8t",propsAsIs:!1}),ds=n.styled_default("div")({name:"ButtonPct",class:"b4iik8i",propsAsIs:!1}),cs=n.styled_default("span")({name:"ButtonBody",class:"b1gq1lnf",propsAsIs:!1}),us=n.styled_default("div")({name:"IconContainer",class:"i1j65z51",propsAsIs:!1}),ps=n.styled_default("div")({name:"IconWrap",class:"i19tpfua",propsAsIs:!1}),ne=n.styled_default("img")({name:"Icon",class:"i1tubmma",propsAsIs:!1}),ms=()=>ne,hs=n.styled_default(ms())({name:"IconDefault",class:"i1grrgwj",propsAsIs:!0}),xs=()=>ne,fs=n.styled_default(xs())({name:"IconCircle",class:"ibemyq8",propsAsIs:!0}),Is=n.styled_default("span")({name:"Title",class:"t1dceht",propsAsIs:!1}),ys=n.styled_default("span")({name:"Indicators",class:"i116q4vq",propsAsIs:!1}),vs=n.styled_default("span")({name:"Pts",class:"p17ajcu2",propsAsIs:!1}),js=n.styled_default("span")({name:"Percentage",class:"pu9kmlb",propsAsIs:!1}),Cs=()=>n.c1,As=n.styled_default(Cs())({name:"CheckIcon",class:"c1j2j0s0",propsAsIs:!0}),G={[u.QuestionImages.CENTERED]:s=>e.jsx(hs,{alt:"option-icon",src:s}),[u.QuestionImages.TRANSPARENT]:s=>e.jsx(us,{children:e.jsx(ps,{style:{backgroundImage:`url(${s})`}})}),[u.QuestionImages.ROUNDED]:s=>e.jsx(fs,{alt:"option-icon",src:s}),[u.QuestionImages.NONE]:()=>null,[u.QuestionImages.UNSET]:()=>null},gs=({questionType:s,hasCorrectAnswer:t,correct:i,youVoted:o,questionVoted:a})=>{if(s===u.QuestionType.POLL&&o)return"correct";if(s===u.QuestionType.PREDICTION){if(t&&a)return o?i?"correct":"incorrect":"unset";if(o)return"correct"}return s===u.QuestionType.TRIVIA&&a&&o?i?"correct":"incorrect":"unset"},_s=({questionType:s,questionVoted:t,correct:i,hasCorrectAnswer:o,questionStatus:a})=>s===u.QuestionType.TRIVIA?t&&i:s===u.QuestionType.PREDICTION?t&&i&&o||a===u.QuestionStatus.RESOLVED&&i:!1,bs=s=>{var t;const{id:i,icon:o,text:a,percentageDecimal:d,points:c,onVote:l,markThatVoted:r,youSelected:p,questionVoted:m,imageMode:y,answerTimeExpired:f,questionStatus:v,isLoading:T,questionType:C,correct:b,hasCorrectAnswer:A,votedAfterQuestionClosed:w,enteredAnActiveQuestion:R,marketClosed:$}=s,[N,P]=h.useState(d),q=gs(s),B=_s({questionType:C,questionVoted:m,correct:b,hasCorrectAnswer:A,questionStatus:v}),I=$&&C===u.QuestionType.PREDICTION,j=m||I,g=C===u.QuestionType.PREDICTION&&!m&&!$,F=m&&!p&&q!=="incorrect";return h.useLayoutEffect(()=>{d>0&&(P(0),requestAnimationFrame(()=>{P(d)}))},[d]),e.jsxs(rs,{value:i,"data-selected":p,"data-answer-state":q,disabled:m||T||f||I&&!R||I&&R&&w,"data-is-not-checked":F,onClick:z=>{r(C===u.QuestionType.PREDICTION?$:v===u.QuestionStatus.RESOLVED),l(z)},children:[e.jsx(ds,{"data-answer-state":q,style:{width:`${j?N:0}%`}}),e.jsxs(cs,{children:[o&&y&&((t=G[y])==null?void 0:t.call(G,o)),e.jsx(Is,{children:a}),g&&e.jsxs("div",{children:[c,e.jsx(vs,{children:"pts"})]}),j&&e.jsxs(ys,{children:[B&&e.jsx(As,{name:"selected"}),e.jsx(js,{children:e.jsx(n.d,{value:d,suffix:"%"})})]})]})]})},Ts=[S.E.PRIMARY_GREEN1,S.E.SECONDARY_RED1,S.E.SECONDARY_RED1,S.E.NEUTRALS_GRAY3],$s=[10,10,1,0],ks=n.styled_default("div")({name:"RemainingTime",class:"r165427",propsAsIs:!1}),Rs=S.E.SECONDARY_GREEN6,J=S.E.SECONDARY_RED3,Ss=S.E.NEUTRALS_GRAY3,ws=({isPlaying:s=!0,duration:t=30,onTimerExpired:i})=>{const[o,a]=h.useState(t>10?Rs:J),d=({remainingTime:r})=>e.jsx(ks,{children:r}),c=h.useCallback(()=>{i==null||i(),a(Ss)},[i,a]),l=h.useCallback(r=>{r===10&&a(J)},[a]);return e.jsx(de.CountdownCircleTimer,{isPlaying:s,duration:t,colors:Ts,colorsTime:$s,size:32,strokeWidth:2,trailStrokeWidth:2,trailColor:o,onComplete:c,onUpdate:l,children:d})},qs=n.styled_default("div")({name:"WinBarContainer",class:"wie6cqo",propsAsIs:!1}),Qs=n.styled_default("div")({name:"Content",class:"cgizw4u",propsAsIs:!1}),Es=n.styled_default("div")({name:"Title",class:"t1l3ucjp",propsAsIs:!1}),Ns=()=>n.c1,Vs=n.styled_default(Ns())({name:"WinIcon",class:"wx7j799",propsAsIs:!0}),Ds=n.styled_default("div")({name:"Points",class:"p4lwuj0",propsAsIs:!1}),Ps=n.styled_default("span")({name:"PointsCount",class:"po9i64o",propsAsIs:!1}),Ls=n.styled_default("span")({name:"PointsUnits",class:"pe5g05h",propsAsIs:!1}),Os=({title:s,points:t,isPlayingTimer:i,isTimer:o,animatePoints:a,questionType:d,timerDuration:c,onTimerExpired:l})=>e.jsxs(qs,{style:{justifyContent:d===u.QuestionType.PREDICTION?"center":"space-between"},children:[e.jsxs(Qs,{children:[s&&e.jsx(Es,{children:s}),t!==void 0&&d!==u.QuestionType.POLL&&e.jsxs(e.Fragment,{children:[e.jsx(Vs,{name:"icon-trophy"}),e.jsxs(Ds,{children:[e.jsx(Ps,{children:a?e.jsx(n.d,{value:t,delay:.3}):t}),e.jsx(Ls,{children:"PTS"})]})]})]}),o&&d!==u.QuestionType.PREDICTION&&e.jsx(ws,{isPlaying:i,onTimerExpired:l,duration:c})]}),Ms=({openedQuestion:s,isLoading:t,vote:i,close:o})=>{var a,d;const c=s.subject,l=s.type,r=s.status,p=(a=s.options)==null?void 0:a.options,m=s.marketClosed,[y,f]=h.useState(!1),[v,T]=h.useState(!1),[C,b]=h.useState(!0),[A,w]=h.useState(!1),[R,$]=h.useState(""),N=s==null?void 0:s.id;h.useEffect(()=>{l===u.QuestionType.PREDICTION?m&&b(!1):r===u.QuestionStatus.RESOLVED&&b(!1)},[]);const P=h.useCallback(_=>{T(_),f(!0)},[]),q=h.useCallback(async _=>{if(N){const V=_.currentTarget.value;$(V),await i(N,V)}},[N,$,i]),B=h.useCallback(()=>{w(!0),setTimeout(o,3e3)},[o]),I=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.youVoted===!0),[s]),j=h.useMemo(()=>!!(s!=null&&s.answers.find(_=>_.correct===!0)),[s]),g=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.correct===!0),[s]),F=h.useMemo(()=>s?s.answers.map(_=>{var V;return{..._,questionVoted:!!I,youSelected:R===_.id,isLoading:t,hasCorrectAnswer:j,questionType:s.type,answerTimeExpired:A,questionStatus:r,imageMode:(V=s.appearance)==null?void 0:V.images,onVote:q}}):[],[j,A,t,s,I,r,q,R]),z=p&&(p.case==="trivia"||p.case==="prediction")?p.value:void 0,Q=r===u.QuestionStatus.RESOLVED&&l===u.QuestionType.TRIVIA&&!I&&!C,W=l===u.QuestionType.TRIVIA&&v&&y&&C,Z=h.useMemo(()=>l===u.QuestionType.PREDICTION?!!(I&&!j||I&&j&&g!=null&&g.youVoted):!0,[l,I,j,g]),ie=h.useMemo(()=>{if(l===u.QuestionType.PREDICTION&&I&&(!j||j&&g!=null&&g.youVoted))return I.points;if(!(Q||A))return r===u.QuestionStatus.RESOLVED?0:I?I.correct?I.points:0:g==null?void 0:g.points},[A,I,g,r,Q,l,j]),ae=h.useMemo(()=>l===u.QuestionType.PREDICTION&&I?j?j&&g!=null&&g.youVoted?"You won":"":"To win":Q||A?"Time expired":l===u.QuestionType.POLL?"Time remaining":I?"You won":"To win",[A,l,I,Q,j,g]),le=(l===u.QuestionType.TRIVIA||l===u.QuestionType.PREDICTION)&&I&&j&&(g==null?void 0:g.youVoted),re=I||Q||W||l===u.QuestionType.TRIVIA&&r===u.QuestionStatus.RESOLVED&&C;return e.jsx(os,{children:e.jsx(ts,{children:e.jsxs(is,{children:[e.jsx(ss,{feedbackMessages:z,questionVoted:!!I,questionVotedCorrectly:I==null?void 0:I.correct,questionType:l,hasCorrectAnswer:j,questionStatus:r,showExpiredNotification:Q,showClosedNotificationTrivia:W,votedInCurrentRender:y,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m}),Z&&e.jsx(Os,{title:ae,points:ie,onTimerExpired:B,questionType:s.type,isTimer:!t,isPlayingTimer:!I,animatePoints:le,timerDuration:re?0:Number(((d=s==null?void 0:s.appearance)==null?void 0:d.autoHideInterval)||"30")}),A?e.jsx(Ge,{title:"More to come...",description:"Watch for additional enhanced stream interactive experience."}):e.jsxs(e.Fragment,{children:[e.jsx(as,{style:Z?{}:{marginTop:0},children:c}),e.jsx(ls,{children:F.map(_=>e.jsx(bs,{..._,markThatVoted:P,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m},_.id))})]})]})})})},Us=n.styled_default("div")({name:"Container",class:"cgn5uen",propsAsIs:!1}),Bs=n.styled_default("div")({name:"Content",class:"c1px8nt6",propsAsIs:!1}),Fs=n.styled_default("h3")({name:"Title",class:"t5et2jt",propsAsIs:!1}),zs=n.styled_default("div")({name:"Description",class:"d1i2kpk2",propsAsIs:!1}),Hs=n.styled_default("img")({name:"Image",class:"id3lh3p",propsAsIs:!1}),Ws=n.styled_default("div")({name:"ImageContainer",class:"i1gfjeu5",propsAsIs:!1}),oe=({imageMode:s,instantView:t,isDetail:i,notification:o,controlVideo:a})=>{const d=t==null?void 0:t.heading,c=t==null?void 0:t.body,l=d||c,r=o==null?void 0:o.title,p=o==null?void 0:o.body;return e.jsxs(Us,{children:[(t==null?void 0:t.video)&&e.jsx(x.z,{source:t.video.url,poster:t.video.thumbnailUrl,controlVideo:a}),(t==null?void 0:t.image)&&!(t!=null&&t.video)&&e.jsx(Ws,{"data-rounded":s===u.QuestionImages.ROUNDED,children:e.jsx(Hs,{src:t==null?void 0:t.image})}),e.jsxs(Bs,{children:[e.jsx(Fs,{children:i&&l?d:r}),e.jsx(zs,{children:i&&l?c:p})]})]})},Zs=n.styled_default("div")({name:"Container",class:"c1euiow",propsAsIs:!1}),Ys=n.styled_default("a")({name:"WebLinkBtn",class:"w19zie3h",propsAsIs:!1}),Gs=({instantView:s,...t})=>e.jsxs(Zs,{children:[e.jsx(oe,{instantView:s,...t,isDetail:!0}),(s==null?void 0:s.webLink)&&e.jsxs(Ys,{href:s==null?void 0:s.webLink.url,target:"_blank",children:[s==null?void 0:s.webLink.label,e.jsx(n.c1,{name:"icon-external-link"})]})]}),Js=n.styled_default("div")({name:"Container",class:"c1dcxmvf",propsAsIs:!1}),Ks=n.styled_default("blockquote")({name:"Quote",class:"qb4q22c",propsAsIs:!1}),Xs=s=>e.jsxs(Js,{children:[s.title&&e.jsx(Ks,{children:s.title}),e.jsx(x.J,{...s,isDetail:!0})]}),et=n.styled_default("div")({name:"QuestionContainer",class:"qdri6g3",propsAsIs:!1}),st=({openedQuestion:s})=>{var t,i;const{sdk:o}=x.n();return((t=s==null?void 0:s.attributes)==null?void 0:t.attributes.case)==="insight"?e.jsx(Gs,{...s.attributes.attributes.value,controlVideo:o==null?void 0:o.controlVideoPlayer}):((i=s==null?void 0:s.attributes)==null?void 0:i.attributes.case)==="tweet"?e.jsx(Xs,{...s.attributes.attributes.value,controlVideo:o==null?void 0:o.controlVideoPlayer}):null},tt=({extendedQuestion:s,vote:t,close:i})=>{const{loading:o,data:a}=s;return a?e.jsx(Ms,{vote:t,close:i,openedQuestion:a,isLoading:!!o}):null},nt=({gamification:s})=>{var t;const i=k.useStore(s.openedQuestion.$store),o=k.useStore(s.openedQuestion.$extendedStore);if(!i)return null;const a=i.type;return e.jsxs(et,{children:[e.jsx(se,{close:s.closeQuestion,type:((t=i.attributes)==null?void 0:t.type)||u.QuestionType.UNSET}),a==="question"&&e.jsx(tt,{vote:s.submitAnswer,close:s.closeQuestion,extendedQuestion:o}),a!=="question"&&e.jsx(st,{openedQuestion:i}),e.jsx(He,{sponsorLogo:""})]})},ot=n.styled_default("div")({name:"Container",class:"c115qtkr",propsAsIs:!1}),it=n.styled_default("div")({name:"STabs",class:"sxnslc8",propsAsIs:!1}),at=n.styled_default("button")({name:"Button",class:"b1umzux0",propsAsIs:!1}),lt=n.styled_default("span")({name:"Title",class:"tspsaas",propsAsIs:!1});var U=(s=>(s.HOME="home",s.LEADERBOARD="leaderboard",s))(U||{});const K=({title:s,active:t,onClick:i})=>e.jsx(at,{onClick:i,"data-selected":t,children:e.jsx(lt,{children:s})}),rt=({activePage:s="home",toggleActivePage:t})=>e.jsx(ot,{children:e.jsxs(it,{"data-position":s==="home"?"left":"right",children:[e.jsx(K,{title:"Home",active:s==="home",onClick:()=>t("home")}),e.jsx(K,{title:"Friends",active:s==="leaderboard",onClick:()=>t("leaderboard")})]})}),dt=n.styled_default("div")({name:"Container",class:"c1ux29ft",propsAsIs:!1}),ct=n.styled_default("img")({name:"FriendsIcon",class:"f10ncfg2",propsAsIs:!1}),ut=n.styled_default("div")({name:"Content",class:"c1yc07bd",propsAsIs:!1}),pt=n.styled_default("div")({name:"Title",class:"tj6cq7w",propsAsIs:!1}),mt=n.styled_default("div")({name:"Description",class:"d1ag78xo",propsAsIs:!1}),ht=()=>n.c1,xt=n.styled_default(ht())({name:"ArrowInviteIcon",class:"awohrz6",propsAsIs:!0}),ft="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='32'%20height='32'%20rx='16'%20fill='white'/%3e%3cpath%20d='M10.4615%2012.6875C9.44231%2012.6875%208.61538%2013.4665%208.61538%2014.4266C8.61538%2015.3868%209.44231%2016.1658%2010.4615%2016.1658C11.4808%2016.1658%2012.3077%2015.3868%2012.3077%2014.4266C12.3077%2013.4665%2011.4808%2012.6875%2010.4615%2012.6875ZM10.4615%2016.1658C9.10817%2016.1658%208%2017.2097%208%2018.4846V19.7527C8%2019.7527%208.61538%2020.2237%2010.4615%2020.2237C12.3077%2020.2237%2012.9231%2019.7527%2012.9231%2019.7527V18.4846C12.9231%2017.2097%2011.8149%2016.1658%2010.4615%2016.1658ZM21.5385%2012.6875C20.5192%2012.6875%2019.6923%2013.4665%2019.6923%2014.4266C19.6923%2015.3868%2020.5192%2016.1658%2021.5385%2016.1658C22.5577%2016.1658%2023.3846%2015.3868%2023.3846%2014.4266C23.3846%2013.4665%2022.5577%2012.6875%2021.5385%2012.6875ZM21.5385%2016.1658C20.1851%2016.1658%2019.0769%2017.2097%2019.0769%2018.4846V19.7527C19.0769%2019.7527%2019.6923%2020.2237%2021.5385%2020.2237C23.3846%2020.2237%2024%2019.7527%2024%2019.7527V18.4846C24%2017.2097%2022.8918%2016.1658%2021.5385%2016.1658ZM16%2015.0063C14.9808%2015.0063%2014.1538%2015.7853%2014.1538%2016.7455C14.1538%2017.7056%2014.9808%2018.4846%2016%2018.4846C17.0192%2018.4846%2017.8462%2017.7056%2017.8462%2016.7455C17.8462%2015.7853%2017.0192%2015.0063%2016%2015.0063ZM16%2018.4846C14.6466%2018.4846%2013.5385%2019.5285%2013.5385%2020.8034V22.0715C13.5385%2022.0715%2014.1538%2022.5425%2016%2022.5425C17.8462%2022.5425%2018.4615%2022.0715%2018.4615%2022.0715V20.8034C18.4615%2019.5285%2017.3534%2018.4846%2016%2018.4846Z'%20fill='%23107D57'/%3e%3cpath%20opacity='0.5'%20d='M13.3908%209C12.3103%209%2011.4336%209.82584%2011.4336%2010.8437C11.4336%2011.8616%2012.3103%2012.6875%2013.3908%2012.6875C14.4713%2012.6875%2015.348%2011.8616%2015.348%2010.8437C15.348%209.82584%2014.4713%209%2013.3908%209ZM13.3908%2012.6875C13.1946%2012.6875%2012.9958%2012.6827%2012.7996%2012.7451C13.192%2013.2372%2013.3908%2013.8542%2013.3908%2014.5312C13.3908%2014.7761%2013.3296%2015.0161%2013.3296%2015.261C13.8521%2014.524%2014.6956%2014.0391%2015.6742%2013.9166C15.218%2013.1796%2014.3694%2012.6875%2013.3908%2012.6875ZM18.61%209C17.5295%209%2016.6528%209.82584%2016.6528%2010.8437C16.6528%2011.8616%2017.5295%2012.6875%2018.61%2012.6875C19.6905%2012.6875%2020.5672%2011.8616%2020.5672%2010.8437C20.5672%209.82584%2019.6905%209%2018.61%209ZM18.61%2012.6875C17.6314%2012.6875%2016.7828%2013.1796%2016.3266%2013.9166C17.3052%2014.0391%2018.1487%2014.524%2018.6712%2015.261C18.6712%2015.0161%2018.61%2014.7761%2018.61%2014.5312C18.61%2013.8542%2018.8088%2013.2372%2019.2012%2012.7451C19.005%2012.6827%2018.8062%2012.6875%2018.61%2012.6875Z'%20fill='%23107D57'/%3e%3c/svg%3e",It=({title:s,description:t,onClick:i,className:o})=>e.jsxs(dt,{onClick:i,className:o,children:[e.jsx(ct,{alt:"friends-icon",src:ft}),e.jsxs(ut,{children:[e.jsx(pt,{children:s}),e.jsx(mt,{children:t})]}),e.jsx(xt,{name:"icon-copy"})]});function yt(s){var t=s.lastRenderedStartIndex,i=s.lastRenderedStopIndex,o=s.startIndex,a=s.stopIndex;return!(o>i||a<t)}function vt(s){for(var t=s.isItemLoaded,i=s.itemCount,o=s.minimumBatchSize,a=s.startIndex,d=s.stopIndex,c=[],l=null,r=null,p=a;p<=d;p++){var m=t(p);m?r!==null&&(c.push(l,r),l=r=null):(r=p,l===null&&(l=p))}if(r!==null){for(var y=Math.min(Math.max(r,l+o-1),i-1),f=r+1;f<=y&&!t(f);f++)r=f;c.push(l,r)}if(c.length)for(;c[1]-c[0]+1<o&&c[0]>0;){var v=c[0]-1;if(!t(v))c[0]=v;else break}return c}var jt=function(s,t){if(!(s instanceof t))throw new TypeError("Cannot call a class as a function")},Ct=function(){function s(t,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,i,o){return i&&s(t.prototype,i),o&&s(t,o),t}}(),At=function(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);s.prototype=Object.create(t&&t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(s,t):s.__proto__=t)},X=function(s,t){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:s};(function(s){At(t,s);function t(){var i,o,a,d;jt(this,t);for(var c=arguments.length,l=Array(c),r=0;r<c;r++)l[r]=arguments[r];return d=(o=(a=X(this,(i=t.__proto__||Object.getPrototypeOf(t)).call.apply(i,[this].concat(l))),a),a._lastRenderedStartIndex=-1,a._lastRenderedStopIndex=-1,a._memoizedUnloadedRanges=[],a._onItemsRendered=function(p){var m=p.visibleStartIndex,y=p.visibleStopIndex;a._lastRenderedStartIndex=m,a._lastRenderedStopIndex=y,a._ensureRowsLoaded(m,y)},a._setRef=function(p){a._listRef=p},o),X(a,d)}return Ct(t,[{key:"resetloadMoreItemsCache",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._memoizedUnloadedRanges=[],o&&this._ensureRowsLoaded(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var o=this.props.children;return o({onItemsRendered:this._onItemsRendered,ref:this._setRef})}},{key:"_ensureRowsLoaded",value:function(o,a){var d=this.props,c=d.isItemLoaded,l=d.itemCount,r=d.minimumBatchSize,p=r===void 0?10:r,m=d.threshold,y=m===void 0?15:m,f=vt({isItemLoaded:c,itemCount:l,minimumBatchSize:p,startIndex:Math.max(0,o-y),stopIndex:Math.min(l-1,a+y)});(this._memoizedUnloadedRanges.length!==f.length||this._memoizedUnloadedRanges.some(function(v,T){return f[T]!==v}))&&(this._memoizedUnloadedRanges=f,this._loadUnloadedRanges(f))}},{key:"_loadUnloadedRanges",value:function(o){for(var a=this,d=this.props.loadMoreItems||this.props.loadMoreRows,c=function(p){var m=o[p],y=o[p+1],f=d(m,y);f!=null&&f.then(function(){if(yt({lastRenderedStartIndex:a._lastRenderedStartIndex,lastRenderedStopIndex:a._lastRenderedStopIndex,startIndex:m,stopIndex:y})){if(a._listRef==null)return;typeof a._listRef.resetAfterIndex=="function"?a._listRef.resetAfterIndex(m,!0):(typeof a._listRef._getItemStyleCache=="function"&&a._listRef._getItemStyleCache(-1),a._listRef.forceUpdate())}})},l=0;l<o.length;l+=2)c(l)}}]),t})(h.PureComponent);const gt=n.styled_default("div")({name:"Container",class:"culdu4a",propsAsIs:!1}),_t=n.styled_default("div")({name:"Position",class:"pwf8e69",propsAsIs:!1}),bt=n.styled_default("img")({name:"Avatar",class:"atf4yh4",propsAsIs:!1}),Tt=n.styled_default("div")({name:"AvatarPlaceholder",class:"a1dg29ja",propsAsIs:!1}),$t=n.styled_default("div")({name:"Content",class:"c10a68rc",propsAsIs:!1}),kt=n.styled_default("div")({name:"NameContainer",class:"nc4kck5",propsAsIs:!1}),Rt=n.styled_default("span")({name:"Name",class:"njsrqgr",propsAsIs:!1}),St=()=>n.c1,wt=n.styled_default(St())({name:"CurrentUserBadge",class:"c17uc4zr",propsAsIs:!0}),qt=({rank:s,avatar:t,name:i,points:o,isCurrentUser:a,openItemDetail:d,style:c})=>e.jsxs(gt,{onClick:d,style:c,children:[e.jsx(_t,{children:s||0}),e.jsxs($t,{children:[t?e.jsx(bt,{alt:"leaderboard-item-avatar",src:t}):e.jsx(Tt,{children:x.I(i||"")}),e.jsxs(kt,{children:[e.jsx(Rt,{children:i||""}),a&&e.jsx(wt,{name:"icon-star"})]})]}),e.jsx("div",{children:x.s(o)})]}),Qt=n.styled_default("div")({name:"Container",class:"c16btbfp",propsAsIs:!1}),Et=({items:s,currentUserId:t,openItemDetail:i,fetchMore:o,scrollNode:a,hasMore:d})=>e.jsx(ce,{loadMore:o,initialLoad:!1,hasMore:d,useWindow:!1,getScrollParent:()=>a.current,children:e.jsx(Qt,{children:s.map(c=>e.jsx(qt,{...c,openItemDetail:()=>i(c.userId),isCurrentUser:!!t&&t===c.userId},c.userId))})}),Nt=({renderClipBoardNode:s,deepLink:t})=>e.jsx(x.F,{renderToNode:s,inviteLink:t,socialLinks:[{icon:"icon-facebook",link:"https://www.facebook.com/TheMasters",label:"Facebook"},{icon:"icon-twitter",link:"https://twitter.com/@TheMasters",label:"X"}],inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."}),Vt=n.styled_default("div")({name:"InviteLinkContainer",class:"i1chxfpe",propsAsIs:!1}),Dt=({gamification:s,scrollNode:t,scrollStore:i,renderClipBoardNode:o})=>{const{data:a,hasMore:d,loading:c,key:l}=k.useStore(s.leaderboardList.$store),{data:r}=k.useStore(s.deepLink.$store),[p,m]=x.h(o);return!a.length&&!c?e.jsx(Nt,{renderClipBoardNode:o,deepLink:r}):e.jsxs(e.Fragment,{children:[e.jsx(Et,{items:a,scrollNode:t,scrollStore:i,fetchMore:s.leaderboardList.fetchMore,hasMore:d,openItemDetail:s.openUser,currentUserId:s.currentUserId.get()},l),r&&e.jsx(Vt,{children:e.jsx(It,{onClick:()=>p(r),title:"Invite Friends",description:"Challenge them now!"})}),m]})},Pt=n.styled_default("div")({name:"QuestionItem",class:"q1w97g3p",propsAsIs:!1}),Lt=n.styled_default("div")({name:"QuestionCaption",class:"q2sl39u",propsAsIs:!1}),Ot=n.styled_default("div")({name:"QuestionBody",class:"qd5h0uc",propsAsIs:!1}),Mt=n.styled_default("div")({name:"QuestionAction",class:"q105uluy",propsAsIs:!1}),Ut=()=>n.c1,M=n.styled_default(Ut())({name:"QuestionActionIcon",class:"q1fa0b9h",propsAsIs:!0}),Bt=()=>n.c1,Ft=n.styled_default(Bt())({name:"QuestionTypeIcon",class:"qxlt78s",propsAsIs:!0}),zt=n.styled_default("div")({name:"QuestionTypeLabel",class:"qmg0vkx",propsAsIs:!1}),Ht=n.styled_default("div")({name:"QuestionContent",class:"q1uz5j1g",propsAsIs:!1}),Wt=n.styled_default("button")({name:"PlayButton",class:"p1pba9p1",propsAsIs:!1}),Zt={[u.PickHistoryStatus.LOST]:e.jsx(M,{name:"incorrectVoted"}),[u.PickHistoryStatus.WON]:e.jsx(M,{name:"icon-check"}),[u.PickHistoryStatus.UNSET]:e.jsx(M,{name:"icon-arrow"}),[u.PickHistoryStatus.DNP]:e.jsx(M,{name:"icon-arrow"})},Yt=({questionId:s,questionType:t,questionStatus:i,subject:o,openForVoting:a,openQuestion:d,status:c})=>{const l=x.o[t],r=Zt[c];return l?e.jsxs(Pt,{onClick:()=>d==null?void 0:d(s),children:[e.jsxs(Ht,{children:[e.jsxs(Lt,{children:[e.jsx(Ft,{"data-type-trivia":t===u.QuestionType.TRIVIA,"data-type-poll":t===u.QuestionType.POLL,name:l.iconName}),e.jsxs(zt,{children:[l.label,t===u.QuestionType.TRIVIA&&i===u.QuestionStatus.RESOLVED&&" • Expired"]})]}),e.jsx(Ot,{children:o||""})]}),e.jsx(Mt,{children:a?e.jsx(Wt,{children:"Play"}):r})]}):null},Gt=n.styled_default("div")({name:"Container",class:"cll3md7",propsAsIs:!1}),Jt=n.styled_default("button")({name:"ActionBtn",class:"a10g1iik",propsAsIs:!1}),Kt=({openInsight:s,questionId:t,...i})=>{const o=()=>{x.k(),s==null||s(t)};return e.jsxs(Gt,{children:[e.jsx(oe,{questionId:t,...i}),s&&e.jsx(Jt,{onClick:o,children:"View Insight"})]})},Xt=n.styled_default("div")({name:"Container",class:"cl56x6b",propsAsIs:!1}),en=()=>x.c$1,sn=n.styled_default(en())({name:"ActionButton",class:"a11pzf92",propsAsIs:!0}),tn=n.styled_default("blockquote")({name:"Quote",class:"q1hbaleq",propsAsIs:!1}),nn=({openTweet:s,...t})=>{const i=()=>{x.k(),s==null||s(t.tweetId)};return e.jsxs(Xt,{children:[t.title&&e.jsx(tn,{children:t.title}),e.jsx(x.J,{...t}),s&&e.jsx(sn,{onClick:i,children:"View Insight"})]})},on=n.styled_default("div")({name:"QuestionsContainer",class:"qvghv3l",propsAsIs:!1}),an=({questions:s,openQuestion:t,controlVideo:i})=>e.jsx(on,{children:s==null?void 0:s.map(o=>{var a,d,c;if(o.type==="question"&&((a=o.attributes)==null?void 0:a.attributes.case)==="question"){const l=o.attributes.attributes.value;return e.jsx(Yt,{openQuestion:t,...l},l.questionId)}if(o.type==="insight"&&((d=o.attributes)==null?void 0:d.attributes.case)==="insight"){const l=o.attributes.attributes.value;return e.jsx(Kt,{openInsight:t,controlVideo:i,...l},l.questionId)}if(o.type==="tweet"&&((c=o.attributes)==null?void 0:c.attributes.case)==="tweet"){const l=o.attributes.attributes.value,r=o.attributes.id;return e.jsx(nn,{openTweet:t,controlVideo:i,...l,tweetId:r},r)}return null})}),ln=({store:s,openQuestion:t})=>{const{sdk:i}=x.n(),o=k.useStore(s);return o!=null&&o.data?e.jsx(an,{openQuestion:t,questions:o.data,controlVideo:i==null?void 0:i.controlVideoPlayer}):e.jsx("div",{children:"wait questions..."})},rn=({userSummary:s})=>{var t;const[i,o]=h.useState(void 0);return h.useEffect(()=>{const a=s.subscribe(d=>{d!=null&&d.data&&o(d.data)});return()=>{a()}},[s]),i!=null&&i.summary?e.jsx(te,{...i.summary,successRate:(t=i.percentage)==null?void 0:t.correct}):e.jsx("div",{children:"wait user..."})},dn=({gamification:s,className:t,scrollStore:i,scrollNode:o,appNode:a,style:d,responsiveStore:c,headerNode:l})=>{const{tabsShown:r}=k.useStore(i,{keys:["tabsShown"]}),[p,m]=h.useState(U.HOME),[,y]=h.useTransition(),{sdkInDesktopView:f}=k.useStore(c,{keys:["sdkInDesktopView"]}),v=b=>{y(()=>{var A;m(b),f===!1&&(((A=a.current)==null?void 0:A.getBoundingClientRect().y)||0)<0&&x.C$1(a,{behavior:"instant"})})};h.useEffect(()=>i.listen(b=>{if(b.scrollPosition===0){i.setKey("tabsShown",!0);return}c.get().sdkInDesktopView?i.setKey("tabsShown",b.scrollDirection==="backward"):i.setKey("tabsShown",b.scrollDirection==="forward")}),[i,c]);let T="0px";f?T=r?"0px":"calc(8px - var(--header-height) - var(--header-offset))":T=r?"calc(var(--header-height) + var(--header-offset) - 2px)":"0px";const C=f?a:l;return e.jsxs(x.p,{className:t,style:d,children:[e.jsx(x.C,{style:{top:T},children:e.jsx(rt,{activePage:p,toggleActivePage:v})}),p===U.HOME&&e.jsxs(e.Fragment,{children:[e.jsx(x.n$1,{style:{paddingTop:"8px"},children:e.jsx(x.m,{children:e.jsx(rn,{userSummary:s.userSummary})})}),e.jsx(x.a,{style:{flex:1},children:e.jsx(ln,{openQuestion:s.openQuestion,store:s.feedList.getStore()})})]}),p===U.LEADERBOARD&&e.jsx(x.l,{children:e.jsx(Dt,{renderClipBoardNode:C,scrollStore:i,scrollNode:o,gamification:s})})]})},cn=()=>x.l$1,ee=n.styled_default(cn())({name:"OpenedContainer",class:"oar61gl",propsAsIs:!0}),un=n.styled_default("div")({name:"UserContainer",class:"u14zaal4",propsAsIs:!1}),pn=({correct:s,incorrect:t})=>{const i=s+t;return i===0?0:Math.round(s/i*100)},mn=({gamification:s,scrollStore:t,className:i,appNode:o,scrollNode:a,headerNode:d,responsiveStore:c})=>{const l=k.useStore(s.openedQuestion.$store),r=k.useStore(s.openedUser),{sdkInDesktopView:p}=k.useStore(c,{keys:["sdkInDesktopView"]}),m=h.useMemo(()=>{var y;const f=(((y=o.current)==null?void 0:y.getBoundingClientRect().y)||0)<0;if(!o.current||!l&&!r)return null;const v=l?e.jsx(ee,{className:i,children:e.jsx(nt,{gamification:s})}):r?e.jsx(ee,{className:i,children:e.jsxs(un,{children:[e.jsx(se,{label:"Friend's Rank",close:s.closeUser}),e.jsx(x.n$1,{children:e.jsx(te,{...r,successRate:pn(r)})})]})}):null;return e.jsx(x.V,{container:o,useContainer:!p,fixedView:f,children:v})},[o,i,s,l,r,p]);return e.jsxs(e.Fragment,{children:[m,e.jsx(dn,{appNode:o,headerNode:d,scrollStore:t,scrollNode:a,className:i,gamification:s,responsiveStore:c})]})};exports.default=mn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./masters2.js");require("react/jsx-runtime");require("@nanostores/react");require("@streamlayer/sdk-web-types");require("react");require("react-countup");require("react-countdown-circle-timer");require("./index2.js");require("lodash.throttle");require("react-infinite-scroller");require("./useSdkFeature.js");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");exports.default=e.mo;
|
package/lib/cjs/masters.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("./index2.js");const e=require("./masters2.js");require("react");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");require("@streamlayer/sdk-web-types");require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("./index2.js");const e=require("./masters2.js");require("react");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");require("@nanostores/react");require("@streamlayer/sdk-web-types");require("./useSdkFeature.js");require("react-countup");require("@streamlayer/sdk-web-interfaces");require("react-countdown-circle-timer");require("lodash.throttle");require("react-infinite-scroller");require("@streamlayer/sdk-web-notifications");exports.MastersStreamLayerProvider=e.MastersStreamLayerProvider;exports.MastersStreamLayerSDKReact=e.MastersStreamLayerSDKReact;
|