fansunited-frontend-components 0.0.61 → 0.0.63
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.d.ts +1 -1
- package/Betslip.d.ts.map +1 -1
- package/Betslip.js +1 -1
- package/ChanceGame.js +28 -27
- package/ChanceGameComponent.d.ts +1 -1
- package/ChanceGameComponent.d.ts.map +1 -1
- package/ClassicQuizPlay.d.ts +1 -1
- package/ClassicQuizPlay.d.ts.map +1 -1
- package/ClassicQuizPlay.js +23 -22
- package/CollectLead.d.ts +1 -1
- package/CollectLead.d.ts.map +1 -1
- package/CollectLead.js +6 -6
- package/Discussion.d.ts +1 -1
- package/Discussion.d.ts.map +1 -1
- package/Discussion.js +1 -1
- package/EitherOrPlay.d.ts +1 -1
- package/EitherOrPlay.d.ts.map +1 -1
- package/EitherOrPlay.js +27 -25
- package/EventCard.d.ts +5 -0
- package/EventCard.d.ts.map +1 -0
- package/EventGamePlay.d.ts +1 -1
- package/EventGamePlay.d.ts.map +1 -1
- package/EventGamePlay.js +35 -33
- package/Leaderboard.d.ts +1 -1
- package/Leaderboard.d.ts.map +1 -1
- package/Leaderboard.js +335 -331
- package/MatchQuizPlay.d.ts +1 -1
- package/MatchQuizPlay.d.ts.map +1 -1
- package/MatchQuizPlay.js +30 -28
- package/PersonalityQuizPlay.d.ts +1 -1
- package/PersonalityQuizPlay.d.ts.map +1 -1
- package/PersonalityQuizPlay.js +22 -21
- package/PickThePair.js +11 -10
- package/PickThePairComponent.d.ts +1 -1
- package/PickThePairComponent.d.ts.map +1 -1
- package/PollVote.d.ts +1 -1
- package/PollVote.d.ts.map +1 -1
- package/PollVote.js +20 -19
- package/Predictor.d.ts +1 -1
- package/Predictor.d.ts.map +1 -1
- package/Predictor.js +26 -24
- package/README.md +243 -5
- package/Standings.d.ts +5 -0
- package/Standings.d.ts.map +1 -0
- package/Standings.js +1626 -0
- package/TopX.js +29 -25
- package/chunks/{AlertMessage-BL6P8IGY.js → AlertMessage-AyMEW3JL.js} +17 -17
- package/chunks/{ArrowRightAlt-Cv7HlloG.js → ArrowRightAlt-DVXOeIJN.js} +10 -10
- package/chunks/{Avatar-DxI6WjFC.js → Avatar-CBP4sabd.js} +8 -8
- package/chunks/Button-DOVRR2Sy.js +748 -0
- package/chunks/{ChanceGameEmbedVariant-CX6xaIi6.js → ChanceGameEmbedVariant-kBcjiKzu.js} +23 -22
- package/chunks/CheckCircle-ByRrHC2p.js +12 -0
- package/chunks/Chip-DeEjQ2-F.js +363 -0
- package/chunks/{Close-uNT6hIb-.js → Close-CS-wfAnO.js} +1 -1
- package/chunks/{Close-BY4UrWwN.js → Close-CdWk2nDh.js} +1 -1
- package/chunks/{CollectLeadForm-BGqpL_RS.js → CollectLeadForm-DevgGzsO.js} +1492 -1842
- package/chunks/{Divider-BuQemoza.js → Divider-D6QU-XQ5.js} +6 -6
- package/chunks/{Edit-Cx3MCmg0.js → Edit-B2N_Ry9g.js} +41 -40
- package/chunks/{EmojiEvents-CTkNXSCR.js → EmojiEvents-E7Oqv7rk.js} +1 -1
- package/chunks/{FavoriteBorder-ByGJB3_t.js → FavoriteBorder-CguT2h2c.js} +1 -1
- package/chunks/{FormControl-BbMcWOns.js → FormControl-D32DP14w.js} +21 -20
- package/chunks/{FormLabel-BtT3kbwT.js → FormLabel-BYtvETHS.js} +8 -8
- package/chunks/{Input-AE_MIs2X.js → Input-D81KBU9B.js} +9 -9
- package/chunks/{KeyboardArrowDown-uQ27mdjR.js → KeyboardArrowDown-CvGmYfHu.js} +3 -3
- package/chunks/{ModalDialog-ComYpWek.js → ModalDialog-D63x8ebf.js} +57 -56
- package/chunks/{NotFoundSkeleton-CNLtkSd8.js → NotFoundSkeleton-B4r94g0a.js} +90 -88
- package/chunks/{Notification-DhQ49EEM.js → Notification-wXJmjBSg.js} +46 -45
- package/chunks/{OverlayApiErrorSkeleton-C2rA6QrQ.js → OverlayApiErrorSkeleton-DwV9wIov.js} +29 -28
- package/chunks/{OverlayLeadAfterCollection-DTYcL4qZ.js → OverlayLeadAfterCollection-CI5NIwUv.js} +10 -10
- package/chunks/{OverlayScoreStateSkeleton-B6gnpmAb.js → OverlayScoreStateSkeleton-wpxvfC5x.js} +10 -10
- package/chunks/Person-DvjCrwnY.js +8 -0
- package/chunks/{PickOneOfX-0lu9_gyg.js → PickOneOfX-DunXqSn1.js} +211 -210
- package/chunks/{Popper-B8ETzmL_.js → Popper-0XuEHl9i.js} +45 -44
- package/chunks/{Portal-QyPKLDoD.js → Portal-4mtEzZlO.js} +6 -6
- package/chunks/{PrizeCard-C4uB4BtX.js → PrizeCard-CjZXXFx3.js} +4083 -3116
- package/chunks/Select-B_VR6iKu.js +1162 -0
- package/chunks/{Spinner-DN1WtGKZ.js → Spinner-htM_pA9-.js} +2 -2
- package/chunks/{SplitLeadAfterCollection-DciMzUEh.js → SplitLeadAfterCollection-CowadlL1.js} +6 -6
- package/chunks/{Stack-CKYSoY8y.js → Stack-BrwF24Ji.js} +19 -19
- package/chunks/{StandardContentSkeleton-praFw8d5.js → StandardContentSkeleton-Bk0sSsby.js} +1 -1
- package/chunks/{Person-FOtZp8_j.js → Table-OBls_6ml.js} +42 -46
- package/chunks/{Tabs-B0X4JiHF.js → Tabs-DW1eIofJ.js} +23 -23
- package/chunks/{Textarea-DkNFdAAC.js → Textarea-DDJ2mdR3.js} +10 -9
- package/chunks/{TimerOutlined-Dhtg7ugR.js → TimerOutlined-BmAAC-Vi.js} +3 -3
- package/chunks/Typography-DjxaMiey.js +1529 -0
- package/chunks/areArraysEqual-B3mXtHvh.js +6 -0
- package/chunks/{CheckCircle-BdPDdjme.js → createSvgIcon-C-cmTwJ_.js} +44 -51
- package/chunks/{helpers-B7ClL9wI.js → helpers-B7-TtMzO.js} +1 -1
- package/chunks/index-8rxXfewU.js +4 -0
- package/chunks/index-BBrO1Htm.js +845 -0
- package/chunks/{index-BRXNdOZ9.js → index-BqoOC2KB.js} +1 -1
- package/chunks/{main-Co41z5OJ.js → main-Bgyyz19Z.js} +20 -20
- package/chunks/{main-DDbrdN8d.js → main-C8ApxGVj.js} +96 -94
- package/chunks/useControlled-BYdyS7Pn.js +31 -0
- package/chunks/useEventCallback-BpsnMnDw.js +19 -0
- package/chunks/{useForwardedInput-xtVMFYxn.js → useForwardedInput-D2NH4BlT.js} +9 -9
- package/chunks/{useImageVariant-y8lhk_d6.js → useImageVariant-qiW-rMPJ.js} +1 -1
- package/chunks/variantColorInheritance-Bgtz8MKI.js +1175 -0
- package/chunks/{areArraysEqual-DkSw-_2f.js → visuallyHidden-B8J7BVSJ.js} +2 -6
- package/components.d.ts +3 -2
- package/components.d.ts.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +1539 -37
- package/package.json +10 -2
- package/chunks/Button-B_IYd2Jd.js +0 -2271
- package/chunks/Select-U-Jes3gR.js +0 -2327
- package/chunks/index-5MPtbA_r.js +0 -706
- package/chunks/index-D6dx63al.js +0 -4
- package/chunks/useEventCallback-VI3dKPOa.js +0 -47
package/Leaderboard.js
CHANGED
|
@@ -1,116 +1,118 @@
|
|
|
1
1
|
import { jsxs as R, jsx as i, Fragment as se } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { u as D,
|
|
4
|
-
import { a as J } from "./chunks/AlertMessage-
|
|
2
|
+
import z, { useState as B, useEffect as Q, useCallback as pe, useMemo as _ } from "react";
|
|
3
|
+
import { u as D, m as fe, n as me, w as he, a as X, c as ce, b as O, e as j, B as L, j as de, q as ge, i as be, f as ye, C as xe, g as Ce, E as ve, h as Te } from "./chunks/PrizeCard-CjZXXFx3.js";
|
|
4
|
+
import { a as J } from "./chunks/AlertMessage-AyMEW3JL.js";
|
|
5
5
|
import { createPortal as Pe } from "react-dom";
|
|
6
|
-
import { F as Se } from "./chunks/FormLabel-
|
|
7
|
-
import { T as
|
|
8
|
-
import { S as we, a as Re } from "./chunks/Select-
|
|
9
|
-
import {
|
|
10
|
-
import { h as
|
|
11
|
-
import { S as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { F as Se } from "./chunks/FormLabel-BYtvETHS.js";
|
|
7
|
+
import { T as I } from "./chunks/Typography-DjxaMiey.js";
|
|
8
|
+
import { S as we, a as Re } from "./chunks/Select-B_VR6iKu.js";
|
|
9
|
+
import { P as K } from "./chunks/Person-DvjCrwnY.js";
|
|
10
|
+
import { h as U, s as Ee } from "./chunks/helpers-B7-TtMzO.js";
|
|
11
|
+
import { S as Ae } from "./chunks/Spinner-htM_pA9-.js";
|
|
12
|
+
import { S as Ie, T as Le } from "./chunks/Table-OBls_6ml.js";
|
|
13
|
+
import { A as ee } from "./chunks/Avatar-CBP4sabd.js";
|
|
14
|
+
import { I as H, B as te } from "./chunks/Button-DOVRR2Sy.js";
|
|
15
|
+
import { C as Me, a as ze } from "./chunks/chevrons-right-CRIN5sOe.js";
|
|
14
16
|
import { C as Be, a as Fe } from "./chunks/chevron-right-B3IZtaMT.js";
|
|
15
17
|
const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()).join(" "), $e = ({
|
|
16
18
|
options: e,
|
|
17
19
|
selectedId: t,
|
|
18
20
|
onChange: a
|
|
19
21
|
}) => {
|
|
20
|
-
const { t: r } = D(), { shadowRootElement: o } = fe(me),
|
|
22
|
+
const { t: r } = D(), { shadowRootElement: o } = fe(me), b = he(), y = X(), d = ce(), c = O().primary, h = j(), v = y.textColor, u = {
|
|
21
23
|
background: {
|
|
22
|
-
surface:
|
|
23
|
-
popup:
|
|
24
|
+
surface: b.colorSchemes.light.palette.background.surface,
|
|
25
|
+
popup: b.colorSchemes.light.palette.background.popup
|
|
24
26
|
},
|
|
25
27
|
neutral: {
|
|
26
|
-
outlinedBorder:
|
|
27
|
-
outlinedColor:
|
|
28
|
-
outlinedHoverBg:
|
|
29
|
-
plainActiveBg:
|
|
30
|
-
plainHoverBg:
|
|
31
|
-
plainHoverColor:
|
|
28
|
+
outlinedBorder: b.colorSchemes.light.palette.neutral.outlinedBorder,
|
|
29
|
+
outlinedColor: b.colorSchemes.light.palette.neutral.outlinedColor,
|
|
30
|
+
outlinedHoverBg: b.colorSchemes.light.palette.neutral.outlinedHoverBg,
|
|
31
|
+
plainActiveBg: b.colorSchemes.light.palette.neutral.plainActiveBg,
|
|
32
|
+
plainHoverBg: b.colorSchemes.light.palette.neutral.plainHoverBg,
|
|
33
|
+
plainHoverColor: b.colorSchemes.light.palette.neutral.plainHoverColor
|
|
32
34
|
}
|
|
33
|
-
},
|
|
35
|
+
}, x = {
|
|
34
36
|
flexShrink: 0,
|
|
35
|
-
fontFamily:
|
|
37
|
+
fontFamily: c,
|
|
36
38
|
fontSize: "0.65em",
|
|
37
39
|
fontWeight: 600,
|
|
38
40
|
letterSpacing: "0.05em",
|
|
39
41
|
textTransform: "uppercase",
|
|
40
|
-
color:
|
|
41
|
-
bgcolor:
|
|
42
|
-
border: `1px solid ${
|
|
43
|
-
borderRadius:
|
|
44
|
-
px:
|
|
45
|
-
py:
|
|
42
|
+
color: u.neutral.outlinedColor,
|
|
43
|
+
bgcolor: u.neutral.plainHoverBg,
|
|
44
|
+
border: `1px solid ${u.neutral.outlinedBorder}`,
|
|
45
|
+
borderRadius: d.sm,
|
|
46
|
+
px: h["2xs"],
|
|
47
|
+
py: h["3xs"]
|
|
46
48
|
}, E = (C) => /* @__PURE__ */ R(
|
|
47
|
-
|
|
49
|
+
L,
|
|
48
50
|
{
|
|
49
51
|
sx: {
|
|
50
52
|
display: "flex",
|
|
51
53
|
alignItems: "center",
|
|
52
54
|
justifyContent: "space-between",
|
|
53
55
|
width: "100%",
|
|
54
|
-
gap:
|
|
56
|
+
gap: h.sm
|
|
55
57
|
},
|
|
56
58
|
children: [
|
|
57
59
|
/* @__PURE__ */ i("span", { children: C.label }),
|
|
58
|
-
C.type && /* @__PURE__ */ i(
|
|
60
|
+
C.type && /* @__PURE__ */ i(L, { sx: x, children: Ue(C.type) })
|
|
59
61
|
]
|
|
60
62
|
}
|
|
61
|
-
),
|
|
63
|
+
), w = {
|
|
62
64
|
root: {
|
|
63
65
|
sx: {
|
|
64
|
-
fontFamily:
|
|
65
|
-
borderRadius:
|
|
66
|
-
bgcolor:
|
|
67
|
-
borderColor:
|
|
68
|
-
color:
|
|
66
|
+
fontFamily: c,
|
|
67
|
+
borderRadius: d.sm,
|
|
68
|
+
bgcolor: u.background.surface,
|
|
69
|
+
borderColor: u.neutral.outlinedBorder,
|
|
70
|
+
color: u.neutral.outlinedColor,
|
|
69
71
|
fontSize: "1em",
|
|
70
|
-
"&:hover": { bgcolor:
|
|
72
|
+
"&:hover": { bgcolor: u.neutral.outlinedHoverBg }
|
|
71
73
|
}
|
|
72
74
|
},
|
|
73
75
|
listbox: {
|
|
74
76
|
container: o,
|
|
75
77
|
sx: {
|
|
76
78
|
zIndex: 10,
|
|
77
|
-
bgcolor:
|
|
78
|
-
border: `1px solid ${
|
|
79
|
-
borderRadius:
|
|
79
|
+
bgcolor: u.background.popup,
|
|
80
|
+
border: `1px solid ${u.neutral.outlinedBorder}`,
|
|
81
|
+
borderRadius: d.sm,
|
|
80
82
|
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
},
|
|
84
|
-
fontFamily:
|
|
85
|
-
color: `${
|
|
85
|
+
}, p = {
|
|
86
|
+
fontFamily: c,
|
|
87
|
+
color: `${u.neutral.outlinedColor} !important`,
|
|
86
88
|
bgcolor: "transparent",
|
|
87
89
|
"&:hover": {
|
|
88
|
-
bgcolor: `${
|
|
89
|
-
color: `${
|
|
90
|
+
bgcolor: `${u.neutral.plainHoverBg} !important`,
|
|
91
|
+
color: `${u.neutral.plainHoverColor} !important`
|
|
90
92
|
},
|
|
91
93
|
"&.Mui-selected": {
|
|
92
|
-
bgcolor: `${
|
|
93
|
-
color: `${
|
|
94
|
+
bgcolor: `${u.neutral.plainActiveBg} !important`,
|
|
95
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
94
96
|
},
|
|
95
97
|
"&.Mui-selected:hover": {
|
|
96
|
-
bgcolor: `${
|
|
97
|
-
color: `${
|
|
98
|
+
bgcolor: `${u.neutral.plainActiveBg} !important`,
|
|
99
|
+
color: `${u.neutral.outlinedColor} !important`
|
|
98
100
|
}
|
|
99
101
|
};
|
|
100
|
-
return /* @__PURE__ */ R(
|
|
102
|
+
return /* @__PURE__ */ R(L, { sx: { display: "flex", flexDirection: "column", gap: h["2xs"] }, children: [
|
|
101
103
|
/* @__PURE__ */ i(
|
|
102
104
|
Se,
|
|
103
105
|
{
|
|
104
106
|
sx: {
|
|
105
107
|
color: `${v} !important`,
|
|
106
|
-
fontFamily:
|
|
108
|
+
fontFamily: c,
|
|
107
109
|
fontSize: "0.875em"
|
|
108
110
|
},
|
|
109
111
|
children: /* @__PURE__ */ i(
|
|
110
|
-
|
|
112
|
+
I,
|
|
111
113
|
{
|
|
112
114
|
sx: {
|
|
113
|
-
fontFamily:
|
|
115
|
+
fontFamily: c,
|
|
114
116
|
fontSize: "0.875em",
|
|
115
117
|
color: v
|
|
116
118
|
},
|
|
@@ -123,14 +125,14 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
123
125
|
we,
|
|
124
126
|
{
|
|
125
127
|
value: t,
|
|
126
|
-
onChange: (C,
|
|
127
|
-
slotProps:
|
|
128
|
+
onChange: (C, P) => P && a(P),
|
|
129
|
+
slotProps: w,
|
|
128
130
|
renderValue: (C) => {
|
|
129
131
|
if (!C) return null;
|
|
130
|
-
const
|
|
131
|
-
return
|
|
132
|
+
const P = e.find((f) => f.id === C.value);
|
|
133
|
+
return P ? E(P) : C.label;
|
|
132
134
|
},
|
|
133
|
-
children: e.map((C) => /* @__PURE__ */ i(Re, { value: C.id, sx:
|
|
135
|
+
children: e.map((C) => /* @__PURE__ */ i(Re, { value: C.id, sx: p, children: E(C) }, C.id))
|
|
134
136
|
}
|
|
135
137
|
)
|
|
136
138
|
] });
|
|
@@ -140,29 +142,29 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
140
142
|
showHeading: a,
|
|
141
143
|
title: r,
|
|
142
144
|
description: o,
|
|
143
|
-
isSplitVariant:
|
|
145
|
+
isSplitVariant: b,
|
|
144
146
|
brandingColors: y,
|
|
145
|
-
rankStyles:
|
|
147
|
+
rankStyles: d
|
|
146
148
|
}) => {
|
|
147
|
-
const { t:
|
|
149
|
+
const { t: c } = D(), h = de(), v = X(), u = (y == null ? void 0 : y.primaryColor) || v.palette.primary.plainColor, x = (y == null ? void 0 : y.contentColor) || v.textColor, E = v.textColor, w = O().primary, p = O().secondary, C = ce(), P = j(), f = ge(), l = v.surfaceVariant, n = h.colorSchemes.light.palette.primary.onPrimary, m = v.outlineEnabledBorder, s = {
|
|
148
150
|
leaderboardContainer: {
|
|
149
151
|
display: "flex",
|
|
150
152
|
flexDirection: "column",
|
|
151
|
-
gap:
|
|
153
|
+
gap: P.md
|
|
152
154
|
},
|
|
153
155
|
leaderboardTitle: {
|
|
154
|
-
fontFamily:
|
|
156
|
+
fontFamily: w,
|
|
155
157
|
fontWeight: 700,
|
|
156
158
|
lineHeight: "133%",
|
|
157
159
|
letterSpacing: "0px",
|
|
158
160
|
fontSize: "1.5em",
|
|
159
|
-
color:
|
|
161
|
+
color: x,
|
|
160
162
|
textAlign: "center"
|
|
161
163
|
},
|
|
162
164
|
tableContainer: {
|
|
163
165
|
overflowX: "auto",
|
|
164
166
|
borderRadius: C.md,
|
|
165
|
-
border: `1px solid ${
|
|
167
|
+
border: `1px solid ${m}`
|
|
166
168
|
},
|
|
167
169
|
table: {
|
|
168
170
|
backgroundColor: l,
|
|
@@ -173,19 +175,19 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
173
175
|
backgroundColor: "transparent"
|
|
174
176
|
},
|
|
175
177
|
"& > thead > tr > th": {
|
|
176
|
-
backgroundColor: `rgba(${
|
|
177
|
-
color:
|
|
178
|
-
fontFamily:
|
|
178
|
+
backgroundColor: `rgba(${U(l)}, 0.8)`,
|
|
179
|
+
color: x,
|
|
180
|
+
fontFamily: w,
|
|
179
181
|
fontWeight: 600,
|
|
180
182
|
fontSize: "0.875em",
|
|
181
183
|
textAlign: "center",
|
|
182
|
-
borderBottom: `1px solid ${
|
|
184
|
+
borderBottom: `1px solid ${m}`
|
|
183
185
|
}
|
|
184
186
|
},
|
|
185
187
|
headerCellPosition: {
|
|
186
|
-
backgroundColor: `rgba(${
|
|
187
|
-
color:
|
|
188
|
-
fontFamily:
|
|
188
|
+
backgroundColor: `rgba(${U(l)}, 0.8)`,
|
|
189
|
+
color: x,
|
|
190
|
+
fontFamily: w,
|
|
189
191
|
fontWeight: 600,
|
|
190
192
|
fontSize: "0.875em",
|
|
191
193
|
textAlign: "center",
|
|
@@ -193,9 +195,9 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
193
195
|
width: "10%"
|
|
194
196
|
},
|
|
195
197
|
headerCellName: {
|
|
196
|
-
backgroundColor: `rgba(${
|
|
197
|
-
color:
|
|
198
|
-
fontFamily:
|
|
198
|
+
backgroundColor: `rgba(${U(l)}, 0.8)`,
|
|
199
|
+
color: x,
|
|
200
|
+
fontFamily: w,
|
|
199
201
|
fontWeight: 600,
|
|
200
202
|
fontSize: "0.875em",
|
|
201
203
|
textAlign: "left",
|
|
@@ -203,9 +205,9 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
203
205
|
width: "80%"
|
|
204
206
|
},
|
|
205
207
|
headerCellPoints: {
|
|
206
|
-
backgroundColor: `rgba(${
|
|
207
|
-
color:
|
|
208
|
-
fontFamily:
|
|
208
|
+
backgroundColor: `rgba(${U(l)}, 0.8)`,
|
|
209
|
+
color: x,
|
|
210
|
+
fontFamily: w,
|
|
209
211
|
fontWeight: 600,
|
|
210
212
|
fontSize: "0.875em",
|
|
211
213
|
textAlign: "center",
|
|
@@ -227,62 +229,62 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
227
229
|
textAlign: "center"
|
|
228
230
|
},
|
|
229
231
|
userRow: {
|
|
230
|
-
backgroundColor: `rgba(${
|
|
232
|
+
backgroundColor: `rgba(${U(u)}, 0.1)`
|
|
231
233
|
},
|
|
232
234
|
nameCell: {
|
|
233
235
|
display: "flex",
|
|
234
236
|
alignItems: "center",
|
|
235
|
-
gap:
|
|
237
|
+
gap: P.sm
|
|
236
238
|
},
|
|
237
239
|
leaderboardAvatar: {
|
|
238
240
|
width: "32px",
|
|
239
241
|
height: "32px",
|
|
240
242
|
fontSize: "0.875em",
|
|
241
243
|
fontWeight: 600,
|
|
242
|
-
backgroundColor:
|
|
244
|
+
backgroundColor: u,
|
|
243
245
|
color: n
|
|
244
246
|
},
|
|
245
247
|
nameText: {
|
|
246
|
-
fontFamily:
|
|
248
|
+
fontFamily: w,
|
|
247
249
|
fontWeight: 500,
|
|
248
250
|
fontSize: "0.875em",
|
|
249
|
-
color:
|
|
251
|
+
color: x,
|
|
250
252
|
overflow: "hidden",
|
|
251
253
|
textOverflow: "ellipsis",
|
|
252
254
|
whiteSpace: "nowrap"
|
|
253
255
|
},
|
|
254
256
|
positionText: {
|
|
255
|
-
fontFamily:
|
|
257
|
+
fontFamily: w,
|
|
256
258
|
fontWeight: 600,
|
|
257
259
|
fontSize: "0.875em",
|
|
258
|
-
color:
|
|
260
|
+
color: x
|
|
259
261
|
},
|
|
260
262
|
pointsText: {
|
|
261
|
-
fontFamily:
|
|
263
|
+
fontFamily: w,
|
|
262
264
|
fontWeight: 600,
|
|
263
265
|
fontSize: "0.875em",
|
|
264
|
-
color:
|
|
266
|
+
color: x
|
|
265
267
|
},
|
|
266
268
|
avatarIcon: {
|
|
267
269
|
fontSize: "1em",
|
|
268
270
|
color: n
|
|
269
271
|
},
|
|
270
272
|
noLeaderboardText: {
|
|
271
|
-
fontFamily:
|
|
273
|
+
fontFamily: p,
|
|
272
274
|
fontSize: "1.25em",
|
|
273
|
-
color:
|
|
275
|
+
color: x,
|
|
274
276
|
textAlign: "center",
|
|
275
|
-
marginY:
|
|
277
|
+
marginY: P.md
|
|
276
278
|
}
|
|
277
279
|
};
|
|
278
280
|
if (!e)
|
|
279
|
-
return /* @__PURE__ */ i(
|
|
281
|
+
return /* @__PURE__ */ i(Ae, { my: 10 });
|
|
280
282
|
if (e.length === 0)
|
|
281
|
-
return /* @__PURE__ */ i(
|
|
282
|
-
const
|
|
283
|
-
return /* @__PURE__ */ R(
|
|
283
|
+
return /* @__PURE__ */ i(I, { level: "body-lg", sx: s.noLeaderboardText, children: c("leaderboard.noLeaderboardAvailable") });
|
|
284
|
+
const T = t, S = T == null ? void 0 : T.profileId, F = S && e.some((g) => g.profileId === S);
|
|
285
|
+
return /* @__PURE__ */ R(L, { sx: s.leaderboardContainer, children: [
|
|
284
286
|
a && /* @__PURE__ */ R(
|
|
285
|
-
|
|
287
|
+
L,
|
|
286
288
|
{
|
|
287
289
|
sx: {
|
|
288
290
|
display: "flex",
|
|
@@ -292,7 +294,7 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
292
294
|
},
|
|
293
295
|
children: [
|
|
294
296
|
/* @__PURE__ */ i(
|
|
295
|
-
|
|
297
|
+
I,
|
|
296
298
|
{
|
|
297
299
|
level: "body-sm",
|
|
298
300
|
sx: {
|
|
@@ -303,23 +305,23 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
303
305
|
fontSize: "0.75em",
|
|
304
306
|
color: E,
|
|
305
307
|
opacity: "60%",
|
|
306
|
-
fontFamily:
|
|
308
|
+
fontFamily: p
|
|
307
309
|
},
|
|
308
|
-
children:
|
|
310
|
+
children: c("leaderboard.heading")
|
|
309
311
|
}
|
|
310
312
|
),
|
|
311
313
|
/* @__PURE__ */ R(
|
|
312
|
-
|
|
314
|
+
L,
|
|
313
315
|
{
|
|
314
316
|
sx: {
|
|
315
317
|
display: "flex",
|
|
316
318
|
flexDirection: "column",
|
|
317
|
-
gap:
|
|
319
|
+
gap: P["3xs"]
|
|
318
320
|
},
|
|
319
321
|
children: [
|
|
320
|
-
r && /* @__PURE__ */ i(
|
|
322
|
+
r && /* @__PURE__ */ i(I, { level: "h4", sx: s.leaderboardTitle, children: r }),
|
|
321
323
|
o && /* @__PURE__ */ i(
|
|
322
|
-
|
|
324
|
+
I,
|
|
323
325
|
{
|
|
324
326
|
sx: {
|
|
325
327
|
fontWeight: 400,
|
|
@@ -328,9 +330,9 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
328
330
|
fontSize: "1.25em",
|
|
329
331
|
color: E,
|
|
330
332
|
opacity: "60%",
|
|
331
|
-
fontFamily:
|
|
333
|
+
fontFamily: w
|
|
332
334
|
},
|
|
333
|
-
children:
|
|
335
|
+
children: Ee(o)
|
|
334
336
|
}
|
|
335
337
|
)
|
|
336
338
|
]
|
|
@@ -339,8 +341,8 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
339
341
|
]
|
|
340
342
|
}
|
|
341
343
|
),
|
|
342
|
-
/* @__PURE__ */ i(
|
|
343
|
-
|
|
344
|
+
/* @__PURE__ */ i(Ie, { sx: s.tableContainer, children: /* @__PURE__ */ R(
|
|
345
|
+
Le,
|
|
344
346
|
{
|
|
345
347
|
variant: "outlined",
|
|
346
348
|
hoverRow: !1,
|
|
@@ -349,43 +351,43 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
349
351
|
sx: s.table,
|
|
350
352
|
children: [
|
|
351
353
|
/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ R("tr", { children: [
|
|
352
|
-
/* @__PURE__ */ i("th", { style: s.headerCellPosition, children:
|
|
353
|
-
/* @__PURE__ */ i("th", { style: s.headerCellName, children:
|
|
354
|
-
/* @__PURE__ */ i("th", { style: s.headerCellPoints, children:
|
|
354
|
+
/* @__PURE__ */ i("th", { style: s.headerCellPosition, children: f || b ? "" : c("leaderboard.position") }),
|
|
355
|
+
/* @__PURE__ */ i("th", { style: s.headerCellName, children: c("leaderboard.name") }),
|
|
356
|
+
/* @__PURE__ */ i("th", { style: s.headerCellPoints, children: f || b ? "🎯" : c("leaderboard.points") })
|
|
355
357
|
] }) }),
|
|
356
358
|
/* @__PURE__ */ R("tbody", { children: [
|
|
357
|
-
|
|
358
|
-
/* @__PURE__ */ i("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(
|
|
359
|
+
T && !F && /* @__PURE__ */ R("tr", { style: s.userRow, children: [
|
|
360
|
+
/* @__PURE__ */ i("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(I, { sx: s.positionText, children: [
|
|
359
361
|
"#",
|
|
360
|
-
|
|
362
|
+
T.position
|
|
361
363
|
] }) }),
|
|
362
|
-
/* @__PURE__ */ i("td", { style: s.tableCellName, children: /* @__PURE__ */ R(
|
|
363
|
-
/* @__PURE__ */ i(
|
|
364
|
-
/* @__PURE__ */ i(
|
|
364
|
+
/* @__PURE__ */ i("td", { style: s.tableCellName, children: /* @__PURE__ */ R(L, { sx: s.nameCell, children: [
|
|
365
|
+
/* @__PURE__ */ i(ee, { sx: s.leaderboardAvatar, children: /* @__PURE__ */ i(K, { sx: s.avatarIcon }) }),
|
|
366
|
+
/* @__PURE__ */ i(I, { sx: s.nameText, children: c("leaderboard.you") })
|
|
365
367
|
] }) }),
|
|
366
|
-
/* @__PURE__ */ i("td", { style: s.tableCellPoints, children: /* @__PURE__ */ i(
|
|
368
|
+
/* @__PURE__ */ i("td", { style: s.tableCellPoints, children: /* @__PURE__ */ i(I, { sx: s.pointsText, children: T.points }) })
|
|
367
369
|
] }),
|
|
368
|
-
e.map((
|
|
370
|
+
e.map((g, A) => {
|
|
369
371
|
var N, V, Y, q;
|
|
370
|
-
const
|
|
372
|
+
const M = S === g.profileId, ue = M ? s.userRow : d == null ? void 0 : d[A + 1];
|
|
371
373
|
return /* @__PURE__ */ R("tr", { style: ue, children: [
|
|
372
|
-
/* @__PURE__ */ i("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(
|
|
374
|
+
/* @__PURE__ */ i("td", { style: s.tableCellPosition, children: /* @__PURE__ */ R(I, { sx: s.positionText, children: [
|
|
373
375
|
"#",
|
|
374
|
-
|
|
376
|
+
g.position
|
|
375
377
|
] }) }),
|
|
376
|
-
/* @__PURE__ */ i("td", { style: s.tableCellName, children: /* @__PURE__ */ R(
|
|
378
|
+
/* @__PURE__ */ i("td", { style: s.tableCellName, children: /* @__PURE__ */ R(L, { sx: s.nameCell, children: [
|
|
377
379
|
/* @__PURE__ */ i(
|
|
378
|
-
|
|
380
|
+
ee,
|
|
379
381
|
{
|
|
380
|
-
src: ((N =
|
|
382
|
+
src: ((N = g.profileModel) == null ? void 0 : N.avatar) || void 0,
|
|
381
383
|
sx: s.leaderboardAvatar,
|
|
382
|
-
children: (V =
|
|
384
|
+
children: (V = g.profileModel) != null && V.avatar ? /* @__PURE__ */ i(se, {}) : /* @__PURE__ */ i(K, { sx: s.avatarIcon })
|
|
383
385
|
}
|
|
384
386
|
),
|
|
385
|
-
/* @__PURE__ */ i(
|
|
387
|
+
/* @__PURE__ */ i(I, { sx: s.nameText, children: M ? c("leaderboard.you") : ((Y = g.profileModel) == null ? void 0 : Y.nickname) || ((q = g.profileModel) == null ? void 0 : q.name) || c("leaderboard.anonymous") })
|
|
386
388
|
] }) }),
|
|
387
|
-
/* @__PURE__ */ i("td", { style: s.tableCellPoints, children: /* @__PURE__ */ i(
|
|
388
|
-
] },
|
|
389
|
+
/* @__PURE__ */ i("td", { style: s.tableCellPoints, children: /* @__PURE__ */ i(I, { sx: s.pointsText, children: g.points }) })
|
|
390
|
+
] }, g.profileId);
|
|
389
391
|
})
|
|
390
392
|
] })
|
|
391
393
|
]
|
|
@@ -398,33 +400,33 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
398
400
|
onChange: a,
|
|
399
401
|
siblingCount: r = 1,
|
|
400
402
|
boundaryCount: o = 1,
|
|
401
|
-
showFirstButton:
|
|
403
|
+
showFirstButton: b = !0,
|
|
402
404
|
showLastButton: y = !0,
|
|
403
|
-
size:
|
|
404
|
-
disabled:
|
|
405
|
-
isOverlayVariant:
|
|
405
|
+
size: d = "md",
|
|
406
|
+
disabled: c = !1,
|
|
407
|
+
isOverlayVariant: h = !1
|
|
406
408
|
}) => {
|
|
407
|
-
const v = de(),
|
|
409
|
+
const v = de(), u = (l) => {
|
|
408
410
|
a && l >= 1 && l <= e && a(l);
|
|
409
|
-
},
|
|
410
|
-
const
|
|
411
|
-
for (let s = l; s <= n; s++)
|
|
412
|
-
return
|
|
413
|
-
},
|
|
411
|
+
}, x = (l, n) => {
|
|
412
|
+
const m = [];
|
|
413
|
+
for (let s = l; s <= n; s++) m.push(s);
|
|
414
|
+
return m;
|
|
415
|
+
}, w = (() => {
|
|
414
416
|
if (e <= 0) return [];
|
|
415
|
-
const l =
|
|
417
|
+
const l = x(1, Math.min(o, e)), n = x(
|
|
416
418
|
Math.max(e - o + 1, o + 1),
|
|
417
419
|
e
|
|
418
|
-
),
|
|
419
|
-
if (
|
|
420
|
-
for (let
|
|
421
|
-
|
|
422
|
-
s < e - o &&
|
|
423
|
-
for (const
|
|
424
|
-
|
|
425
|
-
return
|
|
426
|
-
})(),
|
|
427
|
-
if (!
|
|
420
|
+
), m = Math.max(o + 1, t - r), s = Math.min(e - o, t + r), T = [...l];
|
|
421
|
+
if (m > o + 1 && T.push("ellipsis-start"), m <= s)
|
|
422
|
+
for (let S = m; S <= s; S++)
|
|
423
|
+
T.push(S);
|
|
424
|
+
s < e - o && T.push("ellipsis-end");
|
|
425
|
+
for (const S of n)
|
|
426
|
+
T.includes(S) || T.push(S);
|
|
427
|
+
return T;
|
|
428
|
+
})(), p = d === "sm" ? "sm" : d === "lg" ? "lg" : "md", C = d === "sm" ? 16 : d === "lg" ? 24 : 20, P = (l = !1) => {
|
|
429
|
+
if (!h)
|
|
428
430
|
return {
|
|
429
431
|
borderRadius: "8px",
|
|
430
432
|
minWidth: "32px",
|
|
@@ -453,8 +455,8 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
453
455
|
opacity: 0.5
|
|
454
456
|
}
|
|
455
457
|
};
|
|
456
|
-
},
|
|
457
|
-
if (!
|
|
458
|
+
}, f = () => {
|
|
459
|
+
if (!h)
|
|
458
460
|
return {
|
|
459
461
|
borderRadius: "8px",
|
|
460
462
|
minWidth: "32px",
|
|
@@ -483,7 +485,7 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
483
485
|
};
|
|
484
486
|
};
|
|
485
487
|
return /* @__PURE__ */ R(
|
|
486
|
-
|
|
488
|
+
L,
|
|
487
489
|
{
|
|
488
490
|
sx: {
|
|
489
491
|
display: "flex",
|
|
@@ -492,43 +494,43 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
492
494
|
flexWrap: "wrap"
|
|
493
495
|
},
|
|
494
496
|
children: [
|
|
495
|
-
|
|
496
|
-
|
|
497
|
+
b && /* @__PURE__ */ i(
|
|
498
|
+
H,
|
|
497
499
|
{
|
|
498
|
-
size:
|
|
500
|
+
size: p,
|
|
499
501
|
variant: "plain",
|
|
500
502
|
color: "neutral",
|
|
501
|
-
onClick: () =>
|
|
502
|
-
disabled:
|
|
503
|
-
sx:
|
|
504
|
-
children: /* @__PURE__ */ i(
|
|
503
|
+
onClick: () => u(1),
|
|
504
|
+
disabled: c || t === 1,
|
|
505
|
+
sx: f(),
|
|
506
|
+
children: /* @__PURE__ */ i(Me, { size: C })
|
|
505
507
|
}
|
|
506
508
|
),
|
|
507
509
|
/* @__PURE__ */ i(
|
|
508
|
-
|
|
510
|
+
H,
|
|
509
511
|
{
|
|
510
|
-
size:
|
|
512
|
+
size: p,
|
|
511
513
|
variant: "plain",
|
|
512
514
|
color: "neutral",
|
|
513
|
-
onClick: () =>
|
|
514
|
-
disabled:
|
|
515
|
-
sx:
|
|
515
|
+
onClick: () => u(t - 1),
|
|
516
|
+
disabled: c || t === 1,
|
|
517
|
+
sx: f(),
|
|
516
518
|
children: /* @__PURE__ */ i(Be, { size: C })
|
|
517
519
|
}
|
|
518
520
|
),
|
|
519
|
-
|
|
521
|
+
w.map((l, n) => {
|
|
520
522
|
if (typeof l == "string" && l.startsWith("ellipsis"))
|
|
521
523
|
return /* @__PURE__ */ i(
|
|
522
|
-
|
|
524
|
+
te,
|
|
523
525
|
{
|
|
524
|
-
size:
|
|
526
|
+
size: p,
|
|
525
527
|
variant: "plain",
|
|
526
528
|
color: "neutral",
|
|
527
529
|
disabled: !0,
|
|
528
530
|
sx: {
|
|
529
|
-
...
|
|
531
|
+
...P(!1),
|
|
530
532
|
cursor: "default",
|
|
531
|
-
"&.Mui-disabled":
|
|
533
|
+
"&.Mui-disabled": h ? {
|
|
532
534
|
backgroundColor: "transparent",
|
|
533
535
|
color: v.colorSchemes.dark.textDisabled,
|
|
534
536
|
opacity: 0.5
|
|
@@ -541,49 +543,49 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
541
543
|
},
|
|
542
544
|
`${l}-${n}`
|
|
543
545
|
);
|
|
544
|
-
const
|
|
546
|
+
const m = l === t;
|
|
545
547
|
return /* @__PURE__ */ i(
|
|
546
|
-
|
|
548
|
+
te,
|
|
547
549
|
{
|
|
548
|
-
size:
|
|
549
|
-
variant:
|
|
550
|
+
size: p,
|
|
551
|
+
variant: m ? "solid" : "plain",
|
|
550
552
|
color: "neutral",
|
|
551
|
-
onClick: () =>
|
|
552
|
-
disabled:
|
|
553
|
-
sx:
|
|
553
|
+
onClick: () => u(l),
|
|
554
|
+
disabled: c,
|
|
555
|
+
sx: P(m),
|
|
554
556
|
children: l
|
|
555
557
|
},
|
|
556
558
|
l
|
|
557
559
|
);
|
|
558
560
|
}),
|
|
559
561
|
/* @__PURE__ */ i(
|
|
560
|
-
|
|
562
|
+
H,
|
|
561
563
|
{
|
|
562
|
-
size:
|
|
564
|
+
size: p,
|
|
563
565
|
variant: "plain",
|
|
564
566
|
color: "neutral",
|
|
565
|
-
onClick: () =>
|
|
566
|
-
disabled:
|
|
567
|
-
sx:
|
|
567
|
+
onClick: () => u(t + 1),
|
|
568
|
+
disabled: c || t === e,
|
|
569
|
+
sx: f(),
|
|
568
570
|
children: /* @__PURE__ */ i(Fe, { size: C })
|
|
569
571
|
}
|
|
570
572
|
),
|
|
571
573
|
y && /* @__PURE__ */ i(
|
|
572
|
-
|
|
574
|
+
H,
|
|
573
575
|
{
|
|
574
|
-
size:
|
|
576
|
+
size: p,
|
|
575
577
|
variant: "plain",
|
|
576
578
|
color: "neutral",
|
|
577
|
-
onClick: () =>
|
|
578
|
-
disabled:
|
|
579
|
-
sx:
|
|
580
|
-
children: /* @__PURE__ */ i(
|
|
579
|
+
onClick: () => u(e),
|
|
580
|
+
disabled: c || t === e,
|
|
581
|
+
sx: f(),
|
|
582
|
+
children: /* @__PURE__ */ i(ze, { size: C })
|
|
581
583
|
}
|
|
582
584
|
)
|
|
583
585
|
]
|
|
584
586
|
}
|
|
585
587
|
);
|
|
586
|
-
},
|
|
588
|
+
}, $ = "ALL", G = (e) => ({
|
|
587
589
|
currentPage: e.currentPage,
|
|
588
590
|
totalPages: e.numberOfPages,
|
|
589
591
|
totalItems: e.totalItems,
|
|
@@ -638,7 +640,7 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
638
640
|
const o = await t.loyalty.getLeaderboardForGame(e, { page: a, limit: r });
|
|
639
641
|
return {
|
|
640
642
|
leaderboard: Z(o.data),
|
|
641
|
-
pagination:
|
|
643
|
+
pagination: G(o.meta.pagination)
|
|
642
644
|
};
|
|
643
645
|
}, Oe = async (e, t, a, r) => {
|
|
644
646
|
const o = await t.loyalty.getLeaderboard(
|
|
@@ -647,7 +649,7 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
647
649
|
);
|
|
648
650
|
return {
|
|
649
651
|
leaderboard: Z(o.data),
|
|
650
|
-
pagination:
|
|
652
|
+
pagination: G(o.meta.pagination)
|
|
651
653
|
};
|
|
652
654
|
}, W = async (e, t, a, r) => {
|
|
653
655
|
const o = await t.miniGames.getLeaderboardForClassicQuizzes({
|
|
@@ -657,162 +659,162 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
657
659
|
});
|
|
658
660
|
return {
|
|
659
661
|
leaderboard: Z(o.data),
|
|
660
|
-
pagination:
|
|
662
|
+
pagination: G(o.meta.pagination)
|
|
661
663
|
};
|
|
662
664
|
}, le = (e, t, a, r) => {
|
|
663
665
|
const o = e.type.toUpperCase();
|
|
664
666
|
return o === "TOP_X" || o === "MATCH_QUIZ" ? _e(e.id, t, a, r) : o === "TEMPLATE" ? Oe(e.id, t, a, r) : W([e.id], t, a, r);
|
|
665
667
|
}, We = async (e, t, a) => {
|
|
666
|
-
const o = a.toUpperCase() === "TEMPLATE" ? { rankType: "TEMPLATE", leaderboardIds: [e] } : { rankType: "GAME", gameType: a.toUpperCase(), leaderboardIds: [e] },
|
|
667
|
-
return
|
|
668
|
-
position:
|
|
669
|
-
profileId:
|
|
670
|
-
profileModel:
|
|
671
|
-
points:
|
|
668
|
+
const o = a.toUpperCase() === "TEMPLATE" ? { rankType: "TEMPLATE", leaderboardIds: [e] } : { rankType: "GAME", gameType: a.toUpperCase(), leaderboardIds: [e] }, d = (await t.loyalty.getOwnRankings(o, !0)).data[0] ?? null;
|
|
669
|
+
return d ? {
|
|
670
|
+
position: d.position,
|
|
671
|
+
profileId: d.profileId,
|
|
672
|
+
profileModel: d.profileModel,
|
|
673
|
+
points: d.points
|
|
672
674
|
} : null;
|
|
673
675
|
}, De = async (e, t, a) => {
|
|
674
|
-
const
|
|
676
|
+
const b = (await t.miniGames.getClassicQuizzesUserRanking(
|
|
675
677
|
a,
|
|
676
678
|
void 0,
|
|
677
679
|
!0
|
|
678
680
|
)).data.find((y) => y.classicQuizId === e) ?? null;
|
|
679
|
-
return
|
|
680
|
-
position:
|
|
681
|
+
return b ? {
|
|
682
|
+
position: b.position,
|
|
681
683
|
profileId: a,
|
|
682
684
|
profileModel: null,
|
|
683
|
-
points:
|
|
685
|
+
points: b.points
|
|
684
686
|
} : null;
|
|
685
687
|
}, Xe = (e, t, a) => {
|
|
686
688
|
const r = e.type.toUpperCase();
|
|
687
689
|
return r === "TOP_X" || r === "MATCH_QUIZ" || r === "TEMPLATE" ? We(e.id, t, e.type) : De(e.id, t, a);
|
|
688
|
-
},
|
|
689
|
-
const [o,
|
|
690
|
+
}, je = (e, t, a, r = 10) => {
|
|
691
|
+
const [o, b] = B({}), [y, d] = B(null), [c, h] = B(!1), [v, u] = B(!1), [x, E] = B(
|
|
690
692
|
null
|
|
691
|
-
), [
|
|
692
|
-
|
|
693
|
-
const
|
|
693
|
+
), [w, p] = B(null);
|
|
694
|
+
Q(() => {
|
|
695
|
+
const f = {
|
|
694
696
|
topX: e.filter((n) => n.type.toUpperCase() === "TOP_X").map((n) => n.id),
|
|
695
697
|
matchQuiz: e.filter((n) => n.type.toUpperCase() === "MATCH_QUIZ").map((n) => n.id),
|
|
696
698
|
template: e.filter((n) => n.type.toUpperCase() === "TEMPLATE").map((n) => n.id),
|
|
697
699
|
classicQuiz: e.filter((n) => n.type.toUpperCase() === "CLASSIC_QUIZ").map((n) => n.id)
|
|
698
700
|
}, l = (n) => n.catch(() => []);
|
|
699
701
|
Promise.all([
|
|
700
|
-
l(re(
|
|
701
|
-
l(oe(
|
|
702
|
-
l(ne(
|
|
703
|
-
l(ae(
|
|
702
|
+
l(re(f.topX, t)),
|
|
703
|
+
l(oe(f.matchQuiz, t)),
|
|
704
|
+
l(ne(f.template, t)),
|
|
705
|
+
l(ae(f.classicQuiz, t))
|
|
704
706
|
]).then((n) => {
|
|
705
|
-
const
|
|
707
|
+
const m = {};
|
|
706
708
|
n.flat().forEach((s) => {
|
|
707
|
-
|
|
708
|
-
}),
|
|
709
|
+
m[s.id] = s;
|
|
710
|
+
}), b(m);
|
|
709
711
|
});
|
|
710
|
-
}, [e, t]),
|
|
712
|
+
}, [e, t]), Q(() => {
|
|
711
713
|
ke(t).then(E);
|
|
712
|
-
}, [t]),
|
|
713
|
-
if (!a || !
|
|
714
|
-
|
|
714
|
+
}, [t]), Q(() => {
|
|
715
|
+
if (!a || !x) {
|
|
716
|
+
p(null);
|
|
715
717
|
return;
|
|
716
718
|
}
|
|
717
|
-
let
|
|
718
|
-
if (a ===
|
|
719
|
-
const n = e.map((
|
|
720
|
-
l = t.miniGames.getClassicQuizzesUserRanking(
|
|
721
|
-
const
|
|
722
|
-
return
|
|
723
|
-
position:
|
|
724
|
-
profileId:
|
|
719
|
+
let f = !1, l;
|
|
720
|
+
if (a === $) {
|
|
721
|
+
const n = e.map((m) => m.id);
|
|
722
|
+
l = t.miniGames.getClassicQuizzesUserRanking(x.id, void 0, !0).then((m) => {
|
|
723
|
+
const T = m.data.find((S) => n.includes(S.classicQuizId)) ?? null;
|
|
724
|
+
return T ? {
|
|
725
|
+
position: T.position,
|
|
726
|
+
profileId: x.id,
|
|
725
727
|
profileModel: null,
|
|
726
|
-
points:
|
|
728
|
+
points: T.points
|
|
727
729
|
} : null;
|
|
728
730
|
});
|
|
729
731
|
} else {
|
|
730
|
-
const n = e.find((
|
|
732
|
+
const n = e.find((m) => m.id === a);
|
|
731
733
|
if (!n) return;
|
|
732
|
-
l = Xe(n, t,
|
|
734
|
+
l = Xe(n, t, x.id);
|
|
733
735
|
}
|
|
734
736
|
return l.then((n) => {
|
|
735
|
-
|
|
737
|
+
f || p(n);
|
|
736
738
|
}).catch(() => {
|
|
737
|
-
|
|
739
|
+
f || p(null);
|
|
738
740
|
}), () => {
|
|
739
|
-
|
|
741
|
+
f = !0;
|
|
740
742
|
};
|
|
741
|
-
}, [a, e, t,
|
|
743
|
+
}, [a, e, t, x]), Q(() => {
|
|
742
744
|
if (!a) return;
|
|
743
|
-
let
|
|
744
|
-
return
|
|
745
|
+
let f = !1;
|
|
746
|
+
return h(!0), u(!1), d(null), (async () => {
|
|
745
747
|
try {
|
|
746
|
-
const n = e.length > 1 && e.every((
|
|
747
|
-
if (a ===
|
|
748
|
-
const
|
|
749
|
-
|
|
748
|
+
const n = e.length > 1 && e.every((g) => g.type.toUpperCase() === "CLASSIC_QUIZ");
|
|
749
|
+
if (a === $ && n) {
|
|
750
|
+
const g = e.map((M) => M.id), A = await W(
|
|
751
|
+
g,
|
|
750
752
|
t,
|
|
751
753
|
1,
|
|
752
754
|
r
|
|
753
755
|
);
|
|
754
|
-
|
|
755
|
-
id:
|
|
756
|
-
title:
|
|
756
|
+
f || d({
|
|
757
|
+
id: $,
|
|
758
|
+
title: $,
|
|
757
759
|
description: null,
|
|
758
760
|
branding: null,
|
|
759
|
-
...
|
|
761
|
+
...A
|
|
760
762
|
});
|
|
761
763
|
return;
|
|
762
764
|
}
|
|
763
|
-
const
|
|
764
|
-
if (!
|
|
765
|
-
const s =
|
|
766
|
-
le(
|
|
767
|
-
|
|
765
|
+
const m = e.find((g) => g.id === a);
|
|
766
|
+
if (!m) return;
|
|
767
|
+
const s = m.type.toUpperCase(), T = s === "TOP_X" ? re([a], t) : s === "MATCH_QUIZ" ? oe([a], t) : s === "TEMPLATE" ? ne([a], t) : ae([a], t), [S, F] = await Promise.all([
|
|
768
|
+
le(m, t, 1, r),
|
|
769
|
+
T.catch(() => [])
|
|
768
770
|
]);
|
|
769
|
-
if (!
|
|
770
|
-
const
|
|
771
|
-
|
|
771
|
+
if (!f) {
|
|
772
|
+
const g = F[0];
|
|
773
|
+
d({
|
|
772
774
|
id: a,
|
|
773
|
-
title: (
|
|
774
|
-
description: (
|
|
775
|
-
branding: (
|
|
776
|
-
...
|
|
775
|
+
title: (g == null ? void 0 : g.title) || a,
|
|
776
|
+
description: (g == null ? void 0 : g.description) || null,
|
|
777
|
+
branding: (g == null ? void 0 : g.branding) || null,
|
|
778
|
+
...S
|
|
777
779
|
});
|
|
778
780
|
}
|
|
779
781
|
} catch (n) {
|
|
780
|
-
console.error("Failed to fetch leaderboard:", n),
|
|
782
|
+
console.error("Failed to fetch leaderboard:", n), f || u(!0);
|
|
781
783
|
} finally {
|
|
782
|
-
|
|
784
|
+
f || h(!1);
|
|
783
785
|
}
|
|
784
786
|
})(), () => {
|
|
785
|
-
|
|
787
|
+
f = !0;
|
|
786
788
|
};
|
|
787
789
|
}, [a, e, t, r]);
|
|
788
790
|
const C = pe(
|
|
789
|
-
async (
|
|
791
|
+
async (f) => {
|
|
790
792
|
if (a) {
|
|
791
|
-
|
|
793
|
+
h(!0);
|
|
792
794
|
try {
|
|
793
795
|
let l;
|
|
794
|
-
if (a ===
|
|
795
|
-
const n = e.map((
|
|
796
|
-
l = await W(n, t,
|
|
796
|
+
if (a === $) {
|
|
797
|
+
const n = e.map((m) => m.id);
|
|
798
|
+
l = await W(n, t, f, r);
|
|
797
799
|
} else {
|
|
798
|
-
const n = e.find((
|
|
800
|
+
const n = e.find((m) => m.id === a);
|
|
799
801
|
if (!n) return;
|
|
800
|
-
l = await le(n, t,
|
|
802
|
+
l = await le(n, t, f, r);
|
|
801
803
|
}
|
|
802
|
-
|
|
804
|
+
d((n) => n ? { ...n, ...l } : null);
|
|
803
805
|
} catch (l) {
|
|
804
806
|
console.error("Failed to fetch page:", l);
|
|
805
807
|
} finally {
|
|
806
|
-
|
|
808
|
+
h(!1);
|
|
807
809
|
}
|
|
808
810
|
}
|
|
809
811
|
},
|
|
810
812
|
[a, e, t, r]
|
|
811
|
-
),
|
|
812
|
-
Object.entries(o).map(([
|
|
813
|
+
), P = Object.fromEntries(
|
|
814
|
+
Object.entries(o).map(([f, l]) => [f, l.title])
|
|
813
815
|
);
|
|
814
|
-
return { data: y, entityTitles:
|
|
815
|
-
},
|
|
816
|
+
return { data: y, entityTitles: P, loading: c, error: v, setPage: C, userRank: w };
|
|
817
|
+
}, k = "ALL", ie = ["TOP_X", "MATCH_QUIZ", "TEMPLATE", "CLASSIC_QUIZ"], Ge = (e, t) => {
|
|
816
818
|
if (!Array.isArray(e) || e.length === 0)
|
|
817
819
|
return "The 'entities' setting is required and must be a non-empty array.";
|
|
818
820
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -834,43 +836,45 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
834
836
|
entities: e,
|
|
835
837
|
sdk: t,
|
|
836
838
|
pageSize: a,
|
|
837
|
-
rankStyles: r
|
|
839
|
+
rankStyles: r,
|
|
840
|
+
showOverallOnly: o = !1,
|
|
841
|
+
showHeading: b = !0
|
|
838
842
|
}) => {
|
|
839
|
-
var
|
|
840
|
-
const { t:
|
|
841
|
-
() =>
|
|
843
|
+
var g;
|
|
844
|
+
const { t: y } = D(), d = j(), c = X().surface, h = _(
|
|
845
|
+
() => Ge(e, a),
|
|
842
846
|
[e, a]
|
|
843
|
-
),
|
|
844
|
-
() => !
|
|
845
|
-
[e,
|
|
846
|
-
), x =
|
|
847
|
-
|
|
848
|
-
|
|
847
|
+
), v = _(
|
|
848
|
+
() => !h && e.length > 1 && e.every((A) => A.type.toUpperCase() === "CLASSIC_QUIZ"),
|
|
849
|
+
[e, h]
|
|
850
|
+
), u = o && v, x = v ? k : ((g = e[0]) == null ? void 0 : g.id) || "", [E, w] = B(x);
|
|
851
|
+
Q(() => {
|
|
852
|
+
E === k || e.some((M) => M.id === E) || w(x);
|
|
849
853
|
}, [e]);
|
|
850
|
-
const { data:
|
|
851
|
-
|
|
854
|
+
const { data: p, entityTitles: C, loading: P, error: f, setPage: l, userRank: n } = je(
|
|
855
|
+
h ? [] : e,
|
|
852
856
|
t,
|
|
853
|
-
|
|
857
|
+
h ? "" : E,
|
|
854
858
|
a
|
|
855
|
-
), m =
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
return
|
|
859
|
-
|
|
860
|
-
id:
|
|
861
|
-
label:
|
|
862
|
-
type:
|
|
859
|
+
), m = _(() => {
|
|
860
|
+
if (h) return [];
|
|
861
|
+
const A = [];
|
|
862
|
+
return v && A.push({ id: k, label: y("leaderboard.overall") }), e.forEach((M) => {
|
|
863
|
+
A.push({
|
|
864
|
+
id: M.id,
|
|
865
|
+
label: C[M.id] ?? "",
|
|
866
|
+
type: M.type.toUpperCase()
|
|
863
867
|
});
|
|
864
|
-
}),
|
|
865
|
-
}, [e,
|
|
866
|
-
return
|
|
868
|
+
}), A;
|
|
869
|
+
}, [e, v, y, C, h]), s = e.every((A) => C[A.id] !== void 0), T = !h && !u && (e.length > 1 || v) && s, S = (p == null ? void 0 : p.pagination) || null, F = E === k ? y("leaderboard.overall") : (p == null ? void 0 : p.title) || null;
|
|
870
|
+
return h ? /* @__PURE__ */ i(
|
|
867
871
|
J,
|
|
868
872
|
{
|
|
869
873
|
variant: "error",
|
|
870
874
|
title: "Configuration Error",
|
|
871
|
-
message:
|
|
875
|
+
message: h
|
|
872
876
|
}
|
|
873
|
-
) :
|
|
877
|
+
) : f ? /* @__PURE__ */ i(
|
|
874
878
|
J,
|
|
875
879
|
{
|
|
876
880
|
variant: "error",
|
|
@@ -878,77 +882,77 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
878
882
|
message: "One or more entity IDs could not be found. Please verify the provided IDs and try again."
|
|
879
883
|
}
|
|
880
884
|
) : /* @__PURE__ */ R(
|
|
881
|
-
|
|
885
|
+
L,
|
|
882
886
|
{
|
|
883
887
|
sx: {
|
|
884
888
|
display: "flex",
|
|
885
889
|
flexDirection: "column",
|
|
886
|
-
gap:
|
|
887
|
-
backgroundColor:
|
|
888
|
-
padding:
|
|
890
|
+
gap: d.md,
|
|
891
|
+
backgroundColor: c,
|
|
892
|
+
padding: d.md
|
|
889
893
|
},
|
|
890
894
|
children: [
|
|
891
|
-
|
|
895
|
+
T && /* @__PURE__ */ i(
|
|
892
896
|
$e,
|
|
893
897
|
{
|
|
894
898
|
options: m,
|
|
895
|
-
selectedId:
|
|
896
|
-
onChange:
|
|
899
|
+
selectedId: E,
|
|
900
|
+
onChange: w
|
|
897
901
|
}
|
|
898
902
|
),
|
|
899
903
|
/* @__PURE__ */ i(
|
|
900
904
|
Qe,
|
|
901
905
|
{
|
|
902
|
-
leaderboard: P ? null : (
|
|
903
|
-
userRank: P ? null :
|
|
904
|
-
showHeading: !
|
|
905
|
-
title:
|
|
906
|
-
description: (
|
|
907
|
-
brandingColors: (
|
|
906
|
+
leaderboard: P ? null : (p == null ? void 0 : p.leaderboard) || null,
|
|
907
|
+
userRank: P ? null : n,
|
|
908
|
+
showHeading: b && !T,
|
|
909
|
+
title: F,
|
|
910
|
+
description: (p == null ? void 0 : p.description) || null,
|
|
911
|
+
brandingColors: (p == null ? void 0 : p.branding) || null,
|
|
908
912
|
rankStyles: r
|
|
909
913
|
}
|
|
910
914
|
),
|
|
911
|
-
!P &&
|
|
915
|
+
!P && S && S.totalPages > 1 && /* @__PURE__ */ i(
|
|
912
916
|
He,
|
|
913
917
|
{
|
|
914
|
-
count:
|
|
915
|
-
page:
|
|
916
|
-
onChange:
|
|
918
|
+
count: S.totalPages,
|
|
919
|
+
page: S.currentPage,
|
|
920
|
+
onChange: l
|
|
917
921
|
}
|
|
918
922
|
)
|
|
919
923
|
]
|
|
920
924
|
}
|
|
921
925
|
);
|
|
922
926
|
}, Ne = (e) => {
|
|
923
|
-
var
|
|
924
|
-
const [t, a] =
|
|
927
|
+
var x;
|
|
928
|
+
const [t, a] = z.useState(!1), [r, o] = z.useState(!1), b = z.useRef(
|
|
925
929
|
`leaderboard-shadow-root-${Math.random().toString(36).substring(2, 11)}`
|
|
926
|
-
), y =
|
|
927
|
-
|
|
930
|
+
), y = z.useRef(null), d = z.useRef(null), c = z.useRef(null), h = z.useRef(null);
|
|
931
|
+
z.useEffect(() => {
|
|
928
932
|
be(e.language || "en").finally(() => o(!0));
|
|
929
|
-
}, [e.language]),
|
|
933
|
+
}, [e.language]), z.useEffect(() => {
|
|
930
934
|
if (y.current)
|
|
931
|
-
return y.current.shadowRoot ? (
|
|
932
|
-
|
|
933
|
-
),
|
|
935
|
+
return y.current.shadowRoot ? (d.current = y.current.shadowRoot, c.current = d.current.getElementById(
|
|
936
|
+
b.current
|
|
937
|
+
), c.current || (c.current = document.createElement("div"), c.current.id = b.current, d.current.appendChild(c.current))) : (d.current = y.current.attachShadow({ mode: "open" }), c.current = document.createElement("div"), c.current.id = b.current, d.current.appendChild(c.current)), h.current || (h.current = ye({
|
|
934
938
|
key: "leaderboard-css",
|
|
935
939
|
prepend: !0,
|
|
936
|
-
container:
|
|
940
|
+
container: d.current
|
|
937
941
|
})), a(!0), () => {
|
|
938
942
|
a(!1);
|
|
939
943
|
};
|
|
940
944
|
}, []);
|
|
941
|
-
const v = /* @__PURE__ */ i(
|
|
942
|
-
/* @__PURE__ */ i(xe, { value:
|
|
945
|
+
const v = /* @__PURE__ */ i(L, { ref: y }), u = t && r && c.current && h.current ? Pe(
|
|
946
|
+
/* @__PURE__ */ i(xe, { value: h.current, children: /* @__PURE__ */ i(Ce, { containerRef: y, children: /* @__PURE__ */ i(
|
|
943
947
|
ve,
|
|
944
948
|
{
|
|
945
949
|
customTheme: e.themeOptions,
|
|
946
|
-
mode: (
|
|
947
|
-
shadowRootElement:
|
|
950
|
+
mode: (x = e.themeOptions) == null ? void 0 : x.mode,
|
|
951
|
+
shadowRootElement: c.current,
|
|
948
952
|
children: /* @__PURE__ */ i(
|
|
949
953
|
Te,
|
|
950
954
|
{
|
|
951
|
-
shadowRootElement:
|
|
955
|
+
shadowRootElement: c.current,
|
|
952
956
|
leadPhoneCountryCode: null,
|
|
953
957
|
language: e.language,
|
|
954
958
|
optionsLayout: null,
|
|
@@ -957,13 +961,13 @@ const Ue = (e) => e.split("_").map((t) => t.charAt(0) + t.slice(1).toLowerCase()
|
|
|
957
961
|
)
|
|
958
962
|
}
|
|
959
963
|
) }) }),
|
|
960
|
-
|
|
964
|
+
c.current
|
|
961
965
|
) : null;
|
|
962
966
|
return /* @__PURE__ */ R(se, { children: [
|
|
963
967
|
v,
|
|
964
|
-
|
|
968
|
+
u
|
|
965
969
|
] });
|
|
966
|
-
}, Ve = (e) => /* @__PURE__ */ i(Ne, { ...e, children: /* @__PURE__ */ i(Ze, { ...e }) }),
|
|
970
|
+
}, Ve = (e) => /* @__PURE__ */ i(Ne, { ...e, children: /* @__PURE__ */ i(Ze, { ...e }) }), pt = Ve;
|
|
967
971
|
export {
|
|
968
|
-
|
|
972
|
+
pt as Leaderboard
|
|
969
973
|
};
|