@sensiblestats/widget-react 0.130.1 → 0.131.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 +11 -0
- package/README.md +1 -1
- package/dist/index.cjs +330 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +184 -125
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as useCallback27, useEffect as
|
|
2
|
+
import { useCallback as useCallback27, useEffect as useEffect53, useMemo as useMemo13, useRef as useRef45, useState as useState79 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/strings/tag.ts
|
|
@@ -1285,7 +1285,7 @@ function parseOddsFormat(value) {
|
|
|
1285
1285
|
}
|
|
1286
1286
|
|
|
1287
1287
|
// src/version.generated.ts
|
|
1288
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1288
|
+
var WIDGET_REACT_VERSION = "0.131.0";
|
|
1289
1289
|
|
|
1290
1290
|
// src/config.ts
|
|
1291
1291
|
function hostTag(cfg) {
|
|
@@ -6002,7 +6002,7 @@ function useSlipAdd(slip, ui) {
|
|
|
6002
6002
|
const handler = slip.onAddToSlip;
|
|
6003
6003
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
6004
6004
|
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
6005
|
-
return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
6005
|
+
return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
|
|
6006
6006
|
if (!handler) return { kind: "failed" };
|
|
6007
6007
|
const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
|
|
6008
6008
|
const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
|
|
@@ -6017,11 +6017,13 @@ function useSlipAdd(slip, ui) {
|
|
|
6017
6017
|
matchId: out.matchId,
|
|
6018
6018
|
odds: out.oddsDecimal,
|
|
6019
6019
|
...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
|
|
6020
|
-
...out.sport !== void 0 ? { sport: out.sport } : {}
|
|
6020
|
+
...out.sport !== void 0 ? { sport: out.sport } : {},
|
|
6021
|
+
...fact ? { factKey: fact.factKey } : {}
|
|
6021
6022
|
};
|
|
6023
|
+
const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
|
|
6022
6024
|
track({ name: "add_to_slip_click", ...clickFields });
|
|
6023
6025
|
if (marketDeveloperName !== void 0) {
|
|
6024
|
-
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
6026
|
+
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField, ...factTag });
|
|
6025
6027
|
}
|
|
6026
6028
|
try {
|
|
6027
6029
|
const raw = await withTimeout(Promise.resolve(handler(out)));
|
|
@@ -6036,7 +6038,8 @@ function useSlipAdd(slip, ui) {
|
|
|
6036
6038
|
entityId: marketDeveloperName,
|
|
6037
6039
|
outcome: slipOutcome(result),
|
|
6038
6040
|
...pick,
|
|
6039
|
-
...sportField
|
|
6041
|
+
...sportField,
|
|
6042
|
+
...factTag
|
|
6040
6043
|
});
|
|
6041
6044
|
}
|
|
6042
6045
|
if (slipState) {
|
|
@@ -6049,7 +6052,7 @@ function useSlipAdd(slip, ui) {
|
|
|
6049
6052
|
} catch {
|
|
6050
6053
|
track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
|
|
6051
6054
|
if (marketDeveloperName !== void 0) {
|
|
6052
|
-
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
|
|
6055
|
+
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField, ...factTag });
|
|
6053
6056
|
}
|
|
6054
6057
|
return { kind: "failed" };
|
|
6055
6058
|
}
|
|
@@ -6072,7 +6075,7 @@ function Toast({ toast, onDismiss }) {
|
|
|
6072
6075
|
|
|
6073
6076
|
// src/components/AddToSlipButton.tsx
|
|
6074
6077
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6075
|
-
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
|
|
6078
|
+
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
|
|
6076
6079
|
const [pending, setPending] = useState18(false);
|
|
6077
6080
|
const [settledLocal, setSettledLocal] = useState18(false);
|
|
6078
6081
|
const [toast, setToast] = useState18(null);
|
|
@@ -6086,7 +6089,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
|
|
|
6086
6089
|
const onClick = async () => {
|
|
6087
6090
|
setPending(true);
|
|
6088
6091
|
try {
|
|
6089
|
-
const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
|
|
6092
|
+
const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
|
|
6090
6093
|
if (outcome.kind === "failed") {
|
|
6091
6094
|
setToast({ kind: "error", text: ui.slipFailed });
|
|
6092
6095
|
return;
|
|
@@ -7085,11 +7088,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
|
|
|
7085
7088
|
var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
|
|
7086
7089
|
var MAX_TEAM_CARDS = 3;
|
|
7087
7090
|
function oneCardPerGame(cards) {
|
|
7088
|
-
const
|
|
7091
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
7089
7092
|
return cards.filter((c) => {
|
|
7090
7093
|
if (!c.matchId) return true;
|
|
7091
|
-
if (
|
|
7092
|
-
|
|
7094
|
+
if (seen2.has(c.matchId)) return false;
|
|
7095
|
+
seen2.add(c.matchId);
|
|
7093
7096
|
return true;
|
|
7094
7097
|
});
|
|
7095
7098
|
}
|
|
@@ -7418,7 +7421,9 @@ var WIRE_TO_PUBLIC = {
|
|
|
7418
7421
|
slip_remove: null,
|
|
7419
7422
|
bet_placed: null,
|
|
7420
7423
|
match_view: null,
|
|
7421
|
-
popup_opened: null
|
|
7424
|
+
popup_opened: null,
|
|
7425
|
+
fact_view: null,
|
|
7426
|
+
fact_ask: null
|
|
7422
7427
|
};
|
|
7423
7428
|
|
|
7424
7429
|
// src/popupTelemetry.ts
|
|
@@ -7526,7 +7531,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7526
7531
|
}
|
|
7527
7532
|
|
|
7528
7533
|
// src/components/ChatPanel.tsx
|
|
7529
|
-
import { useCallback as useCallback26, useEffect as
|
|
7534
|
+
import { useCallback as useCallback26, useEffect as useEffect52, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef44, useState as useState78 } from "react";
|
|
7530
7535
|
|
|
7531
7536
|
// src/components/ChatHeader.tsx
|
|
7532
7537
|
import { useEffect as useEffect27, useRef as useRef22, useState as useState32 } from "react";
|
|
@@ -8915,15 +8920,15 @@ function pathRounds(e) {
|
|
|
8915
8920
|
const base = h - pad.b;
|
|
8916
8921
|
const plotH = h - pad.t - pad.b;
|
|
8917
8922
|
const { lo, span } = roundSpan(e);
|
|
8918
|
-
const
|
|
8923
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
8919
8924
|
for (const ev of e.events) {
|
|
8920
8925
|
if (ev.roundIndex < 0) continue;
|
|
8921
8926
|
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8922
8927
|
const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
|
|
8923
|
-
if (short !== "" && !
|
|
8928
|
+
if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
|
|
8924
8929
|
}
|
|
8925
8930
|
const kept = [];
|
|
8926
|
-
for (const [roundIndex, label] of [...
|
|
8931
|
+
for (const [roundIndex, label] of [...seen2.entries()].sort((a, b) => b[0] - a[0])) {
|
|
8927
8932
|
const y = round22(base - (roundIndex - lo + 1) / span * plotH);
|
|
8928
8933
|
const last = kept[kept.length - 1];
|
|
8929
8934
|
if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
|
|
@@ -10576,16 +10581,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10576
10581
|
}
|
|
10577
10582
|
|
|
10578
10583
|
// src/components/LiveFactBlock.tsx
|
|
10579
|
-
import { useState as useState44 } from "react";
|
|
10584
|
+
import { useRef as useRef29, useState as useState44 } from "react";
|
|
10585
|
+
|
|
10586
|
+
// src/useFactView.ts
|
|
10587
|
+
import { useEffect as useEffect34, useRef as useRef28 } from "react";
|
|
10588
|
+
var DWELL_MS = 1e3;
|
|
10589
|
+
var seen = /* @__PURE__ */ new Set();
|
|
10590
|
+
function useFactView(ref, fact, entity2) {
|
|
10591
|
+
const log = useEventLog();
|
|
10592
|
+
const entityRef = useRef28(entity2);
|
|
10593
|
+
entityRef.current = entity2;
|
|
10594
|
+
const id = fact?.id;
|
|
10595
|
+
const factKey = fact?.factKey;
|
|
10596
|
+
useEffect34(() => {
|
|
10597
|
+
if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
|
|
10598
|
+
const el = ref.current;
|
|
10599
|
+
if (!el) return;
|
|
10600
|
+
let timer;
|
|
10601
|
+
const fire = () => {
|
|
10602
|
+
if (seen.has(id)) return;
|
|
10603
|
+
seen.add(id);
|
|
10604
|
+
log.log({ name: "fact_view", ...entityRef.current, factId: String(id), factKey });
|
|
10605
|
+
};
|
|
10606
|
+
const clear = () => {
|
|
10607
|
+
if (timer !== void 0) {
|
|
10608
|
+
clearTimeout(timer);
|
|
10609
|
+
timer = void 0;
|
|
10610
|
+
}
|
|
10611
|
+
};
|
|
10612
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
10613
|
+
timer = setTimeout(fire, DWELL_MS);
|
|
10614
|
+
return clear;
|
|
10615
|
+
}
|
|
10616
|
+
const io = new IntersectionObserver((entries) => {
|
|
10617
|
+
const visible = entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5);
|
|
10618
|
+
if (visible) {
|
|
10619
|
+
if (timer === void 0) timer = setTimeout(fire, DWELL_MS);
|
|
10620
|
+
} else clear();
|
|
10621
|
+
}, { threshold: [0, 0.5] });
|
|
10622
|
+
io.observe(el);
|
|
10623
|
+
return () => {
|
|
10624
|
+
clear();
|
|
10625
|
+
io.disconnect();
|
|
10626
|
+
};
|
|
10627
|
+
}, [id, factKey, log, ref]);
|
|
10628
|
+
}
|
|
10629
|
+
|
|
10630
|
+
// src/components/LiveFactBlock.tsx
|
|
10580
10631
|
import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
10581
10632
|
function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
10582
10633
|
const [expanded, setExpanded] = useState44(false);
|
|
10583
10634
|
const { oddsFormat } = useOddsSettings();
|
|
10635
|
+
const log = useEventLog();
|
|
10636
|
+
const sectionRef = useRef29(null);
|
|
10584
10637
|
const [current, ...earlier] = facts;
|
|
10638
|
+
const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
|
|
10639
|
+
useFactView(sectionRef, current, entity2);
|
|
10585
10640
|
if (!current) return null;
|
|
10586
10641
|
const m = current.market;
|
|
10587
10642
|
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
10588
|
-
return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10643
|
+
return /* @__PURE__ */ jsxs65("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10589
10644
|
/* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
|
|
10590
10645
|
/* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
|
|
10591
10646
|
/* @__PURE__ */ jsxs65("span", { className: "ss-w-fact-min", children: [
|
|
@@ -10611,7 +10666,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10611
10666
|
marketDeveloperName: m.marketDeveloperName,
|
|
10612
10667
|
selectionLabel: m.selectionLabel,
|
|
10613
10668
|
slip,
|
|
10614
|
-
ui
|
|
10669
|
+
ui,
|
|
10670
|
+
fact: { id: current.id, factKey: current.factKey }
|
|
10615
10671
|
}
|
|
10616
10672
|
)
|
|
10617
10673
|
] })
|
|
@@ -10629,7 +10685,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10629
10685
|
{
|
|
10630
10686
|
type: "button",
|
|
10631
10687
|
className: "ss-w-fact-link",
|
|
10632
|
-
onClick: () =>
|
|
10688
|
+
onClick: () => {
|
|
10689
|
+
log?.log({ name: "fact_ask", ...entity2, factId: String(current.id), factKey: current.factKey });
|
|
10690
|
+
onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) });
|
|
10691
|
+
},
|
|
10633
10692
|
children: ui.liveFactAsk
|
|
10634
10693
|
}
|
|
10635
10694
|
),
|
|
@@ -11039,10 +11098,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11039
11098
|
}
|
|
11040
11099
|
|
|
11041
11100
|
// src/components/NbaPropsSection.tsx
|
|
11042
|
-
import { useEffect as
|
|
11101
|
+
import { useEffect as useEffect36, useState as useState48 } from "react";
|
|
11043
11102
|
|
|
11044
11103
|
// src/components/PropsPieces.tsx
|
|
11045
|
-
import { useEffect as
|
|
11104
|
+
import { useEffect as useEffect35, useState as useState47 } from "react";
|
|
11046
11105
|
import { Fragment as Fragment15, jsx as jsx76, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
11047
11106
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11048
11107
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11057,7 +11116,7 @@ function preKickoff(match) {
|
|
|
11057
11116
|
function usePreKickoff(match) {
|
|
11058
11117
|
const [, setTick] = useState47(0);
|
|
11059
11118
|
const pre = preKickoff(match);
|
|
11060
|
-
|
|
11119
|
+
useEffect35(() => {
|
|
11061
11120
|
if (!pre || !match.kickoffUtc) return;
|
|
11062
11121
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11063
11122
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11071,7 +11130,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11071
11130
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11072
11131
|
const live = match.phase === "live";
|
|
11073
11132
|
const open = pre || live;
|
|
11074
|
-
|
|
11133
|
+
useEffect35(() => {
|
|
11075
11134
|
if (!open) return;
|
|
11076
11135
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11077
11136
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11240,7 +11299,7 @@ function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
|
11240
11299
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11241
11300
|
const valid = !Number.isNaN(at2);
|
|
11242
11301
|
const onBreak = atBreak(match);
|
|
11243
|
-
|
|
11302
|
+
useEffect35(() => {
|
|
11244
11303
|
if (!valid || onBreak) return;
|
|
11245
11304
|
const age2 = Date.now() - at2;
|
|
11246
11305
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11306,7 +11365,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11306
11365
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11307
11366
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11308
11367
|
const onBreak = atBreak(match);
|
|
11309
|
-
|
|
11368
|
+
useEffect36(() => {
|
|
11310
11369
|
if (!valid || onBreak) return;
|
|
11311
11370
|
const age2 = Date.now() - at2;
|
|
11312
11371
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11873,7 +11932,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11873
11932
|
}
|
|
11874
11933
|
|
|
11875
11934
|
// src/components/TennisMonitorCard.tsx
|
|
11876
|
-
import { useRef as
|
|
11935
|
+
import { useRef as useRef30 } from "react";
|
|
11877
11936
|
import { toWireSport as toWireSport5 } from "@sensiblestats/widget-sdk";
|
|
11878
11937
|
|
|
11879
11938
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12134,7 +12193,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12134
12193
|
}
|
|
12135
12194
|
|
|
12136
12195
|
// src/components/TennisStatsTables.tsx
|
|
12137
|
-
import { Fragment as Fragment22, useEffect as
|
|
12196
|
+
import { Fragment as Fragment22, useEffect as useEffect37, useState as useState51 } from "react";
|
|
12138
12197
|
import { Fragment as Fragment23, jsx as jsx87, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
12139
12198
|
function formatStat(row, value, locale) {
|
|
12140
12199
|
if (value == null) return "\u2013";
|
|
@@ -12173,7 +12232,7 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12173
12232
|
}
|
|
12174
12233
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12175
12234
|
const [tab, setTab] = useState51("match");
|
|
12176
|
-
|
|
12235
|
+
useEffect37(() => {
|
|
12177
12236
|
setTab("match");
|
|
12178
12237
|
}, [resetKey]);
|
|
12179
12238
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12339,7 +12398,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12339
12398
|
] });
|
|
12340
12399
|
}
|
|
12341
12400
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12342
|
-
const lastTables =
|
|
12401
|
+
const lastTables = useRef30(null);
|
|
12343
12402
|
const t = match.tennis;
|
|
12344
12403
|
if (!t) return /* @__PURE__ */ jsx88(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12345
12404
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12419,7 +12478,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12419
12478
|
}
|
|
12420
12479
|
|
|
12421
12480
|
// src/components/ScoreboardStrip.tsx
|
|
12422
|
-
import { useEffect as
|
|
12481
|
+
import { useEffect as useEffect38, useRef as useRef31 } from "react";
|
|
12423
12482
|
import { sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
12424
12483
|
import { jsx as jsx89, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
12425
12484
|
function nbaStatus(m, ui) {
|
|
@@ -12514,8 +12573,8 @@ function rowsFor(m) {
|
|
|
12514
12573
|
];
|
|
12515
12574
|
}
|
|
12516
12575
|
function useStripScroll(selectedKey) {
|
|
12517
|
-
const stripRef =
|
|
12518
|
-
|
|
12576
|
+
const stripRef = useRef31(null);
|
|
12577
|
+
useEffect38(() => {
|
|
12519
12578
|
const strip = stripRef.current;
|
|
12520
12579
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12521
12580
|
if (!strip || !pressed) return;
|
|
@@ -12940,16 +12999,16 @@ import { useId as useId2, useState as useState52 } from "react";
|
|
|
12940
12999
|
import { localIdOf as localIdOf4, qualifiedId as qualifiedId2, slipSportOf as slipSportOf9, toWireSport as toWireSport6 } from "@sensiblestats/widget-sdk";
|
|
12941
13000
|
|
|
12942
13001
|
// src/useModalDialog.ts
|
|
12943
|
-
import { useEffect as
|
|
13002
|
+
import { useEffect as useEffect39, useRef as useRef32 } from "react";
|
|
12944
13003
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
12945
13004
|
function useModalDialog(onClose, opts = {}) {
|
|
12946
|
-
const dialogRef =
|
|
12947
|
-
const onCloseRef =
|
|
13005
|
+
const dialogRef = useRef32(null);
|
|
13006
|
+
const onCloseRef = useRef32(onClose);
|
|
12948
13007
|
onCloseRef.current = onClose;
|
|
12949
|
-
const openerRef =
|
|
13008
|
+
const openerRef = useRef32(opts.opener);
|
|
12950
13009
|
openerRef.current = opts.opener;
|
|
12951
13010
|
const restore = opts.restoreFocus ?? true;
|
|
12952
|
-
|
|
13011
|
+
useEffect39(() => {
|
|
12953
13012
|
const dialog = dialogRef.current;
|
|
12954
13013
|
const root = dialog?.getRootNode();
|
|
12955
13014
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -12960,7 +13019,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
12960
13019
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
12961
13020
|
};
|
|
12962
13021
|
}, []);
|
|
12963
|
-
|
|
13022
|
+
useEffect39(() => {
|
|
12964
13023
|
const onKey = (e) => {
|
|
12965
13024
|
if (e.key !== "Escape") return;
|
|
12966
13025
|
e.stopPropagation();
|
|
@@ -13212,20 +13271,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13212
13271
|
}
|
|
13213
13272
|
|
|
13214
13273
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13215
|
-
import { useEffect as
|
|
13274
|
+
import { useEffect as useEffect42, useId as useId3, useMemo as useMemo11, useRef as useRef36, useState as useState55 } from "react";
|
|
13216
13275
|
import { matchKey as matchKey10 } from "@sensiblestats/widget-sdk";
|
|
13217
13276
|
|
|
13218
13277
|
// src/useTennisRowPrices.ts
|
|
13219
|
-
import { useEffect as
|
|
13278
|
+
import { useEffect as useEffect40, useRef as useRef33, useState as useState54 } from "react";
|
|
13220
13279
|
import { matchKey as matchKey9 } from "@sensiblestats/widget-sdk";
|
|
13221
13280
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13222
13281
|
function useTennisRowPrices(a) {
|
|
13223
13282
|
const [state, setState] = useState54({ byId: null, stale: false });
|
|
13224
|
-
const getPricesRef =
|
|
13283
|
+
const getPricesRef = useRef33(a.getPrices);
|
|
13225
13284
|
getPricesRef.current = a.getPrices;
|
|
13226
|
-
const latest =
|
|
13285
|
+
const latest = useRef33(0);
|
|
13227
13286
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13228
|
-
|
|
13287
|
+
useEffect40(() => {
|
|
13229
13288
|
if (!a.enabled || idsKey === "") {
|
|
13230
13289
|
latest.current++;
|
|
13231
13290
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13263,11 +13322,11 @@ function useTennisRowPrices(a) {
|
|
|
13263
13322
|
}
|
|
13264
13323
|
|
|
13265
13324
|
// src/components/DayStrip.tsx
|
|
13266
|
-
import { useEffect as
|
|
13325
|
+
import { useEffect as useEffect41, useRef as useRef34 } from "react";
|
|
13267
13326
|
import { jsx as jsx98, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
13268
13327
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13269
|
-
const listRef =
|
|
13270
|
-
|
|
13328
|
+
const listRef = useRef34(null);
|
|
13329
|
+
useEffect41(() => {
|
|
13271
13330
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13272
13331
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13273
13332
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13296,7 +13355,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13296
13355
|
}
|
|
13297
13356
|
|
|
13298
13357
|
// src/components/games/ui/SearchField.tsx
|
|
13299
|
-
import { useCallback as useCallback24, useRef as
|
|
13358
|
+
import { useCallback as useCallback24, useRef as useRef35 } from "react";
|
|
13300
13359
|
|
|
13301
13360
|
// src/components/games/ui/icons.tsx
|
|
13302
13361
|
import { jsx as jsx99 } from "react/jsx-runtime";
|
|
@@ -13335,7 +13394,7 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ jsx99("path", { d:
|
|
|
13335
13394
|
// src/components/games/ui/SearchField.tsx
|
|
13336
13395
|
import { jsx as jsx100, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
13337
13396
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13338
|
-
const localRef =
|
|
13397
|
+
const localRef = useRef35(null);
|
|
13339
13398
|
const setInputRef = useCallback24((node) => {
|
|
13340
13399
|
localRef.current = node;
|
|
13341
13400
|
if (typeof inputRef === "function") inputRef(node);
|
|
@@ -13386,10 +13445,10 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13386
13445
|
const [query, setQuery] = useState55("");
|
|
13387
13446
|
const [toggled, setToggled] = useState55(/* @__PURE__ */ new Map());
|
|
13388
13447
|
const [expanded, setExpanded] = useState55(/* @__PURE__ */ new Set());
|
|
13389
|
-
const listRef =
|
|
13448
|
+
const listRef = useRef36(null);
|
|
13390
13449
|
const [sheet, setSheet] = useState55(null);
|
|
13391
13450
|
const { chips, selected } = loaded;
|
|
13392
|
-
|
|
13451
|
+
useEffect42(() => {
|
|
13393
13452
|
if (selected !== day) onDay(selected);
|
|
13394
13453
|
}, [day, selected, onDay]);
|
|
13395
13454
|
const isToday = selected === today;
|
|
@@ -13531,7 +13590,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13531
13590
|
}
|
|
13532
13591
|
|
|
13533
13592
|
// src/components/GamesPanel.tsx
|
|
13534
|
-
import { useEffect as
|
|
13593
|
+
import { useEffect as useEffect46, useState as useState70 } from "react";
|
|
13535
13594
|
|
|
13536
13595
|
// src/components/GamesLoginWall.tsx
|
|
13537
13596
|
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
@@ -13540,7 +13599,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13540
13599
|
}
|
|
13541
13600
|
|
|
13542
13601
|
// src/components/GamesHub.tsx
|
|
13543
|
-
import { useEffect as
|
|
13602
|
+
import { useEffect as useEffect43, useState as useState56 } from "react";
|
|
13544
13603
|
|
|
13545
13604
|
// src/components/games/ui/gameMeta.ts
|
|
13546
13605
|
function prettifyGameId(gameId) {
|
|
@@ -13692,7 +13751,7 @@ function pickHeroGame(games) {
|
|
|
13692
13751
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13693
13752
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13694
13753
|
const [, setTick] = useState56(0);
|
|
13695
|
-
|
|
13754
|
+
useEffect43(() => {
|
|
13696
13755
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13697
13756
|
return () => clearInterval(id);
|
|
13698
13757
|
}, []);
|
|
@@ -13752,10 +13811,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13752
13811
|
}
|
|
13753
13812
|
|
|
13754
13813
|
// src/components/GameScreenHost.tsx
|
|
13755
|
-
import { useEffect as
|
|
13814
|
+
import { useEffect as useEffect45, useRef as useRef39, useState as useState68 } from "react";
|
|
13756
13815
|
|
|
13757
13816
|
// src/useGamePlay.ts
|
|
13758
|
-
import { useCallback as useCallback25, useRef as
|
|
13817
|
+
import { useCallback as useCallback25, useRef as useRef37, useState as useState57 } from "react";
|
|
13759
13818
|
function toSubmitResult(payload) {
|
|
13760
13819
|
return {
|
|
13761
13820
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13770,12 +13829,12 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13770
13829
|
const [result, setResult] = useState57(null);
|
|
13771
13830
|
const [submitting, setSubmitting] = useState57(false);
|
|
13772
13831
|
const [rawStatus, setRawStatus] = useState57(null);
|
|
13773
|
-
const inFlightRef =
|
|
13774
|
-
const convRef =
|
|
13832
|
+
const inFlightRef = useRef37(false);
|
|
13833
|
+
const convRef = useRef37(conversation);
|
|
13775
13834
|
convRef.current = conversation;
|
|
13776
|
-
const optsRef =
|
|
13835
|
+
const optsRef = useRef37({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13777
13836
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13778
|
-
const resultRef =
|
|
13837
|
+
const resultRef = useRef37(null);
|
|
13779
13838
|
resultRef.current = result;
|
|
13780
13839
|
const refetch = useCallback25(async () => {
|
|
13781
13840
|
const conv = convRef.current;
|
|
@@ -14707,7 +14766,7 @@ function CareerPathGame({
|
|
|
14707
14766
|
}
|
|
14708
14767
|
|
|
14709
14768
|
// src/components/games/BeatTheGridGame.tsx
|
|
14710
|
-
import React, { useEffect as
|
|
14769
|
+
import React, { useEffect as useEffect44, useId as useId6, useRef as useRef38, useState as useState62 } from "react";
|
|
14711
14770
|
|
|
14712
14771
|
// src/components/games/ui/OptionList.tsx
|
|
14713
14772
|
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
@@ -14798,8 +14857,8 @@ function SearchSheet({
|
|
|
14798
14857
|
const s = ui.games.beatTheGrid;
|
|
14799
14858
|
const [query, setQuery] = useState62("");
|
|
14800
14859
|
const inputId = useId6();
|
|
14801
|
-
const inputRef =
|
|
14802
|
-
|
|
14860
|
+
const inputRef = useRef38(null);
|
|
14861
|
+
useEffect44(() => {
|
|
14803
14862
|
inputRef.current?.focus();
|
|
14804
14863
|
}, [row, col]);
|
|
14805
14864
|
const filtered = playerPool.filter(
|
|
@@ -16103,7 +16162,7 @@ function GameScreenHost({
|
|
|
16103
16162
|
}) {
|
|
16104
16163
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16105
16164
|
const [configJson, setConfigJson] = useState68(null);
|
|
16106
|
-
|
|
16165
|
+
useEffect45(() => {
|
|
16107
16166
|
setConfigJson(null);
|
|
16108
16167
|
if (!conversation) return;
|
|
16109
16168
|
let cancelled = false;
|
|
@@ -16126,12 +16185,12 @@ function GameScreenHost({
|
|
|
16126
16185
|
fixtureId: fixtureId || void 0,
|
|
16127
16186
|
locale: ui.hostTag
|
|
16128
16187
|
});
|
|
16129
|
-
|
|
16188
|
+
useEffect45(() => {
|
|
16130
16189
|
if (conversation) hydrate();
|
|
16131
16190
|
}, [conversation, gameId]);
|
|
16132
|
-
const hydrateRef =
|
|
16191
|
+
const hydrateRef = useRef39(hydrate);
|
|
16133
16192
|
hydrateRef.current = hydrate;
|
|
16134
|
-
|
|
16193
|
+
useEffect45(() => {
|
|
16135
16194
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16136
16195
|
if (rawStatus !== "pending") return;
|
|
16137
16196
|
const timerId = setInterval(() => {
|
|
@@ -16438,7 +16497,7 @@ function GamesPanel({
|
|
|
16438
16497
|
}) {
|
|
16439
16498
|
const [selected, setSelected] = useState70(null);
|
|
16440
16499
|
const [segment, setSegment] = useState70("play");
|
|
16441
|
-
|
|
16500
|
+
useEffect46(() => {
|
|
16442
16501
|
ensureGamesFonts();
|
|
16443
16502
|
}, []);
|
|
16444
16503
|
if (!loggedIn) return /* @__PURE__ */ jsx134(GamesLoginWall, { ui });
|
|
@@ -16502,10 +16561,10 @@ function GamesPanel({
|
|
|
16502
16561
|
}
|
|
16503
16562
|
|
|
16504
16563
|
// src/components/FavouritesPanel.tsx
|
|
16505
|
-
import { useEffect as
|
|
16564
|
+
import { useEffect as useEffect49, useRef as useRef41, useState as useState73 } from "react";
|
|
16506
16565
|
|
|
16507
16566
|
// src/components/FavouriteChips.tsx
|
|
16508
|
-
import { useEffect as
|
|
16567
|
+
import { useEffect as useEffect47, useState as useState71 } from "react";
|
|
16509
16568
|
import { Fragment as Fragment41, jsx as jsx135, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
16510
16569
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16511
16570
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16554,10 +16613,10 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16554
16613
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16555
16614
|
const [confirming, setConfirming] = useState71(false);
|
|
16556
16615
|
const data = controller.data;
|
|
16557
|
-
|
|
16616
|
+
useEffect47(() => {
|
|
16558
16617
|
setConfirming(false);
|
|
16559
16618
|
}, [sport]);
|
|
16560
|
-
|
|
16619
|
+
useEffect47(() => {
|
|
16561
16620
|
if (!confirming) return;
|
|
16562
16621
|
const onPointerDown = (e) => {
|
|
16563
16622
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16611,7 +16670,7 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16611
16670
|
}
|
|
16612
16671
|
|
|
16613
16672
|
// src/components/FavouritesSearch.tsx
|
|
16614
|
-
import { useEffect as
|
|
16673
|
+
import { useEffect as useEffect48, useRef as useRef40, useState as useState72 } from "react";
|
|
16615
16674
|
import { jsx as jsx136, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
16616
16675
|
var MIN_LETTERS = 2;
|
|
16617
16676
|
var MAX_LENGTH = 64;
|
|
@@ -16619,13 +16678,13 @@ var DEBOUNCE_MS = 250;
|
|
|
16619
16678
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16620
16679
|
const [query, setQuery] = useState72("");
|
|
16621
16680
|
const [answer, setAnswer] = useState72(null);
|
|
16622
|
-
const controllerRef =
|
|
16681
|
+
const controllerRef = useRef40(controller);
|
|
16623
16682
|
controllerRef.current = controller;
|
|
16624
16683
|
const trimmed = query.trim();
|
|
16625
16684
|
const queryKey = `${sport}|${trimmed}`;
|
|
16626
16685
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16627
16686
|
const settled = answer?.key === queryKey;
|
|
16628
|
-
|
|
16687
|
+
useEffect48(() => {
|
|
16629
16688
|
setAnswer(null);
|
|
16630
16689
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16631
16690
|
let cancelled = false;
|
|
@@ -16689,12 +16748,12 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16689
16748
|
import { jsx as jsx137, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
16690
16749
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16691
16750
|
const [notice, setNotice] = useState73(null);
|
|
16692
|
-
const refreshRef =
|
|
16751
|
+
const refreshRef = useRef41(controller.refresh);
|
|
16693
16752
|
refreshRef.current = controller.refresh;
|
|
16694
|
-
|
|
16753
|
+
useEffect49(() => {
|
|
16695
16754
|
void refreshRef.current();
|
|
16696
16755
|
}, []);
|
|
16697
|
-
|
|
16756
|
+
useEffect49(() => {
|
|
16698
16757
|
setNotice(null);
|
|
16699
16758
|
}, [sport]);
|
|
16700
16759
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16720,7 +16779,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16720
16779
|
}
|
|
16721
16780
|
|
|
16722
16781
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16723
|
-
import { useEffect as
|
|
16782
|
+
import { useEffect as useEffect50, useRef as useRef42, useState as useState74 } from "react";
|
|
16724
16783
|
import { Fragment as Fragment42, jsx as jsx138, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
16725
16784
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16726
16785
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16762,7 +16821,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16762
16821
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16763
16822
|
};
|
|
16764
16823
|
const [view, setView] = useState74(() => saved?.view ?? openingView);
|
|
16765
|
-
const autoWidened =
|
|
16824
|
+
const autoWidened = useRef42(false);
|
|
16766
16825
|
const [widenedNote, setWidenedNote] = useState74(saved?.widenedNote ?? false);
|
|
16767
16826
|
const requestFor = (v) => ({
|
|
16768
16827
|
sport,
|
|
@@ -16777,8 +16836,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16777
16836
|
});
|
|
16778
16837
|
const [first] = useState74(() => requestFor(view));
|
|
16779
16838
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16780
|
-
const lastRequest =
|
|
16781
|
-
|
|
16839
|
+
const lastRequest = useRef42(first);
|
|
16840
|
+
useEffect50(() => {
|
|
16782
16841
|
void request(lastRequest.current);
|
|
16783
16842
|
}, [request]);
|
|
16784
16843
|
const send = (req) => {
|
|
@@ -16813,15 +16872,15 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16813
16872
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
16814
16873
|
const [startedNote, setStartedNote] = useState74(false);
|
|
16815
16874
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
16816
|
-
|
|
16875
|
+
useEffect50(() => {
|
|
16817
16876
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
16818
16877
|
}, [startedNote, status2, anyStarted]);
|
|
16819
16878
|
const market = rows?.[0]?.market;
|
|
16820
|
-
const [
|
|
16821
|
-
|
|
16879
|
+
const [seen2, setSeen] = useState74(null);
|
|
16880
|
+
useEffect50(() => {
|
|
16822
16881
|
if (market) setSeen(market);
|
|
16823
16882
|
}, [market]);
|
|
16824
|
-
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ??
|
|
16883
|
+
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
16825
16884
|
const paused = ready && grid.status === "paused";
|
|
16826
16885
|
const coolOff = status2 === "ready" && grid === null;
|
|
16827
16886
|
const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
|
|
@@ -16831,14 +16890,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16831
16890
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
16832
16891
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
16833
16892
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
16834
|
-
|
|
16893
|
+
useEffect50(() => {
|
|
16835
16894
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
16836
16895
|
autoWidened.current = true;
|
|
16837
16896
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
16838
16897
|
commit(next, true);
|
|
16839
16898
|
send(requestFor(next));
|
|
16840
16899
|
}, [empty2, singles, widened, canWiden, view]);
|
|
16841
|
-
|
|
16900
|
+
useEffect50(() => {
|
|
16842
16901
|
if (coolOff) onCoolOff?.(sport);
|
|
16843
16902
|
}, [coolOff, onCoolOff, sport]);
|
|
16844
16903
|
if (coolOff) return null;
|
|
@@ -17624,7 +17683,7 @@ import { Fragment as Fragment46, jsx as jsx150, jsxs as jsxs133 } from "react/js
|
|
|
17624
17683
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17625
17684
|
function useIsModal() {
|
|
17626
17685
|
const [modal, setModal] = useState78(false);
|
|
17627
|
-
|
|
17686
|
+
useEffect52(() => {
|
|
17628
17687
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17629
17688
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17630
17689
|
const sync = () => setModal(mql.matches);
|
|
@@ -17642,8 +17701,8 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17642
17701
|
const [selectedPlayerId, setSelectedPlayerId] = useState78(null);
|
|
17643
17702
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17644
17703
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17645
|
-
const squadLayerRef =
|
|
17646
|
-
const squadScrollRef =
|
|
17704
|
+
const squadLayerRef = useRef44(null);
|
|
17705
|
+
const squadScrollRef = useRef44(null);
|
|
17647
17706
|
const selectPlayer = (playerId) => {
|
|
17648
17707
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17649
17708
|
setSelectedPlayerId(playerId);
|
|
@@ -17666,16 +17725,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17666
17725
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17667
17726
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17668
17727
|
const activeTab = tabs?.activeTab;
|
|
17669
|
-
|
|
17728
|
+
useEffect52(() => {
|
|
17670
17729
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17671
17730
|
setSelectedPlayerId(null);
|
|
17672
17731
|
clearPlayerDetail?.();
|
|
17673
17732
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17674
|
-
|
|
17733
|
+
useEffect52(() => {
|
|
17675
17734
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17676
17735
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17677
17736
|
const storedTab = tabState?.activeTab;
|
|
17678
|
-
|
|
17737
|
+
useEffect52(() => {
|
|
17679
17738
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17680
17739
|
if (unreachable) setMonitorTab?.("chat");
|
|
17681
17740
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17688,7 +17747,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17688
17747
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17689
17748
|
close();
|
|
17690
17749
|
}, [track, closeTab, answering, close]);
|
|
17691
|
-
|
|
17750
|
+
useEffect52(() => {
|
|
17692
17751
|
const onKey = (e) => {
|
|
17693
17752
|
if (e.key === "Escape") closeWith("escape");
|
|
17694
17753
|
};
|
|
@@ -17704,16 +17763,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17704
17763
|
tabs?.setActiveTab("chat");
|
|
17705
17764
|
send(text2, { grounding, source });
|
|
17706
17765
|
};
|
|
17707
|
-
|
|
17766
|
+
useEffect52(() => {
|
|
17708
17767
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17709
17768
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17710
17769
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17711
|
-
const inputRef =
|
|
17712
|
-
const limitRef =
|
|
17713
|
-
const typedSendRef =
|
|
17714
|
-
const focusAfterCloseRef =
|
|
17770
|
+
const inputRef = useRef44(null);
|
|
17771
|
+
const limitRef = useRef44(null);
|
|
17772
|
+
const typedSendRef = useRef44(false);
|
|
17773
|
+
const focusAfterCloseRef = useRef44(null);
|
|
17715
17774
|
const [tool, setTool] = useState78(null);
|
|
17716
|
-
const panelRef =
|
|
17775
|
+
const panelRef = useRef44(null);
|
|
17717
17776
|
const settings = useOddsSettings();
|
|
17718
17777
|
const [settingsOpen, setSettingsOpen] = useState78(false);
|
|
17719
17778
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
@@ -17726,10 +17785,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17726
17785
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17727
17786
|
}, []);
|
|
17728
17787
|
const paused = isPaused(state.limit);
|
|
17729
|
-
|
|
17788
|
+
useEffect52(() => {
|
|
17730
17789
|
if (paused) setTool(null);
|
|
17731
17790
|
}, [paused]);
|
|
17732
|
-
|
|
17791
|
+
useEffect52(() => {
|
|
17733
17792
|
if (!paused) return;
|
|
17734
17793
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17735
17794
|
typedSendRef.current = false;
|
|
@@ -17755,13 +17814,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17755
17814
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17756
17815
|
return `${k.dayLabel} ${k.time}`;
|
|
17757
17816
|
}, [ui]);
|
|
17758
|
-
|
|
17817
|
+
useEffect52(() => {
|
|
17759
17818
|
if (tool) return;
|
|
17760
17819
|
const target = focusAfterCloseRef.current;
|
|
17761
17820
|
focusAfterCloseRef.current = null;
|
|
17762
17821
|
if (target === "composer") inputRef.current?.focus();
|
|
17763
17822
|
}, [tool]);
|
|
17764
|
-
|
|
17823
|
+
useEffect52(() => {
|
|
17765
17824
|
if (!tool || onChatTab && presetGrid) return;
|
|
17766
17825
|
focusAfterCloseRef.current = "composer";
|
|
17767
17826
|
setTool(null);
|
|
@@ -20714,9 +20773,9 @@ function StatsWidget(props) {
|
|
|
20714
20773
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20715
20774
|
const cfg = props.config;
|
|
20716
20775
|
const built = useMemo13(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
20717
|
-
const trackingRef =
|
|
20776
|
+
const trackingRef = useRef45({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
20718
20777
|
const track = useMemo13(() => createTracker(() => trackingRef.current), []);
|
|
20719
|
-
const eventTextRef =
|
|
20778
|
+
const eventTextRef = useRef45(false);
|
|
20720
20779
|
eventTextRef.current = cfg?.eventText === true;
|
|
20721
20780
|
const logger = useMemo13(() => {
|
|
20722
20781
|
if (!built) return null;
|
|
@@ -20733,8 +20792,8 @@ function StatsWidget(props) {
|
|
|
20733
20792
|
[props.config, widgetStrings.strings]
|
|
20734
20793
|
);
|
|
20735
20794
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20736
|
-
const rootRef =
|
|
20737
|
-
const introDoneRef =
|
|
20795
|
+
const rootRef = useRef45(null);
|
|
20796
|
+
const introDoneRef = useRef45(false);
|
|
20738
20797
|
const markIntroDone = useCallback27(() => {
|
|
20739
20798
|
introDoneRef.current = true;
|
|
20740
20799
|
}, []);
|
|
@@ -20749,13 +20808,13 @@ function StatsWidget(props) {
|
|
|
20749
20808
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
20750
20809
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
20751
20810
|
const liveCardWatches = useMemo13(() => {
|
|
20752
|
-
const
|
|
20811
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
20753
20812
|
const out = [];
|
|
20754
20813
|
for (const msg of controller.state.messages) {
|
|
20755
20814
|
if (msg.role !== "assistant") continue;
|
|
20756
20815
|
for (const vm of msg.marketOdds) {
|
|
20757
|
-
if (vm.live == null ||
|
|
20758
|
-
|
|
20816
|
+
if (vm.live == null || seen2.has(vm.matchId)) continue;
|
|
20817
|
+
seen2.add(vm.matchId);
|
|
20759
20818
|
out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
|
|
20760
20819
|
}
|
|
20761
20820
|
}
|
|
@@ -20801,9 +20860,9 @@ function StatsWidget(props) {
|
|
|
20801
20860
|
timeZone: ui.timeZone
|
|
20802
20861
|
});
|
|
20803
20862
|
const offeredSports = useMemo13(() => {
|
|
20804
|
-
const
|
|
20805
|
-
for (const g of discovery.groups)
|
|
20806
|
-
return [...
|
|
20863
|
+
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
20864
|
+
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
20865
|
+
return [...seen2];
|
|
20807
20866
|
}, [discovery.matchDays, discovery.groups]);
|
|
20808
20867
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
20809
20868
|
const [liveLeague, setLiveLeague] = useState79(null);
|
|
@@ -20816,8 +20875,8 @@ function StatsWidget(props) {
|
|
|
20816
20875
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20817
20876
|
timeZone: ui.timeZone
|
|
20818
20877
|
});
|
|
20819
|
-
const prevLiveSnapshotRef =
|
|
20820
|
-
|
|
20878
|
+
const prevLiveSnapshotRef = useRef45(monitor.snapshot);
|
|
20879
|
+
useEffect53(() => {
|
|
20821
20880
|
const snap = monitor.snapshot;
|
|
20822
20881
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
20823
20882
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -20917,8 +20976,8 @@ function StatsWidget(props) {
|
|
|
20917
20976
|
);
|
|
20918
20977
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
20919
20978
|
const markLiveActivity = monitor.markLiveActivity;
|
|
20920
|
-
const prevLiveCountRef =
|
|
20921
|
-
|
|
20979
|
+
const prevLiveCountRef = useRef45(0);
|
|
20980
|
+
useEffect53(() => {
|
|
20922
20981
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
20923
20982
|
prevLiveCountRef.current = discovery.liveCount;
|
|
20924
20983
|
if (rose) markLiveActivity();
|
|
@@ -20968,10 +21027,10 @@ function StatsWidget(props) {
|
|
|
20968
21027
|
log: logger
|
|
20969
21028
|
})
|
|
20970
21029
|
}));
|
|
20971
|
-
const onControlRef =
|
|
21030
|
+
const onControlRef = useRef45(props.onControl);
|
|
20972
21031
|
onControlRef.current = props.onControl;
|
|
20973
21032
|
const { open: openPanel, close: closePanel } = controller;
|
|
20974
|
-
|
|
21033
|
+
useEffect53(() => {
|
|
20975
21034
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
20976
21035
|
return () => onControlRef.current?.(null);
|
|
20977
21036
|
}, [openPanel, closePanel]);
|
|
@@ -20988,11 +21047,11 @@ function StatsWidget(props) {
|
|
|
20988
21047
|
page: cfg?.page
|
|
20989
21048
|
}
|
|
20990
21049
|
};
|
|
20991
|
-
|
|
21050
|
+
useEffect53(() => {
|
|
20992
21051
|
if (!logger) return;
|
|
20993
21052
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
20994
21053
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
20995
|
-
|
|
21054
|
+
useEffect53(() => {
|
|
20996
21055
|
if (!logger) return;
|
|
20997
21056
|
logger.resume();
|
|
20998
21057
|
const onHide = () => {
|
|
@@ -21010,7 +21069,7 @@ function StatsWidget(props) {
|
|
|
21010
21069
|
logger.dispose();
|
|
21011
21070
|
};
|
|
21012
21071
|
}, [logger]);
|
|
21013
|
-
|
|
21072
|
+
useEffect53(() => {
|
|
21014
21073
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21015
21074
|
const node = rootRef.current?.getRootNode();
|
|
21016
21075
|
if (node) injectStyles(node);
|