@streamlayer/react 0.41.10 → 1.1.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.
Files changed (40) hide show
  1. package/lib/app/advertisement.d.ts +1 -0
  2. package/lib/app/app.d.ts +5 -3
  3. package/lib/app/auth.d.ts +0 -1
  4. package/lib/app/masters.d.ts +2 -1
  5. package/lib/app/provider.d.ts +5 -4
  6. package/lib/app/useStreamLayerApp.d.ts +8 -7
  7. package/lib/cjs/app.js +1 -1
  8. package/lib/cjs/gamification-feature.js +1 -1
  9. package/lib/cjs/gamification-feature2.js +1 -0
  10. package/lib/cjs/index.js +1 -1
  11. package/lib/cjs/index2.js +182 -14
  12. package/lib/cjs/masters.js +1 -1
  13. package/lib/cjs/masters2.js +9 -164
  14. package/lib/cjs/points.js +1 -1
  15. package/lib/cjs/useStreamLayerApp.js +1 -1
  16. package/lib/cjs/useStreamLayerApp2.js +17 -0
  17. package/lib/dist/cjs/gamification-feature2.js +1 -0
  18. package/lib/dist/cjs/index.js +1 -1
  19. package/lib/dist/cjs/masters.js +92 -80
  20. package/lib/dist/es/gamification-feature2.js +115 -0
  21. package/lib/dist/es/index.js +7 -5
  22. package/lib/dist/es/masters.js +31532 -34905
  23. package/lib/dist/index.d.ts +234 -145
  24. package/lib/dist/style.css +1 -1
  25. package/lib/es/app.js +940 -11
  26. package/lib/es/gamification-feature.js +1 -1
  27. package/lib/es/gamification-feature2.js +4 -0
  28. package/lib/es/index.js +6 -14
  29. package/lib/es/index2.js +23159 -112
  30. package/lib/es/masters.js +1 -1
  31. package/lib/es/masters2.js +679 -23045
  32. package/lib/es/points.js +30 -33
  33. package/lib/es/useStreamLayerApp.js +3 -36
  34. package/lib/es/useStreamLayerApp2.js +17388 -0
  35. package/lib/index.d.ts +1 -1
  36. package/lib/masters.d.ts +2 -1
  37. package/lib/style.css +1 -1
  38. package/package.json +45 -40
  39. package/lib/cjs/index3.js +0 -1
  40. package/lib/es/index3.js +0 -246
@@ -0,0 +1,115 @@
1
+ import { jsx as s, jsxs as v, Fragment as S } from "react/jsx-runtime";
2
+ import { M as C, s as b, u as d, T as x, S as $, C as L, p as D, k as M, O as E, m as f, l as A, a as F, b as R, n as V, c as q, d as O, e as P, f as Q } from "./masters.js";
3
+ import { useRef as T, useState as k, useEffect as I, useTransition as K } from "react";
4
+ const U = /* @__PURE__ */ b("div")({
5
+ name: "InviteFriendsContainer",
6
+ class: "i1c9dygq",
7
+ propsAsIs: !1
8
+ }), j = ({
9
+ deepLink: o
10
+ }) => /* @__PURE__ */ s(U, {
11
+ children: /* @__PURE__ */ s(C, {
12
+ inviteLink: o,
13
+ inviteCardTitle: "It’s More Fun With Friends",
14
+ inviteCardSubtext: "Invite and compete against your friends for the top spot on the leaderboard."
15
+ })
16
+ }), B = /* @__PURE__ */ b("div")({
17
+ name: "InviteLinkContainer",
18
+ class: "i1odbhm4",
19
+ propsAsIs: !1
20
+ }), H = ({
21
+ gamification: o,
22
+ scrollNode: t,
23
+ scrollStore: e
24
+ }) => {
25
+ const r = T(null), {
26
+ data: n,
27
+ hasMore: i,
28
+ loading: l,
29
+ key: p
30
+ } = d(o.leaderboardList.$store), {
31
+ data: a
32
+ } = d(o.deepLink.$store), [u, m] = x(r);
33
+ return !n.length && !l ? /* @__PURE__ */ s(j, {
34
+ deepLink: a
35
+ }) : /* @__PURE__ */ v(S, {
36
+ children: [/* @__PURE__ */ s($, {
37
+ items: n,
38
+ scrollNode: t,
39
+ scrollStore: e,
40
+ fetchMore: o.leaderboardList.fetchMore,
41
+ hasMore: i,
42
+ openItemDetail: o.openUser,
43
+ currentUserId: o.currentUserId.get()
44
+ }, p), a && /* @__PURE__ */ s(B, {
45
+ ref: r,
46
+ children: /* @__PURE__ */ s(L, {
47
+ onClick: () => u(a),
48
+ title: "Invite Friends",
49
+ description: "Challenge them now!"
50
+ })
51
+ }), m]
52
+ });
53
+ }, z = ({ store: o, openQuestion: t }) => {
54
+ const { sdk: e } = D(), r = d(o);
55
+ return /* @__PURE__ */ s(M, { openQuestion: t, questions: r.data, controlVideo: e == null ? void 0 : e.controlVideoPlayer });
56
+ }, W = ({ userSummary: o }) => {
57
+ var t;
58
+ const [e, r] = k(void 0);
59
+ return I(() => {
60
+ const n = o.$store.subscribe((i) => {
61
+ i && r(i);
62
+ });
63
+ return () => {
64
+ n();
65
+ };
66
+ }, [o]), /* @__PURE__ */ s(E, { loading: !(e != null && e.summary), ...e == null ? void 0 : e.summary, successRate: (t = e == null ? void 0 : e.percentage) == null ? void 0 : t.correct });
67
+ }, _ = ({ gamification: o, className: t, scrollStore: e, scrollNode: r, appNode: n, style: i, responsiveStore: l }) => {
68
+ const { tabsShown: p } = d(e, { keys: ["tabsShown"] }), [a, u] = k(f.HOME), [, m] = K(), { sdkInDesktopView: g, screen: N } = d(l, { keys: ["sdkInDesktopView"] }), w = (c) => {
69
+ m(() => {
70
+ var y;
71
+ u(c), g === !1 && (((y = n.current) == null ? void 0 : y.getBoundingClientRect().y) || 0) < 0 && Q(n, N.size, { behavior: "instant" });
72
+ });
73
+ };
74
+ I(() => e.subscribe((c) => {
75
+ if (c.scrollPosition === 0) {
76
+ e.setKey("tabsShown", !0);
77
+ return;
78
+ }
79
+ l.get().sdkInDesktopView ? e.setKey("tabsShown", c.scrollDirection === "backward") : e.setKey("tabsShown", c.scrollDirection === "forward");
80
+ }), [e, l]);
81
+ let h = "0px";
82
+ return g ? h = p ? "0px" : "calc(8px - var(--header-height) - var(--header-offset))" : h = p ? "calc(var(--header-height) + var(--header-offset) - 2px)" : "0px", /* @__PURE__ */ v(A, { className: t, style: i, children: [
83
+ /* @__PURE__ */ s(
84
+ F,
85
+ {
86
+ style: {
87
+ top: h
88
+ },
89
+ children: /* @__PURE__ */ s(R, { activePage: a, toggleActivePage: w })
90
+ }
91
+ ),
92
+ a === f.HOME && /* @__PURE__ */ v(S, { children: [
93
+ /* @__PURE__ */ s(V, { style: { paddingTop: "8px" }, children: /* @__PURE__ */ s(q, { children: /* @__PURE__ */ s(W, { userSummary: o.userSummary }) }) }),
94
+ /* @__PURE__ */ s(O, { style: { flex: 1 }, children: /* @__PURE__ */ s(z, { openQuestion: o.openQuestion, store: o.feedList.getStore() }) })
95
+ ] }),
96
+ a === f.LEADERBOARD && /* @__PURE__ */ s(P, { children: /* @__PURE__ */ s(H, { scrollStore: e, scrollNode: r, gamification: o }) })
97
+ ] });
98
+ }, Y = ({
99
+ gamification: o,
100
+ scrollStore: t,
101
+ className: e,
102
+ appNode: r,
103
+ scrollNode: n,
104
+ responsiveStore: i
105
+ }) => /* @__PURE__ */ s(_, {
106
+ appNode: r,
107
+ scrollStore: t,
108
+ scrollNode: n,
109
+ className: e,
110
+ gamification: o,
111
+ responsiveStore: i
112
+ });
113
+ export {
114
+ Y as default
115
+ };
@@ -1,7 +1,9 @@
1
- import { M as e, a as s, S as t, b as S } from "./masters.js";
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import { h as s, i as m, j as o, g as i } from "./masters.js";
2
4
  export {
3
- e as MastersStreamLayerProvider,
4
- s as MastersStreamLayerSDKReact,
5
- t as StreamLayerLogin,
6
- S as StreamLayerSDKPoints
5
+ s as MastersStreamLayerProvider,
6
+ m as MastersStreamLayerSDKReact,
7
+ o as StreamLayerLogin,
8
+ i as StreamLayerSDKPoints
7
9
  };