@sensiblestats/widget-react 0.157.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 +22 -0
- package/dist/index.cjs +221 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -11
- package/dist/index.d.ts +22 -11
- package/dist/index.js +175 -15
- 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"];
|
|
@@ -1832,6 +1832,8 @@ function toClientOptions(cfg) {
|
|
|
1832
1832
|
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
|
|
1833
1833
|
if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
|
|
1834
1834
|
if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
|
|
1835
|
+
const timeZone = validZone(cfg.timeZone);
|
|
1836
|
+
if (timeZone !== void 0) opts.timeZone = timeZone;
|
|
1835
1837
|
return opts;
|
|
1836
1838
|
}
|
|
1837
1839
|
function toUserContext(cfg) {
|
|
@@ -2840,15 +2842,29 @@ var STATES = /* @__PURE__ */ new WeakMap();
|
|
|
2840
2842
|
function isValidId(value) {
|
|
2841
2843
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
2842
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
|
+
}
|
|
2843
2856
|
function createWidgetHost() {
|
|
2844
|
-
const state = { queue: [], sink: null, teaser: null };
|
|
2857
|
+
const state = { queue: [], sink: null, teaser: null, dropped: 0 };
|
|
2845
2858
|
const dispatch = (command) => {
|
|
2846
2859
|
if (state.sink) {
|
|
2847
2860
|
state.sink(command);
|
|
2848
2861
|
return;
|
|
2849
2862
|
}
|
|
2850
2863
|
state.queue.push(command);
|
|
2851
|
-
if (state.queue.length > HOST_QUEUE_MAX)
|
|
2864
|
+
if (state.queue.length > HOST_QUEUE_MAX) {
|
|
2865
|
+
state.queue.shift();
|
|
2866
|
+
state.dropped++;
|
|
2867
|
+
}
|
|
2852
2868
|
};
|
|
2853
2869
|
const host = {
|
|
2854
2870
|
// Every body sits in a try: a missing argument, a malformed one and a widget bug behind the
|
|
@@ -2877,7 +2893,7 @@ function createWidgetHost() {
|
|
|
2877
2893
|
const ref = sport ? { matchOddsId: id, sport } : { matchOddsId: id };
|
|
2878
2894
|
if (!legs.some((l) => sameLeg(l, ref))) legs.push(ref);
|
|
2879
2895
|
}
|
|
2880
|
-
|
|
2896
|
+
dispatch({ kind: "betPlaced", legs, legCount: raw.length, bet: betFieldsOf(bet) });
|
|
2881
2897
|
} catch {
|
|
2882
2898
|
}
|
|
2883
2899
|
},
|
|
@@ -2930,11 +2946,19 @@ function attachTeaser(host, control) {
|
|
|
2930
2946
|
if (state.teaser === control) state.teaser = null;
|
|
2931
2947
|
};
|
|
2932
2948
|
}
|
|
2933
|
-
function attachHost(host, sink) {
|
|
2949
|
+
function attachHost(host, sink, onDropped) {
|
|
2934
2950
|
const state = STATES.get(host);
|
|
2935
2951
|
if (!state) return () => {
|
|
2936
2952
|
};
|
|
2937
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
|
+
}
|
|
2938
2962
|
const queued = state.queue;
|
|
2939
2963
|
state.queue = [];
|
|
2940
2964
|
for (const command of queued) {
|
|
@@ -3161,6 +3185,22 @@ function toSlipEvent(name, entry) {
|
|
|
3161
3185
|
}
|
|
3162
3186
|
|
|
3163
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
|
+
}
|
|
3164
3204
|
function useHostEvents(opts) {
|
|
3165
3205
|
const { host, operatorId, currentUser, logger, isOpen, closePanel } = opts;
|
|
3166
3206
|
const [added, setAdded] = (0, import_react2.useState)({});
|
|
@@ -3213,9 +3253,12 @@ function useHostEvents(opts) {
|
|
|
3213
3253
|
() => tracksViews ? createMatchViews(`ss-w-views:${operatorId}`, { user: currentUser }) : null,
|
|
3214
3254
|
[tracksViews, operatorId, currentUser]
|
|
3215
3255
|
);
|
|
3256
|
+
const loggerRef = (0, import_react2.useRef)(logger);
|
|
3257
|
+
loggerRef.current = logger;
|
|
3216
3258
|
const sinkRef = (0, import_react2.useRef)(() => {
|
|
3217
3259
|
});
|
|
3218
3260
|
sinkRef.current = (command) => {
|
|
3261
|
+
recordRaw(logger, command);
|
|
3219
3262
|
if (command.kind === "matchOpened") {
|
|
3220
3263
|
if (views?.view(command.matchId) === "log") {
|
|
3221
3264
|
logger?.log({ name: "match_view", entityType: "match", entityId: String(command.matchId) });
|
|
@@ -3236,7 +3279,7 @@ function useHostEvents(opts) {
|
|
|
3236
3279
|
};
|
|
3237
3280
|
(0, import_react2.useEffect)(() => {
|
|
3238
3281
|
if (!host) return;
|
|
3239
|
-
return attachHost(host, (command) => sinkRef.current(command));
|
|
3282
|
+
return attachHost(host, (command) => sinkRef.current(command), (count2) => loggerRef.current?.addHostDropped?.(count2));
|
|
3240
3283
|
}, [host]);
|
|
3241
3284
|
(0, import_react2.useEffect)(() => {
|
|
3242
3285
|
if (!isOpen || !views) return;
|
|
@@ -8292,6 +8335,7 @@ function useMatchesDayPick(today) {
|
|
|
8292
8335
|
}
|
|
8293
8336
|
|
|
8294
8337
|
// src/tracking.ts
|
|
8338
|
+
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
8295
8339
|
function createTracker(read2) {
|
|
8296
8340
|
return (body) => {
|
|
8297
8341
|
const { handler, envelope } = read2();
|
|
@@ -8306,6 +8350,45 @@ function createTracker(read2) {
|
|
|
8306
8350
|
});
|
|
8307
8351
|
};
|
|
8308
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
|
+
}
|
|
8309
8392
|
function withTracking(logger, track) {
|
|
8310
8393
|
return {
|
|
8311
8394
|
log(input) {
|
|
@@ -8317,7 +8400,10 @@ function withTracking(logger, track) {
|
|
|
8317
8400
|
flushNow: () => logger.flushNow(),
|
|
8318
8401
|
flushOnHide: () => logger.flushOnHide(),
|
|
8319
8402
|
dispose: () => logger.dispose(),
|
|
8320
|
-
resume: () => logger.resume()
|
|
8403
|
+
resume: () => logger.resume(),
|
|
8404
|
+
markOpened: () => logger.markOpened?.(),
|
|
8405
|
+
markVisible: () => logger.markVisible?.(),
|
|
8406
|
+
addHostDropped: (count2) => logger.addHostDropped?.(count2)
|
|
8321
8407
|
};
|
|
8322
8408
|
}
|
|
8323
8409
|
var entity = (input) => input;
|
|
@@ -8380,7 +8466,27 @@ var WIRE_TO_PUBLIC = {
|
|
|
8380
8466
|
greeting_shown: null,
|
|
8381
8467
|
greeting_cta_click: null,
|
|
8382
8468
|
greeting_card_tap: null,
|
|
8383
|
-
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
|
|
8384
8490
|
};
|
|
8385
8491
|
|
|
8386
8492
|
// src/popupTelemetry.ts
|
|
@@ -8465,6 +8571,12 @@ function useMobileBinding(args) {
|
|
|
8465
8571
|
(0, import_react56.useEffect)(() => {
|
|
8466
8572
|
if (theme) binding?.onTheme?.(theme);
|
|
8467
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]);
|
|
8468
8580
|
const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
8469
8581
|
const onRegisterBack = (0, import_react56.useCallback)((fn) => {
|
|
8470
8582
|
backRef.current = fn;
|
|
@@ -10465,7 +10577,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10465
10577
|
|
|
10466
10578
|
// src/components/CompactOddsList.tsx
|
|
10467
10579
|
var import_react69 = require("react");
|
|
10468
|
-
var
|
|
10580
|
+
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
10469
10581
|
|
|
10470
10582
|
// src/compactList.ts
|
|
10471
10583
|
var COMPACT_MIN_CARDS = 3;
|
|
@@ -10563,7 +10675,7 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10563
10675
|
const vm = row.card;
|
|
10564
10676
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
10565
10677
|
const count2 = allMarketsCount(vm, monitor);
|
|
10566
|
-
const nflPin = (0,
|
|
10678
|
+
const nflPin = (0, import_widget_sdk24.sportOf)(vm.sport) === "americanfootball" && !vm.isLive;
|
|
10567
10679
|
const kickoffFallback = vm.kickoffUtc ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
10568
10680
|
const when = vm.isLive ? ui.liveLabel : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
10569
10681
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
|
|
@@ -10581,7 +10693,7 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10581
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)) }),
|
|
10582
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: [
|
|
10583
10695
|
when ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ss-w-mol-when", children: when }) : null,
|
|
10584
|
-
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
|
|
10585
10697
|
] })
|
|
10586
10698
|
] });
|
|
10587
10699
|
}
|
|
@@ -11887,7 +11999,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11887
11999
|
var import_react93 = require("react");
|
|
11888
12000
|
|
|
11889
12001
|
// src/components/MarketAccordion.tsx
|
|
11890
|
-
var
|
|
12002
|
+
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
11891
12003
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11892
12004
|
function MarketAccordion({ match, monitor, ui, slip }) {
|
|
11893
12005
|
const slipState = useSlipState();
|
|
@@ -11895,7 +12007,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11895
12007
|
if (markets.length === 0) return null;
|
|
11896
12008
|
const mk = monitorMatchKey(match.sport, match.matchId);
|
|
11897
12009
|
const open = monitor.openMarket[mk] ?? null;
|
|
11898
|
-
const sport = (0,
|
|
12010
|
+
const sport = (0, import_widget_sdk25.slipSportOf)(match.sport);
|
|
11899
12011
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-acc", children: markets.map((m) => {
|
|
11900
12012
|
const isOpen = open === m.marketDeveloperName && !m.suspended;
|
|
11901
12013
|
const key = `${mk}:${m.marketDeveloperName}`;
|
|
@@ -13244,14 +13356,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13244
13356
|
|
|
13245
13357
|
// src/components/TennisMonitorCard.tsx
|
|
13246
13358
|
var import_react91 = require("react");
|
|
13247
|
-
var
|
|
13359
|
+
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
13248
13360
|
|
|
13249
13361
|
// src/components/TennisFixtureRow.tsx
|
|
13250
|
-
var
|
|
13362
|
+
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
13251
13363
|
|
|
13252
13364
|
// src/components/FixtureRow.tsx
|
|
13253
13365
|
var import_react89 = require("react");
|
|
13254
|
-
var
|
|
13366
|
+
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
13255
13367
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13256
13368
|
function splitAtFirstSpace(label) {
|
|
13257
13369
|
const i = label.indexOf(" ");
|
|
@@ -13282,7 +13394,7 @@ function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
|
|
|
13282
13394
|
const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
|
|
13283
13395
|
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
|
|
13284
13396
|
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
13285
|
-
const pinSport = (0,
|
|
13397
|
+
const pinSport = (0, import_widget_sdk26.slipSportOf)(match.sport);
|
|
13286
13398
|
const liveTone = isLive || state?.isHalfTime;
|
|
13287
13399
|
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
13288
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;
|
|
@@ -13433,7 +13545,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
|
|
|
13433
13545
|
const live = isTreatedLive(state, stale);
|
|
13434
13546
|
const round = match.round ? ui.tennis.round[match.round] ?? match.round : null;
|
|
13435
13547
|
const showPrices = !live && prices !== void 0 && prices.byId !== null && !prices.stale;
|
|
13436
|
-
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;
|
|
13437
13549
|
const pin = isKnownTour(match.tour) ? { kind: "match", matchId: match.matchId, sport: "tennis", tour: match.tour } : null;
|
|
13438
13550
|
const pinned = !!monitor && !!pin && monitor.isPinned(pinKey(pin));
|
|
13439
13551
|
const pinnable = !!monitor?.enabled && !!pin;
|
|
@@ -13733,7 +13845,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13733
13845
|
const surface = t.header.surface ? surfaceLabel(ui, t.header.surface) : null;
|
|
13734
13846
|
const ask = () => {
|
|
13735
13847
|
if (!onAsk) return;
|
|
13736
|
-
const wire = (0,
|
|
13848
|
+
const wire = (0, import_widget_sdk28.toWireSport)("tennis");
|
|
13737
13849
|
const grounding = {
|
|
13738
13850
|
kind: "match",
|
|
13739
13851
|
subject: `${t.p1.name} ${ui.tennis.vs} ${t.p2.name}`,
|
|
@@ -13792,7 +13904,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13792
13904
|
|
|
13793
13905
|
// src/components/ScoreboardStrip.tsx
|
|
13794
13906
|
var import_react92 = require("react");
|
|
13795
|
-
var
|
|
13907
|
+
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
13796
13908
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13797
13909
|
function nbaStatus(m, ui) {
|
|
13798
13910
|
const b = m.basketball;
|
|
@@ -13904,7 +14016,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13904
14016
|
const m = tile.match;
|
|
13905
14017
|
if (!m) return null;
|
|
13906
14018
|
const nba = isBasketball(m);
|
|
13907
|
-
const sport = (0,
|
|
14019
|
+
const sport = (0, import_widget_sdk29.sportOf)(m.sport);
|
|
13908
14020
|
const inPlay = m.phase === "live" && !atBreak(m) && !(isAmericanFootball(m) && m.americanFootball?.period == null);
|
|
13909
14021
|
const status2 = nba ? nbaStatus(m, ui) : isTennis(m) ? tennisStatus(m, ui) : isAmericanFootball(m) ? nflStatus(m, ui) : footballStatus(m, ui);
|
|
13910
14022
|
const selected = tile.pin.key === selectedKey;
|
|
@@ -13934,7 +14046,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13934
14046
|
}
|
|
13935
14047
|
|
|
13936
14048
|
// src/components/TrendsStrip.tsx
|
|
13937
|
-
var
|
|
14049
|
+
var import_widget_sdk30 = require("@sensiblestats/widget-sdk");
|
|
13938
14050
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
13939
14051
|
function status(m, ui) {
|
|
13940
14052
|
if (m.isSettled || m.phase === "fullTime") return ui.fullTimeLabel;
|
|
@@ -13950,7 +14062,7 @@ function TrendTileButton({ tile, selected, onSelect, ui }) {
|
|
|
13950
14062
|
const { oddsFormat } = useOddsSettings();
|
|
13951
14063
|
const { market: m, vm } = tile;
|
|
13952
14064
|
const inPlay = m.phase === "live" && !m.isSuspended && !m.isSettled;
|
|
13953
|
-
const sport = (0,
|
|
14065
|
+
const sport = (0, import_widget_sdk30.sportOf)(m.card?.sport ?? void 0);
|
|
13954
14066
|
const home = vm?.homeTeamName ?? m.homeTeamName ?? "";
|
|
13955
14067
|
const away = vm?.awayTeamName ?? m.awayTeamName ?? "";
|
|
13956
14068
|
const score = m.phase !== "preMatch" && typeof m.homeScore === "number" ? `${m.homeScore}\u2013${m.awayScore ?? 0}` : null;
|
|
@@ -13992,21 +14104,21 @@ function TrendsStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
13992
14104
|
}
|
|
13993
14105
|
|
|
13994
14106
|
// src/monitorSeed.ts
|
|
13995
|
-
var
|
|
14107
|
+
var import_widget_sdk31 = require("@sensiblestats/widget-sdk");
|
|
13996
14108
|
function buildSeedIndex(groups) {
|
|
13997
14109
|
const index = /* @__PURE__ */ new Map();
|
|
13998
14110
|
for (const group of groups) {
|
|
13999
14111
|
for (const match of group.matches) {
|
|
14000
14112
|
const sport = match.sport ?? group.sport ?? "football";
|
|
14001
14113
|
if (sport !== "football") continue;
|
|
14002
|
-
index.set((0,
|
|
14114
|
+
index.set((0, import_widget_sdk31.matchKey)("football", match.matchId), { match, competitionName: group.competitionName });
|
|
14003
14115
|
}
|
|
14004
14116
|
}
|
|
14005
14117
|
return index;
|
|
14006
14118
|
}
|
|
14007
14119
|
function seedFor(pin, index, states, stale, now) {
|
|
14008
14120
|
if (pin.kind !== "match" || pin.sport !== void 0) return void 0;
|
|
14009
|
-
const key = (0,
|
|
14121
|
+
const key = (0, import_widget_sdk31.matchKey)("football", pin.matchId);
|
|
14010
14122
|
const hit = index.get(key);
|
|
14011
14123
|
if (!hit) return void 0;
|
|
14012
14124
|
const { match, competitionName } = hit;
|
|
@@ -14134,10 +14246,10 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
14134
14246
|
|
|
14135
14247
|
// src/components/LivePanel.tsx
|
|
14136
14248
|
var import_react96 = require("react");
|
|
14137
|
-
var
|
|
14249
|
+
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
14138
14250
|
|
|
14139
14251
|
// src/scheduleView.ts
|
|
14140
|
-
var
|
|
14252
|
+
var import_widget_sdk32 = require("@sensiblestats/widget-sdk");
|
|
14141
14253
|
|
|
14142
14254
|
// src/search.ts
|
|
14143
14255
|
function foldSearchText(s) {
|
|
@@ -14157,7 +14269,7 @@ function matchingFixtures(group, query) {
|
|
|
14157
14269
|
|
|
14158
14270
|
// src/scheduleView.ts
|
|
14159
14271
|
var TOP_COUNT = 3;
|
|
14160
|
-
var keyOf3 = (m) => (0,
|
|
14272
|
+
var keyOf3 = (m) => (0, import_widget_sdk32.matchKey)(m.sport, m.matchId, m.tour);
|
|
14161
14273
|
var sportOf13 = (g) => g.sport ?? "football";
|
|
14162
14274
|
function isMember(group, pinnedKeys) {
|
|
14163
14275
|
return group.isStarred || group.isLearned || group.matches.some((m) => pinnedKeys.has(keyOf3(m)));
|
|
@@ -14227,7 +14339,7 @@ function liveCountsBySport(groups, states, stale) {
|
|
|
14227
14339
|
}
|
|
14228
14340
|
|
|
14229
14341
|
// src/components/LeagueGroup.tsx
|
|
14230
|
-
var
|
|
14342
|
+
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
14231
14343
|
|
|
14232
14344
|
// src/components/ScheduleRow.tsx
|
|
14233
14345
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
@@ -14292,7 +14404,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14292
14404
|
ScheduleRow,
|
|
14293
14405
|
{
|
|
14294
14406
|
match: m,
|
|
14295
|
-
state: states.get((0,
|
|
14407
|
+
state: states.get((0, import_widget_sdk33.matchKey)(m.sport, m.matchId, m.tour)),
|
|
14296
14408
|
stale,
|
|
14297
14409
|
ui,
|
|
14298
14410
|
monitor,
|
|
@@ -14300,7 +14412,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14300
14412
|
slip,
|
|
14301
14413
|
onOpen: (el) => onOpenMatch(m, group.competitionName, el)
|
|
14302
14414
|
},
|
|
14303
|
-
(0,
|
|
14415
|
+
(0, import_widget_sdk33.matchKey)(m.sport, m.matchId, m.tour)
|
|
14304
14416
|
)),
|
|
14305
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) })
|
|
14306
14418
|
] })
|
|
@@ -14309,7 +14421,7 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
14309
14421
|
|
|
14310
14422
|
// src/components/MatchSheet.tsx
|
|
14311
14423
|
var import_react95 = require("react");
|
|
14312
|
-
var
|
|
14424
|
+
var import_widget_sdk34 = require("@sensiblestats/widget-sdk");
|
|
14313
14425
|
|
|
14314
14426
|
// src/useModalDialog.ts
|
|
14315
14427
|
var import_react94 = require("react");
|
|
@@ -14375,7 +14487,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14375
14487
|
const log = useEventLog();
|
|
14376
14488
|
const titleId = (0, import_react95.useId)();
|
|
14377
14489
|
const [limitHit, setLimitHit] = (0, import_react95.useState)(false);
|
|
14378
|
-
const pinSport = (0,
|
|
14490
|
+
const pinSport = (0, import_widget_sdk34.slipSportOf)(match.sport);
|
|
14379
14491
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14380
14492
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
14381
14493
|
const pinned = followable && monitor.isPinned(pinKey(pinSport ? { kind: "match", matchId: match.matchId, sport: pinSport, ...tour ? { tour } : {} } : { kind: "match", matchId: match.matchId }));
|
|
@@ -14396,11 +14508,11 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14396
14508
|
return;
|
|
14397
14509
|
}
|
|
14398
14510
|
if (result === "added") {
|
|
14399
|
-
const wireSport = (0,
|
|
14511
|
+
const wireSport = (0, import_widget_sdk34.toWireSport)(pinSport);
|
|
14400
14512
|
log?.log({
|
|
14401
14513
|
name: "pin_add",
|
|
14402
14514
|
entityType: "match",
|
|
14403
|
-
entityId: (0,
|
|
14515
|
+
entityId: (0, import_widget_sdk34.qualifiedId)(pinSport, "game", (0, import_widget_sdk34.localIdOf)(pinSport, match.matchId, tour)),
|
|
14404
14516
|
...wireSport ? { sport: wireSport } : {}
|
|
14405
14517
|
});
|
|
14406
14518
|
}
|
|
@@ -14408,7 +14520,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14408
14520
|
};
|
|
14409
14521
|
const ask = () => {
|
|
14410
14522
|
if (!onAsk) return;
|
|
14411
|
-
const wire = (0,
|
|
14523
|
+
const wire = (0, import_widget_sdk34.toWireSport)(match.sport);
|
|
14412
14524
|
const grounding = {
|
|
14413
14525
|
kind: treatedLive ? "liveFact" : "match",
|
|
14414
14526
|
...pinSport === "tennis" ? {} : { matchId: match.matchId },
|
|
@@ -14444,7 +14556,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
14444
14556
|
}
|
|
14445
14557
|
|
|
14446
14558
|
// src/components/SportChips.tsx
|
|
14447
|
-
var
|
|
14559
|
+
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
14448
14560
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14449
14561
|
var ORDER2 = ["football", "basketball", "americanfootball", "tennis"];
|
|
14450
14562
|
function SportChips({ offered, value, onChange, counts, ui }) {
|
|
@@ -14479,7 +14591,7 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14479
14591
|
const [toggled, setToggled] = (0, import_react96.useState)(/* @__PURE__ */ new Map());
|
|
14480
14592
|
const [sheet, setSheet] = (0, import_react96.useState)(null);
|
|
14481
14593
|
const pinnedKeys = (0, import_react96.useMemo)(
|
|
14482
|
-
() => 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))),
|
|
14483
14595
|
[monitor.pins]
|
|
14484
14596
|
);
|
|
14485
14597
|
const counts = liveCountsBySport(groups, states, stale);
|
|
@@ -14555,14 +14667,14 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14555
14667
|
ScheduleRow,
|
|
14556
14668
|
{
|
|
14557
14669
|
match,
|
|
14558
|
-
state: states.get((0,
|
|
14670
|
+
state: states.get((0, import_widget_sdk36.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14559
14671
|
stale,
|
|
14560
14672
|
ui,
|
|
14561
14673
|
monitor,
|
|
14562
14674
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14563
14675
|
}
|
|
14564
14676
|
)
|
|
14565
|
-
] }, (0,
|
|
14677
|
+
] }, (0, import_widget_sdk36.matchKey)(match.sport, match.matchId, match.tour))),
|
|
14566
14678
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("button", { type: "button", className: "ss-w-lp-seeall", onClick: onSeeAll, children: ui.seeAllMatches })
|
|
14567
14679
|
] })
|
|
14568
14680
|
] }),
|
|
@@ -14571,7 +14683,7 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14571
14683
|
{
|
|
14572
14684
|
match: sheet.match,
|
|
14573
14685
|
league: sheet.league,
|
|
14574
|
-
state: states.get((0,
|
|
14686
|
+
state: states.get((0, import_widget_sdk36.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14575
14687
|
stale,
|
|
14576
14688
|
ui,
|
|
14577
14689
|
monitor,
|
|
@@ -14585,11 +14697,11 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14585
14697
|
|
|
14586
14698
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14587
14699
|
var import_react100 = require("react");
|
|
14588
|
-
var
|
|
14700
|
+
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
14589
14701
|
|
|
14590
14702
|
// src/useTennisRowPrices.ts
|
|
14591
14703
|
var import_react97 = require("react");
|
|
14592
|
-
var
|
|
14704
|
+
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14593
14705
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14594
14706
|
function useTennisRowPrices(a) {
|
|
14595
14707
|
const [state, setState] = (0, import_react97.useState)({ byId: null, stale: false });
|
|
@@ -14616,7 +14728,7 @@ function useTennisRowPrices(a) {
|
|
|
14616
14728
|
setState({ byId: null, stale: false });
|
|
14617
14729
|
return;
|
|
14618
14730
|
}
|
|
14619
|
-
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 });
|
|
14620
14732
|
},
|
|
14621
14733
|
() => {
|
|
14622
14734
|
if (mine !== latest.current) return;
|
|
@@ -14766,7 +14878,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14766
14878
|
}, [day, selected, onDay]);
|
|
14767
14879
|
const isToday = selected === today;
|
|
14768
14880
|
const pinnedKeys = (0, import_react100.useMemo)(
|
|
14769
|
-
() => 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))),
|
|
14770
14882
|
[monitor.pins]
|
|
14771
14883
|
);
|
|
14772
14884
|
const searching = query.trim().length > 0;
|
|
@@ -14786,7 +14898,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14786
14898
|
const { oddsOffered } = useOddsSettings();
|
|
14787
14899
|
const tennisKeys = /* @__PURE__ */ new Map();
|
|
14788
14900
|
const addTennis = (m) => {
|
|
14789
|
-
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 });
|
|
14790
14902
|
};
|
|
14791
14903
|
for (const s of priced.sections) for (const v of s.groups) for (const m of v.rows) addTennis(m);
|
|
14792
14904
|
for (const { match } of priced.afterMidnight) addTennis(match);
|
|
@@ -14872,7 +14984,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14872
14984
|
ScheduleRow,
|
|
14873
14985
|
{
|
|
14874
14986
|
match,
|
|
14875
|
-
state: states.get((0,
|
|
14987
|
+
state: states.get((0, import_widget_sdk38.matchKey)(match.sport, match.matchId, match.tour)),
|
|
14876
14988
|
stale,
|
|
14877
14989
|
ui,
|
|
14878
14990
|
monitor,
|
|
@@ -14881,7 +14993,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14881
14993
|
onOpen: (el) => openMatch(match, group.competitionName, el)
|
|
14882
14994
|
}
|
|
14883
14995
|
)
|
|
14884
|
-
] }, (0,
|
|
14996
|
+
] }, (0, import_widget_sdk38.matchKey)(match.sport, match.matchId, match.tour)))
|
|
14885
14997
|
] }),
|
|
14886
14998
|
empty2 && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ss-w-today-empty", children: searching ? ui.noLeagueResults : ui.noMatchesDay })
|
|
14887
14999
|
] }),
|
|
@@ -14890,7 +15002,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14890
15002
|
{
|
|
14891
15003
|
match: sheet.match,
|
|
14892
15004
|
league: sheet.league,
|
|
14893
|
-
state: states.get((0,
|
|
15005
|
+
state: states.get((0, import_widget_sdk38.matchKey)(sheet.match.sport, sheet.match.matchId, sheet.match.tour)),
|
|
14894
15006
|
stale,
|
|
14895
15007
|
ui,
|
|
14896
15008
|
monitor,
|
|
@@ -18187,7 +18299,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
18187
18299
|
|
|
18188
18300
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
18189
18301
|
var import_react120 = require("react");
|
|
18190
|
-
var
|
|
18302
|
+
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
18191
18303
|
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
18192
18304
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
18193
18305
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -18257,7 +18369,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
18257
18369
|
widen: v.widen,
|
|
18258
18370
|
...extra?.variant ? { variant: extra.variant } : {},
|
|
18259
18371
|
...extra?.keep?.length ? { keep: sorted(extra.keep) } : {},
|
|
18260
|
-
...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) } : {},
|
|
18261
18373
|
...operatorUserId ? { operatorUserId } : {},
|
|
18262
18374
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
18263
18375
|
});
|
|
@@ -22448,7 +22560,7 @@ function buildClient(props, onUnavailable) {
|
|
|
22448
22560
|
const cfg = props.config;
|
|
22449
22561
|
const options = toClientOptions(cfg);
|
|
22450
22562
|
const base = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
22451
|
-
const client = new
|
|
22563
|
+
const client = new import_widget_sdk40.StatsWidgetClient({ ...options, fetch: (0, import_widget_sdk40.observingFetch)(base, onUnavailable) });
|
|
22452
22564
|
return { client, conversation: client.conversation(toUserContext(cfg)) };
|
|
22453
22565
|
} catch (err) {
|
|
22454
22566
|
console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
|
|
@@ -22473,19 +22585,34 @@ function StatsWidget(props) {
|
|
|
22473
22585
|
onUnavailableRef.current?.(reason);
|
|
22474
22586
|
} catch {
|
|
22475
22587
|
}
|
|
22476
|
-
}), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]);
|
|
22588
|
+
}), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId, cfg?.timeZone]);
|
|
22477
22589
|
const trackingRef = (0, import_react124.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22478
22590
|
const track = (0, import_react124.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22479
22591
|
const eventTextRef = (0, import_react124.useRef)(false);
|
|
22480
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;
|
|
22481
22598
|
const logger = (0, import_react124.useMemo)(() => {
|
|
22482
22599
|
if (!built) return null;
|
|
22600
|
+
const key = tenantKey;
|
|
22601
|
+
const current = () => clientRef.current?.key === key ? clientRef.current.client : built.client;
|
|
22483
22602
|
const raw = built.client.createEventLogger({
|
|
22484
22603
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
22485
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
|
+
}
|
|
22486
22612
|
});
|
|
22487
22613
|
return withTracking(raw, track);
|
|
22488
|
-
}, [built?.
|
|
22614
|
+
}, [built !== null, injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, track]);
|
|
22615
|
+
const record2 = (0, import_react124.useMemo)(() => createRecorder(logger, track), [logger, track]);
|
|
22489
22616
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22490
22617
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22491
22618
|
const ui = (0, import_react124.useMemo)(
|
|
@@ -22505,7 +22632,7 @@ function StatsWidget(props) {
|
|
|
22505
22632
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22506
22633
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22507
22634
|
);
|
|
22508
|
-
const chatTracking = (0, import_react124.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [
|
|
22635
|
+
const chatTracking = (0, import_react124.useMemo)(() => ({ track: record2, eventText: () => eventTextRef.current }), [record2]);
|
|
22509
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);
|
|
22510
22637
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22511
22638
|
const liveCardWatches = (0, import_react124.useMemo)(() => {
|
|
@@ -22671,7 +22798,7 @@ function StatsWidget(props) {
|
|
|
22671
22798
|
operatorUserId,
|
|
22672
22799
|
anonymousUserId,
|
|
22673
22800
|
enabled: hasFavouritesIdentity && panelEverOpened,
|
|
22674
|
-
track,
|
|
22801
|
+
track: record2,
|
|
22675
22802
|
onChanged: discovery.refreshSchedule
|
|
22676
22803
|
});
|
|
22677
22804
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
@@ -22766,7 +22893,8 @@ function StatsWidget(props) {
|
|
|
22766
22893
|
close: controller.close,
|
|
22767
22894
|
dismissPopup: () => dismissPopupRef.current(),
|
|
22768
22895
|
labels: stringsPending ? null : { launcher: ui.launcherLabel, dismiss: ui.dismissGreeting },
|
|
22769
|
-
theme: resolvedTheme
|
|
22896
|
+
theme: resolvedTheme,
|
|
22897
|
+
record: record2
|
|
22770
22898
|
});
|
|
22771
22899
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, hostDrawsLauncher ? mobile.confirmedShown : void 0);
|
|
22772
22900
|
dismissPopupRef.current = dismissPopup;
|
|
@@ -22793,12 +22921,15 @@ function StatsWidget(props) {
|
|
|
22793
22921
|
};
|
|
22794
22922
|
onTeaserTapRef.current = () => {
|
|
22795
22923
|
if (!controller.state.popupText) return;
|
|
22796
|
-
|
|
22924
|
+
record2({ name: "bubble_click" });
|
|
22797
22925
|
if (!bubbleCta) logCtaClick();
|
|
22798
22926
|
openFromCta();
|
|
22799
22927
|
};
|
|
22800
22928
|
const onCta = (0, import_react124.useCallback)(() => onCtaRef.current(), []);
|
|
22801
22929
|
useOpenTelemetry(logger, panelOpen);
|
|
22930
|
+
(0, import_react124.useEffect)(() => {
|
|
22931
|
+
if (panelOpen) logger?.markOpened?.();
|
|
22932
|
+
}, [panelOpen, logger]);
|
|
22802
22933
|
const onControlRef = (0, import_react124.useRef)(props.onControl);
|
|
22803
22934
|
onControlRef.current = props.onControl;
|
|
22804
22935
|
const { open: openPanel, close: closePanel } = controller;
|
|
@@ -22819,6 +22950,34 @@ function StatsWidget(props) {
|
|
|
22819
22950
|
page: cfg?.page
|
|
22820
22951
|
}
|
|
22821
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 } : {} });
|
|
22822
22981
|
(0, import_react124.useEffect)(() => {
|
|
22823
22982
|
if (!logger) return;
|
|
22824
22983
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
@@ -22831,6 +22990,7 @@ function StatsWidget(props) {
|
|
|
22831
22990
|
};
|
|
22832
22991
|
const onVisibilityHide = () => {
|
|
22833
22992
|
if (document.visibilityState === "hidden") logger.flushOnHide();
|
|
22993
|
+
else logger.markVisible?.();
|
|
22834
22994
|
};
|
|
22835
22995
|
window.addEventListener("pagehide", onHide);
|
|
22836
22996
|
document.addEventListener("visibilitychange", onVisibilityHide);
|
|
@@ -22864,7 +23024,7 @@ function StatsWidget(props) {
|
|
|
22864
23024
|
}), [monitor, favouritesEnabled, monitor.enabled, monitor.setActiveTab, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, favourites, built, holds, builderMemory]);
|
|
22865
23025
|
if (!built || widgetStrings.state === "unavailable") return null;
|
|
22866
23026
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
22867
|
-
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)(
|
|
22868
23028
|
ChatPanel,
|
|
22869
23029
|
{
|
|
22870
23030
|
controller,
|