@sensiblestats/widget-react 0.150.1 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +453 -375
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +243 -165
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as useCallback30, useEffect as
|
|
2
|
+
import { useCallback as useCallback30, useEffect as useEffect60, useMemo as useMemo16, useRef as useRef50, useState as useState88 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/strings/tag.ts
|
|
@@ -1347,7 +1347,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
|
|
1349
1349
|
// src/version.generated.ts
|
|
1350
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1350
|
+
var WIDGET_REACT_VERSION = "0.152.0";
|
|
1351
1351
|
|
|
1352
1352
|
// src/config.ts
|
|
1353
1353
|
function hostTag(cfg) {
|
|
@@ -6161,7 +6161,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
|
|
|
6161
6161
|
{
|
|
6162
6162
|
className: "ss-w-v8-card ss-w-v2-alt-row",
|
|
6163
6163
|
"data-match-id": r.matchId,
|
|
6164
|
-
"aria-label": ui.v2CardLabel(r.home, r.away, marketLabel),
|
|
6164
|
+
"aria-label": ui.v2CardLabel(r.home, r.away, r.marketLabel ?? marketLabel),
|
|
6165
6165
|
onClickCapture: logRowTap(events, slotBase + i),
|
|
6166
6166
|
children: [
|
|
6167
6167
|
/* @__PURE__ */ jsxs9("header", { className: "ss-w-v8-card-head", children: [
|
|
@@ -6172,6 +6172,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
|
|
|
6172
6172
|
] }),
|
|
6173
6173
|
sub ? /* @__PURE__ */ jsx10("span", { className: "ss-w-v8-card-sub", children: sub }) : null
|
|
6174
6174
|
] }),
|
|
6175
|
+
r.marketLabel ? /* @__PURE__ */ jsx10("div", { className: "ss-w-v2-head", children: /* @__PURE__ */ jsx10("span", { className: "ss-w-v2-market", children: r.marketLabel }) }) : null,
|
|
6175
6176
|
/* @__PURE__ */ jsx10(PriceButtons, { selections: r.selections, ui, onAdd: add ? (s) => add(r.matchId, market, s) : void 0 }),
|
|
6176
6177
|
r.stat ? /* @__PURE__ */ jsx10("p", { className: "ss-w-v2-stat", children: r.stat }) : null
|
|
6177
6178
|
]
|
|
@@ -6373,7 +6374,7 @@ function oldestQuote(legs) {
|
|
|
6373
6374
|
|
|
6374
6375
|
// src/components/dashboard/v2/useRepriceAdd.ts
|
|
6375
6376
|
var NO_SLIP = {};
|
|
6376
|
-
function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
6377
|
+
function useRepriceAdd({ conversation, locale, slip, ui, sport = "football" }) {
|
|
6377
6378
|
const scope = useSportScope();
|
|
6378
6379
|
const operatorUserId = scope?.operatorUserId;
|
|
6379
6380
|
const anonymousUserId = scope?.anonymousUserId;
|
|
@@ -6392,7 +6393,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6392
6393
|
if (!conversation || !slip) return { outcome: "failed" };
|
|
6393
6394
|
try {
|
|
6394
6395
|
const grid = await conversation.getBuilderGrid(locale, {
|
|
6395
|
-
sport
|
|
6396
|
+
sport,
|
|
6396
6397
|
matchIds: [matchId],
|
|
6397
6398
|
marketKey: market,
|
|
6398
6399
|
legs: 1,
|
|
@@ -6403,8 +6404,8 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6403
6404
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6404
6405
|
});
|
|
6405
6406
|
if (grid === null) return { outcome: "cool_off" };
|
|
6406
|
-
if (grid.status !== "ok" || grid.legs.length !== 1) return { outcome: "gone" };
|
|
6407
|
-
const leg = legsOf(grid,
|
|
6407
|
+
if (grid.status !== "ok" || grid.sport !== sport || grid.legs.length !== 1) return { outcome: "gone" };
|
|
6408
|
+
const leg = legsOf(grid, sport)?.[0];
|
|
6408
6409
|
if (!leg) return { outcome: "gone" };
|
|
6409
6410
|
kickoffs.current.set(leg.matchId, leg.kickoffUtc);
|
|
6410
6411
|
const outcome = await addToSlip(comboLegToSlipSelection(leg, slip.conversationId), {
|
|
@@ -6418,7 +6419,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6418
6419
|
} catch {
|
|
6419
6420
|
return { outcome: "failed" };
|
|
6420
6421
|
}
|
|
6421
|
-
}, [conversation, locale, slip, ui, addToSlip, operatorUserId, anonymousUserId]);
|
|
6422
|
+
}, [conversation, locale, slip, ui, sport, addToSlip, operatorUserId, anonymousUserId]);
|
|
6422
6423
|
return canAdd2 ? add : void 0;
|
|
6423
6424
|
}
|
|
6424
6425
|
|
|
@@ -6432,11 +6433,11 @@ var CHIP_LABEL = {
|
|
|
6432
6433
|
build_combo: (ui) => ui.v2ChipBuildCombo
|
|
6433
6434
|
};
|
|
6434
6435
|
var chipsFor = (section2) => section2.chips.filter((c) => Object.prototype.hasOwnProperty.call(CHIP_LABEL, c) && (!section2.coolOff || c === "live_games"));
|
|
6435
|
-
function MarketFirstGreeting({ section: section2, ui, slip, onAct }) {
|
|
6436
|
+
function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
|
|
6436
6437
|
const log = useEventLog();
|
|
6437
6438
|
const personal = usePersonalGreeting();
|
|
6438
6439
|
const openTab = personal?.openTab;
|
|
6439
|
-
const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui });
|
|
6440
|
+
const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui, sport });
|
|
6440
6441
|
const [chosen, setChosen] = useState20(null);
|
|
6441
6442
|
const [open, setOpen] = useState20(false);
|
|
6442
6443
|
const base = section2.coolOff ? void 0 : section2.featured;
|
|
@@ -7961,7 +7962,7 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, greeting, onTa
|
|
|
7961
7962
|
/* @__PURE__ */ jsx33("span", { className: "ss-w-dash-title", children: shown2.title }),
|
|
7962
7963
|
shown2.subtitle && !shown2.marketFirst ? /* @__PURE__ */ jsx33("span", { className: "ss-w-dash-subtitle", children: shown2.subtitle }) : null
|
|
7963
7964
|
] }),
|
|
7964
|
-
shown2.marketFirst ? /* @__PURE__ */ jsx33(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ jsx33(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx33("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ jsx33(
|
|
7965
|
+
shown2.marketFirst ? /* @__PURE__ */ jsx33(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ jsx33(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx33("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ jsx33(
|
|
7965
7966
|
DashboardTile,
|
|
7966
7967
|
{
|
|
7967
7968
|
tile: tileForFormat(t, oddsFormat),
|
|
@@ -8188,14 +8189,16 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown)
|
|
|
8188
8189
|
import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef25, useState as useState35 } from "react";
|
|
8189
8190
|
var CLEARED = { text: null, asks: [] };
|
|
8190
8191
|
function useMobileBinding(args) {
|
|
8191
|
-
const { binding, panelOpen, popupText, asks, cta } = args;
|
|
8192
|
+
const { binding, panelOpen, popupText, asks, cta, price } = args;
|
|
8192
8193
|
const latest = useRef25(args);
|
|
8193
8194
|
latest.current = args;
|
|
8194
8195
|
const bindingRef = useRef25(binding);
|
|
8195
8196
|
bindingRef.current = binding;
|
|
8196
8197
|
const backRef = useRef25(null);
|
|
8198
|
+
const priceRef = useRef25(null);
|
|
8199
|
+
const priceInFlight = useRef25(/* @__PURE__ */ new Set()).current;
|
|
8197
8200
|
const [confirmedShown, setConfirmedShown] = useState35(null);
|
|
8198
|
-
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta]);
|
|
8201
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta, price]);
|
|
8199
8202
|
const reported = useRef25({ binding: void 0, key: "" });
|
|
8200
8203
|
useEffect30(() => {
|
|
8201
8204
|
if (!binding) return;
|
|
@@ -8203,7 +8206,7 @@ function useMobileBinding(args) {
|
|
|
8203
8206
|
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
8204
8207
|
reported.current = { binding, key: teaserKey };
|
|
8205
8208
|
if (teaserKey === "" && prev.binding !== binding) return;
|
|
8206
|
-
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {} });
|
|
8209
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {}, ...price ? { price } : {} });
|
|
8207
8210
|
}, [binding, teaserKey]);
|
|
8208
8211
|
useEffect30(() => {
|
|
8209
8212
|
if (!binding) return;
|
|
@@ -8219,6 +8222,12 @@ function useMobileBinding(args) {
|
|
|
8219
8222
|
tapCta: () => {
|
|
8220
8223
|
if (latest.current.cta) latest.current.onCta();
|
|
8221
8224
|
},
|
|
8225
|
+
tapTeaser: () => latest.current.onTeaserTap(),
|
|
8226
|
+
tapPrice: (matchOddsId) => {
|
|
8227
|
+
const { panelOpen: open, popupText: text2, price: shown2 } = latest.current;
|
|
8228
|
+
if (open || !text2 || shown2?.matchOddsId !== matchOddsId) return;
|
|
8229
|
+
priceRef.current?.();
|
|
8230
|
+
},
|
|
8222
8231
|
dismissTeaser: () => latest.current.dismissPopup(),
|
|
8223
8232
|
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
8224
8233
|
back: () => backRef.current?.() ?? false
|
|
@@ -8229,8 +8238,12 @@ function useMobileBinding(args) {
|
|
|
8229
8238
|
const onRegisterBack = useCallback25((fn) => {
|
|
8230
8239
|
backRef.current = fn;
|
|
8231
8240
|
}, []);
|
|
8232
|
-
|
|
8233
|
-
|
|
8241
|
+
const onRegisterPrice = useCallback25((fn) => {
|
|
8242
|
+
priceRef.current = fn;
|
|
8243
|
+
}, []);
|
|
8244
|
+
const onPriceResult = useCallback25((result) => bindingRef.current?.onPriceResult(result), []);
|
|
8245
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0, onRegisterPrice: void 0, onPriceResult: void 0, priceInFlight: void 0 };
|
|
8246
|
+
return { confirmedShown, onCloseRequested, onRegisterBack, onRegisterPrice, onPriceResult, priceInFlight };
|
|
8234
8247
|
}
|
|
8235
8248
|
|
|
8236
8249
|
// src/openTelemetry.ts
|
|
@@ -8323,20 +8336,53 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8323
8336
|
// src/components/BubblePrice.tsx
|
|
8324
8337
|
import { useMemo as useMemo11 } from "react";
|
|
8325
8338
|
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8326
|
-
function BubblePrice({ matchId, price, conversation, slip, ui, hook }) {
|
|
8339
|
+
function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
|
|
8327
8340
|
const selections = useMemo11(() => [price.selection], [price.selection]);
|
|
8328
|
-
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui });
|
|
8341
|
+
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
|
|
8329
8342
|
return /* @__PURE__ */ jsxs33("div", { className: "ss-w-greeting-price", children: [
|
|
8330
8343
|
/* @__PURE__ */ jsx37("span", { className: "ss-w-v2-market", children: price.marketLabel }),
|
|
8331
8344
|
/* @__PURE__ */ jsx37(PriceButtons, { selections, ui, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 })
|
|
8332
8345
|
] });
|
|
8333
8346
|
}
|
|
8334
8347
|
|
|
8348
|
+
// src/components/MobileBubblePrice.tsx
|
|
8349
|
+
import { useEffect as useEffect33, useRef as useRef28 } from "react";
|
|
8350
|
+
function MobileBubblePrice(props) {
|
|
8351
|
+
const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
|
|
8352
|
+
const latest = useRef28({ props, add });
|
|
8353
|
+
latest.current = { props, add };
|
|
8354
|
+
const { onRegister, inFlight: inFlight2 } = props;
|
|
8355
|
+
useEffect33(() => {
|
|
8356
|
+
onRegister(() => {
|
|
8357
|
+
const { props: p, add: run } = latest.current;
|
|
8358
|
+
const id = p.price.selection.matchOddsId;
|
|
8359
|
+
if (inFlight2.has(id)) return;
|
|
8360
|
+
const report = (r) => {
|
|
8361
|
+
const now = latest.current.props;
|
|
8362
|
+
try {
|
|
8363
|
+
now.onResult({ matchOddsId: id, outcome: r.outcome, text: r.toast?.text ?? (r.outcome === "gone" ? now.ui.v2PriceGone : null) });
|
|
8364
|
+
} catch {
|
|
8365
|
+
}
|
|
8366
|
+
};
|
|
8367
|
+
if (!run) {
|
|
8368
|
+
report({ outcome: "failed" });
|
|
8369
|
+
return;
|
|
8370
|
+
}
|
|
8371
|
+
inFlight2.add(id);
|
|
8372
|
+
run(p.matchId, p.price.market, p.price.selection, p.hook).then(report, () => report({ outcome: "failed" })).finally(() => {
|
|
8373
|
+
inFlight2.delete(id);
|
|
8374
|
+
});
|
|
8375
|
+
});
|
|
8376
|
+
return () => onRegister(null);
|
|
8377
|
+
}, [onRegister, inFlight2]);
|
|
8378
|
+
return null;
|
|
8379
|
+
}
|
|
8380
|
+
|
|
8335
8381
|
// src/components/ChatPanel.tsx
|
|
8336
|
-
import { useCallback as useCallback29, useEffect as
|
|
8382
|
+
import { useCallback as useCallback29, useEffect as useEffect59, useLayoutEffect as useLayoutEffect2, useMemo as useMemo15, useRef as useRef49, useState as useState87 } from "react";
|
|
8337
8383
|
|
|
8338
8384
|
// src/components/ChatHeader.tsx
|
|
8339
|
-
import { useEffect as
|
|
8385
|
+
import { useEffect as useEffect34, useRef as useRef29, useState as useState38 } from "react";
|
|
8340
8386
|
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8341
8387
|
function ChatHeader({
|
|
8342
8388
|
onClose,
|
|
@@ -8353,17 +8399,17 @@ function ChatHeader({
|
|
|
8353
8399
|
favouritesLabel
|
|
8354
8400
|
}) {
|
|
8355
8401
|
const [menuOpen, setMenuOpen] = useState38(false);
|
|
8356
|
-
const wrapRef =
|
|
8357
|
-
const kebabRef =
|
|
8358
|
-
const firstItemRef =
|
|
8402
|
+
const wrapRef = useRef29(null);
|
|
8403
|
+
const kebabRef = useRef29(null);
|
|
8404
|
+
const firstItemRef = useRef29(null);
|
|
8359
8405
|
const hasNew = !!(canReset && onNewConversation);
|
|
8360
8406
|
const hasSettings = !!onOpenSettings;
|
|
8361
8407
|
const hasFavourites = !!onOpenFavourites;
|
|
8362
8408
|
const hasMenu = hasFavourites || hasNew || hasSettings;
|
|
8363
|
-
|
|
8409
|
+
useEffect34(() => {
|
|
8364
8410
|
if (menuOpen) firstItemRef.current?.focus();
|
|
8365
8411
|
}, [menuOpen]);
|
|
8366
|
-
|
|
8412
|
+
useEffect34(() => {
|
|
8367
8413
|
if (!menuOpen) return;
|
|
8368
8414
|
const onPointer = (e) => {
|
|
8369
8415
|
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
@@ -8451,7 +8497,7 @@ function ChatHeader({
|
|
|
8451
8497
|
}
|
|
8452
8498
|
|
|
8453
8499
|
// src/components/MessageList.tsx
|
|
8454
|
-
import { useEffect as
|
|
8500
|
+
import { useEffect as useEffect38, useRef as useRef32 } from "react";
|
|
8455
8501
|
|
|
8456
8502
|
// src/components/ChatMessage.tsx
|
|
8457
8503
|
import { useState as useState49 } from "react";
|
|
@@ -10094,7 +10140,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10094
10140
|
}
|
|
10095
10141
|
|
|
10096
10142
|
// src/components/CompactOddsList.tsx
|
|
10097
|
-
import { useEffect as
|
|
10143
|
+
import { useEffect as useEffect35, useRef as useRef30, useState as useState42 } from "react";
|
|
10098
10144
|
import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
|
|
10099
10145
|
|
|
10100
10146
|
// src/compactList.ts
|
|
@@ -10219,8 +10265,8 @@ function CompactOddsList({ list, ui, slip, monitor }) {
|
|
|
10219
10265
|
const [shown2, setShown] = useState42(COMPACT_PAGE);
|
|
10220
10266
|
const hidden = list.rowCount - shown2;
|
|
10221
10267
|
const [focusIndex, setFocusIndex] = useState42(null);
|
|
10222
|
-
const focusRef =
|
|
10223
|
-
|
|
10268
|
+
const focusRef = useRef30(null);
|
|
10269
|
+
useEffect35(() => {
|
|
10224
10270
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
10225
10271
|
}, [focusIndex]);
|
|
10226
10272
|
let left = shown2;
|
|
@@ -10455,7 +10501,7 @@ function FixtureCard({ card, ui }) {
|
|
|
10455
10501
|
}
|
|
10456
10502
|
|
|
10457
10503
|
// src/components/dashboard/CountdownCard.tsx
|
|
10458
|
-
import { Fragment as Fragment15, useEffect as
|
|
10504
|
+
import { Fragment as Fragment15, useEffect as useEffect36, useState as useState43 } from "react";
|
|
10459
10505
|
import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10460
10506
|
var DAY_MS3 = 864e5;
|
|
10461
10507
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -10479,7 +10525,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10479
10525
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
10480
10526
|
);
|
|
10481
10527
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
10482
|
-
|
|
10528
|
+
useEffect36(() => {
|
|
10483
10529
|
if (reduced) return;
|
|
10484
10530
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
10485
10531
|
return () => window.clearInterval(id);
|
|
@@ -10835,10 +10881,10 @@ function RestingFormCard({ card }) {
|
|
|
10835
10881
|
}
|
|
10836
10882
|
|
|
10837
10883
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10838
|
-
import { useRef as
|
|
10884
|
+
import { useRef as useRef31, useState as useState47 } from "react";
|
|
10839
10885
|
|
|
10840
10886
|
// src/useLiveClock.ts
|
|
10841
|
-
import { useEffect as
|
|
10887
|
+
import { useEffect as useEffect37, useState as useState46 } from "react";
|
|
10842
10888
|
var TICK_MS = 6e4;
|
|
10843
10889
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10844
10890
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10850,7 +10896,7 @@ function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
|
10850
10896
|
const [displayMinute, setDisplayMinute] = useState46(
|
|
10851
10897
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10852
10898
|
);
|
|
10853
|
-
|
|
10899
|
+
useEffect37(() => {
|
|
10854
10900
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10855
10901
|
if (!clockRunning) return;
|
|
10856
10902
|
const id = window.setInterval(() => {
|
|
@@ -10889,7 +10935,7 @@ function LiveScoreCard({
|
|
|
10889
10935
|
}) {
|
|
10890
10936
|
const { data } = card;
|
|
10891
10937
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10892
|
-
const seedRef =
|
|
10938
|
+
const seedRef = useRef31(null);
|
|
10893
10939
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10894
10940
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10895
10941
|
}
|
|
@@ -11231,11 +11277,11 @@ function turnAnchor(messages) {
|
|
|
11231
11277
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
11232
11278
|
const { state, send } = controller;
|
|
11233
11279
|
const { oddsFormat } = useOddsSettings();
|
|
11234
|
-
const listRef =
|
|
11235
|
-
const endRef =
|
|
11236
|
-
const pinnedRef =
|
|
11237
|
-
const anchoredTurnRef =
|
|
11238
|
-
|
|
11280
|
+
const listRef = useRef32(null);
|
|
11281
|
+
const endRef = useRef32(null);
|
|
11282
|
+
const pinnedRef = useRef32(true);
|
|
11283
|
+
const anchoredTurnRef = useRef32(null);
|
|
11284
|
+
useEffect38(() => {
|
|
11239
11285
|
const anchor = turnAnchor(state.messages);
|
|
11240
11286
|
const list = listRef.current;
|
|
11241
11287
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -11294,13 +11340,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
11294
11340
|
}
|
|
11295
11341
|
|
|
11296
11342
|
// src/components/ChatInput.tsx
|
|
11297
|
-
import { forwardRef, useEffect as
|
|
11343
|
+
import { forwardRef, useEffect as useEffect39, useImperativeHandle, useRef as useRef33, useState as useState50 } from "react";
|
|
11298
11344
|
import { jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
11299
11345
|
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
11300
11346
|
const [value, setValue] = useState50("");
|
|
11301
|
-
const textareaRef =
|
|
11302
|
-
const stopRef =
|
|
11303
|
-
const textBoxWantsFocusRef =
|
|
11347
|
+
const textareaRef = useRef33(null);
|
|
11348
|
+
const stopRef = useRef33(null);
|
|
11349
|
+
const textBoxWantsFocusRef = useRef33(false);
|
|
11304
11350
|
const submit = () => {
|
|
11305
11351
|
if (disabled) return;
|
|
11306
11352
|
const t = value.trim();
|
|
@@ -11326,7 +11372,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
11326
11372
|
stopRef.current?.focus();
|
|
11327
11373
|
}
|
|
11328
11374
|
}), []);
|
|
11329
|
-
|
|
11375
|
+
useEffect39(() => {
|
|
11330
11376
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
11331
11377
|
textBoxWantsFocusRef.current = false;
|
|
11332
11378
|
const box = textareaRef.current;
|
|
@@ -11357,7 +11403,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
11357
11403
|
});
|
|
11358
11404
|
|
|
11359
11405
|
// src/components/TabBar.tsx
|
|
11360
|
-
import { useEffect as
|
|
11406
|
+
import { useEffect as useEffect40, useLayoutEffect, useRef as useRef34 } from "react";
|
|
11361
11407
|
import { jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
11362
11408
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
11363
11409
|
var FOCUS_EDGE = 24;
|
|
@@ -11380,9 +11426,9 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11380
11426
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
11381
11427
|
];
|
|
11382
11428
|
const track = useTrack();
|
|
11383
|
-
const listRef =
|
|
11429
|
+
const listRef = useRef34(null);
|
|
11384
11430
|
const activeTab = monitor.activeTab;
|
|
11385
|
-
|
|
11431
|
+
useEffect40(() => {
|
|
11386
11432
|
const el = listRef.current?.querySelector("[data-on]");
|
|
11387
11433
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
11388
11434
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -11413,7 +11459,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11413
11459
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
11414
11460
|
};
|
|
11415
11461
|
}, [labelSignature]);
|
|
11416
|
-
const pointerDown =
|
|
11462
|
+
const pointerDown = useRef34(false);
|
|
11417
11463
|
const keepFocusedTabInView = (e) => {
|
|
11418
11464
|
const strip = e.currentTarget;
|
|
11419
11465
|
const tab = e.target;
|
|
@@ -11946,10 +11992,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11946
11992
|
}
|
|
11947
11993
|
|
|
11948
11994
|
// src/components/NbaPropsSection.tsx
|
|
11949
|
-
import { useEffect as
|
|
11995
|
+
import { useEffect as useEffect42, useState as useState55 } from "react";
|
|
11950
11996
|
|
|
11951
11997
|
// src/components/PropsPieces.tsx
|
|
11952
|
-
import { useEffect as
|
|
11998
|
+
import { useEffect as useEffect41, useState as useState54 } from "react";
|
|
11953
11999
|
import { Fragment as Fragment18, jsx as jsx85, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
11954
12000
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11955
12001
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11964,7 +12010,7 @@ function preKickoff(match) {
|
|
|
11964
12010
|
function usePreKickoff(match) {
|
|
11965
12011
|
const [, setTick] = useState54(0);
|
|
11966
12012
|
const pre = preKickoff(match);
|
|
11967
|
-
|
|
12013
|
+
useEffect41(() => {
|
|
11968
12014
|
if (!pre || !match.kickoffUtc) return;
|
|
11969
12015
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11970
12016
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11978,7 +12024,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11978
12024
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11979
12025
|
const live = match.phase === "live";
|
|
11980
12026
|
const open = pre || live;
|
|
11981
|
-
|
|
12027
|
+
useEffect41(() => {
|
|
11982
12028
|
if (!open) return;
|
|
11983
12029
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11984
12030
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -12157,7 +12203,7 @@ function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
|
12157
12203
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
12158
12204
|
const valid = !Number.isNaN(at2);
|
|
12159
12205
|
const onBreak = atBreak(match);
|
|
12160
|
-
|
|
12206
|
+
useEffect41(() => {
|
|
12161
12207
|
if (!valid || onBreak) return;
|
|
12162
12208
|
const age2 = Date.now() - at2;
|
|
12163
12209
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12223,7 +12269,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
12223
12269
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
12224
12270
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
12225
12271
|
const onBreak = atBreak(match);
|
|
12226
|
-
|
|
12272
|
+
useEffect42(() => {
|
|
12227
12273
|
if (!valid || onBreak) return;
|
|
12228
12274
|
const age2 = Date.now() - at2;
|
|
12229
12275
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12832,7 +12878,7 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12832
12878
|
}
|
|
12833
12879
|
|
|
12834
12880
|
// src/components/TennisMonitorCard.tsx
|
|
12835
|
-
import { useRef as
|
|
12881
|
+
import { useRef as useRef35 } from "react";
|
|
12836
12882
|
import { toWireSport as toWireSport6 } from "@sensiblestats/widget-sdk";
|
|
12837
12883
|
|
|
12838
12884
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -13095,7 +13141,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
13095
13141
|
}
|
|
13096
13142
|
|
|
13097
13143
|
// src/components/TennisStatsTables.tsx
|
|
13098
|
-
import { Fragment as Fragment25, useEffect as
|
|
13144
|
+
import { Fragment as Fragment25, useEffect as useEffect43, useState as useState60 } from "react";
|
|
13099
13145
|
import { Fragment as Fragment26, jsx as jsx96, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
13100
13146
|
function formatStat(row, value, locale) {
|
|
13101
13147
|
if (value == null) return "\u2013";
|
|
@@ -13134,7 +13180,7 @@ function Tables({ table, labels, names, locale }) {
|
|
|
13134
13180
|
}
|
|
13135
13181
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
13136
13182
|
const [tab, setTab] = useState60("match");
|
|
13137
|
-
|
|
13183
|
+
useEffect43(() => {
|
|
13138
13184
|
setTab("match");
|
|
13139
13185
|
}, [resetKey]);
|
|
13140
13186
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -13300,7 +13346,7 @@ function HeadToHead({ t, ui }) {
|
|
|
13300
13346
|
] });
|
|
13301
13347
|
}
|
|
13302
13348
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
13303
|
-
const lastTables =
|
|
13349
|
+
const lastTables = useRef35(null);
|
|
13304
13350
|
const t = match.tennis;
|
|
13305
13351
|
if (!t) return /* @__PURE__ */ jsx97(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
13306
13352
|
const preMatch = match.phase === "preMatch";
|
|
@@ -13380,7 +13426,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13380
13426
|
}
|
|
13381
13427
|
|
|
13382
13428
|
// src/components/ScoreboardStrip.tsx
|
|
13383
|
-
import { useEffect as
|
|
13429
|
+
import { useEffect as useEffect44, useRef as useRef36 } from "react";
|
|
13384
13430
|
import { sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
13385
13431
|
import { jsx as jsx98, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
13386
13432
|
function nbaStatus(m, ui) {
|
|
@@ -13475,8 +13521,8 @@ function rowsFor(m) {
|
|
|
13475
13521
|
];
|
|
13476
13522
|
}
|
|
13477
13523
|
function useStripScroll(selectedKey) {
|
|
13478
|
-
const stripRef =
|
|
13479
|
-
|
|
13524
|
+
const stripRef = useRef36(null);
|
|
13525
|
+
useEffect44(() => {
|
|
13480
13526
|
const strip = stripRef.current;
|
|
13481
13527
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
13482
13528
|
if (!strip || !pressed) return;
|
|
@@ -13901,16 +13947,16 @@ import { useId as useId3, useState as useState61 } from "react";
|
|
|
13901
13947
|
import { localIdOf as localIdOf5, qualifiedId as qualifiedId3, slipSportOf as slipSportOf9, toWireSport as toWireSport7 } from "@sensiblestats/widget-sdk";
|
|
13902
13948
|
|
|
13903
13949
|
// src/useModalDialog.ts
|
|
13904
|
-
import { useEffect as
|
|
13950
|
+
import { useEffect as useEffect45, useRef as useRef37 } from "react";
|
|
13905
13951
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13906
13952
|
function useModalDialog(onClose, opts = {}) {
|
|
13907
|
-
const dialogRef =
|
|
13908
|
-
const onCloseRef =
|
|
13953
|
+
const dialogRef = useRef37(null);
|
|
13954
|
+
const onCloseRef = useRef37(onClose);
|
|
13909
13955
|
onCloseRef.current = onClose;
|
|
13910
|
-
const openerRef =
|
|
13956
|
+
const openerRef = useRef37(opts.opener);
|
|
13911
13957
|
openerRef.current = opts.opener;
|
|
13912
13958
|
const restore = opts.restoreFocus ?? true;
|
|
13913
|
-
|
|
13959
|
+
useEffect45(() => {
|
|
13914
13960
|
const dialog = dialogRef.current;
|
|
13915
13961
|
const root = dialog?.getRootNode();
|
|
13916
13962
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13921,7 +13967,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13921
13967
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13922
13968
|
};
|
|
13923
13969
|
}, []);
|
|
13924
|
-
|
|
13970
|
+
useEffect45(() => {
|
|
13925
13971
|
const onKey = (e) => {
|
|
13926
13972
|
if (e.key !== "Escape") return;
|
|
13927
13973
|
e.stopPropagation();
|
|
@@ -14173,20 +14219,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14173
14219
|
}
|
|
14174
14220
|
|
|
14175
14221
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14176
|
-
import { useEffect as
|
|
14222
|
+
import { useEffect as useEffect48, useId as useId4, useMemo as useMemo14, useRef as useRef41, useState as useState64 } from "react";
|
|
14177
14223
|
import { matchKey as matchKey10 } from "@sensiblestats/widget-sdk";
|
|
14178
14224
|
|
|
14179
14225
|
// src/useTennisRowPrices.ts
|
|
14180
|
-
import { useEffect as
|
|
14226
|
+
import { useEffect as useEffect46, useRef as useRef38, useState as useState63 } from "react";
|
|
14181
14227
|
import { matchKey as matchKey9 } from "@sensiblestats/widget-sdk";
|
|
14182
14228
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14183
14229
|
function useTennisRowPrices(a) {
|
|
14184
14230
|
const [state, setState] = useState63({ byId: null, stale: false });
|
|
14185
|
-
const getPricesRef =
|
|
14231
|
+
const getPricesRef = useRef38(a.getPrices);
|
|
14186
14232
|
getPricesRef.current = a.getPrices;
|
|
14187
|
-
const latest =
|
|
14233
|
+
const latest = useRef38(0);
|
|
14188
14234
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
14189
|
-
|
|
14235
|
+
useEffect46(() => {
|
|
14190
14236
|
if (!a.enabled || idsKey === "") {
|
|
14191
14237
|
latest.current++;
|
|
14192
14238
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -14224,11 +14270,11 @@ function useTennisRowPrices(a) {
|
|
|
14224
14270
|
}
|
|
14225
14271
|
|
|
14226
14272
|
// src/components/DayStrip.tsx
|
|
14227
|
-
import { useEffect as
|
|
14273
|
+
import { useEffect as useEffect47, useRef as useRef39 } from "react";
|
|
14228
14274
|
import { jsx as jsx107, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
14229
14275
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
14230
|
-
const listRef =
|
|
14231
|
-
|
|
14276
|
+
const listRef = useRef39(null);
|
|
14277
|
+
useEffect47(() => {
|
|
14232
14278
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
14233
14279
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
14234
14280
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -14257,7 +14303,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
14257
14303
|
}
|
|
14258
14304
|
|
|
14259
14305
|
// src/components/games/ui/SearchField.tsx
|
|
14260
|
-
import { useCallback as useCallback27, useRef as
|
|
14306
|
+
import { useCallback as useCallback27, useRef as useRef40 } from "react";
|
|
14261
14307
|
|
|
14262
14308
|
// src/components/games/ui/icons.tsx
|
|
14263
14309
|
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
@@ -14296,7 +14342,7 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ jsx108("path", { d:
|
|
|
14296
14342
|
// src/components/games/ui/SearchField.tsx
|
|
14297
14343
|
import { jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
14298
14344
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
14299
|
-
const localRef =
|
|
14345
|
+
const localRef = useRef40(null);
|
|
14300
14346
|
const setInputRef = useCallback27((node) => {
|
|
14301
14347
|
localRef.current = node;
|
|
14302
14348
|
if (typeof inputRef === "function") inputRef(node);
|
|
@@ -14347,10 +14393,10 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14347
14393
|
const [query, setQuery] = useState64("");
|
|
14348
14394
|
const [toggled, setToggled] = useState64(/* @__PURE__ */ new Map());
|
|
14349
14395
|
const [expanded, setExpanded] = useState64(/* @__PURE__ */ new Set());
|
|
14350
|
-
const listRef =
|
|
14396
|
+
const listRef = useRef41(null);
|
|
14351
14397
|
const [sheet, setSheet] = useState64(null);
|
|
14352
14398
|
const { chips, selected } = loaded;
|
|
14353
|
-
|
|
14399
|
+
useEffect48(() => {
|
|
14354
14400
|
if (selected !== day) onDay(selected);
|
|
14355
14401
|
}, [day, selected, onDay]);
|
|
14356
14402
|
const isToday = selected === today;
|
|
@@ -14492,7 +14538,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14492
14538
|
}
|
|
14493
14539
|
|
|
14494
14540
|
// src/components/GamesPanel.tsx
|
|
14495
|
-
import { useEffect as
|
|
14541
|
+
import { useEffect as useEffect52, useState as useState79 } from "react";
|
|
14496
14542
|
|
|
14497
14543
|
// src/components/GamesLoginWall.tsx
|
|
14498
14544
|
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
@@ -14501,7 +14547,7 @@ function GamesLoginWall({ ui }) {
|
|
|
14501
14547
|
}
|
|
14502
14548
|
|
|
14503
14549
|
// src/components/GamesHub.tsx
|
|
14504
|
-
import { useEffect as
|
|
14550
|
+
import { useEffect as useEffect49, useState as useState65 } from "react";
|
|
14505
14551
|
|
|
14506
14552
|
// src/components/games/ui/gameMeta.ts
|
|
14507
14553
|
function prettifyGameId(gameId) {
|
|
@@ -14653,7 +14699,7 @@ function pickHeroGame(games) {
|
|
|
14653
14699
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14654
14700
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14655
14701
|
const [, setTick] = useState65(0);
|
|
14656
|
-
|
|
14702
|
+
useEffect49(() => {
|
|
14657
14703
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14658
14704
|
return () => clearInterval(id);
|
|
14659
14705
|
}, []);
|
|
@@ -14713,10 +14759,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14713
14759
|
}
|
|
14714
14760
|
|
|
14715
14761
|
// src/components/GameScreenHost.tsx
|
|
14716
|
-
import { useEffect as
|
|
14762
|
+
import { useEffect as useEffect51, useRef as useRef44, useState as useState77 } from "react";
|
|
14717
14763
|
|
|
14718
14764
|
// src/useGamePlay.ts
|
|
14719
|
-
import { useCallback as useCallback28, useRef as
|
|
14765
|
+
import { useCallback as useCallback28, useRef as useRef42, useState as useState66 } from "react";
|
|
14720
14766
|
function toSubmitResult(payload) {
|
|
14721
14767
|
return {
|
|
14722
14768
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14731,12 +14777,12 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14731
14777
|
const [result, setResult] = useState66(null);
|
|
14732
14778
|
const [submitting, setSubmitting] = useState66(false);
|
|
14733
14779
|
const [rawStatus, setRawStatus] = useState66(null);
|
|
14734
|
-
const inFlightRef =
|
|
14735
|
-
const convRef =
|
|
14780
|
+
const inFlightRef = useRef42(false);
|
|
14781
|
+
const convRef = useRef42(conversation);
|
|
14736
14782
|
convRef.current = conversation;
|
|
14737
|
-
const optsRef =
|
|
14783
|
+
const optsRef = useRef42({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14738
14784
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14739
|
-
const resultRef =
|
|
14785
|
+
const resultRef = useRef42(null);
|
|
14740
14786
|
resultRef.current = result;
|
|
14741
14787
|
const refetch = useCallback28(async () => {
|
|
14742
14788
|
const conv = convRef.current;
|
|
@@ -15668,7 +15714,7 @@ function CareerPathGame({
|
|
|
15668
15714
|
}
|
|
15669
15715
|
|
|
15670
15716
|
// src/components/games/BeatTheGridGame.tsx
|
|
15671
|
-
import React, { useEffect as
|
|
15717
|
+
import React, { useEffect as useEffect50, useId as useId7, useRef as useRef43, useState as useState71 } from "react";
|
|
15672
15718
|
|
|
15673
15719
|
// src/components/games/ui/OptionList.tsx
|
|
15674
15720
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
@@ -15759,8 +15805,8 @@ function SearchSheet({
|
|
|
15759
15805
|
const s = ui.games.beatTheGrid;
|
|
15760
15806
|
const [query, setQuery] = useState71("");
|
|
15761
15807
|
const inputId = useId7();
|
|
15762
|
-
const inputRef =
|
|
15763
|
-
|
|
15808
|
+
const inputRef = useRef43(null);
|
|
15809
|
+
useEffect50(() => {
|
|
15764
15810
|
inputRef.current?.focus();
|
|
15765
15811
|
}, [row, col]);
|
|
15766
15812
|
const filtered = playerPool.filter(
|
|
@@ -17064,7 +17110,7 @@ function GameScreenHost({
|
|
|
17064
17110
|
}) {
|
|
17065
17111
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
17066
17112
|
const [configJson, setConfigJson] = useState77(null);
|
|
17067
|
-
|
|
17113
|
+
useEffect51(() => {
|
|
17068
17114
|
setConfigJson(null);
|
|
17069
17115
|
if (!conversation) return;
|
|
17070
17116
|
let cancelled = false;
|
|
@@ -17087,12 +17133,12 @@ function GameScreenHost({
|
|
|
17087
17133
|
fixtureId: fixtureId || void 0,
|
|
17088
17134
|
locale: ui.hostTag
|
|
17089
17135
|
});
|
|
17090
|
-
|
|
17136
|
+
useEffect51(() => {
|
|
17091
17137
|
if (conversation) hydrate();
|
|
17092
17138
|
}, [conversation, gameId]);
|
|
17093
|
-
const hydrateRef =
|
|
17139
|
+
const hydrateRef = useRef44(hydrate);
|
|
17094
17140
|
hydrateRef.current = hydrate;
|
|
17095
|
-
|
|
17141
|
+
useEffect51(() => {
|
|
17096
17142
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
17097
17143
|
if (rawStatus !== "pending") return;
|
|
17098
17144
|
const timerId = setInterval(() => {
|
|
@@ -17399,7 +17445,7 @@ function GamesPanel({
|
|
|
17399
17445
|
}) {
|
|
17400
17446
|
const [selected, setSelected] = useState79(null);
|
|
17401
17447
|
const [segment, setSegment] = useState79("play");
|
|
17402
|
-
|
|
17448
|
+
useEffect52(() => {
|
|
17403
17449
|
ensureGamesFonts();
|
|
17404
17450
|
}, []);
|
|
17405
17451
|
if (!loggedIn) return /* @__PURE__ */ jsx143(GamesLoginWall, { ui });
|
|
@@ -17463,10 +17509,10 @@ function GamesPanel({
|
|
|
17463
17509
|
}
|
|
17464
17510
|
|
|
17465
17511
|
// src/components/FavouritesPanel.tsx
|
|
17466
|
-
import { useEffect as
|
|
17512
|
+
import { useEffect as useEffect55, useRef as useRef46, useState as useState82 } from "react";
|
|
17467
17513
|
|
|
17468
17514
|
// src/components/FavouriteChips.tsx
|
|
17469
|
-
import { useEffect as
|
|
17515
|
+
import { useEffect as useEffect53, useState as useState80 } from "react";
|
|
17470
17516
|
import { Fragment as Fragment44, jsx as jsx144, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
17471
17517
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
17472
17518
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -17514,10 +17560,10 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
17514
17560
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
17515
17561
|
const [confirming, setConfirming] = useState80(false);
|
|
17516
17562
|
const data = controller.data;
|
|
17517
|
-
|
|
17563
|
+
useEffect53(() => {
|
|
17518
17564
|
setConfirming(false);
|
|
17519
17565
|
}, [sport]);
|
|
17520
|
-
|
|
17566
|
+
useEffect53(() => {
|
|
17521
17567
|
if (!confirming) return;
|
|
17522
17568
|
const onPointerDown = (e) => {
|
|
17523
17569
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -17571,7 +17617,7 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
17571
17617
|
}
|
|
17572
17618
|
|
|
17573
17619
|
// src/components/FavouritesSearch.tsx
|
|
17574
|
-
import { useEffect as
|
|
17620
|
+
import { useEffect as useEffect54, useRef as useRef45, useState as useState81 } from "react";
|
|
17575
17621
|
import { jsx as jsx145, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
17576
17622
|
var MIN_LETTERS = 2;
|
|
17577
17623
|
var MAX_LENGTH = 64;
|
|
@@ -17579,13 +17625,13 @@ var DEBOUNCE_MS = 250;
|
|
|
17579
17625
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
17580
17626
|
const [query, setQuery] = useState81("");
|
|
17581
17627
|
const [answer, setAnswer] = useState81(null);
|
|
17582
|
-
const controllerRef =
|
|
17628
|
+
const controllerRef = useRef45(controller);
|
|
17583
17629
|
controllerRef.current = controller;
|
|
17584
17630
|
const trimmed = query.trim();
|
|
17585
17631
|
const queryKey = `${sport}|${trimmed}`;
|
|
17586
17632
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
17587
17633
|
const settled = answer?.key === queryKey;
|
|
17588
|
-
|
|
17634
|
+
useEffect54(() => {
|
|
17589
17635
|
setAnswer(null);
|
|
17590
17636
|
if (trimmed.length < MIN_LETTERS) return;
|
|
17591
17637
|
let cancelled = false;
|
|
@@ -17649,12 +17695,12 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17649
17695
|
import { jsx as jsx146, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
17650
17696
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17651
17697
|
const [notice, setNotice] = useState82(null);
|
|
17652
|
-
const refreshRef =
|
|
17698
|
+
const refreshRef = useRef46(controller.refresh);
|
|
17653
17699
|
refreshRef.current = controller.refresh;
|
|
17654
|
-
|
|
17700
|
+
useEffect55(() => {
|
|
17655
17701
|
void refreshRef.current();
|
|
17656
17702
|
}, []);
|
|
17657
|
-
|
|
17703
|
+
useEffect55(() => {
|
|
17658
17704
|
setNotice(null);
|
|
17659
17705
|
}, [sport]);
|
|
17660
17706
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17775,10 +17821,10 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17775
17821
|
}
|
|
17776
17822
|
|
|
17777
17823
|
// src/components/BuilderPanel.tsx
|
|
17778
|
-
import { useEffect as
|
|
17824
|
+
import { useEffect as useEffect58 } from "react";
|
|
17779
17825
|
|
|
17780
17826
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17781
|
-
import { useEffect as
|
|
17827
|
+
import { useEffect as useEffect57, useId as useId13, useRef as useRef48, useState as useState84 } from "react";
|
|
17782
17828
|
import { MAX_SWAPPED_IDS } from "@sensiblestats/widget-sdk";
|
|
17783
17829
|
import { Fragment as Fragment46, jsx as jsx149, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
17784
17830
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
@@ -17837,7 +17883,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17837
17883
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17838
17884
|
};
|
|
17839
17885
|
const [view, setView] = useState84(() => saved?.view ?? openingView);
|
|
17840
|
-
const autoWidened =
|
|
17886
|
+
const autoWidened = useRef48(false);
|
|
17841
17887
|
const [widenedNote, setWidenedNote] = useState84(saved?.widenedNote ?? false);
|
|
17842
17888
|
const track = useTrack();
|
|
17843
17889
|
const requestFor = (v, extra) => ({
|
|
@@ -17857,15 +17903,15 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17857
17903
|
const [editing, setEditing] = useState84(false);
|
|
17858
17904
|
const [draft, setDraft] = useState84("");
|
|
17859
17905
|
const [invalid, setInvalid] = useState84(null);
|
|
17860
|
-
const inputRef =
|
|
17861
|
-
const pencilRef =
|
|
17906
|
+
const inputRef = useRef48(null);
|
|
17907
|
+
const pencilRef = useRef48(null);
|
|
17862
17908
|
const noteId = useId13();
|
|
17863
17909
|
const customId = useId13();
|
|
17864
|
-
|
|
17910
|
+
useEffect57(() => {
|
|
17865
17911
|
if (editing) inputRef.current?.focus();
|
|
17866
17912
|
}, [editing]);
|
|
17867
17913
|
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
17868
|
-
|
|
17914
|
+
useEffect57(() => {
|
|
17869
17915
|
if (view.legs === 1) {
|
|
17870
17916
|
setEditing(false);
|
|
17871
17917
|
setDraft("");
|
|
@@ -17889,8 +17935,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17889
17935
|
} else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
|
|
17890
17936
|
setShown(shownAfter(shown2, grid, answeredFor));
|
|
17891
17937
|
}
|
|
17892
|
-
const lastRequest =
|
|
17893
|
-
|
|
17938
|
+
const lastRequest = useRef48(first);
|
|
17939
|
+
useEffect57(() => {
|
|
17894
17940
|
void request(lastRequest.current);
|
|
17895
17941
|
}, [request]);
|
|
17896
17942
|
const send = (req) => {
|
|
@@ -17937,8 +17983,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17937
17983
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
17938
17984
|
])).sort((a, b) => a - b);
|
|
17939
17985
|
const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
|
|
17940
|
-
const sectionRef =
|
|
17941
|
-
|
|
17986
|
+
const sectionRef = useRef48(null);
|
|
17987
|
+
useEffect57(() => {
|
|
17942
17988
|
if (tapped === null || status2 !== "ready") return;
|
|
17943
17989
|
setTapped(null);
|
|
17944
17990
|
const root = sectionRef.current;
|
|
@@ -17957,12 +18003,12 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17957
18003
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17958
18004
|
const [startedNote, setStartedNote] = useState84(false);
|
|
17959
18005
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17960
|
-
|
|
18006
|
+
useEffect57(() => {
|
|
17961
18007
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
17962
18008
|
}, [startedNote, status2, anyStarted]);
|
|
17963
18009
|
const market = rows?.[0]?.market;
|
|
17964
18010
|
const [seen2, setSeen] = useState84(null);
|
|
17965
|
-
|
|
18011
|
+
useEffect57(() => {
|
|
17966
18012
|
if (market) setSeen(market);
|
|
17967
18013
|
}, [market]);
|
|
17968
18014
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -18006,14 +18052,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
18006
18052
|
};
|
|
18007
18053
|
};
|
|
18008
18054
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
18009
|
-
|
|
18055
|
+
useEffect57(() => {
|
|
18010
18056
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
18011
18057
|
autoWidened.current = true;
|
|
18012
18058
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
18013
18059
|
commit(next, true);
|
|
18014
18060
|
send(requestFor(next));
|
|
18015
18061
|
}, [empty2, singles, widened, canWiden, view]);
|
|
18016
|
-
|
|
18062
|
+
useEffect57(() => {
|
|
18017
18063
|
if (coolOff) onCoolOff?.(sport);
|
|
18018
18064
|
}, [coolOff, onCoolOff, sport]);
|
|
18019
18065
|
if (coolOff) return null;
|
|
@@ -18213,7 +18259,7 @@ function BuilderPanel({ options, sport, onSportChange, ui, slip, onCoolOff, onHa
|
|
|
18213
18259
|
const scope = useSportScope();
|
|
18214
18260
|
const active = options.find((o) => o.sport === sport) ?? options[0];
|
|
18215
18261
|
const handingOff = active?.keepMarket === true;
|
|
18216
|
-
|
|
18262
|
+
useEffect58(() => {
|
|
18217
18263
|
if (handingOff) onHandOffMounted?.();
|
|
18218
18264
|
}, [handingOff]);
|
|
18219
18265
|
if (!active) return null;
|
|
@@ -18779,7 +18825,7 @@ import { Fragment as Fragment49, jsx as jsx160, jsxs as jsxs140 } from "react/js
|
|
|
18779
18825
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
18780
18826
|
function useIsModal() {
|
|
18781
18827
|
const [modal, setModal] = useState87(false);
|
|
18782
|
-
|
|
18828
|
+
useEffect59(() => {
|
|
18783
18829
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
18784
18830
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
18785
18831
|
const sync = () => setModal(mql.matches);
|
|
@@ -18797,8 +18843,8 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18797
18843
|
const [selectedPlayerId, setSelectedPlayerId] = useState87(null);
|
|
18798
18844
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
18799
18845
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
18800
|
-
const squadLayerRef =
|
|
18801
|
-
const squadScrollRef =
|
|
18846
|
+
const squadLayerRef = useRef49(null);
|
|
18847
|
+
const squadScrollRef = useRef49(null);
|
|
18802
18848
|
const selectPlayer = (playerId) => {
|
|
18803
18849
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
18804
18850
|
setSelectedPlayerId(playerId);
|
|
@@ -18821,7 +18867,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18821
18867
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
18822
18868
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
18823
18869
|
const activeTab = tabs?.activeTab;
|
|
18824
|
-
|
|
18870
|
+
useEffect59(() => {
|
|
18825
18871
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
18826
18872
|
setSelectedPlayerId(null);
|
|
18827
18873
|
clearPlayerDetail?.();
|
|
@@ -18830,11 +18876,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18830
18876
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
18831
18877
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
18832
18878
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18833
|
-
|
|
18879
|
+
useEffect59(() => {
|
|
18834
18880
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18835
18881
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18836
18882
|
const storedTab = tabState?.activeTab;
|
|
18837
|
-
|
|
18883
|
+
useEffect59(() => {
|
|
18838
18884
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18839
18885
|
if (unreachable) setMonitorTab?.("chat");
|
|
18840
18886
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18848,7 +18894,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18848
18894
|
if (onCloseRequested) onCloseRequested();
|
|
18849
18895
|
else close();
|
|
18850
18896
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18851
|
-
|
|
18897
|
+
useEffect59(() => {
|
|
18852
18898
|
const onKey = (e) => {
|
|
18853
18899
|
if (e.key === "Escape") closeWith("escape");
|
|
18854
18900
|
};
|
|
@@ -18864,16 +18910,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18864
18910
|
tabs?.setActiveTab("chat");
|
|
18865
18911
|
send(text2, { grounding, source });
|
|
18866
18912
|
};
|
|
18867
|
-
|
|
18913
|
+
useEffect59(() => {
|
|
18868
18914
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
18869
18915
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
18870
18916
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
18871
|
-
const inputRef =
|
|
18872
|
-
const limitRef =
|
|
18873
|
-
const typedSendRef =
|
|
18874
|
-
const focusAfterCloseRef =
|
|
18917
|
+
const inputRef = useRef49(null);
|
|
18918
|
+
const limitRef = useRef49(null);
|
|
18919
|
+
const typedSendRef = useRef49(false);
|
|
18920
|
+
const focusAfterCloseRef = useRef49(null);
|
|
18875
18921
|
const [tool, setTool] = useState87(null);
|
|
18876
|
-
const panelRef =
|
|
18922
|
+
const panelRef = useRef49(null);
|
|
18877
18923
|
const settings = useOddsSettings();
|
|
18878
18924
|
const [settingsOpen, setSettingsOpen] = useState87(false);
|
|
18879
18925
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
@@ -18891,16 +18937,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18891
18937
|
setFavouritesOpen?.(false);
|
|
18892
18938
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18893
18939
|
}, [setFavouritesOpen]);
|
|
18894
|
-
|
|
18940
|
+
useEffect59(() => {
|
|
18895
18941
|
if (!favouritesOpen) return;
|
|
18896
18942
|
setTool(null);
|
|
18897
18943
|
setSettingsOpen(false);
|
|
18898
18944
|
}, [favouritesOpen]);
|
|
18899
18945
|
const paused = isPaused(state.limit);
|
|
18900
|
-
|
|
18946
|
+
useEffect59(() => {
|
|
18901
18947
|
if (paused) setTool(null);
|
|
18902
18948
|
}, [paused]);
|
|
18903
|
-
|
|
18949
|
+
useEffect59(() => {
|
|
18904
18950
|
if (!paused) return;
|
|
18905
18951
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
18906
18952
|
typedSendRef.current = false;
|
|
@@ -18926,18 +18972,18 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18926
18972
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
18927
18973
|
return `${k.dayLabel} ${k.time}`;
|
|
18928
18974
|
}, [ui]);
|
|
18929
|
-
|
|
18975
|
+
useEffect59(() => {
|
|
18930
18976
|
if (tool) return;
|
|
18931
18977
|
const target = focusAfterCloseRef.current;
|
|
18932
18978
|
focusAfterCloseRef.current = null;
|
|
18933
18979
|
if (target === "composer") inputRef.current?.focus();
|
|
18934
18980
|
}, [tool]);
|
|
18935
|
-
|
|
18981
|
+
useEffect59(() => {
|
|
18936
18982
|
if (!tool || onChatTab && presetGrid) return;
|
|
18937
18983
|
focusAfterCloseRef.current = "composer";
|
|
18938
18984
|
setTool(null);
|
|
18939
18985
|
}, [tool, onChatTab, presetGrid]);
|
|
18940
|
-
const backRef =
|
|
18986
|
+
const backRef = useRef49(() => false);
|
|
18941
18987
|
backRef.current = () => {
|
|
18942
18988
|
if (favouritesOpen) {
|
|
18943
18989
|
closeFavourites();
|
|
@@ -18961,7 +19007,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18961
19007
|
}
|
|
18962
19008
|
return false;
|
|
18963
19009
|
};
|
|
18964
|
-
|
|
19010
|
+
useEffect59(() => {
|
|
18965
19011
|
if (!onRegisterBack) return;
|
|
18966
19012
|
onRegisterBack(() => backRef.current());
|
|
18967
19013
|
return () => onRegisterBack(null);
|
|
@@ -22032,9 +22078,9 @@ function StatsWidget(props) {
|
|
|
22032
22078
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
22033
22079
|
const cfg = props.config;
|
|
22034
22080
|
const built = useMemo16(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
22035
|
-
const trackingRef =
|
|
22081
|
+
const trackingRef = useRef50({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22036
22082
|
const track = useMemo16(() => createTracker(() => trackingRef.current), []);
|
|
22037
|
-
const eventTextRef =
|
|
22083
|
+
const eventTextRef = useRef50(false);
|
|
22038
22084
|
eventTextRef.current = cfg?.eventText === true;
|
|
22039
22085
|
const logger = useMemo16(() => {
|
|
22040
22086
|
if (!built) return null;
|
|
@@ -22051,8 +22097,8 @@ function StatsWidget(props) {
|
|
|
22051
22097
|
[props.config, widgetStrings.strings]
|
|
22052
22098
|
);
|
|
22053
22099
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
22054
|
-
const rootRef =
|
|
22055
|
-
const introDoneRef =
|
|
22100
|
+
const rootRef = useRef50(null);
|
|
22101
|
+
const introDoneRef = useRef50(false);
|
|
22056
22102
|
const markIntroDone = useCallback30(() => {
|
|
22057
22103
|
introDoneRef.current = true;
|
|
22058
22104
|
}, []);
|
|
@@ -22134,8 +22180,8 @@ function StatsWidget(props) {
|
|
|
22134
22180
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
22135
22181
|
timeZone: ui.timeZone
|
|
22136
22182
|
});
|
|
22137
|
-
const prevLiveSnapshotRef =
|
|
22138
|
-
|
|
22183
|
+
const prevLiveSnapshotRef = useRef50(monitor.snapshot);
|
|
22184
|
+
useEffect60(() => {
|
|
22139
22185
|
const snap = monitor.snapshot;
|
|
22140
22186
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
22141
22187
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -22247,8 +22293,8 @@ function StatsWidget(props) {
|
|
|
22247
22293
|
);
|
|
22248
22294
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
22249
22295
|
const markLiveActivity = monitor.markLiveActivity;
|
|
22250
|
-
const prevLiveCountRef =
|
|
22251
|
-
|
|
22296
|
+
const prevLiveCountRef = useRef50(0);
|
|
22297
|
+
useEffect60(() => {
|
|
22252
22298
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
22253
22299
|
prevLiveCountRef.current = discovery.liveCount;
|
|
22254
22300
|
if (rose) markLiveActivity();
|
|
@@ -22296,17 +22342,28 @@ function StatsWidget(props) {
|
|
|
22296
22342
|
log: logger
|
|
22297
22343
|
})
|
|
22298
22344
|
}));
|
|
22299
|
-
const dismissPopupRef =
|
|
22345
|
+
const dismissPopupRef = useRef50(() => {
|
|
22300
22346
|
});
|
|
22301
|
-
const onCtaRef =
|
|
22347
|
+
const onCtaRef = useRef50(() => {
|
|
22302
22348
|
});
|
|
22349
|
+
const onTeaserTapRef = useRef50(() => {
|
|
22350
|
+
});
|
|
22351
|
+
const bubble = controller.state.greetingBubble;
|
|
22352
|
+
const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
|
|
22303
22353
|
const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
|
|
22304
22354
|
const mobile = useMobileBinding({
|
|
22305
22355
|
binding: props.mobile,
|
|
22306
22356
|
panelOpen,
|
|
22307
22357
|
popupText: controller.state.popupText,
|
|
22308
22358
|
cta: bubbleCta,
|
|
22359
|
+
price: bubblePrice ? {
|
|
22360
|
+
matchOddsId: bubblePrice.price.selection.matchOddsId,
|
|
22361
|
+
marketLabel: bubblePrice.price.marketLabel,
|
|
22362
|
+
label: bubblePrice.price.selection.label,
|
|
22363
|
+
odds: formatOdds(bubblePrice.price.selection.formats, oddsSettings.oddsFormat)
|
|
22364
|
+
} : null,
|
|
22309
22365
|
onCta: () => onCtaRef.current(),
|
|
22366
|
+
onTeaserTap: () => onTeaserTapRef.current(),
|
|
22310
22367
|
asks,
|
|
22311
22368
|
open: controller.open,
|
|
22312
22369
|
close: controller.close,
|
|
@@ -22315,10 +22372,10 @@ function StatsWidget(props) {
|
|
|
22315
22372
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
22316
22373
|
dismissPopupRef.current = dismissPopup;
|
|
22317
22374
|
const greetingMeta = latestGreetingMeta(controller.state.messages);
|
|
22318
|
-
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText,
|
|
22375
|
+
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, mobile.confirmedShown);
|
|
22319
22376
|
const [highlight, setHighlight] = useState88(null);
|
|
22320
22377
|
const clearHighlight = useCallback30(() => setHighlight(null), []);
|
|
22321
|
-
|
|
22378
|
+
useEffect60(() => {
|
|
22322
22379
|
if (!panelOpen) setHighlight(null);
|
|
22323
22380
|
}, [panelOpen]);
|
|
22324
22381
|
const highlightRequest = useMemo16(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
|
|
@@ -22335,12 +22392,18 @@ function StatsWidget(props) {
|
|
|
22335
22392
|
const matchId = greetingBubble?.matchId;
|
|
22336
22393
|
if (matchId) setHighlight((prev) => ({ matchId, token: (prev?.token ?? 0) + 1 }));
|
|
22337
22394
|
};
|
|
22395
|
+
onTeaserTapRef.current = () => {
|
|
22396
|
+
if (!controller.state.popupText) return;
|
|
22397
|
+
track({ name: "bubble_click" });
|
|
22398
|
+
if (!bubbleCta) logCtaClick();
|
|
22399
|
+
openFromCta();
|
|
22400
|
+
};
|
|
22338
22401
|
const onCta = useCallback30(() => onCtaRef.current(), []);
|
|
22339
22402
|
useOpenTelemetry(logger, panelOpen);
|
|
22340
|
-
const onControlRef =
|
|
22403
|
+
const onControlRef = useRef50(props.onControl);
|
|
22341
22404
|
onControlRef.current = props.onControl;
|
|
22342
22405
|
const { open: openPanel, close: closePanel } = controller;
|
|
22343
|
-
|
|
22406
|
+
useEffect60(() => {
|
|
22344
22407
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
22345
22408
|
return () => onControlRef.current?.(null);
|
|
22346
22409
|
}, [openPanel, closePanel]);
|
|
@@ -22357,11 +22420,11 @@ function StatsWidget(props) {
|
|
|
22357
22420
|
page: cfg?.page
|
|
22358
22421
|
}
|
|
22359
22422
|
};
|
|
22360
|
-
|
|
22423
|
+
useEffect60(() => {
|
|
22361
22424
|
if (!logger) return;
|
|
22362
22425
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
22363
22426
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
22364
|
-
|
|
22427
|
+
useEffect60(() => {
|
|
22365
22428
|
if (!logger) return;
|
|
22366
22429
|
logger.resume();
|
|
22367
22430
|
const onHide = () => {
|
|
@@ -22379,7 +22442,7 @@ function StatsWidget(props) {
|
|
|
22379
22442
|
logger.dispose();
|
|
22380
22443
|
};
|
|
22381
22444
|
}, [logger]);
|
|
22382
|
-
|
|
22445
|
+
useEffect60(() => {
|
|
22383
22446
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
22384
22447
|
const node = rootRef.current?.getRootNode();
|
|
22385
22448
|
if (node) injectStyles(node);
|
|
@@ -22437,7 +22500,21 @@ function StatsWidget(props) {
|
|
|
22437
22500
|
onCloseRequested: mobile.onCloseRequested,
|
|
22438
22501
|
onRegisterBack: mobile.onRegisterBack
|
|
22439
22502
|
}
|
|
22440
|
-
) }) }) : props.mobile ?
|
|
22503
|
+
) }) }) : props.mobile ? bubblePrice && mobile.onRegisterPrice && mobile.onPriceResult && mobile.priceInFlight ? /* @__PURE__ */ jsx162(
|
|
22504
|
+
MobileBubblePrice,
|
|
22505
|
+
{
|
|
22506
|
+
matchId: bubblePrice.matchId,
|
|
22507
|
+
price: bubblePrice.price,
|
|
22508
|
+
conversation: built?.conversation ?? null,
|
|
22509
|
+
slip,
|
|
22510
|
+
ui,
|
|
22511
|
+
hook: hookOf(greetingMeta),
|
|
22512
|
+
sport: bubblePrice.sport,
|
|
22513
|
+
inFlight: mobile.priceInFlight,
|
|
22514
|
+
onRegister: mobile.onRegisterPrice,
|
|
22515
|
+
onResult: mobile.onPriceResult
|
|
22516
|
+
}
|
|
22517
|
+
) : null : /* @__PURE__ */ jsx162(
|
|
22441
22518
|
ChatFab,
|
|
22442
22519
|
{
|
|
22443
22520
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -22454,15 +22531,16 @@ function StatsWidget(props) {
|
|
|
22454
22531
|
cta: bubbleCta ?? void 0,
|
|
22455
22532
|
onCta,
|
|
22456
22533
|
onBubbleClick: logCtaClick,
|
|
22457
|
-
price:
|
|
22534
|
+
price: bubblePrice ? /* @__PURE__ */ jsx162(
|
|
22458
22535
|
BubblePrice,
|
|
22459
22536
|
{
|
|
22460
|
-
matchId:
|
|
22461
|
-
price:
|
|
22537
|
+
matchId: bubblePrice.matchId,
|
|
22538
|
+
price: bubblePrice.price,
|
|
22462
22539
|
conversation: built?.conversation ?? null,
|
|
22463
22540
|
slip,
|
|
22464
22541
|
ui,
|
|
22465
|
-
hook: hookOf(greetingMeta)
|
|
22542
|
+
hook: hookOf(greetingMeta),
|
|
22543
|
+
sport: bubblePrice.sport
|
|
22466
22544
|
}
|
|
22467
22545
|
) : void 0
|
|
22468
22546
|
}
|