@sensiblestats/widget-react 0.114.1 → 0.116.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 +17 -0
- package/dist/index.cjs +146 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +201 -91
- package/dist/index.js.map +1 -1
- package/dist/styles.css +19 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as useCallback25, useEffect as
|
|
2
|
+
import { useCallback as useCallback25, useEffect as useEffect46, useMemo as useMemo11, useRef as useRef37, useState as useState72 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/kickoff.ts
|
|
@@ -416,6 +416,15 @@ var STRINGS = {
|
|
|
416
416
|
propsLast5: "Last 5 games",
|
|
417
417
|
propsLadderOnly: "Ladder only",
|
|
418
418
|
propsMarkets: (n) => `${n} markets`,
|
|
419
|
+
propsLast5Live: "Last 5 games + live",
|
|
420
|
+
propsLiveBar: "Live",
|
|
421
|
+
propsMinutes: (t) => `${t} min`,
|
|
422
|
+
propsLineChip: (l) => `line ${l}`,
|
|
423
|
+
propsShooting: (made, att) => `FG ${made}/${att}`,
|
|
424
|
+
propsFouls: (n) => `${n} PF`,
|
|
425
|
+
propsStatsLive: (t) => `Stats ${t} UTC \xB7 live`,
|
|
426
|
+
propsStatsAt: (t) => `Stats ${t} UTC`,
|
|
427
|
+
propsStatsAgo: (t, m) => `Stats ${t} UTC \xB7 ${m} min ago`,
|
|
419
428
|
propsStatShort: (stat) => NBA_STAT_SHORT_EN[stat] ?? stat,
|
|
420
429
|
matchupPace: "Pace",
|
|
421
430
|
matchupOffRating: "Offensive rating",
|
|
@@ -1097,6 +1106,15 @@ var STRINGS = {
|
|
|
1097
1106
|
propsLast5: "Son 5 ma\xE7",
|
|
1098
1107
|
propsLadderOnly: "Sadece alternatif",
|
|
1099
1108
|
propsMarkets: (n) => `${n} market`,
|
|
1109
|
+
propsLast5Live: "Son 5 ma\xE7 + canl\u0131",
|
|
1110
|
+
propsLiveBar: "Canl\u0131",
|
|
1111
|
+
propsMinutes: (t) => `${t} dk`,
|
|
1112
|
+
propsLineChip: (l) => `baraj ${l}`,
|
|
1113
|
+
propsShooting: (made, att) => `\u0130B ${made}/${att}`,
|
|
1114
|
+
propsFouls: (n) => `${n} faul`,
|
|
1115
|
+
propsStatsLive: (t) => `\u0130statistik ${t} UTC \xB7 canl\u0131`,
|
|
1116
|
+
propsStatsAt: (t) => `\u0130statistik ${t} UTC`,
|
|
1117
|
+
propsStatsAgo: (t, m) => `\u0130statistik ${t} UTC \xB7 ${m} dk \xF6nce`,
|
|
1100
1118
|
propsStatShort: (stat) => NBA_STAT_SHORT_TR[stat] ?? stat,
|
|
1101
1119
|
matchupPace: "Tempo",
|
|
1102
1120
|
matchupOffRating: "H\xFCcum reytingi",
|
|
@@ -1441,7 +1459,7 @@ function parseOddsFormat(value) {
|
|
|
1441
1459
|
}
|
|
1442
1460
|
|
|
1443
1461
|
// src/version.generated.ts
|
|
1444
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1462
|
+
var WIDGET_REACT_VERSION = "0.116.0";
|
|
1445
1463
|
|
|
1446
1464
|
// src/config.ts
|
|
1447
1465
|
function normalizeUi(cfg) {
|
|
@@ -4174,6 +4192,7 @@ function useTabs(initial = "chat") {
|
|
|
4174
4192
|
|
|
4175
4193
|
// src/useLiveMonitor.ts
|
|
4176
4194
|
var PROPS_FRESH_MS = 6e4;
|
|
4195
|
+
var PROPS_LIVE_FRESH_MS = 1e4;
|
|
4177
4196
|
var MARKET_FRESH_MS = 45e3;
|
|
4178
4197
|
var MARKET_FETCH_TIMEOUT_MS = 15e3;
|
|
4179
4198
|
var DEFAULT_FOOTBALL_MARKET = "FULLTIME_RESULT";
|
|
@@ -4283,7 +4302,7 @@ function useLiveMonitor(opts) {
|
|
|
4283
4302
|
if (!fn) return;
|
|
4284
4303
|
const key = monitorMatchKey(sport, matchId);
|
|
4285
4304
|
const cur = playerPropsRef.current[key];
|
|
4286
|
-
if (cur?.loading || cur && Date.now() - cur.fetchedAt < PROPS_FRESH_MS) return;
|
|
4305
|
+
if (cur?.loading || cur && Date.now() - cur.fetchedAt < (cur.bundle?.live ? PROPS_LIVE_FRESH_MS : PROPS_FRESH_MS)) return;
|
|
4287
4306
|
const put = (entry) => {
|
|
4288
4307
|
playerPropsRef.current = { ...playerPropsRef.current, [key]: entry };
|
|
4289
4308
|
setPlayerProps((prev) => ({ ...prev, [key]: entry }));
|
|
@@ -7157,7 +7176,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
7157
7176
|
}
|
|
7158
7177
|
|
|
7159
7178
|
// src/components/ChatPanel.tsx
|
|
7160
|
-
import { useCallback as useCallback24, useEffect as
|
|
7179
|
+
import { useCallback as useCallback24, useEffect as useEffect45, useLayoutEffect as useLayoutEffect2, useMemo as useMemo10, useRef as useRef36, useState as useState71 } from "react";
|
|
7161
7180
|
|
|
7162
7181
|
// src/components/ChatHeader.tsx
|
|
7163
7182
|
import { useEffect as useEffect24, useRef as useRef20, useState as useState28 } from "react";
|
|
@@ -10151,11 +10170,13 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
10151
10170
|
import { SPORTS as SPORTS6 } from "@sensiblestats/widget-sdk";
|
|
10152
10171
|
|
|
10153
10172
|
// src/components/NbaPropsSection.tsx
|
|
10154
|
-
import { useState as useState43 } from "react";
|
|
10173
|
+
import { useEffect as useEffect32, useState as useState43 } from "react";
|
|
10155
10174
|
|
|
10156
10175
|
// src/components/PropsPieces.tsx
|
|
10157
10176
|
import { useEffect as useEffect31, useState as useState42 } from "react";
|
|
10158
10177
|
import { Fragment as Fragment15, jsx as jsx73, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
10178
|
+
var livePlayer = (bundle, p) => bundle.live === true || !p.live ? p : { ...p, live: null };
|
|
10179
|
+
var mmss = (seconds) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
10159
10180
|
var MAX_TIMER_MS = 2147483647;
|
|
10160
10181
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
10161
10182
|
function preKickoff(match) {
|
|
@@ -10176,7 +10197,8 @@ function usePreKickoff(match) {
|
|
|
10176
10197
|
}
|
|
10177
10198
|
function usePropsOpen(match, monitor, descriptor) {
|
|
10178
10199
|
const sport = descriptor.sport === "americanfootball" ? "americanfootball" : void 0;
|
|
10179
|
-
const
|
|
10200
|
+
const beforeKickoff = usePreKickoff(match);
|
|
10201
|
+
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
10180
10202
|
const live = descriptor.sport === "basketball" && match.phase === "live";
|
|
10181
10203
|
const open = pre || live;
|
|
10182
10204
|
useEffect31(() => {
|
|
@@ -10224,51 +10246,68 @@ function PriceCell({ hitsText, children }) {
|
|
|
10224
10246
|
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-rung-hits", children: hitsText })
|
|
10225
10247
|
] });
|
|
10226
10248
|
}
|
|
10227
|
-
function PropBars({ bars, line, title, wide, ui }) {
|
|
10249
|
+
function PropBars({ bars, line, title, wide, ui, note }) {
|
|
10228
10250
|
const values = bars.map((b) => b.value);
|
|
10229
10251
|
const top = Math.max(...values, line ?? 0, 1) * 1.1;
|
|
10230
10252
|
const pct = (v) => `${v / top * 100}%`;
|
|
10253
|
+
const hasLive = bars.some((b) => b.live);
|
|
10254
|
+
const columns = { "--ss-bars": bars.length };
|
|
10255
|
+
const barClass = (b, v) => b.live ? "ss-w-props-bar ss-w-props-bar--live" : wide && line != null && v < line ? "ss-w-props-bar ss-w-props-bar--under" : "ss-w-props-bar";
|
|
10231
10256
|
return /* @__PURE__ */ jsxs68("div", { className: "ss-w-props-l5", children: [
|
|
10232
|
-
/* @__PURE__ */
|
|
10233
|
-
|
|
10234
|
-
|
|
10257
|
+
note ? /* @__PURE__ */ jsxs68("div", { className: "ss-w-props-l5-head", children: [
|
|
10258
|
+
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-cap", children: title }),
|
|
10259
|
+
note
|
|
10260
|
+
] }) : /* @__PURE__ */ jsx73("span", { className: "ss-w-props-cap", children: title }),
|
|
10261
|
+
/* @__PURE__ */ jsxs68("div", { className: `${wide ? "ss-w-props-bars ss-w-props-bars--wide" : "ss-w-props-bars"}${hasLive ? " ss-w-props-bars--live" : ""}`, style: hasLive ? columns : void 0, children: [
|
|
10262
|
+
bars.map((b, i) => /* @__PURE__ */ jsx73(
|
|
10235
10263
|
"span",
|
|
10236
10264
|
{
|
|
10237
|
-
className:
|
|
10238
|
-
style: { height: pct(
|
|
10239
|
-
children: /* @__PURE__ */ jsx73("span", { className: "ss-w-props-val", children:
|
|
10265
|
+
className: barClass(b, b.value),
|
|
10266
|
+
style: { height: pct(b.value) },
|
|
10267
|
+
children: /* @__PURE__ */ jsx73("span", { className: "ss-w-props-val", children: b.value })
|
|
10240
10268
|
},
|
|
10241
10269
|
i
|
|
10242
10270
|
)),
|
|
10243
10271
|
line != null && /* @__PURE__ */ jsx73("span", { className: "ss-w-props-ref", style: { bottom: pct(line) }, children: /* @__PURE__ */ jsx73("span", { className: "ss-w-props-ref-lab", children: ui.nba.lineText(String(line)) }) })
|
|
10244
10272
|
] }),
|
|
10245
|
-
/* @__PURE__ */ jsx73("div", { className: wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps", children: bars.map((b, i) => /* @__PURE__ */ jsxs68("span", { children: [
|
|
10273
|
+
/* @__PURE__ */ jsx73("div", { className: `${wide ? "ss-w-props-opps ss-w-props-opps--wide" : "ss-w-props-opps"}${hasLive ? " ss-w-props-opps--live" : ""}`, style: hasLive ? columns : void 0, children: bars.map((b, i) => /* @__PURE__ */ jsxs68("span", { children: [
|
|
10246
10274
|
b.away && /* @__PURE__ */ jsx73("i", { className: "ss-w-props-at", children: "@" }),
|
|
10247
|
-
b.label
|
|
10275
|
+
b.live ? /* @__PURE__ */ jsx73("b", { children: b.label }) : b.label
|
|
10248
10276
|
] }, i)) })
|
|
10249
10277
|
] });
|
|
10250
10278
|
}
|
|
10251
|
-
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10279
|
+
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
10280
|
+
const player = livePlayer(bundle, given);
|
|
10252
10281
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10253
10282
|
const [picked, setPicked] = useState42(null);
|
|
10254
10283
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10255
10284
|
const sample = active?.games?.length ?? 0;
|
|
10256
10285
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
10257
10286
|
const bars = active ? descriptor.bars(active, player) : [];
|
|
10258
|
-
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length) : descriptor.barsTitle;
|
|
10287
|
+
const title = typeof descriptor.barsTitle === "function" ? descriptor.barsTitle(bars.length, bars.some((b) => b.live)) : descriptor.barsTitle;
|
|
10259
10288
|
const priceProps = { bundle, descriptor, ui, slip };
|
|
10289
|
+
const liveValue = (s) => player.live ? descriptor.live?.(s, player) ?? null : null;
|
|
10290
|
+
const liveChips = stats.some((s) => liveValue(s) !== null);
|
|
10260
10291
|
return /* @__PURE__ */ jsxs68("div", { className: "ss-w-props-panel", children: [
|
|
10261
|
-
/* @__PURE__ */ jsx73("div", { className: "ss-w-props-chips", children: stats.map((s) =>
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10292
|
+
/* @__PURE__ */ jsx73("div", { className: liveChips ? "ss-w-props-chips ss-w-props-chips--live" : "ss-w-props-chips", children: stats.map((s) => {
|
|
10293
|
+
const now = liveValue(s);
|
|
10294
|
+
return /* @__PURE__ */ jsxs68(
|
|
10295
|
+
"button",
|
|
10296
|
+
{
|
|
10297
|
+
type: "button",
|
|
10298
|
+
className: "ss-w-props-chip",
|
|
10299
|
+
"aria-pressed": s === active,
|
|
10300
|
+
"aria-label": now !== null ? [`${now} ${descriptor.statLabel(s.stat)}`, s.line != null ? ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) : null].filter(Boolean).join(", ") : void 0,
|
|
10301
|
+
onClick: () => setPicked(s.stat),
|
|
10302
|
+
children: [
|
|
10303
|
+
now !== null && /* @__PURE__ */ jsx73("b", { children: now }),
|
|
10304
|
+
descriptor.statLabel(s.stat),
|
|
10305
|
+
now !== null && s.line != null && /* @__PURE__ */ jsx73("i", { children: ui.nba.propsLineChip(ui.nba.lineText(String(s.line))) })
|
|
10306
|
+
]
|
|
10307
|
+
},
|
|
10308
|
+
s.stat
|
|
10309
|
+
);
|
|
10310
|
+
}) }),
|
|
10272
10311
|
active && hasMainLine(active) && /* @__PURE__ */ jsxs68("div", { className: descriptor.sport === "americanfootball" ? "ss-w-props-ou ss-w-props-ou--nfl" : "ss-w-props-ou", children: [
|
|
10273
10312
|
active.over && /* @__PURE__ */ jsx73(PriceCell, { hitsText: hitsOf(active.over, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ jsx73(PropPrice, { price: active.over, label: ui.nba.over(ui.nba.lineText(String(active.over.line ?? active.line))), stat: active, ...priceProps }) }),
|
|
10274
10313
|
active.under && /* @__PURE__ */ jsx73(PriceCell, { hitsText: hitsOf(active.under, (h) => fillNfl(ui.nfl.hits, { h, n: sample })), children: /* @__PURE__ */ jsx73(PropPrice, { price: active.under, label: ui.nba.under(ui.nba.lineText(String(active.under.line ?? active.line))), stat: active, ...priceProps }) })
|
|
@@ -10285,15 +10324,17 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10285
10324
|
}
|
|
10286
10325
|
) }, p.matchOddsId)) })
|
|
10287
10326
|
] }),
|
|
10288
|
-
active && bars.length > 0 && /* @__PURE__ */ jsx73(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui })
|
|
10327
|
+
active && bars.length > 0 && /* @__PURE__ */ jsx73(PropBars, { bars, line: active.line, title, wide: descriptor.tenGameBars, ui, note: player.live ? descriptor.liveNote?.(player, ui) : null })
|
|
10289
10328
|
] });
|
|
10290
10329
|
}
|
|
10291
10330
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10292
10331
|
const [openId, setOpenId] = useState42(null);
|
|
10293
|
-
return /* @__PURE__ */ jsx73("div", { className: "ss-w-props-list", children: players.map((
|
|
10332
|
+
return /* @__PURE__ */ jsx73("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
10333
|
+
const p = livePlayer(bundle, given);
|
|
10294
10334
|
const isOpen = openId === p.playerId;
|
|
10295
10335
|
const main = descriptor.mainStat(p);
|
|
10296
|
-
const
|
|
10336
|
+
const now = main && p.live ? descriptor.live?.(main, p) ?? null : null;
|
|
10337
|
+
const meta = [p.position, p.live ? ui.nba.propsMinutes(mmss(p.live.secondsPlayed)) : null, ui.nba.propsMarkets(p.stats.length)].filter(Boolean).join(" \xB7 ");
|
|
10297
10338
|
return /* @__PURE__ */ jsxs68("div", { className: "ss-w-props-item", children: [
|
|
10298
10339
|
/* @__PURE__ */ jsxs68(
|
|
10299
10340
|
"button",
|
|
@@ -10308,14 +10349,17 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
10308
10349
|
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-name", children: p.name }),
|
|
10309
10350
|
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-meta", children: meta })
|
|
10310
10351
|
] }),
|
|
10311
|
-
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ jsxs68(Fragment15, { children: [
|
|
10352
|
+
/* @__PURE__ */ jsx73("span", { className: now !== null ? "ss-w-props-main ss-w-props-main--live" : "ss-w-props-main", children: main?.line != null ? /* @__PURE__ */ jsxs68(Fragment15, { children: [
|
|
10312
10353
|
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-stat", children: descriptor.statShort(main.stat) }),
|
|
10313
|
-
/* @__PURE__ */
|
|
10354
|
+
now !== null ? /* @__PURE__ */ jsxs68("span", { className: "ss-w-props-nowline", children: [
|
|
10355
|
+
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-now", children: now }),
|
|
10356
|
+
/* @__PURE__ */ jsx73("span", { className: "ss-w-props-line", children: `\xB7 ${ui.nba.lineText(String(main.line))}` })
|
|
10357
|
+
] }) : /* @__PURE__ */ jsx73("span", { className: "ss-w-props-line", children: ui.nba.lineText(String(main.line)) })
|
|
10314
10358
|
] }) : /* @__PURE__ */ jsx73("span", { className: "ss-w-props-stat", children: ui.nba.propsLadderOnly }) })
|
|
10315
10359
|
]
|
|
10316
10360
|
}
|
|
10317
10361
|
),
|
|
10318
|
-
isOpen && /* @__PURE__ */ jsx73(PropPlayerPanel, { player:
|
|
10362
|
+
isOpen && /* @__PURE__ */ jsx73(PropPlayerPanel, { player: given, bundle, descriptor, ui, slip })
|
|
10319
10363
|
] }, p.playerId);
|
|
10320
10364
|
}) });
|
|
10321
10365
|
}
|
|
@@ -10329,21 +10373,65 @@ var GAME_VALUE = {
|
|
|
10329
10373
|
assists: (g) => g.ast,
|
|
10330
10374
|
threes: (g) => g.fg3m
|
|
10331
10375
|
};
|
|
10332
|
-
var
|
|
10376
|
+
var LIVE_VALUE = {
|
|
10377
|
+
points: (l) => l.pts,
|
|
10378
|
+
rebounds: (l) => l.reb,
|
|
10379
|
+
assists: (l) => l.ast,
|
|
10380
|
+
threes: (l) => l.fg3m
|
|
10381
|
+
};
|
|
10382
|
+
var BOX_QUIET_MS = 12e4;
|
|
10383
|
+
var foulTrouble = (pf, period) => period != null && pf >= (period <= 2 ? 3 : 4);
|
|
10384
|
+
var nbaDescriptor = (ui, match) => ({
|
|
10333
10385
|
sport: "basketball",
|
|
10334
10386
|
stats: STAT_ORDER,
|
|
10335
10387
|
statLabel: ui.nba.stat,
|
|
10336
10388
|
statShort: ui.nba.propsStatShort,
|
|
10337
10389
|
mainStat: (p) => p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine),
|
|
10338
|
-
bars: (stat, player) =>
|
|
10339
|
-
|
|
10390
|
+
bars: (stat, player) => {
|
|
10391
|
+
const past = [...player.last5].reverse().map((g) => ({ label: g.opponent, value: (GAME_VALUE[stat.stat] ?? (() => 0))(g) }));
|
|
10392
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10393
|
+
return player.live && now ? [...past, { label: ui.nba.propsLiveBar, value: now(player.live), live: true }] : past;
|
|
10394
|
+
},
|
|
10395
|
+
live: (stat, player) => {
|
|
10396
|
+
const now = LIVE_VALUE[stat.stat];
|
|
10397
|
+
return player.live && now ? now(player.live) : null;
|
|
10398
|
+
},
|
|
10399
|
+
liveNote: (player) => {
|
|
10400
|
+
const l = player.live;
|
|
10401
|
+
if (!l) return null;
|
|
10402
|
+
return /* @__PURE__ */ jsxs69("span", { className: "ss-w-props-l5-note", children: [
|
|
10403
|
+
ui.nba.propsShooting(l.fgm, l.fga),
|
|
10404
|
+
" \xB7 ",
|
|
10405
|
+
/* @__PURE__ */ jsx74("span", { className: foulTrouble(l.pf, match.basketball?.period) ? "ss-w-props-pf--warn" : void 0, children: ui.nba.propsFouls(l.pf) })
|
|
10406
|
+
] });
|
|
10407
|
+
},
|
|
10408
|
+
barsTitle: (_n, hasLive) => hasLive ? ui.nba.propsLast5Live : ui.nba.propsLast5,
|
|
10340
10409
|
showHits: false,
|
|
10341
10410
|
rungLabel: (line, ui2) => `${ui2.nba.lineText(String(line))}+`,
|
|
10342
10411
|
tenGameBars: false
|
|
10343
10412
|
});
|
|
10413
|
+
function StatsClock({ bundle, match, ui }) {
|
|
10414
|
+
const [tick, setTick] = useState43(0);
|
|
10415
|
+
const at = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
10416
|
+
const time = clock2(bundle.boxAsOfUtc);
|
|
10417
|
+
const valid = !Number.isNaN(at) && time !== "";
|
|
10418
|
+
const onBreak = atBreak(match);
|
|
10419
|
+
useEffect32(() => {
|
|
10420
|
+
if (!valid || onBreak) return;
|
|
10421
|
+
const age2 = Date.now() - at;
|
|
10422
|
+
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
10423
|
+
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
10424
|
+
return () => clearTimeout(id);
|
|
10425
|
+
}, [valid, onBreak, at, tick]);
|
|
10426
|
+
if (!valid) return null;
|
|
10427
|
+
if (onBreak) return /* @__PURE__ */ jsx74("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAt(time) });
|
|
10428
|
+
const age = Date.now() - at;
|
|
10429
|
+
if (age >= BOX_QUIET_MS) return /* @__PURE__ */ jsx74("span", { className: "ss-w-props-asof", children: ui.nba.propsStatsAgo(time, Math.floor(age / 6e4)) });
|
|
10430
|
+
return /* @__PURE__ */ jsx74("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
10431
|
+
}
|
|
10344
10432
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10345
10433
|
const [side, setSide] = useState43("home");
|
|
10346
|
-
const descriptor = nbaDescriptor(ui);
|
|
10434
|
+
const descriptor = nbaDescriptor(ui, match);
|
|
10347
10435
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10348
10436
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10349
10437
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
@@ -10354,7 +10442,10 @@ function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
|
10354
10442
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10355
10443
|
];
|
|
10356
10444
|
return /* @__PURE__ */ jsxs69("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10357
|
-
/* @__PURE__ */
|
|
10445
|
+
/* @__PURE__ */ jsxs69("div", { className: "ss-w-props-headrow", children: [
|
|
10446
|
+
/* @__PURE__ */ jsx74("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10447
|
+
/* @__PURE__ */ jsx74(StatsClock, { bundle, match, ui })
|
|
10448
|
+
] }),
|
|
10358
10449
|
/* @__PURE__ */ jsx74("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ jsx74("button", { type: "button", className: "ss-w-props-side", "aria-pressed": shown2 === s.side, onClick: () => setSide(s.side), children: `${s.abbreviation} \xB7 ${bySide(s.side).length}` }, s.side)) }),
|
|
10359
10450
|
/* @__PURE__ */ jsx74(PropRoster, { bundle, players: bySide(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10360
10451
|
] });
|
|
@@ -10804,7 +10895,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10804
10895
|
}
|
|
10805
10896
|
|
|
10806
10897
|
// src/components/ScoreboardStrip.tsx
|
|
10807
|
-
import { useEffect as
|
|
10898
|
+
import { useEffect as useEffect33, useRef as useRef26 } from "react";
|
|
10808
10899
|
import { SPORTS as SPORTS7, sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
10809
10900
|
import { jsx as jsx79, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
10810
10901
|
function nbaStatus(m, ui) {
|
|
@@ -10880,7 +10971,7 @@ function rowsFor(m) {
|
|
|
10880
10971
|
}
|
|
10881
10972
|
function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
10882
10973
|
const stripRef = useRef26(null);
|
|
10883
|
-
|
|
10974
|
+
useEffect33(() => {
|
|
10884
10975
|
const strip = stripRef.current;
|
|
10885
10976
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
10886
10977
|
if (!strip || !pressed) return;
|
|
@@ -11058,7 +11149,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
11058
11149
|
}
|
|
11059
11150
|
|
|
11060
11151
|
// src/components/TodayPanel.tsx
|
|
11061
|
-
import { useEffect as
|
|
11152
|
+
import { useEffect as useEffect35, useId as useId2, useMemo as useMemo9, useState as useState48 } from "react";
|
|
11062
11153
|
import { matchKey as matchKey7 } from "@sensiblestats/widget-sdk";
|
|
11063
11154
|
|
|
11064
11155
|
// src/placement.ts
|
|
@@ -11186,7 +11277,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
11186
11277
|
}
|
|
11187
11278
|
|
|
11188
11279
|
// src/components/LeagueDetail.tsx
|
|
11189
|
-
import { useEffect as
|
|
11280
|
+
import { useEffect as useEffect34, useState as useState47 } from "react";
|
|
11190
11281
|
import { matchKey as matchKey5 } from "@sensiblestats/widget-sdk";
|
|
11191
11282
|
|
|
11192
11283
|
// src/components/FixtureRow.tsx
|
|
@@ -11250,10 +11341,10 @@ import { jsx as jsx83, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
|
11250
11341
|
var STAR_PATH2 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1-6.47L2.5 9.35l6.5-.95z";
|
|
11251
11342
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
11252
11343
|
const [toast, setToast] = useState47(null);
|
|
11253
|
-
|
|
11344
|
+
useEffect34(() => {
|
|
11254
11345
|
setToast(null);
|
|
11255
11346
|
}, [group.competitionId]);
|
|
11256
|
-
|
|
11347
|
+
useEffect34(() => {
|
|
11257
11348
|
if (toast === null) return;
|
|
11258
11349
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11259
11350
|
return () => clearTimeout(id);
|
|
@@ -11494,7 +11585,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11494
11585
|
const [query, setQuery] = useState48("");
|
|
11495
11586
|
const [selectedCompetitionId, setSelectedCompetitionId] = useState48(null);
|
|
11496
11587
|
const [toast, setToast] = useState48(null);
|
|
11497
|
-
|
|
11588
|
+
useEffect35(() => {
|
|
11498
11589
|
if (toast === null) return;
|
|
11499
11590
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11500
11591
|
return () => clearTimeout(id);
|
|
@@ -11540,7 +11631,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11540
11631
|
}
|
|
11541
11632
|
const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
|
|
11542
11633
|
const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
|
|
11543
|
-
|
|
11634
|
+
useEffect35(() => {
|
|
11544
11635
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
11545
11636
|
}, [selectedCompetitionId, openGroup]);
|
|
11546
11637
|
const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get(matchKey7(m.sport, m.matchId)), stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
|
|
@@ -11696,7 +11787,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11696
11787
|
}
|
|
11697
11788
|
|
|
11698
11789
|
// src/components/GamesPanel.tsx
|
|
11699
|
-
import { useEffect as
|
|
11790
|
+
import { useEffect as useEffect39, useState as useState63 } from "react";
|
|
11700
11791
|
|
|
11701
11792
|
// src/components/GamesLoginWall.tsx
|
|
11702
11793
|
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
@@ -11705,7 +11796,7 @@ function GamesLoginWall({ ui }) {
|
|
|
11705
11796
|
}
|
|
11706
11797
|
|
|
11707
11798
|
// src/components/GamesHub.tsx
|
|
11708
|
-
import { useEffect as
|
|
11799
|
+
import { useEffect as useEffect36, useState as useState49 } from "react";
|
|
11709
11800
|
|
|
11710
11801
|
// src/components/games/ui/gameMeta.ts
|
|
11711
11802
|
function prettifyGameId(gameId) {
|
|
@@ -11857,7 +11948,7 @@ function pickHeroGame(games) {
|
|
|
11857
11948
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
11858
11949
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
11859
11950
|
const [, setTick] = useState49(0);
|
|
11860
|
-
|
|
11951
|
+
useEffect36(() => {
|
|
11861
11952
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
11862
11953
|
return () => clearInterval(id);
|
|
11863
11954
|
}, []);
|
|
@@ -11917,7 +12008,7 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
11917
12008
|
}
|
|
11918
12009
|
|
|
11919
12010
|
// src/components/GameScreenHost.tsx
|
|
11920
|
-
import { useEffect as
|
|
12011
|
+
import { useEffect as useEffect38, useRef as useRef31, useState as useState61 } from "react";
|
|
11921
12012
|
|
|
11922
12013
|
// src/useGamePlay.ts
|
|
11923
12014
|
import { useCallback as useCallback23, useRef as useRef29, useState as useState50 } from "react";
|
|
@@ -12869,7 +12960,7 @@ function CareerPathGame({
|
|
|
12869
12960
|
}
|
|
12870
12961
|
|
|
12871
12962
|
// src/components/games/BeatTheGridGame.tsx
|
|
12872
|
-
import React, { useEffect as
|
|
12963
|
+
import React, { useEffect as useEffect37, useId as useId5, useRef as useRef30, useState as useState55 } from "react";
|
|
12873
12964
|
|
|
12874
12965
|
// src/components/games/ui/OptionList.tsx
|
|
12875
12966
|
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
@@ -12961,7 +13052,7 @@ function SearchSheet({
|
|
|
12961
13052
|
const [query, setQuery] = useState55("");
|
|
12962
13053
|
const inputId = useId5();
|
|
12963
13054
|
const inputRef = useRef30(null);
|
|
12964
|
-
|
|
13055
|
+
useEffect37(() => {
|
|
12965
13056
|
inputRef.current?.focus();
|
|
12966
13057
|
}, [row, col]);
|
|
12967
13058
|
const filtered = playerPool.filter(
|
|
@@ -14265,7 +14356,7 @@ function GameScreenHost({
|
|
|
14265
14356
|
}) {
|
|
14266
14357
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
14267
14358
|
const [configJson, setConfigJson] = useState61(null);
|
|
14268
|
-
|
|
14359
|
+
useEffect38(() => {
|
|
14269
14360
|
setConfigJson(null);
|
|
14270
14361
|
if (!conversation) return;
|
|
14271
14362
|
let cancelled = false;
|
|
@@ -14288,12 +14379,12 @@ function GameScreenHost({
|
|
|
14288
14379
|
fixtureId: fixtureId || void 0,
|
|
14289
14380
|
locale: ui.games.lang
|
|
14290
14381
|
});
|
|
14291
|
-
|
|
14382
|
+
useEffect38(() => {
|
|
14292
14383
|
if (conversation) hydrate();
|
|
14293
14384
|
}, [conversation, gameId]);
|
|
14294
14385
|
const hydrateRef = useRef31(hydrate);
|
|
14295
14386
|
hydrateRef.current = hydrate;
|
|
14296
|
-
|
|
14387
|
+
useEffect38(() => {
|
|
14297
14388
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
14298
14389
|
if (rawStatus !== "pending") return;
|
|
14299
14390
|
const timerId = setInterval(() => {
|
|
@@ -14596,7 +14687,7 @@ function GamesPanel({
|
|
|
14596
14687
|
}) {
|
|
14597
14688
|
const [selected, setSelected] = useState63(null);
|
|
14598
14689
|
const [segment, setSegment] = useState63("play");
|
|
14599
|
-
|
|
14690
|
+
useEffect39(() => {
|
|
14600
14691
|
ensureGamesFonts();
|
|
14601
14692
|
}, []);
|
|
14602
14693
|
if (!loggedIn) return /* @__PURE__ */ jsx120(GamesLoginWall, { ui });
|
|
@@ -14660,10 +14751,10 @@ function GamesPanel({
|
|
|
14660
14751
|
}
|
|
14661
14752
|
|
|
14662
14753
|
// src/components/FavouritesPanel.tsx
|
|
14663
|
-
import { useEffect as
|
|
14754
|
+
import { useEffect as useEffect42, useRef as useRef33, useState as useState66 } from "react";
|
|
14664
14755
|
|
|
14665
14756
|
// src/components/FavouriteChips.tsx
|
|
14666
|
-
import { useEffect as
|
|
14757
|
+
import { useEffect as useEffect40, useState as useState64 } from "react";
|
|
14667
14758
|
import { Fragment as Fragment35, jsx as jsx121, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
14668
14759
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
14669
14760
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -14711,10 +14802,10 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
14711
14802
|
function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
14712
14803
|
const [confirming, setConfirming] = useState64(false);
|
|
14713
14804
|
const data = controller.data;
|
|
14714
|
-
|
|
14805
|
+
useEffect40(() => {
|
|
14715
14806
|
setConfirming(false);
|
|
14716
14807
|
}, [sport]);
|
|
14717
|
-
|
|
14808
|
+
useEffect40(() => {
|
|
14718
14809
|
if (!confirming) return;
|
|
14719
14810
|
const onPointerDown = (e) => {
|
|
14720
14811
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -14768,7 +14859,7 @@ function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
|
14768
14859
|
}
|
|
14769
14860
|
|
|
14770
14861
|
// src/components/FavouritesSearch.tsx
|
|
14771
|
-
import { useEffect as
|
|
14862
|
+
import { useEffect as useEffect41, useRef as useRef32, useState as useState65 } from "react";
|
|
14772
14863
|
import { jsx as jsx122, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
14773
14864
|
var MIN_LETTERS = 2;
|
|
14774
14865
|
var MAX_LENGTH = 64;
|
|
@@ -14782,7 +14873,7 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
14782
14873
|
const queryKey = `${sport}|${trimmed}`;
|
|
14783
14874
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
14784
14875
|
const settled = answer?.key === queryKey;
|
|
14785
|
-
|
|
14876
|
+
useEffect41(() => {
|
|
14786
14877
|
setAnswer(null);
|
|
14787
14878
|
if (trimmed.length < MIN_LETTERS) return;
|
|
14788
14879
|
let cancelled = false;
|
|
@@ -14850,10 +14941,10 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
14850
14941
|
const [notice, setNotice] = useState66(null);
|
|
14851
14942
|
const refreshRef = useRef33(controller.refresh);
|
|
14852
14943
|
refreshRef.current = controller.refresh;
|
|
14853
|
-
|
|
14944
|
+
useEffect42(() => {
|
|
14854
14945
|
void refreshRef.current();
|
|
14855
14946
|
}, []);
|
|
14856
|
-
|
|
14947
|
+
useEffect42(() => {
|
|
14857
14948
|
setNotice(null);
|
|
14858
14949
|
}, [sport]);
|
|
14859
14950
|
const sportLabel = sports.find((s) => s.sport === sport)?.label ?? capitalised(sport);
|
|
@@ -14880,7 +14971,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
14880
14971
|
}
|
|
14881
14972
|
|
|
14882
14973
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
14883
|
-
import { useEffect as
|
|
14974
|
+
import { useEffect as useEffect43, useRef as useRef34, useState as useState67 } from "react";
|
|
14884
14975
|
import { Fragment as Fragment36, jsx as jsx124, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
14885
14976
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
14886
14977
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -14937,7 +15028,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
14937
15028
|
const [first] = useState67(() => requestFor(view));
|
|
14938
15029
|
const { grid, status, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: first });
|
|
14939
15030
|
const lastRequest = useRef34(first);
|
|
14940
|
-
|
|
15031
|
+
useEffect43(() => {
|
|
14941
15032
|
void request(lastRequest.current);
|
|
14942
15033
|
}, [request]);
|
|
14943
15034
|
const send = (req) => {
|
|
@@ -14972,12 +15063,12 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
14972
15063
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
14973
15064
|
const [startedNote, setStartedNote] = useState67(false);
|
|
14974
15065
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
14975
|
-
|
|
15066
|
+
useEffect43(() => {
|
|
14976
15067
|
if (startedNote && status === "ready" && !anyStarted) setStartedNote(false);
|
|
14977
15068
|
}, [startedNote, status, anyStarted]);
|
|
14978
15069
|
const market = rows?.[0]?.market;
|
|
14979
15070
|
const [seen, setSeen] = useState67(null);
|
|
14980
|
-
|
|
15071
|
+
useEffect43(() => {
|
|
14981
15072
|
if (market) setSeen(market);
|
|
14982
15073
|
}, [market]);
|
|
14983
15074
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
|
|
@@ -14990,14 +15081,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
14990
15081
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
14991
15082
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
14992
15083
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
14993
|
-
|
|
15084
|
+
useEffect43(() => {
|
|
14994
15085
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
14995
15086
|
autoWidened.current = true;
|
|
14996
15087
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
14997
15088
|
commit(next, true);
|
|
14998
15089
|
send(requestFor(next));
|
|
14999
15090
|
}, [empty2, singles, widened, canWiden, view]);
|
|
15000
|
-
|
|
15091
|
+
useEffect43(() => {
|
|
15001
15092
|
if (coolOff) onCoolOff?.();
|
|
15002
15093
|
}, [coolOff, onCoolOff]);
|
|
15003
15094
|
if (coolOff) return null;
|
|
@@ -15657,16 +15748,16 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
15657
15748
|
}
|
|
15658
15749
|
|
|
15659
15750
|
// src/components/PresetTools.tsx
|
|
15660
|
-
import { useEffect as
|
|
15751
|
+
import { useEffect as useEffect44, useId as useId10, useRef as useRef35, useState as useState70 } from "react";
|
|
15661
15752
|
import { Fragment as Fragment39, jsx as jsx134, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
15662
15753
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
15663
15754
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
15664
15755
|
const dialogRef = useRef35(null);
|
|
15665
15756
|
const titleId = useId10();
|
|
15666
|
-
|
|
15757
|
+
useEffect44(() => {
|
|
15667
15758
|
dialogRef.current?.focus({ preventScroll: true });
|
|
15668
15759
|
}, []);
|
|
15669
|
-
|
|
15760
|
+
useEffect44(() => {
|
|
15670
15761
|
const onKey = (e) => {
|
|
15671
15762
|
if (e.key !== "Escape") return;
|
|
15672
15763
|
e.stopPropagation();
|
|
@@ -15818,7 +15909,7 @@ import { Fragment as Fragment40, jsx as jsx136, jsxs as jsxs120 } from "react/js
|
|
|
15818
15909
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
15819
15910
|
function useIsModal() {
|
|
15820
15911
|
const [modal, setModal] = useState71(false);
|
|
15821
|
-
|
|
15912
|
+
useEffect45(() => {
|
|
15822
15913
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
15823
15914
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
15824
15915
|
const sync = () => setModal(mql.matches);
|
|
@@ -15860,16 +15951,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15860
15951
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
15861
15952
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
15862
15953
|
const activeTab = tabs?.activeTab;
|
|
15863
|
-
|
|
15954
|
+
useEffect45(() => {
|
|
15864
15955
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
15865
15956
|
setSelectedPlayerId(null);
|
|
15866
15957
|
clearPlayerDetail?.();
|
|
15867
15958
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
15868
|
-
|
|
15959
|
+
useEffect45(() => {
|
|
15869
15960
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
15870
15961
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
15871
15962
|
const storedTab = tabState?.activeTab;
|
|
15872
|
-
|
|
15963
|
+
useEffect45(() => {
|
|
15873
15964
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
15874
15965
|
if (unreachable) setMonitorTab?.("chat");
|
|
15875
15966
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -15882,7 +15973,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15882
15973
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
15883
15974
|
close();
|
|
15884
15975
|
}, [track, closeTab, answering, close]);
|
|
15885
|
-
|
|
15976
|
+
useEffect45(() => {
|
|
15886
15977
|
const onKey = (e) => {
|
|
15887
15978
|
if (e.key === "Escape") closeWith("escape");
|
|
15888
15979
|
};
|
|
@@ -15898,7 +15989,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15898
15989
|
tabs?.setActiveTab("chat");
|
|
15899
15990
|
send(text, { grounding, source: "live_fact" });
|
|
15900
15991
|
};
|
|
15901
|
-
|
|
15992
|
+
useEffect45(() => {
|
|
15902
15993
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
15903
15994
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
15904
15995
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
@@ -15920,10 +16011,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15920
16011
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
15921
16012
|
}, []);
|
|
15922
16013
|
const paused = isPaused(state.limit);
|
|
15923
|
-
|
|
16014
|
+
useEffect45(() => {
|
|
15924
16015
|
if (paused) setTool(null);
|
|
15925
16016
|
}, [paused]);
|
|
15926
|
-
|
|
16017
|
+
useEffect45(() => {
|
|
15927
16018
|
if (!paused) return;
|
|
15928
16019
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
15929
16020
|
typedSendRef.current = false;
|
|
@@ -15949,13 +16040,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15949
16040
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
15950
16041
|
return `${k.dayLabel} ${k.time}`;
|
|
15951
16042
|
}, [ui]);
|
|
15952
|
-
|
|
16043
|
+
useEffect45(() => {
|
|
15953
16044
|
if (tool) return;
|
|
15954
16045
|
const target = focusAfterCloseRef.current;
|
|
15955
16046
|
focusAfterCloseRef.current = null;
|
|
15956
16047
|
if (target === "composer") inputRef.current?.focus();
|
|
15957
16048
|
}, [tool]);
|
|
15958
|
-
|
|
16049
|
+
useEffect45(() => {
|
|
15959
16050
|
if (!tool || onChatTab && presetGrid) return;
|
|
15960
16051
|
focusAfterCloseRef.current = "composer";
|
|
15961
16052
|
setTool(null);
|
|
@@ -17918,6 +18009,25 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17918
18009
|
.ss-w-props-ref { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ss-w-ink); }
|
|
17919
18010
|
.ss-w-props-ref-lab { position: absolute; right: 0; top: -7px; width: 28px; text-align: right; line-height: 13px; border-radius: 3px; background: var(--ss-w-bubble); font-size: 9.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
17920
18011
|
.ss-w-props-opps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-right: 32px; text-align: center; font-size: 10px; color: var(--ss-w-faint); }
|
|
18012
|
+
/* Live stats on NBA props (u620): box clock, stat chips with a value, a hatched live bar. */
|
|
18013
|
+
.ss-w-props-headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
|
|
18014
|
+
.ss-w-props-asof { font-size: 10.5px; font-weight: 600; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; text-align: right; }
|
|
18015
|
+
.ss-w-props-asof--live, .ss-w-props-pf--warn { color: var(--ss-w-warn); }
|
|
18016
|
+
.ss-w-props-main--live { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; gap: 2px; max-width: none; }
|
|
18017
|
+
.ss-w-props-nowline { display: flex; align-items: baseline; gap: 4px; }
|
|
18018
|
+
.ss-w-props-now { font-size: 12.5px; font-weight: 800; color: var(--ss-w-ink); }
|
|
18019
|
+
.ss-w-props-main--live .ss-w-props-line { font-weight: 600; color: var(--ss-w-faint); }
|
|
18020
|
+
.ss-w-props-chips--live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
|
|
18021
|
+
.ss-w-props-chips--live .ss-w-props-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 44px; padding: 6px 4px; border-radius: 10px; font-size: 11px; white-space: normal; text-align: center; }
|
|
18022
|
+
.ss-w-props-chips--live .ss-w-props-chip b { font-size: 15px; font-weight: 800; color: var(--ss-w-ink); font-variant-numeric: tabular-nums; }
|
|
18023
|
+
.ss-w-props-chips--live .ss-w-props-chip i { font-style: normal; font-size: 10px; font-weight: 500; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; }
|
|
18024
|
+
.ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] b, .ss-w-props-chips--live .ss-w-props-chip[aria-pressed="true"] i { color: #fff; }
|
|
18025
|
+
.ss-w-props-l5-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 8px; row-gap: 2px; min-width: 0; }
|
|
18026
|
+
.ss-w-props-l5-note { font-size: 11px; color: var(--ss-w-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
18027
|
+
.ss-w-props-bars--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18028
|
+
.ss-w-props-opps--live { grid-template-columns: repeat(var(--ss-bars, 6), minmax(0, 1fr)); gap: 5px; }
|
|
18029
|
+
.ss-w-props-opps b { font-weight: 700; color: var(--ss-w-ink); }
|
|
18030
|
+
.ss-w-props-bar--live { background: repeating-linear-gradient(135deg, var(--ss-w-ink) 0 3px, var(--ss-w-faint) 3px 6px); }
|
|
17921
18031
|
/* NFL props (u605): three tabs, ten-game bars coloured by the line, and the fact and scorer grids. */
|
|
17922
18032
|
.ss-w-props-trends { margin-bottom: 8px; }
|
|
17923
18033
|
.ss-w-props-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
@@ -18665,11 +18775,11 @@ function StatsWidget(props) {
|
|
|
18665
18775
|
pinnedMatchIds
|
|
18666
18776
|
});
|
|
18667
18777
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
18668
|
-
|
|
18778
|
+
useEffect46(() => {
|
|
18669
18779
|
setHasToday(todayHasContent);
|
|
18670
18780
|
}, [todayHasContent]);
|
|
18671
18781
|
const prevLiveSnapshotRef = useRef37(monitor.snapshot);
|
|
18672
|
-
|
|
18782
|
+
useEffect46(() => {
|
|
18673
18783
|
const snap = monitor.snapshot;
|
|
18674
18784
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
18675
18785
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -18760,7 +18870,7 @@ function StatsWidget(props) {
|
|
|
18760
18870
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
18761
18871
|
const markTodayActivity = monitor.markTodayActivity;
|
|
18762
18872
|
const prevLiveCountRef = useRef37(0);
|
|
18763
|
-
|
|
18873
|
+
useEffect46(() => {
|
|
18764
18874
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
18765
18875
|
prevLiveCountRef.current = discovery.liveCount;
|
|
18766
18876
|
if (rose) markTodayActivity();
|
|
@@ -18813,7 +18923,7 @@ function StatsWidget(props) {
|
|
|
18813
18923
|
const onControlRef = useRef37(props.onControl);
|
|
18814
18924
|
onControlRef.current = props.onControl;
|
|
18815
18925
|
const { open: openPanel, close: closePanel } = controller;
|
|
18816
|
-
|
|
18926
|
+
useEffect46(() => {
|
|
18817
18927
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
18818
18928
|
return () => onControlRef.current?.(null);
|
|
18819
18929
|
}, [openPanel, closePanel]);
|
|
@@ -18830,11 +18940,11 @@ function StatsWidget(props) {
|
|
|
18830
18940
|
page: cfg?.page
|
|
18831
18941
|
}
|
|
18832
18942
|
};
|
|
18833
|
-
|
|
18943
|
+
useEffect46(() => {
|
|
18834
18944
|
if (!logger) return;
|
|
18835
18945
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
18836
18946
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
18837
|
-
|
|
18947
|
+
useEffect46(() => {
|
|
18838
18948
|
if (!logger) return;
|
|
18839
18949
|
logger.resume();
|
|
18840
18950
|
const onHide = () => {
|
|
@@ -18852,7 +18962,7 @@ function StatsWidget(props) {
|
|
|
18852
18962
|
logger.dispose();
|
|
18853
18963
|
};
|
|
18854
18964
|
}, [logger]);
|
|
18855
|
-
|
|
18965
|
+
useEffect46(() => {
|
|
18856
18966
|
if (!built || !ui.injectStyles) return;
|
|
18857
18967
|
const node = rootRef.current?.getRootNode();
|
|
18858
18968
|
if (node) injectStyles(node);
|