fansunited-frontend-components 0.0.92 → 0.0.94
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.
- package/Betslip.js +1 -1
- package/ChanceGame.js +139 -146
- package/ClassicQuizPlay.js +1 -1
- package/CollectLead.js +14 -20
- package/CompetitionStatistics.js +27 -27
- package/CompetitorCard.js +895 -891
- package/Discussion.js +1 -1
- package/EitherOrPlay.js +1 -1
- package/EventCard.js +1494 -1571
- package/EventGamePlay.js +1 -1
- package/Leaderboard.js +249 -257
- package/List.js +319 -436
- package/MatchQuizPlay.js +1 -1
- package/Odds.js +30 -30
- package/PersonalityQuizPlay.js +1 -1
- package/PickThePair.js +627 -693
- package/PlayerOfTheMatch.js +256 -279
- package/PollVote.js +1 -1
- package/Predictor.js +19443 -2
- package/README.md +2 -1
- package/Standings.js +94 -99
- package/TopX.js +5871 -6988
- package/chunks/ChanceGameEmbedVariant-C3NGwvTF.js +21 -0
- package/chunks/OddsSkeleton-Bav8FHHN.js +26 -0
- package/chunks/{OddsStrip-B159Nivm.js → OddsStrip-CviVfQI4.js} +51 -53
- package/chunks/{PickOneOfX-D9qlxKTD.js → PickOneOfX-a6Dv0-rR.js} +210 -212
- package/chunks/index-B1d9q8fX.js +4 -0
- package/chunks/index-BP0pvFJ4.js +4 -0
- package/chunks/index-CHZyL_g_.js +4 -0
- package/chunks/index-CeCUdRmF.js +4 -0
- package/chunks/index-Ckyyw-I8.js +4 -0
- package/chunks/index-DGvCP5G8.js +4 -0
- package/chunks/index-yjMVOgwO.js +4 -0
- package/chunks/{main-CcPVuc5G.js → main-CFwRpvUi.js} +219 -238
- package/chunks/{main-By2Fg4Us.js → main-D9tFZv2q.js} +272 -309
- package/chunks/{main-Db4YC1C9.js → main-Dj4Manb5.js} +386 -407
- package/chunks/{main-BhONg691.js → main-DjiQz1dv.js} +764 -1125
- package/chunks/{main-BoLNJccN.js → main-Dys2_Jt2.js} +1625 -1954
- package/chunks/{main-JAewg2VD.js → main-dwV_55lz.js} +409 -432
- package/chunks/main-eAQMCxQ7.js +1949 -0
- package/chunks/{main-CWfREbUv.js → main-gexg6lc-.js} +959 -977
- package/index.js +40 -44
- package/package.json +13 -5
- package/chunks/AccessTime-B7Q_InTi.js +0 -10
- package/chunks/AlertMessage-CTbc9daZ.js +0 -318
- package/chunks/Avatar-Ve0m4ut_.js +0 -353
- package/chunks/Button-x1sQVMH2.js +0 -665
- package/chunks/Card-DfxnA3Cz.js +0 -196
- package/chunks/CardActions-TMBAbk8a.js +0 -140
- package/chunks/CardContent-CLQHztIU.js +0 -106
- package/chunks/ChanceGameEmbedVariant-C3TKbPI4.js +0 -913
- package/chunks/CheckCircle-DW1VzjQO.js +0 -8
- package/chunks/Chip-BUoNpinI.js +0 -365
- package/chunks/CircularProgress-D88LgW2V.js +0 -317
- package/chunks/Close-BxLZcPtb.js +0 -9
- package/chunks/Close-DVx6f5-e.js +0 -8
- package/chunks/CollectLeadForm-DtUFKk99.js +0 -3419
- package/chunks/ConsentsList-BcIMKviP.js +0 -339
- package/chunks/DirectionScope-CK0duYt8.js +0 -36
- package/chunks/Divider-D_ALv2uC.js +0 -166
- package/chunks/Edit-CiKqhDom.js +0 -99
- package/chunks/EmojiEvents-BYoxruEl.js +0 -8
- package/chunks/FavoriteBorder-YhT6RHv5.js +0 -11
- package/chunks/FormControl-BNG04EhC.js +0 -656
- package/chunks/FormControlContext-Ct0huDDM.js +0 -6
- package/chunks/FormLabel-Bl7hTa8O.js +0 -130
- package/chunks/GlobalStyles-PokSS9bO.js +0 -12
- package/chunks/InlineSpinner-BhKW6lxZ.js +0 -28
- package/chunks/Input-B7kPqO0b.js +0 -391
- package/chunks/KeyboardArrowDown-OGGGLEnE.js +0 -8
- package/chunks/KeyboardArrowRight-DN7qrp17.js +0 -11
- package/chunks/KeyboardArrowUp-jvN5m_A0.js +0 -8
- package/chunks/Link-brb09X-6.js +0 -319
- package/chunks/ListItemButton-BFG5QJbo.js +0 -1151
- package/chunks/ModalClose-D3i-AyMB.js +0 -153
- package/chunks/ModalDialog-Be6w76fh.js +0 -880
- package/chunks/NotFoundSkeleton-BHRVG8yg.js +0 -83
- package/chunks/Notification-CC66HKXb.js +0 -614
- package/chunks/OddsSkeleton-BBOVhfsn.js +0 -137
- package/chunks/OverlayScoreStateSkeleton-D5rnBJ_w.js +0 -154
- package/chunks/OverlayScoreStateWrapperSkeleton-CTXzD0bm.js +0 -81
- package/chunks/OverlaySignInSkeleton-T8A_9Tco.js +0 -518
- package/chunks/OverlaySkeleton-y02LRXZy.js +0 -1193
- package/chunks/Person-BD-IO4aX.js +0 -8
- package/chunks/PersonOutline-Nxl_9g9S.js +0 -8
- package/chunks/Popper-CGfJHTbM.js +0 -1263
- package/chunks/Portal-DQQSLiON.js +0 -74
- package/chunks/Portal-X8O64KaQ.js +0 -66
- package/chunks/Predictor-BJBBwZ6R.js +0 -19513
- package/chunks/PrizeCard-B2tBhY45.js +0 -36400
- package/chunks/Search-jaDXe8g7.js +0 -14
- package/chunks/Select-CzBMHr7z.js +0 -1165
- package/chunks/Sheet-x-YGYOYz.js +0 -132
- package/chunks/SignInCta-3NFxIOuf.js +0 -79
- package/chunks/Spinner-_5U881sC.js +0 -39
- package/chunks/SportsSoccer-DLUgspA-.js +0 -20
- package/chunks/Stack-CDpKA1D-.js +0 -169
- package/chunks/StandardContentSkeleton-DaZftDxZ.js +0 -57
- package/chunks/Table-IJ9-D2DF.js +0 -394
- package/chunks/Tabs-iyOvjGfd.js +0 -1084
- package/chunks/Textarea-Dv_Z4l5j.js +0 -475
- package/chunks/TimerOutlined-jNsK__Zz.js +0 -8
- package/chunks/Tooltip-clSjN1oC.js +0 -535
- package/chunks/Typography-BsucZNXl.js +0 -775
- package/chunks/areArraysEqual-B3mXtHvh.js +0 -6
- package/chunks/colorInversionUtils-AoR_6ghW.js +0 -347
- package/chunks/createSvgIcon-BWoHeNkc.js +0 -2813
- package/chunks/createSvgIcon-DBkOhFdn.js +0 -206
- package/chunks/dividerClasses-BkQMLbsL.js +0 -9
- package/chunks/elementAcceptingRef-DjUfkpLB.js +0 -25
- package/chunks/enums-B1lTCQvC.js +0 -15
- package/chunks/formLabelClasses-N0g8NZ67.js +0 -9
- package/chunks/getReactElementRef-B3MFPBbS.js +0 -21
- package/chunks/helpers-CKFwVhwj.js +0 -558
- package/chunks/index-Bg5jypgn.js +0 -11
- package/chunks/index-Bnad45hB.js +0 -4
- package/chunks/index-C6rtfeRX.js +0 -4
- package/chunks/index-CFc0WTOi.js +0 -848
- package/chunks/index-C_kf8WZI.js +0 -4
- package/chunks/index-CaVpDbdC.js +0 -4
- package/chunks/index-DJJVbXn_.js +0 -4
- package/chunks/index-DQO7VDRC.js +0 -4
- package/chunks/index-Kgehqf8J.js +0 -4
- package/chunks/main-W_W6YBtr.js +0 -3280
- package/chunks/ownerWindow-PI509BpA.js +0 -7
- package/chunks/searchEntities-SJcoznz0.js +0 -38
- package/chunks/sportsEvents-CGX-WkNB.js +0 -27
- package/chunks/useButton-C9taTgFS.js +0 -106
- package/chunks/useConsents-BLhgfEDf.js +0 -1168
- package/chunks/useControlled-BYdyS7Pn.js +0 -31
- package/chunks/useEmbedCode-DCWnWGak.js +0 -31
- package/chunks/useEventCallback-C9W0M_8l.js +0 -14
- package/chunks/useForwardedInput-CkAnayh_.js +0 -180
- package/chunks/useImageVariant-B62O7iLC.js +0 -15
- package/chunks/useInfoPage-BHdgKdme.js +0 -50
- package/chunks/useParticipationDraft-Brnd_p3w.js +0 -307
- package/chunks/useSwitch-DLSSqtcZ.js +0 -66
- package/chunks/variantColorInheritance-DZr7CNx6.js +0 -30
- package/chunks/visuallyHidden-B8J7BVSJ.js +0 -14
package/Leaderboard.js
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import z, { useState as B, useEffect as Q, useCallback as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import { T as Fe } from "./chunks/Table-IJ9-D2DF.js";
|
|
14
|
-
import { A as te } from "./chunks/Avatar-Ve0m4ut_.js";
|
|
15
|
-
import { D as H } from "./chunks/DirectionScope-CK0duYt8.js";
|
|
16
|
-
import { I as k, B as re } from "./chunks/Button-x1sQVMH2.js";
|
|
17
|
-
import { C as Ue, a as $e } from "./chunks/chevrons-right-CXSpQt9w.js";
|
|
18
|
-
import { C as Qe } from "./chunks/chevron-left-CxfCSZcr.js";
|
|
19
|
-
import { C as He } from "./chunks/chevron-right-BEQMacFn.js";
|
|
20
|
-
const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()).join(" "), _e = ({
|
|
1
|
+
import { jsxs as R, jsx as a, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import z, { useState as B, useEffect as Q, useCallback as he, useMemo as D } from "react";
|
|
3
|
+
import { useTheme as me, Box as I, FormLabel as fe, Typography as L, Select as ge, Option as be, Sheet as ye, Table as xe, Avatar as J, IconButton as H, Button as ee } from "@mui/joy";
|
|
4
|
+
import { useTranslation as X } from "react-i18next";
|
|
5
|
+
import { useConstantContext as Ce, ConstantsContext as ve, useColors as G, useCornerRadius as de, useFontFamily as W, useSpacingScale as j, useInternalTheme as ue, isExtraSmall as Te, hexToRgb as U, Spinner as Pe, stripHtmlTags as we, DirectionalIcon as k, AlertMessage as te, getLanguageDirection as Se, initializeI18n as Re, applyDirectionToMount as Ee, widgetCacheKey as Ae, createWidgetCache as Le, ContainerProvider as Ie, ThemeProvider as Me, ConstantsProvider as ze } from "fansunited-frontend-core";
|
|
6
|
+
import re from "@mui/icons-material/Person";
|
|
7
|
+
import { C as Be, a as Fe } from "./chunks/chevrons-right-CXSpQt9w.js";
|
|
8
|
+
import { C as Ue } from "./chunks/chevron-left-CxfCSZcr.js";
|
|
9
|
+
import { C as $e } from "./chunks/chevron-right-BEQMacFn.js";
|
|
10
|
+
import { CacheProvider as Qe } from "@emotion/react";
|
|
11
|
+
import { createPortal as He } from "react-dom";
|
|
12
|
+
const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()).join(" "), Oe = ({
|
|
21
13
|
options: e,
|
|
22
14
|
selectedId: t,
|
|
23
15
|
onChange: o
|
|
24
16
|
}) => {
|
|
25
|
-
const { t: r } = X(), { shadowRootElement:
|
|
17
|
+
const { t: r } = X(), { shadowRootElement: l } = Ce(ve), f = me(), v = G(), y = de(), d = W().primary, c = j(), C = v.textColor, p = {
|
|
26
18
|
background: {
|
|
27
|
-
surface:
|
|
28
|
-
popup:
|
|
19
|
+
surface: f.colorSchemes.light.palette.background.surface,
|
|
20
|
+
popup: f.colorSchemes.light.palette.background.popup
|
|
29
21
|
},
|
|
30
22
|
neutral: {
|
|
31
|
-
outlinedBorder:
|
|
32
|
-
outlinedColor:
|
|
33
|
-
outlinedHoverBg:
|
|
34
|
-
plainActiveBg:
|
|
35
|
-
plainHoverBg:
|
|
36
|
-
plainHoverColor:
|
|
23
|
+
outlinedBorder: f.colorSchemes.light.palette.neutral.outlinedBorder,
|
|
24
|
+
outlinedColor: f.colorSchemes.light.palette.neutral.outlinedColor,
|
|
25
|
+
outlinedHoverBg: f.colorSchemes.light.palette.neutral.outlinedHoverBg,
|
|
26
|
+
plainActiveBg: f.colorSchemes.light.palette.neutral.plainActiveBg,
|
|
27
|
+
plainHoverBg: f.colorSchemes.light.palette.neutral.plainHoverBg,
|
|
28
|
+
plainHoverColor: f.colorSchemes.light.palette.neutral.plainHoverColor
|
|
37
29
|
}
|
|
38
30
|
}, x = {
|
|
39
31
|
flexShrink: 0,
|
|
@@ -48,7 +40,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
48
40
|
borderRadius: y.sm,
|
|
49
41
|
px: c["2xs"],
|
|
50
42
|
py: c["3xs"]
|
|
51
|
-
},
|
|
43
|
+
}, E = (g) => /* @__PURE__ */ R(
|
|
52
44
|
I,
|
|
53
45
|
{
|
|
54
46
|
sx: {
|
|
@@ -59,8 +51,8 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
59
51
|
gap: c.sm
|
|
60
52
|
},
|
|
61
53
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
g.type && /* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ a("span", { children: g.label }),
|
|
55
|
+
g.type && /* @__PURE__ */ a(I, { sx: x, children: ke(g.type) })
|
|
64
56
|
]
|
|
65
57
|
}
|
|
66
58
|
), P = {
|
|
@@ -76,7 +68,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
76
68
|
}
|
|
77
69
|
},
|
|
78
70
|
listbox: {
|
|
79
|
-
container:
|
|
71
|
+
container: l,
|
|
80
72
|
sx: {
|
|
81
73
|
zIndex: 10,
|
|
82
74
|
bgcolor: p.background.popup,
|
|
@@ -102,16 +94,16 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
102
94
|
color: `${p.neutral.outlinedColor} !important`
|
|
103
95
|
}
|
|
104
96
|
};
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
|
|
97
|
+
return /* @__PURE__ */ R(I, { sx: { display: "flex", flexDirection: "column", gap: c["2xs"] }, children: [
|
|
98
|
+
/* @__PURE__ */ a(
|
|
99
|
+
fe,
|
|
108
100
|
{
|
|
109
101
|
sx: {
|
|
110
102
|
color: `${C} !important`,
|
|
111
103
|
fontFamily: d,
|
|
112
104
|
fontSize: "0.875em"
|
|
113
105
|
},
|
|
114
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ a(
|
|
115
107
|
L,
|
|
116
108
|
{
|
|
117
109
|
sx: {
|
|
@@ -124,18 +116,18 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
124
116
|
)
|
|
125
117
|
}
|
|
126
118
|
),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
119
|
+
/* @__PURE__ */ a(
|
|
120
|
+
ge,
|
|
129
121
|
{
|
|
130
122
|
value: t,
|
|
131
|
-
onChange: (g,
|
|
123
|
+
onChange: (g, w) => w && o(w),
|
|
132
124
|
slotProps: P,
|
|
133
125
|
renderValue: (g) => {
|
|
134
126
|
if (!g) return null;
|
|
135
|
-
const
|
|
136
|
-
return
|
|
127
|
+
const w = e.find((h) => h.id === g.value);
|
|
128
|
+
return w ? E(w) : g.label;
|
|
137
129
|
},
|
|
138
|
-
children: e.map((g) => /* @__PURE__ */
|
|
130
|
+
children: e.map((g) => /* @__PURE__ */ a(be, { value: g.id, sx: u, children: E(g) }, g.id))
|
|
139
131
|
}
|
|
140
132
|
)
|
|
141
133
|
] });
|
|
@@ -144,16 +136,16 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
144
136
|
userRank: t,
|
|
145
137
|
showHeading: o,
|
|
146
138
|
title: r,
|
|
147
|
-
description:
|
|
148
|
-
isSplitVariant:
|
|
139
|
+
description: l,
|
|
140
|
+
isSplitVariant: f,
|
|
149
141
|
brandingColors: v,
|
|
150
142
|
rankStyles: y
|
|
151
143
|
}) => {
|
|
152
|
-
const { t: d } = X(), c = ue(), C = G(), p = (v == null ? void 0 : v.primaryColor) || C.palette.primary.plainColor, x = (v == null ? void 0 : v.contentColor) || C.textColor,
|
|
144
|
+
const { t: d } = X(), c = ue(), C = G(), p = (v == null ? void 0 : v.primaryColor) || C.palette.primary.plainColor, x = (v == null ? void 0 : v.contentColor) || C.textColor, E = C.textColor, P = W().primary, u = W().secondary, g = de(), w = j(), h = Te(), i = C.surfaceVariant, n = c.colorSchemes.light.palette.primary.onPrimary, m = C.outlineEnabledBorder, s = {
|
|
153
145
|
leaderboardContainer: {
|
|
154
146
|
display: "flex",
|
|
155
147
|
flexDirection: "column",
|
|
156
|
-
gap:
|
|
148
|
+
gap: w.md
|
|
157
149
|
},
|
|
158
150
|
leaderboardTitle: {
|
|
159
151
|
fontFamily: P,
|
|
@@ -167,7 +159,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
167
159
|
tableContainer: {
|
|
168
160
|
overflowX: "auto",
|
|
169
161
|
borderRadius: g.md,
|
|
170
|
-
border: `1px solid ${
|
|
162
|
+
border: `1px solid ${m}`
|
|
171
163
|
},
|
|
172
164
|
table: {
|
|
173
165
|
backgroundColor: i,
|
|
@@ -184,7 +176,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
184
176
|
fontWeight: 600,
|
|
185
177
|
fontSize: "0.875em",
|
|
186
178
|
textAlign: "center",
|
|
187
|
-
borderBottom: `1px solid ${
|
|
179
|
+
borderBottom: `1px solid ${m}`
|
|
188
180
|
}
|
|
189
181
|
},
|
|
190
182
|
headerCellPosition: {
|
|
@@ -237,7 +229,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
237
229
|
nameCell: {
|
|
238
230
|
display: "flex",
|
|
239
231
|
alignItems: "center",
|
|
240
|
-
gap:
|
|
232
|
+
gap: w.sm
|
|
241
233
|
},
|
|
242
234
|
leaderboardAvatar: {
|
|
243
235
|
width: "32px",
|
|
@@ -277,16 +269,16 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
277
269
|
fontSize: "1.25em",
|
|
278
270
|
color: x,
|
|
279
271
|
textAlign: "center",
|
|
280
|
-
marginY:
|
|
272
|
+
marginY: w.md
|
|
281
273
|
}
|
|
282
274
|
};
|
|
283
275
|
if (!e)
|
|
284
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ a(Pe, { my: 10 });
|
|
285
277
|
if (e.length === 0)
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
-
const T = t,
|
|
288
|
-
return /* @__PURE__ */
|
|
289
|
-
o && /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ a(L, { level: "body-lg", sx: s.noLeaderboardText, children: d("leaderboard.noLeaderboardAvailable") });
|
|
279
|
+
const T = t, S = T == null ? void 0 : T.profileId, F = S && e.some((b) => b.profileId === S);
|
|
280
|
+
return /* @__PURE__ */ R(I, { sx: s.leaderboardContainer, children: [
|
|
281
|
+
o && /* @__PURE__ */ R(
|
|
290
282
|
I,
|
|
291
283
|
{
|
|
292
284
|
sx: {
|
|
@@ -296,7 +288,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
296
288
|
textAlign: "center"
|
|
297
289
|
},
|
|
298
290
|
children: [
|
|
299
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ a(
|
|
300
292
|
L,
|
|
301
293
|
{
|
|
302
294
|
level: "body-sm",
|
|
@@ -306,24 +298,24 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
306
298
|
letterSpacing: "1px",
|
|
307
299
|
textTransform: "uppercase",
|
|
308
300
|
fontSize: "0.75em",
|
|
309
|
-
color:
|
|
301
|
+
color: E,
|
|
310
302
|
opacity: "60%",
|
|
311
303
|
fontFamily: u
|
|
312
304
|
},
|
|
313
305
|
children: d("leaderboard.heading")
|
|
314
306
|
}
|
|
315
307
|
),
|
|
316
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ R(
|
|
317
309
|
I,
|
|
318
310
|
{
|
|
319
311
|
sx: {
|
|
320
312
|
display: "flex",
|
|
321
313
|
flexDirection: "column",
|
|
322
|
-
gap:
|
|
314
|
+
gap: w["3xs"]
|
|
323
315
|
},
|
|
324
316
|
children: [
|
|
325
|
-
r && /* @__PURE__ */
|
|
326
|
-
|
|
317
|
+
r && /* @__PURE__ */ a(L, { level: "h4", sx: s.leaderboardTitle, children: r }),
|
|
318
|
+
l && /* @__PURE__ */ a(
|
|
327
319
|
L,
|
|
328
320
|
{
|
|
329
321
|
sx: {
|
|
@@ -331,11 +323,11 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
331
323
|
lineHeight: "140%",
|
|
332
324
|
letterSpacing: "0.15px",
|
|
333
325
|
fontSize: "1.25em",
|
|
334
|
-
color:
|
|
326
|
+
color: E,
|
|
335
327
|
opacity: "60%",
|
|
336
328
|
fontFamily: P
|
|
337
329
|
},
|
|
338
|
-
children:
|
|
330
|
+
children: we(l)
|
|
339
331
|
}
|
|
340
332
|
)
|
|
341
333
|
]
|
|
@@ -344,8 +336,8 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
344
336
|
]
|
|
345
337
|
}
|
|
346
338
|
),
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
|
|
339
|
+
/* @__PURE__ */ a(ye, { sx: s.tableContainer, children: /* @__PURE__ */ R(
|
|
340
|
+
xe,
|
|
349
341
|
{
|
|
350
342
|
variant: "outlined",
|
|
351
343
|
hoverRow: !1,
|
|
@@ -353,43 +345,43 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
353
345
|
size: "sm",
|
|
354
346
|
sx: s.table,
|
|
355
347
|
children: [
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ R("tr", { children: [
|
|
349
|
+
/* @__PURE__ */ a("th", { style: s.headerCellPosition, children: h || f ? "" : d("leaderboard.position") }),
|
|
350
|
+
/* @__PURE__ */ a("th", { style: s.headerCellName, children: d("leaderboard.name") }),
|
|
351
|
+
/* @__PURE__ */ a("th", { style: s.headerCellPoints, children: h || f ? "🎯" : d("leaderboard.points") })
|
|
360
352
|
] }) }),
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
T && !F && /* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ R("tbody", { children: [
|
|
354
|
+
T && !F && /* @__PURE__ */ R("tr", { style: s.userRow, children: [
|
|
355
|
+
/* @__PURE__ */ a("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(L, { sx: s.positionText, children: [
|
|
364
356
|
"#",
|
|
365
357
|
T.position
|
|
366
358
|
] }) }),
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ a("td", { style: s.tableCellName, children: /* @__PURE__ */ R(I, { sx: s.nameCell, children: [
|
|
360
|
+
/* @__PURE__ */ a(J, { sx: s.leaderboardAvatar, children: /* @__PURE__ */ a(re, { sx: s.avatarIcon }) }),
|
|
361
|
+
/* @__PURE__ */ a(L, { sx: s.nameText, children: d("leaderboard.you") })
|
|
370
362
|
] }) }),
|
|
371
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ a("td", { style: s.tableCellPoints, children: /* @__PURE__ */ a(L, { sx: s.pointsText, children: T.points }) })
|
|
372
364
|
] }),
|
|
373
|
-
e.map((b,
|
|
374
|
-
var V, Y,
|
|
375
|
-
const M =
|
|
376
|
-
return /* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
365
|
+
e.map((b, A) => {
|
|
366
|
+
var V, Y, K, q;
|
|
367
|
+
const M = S === b.profileId, pe = M ? s.userRow : y == null ? void 0 : y[A + 1];
|
|
368
|
+
return /* @__PURE__ */ R("tr", { style: pe, children: [
|
|
369
|
+
/* @__PURE__ */ a("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(L, { sx: s.positionText, children: [
|
|
378
370
|
"#",
|
|
379
371
|
b.position
|
|
380
372
|
] }) }),
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
|
|
373
|
+
/* @__PURE__ */ a("td", { style: s.tableCellName, children: /* @__PURE__ */ R(I, { sx: s.nameCell, children: [
|
|
374
|
+
/* @__PURE__ */ a(
|
|
375
|
+
J,
|
|
384
376
|
{
|
|
385
377
|
src: ((V = b.profileModel) == null ? void 0 : V.avatar) || void 0,
|
|
386
378
|
sx: s.leaderboardAvatar,
|
|
387
|
-
children: (Y = b.profileModel) != null && Y.avatar ? /* @__PURE__ */
|
|
379
|
+
children: (Y = b.profileModel) != null && Y.avatar ? /* @__PURE__ */ a(ce, {}) : /* @__PURE__ */ a(re, { sx: s.avatarIcon })
|
|
388
380
|
}
|
|
389
381
|
),
|
|
390
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ a(L, { sx: s.nameText, children: M ? d("leaderboard.you") : ((K = b.profileModel) == null ? void 0 : K.nickname) || ((q = b.profileModel) == null ? void 0 : q.name) || d("leaderboard.anonymous") })
|
|
391
383
|
] }) }),
|
|
392
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ a("td", { style: s.tableCellPoints, children: /* @__PURE__ */ a(L, { sx: s.pointsText, children: b.points }) })
|
|
393
385
|
] }, b.profileId);
|
|
394
386
|
})
|
|
395
387
|
] })
|
|
@@ -397,13 +389,13 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
397
389
|
}
|
|
398
390
|
) })
|
|
399
391
|
] });
|
|
400
|
-
},
|
|
392
|
+
}, We = ({
|
|
401
393
|
count: e = 10,
|
|
402
394
|
page: t = 1,
|
|
403
395
|
onChange: o,
|
|
404
396
|
siblingCount: r = 1,
|
|
405
|
-
boundaryCount:
|
|
406
|
-
showFirstButton:
|
|
397
|
+
boundaryCount: l = 1,
|
|
398
|
+
showFirstButton: f = !0,
|
|
407
399
|
showLastButton: v = !0,
|
|
408
400
|
size: y = "md",
|
|
409
401
|
disabled: d = !1,
|
|
@@ -412,23 +404,23 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
412
404
|
const C = ue(), p = (i) => {
|
|
413
405
|
o && i >= 1 && i <= e && o(i);
|
|
414
406
|
}, x = (i, n) => {
|
|
415
|
-
const
|
|
416
|
-
for (let s = i; s <= n; s++)
|
|
417
|
-
return
|
|
407
|
+
const m = [];
|
|
408
|
+
for (let s = i; s <= n; s++) m.push(s);
|
|
409
|
+
return m;
|
|
418
410
|
}, P = (() => {
|
|
419
411
|
if (e <= 0) return [];
|
|
420
|
-
const i = x(1, Math.min(
|
|
421
|
-
Math.max(e -
|
|
412
|
+
const i = x(1, Math.min(l, e)), n = x(
|
|
413
|
+
Math.max(e - l + 1, l + 1),
|
|
422
414
|
e
|
|
423
|
-
),
|
|
424
|
-
if (
|
|
425
|
-
for (let
|
|
426
|
-
T.push(
|
|
427
|
-
s < e -
|
|
428
|
-
for (const
|
|
429
|
-
T.includes(
|
|
415
|
+
), m = Math.max(l + 1, t - r), s = Math.min(e - l, t + r), T = [...i];
|
|
416
|
+
if (m > l + 1 && T.push("ellipsis-start"), m <= s)
|
|
417
|
+
for (let S = m; S <= s; S++)
|
|
418
|
+
T.push(S);
|
|
419
|
+
s < e - l && T.push("ellipsis-end");
|
|
420
|
+
for (const S of n)
|
|
421
|
+
T.includes(S) || T.push(S);
|
|
430
422
|
return T;
|
|
431
|
-
})(), u = y === "sm" ? "sm" : y === "lg" ? "lg" : "md", g = y === "sm" ? 16 : y === "lg" ? 24 : 20,
|
|
423
|
+
})(), u = y === "sm" ? "sm" : y === "lg" ? "lg" : "md", g = y === "sm" ? 16 : y === "lg" ? 24 : 20, w = (i = !1) => {
|
|
432
424
|
if (!c)
|
|
433
425
|
return {
|
|
434
426
|
borderRadius: "8px",
|
|
@@ -458,7 +450,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
458
450
|
opacity: 0.5
|
|
459
451
|
}
|
|
460
452
|
};
|
|
461
|
-
},
|
|
453
|
+
}, h = () => {
|
|
462
454
|
if (!c)
|
|
463
455
|
return {
|
|
464
456
|
borderRadius: "8px",
|
|
@@ -487,7 +479,7 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
487
479
|
}
|
|
488
480
|
};
|
|
489
481
|
};
|
|
490
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ R(
|
|
491
483
|
I,
|
|
492
484
|
{
|
|
493
485
|
sx: {
|
|
@@ -497,41 +489,41 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
497
489
|
flexWrap: "wrap"
|
|
498
490
|
},
|
|
499
491
|
children: [
|
|
500
|
-
|
|
501
|
-
|
|
492
|
+
f && /* @__PURE__ */ a(
|
|
493
|
+
H,
|
|
502
494
|
{
|
|
503
495
|
size: u,
|
|
504
496
|
variant: "plain",
|
|
505
497
|
color: "neutral",
|
|
506
498
|
onClick: () => p(1),
|
|
507
499
|
disabled: d || t === 1,
|
|
508
|
-
sx:
|
|
509
|
-
children: /* @__PURE__ */
|
|
500
|
+
sx: h(),
|
|
501
|
+
children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(Be, { size: g }) })
|
|
510
502
|
}
|
|
511
503
|
),
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
|
|
504
|
+
/* @__PURE__ */ a(
|
|
505
|
+
H,
|
|
514
506
|
{
|
|
515
507
|
size: u,
|
|
516
508
|
variant: "plain",
|
|
517
509
|
color: "neutral",
|
|
518
510
|
onClick: () => p(t - 1),
|
|
519
511
|
disabled: d || t === 1,
|
|
520
|
-
sx:
|
|
521
|
-
children: /* @__PURE__ */
|
|
512
|
+
sx: h(),
|
|
513
|
+
children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(Ue, { size: g }) })
|
|
522
514
|
}
|
|
523
515
|
),
|
|
524
516
|
P.map((i, n) => {
|
|
525
517
|
if (typeof i == "string" && i.startsWith("ellipsis"))
|
|
526
|
-
return /* @__PURE__ */
|
|
527
|
-
|
|
518
|
+
return /* @__PURE__ */ a(
|
|
519
|
+
ee,
|
|
528
520
|
{
|
|
529
521
|
size: u,
|
|
530
522
|
variant: "plain",
|
|
531
523
|
color: "neutral",
|
|
532
524
|
disabled: !0,
|
|
533
525
|
sx: {
|
|
534
|
-
...
|
|
526
|
+
...w(!1),
|
|
535
527
|
cursor: "default",
|
|
536
528
|
"&.Mui-disabled": c ? {
|
|
537
529
|
backgroundColor: "transparent",
|
|
@@ -546,43 +538,43 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
546
538
|
},
|
|
547
539
|
`${i}-${n}`
|
|
548
540
|
);
|
|
549
|
-
const
|
|
550
|
-
return /* @__PURE__ */
|
|
551
|
-
|
|
541
|
+
const m = i === t;
|
|
542
|
+
return /* @__PURE__ */ a(
|
|
543
|
+
ee,
|
|
552
544
|
{
|
|
553
545
|
size: u,
|
|
554
|
-
variant:
|
|
546
|
+
variant: m ? "solid" : "plain",
|
|
555
547
|
color: "neutral",
|
|
556
548
|
onClick: () => p(i),
|
|
557
549
|
disabled: d,
|
|
558
|
-
sx:
|
|
550
|
+
sx: w(m),
|
|
559
551
|
children: i
|
|
560
552
|
},
|
|
561
553
|
i
|
|
562
554
|
);
|
|
563
555
|
}),
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
|
|
556
|
+
/* @__PURE__ */ a(
|
|
557
|
+
H,
|
|
566
558
|
{
|
|
567
559
|
size: u,
|
|
568
560
|
variant: "plain",
|
|
569
561
|
color: "neutral",
|
|
570
562
|
onClick: () => p(t + 1),
|
|
571
563
|
disabled: d || t === e,
|
|
572
|
-
sx:
|
|
573
|
-
children: /* @__PURE__ */
|
|
564
|
+
sx: h(),
|
|
565
|
+
children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a($e, { size: g }) })
|
|
574
566
|
}
|
|
575
567
|
),
|
|
576
|
-
v && /* @__PURE__ */
|
|
577
|
-
|
|
568
|
+
v && /* @__PURE__ */ a(
|
|
569
|
+
H,
|
|
578
570
|
{
|
|
579
571
|
size: u,
|
|
580
572
|
variant: "plain",
|
|
581
573
|
color: "neutral",
|
|
582
574
|
onClick: () => p(e),
|
|
583
575
|
disabled: d || t === e,
|
|
584
|
-
sx:
|
|
585
|
-
children: /* @__PURE__ */
|
|
576
|
+
sx: h(),
|
|
577
|
+
children: /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(Fe, { size: g }) })
|
|
586
578
|
}
|
|
587
579
|
)
|
|
588
580
|
]
|
|
@@ -598,77 +590,77 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
598
590
|
profileId: t.profileId,
|
|
599
591
|
profileModel: t.profileModel,
|
|
600
592
|
points: t.points
|
|
601
|
-
})),
|
|
593
|
+
})), _e = async (e) => {
|
|
602
594
|
try {
|
|
603
595
|
return await e.profile.getOwn().getInfo();
|
|
604
596
|
} catch {
|
|
605
597
|
return null;
|
|
606
598
|
}
|
|
607
599
|
}, oe = async (e, t) => e.length === 0 ? [] : (await t.topX.getGames({ gameIds: e })).data.map((r) => {
|
|
608
|
-
var
|
|
600
|
+
var l;
|
|
609
601
|
return {
|
|
610
602
|
id: r.id,
|
|
611
603
|
title: r.title,
|
|
612
604
|
description: r.description || null,
|
|
613
|
-
branding: ((
|
|
605
|
+
branding: ((l = r.branding) == null ? void 0 : l.colors) || null
|
|
614
606
|
};
|
|
615
607
|
}), ne = async (e, t) => e.length === 0 ? [] : (await t.matchQuiz.getGames({ gameIds: e })).data.map((r) => {
|
|
616
|
-
var
|
|
608
|
+
var l;
|
|
617
609
|
return {
|
|
618
610
|
id: r.id,
|
|
619
611
|
title: r.title,
|
|
620
612
|
description: r.description || null,
|
|
621
|
-
branding: ((
|
|
613
|
+
branding: ((l = r.branding) == null ? void 0 : l.colors) || null
|
|
622
614
|
};
|
|
623
|
-
}),
|
|
624
|
-
var
|
|
615
|
+
}), le = async (e, t) => e.length === 0 ? [] : (await t.loyalty.getTemplates()).data.filter((r) => e.includes(r.id)).map((r) => {
|
|
616
|
+
var l;
|
|
625
617
|
return {
|
|
626
618
|
id: r.id,
|
|
627
619
|
title: r.title || r.name,
|
|
628
620
|
description: r.description || null,
|
|
629
|
-
branding: ((
|
|
621
|
+
branding: ((l = r.branding) == null ? void 0 : l.colors) || null
|
|
630
622
|
};
|
|
631
|
-
}),
|
|
623
|
+
}), ae = async (e, t) => e.length === 0 ? [] : (await t.miniGames.getClassicQuizzes({
|
|
632
624
|
classicQuizIds: e,
|
|
633
625
|
limit: e.length
|
|
634
626
|
})).data.map((r) => {
|
|
635
|
-
var
|
|
627
|
+
var l;
|
|
636
628
|
return {
|
|
637
629
|
id: r.id,
|
|
638
630
|
title: r.title || r.name,
|
|
639
631
|
description: r.description || null,
|
|
640
|
-
branding: ((
|
|
632
|
+
branding: ((l = r.branding) == null ? void 0 : l.colors) || null
|
|
641
633
|
};
|
|
642
634
|
}), Xe = async (e, t, o, r) => {
|
|
643
|
-
const
|
|
635
|
+
const l = await t.loyalty.getLeaderboardForGame(e, { page: o, limit: r });
|
|
644
636
|
return {
|
|
645
|
-
leaderboard: N(
|
|
646
|
-
pagination: Z(
|
|
637
|
+
leaderboard: N(l.data),
|
|
638
|
+
pagination: Z(l.meta.pagination)
|
|
647
639
|
};
|
|
648
640
|
}, Ge = async (e, t, o, r) => {
|
|
649
|
-
const
|
|
641
|
+
const l = await t.loyalty.getLeaderboard(
|
|
650
642
|
e,
|
|
651
643
|
{ page: o, limit: r }
|
|
652
644
|
);
|
|
653
645
|
return {
|
|
654
|
-
leaderboard: N(
|
|
655
|
-
pagination: Z(
|
|
646
|
+
leaderboard: N(l.data),
|
|
647
|
+
pagination: Z(l.meta.pagination)
|
|
656
648
|
};
|
|
657
|
-
},
|
|
658
|
-
const
|
|
649
|
+
}, _ = async (e, t, o, r) => {
|
|
650
|
+
const l = await t.miniGames.getLeaderboardForClassicQuizzes({
|
|
659
651
|
classicQuizIds: e,
|
|
660
652
|
page: o,
|
|
661
653
|
limit: r
|
|
662
654
|
});
|
|
663
655
|
return {
|
|
664
|
-
leaderboard: N(
|
|
665
|
-
pagination: Z(
|
|
656
|
+
leaderboard: N(l.data),
|
|
657
|
+
pagination: Z(l.meta.pagination)
|
|
666
658
|
};
|
|
667
659
|
}, ie = (e, t, o, r) => {
|
|
668
|
-
const
|
|
669
|
-
return
|
|
660
|
+
const l = e.type.toUpperCase();
|
|
661
|
+
return l === "TOP_X" || l === "MATCH_QUIZ" ? Xe(e.id, t, o, r) : l === "TEMPLATE" ? Ge(e.id, t, o, r) : _([e.id], t, o, r);
|
|
670
662
|
}, je = async (e, t, o, r) => {
|
|
671
|
-
const
|
|
663
|
+
const f = o.toUpperCase() === "TEMPLATE" ? { rankType: "TEMPLATE", leaderboardIds: [e] } : { rankType: "GAME", gameType: o.toUpperCase(), leaderboardIds: [e] }, d = (await t.loyalty.getOwnRankings(f, !0)).data[0] ?? null;
|
|
672
664
|
return d ? {
|
|
673
665
|
position: d.position,
|
|
674
666
|
profileId: r,
|
|
@@ -676,54 +668,54 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
676
668
|
points: d.points
|
|
677
669
|
} : null;
|
|
678
670
|
}, Ze = async (e, t, o) => {
|
|
679
|
-
const
|
|
671
|
+
const f = (await t.miniGames.getClassicQuizzesUserRanking(
|
|
680
672
|
o,
|
|
681
673
|
void 0,
|
|
682
674
|
!0
|
|
683
675
|
)).data.find((v) => v.classicQuizId === e) ?? null;
|
|
684
|
-
return
|
|
685
|
-
position:
|
|
676
|
+
return f ? {
|
|
677
|
+
position: f.position,
|
|
686
678
|
profileId: o,
|
|
687
679
|
profileModel: null,
|
|
688
|
-
points:
|
|
680
|
+
points: f.points
|
|
689
681
|
} : null;
|
|
690
682
|
}, Ne = (e, t, o) => {
|
|
691
683
|
const r = e.type.toUpperCase();
|
|
692
684
|
return r === "TOP_X" || r === "MATCH_QUIZ" || r === "TEMPLATE" ? je(e.id, t, e.type, o) : Ze(e.id, t, o);
|
|
693
685
|
}, Ve = (e, t, o, r = 10) => {
|
|
694
|
-
const [
|
|
686
|
+
const [l, f] = B({}), [v, y] = B(null), [d, c] = B(!1), [C, p] = B(!1), [x, E] = B(
|
|
695
687
|
null
|
|
696
688
|
), [P, u] = B(null);
|
|
697
689
|
Q(() => {
|
|
698
|
-
const
|
|
690
|
+
const h = {
|
|
699
691
|
topX: e.filter((n) => n.type.toUpperCase() === "TOP_X").map((n) => n.id),
|
|
700
692
|
matchQuiz: e.filter((n) => n.type.toUpperCase() === "MATCH_QUIZ").map((n) => n.id),
|
|
701
693
|
template: e.filter((n) => n.type.toUpperCase() === "TEMPLATE").map((n) => n.id),
|
|
702
694
|
classicQuiz: e.filter((n) => n.type.toUpperCase() === "CLASSIC_QUIZ").map((n) => n.id)
|
|
703
695
|
}, i = (n) => n.catch(() => []);
|
|
704
696
|
Promise.all([
|
|
705
|
-
i(oe(
|
|
706
|
-
i(ne(
|
|
707
|
-
i(
|
|
708
|
-
i(
|
|
697
|
+
i(oe(h.topX, t)),
|
|
698
|
+
i(ne(h.matchQuiz, t)),
|
|
699
|
+
i(le(h.template, t)),
|
|
700
|
+
i(ae(h.classicQuiz, t))
|
|
709
701
|
]).then((n) => {
|
|
710
|
-
const
|
|
702
|
+
const m = {};
|
|
711
703
|
n.flat().forEach((s) => {
|
|
712
|
-
|
|
713
|
-
}),
|
|
704
|
+
m[s.id] = s;
|
|
705
|
+
}), f(m);
|
|
714
706
|
});
|
|
715
707
|
}, [e, t]), Q(() => {
|
|
716
|
-
|
|
708
|
+
_e(t).then(E);
|
|
717
709
|
}, [t]), Q(() => {
|
|
718
710
|
if (!o || !x) {
|
|
719
711
|
u(null);
|
|
720
712
|
return;
|
|
721
713
|
}
|
|
722
|
-
let
|
|
714
|
+
let h = !1, i;
|
|
723
715
|
if (o === $) {
|
|
724
|
-
const n = e.map((
|
|
725
|
-
i = t.miniGames.getClassicQuizzesUserRanking(x.id, void 0, !0).then((
|
|
726
|
-
const T =
|
|
716
|
+
const n = e.map((m) => m.id);
|
|
717
|
+
i = t.miniGames.getClassicQuizzesUserRanking(x.id, void 0, !0).then((m) => {
|
|
718
|
+
const T = m.data.find((S) => n.includes(S.classicQuizId)) ?? null;
|
|
727
719
|
return T ? {
|
|
728
720
|
position: T.position,
|
|
729
721
|
profileId: x.id,
|
|
@@ -732,77 +724,77 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
732
724
|
} : null;
|
|
733
725
|
});
|
|
734
726
|
} else {
|
|
735
|
-
const n = e.find((
|
|
727
|
+
const n = e.find((m) => m.id === o);
|
|
736
728
|
if (!n) return;
|
|
737
729
|
i = Ne(n, t, x.id);
|
|
738
730
|
}
|
|
739
731
|
return i.then((n) => {
|
|
740
|
-
|
|
732
|
+
h || u(n);
|
|
741
733
|
}).catch(() => {
|
|
742
|
-
|
|
734
|
+
h || u(null);
|
|
743
735
|
}), () => {
|
|
744
|
-
|
|
736
|
+
h = !0;
|
|
745
737
|
};
|
|
746
738
|
}, [o, e, t, x]), Q(() => {
|
|
747
739
|
if (!o) return;
|
|
748
|
-
let
|
|
740
|
+
let h = !1;
|
|
749
741
|
return c(!0), p(!1), y(null), (async () => {
|
|
750
742
|
try {
|
|
751
743
|
const n = e.length > 1 && e.every((b) => b.type.toUpperCase() === "CLASSIC_QUIZ");
|
|
752
744
|
if (o === $ && n) {
|
|
753
|
-
const b = e.map((M) => M.id),
|
|
745
|
+
const b = e.map((M) => M.id), A = await _(
|
|
754
746
|
b,
|
|
755
747
|
t,
|
|
756
748
|
1,
|
|
757
749
|
r
|
|
758
750
|
);
|
|
759
|
-
|
|
751
|
+
h || y({
|
|
760
752
|
id: $,
|
|
761
753
|
title: $,
|
|
762
754
|
description: null,
|
|
763
755
|
branding: null,
|
|
764
|
-
...
|
|
756
|
+
...A
|
|
765
757
|
});
|
|
766
758
|
return;
|
|
767
759
|
}
|
|
768
|
-
const
|
|
769
|
-
if (!
|
|
770
|
-
const s =
|
|
771
|
-
ie(
|
|
760
|
+
const m = e.find((b) => b.id === o);
|
|
761
|
+
if (!m) return;
|
|
762
|
+
const s = m.type.toUpperCase(), T = s === "TOP_X" ? oe([o], t) : s === "MATCH_QUIZ" ? ne([o], t) : s === "TEMPLATE" ? le([o], t) : ae([o], t), [S, F] = await Promise.all([
|
|
763
|
+
ie(m, t, 1, r),
|
|
772
764
|
T.catch(() => [])
|
|
773
765
|
]);
|
|
774
|
-
if (!
|
|
766
|
+
if (!h) {
|
|
775
767
|
const b = F[0];
|
|
776
768
|
y({
|
|
777
769
|
id: o,
|
|
778
770
|
title: (b == null ? void 0 : b.title) || o,
|
|
779
771
|
description: (b == null ? void 0 : b.description) || null,
|
|
780
772
|
branding: (b == null ? void 0 : b.branding) || null,
|
|
781
|
-
...
|
|
773
|
+
...S
|
|
782
774
|
});
|
|
783
775
|
}
|
|
784
776
|
} catch (n) {
|
|
785
|
-
console.error("Failed to fetch leaderboard:", n),
|
|
777
|
+
console.error("Failed to fetch leaderboard:", n), h || p(!0);
|
|
786
778
|
} finally {
|
|
787
|
-
|
|
779
|
+
h || c(!1);
|
|
788
780
|
}
|
|
789
781
|
})(), () => {
|
|
790
|
-
|
|
782
|
+
h = !0;
|
|
791
783
|
};
|
|
792
784
|
}, [o, e, t, r]);
|
|
793
|
-
const g =
|
|
794
|
-
async (
|
|
785
|
+
const g = he(
|
|
786
|
+
async (h) => {
|
|
795
787
|
if (o) {
|
|
796
788
|
c(!0);
|
|
797
789
|
try {
|
|
798
790
|
let i;
|
|
799
791
|
if (o === $) {
|
|
800
|
-
const n = e.map((
|
|
801
|
-
i = await
|
|
792
|
+
const n = e.map((m) => m.id);
|
|
793
|
+
i = await _(n, t, h, r);
|
|
802
794
|
} else {
|
|
803
|
-
const n = e.find((
|
|
795
|
+
const n = e.find((m) => m.id === o);
|
|
804
796
|
if (!n) return;
|
|
805
|
-
i = await ie(n, t,
|
|
797
|
+
i = await ie(n, t, h, r);
|
|
806
798
|
}
|
|
807
799
|
y((n) => n ? { ...n, ...i } : null);
|
|
808
800
|
} catch (i) {
|
|
@@ -813,78 +805,78 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
813
805
|
}
|
|
814
806
|
},
|
|
815
807
|
[o, e, t, r]
|
|
816
|
-
),
|
|
817
|
-
Object.entries(
|
|
808
|
+
), w = Object.fromEntries(
|
|
809
|
+
Object.entries(l).map(([h, i]) => [h, i.title])
|
|
818
810
|
);
|
|
819
|
-
return { data: v, entityTitles:
|
|
820
|
-
},
|
|
811
|
+
return { data: v, entityTitles: w, loading: d, error: C, setPage: g, userRank: P };
|
|
812
|
+
}, O = "ALL", se = ["TOP_X", "MATCH_QUIZ", "TEMPLATE", "CLASSIC_QUIZ"], Ye = (e, t) => {
|
|
821
813
|
if (!Array.isArray(e) || e.length === 0)
|
|
822
814
|
return "The 'entities' setting is required and must be a non-empty array.";
|
|
823
815
|
const o = /* @__PURE__ */ new Set();
|
|
824
816
|
for (let r = 0; r < e.length; r++) {
|
|
825
|
-
const
|
|
826
|
-
if (!
|
|
817
|
+
const l = e[r];
|
|
818
|
+
if (!l || typeof l != "object")
|
|
827
819
|
return `Entity at index ${r} must be an object with 'id' and 'type' fields.`;
|
|
828
|
-
if (!
|
|
820
|
+
if (!l.id || typeof l.id != "string")
|
|
829
821
|
return `Entity at index ${r} is missing a required 'id' string field.`;
|
|
830
|
-
if (o.has(
|
|
831
|
-
return `Duplicate entity id '${
|
|
832
|
-
if (o.add(
|
|
822
|
+
if (o.has(l.id))
|
|
823
|
+
return `Duplicate entity id '${l.id}' found at index ${r}. Each entity must have a unique id.`;
|
|
824
|
+
if (o.add(l.id), !l.type || typeof l.type != "string")
|
|
833
825
|
return `Entity at index ${r} is missing a required 'type' string field.`;
|
|
834
|
-
if (!se.includes(
|
|
835
|
-
return `Entity at index ${r} has an invalid type '${
|
|
826
|
+
if (!se.includes(l.type.toUpperCase()))
|
|
827
|
+
return `Entity at index ${r} has an invalid type '${l.type}'. Valid values are: ${se.join(", ")} (case-insensitive).`;
|
|
836
828
|
}
|
|
837
829
|
return t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t < 1 || t > 50) ? "The 'pageSize' setting must be an integer between 1 and 50." : null;
|
|
838
|
-
},
|
|
830
|
+
}, Ke = ({
|
|
839
831
|
entities: e,
|
|
840
832
|
sdk: t,
|
|
841
833
|
pageSize: o,
|
|
842
834
|
rankStyles: r,
|
|
843
|
-
showOverallOnly:
|
|
844
|
-
showHeading:
|
|
835
|
+
showOverallOnly: l = !1,
|
|
836
|
+
showHeading: f = !0
|
|
845
837
|
}) => {
|
|
846
838
|
var b;
|
|
847
839
|
const { t: v } = X(), y = j(), d = G().surface, c = D(
|
|
848
840
|
() => Ye(e, o),
|
|
849
841
|
[e, o]
|
|
850
842
|
), C = D(
|
|
851
|
-
() => !c && e.length > 1 && e.every((
|
|
843
|
+
() => !c && e.length > 1 && e.every((A) => A.type.toUpperCase() === "CLASSIC_QUIZ"),
|
|
852
844
|
[e, c]
|
|
853
|
-
), p =
|
|
845
|
+
), p = l && C, x = C ? O : ((b = e[0]) == null ? void 0 : b.id) || "", [E, P] = B(x);
|
|
854
846
|
Q(() => {
|
|
855
|
-
|
|
847
|
+
E === O || e.some((M) => M.id === E) || P(x);
|
|
856
848
|
}, [e]);
|
|
857
|
-
const { data: u, entityTitles: g, loading:
|
|
849
|
+
const { data: u, entityTitles: g, loading: w, error: h, setPage: i, userRank: n } = Ve(
|
|
858
850
|
c ? [] : e,
|
|
859
851
|
t,
|
|
860
|
-
c ? "" :
|
|
852
|
+
c ? "" : E,
|
|
861
853
|
o
|
|
862
|
-
),
|
|
854
|
+
), m = D(() => {
|
|
863
855
|
if (c) return [];
|
|
864
|
-
const
|
|
865
|
-
return C &&
|
|
866
|
-
|
|
856
|
+
const A = [];
|
|
857
|
+
return C && A.push({ id: O, label: v("leaderboard.overall") }), e.forEach((M) => {
|
|
858
|
+
A.push({
|
|
867
859
|
id: M.id,
|
|
868
860
|
label: g[M.id] ?? "",
|
|
869
861
|
type: M.type.toUpperCase()
|
|
870
862
|
});
|
|
871
|
-
}),
|
|
872
|
-
}, [e, C, v, g, c]), s = e.every((
|
|
873
|
-
return c ? /* @__PURE__ */
|
|
874
|
-
|
|
863
|
+
}), A;
|
|
864
|
+
}, [e, C, v, g, c]), s = e.every((A) => g[A.id] !== void 0), T = !c && !p && (e.length > 1 || C) && s, S = (u == null ? void 0 : u.pagination) || null, F = E === O ? v("leaderboard.overall") : (u == null ? void 0 : u.title) || null;
|
|
865
|
+
return c ? /* @__PURE__ */ a(
|
|
866
|
+
te,
|
|
875
867
|
{
|
|
876
868
|
variant: "error",
|
|
877
869
|
title: "Configuration Error",
|
|
878
870
|
message: c
|
|
879
871
|
}
|
|
880
|
-
) :
|
|
881
|
-
|
|
872
|
+
) : h ? /* @__PURE__ */ a(
|
|
873
|
+
te,
|
|
882
874
|
{
|
|
883
875
|
variant: "error",
|
|
884
876
|
title: "Failed to Load Leaderboard",
|
|
885
877
|
message: "One or more entity IDs could not be found. Please verify the provided IDs and try again."
|
|
886
878
|
}
|
|
887
|
-
) : /* @__PURE__ */
|
|
879
|
+
) : /* @__PURE__ */ R(
|
|
888
880
|
I,
|
|
889
881
|
{
|
|
890
882
|
sx: {
|
|
@@ -895,79 +887,79 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
895
887
|
padding: y.md
|
|
896
888
|
},
|
|
897
889
|
children: [
|
|
898
|
-
T && /* @__PURE__ */
|
|
899
|
-
|
|
890
|
+
T && /* @__PURE__ */ a(
|
|
891
|
+
Oe,
|
|
900
892
|
{
|
|
901
|
-
options:
|
|
902
|
-
selectedId:
|
|
893
|
+
options: m,
|
|
894
|
+
selectedId: E,
|
|
903
895
|
onChange: P
|
|
904
896
|
}
|
|
905
897
|
),
|
|
906
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ a(
|
|
907
899
|
De,
|
|
908
900
|
{
|
|
909
|
-
leaderboard:
|
|
910
|
-
userRank:
|
|
911
|
-
showHeading:
|
|
901
|
+
leaderboard: w ? null : (u == null ? void 0 : u.leaderboard) || null,
|
|
902
|
+
userRank: w ? null : n,
|
|
903
|
+
showHeading: f && !T,
|
|
912
904
|
title: F,
|
|
913
905
|
description: (u == null ? void 0 : u.description) || null,
|
|
914
906
|
brandingColors: (u == null ? void 0 : u.branding) || null,
|
|
915
907
|
rankStyles: r
|
|
916
908
|
}
|
|
917
909
|
),
|
|
918
|
-
!
|
|
919
|
-
|
|
910
|
+
!w && S && S.totalPages > 1 && /* @__PURE__ */ a(
|
|
911
|
+
We,
|
|
920
912
|
{
|
|
921
|
-
count:
|
|
922
|
-
page:
|
|
913
|
+
count: S.totalPages,
|
|
914
|
+
page: S.currentPage,
|
|
923
915
|
onChange: i
|
|
924
916
|
}
|
|
925
917
|
)
|
|
926
918
|
]
|
|
927
919
|
}
|
|
928
920
|
);
|
|
929
|
-
},
|
|
921
|
+
}, qe = (e) => {
|
|
930
922
|
var P;
|
|
931
|
-
const [t, o] = z.useState(!1), [r,
|
|
923
|
+
const [t, o] = z.useState(!1), [r, l] = z.useState(!1), f = Se(e.language), v = z.useRef(
|
|
932
924
|
`leaderboard-shadow-root-${Math.random().toString(36).substring(2, 11)}`
|
|
933
925
|
), y = z.useRef(null), d = z.useRef(null), c = z.useRef(null), [C, p] = z.useState(null);
|
|
934
926
|
z.useEffect(() => {
|
|
935
|
-
|
|
927
|
+
Re(e.language || "en").finally(() => l(!0));
|
|
936
928
|
}, [e.language]), z.useEffect(() => {
|
|
937
929
|
if (!y.current) return;
|
|
938
930
|
y.current.shadowRoot ? (d.current = y.current.shadowRoot, c.current = d.current.getElementById(
|
|
939
931
|
v.current
|
|
940
|
-
), c.current || (c.current = document.createElement("div"), c.current.id = v.current, d.current.appendChild(c.current))) : (d.current = y.current.attachShadow({ mode: "open" }), c.current = document.createElement("div"), c.current.id = v.current, d.current.appendChild(c.current)),
|
|
941
|
-
const u =
|
|
932
|
+
), c.current || (c.current = document.createElement("div"), c.current.id = v.current, d.current.appendChild(c.current))) : (d.current = y.current.attachShadow({ mode: "open" }), c.current = document.createElement("div"), c.current.id = v.current, d.current.appendChild(c.current)), Ee(c.current, f);
|
|
933
|
+
const u = Ae("leaderboard", f);
|
|
942
934
|
return p(
|
|
943
|
-
(g) => (g == null ? void 0 : g.key) === u ? g :
|
|
935
|
+
(g) => (g == null ? void 0 : g.key) === u ? g : Le(
|
|
944
936
|
"leaderboard",
|
|
945
937
|
d.current,
|
|
946
|
-
|
|
938
|
+
f
|
|
947
939
|
)
|
|
948
940
|
), o(!0), () => {
|
|
949
941
|
o(!1);
|
|
950
942
|
};
|
|
951
|
-
}, [
|
|
952
|
-
const x = /* @__PURE__ */
|
|
943
|
+
}, [f]);
|
|
944
|
+
const x = /* @__PURE__ */ a(I, { ref: y, lang: e.language || "en" }), E = t && r && c.current && C ? He(
|
|
953
945
|
// Keyed on the cache, not on `direction`: it must change in the same
|
|
954
946
|
// render that adopts the new cache, or CssVarsProvider writes its CSS
|
|
955
947
|
// variables into the outgoing cache and never repeats.
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
|
|
948
|
+
/* @__PURE__ */ a(Qe, { value: C, children: /* @__PURE__ */ a(Ie, { containerRef: y, children: /* @__PURE__ */ a(
|
|
949
|
+
Me,
|
|
958
950
|
{
|
|
959
951
|
customTheme: e.themeOptions,
|
|
960
952
|
mode: (P = e.themeOptions) == null ? void 0 : P.mode,
|
|
961
953
|
shadowRootElement: c.current,
|
|
962
|
-
direction:
|
|
963
|
-
children: /* @__PURE__ */
|
|
964
|
-
|
|
954
|
+
direction: f,
|
|
955
|
+
children: /* @__PURE__ */ a(
|
|
956
|
+
ze,
|
|
965
957
|
{
|
|
966
958
|
shadowRootElement: c.current,
|
|
967
959
|
leadPhoneCountryCode: null,
|
|
968
960
|
language: e.language,
|
|
969
961
|
optionsLayout: null,
|
|
970
|
-
direction:
|
|
962
|
+
direction: f,
|
|
971
963
|
children: e.children
|
|
972
964
|
}
|
|
973
965
|
)
|
|
@@ -975,11 +967,11 @@ const ke = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
975
967
|
) }) }, C.key),
|
|
976
968
|
c.current
|
|
977
969
|
) : null;
|
|
978
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ R(ce, { children: [
|
|
979
971
|
x,
|
|
980
|
-
|
|
972
|
+
E
|
|
981
973
|
] });
|
|
982
|
-
}, Je = (e) => /* @__PURE__ */
|
|
974
|
+
}, Je = (e) => /* @__PURE__ */ a(qe, { ...e, children: /* @__PURE__ */ a(Ke, { ...e }) }), ut = Je;
|
|
983
975
|
export {
|
|
984
|
-
|
|
976
|
+
ut as Leaderboard
|
|
985
977
|
};
|