@sensiblestats/widget-react 0.131.0 → 0.132.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 +429 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +384 -294
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,13 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
StatsWidget: () => StatsWidget,
|
|
34
34
|
WIDGET_CSS: () => WIDGET_CSS,
|
|
35
|
+
WIDGET_REACT_VERSION: () => WIDGET_REACT_VERSION,
|
|
35
36
|
createWidgetHost: () => createWidgetHost
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
39
|
|
|
39
40
|
// src/StatsWidget.tsx
|
|
40
|
-
var
|
|
41
|
+
var import_react104 = require("react");
|
|
41
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
42
43
|
|
|
43
44
|
// src/strings/tag.ts
|
|
@@ -1323,7 +1324,7 @@ function parseOddsFormat(value) {
|
|
|
1323
1324
|
}
|
|
1324
1325
|
|
|
1325
1326
|
// src/version.generated.ts
|
|
1326
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1327
|
+
var WIDGET_REACT_VERSION = "0.132.0";
|
|
1327
1328
|
|
|
1328
1329
|
// src/config.ts
|
|
1329
1330
|
function hostTag(cfg) {
|
|
@@ -1688,8 +1689,9 @@ function normalizeUi(cfg, loaded) {
|
|
|
1688
1689
|
};
|
|
1689
1690
|
}
|
|
1690
1691
|
function toClientOptions(cfg) {
|
|
1691
|
-
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client:
|
|
1692
|
+
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
|
|
1692
1693
|
if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
|
|
1694
|
+
if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
|
|
1693
1695
|
return opts;
|
|
1694
1696
|
}
|
|
1695
1697
|
function toUserContext(cfg) {
|
|
@@ -7466,7 +7468,7 @@ var WIRE_TO_PUBLIC = {
|
|
|
7466
7468
|
|
|
7467
7469
|
// src/popupTelemetry.ts
|
|
7468
7470
|
var import_react41 = require("react");
|
|
7469
|
-
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7471
|
+
function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
|
|
7470
7472
|
const shownRef = (0, import_react41.useRef)(/* @__PURE__ */ new Set());
|
|
7471
7473
|
const closedTextRef = (0, import_react41.useRef)(null);
|
|
7472
7474
|
(0, import_react41.useEffect)(() => {
|
|
@@ -7475,23 +7477,70 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7475
7477
|
closedTextRef.current = null;
|
|
7476
7478
|
return;
|
|
7477
7479
|
}
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7480
|
+
const text2 = confirmedShown === void 0 || confirmedShown === popupText ? popupText : null;
|
|
7481
|
+
closedTextRef.current = text2;
|
|
7482
|
+
if (text2 && !shownRef.current.has(text2)) {
|
|
7483
|
+
shownRef.current.add(text2);
|
|
7481
7484
|
log?.log({ name: "popup_shown" });
|
|
7482
7485
|
}
|
|
7483
|
-
}, [log, isOpen, popupText]);
|
|
7486
|
+
}, [log, isOpen, popupText, confirmedShown]);
|
|
7484
7487
|
return (0, import_react41.useCallback)(() => {
|
|
7485
7488
|
log?.log({ name: "popup_dismissed" });
|
|
7486
7489
|
dismissPopup();
|
|
7487
7490
|
}, [log, dismissPopup]);
|
|
7488
7491
|
}
|
|
7489
7492
|
|
|
7490
|
-
// src/
|
|
7493
|
+
// src/mobileBinding.ts
|
|
7491
7494
|
var import_react42 = require("react");
|
|
7492
|
-
|
|
7493
|
-
|
|
7495
|
+
var CLEARED = { text: null, asks: [] };
|
|
7496
|
+
function useMobileBinding(args) {
|
|
7497
|
+
const { binding, panelOpen, popupText, asks } = args;
|
|
7498
|
+
const latest = (0, import_react42.useRef)(args);
|
|
7499
|
+
latest.current = args;
|
|
7500
|
+
const bindingRef = (0, import_react42.useRef)(binding);
|
|
7501
|
+
bindingRef.current = binding;
|
|
7502
|
+
const backRef = (0, import_react42.useRef)(null);
|
|
7503
|
+
const [confirmedShown, setConfirmedShown] = (0, import_react42.useState)(null);
|
|
7504
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label)]);
|
|
7505
|
+
const reported = (0, import_react42.useRef)({ binding: void 0, key: "" });
|
|
7506
|
+
(0, import_react42.useEffect)(() => {
|
|
7507
|
+
if (!binding) return;
|
|
7508
|
+
const prev = reported.current;
|
|
7509
|
+
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
7510
|
+
reported.current = { binding, key: teaserKey };
|
|
7511
|
+
if (teaserKey === "" && prev.binding !== binding) return;
|
|
7512
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })) });
|
|
7513
|
+
}, [binding, teaserKey]);
|
|
7494
7514
|
(0, import_react42.useEffect)(() => {
|
|
7515
|
+
if (!binding) return;
|
|
7516
|
+
binding.onHandle({
|
|
7517
|
+
open: () => latest.current.open(),
|
|
7518
|
+
close: () => latest.current.close(),
|
|
7519
|
+
tapAsk: (index) => {
|
|
7520
|
+
const { asks: current, open } = latest.current;
|
|
7521
|
+
if (!Number.isInteger(index) || index < 0 || index >= current.length) return;
|
|
7522
|
+
open();
|
|
7523
|
+
current[index].onTap();
|
|
7524
|
+
},
|
|
7525
|
+
dismissTeaser: () => latest.current.dismissPopup(),
|
|
7526
|
+
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
7527
|
+
back: () => backRef.current?.() ?? false
|
|
7528
|
+
});
|
|
7529
|
+
return () => binding.onHandle(null);
|
|
7530
|
+
}, [binding]);
|
|
7531
|
+
const onCloseRequested = (0, import_react42.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
7532
|
+
const onRegisterBack = (0, import_react42.useCallback)((fn) => {
|
|
7533
|
+
backRef.current = fn;
|
|
7534
|
+
}, []);
|
|
7535
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0 };
|
|
7536
|
+
return { confirmedShown, onCloseRequested, onRegisterBack };
|
|
7537
|
+
}
|
|
7538
|
+
|
|
7539
|
+
// src/openTelemetry.ts
|
|
7540
|
+
var import_react43 = require("react");
|
|
7541
|
+
function useOpenTelemetry(log, isOpen) {
|
|
7542
|
+
const openLoggedRef = (0, import_react43.useRef)(false);
|
|
7543
|
+
(0, import_react43.useEffect)(() => {
|
|
7495
7544
|
if (!isOpen) {
|
|
7496
7545
|
openLoggedRef.current = false;
|
|
7497
7546
|
return;
|
|
@@ -7503,13 +7552,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7503
7552
|
}
|
|
7504
7553
|
|
|
7505
7554
|
// src/components/ChatFab.tsx
|
|
7506
|
-
var
|
|
7555
|
+
var import_react45 = require("react");
|
|
7507
7556
|
|
|
7508
7557
|
// src/components/BrandMark.tsx
|
|
7509
|
-
var
|
|
7558
|
+
var import_react44 = require("react");
|
|
7510
7559
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
7511
7560
|
function BrandMark({ logoUrl, className }) {
|
|
7512
|
-
const [failed, setFailed] = (0,
|
|
7561
|
+
const [failed, setFailed] = (0, import_react44.useState)(false);
|
|
7513
7562
|
if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SsMark, { className });
|
|
7514
7563
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7515
7564
|
}
|
|
@@ -7547,9 +7596,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7547
7596
|
const bubble = popupText ?? greeting;
|
|
7548
7597
|
const hidden = busy && !label;
|
|
7549
7598
|
const track = useTrack();
|
|
7550
|
-
const [intro, setIntro] = (0,
|
|
7551
|
-
const armedRef = (0,
|
|
7552
|
-
(0,
|
|
7599
|
+
const [intro, setIntro] = (0, import_react45.useState)(false);
|
|
7600
|
+
const armedRef = (0, import_react45.useRef)(introAllowed);
|
|
7601
|
+
(0, import_react45.useEffect)(() => {
|
|
7553
7602
|
if (armedRef.current && bubble) {
|
|
7554
7603
|
armedRef.current = false;
|
|
7555
7604
|
setIntro(true);
|
|
@@ -7569,10 +7618,10 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7569
7618
|
}
|
|
7570
7619
|
|
|
7571
7620
|
// src/components/ChatPanel.tsx
|
|
7572
|
-
var
|
|
7621
|
+
var import_react103 = require("react");
|
|
7573
7622
|
|
|
7574
7623
|
// src/components/ChatHeader.tsx
|
|
7575
|
-
var
|
|
7624
|
+
var import_react46 = require("react");
|
|
7576
7625
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7577
7626
|
function ChatHeader({
|
|
7578
7627
|
onClose,
|
|
@@ -7586,20 +7635,20 @@ function ChatHeader({
|
|
|
7586
7635
|
onOpenSettings,
|
|
7587
7636
|
settingsLabel
|
|
7588
7637
|
}) {
|
|
7589
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
7590
|
-
const wrapRef = (0,
|
|
7591
|
-
const kebabRef = (0,
|
|
7592
|
-
const firstItemRef = (0,
|
|
7638
|
+
const [menuOpen, setMenuOpen] = (0, import_react46.useState)(false);
|
|
7639
|
+
const wrapRef = (0, import_react46.useRef)(null);
|
|
7640
|
+
const kebabRef = (0, import_react46.useRef)(null);
|
|
7641
|
+
const firstItemRef = (0, import_react46.useRef)(null);
|
|
7593
7642
|
const hasNew = !!(canReset && onNewConversation);
|
|
7594
7643
|
const hasSettings = !!onOpenSettings;
|
|
7595
7644
|
const hasMenu = hasNew || hasSettings;
|
|
7596
|
-
(0,
|
|
7645
|
+
(0, import_react46.useEffect)(() => {
|
|
7597
7646
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7598
7647
|
}, [menuOpen]);
|
|
7599
|
-
(0,
|
|
7648
|
+
(0, import_react46.useEffect)(() => {
|
|
7600
7649
|
if (!menuOpen) return;
|
|
7601
7650
|
const onPointer = (e) => {
|
|
7602
|
-
if (!wrapRef.current
|
|
7651
|
+
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
7603
7652
|
};
|
|
7604
7653
|
const onKey = (e) => {
|
|
7605
7654
|
if (e.key === "Escape") {
|
|
@@ -7669,10 +7718,10 @@ function ChatHeader({
|
|
|
7669
7718
|
}
|
|
7670
7719
|
|
|
7671
7720
|
// src/components/MessageList.tsx
|
|
7672
|
-
var
|
|
7721
|
+
var import_react59 = require("react");
|
|
7673
7722
|
|
|
7674
7723
|
// src/components/ChatMessage.tsx
|
|
7675
|
-
var
|
|
7724
|
+
var import_react58 = require("react");
|
|
7676
7725
|
|
|
7677
7726
|
// src/components/Markdown.tsx
|
|
7678
7727
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -7690,7 +7739,7 @@ function Markdown({ text: text2 }) {
|
|
|
7690
7739
|
}
|
|
7691
7740
|
|
|
7692
7741
|
// src/components/EntityCardList.tsx
|
|
7693
|
-
var
|
|
7742
|
+
var import_react47 = require("react");
|
|
7694
7743
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7695
7744
|
var MAX_VISIBLE = 3;
|
|
7696
7745
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7774,7 +7823,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7774
7823
|
)) });
|
|
7775
7824
|
}
|
|
7776
7825
|
function EntityCardItem({ c }) {
|
|
7777
|
-
const [active, setActive] = (0,
|
|
7826
|
+
const [active, setActive] = (0, import_react47.useState)(0);
|
|
7778
7827
|
const hasBody = c.scopes.length > 0;
|
|
7779
7828
|
if (!hasBody) {
|
|
7780
7829
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -7788,7 +7837,7 @@ function EntityCardItem({ c }) {
|
|
|
7788
7837
|
] });
|
|
7789
7838
|
}
|
|
7790
7839
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
7791
|
-
const [expanded, setExpanded] = (0,
|
|
7840
|
+
const [expanded, setExpanded] = (0, import_react47.useState)(false);
|
|
7792
7841
|
if (cards.length === 0) return null;
|
|
7793
7842
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7794
7843
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7889,17 +7938,17 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7889
7938
|
}
|
|
7890
7939
|
|
|
7891
7940
|
// src/components/AddAllToSlipButton.tsx
|
|
7892
|
-
var
|
|
7941
|
+
var import_react48 = require("react");
|
|
7893
7942
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7894
7943
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
7895
7944
|
const add = useSlipAdd(slip, ui);
|
|
7896
7945
|
const slipState = useSlipState();
|
|
7897
7946
|
const log = useEventLog();
|
|
7898
7947
|
const track = useTrack();
|
|
7899
|
-
const [pending, setPending] = (0,
|
|
7900
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
7901
|
-
const [toast, setToast] = (0,
|
|
7902
|
-
const dismiss = (0,
|
|
7948
|
+
const [pending, setPending] = (0, import_react48.useState)(false);
|
|
7949
|
+
const [settledLocal, setSettledLocal] = (0, import_react48.useState)({});
|
|
7950
|
+
const [toast, setToast] = (0, import_react48.useState)(null);
|
|
7951
|
+
const dismiss = (0, import_react48.useCallback)(() => setToast(null), []);
|
|
7903
7952
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
7904
7953
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
7905
7954
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -7972,10 +8021,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
7972
8021
|
}
|
|
7973
8022
|
|
|
7974
8023
|
// src/presetToolsContext.ts
|
|
7975
|
-
var
|
|
7976
|
-
var PresetToolsContext = (0,
|
|
8024
|
+
var import_react49 = require("react");
|
|
8025
|
+
var PresetToolsContext = (0, import_react49.createContext)(null);
|
|
7977
8026
|
function usePresetTools() {
|
|
7978
|
-
return (0,
|
|
8027
|
+
return (0, import_react49.useContext)(PresetToolsContext);
|
|
7979
8028
|
}
|
|
7980
8029
|
|
|
7981
8030
|
// src/components/ComboCardList.tsx
|
|
@@ -9209,7 +9258,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
9209
9258
|
}
|
|
9210
9259
|
|
|
9211
9260
|
// src/components/CompactOddsList.tsx
|
|
9212
|
-
var
|
|
9261
|
+
var import_react50 = require("react");
|
|
9213
9262
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
9214
9263
|
|
|
9215
9264
|
// src/compactList.ts
|
|
@@ -9331,11 +9380,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
9331
9380
|
] });
|
|
9332
9381
|
}
|
|
9333
9382
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
9334
|
-
const [shown2, setShown] = (0,
|
|
9383
|
+
const [shown2, setShown] = (0, import_react50.useState)(COMPACT_PAGE);
|
|
9335
9384
|
const hidden = list.rowCount - shown2;
|
|
9336
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
9337
|
-
const focusRef = (0,
|
|
9338
|
-
(0,
|
|
9385
|
+
const [focusIndex, setFocusIndex] = (0, import_react50.useState)(null);
|
|
9386
|
+
const focusRef = (0, import_react50.useRef)(null);
|
|
9387
|
+
(0, import_react50.useEffect)(() => {
|
|
9339
9388
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
9340
9389
|
}, [focusIndex]);
|
|
9341
9390
|
let left = shown2;
|
|
@@ -9570,7 +9619,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9570
9619
|
}
|
|
9571
9620
|
|
|
9572
9621
|
// src/components/dashboard/CountdownCard.tsx
|
|
9573
|
-
var
|
|
9622
|
+
var import_react51 = require("react");
|
|
9574
9623
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9575
9624
|
var DAY_MS3 = 864e5;
|
|
9576
9625
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -9589,12 +9638,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9589
9638
|
function CountdownCard({ card, ui }) {
|
|
9590
9639
|
const { data } = card;
|
|
9591
9640
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
9592
|
-
const [nowMs, setNowMs] = (0,
|
|
9593
|
-
const [reduced] = (0,
|
|
9641
|
+
const [nowMs, setNowMs] = (0, import_react51.useState)(() => Date.now());
|
|
9642
|
+
const [reduced] = (0, import_react51.useState)(
|
|
9594
9643
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9595
9644
|
);
|
|
9596
9645
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9597
|
-
(0,
|
|
9646
|
+
(0, import_react51.useEffect)(() => {
|
|
9598
9647
|
if (reduced) return;
|
|
9599
9648
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
9600
9649
|
return () => window.clearInterval(id);
|
|
@@ -9602,7 +9651,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9602
9651
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
9603
9652
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
9604
9653
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
9605
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9654
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react51.Fragment, { children: [
|
|
9606
9655
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
9607
9656
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
9608
9657
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -9613,7 +9662,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9613
9662
|
}
|
|
9614
9663
|
|
|
9615
9664
|
// src/components/dashboard/InjuriesCard.tsx
|
|
9616
|
-
var
|
|
9665
|
+
var import_react52 = require("react");
|
|
9617
9666
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9618
9667
|
var SHOWN = 3;
|
|
9619
9668
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9636,7 +9685,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9636
9685
|
}
|
|
9637
9686
|
function InjuriesCard({ card, ui }) {
|
|
9638
9687
|
const { data } = card;
|
|
9639
|
-
const [expanded, setExpanded] = (0,
|
|
9688
|
+
const [expanded, setExpanded] = (0, import_react52.useState)(false);
|
|
9640
9689
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9641
9690
|
const limit = expanded ? void 0 : SHOWN;
|
|
9642
9691
|
const { showMore, showLess } = ui;
|
|
@@ -9741,7 +9790,7 @@ function LinksCard({ card }) {
|
|
|
9741
9790
|
}
|
|
9742
9791
|
|
|
9743
9792
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9744
|
-
var
|
|
9793
|
+
var import_react53 = require("react");
|
|
9745
9794
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9746
9795
|
function initials3(name) {
|
|
9747
9796
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9751,7 +9800,7 @@ function PostMatchCrest({
|
|
|
9751
9800
|
name,
|
|
9752
9801
|
side
|
|
9753
9802
|
}) {
|
|
9754
|
-
const [failed, setFailed] = (0,
|
|
9803
|
+
const [failed, setFailed] = (0, import_react53.useState)(false);
|
|
9755
9804
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9756
9805
|
if (url && !failed) {
|
|
9757
9806
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9950,10 +9999,10 @@ function RestingFormCard({ card }) {
|
|
|
9950
9999
|
}
|
|
9951
10000
|
|
|
9952
10001
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9953
|
-
var
|
|
10002
|
+
var import_react55 = require("react");
|
|
9954
10003
|
|
|
9955
10004
|
// src/useLiveClock.ts
|
|
9956
|
-
var
|
|
10005
|
+
var import_react54 = require("react");
|
|
9957
10006
|
var TICK_MS = 6e4;
|
|
9958
10007
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9959
10008
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9962,10 +10011,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9962
10011
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9963
10012
|
}
|
|
9964
10013
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9965
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10014
|
+
const [displayMinute, setDisplayMinute] = (0, import_react54.useState)(
|
|
9966
10015
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9967
10016
|
);
|
|
9968
|
-
(0,
|
|
10017
|
+
(0, import_react54.useEffect)(() => {
|
|
9969
10018
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9970
10019
|
if (!clockRunning) return;
|
|
9971
10020
|
const id = window.setInterval(() => {
|
|
@@ -9982,7 +10031,7 @@ function initials5(name) {
|
|
|
9982
10031
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9983
10032
|
}
|
|
9984
10033
|
function LiveCrest({ url, name, side }) {
|
|
9985
|
-
const [failed, setFailed] = (0,
|
|
10034
|
+
const [failed, setFailed] = (0, import_react55.useState)(false);
|
|
9986
10035
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9987
10036
|
if (url && !failed) {
|
|
9988
10037
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10004,7 +10053,7 @@ function LiveScoreCard({
|
|
|
10004
10053
|
}) {
|
|
10005
10054
|
const { data } = card;
|
|
10006
10055
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10007
|
-
const seedRef = (0,
|
|
10056
|
+
const seedRef = (0, import_react55.useRef)(null);
|
|
10008
10057
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10009
10058
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10010
10059
|
}
|
|
@@ -10050,7 +10099,7 @@ function LiveScoreCard({
|
|
|
10050
10099
|
}
|
|
10051
10100
|
|
|
10052
10101
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10053
|
-
var
|
|
10102
|
+
var import_react56 = require("react");
|
|
10054
10103
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10055
10104
|
var SHOWN2 = 3;
|
|
10056
10105
|
function EventIcon({ type }) {
|
|
@@ -10092,7 +10141,7 @@ function EventRow({ e }) {
|
|
|
10092
10141
|
] });
|
|
10093
10142
|
}
|
|
10094
10143
|
function LiveTimelineCard({ card, ui }) {
|
|
10095
|
-
const [expanded, setExpanded] = (0,
|
|
10144
|
+
const [expanded, setExpanded] = (0, import_react56.useState)(false);
|
|
10096
10145
|
const events = card.data.events;
|
|
10097
10146
|
if (!events || events.length === 0) return null;
|
|
10098
10147
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -10116,7 +10165,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
10116
10165
|
}
|
|
10117
10166
|
|
|
10118
10167
|
// src/components/dashboard/MomentumWave.tsx
|
|
10119
|
-
var
|
|
10168
|
+
var import_react57 = require("react");
|
|
10120
10169
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10121
10170
|
var WIDTH = 270;
|
|
10122
10171
|
var HEIGHT = 56;
|
|
@@ -10141,7 +10190,7 @@ function MomentumWave({
|
|
|
10141
10190
|
}) {
|
|
10142
10191
|
if (points.length === 0) return null;
|
|
10143
10192
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
10144
|
-
const clipId = (0,
|
|
10193
|
+
const clipId = (0, import_react57.useId)();
|
|
10145
10194
|
const topClipId = `${clipId}-top`;
|
|
10146
10195
|
const bottomClipId = `${clipId}-bottom`;
|
|
10147
10196
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -10291,7 +10340,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
10291
10340
|
// src/components/ChatMessage.tsx
|
|
10292
10341
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
10293
10342
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
10294
|
-
const [sport, setSport] = (0,
|
|
10343
|
+
const [sport, setSport] = (0, import_react58.useState)(null);
|
|
10295
10344
|
if (message.role === "user") {
|
|
10296
10345
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
10297
10346
|
}
|
|
@@ -10345,11 +10394,11 @@ function turnAnchor(messages) {
|
|
|
10345
10394
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
10346
10395
|
const { state, send } = controller;
|
|
10347
10396
|
const { oddsFormat } = useOddsSettings();
|
|
10348
|
-
const listRef = (0,
|
|
10349
|
-
const endRef = (0,
|
|
10350
|
-
const pinnedRef = (0,
|
|
10351
|
-
const anchoredTurnRef = (0,
|
|
10352
|
-
(0,
|
|
10397
|
+
const listRef = (0, import_react59.useRef)(null);
|
|
10398
|
+
const endRef = (0, import_react59.useRef)(null);
|
|
10399
|
+
const pinnedRef = (0, import_react59.useRef)(true);
|
|
10400
|
+
const anchoredTurnRef = (0, import_react59.useRef)(null);
|
|
10401
|
+
(0, import_react59.useEffect)(() => {
|
|
10353
10402
|
const anchor = turnAnchor(state.messages);
|
|
10354
10403
|
const list = listRef.current;
|
|
10355
10404
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -10408,13 +10457,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
10408
10457
|
}
|
|
10409
10458
|
|
|
10410
10459
|
// src/components/ChatInput.tsx
|
|
10411
|
-
var
|
|
10460
|
+
var import_react60 = require("react");
|
|
10412
10461
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10413
|
-
var ChatInput = (0,
|
|
10414
|
-
const [value, setValue] = (0,
|
|
10415
|
-
const textareaRef = (0,
|
|
10416
|
-
const stopRef = (0,
|
|
10417
|
-
const textBoxWantsFocusRef = (0,
|
|
10462
|
+
var ChatInput = (0, import_react60.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
10463
|
+
const [value, setValue] = (0, import_react60.useState)("");
|
|
10464
|
+
const textareaRef = (0, import_react60.useRef)(null);
|
|
10465
|
+
const stopRef = (0, import_react60.useRef)(null);
|
|
10466
|
+
const textBoxWantsFocusRef = (0, import_react60.useRef)(false);
|
|
10418
10467
|
const submit = () => {
|
|
10419
10468
|
if (disabled) return;
|
|
10420
10469
|
const t = value.trim();
|
|
@@ -10428,7 +10477,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10428
10477
|
submit();
|
|
10429
10478
|
}
|
|
10430
10479
|
};
|
|
10431
|
-
(0,
|
|
10480
|
+
(0, import_react60.useImperativeHandle)(ref, () => ({
|
|
10432
10481
|
focus() {
|
|
10433
10482
|
const box = textareaRef.current;
|
|
10434
10483
|
if (box && !box.disabled) {
|
|
@@ -10440,7 +10489,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10440
10489
|
stopRef.current?.focus();
|
|
10441
10490
|
}
|
|
10442
10491
|
}), []);
|
|
10443
|
-
(0,
|
|
10492
|
+
(0, import_react60.useEffect)(() => {
|
|
10444
10493
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
10445
10494
|
textBoxWantsFocusRef.current = false;
|
|
10446
10495
|
const box = textareaRef.current;
|
|
@@ -10471,7 +10520,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10471
10520
|
});
|
|
10472
10521
|
|
|
10473
10522
|
// src/components/TabBar.tsx
|
|
10474
|
-
var
|
|
10523
|
+
var import_react61 = require("react");
|
|
10475
10524
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10476
10525
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true], [4, true], [5, true], [6, true]];
|
|
10477
10526
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -10494,16 +10543,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10494
10543
|
...favouritesEnabled && !clubEnabled ? [{ tab: "favourites", label: ui.tabFavourites, count: 0, dot: false }] : []
|
|
10495
10544
|
];
|
|
10496
10545
|
const track = useTrack();
|
|
10497
|
-
const listRef = (0,
|
|
10546
|
+
const listRef = (0, import_react61.useRef)(null);
|
|
10498
10547
|
const activeTab = monitor.activeTab;
|
|
10499
|
-
(0,
|
|
10548
|
+
(0, import_react61.useEffect)(() => {
|
|
10500
10549
|
const el = listRef.current?.querySelector("[data-on]");
|
|
10501
10550
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
10502
10551
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10503
10552
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
10504
10553
|
}, [activeTab]);
|
|
10505
10554
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
10506
|
-
(0,
|
|
10555
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
10507
10556
|
const strip = listRef.current;
|
|
10508
10557
|
if (!strip) return;
|
|
10509
10558
|
const fav = strip.querySelector("[data-fav-tab]");
|
|
@@ -10557,7 +10606,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10557
10606
|
}
|
|
10558
10607
|
|
|
10559
10608
|
// src/components/MonitorTabs.tsx
|
|
10560
|
-
var
|
|
10609
|
+
var import_react73 = require("react");
|
|
10561
10610
|
|
|
10562
10611
|
// src/components/MarketAccordion.tsx
|
|
10563
10612
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10619,19 +10668,19 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10619
10668
|
}
|
|
10620
10669
|
|
|
10621
10670
|
// src/components/LiveFactBlock.tsx
|
|
10622
|
-
var
|
|
10671
|
+
var import_react63 = require("react");
|
|
10623
10672
|
|
|
10624
10673
|
// src/useFactView.ts
|
|
10625
|
-
var
|
|
10674
|
+
var import_react62 = require("react");
|
|
10626
10675
|
var DWELL_MS = 1e3;
|
|
10627
10676
|
var seen = /* @__PURE__ */ new Set();
|
|
10628
10677
|
function useFactView(ref, fact, entity2) {
|
|
10629
10678
|
const log = useEventLog();
|
|
10630
|
-
const entityRef = (0,
|
|
10679
|
+
const entityRef = (0, import_react62.useRef)(entity2);
|
|
10631
10680
|
entityRef.current = entity2;
|
|
10632
10681
|
const id = fact?.id;
|
|
10633
10682
|
const factKey = fact?.factKey;
|
|
10634
|
-
(0,
|
|
10683
|
+
(0, import_react62.useEffect)(() => {
|
|
10635
10684
|
if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
|
|
10636
10685
|
const el = ref.current;
|
|
10637
10686
|
if (!el) return;
|
|
@@ -10668,10 +10717,10 @@ function useFactView(ref, fact, entity2) {
|
|
|
10668
10717
|
// src/components/LiveFactBlock.tsx
|
|
10669
10718
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10670
10719
|
function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
10671
|
-
const [expanded, setExpanded] = (0,
|
|
10720
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(false);
|
|
10672
10721
|
const { oddsFormat } = useOddsSettings();
|
|
10673
10722
|
const log = useEventLog();
|
|
10674
|
-
const sectionRef = (0,
|
|
10723
|
+
const sectionRef = (0, import_react63.useRef)(null);
|
|
10675
10724
|
const [current, ...earlier] = facts;
|
|
10676
10725
|
const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
|
|
10677
10726
|
useFactView(sectionRef, current, entity2);
|
|
@@ -10745,7 +10794,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10745
10794
|
}
|
|
10746
10795
|
|
|
10747
10796
|
// src/components/MonitorFormH2H.tsx
|
|
10748
|
-
var
|
|
10797
|
+
var import_react64 = require("react");
|
|
10749
10798
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10750
10799
|
function resultClass2(result) {
|
|
10751
10800
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10761,7 +10810,7 @@ function FormDots({ form, ui }) {
|
|
|
10761
10810
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10762
10811
|
}
|
|
10763
10812
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10764
|
-
const [expanded, setExpanded] = (0,
|
|
10813
|
+
const [expanded, setExpanded] = (0, import_react64.useState)(false);
|
|
10765
10814
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10766
10815
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10767
10816
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, {});
|
|
@@ -10994,7 +11043,7 @@ var sportLabel = (ui, sport) => {
|
|
|
10994
11043
|
};
|
|
10995
11044
|
|
|
10996
11045
|
// src/components/NbaFormSection.tsx
|
|
10997
|
-
var
|
|
11046
|
+
var import_react65 = require("react");
|
|
10998
11047
|
|
|
10999
11048
|
// src/components/NbaFormRest.tsx
|
|
11000
11049
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -11093,8 +11142,8 @@ function Row2({ game, abbr, tonight, ui }) {
|
|
|
11093
11142
|
] });
|
|
11094
11143
|
}
|
|
11095
11144
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11096
|
-
const [open, setOpen] = (0,
|
|
11097
|
-
const [side, setSide] = (0,
|
|
11145
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
11146
|
+
const [side, setSide] = (0, import_react65.useState)("away");
|
|
11098
11147
|
const form = useNbaForm(match, monitor);
|
|
11099
11148
|
const b = match.basketball;
|
|
11100
11149
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11136,10 +11185,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11136
11185
|
}
|
|
11137
11186
|
|
|
11138
11187
|
// src/components/NbaPropsSection.tsx
|
|
11139
|
-
var
|
|
11188
|
+
var import_react67 = require("react");
|
|
11140
11189
|
|
|
11141
11190
|
// src/components/PropsPieces.tsx
|
|
11142
|
-
var
|
|
11191
|
+
var import_react66 = require("react");
|
|
11143
11192
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11144
11193
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11145
11194
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11152,9 +11201,9 @@ function preKickoff(match) {
|
|
|
11152
11201
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
11153
11202
|
}
|
|
11154
11203
|
function usePreKickoff(match) {
|
|
11155
|
-
const [, setTick] = (0,
|
|
11204
|
+
const [, setTick] = (0, import_react66.useState)(0);
|
|
11156
11205
|
const pre = preKickoff(match);
|
|
11157
|
-
(0,
|
|
11206
|
+
(0, import_react66.useEffect)(() => {
|
|
11158
11207
|
if (!pre || !match.kickoffUtc) return;
|
|
11159
11208
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11160
11209
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11168,7 +11217,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11168
11217
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11169
11218
|
const live = match.phase === "live";
|
|
11170
11219
|
const open = pre || live;
|
|
11171
|
-
(0,
|
|
11220
|
+
(0, import_react66.useEffect)(() => {
|
|
11172
11221
|
if (!open) return;
|
|
11173
11222
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11174
11223
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11246,7 +11295,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
11246
11295
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
11247
11296
|
const player = livePlayer(bundle, given);
|
|
11248
11297
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
11249
|
-
const [picked, setPicked] = (0,
|
|
11298
|
+
const [picked, setPicked] = (0, import_react66.useState)(null);
|
|
11250
11299
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
11251
11300
|
const sample = active?.games?.length ?? 0;
|
|
11252
11301
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -11295,7 +11344,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11295
11344
|
] });
|
|
11296
11345
|
}
|
|
11297
11346
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11298
|
-
const [openId, setOpenId] = (0,
|
|
11347
|
+
const [openId, setOpenId] = (0, import_react66.useState)(null);
|
|
11299
11348
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11300
11349
|
const p = livePlayer(bundle, given);
|
|
11301
11350
|
const isOpen = openId === p.playerId;
|
|
@@ -11332,12 +11381,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11332
11381
|
}
|
|
11333
11382
|
var BOX_QUIET_MS = 12e4;
|
|
11334
11383
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
11335
|
-
const [tick, setTick] = (0,
|
|
11384
|
+
const [tick, setTick] = (0, import_react66.useState)(0);
|
|
11336
11385
|
const time = clock2(boxAsOfUtc, ui);
|
|
11337
11386
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11338
11387
|
const valid = !Number.isNaN(at2);
|
|
11339
11388
|
const onBreak = atBreak(match);
|
|
11340
|
-
(0,
|
|
11389
|
+
(0, import_react66.useEffect)(() => {
|
|
11341
11390
|
if (!valid || onBreak) return;
|
|
11342
11391
|
const age2 = Date.now() - at2;
|
|
11343
11392
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11398,12 +11447,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
11398
11447
|
tenGameBars: false
|
|
11399
11448
|
});
|
|
11400
11449
|
function StatsClock2({ bundle, match, ui }) {
|
|
11401
|
-
const [tick, setTick] = (0,
|
|
11450
|
+
const [tick, setTick] = (0, import_react67.useState)(0);
|
|
11402
11451
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
11403
11452
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11404
11453
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11405
11454
|
const onBreak = atBreak(match);
|
|
11406
|
-
(0,
|
|
11455
|
+
(0, import_react67.useEffect)(() => {
|
|
11407
11456
|
if (!valid || onBreak) return;
|
|
11408
11457
|
const age2 = Date.now() - at2;
|
|
11409
11458
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11417,7 +11466,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11417
11466
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
11418
11467
|
}
|
|
11419
11468
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
11420
|
-
const [side, setSide] = (0,
|
|
11469
|
+
const [side, setSide] = (0, import_react67.useState)("home");
|
|
11421
11470
|
const descriptor = nbaDescriptor(ui, match);
|
|
11422
11471
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11423
11472
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11566,7 +11615,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11566
11615
|
}
|
|
11567
11616
|
|
|
11568
11617
|
// src/components/NflFormSection.tsx
|
|
11569
|
-
var
|
|
11618
|
+
var import_react68 = require("react");
|
|
11570
11619
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11571
11620
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11572
11621
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11618,7 +11667,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11618
11667
|
] });
|
|
11619
11668
|
}
|
|
11620
11669
|
function NflFormSection({ match, monitor, ui }) {
|
|
11621
|
-
const [segment, setSegment] = (0,
|
|
11670
|
+
const [segment, setSegment] = (0, import_react68.useState)("away");
|
|
11622
11671
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11623
11672
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11624
11673
|
const form = bundle?.form;
|
|
@@ -11651,7 +11700,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11651
11700
|
}
|
|
11652
11701
|
|
|
11653
11702
|
// src/components/NflPropsSection.tsx
|
|
11654
|
-
var
|
|
11703
|
+
var import_react69 = require("react");
|
|
11655
11704
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11656
11705
|
var TRENDS_SHOWN = 3;
|
|
11657
11706
|
var SCORERS_SHOWN = 8;
|
|
@@ -11724,7 +11773,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11724
11773
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11725
11774
|
}
|
|
11726
11775
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11727
|
-
const [all, setAll] = (0,
|
|
11776
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11728
11777
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11729
11778
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11730
11779
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11757,7 +11806,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11757
11806
|
] });
|
|
11758
11807
|
}
|
|
11759
11808
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11760
|
-
const [all, setAll] = (0,
|
|
11809
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11761
11810
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11762
11811
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11763
11812
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11784,7 +11833,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11784
11833
|
] });
|
|
11785
11834
|
}
|
|
11786
11835
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
11787
|
-
const [tab, setTab] = (0,
|
|
11836
|
+
const [tab, setTab] = (0, import_react69.useState)(null);
|
|
11788
11837
|
const descriptor = nflDescriptor(ui);
|
|
11789
11838
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11790
11839
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11970,7 +12019,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11970
12019
|
}
|
|
11971
12020
|
|
|
11972
12021
|
// src/components/TennisMonitorCard.tsx
|
|
11973
|
-
var
|
|
12022
|
+
var import_react71 = require("react");
|
|
11974
12023
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
11975
12024
|
|
|
11976
12025
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12231,7 +12280,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12231
12280
|
}
|
|
12232
12281
|
|
|
12233
12282
|
// src/components/TennisStatsTables.tsx
|
|
12234
|
-
var
|
|
12283
|
+
var import_react70 = require("react");
|
|
12235
12284
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12236
12285
|
function formatStat(row, value, locale) {
|
|
12237
12286
|
if (value == null) return "\u2013";
|
|
@@ -12269,8 +12318,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12269
12318
|
] });
|
|
12270
12319
|
}
|
|
12271
12320
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12272
|
-
const [tab, setTab] = (0,
|
|
12273
|
-
(0,
|
|
12321
|
+
const [tab, setTab] = (0, import_react70.useState)("match");
|
|
12322
|
+
(0, import_react70.useEffect)(() => {
|
|
12274
12323
|
setTab("match");
|
|
12275
12324
|
}, [resetKey]);
|
|
12276
12325
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12301,7 +12350,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12301
12350
|
] }),
|
|
12302
12351
|
today.rows.map((r) => {
|
|
12303
12352
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react70.Fragment, { children: [
|
|
12305
12354
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12306
12355
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12307
12356
|
f(r.p1Today),
|
|
@@ -12436,7 +12485,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12436
12485
|
] });
|
|
12437
12486
|
}
|
|
12438
12487
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12439
|
-
const lastTables = (0,
|
|
12488
|
+
const lastTables = (0, import_react71.useRef)(null);
|
|
12440
12489
|
const t = match.tennis;
|
|
12441
12490
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12442
12491
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12516,7 +12565,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12516
12565
|
}
|
|
12517
12566
|
|
|
12518
12567
|
// src/components/ScoreboardStrip.tsx
|
|
12519
|
-
var
|
|
12568
|
+
var import_react72 = require("react");
|
|
12520
12569
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12521
12570
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12522
12571
|
function nbaStatus(m, ui) {
|
|
@@ -12611,8 +12660,8 @@ function rowsFor(m) {
|
|
|
12611
12660
|
];
|
|
12612
12661
|
}
|
|
12613
12662
|
function useStripScroll(selectedKey) {
|
|
12614
|
-
const stripRef = (0,
|
|
12615
|
-
(0,
|
|
12663
|
+
const stripRef = (0, import_react72.useRef)(null);
|
|
12664
|
+
(0, import_react72.useEffect)(() => {
|
|
12616
12665
|
const strip = stripRef.current;
|
|
12617
12666
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12618
12667
|
if (!strip || !pressed) return;
|
|
@@ -12786,7 +12835,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12786
12835
|
] });
|
|
12787
12836
|
}
|
|
12788
12837
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
12789
|
-
const seedIndex = (0,
|
|
12838
|
+
const seedIndex = (0, import_react73.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
12790
12839
|
const tiles = orderTiles(
|
|
12791
12840
|
monitor.pins,
|
|
12792
12841
|
monitor.snapshot,
|
|
@@ -12858,7 +12907,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
12858
12907
|
}
|
|
12859
12908
|
|
|
12860
12909
|
// src/components/LivePanel.tsx
|
|
12861
|
-
var
|
|
12910
|
+
var import_react76 = require("react");
|
|
12862
12911
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
12863
12912
|
|
|
12864
12913
|
// src/scheduleView.ts
|
|
@@ -13033,20 +13082,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13033
13082
|
}
|
|
13034
13083
|
|
|
13035
13084
|
// src/components/MatchSheet.tsx
|
|
13036
|
-
var
|
|
13085
|
+
var import_react75 = require("react");
|
|
13037
13086
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13038
13087
|
|
|
13039
13088
|
// src/useModalDialog.ts
|
|
13040
|
-
var
|
|
13089
|
+
var import_react74 = require("react");
|
|
13041
13090
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13042
13091
|
function useModalDialog(onClose, opts = {}) {
|
|
13043
|
-
const dialogRef = (0,
|
|
13044
|
-
const onCloseRef = (0,
|
|
13092
|
+
const dialogRef = (0, import_react74.useRef)(null);
|
|
13093
|
+
const onCloseRef = (0, import_react74.useRef)(onClose);
|
|
13045
13094
|
onCloseRef.current = onClose;
|
|
13046
|
-
const openerRef = (0,
|
|
13095
|
+
const openerRef = (0, import_react74.useRef)(opts.opener);
|
|
13047
13096
|
openerRef.current = opts.opener;
|
|
13048
13097
|
const restore = opts.restoreFocus ?? true;
|
|
13049
|
-
(0,
|
|
13098
|
+
(0, import_react74.useEffect)(() => {
|
|
13050
13099
|
const dialog = dialogRef.current;
|
|
13051
13100
|
const root = dialog?.getRootNode();
|
|
13052
13101
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13057,7 +13106,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13057
13106
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13058
13107
|
};
|
|
13059
13108
|
}, []);
|
|
13060
|
-
(0,
|
|
13109
|
+
(0, import_react74.useEffect)(() => {
|
|
13061
13110
|
const onKey = (e) => {
|
|
13062
13111
|
if (e.key !== "Escape") return;
|
|
13063
13112
|
e.stopPropagation();
|
|
@@ -13098,8 +13147,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13098
13147
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13099
13148
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13100
13149
|
const log = useEventLog();
|
|
13101
|
-
const titleId = (0,
|
|
13102
|
-
const [limitHit, setLimitHit] = (0,
|
|
13150
|
+
const titleId = (0, import_react75.useId)();
|
|
13151
|
+
const [limitHit, setLimitHit] = (0, import_react75.useState)(false);
|
|
13103
13152
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13104
13153
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13105
13154
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13200,10 +13249,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13200
13249
|
var QUIET_ROWS = 4;
|
|
13201
13250
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13202
13251
|
const { groups, states, stale } = discovery;
|
|
13203
|
-
const [mine, setMine] = (0,
|
|
13204
|
-
const [toggled, setToggled] = (0,
|
|
13205
|
-
const [sheet, setSheet] = (0,
|
|
13206
|
-
const pinnedKeys = (0,
|
|
13252
|
+
const [mine, setMine] = (0, import_react76.useState)(false);
|
|
13253
|
+
const [toggled, setToggled] = (0, import_react76.useState)(/* @__PURE__ */ new Map());
|
|
13254
|
+
const [sheet, setSheet] = (0, import_react76.useState)(null);
|
|
13255
|
+
const pinnedKeys = (0, import_react76.useMemo)(
|
|
13207
13256
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13208
13257
|
[monitor.pins]
|
|
13209
13258
|
);
|
|
@@ -13309,20 +13358,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13309
13358
|
}
|
|
13310
13359
|
|
|
13311
13360
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13312
|
-
var
|
|
13361
|
+
var import_react80 = require("react");
|
|
13313
13362
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13314
13363
|
|
|
13315
13364
|
// src/useTennisRowPrices.ts
|
|
13316
|
-
var
|
|
13365
|
+
var import_react77 = require("react");
|
|
13317
13366
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13318
13367
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13319
13368
|
function useTennisRowPrices(a) {
|
|
13320
|
-
const [state, setState] = (0,
|
|
13321
|
-
const getPricesRef = (0,
|
|
13369
|
+
const [state, setState] = (0, import_react77.useState)({ byId: null, stale: false });
|
|
13370
|
+
const getPricesRef = (0, import_react77.useRef)(a.getPrices);
|
|
13322
13371
|
getPricesRef.current = a.getPrices;
|
|
13323
|
-
const latest = (0,
|
|
13372
|
+
const latest = (0, import_react77.useRef)(0);
|
|
13324
13373
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13325
|
-
(0,
|
|
13374
|
+
(0, import_react77.useEffect)(() => {
|
|
13326
13375
|
if (!a.enabled || idsKey === "") {
|
|
13327
13376
|
latest.current++;
|
|
13328
13377
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13360,11 +13409,11 @@ function useTennisRowPrices(a) {
|
|
|
13360
13409
|
}
|
|
13361
13410
|
|
|
13362
13411
|
// src/components/DayStrip.tsx
|
|
13363
|
-
var
|
|
13412
|
+
var import_react78 = require("react");
|
|
13364
13413
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13365
13414
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13366
|
-
const listRef = (0,
|
|
13367
|
-
(0,
|
|
13415
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
13416
|
+
(0, import_react78.useEffect)(() => {
|
|
13368
13417
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13369
13418
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13370
13419
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13393,7 +13442,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13393
13442
|
}
|
|
13394
13443
|
|
|
13395
13444
|
// src/components/games/ui/SearchField.tsx
|
|
13396
|
-
var
|
|
13445
|
+
var import_react79 = require("react");
|
|
13397
13446
|
|
|
13398
13447
|
// src/components/games/ui/icons.tsx
|
|
13399
13448
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -13432,8 +13481,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13432
13481
|
// src/components/games/ui/SearchField.tsx
|
|
13433
13482
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13434
13483
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13435
|
-
const localRef = (0,
|
|
13436
|
-
const setInputRef = (0,
|
|
13484
|
+
const localRef = (0, import_react79.useRef)(null);
|
|
13485
|
+
const setInputRef = (0, import_react79.useCallback)((node) => {
|
|
13437
13486
|
localRef.current = node;
|
|
13438
13487
|
if (typeof inputRef === "function") inputRef(node);
|
|
13439
13488
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13479,18 +13528,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13479
13528
|
var SKELETON_ROWS = 3;
|
|
13480
13529
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13481
13530
|
const { localDate: today, states, stale } = discovery;
|
|
13482
|
-
const searchId = (0,
|
|
13483
|
-
const [query, setQuery] = (0,
|
|
13484
|
-
const [toggled, setToggled] = (0,
|
|
13485
|
-
const [expanded, setExpanded] = (0,
|
|
13486
|
-
const listRef = (0,
|
|
13487
|
-
const [sheet, setSheet] = (0,
|
|
13531
|
+
const searchId = (0, import_react80.useId)();
|
|
13532
|
+
const [query, setQuery] = (0, import_react80.useState)("");
|
|
13533
|
+
const [toggled, setToggled] = (0, import_react80.useState)(/* @__PURE__ */ new Map());
|
|
13534
|
+
const [expanded, setExpanded] = (0, import_react80.useState)(/* @__PURE__ */ new Set());
|
|
13535
|
+
const listRef = (0, import_react80.useRef)(null);
|
|
13536
|
+
const [sheet, setSheet] = (0, import_react80.useState)(null);
|
|
13488
13537
|
const { chips, selected } = loaded;
|
|
13489
|
-
(0,
|
|
13538
|
+
(0, import_react80.useEffect)(() => {
|
|
13490
13539
|
if (selected !== day) onDay(selected);
|
|
13491
13540
|
}, [day, selected, onDay]);
|
|
13492
13541
|
const isToday = selected === today;
|
|
13493
|
-
const pinnedKeys = (0,
|
|
13542
|
+
const pinnedKeys = (0, import_react80.useMemo)(
|
|
13494
13543
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13495
13544
|
[monitor.pins]
|
|
13496
13545
|
);
|
|
@@ -13628,7 +13677,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13628
13677
|
}
|
|
13629
13678
|
|
|
13630
13679
|
// src/components/GamesPanel.tsx
|
|
13631
|
-
var
|
|
13680
|
+
var import_react95 = require("react");
|
|
13632
13681
|
|
|
13633
13682
|
// src/components/GamesLoginWall.tsx
|
|
13634
13683
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
@@ -13637,7 +13686,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13637
13686
|
}
|
|
13638
13687
|
|
|
13639
13688
|
// src/components/GamesHub.tsx
|
|
13640
|
-
var
|
|
13689
|
+
var import_react81 = require("react");
|
|
13641
13690
|
|
|
13642
13691
|
// src/components/games/ui/gameMeta.ts
|
|
13643
13692
|
function prettifyGameId(gameId) {
|
|
@@ -13788,8 +13837,8 @@ function pickHeroGame(games) {
|
|
|
13788
13837
|
}
|
|
13789
13838
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13790
13839
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13791
|
-
const [, setTick] = (0,
|
|
13792
|
-
(0,
|
|
13840
|
+
const [, setTick] = (0, import_react81.useState)(0);
|
|
13841
|
+
(0, import_react81.useEffect)(() => {
|
|
13793
13842
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13794
13843
|
return () => clearInterval(id);
|
|
13795
13844
|
}, []);
|
|
@@ -13849,10 +13898,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13849
13898
|
}
|
|
13850
13899
|
|
|
13851
13900
|
// src/components/GameScreenHost.tsx
|
|
13852
|
-
var
|
|
13901
|
+
var import_react93 = require("react");
|
|
13853
13902
|
|
|
13854
13903
|
// src/useGamePlay.ts
|
|
13855
|
-
var
|
|
13904
|
+
var import_react82 = require("react");
|
|
13856
13905
|
function toSubmitResult(payload) {
|
|
13857
13906
|
return {
|
|
13858
13907
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13864,17 +13913,17 @@ function toSubmitResult(payload) {
|
|
|
13864
13913
|
};
|
|
13865
13914
|
}
|
|
13866
13915
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
13867
|
-
const [result, setResult] = (0,
|
|
13868
|
-
const [submitting, setSubmitting] = (0,
|
|
13869
|
-
const [rawStatus, setRawStatus] = (0,
|
|
13870
|
-
const inFlightRef = (0,
|
|
13871
|
-
const convRef = (0,
|
|
13916
|
+
const [result, setResult] = (0, import_react82.useState)(null);
|
|
13917
|
+
const [submitting, setSubmitting] = (0, import_react82.useState)(false);
|
|
13918
|
+
const [rawStatus, setRawStatus] = (0, import_react82.useState)(null);
|
|
13919
|
+
const inFlightRef = (0, import_react82.useRef)(false);
|
|
13920
|
+
const convRef = (0, import_react82.useRef)(conversation);
|
|
13872
13921
|
convRef.current = conversation;
|
|
13873
|
-
const optsRef = (0,
|
|
13922
|
+
const optsRef = (0, import_react82.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13874
13923
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13875
|
-
const resultRef = (0,
|
|
13924
|
+
const resultRef = (0, import_react82.useRef)(null);
|
|
13876
13925
|
resultRef.current = result;
|
|
13877
|
-
const refetch = (0,
|
|
13926
|
+
const refetch = (0, import_react82.useCallback)(async () => {
|
|
13878
13927
|
const conv = convRef.current;
|
|
13879
13928
|
if (!conv) return;
|
|
13880
13929
|
const opts = optsRef.current;
|
|
@@ -13890,7 +13939,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13890
13939
|
} catch {
|
|
13891
13940
|
}
|
|
13892
13941
|
}, []);
|
|
13893
|
-
const submit = (0,
|
|
13942
|
+
const submit = (0, import_react82.useCallback)(async (answerJson) => {
|
|
13894
13943
|
const conv = convRef.current;
|
|
13895
13944
|
if (!conv || inFlightRef.current) return;
|
|
13896
13945
|
inFlightRef.current = true;
|
|
@@ -13917,14 +13966,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13917
13966
|
setSubmitting(false);
|
|
13918
13967
|
}
|
|
13919
13968
|
}, [refetch]);
|
|
13920
|
-
const hydrate = (0,
|
|
13969
|
+
const hydrate = (0, import_react82.useCallback)(() => {
|
|
13921
13970
|
void refetch();
|
|
13922
13971
|
}, [refetch]);
|
|
13923
13972
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
13924
13973
|
}
|
|
13925
13974
|
|
|
13926
13975
|
// src/components/games/MysteryTigerGame.tsx
|
|
13927
|
-
var
|
|
13976
|
+
var import_react84 = require("react");
|
|
13928
13977
|
|
|
13929
13978
|
// src/components/games/nationFlags.ts
|
|
13930
13979
|
var FLAGS = {
|
|
@@ -14135,7 +14184,7 @@ function isNationCode(flag) {
|
|
|
14135
14184
|
}
|
|
14136
14185
|
|
|
14137
14186
|
// src/components/games/PlayerAvatar.tsx
|
|
14138
|
-
var
|
|
14187
|
+
var import_react83 = require("react");
|
|
14139
14188
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14140
14189
|
function initialsOf(name) {
|
|
14141
14190
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14153,7 +14202,7 @@ function PlayerAvatar({
|
|
|
14153
14202
|
imagePath,
|
|
14154
14203
|
className
|
|
14155
14204
|
}) {
|
|
14156
|
-
const [failed, setFailed] = (0,
|
|
14205
|
+
const [failed, setFailed] = (0, import_react83.useState)(false);
|
|
14157
14206
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14158
14207
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14159
14208
|
}
|
|
@@ -14397,8 +14446,8 @@ function MysteryTigerGame({
|
|
|
14397
14446
|
onBack
|
|
14398
14447
|
}) {
|
|
14399
14448
|
const t = ui.games.mysteryTiger;
|
|
14400
|
-
const [query, setQuery] = (0,
|
|
14401
|
-
const inputId = (0,
|
|
14449
|
+
const [query, setQuery] = (0, import_react84.useState)("");
|
|
14450
|
+
const inputId = (0, import_react84.useId)();
|
|
14402
14451
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14403
14452
|
const guessResults = clientState?.guessResults ?? [];
|
|
14404
14453
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14659,13 +14708,13 @@ function HigherOrLowerGame({
|
|
|
14659
14708
|
}
|
|
14660
14709
|
|
|
14661
14710
|
// src/components/games/CareerPathGame.tsx
|
|
14662
|
-
var
|
|
14711
|
+
var import_react86 = require("react");
|
|
14663
14712
|
|
|
14664
14713
|
// src/components/games/ui/CrestShield.tsx
|
|
14665
|
-
var
|
|
14714
|
+
var import_react85 = require("react");
|
|
14666
14715
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
14667
14716
|
function CrestShield({ src, name, size = 28 }) {
|
|
14668
|
-
const [failed, setFailed] = (0,
|
|
14717
|
+
const [failed, setFailed] = (0, import_react85.useState)(false);
|
|
14669
14718
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14670
14719
|
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14671
14720
|
}
|
|
@@ -14697,8 +14746,8 @@ function CareerPathGame({
|
|
|
14697
14746
|
}) {
|
|
14698
14747
|
const s = ui.games.careerPath;
|
|
14699
14748
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14700
|
-
const [query, setQuery] = (0,
|
|
14701
|
-
const inputId = (0,
|
|
14749
|
+
const [query, setQuery] = (0, import_react86.useState)("");
|
|
14750
|
+
const inputId = (0, import_react86.useId)();
|
|
14702
14751
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14703
14752
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14704
14753
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -14804,7 +14853,7 @@ function CareerPathGame({
|
|
|
14804
14853
|
}
|
|
14805
14854
|
|
|
14806
14855
|
// src/components/games/BeatTheGridGame.tsx
|
|
14807
|
-
var
|
|
14856
|
+
var import_react87 = __toESM(require("react"), 1);
|
|
14808
14857
|
|
|
14809
14858
|
// src/components/games/ui/OptionList.tsx
|
|
14810
14859
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
@@ -14893,10 +14942,10 @@ function SearchSheet({
|
|
|
14893
14942
|
ui
|
|
14894
14943
|
}) {
|
|
14895
14944
|
const s = ui.games.beatTheGrid;
|
|
14896
|
-
const [query, setQuery] = (0,
|
|
14897
|
-
const inputId = (0,
|
|
14898
|
-
const inputRef = (0,
|
|
14899
|
-
(0,
|
|
14945
|
+
const [query, setQuery] = (0, import_react87.useState)("");
|
|
14946
|
+
const inputId = (0, import_react87.useId)();
|
|
14947
|
+
const inputRef = (0, import_react87.useRef)(null);
|
|
14948
|
+
(0, import_react87.useEffect)(() => {
|
|
14900
14949
|
inputRef.current?.focus();
|
|
14901
14950
|
}, [row, col]);
|
|
14902
14951
|
const filtered = playerPool.filter(
|
|
@@ -14961,7 +15010,7 @@ function BeatTheGridGame({
|
|
|
14961
15010
|
}) {
|
|
14962
15011
|
const s = ui.games.beatTheGrid;
|
|
14963
15012
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
14964
|
-
const [activeCell, setActiveCell] = (0,
|
|
15013
|
+
const [activeCell, setActiveCell] = (0, import_react87.useState)(null);
|
|
14965
15014
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
14966
15015
|
const filledCells = clientState?.cells ?? [];
|
|
14967
15016
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15035,7 +15084,7 @@ function BeatTheGridGame({
|
|
|
15035
15084
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15036
15085
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15037
15086
|
] });
|
|
15038
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
15087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react87.default.Fragment, { children: [
|
|
15039
15088
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15040
15089
|
cols.map((colLabel, colIdx) => {
|
|
15041
15090
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15116,7 +15165,7 @@ function BeatTheGridGame({
|
|
|
15116
15165
|
}
|
|
15117
15166
|
|
|
15118
15167
|
// src/components/games/GuessTheXiGame.tsx
|
|
15119
|
-
var
|
|
15168
|
+
var import_react88 = require("react");
|
|
15120
15169
|
|
|
15121
15170
|
// src/components/games/ui/PitchSvg.tsx
|
|
15122
15171
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
@@ -15205,8 +15254,8 @@ function GuessTheXiGame({
|
|
|
15205
15254
|
onBack
|
|
15206
15255
|
}) {
|
|
15207
15256
|
const t = ui.games.guessTheXi;
|
|
15208
|
-
const [query, setQuery] = (0,
|
|
15209
|
-
const inputId = (0,
|
|
15257
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
15258
|
+
const inputId = (0, import_react88.useId)();
|
|
15210
15259
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15211
15260
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15212
15261
|
const solved = clientState?.status === "solved";
|
|
@@ -15348,7 +15397,7 @@ function GuessTheXiGame({
|
|
|
15348
15397
|
}
|
|
15349
15398
|
|
|
15350
15399
|
// src/components/games/DailyQuizGame.tsx
|
|
15351
|
-
var
|
|
15400
|
+
var import_react89 = require("react");
|
|
15352
15401
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
15353
15402
|
function parseClientState6(json) {
|
|
15354
15403
|
if (!json) return null;
|
|
@@ -15389,8 +15438,8 @@ function DailyQuizGame({
|
|
|
15389
15438
|
}) {
|
|
15390
15439
|
const s = ui.games.dailyQuiz;
|
|
15391
15440
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15392
|
-
const [selections, setSelections] = (0,
|
|
15393
|
-
const [page, setPage] = (0,
|
|
15441
|
+
const [selections, setSelections] = (0, import_react89.useState)(/* @__PURE__ */ new Map());
|
|
15442
|
+
const [page, setPage] = (0, import_react89.useState)(0);
|
|
15394
15443
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15395
15444
|
const results2 = clientState?.results ?? [];
|
|
15396
15445
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15500,7 +15549,7 @@ function DailyQuizGame({
|
|
|
15500
15549
|
}
|
|
15501
15550
|
|
|
15502
15551
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15503
|
-
var
|
|
15552
|
+
var import_react90 = require("react");
|
|
15504
15553
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15505
15554
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15506
15555
|
function parseClientState7(json) {
|
|
@@ -15596,12 +15645,12 @@ function MatchdayPredictorGame({
|
|
|
15596
15645
|
onBack
|
|
15597
15646
|
}) {
|
|
15598
15647
|
const t = ui.games.predictor;
|
|
15599
|
-
const [homeScore, setHomeScore] = (0,
|
|
15600
|
-
const [awayScore, setAwayScore] = (0,
|
|
15601
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15602
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15603
|
-
const [query, setQuery] = (0,
|
|
15604
|
-
const searchId = (0,
|
|
15648
|
+
const [homeScore, setHomeScore] = (0, import_react90.useState)(0);
|
|
15649
|
+
const [awayScore, setAwayScore] = (0, import_react90.useState)(0);
|
|
15650
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react90.useState)(null);
|
|
15651
|
+
const [lastEdited, setLastEdited] = (0, import_react90.useState)("home");
|
|
15652
|
+
const [query, setQuery] = (0, import_react90.useState)("");
|
|
15653
|
+
const searchId = (0, import_react90.useId)();
|
|
15605
15654
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15606
15655
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15607
15656
|
const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -15768,7 +15817,7 @@ function MatchdayPredictorGame({
|
|
|
15768
15817
|
}
|
|
15769
15818
|
|
|
15770
15819
|
// src/components/games/StartingXiGame.tsx
|
|
15771
|
-
var
|
|
15820
|
+
var import_react91 = require("react");
|
|
15772
15821
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15773
15822
|
var POINTS_PER_STARTER = 8;
|
|
15774
15823
|
var XI_SIZE = 11;
|
|
@@ -15812,10 +15861,10 @@ function StartingXiGame({
|
|
|
15812
15861
|
lockAtUtc
|
|
15813
15862
|
}) {
|
|
15814
15863
|
const t = ui.games.startingXi;
|
|
15815
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
15816
|
-
const [active, setActive] = (0,
|
|
15817
|
-
const [query, setQuery] = (0,
|
|
15818
|
-
const searchId = (0,
|
|
15864
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react91.useState)(() => Array(XI_SIZE).fill(null));
|
|
15865
|
+
const [active, setActive] = (0, import_react91.useState)(0);
|
|
15866
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15867
|
+
const searchId = (0, import_react91.useId)();
|
|
15819
15868
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
15820
15869
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15821
15870
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -15954,7 +16003,7 @@ function StartingXiGame({
|
|
|
15954
16003
|
}
|
|
15955
16004
|
|
|
15956
16005
|
// src/components/games/StatLadderGame.tsx
|
|
15957
|
-
var
|
|
16006
|
+
var import_react92 = require("react");
|
|
15958
16007
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15959
16008
|
function ladderClue(ladder) {
|
|
15960
16009
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -15991,9 +16040,9 @@ function StatLadderGame({
|
|
|
15991
16040
|
onBack
|
|
15992
16041
|
}) {
|
|
15993
16042
|
const t = ui.games.statLadder;
|
|
15994
|
-
const [query, setQuery] = (0,
|
|
15995
|
-
const [selectedId, setSelectedId] = (0,
|
|
15996
|
-
const searchId = (0,
|
|
16043
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
16044
|
+
const [selectedId, setSelectedId] = (0, import_react92.useState)(null);
|
|
16045
|
+
const searchId = (0, import_react92.useId)();
|
|
15997
16046
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
15998
16047
|
const revealed = clientState != null;
|
|
15999
16048
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16199,8 +16248,8 @@ function GameScreenHost({
|
|
|
16199
16248
|
ui
|
|
16200
16249
|
}) {
|
|
16201
16250
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16202
|
-
const [configJson, setConfigJson] = (0,
|
|
16203
|
-
(0,
|
|
16251
|
+
const [configJson, setConfigJson] = (0, import_react93.useState)(null);
|
|
16252
|
+
(0, import_react93.useEffect)(() => {
|
|
16204
16253
|
setConfigJson(null);
|
|
16205
16254
|
if (!conversation) return;
|
|
16206
16255
|
let cancelled = false;
|
|
@@ -16223,12 +16272,12 @@ function GameScreenHost({
|
|
|
16223
16272
|
fixtureId: fixtureId || void 0,
|
|
16224
16273
|
locale: ui.hostTag
|
|
16225
16274
|
});
|
|
16226
|
-
(0,
|
|
16275
|
+
(0, import_react93.useEffect)(() => {
|
|
16227
16276
|
if (conversation) hydrate();
|
|
16228
16277
|
}, [conversation, gameId]);
|
|
16229
|
-
const hydrateRef = (0,
|
|
16278
|
+
const hydrateRef = (0, import_react93.useRef)(hydrate);
|
|
16230
16279
|
hydrateRef.current = hydrate;
|
|
16231
|
-
(0,
|
|
16280
|
+
(0, import_react93.useEffect)(() => {
|
|
16232
16281
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16233
16282
|
if (rawStatus !== "pending") return;
|
|
16234
16283
|
const timerId = setInterval(() => {
|
|
@@ -16341,7 +16390,7 @@ function GameScreenHost({
|
|
|
16341
16390
|
}
|
|
16342
16391
|
|
|
16343
16392
|
// src/components/Leaderboard.tsx
|
|
16344
|
-
var
|
|
16393
|
+
var import_react94 = require("react");
|
|
16345
16394
|
|
|
16346
16395
|
// src/components/LeaderboardRow.tsx
|
|
16347
16396
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
@@ -16428,7 +16477,7 @@ function Leaderboard({
|
|
|
16428
16477
|
ui,
|
|
16429
16478
|
onPlay
|
|
16430
16479
|
}) {
|
|
16431
|
-
const [segment, setSegment] = (0,
|
|
16480
|
+
const [segment, setSegment] = (0, import_react94.useState)("weekly");
|
|
16432
16481
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16433
16482
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16434
16483
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16533,9 +16582,9 @@ function GamesPanel({
|
|
|
16533
16582
|
leaderboardLoading,
|
|
16534
16583
|
refreshHub
|
|
16535
16584
|
}) {
|
|
16536
|
-
const [selected, setSelected] = (0,
|
|
16537
|
-
const [segment, setSegment] = (0,
|
|
16538
|
-
(0,
|
|
16585
|
+
const [selected, setSelected] = (0, import_react95.useState)(null);
|
|
16586
|
+
const [segment, setSegment] = (0, import_react95.useState)("play");
|
|
16587
|
+
(0, import_react95.useEffect)(() => {
|
|
16539
16588
|
ensureGamesFonts();
|
|
16540
16589
|
}, []);
|
|
16541
16590
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
|
|
@@ -16599,10 +16648,10 @@ function GamesPanel({
|
|
|
16599
16648
|
}
|
|
16600
16649
|
|
|
16601
16650
|
// src/components/FavouritesPanel.tsx
|
|
16602
|
-
var
|
|
16651
|
+
var import_react98 = require("react");
|
|
16603
16652
|
|
|
16604
16653
|
// src/components/FavouriteChips.tsx
|
|
16605
|
-
var
|
|
16654
|
+
var import_react96 = require("react");
|
|
16606
16655
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16607
16656
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16608
16657
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16649,12 +16698,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16649
16698
|
] });
|
|
16650
16699
|
}
|
|
16651
16700
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16652
|
-
const [confirming, setConfirming] = (0,
|
|
16701
|
+
const [confirming, setConfirming] = (0, import_react96.useState)(false);
|
|
16653
16702
|
const data = controller.data;
|
|
16654
|
-
(0,
|
|
16703
|
+
(0, import_react96.useEffect)(() => {
|
|
16655
16704
|
setConfirming(false);
|
|
16656
16705
|
}, [sport]);
|
|
16657
|
-
(0,
|
|
16706
|
+
(0, import_react96.useEffect)(() => {
|
|
16658
16707
|
if (!confirming) return;
|
|
16659
16708
|
const onPointerDown = (e) => {
|
|
16660
16709
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16708,21 +16757,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16708
16757
|
}
|
|
16709
16758
|
|
|
16710
16759
|
// src/components/FavouritesSearch.tsx
|
|
16711
|
-
var
|
|
16760
|
+
var import_react97 = require("react");
|
|
16712
16761
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16713
16762
|
var MIN_LETTERS = 2;
|
|
16714
16763
|
var MAX_LENGTH = 64;
|
|
16715
16764
|
var DEBOUNCE_MS = 250;
|
|
16716
16765
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16717
|
-
const [query, setQuery] = (0,
|
|
16718
|
-
const [answer, setAnswer] = (0,
|
|
16719
|
-
const controllerRef = (0,
|
|
16766
|
+
const [query, setQuery] = (0, import_react97.useState)("");
|
|
16767
|
+
const [answer, setAnswer] = (0, import_react97.useState)(null);
|
|
16768
|
+
const controllerRef = (0, import_react97.useRef)(controller);
|
|
16720
16769
|
controllerRef.current = controller;
|
|
16721
16770
|
const trimmed = query.trim();
|
|
16722
16771
|
const queryKey = `${sport}|${trimmed}`;
|
|
16723
16772
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16724
16773
|
const settled = answer?.key === queryKey;
|
|
16725
|
-
(0,
|
|
16774
|
+
(0, import_react97.useEffect)(() => {
|
|
16726
16775
|
setAnswer(null);
|
|
16727
16776
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16728
16777
|
let cancelled = false;
|
|
@@ -16785,13 +16834,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16785
16834
|
// src/components/FavouritesPanel.tsx
|
|
16786
16835
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16787
16836
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16788
|
-
const [notice, setNotice] = (0,
|
|
16789
|
-
const refreshRef = (0,
|
|
16837
|
+
const [notice, setNotice] = (0, import_react98.useState)(null);
|
|
16838
|
+
const refreshRef = (0, import_react98.useRef)(controller.refresh);
|
|
16790
16839
|
refreshRef.current = controller.refresh;
|
|
16791
|
-
(0,
|
|
16840
|
+
(0, import_react98.useEffect)(() => {
|
|
16792
16841
|
void refreshRef.current();
|
|
16793
16842
|
}, []);
|
|
16794
|
-
(0,
|
|
16843
|
+
(0, import_react98.useEffect)(() => {
|
|
16795
16844
|
setNotice(null);
|
|
16796
16845
|
}, [sport]);
|
|
16797
16846
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16817,7 +16866,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16817
16866
|
}
|
|
16818
16867
|
|
|
16819
16868
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16820
|
-
var
|
|
16869
|
+
var import_react99 = require("react");
|
|
16821
16870
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
16822
16871
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16823
16872
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16843,8 +16892,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16843
16892
|
const opening = openingGames(preset);
|
|
16844
16893
|
const gamesOptions = opening.options;
|
|
16845
16894
|
const marketOptions = usableMarkets(preset);
|
|
16846
|
-
const [fingerprint] = (0,
|
|
16847
|
-
const [saved] = (0,
|
|
16895
|
+
const [fingerprint] = (0, import_react99.useState)(() => JSON.stringify(preset));
|
|
16896
|
+
const [saved] = (0, import_react99.useState)(() => {
|
|
16848
16897
|
const kept = memory3?.savedView(sport);
|
|
16849
16898
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
16850
16899
|
});
|
|
@@ -16858,9 +16907,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16858
16907
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
16859
16908
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16860
16909
|
};
|
|
16861
|
-
const [view, setView] = (0,
|
|
16862
|
-
const autoWidened = (0,
|
|
16863
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
16910
|
+
const [view, setView] = (0, import_react99.useState)(() => saved?.view ?? openingView);
|
|
16911
|
+
const autoWidened = (0, import_react99.useRef)(false);
|
|
16912
|
+
const [widenedNote, setWidenedNote] = (0, import_react99.useState)(saved?.widenedNote ?? false);
|
|
16864
16913
|
const requestFor = (v) => ({
|
|
16865
16914
|
sport,
|
|
16866
16915
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -16872,10 +16921,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16872
16921
|
...operatorUserId ? { operatorUserId } : {},
|
|
16873
16922
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
16874
16923
|
});
|
|
16875
|
-
const [first] = (0,
|
|
16924
|
+
const [first] = (0, import_react99.useState)(() => requestFor(view));
|
|
16876
16925
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16877
|
-
const lastRequest = (0,
|
|
16878
|
-
(0,
|
|
16926
|
+
const lastRequest = (0, import_react99.useRef)(first);
|
|
16927
|
+
(0, import_react99.useEffect)(() => {
|
|
16879
16928
|
void request(lastRequest.current);
|
|
16880
16929
|
}, [request]);
|
|
16881
16930
|
const send = (req) => {
|
|
@@ -16908,14 +16957,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16908
16957
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
16909
16958
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
16910
16959
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
16911
|
-
const [startedNote, setStartedNote] = (0,
|
|
16960
|
+
const [startedNote, setStartedNote] = (0, import_react99.useState)(false);
|
|
16912
16961
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
16913
|
-
(0,
|
|
16962
|
+
(0, import_react99.useEffect)(() => {
|
|
16914
16963
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
16915
16964
|
}, [startedNote, status2, anyStarted]);
|
|
16916
16965
|
const market = rows?.[0]?.market;
|
|
16917
|
-
const [seen2, setSeen] = (0,
|
|
16918
|
-
(0,
|
|
16966
|
+
const [seen2, setSeen] = (0, import_react99.useState)(null);
|
|
16967
|
+
(0, import_react99.useEffect)(() => {
|
|
16919
16968
|
if (market) setSeen(market);
|
|
16920
16969
|
}, [market]);
|
|
16921
16970
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -16928,14 +16977,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16928
16977
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
16929
16978
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
16930
16979
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
16931
|
-
(0,
|
|
16980
|
+
(0, import_react99.useEffect)(() => {
|
|
16932
16981
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
16933
16982
|
autoWidened.current = true;
|
|
16934
16983
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
16935
16984
|
commit(next, true);
|
|
16936
16985
|
send(requestFor(next));
|
|
16937
16986
|
}, [empty2, singles, widened, canWiden, view]);
|
|
16938
|
-
(0,
|
|
16987
|
+
(0, import_react99.useEffect)(() => {
|
|
16939
16988
|
if (coolOff) onCoolOff?.(sport);
|
|
16940
16989
|
}, [coolOff, onCoolOff, sport]);
|
|
16941
16990
|
if (coolOff) return null;
|
|
@@ -17338,10 +17387,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17338
17387
|
}
|
|
17339
17388
|
|
|
17340
17389
|
// src/components/PlayerPhoto.tsx
|
|
17341
|
-
var
|
|
17390
|
+
var import_react100 = require("react");
|
|
17342
17391
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17343
17392
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17344
|
-
const [failed, setFailed] = (0,
|
|
17393
|
+
const [failed, setFailed] = (0, import_react100.useState)(false);
|
|
17345
17394
|
const box = { width: size, height: size };
|
|
17346
17395
|
if (photoUrl && !failed) {
|
|
17347
17396
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17376,7 +17425,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17376
17425
|
}
|
|
17377
17426
|
|
|
17378
17427
|
// src/components/PerformanceBars.tsx
|
|
17379
|
-
var
|
|
17428
|
+
var import_react101 = require("react");
|
|
17380
17429
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17381
17430
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17382
17431
|
function finite4(v) {
|
|
@@ -17422,7 +17471,7 @@ function unrankedLine(ui, reason) {
|
|
|
17422
17471
|
}
|
|
17423
17472
|
}
|
|
17424
17473
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17425
|
-
const [mode, setMode] = (0,
|
|
17474
|
+
const [mode, setMode] = (0, import_react101.useState)("total");
|
|
17426
17475
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17427
17476
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17428
17477
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17594,11 +17643,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
17594
17643
|
}
|
|
17595
17644
|
|
|
17596
17645
|
// src/components/PresetTools.tsx
|
|
17597
|
-
var
|
|
17646
|
+
var import_react102 = require("react");
|
|
17598
17647
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
17599
17648
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17600
17649
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17601
|
-
const titleId = (0,
|
|
17650
|
+
const titleId = (0, import_react102.useId)();
|
|
17602
17651
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17603
17652
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17604
17653
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17648,9 +17697,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17648
17697
|
const totalOptions = comboTotals(grid);
|
|
17649
17698
|
const totals = totalOptions.map((o) => o.value);
|
|
17650
17699
|
const legChoices = comboLegChoices(grid);
|
|
17651
|
-
const [total, setTotal] = (0,
|
|
17652
|
-
const [legs, setLegs] = (0,
|
|
17653
|
-
const [announcement, setAnnouncement] = (0,
|
|
17700
|
+
const [total, setTotal] = (0, import_react102.useState)(() => nearest(totals, initialTotal));
|
|
17701
|
+
const [legs, setLegs] = (0, import_react102.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17702
|
+
const [announcement, setAnnouncement] = (0, import_react102.useState)("");
|
|
17654
17703
|
const cell2 = findCombo(grid, total, legs);
|
|
17655
17704
|
const minLegs = legChoices[0] ?? legs;
|
|
17656
17705
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17720,8 +17769,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17720
17769
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
17721
17770
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17722
17771
|
function useIsModal() {
|
|
17723
|
-
const [modal, setModal] = (0,
|
|
17724
|
-
(0,
|
|
17772
|
+
const [modal, setModal] = (0, import_react103.useState)(false);
|
|
17773
|
+
(0, import_react103.useEffect)(() => {
|
|
17725
17774
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17726
17775
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17727
17776
|
const sync = () => setModal(mql.matches);
|
|
@@ -17733,14 +17782,14 @@ function useIsModal() {
|
|
|
17733
17782
|
}
|
|
17734
17783
|
var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
|
|
17735
17784
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17736
|
-
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
|
|
17785
|
+
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17737
17786
|
const { state, close, stop, send, reset } = controller;
|
|
17738
|
-
const [squadView, setSquadView] = (0,
|
|
17739
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17787
|
+
const [squadView, setSquadView] = (0, import_react103.useState)("roster");
|
|
17788
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react103.useState)(null);
|
|
17740
17789
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17741
17790
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17742
|
-
const squadLayerRef = (0,
|
|
17743
|
-
const squadScrollRef = (0,
|
|
17791
|
+
const squadLayerRef = (0, import_react103.useRef)(null);
|
|
17792
|
+
const squadScrollRef = (0, import_react103.useRef)(null);
|
|
17744
17793
|
const selectPlayer = (playerId) => {
|
|
17745
17794
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17746
17795
|
setSelectedPlayerId(playerId);
|
|
@@ -17750,7 +17799,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17750
17799
|
setSelectedPlayerId(null);
|
|
17751
17800
|
clearPlayerDetail?.();
|
|
17752
17801
|
};
|
|
17753
|
-
(0,
|
|
17802
|
+
(0, import_react103.useLayoutEffect)(() => {
|
|
17754
17803
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17755
17804
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17756
17805
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17763,16 +17812,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17763
17812
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17764
17813
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17765
17814
|
const activeTab = tabs?.activeTab;
|
|
17766
|
-
(0,
|
|
17815
|
+
(0, import_react103.useEffect)(() => {
|
|
17767
17816
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17768
17817
|
setSelectedPlayerId(null);
|
|
17769
17818
|
clearPlayerDetail?.();
|
|
17770
17819
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17771
|
-
(0,
|
|
17820
|
+
(0, import_react103.useEffect)(() => {
|
|
17772
17821
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17773
17822
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17774
17823
|
const storedTab = tabState?.activeTab;
|
|
17775
|
-
(0,
|
|
17824
|
+
(0, import_react103.useEffect)(() => {
|
|
17776
17825
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17777
17826
|
if (unreachable) setMonitorTab?.("chat");
|
|
17778
17827
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17781,11 +17830,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17781
17830
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
17782
17831
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
17783
17832
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
17784
|
-
const closeWith = (0,
|
|
17833
|
+
const closeWith = (0, import_react103.useCallback)((method) => {
|
|
17785
17834
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17835
|
+
if (onCloseRequested) onCloseRequested();
|
|
17836
|
+
else close();
|
|
17837
|
+
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
17838
|
+
(0, import_react103.useEffect)(() => {
|
|
17789
17839
|
const onKey = (e) => {
|
|
17790
17840
|
if (e.key === "Escape") closeWith("escape");
|
|
17791
17841
|
};
|
|
@@ -17801,68 +17851,93 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17801
17851
|
tabs?.setActiveTab("chat");
|
|
17802
17852
|
send(text2, { grounding, source });
|
|
17803
17853
|
};
|
|
17804
|
-
(0,
|
|
17854
|
+
(0, import_react103.useEffect)(() => {
|
|
17805
17855
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17806
17856
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17807
17857
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17808
|
-
const inputRef = (0,
|
|
17809
|
-
const limitRef = (0,
|
|
17810
|
-
const typedSendRef = (0,
|
|
17811
|
-
const focusAfterCloseRef = (0,
|
|
17812
|
-
const [tool, setTool] = (0,
|
|
17813
|
-
const panelRef = (0,
|
|
17858
|
+
const inputRef = (0, import_react103.useRef)(null);
|
|
17859
|
+
const limitRef = (0, import_react103.useRef)(null);
|
|
17860
|
+
const typedSendRef = (0, import_react103.useRef)(false);
|
|
17861
|
+
const focusAfterCloseRef = (0, import_react103.useRef)(null);
|
|
17862
|
+
const [tool, setTool] = (0, import_react103.useState)(null);
|
|
17863
|
+
const panelRef = (0, import_react103.useRef)(null);
|
|
17814
17864
|
const settings = useOddsSettings();
|
|
17815
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
17865
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react103.useState)(false);
|
|
17816
17866
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
17817
|
-
const openSettings = (0,
|
|
17867
|
+
const openSettings = (0, import_react103.useCallback)(() => {
|
|
17818
17868
|
setTool(null);
|
|
17819
17869
|
setSettingsOpen(true);
|
|
17820
17870
|
}, []);
|
|
17821
|
-
const closeSettings = (0,
|
|
17871
|
+
const closeSettings = (0, import_react103.useCallback)(() => {
|
|
17822
17872
|
setSettingsOpen(false);
|
|
17823
17873
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17824
17874
|
}, []);
|
|
17825
17875
|
const paused = isPaused(state.limit);
|
|
17826
|
-
(0,
|
|
17876
|
+
(0, import_react103.useEffect)(() => {
|
|
17827
17877
|
if (paused) setTool(null);
|
|
17828
17878
|
}, [paused]);
|
|
17829
|
-
(0,
|
|
17879
|
+
(0, import_react103.useEffect)(() => {
|
|
17830
17880
|
if (!paused) return;
|
|
17831
17881
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17832
17882
|
typedSendRef.current = false;
|
|
17833
17883
|
}, [paused]);
|
|
17834
|
-
const openTool = (0,
|
|
17884
|
+
const openTool = (0, import_react103.useCallback)((next) => {
|
|
17835
17885
|
setTool(next);
|
|
17836
17886
|
}, []);
|
|
17837
|
-
const toolsValue = (0,
|
|
17887
|
+
const toolsValue = (0, import_react103.useMemo)(
|
|
17838
17888
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
17839
17889
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
17840
17890
|
);
|
|
17841
|
-
const closeTool = (0,
|
|
17891
|
+
const closeTool = (0, import_react103.useCallback)(() => {
|
|
17842
17892
|
focusAfterCloseRef.current = "composer";
|
|
17843
17893
|
setTool(null);
|
|
17844
17894
|
}, []);
|
|
17845
|
-
const sendAsk = (0,
|
|
17895
|
+
const sendAsk = (0, import_react103.useCallback)((ask) => {
|
|
17846
17896
|
focusAfterCloseRef.current = "composer";
|
|
17847
17897
|
setTool(null);
|
|
17848
17898
|
tabs?.setActiveTab("chat");
|
|
17849
17899
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
17850
17900
|
}, [tabs, send]);
|
|
17851
|
-
const formatKickoff = (0,
|
|
17901
|
+
const formatKickoff = (0, import_react103.useCallback)((kickoffUtc) => {
|
|
17852
17902
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17853
17903
|
return `${k.dayLabel} ${k.time}`;
|
|
17854
17904
|
}, [ui]);
|
|
17855
|
-
(0,
|
|
17905
|
+
(0, import_react103.useEffect)(() => {
|
|
17856
17906
|
if (tool) return;
|
|
17857
17907
|
const target = focusAfterCloseRef.current;
|
|
17858
17908
|
focusAfterCloseRef.current = null;
|
|
17859
17909
|
if (target === "composer") inputRef.current?.focus();
|
|
17860
17910
|
}, [tool]);
|
|
17861
|
-
(0,
|
|
17911
|
+
(0, import_react103.useEffect)(() => {
|
|
17862
17912
|
if (!tool || onChatTab && presetGrid) return;
|
|
17863
17913
|
focusAfterCloseRef.current = "composer";
|
|
17864
17914
|
setTool(null);
|
|
17865
17915
|
}, [tool, onChatTab, presetGrid]);
|
|
17916
|
+
const backRef = (0, import_react103.useRef)(() => false);
|
|
17917
|
+
backRef.current = () => {
|
|
17918
|
+
if (settingsOpen && hasSettings) {
|
|
17919
|
+
closeSettings();
|
|
17920
|
+
return true;
|
|
17921
|
+
}
|
|
17922
|
+
if (tool) {
|
|
17923
|
+
closeTool();
|
|
17924
|
+
return true;
|
|
17925
|
+
}
|
|
17926
|
+
if (selectedPlayerId !== null) {
|
|
17927
|
+
closePlayer();
|
|
17928
|
+
return true;
|
|
17929
|
+
}
|
|
17930
|
+
if (tabs && tabs.activeTab !== "chat") {
|
|
17931
|
+
tabs.setActiveTab("chat");
|
|
17932
|
+
return true;
|
|
17933
|
+
}
|
|
17934
|
+
return false;
|
|
17935
|
+
};
|
|
17936
|
+
(0, import_react103.useEffect)(() => {
|
|
17937
|
+
if (!onRegisterBack) return;
|
|
17938
|
+
onRegisterBack(() => backRef.current());
|
|
17939
|
+
return () => onRegisterBack(null);
|
|
17940
|
+
}, [onRegisterBack]);
|
|
17866
17941
|
return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
17867
17942
|
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
17868
17943
|
ChatHeader,
|
|
@@ -18224,6 +18299,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18224
18299
|
.ss-w-root[data-ss-w-pos="right"] .ss-w-panel,
|
|
18225
18300
|
.ss-w-root[data-ss-w-pos="left"] .ss-w-panel { inset: 0; width: auto; height: auto; border: none; border-radius: 0; }
|
|
18226
18301
|
}
|
|
18302
|
+
.ss-w-root[data-ss-w-mobile] .ss-w-panel { inset: 0; width: 100%; height: 100%; max-width: none; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
|
|
18227
18303
|
.ss-w-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ss-w-line); }
|
|
18228
18304
|
.ss-w-header-mark { width: 18px; height: 18px; display: block; object-fit: contain; }
|
|
18229
18305
|
.ss-w-header-title { font-weight: 660; flex: 1; }
|
|
@@ -20810,12 +20886,12 @@ function injectStyles(root) {
|
|
|
20810
20886
|
function StatsWidget(props) {
|
|
20811
20887
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20812
20888
|
const cfg = props.config;
|
|
20813
|
-
const built = (0,
|
|
20814
|
-
const trackingRef = (0,
|
|
20815
|
-
const track = (0,
|
|
20816
|
-
const eventTextRef = (0,
|
|
20889
|
+
const built = (0, import_react104.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
20890
|
+
const trackingRef = (0, import_react104.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
20891
|
+
const track = (0, import_react104.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
20892
|
+
const eventTextRef = (0, import_react104.useRef)(false);
|
|
20817
20893
|
eventTextRef.current = cfg?.eventText === true;
|
|
20818
|
-
const logger = (0,
|
|
20894
|
+
const logger = (0, import_react104.useMemo)(() => {
|
|
20819
20895
|
if (!built) return null;
|
|
20820
20896
|
const raw = built.client.createEventLogger({
|
|
20821
20897
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -20825,27 +20901,27 @@ function StatsWidget(props) {
|
|
|
20825
20901
|
}, [built?.client, track]);
|
|
20826
20902
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
20827
20903
|
const stringsPending = widgetStrings.strings === void 0;
|
|
20828
|
-
const ui = (0,
|
|
20904
|
+
const ui = (0, import_react104.useMemo)(
|
|
20829
20905
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
20830
20906
|
[props.config, widgetStrings.strings]
|
|
20831
20907
|
);
|
|
20832
20908
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20833
|
-
const rootRef = (0,
|
|
20834
|
-
const introDoneRef = (0,
|
|
20835
|
-
const markIntroDone = (0,
|
|
20909
|
+
const rootRef = (0, import_react104.useRef)(null);
|
|
20910
|
+
const introDoneRef = (0, import_react104.useRef)(false);
|
|
20911
|
+
const markIntroDone = (0, import_react104.useCallback)(() => {
|
|
20836
20912
|
introDoneRef.current = true;
|
|
20837
20913
|
}, []);
|
|
20838
20914
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
20839
20915
|
const threadLanguage = familyOf(language);
|
|
20840
20916
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
20841
|
-
const sportScope = (0,
|
|
20917
|
+
const sportScope = (0, import_react104.useMemo)(
|
|
20842
20918
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
20843
20919
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
20844
20920
|
);
|
|
20845
|
-
const chatTracking = (0,
|
|
20921
|
+
const chatTracking = (0, import_react104.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
20846
20922
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
20847
20923
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
20848
|
-
const liveCardWatches = (0,
|
|
20924
|
+
const liveCardWatches = (0, import_react104.useMemo)(() => {
|
|
20849
20925
|
const seen2 = /* @__PURE__ */ new Set();
|
|
20850
20926
|
const out = [];
|
|
20851
20927
|
for (const msg of controller.state.messages) {
|
|
@@ -20871,19 +20947,19 @@ function StatsWidget(props) {
|
|
|
20871
20947
|
});
|
|
20872
20948
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
20873
20949
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
20874
|
-
const getSchedule = (0,
|
|
20950
|
+
const getSchedule = (0, import_react104.useCallback)(
|
|
20875
20951
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
20876
20952
|
[built, operatorUserId, anonymousUserId]
|
|
20877
20953
|
);
|
|
20878
|
-
const getStates = (0,
|
|
20954
|
+
const getStates = (0, import_react104.useCallback)(
|
|
20879
20955
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
20880
20956
|
[built, requestTag]
|
|
20881
20957
|
);
|
|
20882
|
-
const getTennisPrices = (0,
|
|
20958
|
+
const getTennisPrices = (0, import_react104.useCallback)(
|
|
20883
20959
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
20884
20960
|
[built, requestTag]
|
|
20885
20961
|
);
|
|
20886
|
-
const pinnedMatchIds = (0,
|
|
20962
|
+
const pinnedMatchIds = (0, import_react104.useMemo)(
|
|
20887
20963
|
() => footballMatchPinIds(monitor.pins),
|
|
20888
20964
|
[monitor.pins]
|
|
20889
20965
|
);
|
|
@@ -20897,13 +20973,13 @@ function StatsWidget(props) {
|
|
|
20897
20973
|
pinnedMatchIds,
|
|
20898
20974
|
timeZone: ui.timeZone
|
|
20899
20975
|
});
|
|
20900
|
-
const offeredSports = (0,
|
|
20976
|
+
const offeredSports = (0, import_react104.useMemo)(() => {
|
|
20901
20977
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
20902
20978
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
20903
20979
|
return [...seen2];
|
|
20904
20980
|
}, [discovery.matchDays, discovery.groups]);
|
|
20905
20981
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
20906
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
20982
|
+
const [liveLeague, setLiveLeague] = (0, import_react104.useState)(null);
|
|
20907
20983
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
20908
20984
|
const matchesLoaded = useMatchesDay({
|
|
20909
20985
|
discovery,
|
|
@@ -20913,8 +20989,8 @@ function StatsWidget(props) {
|
|
|
20913
20989
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20914
20990
|
timeZone: ui.timeZone
|
|
20915
20991
|
});
|
|
20916
|
-
const prevLiveSnapshotRef = (0,
|
|
20917
|
-
(0,
|
|
20992
|
+
const prevLiveSnapshotRef = (0, import_react104.useRef)(monitor.snapshot);
|
|
20993
|
+
(0, import_react104.useEffect)(() => {
|
|
20918
20994
|
const snap = monitor.snapshot;
|
|
20919
20995
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
20920
20996
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -20954,14 +21030,14 @@ function StatsWidget(props) {
|
|
|
20954
21030
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20955
21031
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20956
21032
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
20957
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
20958
|
-
const latestGreeting = (0,
|
|
21033
|
+
const [favSportPick, setFavSportPick] = (0, import_react104.useState)(null);
|
|
21034
|
+
const latestGreeting = (0, import_react104.useMemo)(() => {
|
|
20959
21035
|
for (const m of [...controller.state.messages].reverse()) {
|
|
20960
21036
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
20961
21037
|
}
|
|
20962
21038
|
return null;
|
|
20963
21039
|
}, [controller.state.messages]);
|
|
20964
|
-
const favSportOptions = (0,
|
|
21040
|
+
const favSportOptions = (0, import_react104.useMemo)(
|
|
20965
21041
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
20966
21042
|
[latestGreeting]
|
|
20967
21043
|
);
|
|
@@ -20970,20 +21046,20 @@ function StatsWidget(props) {
|
|
|
20970
21046
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
20971
21047
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
20972
21048
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
20973
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
20974
|
-
const builderGreeting = (0,
|
|
21049
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react104.useState)(null);
|
|
21050
|
+
const builderGreeting = (0, import_react104.useMemo)(
|
|
20975
21051
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
20976
21052
|
[controller.state.messages]
|
|
20977
21053
|
);
|
|
20978
|
-
const [coolOff, setCoolOff] = (0,
|
|
20979
|
-
const onBuilderCoolOff = (0,
|
|
21054
|
+
const [coolOff, setCoolOff] = (0, import_react104.useState)(null);
|
|
21055
|
+
const onBuilderCoolOff = (0, import_react104.useCallback)((sport) => {
|
|
20980
21056
|
if (!builderGreeting) return;
|
|
20981
21057
|
setCoolOff((prev) => {
|
|
20982
21058
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
20983
21059
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
20984
21060
|
});
|
|
20985
21061
|
}, [builderGreeting]);
|
|
20986
|
-
const builderOptions = (0,
|
|
21062
|
+
const builderOptions = (0, import_react104.useMemo)(() => {
|
|
20987
21063
|
const greeting = builderGreeting;
|
|
20988
21064
|
if (!greeting) return [];
|
|
20989
21065
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -20996,7 +21072,7 @@ function StatsWidget(props) {
|
|
|
20996
21072
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
20997
21073
|
}, [builderGreeting, coolOff, ui]);
|
|
20998
21074
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
20999
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21075
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react104.useState)(panelOpen);
|
|
21000
21076
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21001
21077
|
const favourites = useFavourites({
|
|
21002
21078
|
conversation: built?.conversation ?? null,
|
|
@@ -21008,14 +21084,14 @@ function StatsWidget(props) {
|
|
|
21008
21084
|
onChanged: discovery.refreshSchedule
|
|
21009
21085
|
});
|
|
21010
21086
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21011
|
-
const getPricePresets = (0,
|
|
21087
|
+
const getPricePresets = (0, import_react104.useCallback)(
|
|
21012
21088
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21013
21089
|
[built]
|
|
21014
21090
|
);
|
|
21015
21091
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21016
21092
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21017
|
-
const prevLiveCountRef = (0,
|
|
21018
|
-
(0,
|
|
21093
|
+
const prevLiveCountRef = (0, import_react104.useRef)(0);
|
|
21094
|
+
(0, import_react104.useEffect)(() => {
|
|
21019
21095
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21020
21096
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21021
21097
|
if (rose) markLiveActivity();
|
|
@@ -21029,7 +21105,7 @@ function StatsWidget(props) {
|
|
|
21029
21105
|
closePanel: controller.close
|
|
21030
21106
|
});
|
|
21031
21107
|
const markAdded = hostEvents.markAdded;
|
|
21032
|
-
const slip = (0,
|
|
21108
|
+
const slip = (0, import_react104.useMemo)(
|
|
21033
21109
|
() => {
|
|
21034
21110
|
const handler = props.config?.onAddToSlip;
|
|
21035
21111
|
return {
|
|
@@ -21049,12 +21125,10 @@ function StatsWidget(props) {
|
|
|
21049
21125
|
},
|
|
21050
21126
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21051
21127
|
);
|
|
21052
|
-
const onDashboardTap = (0,
|
|
21128
|
+
const onDashboardTap = (0, import_react104.useMemo)(
|
|
21053
21129
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21054
21130
|
[built, logger]
|
|
21055
21131
|
);
|
|
21056
|
-
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup);
|
|
21057
|
-
useOpenTelemetry(logger, panelOpen);
|
|
21058
21132
|
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
|
|
21059
21133
|
label: ask.label,
|
|
21060
21134
|
onTap: () => runBubbleAsk(ask, {
|
|
@@ -21065,10 +21139,24 @@ function StatsWidget(props) {
|
|
|
21065
21139
|
log: logger
|
|
21066
21140
|
})
|
|
21067
21141
|
}));
|
|
21068
|
-
const
|
|
21142
|
+
const dismissPopupRef = (0, import_react104.useRef)(() => {
|
|
21143
|
+
});
|
|
21144
|
+
const mobile = useMobileBinding({
|
|
21145
|
+
binding: props.mobile,
|
|
21146
|
+
panelOpen,
|
|
21147
|
+
popupText: controller.state.popupText,
|
|
21148
|
+
asks,
|
|
21149
|
+
open: controller.open,
|
|
21150
|
+
close: controller.close,
|
|
21151
|
+
dismissPopup: () => dismissPopupRef.current()
|
|
21152
|
+
});
|
|
21153
|
+
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21154
|
+
dismissPopupRef.current = dismissPopup;
|
|
21155
|
+
useOpenTelemetry(logger, panelOpen);
|
|
21156
|
+
const onControlRef = (0, import_react104.useRef)(props.onControl);
|
|
21069
21157
|
onControlRef.current = props.onControl;
|
|
21070
21158
|
const { open: openPanel, close: closePanel } = controller;
|
|
21071
|
-
(0,
|
|
21159
|
+
(0, import_react104.useEffect)(() => {
|
|
21072
21160
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21073
21161
|
return () => onControlRef.current?.(null);
|
|
21074
21162
|
}, [openPanel, closePanel]);
|
|
@@ -21085,11 +21173,11 @@ function StatsWidget(props) {
|
|
|
21085
21173
|
page: cfg?.page
|
|
21086
21174
|
}
|
|
21087
21175
|
};
|
|
21088
|
-
(0,
|
|
21176
|
+
(0, import_react104.useEffect)(() => {
|
|
21089
21177
|
if (!logger) return;
|
|
21090
21178
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21091
21179
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21092
|
-
(0,
|
|
21180
|
+
(0, import_react104.useEffect)(() => {
|
|
21093
21181
|
if (!logger) return;
|
|
21094
21182
|
logger.resume();
|
|
21095
21183
|
const onHide = () => {
|
|
@@ -21107,15 +21195,15 @@ function StatsWidget(props) {
|
|
|
21107
21195
|
logger.dispose();
|
|
21108
21196
|
};
|
|
21109
21197
|
}, [logger]);
|
|
21110
|
-
(0,
|
|
21198
|
+
(0, import_react104.useEffect)(() => {
|
|
21111
21199
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21112
21200
|
const node = rootRef.current?.getRootNode();
|
|
21113
21201
|
if (node) injectStyles(node);
|
|
21114
21202
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21115
21203
|
const holds = useSessionHolds();
|
|
21116
21204
|
const builderConversation = built?.conversation ?? null;
|
|
21117
|
-
const builderMemory = (0,
|
|
21118
|
-
const personalGreeting = (0,
|
|
21205
|
+
const builderMemory = (0, import_react104.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21206
|
+
const personalGreeting = (0, import_react104.useMemo)(() => ({
|
|
21119
21207
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21120
21208
|
conversation: built?.conversation ?? null,
|
|
21121
21209
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -21128,7 +21216,7 @@ function StatsWidget(props) {
|
|
|
21128
21216
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
21129
21217
|
if (!built || widgetStrings.state === "unavailable") return null;
|
|
21130
21218
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
21131
|
-
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.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_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.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"], "data-ss-w-mobile": props.mobile ? "" : void 0, style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21132
21220
|
ChatPanel,
|
|
21133
21221
|
{
|
|
21134
21222
|
controller,
|
|
@@ -21160,9 +21248,11 @@ function StatsWidget(props) {
|
|
|
21160
21248
|
presetGrid,
|
|
21161
21249
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
21162
21250
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick },
|
|
21163
|
-
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor }
|
|
21251
|
+
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor },
|
|
21252
|
+
onCloseRequested: mobile.onCloseRequested,
|
|
21253
|
+
onRegisterBack: mobile.onRegisterBack
|
|
21164
21254
|
}
|
|
21165
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21255
|
+
) }) : props.mobile ? null : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21166
21256
|
ChatFab,
|
|
21167
21257
|
{
|
|
21168
21258
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -21188,6 +21278,7 @@ function emptyConversation() {
|
|
|
21188
21278
|
0 && (module.exports = {
|
|
21189
21279
|
StatsWidget,
|
|
21190
21280
|
WIDGET_CSS,
|
|
21281
|
+
WIDGET_REACT_VERSION,
|
|
21191
21282
|
createWidgetHost
|
|
21192
21283
|
});
|
|
21193
21284
|
//# sourceMappingURL=index.cjs.map
|