@streamlayer/react 1.8.6 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("./masters.js"),c=require("react"),y=(o,r,s)=>{const n=r>=e.C.lg&&r<e.C.xl?75:52;o.current&&window.scrollTo({top:o.current.offsetTop-n,...s})},j=e.styled_default("div")({name:"InviteFriendsContainer",class:"i1c9dygq",propsAsIs:!1}),b=({deepLink:o})=>t.jsx(j,{children:t.jsx(e.M,{inviteLink:o,inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."})}),k=e.styled_default("div")({name:"InviteLinkContainer",class:"i1odbhm4",propsAsIs:!1}),w=({gamification:o,scrollNode:r,scrollStore:s})=>{const n=c.useRef(null),{data:i,hasMore:l,loading:d,key:p}=e.useStore(o.leaderboardList.$store),{data:a}=e.useStore(o.deepLink.$store),[m,h]=e.T(n);return!i.length&&!d?t.jsx(b,{deepLink:a}):t.jsxs(t.Fragment,{children:[t.jsx(e.S,{items:i,scrollNode:r,scrollStore:s,fetchMore:o.leaderboardList.fetchMore,hasMore:l,openItemDetail:o.openUser,currentUserId:o.currentUserId.get()},p),a&&t.jsx(k,{ref:n,children:t.jsx(e.C$1,{onClick:()=>m(a),title:"Invite Friends",description:"Challenge them now!"})}),h]})},I=({store:o,openQuestion:r})=>{const{sdk:s}=e.p(),n=e.useStore(o);return t.jsx(e.k,{openQuestion:r,questions:n.data,controlVideo:s==null?void 0:s.controlVideoPlayer})},N=({userSummary:o})=>{var r;const[s,n]=c.useState(void 0);return c.useEffect(()=>{const i=o.$store.subscribe(l=>{l&&n(l)});return()=>{i()}},[o]),t.jsx(e.O,{loading:!(s!=null&&s.summary),...s==null?void 0:s.summary,successRate:(r=s==null?void 0:s.percentage)==null?void 0:r.correct})},C=({gamification:o,className:r,scrollStore:s,scrollNode:n,appNode:i,style:l,responsiveStore:d})=>{const{tabsShown:p}=e.useStore(s,{keys:["tabsShown"]}),[a,m]=c.useState(e.m.HOME),[,h]=c.useTransition(),{sdkInDesktopView:x,screen:f}=e.useStore(d,{keys:["sdkInDesktopView"]}),v=u=>{h(()=>{var g;m(u),x===!1&&(((g=i.current)==null?void 0:g.getBoundingClientRect().y)||0)<0&&y(i,f.size,{behavior:"instant"})})};c.useEffect(()=>s.subscribe(u=>{if(u.scrollPosition===0){s.setKey("tabsShown",!0);return}d.get().sdkInDesktopView?s.setKey("tabsShown",u.scrollDirection==="backward"):s.setKey("tabsShown",u.scrollDirection==="forward")}),[s,d]);let S="0px";return x?S=p?"0px":"calc(0px - var(--header-height))":S=p?"var(--header-height)":"0px",t.jsxs(e.l,{className:e.cx_default(r,"SL-Tabs"),style:l,children:[t.jsx(e.S$1,{style:{top:S},children:t.jsx(e.b,{activePage:a,toggleActivePage:v})}),a===e.m.HOME&&t.jsxs(t.Fragment,{children:[t.jsx(e.m$1,{children:t.jsx(e.d,{children:t.jsx(N,{userSummary:o.userSummary})})}),t.jsx(e.n,{style:{flex:1},children:t.jsx(I,{openQuestion:o.openQuestion,store:o.feedList.getStore()})})]}),a===e.m.LEADERBOARD&&t.jsx(e.C$2,{children:t.jsx(w,{scrollStore:s,scrollNode:n,gamification:o})})]})},L=({gamification:o,scrollStore:r,className:s,appNode:n,scrollNode:i,responsiveStore:l})=>t.jsx(C,{appNode:n,scrollStore:r,scrollNode:i,className:s,gamification:o,responsiveStore:l});exports.default=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),e=require("./masters.js"),c=require("react"),j=(s,r,t)=>{const n=r>=e.C.lg&&r<e.C.xl?75:52;s.current&&window.scrollTo({top:s.current.offsetTop-n,...t})},y=e.styled_default("div")({name:"InviteFriendsContainer",class:"i1c9dygq",propsAsIs:!1}),k=({deepLink:s})=>o.jsx(y,{children:o.jsx(e.M,{inviteLink:s,inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."})}),I=e.styled_default("div")({name:"InviteLinkContainer",class:"i1odbhm4",propsAsIs:!1}),w=({gamification:s,scrollNode:r,scrollStore:t})=>{const n=c.useRef(null),{data:i,hasMore:l,loading:d,key:m}=e.useStore(s.leaderboardList.$store),{data:a}=e.useStore(s.deepLink.$store),[u,h]=e.T(n);return!i.length&&!d?o.jsx(k,{deepLink:a}):o.jsxs(o.Fragment,{children:[o.jsx(e.S,{items:i,scrollNode:r,scrollStore:t,fetchMore:s.leaderboardList.fetchMore,hasMore:l,openItemDetail:s.openUser,currentUserId:s.currentUserId.get()},m),a&&o.jsx(I,{ref:n,children:o.jsx(e.C$1,{onClick:()=>u(a),title:"Invite Friends",description:"Challenge them now!"})}),h]})},N=({store:s,openQuestion:r})=>{const{sdk:t}=e.p(),n=e.useStore(s);return o.jsx(e.k,{openQuestion:r,questions:n.data,controlVideo:t==null?void 0:t.controlVideoPlayer})},C=({userSummary:s})=>{var r;const[t,n]=c.useState(void 0);return c.useEffect(()=>{const i=s.$store.subscribe(l=>{l&&n(l)});return()=>{i()}},[s]),o.jsx(e.O,{loading:!(t!=null&&t.summary),...t==null?void 0:t.summary,successRate:(r=t==null?void 0:t.percentage)==null?void 0:r.correct})},L=({gamification:s,className:r,scrollStore:t,scrollNode:n,appNode:i,style:l,responsiveStore:d})=>{const{tabsShown:m}=e.useStore(t,{keys:["tabsShown"]}),a=e.useStore(s.friendsTabEnabled),[u,h]=c.useState(e.m.HOME),[,g]=c.useTransition(),{sdkInDesktopView:x,screen:v}=e.useStore(d,{keys:["sdkInDesktopView"]}),b=p=>{g(()=>{var f;h(p),x===!1&&(((f=i.current)==null?void 0:f.getBoundingClientRect().y)||0)<0&&j(i,v.size,{behavior:"instant"})})};c.useEffect(()=>t.subscribe(p=>{if(p.scrollPosition===0){t.setKey("tabsShown",!0);return}d.get().sdkInDesktopView?t.setKey("tabsShown",p.scrollDirection==="backward"):t.setKey("tabsShown",p.scrollDirection==="forward")}),[t,d]),c.useEffect(()=>{a||h(e.m.HOME)},[a]);let S="0px";return x?S=m?"0px":"calc(0px - var(--header-height))":S=m?"var(--header-height)":"0px",o.jsxs(e.l,{className:e.cx_default(r,"SL-Tabs"),style:l,children:[a&&o.jsx(e.S$1,{style:{top:S},children:o.jsx(e.b,{activePage:u,toggleActivePage:b})}),u===e.m.HOME&&o.jsxs(o.Fragment,{children:[o.jsx(e.m$1,{children:o.jsx(e.d,{children:o.jsx(C,{userSummary:s.userSummary})})}),o.jsx(e.n,{style:{flex:1},children:o.jsx(N,{openQuestion:s.openQuestion,store:s.feedList.getStore()})})]}),u===e.m.LEADERBOARD&&o.jsx(e.C$2,{children:o.jsx(w,{scrollStore:t,scrollNode:n,gamification:s})})]})},M=({gamification:s,scrollStore:r,className:t,appNode:n,scrollNode:i,responsiveStore:l})=>o.jsx(L,{appNode:n,scrollStore:r,scrollNode:i,className:t,gamification:s,responsiveStore:l});exports.default=M;