@streamlayer/react 1.7.0 → 1.8.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.r.lg&&r<e.r.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,{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:g,screen:S}=e.useStore(d,{keys:["sdkInDesktopView"]}),v=u=>{h(()=>{var x;m(u),g===!1&&(((x=i.current)==null?void 0:x.getBoundingClientRect().y)||0)<0&&y(i,S.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 f="0px";return g?f=p?"0px":"calc(var(--header-height) - var(--header-offset))":f=p?"calc(var(--header-height) + var(--header-offset))":"0px",t.jsxs(e.c,{className:e.cx_default(r,"SL-Tabs"),style:l,children:[t.jsx(e.C$1,{style:{top:f},children:t.jsx(e.b,{activePage:a,toggleActivePage:v})}),a===e.m.HOME&&t.jsxs(t.Fragment,{children:[t.jsx(e.n,{style:{paddingTop:"8px"},children:t.jsx(e.m$1,{children:t.jsx(N,{userSummary:o.userSummary})})}),t.jsx(e.e,{style:{flex:1},children:t.jsx(I,{openQuestion:o.openQuestion,store:o.feedList.getStore()})})]}),a===e.m.LEADERBOARD&&t.jsx(e.l,{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 t=require("react/jsx-runtime"),e=require("./masters.js"),c=require("react"),y=(o,r,s)=>{const n=r>=e.r.lg&&r<e.r.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,{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:g,screen:f}=e.useStore(d,{keys:["sdkInDesktopView"]}),v=u=>{h(()=>{var S;m(u),g===!1&&(((S=i.current)==null?void 0:S.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 x="0px";return g?x=p?"0px":"calc(0px - var(--header-height))":x=p?"var(--header-height)":"0px",t.jsxs(e.c,{className:e.cx_default(r,"SL-Tabs"),style:l,children:[t.jsx(e.C$1,{style:{top:x},children:t.jsx(e.b,{activePage:a,toggleActivePage:v})}),a===e.m.HOME&&t.jsxs(t.Fragment,{children:[t.jsx(e.n,{style:{paddingTop:"8px"},children:t.jsx(e.m$1,{children:t.jsx(N,{userSummary:o.userSummary})})}),t.jsx(e.e,{style:{flex:1},children:t.jsx(I,{openQuestion:o.openQuestion,store:o.feedList.getStore()})})]}),a===e.m.LEADERBOARD&&t.jsx(e.l,{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;