@sensiblestats/widget-react 0.121.0 → 0.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.cjs +104 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +104 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.122.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Ask for live match states in the host language: `getStates` and `postStates` take an optional locale, and the widget passes its host language.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @sensiblestats/widget-sdk@0.86.1
|
|
10
|
+
|
|
11
|
+
## 0.122.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Read the Continue label, the countdown title and the Mystery Tiger position tiles from the server's strings rows. A widget whose non-English strings cannot load stays hidden: a 4xx other than 429 is final, anything else recovers through a 5-minute retry, the browser coming back online, or the tab becoming visible. The SDK's getWidgetStrings errors now carry the HTTP status and Retry-After, which the gateway forwards.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @sensiblestats/widget-sdk@0.86.0
|
|
21
|
+
|
|
3
22
|
## 0.121.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -278,6 +278,8 @@ var BUNDLED_EN_GB = {
|
|
|
278
278
|
"widget.v8GamesGroup": "Games",
|
|
279
279
|
"widget.v8NoGame": "No game in the window",
|
|
280
280
|
"widget.v8Ask": "Ask",
|
|
281
|
+
"widget.actionContinue": "Continue",
|
|
282
|
+
"widget.countdownTitle": "Kick-off in",
|
|
281
283
|
"widget.v8NoLine": "No line posted yet. Lines usually post on the day.",
|
|
282
284
|
"widget.v8FollowWho": "Who do you follow?",
|
|
283
285
|
"widget.tabLeaderboard": "Leaderboard",
|
|
@@ -754,6 +756,26 @@ var BUNDLED_EN_GB = {
|
|
|
754
756
|
"widget.code.positionShort.Defender": "DF",
|
|
755
757
|
"widget.code.positionShort.Midfielder": "MF",
|
|
756
758
|
"widget.code.positionShort.Attacker": "FW",
|
|
759
|
+
"widget.code.positionShort.GK": "GK",
|
|
760
|
+
"widget.code.positionShort.DEF": "DEF",
|
|
761
|
+
"widget.code.positionShort.CB": "CB",
|
|
762
|
+
"widget.code.positionShort.LB": "LB",
|
|
763
|
+
"widget.code.positionShort.RB": "RB",
|
|
764
|
+
"widget.code.positionShort.LWB": "LWB",
|
|
765
|
+
"widget.code.positionShort.RWB": "RWB",
|
|
766
|
+
"widget.code.positionShort.SW": "SW",
|
|
767
|
+
"widget.code.positionShort.MID": "MID",
|
|
768
|
+
"widget.code.positionShort.DM": "DM",
|
|
769
|
+
"widget.code.positionShort.CM": "CM",
|
|
770
|
+
"widget.code.positionShort.AM": "AM",
|
|
771
|
+
"widget.code.positionShort.LM": "LM",
|
|
772
|
+
"widget.code.positionShort.RM": "RM",
|
|
773
|
+
"widget.code.positionShort.LW": "LW",
|
|
774
|
+
"widget.code.positionShort.RW": "RW",
|
|
775
|
+
"widget.code.positionShort.FWD": "FWD",
|
|
776
|
+
"widget.code.positionShort.ST": "ST",
|
|
777
|
+
"widget.code.positionShort.SS": "SS",
|
|
778
|
+
"widget.code.positionShort.CF": "CF",
|
|
757
779
|
"widget.code.settle.over": "Over",
|
|
758
780
|
"widget.code.settle.under": "Under",
|
|
759
781
|
"widget.code.settle.push": "Push",
|
|
@@ -888,6 +910,7 @@ function formDay(etDate, anchorEtDate, tag2) {
|
|
|
888
910
|
// src/strings/build.ts
|
|
889
911
|
var LEG_COUNTS = [2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
890
912
|
var POSITIONS = ["Goalkeeper", "Defender", "Midfielder", "Attacker"];
|
|
913
|
+
var TILE_POSITION_CODES = ["GK", "DEF", "CB", "LB", "RB", "LWB", "RWB", "SW", "MID", "DM", "CM", "AM", "LM", "RM", "LW", "RW", "FWD", "ST", "SS", "CF"];
|
|
891
914
|
var CODE_SETS = {
|
|
892
915
|
result: ["W", "D", "L"],
|
|
893
916
|
gridAbbrev: ["Goalkeeper", "Defender", "Midfielder", "Forward"],
|
|
@@ -909,7 +932,7 @@ var CODE_SETS = {
|
|
|
909
932
|
],
|
|
910
933
|
groupNoun: ["G", "D", "M", "F"],
|
|
911
934
|
position: POSITIONS,
|
|
912
|
-
positionShort: POSITIONS,
|
|
935
|
+
positionShort: [...POSITIONS, ...TILE_POSITION_CODES],
|
|
913
936
|
foot: ["right", "left", "both"],
|
|
914
937
|
settle: ["over", "under", "push", "void", "yes", "no"],
|
|
915
938
|
window: ["1q", "first3min"],
|
|
@@ -1109,6 +1132,7 @@ var ROW_LEAVES = {
|
|
|
1109
1132
|
var CODE_LEAVES = [
|
|
1110
1133
|
["venue", "venue", { home: "home", away: "away", short: "short" }],
|
|
1111
1134
|
["positionGroupShort", "positionShort", { Goalkeeper: "Goalkeeper", Defender: "Defender", Midfielder: "Midfielder", Attacker: "Attacker" }],
|
|
1135
|
+
["positionTile", "positionShort", Object.fromEntries(TILE_POSITION_CODES.map((c) => [c, c]))],
|
|
1112
1136
|
["sport", "sport", { football: "football", nba: "nba", nfl: "nfl" }],
|
|
1113
1137
|
["resultLetter", "result", { W: "W", D: "D", L: "L" }],
|
|
1114
1138
|
["perfGroupNoun", "groupNoun", { G: "G", D: "D", M: "M", F: "F" }],
|
|
@@ -1162,7 +1186,7 @@ function parseOddsFormat(value) {
|
|
|
1162
1186
|
}
|
|
1163
1187
|
|
|
1164
1188
|
// src/version.generated.ts
|
|
1165
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1189
|
+
var WIDGET_REACT_VERSION = "0.122.1";
|
|
1166
1190
|
|
|
1167
1191
|
// src/config.ts
|
|
1168
1192
|
function hostTag(cfg) {
|
|
@@ -1358,6 +1382,7 @@ function normalizeUi(cfg, loaded) {
|
|
|
1358
1382
|
sportFootball: strings.sportFootball,
|
|
1359
1383
|
venue: strings.venue,
|
|
1360
1384
|
positionGroupShort: strings.positionGroupShort,
|
|
1385
|
+
positionTile: strings.positionTile,
|
|
1361
1386
|
sport: strings.sport,
|
|
1362
1387
|
liveCountLabel: strings.liveCountLabel,
|
|
1363
1388
|
myLeagues: strings.myLeagues,
|
|
@@ -1493,6 +1518,8 @@ function normalizeUi(cfg, loaded) {
|
|
|
1493
1518
|
v8NoPrices: strings.v8NoPrices,
|
|
1494
1519
|
v8NoGame: strings.v8NoGame,
|
|
1495
1520
|
v8Ask: strings.v8Ask,
|
|
1521
|
+
actionContinue: strings.actionContinue,
|
|
1522
|
+
countdownTitle: strings.countdownTitle,
|
|
1496
1523
|
v8NoLine: strings.v8NoLine,
|
|
1497
1524
|
v8Hits: strings.v8Hits,
|
|
1498
1525
|
v8FollowWho: strings.v8FollowWho,
|
|
@@ -1536,6 +1563,21 @@ function toUserContext(cfg) {
|
|
|
1536
1563
|
var import_react = require("react");
|
|
1537
1564
|
var BUNDLED = { tag: BUNDLED_TAG, clock: BUNDLED_CLOCK, version: "", strings: BUNDLED_EN_GB };
|
|
1538
1565
|
var RETRY_MS = [1e3, 2e3, 4e3, 8e3, 16e3, 3e4];
|
|
1566
|
+
var SLOW_RETRY_MS = 3e5;
|
|
1567
|
+
var MAX_RETRY_AFTER_MS = 3e5;
|
|
1568
|
+
function isPermanent(err) {
|
|
1569
|
+
const status2 = err?.status;
|
|
1570
|
+
return typeof status2 === "number" && status2 >= 400 && status2 < 500 && status2 !== 429;
|
|
1571
|
+
}
|
|
1572
|
+
function holdsRetryAfter(err) {
|
|
1573
|
+
const e = err;
|
|
1574
|
+
return e?.status === 429 && typeof e.retryAfter === "number" && e.retryAfter >= 0;
|
|
1575
|
+
}
|
|
1576
|
+
function retryDelay(err, n) {
|
|
1577
|
+
const after = err;
|
|
1578
|
+
if (after?.status === 429 && typeof after.retryAfter === "number" && after.retryAfter >= 0) return Math.min(after.retryAfter * 1e3, MAX_RETRY_AFTER_MS);
|
|
1579
|
+
return n < RETRY_MS.length ? RETRY_MS[n] : SLOW_RETRY_MS;
|
|
1580
|
+
}
|
|
1539
1581
|
var cacheKey = (operatorId, tag2) => `ss-w-strings:${operatorId}:${tag2 || "_"}`;
|
|
1540
1582
|
function readCache(key) {
|
|
1541
1583
|
try {
|
|
@@ -1572,15 +1614,21 @@ function useWidgetStrings(cfg, source) {
|
|
|
1572
1614
|
(0, import_react.useEffect)(() => {
|
|
1573
1615
|
let cancelled = false;
|
|
1574
1616
|
let timer;
|
|
1617
|
+
let inFlight2 = false;
|
|
1618
|
+
let waitingFor = 0;
|
|
1619
|
+
let holdUntil = 0;
|
|
1575
1620
|
const cached = readCache(key);
|
|
1576
1621
|
const attempt = (n) => {
|
|
1577
1622
|
if (cancelled) return;
|
|
1623
|
+
timer = void 0;
|
|
1624
|
+
inFlight2 = true;
|
|
1578
1625
|
const src = sourceRef.current;
|
|
1579
1626
|
Promise.resolve().then(() => {
|
|
1580
1627
|
if (cancelled) throw new Error("unmounted");
|
|
1581
1628
|
if (!src) throw new Error("no client");
|
|
1582
1629
|
return src.getWidgetStrings(tag2, cached?.version);
|
|
1583
1630
|
}).then((res) => {
|
|
1631
|
+
inFlight2 = false;
|
|
1584
1632
|
if (cancelled) return;
|
|
1585
1633
|
if (res.strings) {
|
|
1586
1634
|
const next = { tag: res.tag, clock: res.clock, version: res.version, strings: res.strings };
|
|
@@ -1591,19 +1639,40 @@ function useWidgetStrings(cfg, source) {
|
|
|
1591
1639
|
} else {
|
|
1592
1640
|
throw new Error("strings response carried no rows");
|
|
1593
1641
|
}
|
|
1594
|
-
}).catch(() => {
|
|
1642
|
+
}).catch((err) => {
|
|
1643
|
+
inFlight2 = false;
|
|
1595
1644
|
if (cancelled || cached) return;
|
|
1596
1645
|
if (isEnglish(tag2)) {
|
|
1597
1646
|
setHeld({ key, state: "fallback", strings: BUNDLED });
|
|
1598
1647
|
return;
|
|
1599
1648
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1649
|
+
if (isPermanent(err)) {
|
|
1650
|
+
setHeld({ key, state: "unavailable" });
|
|
1651
|
+
return;
|
|
1652
|
+
}
|
|
1653
|
+
setHeld({ key, state: n >= RETRY_MS.length ? "unavailable" : "retrying" });
|
|
1654
|
+
waitingFor = n + 1;
|
|
1655
|
+
const delay = retryDelay(err, n);
|
|
1656
|
+
holdUntil = holdsRetryAfter(err) ? Date.now() + delay : 0;
|
|
1657
|
+
timer = setTimeout(() => attempt(waitingFor), delay);
|
|
1602
1658
|
});
|
|
1603
1659
|
};
|
|
1660
|
+
const rearm = () => {
|
|
1661
|
+
if (cancelled || inFlight2 || timer === void 0) return;
|
|
1662
|
+
if (waitingFor <= RETRY_MS.length || Date.now() < holdUntil) return;
|
|
1663
|
+
clearTimeout(timer);
|
|
1664
|
+
attempt(waitingFor);
|
|
1665
|
+
};
|
|
1666
|
+
const onVisible = () => {
|
|
1667
|
+
if (document.visibilityState === "visible") rearm();
|
|
1668
|
+
};
|
|
1669
|
+
window.addEventListener("online", rearm);
|
|
1670
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
1604
1671
|
attempt(0);
|
|
1605
1672
|
return () => {
|
|
1606
1673
|
cancelled = true;
|
|
1674
|
+
window.removeEventListener("online", rearm);
|
|
1675
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
1607
1676
|
if (timer !== void 0) clearTimeout(timer);
|
|
1608
1677
|
};
|
|
1609
1678
|
}, [key, tag2, source !== null]);
|
|
@@ -1704,7 +1773,7 @@ function toCardVM(card) {
|
|
|
1704
1773
|
};
|
|
1705
1774
|
}
|
|
1706
1775
|
function toActionVM(action) {
|
|
1707
|
-
const label = str(action.actionLabel) ?? str(action.label) ?? str(action.text) ?? str(action.title) ?? "
|
|
1776
|
+
const label = str(action.actionLabel) ?? str(action.label) ?? str(action.text) ?? str(action.title) ?? "";
|
|
1708
1777
|
const actionId = str(action.actionId) ?? str(action.id);
|
|
1709
1778
|
const actionRef = str(action.actionRef);
|
|
1710
1779
|
const message = str(action.actionValue) ?? str(action.message) ?? str(action.query) ?? label;
|
|
@@ -8693,10 +8762,13 @@ function OddsMovementCardList({ cards, ui, monitor }) {
|
|
|
8693
8762
|
|
|
8694
8763
|
// src/components/ActionButtons.tsx
|
|
8695
8764
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8696
|
-
function ActionButtons({ actions, loading, disabled, onAct }) {
|
|
8765
|
+
function ActionButtons({ actions, ui, loading, disabled, onAct }) {
|
|
8697
8766
|
if (actions.length === 0 && !loading) return null;
|
|
8698
8767
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ss-w-actions", children: [
|
|
8699
|
-
actions.map((a, i) =>
|
|
8768
|
+
actions.map((a, i) => {
|
|
8769
|
+
const label = a.label || ui.actionContinue;
|
|
8770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", className: "ss-w-abtn", disabled, onClick: () => onAct(a.label ? a : { ...a, label, message: a.message || label }), children: label }, `${label}-${i}`);
|
|
8771
|
+
}),
|
|
8700
8772
|
actions.length === 0 && loading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
8701
8773
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "ss-w-abtn-shimmer" }),
|
|
8702
8774
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "ss-w-abtn-shimmer" })
|
|
@@ -8811,7 +8883,7 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
8811
8883
|
if (withSeconds) segs.push({ value: pad2(seconds), unit: "s" });
|
|
8812
8884
|
return segs;
|
|
8813
8885
|
}
|
|
8814
|
-
function CountdownCard({ card }) {
|
|
8886
|
+
function CountdownCard({ card, ui }) {
|
|
8815
8887
|
const { data } = card;
|
|
8816
8888
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
8817
8889
|
const [nowMs, setNowMs] = (0, import_react50.useState)(() => Date.now());
|
|
@@ -8826,7 +8898,7 @@ function CountdownCard({ card }) {
|
|
|
8826
8898
|
}, [reduced, withinDay]);
|
|
8827
8899
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
8828
8900
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
8829
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ??
|
|
8901
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
8830
8902
|
segments ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react50.Fragment, { children: [
|
|
8831
8903
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
8832
8904
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
@@ -9471,7 +9543,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
9471
9543
|
case "fixture":
|
|
9472
9544
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FixtureCard, { card, ui });
|
|
9473
9545
|
case "countdown":
|
|
9474
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CountdownCard, { card });
|
|
9546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CountdownCard, { card, ui });
|
|
9475
9547
|
case "injuries":
|
|
9476
9548
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(InjuriesCard, { card, ui });
|
|
9477
9549
|
case "reasonToBet":
|
|
@@ -9538,7 +9610,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
|
9538
9610
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
|
|
9539
9611
|
compact ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
|
|
9540
9612
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
|
|
9541
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ActionButtons, { actions, loading: false, disabled, onAct })
|
|
9613
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ActionButtons, { actions, ui, loading: false, disabled, onAct })
|
|
9542
9614
|
] });
|
|
9543
9615
|
}
|
|
9544
9616
|
|
|
@@ -9613,7 +9685,7 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9613
9685
|
},
|
|
9614
9686
|
m.id
|
|
9615
9687
|
)),
|
|
9616
|
-
state.isStreaming && state.actionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ActionButtons, { actions: [], loading: true, onAct: () => {
|
|
9688
|
+
state.isStreaming && state.actionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ActionButtons, { actions: [], ui, loading: true, onAct: () => {
|
|
9617
9689
|
} }) : null,
|
|
9618
9690
|
state.status ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "ss-w-status", children: state.status }) : null,
|
|
9619
9691
|
state.error ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ss-w-error", role: "alert", children: [
|
|
@@ -12822,7 +12894,7 @@ function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQu
|
|
|
12822
12894
|
}
|
|
12823
12895
|
|
|
12824
12896
|
// src/components/games/positionCodes.ts
|
|
12825
|
-
var
|
|
12897
|
+
var POSITION_NAME_TO_CODE = {
|
|
12826
12898
|
goalkeeper: "GK",
|
|
12827
12899
|
keeper: "GK",
|
|
12828
12900
|
defender: "DEF",
|
|
@@ -12849,11 +12921,18 @@ var POSITION_SHORT = {
|
|
|
12849
12921
|
forward: "FWD",
|
|
12850
12922
|
attacker: "FWD",
|
|
12851
12923
|
striker: "ST",
|
|
12924
|
+
"secondary striker": "SS",
|
|
12852
12925
|
"second striker": "SS",
|
|
12853
12926
|
"centre forward": "CF",
|
|
12854
12927
|
"center forward": "CF",
|
|
12855
12928
|
"centre-forward": "CF"
|
|
12856
12929
|
};
|
|
12930
|
+
function tilePosition(tiles, value) {
|
|
12931
|
+
const code = POSITION_NAME_TO_CODE[value.trim().toLowerCase()];
|
|
12932
|
+
if (code) return tiles[code] || code;
|
|
12933
|
+
if (value.length <= 3) return value.toUpperCase();
|
|
12934
|
+
return value.split(/[\s-]+/).filter(Boolean).map((w) => (w[0] ?? "").toUpperCase()).join("").slice(0, 3);
|
|
12935
|
+
}
|
|
12857
12936
|
|
|
12858
12937
|
// src/components/games/ui/FooterBar.tsx
|
|
12859
12938
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
@@ -12932,22 +13011,16 @@ function directionArrow(v) {
|
|
|
12932
13011
|
if (v.direction === "down") return "\u25BC";
|
|
12933
13012
|
return "";
|
|
12934
13013
|
}
|
|
12935
|
-
function
|
|
12936
|
-
const mapped = POSITION_SHORT[value.trim().toLowerCase()];
|
|
12937
|
-
if (mapped) return mapped;
|
|
12938
|
-
if (value.length <= 3) return value.toUpperCase();
|
|
12939
|
-
return value.split(/[\s-]+/).filter(Boolean).map((w) => (w[0] ?? "").toUpperCase()).join("").slice(0, 3);
|
|
12940
|
-
}
|
|
12941
|
-
function tileFace(key, v) {
|
|
13014
|
+
function tileFace(key, v, tiles) {
|
|
12942
13015
|
if (!v.value) return verdictGlyph(v);
|
|
12943
13016
|
if (key === "nationality") return nationalityFlag(v.value);
|
|
12944
|
-
if (key === "position") return
|
|
13017
|
+
if (key === "position") return tilePosition(tiles, v.value);
|
|
12945
13018
|
return v.value;
|
|
12946
13019
|
}
|
|
12947
|
-
function deriveKnownAttributes(guesses, keys) {
|
|
13020
|
+
function deriveKnownAttributes(guesses, keys, tiles) {
|
|
12948
13021
|
return keys.map((key) => {
|
|
12949
13022
|
const exact = guesses.find((g) => g[key].verdict === "exact");
|
|
12950
|
-
if (exact) return { key, state: "known", text: tileFace(key, exact[key]) };
|
|
13023
|
+
if (exact) return { key, state: "known", text: tileFace(key, exact[key], tiles) };
|
|
12951
13024
|
if (!NUMERIC_KEYS.has(key)) return { key, state: "unknown", text: "?" };
|
|
12952
13025
|
let maxUp = null;
|
|
12953
13026
|
let minDown = null;
|
|
@@ -13011,7 +13084,7 @@ function MysteryTigerGame({
|
|
|
13011
13084
|
] }) });
|
|
13012
13085
|
const segments = Array.from({ length: totalGuesses }, (_, i) => i < guessesUsed ? "done" : i === guessesUsed ? "current" : "todo");
|
|
13013
13086
|
const cols = { gridTemplateColumns: `minmax(0, 1fr) repeat(${keys.length}, 42px)` };
|
|
13014
|
-
const known = deriveKnownAttributes(guessResults, keys);
|
|
13087
|
+
const known = deriveKnownAttributes(guessResults, keys, ui.positionTile);
|
|
13015
13088
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "ss-g-screen ss-g-mt", "data-game": "mystery-tiger", "data-testid": "game-screen-mystery-tiger", children: [
|
|
13016
13089
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
13017
13090
|
GameHeader,
|
|
@@ -13065,7 +13138,7 @@ function MysteryTigerGame({
|
|
|
13065
13138
|
"data-verdict": v.verdict,
|
|
13066
13139
|
"aria-label": `${t.labels[key]}: ${v.value ?? v.verdict}${v.direction ? ` ${v.direction}` : ""}`,
|
|
13067
13140
|
children: [
|
|
13068
|
-
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "ss-g-mt-cell-v", "aria-hidden": "true", children: tileFace(key, v) }),
|
|
13141
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "ss-g-mt-cell-v", "aria-hidden": "true", children: tileFace(key, v, ui.positionTile) }),
|
|
13069
13142
|
arrow && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "ss-g-mt-cell-dir", "aria-hidden": "true", children: arrow })
|
|
13070
13143
|
]
|
|
13071
13144
|
},
|
|
@@ -19247,8 +19320,8 @@ function StatsWidget(props) {
|
|
|
19247
19320
|
[built, operatorUserId, anonymousUserId]
|
|
19248
19321
|
);
|
|
19249
19322
|
const getStates = (0, import_react99.useCallback)(
|
|
19250
|
-
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
19251
|
-
[built]
|
|
19323
|
+
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag) : Promise.resolve(null),
|
|
19324
|
+
[built, requestTag]
|
|
19252
19325
|
);
|
|
19253
19326
|
const pinnedMatchIds = (0, import_react99.useMemo)(
|
|
19254
19327
|
() => footballMatchPinIds(monitor.pins),
|
|
@@ -19464,10 +19537,10 @@ function StatsWidget(props) {
|
|
|
19464
19537
|
};
|
|
19465
19538
|
}, [logger]);
|
|
19466
19539
|
(0, import_react99.useEffect)(() => {
|
|
19467
|
-
if (!built || !ui.injectStyles) return;
|
|
19540
|
+
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
19468
19541
|
const node = rootRef.current?.getRootNode();
|
|
19469
19542
|
if (node) injectStyles(node);
|
|
19470
|
-
}, [built, ui.injectStyles]);
|
|
19543
|
+
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
19471
19544
|
const holds = useSessionHolds();
|
|
19472
19545
|
const builderConversation = built?.conversation ?? null;
|
|
19473
19546
|
const builderMemory = (0, import_react99.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
@@ -19482,7 +19555,7 @@ function StatsWidget(props) {
|
|
|
19482
19555
|
holds,
|
|
19483
19556
|
memory: builderMemory
|
|
19484
19557
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
19485
|
-
if (!built) return null;
|
|
19558
|
+
if (!built || widgetStrings.state === "unavailable") return null;
|
|
19486
19559
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
19487
19560
|
return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
19488
19561
|
ChatPanel,
|