@sensiblestats/widget-react 0.51.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +243 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -69
- package/dist/index.js.map +1 -1
- package/dist/styles.css +15 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.52.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Club games UX batch (widget): hide the chat composer on the Games and Leaderboard tabs; show canonical game names + icons in the hub instead of the raw gameId ("beat-the-grid" → "Beat the Grid"); Higher or Lower cards no longer stretch to full height and both Higher/Lower options are neutral until picked (no pre-selected look); Career Path renders as a horizontal-scrolling strip of fixed compact crest cards instead of a wrapping squished grid; Guess the XI now renders nationality flags laid out on a pitch in formation rows with a "name the team" typeahead, replacing the raw formation-coordinate chips and the flat team-button list.
|
|
8
|
+
|
|
3
9
|
## 0.51.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/StatsWidget.tsx
|
|
39
|
-
var
|
|
39
|
+
var import_react40 = require("react");
|
|
40
40
|
var import_widget_sdk5 = require("@sensiblestats/widget-sdk");
|
|
41
41
|
|
|
42
42
|
// src/kickoff.ts
|
|
@@ -1929,7 +1929,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
1931
1931
|
// src/components/ChatPanel.tsx
|
|
1932
|
-
var
|
|
1932
|
+
var import_react39 = require("react");
|
|
1933
1933
|
|
|
1934
1934
|
// src/components/ChatHeader.tsx
|
|
1935
1935
|
var import_react11 = require("react");
|
|
@@ -4032,7 +4032,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
4032
4032
|
}
|
|
4033
4033
|
|
|
4034
4034
|
// src/components/GamesPanel.tsx
|
|
4035
|
-
var
|
|
4035
|
+
var import_react37 = require("react");
|
|
4036
4036
|
|
|
4037
4037
|
// src/components/GamesLoginWall.tsx
|
|
4038
4038
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
@@ -4045,14 +4045,36 @@ var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
|
4045
4045
|
var GAME_ICONS = {
|
|
4046
4046
|
"mystery-tiger": "\u{1F42F}",
|
|
4047
4047
|
"daily-quiz": "\u{1F9E0}",
|
|
4048
|
-
"career-path": "\
|
|
4049
|
-
"beat-the-grid": "\u{
|
|
4050
|
-
"guess-xi": "\u{1F4CB}",
|
|
4051
|
-
"
|
|
4048
|
+
"career-path": "\u{1F9ED}",
|
|
4049
|
+
"beat-the-grid": "\u{1F532}",
|
|
4050
|
+
"guess-the-xi": "\u{1F4CB}",
|
|
4051
|
+
"higher-or-lower": "\u{1F4C8}",
|
|
4052
|
+
"matchday-predictor": "\u{1F3AF}",
|
|
4053
|
+
"starting-xi": "\u{1F455}",
|
|
4054
|
+
"stat-ladder": "\u{1FA9C}",
|
|
4055
|
+
"fan-motm": "\u2B50"
|
|
4056
|
+
};
|
|
4057
|
+
var GAME_TITLES = {
|
|
4058
|
+
"mystery-tiger": "Mystery Tiger",
|
|
4059
|
+
"daily-quiz": "Daily Quiz",
|
|
4060
|
+
"career-path": "Career Path",
|
|
4061
|
+
"beat-the-grid": "Beat the Grid",
|
|
4062
|
+
"guess-the-xi": "Guess the XI",
|
|
4063
|
+
"higher-or-lower": "Higher or Lower",
|
|
4064
|
+
"matchday-predictor": "Matchday Predictor",
|
|
4065
|
+
"starting-xi": "Starting XI",
|
|
4066
|
+
"stat-ladder": "Stat Ladder",
|
|
4067
|
+
"fan-motm": "Fan MOTM"
|
|
4052
4068
|
};
|
|
4053
4069
|
function gameIcon(game) {
|
|
4054
4070
|
return GAME_ICONS[game.gameId] ?? (game.kind === "fixture" ? "\u{1F4C5}" : "\u{1F3AE}");
|
|
4055
4071
|
}
|
|
4072
|
+
function prettifyGameId(gameId) {
|
|
4073
|
+
return gameId.split("-").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
4074
|
+
}
|
|
4075
|
+
function gameTitle(game) {
|
|
4076
|
+
return game.title ?? GAME_TITLES[game.gameId] ?? prettifyGameId(game.gameId);
|
|
4077
|
+
}
|
|
4056
4078
|
function formatCountdown(lockAtUtc) {
|
|
4057
4079
|
const diff = new Date(lockAtUtc).getTime() - Date.now();
|
|
4058
4080
|
if (diff <= 0) return null;
|
|
@@ -4093,7 +4115,7 @@ function GameTile({
|
|
|
4093
4115
|
const statusClass = `ss-w-tile-status ss-w-tile-status--${game.status}`;
|
|
4094
4116
|
const inner = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4095
4117
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-icon", children: gameIcon(game) }),
|
|
4096
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-title", children: game
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ss-w-tile-title", children: gameTitle(game) }),
|
|
4097
4119
|
countdown !== null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: statusClass, "data-testid": "tile-countdown", children: countdown }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: statusClass, children: statusLabel }),
|
|
4098
4120
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: `ss-w-tile-chip ss-w-tile-chip--${game.ranked ? "skill" : "fun"}`, children: game.ranked ? "Skill" : "For fun" })
|
|
4099
4121
|
] });
|
|
@@ -4144,7 +4166,7 @@ function GamesHub({
|
|
|
4144
4166
|
}
|
|
4145
4167
|
|
|
4146
4168
|
// src/components/GameScreenHost.tsx
|
|
4147
|
-
var
|
|
4169
|
+
var import_react36 = require("react");
|
|
4148
4170
|
|
|
4149
4171
|
// src/useGamePlay.ts
|
|
4150
4172
|
var import_react28 = require("react");
|
|
@@ -4804,6 +4826,90 @@ function BeatTheGridGame({
|
|
|
4804
4826
|
] });
|
|
4805
4827
|
}
|
|
4806
4828
|
|
|
4829
|
+
// src/components/games/GuessTheXiGame.tsx
|
|
4830
|
+
var import_react32 = require("react");
|
|
4831
|
+
|
|
4832
|
+
// src/components/games/nationFlags.ts
|
|
4833
|
+
var FLAGS = {
|
|
4834
|
+
england: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0065}\u{E006E}\u{E0067}\u{E007F}",
|
|
4835
|
+
scotland: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0073}\u{E0063}\u{E0074}\u{E007F}",
|
|
4836
|
+
wales: "\u{1F3F4}\u{E0067}\u{E0062}\u{E0077}\u{E006C}\u{E0073}\u{E007F}",
|
|
4837
|
+
"northern ireland": "\u{1F1EC}\u{1F1E7}",
|
|
4838
|
+
"republic of ireland": "\u{1F1EE}\u{1F1EA}",
|
|
4839
|
+
ireland: "\u{1F1EE}\u{1F1EA}",
|
|
4840
|
+
"united kingdom": "\u{1F1EC}\u{1F1E7}",
|
|
4841
|
+
france: "\u{1F1EB}\u{1F1F7}",
|
|
4842
|
+
spain: "\u{1F1EA}\u{1F1F8}",
|
|
4843
|
+
portugal: "\u{1F1F5}\u{1F1F9}",
|
|
4844
|
+
germany: "\u{1F1E9}\u{1F1EA}",
|
|
4845
|
+
italy: "\u{1F1EE}\u{1F1F9}",
|
|
4846
|
+
netherlands: "\u{1F1F3}\u{1F1F1}",
|
|
4847
|
+
belgium: "\u{1F1E7}\u{1F1EA}",
|
|
4848
|
+
switzerland: "\u{1F1E8}\u{1F1ED}",
|
|
4849
|
+
austria: "\u{1F1E6}\u{1F1F9}",
|
|
4850
|
+
denmark: "\u{1F1E9}\u{1F1F0}",
|
|
4851
|
+
sweden: "\u{1F1F8}\u{1F1EA}",
|
|
4852
|
+
norway: "\u{1F1F3}\u{1F1F4}",
|
|
4853
|
+
finland: "\u{1F1EB}\u{1F1EE}",
|
|
4854
|
+
iceland: "\u{1F1EE}\u{1F1F8}",
|
|
4855
|
+
poland: "\u{1F1F5}\u{1F1F1}",
|
|
4856
|
+
czechia: "\u{1F1E8}\u{1F1FF}",
|
|
4857
|
+
"czech republic": "\u{1F1E8}\u{1F1FF}",
|
|
4858
|
+
croatia: "\u{1F1ED}\u{1F1F7}",
|
|
4859
|
+
serbia: "\u{1F1F7}\u{1F1F8}",
|
|
4860
|
+
"bosnia and herzegovina": "\u{1F1E7}\u{1F1E6}",
|
|
4861
|
+
greece: "\u{1F1EC}\u{1F1F7}",
|
|
4862
|
+
romania: "\u{1F1F7}\u{1F1F4}",
|
|
4863
|
+
ukraine: "\u{1F1FA}\u{1F1E6}",
|
|
4864
|
+
russia: "\u{1F1F7}\u{1F1FA}",
|
|
4865
|
+
hungary: "\u{1F1ED}\u{1F1FA}",
|
|
4866
|
+
slovakia: "\u{1F1F8}\u{1F1F0}",
|
|
4867
|
+
slovenia: "\u{1F1F8}\u{1F1EE}",
|
|
4868
|
+
turkey: "\u{1F1F9}\u{1F1F7}",
|
|
4869
|
+
t\u00FCrkiye: "\u{1F1F9}\u{1F1F7}",
|
|
4870
|
+
albania: "\u{1F1E6}\u{1F1F1}",
|
|
4871
|
+
"north macedonia": "\u{1F1F2}\u{1F1F0}",
|
|
4872
|
+
brazil: "\u{1F1E7}\u{1F1F7}",
|
|
4873
|
+
argentina: "\u{1F1E6}\u{1F1F7}",
|
|
4874
|
+
uruguay: "\u{1F1FA}\u{1F1FE}",
|
|
4875
|
+
colombia: "\u{1F1E8}\u{1F1F4}",
|
|
4876
|
+
chile: "\u{1F1E8}\u{1F1F1}",
|
|
4877
|
+
peru: "\u{1F1F5}\u{1F1EA}",
|
|
4878
|
+
ecuador: "\u{1F1EA}\u{1F1E8}",
|
|
4879
|
+
paraguay: "\u{1F1F5}\u{1F1FE}",
|
|
4880
|
+
mexico: "\u{1F1F2}\u{1F1FD}",
|
|
4881
|
+
"united states": "\u{1F1FA}\u{1F1F8}",
|
|
4882
|
+
usa: "\u{1F1FA}\u{1F1F8}",
|
|
4883
|
+
canada: "\u{1F1E8}\u{1F1E6}",
|
|
4884
|
+
jamaica: "\u{1F1EF}\u{1F1F2}",
|
|
4885
|
+
nigeria: "\u{1F1F3}\u{1F1EC}",
|
|
4886
|
+
ghana: "\u{1F1EC}\u{1F1ED}",
|
|
4887
|
+
senegal: "\u{1F1F8}\u{1F1F3}",
|
|
4888
|
+
ivorycoast: "\u{1F1E8}\u{1F1EE}",
|
|
4889
|
+
"cote d'ivoire": "\u{1F1E8}\u{1F1EE}",
|
|
4890
|
+
"ivory coast": "\u{1F1E8}\u{1F1EE}",
|
|
4891
|
+
cameroon: "\u{1F1E8}\u{1F1F2}",
|
|
4892
|
+
egypt: "\u{1F1EA}\u{1F1EC}",
|
|
4893
|
+
morocco: "\u{1F1F2}\u{1F1E6}",
|
|
4894
|
+
algeria: "\u{1F1E9}\u{1F1FF}",
|
|
4895
|
+
tunisia: "\u{1F1F9}\u{1F1F3}",
|
|
4896
|
+
mali: "\u{1F1F2}\u{1F1F1}",
|
|
4897
|
+
"south africa": "\u{1F1FF}\u{1F1E6}",
|
|
4898
|
+
"dr congo": "\u{1F1E8}\u{1F1E9}",
|
|
4899
|
+
japan: "\u{1F1EF}\u{1F1F5}",
|
|
4900
|
+
"south korea": "\u{1F1F0}\u{1F1F7}",
|
|
4901
|
+
korea: "\u{1F1F0}\u{1F1F7}",
|
|
4902
|
+
australia: "\u{1F1E6}\u{1F1FA}",
|
|
4903
|
+
"saudi arabia": "\u{1F1F8}\u{1F1E6}",
|
|
4904
|
+
iran: "\u{1F1EE}\u{1F1F7}",
|
|
4905
|
+
"new zealand": "\u{1F1F3}\u{1F1FF}"
|
|
4906
|
+
};
|
|
4907
|
+
function nationalityFlag(nationality) {
|
|
4908
|
+
if (!nationality) return "\u{1F3F3}\uFE0F";
|
|
4909
|
+
const key = nationality.trim().toLowerCase();
|
|
4910
|
+
return FLAGS[key] ?? nationality.slice(0, 3).toUpperCase();
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4807
4913
|
// src/components/games/GuessTheXiGame.tsx
|
|
4808
4914
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4809
4915
|
function parseClientState5(json) {
|
|
@@ -4814,6 +4920,16 @@ function parseClientState5(json) {
|
|
|
4814
4920
|
return null;
|
|
4815
4921
|
}
|
|
4816
4922
|
}
|
|
4923
|
+
function toRows(positions) {
|
|
4924
|
+
const byRow = /* @__PURE__ */ new Map();
|
|
4925
|
+
positions.forEach((p, i) => {
|
|
4926
|
+
const rowKey = Number(p.slot?.split(":")[0]) || i + 1;
|
|
4927
|
+
const bucket = byRow.get(rowKey) ?? [];
|
|
4928
|
+
bucket.push(p);
|
|
4929
|
+
byRow.set(rowKey, bucket);
|
|
4930
|
+
});
|
|
4931
|
+
return [...byRow.keys()].sort((a, b) => a - b).map((k) => byRow.get(k));
|
|
4932
|
+
}
|
|
4817
4933
|
function RevealCard({ reveal }) {
|
|
4818
4934
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-reveal", "data-reveal-type": reveal.type ?? "", children: [
|
|
4819
4935
|
reveal.slot && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-gxi-reveal-slot", children: reveal.slot }),
|
|
@@ -4826,51 +4942,90 @@ function GuessTheXiGame({
|
|
|
4826
4942
|
submitting,
|
|
4827
4943
|
onSubmit
|
|
4828
4944
|
}) {
|
|
4945
|
+
const [query, setQuery] = (0, import_react32.useState)("");
|
|
4946
|
+
const inputId = (0, import_react32.useId)();
|
|
4829
4947
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
4830
4948
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
4831
4949
|
const solved = clientState?.status === "solved";
|
|
4950
|
+
const guessedTeamIds = new Set(clientState?.guessHistory.map((g) => g.teamId) ?? []);
|
|
4951
|
+
const rows = config ? toRows(config.positions) : [];
|
|
4952
|
+
const filtered = config && !isOver ? config.teamPool.filter(
|
|
4953
|
+
(t) => !guessedTeamIds.has(t.teamId) && t.teamName.toLowerCase().includes(query.toLowerCase())
|
|
4954
|
+
) : [];
|
|
4832
4955
|
function handlePick(teamId) {
|
|
4833
4956
|
if (!config || isOver || submitting) return;
|
|
4834
4957
|
const prevGuesses = clientState?.guessHistory.map((g) => ({ teamId: g.teamId })) ?? [];
|
|
4835
4958
|
const newGuesses = [...prevGuesses, { teamId }];
|
|
4959
|
+
setQuery("");
|
|
4836
4960
|
onSubmit(JSON.stringify({ guesses: newGuesses }));
|
|
4837
4961
|
}
|
|
4962
|
+
const wrongGuesses = (clientState?.guessHistory ?? []).filter((g) => !g.wasCorrect);
|
|
4838
4963
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi", "data-testid": "game-screen-guess-the-xi", children: [
|
|
4839
4964
|
!config && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gscreen-body", children: "Loading\u2026" }),
|
|
4840
4965
|
config && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
4841
4966
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-head", children: [
|
|
4842
4967
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
4843
4968
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-title", children: "Guess the XI" }),
|
|
4844
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-sub", children: [
|
|
4970
|
+
"Which team? \xB7 ",
|
|
4971
|
+
config.poolLabel
|
|
4972
|
+
] })
|
|
4845
4973
|
] }),
|
|
4846
4974
|
clientState && !isOver && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ss-w-gxi-left", children: [
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
"/6"
|
|
4975
|
+
Math.max(0, 6 - clientState.guessesUsed),
|
|
4976
|
+
" left"
|
|
4850
4977
|
] })
|
|
4851
4978
|
] }),
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4979
|
+
rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-pitch", children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-prow", children: row.map((pos, c) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4980
|
+
"div",
|
|
4981
|
+
{
|
|
4982
|
+
className: "ss-w-gxi-flag",
|
|
4983
|
+
title: pos.nationality,
|
|
4984
|
+
"aria-label": pos.nationality,
|
|
4985
|
+
children: nationalityFlag(pos.nationality)
|
|
4986
|
+
},
|
|
4987
|
+
`${pos.slot}-${c}`
|
|
4988
|
+
)) }, r)) }),
|
|
4856
4989
|
clientState && clientState.earnedReveals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-reveals", children: clientState.earnedReveals.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RevealCard, { reveal: r }, i)) }),
|
|
4857
|
-
!isOver ? /* @__PURE__ */ (0, import_jsx_runtime59.
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
"
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4990
|
+
!isOver ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
4991
|
+
wrongGuesses.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-wrong", children: wrongGuesses.map((g) => {
|
|
4992
|
+
const team = config.teamPool.find((t) => t.teamId === g.teamId);
|
|
4993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-gxi-wrong-pill", children: team?.teamName ?? `#${g.teamId}` }, g.teamId);
|
|
4994
|
+
}) }),
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gtta", children: [
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4997
|
+
"input",
|
|
4998
|
+
{
|
|
4999
|
+
id: inputId,
|
|
5000
|
+
type: "text",
|
|
5001
|
+
role: "textbox",
|
|
5002
|
+
className: "ss-w-gtta-i",
|
|
5003
|
+
placeholder: "Name the team\u2026",
|
|
5004
|
+
value: query,
|
|
5005
|
+
disabled: submitting || isOver,
|
|
5006
|
+
onChange: (e) => setQuery(e.target.value),
|
|
5007
|
+
autoComplete: "off",
|
|
5008
|
+
"aria-label": "Name the team",
|
|
5009
|
+
"aria-autocomplete": "list"
|
|
5010
|
+
}
|
|
5011
|
+
),
|
|
5012
|
+
query.length > 0 && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gtta-drop", role: "listbox", children: filtered.map((t) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5013
|
+
"div",
|
|
5014
|
+
{
|
|
5015
|
+
className: "ss-w-gtta-opt",
|
|
5016
|
+
role: "option",
|
|
5017
|
+
"aria-selected": false,
|
|
5018
|
+
onClick: () => handlePick(t.teamId),
|
|
5019
|
+
onKeyDown: (e) => {
|
|
5020
|
+
if (e.key === "Enter") handlePick(t.teamId);
|
|
5021
|
+
},
|
|
5022
|
+
tabIndex: 0,
|
|
5023
|
+
children: t.teamName
|
|
5024
|
+
},
|
|
5025
|
+
t.teamId
|
|
5026
|
+
)) })
|
|
5027
|
+
] })
|
|
5028
|
+
] }) : clientState && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: `ss-w-gxi-banner ss-w-gxi-banner--${solved ? "solved" : "failed"}`, children: [
|
|
4874
5029
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-banner-label", children: solved ? "\u2705 Solved!" : "\u{1F614} Out of guesses" }),
|
|
4875
5030
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-gxi-banner-score", children: clientState.score }),
|
|
4876
5031
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-gxi-banner-sub", children: [
|
|
@@ -4885,7 +5040,7 @@ function GuessTheXiGame({
|
|
|
4885
5040
|
}
|
|
4886
5041
|
|
|
4887
5042
|
// src/components/games/DailyQuizGame.tsx
|
|
4888
|
-
var
|
|
5043
|
+
var import_react33 = require("react");
|
|
4889
5044
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4890
5045
|
function parseClientState6(json) {
|
|
4891
5046
|
if (!json) return null;
|
|
@@ -4904,7 +5059,7 @@ function DailyQuizGame({
|
|
|
4904
5059
|
submitting,
|
|
4905
5060
|
onSubmit
|
|
4906
5061
|
}) {
|
|
4907
|
-
const [selections, setSelections] = (0,
|
|
5062
|
+
const [selections, setSelections] = (0, import_react33.useState)(/* @__PURE__ */ new Map());
|
|
4908
5063
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
4909
5064
|
const isRevealed = (clientState?.results.length ?? 0) > 0 || result?.alreadyPlayed === true;
|
|
4910
5065
|
const allAnswered = config != null && selections.size === config.questions.length;
|
|
@@ -4984,7 +5139,7 @@ function DailyQuizGame({
|
|
|
4984
5139
|
}
|
|
4985
5140
|
|
|
4986
5141
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
4987
|
-
var
|
|
5142
|
+
var import_react34 = require("react");
|
|
4988
5143
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4989
5144
|
function parseClientState7(json) {
|
|
4990
5145
|
if (!json) return null;
|
|
@@ -5007,9 +5162,9 @@ function MatchdayPredictorGame({
|
|
|
5007
5162
|
submitting,
|
|
5008
5163
|
onSubmit
|
|
5009
5164
|
}) {
|
|
5010
|
-
const [homeScore, setHomeScore] = (0,
|
|
5011
|
-
const [awayScore, setAwayScore] = (0,
|
|
5012
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
5165
|
+
const [homeScore, setHomeScore] = (0, import_react34.useState)(0);
|
|
5166
|
+
const [awayScore, setAwayScore] = (0, import_react34.useState)(0);
|
|
5167
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react34.useState)(null);
|
|
5013
5168
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
5014
5169
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
5015
5170
|
if (alreadyPlayed && clientState) {
|
|
@@ -5159,7 +5314,7 @@ function MatchdayPredictorGame({
|
|
|
5159
5314
|
}
|
|
5160
5315
|
|
|
5161
5316
|
// src/components/games/StartingXiGame.tsx
|
|
5162
|
-
var
|
|
5317
|
+
var import_react35 = require("react");
|
|
5163
5318
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
5164
5319
|
function parseClientState8(json) {
|
|
5165
5320
|
if (!json) return null;
|
|
@@ -5180,7 +5335,7 @@ function StartingXiGame({
|
|
|
5180
5335
|
submitting,
|
|
5181
5336
|
onSubmit
|
|
5182
5337
|
}) {
|
|
5183
|
-
const [picked, setPicked] = (0,
|
|
5338
|
+
const [picked, setPicked] = (0, import_react35.useState)([]);
|
|
5184
5339
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
5185
5340
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
5186
5341
|
if (alreadyPlayed) {
|
|
@@ -5424,8 +5579,8 @@ function GameScreenHost({
|
|
|
5424
5579
|
ui
|
|
5425
5580
|
}) {
|
|
5426
5581
|
const { gameId, fixtureId, gameDay = "" } = selected;
|
|
5427
|
-
const [configJson, setConfigJson] = (0,
|
|
5428
|
-
(0,
|
|
5582
|
+
const [configJson, setConfigJson] = (0, import_react36.useState)(null);
|
|
5583
|
+
(0, import_react36.useEffect)(() => {
|
|
5429
5584
|
setConfigJson(null);
|
|
5430
5585
|
if (!conversation) return;
|
|
5431
5586
|
let cancelled = false;
|
|
@@ -5447,12 +5602,12 @@ function GameScreenHost({
|
|
|
5447
5602
|
gameDay,
|
|
5448
5603
|
fixtureId: fixtureId || void 0
|
|
5449
5604
|
});
|
|
5450
|
-
(0,
|
|
5605
|
+
(0, import_react36.useEffect)(() => {
|
|
5451
5606
|
if (conversation) hydrate();
|
|
5452
5607
|
}, [conversation, gameId]);
|
|
5453
|
-
const hydrateRef = (0,
|
|
5608
|
+
const hydrateRef = (0, import_react36.useRef)(hydrate);
|
|
5454
5609
|
hydrateRef.current = hydrate;
|
|
5455
|
-
(0,
|
|
5610
|
+
(0, import_react36.useEffect)(() => {
|
|
5456
5611
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
5457
5612
|
if (rawStatus !== "pending") return;
|
|
5458
5613
|
const timerId = setInterval(() => {
|
|
@@ -5570,7 +5725,7 @@ function GamesPanel({
|
|
|
5570
5725
|
ui,
|
|
5571
5726
|
conversation
|
|
5572
5727
|
}) {
|
|
5573
|
-
const [selected, setSelected] = (0,
|
|
5728
|
+
const [selected, setSelected] = (0, import_react37.useState)(null);
|
|
5574
5729
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(GamesLoginWall, { ui });
|
|
5575
5730
|
if (selected !== null) {
|
|
5576
5731
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-mon-list", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -5594,7 +5749,7 @@ function GamesPanel({
|
|
|
5594
5749
|
}
|
|
5595
5750
|
|
|
5596
5751
|
// src/components/Leaderboard.tsx
|
|
5597
|
-
var
|
|
5752
|
+
var import_react38 = require("react");
|
|
5598
5753
|
|
|
5599
5754
|
// src/components/LeaderboardRow.tsx
|
|
5600
5755
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
@@ -5679,7 +5834,7 @@ function Leaderboard({
|
|
|
5679
5834
|
ui,
|
|
5680
5835
|
onPlay
|
|
5681
5836
|
}) {
|
|
5682
|
-
const [segment, setSegment] = (0,
|
|
5837
|
+
const [segment, setSegment] = (0, import_react38.useState)("weekly");
|
|
5683
5838
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
5684
5839
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
5685
5840
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -5762,8 +5917,8 @@ function LeaderboardPanel({ loggedIn, data, loading, onPlay, ui }) {
|
|
|
5762
5917
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5763
5918
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
5764
5919
|
function useIsModal() {
|
|
5765
|
-
const [modal, setModal] = (0,
|
|
5766
|
-
(0,
|
|
5920
|
+
const [modal, setModal] = (0, import_react39.useState)(false);
|
|
5921
|
+
(0, import_react39.useEffect)(() => {
|
|
5767
5922
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
5768
5923
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
5769
5924
|
const sync = () => setModal(mql.matches);
|
|
@@ -5776,7 +5931,7 @@ function useIsModal() {
|
|
|
5776
5931
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, loggedIn, conversation }) {
|
|
5777
5932
|
const { state, close, stop, send, reset } = controller;
|
|
5778
5933
|
const isModal = useIsModal();
|
|
5779
|
-
(0,
|
|
5934
|
+
(0, import_react39.useEffect)(() => {
|
|
5780
5935
|
const onKey = (e) => {
|
|
5781
5936
|
if (e.key === "Escape") close();
|
|
5782
5937
|
};
|
|
@@ -5787,7 +5942,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
5787
5942
|
monitor?.setActiveTab("chat");
|
|
5788
5943
|
send(text);
|
|
5789
5944
|
};
|
|
5790
|
-
(0,
|
|
5945
|
+
(0, import_react39.useEffect)(() => {
|
|
5791
5946
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
5792
5947
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
5793
5948
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
@@ -5837,7 +5992,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
5837
5992
|
ui
|
|
5838
5993
|
}
|
|
5839
5994
|
),
|
|
5840
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatInput, { placeholder: ui.placeholder, streaming: state.isStreaming, onSend: handleSend, onStop: stop, stopLabel: ui.stopResponse, sendLabel: ui.sendMessage })
|
|
5995
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "leaderboard") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatInput, { placeholder: ui.placeholder, streaming: state.isStreaming, onSend: handleSend, onStop: stop, stopLabel: ui.stopResponse, sendLabel: ui.sendMessage })
|
|
5841
5996
|
] });
|
|
5842
5997
|
}
|
|
5843
5998
|
|
|
@@ -6864,9 +7019,9 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6864
7019
|
.ss-w-hlbtns { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
|
|
6865
7020
|
.ss-w-hl-or { text-align: center; font-size: 11px; font-weight: 700; color: var(--ss-w-faint); }
|
|
6866
7021
|
.ss-w-hlbtn { font: inherit; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; border-radius: 9px; padding: 10px 12px; cursor: pointer; border: 1px solid var(--ss-w-line); white-space: nowrap; transition: border-color .1s, background .1s; }
|
|
6867
|
-
|
|
6868
|
-
.ss-w-hlbtn--dn { background: var(--ss-w-panel); color: var(--ss-w-ink); }
|
|
6869
|
-
.ss-w-hlbtn:hover:not(:disabled) { border-color: var(--ss-w-accent); }
|
|
7022
|
+
/* Both options are neutral until picked \u2014 an amber default read as "already selected". */
|
|
7023
|
+
.ss-w-hlbtn--up, .ss-w-hlbtn--dn { background: var(--ss-w-panel); color: var(--ss-w-ink); }
|
|
7024
|
+
.ss-w-hlbtn:hover:not(:disabled) { border-color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 10%, var(--ss-w-panel)); color: var(--ss-w-accent); }
|
|
6870
7025
|
.ss-w-hlbtn:disabled { opacity: .5; cursor: not-allowed; }
|
|
6871
7026
|
/* Run-over terminal panel */
|
|
6872
7027
|
.ss-w-hl-over { background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 16px; text-align: center; display: flex; flex-direction: column; gap: 5px; }
|
|
@@ -6893,18 +7048,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6893
7048
|
.ss-w-cpath-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
6894
7049
|
.ss-w-cpath-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
6895
7050
|
/* Career sequence \u2014 horizontal crests with arrows */
|
|
6896
|
-
.ss-w-cpath-seq { display: flex; flex-wrap:
|
|
6897
|
-
.ss-w-cpath-arrow { align-self: center; color: var(--ss-w-faint); font-size: 13px; padding-top: 10px; }
|
|
7051
|
+
.ss-w-cpath-seq { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 4px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 14px; padding: 13px 11px; overflow-x: auto; overscroll-behavior-x: contain; }
|
|
7052
|
+
.ss-w-cpath-arrow { align-self: center; flex: none; color: var(--ss-w-faint); font-size: 13px; padding-top: 10px; }
|
|
6898
7053
|
/* Single club \u2014 small vertical card */
|
|
6899
|
-
.ss-w-cpath-club { display: flex; flex-direction: column; align-items: center; gap: 3px; width:
|
|
7054
|
+
.ss-w-cpath-club { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; flex: none; }
|
|
6900
7055
|
.ss-w-cpath-crest { width: 34px; height: 34px; object-fit: contain; flex: none; border-radius: 8px; }
|
|
6901
7056
|
.ss-w-cpath-crest--fallback { background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); display: grid; place-items: center; font-size: 9px; font-weight: 800; letter-spacing: .02em; color: var(--ss-w-faint); }
|
|
6902
|
-
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.
|
|
7057
|
+
.ss-w-cpath-club-name { font-size: 9px; font-weight: 600; color: var(--ss-w-ink); text-align: center; line-height: 1.15; max-width: 56px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
6903
7058
|
.ss-w-cpath-spell-yr { font-size: 8px; color: var(--ss-w-faint); font-weight: 500; white-space: nowrap; }
|
|
6904
7059
|
.ss-w-cpath-loan-badge { font-size: 7.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ss-w-accent) 15%, var(--ss-w-panel)); color: var(--ss-w-accent); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|
|
6905
7060
|
.ss-w-cpath-club--loan .ss-w-cpath-crest { border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); }
|
|
6906
7061
|
/* Hidden clubs chip */
|
|
6907
|
-
.ss-w-cpath-hidden { align-self: center; font-size: 9px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
7062
|
+
.ss-w-cpath-hidden { align-self: center; flex: none; white-space: nowrap; font-size: 9px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border: 1px dashed var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
6908
7063
|
/* Hint line */
|
|
6909
7064
|
.ss-w-cpath-hint { font-size: 11.5px; color: var(--ss-w-faint); text-align: center; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ss-w-accent) 8%, var(--ss-w-panel)); border: 1px dashed color-mix(in srgb, var(--ss-w-accent) 30%, var(--ss-w-line)); }
|
|
6910
7065
|
/* Terminal outcome */
|
|
@@ -6968,23 +7123,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
6968
7123
|
.ss-w-gxi-title { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--ss-w-ink); line-height: 1; }
|
|
6969
7124
|
.ss-w-gxi-sub { font-size: 11px; color: var(--ss-w-faint); margin-top: 4px; }
|
|
6970
7125
|
.ss-w-gxi-left { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 11%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 22%, var(--ss-w-line)); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
|
|
6971
|
-
/*
|
|
6972
|
-
.ss-w-gxi-pitch { display: flex; flex-
|
|
6973
|
-
.ss-w-gxi-
|
|
6974
|
-
.ss-w-gxi-
|
|
6975
|
-
|
|
7126
|
+
/* Pitch: a flag per slot laid out in formation rows on a green field */
|
|
7127
|
+
.ss-w-gxi-pitch { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 16px 10px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ss-w-correct) 22%, var(--ss-w-line)); background: linear-gradient(180deg, color-mix(in srgb, var(--ss-w-correct) 10%, var(--ss-w-panel)), color-mix(in srgb, var(--ss-w-correct) 4%, var(--ss-w-panel))); }
|
|
7128
|
+
.ss-w-gxi-prow { display: flex; justify-content: space-around; align-items: center; gap: 8px; }
|
|
7129
|
+
.ss-w-gxi-flag { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 19px; line-height: 1; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); box-shadow: 0 1px 3px rgba(0,0,0,.14); overflow: hidden; }
|
|
7130
|
+
/* Wrong-guess trail */
|
|
7131
|
+
.ss-w-gxi-wrong { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
7132
|
+
.ss-w-gxi-wrong-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ss-w-wrong) 10%, var(--ss-w-panel)); border: 1px solid var(--ss-w-line); color: var(--ss-w-faint); text-decoration: line-through; }
|
|
6976
7133
|
/* Earned reveals */
|
|
6977
7134
|
.ss-w-gxi-reveals { display: flex; flex-direction: column; gap: 4px; }
|
|
6978
7135
|
.ss-w-gxi-reveal { display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: color-mix(in srgb, var(--ss-w-cta) 8%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-cta) 22%, var(--ss-w-line)); border-radius: 8px; }
|
|
6979
7136
|
.ss-w-gxi-reveal-slot { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ss-w-cta-ink, #1b1300); background: var(--ss-w-cta); border-radius: 6px; padding: 1px 6px; flex: none; }
|
|
6980
7137
|
.ss-w-gxi-reveal-val { font-size: 12.5px; font-weight: 600; color: var(--ss-w-ink); }
|
|
6981
|
-
/* Team pool: responsive flex grid of buttons */
|
|
6982
|
-
.ss-w-gxi-pool { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
6983
|
-
.ss-w-gxi-team-btn { font: inherit; font-size: 12.5px; font-weight: 650; border-radius: 10px; padding: 9px 14px; cursor: pointer; border: 1.5px solid var(--ss-w-line); background: var(--ss-w-panel); color: var(--ss-w-ink); transition: background .1s, border-color .1s; }
|
|
6984
|
-
.ss-w-gxi-team-btn:hover:not(:disabled) { background: var(--ss-w-bubble); border-color: var(--ss-w-accent); }
|
|
6985
|
-
.ss-w-gxi-team-btn:disabled { opacity: .5; cursor: not-allowed; }
|
|
6986
|
-
.ss-w-gxi-team-btn--correct { background: color-mix(in srgb, var(--ss-w-correct) 14%, var(--ss-w-panel)); border-color: color-mix(in srgb, var(--ss-w-correct) 35%, var(--ss-w-line)); color: var(--ss-w-correct); }
|
|
6987
|
-
.ss-w-gxi-team-btn--wrong { background: color-mix(in srgb, var(--ss-w-wrong) 8%, var(--ss-w-panel)); text-decoration: line-through; opacity: .65; }
|
|
6988
7138
|
/* Terminal outcome banner */
|
|
6989
7139
|
.ss-w-gxi-banner { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 16px 12px; border-radius: 14px; text-align: center; }
|
|
6990
7140
|
.ss-w-gxi-banner--solved { background: color-mix(in srgb, var(--ss-w-correct) 12%, var(--ss-w-panel)); border: 1px solid color-mix(in srgb, var(--ss-w-correct) 28%, var(--ss-w-line)); }
|
|
@@ -7161,23 +7311,23 @@ function injectStyles(root) {
|
|
|
7161
7311
|
function StatsWidget(props) {
|
|
7162
7312
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
7163
7313
|
const cfg = props.config;
|
|
7164
|
-
const built = (0,
|
|
7165
|
-
const logger = (0,
|
|
7314
|
+
const built = (0, import_react40.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
7315
|
+
const logger = (0, import_react40.useMemo)(
|
|
7166
7316
|
() => built ? built.client.createEventLogger({
|
|
7167
7317
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
7168
7318
|
anonymousUserId: cfg?.userContext?.anonymousUserId
|
|
7169
7319
|
}) : null,
|
|
7170
7320
|
[built?.client]
|
|
7171
7321
|
);
|
|
7172
|
-
const ui = (0,
|
|
7173
|
-
const rootRef = (0,
|
|
7174
|
-
const introDoneRef = (0,
|
|
7175
|
-
const markIntroDone = (0,
|
|
7322
|
+
const ui = (0, import_react40.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
7323
|
+
const rootRef = (0, import_react40.useRef)(null);
|
|
7324
|
+
const introDoneRef = (0, import_react40.useRef)(false);
|
|
7325
|
+
const markIntroDone = (0, import_react40.useCallback)(() => {
|
|
7176
7326
|
introDoneRef.current = true;
|
|
7177
7327
|
}, []);
|
|
7178
7328
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
|
|
7179
7329
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey);
|
|
7180
|
-
const [hasToday, setHasToday] = (0,
|
|
7330
|
+
const [hasToday, setHasToday] = (0, import_react40.useState)(false);
|
|
7181
7331
|
const monitor = useLiveMonitor({
|
|
7182
7332
|
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins) : Promise.resolve(null),
|
|
7183
7333
|
getMarketOdds: (matchId, dev) => built ? built.conversation.getMarketOdds(matchId, dev) : Promise.resolve(null),
|
|
@@ -7185,15 +7335,15 @@ function StatsWidget(props) {
|
|
|
7185
7335
|
isOpen: controller.state.isOpen,
|
|
7186
7336
|
hasToday
|
|
7187
7337
|
});
|
|
7188
|
-
const getSchedule = (0,
|
|
7338
|
+
const getSchedule = (0, import_react40.useCallback)(
|
|
7189
7339
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes) : Promise.resolve(null),
|
|
7190
7340
|
[built]
|
|
7191
7341
|
);
|
|
7192
|
-
const getStates = (0,
|
|
7342
|
+
const getStates = (0, import_react40.useCallback)(
|
|
7193
7343
|
(matchIds) => built ? built.conversation.getStates(matchIds) : Promise.resolve(null),
|
|
7194
7344
|
[built]
|
|
7195
7345
|
);
|
|
7196
|
-
const pinnedMatchIds = (0,
|
|
7346
|
+
const pinnedMatchIds = (0, import_react40.useMemo)(
|
|
7197
7347
|
() => monitor.pins.filter((p) => p.kind === "match").map((p) => p.matchId),
|
|
7198
7348
|
[monitor.pins]
|
|
7199
7349
|
);
|
|
@@ -7205,19 +7355,19 @@ function StatsWidget(props) {
|
|
|
7205
7355
|
pinnedMatchIds
|
|
7206
7356
|
});
|
|
7207
7357
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
7208
|
-
(0,
|
|
7358
|
+
(0, import_react40.useEffect)(() => {
|
|
7209
7359
|
setHasToday(todayHasContent);
|
|
7210
7360
|
}, [todayHasContent]);
|
|
7211
7361
|
const gamesResult = useGames(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7212
7362
|
const leaderboardResult = useLeaderboard(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
7213
7363
|
const markTodayActivity = monitor.markTodayActivity;
|
|
7214
|
-
const prevLiveCountRef = (0,
|
|
7215
|
-
(0,
|
|
7364
|
+
const prevLiveCountRef = (0, import_react40.useRef)(0);
|
|
7365
|
+
(0, import_react40.useEffect)(() => {
|
|
7216
7366
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
7217
7367
|
prevLiveCountRef.current = discovery.liveCount;
|
|
7218
7368
|
if (rose) markTodayActivity();
|
|
7219
7369
|
}, [discovery.liveCount, markTodayActivity]);
|
|
7220
|
-
const slip = (0,
|
|
7370
|
+
const slip = (0, import_react40.useMemo)(
|
|
7221
7371
|
() => {
|
|
7222
7372
|
const handler = props.config?.onAddToSlip;
|
|
7223
7373
|
return {
|
|
@@ -7240,18 +7390,18 @@ function StatsWidget(props) {
|
|
|
7240
7390
|
},
|
|
7241
7391
|
[props.config?.onAddToSlip, controller.state.conversationId, built, monitor.markInSlip]
|
|
7242
7392
|
);
|
|
7243
|
-
const onDashboardTap = (0,
|
|
7393
|
+
const onDashboardTap = (0, import_react40.useMemo)(
|
|
7244
7394
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
7245
7395
|
[built, logger]
|
|
7246
7396
|
);
|
|
7247
7397
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
7248
7398
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
7249
7399
|
const conversationId = controller.state.conversationId ?? void 0;
|
|
7250
|
-
(0,
|
|
7400
|
+
(0, import_react40.useEffect)(() => {
|
|
7251
7401
|
if (!logger) return;
|
|
7252
7402
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
7253
7403
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
7254
|
-
(0,
|
|
7404
|
+
(0, import_react40.useEffect)(() => {
|
|
7255
7405
|
if (!logger) return;
|
|
7256
7406
|
const onHide = () => {
|
|
7257
7407
|
logger.flushOnHide();
|
|
@@ -7268,7 +7418,7 @@ function StatsWidget(props) {
|
|
|
7268
7418
|
logger.dispose();
|
|
7269
7419
|
};
|
|
7270
7420
|
}, [logger]);
|
|
7271
|
-
(0,
|
|
7421
|
+
(0, import_react40.useEffect)(() => {
|
|
7272
7422
|
if (!built || !ui.injectStyles) return;
|
|
7273
7423
|
const node = rootRef.current?.getRootNode();
|
|
7274
7424
|
if (node) injectStyles(node);
|