@sensiblestats/widget-react 0.153.0 → 0.153.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +607 -570
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +327 -290
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,8 +38,8 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/StatsWidget.tsx
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_react123 = require("react");
|
|
42
|
+
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
45
45
|
function familyOf(tag2) {
|
|
@@ -1417,7 +1417,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
|
|
1419
1419
|
// src/version.generated.ts
|
|
1420
|
-
var WIDGET_REACT_VERSION = "0.153.
|
|
1420
|
+
var WIDGET_REACT_VERSION = "0.153.1";
|
|
1421
1421
|
|
|
1422
1422
|
// src/config.ts
|
|
1423
1423
|
function hostTag(cfg) {
|
|
@@ -2670,6 +2670,10 @@ function slipKey(ref) {
|
|
|
2670
2670
|
function sameLeg(a, b) {
|
|
2671
2671
|
return a.matchOddsId === b.matchOddsId && (0, import_widget_sdk2.sportOf)(a.sport) === (0, import_widget_sdk2.sportOf)(b.sport);
|
|
2672
2672
|
}
|
|
2673
|
+
function slipSportOfWire(sport) {
|
|
2674
|
+
const hit = Object.entries(import_widget_sdk2.SPORTS).find(([, spec]) => spec.wireKey === sport);
|
|
2675
|
+
return hit ? hit[0] : void 0;
|
|
2676
|
+
}
|
|
2673
2677
|
|
|
2674
2678
|
// src/monitorMatch.ts
|
|
2675
2679
|
var import_widget_sdk3 = require("@sensiblestats/widget-sdk");
|
|
@@ -5795,7 +5799,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5795
5799
|
}
|
|
5796
5800
|
|
|
5797
5801
|
// src/components/dashboard/GreetingDashboard.tsx
|
|
5798
|
-
var
|
|
5802
|
+
var import_react51 = require("react");
|
|
5799
5803
|
|
|
5800
5804
|
// src/eventLogContext.ts
|
|
5801
5805
|
var import_react18 = require("react");
|
|
@@ -6053,7 +6057,7 @@ function SportSwitch({ sports, selected, onSelect, liveLabel: liveLabel3, groupL
|
|
|
6053
6057
|
}
|
|
6054
6058
|
|
|
6055
6059
|
// src/components/dashboard/v2/MarketFirstGreeting.tsx
|
|
6056
|
-
var
|
|
6060
|
+
var import_react36 = require("react");
|
|
6057
6061
|
|
|
6058
6062
|
// src/useFeaturedHighlight.ts
|
|
6059
6063
|
var import_react22 = require("react");
|
|
@@ -6114,7 +6118,7 @@ function SinceLines({ since, ui }) {
|
|
|
6114
6118
|
}
|
|
6115
6119
|
|
|
6116
6120
|
// src/components/dashboard/v2/FeaturedCard.tsx
|
|
6117
|
-
var
|
|
6121
|
+
var import_react31 = require("react");
|
|
6118
6122
|
|
|
6119
6123
|
// src/components/PinToggle.tsx
|
|
6120
6124
|
var import_react26 = require("react");
|
|
@@ -6235,10 +6239,30 @@ function MarketMenu({ markets, current, label, onPick }) {
|
|
|
6235
6239
|
}
|
|
6236
6240
|
|
|
6237
6241
|
// src/components/dashboard/v2/MarketRows.tsx
|
|
6238
|
-
var
|
|
6242
|
+
var import_react30 = require("react");
|
|
6239
6243
|
|
|
6240
6244
|
// src/components/dashboard/v2/Price.tsx
|
|
6245
|
+
var import_react29 = require("react");
|
|
6246
|
+
|
|
6247
|
+
// src/slipSettled.ts
|
|
6248
|
+
var import_react28 = require("react");
|
|
6249
|
+
|
|
6250
|
+
// src/slipStateContext.ts
|
|
6241
6251
|
var import_react27 = require("react");
|
|
6252
|
+
var SlipStateContext = (0, import_react27.createContext)(null);
|
|
6253
|
+
function useSlipState() {
|
|
6254
|
+
return (0, import_react27.useContext)(SlipStateContext);
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
// src/slipSettled.ts
|
|
6258
|
+
function useSettledMarks() {
|
|
6259
|
+
const slipState = useSlipState();
|
|
6260
|
+
const [local, setLocal] = (0, import_react28.useState)({});
|
|
6261
|
+
const localSettle = (0, import_react28.useCallback)((key) => setLocal((prev) => prev[key] ? prev : { ...prev, [key]: true }), []);
|
|
6262
|
+
return slipState ? { isSettled: (key) => !!slipState.settled[key], settle: slipState.settle } : { isSettled: (key) => !!local[key], settle: localSettle };
|
|
6263
|
+
}
|
|
6264
|
+
|
|
6265
|
+
// src/components/dashboard/v2/Price.tsx
|
|
6242
6266
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6243
6267
|
function logRowTap(events, slot) {
|
|
6244
6268
|
return (e) => {
|
|
@@ -6246,21 +6270,29 @@ function logRowTap(events, slot) {
|
|
|
6246
6270
|
events?.cardTap(slot);
|
|
6247
6271
|
};
|
|
6248
6272
|
}
|
|
6273
|
+
function DonePill({ text: text2 }) {
|
|
6274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ss-w-pill ss-w-pill--done", children: [
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M5 12.5l4.5 4.5L19 7.5" }) }),
|
|
6276
|
+
text2
|
|
6277
|
+
] });
|
|
6278
|
+
}
|
|
6249
6279
|
function Pill({ price }) {
|
|
6250
6280
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ss-w-pill", children: [
|
|
6251
6281
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 5v14M5 12h14" }) }),
|
|
6252
6282
|
price
|
|
6253
6283
|
] });
|
|
6254
6284
|
}
|
|
6255
|
-
function PriceButtons({ selections, ui, onAdd, rowLabel }) {
|
|
6285
|
+
function PriceButtons({ selections, ui, onAdd, rowLabel, sport }) {
|
|
6256
6286
|
const { oddsFormat } = useOddsSettings();
|
|
6257
|
-
const
|
|
6258
|
-
const
|
|
6259
|
-
const [
|
|
6260
|
-
const
|
|
6261
|
-
const
|
|
6287
|
+
const marks = useSettledMarks();
|
|
6288
|
+
const keyOf4 = (s) => slipKey({ matchOddsId: s.matchOddsId, sport: slipSportOfWire(sport) });
|
|
6289
|
+
const [busy, setBusy] = (0, import_react29.useState)(/* @__PURE__ */ new Set());
|
|
6290
|
+
const [goneFor, setGoneFor] = (0, import_react29.useState)(null);
|
|
6291
|
+
const [toast, setToast] = (0, import_react29.useState)(null);
|
|
6292
|
+
const dismiss = (0, import_react29.useCallback)(() => setToast(null), []);
|
|
6293
|
+
const inFlight2 = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
6262
6294
|
const tap = async (s) => {
|
|
6263
|
-
if (!onAdd || inFlight2.current.has(s.matchOddsId)) return;
|
|
6295
|
+
if (!onAdd || inFlight2.current.has(s.matchOddsId) || marks.isSettled(keyOf4(s))) return;
|
|
6264
6296
|
inFlight2.current.add(s.matchOddsId);
|
|
6265
6297
|
setBusy(new Set(inFlight2.current));
|
|
6266
6298
|
setGoneFor(null);
|
|
@@ -6272,6 +6304,7 @@ function PriceButtons({ selections, ui, onAdd, rowLabel }) {
|
|
|
6272
6304
|
inFlight2.current.delete(s.matchOddsId);
|
|
6273
6305
|
setBusy(new Set(inFlight2.current));
|
|
6274
6306
|
}
|
|
6307
|
+
if (result.outcome === "added") marks.settle(keyOf4(s));
|
|
6275
6308
|
if (result.outcome === "gone") setGoneFor(selections);
|
|
6276
6309
|
if (result.toast) setToast({ toast: result.toast, for: selections });
|
|
6277
6310
|
};
|
|
@@ -6279,19 +6312,22 @@ function PriceButtons({ selections, ui, onAdd, rowLabel }) {
|
|
|
6279
6312
|
const buttons = selections.map((s) => {
|
|
6280
6313
|
const label = asRow ? rowLabel ?? s.label : s.label;
|
|
6281
6314
|
const price = formatOdds(s.formats, oddsFormat);
|
|
6315
|
+
const done = marks.isSettled(keyOf4(s));
|
|
6282
6316
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6283
6317
|
"button",
|
|
6284
6318
|
{
|
|
6285
6319
|
type: "button",
|
|
6286
6320
|
className: asRow ? "ss-w-v2-row" : "ss-w-v2-tile",
|
|
6287
|
-
"aria-label": ui.v2AddLabel(label, price),
|
|
6288
|
-
|
|
6289
|
-
|
|
6321
|
+
"aria-label": done ? `${label}, ${ui.inSlip}` : ui.v2AddLabel(label, price),
|
|
6322
|
+
"data-settled": done || void 0,
|
|
6323
|
+
"aria-disabled": done || void 0,
|
|
6324
|
+
disabled: busy.has(s.matchOddsId) || done,
|
|
6325
|
+
onClick: onAdd && !done ? () => {
|
|
6290
6326
|
void tap(s);
|
|
6291
6327
|
} : void 0,
|
|
6292
6328
|
children: [
|
|
6293
6329
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }),
|
|
6294
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { price })
|
|
6330
|
+
done ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DonePill, { text: ui.inSlip }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { price })
|
|
6295
6331
|
]
|
|
6296
6332
|
},
|
|
6297
6333
|
s.matchOddsId
|
|
@@ -6308,25 +6344,25 @@ function PriceButtons({ selections, ui, onAdd, rowLabel }) {
|
|
|
6308
6344
|
// src/components/dashboard/v2/MarketRows.tsx
|
|
6309
6345
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6310
6346
|
var FACT_KEY = { GOALS_OVER_UNDER: "goals", BOTH_TEAMS_TO_SCORE: "btts", FULLTIME_RESULT: "result" };
|
|
6311
|
-
function FactRowView({ row, ui, matchId, add, lead }) {
|
|
6312
|
-
const events = (0,
|
|
6347
|
+
function FactRowView({ row, ui, matchId, add, lead, sport }) {
|
|
6348
|
+
const events = (0, import_react30.useContext)(GreetingEventsContext);
|
|
6313
6349
|
const hook = lead ? events?.hook : { kind: "fact", factKey: FACT_KEY[row.market] ?? row.market };
|
|
6314
|
-
const selections = (0,
|
|
6350
|
+
const selections = (0, import_react30.useMemo)(() => [row.selection], [row.selection]);
|
|
6315
6351
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ss-w-v2-fact", children: [
|
|
6316
6352
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: row.stat }),
|
|
6317
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PriceButtons, { selections, ui, rowLabel: row.label, onAdd: add ? (s) => add(matchId, row.market, s, hook) : void 0 })
|
|
6353
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PriceButtons, { selections, ui, rowLabel: row.label, sport, onAdd: add ? (s) => add(matchId, row.market, s, hook) : void 0 })
|
|
6318
6354
|
] });
|
|
6319
6355
|
}
|
|
6320
|
-
function FactRows({ rows, hide, ui, matchId, add, lead = false }) {
|
|
6356
|
+
function FactRows({ rows, hide, ui, matchId, add, lead = false, sport }) {
|
|
6321
6357
|
const shown2 = rows.filter((r) => r.market !== hide);
|
|
6322
6358
|
if (shown2.length === 0) return null;
|
|
6323
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: shown2.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FactRowView, { row: r, ui, matchId, add, lead }, `${r.market}:${r.selection.matchOddsId}`)) });
|
|
6359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: shown2.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FactRowView, { row: r, ui, matchId, add, lead, sport }, `${r.market}:${r.selection.matchOddsId}`)) });
|
|
6324
6360
|
}
|
|
6325
6361
|
|
|
6326
6362
|
// src/components/dashboard/v2/FeaturedCard.tsx
|
|
6327
6363
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6328
6364
|
function FeaturedCard({ card, ui, tag: tag2, sport, open, onToggleMenu, onPick, picked, highlighted = false, add }) {
|
|
6329
|
-
const events = (0,
|
|
6365
|
+
const events = (0, import_react31.useContext)(GreetingEventsContext);
|
|
6330
6366
|
const monitor = usePersonalGreeting()?.monitor;
|
|
6331
6367
|
const title = card.title ?? ui.v2GameTitle(card.home.label, card.away.label, sport);
|
|
6332
6368
|
const meta = [instantMs(card.startsAtUtc) === null ? null : ui.v2KickoffLine(card.startsAtUtc), card.competition].filter(Boolean).join(" \xB7 ");
|
|
@@ -6346,7 +6382,7 @@ function FeaturedCard({ card, ui, tag: tag2, sport, open, onToggleMenu, onPick,
|
|
|
6346
6382
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PinToggle, { ui, monitor, market: card.market, pin: { kind: "match", matchId: Number(card.matchId), ...sport === "nba" ? { sport: "basketball" } : {} } })
|
|
6347
6383
|
] }),
|
|
6348
6384
|
meta ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "ss-w-v2-meta", children: meta }) : null,
|
|
6349
|
-
card.hook ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FactRows, { rows: [card.hook], hide: picked, ui, matchId: card.matchId, add, lead: true }) : null,
|
|
6385
|
+
card.hook ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FactRows, { rows: [card.hook], hide: picked, ui, matchId: card.matchId, add, lead: true, sport }) : null,
|
|
6350
6386
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "ss-w-v2-head", children: [
|
|
6351
6387
|
markets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "ss-w-v2-mkt", "aria-label": ui.v2ChangeMarket(card.marketLabel), "aria-expanded": open, onClick: onToggleMenu, children: [
|
|
6352
6388
|
card.marketLabel,
|
|
@@ -6355,20 +6391,20 @@ function FeaturedCard({ card, ui, tag: tag2, sport, open, onToggleMenu, onPick,
|
|
|
6355
6391
|
card.yourMarket ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ss-w-v2-tag", children: tag2 }) : null
|
|
6356
6392
|
] }),
|
|
6357
6393
|
open ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarketMenu, { markets, current: card.market, label: ui.v2ChangeMarket(card.marketLabel), onPick }) : null,
|
|
6358
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PriceButtons, { selections: card.selections, ui, onAdd: add ? (s) => add(card.matchId, card.market, s, events?.hook) : void 0 }),
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PriceButtons, { selections: card.selections, ui, sport, onAdd: add ? (s) => add(card.matchId, card.market, s, events?.hook) : void 0 }),
|
|
6359
6395
|
add ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "ss-w-v2-hint", children: ui.v2PriceHint }) : null,
|
|
6360
6396
|
card.stat ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "ss-w-v2-stat", children: card.stat }) : null,
|
|
6361
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FactRows, { rows: card.facts ?? [], hide: picked, ui, matchId: card.matchId, add })
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FactRows, { rows: card.facts ?? [], hide: picked, ui, matchId: card.matchId, add, sport })
|
|
6362
6398
|
]
|
|
6363
6399
|
}
|
|
6364
6400
|
);
|
|
6365
6401
|
}
|
|
6366
6402
|
|
|
6367
6403
|
// src/components/dashboard/v2/useRepriceAdd.ts
|
|
6368
|
-
var
|
|
6404
|
+
var import_react35 = require("react");
|
|
6369
6405
|
|
|
6370
6406
|
// src/nflKickoff.ts
|
|
6371
|
-
var
|
|
6407
|
+
var import_react32 = require("react");
|
|
6372
6408
|
var import_widget_sdk17 = require("@sensiblestats/widget-sdk");
|
|
6373
6409
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
6374
6410
|
var isNfl = (sport) => (0, import_widget_sdk17.sportOf)(sport) === "americanfootball";
|
|
@@ -6396,9 +6432,9 @@ function guardLegsPreMatch(slip, legs, ui) {
|
|
|
6396
6432
|
};
|
|
6397
6433
|
}
|
|
6398
6434
|
function useNextKickoffRender(kickoffs) {
|
|
6399
|
-
const [tick, setTick] = (0,
|
|
6435
|
+
const [tick, setTick] = (0, import_react32.useState)(0);
|
|
6400
6436
|
const key = kickoffs.map((k) => k ?? "").join("|");
|
|
6401
|
-
(0,
|
|
6437
|
+
(0, import_react32.useEffect)(() => {
|
|
6402
6438
|
const now = Date.now();
|
|
6403
6439
|
const upcoming = key.split("|").map((k) => k ? Date.parse(k) : NaN).filter((ms) => ms > now);
|
|
6404
6440
|
if (upcoming.length === 0) return;
|
|
@@ -6410,23 +6446,16 @@ function useNextKickoffRender(kickoffs) {
|
|
|
6410
6446
|
}
|
|
6411
6447
|
|
|
6412
6448
|
// src/slipAdd.ts
|
|
6413
|
-
var
|
|
6449
|
+
var import_react34 = require("react");
|
|
6414
6450
|
var import_widget_sdk18 = require("@sensiblestats/widget-sdk");
|
|
6415
6451
|
|
|
6416
6452
|
// src/trackingContext.ts
|
|
6417
|
-
var
|
|
6453
|
+
var import_react33 = require("react");
|
|
6418
6454
|
var noop = () => {
|
|
6419
6455
|
};
|
|
6420
|
-
var TrackingContext = (0,
|
|
6456
|
+
var TrackingContext = (0, import_react33.createContext)(noop);
|
|
6421
6457
|
function useTrack() {
|
|
6422
|
-
return (0,
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
|
-
// src/slipStateContext.ts
|
|
6426
|
-
var import_react32 = require("react");
|
|
6427
|
-
var SlipStateContext = (0, import_react32.createContext)(null);
|
|
6428
|
-
function useSlipState() {
|
|
6429
|
-
return (0, import_react32.useContext)(SlipStateContext);
|
|
6458
|
+
return (0, import_react33.useContext)(TrackingContext);
|
|
6430
6459
|
}
|
|
6431
6460
|
|
|
6432
6461
|
// src/slipAdd.ts
|
|
@@ -6458,7 +6487,7 @@ function useSlipAdd(slip, ui) {
|
|
|
6458
6487
|
const handler = slip.onAddToSlip;
|
|
6459
6488
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
6460
6489
|
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
6461
|
-
return (0,
|
|
6490
|
+
return (0, import_react34.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line, fact, hook }) => {
|
|
6462
6491
|
if (!handler) return { kind: "failed" };
|
|
6463
6492
|
const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
|
|
6464
6493
|
const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
|
|
@@ -6519,11 +6548,6 @@ function useSlipAdd(slip, ui) {
|
|
|
6519
6548
|
}
|
|
6520
6549
|
|
|
6521
6550
|
// src/components/dashboard/v8/builderLegs.ts
|
|
6522
|
-
var import_widget_sdk19 = require("@sensiblestats/widget-sdk");
|
|
6523
|
-
function slipSportOfWire(sport) {
|
|
6524
|
-
const hit = Object.entries(import_widget_sdk19.SPORTS).find(([, spec]) => spec.wireKey === sport);
|
|
6525
|
-
return hit ? hit[0] : void 0;
|
|
6526
|
-
}
|
|
6527
6551
|
function readLeg(raw, sport) {
|
|
6528
6552
|
const vm = toComboLegVM(raw);
|
|
6529
6553
|
const slipSport = slipSportOfWire(sport);
|
|
@@ -6561,8 +6585,8 @@ function useRepriceAdd({ conversation, locale, slip, ui, sport = "football" }) {
|
|
|
6561
6585
|
const operatorUserId = scope?.operatorUserId;
|
|
6562
6586
|
const anonymousUserId = scope?.anonymousUserId;
|
|
6563
6587
|
const host = slip?.onAddToSlip;
|
|
6564
|
-
const kickoffs = (0,
|
|
6565
|
-
const guarded = (0,
|
|
6588
|
+
const kickoffs = (0, import_react35.useRef)(/* @__PURE__ */ new Map());
|
|
6589
|
+
const guarded = (0, import_react35.useMemo)(() => {
|
|
6566
6590
|
if (!slip || !host) return NO_SLIP;
|
|
6567
6591
|
return {
|
|
6568
6592
|
...slip,
|
|
@@ -6571,7 +6595,7 @@ function useRepriceAdd({ conversation, locale, slip, ui, sport = "football" }) {
|
|
|
6571
6595
|
}, [slip, host, ui]);
|
|
6572
6596
|
const addToSlip = useSlipAdd(guarded, ui);
|
|
6573
6597
|
const canAdd2 = !!conversation && !!host;
|
|
6574
|
-
const add = (0,
|
|
6598
|
+
const add = (0, import_react35.useCallback)(async (matchId, market, selection, hook) => {
|
|
6575
6599
|
if (!conversation || !slip) return { outcome: "failed" };
|
|
6576
6600
|
try {
|
|
6577
6601
|
const grid = await conversation.getBuilderGrid(locale, {
|
|
@@ -6616,15 +6640,15 @@ function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
|
|
|
6616
6640
|
const personal = usePersonalGreeting();
|
|
6617
6641
|
const openTab = personal?.openTab;
|
|
6618
6642
|
const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui, sport });
|
|
6619
|
-
const [chosen, setChosen] = (0,
|
|
6620
|
-
const [open, setOpen] = (0,
|
|
6643
|
+
const [chosen, setChosen] = (0, import_react36.useState)(null);
|
|
6644
|
+
const [open, setOpen] = (0, import_react36.useState)(false);
|
|
6621
6645
|
const base = section2.coolOff ? void 0 : section2.featured;
|
|
6622
6646
|
const pickedRow = base && chosen && chosen.matchId === base.matchId ? chosen.row : null;
|
|
6623
|
-
const card = base && pickedRow ? { ...base, market: pickedRow.market, marketLabel: pickedRow.marketLabel, selections: pickedRow.selections, stat: pickedRow.stat, yourMarket:
|
|
6647
|
+
const card = base && pickedRow ? { ...base, market: pickedRow.market, marketLabel: pickedRow.marketLabel, selections: pickedRow.selections, stat: pickedRow.stat, yourMarket: pickedRow.yourMarket } : base;
|
|
6624
6648
|
const menu = base && pickedRow ? [{ market: base.market, marketLabel: base.marketLabel, yourMarket: base.yourMarket, selections: base.selections, stat: base.stat }, ...base.markets ?? []] : base?.markets ?? [];
|
|
6625
|
-
const rootRef = (0,
|
|
6626
|
-
const [pickCount, setPickCount] = (0,
|
|
6627
|
-
(0,
|
|
6649
|
+
const rootRef = (0, import_react36.useRef)(null);
|
|
6650
|
+
const [pickCount, setPickCount] = (0, import_react36.useState)(0);
|
|
6651
|
+
(0, import_react36.useEffect)(() => {
|
|
6628
6652
|
if (pickCount === 0) return;
|
|
6629
6653
|
rootRef.current?.querySelector(".ss-w-v2-featured .ss-w-v2-tile, .ss-w-v2-featured > .ss-w-v2-row, .ss-w-v2-chips button")?.focus();
|
|
6630
6654
|
}, [pickCount]);
|
|
@@ -6639,7 +6663,7 @@ function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
|
|
|
6639
6663
|
setChosen({ matchId: card.matchId, row });
|
|
6640
6664
|
log?.log({ name: "market_choose", entityType: "market", entityId: row.market });
|
|
6641
6665
|
};
|
|
6642
|
-
const request = (0,
|
|
6666
|
+
const request = (0, import_react36.useContext)(GreetingHighlightContext);
|
|
6643
6667
|
const highlighted = useFeaturedHighlight(card && request?.matchId === card.matchId ? card.matchId : null, request?.token, request?.clear);
|
|
6644
6668
|
const chips = openTab ? chipsFor(section2) : [];
|
|
6645
6669
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "ss-w-v2", ref: rootRef, children: [
|
|
@@ -6666,10 +6690,10 @@ function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
|
|
|
6666
6690
|
}
|
|
6667
6691
|
|
|
6668
6692
|
// src/components/dashboard/v8/CardLine.tsx
|
|
6669
|
-
var
|
|
6693
|
+
var import_react45 = require("react");
|
|
6670
6694
|
|
|
6671
6695
|
// src/useBuilderGrid.ts
|
|
6672
|
-
var
|
|
6696
|
+
var import_react37 = require("react");
|
|
6673
6697
|
|
|
6674
6698
|
// src/builderMemory.ts
|
|
6675
6699
|
var GRID_TTL_MS = 5 * 6e4;
|
|
@@ -6765,18 +6789,18 @@ function forget(memory3, key, flight) {
|
|
|
6765
6789
|
if (flights?.get(key) === flight) flights.delete(key);
|
|
6766
6790
|
}
|
|
6767
6791
|
function useBuilderGrid({ conversation, locale, memory: memory3, initial: initial2 }) {
|
|
6768
|
-
const [seed] = (0,
|
|
6769
|
-
const [grid, setGrid] = (0,
|
|
6770
|
-
const [status2, setStatus] = (0,
|
|
6771
|
-
const [confirmed, setConfirmed] = (0,
|
|
6772
|
-
const [answered, setAnswered] = (0,
|
|
6773
|
-
const seq = (0,
|
|
6774
|
-
const mounted = (0,
|
|
6775
|
-
const hung = (0,
|
|
6776
|
-
const waiting = (0,
|
|
6777
|
-
const memoryRef = (0,
|
|
6792
|
+
const [seed] = (0, import_react37.useState)(() => memory3 && conversation && initial2 ? memory3.cachedGrid(gridKey(locale, initial2)) : void 0);
|
|
6793
|
+
const [grid, setGrid] = (0, import_react37.useState)(seed ?? null);
|
|
6794
|
+
const [status2, setStatus] = (0, import_react37.useState)(seed ? "ready" : "idle");
|
|
6795
|
+
const [confirmed, setConfirmed] = (0, import_react37.useState)(false);
|
|
6796
|
+
const [answered, setAnswered] = (0, import_react37.useState)(seed && initial2 ? { req: initial2, locale } : null);
|
|
6797
|
+
const seq = (0, import_react37.useRef)(0);
|
|
6798
|
+
const mounted = (0, import_react37.useRef)(true);
|
|
6799
|
+
const hung = (0, import_react37.useRef)(void 0);
|
|
6800
|
+
const waiting = (0, import_react37.useRef)(null);
|
|
6801
|
+
const memoryRef = (0, import_react37.useRef)(memory3);
|
|
6778
6802
|
memoryRef.current = memory3;
|
|
6779
|
-
const stopWaiting = (0,
|
|
6803
|
+
const stopWaiting = (0, import_react37.useCallback)((release, keep) => {
|
|
6780
6804
|
window.clearTimeout(hung.current);
|
|
6781
6805
|
const w = waiting.current;
|
|
6782
6806
|
waiting.current = null;
|
|
@@ -6784,14 +6808,14 @@ function useBuilderGrid({ conversation, locale, memory: memory3, initial: initia
|
|
|
6784
6808
|
w.flight.waiters -= 1;
|
|
6785
6809
|
if (release && w.key !== keep && w.flight.waiters <= 0 && memoryRef.current) forget(memoryRef.current, w.key, w.flight);
|
|
6786
6810
|
}, []);
|
|
6787
|
-
(0,
|
|
6811
|
+
(0, import_react37.useEffect)(() => {
|
|
6788
6812
|
mounted.current = true;
|
|
6789
6813
|
return () => {
|
|
6790
6814
|
mounted.current = false;
|
|
6791
6815
|
stopWaiting(true);
|
|
6792
6816
|
};
|
|
6793
6817
|
}, [stopWaiting]);
|
|
6794
|
-
const request = (0,
|
|
6818
|
+
const request = (0, import_react37.useCallback)(async (req) => {
|
|
6795
6819
|
if (!conversation) return;
|
|
6796
6820
|
const mine = ++seq.current;
|
|
6797
6821
|
const key = memory3 ? gridKey(locale, req) : null;
|
|
@@ -6867,13 +6891,13 @@ function useBuilderGrid({ conversation, locale, memory: memory3, initial: initia
|
|
|
6867
6891
|
}
|
|
6868
6892
|
|
|
6869
6893
|
// src/components/AddToSlipButton.tsx
|
|
6870
|
-
var
|
|
6894
|
+
var import_react38 = require("react");
|
|
6871
6895
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6872
6896
|
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
|
|
6873
|
-
const [pending, setPending] = (0,
|
|
6874
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
6875
|
-
const [toast, setToast] = (0,
|
|
6876
|
-
const dismiss = (0,
|
|
6897
|
+
const [pending, setPending] = (0, import_react38.useState)(false);
|
|
6898
|
+
const [settledLocal, setSettledLocal] = (0, import_react38.useState)(false);
|
|
6899
|
+
const [toast, setToast] = (0, import_react38.useState)(null);
|
|
6900
|
+
const dismiss = (0, import_react38.useCallback)(() => setToast(null), []);
|
|
6877
6901
|
const add = useSlipAdd(slip, ui);
|
|
6878
6902
|
const slipState = useSlipState();
|
|
6879
6903
|
const { oddsFormat } = useOddsSettings();
|
|
@@ -6901,6 +6925,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
|
|
|
6901
6925
|
type: "button",
|
|
6902
6926
|
className: "ss-w-slip-btn ss-w-slip-btn--price",
|
|
6903
6927
|
"data-settled": settled || void 0,
|
|
6928
|
+
"aria-disabled": settled || void 0,
|
|
6904
6929
|
"aria-label": `${price.ariaLabel}, ${settled ? ui.inSlip : ui.addToSlip}`,
|
|
6905
6930
|
disabled: pending || settled || hold,
|
|
6906
6931
|
onClick,
|
|
@@ -6943,8 +6968,8 @@ function AddToSlipButton({ it, slip, ui }) {
|
|
|
6943
6968
|
}
|
|
6944
6969
|
|
|
6945
6970
|
// src/components/MarketOddsCardList.tsx
|
|
6946
|
-
var
|
|
6947
|
-
var
|
|
6971
|
+
var import_react44 = require("react");
|
|
6972
|
+
var import_widget_sdk21 = require("@sensiblestats/widget-sdk");
|
|
6948
6973
|
|
|
6949
6974
|
// src/components/OddsMovementBadge.tsx
|
|
6950
6975
|
var import_jsx_runtime14 = (
|
|
@@ -6971,14 +6996,14 @@ function OddsMovementBadge({
|
|
|
6971
6996
|
}
|
|
6972
6997
|
|
|
6973
6998
|
// src/components/Crest.tsx
|
|
6974
|
-
var
|
|
6999
|
+
var import_react39 = require("react");
|
|
6975
7000
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
6976
7001
|
function initials(name) {
|
|
6977
7002
|
return (name ?? "").trim().slice(0, 1).toUpperCase() || "?";
|
|
6978
7003
|
}
|
|
6979
7004
|
function Crest({ url, name, kind, abbr }) {
|
|
6980
7005
|
const cls = kind === "comp" ? "ss-w-bi-comp-logo" : kind === "player" ? "ss-w-bi-crest ss-w-bi-crest--player" : "ss-w-bi-crest";
|
|
6981
|
-
const [failed, setFailed] = (0,
|
|
7006
|
+
const [failed, setFailed] = (0, import_react39.useState)(false);
|
|
6982
7007
|
if (url && !failed) {
|
|
6983
7008
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
6984
7009
|
}
|
|
@@ -6987,11 +7012,11 @@ function Crest({ url, name, kind, abbr }) {
|
|
|
6987
7012
|
}
|
|
6988
7013
|
|
|
6989
7014
|
// src/components/PriceHistoryButton.tsx
|
|
6990
|
-
var
|
|
7015
|
+
var import_react40 = require("react");
|
|
6991
7016
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
6992
7017
|
function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
6993
|
-
const [toast, setToast] = (0,
|
|
6994
|
-
const dismiss = (0,
|
|
7018
|
+
const [toast, setToast] = (0, import_react40.useState)(null);
|
|
7019
|
+
const dismiss = (0, import_react40.useCallback)(() => setToast(null), []);
|
|
6995
7020
|
const log = useEventLog();
|
|
6996
7021
|
if (!monitor || !monitor.enabled) return null;
|
|
6997
7022
|
const name = displayLabel ?? joinSelection(selection.selectionLabel ?? void 0, selection.line ?? void 0);
|
|
@@ -7018,20 +7043,20 @@ function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
|
7018
7043
|
}
|
|
7019
7044
|
|
|
7020
7045
|
// src/components/LiveFactBlock.tsx
|
|
7021
|
-
var
|
|
7022
|
-
var
|
|
7046
|
+
var import_react42 = require("react");
|
|
7047
|
+
var import_widget_sdk19 = require("@sensiblestats/widget-sdk");
|
|
7023
7048
|
|
|
7024
7049
|
// src/useFactView.ts
|
|
7025
|
-
var
|
|
7050
|
+
var import_react41 = require("react");
|
|
7026
7051
|
var DWELL_MS = 1e3;
|
|
7027
7052
|
var seen = /* @__PURE__ */ new Set();
|
|
7028
7053
|
function useFactView(ref, fact, entity2) {
|
|
7029
7054
|
const log = useEventLog();
|
|
7030
|
-
const entityRef = (0,
|
|
7055
|
+
const entityRef = (0, import_react41.useRef)(entity2);
|
|
7031
7056
|
entityRef.current = entity2;
|
|
7032
7057
|
const id = fact?.id;
|
|
7033
7058
|
const factKey = fact?.factKey;
|
|
7034
|
-
(0,
|
|
7059
|
+
(0, import_react41.useEffect)(() => {
|
|
7035
7060
|
if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
|
|
7036
7061
|
const el = ref.current;
|
|
7037
7062
|
if (!el) return;
|
|
@@ -7079,18 +7104,18 @@ function evidenceText(f, ui) {
|
|
|
7079
7104
|
return parts2.length > 0 ? parts2.join(" \xB7 ") : void 0;
|
|
7080
7105
|
}
|
|
7081
7106
|
function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
7082
|
-
const [expanded, setExpanded] = (0,
|
|
7107
|
+
const [expanded, setExpanded] = (0, import_react42.useState)(false);
|
|
7083
7108
|
const { oddsFormat } = useOddsSettings();
|
|
7084
7109
|
const log = useEventLog();
|
|
7085
|
-
const sectionRef = (0,
|
|
7110
|
+
const sectionRef = (0, import_react42.useRef)(null);
|
|
7086
7111
|
const current = facts.find((f) => f.marketState);
|
|
7087
7112
|
const earlier = facts.filter((f) => f.marketState && f !== current);
|
|
7088
7113
|
const background = facts.filter((f) => !f.marketState).slice(0, BACKGROUND_MAX);
|
|
7089
7114
|
const m = current?.market;
|
|
7090
7115
|
const sport = scope?.sport;
|
|
7091
|
-
const wire = (0,
|
|
7116
|
+
const wire = (0, import_widget_sdk19.toWireSport)(sport);
|
|
7092
7117
|
const sportFields = wire ? { sport: wire, ...scope?.tour ? { tour: scope.tour } : {} } : {};
|
|
7093
|
-
const entity2 = current?.marketState && m ? { entityType: "market", entityId: (0,
|
|
7118
|
+
const entity2 = current?.marketState && m ? { entityType: "market", entityId: (0, import_widget_sdk19.qualifiedId)(sport, "market", m.marketDeveloperName), ...sportFields } : { entityType: "match", entityId: (0, import_widget_sdk19.qualifiedId)(sport, "game", (0, import_widget_sdk19.localIdOf)(sport, match.matchId, scope?.tour)), ...sportFields };
|
|
7094
7119
|
useFactView(sectionRef, current, entity2);
|
|
7095
7120
|
if (facts.length === 0) return null;
|
|
7096
7121
|
const open = current?.marketState === "open" && !!m && !m.isSuspended;
|
|
@@ -7170,17 +7195,17 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7170
7195
|
}
|
|
7171
7196
|
|
|
7172
7197
|
// src/components/AllMarketsButton.tsx
|
|
7173
|
-
var
|
|
7174
|
-
var
|
|
7198
|
+
var import_react43 = require("react");
|
|
7199
|
+
var import_widget_sdk20 = require("@sensiblestats/widget-sdk");
|
|
7175
7200
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7176
7201
|
function allMarketsCount(vm, monitor) {
|
|
7177
|
-
if (!monitor?.enabled || !vm.pinEnabled || (0,
|
|
7202
|
+
if (!monitor?.enabled || !vm.pinEnabled || (0, import_widget_sdk20.sportOf)(vm.sport) !== void 0) return null;
|
|
7178
7203
|
return vm.marketCount !== void 0 && vm.marketCount >= 2 ? vm.marketCount : null;
|
|
7179
7204
|
}
|
|
7180
7205
|
function AllMarketsButton({ vm, count: count2, monitor, ui, surface }) {
|
|
7181
7206
|
const log = useEventLog();
|
|
7182
|
-
const [toast, setToast] = (0,
|
|
7183
|
-
const dismiss = (0,
|
|
7207
|
+
const [toast, setToast] = (0, import_react43.useState)(null);
|
|
7208
|
+
const dismiss = (0, import_react43.useCallback)(() => setToast(null), []);
|
|
7184
7209
|
const onClick = () => {
|
|
7185
7210
|
if (monitor.pinMatch({ matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName }) === "match_limit") {
|
|
7186
7211
|
setToast({ kind: "error", text: ui.matchLimitToast });
|
|
@@ -7219,7 +7244,7 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
7219
7244
|
const previousOdds = row.previousPriceForms ? formatOdds(row.previousPriceForms, oddsFormat) : void 0;
|
|
7220
7245
|
const slipAllowed = vm.addToSlipEnabled && !suppressSlip && slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now());
|
|
7221
7246
|
const selection = slipAllowed ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
7222
|
-
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: (0,
|
|
7247
|
+
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: (0, import_widget_sdk21.slipSportOf)(vm.sport) })];
|
|
7223
7248
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-mo-row", children: [
|
|
7224
7249
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-mo-sel", children: row.selection }),
|
|
7225
7250
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OddsMovementBadge, { previous: previousOdds, current: odds, direction: row.movementDirection, ui }),
|
|
@@ -7245,7 +7270,7 @@ function fmtHhMm(iso, tag2, clock3, timeZone) {
|
|
|
7245
7270
|
return formatTime(iso, tag2, clock3, { timeZone });
|
|
7246
7271
|
}
|
|
7247
7272
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
7248
|
-
const [open, setOpen] = (0,
|
|
7273
|
+
const [open, setOpen] = (0, import_react44.useState)(false);
|
|
7249
7274
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
7250
7275
|
const kickoffFallback = vm.kickoffUtc ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
7251
7276
|
const kickoff = vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -7256,15 +7281,15 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
7256
7281
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
7257
7282
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
7258
7283
|
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui), ui.timeZone) : null;
|
|
7259
|
-
const [, setStaleTick] = (0,
|
|
7284
|
+
const [, setStaleTick] = (0, import_react44.useState)(0);
|
|
7260
7285
|
const watchStale = live != null && !isClosed && !isStale;
|
|
7261
|
-
(0,
|
|
7286
|
+
(0, import_react44.useEffect)(() => {
|
|
7262
7287
|
if (!watchStale) return;
|
|
7263
7288
|
const id = window.setTimeout(() => setStaleTick((n) => n + 1), Math.max(0, asOfMs + STALE_AFTER_MS - Date.now()) + 1);
|
|
7264
7289
|
return () => window.clearTimeout(id);
|
|
7265
7290
|
}, [watchStale, asOfMs]);
|
|
7266
|
-
const showPin = !!monitor && (0,
|
|
7267
|
-
const history = showPin && !pinRef && !hideHeader && (0,
|
|
7291
|
+
const showPin = !!monitor && (0, import_widget_sdk21.mayPinOrSlip)(vm.sport) && (vm.pinEnabled || (0, import_widget_sdk21.slipSportOf)(vm.sport) !== void 0) && !live && (!!pinRef || !vm.isLive);
|
|
7292
|
+
const history = showPin && !pinRef && !hideHeader && (0, import_widget_sdk21.sportOf)(vm.sport) === void 0 ? monitor : void 0;
|
|
7268
7293
|
const allMarkets = !hideHeader && !pinRef && !live && !vm.isLive ? allMarketsCount(vm, monitor) : null;
|
|
7269
7294
|
const showHeader = !!vm.competition || vm.isLive || !!kickoff || showPin || !!live;
|
|
7270
7295
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: hideHeader ? "ss-w-mocard ss-w-mocard--bare" : "ss-w-mocard", children: [
|
|
@@ -7292,7 +7317,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
7292
7317
|
{
|
|
7293
7318
|
ui,
|
|
7294
7319
|
monitor,
|
|
7295
|
-
pin: pinRef ?? { kind: "match", matchId: vm.matchId, sport: (0,
|
|
7320
|
+
pin: pinRef ?? { kind: "match", matchId: vm.matchId, sport: (0, import_widget_sdk21.slipSportOf)(vm.sport) },
|
|
7296
7321
|
market: pinRef ? void 0 : vm.marketDeveloperName
|
|
7297
7322
|
}
|
|
7298
7323
|
) : null
|
|
@@ -7397,7 +7422,7 @@ var asOf = (iso, ui) => {
|
|
|
7397
7422
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId }) {
|
|
7398
7423
|
const matchId = card.matchId;
|
|
7399
7424
|
const canAdd2 = !!slip.onAddToSlip;
|
|
7400
|
-
const ask = (0,
|
|
7425
|
+
const ask = (0, import_react45.useMemo)(() => canAdd2 && marketKey && matchId ? {
|
|
7401
7426
|
sport,
|
|
7402
7427
|
marketKey,
|
|
7403
7428
|
matchIds: [matchId],
|
|
@@ -7408,7 +7433,7 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
7408
7433
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
7409
7434
|
} : null, [canAdd2, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
7410
7435
|
const { grid, answeredFor, request } = useBuilderGrid({ conversation, locale: ui.hostTag, initial: ask });
|
|
7411
|
-
(0,
|
|
7436
|
+
(0, import_react45.useEffect)(() => {
|
|
7412
7437
|
if (ask) void request(ask);
|
|
7413
7438
|
}, [request, ask]);
|
|
7414
7439
|
useNextKickoffRender([card.startsAtUtc]);
|
|
@@ -7447,16 +7472,16 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
7447
7472
|
}
|
|
7448
7473
|
|
|
7449
7474
|
// src/components/dashboard/v8/Pic.tsx
|
|
7450
|
-
var
|
|
7475
|
+
var import_react46 = require("react");
|
|
7451
7476
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7452
7477
|
function Pic({ src, kind = "team" }) {
|
|
7453
|
-
const [failed, setFailed] = (0,
|
|
7478
|
+
const [failed, setFailed] = (0, import_react46.useState)(null);
|
|
7454
7479
|
if (!src || failed === src) return null;
|
|
7455
7480
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { className: kind === "player" ? "ss-w-v8-pic ss-w-v8-pic--player" : "ss-w-v8-pic", src, alt: "", "aria-hidden": "true", onError: () => setFailed(src) });
|
|
7456
7481
|
}
|
|
7457
7482
|
|
|
7458
7483
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
7459
|
-
var
|
|
7484
|
+
var import_react47 = require("react");
|
|
7460
7485
|
|
|
7461
7486
|
// src/components/dashboard/v8/factLeg.ts
|
|
7462
7487
|
var isProp = (key) => key.toLowerCase().startsWith("prop_");
|
|
@@ -7487,7 +7512,7 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
|
7487
7512
|
function FactPrice({ reference, ui, slip, conversation, memory: memory3, stars, enabled, operatorUserId, anonymousUserId }) {
|
|
7488
7513
|
const { sport, marketKey, matchId } = reference;
|
|
7489
7514
|
const canAdd2 = !!slip.onAddToSlip;
|
|
7490
|
-
const ask = (0,
|
|
7515
|
+
const ask = (0, import_react47.useMemo)(() => enabled && canAdd2 && marketKey && matchId ? {
|
|
7491
7516
|
sport,
|
|
7492
7517
|
marketKey,
|
|
7493
7518
|
matchIds: [matchId],
|
|
@@ -7499,7 +7524,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory3, stars,
|
|
|
7499
7524
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
7500
7525
|
} : null, [enabled, canAdd2, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
7501
7526
|
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: ask });
|
|
7502
|
-
(0,
|
|
7527
|
+
(0, import_react47.useEffect)(() => {
|
|
7503
7528
|
if (ask) void request(ask);
|
|
7504
7529
|
}, [request, ask]);
|
|
7505
7530
|
const settled = answeredFor === ask;
|
|
@@ -7568,7 +7593,7 @@ function FavouritesInvite({ ui, sport, onOpen }) {
|
|
|
7568
7593
|
}
|
|
7569
7594
|
|
|
7570
7595
|
// src/components/dashboard/v8/useFollow.ts
|
|
7571
|
-
var
|
|
7596
|
+
var import_react48 = require("react");
|
|
7572
7597
|
|
|
7573
7598
|
// src/favouriteKinds.ts
|
|
7574
7599
|
function favouriteKinds(sport) {
|
|
@@ -7587,7 +7612,7 @@ function favouriteKindLabel(ui, sport, kind) {
|
|
|
7587
7612
|
var isFavouriteKind = (kind) => kind === "team" || kind === "player" || kind === "competition";
|
|
7588
7613
|
var keyOf2 = (sport, t) => `${sport}:${t.kind}:${t.id}`;
|
|
7589
7614
|
function useFollow(controller, ui, holds, sport) {
|
|
7590
|
-
const [notice, setNotice] = (0,
|
|
7615
|
+
const [notice, setNotice] = (0, import_react48.useState)(null);
|
|
7591
7616
|
const isOpen = (t) => isFavouriteKind(t.kind) && !holds.followed.has(keyOf2(sport, t)) && !controller.isStarred(t.kind, t.id);
|
|
7592
7617
|
const follow = async (t) => {
|
|
7593
7618
|
if (!isFavouriteKind(t.kind)) return;
|
|
@@ -7621,7 +7646,7 @@ function FollowSuggestions({ chips, ui, controller, holds, sport }) {
|
|
|
7621
7646
|
}
|
|
7622
7647
|
|
|
7623
7648
|
// src/components/dashboard/v8/TeamStats.tsx
|
|
7624
|
-
var
|
|
7649
|
+
var import_widget_sdk22 = require("@sensiblestats/widget-sdk");
|
|
7625
7650
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
7626
7651
|
var RESULTS = ["W", "D", "L"];
|
|
7627
7652
|
var results = (form) => (form ?? []).filter((r) => RESULTS.includes(r));
|
|
@@ -7636,7 +7661,7 @@ function teamCardHasContent(card) {
|
|
|
7636
7661
|
if (card.homeLabel && card.awayLabel) return true;
|
|
7637
7662
|
return results(card.form).length > 0 || results(card.homeForm).length > 0 || results(card.awayForm).length > 0 || !!card.h2h || !!card.fact;
|
|
7638
7663
|
}
|
|
7639
|
-
var drawsShown = (sport, draws) => draws > 0 || (0,
|
|
7664
|
+
var drawsShown = (sport, draws) => draws > 0 || (0, import_widget_sdk22.sportOf)(sport) === void 0 && (0, import_widget_sdk22.fromWireSport)(sport) === void 0;
|
|
7640
7665
|
function TeamStats({ card, ui, sport }) {
|
|
7641
7666
|
const pair = named2(card);
|
|
7642
7667
|
const h2h = card.h2h;
|
|
@@ -7738,10 +7763,10 @@ function GuessCard({ guess, ui, controller, holds, sport, conversation, operator
|
|
|
7738
7763
|
}
|
|
7739
7764
|
|
|
7740
7765
|
// src/components/dashboard/v8/IdleTeams.tsx
|
|
7741
|
-
var
|
|
7766
|
+
var import_react49 = require("react");
|
|
7742
7767
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
7743
7768
|
function IdleTeams({ teams, ui, onAct, slotBase }) {
|
|
7744
|
-
const events = (0,
|
|
7769
|
+
const events = (0, import_react49.useContext)(GreetingEventsContext);
|
|
7745
7770
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: teams.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "ss-w-v8-idle", children: [
|
|
7746
7771
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Pic, { src: t.imagePath }),
|
|
7747
7772
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "ss-w-v8-idle-text", children: [
|
|
@@ -7759,10 +7784,10 @@ function IdleTeams({ teams, ui, onAct, slotBase }) {
|
|
|
7759
7784
|
}
|
|
7760
7785
|
|
|
7761
7786
|
// src/components/dashboard/v8/MatchCard.tsx
|
|
7762
|
-
var
|
|
7787
|
+
var import_react50 = require("react");
|
|
7763
7788
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
7764
7789
|
function MatchCard({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId, slot }) {
|
|
7765
|
-
const events = (0,
|
|
7790
|
+
const events = (0, import_react50.useContext)(GreetingEventsContext);
|
|
7766
7791
|
if (!teamCardHasContent(card)) return null;
|
|
7767
7792
|
const pair = !!(card.homeLabel && card.awayLabel);
|
|
7768
7793
|
const title = card.homeLabel && card.awayLabel ? `${card.homeLabel} - ${card.awayLabel}` : card.label;
|
|
@@ -8029,16 +8054,16 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, greeting, onTa
|
|
|
8029
8054
|
const { oddsFormat } = useOddsSettings();
|
|
8030
8055
|
const scope = useSportScope();
|
|
8031
8056
|
const sets = switchSets(dashboards);
|
|
8032
|
-
const [selected, setSelected] = (0,
|
|
8057
|
+
const [selected, setSelected] = (0, import_react51.useState)(() => initialSport(sets, defaultSport));
|
|
8033
8058
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
8034
8059
|
const shown2 = active ? active.dashboard : dashboard;
|
|
8035
8060
|
const personal = shown2.personal;
|
|
8036
8061
|
const starsElsewhere = (sets ?? []).some((s) => (s.dashboard.personal?.ribbon?.stars.length ?? 0) > 0);
|
|
8037
8062
|
const meta = active ? active.greeting ?? (greeting?.sport === active.sport ? greeting : void 0) : greeting;
|
|
8038
|
-
(0,
|
|
8063
|
+
(0, import_react51.useEffect)(() => {
|
|
8039
8064
|
if (log && meta) sendGreetingOnce((e) => log.log(e), log, meta, "panel");
|
|
8040
8065
|
}, [log, meta]);
|
|
8041
|
-
const events = (0,
|
|
8066
|
+
const events = (0, import_react51.useMemo)(() => {
|
|
8042
8067
|
if (!log || !meta) return null;
|
|
8043
8068
|
const send = (name, slot) => {
|
|
8044
8069
|
if (!Number.isInteger(slot) || slot < 0 || slot > 19) return;
|
|
@@ -8077,33 +8102,33 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, greeting, onTa
|
|
|
8077
8102
|
}
|
|
8078
8103
|
|
|
8079
8104
|
// src/useScheduleSport.ts
|
|
8080
|
-
var
|
|
8105
|
+
var import_react52 = require("react");
|
|
8081
8106
|
function useScheduleSport(offered) {
|
|
8082
|
-
const [chosen, setChosen] = (0,
|
|
8107
|
+
const [chosen, setChosen] = (0, import_react52.useState)("all");
|
|
8083
8108
|
const sport = chosen === "all" || offered.includes(chosen) ? chosen : "all";
|
|
8084
|
-
(0,
|
|
8109
|
+
(0, import_react52.useEffect)(() => {
|
|
8085
8110
|
if (sport !== chosen) setChosen("all");
|
|
8086
8111
|
}, [sport, chosen]);
|
|
8087
|
-
const setSport = (0,
|
|
8112
|
+
const setSport = (0, import_react52.useCallback)((s) => setChosen(s), []);
|
|
8088
8113
|
return { sport, setSport, offered };
|
|
8089
8114
|
}
|
|
8090
8115
|
|
|
8091
8116
|
// src/useMatchesDay.ts
|
|
8092
|
-
var
|
|
8117
|
+
var import_react54 = require("react");
|
|
8093
8118
|
|
|
8094
8119
|
// src/useScheduleDay.ts
|
|
8095
|
-
var
|
|
8120
|
+
var import_react53 = require("react");
|
|
8096
8121
|
var EMPTY = [];
|
|
8097
8122
|
function useScheduleDay(opts) {
|
|
8098
8123
|
const { localDate, today, todayGroups, enabled, resetKey, timeZone } = opts;
|
|
8099
|
-
const getRef = (0,
|
|
8124
|
+
const getRef = (0, import_react53.useRef)(opts.getSchedule);
|
|
8100
8125
|
getRef.current = opts.getSchedule;
|
|
8101
|
-
const daysRef = (0,
|
|
8102
|
-
const [fetched, setFetched] = (0,
|
|
8103
|
-
const [retryKey, setRetryKey] = (0,
|
|
8104
|
-
const [seenDate, setSeenDate] = (0,
|
|
8105
|
-
const [seenReset, setSeenReset] = (0,
|
|
8106
|
-
const [seenZone, setSeenZone] = (0,
|
|
8126
|
+
const daysRef = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
8127
|
+
const [fetched, setFetched] = (0, import_react53.useState)({ status: "idle", groups: EMPTY });
|
|
8128
|
+
const [retryKey, setRetryKey] = (0, import_react53.useState)(0);
|
|
8129
|
+
const [seenDate, setSeenDate] = (0, import_react53.useState)(localDate);
|
|
8130
|
+
const [seenReset, setSeenReset] = (0, import_react53.useState)(resetKey);
|
|
8131
|
+
const [seenZone, setSeenZone] = (0, import_react53.useState)(timeZone);
|
|
8107
8132
|
if (seenDate !== localDate) {
|
|
8108
8133
|
setSeenDate(localDate);
|
|
8109
8134
|
setFetched({ status: "idle", groups: EMPTY });
|
|
@@ -8115,7 +8140,7 @@ function useScheduleDay(opts) {
|
|
|
8115
8140
|
setFetched({ status: "idle", groups: EMPTY });
|
|
8116
8141
|
}
|
|
8117
8142
|
const isToday = localDate === today;
|
|
8118
|
-
(0,
|
|
8143
|
+
(0, import_react53.useEffect)(() => {
|
|
8119
8144
|
if (!enabled || isToday || daysRef.current.has(localDate)) return;
|
|
8120
8145
|
let cancelled = false;
|
|
8121
8146
|
setFetched({ status: "loading", groups: EMPTY });
|
|
@@ -8137,7 +8162,7 @@ function useScheduleDay(opts) {
|
|
|
8137
8162
|
cancelled = true;
|
|
8138
8163
|
};
|
|
8139
8164
|
}, [localDate, isToday, enabled, retryKey, resetKey, timeZone]);
|
|
8140
|
-
const retry = (0,
|
|
8165
|
+
const retry = (0, import_react53.useCallback)(() => {
|
|
8141
8166
|
setRetryKey((k) => k + 1);
|
|
8142
8167
|
}, []);
|
|
8143
8168
|
if (isToday) return { status: "ready", groups: todayGroups, retry };
|
|
@@ -8150,7 +8175,7 @@ function useScheduleDay(opts) {
|
|
|
8150
8175
|
// src/useMatchesDay.ts
|
|
8151
8176
|
function useMatchesDay({ discovery, day, sport, getSchedule, enabled, timeZone }) {
|
|
8152
8177
|
const { localDate: today, matchDays } = discovery;
|
|
8153
|
-
const chips = (0,
|
|
8178
|
+
const chips = (0, import_react54.useMemo)(() => buildDayChips(today, matchDays, sport), [today, matchDays, sport]);
|
|
8154
8179
|
const selected = chips.some((c) => c.date === day) ? day : today;
|
|
8155
8180
|
const loaded = useScheduleDay({
|
|
8156
8181
|
localDate: selected,
|
|
@@ -8164,8 +8189,8 @@ function useMatchesDay({ discovery, day, sport, getSchedule, enabled, timeZone }
|
|
|
8164
8189
|
return { ...loaded, chips, selected };
|
|
8165
8190
|
}
|
|
8166
8191
|
function useMatchesDayPick(today) {
|
|
8167
|
-
const [pick, setPick] = (0,
|
|
8168
|
-
const setDay = (0,
|
|
8192
|
+
const [pick, setPick] = (0, import_react54.useState)(null);
|
|
8193
|
+
const setDay = (0, import_react54.useCallback)((d) => setPick({ day: d, madeOn: today }), [today]);
|
|
8169
8194
|
return [pick !== null && pick.madeOn === today ? pick.day : today, setDay];
|
|
8170
8195
|
}
|
|
8171
8196
|
|
|
@@ -8262,11 +8287,11 @@ var WIRE_TO_PUBLIC = {
|
|
|
8262
8287
|
};
|
|
8263
8288
|
|
|
8264
8289
|
// src/popupTelemetry.ts
|
|
8265
|
-
var
|
|
8290
|
+
var import_react55 = require("react");
|
|
8266
8291
|
function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
|
|
8267
|
-
const shownRef = (0,
|
|
8268
|
-
const closedTextRef = (0,
|
|
8269
|
-
(0,
|
|
8292
|
+
const shownRef = (0, import_react55.useRef)(/* @__PURE__ */ new Set());
|
|
8293
|
+
const closedTextRef = (0, import_react55.useRef)(null);
|
|
8294
|
+
(0, import_react55.useEffect)(() => {
|
|
8270
8295
|
if (isOpen) {
|
|
8271
8296
|
if (closedTextRef.current) log?.log({ name: "popup_opened" });
|
|
8272
8297
|
closedTextRef.current = null;
|
|
@@ -8279,28 +8304,28 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown)
|
|
|
8279
8304
|
log?.log({ name: "popup_shown" });
|
|
8280
8305
|
}
|
|
8281
8306
|
}, [log, isOpen, popupText, confirmedShown]);
|
|
8282
|
-
return (0,
|
|
8307
|
+
return (0, import_react55.useCallback)(() => {
|
|
8283
8308
|
log?.log({ name: "popup_dismissed" });
|
|
8284
8309
|
dismissPopup();
|
|
8285
8310
|
}, [log, dismissPopup]);
|
|
8286
8311
|
}
|
|
8287
8312
|
|
|
8288
8313
|
// src/mobileBinding.ts
|
|
8289
|
-
var
|
|
8314
|
+
var import_react56 = require("react");
|
|
8290
8315
|
var CLEARED = { text: null, asks: [] };
|
|
8291
8316
|
function useMobileBinding(args) {
|
|
8292
8317
|
const { binding, panelOpen, popupText, asks, cta, price } = args;
|
|
8293
|
-
const latest = (0,
|
|
8318
|
+
const latest = (0, import_react56.useRef)(args);
|
|
8294
8319
|
latest.current = args;
|
|
8295
|
-
const bindingRef = (0,
|
|
8320
|
+
const bindingRef = (0, import_react56.useRef)(binding);
|
|
8296
8321
|
bindingRef.current = binding;
|
|
8297
|
-
const backRef = (0,
|
|
8298
|
-
const priceRef = (0,
|
|
8299
|
-
const priceInFlight = (0,
|
|
8300
|
-
const [confirmedShown, setConfirmedShown] = (0,
|
|
8322
|
+
const backRef = (0, import_react56.useRef)(null);
|
|
8323
|
+
const priceRef = (0, import_react56.useRef)(null);
|
|
8324
|
+
const priceInFlight = (0, import_react56.useRef)(/* @__PURE__ */ new Set()).current;
|
|
8325
|
+
const [confirmedShown, setConfirmedShown] = (0, import_react56.useState)(null);
|
|
8301
8326
|
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta, price]);
|
|
8302
|
-
const reported = (0,
|
|
8303
|
-
(0,
|
|
8327
|
+
const reported = (0, import_react56.useRef)({ binding: void 0, key: "" });
|
|
8328
|
+
(0, import_react56.useEffect)(() => {
|
|
8304
8329
|
if (!binding) return;
|
|
8305
8330
|
const prev = reported.current;
|
|
8306
8331
|
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
@@ -8308,7 +8333,7 @@ function useMobileBinding(args) {
|
|
|
8308
8333
|
if (teaserKey === "" && prev.binding !== binding) return;
|
|
8309
8334
|
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {}, ...price ? { price } : {} });
|
|
8310
8335
|
}, [binding, teaserKey]);
|
|
8311
|
-
(0,
|
|
8336
|
+
(0, import_react56.useEffect)(() => {
|
|
8312
8337
|
if (!binding) return;
|
|
8313
8338
|
binding.onHandle({
|
|
8314
8339
|
open: () => latest.current.open(),
|
|
@@ -8334,23 +8359,23 @@ function useMobileBinding(args) {
|
|
|
8334
8359
|
});
|
|
8335
8360
|
return () => binding.onHandle(null);
|
|
8336
8361
|
}, [binding]);
|
|
8337
|
-
const onCloseRequested = (0,
|
|
8338
|
-
const onRegisterBack = (0,
|
|
8362
|
+
const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
8363
|
+
const onRegisterBack = (0, import_react56.useCallback)((fn) => {
|
|
8339
8364
|
backRef.current = fn;
|
|
8340
8365
|
}, []);
|
|
8341
|
-
const onRegisterPrice = (0,
|
|
8366
|
+
const onRegisterPrice = (0, import_react56.useCallback)((fn) => {
|
|
8342
8367
|
priceRef.current = fn;
|
|
8343
8368
|
}, []);
|
|
8344
|
-
const onPriceResult = (0,
|
|
8369
|
+
const onPriceResult = (0, import_react56.useCallback)((result) => bindingRef.current?.onPriceResult(result), []);
|
|
8345
8370
|
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0, onRegisterPrice: void 0, onPriceResult: void 0, priceInFlight: void 0 };
|
|
8346
8371
|
return { confirmedShown, onCloseRequested, onRegisterBack, onRegisterPrice, onPriceResult, priceInFlight };
|
|
8347
8372
|
}
|
|
8348
8373
|
|
|
8349
8374
|
// src/openTelemetry.ts
|
|
8350
|
-
var
|
|
8375
|
+
var import_react57 = require("react");
|
|
8351
8376
|
function useOpenTelemetry(log, isOpen) {
|
|
8352
|
-
const openLoggedRef = (0,
|
|
8353
|
-
(0,
|
|
8377
|
+
const openLoggedRef = (0, import_react57.useRef)(false);
|
|
8378
|
+
(0, import_react57.useEffect)(() => {
|
|
8354
8379
|
if (!isOpen) {
|
|
8355
8380
|
openLoggedRef.current = false;
|
|
8356
8381
|
return;
|
|
@@ -8362,13 +8387,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
8362
8387
|
}
|
|
8363
8388
|
|
|
8364
8389
|
// src/components/ChatFab.tsx
|
|
8365
|
-
var
|
|
8390
|
+
var import_react59 = require("react");
|
|
8366
8391
|
|
|
8367
8392
|
// src/components/BrandMark.tsx
|
|
8368
|
-
var
|
|
8393
|
+
var import_react58 = require("react");
|
|
8369
8394
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8370
8395
|
function BrandMark({ logoUrl, className }) {
|
|
8371
|
-
const [failed, setFailed] = (0,
|
|
8396
|
+
const [failed, setFailed] = (0, import_react58.useState)(false);
|
|
8372
8397
|
if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SsMark, { className });
|
|
8373
8398
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
8374
8399
|
}
|
|
@@ -8412,9 +8437,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8412
8437
|
const bubble = popupText ?? greeting;
|
|
8413
8438
|
const hidden = busy && !label;
|
|
8414
8439
|
const track = useTrack();
|
|
8415
|
-
const [intro, setIntro] = (0,
|
|
8416
|
-
const armedRef = (0,
|
|
8417
|
-
(0,
|
|
8440
|
+
const [intro, setIntro] = (0, import_react59.useState)(false);
|
|
8441
|
+
const armedRef = (0, import_react59.useRef)(introAllowed);
|
|
8442
|
+
(0, import_react59.useEffect)(() => {
|
|
8418
8443
|
if (armedRef.current && bubble) {
|
|
8419
8444
|
armedRef.current = false;
|
|
8420
8445
|
setIntro(true);
|
|
@@ -8435,27 +8460,37 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8435
8460
|
}
|
|
8436
8461
|
|
|
8437
8462
|
// src/components/BubblePrice.tsx
|
|
8438
|
-
var
|
|
8463
|
+
var import_react60 = require("react");
|
|
8439
8464
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8440
8465
|
function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
|
|
8441
|
-
const selections = (0,
|
|
8466
|
+
const selections = (0, import_react60.useMemo)(() => [price.selection], [price.selection]);
|
|
8442
8467
|
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
|
|
8443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ss-w-greeting-pick", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, rowLabel: price.label || price.selection.label, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 }) });
|
|
8468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ss-w-greeting-pick", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, rowLabel: price.label || price.selection.label, sport, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 }) });
|
|
8444
8469
|
}
|
|
8445
8470
|
|
|
8446
8471
|
// src/components/MobileBubblePrice.tsx
|
|
8447
|
-
var
|
|
8472
|
+
var import_react61 = require("react");
|
|
8448
8473
|
function MobileBubblePrice(props) {
|
|
8449
8474
|
const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
|
|
8450
|
-
const
|
|
8451
|
-
latest
|
|
8475
|
+
const marks = useSettledMarks();
|
|
8476
|
+
const latest = (0, import_react61.useRef)({ props, add, marks });
|
|
8477
|
+
latest.current = { props, add, marks };
|
|
8452
8478
|
const { onRegister, inFlight: inFlight2 } = props;
|
|
8453
|
-
(0,
|
|
8479
|
+
(0, import_react61.useEffect)(() => {
|
|
8454
8480
|
onRegister(() => {
|
|
8455
|
-
const { props: p, add: run } = latest.current;
|
|
8481
|
+
const { props: p, add: run, marks: m } = latest.current;
|
|
8456
8482
|
const id = p.price.selection.matchOddsId;
|
|
8457
8483
|
if (inFlight2.has(id)) return;
|
|
8484
|
+
const key = slipKey({ matchOddsId: id, sport: slipSportOfWire(p.sport) });
|
|
8485
|
+
if (m.isSettled(key)) {
|
|
8486
|
+
try {
|
|
8487
|
+
p.onResult({ matchOddsId: id, outcome: "added", text: null });
|
|
8488
|
+
} catch {
|
|
8489
|
+
}
|
|
8490
|
+
return;
|
|
8491
|
+
}
|
|
8458
8492
|
const report = (r) => {
|
|
8493
|
+
if (r.outcome === "added") latest.current.marks.settle(key);
|
|
8459
8494
|
const now = latest.current.props;
|
|
8460
8495
|
try {
|
|
8461
8496
|
now.onResult({ matchOddsId: id, outcome: r.outcome, text: r.toast?.text ?? (r.outcome === "gone" ? now.ui.v2PriceGone : null) });
|
|
@@ -8477,10 +8512,10 @@ function MobileBubblePrice(props) {
|
|
|
8477
8512
|
}
|
|
8478
8513
|
|
|
8479
8514
|
// src/components/ChatPanel.tsx
|
|
8480
|
-
var
|
|
8515
|
+
var import_react122 = require("react");
|
|
8481
8516
|
|
|
8482
8517
|
// src/components/ChatHeader.tsx
|
|
8483
|
-
var
|
|
8518
|
+
var import_react62 = require("react");
|
|
8484
8519
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8485
8520
|
function ChatHeader({
|
|
8486
8521
|
onClose,
|
|
@@ -8496,18 +8531,18 @@ function ChatHeader({
|
|
|
8496
8531
|
onOpenFavourites,
|
|
8497
8532
|
favouritesLabel
|
|
8498
8533
|
}) {
|
|
8499
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
8500
|
-
const wrapRef = (0,
|
|
8501
|
-
const kebabRef = (0,
|
|
8502
|
-
const firstItemRef = (0,
|
|
8534
|
+
const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
|
|
8535
|
+
const wrapRef = (0, import_react62.useRef)(null);
|
|
8536
|
+
const kebabRef = (0, import_react62.useRef)(null);
|
|
8537
|
+
const firstItemRef = (0, import_react62.useRef)(null);
|
|
8503
8538
|
const hasNew = !!(canReset && onNewConversation);
|
|
8504
8539
|
const hasSettings = !!onOpenSettings;
|
|
8505
8540
|
const hasFavourites = !!onOpenFavourites;
|
|
8506
8541
|
const hasMenu = hasFavourites || hasNew || hasSettings;
|
|
8507
|
-
(0,
|
|
8542
|
+
(0, import_react62.useEffect)(() => {
|
|
8508
8543
|
if (menuOpen) firstItemRef.current?.focus();
|
|
8509
8544
|
}, [menuOpen]);
|
|
8510
|
-
(0,
|
|
8545
|
+
(0, import_react62.useEffect)(() => {
|
|
8511
8546
|
if (!menuOpen) return;
|
|
8512
8547
|
const onPointer = (e) => {
|
|
8513
8548
|
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
@@ -8595,10 +8630,10 @@ function ChatHeader({
|
|
|
8595
8630
|
}
|
|
8596
8631
|
|
|
8597
8632
|
// src/components/MessageList.tsx
|
|
8598
|
-
var
|
|
8633
|
+
var import_react77 = require("react");
|
|
8599
8634
|
|
|
8600
8635
|
// src/components/ChatMessage.tsx
|
|
8601
|
-
var
|
|
8636
|
+
var import_react76 = require("react");
|
|
8602
8637
|
|
|
8603
8638
|
// src/components/Markdown.tsx
|
|
8604
8639
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8616,7 +8651,7 @@ function Markdown({ text: text2 }) {
|
|
|
8616
8651
|
}
|
|
8617
8652
|
|
|
8618
8653
|
// src/components/EntityCardList.tsx
|
|
8619
|
-
var
|
|
8654
|
+
var import_react63 = require("react");
|
|
8620
8655
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8621
8656
|
var MAX_VISIBLE = 3;
|
|
8622
8657
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -8719,7 +8754,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
8719
8754
|
)) });
|
|
8720
8755
|
}
|
|
8721
8756
|
function EntityCardItem({ c }) {
|
|
8722
|
-
const [active, setActive] = (0,
|
|
8757
|
+
const [active, setActive] = (0, import_react63.useState)(0);
|
|
8723
8758
|
const hasBody = c.scopes.length > 0;
|
|
8724
8759
|
if (!hasBody) {
|
|
8725
8760
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -8734,7 +8769,7 @@ function EntityCardItem({ c }) {
|
|
|
8734
8769
|
] });
|
|
8735
8770
|
}
|
|
8736
8771
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
8737
|
-
const [expanded, setExpanded] = (0,
|
|
8772
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(false);
|
|
8738
8773
|
if (cards.length === 0) return null;
|
|
8739
8774
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
8740
8775
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -8883,20 +8918,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
8883
8918
|
}
|
|
8884
8919
|
|
|
8885
8920
|
// src/components/ComboCardList.tsx
|
|
8886
|
-
var
|
|
8921
|
+
var import_react66 = require("react");
|
|
8887
8922
|
|
|
8888
8923
|
// src/components/AddAllToSlipButton.tsx
|
|
8889
|
-
var
|
|
8924
|
+
var import_react64 = require("react");
|
|
8890
8925
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
8891
8926
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
8892
8927
|
const add = useSlipAdd(slip, ui);
|
|
8893
8928
|
const slipState = useSlipState();
|
|
8894
8929
|
const log = useEventLog();
|
|
8895
8930
|
const track = useTrack();
|
|
8896
|
-
const [pending, setPending] = (0,
|
|
8897
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
8898
|
-
const [toast, setToast] = (0,
|
|
8899
|
-
const dismiss = (0,
|
|
8931
|
+
const [pending, setPending] = (0, import_react64.useState)(false);
|
|
8932
|
+
const [settledLocal, setSettledLocal] = (0, import_react64.useState)({});
|
|
8933
|
+
const [toast, setToast] = (0, import_react64.useState)(null);
|
|
8934
|
+
const dismiss = (0, import_react64.useCallback)(() => setToast(null), []);
|
|
8900
8935
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
8901
8936
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
8902
8937
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -8969,10 +9004,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
8969
9004
|
}
|
|
8970
9005
|
|
|
8971
9006
|
// src/presetToolsContext.ts
|
|
8972
|
-
var
|
|
8973
|
-
var PresetToolsContext = (0,
|
|
9007
|
+
var import_react65 = require("react");
|
|
9008
|
+
var PresetToolsContext = (0, import_react65.createContext)(null);
|
|
8974
9009
|
function usePresetTools() {
|
|
8975
|
-
return (0,
|
|
9010
|
+
return (0, import_react65.useContext)(PresetToolsContext);
|
|
8976
9011
|
}
|
|
8977
9012
|
|
|
8978
9013
|
// src/components/ComboCardList.tsx
|
|
@@ -8986,7 +9021,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
|
|
|
8986
9021
|
const showPin = !!monitor && leg.pinEnabled;
|
|
8987
9022
|
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
8988
9023
|
const line = leg.statText ?? factText;
|
|
8989
|
-
const noteId = (0,
|
|
9024
|
+
const noteId = (0, import_react66.useId)();
|
|
8990
9025
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
8991
9026
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
8992
9027
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -9610,7 +9645,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
9610
9645
|
}
|
|
9611
9646
|
|
|
9612
9647
|
// src/components/NflInsightList.tsx
|
|
9613
|
-
var
|
|
9648
|
+
var import_react67 = require("react");
|
|
9614
9649
|
|
|
9615
9650
|
// src/strings/types.ts
|
|
9616
9651
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
@@ -9627,7 +9662,7 @@ function teamImage(vm, abbr) {
|
|
|
9627
9662
|
return void 0;
|
|
9628
9663
|
}
|
|
9629
9664
|
function Badge({ abbr, url }) {
|
|
9630
|
-
const [failed, setFailed] = (0,
|
|
9665
|
+
const [failed, setFailed] = (0, import_react67.useState)(false);
|
|
9631
9666
|
if (url && !failed) {
|
|
9632
9667
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
9633
9668
|
}
|
|
@@ -10238,8 +10273,8 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10238
10273
|
}
|
|
10239
10274
|
|
|
10240
10275
|
// src/components/CompactOddsList.tsx
|
|
10241
|
-
var
|
|
10242
|
-
var
|
|
10276
|
+
var import_react68 = require("react");
|
|
10277
|
+
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
10243
10278
|
|
|
10244
10279
|
// src/compactList.ts
|
|
10245
10280
|
var COMPACT_MIN_CARDS = 3;
|
|
@@ -10337,7 +10372,7 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10337
10372
|
const vm = row.card;
|
|
10338
10373
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
10339
10374
|
const count2 = allMarketsCount(vm, monitor);
|
|
10340
|
-
const nflPin = (0,
|
|
10375
|
+
const nflPin = (0, import_widget_sdk23.sportOf)(vm.sport) === "americanfootball" && !vm.isLive;
|
|
10341
10376
|
const kickoffFallback = vm.kickoffUtc ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
10342
10377
|
const when = vm.isLive ? ui.liveLabel : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
10343
10378
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
|
|
@@ -10355,16 +10390,16 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10355
10390
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mol-cells", style: { gridTemplateColumns: `repeat(${row.cells.length || columns}, minmax(0, 1fr))` }, children: row.cells.map((cell2) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Cell2, { row, cell: cell2, ui, slip }, cell2.row.key)) }),
|
|
10356
10391
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: vm.isLive ? "ss-w-mol-side ss-w-mol-side--live" : "ss-w-mol-side", children: [
|
|
10357
10392
|
when ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mol-when", children: when }) : null,
|
|
10358
|
-
count2 !== null && monitor && ui ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AllMarketsButton, { vm, count: count2, monitor, ui, surface: "list" }) : monitor && (vm.pinEnabled && vm.isLive || nflPin) && (0,
|
|
10393
|
+
count2 !== null && monitor && ui ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AllMarketsButton, { vm, count: count2, monitor, ui, surface: "list" }) : monitor && (vm.pinEnabled && vm.isLive || nflPin) && (0, import_widget_sdk23.mayPinOrSlip)(vm.sport) ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: vm.matchId, sport: (0, import_widget_sdk23.slipSportOf)(vm.sport) } }) : null
|
|
10359
10394
|
] })
|
|
10360
10395
|
] });
|
|
10361
10396
|
}
|
|
10362
10397
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
10363
|
-
const [shown2, setShown] = (0,
|
|
10398
|
+
const [shown2, setShown] = (0, import_react68.useState)(COMPACT_PAGE);
|
|
10364
10399
|
const hidden = list.rowCount - shown2;
|
|
10365
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
10366
|
-
const focusRef = (0,
|
|
10367
|
-
(0,
|
|
10400
|
+
const [focusIndex, setFocusIndex] = (0, import_react68.useState)(null);
|
|
10401
|
+
const focusRef = (0, import_react68.useRef)(null);
|
|
10402
|
+
(0, import_react68.useEffect)(() => {
|
|
10368
10403
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
10369
10404
|
}, [focusIndex]);
|
|
10370
10405
|
let left = shown2;
|
|
@@ -10599,7 +10634,7 @@ function FixtureCard({ card, ui }) {
|
|
|
10599
10634
|
}
|
|
10600
10635
|
|
|
10601
10636
|
// src/components/dashboard/CountdownCard.tsx
|
|
10602
|
-
var
|
|
10637
|
+
var import_react69 = require("react");
|
|
10603
10638
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10604
10639
|
var DAY_MS3 = 864e5;
|
|
10605
10640
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -10618,12 +10653,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
10618
10653
|
function CountdownCard({ card, ui }) {
|
|
10619
10654
|
const { data } = card;
|
|
10620
10655
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
10621
|
-
const [nowMs, setNowMs] = (0,
|
|
10622
|
-
const [reduced] = (0,
|
|
10656
|
+
const [nowMs, setNowMs] = (0, import_react69.useState)(() => Date.now());
|
|
10657
|
+
const [reduced] = (0, import_react69.useState)(
|
|
10623
10658
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
10624
10659
|
);
|
|
10625
10660
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
10626
|
-
(0,
|
|
10661
|
+
(0, import_react69.useEffect)(() => {
|
|
10627
10662
|
if (reduced) return;
|
|
10628
10663
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
10629
10664
|
return () => window.clearInterval(id);
|
|
@@ -10631,7 +10666,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10631
10666
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
10632
10667
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
10633
10668
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
10634
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10669
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react69.Fragment, { children: [
|
|
10635
10670
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
10636
10671
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
10637
10672
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -10642,7 +10677,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10642
10677
|
}
|
|
10643
10678
|
|
|
10644
10679
|
// src/components/dashboard/InjuriesCard.tsx
|
|
10645
|
-
var
|
|
10680
|
+
var import_react70 = require("react");
|
|
10646
10681
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10647
10682
|
var SHOWN = 3;
|
|
10648
10683
|
function ColHead({ name, crestUrl }) {
|
|
@@ -10665,7 +10700,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
10665
10700
|
}
|
|
10666
10701
|
function InjuriesCard({ card, ui }) {
|
|
10667
10702
|
const { data } = card;
|
|
10668
|
-
const [expanded, setExpanded] = (0,
|
|
10703
|
+
const [expanded, setExpanded] = (0, import_react70.useState)(false);
|
|
10669
10704
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
10670
10705
|
const limit = expanded ? void 0 : SHOWN;
|
|
10671
10706
|
const { showMore, showLess } = ui;
|
|
@@ -10770,7 +10805,7 @@ function LinksCard({ card }) {
|
|
|
10770
10805
|
}
|
|
10771
10806
|
|
|
10772
10807
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
10773
|
-
var
|
|
10808
|
+
var import_react71 = require("react");
|
|
10774
10809
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10775
10810
|
function initials3(name) {
|
|
10776
10811
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -10780,7 +10815,7 @@ function PostMatchCrest({
|
|
|
10780
10815
|
name,
|
|
10781
10816
|
side
|
|
10782
10817
|
}) {
|
|
10783
|
-
const [failed, setFailed] = (0,
|
|
10818
|
+
const [failed, setFailed] = (0, import_react71.useState)(false);
|
|
10784
10819
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
10785
10820
|
if (url && !failed) {
|
|
10786
10821
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10979,10 +11014,10 @@ function RestingFormCard({ card }) {
|
|
|
10979
11014
|
}
|
|
10980
11015
|
|
|
10981
11016
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10982
|
-
var
|
|
11017
|
+
var import_react73 = require("react");
|
|
10983
11018
|
|
|
10984
11019
|
// src/useLiveClock.ts
|
|
10985
|
-
var
|
|
11020
|
+
var import_react72 = require("react");
|
|
10986
11021
|
var TICK_MS = 6e4;
|
|
10987
11022
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10988
11023
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10991,10 +11026,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
10991
11026
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
10992
11027
|
}
|
|
10993
11028
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
10994
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
11029
|
+
const [displayMinute, setDisplayMinute] = (0, import_react72.useState)(
|
|
10995
11030
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10996
11031
|
);
|
|
10997
|
-
(0,
|
|
11032
|
+
(0, import_react72.useEffect)(() => {
|
|
10998
11033
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10999
11034
|
if (!clockRunning) return;
|
|
11000
11035
|
const id = window.setInterval(() => {
|
|
@@ -11011,7 +11046,7 @@ function initials5(name) {
|
|
|
11011
11046
|
return name.trim().slice(0, 3).toUpperCase();
|
|
11012
11047
|
}
|
|
11013
11048
|
function LiveCrest({ url, name, side }) {
|
|
11014
|
-
const [failed, setFailed] = (0,
|
|
11049
|
+
const [failed, setFailed] = (0, import_react73.useState)(false);
|
|
11015
11050
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
11016
11051
|
if (url && !failed) {
|
|
11017
11052
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -11033,7 +11068,7 @@ function LiveScoreCard({
|
|
|
11033
11068
|
}) {
|
|
11034
11069
|
const { data } = card;
|
|
11035
11070
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
11036
|
-
const seedRef = (0,
|
|
11071
|
+
const seedRef = (0, import_react73.useRef)(null);
|
|
11037
11072
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
11038
11073
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
11039
11074
|
}
|
|
@@ -11079,7 +11114,7 @@ function LiveScoreCard({
|
|
|
11079
11114
|
}
|
|
11080
11115
|
|
|
11081
11116
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
11082
|
-
var
|
|
11117
|
+
var import_react74 = require("react");
|
|
11083
11118
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
11084
11119
|
var SHOWN2 = 3;
|
|
11085
11120
|
function EventIcon({ type }) {
|
|
@@ -11121,7 +11156,7 @@ function EventRow({ e }) {
|
|
|
11121
11156
|
] });
|
|
11122
11157
|
}
|
|
11123
11158
|
function LiveTimelineCard({ card, ui }) {
|
|
11124
|
-
const [expanded, setExpanded] = (0,
|
|
11159
|
+
const [expanded, setExpanded] = (0, import_react74.useState)(false);
|
|
11125
11160
|
const events = card.data.events;
|
|
11126
11161
|
if (!events || events.length === 0) return null;
|
|
11127
11162
|
const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -11145,7 +11180,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
11145
11180
|
}
|
|
11146
11181
|
|
|
11147
11182
|
// src/components/dashboard/MomentumWave.tsx
|
|
11148
|
-
var
|
|
11183
|
+
var import_react75 = require("react");
|
|
11149
11184
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
11150
11185
|
var WIDTH = 270;
|
|
11151
11186
|
var HEIGHT = 56;
|
|
@@ -11170,7 +11205,7 @@ function MomentumWave({
|
|
|
11170
11205
|
}) {
|
|
11171
11206
|
if (points.length === 0) return null;
|
|
11172
11207
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
11173
|
-
const clipId = (0,
|
|
11208
|
+
const clipId = (0, import_react75.useId)();
|
|
11174
11209
|
const topClipId = `${clipId}-top`;
|
|
11175
11210
|
const bottomClipId = `${clipId}-bottom`;
|
|
11176
11211
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -11320,7 +11355,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
11320
11355
|
// src/components/ChatMessage.tsx
|
|
11321
11356
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11322
11357
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
11323
|
-
const [sport, setSport] = (0,
|
|
11358
|
+
const [sport, setSport] = (0, import_react76.useState)(null);
|
|
11324
11359
|
if (message.role === "user") {
|
|
11325
11360
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
11326
11361
|
}
|
|
@@ -11375,11 +11410,11 @@ function turnAnchor(messages) {
|
|
|
11375
11410
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
11376
11411
|
const { state, send } = controller;
|
|
11377
11412
|
const { oddsFormat } = useOddsSettings();
|
|
11378
|
-
const listRef = (0,
|
|
11379
|
-
const endRef = (0,
|
|
11380
|
-
const pinnedRef = (0,
|
|
11381
|
-
const anchoredTurnRef = (0,
|
|
11382
|
-
(0,
|
|
11413
|
+
const listRef = (0, import_react77.useRef)(null);
|
|
11414
|
+
const endRef = (0, import_react77.useRef)(null);
|
|
11415
|
+
const pinnedRef = (0, import_react77.useRef)(true);
|
|
11416
|
+
const anchoredTurnRef = (0, import_react77.useRef)(null);
|
|
11417
|
+
(0, import_react77.useEffect)(() => {
|
|
11383
11418
|
const anchor = turnAnchor(state.messages);
|
|
11384
11419
|
const list = listRef.current;
|
|
11385
11420
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -11438,13 +11473,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
11438
11473
|
}
|
|
11439
11474
|
|
|
11440
11475
|
// src/components/ChatInput.tsx
|
|
11441
|
-
var
|
|
11476
|
+
var import_react78 = require("react");
|
|
11442
11477
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11443
|
-
var ChatInput = (0,
|
|
11444
|
-
const [value, setValue] = (0,
|
|
11445
|
-
const textareaRef = (0,
|
|
11446
|
-
const stopRef = (0,
|
|
11447
|
-
const textBoxWantsFocusRef = (0,
|
|
11478
|
+
var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
11479
|
+
const [value, setValue] = (0, import_react78.useState)("");
|
|
11480
|
+
const textareaRef = (0, import_react78.useRef)(null);
|
|
11481
|
+
const stopRef = (0, import_react78.useRef)(null);
|
|
11482
|
+
const textBoxWantsFocusRef = (0, import_react78.useRef)(false);
|
|
11448
11483
|
const submit = () => {
|
|
11449
11484
|
if (disabled) return;
|
|
11450
11485
|
const t = value.trim();
|
|
@@ -11458,7 +11493,7 @@ var ChatInput = (0, import_react77.forwardRef)(function ChatInput2({ placeholder
|
|
|
11458
11493
|
submit();
|
|
11459
11494
|
}
|
|
11460
11495
|
};
|
|
11461
|
-
(0,
|
|
11496
|
+
(0, import_react78.useImperativeHandle)(ref, () => ({
|
|
11462
11497
|
focus() {
|
|
11463
11498
|
const box = textareaRef.current;
|
|
11464
11499
|
if (box && !box.disabled) {
|
|
@@ -11470,7 +11505,7 @@ var ChatInput = (0, import_react77.forwardRef)(function ChatInput2({ placeholder
|
|
|
11470
11505
|
stopRef.current?.focus();
|
|
11471
11506
|
}
|
|
11472
11507
|
}), []);
|
|
11473
|
-
(0,
|
|
11508
|
+
(0, import_react78.useEffect)(() => {
|
|
11474
11509
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
11475
11510
|
textBoxWantsFocusRef.current = false;
|
|
11476
11511
|
const box = textareaRef.current;
|
|
@@ -11501,7 +11536,7 @@ var ChatInput = (0, import_react77.forwardRef)(function ChatInput2({ placeholder
|
|
|
11501
11536
|
});
|
|
11502
11537
|
|
|
11503
11538
|
// src/components/TabBar.tsx
|
|
11504
|
-
var
|
|
11539
|
+
var import_react79 = require("react");
|
|
11505
11540
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11506
11541
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
11507
11542
|
var FOCUS_EDGE = 24;
|
|
@@ -11524,16 +11559,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11524
11559
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
11525
11560
|
];
|
|
11526
11561
|
const track = useTrack();
|
|
11527
|
-
const listRef = (0,
|
|
11562
|
+
const listRef = (0, import_react79.useRef)(null);
|
|
11528
11563
|
const activeTab = monitor.activeTab;
|
|
11529
|
-
(0,
|
|
11564
|
+
(0, import_react79.useEffect)(() => {
|
|
11530
11565
|
const el = listRef.current?.querySelector("[data-on]");
|
|
11531
11566
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
11532
11567
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11533
11568
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
11534
11569
|
}, [activeTab]);
|
|
11535
11570
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
11536
|
-
(0,
|
|
11571
|
+
(0, import_react79.useLayoutEffect)(() => {
|
|
11537
11572
|
const strip = listRef.current;
|
|
11538
11573
|
if (!strip) return;
|
|
11539
11574
|
const measure = () => {
|
|
@@ -11557,7 +11592,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11557
11592
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
11558
11593
|
};
|
|
11559
11594
|
}, [labelSignature]);
|
|
11560
|
-
const pointerDown = (0,
|
|
11595
|
+
const pointerDown = (0, import_react79.useRef)(false);
|
|
11561
11596
|
const keepFocusedTabInView = (e) => {
|
|
11562
11597
|
const strip = e.currentTarget;
|
|
11563
11598
|
const tab = e.target;
|
|
@@ -11617,10 +11652,10 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11617
11652
|
}
|
|
11618
11653
|
|
|
11619
11654
|
// src/components/MonitorTabs.tsx
|
|
11620
|
-
var
|
|
11655
|
+
var import_react92 = require("react");
|
|
11621
11656
|
|
|
11622
11657
|
// src/components/MarketAccordion.tsx
|
|
11623
|
-
var
|
|
11658
|
+
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
11624
11659
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11625
11660
|
function MarketAccordion({ match, monitor, ui, slip }) {
|
|
11626
11661
|
const slipState = useSlipState();
|
|
@@ -11628,7 +11663,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11628
11663
|
if (markets.length === 0) return null;
|
|
11629
11664
|
const mk = monitorMatchKey(match.sport, match.matchId);
|
|
11630
11665
|
const open = monitor.openMarket[mk] ?? null;
|
|
11631
|
-
const sport = (0,
|
|
11666
|
+
const sport = (0, import_widget_sdk24.slipSportOf)(match.sport);
|
|
11632
11667
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ss-w-acc", children: markets.map((m) => {
|
|
11633
11668
|
const isOpen = open === m.marketDeveloperName && !m.suspended;
|
|
11634
11669
|
const key = `${mk}:${m.marketDeveloperName}`;
|
|
@@ -11679,7 +11714,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11679
11714
|
}
|
|
11680
11715
|
|
|
11681
11716
|
// src/components/MonitorFormH2H.tsx
|
|
11682
|
-
var
|
|
11717
|
+
var import_react80 = require("react");
|
|
11683
11718
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11684
11719
|
function resultClass2(result) {
|
|
11685
11720
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -11695,7 +11730,7 @@ function FormDots({ form, ui }) {
|
|
|
11695
11730
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
11696
11731
|
}
|
|
11697
11732
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
11698
|
-
const [expanded, setExpanded] = (0,
|
|
11733
|
+
const [expanded, setExpanded] = (0, import_react80.useState)(false);
|
|
11699
11734
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
11700
11735
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
11701
11736
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, {});
|
|
@@ -11773,10 +11808,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
|
11773
11808
|
}
|
|
11774
11809
|
|
|
11775
11810
|
// src/components/CompLogo.tsx
|
|
11776
|
-
var
|
|
11811
|
+
var import_react81 = require("react");
|
|
11777
11812
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11778
11813
|
function CompLogo({ url }) {
|
|
11779
|
-
const [failed, setFailed] = (0,
|
|
11814
|
+
const [failed, setFailed] = (0, import_react81.useState)(null);
|
|
11780
11815
|
if (!url || failed === url) return null;
|
|
11781
11816
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
|
|
11782
11817
|
}
|
|
@@ -11934,7 +11969,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11934
11969
|
}
|
|
11935
11970
|
|
|
11936
11971
|
// src/components/NbaMonitorCard.tsx
|
|
11937
|
-
var
|
|
11972
|
+
var import_react85 = require("react");
|
|
11938
11973
|
|
|
11939
11974
|
// src/sportLabel.ts
|
|
11940
11975
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -11944,7 +11979,7 @@ var sportLabel = (ui, sport) => {
|
|
|
11944
11979
|
};
|
|
11945
11980
|
|
|
11946
11981
|
// src/components/NbaFormSection.tsx
|
|
11947
|
-
var
|
|
11982
|
+
var import_react82 = require("react");
|
|
11948
11983
|
|
|
11949
11984
|
// src/components/NbaFormRest.tsx
|
|
11950
11985
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
@@ -12044,8 +12079,8 @@ function Row3({ game, abbr, tonight, ui }) {
|
|
|
12044
12079
|
] });
|
|
12045
12080
|
}
|
|
12046
12081
|
function NbaFormSection({ match, monitor, ui }) {
|
|
12047
|
-
const [open, setOpen] = (0,
|
|
12048
|
-
const [side, setSide] = (0,
|
|
12082
|
+
const [open, setOpen] = (0, import_react82.useState)(false);
|
|
12083
|
+
const [side, setSide] = (0, import_react82.useState)("away");
|
|
12049
12084
|
const form = useNbaForm(match, monitor);
|
|
12050
12085
|
const b = match.basketball;
|
|
12051
12086
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -12090,10 +12125,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
12090
12125
|
}
|
|
12091
12126
|
|
|
12092
12127
|
// src/components/NbaPropsSection.tsx
|
|
12093
|
-
var
|
|
12128
|
+
var import_react84 = require("react");
|
|
12094
12129
|
|
|
12095
12130
|
// src/components/PropsPieces.tsx
|
|
12096
|
-
var
|
|
12131
|
+
var import_react83 = require("react");
|
|
12097
12132
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
12098
12133
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
12099
12134
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -12106,9 +12141,9 @@ function preKickoff(match) {
|
|
|
12106
12141
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
12107
12142
|
}
|
|
12108
12143
|
function usePreKickoff(match) {
|
|
12109
|
-
const [, setTick] = (0,
|
|
12144
|
+
const [, setTick] = (0, import_react83.useState)(0);
|
|
12110
12145
|
const pre = preKickoff(match);
|
|
12111
|
-
(0,
|
|
12146
|
+
(0, import_react83.useEffect)(() => {
|
|
12112
12147
|
if (!pre || !match.kickoffUtc) return;
|
|
12113
12148
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
12114
12149
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -12122,7 +12157,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
12122
12157
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
12123
12158
|
const live = match.phase === "live";
|
|
12124
12159
|
const open = pre || live;
|
|
12125
|
-
(0,
|
|
12160
|
+
(0, import_react83.useEffect)(() => {
|
|
12126
12161
|
if (!open) return;
|
|
12127
12162
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
12128
12163
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -12200,7 +12235,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
12200
12235
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
12201
12236
|
const player = livePlayer(bundle, given);
|
|
12202
12237
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
12203
|
-
const [picked, setPicked] = (0,
|
|
12238
|
+
const [picked, setPicked] = (0, import_react83.useState)(null);
|
|
12204
12239
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
12205
12240
|
const sample = active?.games?.length ?? 0;
|
|
12206
12241
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -12249,8 +12284,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
12249
12284
|
] });
|
|
12250
12285
|
}
|
|
12251
12286
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
12252
|
-
const [openId, setOpenId] = (0,
|
|
12253
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
12287
|
+
const [openId, setOpenId] = (0, import_react83.useState)(null);
|
|
12288
|
+
const [brokenShots, setBrokenShots] = (0, import_react83.useState)(/* @__PURE__ */ new Set());
|
|
12254
12289
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
12255
12290
|
const p = livePlayer(bundle, given);
|
|
12256
12291
|
const isOpen = openId === p.playerId;
|
|
@@ -12296,12 +12331,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
12296
12331
|
}
|
|
12297
12332
|
var BOX_QUIET_MS = 12e4;
|
|
12298
12333
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
12299
|
-
const [tick, setTick] = (0,
|
|
12334
|
+
const [tick, setTick] = (0, import_react83.useState)(0);
|
|
12300
12335
|
const time = clock2(boxAsOfUtc, ui);
|
|
12301
12336
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
12302
12337
|
const valid = !Number.isNaN(at2);
|
|
12303
12338
|
const onBreak = atBreak(match);
|
|
12304
|
-
(0,
|
|
12339
|
+
(0, import_react83.useEffect)(() => {
|
|
12305
12340
|
if (!valid || onBreak) return;
|
|
12306
12341
|
const age2 = Date.now() - at2;
|
|
12307
12342
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12362,12 +12397,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
12362
12397
|
tenGameBars: false
|
|
12363
12398
|
});
|
|
12364
12399
|
function StatsClock2({ bundle, match, ui }) {
|
|
12365
|
-
const [tick, setTick] = (0,
|
|
12400
|
+
const [tick, setTick] = (0, import_react84.useState)(0);
|
|
12366
12401
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
12367
12402
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
12368
12403
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
12369
12404
|
const onBreak = atBreak(match);
|
|
12370
|
-
(0,
|
|
12405
|
+
(0, import_react84.useEffect)(() => {
|
|
12371
12406
|
if (!valid || onBreak) return;
|
|
12372
12407
|
const age2 = Date.now() - at2;
|
|
12373
12408
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12381,7 +12416,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
12381
12416
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
12382
12417
|
}
|
|
12383
12418
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
12384
|
-
const [side, setSide] = (0,
|
|
12419
|
+
const [side, setSide] = (0, import_react84.useState)("home");
|
|
12385
12420
|
const descriptor = nbaDescriptor(ui, match);
|
|
12386
12421
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12387
12422
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12419,7 +12454,7 @@ function city(teamName, nickname) {
|
|
|
12419
12454
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
12420
12455
|
}
|
|
12421
12456
|
function BadgeCrest({ url, abbreviation }) {
|
|
12422
|
-
const [failed, setFailed] = (0,
|
|
12457
|
+
const [failed, setFailed] = (0, import_react85.useState)(false);
|
|
12423
12458
|
if (url && !failed) {
|
|
12424
12459
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
12425
12460
|
}
|
|
@@ -12554,7 +12589,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12554
12589
|
}
|
|
12555
12590
|
|
|
12556
12591
|
// src/components/NflFormSection.tsx
|
|
12557
|
-
var
|
|
12592
|
+
var import_react86 = require("react");
|
|
12558
12593
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12559
12594
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
12560
12595
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -12607,7 +12642,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
12607
12642
|
] });
|
|
12608
12643
|
}
|
|
12609
12644
|
function NflFormSection({ match, monitor, ui }) {
|
|
12610
|
-
const [segment, setSegment] = (0,
|
|
12645
|
+
const [segment, setSegment] = (0, import_react86.useState)("away");
|
|
12611
12646
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
12612
12647
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
12613
12648
|
const form = bundle?.form;
|
|
@@ -12640,7 +12675,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
12640
12675
|
}
|
|
12641
12676
|
|
|
12642
12677
|
// src/components/NflPropsSection.tsx
|
|
12643
|
-
var
|
|
12678
|
+
var import_react87 = require("react");
|
|
12644
12679
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12645
12680
|
var TRENDS_SHOWN = 3;
|
|
12646
12681
|
var SCORERS_SHOWN = 8;
|
|
@@ -12713,7 +12748,7 @@ function ShowMore({ label, onClick }) {
|
|
|
12713
12748
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
12714
12749
|
}
|
|
12715
12750
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
12716
|
-
const [all, setAll] = (0,
|
|
12751
|
+
const [all, setAll] = (0, import_react87.useState)(false);
|
|
12717
12752
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
12718
12753
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
12719
12754
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -12746,7 +12781,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
12746
12781
|
] });
|
|
12747
12782
|
}
|
|
12748
12783
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
12749
|
-
const [all, setAll] = (0,
|
|
12784
|
+
const [all, setAll] = (0, import_react87.useState)(false);
|
|
12750
12785
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
12751
12786
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
12752
12787
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -12776,7 +12811,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
12776
12811
|
] });
|
|
12777
12812
|
}
|
|
12778
12813
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
12779
|
-
const [tab, setTab] = (0,
|
|
12814
|
+
const [tab, setTab] = (0, import_react87.useState)(null);
|
|
12780
12815
|
const descriptor = nflDescriptor(ui);
|
|
12781
12816
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12782
12817
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12976,15 +13011,15 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12976
13011
|
}
|
|
12977
13012
|
|
|
12978
13013
|
// src/components/TennisMonitorCard.tsx
|
|
12979
|
-
var
|
|
12980
|
-
var
|
|
13014
|
+
var import_react90 = require("react");
|
|
13015
|
+
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12981
13016
|
|
|
12982
13017
|
// src/components/TennisFixtureRow.tsx
|
|
12983
|
-
var
|
|
13018
|
+
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
12984
13019
|
|
|
12985
13020
|
// src/components/FixtureRow.tsx
|
|
12986
|
-
var
|
|
12987
|
-
var
|
|
13021
|
+
var import_react88 = require("react");
|
|
13022
|
+
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
12988
13023
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12989
13024
|
function splitAtFirstSpace(label) {
|
|
12990
13025
|
const i = label.indexOf(" ");
|
|
@@ -12997,7 +13032,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
12997
13032
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
12998
13033
|
}
|
|
12999
13034
|
function Side2({ name, crest, abbr, away = false }) {
|
|
13000
|
-
const [failed, setFailed] = (0,
|
|
13035
|
+
const [failed, setFailed] = (0, import_react88.useState)(false);
|
|
13001
13036
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
13002
13037
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
13003
13038
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -13015,7 +13050,7 @@ function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
|
|
|
13015
13050
|
const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
|
|
13016
13051
|
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
|
|
13017
13052
|
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
13018
|
-
const pinSport = (0,
|
|
13053
|
+
const pinSport = (0, import_widget_sdk25.slipSportOf)(match.sport);
|
|
13019
13054
|
const liveTone = isLive || state?.isHalfTime;
|
|
13020
13055
|
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
13021
13056
|
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date(), ui.timeZone) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short", timeZone: ui.timeZone }) : null;
|
|
@@ -13166,7 +13201,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
|
|
|
13166
13201
|
const live = isTreatedLive(state, stale);
|
|
13167
13202
|
const round = match.round ? ui.tennis.round[match.round] ?? match.round : null;
|
|
13168
13203
|
const showPrices = !live && prices !== void 0 && prices.byId !== null && !prices.stale;
|
|
13169
|
-
const entry = showPrices ? isKnownTour(match.tour) ? prices.byId.get((0,
|
|
13204
|
+
const entry = showPrices ? isKnownTour(match.tour) ? prices.byId.get((0, import_widget_sdk26.matchKey)("tennis", match.matchId, match.tour)) : void 0 : void 0;
|
|
13170
13205
|
const pin = isKnownTour(match.tour) ? { kind: "match", matchId: match.matchId, sport: "tennis", tour: match.tour } : null;
|
|
13171
13206
|
const pinned = !!monitor && !!pin && monitor.isPinned(pinKey(pin));
|
|
13172
13207
|
const pinnable = !!monitor?.enabled && !!pin;
|
|
@@ -13239,7 +13274,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
13239
13274
|
}
|
|
13240
13275
|
|
|
13241
13276
|
// src/components/TennisStatsTables.tsx
|
|
13242
|
-
var
|
|
13277
|
+
var import_react89 = require("react");
|
|
13243
13278
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13244
13279
|
function formatStat(row, value, locale) {
|
|
13245
13280
|
if (value == null) return "\u2013";
|
|
@@ -13277,8 +13312,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
13277
13312
|
] });
|
|
13278
13313
|
}
|
|
13279
13314
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
13280
|
-
const [tab, setTab] = (0,
|
|
13281
|
-
(0,
|
|
13315
|
+
const [tab, setTab] = (0, import_react89.useState)("match");
|
|
13316
|
+
(0, import_react89.useEffect)(() => {
|
|
13282
13317
|
setTab("match");
|
|
13283
13318
|
}, [resetKey]);
|
|
13284
13319
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -13309,7 +13344,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
13309
13344
|
] }),
|
|
13310
13345
|
today.rows.map((r) => {
|
|
13311
13346
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
13312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
13347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_react89.Fragment, { children: [
|
|
13313
13348
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
13314
13349
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
13315
13350
|
f(r.p1Today),
|
|
@@ -13444,7 +13479,7 @@ function HeadToHead({ t, ui }) {
|
|
|
13444
13479
|
] });
|
|
13445
13480
|
}
|
|
13446
13481
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
13447
|
-
const lastTables = (0,
|
|
13482
|
+
const lastTables = (0, import_react90.useRef)(null);
|
|
13448
13483
|
const t = match.tennis;
|
|
13449
13484
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
13450
13485
|
const preMatch = match.phase === "preMatch";
|
|
@@ -13466,7 +13501,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13466
13501
|
const surface = t.header.surface ? surfaceLabel(ui, t.header.surface) : null;
|
|
13467
13502
|
const ask = () => {
|
|
13468
13503
|
if (!onAsk) return;
|
|
13469
|
-
const wire = (0,
|
|
13504
|
+
const wire = (0, import_widget_sdk27.toWireSport)("tennis");
|
|
13470
13505
|
const grounding = {
|
|
13471
13506
|
kind: "match",
|
|
13472
13507
|
subject: `${t.p1.name} ${ui.tennis.vs} ${t.p2.name}`,
|
|
@@ -13524,8 +13559,8 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13524
13559
|
}
|
|
13525
13560
|
|
|
13526
13561
|
// src/components/ScoreboardStrip.tsx
|
|
13527
|
-
var
|
|
13528
|
-
var
|
|
13562
|
+
var import_react91 = require("react");
|
|
13563
|
+
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
13529
13564
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13530
13565
|
function nbaStatus(m, ui) {
|
|
13531
13566
|
const b = m.basketball;
|
|
@@ -13619,8 +13654,8 @@ function rowsFor(m) {
|
|
|
13619
13654
|
];
|
|
13620
13655
|
}
|
|
13621
13656
|
function useStripScroll(selectedKey) {
|
|
13622
|
-
const stripRef = (0,
|
|
13623
|
-
(0,
|
|
13657
|
+
const stripRef = (0, import_react91.useRef)(null);
|
|
13658
|
+
(0, import_react91.useEffect)(() => {
|
|
13624
13659
|
const strip = stripRef.current;
|
|
13625
13660
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
13626
13661
|
if (!strip || !pressed) return;
|
|
@@ -13637,7 +13672,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13637
13672
|
const m = tile.match;
|
|
13638
13673
|
if (!m) return null;
|
|
13639
13674
|
const nba = isBasketball(m);
|
|
13640
|
-
const sport = (0,
|
|
13675
|
+
const sport = (0, import_widget_sdk28.sportOf)(m.sport);
|
|
13641
13676
|
const inPlay = m.phase === "live" && !atBreak(m) && !(isAmericanFootball(m) && m.americanFootball?.period == null);
|
|
13642
13677
|
const status2 = nba ? nbaStatus(m, ui) : isTennis(m) ? tennisStatus(m, ui) : isAmericanFootball(m) ? nflStatus(m, ui) : footballStatus(m, ui);
|
|
13643
13678
|
const selected = tile.pin.key === selectedKey;
|
|
@@ -13667,7 +13702,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13667
13702
|
}
|
|
13668
13703
|
|
|
13669
13704
|
// src/components/TrendsStrip.tsx
|
|
13670
|
-
var
|
|
13705
|
+
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
13671
13706
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13672
13707
|
function status(m, ui) {
|
|
13673
13708
|
if (m.isSettled || m.phase === "fullTime") return ui.fullTimeLabel;
|
|
@@ -13683,7 +13718,7 @@ function TrendTileButton({ tile, selected, onSelect, ui }) {
|
|
|
13683
13718
|
const { oddsFormat } = useOddsSettings();
|
|
13684
13719
|
const { market: m, vm } = tile;
|
|
13685
13720
|
const inPlay = m.phase === "live" && !m.isSuspended && !m.isSettled;
|
|
13686
|
-
const sport = (0,
|
|
13721
|
+
const sport = (0, import_widget_sdk29.sportOf)(m.card?.sport ?? void 0);
|
|
13687
13722
|
const home = vm?.homeTeamName ?? m.homeTeamName ?? "";
|
|
13688
13723
|
const away = vm?.awayTeamName ?? m.awayTeamName ?? "";
|
|
13689
13724
|
const score = m.phase !== "preMatch" && typeof m.homeScore === "number" ? `${m.homeScore}\u2013${m.awayScore ?? 0}` : null;
|
|
@@ -13725,21 +13760,21 @@ function TrendsStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13725
13760
|
}
|
|
13726
13761
|
|
|
13727
13762
|
// src/monitorSeed.ts
|
|
13728
|
-
var
|
|
13763
|
+
var import_widget_sdk30 = require("@sensiblestats/widget-sdk");
|
|
13729
13764
|
function buildSeedIndex(groups) {
|
|
13730
13765
|
const index = /* @__PURE__ */ new Map();
|
|
13731
13766
|
for (const group of groups) {
|
|
13732
13767
|
for (const match of group.matches) {
|
|
13733
13768
|
const sport = match.sport ?? group.sport ?? "football";
|
|
13734
13769
|
if (sport !== "football") continue;
|
|
13735
|
-
index.set((0,
|
|
13770
|
+
index.set((0, import_widget_sdk30.matchKey)("football", match.matchId), { match, competitionName: group.competitionName });
|
|
13736
13771
|
}
|
|
13737
13772
|
}
|
|
13738
13773
|
return index;
|
|
13739
13774
|
}
|
|
13740
13775
|
function seedFor(pin, index, states, stale, now) {
|
|
13741
13776
|
if (pin.kind !== "match" || pin.sport !== void 0) return void 0;
|
|
13742
|
-
const key = (0,
|
|
13777
|
+
const key = (0, import_widget_sdk30.matchKey)("football", pin.matchId);
|
|
13743
13778
|
const hit = index.get(key);
|
|
13744
13779
|
if (!hit) return void 0;
|
|
13745
13780
|
const { match, competitionName } = hit;
|
|
@@ -13794,7 +13829,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
13794
13829
|
] });
|
|
13795
13830
|
}
|
|
13796
13831
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
13797
|
-
const seedIndex = (0,
|
|
13832
|
+
const seedIndex = (0, import_react92.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
13798
13833
|
const tiles = orderTiles(
|
|
13799
13834
|
monitor.pins,
|
|
13800
13835
|
monitor.snapshot,
|
|
@@ -13866,11 +13901,11 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
13866
13901
|
}
|
|
13867
13902
|
|
|
13868
13903
|
// src/components/LivePanel.tsx
|
|
13869
|
-
var
|
|
13870
|
-
var
|
|
13904
|
+
var import_react95 = require("react");
|
|
13905
|
+
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
13871
13906
|
|
|
13872
13907
|
// src/scheduleView.ts
|
|
13873
|
-
var
|
|
13908
|
+
var import_widget_sdk31 = require("@sensiblestats/widget-sdk");
|
|
13874
13909
|
|
|
13875
13910
|
// src/search.ts
|
|
13876
13911
|
function foldSearchText(s) {
|
|
@@ -13890,7 +13925,7 @@ function matchingFixtures(group, query) {
|
|
|
13890
13925
|
|
|
13891
13926
|
// src/scheduleView.ts
|
|
13892
13927
|
var TOP_COUNT = 3;
|
|
13893
|
-
var keyOf3 = (m) => (0,
|
|
13928
|
+
var keyOf3 = (m) => (0, import_widget_sdk31.matchKey)(m.sport, m.matchId, m.tour);
|
|
13894
13929
|
var sportOf13 = (g) => g.sport ?? "football";
|
|
13895
13930
|
function isMember(group, pinnedKeys) {
|
|
13896
13931
|
return group.isStarred || group.isLearned || group.matches.some((m) => pinnedKeys.has(keyOf3(m)));
|
|
@@ -13960,7 +13995,7 @@ function liveCountsBySport(groups, states, stale) {
|
|
|
13960
13995
|
}
|
|
13961
13996
|
|
|
13962
13997
|
// src/components/LeagueGroup.tsx
|
|
13963
|
-
var
|
|
13998
|
+
var import_widget_sdk32 = require("@sensiblestats/widget-sdk");
|
|
13964
13999
|
|
|
13965
14000
|
// src/components/ScheduleRow.tsx
|
|
13966
14001
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
@@ -14025,7 +14060,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14025
14060
|
ScheduleRow,
|
|
14026
14061
|
{
|
|
14027
14062
|
match: m,
|
|
14028
|
-
state: states.get((0,
|
|
14063
|
+
state: states.get((0, import_widget_sdk32.matchKey)(m.sport, m.matchId, m.tour)),
|
|
14029
14064
|
stale,
|
|
14030
14065
|
ui,
|
|
14031
14066
|
monitor,
|
|
@@ -14033,7 +14068,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14033
14068
|
slip,
|
|
14034
14069
|
onOpen: (el) => onOpenMatch(m, group.competitionName, el)
|
|
14035
14070
|
},
|
|
14036
|
-
(0,
|
|
14071
|
+
(0, import_widget_sdk32.matchKey)(m.sport, m.matchId, m.tour)
|
|
14037
14072
|
)),
|
|
14038
14073
|
hidden > 0 && onShowAll && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("button", { type: "button", className: "ss-w-lg-showall", onClick: onShowAll, children: ui.showAllN(rows.length) })
|
|
14039
14074
|
] })
|
|
@@ -14041,20 +14076,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14041
14076
|
}
|
|
14042
14077
|
|
|
14043
14078
|
// src/components/MatchSheet.tsx
|
|
14044
|
-
var
|
|
14045
|
-
var
|
|
14079
|
+
var import_react94 = require("react");
|
|
14080
|
+
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
14046
14081
|
|
|
14047
14082
|
// src/useModalDialog.ts
|
|
14048
|
-
var
|
|
14083
|
+
var import_react93 = require("react");
|
|
14049
14084
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
14050
14085
|
function useModalDialog(onClose, opts = {}) {
|
|
14051
|
-
const dialogRef = (0,
|
|
14052
|
-
const onCloseRef = (0,
|
|
14086
|
+
const dialogRef = (0, import_react93.useRef)(null);
|
|
14087
|
+
const onCloseRef = (0, import_react93.useRef)(onClose);
|
|
14053
14088
|
onCloseRef.current = onClose;
|
|
14054
|
-
const openerRef = (0,
|
|
14089
|
+
const openerRef = (0, import_react93.useRef)(opts.opener);
|
|
14055
14090
|
openerRef.current = opts.opener;
|
|
14056
14091
|
const restore = opts.restoreFocus ?? true;
|
|
14057
|
-
(0,
|
|
14092
|
+
(0, import_react93.useEffect)(() => {
|
|
14058
14093
|
const dialog = dialogRef.current;
|
|
14059
14094
|
const root = dialog?.getRootNode();
|
|
14060
14095
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -14065,7 +14100,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
14065
14100
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
14066
14101
|
};
|
|
14067
14102
|
}, []);
|
|
14068
|
-
(0,
|
|
14103
|
+
(0, import_react93.useEffect)(() => {
|
|
14069
14104
|
const onKey = (e) => {
|
|
14070
14105
|
if (e.key !== "Escape") return;
|
|
14071
14106
|
e.stopPropagation();
|
|
@@ -14106,9 +14141,9 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
14106
14141
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
14107
14142
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
14108
14143
|
const log = useEventLog();
|
|
14109
|
-
const titleId = (0,
|
|
14110
|
-
const [limitHit, setLimitHit] = (0,
|
|
14111
|
-
const pinSport = (0,
|
|
14144
|
+
const titleId = (0, import_react94.useId)();
|
|
14145
|
+
const [limitHit, setLimitHit] = (0, import_react94.useState)(false);
|
|
14146
|
+
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
14112
14147
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14113
14148
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
14114
14149
|
const pinned = followable && monitor.isPinned(pinKey(pinSport ? { kind: "match", matchId: match.matchId, sport: pinSport, ...tour ? { tour } : {} } : { kind: "match", matchId: match.matchId }));
|
|
@@ -14129,11 +14164,11 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14129
14164
|
return;
|
|
14130
14165
|
}
|
|
14131
14166
|
if (result === "added") {
|
|
14132
|
-
const wireSport = (0,
|
|
14167
|
+
const wireSport = (0, import_widget_sdk33.toWireSport)(pinSport);
|
|
14133
14168
|
log?.log({
|
|
14134
14169
|
name: "pin_add",
|
|
14135
14170
|
entityType: "match",
|
|
14136
|
-
entityId: (0,
|
|
14171
|
+
entityId: (0, import_widget_sdk33.qualifiedId)(pinSport, "game", (0, import_widget_sdk33.localIdOf)(pinSport, match.matchId, tour)),
|
|
14137
14172
|
...wireSport ? { sport: wireSport } : {}
|
|
14138
14173
|
});
|
|
14139
14174
|
}
|
|
@@ -14141,7 +14176,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14141
14176
|
};
|
|
14142
14177
|
const ask = () => {
|
|
14143
14178
|
if (!onAsk) return;
|
|
14144
|
-
const wire = (0,
|
|
14179
|
+
const wire = (0, import_widget_sdk33.toWireSport)(match.sport);
|
|
14145
14180
|
const grounding = {
|
|
14146
14181
|
kind: treatedLive ? "liveFact" : "match",
|
|
14147
14182
|
...pinSport === "tennis" ? {} : { matchId: match.matchId },
|
|
@@ -14177,7 +14212,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14177
14212
|
}
|
|
14178
14213
|
|
|
14179
14214
|
// src/components/SportChips.tsx
|
|
14180
|
-
var
|
|
14215
|
+
var import_widget_sdk34 = require("@sensiblestats/widget-sdk");
|
|
14181
14216
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
14182
14217
|
var ORDER2 = ["football", "basketball", "americanfootball", "tennis"];
|
|
14183
14218
|
function SportChips({ offered, value, onChange, counts, ui }) {
|
|
@@ -14208,11 +14243,11 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
14208
14243
|
var QUIET_ROWS = 4;
|
|
14209
14244
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
14210
14245
|
const { groups, states, stale } = discovery;
|
|
14211
|
-
const [mine, setMine] = (0,
|
|
14212
|
-
const [toggled, setToggled] = (0,
|
|
14213
|
-
const [sheet, setSheet] = (0,
|
|
14214
|
-
const pinnedKeys = (0,
|
|
14215
|
-
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0,
|
|
14246
|
+
const [mine, setMine] = (0, import_react95.useState)(false);
|
|
14247
|
+
const [toggled, setToggled] = (0, import_react95.useState)(/* @__PURE__ */ new Map());
|
|
14248
|
+
const [sheet, setSheet] = (0, import_react95.useState)(null);
|
|
14249
|
+
const pinnedKeys = (0, import_react95.useMemo)(
|
|
14250
|
+
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14216
14251
|
[monitor.pins]
|
|
14217
14252
|
);
|
|
14218
14253
|
const counts = liveCountsBySport(groups, states, stale);
|
|
@@ -14288,14 +14323,14 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14288
14323
|
ScheduleRow,
|
|
14289
14324
|
{
|
|
14290
14325
|
match,
|
|
14291
|
-
state: states.get((0,
|
|
14326
|
+
state: states.get((0, import_widget_sdk35.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14292
14327
|
stale,
|
|
14293
14328
|
ui,
|
|
14294
14329
|
monitor,
|
|
14295
14330
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14296
14331
|
}
|
|
14297
14332
|
)
|
|
14298
|
-
] }, (0,
|
|
14333
|
+
] }, (0, import_widget_sdk35.matchKey)(match.sport, match.matchId, match.tour))),
|
|
14299
14334
|
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("button", { type: "button", className: "ss-w-lp-seeall", onClick: onSeeAll, children: ui.seeAllMatches })
|
|
14300
14335
|
] })
|
|
14301
14336
|
] }),
|
|
@@ -14304,7 +14339,7 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14304
14339
|
{
|
|
14305
14340
|
match: sheet.match,
|
|
14306
14341
|
league: sheet.league,
|
|
14307
|
-
state: states.get((0,
|
|
14342
|
+
state: states.get((0, import_widget_sdk35.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14308
14343
|
stale,
|
|
14309
14344
|
ui,
|
|
14310
14345
|
monitor,
|
|
@@ -14317,20 +14352,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14317
14352
|
}
|
|
14318
14353
|
|
|
14319
14354
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14320
|
-
var
|
|
14321
|
-
var
|
|
14355
|
+
var import_react99 = require("react");
|
|
14356
|
+
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14322
14357
|
|
|
14323
14358
|
// src/useTennisRowPrices.ts
|
|
14324
|
-
var
|
|
14325
|
-
var
|
|
14359
|
+
var import_react96 = require("react");
|
|
14360
|
+
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
14326
14361
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14327
14362
|
function useTennisRowPrices(a) {
|
|
14328
|
-
const [state, setState] = (0,
|
|
14329
|
-
const getPricesRef = (0,
|
|
14363
|
+
const [state, setState] = (0, import_react96.useState)({ byId: null, stale: false });
|
|
14364
|
+
const getPricesRef = (0, import_react96.useRef)(a.getPrices);
|
|
14330
14365
|
getPricesRef.current = a.getPrices;
|
|
14331
|
-
const latest = (0,
|
|
14366
|
+
const latest = (0, import_react96.useRef)(0);
|
|
14332
14367
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
14333
|
-
(0,
|
|
14368
|
+
(0, import_react96.useEffect)(() => {
|
|
14334
14369
|
if (!a.enabled || idsKey === "") {
|
|
14335
14370
|
latest.current++;
|
|
14336
14371
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -14349,7 +14384,7 @@ function useTennisRowPrices(a) {
|
|
|
14349
14384
|
setState({ byId: null, stale: false });
|
|
14350
14385
|
return;
|
|
14351
14386
|
}
|
|
14352
|
-
setState({ byId: new Map(rows.map((r) => [(0,
|
|
14387
|
+
setState({ byId: new Map(rows.map((r) => [(0, import_widget_sdk36.matchKey)("tennis", r.matchId, r.tour), r.price ?? null])), stale: false });
|
|
14353
14388
|
},
|
|
14354
14389
|
() => {
|
|
14355
14390
|
if (mine !== latest.current) return;
|
|
@@ -14368,11 +14403,11 @@ function useTennisRowPrices(a) {
|
|
|
14368
14403
|
}
|
|
14369
14404
|
|
|
14370
14405
|
// src/components/DayStrip.tsx
|
|
14371
|
-
var
|
|
14406
|
+
var import_react97 = require("react");
|
|
14372
14407
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14373
14408
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
14374
|
-
const listRef = (0,
|
|
14375
|
-
(0,
|
|
14409
|
+
const listRef = (0, import_react97.useRef)(null);
|
|
14410
|
+
(0, import_react97.useEffect)(() => {
|
|
14376
14411
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
14377
14412
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
14378
14413
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -14401,7 +14436,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
14401
14436
|
}
|
|
14402
14437
|
|
|
14403
14438
|
// src/components/games/ui/SearchField.tsx
|
|
14404
|
-
var
|
|
14439
|
+
var import_react98 = require("react");
|
|
14405
14440
|
|
|
14406
14441
|
// src/components/games/ui/icons.tsx
|
|
14407
14442
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
@@ -14440,8 +14475,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
14440
14475
|
// src/components/games/ui/SearchField.tsx
|
|
14441
14476
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
14442
14477
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
14443
|
-
const localRef = (0,
|
|
14444
|
-
const setInputRef = (0,
|
|
14478
|
+
const localRef = (0, import_react98.useRef)(null);
|
|
14479
|
+
const setInputRef = (0, import_react98.useCallback)((node) => {
|
|
14445
14480
|
localRef.current = node;
|
|
14446
14481
|
if (typeof inputRef === "function") inputRef(node);
|
|
14447
14482
|
else if (inputRef) inputRef.current = node;
|
|
@@ -14487,19 +14522,19 @@ var TOP_ROW_CAP = 3;
|
|
|
14487
14522
|
var SKELETON_ROWS = 3;
|
|
14488
14523
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
14489
14524
|
const { localDate: today, states, stale } = discovery;
|
|
14490
|
-
const searchId = (0,
|
|
14491
|
-
const [query, setQuery] = (0,
|
|
14492
|
-
const [toggled, setToggled] = (0,
|
|
14493
|
-
const [expanded, setExpanded] = (0,
|
|
14494
|
-
const listRef = (0,
|
|
14495
|
-
const [sheet, setSheet] = (0,
|
|
14525
|
+
const searchId = (0, import_react99.useId)();
|
|
14526
|
+
const [query, setQuery] = (0, import_react99.useState)("");
|
|
14527
|
+
const [toggled, setToggled] = (0, import_react99.useState)(/* @__PURE__ */ new Map());
|
|
14528
|
+
const [expanded, setExpanded] = (0, import_react99.useState)(/* @__PURE__ */ new Set());
|
|
14529
|
+
const listRef = (0, import_react99.useRef)(null);
|
|
14530
|
+
const [sheet, setSheet] = (0, import_react99.useState)(null);
|
|
14496
14531
|
const { chips, selected } = loaded;
|
|
14497
|
-
(0,
|
|
14532
|
+
(0, import_react99.useEffect)(() => {
|
|
14498
14533
|
if (selected !== day) onDay(selected);
|
|
14499
14534
|
}, [day, selected, onDay]);
|
|
14500
14535
|
const isToday = selected === today;
|
|
14501
|
-
const pinnedKeys = (0,
|
|
14502
|
-
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0,
|
|
14536
|
+
const pinnedKeys = (0, import_react99.useMemo)(
|
|
14537
|
+
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14503
14538
|
[monitor.pins]
|
|
14504
14539
|
);
|
|
14505
14540
|
const searching = query.trim().length > 0;
|
|
@@ -14519,7 +14554,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14519
14554
|
const { oddsOffered } = useOddsSettings();
|
|
14520
14555
|
const tennisKeys = /* @__PURE__ */ new Map();
|
|
14521
14556
|
const addTennis = (m) => {
|
|
14522
|
-
if (m.sport === "tennis" && isKnownTour(m.tour)) tennisKeys.set((0,
|
|
14557
|
+
if (m.sport === "tennis" && isKnownTour(m.tour)) tennisKeys.set((0, import_widget_sdk37.matchKey)("tennis", m.matchId, m.tour), { tour: m.tour, matchId: m.matchId });
|
|
14523
14558
|
};
|
|
14524
14559
|
for (const s of priced.sections) for (const v of s.groups) for (const m of v.rows) addTennis(m);
|
|
14525
14560
|
for (const { match } of priced.afterMidnight) addTennis(match);
|
|
@@ -14605,7 +14640,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14605
14640
|
ScheduleRow,
|
|
14606
14641
|
{
|
|
14607
14642
|
match,
|
|
14608
|
-
state: states.get((0,
|
|
14643
|
+
state: states.get((0, import_widget_sdk37.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14609
14644
|
stale,
|
|
14610
14645
|
ui,
|
|
14611
14646
|
monitor,
|
|
@@ -14614,7 +14649,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14614
14649
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14615
14650
|
}
|
|
14616
14651
|
)
|
|
14617
|
-
] }, (0,
|
|
14652
|
+
] }, (0, import_widget_sdk37.matchKey)(match.sport, match.matchId, match.tour)))
|
|
14618
14653
|
] }),
|
|
14619
14654
|
empty2 && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "ss-w-today-empty", children: searching ? ui.noLeagueResults : ui.noMatchesDay })
|
|
14620
14655
|
] }),
|
|
@@ -14623,7 +14658,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14623
14658
|
{
|
|
14624
14659
|
match: sheet.match,
|
|
14625
14660
|
league: sheet.league,
|
|
14626
|
-
state: states.get((0,
|
|
14661
|
+
state: states.get((0, import_widget_sdk37.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14627
14662
|
stale,
|
|
14628
14663
|
ui,
|
|
14629
14664
|
monitor,
|
|
@@ -14636,7 +14671,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14636
14671
|
}
|
|
14637
14672
|
|
|
14638
14673
|
// src/components/GamesPanel.tsx
|
|
14639
|
-
var
|
|
14674
|
+
var import_react114 = require("react");
|
|
14640
14675
|
|
|
14641
14676
|
// src/components/GamesLoginWall.tsx
|
|
14642
14677
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
@@ -14645,7 +14680,7 @@ function GamesLoginWall({ ui }) {
|
|
|
14645
14680
|
}
|
|
14646
14681
|
|
|
14647
14682
|
// src/components/GamesHub.tsx
|
|
14648
|
-
var
|
|
14683
|
+
var import_react100 = require("react");
|
|
14649
14684
|
|
|
14650
14685
|
// src/components/games/ui/gameMeta.ts
|
|
14651
14686
|
function prettifyGameId(gameId) {
|
|
@@ -14796,8 +14831,8 @@ function pickHeroGame(games) {
|
|
|
14796
14831
|
}
|
|
14797
14832
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14798
14833
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14799
|
-
const [, setTick] = (0,
|
|
14800
|
-
(0,
|
|
14834
|
+
const [, setTick] = (0, import_react100.useState)(0);
|
|
14835
|
+
(0, import_react100.useEffect)(() => {
|
|
14801
14836
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14802
14837
|
return () => clearInterval(id);
|
|
14803
14838
|
}, []);
|
|
@@ -14857,10 +14892,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14857
14892
|
}
|
|
14858
14893
|
|
|
14859
14894
|
// src/components/GameScreenHost.tsx
|
|
14860
|
-
var
|
|
14895
|
+
var import_react112 = require("react");
|
|
14861
14896
|
|
|
14862
14897
|
// src/useGamePlay.ts
|
|
14863
|
-
var
|
|
14898
|
+
var import_react101 = require("react");
|
|
14864
14899
|
function toSubmitResult(payload) {
|
|
14865
14900
|
return {
|
|
14866
14901
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14872,17 +14907,17 @@ function toSubmitResult(payload) {
|
|
|
14872
14907
|
};
|
|
14873
14908
|
}
|
|
14874
14909
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
14875
|
-
const [result, setResult] = (0,
|
|
14876
|
-
const [submitting, setSubmitting] = (0,
|
|
14877
|
-
const [rawStatus, setRawStatus] = (0,
|
|
14878
|
-
const inFlightRef = (0,
|
|
14879
|
-
const convRef = (0,
|
|
14910
|
+
const [result, setResult] = (0, import_react101.useState)(null);
|
|
14911
|
+
const [submitting, setSubmitting] = (0, import_react101.useState)(false);
|
|
14912
|
+
const [rawStatus, setRawStatus] = (0, import_react101.useState)(null);
|
|
14913
|
+
const inFlightRef = (0, import_react101.useRef)(false);
|
|
14914
|
+
const convRef = (0, import_react101.useRef)(conversation);
|
|
14880
14915
|
convRef.current = conversation;
|
|
14881
|
-
const optsRef = (0,
|
|
14916
|
+
const optsRef = (0, import_react101.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14882
14917
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14883
|
-
const resultRef = (0,
|
|
14918
|
+
const resultRef = (0, import_react101.useRef)(null);
|
|
14884
14919
|
resultRef.current = result;
|
|
14885
|
-
const refetch = (0,
|
|
14920
|
+
const refetch = (0, import_react101.useCallback)(async () => {
|
|
14886
14921
|
const conv = convRef.current;
|
|
14887
14922
|
if (!conv) return;
|
|
14888
14923
|
const opts = optsRef.current;
|
|
@@ -14898,7 +14933,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14898
14933
|
} catch {
|
|
14899
14934
|
}
|
|
14900
14935
|
}, []);
|
|
14901
|
-
const submit = (0,
|
|
14936
|
+
const submit = (0, import_react101.useCallback)(async (answerJson) => {
|
|
14902
14937
|
const conv = convRef.current;
|
|
14903
14938
|
if (!conv || inFlightRef.current) return;
|
|
14904
14939
|
inFlightRef.current = true;
|
|
@@ -14925,14 +14960,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14925
14960
|
setSubmitting(false);
|
|
14926
14961
|
}
|
|
14927
14962
|
}, [refetch]);
|
|
14928
|
-
const hydrate = (0,
|
|
14963
|
+
const hydrate = (0, import_react101.useCallback)(() => {
|
|
14929
14964
|
void refetch();
|
|
14930
14965
|
}, [refetch]);
|
|
14931
14966
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14932
14967
|
}
|
|
14933
14968
|
|
|
14934
14969
|
// src/components/games/MysteryTigerGame.tsx
|
|
14935
|
-
var
|
|
14970
|
+
var import_react103 = require("react");
|
|
14936
14971
|
|
|
14937
14972
|
// src/components/games/nationFlags.ts
|
|
14938
14973
|
var FLAGS = {
|
|
@@ -15143,7 +15178,7 @@ function isNationCode(flag) {
|
|
|
15143
15178
|
}
|
|
15144
15179
|
|
|
15145
15180
|
// src/components/games/PlayerAvatar.tsx
|
|
15146
|
-
var
|
|
15181
|
+
var import_react102 = require("react");
|
|
15147
15182
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
15148
15183
|
function initialsOf(name) {
|
|
15149
15184
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -15161,7 +15196,7 @@ function PlayerAvatar({
|
|
|
15161
15196
|
imagePath,
|
|
15162
15197
|
className
|
|
15163
15198
|
}) {
|
|
15164
|
-
const [failed, setFailed] = (0,
|
|
15199
|
+
const [failed, setFailed] = (0, import_react102.useState)(false);
|
|
15165
15200
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
15166
15201
|
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
15167
15202
|
}
|
|
@@ -15405,8 +15440,8 @@ function MysteryTigerGame({
|
|
|
15405
15440
|
onBack
|
|
15406
15441
|
}) {
|
|
15407
15442
|
const t = ui.games.mysteryTiger;
|
|
15408
|
-
const [query, setQuery] = (0,
|
|
15409
|
-
const inputId = (0,
|
|
15443
|
+
const [query, setQuery] = (0, import_react103.useState)("");
|
|
15444
|
+
const inputId = (0, import_react103.useId)();
|
|
15410
15445
|
const clientState = parseClientState(result?.clientStateJson);
|
|
15411
15446
|
const guessResults = clientState?.guessResults ?? [];
|
|
15412
15447
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -15667,13 +15702,13 @@ function HigherOrLowerGame({
|
|
|
15667
15702
|
}
|
|
15668
15703
|
|
|
15669
15704
|
// src/components/games/CareerPathGame.tsx
|
|
15670
|
-
var
|
|
15705
|
+
var import_react105 = require("react");
|
|
15671
15706
|
|
|
15672
15707
|
// src/components/games/ui/CrestShield.tsx
|
|
15673
|
-
var
|
|
15708
|
+
var import_react104 = require("react");
|
|
15674
15709
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15675
15710
|
function CrestShield({ src, name, size = 28 }) {
|
|
15676
|
-
const [failed, setFailed] = (0,
|
|
15711
|
+
const [failed, setFailed] = (0, import_react104.useState)(false);
|
|
15677
15712
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
15678
15713
|
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
15679
15714
|
}
|
|
@@ -15705,8 +15740,8 @@ function CareerPathGame({
|
|
|
15705
15740
|
}) {
|
|
15706
15741
|
const s = ui.games.careerPath;
|
|
15707
15742
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
15708
|
-
const [query, setQuery] = (0,
|
|
15709
|
-
const inputId = (0,
|
|
15743
|
+
const [query, setQuery] = (0, import_react105.useState)("");
|
|
15744
|
+
const inputId = (0, import_react105.useId)();
|
|
15710
15745
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
15711
15746
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
15712
15747
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -15812,7 +15847,7 @@ function CareerPathGame({
|
|
|
15812
15847
|
}
|
|
15813
15848
|
|
|
15814
15849
|
// src/components/games/BeatTheGridGame.tsx
|
|
15815
|
-
var
|
|
15850
|
+
var import_react106 = __toESM(require("react"), 1);
|
|
15816
15851
|
|
|
15817
15852
|
// src/components/games/ui/OptionList.tsx
|
|
15818
15853
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
@@ -15901,10 +15936,10 @@ function SearchSheet({
|
|
|
15901
15936
|
ui
|
|
15902
15937
|
}) {
|
|
15903
15938
|
const s = ui.games.beatTheGrid;
|
|
15904
|
-
const [query, setQuery] = (0,
|
|
15905
|
-
const inputId = (0,
|
|
15906
|
-
const inputRef = (0,
|
|
15907
|
-
(0,
|
|
15939
|
+
const [query, setQuery] = (0, import_react106.useState)("");
|
|
15940
|
+
const inputId = (0, import_react106.useId)();
|
|
15941
|
+
const inputRef = (0, import_react106.useRef)(null);
|
|
15942
|
+
(0, import_react106.useEffect)(() => {
|
|
15908
15943
|
inputRef.current?.focus();
|
|
15909
15944
|
}, [row, col]);
|
|
15910
15945
|
const filtered = playerPool.filter(
|
|
@@ -15969,7 +16004,7 @@ function BeatTheGridGame({
|
|
|
15969
16004
|
}) {
|
|
15970
16005
|
const s = ui.games.beatTheGrid;
|
|
15971
16006
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15972
|
-
const [activeCell, setActiveCell] = (0,
|
|
16007
|
+
const [activeCell, setActiveCell] = (0, import_react106.useState)(null);
|
|
15973
16008
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15974
16009
|
const filledCells = clientState?.cells ?? [];
|
|
15975
16010
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -16043,7 +16078,7 @@ function BeatTheGridGame({
|
|
|
16043
16078
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
16044
16079
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
16045
16080
|
] });
|
|
16046
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
16081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_react106.default.Fragment, { children: [
|
|
16047
16082
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
16048
16083
|
cols.map((colLabel, colIdx) => {
|
|
16049
16084
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -16124,7 +16159,7 @@ function BeatTheGridGame({
|
|
|
16124
16159
|
}
|
|
16125
16160
|
|
|
16126
16161
|
// src/components/games/GuessTheXiGame.tsx
|
|
16127
|
-
var
|
|
16162
|
+
var import_react107 = require("react");
|
|
16128
16163
|
|
|
16129
16164
|
// src/components/games/ui/PitchSvg.tsx
|
|
16130
16165
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16213,8 +16248,8 @@ function GuessTheXiGame({
|
|
|
16213
16248
|
onBack
|
|
16214
16249
|
}) {
|
|
16215
16250
|
const t = ui.games.guessTheXi;
|
|
16216
|
-
const [query, setQuery] = (0,
|
|
16217
|
-
const inputId = (0,
|
|
16251
|
+
const [query, setQuery] = (0, import_react107.useState)("");
|
|
16252
|
+
const inputId = (0, import_react107.useId)();
|
|
16218
16253
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
16219
16254
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
16220
16255
|
const solved = clientState?.status === "solved";
|
|
@@ -16356,7 +16391,7 @@ function GuessTheXiGame({
|
|
|
16356
16391
|
}
|
|
16357
16392
|
|
|
16358
16393
|
// src/components/games/DailyQuizGame.tsx
|
|
16359
|
-
var
|
|
16394
|
+
var import_react108 = require("react");
|
|
16360
16395
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
16361
16396
|
function parseClientState6(json) {
|
|
16362
16397
|
if (!json) return null;
|
|
@@ -16397,8 +16432,8 @@ function DailyQuizGame({
|
|
|
16397
16432
|
}) {
|
|
16398
16433
|
const s = ui.games.dailyQuiz;
|
|
16399
16434
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
16400
|
-
const [selections, setSelections] = (0,
|
|
16401
|
-
const [page, setPage] = (0,
|
|
16435
|
+
const [selections, setSelections] = (0, import_react108.useState)(/* @__PURE__ */ new Map());
|
|
16436
|
+
const [page, setPage] = (0, import_react108.useState)(0);
|
|
16402
16437
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
16403
16438
|
const results2 = clientState?.results ?? [];
|
|
16404
16439
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -16508,7 +16543,7 @@ function DailyQuizGame({
|
|
|
16508
16543
|
}
|
|
16509
16544
|
|
|
16510
16545
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
16511
|
-
var
|
|
16546
|
+
var import_react109 = require("react");
|
|
16512
16547
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
16513
16548
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
16514
16549
|
function parseClientState7(json) {
|
|
@@ -16604,12 +16639,12 @@ function MatchdayPredictorGame({
|
|
|
16604
16639
|
onBack
|
|
16605
16640
|
}) {
|
|
16606
16641
|
const t = ui.games.predictor;
|
|
16607
|
-
const [homeScore, setHomeScore] = (0,
|
|
16608
|
-
const [awayScore, setAwayScore] = (0,
|
|
16609
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
16610
|
-
const [lastEdited, setLastEdited] = (0,
|
|
16611
|
-
const [query, setQuery] = (0,
|
|
16612
|
-
const searchId = (0,
|
|
16642
|
+
const [homeScore, setHomeScore] = (0, import_react109.useState)(0);
|
|
16643
|
+
const [awayScore, setAwayScore] = (0, import_react109.useState)(0);
|
|
16644
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react109.useState)(null);
|
|
16645
|
+
const [lastEdited, setLastEdited] = (0, import_react109.useState)("home");
|
|
16646
|
+
const [query, setQuery] = (0, import_react109.useState)("");
|
|
16647
|
+
const searchId = (0, import_react109.useId)();
|
|
16613
16648
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
16614
16649
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16615
16650
|
const header = /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
@@ -16776,7 +16811,7 @@ function MatchdayPredictorGame({
|
|
|
16776
16811
|
}
|
|
16777
16812
|
|
|
16778
16813
|
// src/components/games/StartingXiGame.tsx
|
|
16779
|
-
var
|
|
16814
|
+
var import_react110 = require("react");
|
|
16780
16815
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16781
16816
|
var POINTS_PER_STARTER = 8;
|
|
16782
16817
|
var XI_SIZE = 11;
|
|
@@ -16820,10 +16855,10 @@ function StartingXiGame({
|
|
|
16820
16855
|
lockAtUtc
|
|
16821
16856
|
}) {
|
|
16822
16857
|
const t = ui.games.startingXi;
|
|
16823
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
16824
|
-
const [active, setActive] = (0,
|
|
16825
|
-
const [query, setQuery] = (0,
|
|
16826
|
-
const searchId = (0,
|
|
16858
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react110.useState)(() => Array(XI_SIZE).fill(null));
|
|
16859
|
+
const [active, setActive] = (0, import_react110.useState)(0);
|
|
16860
|
+
const [query, setQuery] = (0, import_react110.useState)("");
|
|
16861
|
+
const searchId = (0, import_react110.useId)();
|
|
16827
16862
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
16828
16863
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16829
16864
|
const header = /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
@@ -16962,7 +16997,7 @@ function StartingXiGame({
|
|
|
16962
16997
|
}
|
|
16963
16998
|
|
|
16964
16999
|
// src/components/games/StatLadderGame.tsx
|
|
16965
|
-
var
|
|
17000
|
+
var import_react111 = require("react");
|
|
16966
17001
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16967
17002
|
function ladderClue(ladder) {
|
|
16968
17003
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16999,9 +17034,9 @@ function StatLadderGame({
|
|
|
16999
17034
|
onBack
|
|
17000
17035
|
}) {
|
|
17001
17036
|
const t = ui.games.statLadder;
|
|
17002
|
-
const [query, setQuery] = (0,
|
|
17003
|
-
const [selectedId, setSelectedId] = (0,
|
|
17004
|
-
const searchId = (0,
|
|
17037
|
+
const [query, setQuery] = (0, import_react111.useState)("");
|
|
17038
|
+
const [selectedId, setSelectedId] = (0, import_react111.useState)(null);
|
|
17039
|
+
const searchId = (0, import_react111.useId)();
|
|
17005
17040
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
17006
17041
|
const revealed = clientState != null;
|
|
17007
17042
|
const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -17207,8 +17242,8 @@ function GameScreenHost({
|
|
|
17207
17242
|
ui
|
|
17208
17243
|
}) {
|
|
17209
17244
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
17210
|
-
const [configJson, setConfigJson] = (0,
|
|
17211
|
-
(0,
|
|
17245
|
+
const [configJson, setConfigJson] = (0, import_react112.useState)(null);
|
|
17246
|
+
(0, import_react112.useEffect)(() => {
|
|
17212
17247
|
setConfigJson(null);
|
|
17213
17248
|
if (!conversation) return;
|
|
17214
17249
|
let cancelled = false;
|
|
@@ -17231,12 +17266,12 @@ function GameScreenHost({
|
|
|
17231
17266
|
fixtureId: fixtureId || void 0,
|
|
17232
17267
|
locale: ui.hostTag
|
|
17233
17268
|
});
|
|
17234
|
-
(0,
|
|
17269
|
+
(0, import_react112.useEffect)(() => {
|
|
17235
17270
|
if (conversation) hydrate();
|
|
17236
17271
|
}, [conversation, gameId]);
|
|
17237
|
-
const hydrateRef = (0,
|
|
17272
|
+
const hydrateRef = (0, import_react112.useRef)(hydrate);
|
|
17238
17273
|
hydrateRef.current = hydrate;
|
|
17239
|
-
(0,
|
|
17274
|
+
(0, import_react112.useEffect)(() => {
|
|
17240
17275
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
17241
17276
|
if (rawStatus !== "pending") return;
|
|
17242
17277
|
const timerId = setInterval(() => {
|
|
@@ -17349,7 +17384,7 @@ function GameScreenHost({
|
|
|
17349
17384
|
}
|
|
17350
17385
|
|
|
17351
17386
|
// src/components/Leaderboard.tsx
|
|
17352
|
-
var
|
|
17387
|
+
var import_react113 = require("react");
|
|
17353
17388
|
|
|
17354
17389
|
// src/components/LeaderboardRow.tsx
|
|
17355
17390
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
@@ -17436,7 +17471,7 @@ function Leaderboard({
|
|
|
17436
17471
|
ui,
|
|
17437
17472
|
onPlay
|
|
17438
17473
|
}) {
|
|
17439
|
-
const [segment, setSegment] = (0,
|
|
17474
|
+
const [segment, setSegment] = (0, import_react113.useState)("weekly");
|
|
17440
17475
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
17441
17476
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
17442
17477
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -17541,9 +17576,9 @@ function GamesPanel({
|
|
|
17541
17576
|
leaderboardLoading,
|
|
17542
17577
|
refreshHub
|
|
17543
17578
|
}) {
|
|
17544
|
-
const [selected, setSelected] = (0,
|
|
17545
|
-
const [segment, setSegment] = (0,
|
|
17546
|
-
(0,
|
|
17579
|
+
const [selected, setSelected] = (0, import_react114.useState)(null);
|
|
17580
|
+
const [segment, setSegment] = (0, import_react114.useState)("play");
|
|
17581
|
+
(0, import_react114.useEffect)(() => {
|
|
17547
17582
|
ensureGamesFonts();
|
|
17548
17583
|
}, []);
|
|
17549
17584
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(GamesLoginWall, { ui });
|
|
@@ -17607,10 +17642,10 @@ function GamesPanel({
|
|
|
17607
17642
|
}
|
|
17608
17643
|
|
|
17609
17644
|
// src/components/FavouritesPanel.tsx
|
|
17610
|
-
var
|
|
17645
|
+
var import_react117 = require("react");
|
|
17611
17646
|
|
|
17612
17647
|
// src/components/FavouriteChips.tsx
|
|
17613
|
-
var
|
|
17648
|
+
var import_react115 = require("react");
|
|
17614
17649
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17615
17650
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
17616
17651
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -17656,12 +17691,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
17656
17691
|
] });
|
|
17657
17692
|
}
|
|
17658
17693
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
17659
|
-
const [confirming, setConfirming] = (0,
|
|
17694
|
+
const [confirming, setConfirming] = (0, import_react115.useState)(false);
|
|
17660
17695
|
const data = controller.data;
|
|
17661
|
-
(0,
|
|
17696
|
+
(0, import_react115.useEffect)(() => {
|
|
17662
17697
|
setConfirming(false);
|
|
17663
17698
|
}, [sport]);
|
|
17664
|
-
(0,
|
|
17699
|
+
(0, import_react115.useEffect)(() => {
|
|
17665
17700
|
if (!confirming) return;
|
|
17666
17701
|
const onPointerDown = (e) => {
|
|
17667
17702
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -17715,21 +17750,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
17715
17750
|
}
|
|
17716
17751
|
|
|
17717
17752
|
// src/components/FavouritesSearch.tsx
|
|
17718
|
-
var
|
|
17753
|
+
var import_react116 = require("react");
|
|
17719
17754
|
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
17720
17755
|
var MIN_LETTERS = 2;
|
|
17721
17756
|
var MAX_LENGTH = 64;
|
|
17722
17757
|
var DEBOUNCE_MS = 250;
|
|
17723
17758
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
17724
|
-
const [query, setQuery] = (0,
|
|
17725
|
-
const [answer, setAnswer] = (0,
|
|
17726
|
-
const controllerRef = (0,
|
|
17759
|
+
const [query, setQuery] = (0, import_react116.useState)("");
|
|
17760
|
+
const [answer, setAnswer] = (0, import_react116.useState)(null);
|
|
17761
|
+
const controllerRef = (0, import_react116.useRef)(controller);
|
|
17727
17762
|
controllerRef.current = controller;
|
|
17728
17763
|
const trimmed = query.trim();
|
|
17729
17764
|
const queryKey = `${sport}|${trimmed}`;
|
|
17730
17765
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
17731
17766
|
const settled = answer?.key === queryKey;
|
|
17732
|
-
(0,
|
|
17767
|
+
(0, import_react116.useEffect)(() => {
|
|
17733
17768
|
setAnswer(null);
|
|
17734
17769
|
if (trimmed.length < MIN_LETTERS) return;
|
|
17735
17770
|
let cancelled = false;
|
|
@@ -17792,13 +17827,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17792
17827
|
// src/components/FavouritesPanel.tsx
|
|
17793
17828
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17794
17829
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17795
|
-
const [notice, setNotice] = (0,
|
|
17796
|
-
const refreshRef = (0,
|
|
17830
|
+
const [notice, setNotice] = (0, import_react117.useState)(null);
|
|
17831
|
+
const refreshRef = (0, import_react117.useRef)(controller.refresh);
|
|
17797
17832
|
refreshRef.current = controller.refresh;
|
|
17798
|
-
(0,
|
|
17833
|
+
(0, import_react117.useEffect)(() => {
|
|
17799
17834
|
void refreshRef.current();
|
|
17800
17835
|
}, []);
|
|
17801
|
-
(0,
|
|
17836
|
+
(0, import_react117.useEffect)(() => {
|
|
17802
17837
|
setNotice(null);
|
|
17803
17838
|
}, [sport]);
|
|
17804
17839
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17824,11 +17859,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
17824
17859
|
}
|
|
17825
17860
|
|
|
17826
17861
|
// src/components/PresetTools.tsx
|
|
17827
|
-
var
|
|
17862
|
+
var import_react118 = require("react");
|
|
17828
17863
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17829
17864
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17830
17865
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17831
|
-
const titleId = (0,
|
|
17866
|
+
const titleId = (0, import_react118.useId)();
|
|
17832
17867
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17833
17868
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17834
17869
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17878,9 +17913,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17878
17913
|
const totalOptions = comboTotals(grid);
|
|
17879
17914
|
const totals = totalOptions.map((o) => o.value);
|
|
17880
17915
|
const legChoices = comboLegChoices(grid);
|
|
17881
|
-
const [total, setTotal] = (0,
|
|
17882
|
-
const [legs, setLegs] = (0,
|
|
17883
|
-
const [announcement, setAnnouncement] = (0,
|
|
17916
|
+
const [total, setTotal] = (0, import_react118.useState)(() => nearest(totals, initialTotal));
|
|
17917
|
+
const [legs, setLegs] = (0, import_react118.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17918
|
+
const [announcement, setAnnouncement] = (0, import_react118.useState)("");
|
|
17884
17919
|
const cell2 = findCombo(grid, total, legs);
|
|
17885
17920
|
const minLegs = legChoices[0] ?? legs;
|
|
17886
17921
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17919,8 +17954,8 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17919
17954
|
}
|
|
17920
17955
|
|
|
17921
17956
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17922
|
-
var
|
|
17923
|
-
var
|
|
17957
|
+
var import_react119 = require("react");
|
|
17958
|
+
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
17924
17959
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
17925
17960
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
17926
17961
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -17960,8 +17995,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17960
17995
|
const opening = openingGames(preset);
|
|
17961
17996
|
const gamesOptions = opening.options;
|
|
17962
17997
|
const marketOptions = usableMarkets(preset);
|
|
17963
|
-
const [fingerprint] = (0,
|
|
17964
|
-
const [saved] = (0,
|
|
17998
|
+
const [fingerprint] = (0, import_react119.useState)(() => JSON.stringify(preset));
|
|
17999
|
+
const [saved] = (0, import_react119.useState)(() => {
|
|
17965
18000
|
const kept = memory3?.savedView(sport);
|
|
17966
18001
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
17967
18002
|
});
|
|
@@ -17976,9 +18011,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17976
18011
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
17977
18012
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17978
18013
|
};
|
|
17979
|
-
const [view, setView] = (0,
|
|
17980
|
-
const autoWidened = (0,
|
|
17981
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
18014
|
+
const [view, setView] = (0, import_react119.useState)(() => saved?.view ?? openingView);
|
|
18015
|
+
const autoWidened = (0, import_react119.useRef)(false);
|
|
18016
|
+
const [widenedNote, setWidenedNote] = (0, import_react119.useState)(saved?.widenedNote ?? false);
|
|
17982
18017
|
const track = useTrack();
|
|
17983
18018
|
const requestFor = (v, extra) => ({
|
|
17984
18019
|
sport,
|
|
@@ -17990,22 +18025,22 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17990
18025
|
widen: v.widen,
|
|
17991
18026
|
...extra?.variant ? { variant: extra.variant } : {},
|
|
17992
18027
|
...extra?.keep?.length ? { keep: sorted(extra.keep) } : {},
|
|
17993
|
-
...extra?.swapped?.length ? { swapped: [...new Set(extra.swapped)].slice(-
|
|
18028
|
+
...extra?.swapped?.length ? { swapped: [...new Set(extra.swapped)].slice(-import_widget_sdk38.MAX_SWAPPED_IDS) } : {},
|
|
17994
18029
|
...operatorUserId ? { operatorUserId } : {},
|
|
17995
18030
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17996
18031
|
});
|
|
17997
|
-
const [editing, setEditing] = (0,
|
|
17998
|
-
const [draft, setDraft] = (0,
|
|
17999
|
-
const [invalid, setInvalid] = (0,
|
|
18000
|
-
const inputRef = (0,
|
|
18001
|
-
const pencilRef = (0,
|
|
18002
|
-
const noteId = (0,
|
|
18003
|
-
const customId = (0,
|
|
18004
|
-
(0,
|
|
18032
|
+
const [editing, setEditing] = (0, import_react119.useState)(false);
|
|
18033
|
+
const [draft, setDraft] = (0, import_react119.useState)("");
|
|
18034
|
+
const [invalid, setInvalid] = (0, import_react119.useState)(null);
|
|
18035
|
+
const inputRef = (0, import_react119.useRef)(null);
|
|
18036
|
+
const pencilRef = (0, import_react119.useRef)(null);
|
|
18037
|
+
const noteId = (0, import_react119.useId)();
|
|
18038
|
+
const customId = (0, import_react119.useId)();
|
|
18039
|
+
(0, import_react119.useEffect)(() => {
|
|
18005
18040
|
if (editing) inputRef.current?.focus();
|
|
18006
18041
|
}, [editing]);
|
|
18007
18042
|
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
18008
|
-
(0,
|
|
18043
|
+
(0, import_react119.useEffect)(() => {
|
|
18009
18044
|
if (view.legs === 1) {
|
|
18010
18045
|
setEditing(false);
|
|
18011
18046
|
setDraft("");
|
|
@@ -18021,16 +18056,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18021
18056
|
setEditing(false);
|
|
18022
18057
|
pencilRef.current?.focus();
|
|
18023
18058
|
};
|
|
18024
|
-
const [first] = (0,
|
|
18059
|
+
const [first] = (0, import_react119.useState)(() => requestFor(view));
|
|
18025
18060
|
const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
18026
|
-
const [shown2, setShown] = (0,
|
|
18061
|
+
const [shown2, setShown] = (0, import_react119.useState)(null);
|
|
18027
18062
|
if (grid === null) {
|
|
18028
18063
|
if (shown2 !== null && status2 === "ready") setShown(null);
|
|
18029
18064
|
} else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
|
|
18030
18065
|
setShown(shownAfter(shown2, grid, answeredFor));
|
|
18031
18066
|
}
|
|
18032
|
-
const lastRequest = (0,
|
|
18033
|
-
(0,
|
|
18067
|
+
const lastRequest = (0, import_react119.useRef)(first);
|
|
18068
|
+
(0, import_react119.useEffect)(() => {
|
|
18034
18069
|
void request(lastRequest.current);
|
|
18035
18070
|
}, [request]);
|
|
18036
18071
|
const send = (req) => {
|
|
@@ -18068,7 +18103,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18068
18103
|
};
|
|
18069
18104
|
const canNarrow = preset.matchIds.length > 0;
|
|
18070
18105
|
const ready = status2 === "ready" && grid !== null;
|
|
18071
|
-
const [tapped, setTapped] = (0,
|
|
18106
|
+
const [tapped, setTapped] = (0, import_react119.useState)(null);
|
|
18072
18107
|
const busy = tapped !== null && status2 === "loading" && shown2 !== null;
|
|
18073
18108
|
const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
|
|
18074
18109
|
const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
|
|
@@ -18077,8 +18112,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18077
18112
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
18078
18113
|
])).sort((a, b) => a - b);
|
|
18079
18114
|
const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
|
|
18080
|
-
const sectionRef = (0,
|
|
18081
|
-
(0,
|
|
18115
|
+
const sectionRef = (0, import_react119.useRef)(null);
|
|
18116
|
+
(0, import_react119.useEffect)(() => {
|
|
18082
18117
|
if (tapped === null || status2 !== "ready") return;
|
|
18083
18118
|
setTapped(null);
|
|
18084
18119
|
const root = sectionRef.current;
|
|
@@ -18095,14 +18130,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18095
18130
|
}, [tapped, status2]);
|
|
18096
18131
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
18097
18132
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
18098
|
-
const [startedNote, setStartedNote] = (0,
|
|
18133
|
+
const [startedNote, setStartedNote] = (0, import_react119.useState)(false);
|
|
18099
18134
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
18100
|
-
(0,
|
|
18135
|
+
(0, import_react119.useEffect)(() => {
|
|
18101
18136
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
18102
18137
|
}, [startedNote, status2, anyStarted]);
|
|
18103
18138
|
const market = rows?.[0]?.market;
|
|
18104
|
-
const [seen2, setSeen] = (0,
|
|
18105
|
-
(0,
|
|
18139
|
+
const [seen2, setSeen] = (0, import_react119.useState)(null);
|
|
18140
|
+
(0, import_react119.useEffect)(() => {
|
|
18106
18141
|
if (market) setSeen(market);
|
|
18107
18142
|
}, [market]);
|
|
18108
18143
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -18146,14 +18181,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18146
18181
|
};
|
|
18147
18182
|
};
|
|
18148
18183
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
18149
|
-
(0,
|
|
18184
|
+
(0, import_react119.useEffect)(() => {
|
|
18150
18185
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
18151
18186
|
autoWidened.current = true;
|
|
18152
18187
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
18153
18188
|
commit(next, true);
|
|
18154
18189
|
send(requestFor(next));
|
|
18155
18190
|
}, [empty2, singles, widened, canWiden, view]);
|
|
18156
|
-
(0,
|
|
18191
|
+
(0, import_react119.useEffect)(() => {
|
|
18157
18192
|
if (coolOff) onCoolOff?.(sport);
|
|
18158
18193
|
}, [coolOff, onCoolOff, sport]);
|
|
18159
18194
|
if (coolOff) return null;
|
|
@@ -18620,10 +18655,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
18620
18655
|
}
|
|
18621
18656
|
|
|
18622
18657
|
// src/components/PlayerPhoto.tsx
|
|
18623
|
-
var
|
|
18658
|
+
var import_react120 = require("react");
|
|
18624
18659
|
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
18625
18660
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
18626
|
-
const [failed, setFailed] = (0,
|
|
18661
|
+
const [failed, setFailed] = (0, import_react120.useState)(false);
|
|
18627
18662
|
const box = { width: size, height: size };
|
|
18628
18663
|
if (photoUrl && !failed) {
|
|
18629
18664
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -18658,7 +18693,7 @@ function MiniPitch({ positionCode }) {
|
|
|
18658
18693
|
}
|
|
18659
18694
|
|
|
18660
18695
|
// src/components/PerformanceBars.tsx
|
|
18661
|
-
var
|
|
18696
|
+
var import_react121 = require("react");
|
|
18662
18697
|
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
18663
18698
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
18664
18699
|
function finite4(v) {
|
|
@@ -18704,7 +18739,7 @@ function unrankedLine(ui, reason) {
|
|
|
18704
18739
|
}
|
|
18705
18740
|
}
|
|
18706
18741
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
18707
|
-
const [mode, setMode] = (0,
|
|
18742
|
+
const [mode, setMode] = (0, import_react121.useState)("total");
|
|
18708
18743
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
18709
18744
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
18710
18745
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -18913,8 +18948,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
18913
18948
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
18914
18949
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
18915
18950
|
function useIsModal() {
|
|
18916
|
-
const [modal, setModal] = (0,
|
|
18917
|
-
(0,
|
|
18951
|
+
const [modal, setModal] = (0, import_react122.useState)(false);
|
|
18952
|
+
(0, import_react122.useEffect)(() => {
|
|
18918
18953
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
18919
18954
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
18920
18955
|
const sync = () => setModal(mql.matches);
|
|
@@ -18928,12 +18963,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
18928
18963
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
18929
18964
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
18930
18965
|
const { state, close, stop, send, reset } = controller;
|
|
18931
|
-
const [squadView, setSquadView] = (0,
|
|
18932
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
18966
|
+
const [squadView, setSquadView] = (0, import_react122.useState)("roster");
|
|
18967
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react122.useState)(null);
|
|
18933
18968
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
18934
18969
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
18935
|
-
const squadLayerRef = (0,
|
|
18936
|
-
const squadScrollRef = (0,
|
|
18970
|
+
const squadLayerRef = (0, import_react122.useRef)(null);
|
|
18971
|
+
const squadScrollRef = (0, import_react122.useRef)(null);
|
|
18937
18972
|
const selectPlayer = (playerId) => {
|
|
18938
18973
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
18939
18974
|
setSelectedPlayerId(playerId);
|
|
@@ -18943,7 +18978,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18943
18978
|
setSelectedPlayerId(null);
|
|
18944
18979
|
clearPlayerDetail?.();
|
|
18945
18980
|
};
|
|
18946
|
-
(0,
|
|
18981
|
+
(0, import_react122.useLayoutEffect)(() => {
|
|
18947
18982
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
18948
18983
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
18949
18984
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -18956,7 +18991,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18956
18991
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
18957
18992
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
18958
18993
|
const activeTab = tabs?.activeTab;
|
|
18959
|
-
(0,
|
|
18994
|
+
(0, import_react122.useEffect)(() => {
|
|
18960
18995
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
18961
18996
|
setSelectedPlayerId(null);
|
|
18962
18997
|
clearPlayerDetail?.();
|
|
@@ -18965,11 +19000,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18965
19000
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
18966
19001
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
18967
19002
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18968
|
-
(0,
|
|
19003
|
+
(0, import_react122.useEffect)(() => {
|
|
18969
19004
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18970
19005
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18971
19006
|
const storedTab = tabState?.activeTab;
|
|
18972
|
-
(0,
|
|
19007
|
+
(0, import_react122.useEffect)(() => {
|
|
18973
19008
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18974
19009
|
if (unreachable) setMonitorTab?.("chat");
|
|
18975
19010
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18978,12 +19013,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18978
19013
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
18979
19014
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
18980
19015
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
18981
|
-
const closeWith = (0,
|
|
19016
|
+
const closeWith = (0, import_react122.useCallback)((method) => {
|
|
18982
19017
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
18983
19018
|
if (onCloseRequested) onCloseRequested();
|
|
18984
19019
|
else close();
|
|
18985
19020
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18986
|
-
(0,
|
|
19021
|
+
(0, import_react122.useEffect)(() => {
|
|
18987
19022
|
const onKey = (e) => {
|
|
18988
19023
|
if (e.key === "Escape") closeWith("escape");
|
|
18989
19024
|
};
|
|
@@ -18999,80 +19034,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18999
19034
|
tabs?.setActiveTab("chat");
|
|
19000
19035
|
send(text2, { grounding, source });
|
|
19001
19036
|
};
|
|
19002
|
-
(0,
|
|
19037
|
+
(0, import_react122.useEffect)(() => {
|
|
19003
19038
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
19004
19039
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
19005
19040
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
19006
|
-
const inputRef = (0,
|
|
19007
|
-
const limitRef = (0,
|
|
19008
|
-
const typedSendRef = (0,
|
|
19009
|
-
const focusAfterCloseRef = (0,
|
|
19010
|
-
const [tool, setTool] = (0,
|
|
19011
|
-
const panelRef = (0,
|
|
19041
|
+
const inputRef = (0, import_react122.useRef)(null);
|
|
19042
|
+
const limitRef = (0, import_react122.useRef)(null);
|
|
19043
|
+
const typedSendRef = (0, import_react122.useRef)(false);
|
|
19044
|
+
const focusAfterCloseRef = (0, import_react122.useRef)(null);
|
|
19045
|
+
const [tool, setTool] = (0, import_react122.useState)(null);
|
|
19046
|
+
const panelRef = (0, import_react122.useRef)(null);
|
|
19012
19047
|
const settings = useOddsSettings();
|
|
19013
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
19048
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react122.useState)(false);
|
|
19014
19049
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
19015
|
-
const openSettings = (0,
|
|
19050
|
+
const openSettings = (0, import_react122.useCallback)(() => {
|
|
19016
19051
|
setTool(null);
|
|
19017
19052
|
setFavouritesOpen?.(false);
|
|
19018
19053
|
setSettingsOpen(true);
|
|
19019
19054
|
}, [setFavouritesOpen]);
|
|
19020
|
-
const closeSettings = (0,
|
|
19055
|
+
const closeSettings = (0, import_react122.useCallback)(() => {
|
|
19021
19056
|
setSettingsOpen(false);
|
|
19022
19057
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
19023
19058
|
}, []);
|
|
19024
|
-
const openFavourites = (0,
|
|
19025
|
-
const closeFavourites = (0,
|
|
19059
|
+
const openFavourites = (0, import_react122.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
19060
|
+
const closeFavourites = (0, import_react122.useCallback)(() => {
|
|
19026
19061
|
setFavouritesOpen?.(false);
|
|
19027
19062
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
19028
19063
|
}, [setFavouritesOpen]);
|
|
19029
|
-
(0,
|
|
19064
|
+
(0, import_react122.useEffect)(() => {
|
|
19030
19065
|
if (!favouritesOpen) return;
|
|
19031
19066
|
setTool(null);
|
|
19032
19067
|
setSettingsOpen(false);
|
|
19033
19068
|
}, [favouritesOpen]);
|
|
19034
19069
|
const paused = isPaused(state.limit);
|
|
19035
|
-
(0,
|
|
19070
|
+
(0, import_react122.useEffect)(() => {
|
|
19036
19071
|
if (paused) setTool(null);
|
|
19037
19072
|
}, [paused]);
|
|
19038
|
-
(0,
|
|
19073
|
+
(0, import_react122.useEffect)(() => {
|
|
19039
19074
|
if (!paused) return;
|
|
19040
19075
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
19041
19076
|
typedSendRef.current = false;
|
|
19042
19077
|
}, [paused]);
|
|
19043
|
-
const openTool = (0,
|
|
19078
|
+
const openTool = (0, import_react122.useCallback)((next) => {
|
|
19044
19079
|
setTool(next);
|
|
19045
19080
|
}, []);
|
|
19046
|
-
const toolsValue = (0,
|
|
19081
|
+
const toolsValue = (0, import_react122.useMemo)(
|
|
19047
19082
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
19048
19083
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
19049
19084
|
);
|
|
19050
|
-
const closeTool = (0,
|
|
19085
|
+
const closeTool = (0, import_react122.useCallback)(() => {
|
|
19051
19086
|
focusAfterCloseRef.current = "composer";
|
|
19052
19087
|
setTool(null);
|
|
19053
19088
|
}, []);
|
|
19054
|
-
const sendAsk = (0,
|
|
19089
|
+
const sendAsk = (0, import_react122.useCallback)((ask) => {
|
|
19055
19090
|
focusAfterCloseRef.current = "composer";
|
|
19056
19091
|
setTool(null);
|
|
19057
19092
|
tabs?.setActiveTab("chat");
|
|
19058
19093
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
19059
19094
|
}, [tabs, send]);
|
|
19060
|
-
const formatKickoff = (0,
|
|
19095
|
+
const formatKickoff = (0, import_react122.useCallback)((kickoffUtc) => {
|
|
19061
19096
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
19062
19097
|
return `${k.dayLabel} ${k.time}`;
|
|
19063
19098
|
}, [ui]);
|
|
19064
|
-
(0,
|
|
19099
|
+
(0, import_react122.useEffect)(() => {
|
|
19065
19100
|
if (tool) return;
|
|
19066
19101
|
const target = focusAfterCloseRef.current;
|
|
19067
19102
|
focusAfterCloseRef.current = null;
|
|
19068
19103
|
if (target === "composer") inputRef.current?.focus();
|
|
19069
19104
|
}, [tool]);
|
|
19070
|
-
(0,
|
|
19105
|
+
(0, import_react122.useEffect)(() => {
|
|
19071
19106
|
if (!tool || onChatTab && presetGrid) return;
|
|
19072
19107
|
focusAfterCloseRef.current = "composer";
|
|
19073
19108
|
setTool(null);
|
|
19074
19109
|
}, [tool, onChatTab, presetGrid]);
|
|
19075
|
-
const backRef = (0,
|
|
19110
|
+
const backRef = (0, import_react122.useRef)(() => false);
|
|
19076
19111
|
backRef.current = () => {
|
|
19077
19112
|
if (favouritesOpen) {
|
|
19078
19113
|
closeFavourites();
|
|
@@ -19096,7 +19131,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19096
19131
|
}
|
|
19097
19132
|
return false;
|
|
19098
19133
|
};
|
|
19099
|
-
(0,
|
|
19134
|
+
(0, import_react122.useEffect)(() => {
|
|
19100
19135
|
if (!onRegisterBack) return;
|
|
19101
19136
|
onRegisterBack(() => backRef.current());
|
|
19102
19137
|
return () => onRegisterBack(null);
|
|
@@ -22144,6 +22179,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
22144
22179
|
.ss-w-tni-price-lab { color: var(--ss-w-faint); font-weight: 600; }
|
|
22145
22180
|
.ss-w-tni-price-val { color: var(--ss-w-ink); font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
|
|
22146
22181
|
.ss-w-tni-price-sep { color: var(--ss-w-faint); font-weight: 400; }
|
|
22182
|
+
.ss-w-v2-row[data-settled], .ss-w-v2-tile[data-settled] { cursor: default; }
|
|
22183
|
+
.ss-w-pill--done { background: var(--ss-w-panel); color: var(--ss-w-faint); box-shadow: inset 0 0 0 1.5px var(--ss-w-line); font-size: 13px; }
|
|
22147
22184
|
`;
|
|
22148
22185
|
|
|
22149
22186
|
// src/StatsWidget.tsx
|
|
@@ -22155,7 +22192,7 @@ function buildClient(props) {
|
|
|
22155
22192
|
return { client: props.client, conversation: props.client.conversation() };
|
|
22156
22193
|
}
|
|
22157
22194
|
const cfg = props.config;
|
|
22158
|
-
const client = new
|
|
22195
|
+
const client = new import_widget_sdk39.StatsWidgetClient(toClientOptions(cfg));
|
|
22159
22196
|
return { client, conversation: client.conversation(toUserContext(cfg)) };
|
|
22160
22197
|
} catch (err) {
|
|
22161
22198
|
console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
|
|
@@ -22173,12 +22210,12 @@ function injectStyles(root) {
|
|
|
22173
22210
|
function StatsWidget(props) {
|
|
22174
22211
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
22175
22212
|
const cfg = props.config;
|
|
22176
|
-
const built = (0,
|
|
22177
|
-
const trackingRef = (0,
|
|
22178
|
-
const track = (0,
|
|
22179
|
-
const eventTextRef = (0,
|
|
22213
|
+
const built = (0, import_react123.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
22214
|
+
const trackingRef = (0, import_react123.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22215
|
+
const track = (0, import_react123.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22216
|
+
const eventTextRef = (0, import_react123.useRef)(false);
|
|
22180
22217
|
eventTextRef.current = cfg?.eventText === true;
|
|
22181
|
-
const logger = (0,
|
|
22218
|
+
const logger = (0, import_react123.useMemo)(() => {
|
|
22182
22219
|
if (!built) return null;
|
|
22183
22220
|
const raw = built.client.createEventLogger({
|
|
22184
22221
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -22188,27 +22225,27 @@ function StatsWidget(props) {
|
|
|
22188
22225
|
}, [built?.client, track]);
|
|
22189
22226
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22190
22227
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22191
|
-
const ui = (0,
|
|
22228
|
+
const ui = (0, import_react123.useMemo)(
|
|
22192
22229
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
22193
22230
|
[props.config, widgetStrings.strings]
|
|
22194
22231
|
);
|
|
22195
22232
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
22196
|
-
const rootRef = (0,
|
|
22197
|
-
const introDoneRef = (0,
|
|
22198
|
-
const markIntroDone = (0,
|
|
22233
|
+
const rootRef = (0, import_react123.useRef)(null);
|
|
22234
|
+
const introDoneRef = (0, import_react123.useRef)(false);
|
|
22235
|
+
const markIntroDone = (0, import_react123.useCallback)(() => {
|
|
22199
22236
|
introDoneRef.current = true;
|
|
22200
22237
|
}, []);
|
|
22201
22238
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
22202
22239
|
const threadLanguage = familyOf(language);
|
|
22203
22240
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
22204
|
-
const sportScope = (0,
|
|
22241
|
+
const sportScope = (0, import_react123.useMemo)(
|
|
22205
22242
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22206
22243
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22207
22244
|
);
|
|
22208
|
-
const chatTracking = (0,
|
|
22245
|
+
const chatTracking = (0, import_react123.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
22209
22246
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
22210
22247
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22211
|
-
const liveCardWatches = (0,
|
|
22248
|
+
const liveCardWatches = (0, import_react123.useMemo)(() => {
|
|
22212
22249
|
const seen2 = /* @__PURE__ */ new Set();
|
|
22213
22250
|
const out = [];
|
|
22214
22251
|
for (const msg of controller.state.messages) {
|
|
@@ -22234,19 +22271,19 @@ function StatsWidget(props) {
|
|
|
22234
22271
|
});
|
|
22235
22272
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
22236
22273
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
22237
|
-
const getSchedule = (0,
|
|
22274
|
+
const getSchedule = (0, import_react123.useCallback)(
|
|
22238
22275
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
22239
22276
|
[built, operatorUserId, anonymousUserId]
|
|
22240
22277
|
);
|
|
22241
|
-
const getStates = (0,
|
|
22278
|
+
const getStates = (0, import_react123.useCallback)(
|
|
22242
22279
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
22243
22280
|
[built, requestTag]
|
|
22244
22281
|
);
|
|
22245
|
-
const getTennisPrices = (0,
|
|
22282
|
+
const getTennisPrices = (0, import_react123.useCallback)(
|
|
22246
22283
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
22247
22284
|
[built, requestTag]
|
|
22248
22285
|
);
|
|
22249
|
-
const pinnedMatchIds = (0,
|
|
22286
|
+
const pinnedMatchIds = (0, import_react123.useMemo)(
|
|
22250
22287
|
() => footballMatchPinIds(monitor.pins),
|
|
22251
22288
|
[monitor.pins]
|
|
22252
22289
|
);
|
|
@@ -22260,13 +22297,13 @@ function StatsWidget(props) {
|
|
|
22260
22297
|
pinnedMatchIds,
|
|
22261
22298
|
timeZone: ui.timeZone
|
|
22262
22299
|
});
|
|
22263
|
-
const offeredSports = (0,
|
|
22300
|
+
const offeredSports = (0, import_react123.useMemo)(() => {
|
|
22264
22301
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
22265
22302
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
22266
22303
|
return [...seen2];
|
|
22267
22304
|
}, [discovery.matchDays, discovery.groups]);
|
|
22268
22305
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
22269
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
22306
|
+
const [liveLeague, setLiveLeague] = (0, import_react123.useState)(null);
|
|
22270
22307
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
22271
22308
|
const matchesLoaded = useMatchesDay({
|
|
22272
22309
|
discovery,
|
|
@@ -22276,8 +22313,8 @@ function StatsWidget(props) {
|
|
|
22276
22313
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
22277
22314
|
timeZone: ui.timeZone
|
|
22278
22315
|
});
|
|
22279
|
-
const prevLiveSnapshotRef = (0,
|
|
22280
|
-
(0,
|
|
22316
|
+
const prevLiveSnapshotRef = (0, import_react123.useRef)(monitor.snapshot);
|
|
22317
|
+
(0, import_react123.useEffect)(() => {
|
|
22281
22318
|
const snap = monitor.snapshot;
|
|
22282
22319
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
22283
22320
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -22317,14 +22354,14 @@ function StatsWidget(props) {
|
|
|
22317
22354
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22318
22355
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22319
22356
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
22320
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
22321
|
-
const latestGreeting = (0,
|
|
22357
|
+
const [favSportPick, setFavSportPick] = (0, import_react123.useState)(null);
|
|
22358
|
+
const latestGreeting = (0, import_react123.useMemo)(() => {
|
|
22322
22359
|
for (const m of [...controller.state.messages].reverse()) {
|
|
22323
22360
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
22324
22361
|
}
|
|
22325
22362
|
return null;
|
|
22326
22363
|
}, [controller.state.messages]);
|
|
22327
|
-
const favSportOptions = (0,
|
|
22364
|
+
const favSportOptions = (0, import_react123.useMemo)(
|
|
22328
22365
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
22329
22366
|
[latestGreeting]
|
|
22330
22367
|
);
|
|
@@ -22333,20 +22370,20 @@ function StatsWidget(props) {
|
|
|
22333
22370
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
22334
22371
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
22335
22372
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
22336
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
22337
|
-
const builderGreeting = (0,
|
|
22373
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react123.useState)(null);
|
|
22374
|
+
const builderGreeting = (0, import_react123.useMemo)(
|
|
22338
22375
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
22339
22376
|
[controller.state.messages]
|
|
22340
22377
|
);
|
|
22341
|
-
const [coolOff, setCoolOff] = (0,
|
|
22342
|
-
const onBuilderCoolOff = (0,
|
|
22378
|
+
const [coolOff, setCoolOff] = (0, import_react123.useState)(null);
|
|
22379
|
+
const onBuilderCoolOff = (0, import_react123.useCallback)((sport) => {
|
|
22343
22380
|
if (!builderGreeting) return;
|
|
22344
22381
|
setCoolOff((prev) => {
|
|
22345
22382
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
22346
22383
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
22347
22384
|
});
|
|
22348
22385
|
}, [builderGreeting]);
|
|
22349
|
-
const builderOptions = (0,
|
|
22386
|
+
const builderOptions = (0, import_react123.useMemo)(() => {
|
|
22350
22387
|
const greeting = builderGreeting;
|
|
22351
22388
|
if (!greeting) return [];
|
|
22352
22389
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -22363,7 +22400,7 @@ function StatsWidget(props) {
|
|
|
22363
22400
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
22364
22401
|
}, [builderGreeting, coolOff, ui]);
|
|
22365
22402
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
22366
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
22403
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react123.useState)(panelOpen);
|
|
22367
22404
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
22368
22405
|
const favourites = useFavourites({
|
|
22369
22406
|
conversation: built?.conversation ?? null,
|
|
@@ -22375,16 +22412,16 @@ function StatsWidget(props) {
|
|
|
22375
22412
|
onChanged: discovery.refreshSchedule
|
|
22376
22413
|
});
|
|
22377
22414
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
22378
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
22415
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react123.useState)(false);
|
|
22379
22416
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
22380
|
-
const getPricePresets = (0,
|
|
22417
|
+
const getPricePresets = (0, import_react123.useCallback)(
|
|
22381
22418
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
22382
22419
|
[built]
|
|
22383
22420
|
);
|
|
22384
22421
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
22385
22422
|
const markLiveActivity = monitor.markLiveActivity;
|
|
22386
|
-
const prevLiveCountRef = (0,
|
|
22387
|
-
(0,
|
|
22423
|
+
const prevLiveCountRef = (0, import_react123.useRef)(0);
|
|
22424
|
+
(0, import_react123.useEffect)(() => {
|
|
22388
22425
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
22389
22426
|
prevLiveCountRef.current = discovery.liveCount;
|
|
22390
22427
|
if (rose) markLiveActivity();
|
|
@@ -22398,7 +22435,7 @@ function StatsWidget(props) {
|
|
|
22398
22435
|
closePanel: controller.close
|
|
22399
22436
|
});
|
|
22400
22437
|
const markAdded = hostEvents.markAdded;
|
|
22401
|
-
const slip = (0,
|
|
22438
|
+
const slip = (0, import_react123.useMemo)(
|
|
22402
22439
|
() => {
|
|
22403
22440
|
const handler = props.config?.onAddToSlip;
|
|
22404
22441
|
return {
|
|
@@ -22418,7 +22455,7 @@ function StatsWidget(props) {
|
|
|
22418
22455
|
},
|
|
22419
22456
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
22420
22457
|
);
|
|
22421
|
-
const onDashboardTap = (0,
|
|
22458
|
+
const onDashboardTap = (0, import_react123.useMemo)(
|
|
22422
22459
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
22423
22460
|
[built, logger]
|
|
22424
22461
|
);
|
|
@@ -22432,11 +22469,11 @@ function StatsWidget(props) {
|
|
|
22432
22469
|
log: logger
|
|
22433
22470
|
})
|
|
22434
22471
|
}));
|
|
22435
|
-
const dismissPopupRef = (0,
|
|
22472
|
+
const dismissPopupRef = (0, import_react123.useRef)(() => {
|
|
22436
22473
|
});
|
|
22437
|
-
const onCtaRef = (0,
|
|
22474
|
+
const onCtaRef = (0, import_react123.useRef)(() => {
|
|
22438
22475
|
});
|
|
22439
|
-
const onTeaserTapRef = (0,
|
|
22476
|
+
const onTeaserTapRef = (0, import_react123.useRef)(() => {
|
|
22440
22477
|
});
|
|
22441
22478
|
const bubble = controller.state.greetingBubble;
|
|
22442
22479
|
const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
|
|
@@ -22464,15 +22501,15 @@ function StatsWidget(props) {
|
|
|
22464
22501
|
dismissPopupRef.current = dismissPopup;
|
|
22465
22502
|
const greetingMeta = latestGreetingMeta(controller.state.messages);
|
|
22466
22503
|
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, mobile.confirmedShown);
|
|
22467
|
-
const [highlight, setHighlight] = (0,
|
|
22468
|
-
const clearHighlight = (0,
|
|
22469
|
-
(0,
|
|
22504
|
+
const [highlight, setHighlight] = (0, import_react123.useState)(null);
|
|
22505
|
+
const clearHighlight = (0, import_react123.useCallback)(() => setHighlight(null), []);
|
|
22506
|
+
(0, import_react123.useEffect)(() => {
|
|
22470
22507
|
if (!panelOpen) setHighlight(null);
|
|
22471
22508
|
}, [panelOpen]);
|
|
22472
|
-
const highlightRequest = (0,
|
|
22509
|
+
const highlightRequest = (0, import_react123.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
|
|
22473
22510
|
const { open: openFromCta, state: { greetingBubble } } = controller;
|
|
22474
22511
|
const setTab = monitor.setActiveTab;
|
|
22475
|
-
const logCtaClick = (0,
|
|
22512
|
+
const logCtaClick = (0, import_react123.useCallback)(() => {
|
|
22476
22513
|
if (!logger || !greetingMeta) return;
|
|
22477
22514
|
logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
|
|
22478
22515
|
}, [logger, greetingMeta]);
|
|
@@ -22489,12 +22526,12 @@ function StatsWidget(props) {
|
|
|
22489
22526
|
if (!bubbleCta) logCtaClick();
|
|
22490
22527
|
openFromCta();
|
|
22491
22528
|
};
|
|
22492
|
-
const onCta = (0,
|
|
22529
|
+
const onCta = (0, import_react123.useCallback)(() => onCtaRef.current(), []);
|
|
22493
22530
|
useOpenTelemetry(logger, panelOpen);
|
|
22494
|
-
const onControlRef = (0,
|
|
22531
|
+
const onControlRef = (0, import_react123.useRef)(props.onControl);
|
|
22495
22532
|
onControlRef.current = props.onControl;
|
|
22496
22533
|
const { open: openPanel, close: closePanel } = controller;
|
|
22497
|
-
(0,
|
|
22534
|
+
(0, import_react123.useEffect)(() => {
|
|
22498
22535
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
22499
22536
|
return () => onControlRef.current?.(null);
|
|
22500
22537
|
}, [openPanel, closePanel]);
|
|
@@ -22511,11 +22548,11 @@ function StatsWidget(props) {
|
|
|
22511
22548
|
page: cfg?.page
|
|
22512
22549
|
}
|
|
22513
22550
|
};
|
|
22514
|
-
(0,
|
|
22551
|
+
(0, import_react123.useEffect)(() => {
|
|
22515
22552
|
if (!logger) return;
|
|
22516
22553
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
22517
22554
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
22518
|
-
(0,
|
|
22555
|
+
(0, import_react123.useEffect)(() => {
|
|
22519
22556
|
if (!logger) return;
|
|
22520
22557
|
logger.resume();
|
|
22521
22558
|
const onHide = () => {
|
|
@@ -22533,15 +22570,15 @@ function StatsWidget(props) {
|
|
|
22533
22570
|
logger.dispose();
|
|
22534
22571
|
};
|
|
22535
22572
|
}, [logger]);
|
|
22536
|
-
(0,
|
|
22573
|
+
(0, import_react123.useEffect)(() => {
|
|
22537
22574
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
22538
22575
|
const node = rootRef.current?.getRootNode();
|
|
22539
22576
|
if (node) injectStyles(node);
|
|
22540
22577
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
22541
22578
|
const holds = useSessionHolds();
|
|
22542
22579
|
const builderConversation = built?.conversation ?? null;
|
|
22543
|
-
const builderMemory = (0,
|
|
22544
|
-
const personalGreeting = (0,
|
|
22580
|
+
const builderMemory = (0, import_react123.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
22581
|
+
const personalGreeting = (0, import_react123.useMemo)(() => ({
|
|
22545
22582
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
22546
22583
|
conversation: built?.conversation ?? null,
|
|
22547
22584
|
openFavourites: () => setFavouritesOpen(true),
|