@streamlayer/react 1.6.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 s=require("react/jsx-runtime"),e=require("./masters.js"),c=require("react"),y=e.styled_default("div")({name:"InviteFriendsContainer",class:"i1c9dygq",propsAsIs:!1}),j=({deepLink:o})=>s.jsx(y,{children:s.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."})}),b=e.styled_default("div")({name:"InviteLinkContainer",class:"i1odbhm4",propsAsIs:!1}),k=({gamification:o,scrollNode:r,scrollStore:t})=>{const n=c.useRef(null),{data:i,hasMore:a,loading:d,key:p}=e.useStore(o.leaderboardList.$store),{data:l}=e.useStore(o.deepLink.$store),[m,h]=e.T(n);return!i.length&&!d?s.jsx(j,{deepLink:l}):s.jsxs(s.Fragment,{children:[s.jsx(e.S,{items:i,scrollNode:r,scrollStore:t,fetchMore:o.leaderboardList.fetchMore,hasMore:a,openItemDetail:o.openUser,currentUserId:o.currentUserId.get()},p),l&&s.jsx(b,{ref:n,children:s.jsx(e.C,{onClick:()=>m(l),title:"Invite Friends",description:"Challenge them now!"})}),h]})},I=({store:o,openQuestion:r})=>{const{sdk:t}=e.p(),n=e.useStore(o);return s.jsx(e.k,{openQuestion:r,questions:n.data,controlVideo:t==null?void 0:t.controlVideoPlayer})},N=({userSummary:o})=>{var r;const[t,n]=c.useState(void 0);return c.useEffect(()=>{const i=o.$store.subscribe(a=>{a&&n(a)});return()=>{i()}},[o]),s.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})},w=({gamification:o,className:r,scrollStore:t,scrollNode:n,appNode:i,style:a,responsiveStore:d})=>{const{tabsShown:p}=e.useStore(t,{keys:["tabsShown"]}),[l,m]=c.useState(e.m.HOME),[,h]=c.useTransition(),{sdkInDesktopView:g,screen:v}=e.useStore(d,{keys:["sdkInDesktopView"]}),f=u=>{h(()=>{var S;m(u),g===!1&&(((S=i.current)==null?void 0:S.getBoundingClientRect().y)||0)<0&&e.C$2(i,v.size,{behavior:"instant"})})};c.useEffect(()=>t.subscribe(u=>{if(u.scrollPosition===0){t.setKey("tabsShown",!0);return}d.get().sdkInDesktopView?t.setKey("tabsShown",u.scrollDirection==="backward"):t.setKey("tabsShown",u.scrollDirection==="forward")}),[t,d]);let x="0px";return g?x=p?"0px":"calc(8px - var(--header-height) - var(--header-offset))":x=p?"calc(var(--header-height) + var(--header-offset) - 2px)":"0px",s.jsxs(e.l,{className:r,style:a,children:[s.jsx(e.C$1,{style:{top:x},children:s.jsx(e.b,{activePage:l,toggleActivePage:f})}),l===e.m.HOME&&s.jsxs(s.Fragment,{children:[s.jsx(e.n,{style:{paddingTop:"8px"},children:s.jsx(e.m$1,{children:s.jsx(N,{userSummary:o.userSummary})})}),s.jsx(e.a,{style:{flex:1},children:s.jsx(I,{openQuestion:o.openQuestion,store:o.feedList.getStore()})})]}),l===e.m.LEADERBOARD&&s.jsx(e.p$1,{children:s.jsx(k,{scrollStore:t,scrollNode:n,gamification:o})})]})},C=({gamification:o,scrollStore:r,className:t,appNode:n,scrollNode:i,responsiveStore:a})=>s.jsx(w,{appNode:n,scrollStore:r,scrollNode:i,className:t,gamification:o,responsiveStore:a});exports.default=C;
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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const e=require("./masters.js");exports.MastersStreamLayerProvider=e.MastersStreamLayerProvider;exports.MastersStreamLayerSDKReact=e.MastersStreamLayerSDKReact;exports.StreamLayerLogin=e.StreamLayerLogin;exports.StreamLayerSDKPoints=e.StreamLayerSDKPoints;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");const e=require("./masters.js");require("react");exports.MastersStreamLayerProvider=e.MastersStreamLayerProvider;exports.MastersStreamLayerSDKReact=e.MastersStreamLayerSDKReact;exports.StreamLayerLogin=e.StreamLayerLogin;exports.StreamLayerSDKPoints=e.StreamLayerSDKPoints;