@sensiblestats/widget-react 0.158.0 → 0.159.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.cjs +218 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +172 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
39
39
|
|
|
40
40
|
// src/StatsWidget.tsx
|
|
41
41
|
var import_react124 = require("react");
|
|
42
|
-
var
|
|
42
|
+
var import_widget_sdk40 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
45
45
|
function familyOf(tag2) {
|
|
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
1424
|
// src/version.generated.ts
|
|
1425
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1425
|
+
var WIDGET_REACT_VERSION = "0.159.0";
|
|
1426
1426
|
|
|
1427
1427
|
// src/config.ts
|
|
1428
1428
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -2842,15 +2842,29 @@ var STATES = /* @__PURE__ */ new WeakMap();
|
|
|
2842
2842
|
function isValidId(value) {
|
|
2843
2843
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
2844
2844
|
}
|
|
2845
|
+
var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
2846
|
+
function betFieldsOf(bet) {
|
|
2847
|
+
const { stake, currency, betId, betType, totalOdds } = bet;
|
|
2848
|
+
return {
|
|
2849
|
+
...isFiniteNumber(stake) ? { stake } : {},
|
|
2850
|
+
...typeof currency === "string" ? { currency } : {},
|
|
2851
|
+
...typeof betId === "string" ? { betId } : {},
|
|
2852
|
+
...typeof betType === "string" ? { betType } : {},
|
|
2853
|
+
...isFiniteNumber(totalOdds) ? { totalOdds } : {}
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2845
2856
|
function createWidgetHost() {
|
|
2846
|
-
const state = { queue: [], sink: null, teaser: null };
|
|
2857
|
+
const state = { queue: [], sink: null, teaser: null, dropped: 0 };
|
|
2847
2858
|
const dispatch = (command) => {
|
|
2848
2859
|
if (state.sink) {
|
|
2849
2860
|
state.sink(command);
|
|
2850
2861
|
return;
|
|
2851
2862
|
}
|
|
2852
2863
|
state.queue.push(command);
|
|
2853
|
-
if (state.queue.length > HOST_QUEUE_MAX)
|
|
2864
|
+
if (state.queue.length > HOST_QUEUE_MAX) {
|
|
2865
|
+
state.queue.shift();
|
|
2866
|
+
state.dropped++;
|
|
2867
|
+
}
|
|
2854
2868
|
};
|
|
2855
2869
|
const host = {
|
|
2856
2870
|
// Every body sits in a try: a missing argument, a malformed one and a widget bug behind the
|
|
@@ -2879,7 +2893,7 @@ function createWidgetHost() {
|
|
|
2879
2893
|
const ref = sport ? { matchOddsId: id, sport } : { matchOddsId: id };
|
|
2880
2894
|
if (!legs.some((l) => sameLeg(l, ref))) legs.push(ref);
|
|
2881
2895
|
}
|
|
2882
|
-
|
|
2896
|
+
dispatch({ kind: "betPlaced", legs, legCount: raw.length, bet: betFieldsOf(bet) });
|
|
2883
2897
|
} catch {
|
|
2884
2898
|
}
|
|
2885
2899
|
},
|
|
@@ -2932,11 +2946,19 @@ function attachTeaser(host, control) {
|
|
|
2932
2946
|
if (state.teaser === control) state.teaser = null;
|
|
2933
2947
|
};
|
|
2934
2948
|
}
|
|
2935
|
-
function attachHost(host, sink) {
|
|
2949
|
+
function attachHost(host, sink, onDropped) {
|
|
2936
2950
|
const state = STATES.get(host);
|
|
2937
2951
|
if (!state) return () => {
|
|
2938
2952
|
};
|
|
2939
2953
|
state.sink = sink;
|
|
2954
|
+
if (state.dropped > 0) {
|
|
2955
|
+
const count2 = state.dropped;
|
|
2956
|
+
state.dropped = 0;
|
|
2957
|
+
try {
|
|
2958
|
+
onDropped?.(count2);
|
|
2959
|
+
} catch {
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2940
2962
|
const queued = state.queue;
|
|
2941
2963
|
state.queue = [];
|
|
2942
2964
|
for (const command of queued) {
|
|
@@ -3163,6 +3185,22 @@ function toSlipEvent(name, entry) {
|
|
|
3163
3185
|
}
|
|
3164
3186
|
|
|
3165
3187
|
// src/useHostEvents.ts
|
|
3188
|
+
function recordRaw(logger, command) {
|
|
3189
|
+
if (!logger) return;
|
|
3190
|
+
try {
|
|
3191
|
+
if (command.kind === "matchOpened") {
|
|
3192
|
+
logger.log({ name: "host_match_opened", props: { matchId: command.matchId } });
|
|
3193
|
+
} else if (command.kind === "slipRemoved") {
|
|
3194
|
+
logger.log({ name: "host_slip_removed", props: { matchOddsId: command.matchOddsId, ...command.sport ? { sport: command.sport } : {} } });
|
|
3195
|
+
} else {
|
|
3196
|
+
logger.log({
|
|
3197
|
+
name: "host_bet_placed",
|
|
3198
|
+
props: { legs: command.legs.map((leg) => leg.sport ? { matchOddsId: leg.matchOddsId, sport: leg.sport } : { matchOddsId: leg.matchOddsId }), legCount: command.legCount, ...command.bet }
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
} catch {
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3166
3204
|
function useHostEvents(opts) {
|
|
3167
3205
|
const { host, operatorId, currentUser, logger, isOpen, closePanel } = opts;
|
|
3168
3206
|
const [added, setAdded] = (0, import_react2.useState)({});
|
|
@@ -3215,9 +3253,12 @@ function useHostEvents(opts) {
|
|
|
3215
3253
|
() => tracksViews ? createMatchViews(`ss-w-views:${operatorId}`, { user: currentUser }) : null,
|
|
3216
3254
|
[tracksViews, operatorId, currentUser]
|
|
3217
3255
|
);
|
|
3256
|
+
const loggerRef = (0, import_react2.useRef)(logger);
|
|
3257
|
+
loggerRef.current = logger;
|
|
3218
3258
|
const sinkRef = (0, import_react2.useRef)(() => {
|
|
3219
3259
|
});
|
|
3220
3260
|
sinkRef.current = (command) => {
|
|
3261
|
+
recordRaw(logger, command);
|
|
3221
3262
|
if (command.kind === "matchOpened") {
|
|
3222
3263
|
if (views?.view(command.matchId) === "log") {
|
|
3223
3264
|
logger?.log({ name: "match_view", entityType: "match", entityId: String(command.matchId) });
|
|
@@ -3238,7 +3279,7 @@ function useHostEvents(opts) {
|
|
|
3238
3279
|
};
|
|
3239
3280
|
(0, import_react2.useEffect)(() => {
|
|
3240
3281
|
if (!host) return;
|
|
3241
|
-
return attachHost(host, (command) => sinkRef.current(command));
|
|
3282
|
+
return attachHost(host, (command) => sinkRef.current(command), (count2) => loggerRef.current?.addHostDropped?.(count2));
|
|
3242
3283
|
}, [host]);
|
|
3243
3284
|
(0, import_react2.useEffect)(() => {
|
|
3244
3285
|
if (!isOpen || !views) return;
|
|
@@ -8294,6 +8335,7 @@ function useMatchesDayPick(today) {
|
|
|
8294
8335
|
}
|
|
8295
8336
|
|
|
8296
8337
|
// src/tracking.ts
|
|
8338
|
+
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
8297
8339
|
function createTracker(read2) {
|
|
8298
8340
|
return (body) => {
|
|
8299
8341
|
const { handler, envelope } = read2();
|
|
@@ -8308,6 +8350,45 @@ function createTracker(read2) {
|
|
|
8308
8350
|
});
|
|
8309
8351
|
};
|
|
8310
8352
|
}
|
|
8353
|
+
var PUBLIC_ONLY_NAMES = [
|
|
8354
|
+
"launcher_click",
|
|
8355
|
+
"bubble_click",
|
|
8356
|
+
"widget_close",
|
|
8357
|
+
"tab_change",
|
|
8358
|
+
"question_asked",
|
|
8359
|
+
"answer_received",
|
|
8360
|
+
"answer_failed",
|
|
8361
|
+
"answer_stopped",
|
|
8362
|
+
"new_conversation",
|
|
8363
|
+
"combo_variant_click",
|
|
8364
|
+
"combo_swap_click",
|
|
8365
|
+
"combo_add_click",
|
|
8366
|
+
"favourite_change"
|
|
8367
|
+
];
|
|
8368
|
+
var PUBLIC_ONLY = new Set(PUBLIC_ONLY_NAMES);
|
|
8369
|
+
function isPublicOnly(name) {
|
|
8370
|
+
return PUBLIC_ONLY.has(name);
|
|
8371
|
+
}
|
|
8372
|
+
function createRecorder(logger, track) {
|
|
8373
|
+
return (input) => {
|
|
8374
|
+
try {
|
|
8375
|
+
if (isPublicOnly(input.name)) {
|
|
8376
|
+
track(input);
|
|
8377
|
+
if (logger) {
|
|
8378
|
+
const { name, ...props } = input;
|
|
8379
|
+
logger.log({ name, props });
|
|
8380
|
+
}
|
|
8381
|
+
return;
|
|
8382
|
+
}
|
|
8383
|
+
if (logger && (0, import_widget_sdk23.isWidgetEventName)(input.name)) {
|
|
8384
|
+
logger.log(input);
|
|
8385
|
+
return;
|
|
8386
|
+
}
|
|
8387
|
+
track(input);
|
|
8388
|
+
} catch {
|
|
8389
|
+
}
|
|
8390
|
+
};
|
|
8391
|
+
}
|
|
8311
8392
|
function withTracking(logger, track) {
|
|
8312
8393
|
return {
|
|
8313
8394
|
log(input) {
|
|
@@ -8319,7 +8400,10 @@ function withTracking(logger, track) {
|
|
|
8319
8400
|
flushNow: () => logger.flushNow(),
|
|
8320
8401
|
flushOnHide: () => logger.flushOnHide(),
|
|
8321
8402
|
dispose: () => logger.dispose(),
|
|
8322
|
-
resume: () => logger.resume()
|
|
8403
|
+
resume: () => logger.resume(),
|
|
8404
|
+
markOpened: () => logger.markOpened?.(),
|
|
8405
|
+
markVisible: () => logger.markVisible?.(),
|
|
8406
|
+
addHostDropped: (count2) => logger.addHostDropped?.(count2)
|
|
8323
8407
|
};
|
|
8324
8408
|
}
|
|
8325
8409
|
var entity = (input) => input;
|
|
@@ -8382,7 +8466,27 @@ var WIRE_TO_PUBLIC = {
|
|
|
8382
8466
|
greeting_shown: null,
|
|
8383
8467
|
greeting_cta_click: null,
|
|
8384
8468
|
greeting_card_tap: null,
|
|
8385
|
-
greeting_ask_tap: null
|
|
8469
|
+
greeting_ask_tap: null,
|
|
8470
|
+
answer_failed: null,
|
|
8471
|
+
answer_received: null,
|
|
8472
|
+
answer_stopped: null,
|
|
8473
|
+
bubble_click: null,
|
|
8474
|
+
combo_add_click: null,
|
|
8475
|
+
combo_swap_click: null,
|
|
8476
|
+
combo_variant_click: null,
|
|
8477
|
+
favourite_change: null,
|
|
8478
|
+
host_bet_placed: null,
|
|
8479
|
+
host_match_opened: null,
|
|
8480
|
+
host_page_change: null,
|
|
8481
|
+
host_slip_removed: null,
|
|
8482
|
+
launcher_click: null,
|
|
8483
|
+
native_command: null,
|
|
8484
|
+
new_conversation: null,
|
|
8485
|
+
props_too_large: null,
|
|
8486
|
+
question_asked: null,
|
|
8487
|
+
tab_change: null,
|
|
8488
|
+
widget_close: null,
|
|
8489
|
+
widget_unavailable: null
|
|
8386
8490
|
};
|
|
8387
8491
|
|
|
8388
8492
|
// src/popupTelemetry.ts
|
|
@@ -8467,6 +8571,12 @@ function useMobileBinding(args) {
|
|
|
8467
8571
|
(0, import_react56.useEffect)(() => {
|
|
8468
8572
|
if (theme) binding?.onTheme?.(theme);
|
|
8469
8573
|
}, [binding, theme]);
|
|
8574
|
+
const record2 = args.record;
|
|
8575
|
+
(0, import_react56.useEffect)(() => {
|
|
8576
|
+
if (!binding?.onRecorder) return;
|
|
8577
|
+
binding.onRecorder(record2);
|
|
8578
|
+
return () => binding.onRecorder?.(null);
|
|
8579
|
+
}, [binding, record2]);
|
|
8470
8580
|
const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
8471
8581
|
const onRegisterBack = (0, import_react56.useCallback)((fn) => {
|
|
8472
8582
|
backRef.current = fn;
|
|
@@ -10467,7 +10577,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10467
10577
|
|
|
10468
10578
|
// src/components/CompactOddsList.tsx
|
|
10469
10579
|
var import_react69 = require("react");
|
|
10470
|
-
var
|
|
10580
|
+
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
10471
10581
|
|
|
10472
10582
|
// src/compactList.ts
|
|
10473
10583
|
var COMPACT_MIN_CARDS = 3;
|
|
@@ -10565,7 +10675,7 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10565
10675
|
const vm = row.card;
|
|
10566
10676
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
10567
10677
|
const count2 = allMarketsCount(vm, monitor);
|
|
10568
|
-
const nflPin = (0,
|
|
10678
|
+
const nflPin = (0, import_widget_sdk24.sportOf)(vm.sport) === "americanfootball" && !vm.isLive;
|
|
10569
10679
|
const kickoffFallback = vm.kickoffUtc ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
10570
10680
|
const when = vm.isLive ? ui.liveLabel : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
10571
10681
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
|
|
@@ -10583,7 +10693,7 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10583
10693
|
/* @__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)) }),
|
|
10584
10694
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: vm.isLive ? "ss-w-mol-side ss-w-mol-side--live" : "ss-w-mol-side", children: [
|
|
10585
10695
|
when ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mol-when", children: when }) : null,
|
|
10586
|
-
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,
|
|
10696
|
+
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_sdk24.mayPinOrSlip)(vm.sport) ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: vm.matchId, sport: (0, import_widget_sdk24.slipSportOf)(vm.sport) } }) : null
|
|
10587
10697
|
] })
|
|
10588
10698
|
] });
|
|
10589
10699
|
}
|
|
@@ -11889,7 +11999,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11889
11999
|
var import_react93 = require("react");
|
|
11890
12000
|
|
|
11891
12001
|
// src/components/MarketAccordion.tsx
|
|
11892
|
-
var
|
|
12002
|
+
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
11893
12003
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11894
12004
|
function MarketAccordion({ match, monitor, ui, slip }) {
|
|
11895
12005
|
const slipState = useSlipState();
|
|
@@ -11897,7 +12007,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11897
12007
|
if (markets.length === 0) return null;
|
|
11898
12008
|
const mk = monitorMatchKey(match.sport, match.matchId);
|
|
11899
12009
|
const open = monitor.openMarket[mk] ?? null;
|
|
11900
|
-
const sport = (0,
|
|
12010
|
+
const sport = (0, import_widget_sdk25.slipSportOf)(match.sport);
|
|
11901
12011
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-acc", children: markets.map((m) => {
|
|
11902
12012
|
const isOpen = open === m.marketDeveloperName && !m.suspended;
|
|
11903
12013
|
const key = `${mk}:${m.marketDeveloperName}`;
|
|
@@ -13246,14 +13356,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13246
13356
|
|
|
13247
13357
|
// src/components/TennisMonitorCard.tsx
|
|
13248
13358
|
var import_react91 = require("react");
|
|
13249
|
-
var
|
|
13359
|
+
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
13250
13360
|
|
|
13251
13361
|
// src/components/TennisFixtureRow.tsx
|
|
13252
|
-
var
|
|
13362
|
+
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
13253
13363
|
|
|
13254
13364
|
// src/components/FixtureRow.tsx
|
|
13255
13365
|
var import_react89 = require("react");
|
|
13256
|
-
var
|
|
13366
|
+
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
13257
13367
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13258
13368
|
function splitAtFirstSpace(label) {
|
|
13259
13369
|
const i = label.indexOf(" ");
|
|
@@ -13284,7 +13394,7 @@ function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
|
|
|
13284
13394
|
const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
|
|
13285
13395
|
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
|
|
13286
13396
|
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
13287
|
-
const pinSport = (0,
|
|
13397
|
+
const pinSport = (0, import_widget_sdk26.slipSportOf)(match.sport);
|
|
13288
13398
|
const liveTone = isLive || state?.isHalfTime;
|
|
13289
13399
|
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
13290
13400
|
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;
|
|
@@ -13435,7 +13545,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
|
|
|
13435
13545
|
const live = isTreatedLive(state, stale);
|
|
13436
13546
|
const round = match.round ? ui.tennis.round[match.round] ?? match.round : null;
|
|
13437
13547
|
const showPrices = !live && prices !== void 0 && prices.byId !== null && !prices.stale;
|
|
13438
|
-
const entry = showPrices ? isKnownTour(match.tour) ? prices.byId.get((0,
|
|
13548
|
+
const entry = showPrices ? isKnownTour(match.tour) ? prices.byId.get((0, import_widget_sdk27.matchKey)("tennis", match.matchId, match.tour)) : void 0 : void 0;
|
|
13439
13549
|
const pin = isKnownTour(match.tour) ? { kind: "match", matchId: match.matchId, sport: "tennis", tour: match.tour } : null;
|
|
13440
13550
|
const pinned = !!monitor && !!pin && monitor.isPinned(pinKey(pin));
|
|
13441
13551
|
const pinnable = !!monitor?.enabled && !!pin;
|
|
@@ -13735,7 +13845,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13735
13845
|
const surface = t.header.surface ? surfaceLabel(ui, t.header.surface) : null;
|
|
13736
13846
|
const ask = () => {
|
|
13737
13847
|
if (!onAsk) return;
|
|
13738
|
-
const wire = (0,
|
|
13848
|
+
const wire = (0, import_widget_sdk28.toWireSport)("tennis");
|
|
13739
13849
|
const grounding = {
|
|
13740
13850
|
kind: "match",
|
|
13741
13851
|
subject: `${t.p1.name} ${ui.tennis.vs} ${t.p2.name}`,
|
|
@@ -13794,7 +13904,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13794
13904
|
|
|
13795
13905
|
// src/components/ScoreboardStrip.tsx
|
|
13796
13906
|
var import_react92 = require("react");
|
|
13797
|
-
var
|
|
13907
|
+
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
13798
13908
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13799
13909
|
function nbaStatus(m, ui) {
|
|
13800
13910
|
const b = m.basketball;
|
|
@@ -13906,7 +14016,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13906
14016
|
const m = tile.match;
|
|
13907
14017
|
if (!m) return null;
|
|
13908
14018
|
const nba = isBasketball(m);
|
|
13909
|
-
const sport = (0,
|
|
14019
|
+
const sport = (0, import_widget_sdk29.sportOf)(m.sport);
|
|
13910
14020
|
const inPlay = m.phase === "live" && !atBreak(m) && !(isAmericanFootball(m) && m.americanFootball?.period == null);
|
|
13911
14021
|
const status2 = nba ? nbaStatus(m, ui) : isTennis(m) ? tennisStatus(m, ui) : isAmericanFootball(m) ? nflStatus(m, ui) : footballStatus(m, ui);
|
|
13912
14022
|
const selected = tile.pin.key === selectedKey;
|
|
@@ -13936,7 +14046,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13936
14046
|
}
|
|
13937
14047
|
|
|
13938
14048
|
// src/components/TrendsStrip.tsx
|
|
13939
|
-
var
|
|
14049
|
+
var import_widget_sdk30 = require("@sensiblestats/widget-sdk");
|
|
13940
14050
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
13941
14051
|
function status(m, ui) {
|
|
13942
14052
|
if (m.isSettled || m.phase === "fullTime") return ui.fullTimeLabel;
|
|
@@ -13952,7 +14062,7 @@ function TrendTileButton({ tile, selected, onSelect, ui }) {
|
|
|
13952
14062
|
const { oddsFormat } = useOddsSettings();
|
|
13953
14063
|
const { market: m, vm } = tile;
|
|
13954
14064
|
const inPlay = m.phase === "live" && !m.isSuspended && !m.isSettled;
|
|
13955
|
-
const sport = (0,
|
|
14065
|
+
const sport = (0, import_widget_sdk30.sportOf)(m.card?.sport ?? void 0);
|
|
13956
14066
|
const home = vm?.homeTeamName ?? m.homeTeamName ?? "";
|
|
13957
14067
|
const away = vm?.awayTeamName ?? m.awayTeamName ?? "";
|
|
13958
14068
|
const score = m.phase !== "preMatch" && typeof m.homeScore === "number" ? `${m.homeScore}\u2013${m.awayScore ?? 0}` : null;
|
|
@@ -13994,21 +14104,21 @@ function TrendsStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13994
14104
|
}
|
|
13995
14105
|
|
|
13996
14106
|
// src/monitorSeed.ts
|
|
13997
|
-
var
|
|
14107
|
+
var import_widget_sdk31 = require("@sensiblestats/widget-sdk");
|
|
13998
14108
|
function buildSeedIndex(groups) {
|
|
13999
14109
|
const index = /* @__PURE__ */ new Map();
|
|
14000
14110
|
for (const group of groups) {
|
|
14001
14111
|
for (const match of group.matches) {
|
|
14002
14112
|
const sport = match.sport ?? group.sport ?? "football";
|
|
14003
14113
|
if (sport !== "football") continue;
|
|
14004
|
-
index.set((0,
|
|
14114
|
+
index.set((0, import_widget_sdk31.matchKey)("football", match.matchId), { match, competitionName: group.competitionName });
|
|
14005
14115
|
}
|
|
14006
14116
|
}
|
|
14007
14117
|
return index;
|
|
14008
14118
|
}
|
|
14009
14119
|
function seedFor(pin, index, states, stale, now) {
|
|
14010
14120
|
if (pin.kind !== "match" || pin.sport !== void 0) return void 0;
|
|
14011
|
-
const key = (0,
|
|
14121
|
+
const key = (0, import_widget_sdk31.matchKey)("football", pin.matchId);
|
|
14012
14122
|
const hit = index.get(key);
|
|
14013
14123
|
if (!hit) return void 0;
|
|
14014
14124
|
const { match, competitionName } = hit;
|
|
@@ -14136,10 +14246,10 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
14136
14246
|
|
|
14137
14247
|
// src/components/LivePanel.tsx
|
|
14138
14248
|
var import_react96 = require("react");
|
|
14139
|
-
var
|
|
14249
|
+
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
14140
14250
|
|
|
14141
14251
|
// src/scheduleView.ts
|
|
14142
|
-
var
|
|
14252
|
+
var import_widget_sdk32 = require("@sensiblestats/widget-sdk");
|
|
14143
14253
|
|
|
14144
14254
|
// src/search.ts
|
|
14145
14255
|
function foldSearchText(s) {
|
|
@@ -14159,7 +14269,7 @@ function matchingFixtures(group, query) {
|
|
|
14159
14269
|
|
|
14160
14270
|
// src/scheduleView.ts
|
|
14161
14271
|
var TOP_COUNT = 3;
|
|
14162
|
-
var keyOf3 = (m) => (0,
|
|
14272
|
+
var keyOf3 = (m) => (0, import_widget_sdk32.matchKey)(m.sport, m.matchId, m.tour);
|
|
14163
14273
|
var sportOf13 = (g) => g.sport ?? "football";
|
|
14164
14274
|
function isMember(group, pinnedKeys) {
|
|
14165
14275
|
return group.isStarred || group.isLearned || group.matches.some((m) => pinnedKeys.has(keyOf3(m)));
|
|
@@ -14229,7 +14339,7 @@ function liveCountsBySport(groups, states, stale) {
|
|
|
14229
14339
|
}
|
|
14230
14340
|
|
|
14231
14341
|
// src/components/LeagueGroup.tsx
|
|
14232
|
-
var
|
|
14342
|
+
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
14233
14343
|
|
|
14234
14344
|
// src/components/ScheduleRow.tsx
|
|
14235
14345
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
@@ -14294,7 +14404,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14294
14404
|
ScheduleRow,
|
|
14295
14405
|
{
|
|
14296
14406
|
match: m,
|
|
14297
|
-
state: states.get((0,
|
|
14407
|
+
state: states.get((0, import_widget_sdk33.matchKey)(m.sport, m.matchId, m.tour)),
|
|
14298
14408
|
stale,
|
|
14299
14409
|
ui,
|
|
14300
14410
|
monitor,
|
|
@@ -14302,7 +14412,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14302
14412
|
slip,
|
|
14303
14413
|
onOpen: (el) => onOpenMatch(m, group.competitionName, el)
|
|
14304
14414
|
},
|
|
14305
|
-
(0,
|
|
14415
|
+
(0, import_widget_sdk33.matchKey)(m.sport, m.matchId, m.tour)
|
|
14306
14416
|
)),
|
|
14307
14417
|
hidden > 0 && onShowAll && /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("button", { type: "button", className: "ss-w-lg-showall", onClick: onShowAll, children: ui.showAllN(rows.length) })
|
|
14308
14418
|
] })
|
|
@@ -14311,7 +14421,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14311
14421
|
|
|
14312
14422
|
// src/components/MatchSheet.tsx
|
|
14313
14423
|
var import_react95 = require("react");
|
|
14314
|
-
var
|
|
14424
|
+
var import_widget_sdk34 = require("@sensiblestats/widget-sdk");
|
|
14315
14425
|
|
|
14316
14426
|
// src/useModalDialog.ts
|
|
14317
14427
|
var import_react94 = require("react");
|
|
@@ -14377,7 +14487,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14377
14487
|
const log = useEventLog();
|
|
14378
14488
|
const titleId = (0, import_react95.useId)();
|
|
14379
14489
|
const [limitHit, setLimitHit] = (0, import_react95.useState)(false);
|
|
14380
|
-
const pinSport = (0,
|
|
14490
|
+
const pinSport = (0, import_widget_sdk34.slipSportOf)(match.sport);
|
|
14381
14491
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14382
14492
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
14383
14493
|
const pinned = followable && monitor.isPinned(pinKey(pinSport ? { kind: "match", matchId: match.matchId, sport: pinSport, ...tour ? { tour } : {} } : { kind: "match", matchId: match.matchId }));
|
|
@@ -14398,11 +14508,11 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14398
14508
|
return;
|
|
14399
14509
|
}
|
|
14400
14510
|
if (result === "added") {
|
|
14401
|
-
const wireSport = (0,
|
|
14511
|
+
const wireSport = (0, import_widget_sdk34.toWireSport)(pinSport);
|
|
14402
14512
|
log?.log({
|
|
14403
14513
|
name: "pin_add",
|
|
14404
14514
|
entityType: "match",
|
|
14405
|
-
entityId: (0,
|
|
14515
|
+
entityId: (0, import_widget_sdk34.qualifiedId)(pinSport, "game", (0, import_widget_sdk34.localIdOf)(pinSport, match.matchId, tour)),
|
|
14406
14516
|
...wireSport ? { sport: wireSport } : {}
|
|
14407
14517
|
});
|
|
14408
14518
|
}
|
|
@@ -14410,7 +14520,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14410
14520
|
};
|
|
14411
14521
|
const ask = () => {
|
|
14412
14522
|
if (!onAsk) return;
|
|
14413
|
-
const wire = (0,
|
|
14523
|
+
const wire = (0, import_widget_sdk34.toWireSport)(match.sport);
|
|
14414
14524
|
const grounding = {
|
|
14415
14525
|
kind: treatedLive ? "liveFact" : "match",
|
|
14416
14526
|
...pinSport === "tennis" ? {} : { matchId: match.matchId },
|
|
@@ -14446,7 +14556,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14446
14556
|
}
|
|
14447
14557
|
|
|
14448
14558
|
// src/components/SportChips.tsx
|
|
14449
|
-
var
|
|
14559
|
+
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
14450
14560
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14451
14561
|
var ORDER2 = ["football", "basketball", "americanfootball", "tennis"];
|
|
14452
14562
|
function SportChips({ offered, value, onChange, counts, ui }) {
|
|
@@ -14481,7 +14591,7 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14481
14591
|
const [toggled, setToggled] = (0, import_react96.useState)(/* @__PURE__ */ new Map());
|
|
14482
14592
|
const [sheet, setSheet] = (0, import_react96.useState)(null);
|
|
14483
14593
|
const pinnedKeys = (0, import_react96.useMemo)(
|
|
14484
|
-
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0,
|
|
14594
|
+
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk36.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14485
14595
|
[monitor.pins]
|
|
14486
14596
|
);
|
|
14487
14597
|
const counts = liveCountsBySport(groups, states, stale);
|
|
@@ -14557,14 +14667,14 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14557
14667
|
ScheduleRow,
|
|
14558
14668
|
{
|
|
14559
14669
|
match,
|
|
14560
|
-
state: states.get((0,
|
|
14670
|
+
state: states.get((0, import_widget_sdk36.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14561
14671
|
stale,
|
|
14562
14672
|
ui,
|
|
14563
14673
|
monitor,
|
|
14564
14674
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14565
14675
|
}
|
|
14566
14676
|
)
|
|
14567
|
-
] }, (0,
|
|
14677
|
+
] }, (0, import_widget_sdk36.matchKey)(match.sport, match.matchId, match.tour))),
|
|
14568
14678
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "ss-w-lp-seeall", onClick: onSeeAll, children: ui.seeAllMatches })
|
|
14569
14679
|
] })
|
|
14570
14680
|
] }),
|
|
@@ -14573,7 +14683,7 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14573
14683
|
{
|
|
14574
14684
|
match: sheet.match,
|
|
14575
14685
|
league: sheet.league,
|
|
14576
|
-
state: states.get((0,
|
|
14686
|
+
state: states.get((0, import_widget_sdk36.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14577
14687
|
stale,
|
|
14578
14688
|
ui,
|
|
14579
14689
|
monitor,
|
|
@@ -14587,11 +14697,11 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14587
14697
|
|
|
14588
14698
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14589
14699
|
var import_react100 = require("react");
|
|
14590
|
-
var
|
|
14700
|
+
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
14591
14701
|
|
|
14592
14702
|
// src/useTennisRowPrices.ts
|
|
14593
14703
|
var import_react97 = require("react");
|
|
14594
|
-
var
|
|
14704
|
+
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14595
14705
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14596
14706
|
function useTennisRowPrices(a) {
|
|
14597
14707
|
const [state, setState] = (0, import_react97.useState)({ byId: null, stale: false });
|
|
@@ -14618,7 +14728,7 @@ function useTennisRowPrices(a) {
|
|
|
14618
14728
|
setState({ byId: null, stale: false });
|
|
14619
14729
|
return;
|
|
14620
14730
|
}
|
|
14621
|
-
setState({ byId: new Map(rows.map((r) => [(0,
|
|
14731
|
+
setState({ byId: new Map(rows.map((r) => [(0, import_widget_sdk37.matchKey)("tennis", r.matchId, r.tour), r.price ?? null])), stale: false });
|
|
14622
14732
|
},
|
|
14623
14733
|
() => {
|
|
14624
14734
|
if (mine !== latest.current) return;
|
|
@@ -14768,7 +14878,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14768
14878
|
}, [day, selected, onDay]);
|
|
14769
14879
|
const isToday = selected === today;
|
|
14770
14880
|
const pinnedKeys = (0, import_react100.useMemo)(
|
|
14771
|
-
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0,
|
|
14881
|
+
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk38.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14772
14882
|
[monitor.pins]
|
|
14773
14883
|
);
|
|
14774
14884
|
const searching = query.trim().length > 0;
|
|
@@ -14788,7 +14898,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14788
14898
|
const { oddsOffered } = useOddsSettings();
|
|
14789
14899
|
const tennisKeys = /* @__PURE__ */ new Map();
|
|
14790
14900
|
const addTennis = (m) => {
|
|
14791
|
-
if (m.sport === "tennis" && isKnownTour(m.tour)) tennisKeys.set((0,
|
|
14901
|
+
if (m.sport === "tennis" && isKnownTour(m.tour)) tennisKeys.set((0, import_widget_sdk38.matchKey)("tennis", m.matchId, m.tour), { tour: m.tour, matchId: m.matchId });
|
|
14792
14902
|
};
|
|
14793
14903
|
for (const s of priced.sections) for (const v of s.groups) for (const m of v.rows) addTennis(m);
|
|
14794
14904
|
for (const { match } of priced.afterMidnight) addTennis(match);
|
|
@@ -14874,7 +14984,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14874
14984
|
ScheduleRow,
|
|
14875
14985
|
{
|
|
14876
14986
|
match,
|
|
14877
|
-
state: states.get((0,
|
|
14987
|
+
state: states.get((0, import_widget_sdk38.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14878
14988
|
stale,
|
|
14879
14989
|
ui,
|
|
14880
14990
|
monitor,
|
|
@@ -14883,7 +14993,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14883
14993
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14884
14994
|
}
|
|
14885
14995
|
)
|
|
14886
|
-
] }, (0,
|
|
14996
|
+
] }, (0, import_widget_sdk38.matchKey)(match.sport, match.matchId, match.tour)))
|
|
14887
14997
|
] }),
|
|
14888
14998
|
empty2 && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ss-w-today-empty", children: searching ? ui.noLeagueResults : ui.noMatchesDay })
|
|
14889
14999
|
] }),
|
|
@@ -14892,7 +15002,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14892
15002
|
{
|
|
14893
15003
|
match: sheet.match,
|
|
14894
15004
|
league: sheet.league,
|
|
14895
|
-
state: states.get((0,
|
|
15005
|
+
state: states.get((0, import_widget_sdk38.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14896
15006
|
stale,
|
|
14897
15007
|
ui,
|
|
14898
15008
|
monitor,
|
|
@@ -18189,7 +18299,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
18189
18299
|
|
|
18190
18300
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
18191
18301
|
var import_react120 = require("react");
|
|
18192
|
-
var
|
|
18302
|
+
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
18193
18303
|
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
18194
18304
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
18195
18305
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -18259,7 +18369,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18259
18369
|
widen: v.widen,
|
|
18260
18370
|
...extra?.variant ? { variant: extra.variant } : {},
|
|
18261
18371
|
...extra?.keep?.length ? { keep: sorted(extra.keep) } : {},
|
|
18262
|
-
...extra?.swapped?.length ? { swapped: [...new Set(extra.swapped)].slice(-
|
|
18372
|
+
...extra?.swapped?.length ? { swapped: [...new Set(extra.swapped)].slice(-import_widget_sdk39.MAX_SWAPPED_IDS) } : {},
|
|
18263
18373
|
...operatorUserId ? { operatorUserId } : {},
|
|
18264
18374
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
18265
18375
|
});
|
|
@@ -22450,7 +22560,7 @@ function buildClient(props, onUnavailable) {
|
|
|
22450
22560
|
const cfg = props.config;
|
|
22451
22561
|
const options = toClientOptions(cfg);
|
|
22452
22562
|
const base = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
22453
|
-
const client = new
|
|
22563
|
+
const client = new import_widget_sdk40.StatsWidgetClient({ ...options, fetch: (0, import_widget_sdk40.observingFetch)(base, onUnavailable) });
|
|
22454
22564
|
return { client, conversation: client.conversation(toUserContext(cfg)) };
|
|
22455
22565
|
} catch (err) {
|
|
22456
22566
|
console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
|
|
@@ -22480,14 +22590,29 @@ function StatsWidget(props) {
|
|
|
22480
22590
|
const track = (0, import_react124.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22481
22591
|
const eventTextRef = (0, import_react124.useRef)(false);
|
|
22482
22592
|
eventTextRef.current = cfg?.eventText === true;
|
|
22593
|
+
const wireContextRef = (0, import_react124.useRef)(() => ({ widgetVersion: WIDGET_REACT_VERSION, surface: "react" }));
|
|
22594
|
+
const wireScopeRef = (0, import_react124.useRef)(() => ({}));
|
|
22595
|
+
const tenantKey = injectedClient ?? `${cfg?.operatorId}|${cfg?.publicKey}|${cfg?.baseUrl}`;
|
|
22596
|
+
const clientRef = (0, import_react124.useRef)(null);
|
|
22597
|
+
clientRef.current = built ? { client: built.client, key: tenantKey } : null;
|
|
22483
22598
|
const logger = (0, import_react124.useMemo)(() => {
|
|
22484
22599
|
if (!built) return null;
|
|
22600
|
+
const key = tenantKey;
|
|
22601
|
+
const current = () => clientRef.current?.key === key ? clientRef.current.client : built.client;
|
|
22485
22602
|
const raw = built.client.createEventLogger({
|
|
22486
22603
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
22487
22604
|
anonymousUserId: cfg?.userContext?.anonymousUserId
|
|
22605
|
+
}, {
|
|
22606
|
+
context: () => wireContextRef.current(),
|
|
22607
|
+
scope: () => wireScopeRef.current(),
|
|
22608
|
+
transport: {
|
|
22609
|
+
flush: (batch) => current().sendEvents(batch),
|
|
22610
|
+
flushKeepalive: (batch) => current().sendEventsKeepalive(batch)
|
|
22611
|
+
}
|
|
22488
22612
|
});
|
|
22489
22613
|
return withTracking(raw, track);
|
|
22490
|
-
}, [built?.
|
|
22614
|
+
}, [built !== null, injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, track]);
|
|
22615
|
+
const record2 = (0, import_react124.useMemo)(() => createRecorder(logger, track), [logger, track]);
|
|
22491
22616
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22492
22617
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22493
22618
|
const ui = (0, import_react124.useMemo)(
|
|
@@ -22507,7 +22632,7 @@ function StatsWidget(props) {
|
|
|
22507
22632
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22508
22633
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22509
22634
|
);
|
|
22510
|
-
const chatTracking = (0, import_react124.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [
|
|
22635
|
+
const chatTracking = (0, import_react124.useMemo)(() => ({ track: record2, eventText: () => eventTextRef.current }), [record2]);
|
|
22511
22636
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
22512
22637
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22513
22638
|
const liveCardWatches = (0, import_react124.useMemo)(() => {
|
|
@@ -22673,7 +22798,7 @@ function StatsWidget(props) {
|
|
|
22673
22798
|
operatorUserId,
|
|
22674
22799
|
anonymousUserId,
|
|
22675
22800
|
enabled: hasFavouritesIdentity && panelEverOpened,
|
|
22676
|
-
track,
|
|
22801
|
+
track: record2,
|
|
22677
22802
|
onChanged: discovery.refreshSchedule
|
|
22678
22803
|
});
|
|
22679
22804
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
@@ -22768,7 +22893,8 @@ function StatsWidget(props) {
|
|
|
22768
22893
|
close: controller.close,
|
|
22769
22894
|
dismissPopup: () => dismissPopupRef.current(),
|
|
22770
22895
|
labels: stringsPending ? null : { launcher: ui.launcherLabel, dismiss: ui.dismissGreeting },
|
|
22771
|
-
theme: resolvedTheme
|
|
22896
|
+
theme: resolvedTheme,
|
|
22897
|
+
record: record2
|
|
22772
22898
|
});
|
|
22773
22899
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, hostDrawsLauncher ? mobile.confirmedShown : void 0);
|
|
22774
22900
|
dismissPopupRef.current = dismissPopup;
|
|
@@ -22795,12 +22921,15 @@ function StatsWidget(props) {
|
|
|
22795
22921
|
};
|
|
22796
22922
|
onTeaserTapRef.current = () => {
|
|
22797
22923
|
if (!controller.state.popupText) return;
|
|
22798
|
-
|
|
22924
|
+
record2({ name: "bubble_click" });
|
|
22799
22925
|
if (!bubbleCta) logCtaClick();
|
|
22800
22926
|
openFromCta();
|
|
22801
22927
|
};
|
|
22802
22928
|
const onCta = (0, import_react124.useCallback)(() => onCtaRef.current(), []);
|
|
22803
22929
|
useOpenTelemetry(logger, panelOpen);
|
|
22930
|
+
(0, import_react124.useEffect)(() => {
|
|
22931
|
+
if (panelOpen) logger?.markOpened?.();
|
|
22932
|
+
}, [panelOpen, logger]);
|
|
22804
22933
|
const onControlRef = (0, import_react124.useRef)(props.onControl);
|
|
22805
22934
|
onControlRef.current = props.onControl;
|
|
22806
22935
|
const { open: openPanel, close: closePanel } = controller;
|
|
@@ -22821,6 +22950,34 @@ function StatsWidget(props) {
|
|
|
22821
22950
|
page: cfg?.page
|
|
22822
22951
|
}
|
|
22823
22952
|
};
|
|
22953
|
+
const themeAttr = themeAttrs(ui, oddsSettings.userTheme)["data-ss-w-theme"];
|
|
22954
|
+
const surface = props.mobile ? "mobile" : props.surface ?? "react";
|
|
22955
|
+
const resolvedLanguage = widgetStrings.strings?.tag;
|
|
22956
|
+
const tenant = clubFixturesResult.enabled ? "club" : "sportsbook";
|
|
22957
|
+
const oddsFormat = oddsSettings.oddsFormat;
|
|
22958
|
+
wireContextRef.current = () => ({
|
|
22959
|
+
widgetVersion: WIDGET_REACT_VERSION,
|
|
22960
|
+
surface,
|
|
22961
|
+
...props.mobile?.client ? { client: props.mobile.client } : {},
|
|
22962
|
+
language,
|
|
22963
|
+
resolvedLanguage,
|
|
22964
|
+
tenant,
|
|
22965
|
+
oddsFormat,
|
|
22966
|
+
theme: themeAttr,
|
|
22967
|
+
layout: typeof window.matchMedia === "function" && window.matchMedia(FULLSCREEN_QUERY).matches ? "fullscreen" : "modal",
|
|
22968
|
+
viewport: { w: Math.round(window.innerWidth / 10) * 10, h: Math.round(window.innerHeight / 10) * 10 }
|
|
22969
|
+
});
|
|
22970
|
+
const pageKey2 = JSON.stringify(cfg?.page ?? null);
|
|
22971
|
+
const pageSeen = (0, import_react124.useRef)(null);
|
|
22972
|
+
(0, import_react124.useEffect)(() => {
|
|
22973
|
+
const prev = pageSeen.current;
|
|
22974
|
+
pageSeen.current = pageKey2;
|
|
22975
|
+
if (prev === null || prev === pageKey2) return;
|
|
22976
|
+
record2({ name: "host_page_change", props: cfg?.page ? { page: { ...cfg.page } } : {} });
|
|
22977
|
+
}, [pageKey2]);
|
|
22978
|
+
const activeTab = monitor.activeTab;
|
|
22979
|
+
const scopePage = cfg?.page;
|
|
22980
|
+
wireScopeRef.current = () => ({ ...panelOpen ? { tab: activeTab } : {}, ...scopePage ? { page: scopePage } : {} });
|
|
22824
22981
|
(0, import_react124.useEffect)(() => {
|
|
22825
22982
|
if (!logger) return;
|
|
22826
22983
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
@@ -22833,6 +22990,7 @@ function StatsWidget(props) {
|
|
|
22833
22990
|
};
|
|
22834
22991
|
const onVisibilityHide = () => {
|
|
22835
22992
|
if (document.visibilityState === "hidden") logger.flushOnHide();
|
|
22993
|
+
else logger.markVisible?.();
|
|
22836
22994
|
};
|
|
22837
22995
|
window.addEventListener("pagehide", onHide);
|
|
22838
22996
|
document.addEventListener("visibilitychange", onVisibilityHide);
|
|
@@ -22866,7 +23024,7 @@ function StatsWidget(props) {
|
|
|
22866
23024
|
}), [monitor, favouritesEnabled, monitor.enabled, monitor.setActiveTab, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, favourites, built, holds, builderMemory]);
|
|
22867
23025
|
if (!built || widgetStrings.state === "unavailable") return null;
|
|
22868
23026
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
22869
|
-
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(TrackingContext.Provider, { value:
|
|
23027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(TrackingContext.Provider, { value: record2, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], "data-ss-w-mobile": props.mobile ? "" : void 0, style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(GreetingHighlightContext.Provider, { value: highlightRequest, children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
22870
23028
|
ChatPanel,
|
|
22871
23029
|
{
|
|
22872
23030
|
controller,
|