@streamlayer/web-os 0.4.3 → 0.4.4

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 (39) hide show
  1. package/lib/cjs/gamification-feature.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/index2.js +25 -40
  4. package/lib/classic/cjs/classic.js +1 -1
  5. package/lib/classic/cjs/gamification-feature.js +1 -1
  6. package/lib/classic/cjs/index.js +1 -1
  7. package/lib/classic/cjs/index2.js +1 -10
  8. package/lib/classic/classic.d.ts +2 -13
  9. package/lib/classic/core/app/app.d.ts +16 -0
  10. package/lib/classic/core/app/event.d.ts +6 -0
  11. package/lib/classic/core/app/provider.d.ts +49 -0
  12. package/lib/classic/core/app/useStreamLayerApp.d.ts +23 -0
  13. package/lib/classic/core/index.d.ts +4 -0
  14. package/lib/classic/es/classic.js +78 -8
  15. package/lib/classic/es/gamification-feature.js +638 -2
  16. package/lib/classic/es/index.js +157 -10
  17. package/lib/classic/es/index2.js +19054 -11977
  18. package/lib/classic/index.d.ts +2 -13
  19. package/lib/classic.d.ts +2 -13
  20. package/lib/core/app/app.d.ts +16 -0
  21. package/lib/core/app/event.d.ts +6 -0
  22. package/lib/core/app/provider.d.ts +49 -0
  23. package/lib/core/app/useStreamLayerApp.d.ts +23 -0
  24. package/lib/core/index.d.ts +4 -0
  25. package/lib/es/gamification-feature.js +606 -2
  26. package/lib/es/index.js +2 -2
  27. package/lib/es/index2.js +16237 -23252
  28. package/lib/index.d.ts +2 -13
  29. package/package.json +19 -20
  30. package/lib/cjs/gamification-feature2.js +0 -1
  31. package/lib/classic/cjs/classic2.js +0 -10
  32. package/lib/classic/cjs/gamification-feature2.js +0 -1
  33. package/lib/classic/cjs/gamification-feature3.js +0 -1
  34. package/lib/classic/cjs/index3.js +0 -1
  35. package/lib/classic/es/classic2.js +0 -13037
  36. package/lib/classic/es/gamification-feature2.js +0 -4
  37. package/lib/classic/es/gamification-feature3.js +0 -643
  38. package/lib/classic/es/index3.js +0 -14930
  39. package/lib/es/gamification-feature2.js +0 -608
@@ -1,4 +1,640 @@
1
- import { F } from "./index2.js";
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { A as A$2, s as styled_default, i as i$5, I as I$4, e as s$3, B as B1, f as f$2, j as InvitationFrom, c as useStore, k as r$5, l as S$1, O, m as b$2, R as R$1, D, w as wt, p as p$6, n as useTransition, o as l$6, q as cx_default, t as S$2, v as m$6, x as d$3, y as n$4, C as C$2 } from "./index2.js";
3
+ import "@noriginmedia/norigin-spatial-navigation";
4
+ import { useRef, useState, useCallback, useEffect } from "react";
5
+ import "react-countdown-circle-timer";
6
+ import { createPortal } from "react-dom";
7
+ import "react-countup";
8
+ import "nanostores";
9
+ import "lodash.throttle";
10
+ import m$5 from "react-infinite-scroller";
11
+ const I$3 = (o2, e2, n2) => {
12
+ const t2 = e2 >= A$2.lg && e2 < A$2.xl ? 75 : 52;
13
+ o2.current && window.scrollTo({
14
+ top: o2.current.offsetTop - t2,
15
+ ...n2
16
+ });
17
+ };
18
+ const n$3 = /* @__PURE__ */ styled_default("div")({
19
+ name: "Container",
20
+ class: "c1zy8a",
21
+ propsAsIs: false
22
+ }), o$5 = /* @__PURE__ */ styled_default("div")({
23
+ name: "Title",
24
+ class: "t1vih9p5",
25
+ propsAsIs: false
26
+ }), t$4 = /* @__PURE__ */ styled_default("div")({
27
+ name: "Indicator",
28
+ class: "i1fbnvpb",
29
+ propsAsIs: false
30
+ });
31
+ const m$4 = ({ indicator: i2, title: n2 }) => /* @__PURE__ */ jsxs(n$3, { children: [
32
+ /* @__PURE__ */ jsx(o$5, { children: n2 }),
33
+ /* @__PURE__ */ jsx(t$4, { children: i2 })
34
+ ] });
35
+ const t$3 = /* @__PURE__ */ styled_default("div")({
36
+ name: "Container",
37
+ class: "ctmhwyc",
38
+ propsAsIs: false
39
+ }), a$5 = /* @__PURE__ */ styled_default("div")({
40
+ name: "Indicator",
41
+ class: "i1jri200",
42
+ propsAsIs: false
43
+ }), e$8 = /* @__PURE__ */ styled_default("div")({
44
+ name: "Title",
45
+ class: "t8s05oq",
46
+ propsAsIs: false
47
+ });
48
+ const l$5 = ({ indicator: r2, title: t2 }) => /* @__PURE__ */ jsxs(t$3, { children: [
49
+ /* @__PURE__ */ jsx(a$5, { children: r2 }),
50
+ /* @__PURE__ */ jsx(e$8, { children: t2 })
51
+ ] });
52
+ const o$4 = /* @__PURE__ */ styled_default("div")({
53
+ name: "Container",
54
+ class: "c1yrpn9o",
55
+ propsAsIs: false
56
+ }), n$2 = /* @__PURE__ */ styled_default("div")({
57
+ name: "TopInfo",
58
+ class: "t17fwahh",
59
+ propsAsIs: false
60
+ }), e$7 = /* @__PURE__ */ styled_default("div")({
61
+ name: "BottomInfo",
62
+ class: "by6w7e9",
63
+ propsAsIs: false
64
+ }), t$2 = /* @__PURE__ */ styled_default("div")({
65
+ name: "User",
66
+ class: "u1g7arbm",
67
+ propsAsIs: false
68
+ }), r$4 = /* @__PURE__ */ styled_default("img")({
69
+ name: "Avatar",
70
+ class: "a1ldeata",
71
+ propsAsIs: false
72
+ }), c$4 = /* @__PURE__ */ styled_default("div")({
73
+ name: "UserInfo",
74
+ class: "u10d4koz",
75
+ propsAsIs: false
76
+ }), l$4 = /* @__PURE__ */ styled_default("div")({
77
+ name: "UserName",
78
+ class: "u1q6roj0",
79
+ propsAsIs: false
80
+ }), p$5 = /* @__PURE__ */ styled_default("div")({
81
+ name: "UserRating",
82
+ class: "ui0m425",
83
+ propsAsIs: false
84
+ }), i$4 = /* @__PURE__ */ styled_default("img")({
85
+ name: "TrophyIcon",
86
+ class: "t1el3mrn",
87
+ propsAsIs: false
88
+ }), m$3 = /* @__PURE__ */ styled_default("div")({
89
+ name: "RtsContainer",
90
+ class: "r2vgnxv",
91
+ propsAsIs: false
92
+ }), d$2 = /* @__PURE__ */ styled_default("div")({
93
+ name: "RtsDivider",
94
+ class: "roqn06j",
95
+ propsAsIs: false
96
+ }), f$1 = /* @__PURE__ */ styled_default("div")({
97
+ name: "Rts",
98
+ class: "r15adx7c",
99
+ propsAsIs: false
100
+ }), I$2 = /* @__PURE__ */ styled_default("div")({
101
+ name: "RtsIndicator",
102
+ class: "rv59lta",
103
+ propsAsIs: false
104
+ }), v$1 = /* @__PURE__ */ styled_default("div")({
105
+ name: "RtsLabel",
106
+ class: "r55lotb",
107
+ propsAsIs: false
108
+ }), A$1 = /* @__PURE__ */ styled_default("div")({
109
+ name: "Divider",
110
+ class: "d1knfgqt",
111
+ propsAsIs: false
112
+ }), R = /* @__PURE__ */ styled_default("div")({
113
+ name: "Ranks",
114
+ class: "r1mqo824",
115
+ propsAsIs: false
116
+ }), U = /* @__PURE__ */ styled_default("div")({
117
+ name: "Statistics",
118
+ class: "sxareh6",
119
+ propsAsIs: false
120
+ }), u$1 = /* @__PURE__ */ styled_default("div")({
121
+ name: "AvatarPlaceholder",
122
+ class: "amcu48h",
123
+ propsAsIs: false
124
+ }), h = /* @__PURE__ */ styled_default("button")({
125
+ name: "UserAccountBtn",
126
+ class: "u32nfkp",
127
+ propsAsIs: false
128
+ });
129
+ const F = "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", z$1 = ({
130
+ loading: t2,
131
+ hideFriendsRank: n2,
132
+ avatar: l2,
133
+ name: o2,
134
+ points: s2,
135
+ friendsRank: m2,
136
+ rank: C2,
137
+ streak: p2,
138
+ correct: f2,
139
+ incorrect: v2,
140
+ inTop: L,
141
+ successRate: g2
142
+ }) => /* @__PURE__ */ jsxs(o$4, { "data-loading": t2, children: [
143
+ /* @__PURE__ */ jsx(n$2, { children: /* @__PURE__ */ jsx(i$5, { loading: t2, children: /* @__PURE__ */ jsxs(t$2, { children: [
144
+ /* @__PURE__ */ jsxs(h, { children: [
145
+ l2 && /* @__PURE__ */ jsx(r$4, { alt: "avatar", src: l2 }),
146
+ !l2 && /* @__PURE__ */ jsx(u$1, { children: I$4(o2 || "") })
147
+ ] }),
148
+ /* @__PURE__ */ jsxs(c$4, { children: [
149
+ /* @__PURE__ */ jsx(l$4, { children: o2 }),
150
+ /* @__PURE__ */ jsxs(p$5, { children: [
151
+ /* @__PURE__ */ jsxs(m$3, { children: [
152
+ /* @__PURE__ */ jsxs(f$1, { children: [
153
+ /* @__PURE__ */ jsx(i$4, { alt: "rank-icon", src: F }),
154
+ /* @__PURE__ */ jsxs(I$2, { children: [
155
+ s$3(s2),
156
+ /* @__PURE__ */ jsx(v$1, { children: "PTS" })
157
+ ] })
158
+ ] }),
159
+ n2 && /* @__PURE__ */ jsxs(I$2, { children: [
160
+ /* @__PURE__ */ jsx(d$2, {}),
161
+ C2 || 0,
162
+ /* @__PURE__ */ jsx(v$1, { children: "global rank" })
163
+ ] })
164
+ ] }),
165
+ !n2 && /* @__PURE__ */ jsxs(Fragment, { children: [
166
+ /* @__PURE__ */ jsx(A$1, {}),
167
+ /* @__PURE__ */ jsxs("div", { children: [
168
+ "TOP ",
169
+ L || 0,
170
+ "%"
171
+ ] })
172
+ ] })
173
+ ] })
174
+ ] })
175
+ ] }) }) }),
176
+ /* @__PURE__ */ jsxs(e$7, { children: [
177
+ !n2 && /* @__PURE__ */ jsxs(R, { children: [
178
+ /* @__PURE__ */ jsx(i$5, { loading: t2, style: { width: "100%" }, children: /* @__PURE__ */ jsx(m$4, { indicator: m2 || 0, title: "Friends rank" }) }),
179
+ /* @__PURE__ */ jsx(i$5, { loading: t2, style: { width: "100%" }, children: /* @__PURE__ */ jsx(m$4, { indicator: C2 || 0, title: "Global rank" }) })
180
+ ] }),
181
+ /* @__PURE__ */ jsx(i$5, { loading: t2, children: /* @__PURE__ */ jsxs(U, { children: [
182
+ /* @__PURE__ */ jsx(l$5, { indicator: p2 || 0, title: "Win streak" }),
183
+ /* @__PURE__ */ jsx(l$5, { indicator: f2 || 0, title: "Correct" }),
184
+ /* @__PURE__ */ jsx(l$5, { indicator: v2 || 0, title: "Incorrect" }),
185
+ /* @__PURE__ */ jsx(l$5, { indicator: `${g2 || 0}%`, title: "Succ. rate" })
186
+ ] }) })
187
+ ] })
188
+ ] });
189
+ const t$1 = /* @__PURE__ */ styled_default("div")({
190
+ name: "Container",
191
+ class: "c115qtkr",
192
+ propsAsIs: false
193
+ }), n$1 = /* @__PURE__ */ styled_default("div")({
194
+ name: "STabs",
195
+ class: "sxnslc8",
196
+ propsAsIs: false
197
+ }), o$3 = /* @__PURE__ */ styled_default("button")({
198
+ name: "Button",
199
+ class: "b1umzux0",
200
+ propsAsIs: false
201
+ }), e$6 = /* @__PURE__ */ styled_default("span")({
202
+ name: "Title",
203
+ class: "tspsaas",
204
+ propsAsIs: false
205
+ });
206
+ var m$2 = /* @__PURE__ */ ((r2) => (r2.HOME = "home", r2.LEADERBOARD = "leaderboard", r2))(m$2 || {});
207
+ const o$2 = ({ title: r2, active: e2, onClick: n2 }) => /* @__PURE__ */ jsx(o$3, { "data-a": "intr", onClick: n2, "data-selected": e2, children: /* @__PURE__ */ jsx(e$6, { "data-a": "intr", children: r2 }) }), b$1 = ({ activePage: r2 = "home", toggleActivePage: e2 }) => /* @__PURE__ */ jsx(t$1, { children: /* @__PURE__ */ jsxs(n$1, { "data-position": r2 === "home" ? "left" : "right", children: [
208
+ /* @__PURE__ */ jsx(o$2, { title: "Home", active: r2 === "home", onClick: () => e2(
209
+ "home"
210
+ /* HOME */
211
+ ) }),
212
+ /* @__PURE__ */ jsx(
213
+ o$2,
214
+ {
215
+ title: "Friends",
216
+ active: r2 === "leaderboard",
217
+ onClick: () => e2(
218
+ "leaderboard"
219
+ /* LEADERBOARD */
220
+ )
221
+ }
222
+ )
223
+ ] }) });
224
+ const n = /* @__PURE__ */ styled_default("button")({
225
+ name: "Container",
226
+ class: "cpjnajb",
227
+ propsAsIs: false
228
+ }), a$4 = /* @__PURE__ */ styled_default("div")({
229
+ name: "Content",
230
+ class: "c4m6kaz",
231
+ propsAsIs: false
232
+ }), e$5 = /* @__PURE__ */ styled_default("span")({
233
+ name: "Title",
234
+ class: "t1h8t9cc",
235
+ propsAsIs: false
236
+ });
237
+ const s$2 = () => /* @__PURE__ */ jsx(n, { children: /* @__PURE__ */ jsxs(a$4, { children: [
238
+ /* @__PURE__ */ jsx(B1, { name: "iconCopySuccess" }),
239
+ /* @__PURE__ */ jsx(e$5, { children: "Link Copied to Clipboard" })
240
+ ] }) });
241
+ const T = (r2) => {
242
+ const t2 = useRef(), [c2, o2] = useState(null), a2 = useCallback(
243
+ async (e2) => {
244
+ var i2;
245
+ if (e2 && ((i2 = navigator == null ? void 0 : navigator.clipboard) != null && i2.writeText)) {
246
+ t2.current && (clearTimeout(t2.current), o2(null));
247
+ try {
248
+ await navigator.clipboard.writeText(e2), r2.current && (o2(createPortal(/* @__PURE__ */ jsx(s$2, {}), r2.current)), t2.current = setTimeout(() => {
249
+ o2(null);
250
+ }, 1e3));
251
+ } catch (n2) {
252
+ console.error("Unable to copy to clipboard", n2);
253
+ }
254
+ }
255
+ },
256
+ [r2]
257
+ );
258
+ return useEffect(() => () => {
259
+ clearTimeout(t2.current);
260
+ }, []), [a2, c2];
261
+ };
262
+ const r$3 = /* @__PURE__ */ styled_default("div")({
263
+ name: "Container",
264
+ class: "c1ux29ft",
265
+ propsAsIs: false
266
+ }), o$1 = () => B1, a$3 = /* @__PURE__ */ styled_default(o$1())({
267
+ name: "FriendsIcon",
268
+ class: "f10ncfg2",
269
+ propsAsIs: true
270
+ }), p$4 = /* @__PURE__ */ styled_default("div")({
271
+ name: "Content",
272
+ class: "c1yc07bd",
273
+ propsAsIs: false
274
+ }), i$3 = /* @__PURE__ */ styled_default("div")({
275
+ name: "Title",
276
+ class: "tj6cq7w",
277
+ propsAsIs: false
278
+ }), l$3 = /* @__PURE__ */ styled_default("div")({
279
+ name: "Description",
280
+ class: "d1ag78xo",
281
+ propsAsIs: false
282
+ }), e$4 = () => B1, I$1 = /* @__PURE__ */ styled_default(e$4())({
283
+ name: "ArrowInviteIcon",
284
+ class: "awohrz6",
285
+ propsAsIs: true
286
+ });
287
+ const C$1 = ({ title: o2, description: t2, onClick: r2, className: e2 }) => {
288
+ const [c2] = f$2({
289
+ type: "invitation",
290
+ action: "sent",
291
+ payload: {
292
+ from: InvitationFrom.TITLE_CARD
293
+ }
294
+ });
295
+ return /* @__PURE__ */ jsxs(r$3, { "data-a": "intr", onClick: c2(r2), className: e2, children: [
296
+ /* @__PURE__ */ jsx(a$3, { name: "icon-friends" }),
297
+ /* @__PURE__ */ jsxs(p$4, { children: [
298
+ /* @__PURE__ */ jsx(i$3, { children: o2 }),
299
+ /* @__PURE__ */ jsx(l$3, { children: t2 })
300
+ ] }),
301
+ /* @__PURE__ */ jsx(I$1, { name: "icon-copy" })
302
+ ] });
303
+ };
304
+ const r$2 = /* @__PURE__ */ styled_default("div")({
305
+ name: "Container",
306
+ class: "culdu4a",
307
+ propsAsIs: false
308
+ }), t = /* @__PURE__ */ styled_default("div")({
309
+ name: "Position",
310
+ class: "pwf8e69",
311
+ propsAsIs: false
312
+ }), c$3 = /* @__PURE__ */ styled_default("img")({
313
+ name: "Avatar",
314
+ class: "atf4yh4",
315
+ propsAsIs: false
316
+ }), p$3 = /* @__PURE__ */ styled_default("div")({
317
+ name: "AvatarPlaceholder",
318
+ class: "a1dg29ja",
319
+ propsAsIs: false
320
+ }), l$2 = /* @__PURE__ */ styled_default("div")({
321
+ name: "Content",
322
+ class: "c10a68rc",
323
+ propsAsIs: false
324
+ }), m$1 = /* @__PURE__ */ styled_default("div")({
325
+ name: "NameContainer",
326
+ class: "nc4kck5",
327
+ propsAsIs: false
328
+ }), i$2 = /* @__PURE__ */ styled_default("span")({
329
+ name: "Name",
330
+ class: "njsrqgr",
331
+ propsAsIs: false
332
+ }), e$3 = () => B1, d$1 = /* @__PURE__ */ styled_default(e$3())({
333
+ name: "CurrentUserBadge",
334
+ class: "c17uc4zr",
335
+ propsAsIs: true
336
+ });
337
+ const N = ({
338
+ friendsRank: i2,
339
+ avatar: a2,
340
+ name: t$12,
341
+ userId: n2,
342
+ points: o2,
343
+ isCurrentUser: d2,
344
+ style: m2
345
+ }) => /* @__PURE__ */ jsxs(r$2, { "data-name": n2, style: m2, children: [
346
+ /* @__PURE__ */ jsx(t, { children: i2 || 0 }),
347
+ /* @__PURE__ */ jsxs(l$2, { children: [
348
+ a2 ? /* @__PURE__ */ jsx(c$3, { alt: "leaderboard-item-avatar", src: a2 }) : /* @__PURE__ */ jsx(p$3, { children: I$4(t$12 || "") }),
349
+ /* @__PURE__ */ jsxs(m$1, { children: [
350
+ /* @__PURE__ */ jsx(i$2, { children: t$12 || "" }),
351
+ d2 && /* @__PURE__ */ jsx(d$1, { name: "icon-star" })
352
+ ] })
353
+ ] }),
354
+ /* @__PURE__ */ jsx("div", { children: s$3(o2) })
355
+ ] });
356
+ const u = /* @__PURE__ */ styled_default("div")({
357
+ name: "Container",
358
+ class: "c16btbfp",
359
+ propsAsIs: false
360
+ }), S = ({
361
+ items: s2,
362
+ currentUserId: e2,
363
+ openItemDetail: o2,
364
+ fetchMore: n2,
365
+ scrollNode: i2,
366
+ hasMore: d2
367
+ }) => {
368
+ const l2 = useCallback((r2) => {
369
+ const a2 = r2.target.getAttribute("data-name");
370
+ a2 && o2(a2);
371
+ }, [o2]);
372
+ return /* @__PURE__ */ jsx(m$5, {
373
+ loadMore: n2,
374
+ initialLoad: false,
375
+ hasMore: d2,
376
+ useWindow: false,
377
+ getScrollParent: () => i2.current,
378
+ children: /* @__PURE__ */ jsx(u, {
379
+ "data-a": "intr",
380
+ onClick: l2,
381
+ children: s2.map((r2) => /* @__PURE__ */ jsx(N, {
382
+ ...r2,
383
+ isCurrentUser: !!e2 && e2 === r2.userId
384
+ }, r2.userId))
385
+ })
386
+ });
387
+ };
388
+ const i$1 = /* @__PURE__ */ styled_default("div")({
389
+ name: "Container",
390
+ class: "c1itm4k7",
391
+ propsAsIs: false
392
+ }), c$2 = /* @__PURE__ */ styled_default("div")({
393
+ name: "IconContainer",
394
+ class: "i1w4fsni",
395
+ propsAsIs: false
396
+ }), e$2 = () => B1, l$1 = /* @__PURE__ */ styled_default(e$2())({
397
+ name: "InviteGameIcon",
398
+ class: "i19m85r1",
399
+ propsAsIs: true
400
+ }), p$2 = /* @__PURE__ */ styled_default("div")({
401
+ name: "Content",
402
+ class: "c1mbu204",
403
+ propsAsIs: false
404
+ }), r$1 = /* @__PURE__ */ styled_default("div")({
405
+ name: "Heading",
406
+ class: "h1amdqtv",
407
+ propsAsIs: false
408
+ }), m = /* @__PURE__ */ styled_default("div")({
409
+ name: "Subtext",
410
+ class: "s1lhlj9j",
411
+ propsAsIs: false
412
+ }), I = /* @__PURE__ */ styled_default("div")({
413
+ name: "LinkContainer",
414
+ class: "l1wot35e",
415
+ propsAsIs: false
416
+ }), d = /* @__PURE__ */ styled_default("div")({
417
+ name: "LinkInfo",
418
+ class: "l1jdw39q",
419
+ propsAsIs: false
420
+ }), f = /* @__PURE__ */ styled_default("span")({
421
+ name: "LinkTitle",
422
+ class: "l1cr5mk",
423
+ propsAsIs: false
424
+ }), v = /* @__PURE__ */ styled_default("span")({
425
+ name: "LinkAddress",
426
+ class: "lvi87q4",
427
+ propsAsIs: false
428
+ }), o = () => B1, A = /* @__PURE__ */ styled_default(o())({
429
+ name: "LinkIcon",
430
+ class: "l1pqlvw3",
431
+ propsAsIs: true
432
+ });
433
+ const M = ({
434
+ inviteLink: i2,
435
+ inviteCardTitle: e2,
436
+ inviteCardSubtext: t2,
437
+ primaryColor: c2,
438
+ className: a2
439
+ }) => {
440
+ const r2 = useRef(null), [l2, d$12] = T(r2), [m$12] = f$2({
441
+ type: "invitation",
442
+ action: "sent",
443
+ payload: {
444
+ from: InvitationFrom.MENU
445
+ }
446
+ });
447
+ return /* @__PURE__ */ jsxs(i$1, { className: a2, children: [
448
+ /* @__PURE__ */ jsx(c$2, { style: { backgroundColor: c2 }, children: /* @__PURE__ */ jsx(l$1, { name: "invite-game-icon" }) }),
449
+ /* @__PURE__ */ jsxs(p$2, { children: [
450
+ /* @__PURE__ */ jsx(r$1, { children: e2 || "" }),
451
+ /* @__PURE__ */ jsx(m, { children: t2 || "" })
452
+ ] }),
453
+ i2 && /* @__PURE__ */ jsxs(I, { ref: r2, "data-a": "intr", onClick: m$12(() => l2(i2)), children: [
454
+ /* @__PURE__ */ jsxs(d, { children: [
455
+ /* @__PURE__ */ jsx(f, { children: "Invite link" }),
456
+ /* @__PURE__ */ jsx(v, { children: i2 })
457
+ ] }),
458
+ /* @__PURE__ */ jsx(A, { name: "icon-copy" })
459
+ ] }),
460
+ d$12
461
+ ] });
462
+ };
463
+ const r = /* @__PURE__ */ styled_default("div")({
464
+ name: "InviteFriendsContainer",
465
+ class: "i1c9dygq",
466
+ propsAsIs: false
467
+ }), a$2 = ({
468
+ deepLink: i2
469
+ }) => /* @__PURE__ */ jsx(r, {
470
+ children: /* @__PURE__ */ jsx(M, {
471
+ inviteLink: i2,
472
+ inviteCardTitle: "It’s More Fun With Friends",
473
+ inviteCardSubtext: "Invite and compete against your friends for the top spot on the leaderboard."
474
+ })
475
+ });
476
+ const C = /* @__PURE__ */ styled_default("div")({
477
+ name: "InviteLinkContainer",
478
+ class: "i1odbhm4",
479
+ propsAsIs: false
480
+ }), z = ({
481
+ gamification: e2,
482
+ scrollNode: s2,
483
+ scrollStore: p2
484
+ }) => {
485
+ const o2 = useRef(null), {
486
+ data: i2,
487
+ hasMore: d2,
488
+ loading: m2,
489
+ key: a2
490
+ } = useStore(e2.leaderboardList.$store), {
491
+ data: t2
492
+ } = useStore(e2.deepLink.$store), [l2, c2] = T(o2);
493
+ return !i2.length && !m2 ? /* @__PURE__ */ jsx(a$2, {
494
+ deepLink: t2
495
+ }) : /* @__PURE__ */ jsxs(Fragment, {
496
+ children: [/* @__PURE__ */ jsx(S, {
497
+ items: i2,
498
+ scrollNode: s2,
499
+ scrollStore: p2,
500
+ fetchMore: e2.leaderboardList.fetchMore,
501
+ hasMore: d2,
502
+ openItemDetail: e2.openUser,
503
+ currentUserId: e2.currentUserId.get()
504
+ }, a2), t2 && /* @__PURE__ */ jsx(C, {
505
+ ref: o2,
506
+ children: /* @__PURE__ */ jsx(C$1, {
507
+ "data-a": "intr",
508
+ onClick: () => l2(t2),
509
+ title: "Invite Friends",
510
+ description: "Challenge them now!"
511
+ })
512
+ }), c2]
513
+ });
514
+ };
515
+ const s$1 = () => r$5, i = /* @__PURE__ */ styled_default(s$1())({
516
+ name: "Container",
517
+ class: "cll3md7",
518
+ propsAsIs: true
519
+ }), e$1 = () => S$1, p$1 = /* @__PURE__ */ styled_default(e$1())({
520
+ name: "ActionBtn",
521
+ class: "a10g1iik",
522
+ propsAsIs: true
523
+ });
524
+ const c$1 = ({ questionId: t2, ...r2 }) => /* @__PURE__ */ jsxs(i, { "data-a": "intr", "data-name": t2, children: [
525
+ /* @__PURE__ */ jsx(O, { questionId: t2, ...r2 }),
526
+ /* @__PURE__ */ jsx(p$1, { "data-a": "intr", "data-name": t2, children: "View Insight" })
527
+ ] });
528
+ const s = () => r$5, a$1 = /* @__PURE__ */ styled_default(s())({
529
+ name: "Container",
530
+ class: "cl56x6b",
531
+ propsAsIs: true
532
+ }), c = /* @__PURE__ */ styled_default("button")({
533
+ name: "ActionButton",
534
+ class: "a11pzf92",
535
+ propsAsIs: false
536
+ }), p = /* @__PURE__ */ styled_default("blockquote")({
537
+ name: "Quote",
538
+ class: "q1hbaleq",
539
+ propsAsIs: false
540
+ });
541
+ const l = ({ ...t2 }) => /* @__PURE__ */ jsxs(a$1, { "data-a": "intr", "data-name": t2.tweetId, children: [
542
+ t2.title && /* @__PURE__ */ jsx(p, { children: t2.title }),
543
+ /* @__PURE__ */ jsx(b$2, { ...t2 }),
544
+ /* @__PURE__ */ jsx(c, { "data-a": "intr", "data-name": t2.tweetId, children: "View Insight" })
545
+ ] });
546
+ const e = /* @__PURE__ */ styled_default("div")({
547
+ name: "QuestionsContainer",
548
+ class: "qvghv3l",
549
+ propsAsIs: false
550
+ });
551
+ const k = ({ questions: n2, openQuestion: b2, controlVideo: a2 }) => {
552
+ const l$12 = (t2) => {
553
+ const e2 = t2.target.getAttribute("data-name");
554
+ e2 && (wt(), b2(e2, { openedFrom: "list" }));
555
+ };
556
+ return n2 ? /* @__PURE__ */ jsx(e, { "data-a": "intr", onClick: l$12, children: n2 == null ? void 0 : n2.map((t2) => {
557
+ var e2, u2, s2;
558
+ if (t2.type === "question" && ((e2 = t2.attributes) == null ? void 0 : e2.attributes.case) === "question") {
559
+ const i2 = t2.attributes.attributes.value;
560
+ return /* @__PURE__ */ jsx(R$1, { ...i2 }, i2.questionId);
561
+ }
562
+ if (t2.type === "insight" && ((u2 = t2.attributes) == null ? void 0 : u2.attributes.case) === "insight") {
563
+ const i2 = t2.attributes.attributes.value;
564
+ return /* @__PURE__ */ jsx(c$1, { controlVideo: a2, ...i2 }, i2.questionId);
565
+ }
566
+ if (t2.type === "tweet" && ((s2 = t2.attributes) == null ? void 0 : s2.attributes.case) === "tweet") {
567
+ const i2 = t2.attributes.attributes.value, o2 = t2.attributes.id;
568
+ return /* @__PURE__ */ jsx(l, { controlVideo: a2, ...i2, tweetId: o2 }, o2);
569
+ }
570
+ return null;
571
+ }) }) : /* @__PURE__ */ jsx(e, { children: Array.from({ length: 5 }).map((t2, e2) => /* @__PURE__ */ jsx(D, {}, e2)) });
572
+ };
573
+ const a = ({ store: t2, openQuestion: r2 }) => {
574
+ const { sdk: o2 } = p$6(), e2 = useStore(t2);
575
+ return /* @__PURE__ */ jsx(k, { openQuestion: r2, questions: e2.data, controlVideo: o2 == null ? void 0 : o2.controlVideoPlayer });
576
+ };
577
+ const b = ({ userSummary: r2 }) => {
578
+ var e2;
579
+ const [t2, s2] = useState(void 0);
580
+ return useEffect(() => {
581
+ const c2 = r2.$store.subscribe((o2) => {
582
+ o2 && s2(o2);
583
+ });
584
+ return () => {
585
+ c2();
586
+ };
587
+ }, [r2]), /* @__PURE__ */ jsx(z$1, { loading: !(t2 != null && t2.summary), ...t2 == null ? void 0 : t2.summary, successRate: (e2 = t2 == null ? void 0 : t2.percentage) == null ? void 0 : e2.correct });
588
+ };
589
+ const W = ({ gamification: s2, className: w, scrollStore: t2, scrollNode: y, appNode: c2, style: k2, responsiveStore: i2 }) => {
590
+ const { tabsShown: u2 } = useStore(t2, { keys: ["tabsShown"] }), o2 = useStore(s2.friendsTabEnabled), [a$12, h2] = useState(m$2.HOME), [, T2] = useTransition(), { sdkInDesktopView: l2, screen: g2 } = useStore(i2, { keys: ["sdkInDesktopView"] }), x = (r2) => {
591
+ T2(() => {
592
+ var b2;
593
+ h2(r2), l2 === false && (((b2 = c2.current) == null ? void 0 : b2.getBoundingClientRect().y) || 0) < 0 && I$3(c2, g2.size, { behavior: "instant" });
594
+ });
595
+ };
596
+ useEffect(() => t2.subscribe((r2) => {
597
+ if (r2.scrollPosition === 0) {
598
+ t2.setKey("tabsShown", true);
599
+ return;
600
+ }
601
+ i2.get().sdkInDesktopView ? t2.setKey("tabsShown", r2.scrollDirection === "backward") : t2.setKey("tabsShown", r2.scrollDirection === "forward");
602
+ }), [t2, i2]), useEffect(() => {
603
+ o2 || h2(m$2.HOME);
604
+ }, [o2]);
605
+ let m2 = "0px";
606
+ return l2 ? m2 = u2 ? "0px" : "calc(0px - var(--header-height))" : m2 = u2 ? "var(--header-height)" : "0px", /* @__PURE__ */ jsxs(l$6, { className: cx_default(w, "SL-Tabs", "sl-hide-on-modal"), style: k2, children: [
607
+ o2 && /* @__PURE__ */ jsx(
608
+ S$2,
609
+ {
610
+ style: {
611
+ top: m2
612
+ },
613
+ children: /* @__PURE__ */ jsx(b$1, { activePage: a$12, toggleActivePage: x })
614
+ }
615
+ ),
616
+ a$12 === m$2.HOME && /* @__PURE__ */ jsxs(Fragment, { children: [
617
+ /* @__PURE__ */ jsx(m$6, { children: /* @__PURE__ */ jsx(d$3, { children: /* @__PURE__ */ jsx(b, { userSummary: s2.userSummary }) }) }),
618
+ /* @__PURE__ */ jsx(n$4, { style: { flex: 1 }, children: /* @__PURE__ */ jsx(a, { openQuestion: s2.openQuestion, store: s2.feedList.getStore() }) })
619
+ ] }),
620
+ a$12 === m$2.LEADERBOARD && /* @__PURE__ */ jsx(C$2, { children: /* @__PURE__ */ jsx(z, { scrollStore: t2, scrollNode: y, gamification: s2 }) })
621
+ ] });
622
+ };
623
+ const g = ({
624
+ gamification: e2,
625
+ scrollStore: t2,
626
+ className: n2,
627
+ appNode: r2,
628
+ scrollNode: p2,
629
+ responsiveStore: a2
630
+ }) => /* @__PURE__ */ jsx(W, {
631
+ appNode: r2,
632
+ scrollStore: t2,
633
+ scrollNode: p2,
634
+ className: n2,
635
+ gamification: e2,
636
+ responsiveStore: a2
637
+ });
2
638
  export {
3
- F as default
639
+ g as default
4
640
  };