@streamlayer/react 0.31.0 → 0.31.1
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.
|
@@ -2,18 +2,18 @@ import { jsxs as p, jsx as s, Fragment as b } from "react/jsx-runtime";
|
|
|
2
2
|
import { s as o, i as j } from "./index4.js";
|
|
3
3
|
import { useStore as k } from "@nanostores/react";
|
|
4
4
|
import { o as Ne, r as te, w as $e, A as Re, O as Qe, a as K, n as Ue, d as _e } from "./masters2.js";
|
|
5
|
-
import { useState as R, useCallback as F, useMemo as W, createElement as H, PureComponent as
|
|
5
|
+
import { useState as R, useCallback as F, useMemo as W, createElement as H, PureComponent as ye } from "react";
|
|
6
6
|
import { QuestionType as x, QuestionStatus as Q, QuestionImages as $, PickHistoryStatus as q } from "@streamlayer/sdk-web-types";
|
|
7
7
|
import { m as qe } from "./index3.js";
|
|
8
8
|
import "react-countup";
|
|
9
|
-
import { CountdownCircleTimer as
|
|
9
|
+
import { CountdownCircleTimer as Pe } from "react-countdown-circle-timer";
|
|
10
10
|
import { E } from "./index2.js";
|
|
11
11
|
import "@streamlayer/sdk-web-interfaces";
|
|
12
12
|
import "@streamlayer/sdk-web-notifications";
|
|
13
13
|
import "@lottiefiles/react-lottie-player";
|
|
14
14
|
import "./useStreamLayerApp.js";
|
|
15
15
|
import "@streamlayer/sdk-web";
|
|
16
|
-
const
|
|
16
|
+
const Ye = /* @__PURE__ */ o("div")({
|
|
17
17
|
name: "Container",
|
|
18
18
|
class: "c1vwopgc",
|
|
19
19
|
propsAsIs: !1
|
|
@@ -37,9 +37,9 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
37
37
|
name: "CloseIcon",
|
|
38
38
|
class: "cvsl7l3",
|
|
39
39
|
propsAsIs: !0
|
|
40
|
-
}),
|
|
40
|
+
}), Ae = ({ type: e, close: t, label: n }) => {
|
|
41
41
|
const i = e ? Ne[e] : { label: n, iconName: void 0 };
|
|
42
|
-
return /* @__PURE__ */ p(
|
|
42
|
+
return /* @__PURE__ */ p(Ye, { children: [
|
|
43
43
|
/* @__PURE__ */ p(We, { children: [
|
|
44
44
|
(i == null ? void 0 : i.iconName) && /* @__PURE__ */ s(Fe, { name: i.iconName }),
|
|
45
45
|
(i == null ? void 0 : i.label) && /* @__PURE__ */ s(Be, { children: i.label })
|
|
@@ -80,7 +80,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
80
80
|
name: "Title",
|
|
81
81
|
class: "t8s05oq",
|
|
82
82
|
propsAsIs: !1
|
|
83
|
-
}),
|
|
83
|
+
}), P = ({ indicator: e, title: t }) => /* @__PURE__ */ p(st, { children: [
|
|
84
84
|
/* @__PURE__ */ s(it, { children: e }),
|
|
85
85
|
/* @__PURE__ */ s(rt, { children: t })
|
|
86
86
|
] }), ot = /* @__PURE__ */ o("div")({
|
|
@@ -143,11 +143,11 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
143
143
|
name: "Statistics",
|
|
144
144
|
class: "s1knfgqt",
|
|
145
145
|
propsAsIs: !1
|
|
146
|
-
}),
|
|
146
|
+
}), yt = /* @__PURE__ */ o("div")({
|
|
147
147
|
name: "AvatarPlaceholder",
|
|
148
148
|
class: "a1mqo824",
|
|
149
149
|
propsAsIs: !1
|
|
150
|
-
}),
|
|
150
|
+
}), At = /* @__PURE__ */ o("button")({
|
|
151
151
|
name: "UserAccountBtn",
|
|
152
152
|
class: "uxareh6",
|
|
153
153
|
propsAsIs: !1
|
|
@@ -157,16 +157,16 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
157
157
|
points: n,
|
|
158
158
|
friendsRank: i,
|
|
159
159
|
rank: r,
|
|
160
|
-
streak:
|
|
160
|
+
streak: m,
|
|
161
161
|
correct: u,
|
|
162
|
-
incorrect:
|
|
162
|
+
incorrect: I,
|
|
163
163
|
inTop: d,
|
|
164
164
|
successRate: h
|
|
165
165
|
}) => /* @__PURE__ */ p(ot, { children: [
|
|
166
166
|
/* @__PURE__ */ s(at, { children: /* @__PURE__ */ p(ct, { children: [
|
|
167
|
-
/* @__PURE__ */ p(
|
|
167
|
+
/* @__PURE__ */ p(At, { children: [
|
|
168
168
|
e && /* @__PURE__ */ s(dt, { alt: "avatar", src: e }),
|
|
169
|
-
!e && /* @__PURE__ */ s(
|
|
169
|
+
!e && /* @__PURE__ */ s(yt, { children: Te(t || "") })
|
|
170
170
|
] }),
|
|
171
171
|
/* @__PURE__ */ p(ut, { children: [
|
|
172
172
|
/* @__PURE__ */ s(pt, { children: t }),
|
|
@@ -193,10 +193,10 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
193
193
|
/* @__PURE__ */ s(oe, { indicator: r || 0, title: "Global rank" })
|
|
194
194
|
] }),
|
|
195
195
|
/* @__PURE__ */ p(Nt, { children: [
|
|
196
|
-
/* @__PURE__ */ s(
|
|
197
|
-
/* @__PURE__ */ s(
|
|
198
|
-
/* @__PURE__ */ s(
|
|
199
|
-
/* @__PURE__ */ s(
|
|
196
|
+
/* @__PURE__ */ s(P, { indicator: m || 0, title: "Win streak" }),
|
|
197
|
+
/* @__PURE__ */ s(P, { indicator: u || 0, title: "Correct" }),
|
|
198
|
+
/* @__PURE__ */ s(P, { indicator: I || 0, title: "Incorrect" }),
|
|
199
|
+
/* @__PURE__ */ s(P, { indicator: `${h || 0}%`, title: "Succ. rate" })
|
|
200
200
|
] })
|
|
201
201
|
] })
|
|
202
202
|
] }), Dt = /* @__PURE__ */ o("div")({
|
|
@@ -249,21 +249,21 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
249
249
|
questionVoted: n,
|
|
250
250
|
questionType: i,
|
|
251
251
|
hasCorrectAnswer: r,
|
|
252
|
-
questionStatus:
|
|
252
|
+
questionStatus: m
|
|
253
253
|
}) => {
|
|
254
254
|
const u = n && (i === x.TRIVIA || i === x.PREDICTION);
|
|
255
|
-
if (!u &&
|
|
255
|
+
if (!u && m !== Q.RESOLVED)
|
|
256
256
|
return null;
|
|
257
|
-
const
|
|
258
|
-
return /* @__PURE__ */ p(jt, { "data-isPrediction":
|
|
259
|
-
|
|
257
|
+
const I = i === x.PREDICTION && !r, d = t ? "correct" : "incorrect", h = t ? e.correctFeedback : e.incorrectFeedback;
|
|
258
|
+
return /* @__PURE__ */ p(jt, { "data-isPrediction": I, children: [
|
|
259
|
+
m === Q.RESOLVED && i === x.TRIVIA && !n && /* @__PURE__ */ p(b, { children: [
|
|
260
260
|
/* @__PURE__ */ s(ae, { children: /* @__PURE__ */ s(j, { name: "questionExpired" }) }),
|
|
261
261
|
/* @__PURE__ */ p("div", { children: [
|
|
262
262
|
/* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(Z, { children: "Question Expired" }) }),
|
|
263
263
|
/* @__PURE__ */ s(wt, { children: "You can still answer to see if you're correct, but no points are awarded for expired questions." })
|
|
264
264
|
] })
|
|
265
265
|
] }),
|
|
266
|
-
u &&
|
|
266
|
+
u && I && /* @__PURE__ */ p(b, { children: [
|
|
267
267
|
/* @__PURE__ */ s(Ct, { name: "icon-prediction" }),
|
|
268
268
|
/* @__PURE__ */ s(Z, { children: "Stay tuned to see if your prediction was correct." })
|
|
269
269
|
] }),
|
|
@@ -307,7 +307,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
307
307
|
name: "IconContainer",
|
|
308
308
|
class: "i1j65z51",
|
|
309
309
|
propsAsIs: !1
|
|
310
|
-
}),
|
|
310
|
+
}), Pt = /* @__PURE__ */ o("div")({
|
|
311
311
|
name: "IconWrap",
|
|
312
312
|
class: "i19tpfua",
|
|
313
313
|
propsAsIs: !1
|
|
@@ -315,7 +315,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
315
315
|
name: "Icon",
|
|
316
316
|
class: "i1tubmma",
|
|
317
317
|
propsAsIs: !1
|
|
318
|
-
}),
|
|
318
|
+
}), Yt = () => ze, Wt = /* @__PURE__ */ o(Yt())({
|
|
319
319
|
name: "IconDefault",
|
|
320
320
|
class: "i1grrgwj",
|
|
321
321
|
propsAsIs: !0
|
|
@@ -341,7 +341,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
341
341
|
propsAsIs: !0
|
|
342
342
|
}), ce = {
|
|
343
343
|
[$.CENTERED]: (e) => /* @__PURE__ */ s(Wt, { alt: "option-icon", src: e }),
|
|
344
|
-
[$.TRANSPARENT]: (e) => /* @__PURE__ */ s(qt, { children: /* @__PURE__ */ s(
|
|
344
|
+
[$.TRANSPARENT]: (e) => /* @__PURE__ */ s(qt, { children: /* @__PURE__ */ s(Pt, { style: { backgroundImage: `url(${e})` } }) }),
|
|
345
345
|
[$.ROUNDED]: (e) => /* @__PURE__ */ s(Ft, { alt: "option-icon", src: e }),
|
|
346
346
|
[$.NONE]: () => null,
|
|
347
347
|
[$.UNSET]: () => null
|
|
@@ -368,36 +368,36 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
368
368
|
id: n,
|
|
369
369
|
icon: i,
|
|
370
370
|
text: r,
|
|
371
|
-
percentageDecimal:
|
|
371
|
+
percentageDecimal: m,
|
|
372
372
|
// extra props
|
|
373
373
|
onVote: u,
|
|
374
|
-
youSelected:
|
|
374
|
+
youSelected: I,
|
|
375
375
|
questionVoted: d,
|
|
376
376
|
// ToDo: Figure out why imageMode is not in the response, and delete default value
|
|
377
377
|
imageMode: h,
|
|
378
|
-
answerTimeExpired:
|
|
378
|
+
answerTimeExpired: y,
|
|
379
379
|
questionStatus: D,
|
|
380
380
|
isLoading: N,
|
|
381
|
-
questionType:
|
|
381
|
+
questionType: A,
|
|
382
382
|
correct: T,
|
|
383
383
|
hasCorrectAnswer: a
|
|
384
|
-
} = e, l = Kt(e), c = Xt({ questionType:
|
|
384
|
+
} = e, l = Kt(e), c = Xt({ questionType: A, questionVoted: d, correct: T, hasCorrectAnswer: a, questionStatus: D }), f = d || D === Q.RESOLVED && A === x.PREDICTION;
|
|
385
385
|
return /* @__PURE__ */ p(
|
|
386
386
|
Qt,
|
|
387
387
|
{
|
|
388
388
|
value: n,
|
|
389
|
-
"data-selected":
|
|
389
|
+
"data-selected": I,
|
|
390
390
|
"data-answerState": l,
|
|
391
|
-
disabled: d || N ||
|
|
391
|
+
disabled: d || N || y,
|
|
392
392
|
onClick: u,
|
|
393
393
|
children: [
|
|
394
|
-
f && /* @__PURE__ */ s(Ut, { "data-answerState": l, style: { width: `${
|
|
394
|
+
f && /* @__PURE__ */ s(Ut, { "data-answerState": l, style: { width: `${m}%` } }),
|
|
395
395
|
/* @__PURE__ */ p(_t, { children: [
|
|
396
396
|
i && h && ((t = ce[h]) == null ? void 0 : t.call(ce, i)),
|
|
397
397
|
/* @__PURE__ */ s(Bt, { children: r }),
|
|
398
398
|
f && /* @__PURE__ */ p(Ht, { children: [
|
|
399
399
|
c && /* @__PURE__ */ s(Jt, { name: "selected" }),
|
|
400
|
-
/* @__PURE__ */ s(Zt, { children: /* @__PURE__ */ s(qe, { value:
|
|
400
|
+
/* @__PURE__ */ s(Zt, { children: /* @__PURE__ */ s(qe, { value: m, suffix: "%" }) })
|
|
401
401
|
] })
|
|
402
402
|
] })
|
|
403
403
|
]
|
|
@@ -412,16 +412,16 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
412
412
|
duration: t = 30,
|
|
413
413
|
onTimerExpired: n
|
|
414
414
|
}) => {
|
|
415
|
-
const [i, r] = R(t > 10 ? rn : de),
|
|
415
|
+
const [i, r] = R(t > 10 ? rn : de), m = ({
|
|
416
416
|
remainingTime: d
|
|
417
417
|
}) => /* @__PURE__ */ s(sn, {
|
|
418
418
|
children: d
|
|
419
419
|
}), u = F(() => {
|
|
420
420
|
n == null || n(), r(on);
|
|
421
|
-
}, [n, r]),
|
|
421
|
+
}, [n, r]), I = F((d) => {
|
|
422
422
|
d === 10 && r(de);
|
|
423
423
|
}, [r]);
|
|
424
|
-
return /* @__PURE__ */ s(
|
|
424
|
+
return /* @__PURE__ */ s(Pe, {
|
|
425
425
|
isPlaying: e,
|
|
426
426
|
duration: t,
|
|
427
427
|
colors: tn,
|
|
@@ -431,8 +431,8 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
431
431
|
trailStrokeWidth: 2,
|
|
432
432
|
trailColor: i,
|
|
433
433
|
onComplete: u,
|
|
434
|
-
onUpdate:
|
|
435
|
-
children:
|
|
434
|
+
onUpdate: I,
|
|
435
|
+
children: m
|
|
436
436
|
});
|
|
437
437
|
}, ln = /* @__PURE__ */ o("div")({
|
|
438
438
|
name: "WinBarContainer",
|
|
@@ -462,7 +462,14 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
462
462
|
name: "PointsUnits",
|
|
463
463
|
class: "pe5g05h",
|
|
464
464
|
propsAsIs: !1
|
|
465
|
-
}), fn = ({
|
|
465
|
+
}), fn = ({
|
|
466
|
+
title: e,
|
|
467
|
+
points: t,
|
|
468
|
+
isPlayingTimer: n,
|
|
469
|
+
isTimer: i,
|
|
470
|
+
timerDuration: r,
|
|
471
|
+
onTimerExpired: m
|
|
472
|
+
}) => /* @__PURE__ */ p(ln, { children: [
|
|
466
473
|
/* @__PURE__ */ p(cn, { children: [
|
|
467
474
|
e && /* @__PURE__ */ s(dn, { children: e }),
|
|
468
475
|
t !== void 0 && /* @__PURE__ */ p(b, { children: [
|
|
@@ -473,17 +480,17 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
473
480
|
] })
|
|
474
481
|
] })
|
|
475
482
|
] }),
|
|
476
|
-
i && /* @__PURE__ */ s(an, { isPlaying: n, onTimerExpired: r })
|
|
483
|
+
i && /* @__PURE__ */ s(an, { isPlaying: n, onTimerExpired: m, duration: r })
|
|
477
484
|
] }), gn = ({ openedQuestion: e, vote: t, close: n }) => {
|
|
478
485
|
var i;
|
|
479
|
-
const r = e.subject,
|
|
486
|
+
const r = e.subject, m = e.type, u = (i = e.options) == null ? void 0 : i.options, [I, d] = R(!1), [h, y] = R(!1), [D, N] = R(""), A = e == null ? void 0 : e.id, T = F(
|
|
480
487
|
async (v) => {
|
|
481
|
-
if (
|
|
488
|
+
if (A) {
|
|
482
489
|
const g = v.currentTarget.value;
|
|
483
|
-
N(g),
|
|
490
|
+
N(g), y(!0), await t(A, g), y(!1);
|
|
484
491
|
}
|
|
485
492
|
},
|
|
486
|
-
[
|
|
493
|
+
[A, N, t]
|
|
487
494
|
), a = F(() => {
|
|
488
495
|
d(!0), setTimeout(n, 3e3);
|
|
489
496
|
}, [n]), l = W(
|
|
@@ -501,13 +508,13 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
501
508
|
isLoading: h,
|
|
502
509
|
hasCorrectAnswer: c,
|
|
503
510
|
questionType: e.type,
|
|
504
|
-
answerTimeExpired:
|
|
511
|
+
answerTimeExpired: I,
|
|
505
512
|
questionStatus: e.status,
|
|
506
513
|
imageMode: (g = e.appearance) == null ? void 0 : g.images,
|
|
507
514
|
// ToDo: Figure out why imageMode is not in the response
|
|
508
515
|
onVote: T
|
|
509
516
|
};
|
|
510
|
-
}) : [], [c,
|
|
517
|
+
}) : [], [c, I, h, e, l, T, D]), M = u && (u.case === "trivia" || u.case === "prediction") ? u.value : void 0;
|
|
511
518
|
return /* @__PURE__ */ s(te, { "data-question-header": "true", children: /* @__PURE__ */ s(Et, { children: /* @__PURE__ */ p(Lt, { children: [
|
|
512
519
|
M && /* @__PURE__ */ s(
|
|
513
520
|
bt,
|
|
@@ -515,7 +522,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
515
522
|
feedbackMessages: M,
|
|
516
523
|
questionVoted: !!l,
|
|
517
524
|
questionVotedCorrectly: l == null ? void 0 : l.correct,
|
|
518
|
-
questionType:
|
|
525
|
+
questionType: m,
|
|
519
526
|
hasCorrectAnswer: c,
|
|
520
527
|
questionStatus: e.status
|
|
521
528
|
}
|
|
@@ -523,13 +530,15 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
523
530
|
e.type !== x.PREDICTION && /* @__PURE__ */ s(
|
|
524
531
|
fn,
|
|
525
532
|
{
|
|
526
|
-
title:
|
|
527
|
-
points:
|
|
533
|
+
title: I ? "Time expired" : "To win",
|
|
534
|
+
points: I ? void 0 : 100,
|
|
528
535
|
onTimerExpired: a,
|
|
529
|
-
isTimer: !0
|
|
536
|
+
isTimer: !0,
|
|
537
|
+
isPlayingTimer: !l,
|
|
538
|
+
timerDuration: l ? 0 : 30
|
|
530
539
|
}
|
|
531
540
|
),
|
|
532
|
-
|
|
541
|
+
I ? /* @__PURE__ */ s(
|
|
533
542
|
xt,
|
|
534
543
|
{
|
|
535
544
|
title: "More to come...",
|
|
@@ -552,11 +561,11 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
552
561
|
name: "Title",
|
|
553
562
|
class: "t5et2jt",
|
|
554
563
|
propsAsIs: !1
|
|
555
|
-
}),
|
|
564
|
+
}), yn = /* @__PURE__ */ o("div")({
|
|
556
565
|
name: "Description",
|
|
557
566
|
class: "d1i2kpk2",
|
|
558
567
|
propsAsIs: !1
|
|
559
|
-
}),
|
|
568
|
+
}), An = /* @__PURE__ */ o("div")({
|
|
560
569
|
name: "DateWrap",
|
|
561
570
|
class: "dd3lh3p",
|
|
562
571
|
propsAsIs: !1
|
|
@@ -575,18 +584,18 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
575
584
|
};
|
|
576
585
|
}
|
|
577
586
|
return null;
|
|
578
|
-
}, [e]),
|
|
587
|
+
}, [e]), m = (i == null ? void 0 : i.image) || t;
|
|
579
588
|
return /* @__PURE__ */ p(Mn, { children: [
|
|
580
|
-
r && /* @__PURE__ */ p(
|
|
589
|
+
r && /* @__PURE__ */ p(An, { children: [
|
|
581
590
|
r.date,
|
|
582
591
|
" · ",
|
|
583
592
|
r.time
|
|
584
593
|
] }),
|
|
585
594
|
(i == null ? void 0 : i.video) && /* @__PURE__ */ s($e, { source: i.video.url, poster: i.video.thumbnailUrl }),
|
|
586
|
-
|
|
595
|
+
m && /* @__PURE__ */ s(Tn, { src: m }),
|
|
587
596
|
/* @__PURE__ */ p(vn, { children: [
|
|
588
597
|
/* @__PURE__ */ s(Nn, { children: (i == null ? void 0 : i.heading) || n }),
|
|
589
|
-
/* @__PURE__ */ s(
|
|
598
|
+
/* @__PURE__ */ s(yn, { children: i == null ? void 0 : i.body })
|
|
590
599
|
] })
|
|
591
600
|
] });
|
|
592
601
|
}, Dn = /* @__PURE__ */ o("div")({
|
|
@@ -638,7 +647,7 @@ const Pe = /* @__PURE__ */ o("div")({
|
|
|
638
647
|
return null;
|
|
639
648
|
const r = n.type;
|
|
640
649
|
return /* @__PURE__ */ p(xn, {
|
|
641
|
-
children: [/* @__PURE__ */ s(
|
|
650
|
+
children: [/* @__PURE__ */ s(Ae, {
|
|
642
651
|
close: e.closeQuestion,
|
|
643
652
|
type: ((t = n.attributes) == null ? void 0 : t.type) || x.UNSET
|
|
644
653
|
}), r === "question" && /* @__PURE__ */ s(On, {
|
|
@@ -723,11 +732,11 @@ function Qn(e, t) {
|
|
|
723
732
|
}
|
|
724
733
|
function G(e, t) {
|
|
725
734
|
t === void 0 && (t = Qn);
|
|
726
|
-
var n, i = [], r,
|
|
735
|
+
var n, i = [], r, m = !1;
|
|
727
736
|
function u() {
|
|
728
|
-
for (var
|
|
729
|
-
|
|
730
|
-
return
|
|
737
|
+
for (var I = [], d = 0; d < arguments.length; d++)
|
|
738
|
+
I[d] = arguments[d];
|
|
739
|
+
return m && n === this && t(I, i) || (r = e.apply(this, I), m = !0, n = this, i = I), r;
|
|
731
740
|
}
|
|
732
741
|
return u;
|
|
733
742
|
}
|
|
@@ -767,11 +776,11 @@ function ge(e) {
|
|
|
767
776
|
}
|
|
768
777
|
return w;
|
|
769
778
|
}
|
|
770
|
-
var qn = 150,
|
|
779
|
+
var qn = 150, Pn = function(t, n) {
|
|
771
780
|
return t;
|
|
772
781
|
};
|
|
773
|
-
function
|
|
774
|
-
var t, n = e.getItemOffset, i = e.getEstimatedTotalSize, r = e.getItemSize,
|
|
782
|
+
function Yn(e) {
|
|
783
|
+
var t, n = e.getItemOffset, i = e.getEstimatedTotalSize, r = e.getItemSize, m = e.getOffsetForIndexAndAlignment, u = e.getStartIndexForOffset, I = e.getStopIndexForStartIndex, d = e.initInstanceProps, h = e.shouldResetStyleCacheOnItemSizeChange, y = e.validateProps;
|
|
775
784
|
return t = /* @__PURE__ */ function(D) {
|
|
776
785
|
$n(N, D);
|
|
777
786
|
function N(T) {
|
|
@@ -862,10 +871,10 @@ function Pn(e) {
|
|
|
862
871
|
}, a;
|
|
863
872
|
}
|
|
864
873
|
N.getDerivedStateFromProps = function(a, l) {
|
|
865
|
-
return Wn(a, l),
|
|
874
|
+
return Wn(a, l), y(a), null;
|
|
866
875
|
};
|
|
867
|
-
var
|
|
868
|
-
return
|
|
876
|
+
var A = N.prototype;
|
|
877
|
+
return A.scrollTo = function(a) {
|
|
869
878
|
a = Math.max(0, a), this.setState(function(l) {
|
|
870
879
|
return l.scrollOffset === a ? null : {
|
|
871
880
|
scrollDirection: l.scrollOffset < a ? "forward" : "backward",
|
|
@@ -873,7 +882,7 @@ function Pn(e) {
|
|
|
873
882
|
scrollUpdateWasRequested: !0
|
|
874
883
|
};
|
|
875
884
|
}, this._resetIsScrollingDebounced);
|
|
876
|
-
},
|
|
885
|
+
}, A.scrollToItem = function(a, l) {
|
|
877
886
|
l === void 0 && (l = "auto");
|
|
878
887
|
var c = this.props, f = c.itemCount, M = c.layout, v = this.state.scrollOffset;
|
|
879
888
|
a = Math.max(0, Math.min(a, f - 1));
|
|
@@ -882,15 +891,15 @@ function Pn(e) {
|
|
|
882
891
|
var S = this._outerRef;
|
|
883
892
|
M === "vertical" ? g = S.scrollWidth > S.clientWidth ? fe() : 0 : g = S.scrollHeight > S.clientHeight ? fe() : 0;
|
|
884
893
|
}
|
|
885
|
-
this.scrollTo(
|
|
886
|
-
},
|
|
894
|
+
this.scrollTo(m(this.props, a, l, v, this._instanceProps, g));
|
|
895
|
+
}, A.componentDidMount = function() {
|
|
887
896
|
var a = this.props, l = a.direction, c = a.initialScrollOffset, f = a.layout;
|
|
888
897
|
if (typeof c == "number" && this._outerRef != null) {
|
|
889
898
|
var M = this._outerRef;
|
|
890
899
|
l === "horizontal" || f === "horizontal" ? M.scrollLeft = c : M.scrollTop = c;
|
|
891
900
|
}
|
|
892
901
|
this._callPropsCallbacks();
|
|
893
|
-
},
|
|
902
|
+
}, A.componentDidUpdate = function() {
|
|
894
903
|
var a = this.props, l = a.direction, c = a.layout, f = this.state, M = f.scrollOffset, v = f.scrollUpdateWasRequested;
|
|
895
904
|
if (v && this._outerRef != null) {
|
|
896
905
|
var g = this._outerRef;
|
|
@@ -914,10 +923,10 @@ function Pn(e) {
|
|
|
914
923
|
g.scrollTop = M;
|
|
915
924
|
}
|
|
916
925
|
this._callPropsCallbacks();
|
|
917
|
-
},
|
|
926
|
+
}, A.componentWillUnmount = function() {
|
|
918
927
|
this._resetIsScrollingTimeoutId !== null && he(this._resetIsScrollingTimeoutId);
|
|
919
|
-
},
|
|
920
|
-
var a = this.props, l = a.children, c = a.className, f = a.direction, M = a.height, v = a.innerRef, g = a.innerElementType, S = a.innerTagName, z = a.itemCount, O = a.itemData, C = a.itemKey, U = C === void 0 ?
|
|
928
|
+
}, A.render = function() {
|
|
929
|
+
var a = this.props, l = a.children, c = a.className, f = a.direction, M = a.height, v = a.innerRef, g = a.innerElementType, S = a.innerTagName, z = a.itemCount, O = a.itemData, C = a.itemKey, U = C === void 0 ? Pn : C, _ = a.layout, je = a.outerElementType, Oe = a.outerTagName, Ce = a.style, ke = a.useIsScrolling, we = a.width, ne = this.state.isScrolling, B = f === "horizontal" || _ === "horizontal", be = B ? this._onScrollHorizontal : this._onScrollVertical, se = this._getRangeToRender(), Ee = se[0], Le = se[1], ie = [];
|
|
921
930
|
if (z > 0)
|
|
922
931
|
for (var L = Ee; L <= Le; L++)
|
|
923
932
|
ie.push(H(l, {
|
|
@@ -950,7 +959,7 @@ function Pn(e) {
|
|
|
950
959
|
width: B ? re : "100%"
|
|
951
960
|
}
|
|
952
961
|
}));
|
|
953
|
-
},
|
|
962
|
+
}, A._callPropsCallbacks = function() {
|
|
954
963
|
if (typeof this.props.onItemsRendered == "function") {
|
|
955
964
|
var a = this.props.itemCount;
|
|
956
965
|
if (a > 0) {
|
|
@@ -962,14 +971,14 @@ function Pn(e) {
|
|
|
962
971
|
var g = this.state, S = g.scrollDirection, z = g.scrollOffset, O = g.scrollUpdateWasRequested;
|
|
963
972
|
this._callOnScroll(S, z, O);
|
|
964
973
|
}
|
|
965
|
-
},
|
|
974
|
+
}, A._getRangeToRender = function() {
|
|
966
975
|
var a = this.props, l = a.itemCount, c = a.overscanCount, f = this.state, M = f.isScrolling, v = f.scrollDirection, g = f.scrollOffset;
|
|
967
976
|
if (l === 0)
|
|
968
977
|
return [0, 0, 0, 0];
|
|
969
|
-
var S = u(this.props, g, this._instanceProps), z =
|
|
978
|
+
var S = u(this.props, g, this._instanceProps), z = I(this.props, S, g, this._instanceProps), O = !M || v === "backward" ? Math.max(1, c) : 1, C = !M || v === "forward" ? Math.max(1, c) : 1;
|
|
970
979
|
return [Math.max(0, S - O), Math.max(0, Math.min(l - 1, z + C)), S, z];
|
|
971
980
|
}, N;
|
|
972
|
-
}(
|
|
981
|
+
}(ye), t.defaultProps = {
|
|
973
982
|
direction: "ltr",
|
|
974
983
|
itemData: void 0,
|
|
975
984
|
layout: "vertical",
|
|
@@ -979,7 +988,7 @@ function Pn(e) {
|
|
|
979
988
|
}
|
|
980
989
|
var Wn = function(t, n) {
|
|
981
990
|
t.children, t.direction, t.height, t.layout, t.innerTagName, t.outerTagName, t.width, n.instance;
|
|
982
|
-
}, Vn = /* @__PURE__ */
|
|
991
|
+
}, Vn = /* @__PURE__ */ Yn({
|
|
983
992
|
getItemOffset: function(t, n) {
|
|
984
993
|
var i = t.itemSize;
|
|
985
994
|
return n * i;
|
|
@@ -992,8 +1001,8 @@ var Wn = function(t, n) {
|
|
|
992
1001
|
var n = t.itemCount, i = t.itemSize;
|
|
993
1002
|
return i * n;
|
|
994
1003
|
},
|
|
995
|
-
getOffsetForIndexAndAlignment: function(t, n, i, r,
|
|
996
|
-
var
|
|
1004
|
+
getOffsetForIndexAndAlignment: function(t, n, i, r, m, u) {
|
|
1005
|
+
var I = t.direction, d = t.height, h = t.itemCount, y = t.itemSize, D = t.layout, N = t.width, A = I === "horizontal" || D === "horizontal", T = A ? N : d, a = Math.max(0, h * y - T), l = Math.min(a, n * y), c = Math.max(0, n * y - T + y + u);
|
|
997
1006
|
switch (i === "smart" && (r >= c - T && r <= l + T ? i = "auto" : i = "center"), i) {
|
|
998
1007
|
case "start":
|
|
999
1008
|
return l;
|
|
@@ -1013,10 +1022,10 @@ var Wn = function(t, n) {
|
|
|
1013
1022
|
return Math.max(0, Math.min(i - 1, Math.floor(n / r)));
|
|
1014
1023
|
},
|
|
1015
1024
|
getStopIndexForStartIndex: function(t, n, i) {
|
|
1016
|
-
var r = t.direction,
|
|
1025
|
+
var r = t.direction, m = t.height, u = t.itemCount, I = t.itemSize, d = t.layout, h = t.width, y = r === "horizontal" || d === "horizontal", D = n * I, N = y ? h : m, A = Math.ceil((N + i - D) / I);
|
|
1017
1026
|
return Math.max(0, Math.min(
|
|
1018
1027
|
u - 1,
|
|
1019
|
-
n +
|
|
1028
|
+
n + A - 1
|
|
1020
1029
|
// -1 is because stop index is inclusive
|
|
1021
1030
|
));
|
|
1022
1031
|
},
|
|
@@ -1032,20 +1041,20 @@ function Fn(e) {
|
|
|
1032
1041
|
return !(i > n || r < t);
|
|
1033
1042
|
}
|
|
1034
1043
|
function Bn(e) {
|
|
1035
|
-
for (var t = e.isItemLoaded, n = e.itemCount, i = e.minimumBatchSize, r = e.startIndex,
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1044
|
+
for (var t = e.isItemLoaded, n = e.itemCount, i = e.minimumBatchSize, r = e.startIndex, m = e.stopIndex, u = [], I = null, d = null, h = r; h <= m; h++) {
|
|
1045
|
+
var y = t(h);
|
|
1046
|
+
y ? d !== null && (u.push(I, d), I = d = null) : (d = h, I === null && (I = h));
|
|
1038
1047
|
}
|
|
1039
1048
|
if (d !== null) {
|
|
1040
|
-
for (var D = Math.min(Math.max(d,
|
|
1049
|
+
for (var D = Math.min(Math.max(d, I + i - 1), n - 1), N = d + 1; N <= D && !t(N); N++)
|
|
1041
1050
|
d = N;
|
|
1042
|
-
u.push(
|
|
1051
|
+
u.push(I, d);
|
|
1043
1052
|
}
|
|
1044
1053
|
if (u.length)
|
|
1045
1054
|
for (; u[1] - u[0] + 1 < i && u[0] > 0; ) {
|
|
1046
|
-
var
|
|
1047
|
-
if (!t(
|
|
1048
|
-
u[0] =
|
|
1055
|
+
var A = u[0] - 1;
|
|
1056
|
+
if (!t(A))
|
|
1057
|
+
u[0] = A;
|
|
1049
1058
|
else
|
|
1050
1059
|
break;
|
|
1051
1060
|
}
|
|
@@ -1082,16 +1091,16 @@ var Hn = function(e, t) {
|
|
|
1082
1091
|
}, Jn = function(e) {
|
|
1083
1092
|
Gn(t, e);
|
|
1084
1093
|
function t() {
|
|
1085
|
-
var n, i, r,
|
|
1094
|
+
var n, i, r, m;
|
|
1086
1095
|
Hn(this, t);
|
|
1087
|
-
for (var u = arguments.length,
|
|
1088
|
-
|
|
1089
|
-
return
|
|
1090
|
-
var
|
|
1091
|
-
r._lastRenderedStartIndex =
|
|
1096
|
+
for (var u = arguments.length, I = Array(u), d = 0; d < u; d++)
|
|
1097
|
+
I[d] = arguments[d];
|
|
1098
|
+
return m = (i = (r = Me(this, (n = t.__proto__ || Object.getPrototypeOf(t)).call.apply(n, [this].concat(I))), r), r._lastRenderedStartIndex = -1, r._lastRenderedStopIndex = -1, r._memoizedUnloadedRanges = [], r._onItemsRendered = function(h) {
|
|
1099
|
+
var y = h.visibleStartIndex, D = h.visibleStopIndex;
|
|
1100
|
+
r._lastRenderedStartIndex = y, r._lastRenderedStopIndex = D, r._ensureRowsLoaded(y, D);
|
|
1092
1101
|
}, r._setRef = function(h) {
|
|
1093
1102
|
r._listRef = h;
|
|
1094
|
-
}, i), Me(r,
|
|
1103
|
+
}, i), Me(r, m);
|
|
1095
1104
|
}
|
|
1096
1105
|
return Zn(t, [{
|
|
1097
1106
|
key: "resetloadMoreItemsCache",
|
|
@@ -1115,39 +1124,39 @@ var Hn = function(e, t) {
|
|
|
1115
1124
|
}, {
|
|
1116
1125
|
key: "_ensureRowsLoaded",
|
|
1117
1126
|
value: function(i, r) {
|
|
1118
|
-
var
|
|
1127
|
+
var m = this.props, u = m.isItemLoaded, I = m.itemCount, d = m.minimumBatchSize, h = d === void 0 ? 10 : d, y = m.threshold, D = y === void 0 ? 15 : y, N = Bn({
|
|
1119
1128
|
isItemLoaded: u,
|
|
1120
|
-
itemCount:
|
|
1129
|
+
itemCount: I,
|
|
1121
1130
|
minimumBatchSize: h,
|
|
1122
1131
|
startIndex: Math.max(0, i - D),
|
|
1123
|
-
stopIndex: Math.min(
|
|
1132
|
+
stopIndex: Math.min(I - 1, r + D)
|
|
1124
1133
|
});
|
|
1125
|
-
(this._memoizedUnloadedRanges.length !== N.length || this._memoizedUnloadedRanges.some(function(
|
|
1126
|
-
return N[T] !==
|
|
1134
|
+
(this._memoizedUnloadedRanges.length !== N.length || this._memoizedUnloadedRanges.some(function(A, T) {
|
|
1135
|
+
return N[T] !== A;
|
|
1127
1136
|
})) && (this._memoizedUnloadedRanges = N, this._loadUnloadedRanges(N));
|
|
1128
1137
|
}
|
|
1129
1138
|
}, {
|
|
1130
1139
|
key: "_loadUnloadedRanges",
|
|
1131
1140
|
value: function(i) {
|
|
1132
|
-
for (var r = this,
|
|
1133
|
-
var
|
|
1141
|
+
for (var r = this, m = this.props.loadMoreItems || this.props.loadMoreRows, u = function(h) {
|
|
1142
|
+
var y = i[h], D = i[h + 1], N = m(y, D);
|
|
1134
1143
|
N != null && N.then(function() {
|
|
1135
1144
|
if (Fn({
|
|
1136
1145
|
lastRenderedStartIndex: r._lastRenderedStartIndex,
|
|
1137
1146
|
lastRenderedStopIndex: r._lastRenderedStopIndex,
|
|
1138
|
-
startIndex:
|
|
1147
|
+
startIndex: y,
|
|
1139
1148
|
stopIndex: D
|
|
1140
1149
|
})) {
|
|
1141
1150
|
if (r._listRef == null)
|
|
1142
1151
|
return;
|
|
1143
|
-
typeof r._listRef.resetAfterIndex == "function" ? r._listRef.resetAfterIndex(
|
|
1152
|
+
typeof r._listRef.resetAfterIndex == "function" ? r._listRef.resetAfterIndex(y, !0) : (typeof r._listRef._getItemStyleCache == "function" && r._listRef._getItemStyleCache(-1), r._listRef.forceUpdate());
|
|
1144
1153
|
}
|
|
1145
1154
|
});
|
|
1146
|
-
},
|
|
1147
|
-
u(
|
|
1155
|
+
}, I = 0; I < i.length; I += 2)
|
|
1156
|
+
u(I);
|
|
1148
1157
|
}
|
|
1149
1158
|
}]), t;
|
|
1150
|
-
}(
|
|
1159
|
+
}(ye);
|
|
1151
1160
|
const Kn = /* @__PURE__ */ o("div")({
|
|
1152
1161
|
name: "Container",
|
|
1153
1162
|
class: "culdu4a",
|
|
@@ -1186,9 +1195,9 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1186
1195
|
name: n,
|
|
1187
1196
|
points: i,
|
|
1188
1197
|
isCurrentUser: r,
|
|
1189
|
-
openItemDetail:
|
|
1198
|
+
openItemDetail: m,
|
|
1190
1199
|
style: u
|
|
1191
|
-
}) => /* @__PURE__ */ p(Kn, { onClick:
|
|
1200
|
+
}) => /* @__PURE__ */ p(Kn, { onClick: m, style: u, children: [
|
|
1192
1201
|
/* @__PURE__ */ s(Xn, { children: e || 0 }),
|
|
1193
1202
|
/* @__PURE__ */ p(ns, { children: [
|
|
1194
1203
|
t ? /* @__PURE__ */ s(es, { alt: "leaderboard-item-avatar", src: t }) : /* @__PURE__ */ s(ts, { children: Te(n || "") }),
|
|
@@ -1207,21 +1216,21 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1207
1216
|
currentUserId: t,
|
|
1208
1217
|
openItemDetail: n,
|
|
1209
1218
|
fetchMore: i
|
|
1210
|
-
}) => /* @__PURE__ */ s(Re, { children: ({ width: r, height:
|
|
1219
|
+
}) => /* @__PURE__ */ s(Re, { children: ({ width: r, height: m }) => /* @__PURE__ */ s(
|
|
1211
1220
|
Jn,
|
|
1212
1221
|
{
|
|
1213
1222
|
isItemLoaded: (u) => u < e.length,
|
|
1214
1223
|
itemCount: e.length + 1,
|
|
1215
1224
|
loadMoreItems: i,
|
|
1216
|
-
children: ({ onItemsRendered: u, ref:
|
|
1225
|
+
children: ({ onItemsRendered: u, ref: I }) => /* @__PURE__ */ s(ls, { children: /* @__PURE__ */ s(
|
|
1217
1226
|
Vn,
|
|
1218
1227
|
{
|
|
1219
1228
|
itemSize: 56,
|
|
1220
1229
|
onItemsRendered: u,
|
|
1221
|
-
ref:
|
|
1230
|
+
ref: I,
|
|
1222
1231
|
itemCount: e.length,
|
|
1223
1232
|
width: r,
|
|
1224
|
-
height:
|
|
1233
|
+
height: m,
|
|
1225
1234
|
children: ({ index: d, style: h }) => /* @__PURE__ */ s(
|
|
1226
1235
|
as,
|
|
1227
1236
|
{
|
|
@@ -1284,7 +1293,7 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1284
1293
|
name: "QuestionAction",
|
|
1285
1294
|
class: "q105uluy",
|
|
1286
1295
|
propsAsIs: !1
|
|
1287
|
-
}), fs = () => j,
|
|
1296
|
+
}), fs = () => j, Y = /* @__PURE__ */ o(fs())({
|
|
1288
1297
|
name: "QuestionActionIcon",
|
|
1289
1298
|
class: "q1fa0b9h",
|
|
1290
1299
|
propsAsIs: !0
|
|
@@ -1300,37 +1309,37 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1300
1309
|
name: "QuestionContent",
|
|
1301
1310
|
class: "q1uz5j1g",
|
|
1302
1311
|
propsAsIs: !1
|
|
1303
|
-
}),
|
|
1312
|
+
}), ys = /* @__PURE__ */ o("button")({
|
|
1304
1313
|
name: "PlayButton",
|
|
1305
1314
|
class: "p1pba9p1",
|
|
1306
1315
|
propsAsIs: !1
|
|
1307
|
-
}),
|
|
1308
|
-
[q.LOST]: /* @__PURE__ */ s(
|
|
1309
|
-
[q.WON]: /* @__PURE__ */ s(
|
|
1310
|
-
[q.UNSET]: /* @__PURE__ */ s(
|
|
1311
|
-
[q.DNP]: /* @__PURE__ */ s(
|
|
1316
|
+
}), As = {
|
|
1317
|
+
[q.LOST]: /* @__PURE__ */ s(Y, { name: "icon-cross" }),
|
|
1318
|
+
[q.WON]: /* @__PURE__ */ s(Y, { name: "icon-check" }),
|
|
1319
|
+
[q.UNSET]: /* @__PURE__ */ s(Y, { name: "icon-arrow" }),
|
|
1320
|
+
[q.DNP]: /* @__PURE__ */ s(Y, { name: "icon-arrow" })
|
|
1312
1321
|
}, Ts = ({
|
|
1313
1322
|
questionId: e,
|
|
1314
1323
|
questionType: t,
|
|
1315
1324
|
questionStatus: n,
|
|
1316
1325
|
subject: i,
|
|
1317
1326
|
openForVoting: r,
|
|
1318
|
-
openQuestion:
|
|
1327
|
+
openQuestion: m,
|
|
1319
1328
|
status: u
|
|
1320
1329
|
}) => {
|
|
1321
|
-
const
|
|
1322
|
-
return
|
|
1330
|
+
const I = Ne[t], d = As[u];
|
|
1331
|
+
return I ? /* @__PURE__ */ p(ps, { onClick: () => m == null ? void 0 : m(e), children: [
|
|
1323
1332
|
/* @__PURE__ */ p(Ns, { children: [
|
|
1324
1333
|
/* @__PURE__ */ p(ms, { children: [
|
|
1325
|
-
/* @__PURE__ */ s(Ms, { name:
|
|
1334
|
+
/* @__PURE__ */ s(Ms, { name: I.iconName }),
|
|
1326
1335
|
/* @__PURE__ */ p(vs, { children: [
|
|
1327
|
-
|
|
1336
|
+
I.label,
|
|
1328
1337
|
t === x.TRIVIA && n === Q.RESOLVED && " • Expired"
|
|
1329
1338
|
] })
|
|
1330
1339
|
] }),
|
|
1331
1340
|
/* @__PURE__ */ s(Is, { children: i || "" })
|
|
1332
1341
|
] }),
|
|
1333
|
-
/* @__PURE__ */ s(hs, { children: r ? /* @__PURE__ */ s(
|
|
1342
|
+
/* @__PURE__ */ s(hs, { children: r ? /* @__PURE__ */ s(ys, { children: "Play" }) : d })
|
|
1334
1343
|
] }) : null;
|
|
1335
1344
|
}, Ds = /* @__PURE__ */ o("div")({
|
|
1336
1345
|
name: "Container",
|
|
@@ -1354,12 +1363,12 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1354
1363
|
}), js = ({ questions: e, openQuestion: t }) => /* @__PURE__ */ s(xs, { children: e == null ? void 0 : e.map((n) => {
|
|
1355
1364
|
var i, r;
|
|
1356
1365
|
if (n.type === "question" && ((i = n.attributes) == null ? void 0 : i.attributes.case) === "question") {
|
|
1357
|
-
const
|
|
1358
|
-
return /* @__PURE__ */ s(Ts, { openQuestion: t, ...
|
|
1366
|
+
const m = n.attributes.attributes.value;
|
|
1367
|
+
return /* @__PURE__ */ s(Ts, { openQuestion: t, ...m }, m.questionId);
|
|
1359
1368
|
}
|
|
1360
1369
|
if (n.type === "insight" && ((r = n.attributes) == null ? void 0 : r.attributes.case) === "insight") {
|
|
1361
|
-
const
|
|
1362
|
-
return /* @__PURE__ */ s(zs, { openInsight: t, ...
|
|
1370
|
+
const m = n.attributes.attributes.value;
|
|
1371
|
+
return /* @__PURE__ */ s(zs, { openInsight: t, ...m }, m.questionId);
|
|
1363
1372
|
}
|
|
1364
1373
|
return null;
|
|
1365
1374
|
}) }), Os = ({ store: e, openQuestion: t }) => {
|
|
@@ -1437,7 +1446,7 @@ const Kn = /* @__PURE__ */ o("div")({
|
|
|
1437
1446
|
}), i && /* @__PURE__ */ s(ve, {
|
|
1438
1447
|
className: t,
|
|
1439
1448
|
children: /* @__PURE__ */ p(bs, {
|
|
1440
|
-
children: [/* @__PURE__ */ s(
|
|
1449
|
+
children: [/* @__PURE__ */ s(Ae, {
|
|
1441
1450
|
label: "Friend's Rank",
|
|
1442
1451
|
close: e.closeUser
|
|
1443
1452
|
}), /* @__PURE__ */ s(K, {
|