@sensiblestats/widget-react 0.101.0 → 0.102.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 +65 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.102.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Send `sport: "nba"` on NBA pins, slips and host slip events, with qualified ids (`nba:game:{id}`, `nba:market:{key}`) on pin events and the bare game id on slip events. `SignalInput` and `WidgetEventInput` gain an optional `sport`; each sport in the SDK's sport map gains a `wireKey` (`nba` for basketball, none for NFL, which sends nothing new). Football bodies are unchanged. A basketball slip pick keeps its `matchId`. Release only after ChatAssistantAPI and WidgetGateway carrying u592 are deployed: an older server would read the `nba:` ids as football.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sensiblestats/widget-sdk@0.69.0
|
|
13
|
+
|
|
3
14
|
## 0.101.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
38
38
|
|
|
39
39
|
// src/StatsWidget.tsx
|
|
40
40
|
var import_react75 = require("react");
|
|
41
|
-
var
|
|
41
|
+
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
42
42
|
|
|
43
43
|
// src/kickoff.ts
|
|
44
44
|
function formatBettingKickoff(kickoffUtc, ui, locale, now = /* @__PURE__ */ new Date()) {
|
|
@@ -1206,7 +1206,7 @@ function isEnglishLocale(locale) {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
// src/version.generated.ts
|
|
1209
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1209
|
+
var WIDGET_REACT_VERSION = "0.102.0";
|
|
1210
1210
|
|
|
1211
1211
|
// src/config.ts
|
|
1212
1212
|
function normalizeUi(cfg) {
|
|
@@ -2049,7 +2049,7 @@ var MAX_LINE = 32;
|
|
|
2049
2049
|
var MAX_ODDS = 1e4;
|
|
2050
2050
|
function slipPickFields(selection, label, line) {
|
|
2051
2051
|
const fields = {};
|
|
2052
|
-
if ((0, import_widget_sdk4.sportOf)(selection.sport) === void 0 && Number.isSafeInteger(selection.matchId) && selection.matchId > 0) fields.matchId = selection.matchId;
|
|
2052
|
+
if (((0, import_widget_sdk4.sportOf)(selection.sport) === void 0 || (0, import_widget_sdk4.toWireSport)(selection.sport) !== void 0) && Number.isSafeInteger(selection.matchId) && selection.matchId > 0) fields.matchId = selection.matchId;
|
|
2053
2053
|
if (label && label.trim() && label.length <= MAX_SELECTION) fields.selection = label;
|
|
2054
2054
|
if (line && line.trim() && line.length <= MAX_LINE) fields.line = line;
|
|
2055
2055
|
const odds = selection.oddsDecimal;
|
|
@@ -2399,6 +2399,7 @@ function createSlipLedger(storageKey, options = {}) {
|
|
|
2399
2399
|
};
|
|
2400
2400
|
}
|
|
2401
2401
|
function toSlipEvent(name, entry) {
|
|
2402
|
+
const sport = (0, import_widget_sdk6.toWireSport)(entry.sport);
|
|
2402
2403
|
return {
|
|
2403
2404
|
name,
|
|
2404
2405
|
entityType: "market",
|
|
@@ -2407,7 +2408,8 @@ function toSlipEvent(name, entry) {
|
|
|
2407
2408
|
matchId: entry.matchId,
|
|
2408
2409
|
selection: entry.selection,
|
|
2409
2410
|
line: entry.line,
|
|
2410
|
-
odds: entry.odds
|
|
2411
|
+
odds: entry.odds,
|
|
2412
|
+
...sport ? { sport } : {}
|
|
2411
2413
|
};
|
|
2412
2414
|
}
|
|
2413
2415
|
|
|
@@ -4855,8 +4857,10 @@ function useSlipAdd(slip, ui) {
|
|
|
4855
4857
|
return (0, import_react23.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
4856
4858
|
if (!handler) return { kind: "failed" };
|
|
4857
4859
|
const pick = slipPickFields(selection, rawLabels ? selectionLabel : void 0, line);
|
|
4860
|
+
const wireSport = (0, import_widget_sdk15.toWireSport)(selection.sport);
|
|
4861
|
+
const sportField = wireSport ? { sport: wireSport } : {};
|
|
4858
4862
|
if (marketDeveloperName !== void 0) {
|
|
4859
|
-
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick });
|
|
4863
|
+
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
4860
4864
|
}
|
|
4861
4865
|
try {
|
|
4862
4866
|
const raw = await withTimeout(Promise.resolve(handler(selection)));
|
|
@@ -4869,7 +4873,8 @@ function useSlipAdd(slip, ui) {
|
|
|
4869
4873
|
marketDeveloperName,
|
|
4870
4874
|
entityId: marketDeveloperName,
|
|
4871
4875
|
outcome: slipOutcome(result),
|
|
4872
|
-
...pick
|
|
4876
|
+
...pick,
|
|
4877
|
+
...sportField
|
|
4873
4878
|
});
|
|
4874
4879
|
}
|
|
4875
4880
|
if (slipState) {
|
|
@@ -4881,7 +4886,7 @@ function useSlipAdd(slip, ui) {
|
|
|
4881
4886
|
return { kind: "answered", result };
|
|
4882
4887
|
} catch {
|
|
4883
4888
|
if (marketDeveloperName !== void 0) {
|
|
4884
|
-
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick });
|
|
4889
|
+
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
|
|
4885
4890
|
}
|
|
4886
4891
|
return { kind: "failed" };
|
|
4887
4892
|
}
|
|
@@ -5013,6 +5018,7 @@ function Crest2({ url, name, kind, abbr }) {
|
|
|
5013
5018
|
|
|
5014
5019
|
// src/components/PinToggle.tsx
|
|
5015
5020
|
var import_react27 = require("react");
|
|
5021
|
+
var import_widget_sdk16 = require("@sensiblestats/widget-sdk");
|
|
5016
5022
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5017
5023
|
var PIN_GLYPHS = {
|
|
5018
5024
|
pin: { viewBox: "0 0 24 24", strokeWidth: 1.4, transform: "scale(1.5)", d: "M9.5 1.5 14.5 6.5 13 8l-.5-.5-3 3 .3 2.2-1.4 1.4L5.6 11.3l-3.3 3.3-1-1 3.3-3.3L1.9 7.5l1.4-1.4 2.2.3 3-3L8 2.9z" },
|
|
@@ -5025,6 +5031,8 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
5025
5031
|
const log = useEventLog();
|
|
5026
5032
|
if (!monitor || !monitor.enabled) return null;
|
|
5027
5033
|
const key = pinKey(pin);
|
|
5034
|
+
const wireSport = (0, import_widget_sdk16.toWireSport)(pin.sport);
|
|
5035
|
+
const sportField = wireSport ? { sport: wireSport } : {};
|
|
5028
5036
|
const pinned = monitor.isPinned(key);
|
|
5029
5037
|
const labels = pin.kind === "match" ? { pin: ui.matchPinLabel, unpin: ui.matchUnpinLabel } : { pin: ui.pinLabel, unpin: ui.unpinLabel };
|
|
5030
5038
|
const onClick = (e) => {
|
|
@@ -5032,7 +5040,13 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
5032
5040
|
if (pin.kind === "match" && !monitor.isPinned(key)) {
|
|
5033
5041
|
const result2 = monitor.pinMatch({ matchId: pin.matchId, marketDeveloperName: market, sport: pin.sport });
|
|
5034
5042
|
if (result2 === "added") {
|
|
5035
|
-
log?.log({
|
|
5043
|
+
log?.log({
|
|
5044
|
+
name: "pin_add",
|
|
5045
|
+
entityType: "match",
|
|
5046
|
+
entityId: (0, import_widget_sdk16.qualifiedId)(pin.sport, "game", String(pin.matchId)),
|
|
5047
|
+
marketDeveloperName: pin.marketDeveloperName,
|
|
5048
|
+
...sportField
|
|
5049
|
+
});
|
|
5036
5050
|
} else if (result2 === "match_limit") {
|
|
5037
5051
|
setToast({ kind: "error", text: ui.matchLimitToast });
|
|
5038
5052
|
}
|
|
@@ -5043,8 +5057,9 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
5043
5057
|
log?.log({
|
|
5044
5058
|
name: result === "added" ? "pin_add" : "pin_remove",
|
|
5045
5059
|
entityType: pin.kind === "match" ? "match" : "market",
|
|
5046
|
-
entityId: pin.kind === "match" ? String(pin.matchId) : pin.marketDeveloperName,
|
|
5047
|
-
marketDeveloperName: pin.marketDeveloperName
|
|
5060
|
+
entityId: pin.kind === "match" ? (0, import_widget_sdk16.qualifiedId)(pin.sport, "game", String(pin.matchId)) : (0, import_widget_sdk16.qualifiedId)(pin.sport, "market", pin.marketDeveloperName),
|
|
5061
|
+
marketDeveloperName: pin.marketDeveloperName,
|
|
5062
|
+
...sportField
|
|
5048
5063
|
});
|
|
5049
5064
|
} else if (result === "market_limit") {
|
|
5050
5065
|
setToast({ kind: "error", text: ui.marketLimitToast });
|
|
@@ -5809,9 +5824,9 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
5809
5824
|
|
|
5810
5825
|
// src/nflKickoff.ts
|
|
5811
5826
|
var import_react31 = require("react");
|
|
5812
|
-
var
|
|
5827
|
+
var import_widget_sdk17 = require("@sensiblestats/widget-sdk");
|
|
5813
5828
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5814
|
-
var isNfl = (sport) => (0,
|
|
5829
|
+
var isNfl = (sport) => (0, import_widget_sdk17.sportOf)(sport) === "americanfootball";
|
|
5815
5830
|
var nflStarted = (vm, nowMs) => isNfl(vm.sport) && !(vm.kickoffUtc != null && Date.parse(vm.kickoffUtc) > nowMs);
|
|
5816
5831
|
function guardNflKickoff(slip, vm) {
|
|
5817
5832
|
const host = slip.onAddToSlip;
|
|
@@ -6143,14 +6158,14 @@ function NflInsightList({ insights, ui, slip = {}, monitor }) {
|
|
|
6143
6158
|
|
|
6144
6159
|
// src/components/MarketOddsCardList.tsx
|
|
6145
6160
|
var import_react33 = require("react");
|
|
6146
|
-
var
|
|
6161
|
+
var import_widget_sdk19 = require("@sensiblestats/widget-sdk");
|
|
6147
6162
|
|
|
6148
6163
|
// src/components/AllMarketsButton.tsx
|
|
6149
6164
|
var import_react32 = require("react");
|
|
6150
|
-
var
|
|
6165
|
+
var import_widget_sdk18 = require("@sensiblestats/widget-sdk");
|
|
6151
6166
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6152
6167
|
function allMarketsCount(vm, monitor) {
|
|
6153
|
-
if (!monitor?.enabled || !vm.pinEnabled || (0,
|
|
6168
|
+
if (!monitor?.enabled || !vm.pinEnabled || (0, import_widget_sdk18.sportOf)(vm.sport) !== void 0) return null;
|
|
6154
6169
|
return vm.marketCount !== void 0 && vm.marketCount >= 2 ? vm.marketCount : null;
|
|
6155
6170
|
}
|
|
6156
6171
|
function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
@@ -6192,7 +6207,7 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
|
6192
6207
|
function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
6193
6208
|
const slipAllowed = vm.addToSlipEnabled && !suppressSlip && slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now());
|
|
6194
6209
|
const selection = slipAllowed ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
6195
|
-
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: (0,
|
|
6210
|
+
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: (0, import_widget_sdk19.slipSportOf)(vm.sport) })];
|
|
6196
6211
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "ss-w-mo-row", children: [
|
|
6197
6212
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "ss-w-mo-sel", children: row.selection }),
|
|
6198
6213
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(OddsMovementBadge, { previous: row.previousOdds, current: row.odds, direction: row.movementDirection, ui }),
|
|
@@ -6235,8 +6250,8 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6235
6250
|
const id = window.setTimeout(() => setStaleTick((n) => n + 1), Math.max(0, asOfMs + STALE_AFTER_MS - Date.now()) + 1);
|
|
6236
6251
|
return () => window.clearTimeout(id);
|
|
6237
6252
|
}, [watchStale, asOfMs]);
|
|
6238
|
-
const showPin = !!monitor && (0,
|
|
6239
|
-
const history = showPin && !pinRef && !hideHeader && (0,
|
|
6253
|
+
const showPin = !!monitor && (0, import_widget_sdk19.mayPinOrSlip)(vm.sport) && (vm.pinEnabled || (0, import_widget_sdk19.slipSportOf)(vm.sport) !== void 0) && !live && (!!pinRef || !vm.isLive);
|
|
6254
|
+
const history = showPin && !pinRef && !hideHeader && (0, import_widget_sdk19.sportOf)(vm.sport) === void 0 ? monitor : void 0;
|
|
6240
6255
|
const allMarkets = !hideHeader && !pinRef && !live && !vm.isLive ? allMarketsCount(vm, monitor) : null;
|
|
6241
6256
|
const showHeader = !!vm.competition || vm.isLive || !!kickoff || showPin || !!live;
|
|
6242
6257
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: hideHeader ? "ss-w-mocard ss-w-mocard--bare" : "ss-w-mocard", children: [
|
|
@@ -6264,7 +6279,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6264
6279
|
{
|
|
6265
6280
|
ui,
|
|
6266
6281
|
monitor,
|
|
6267
|
-
pin: pinRef ?? { kind: "match", matchId: vm.matchId, sport: (0,
|
|
6282
|
+
pin: pinRef ?? { kind: "match", matchId: vm.matchId, sport: (0, import_widget_sdk19.slipSportOf)(vm.sport) },
|
|
6268
6283
|
market: pinRef ? void 0 : vm.marketDeveloperName
|
|
6269
6284
|
}
|
|
6270
6285
|
) : null
|
|
@@ -6310,7 +6325,7 @@ function MarketOddsCardList({ cards, ui, slip, monitor, inSlipIds, hideHeader, p
|
|
|
6310
6325
|
|
|
6311
6326
|
// src/components/CompactOddsList.tsx
|
|
6312
6327
|
var import_react34 = require("react");
|
|
6313
|
-
var
|
|
6328
|
+
var import_widget_sdk20 = require("@sensiblestats/widget-sdk");
|
|
6314
6329
|
|
|
6315
6330
|
// src/compactList.ts
|
|
6316
6331
|
var COMPACT_MIN_CARDS = 3;
|
|
@@ -6404,7 +6419,7 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
6404
6419
|
const vm = row.card;
|
|
6405
6420
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
6406
6421
|
const count = allMarketsCount(vm, monitor);
|
|
6407
|
-
const nflPin = (0,
|
|
6422
|
+
const nflPin = (0, import_widget_sdk20.sportOf)(vm.sport) === "americanfootball" && !vm.isLive;
|
|
6408
6423
|
const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
6409
6424
|
const when = vm.isLive ? ui?.liveLabel ?? "Live" : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
6410
6425
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
|
|
@@ -6422,7 +6437,7 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
6422
6437
|
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(Cell, { row, cell: cell2, ui, slip }, cell2.row.key)) }),
|
|
6423
6438
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: vm.isLive ? "ss-w-mol-side ss-w-mol-side--live" : "ss-w-mol-side", children: [
|
|
6424
6439
|
when ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "ss-w-mol-when", children: when }) : null,
|
|
6425
|
-
count !== null && monitor && ui ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AllMarketsButton, { vm, count, monitor, ui, surface: "list" }) : monitor && (vm.pinEnabled && vm.isLive || nflPin) && (0,
|
|
6440
|
+
count !== null && monitor && ui ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AllMarketsButton, { vm, count, monitor, ui, surface: "list" }) : monitor && (vm.pinEnabled && vm.isLive || nflPin) && (0, import_widget_sdk20.mayPinOrSlip)(vm.sport) && ui ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: vm.matchId, sport: (0, import_widget_sdk20.slipSportOf)(vm.sport) } }) : null
|
|
6426
6441
|
] })
|
|
6427
6442
|
] });
|
|
6428
6443
|
}
|
|
@@ -7702,7 +7717,7 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
|
|
|
7702
7717
|
var import_react49 = require("react");
|
|
7703
7718
|
|
|
7704
7719
|
// src/components/MarketAccordion.tsx
|
|
7705
|
-
var
|
|
7720
|
+
var import_widget_sdk21 = require("@sensiblestats/widget-sdk");
|
|
7706
7721
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7707
7722
|
function MarketAccordion({ match, monitor, ui, slip }) {
|
|
7708
7723
|
const slipState = useSlipState();
|
|
@@ -7710,7 +7725,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
7710
7725
|
if (markets.length === 0) return null;
|
|
7711
7726
|
const mk = monitorMatchKey(match.sport, match.matchId);
|
|
7712
7727
|
const open = monitor.openMarket[mk] ?? null;
|
|
7713
|
-
const sport = (0,
|
|
7728
|
+
const sport = (0, import_widget_sdk21.slipSportOf)(match.sport);
|
|
7714
7729
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "ss-w-acc", children: markets.map((m) => {
|
|
7715
7730
|
const isOpen = open === m.marketDeveloperName && !m.suspended;
|
|
7716
7731
|
const key = `${mk}:${m.marketDeveloperName}`;
|
|
@@ -8078,7 +8093,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
8078
8093
|
}
|
|
8079
8094
|
|
|
8080
8095
|
// src/components/NbaMonitorCard.tsx
|
|
8081
|
-
var
|
|
8096
|
+
var import_widget_sdk22 = require("@sensiblestats/widget-sdk");
|
|
8082
8097
|
|
|
8083
8098
|
// src/components/NbaPropsSection.tsx
|
|
8084
8099
|
var import_react47 = require("react");
|
|
@@ -8283,7 +8298,7 @@ function UnavailableCard({ match, monitor, ui, sport }) {
|
|
|
8283
8298
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-mon-item", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-mon", children: [
|
|
8284
8299
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-mon-top", children: [
|
|
8285
8300
|
unavailableLabel(match, ui) && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-mon-pill", children: unavailableLabel(match, ui) }),
|
|
8286
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-mon-comp", children: match.competitionName ??
|
|
8301
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ss-w-mon-comp", children: match.competitionName ?? import_widget_sdk22.SPORTS[sport].label }),
|
|
8287
8302
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId, sport } })
|
|
8288
8303
|
] }),
|
|
8289
8304
|
(match.awayTeamName || match.homeTeamName) && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-mon-main", children: [
|
|
@@ -8445,7 +8460,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
8445
8460
|
|
|
8446
8461
|
// src/components/ScoreboardStrip.tsx
|
|
8447
8462
|
var import_react48 = require("react");
|
|
8448
|
-
var
|
|
8463
|
+
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
8449
8464
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8450
8465
|
function nbaStatus(m, ui) {
|
|
8451
8466
|
const b = m.basketball;
|
|
@@ -8533,7 +8548,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
8533
8548
|
const m = tile.match;
|
|
8534
8549
|
if (!m) return null;
|
|
8535
8550
|
const nba = isBasketball(m);
|
|
8536
|
-
const sport = (0,
|
|
8551
|
+
const sport = (0, import_widget_sdk23.sportOf)(m.sport);
|
|
8537
8552
|
const inPlay = m.phase === "live" && !atBreak(m) && !(isAmericanFootball(m) && m.americanFootball?.period == null);
|
|
8538
8553
|
const status = nba ? nbaStatus(m, ui) : isAmericanFootball(m) ? nflStatus(m, ui) : footballStatus(m, ui);
|
|
8539
8554
|
const selected = tile.pin.key === selectedKey;
|
|
@@ -8548,7 +8563,7 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
8548
8563
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: inPlay ? "ss-w-strip-status ss-w-strip-status--live" : "ss-w-strip-status", children: [
|
|
8549
8564
|
inPlay && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-strip-dot", "aria-hidden": "true" }),
|
|
8550
8565
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-strip-when", children: status }),
|
|
8551
|
-
sport && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-strip-sport", children:
|
|
8566
|
+
sport && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ss-w-strip-sport", children: import_widget_sdk23.SPORTS[sport].label })
|
|
8552
8567
|
] }),
|
|
8553
8568
|
rowsFor(m).map((row) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: row.muted ? "ss-w-strip-row ss-w-strip-row--muted" : "ss-w-strip-row", children: [
|
|
8554
8569
|
row.mark,
|
|
@@ -8563,21 +8578,21 @@ function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
|
8563
8578
|
}
|
|
8564
8579
|
|
|
8565
8580
|
// src/monitorSeed.ts
|
|
8566
|
-
var
|
|
8581
|
+
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
8567
8582
|
function buildSeedIndex(groups) {
|
|
8568
8583
|
const index = /* @__PURE__ */ new Map();
|
|
8569
8584
|
for (const group of groups) {
|
|
8570
8585
|
for (const match of group.matches) {
|
|
8571
8586
|
const sport = match.sport ?? group.sport ?? "football";
|
|
8572
8587
|
if (sport !== "football") continue;
|
|
8573
|
-
index.set((0,
|
|
8588
|
+
index.set((0, import_widget_sdk24.matchKey)("football", match.matchId), { match, competitionName: group.competitionName });
|
|
8574
8589
|
}
|
|
8575
8590
|
}
|
|
8576
8591
|
return index;
|
|
8577
8592
|
}
|
|
8578
8593
|
function seedFor(pin, index, states, stale, now) {
|
|
8579
8594
|
if (pin.kind !== "match" || pin.sport !== void 0) return void 0;
|
|
8580
|
-
const key = (0,
|
|
8595
|
+
const key = (0, import_widget_sdk24.matchKey)("football", pin.matchId);
|
|
8581
8596
|
const hit = index.get(key);
|
|
8582
8597
|
if (!hit) return void 0;
|
|
8583
8598
|
const { match, competitionName } = hit;
|
|
@@ -8699,7 +8714,7 @@ function OddsPanel({ monitor, ui, slip }) {
|
|
|
8699
8714
|
|
|
8700
8715
|
// src/components/TodayPanel.tsx
|
|
8701
8716
|
var import_react53 = require("react");
|
|
8702
|
-
var
|
|
8717
|
+
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
8703
8718
|
|
|
8704
8719
|
// src/placement.ts
|
|
8705
8720
|
function placeLeagues(visible, pinnedMatchIds) {
|
|
@@ -8827,10 +8842,10 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
8827
8842
|
|
|
8828
8843
|
// src/components/LeagueDetail.tsx
|
|
8829
8844
|
var import_react51 = require("react");
|
|
8830
|
-
var
|
|
8845
|
+
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
8831
8846
|
|
|
8832
8847
|
// src/components/FixtureRow.tsx
|
|
8833
|
-
var
|
|
8848
|
+
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
8834
8849
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8835
8850
|
function splitAtFirstSpace(label) {
|
|
8836
8851
|
const i = label.indexOf(" ");
|
|
@@ -8857,7 +8872,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
8857
8872
|
const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
|
|
8858
8873
|
const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
|
|
8859
8874
|
const isNba = match.sport === "basketball";
|
|
8860
|
-
const pinSport = (0,
|
|
8875
|
+
const pinSport = (0, import_widget_sdk25.slipSportOf)(match.sport);
|
|
8861
8876
|
const liveTone = isLive || state?.isHalfTime;
|
|
8862
8877
|
const clockParts = isNba && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
8863
8878
|
const dayMarker = isNba && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? new Intl.DateTimeFormat(ui.locale === "tr" ? "tr-TR" : "en-GB", { weekday: "short" }).format(new Date(match.kickoffUnix * 1e3)) : null;
|
|
@@ -8898,7 +8913,7 @@ function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, on
|
|
|
8898
8913
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
8899
8914
|
return () => clearTimeout(id);
|
|
8900
8915
|
}, [toast]);
|
|
8901
|
-
const own = group.matches.filter((m) => !isTreatedLive(states.get((0,
|
|
8916
|
+
const own = group.matches.filter((m) => !isTreatedLive(states.get((0, import_widget_sdk26.matchKey)(m.sport, m.matchId)), stale));
|
|
8902
8917
|
const onStarClick = () => {
|
|
8903
8918
|
const next = !group.isStarred;
|
|
8904
8919
|
void starTap.tap(group.competitionId, next).then((ok) => {
|
|
@@ -8964,12 +8979,12 @@ function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, on
|
|
|
8964
8979
|
FixtureRow,
|
|
8965
8980
|
{
|
|
8966
8981
|
match: m,
|
|
8967
|
-
state: states.get((0,
|
|
8982
|
+
state: states.get((0, import_widget_sdk26.matchKey)(m.sport, m.matchId)),
|
|
8968
8983
|
stale,
|
|
8969
8984
|
ui,
|
|
8970
8985
|
monitor
|
|
8971
8986
|
},
|
|
8972
|
-
(0,
|
|
8987
|
+
(0, import_widget_sdk26.matchKey)(m.sport, m.matchId)
|
|
8973
8988
|
))
|
|
8974
8989
|
] }),
|
|
8975
8990
|
toast !== null && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "ss-w-today-toast", role: "status", "aria-live": "polite", children: toast })
|
|
@@ -8977,17 +8992,17 @@ function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, on
|
|
|
8977
8992
|
}
|
|
8978
8993
|
|
|
8979
8994
|
// src/components/LeagueRowGroup.tsx
|
|
8980
|
-
var
|
|
8995
|
+
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
8981
8996
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
8982
8997
|
var ROW_CAP_PER_LEAGUE = 3;
|
|
8983
8998
|
var SECTION_ROW_BUDGET = 12;
|
|
8984
8999
|
function rowsFor2(group, states, stale) {
|
|
8985
|
-
const nonLive = group.matches.filter((m) => !isTreatedLive(states.get((0,
|
|
9000
|
+
const nonLive = group.matches.filter((m) => !isTreatedLive(states.get((0, import_widget_sdk27.matchKey)(m.sport, m.matchId)), stale)).length;
|
|
8986
9001
|
return Math.min(nonLive, ROW_CAP_PER_LEAGUE);
|
|
8987
9002
|
}
|
|
8988
9003
|
var STAR_PATH3 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1-6.47L2.5 9.35l6.5-.95z";
|
|
8989
9004
|
function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starClickable2, disambiguate, onOpen, starTap, ui, monitor }) {
|
|
8990
|
-
const sorted = group.matches.filter((m) => !isTreatedLive(states.get((0,
|
|
9005
|
+
const sorted = group.matches.filter((m) => !isTreatedLive(states.get((0, import_widget_sdk27.matchKey)(m.sport, m.matchId)), stale)).sort((a, b) => a.kickoffUnix - b.kickoffUnix);
|
|
8991
9006
|
if (sorted.length === 0) return null;
|
|
8992
9007
|
const shown = sorted.slice(0, cap2);
|
|
8993
9008
|
const overflow = sorted.length - shown.length;
|
|
@@ -9034,12 +9049,12 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
|
|
|
9034
9049
|
FixtureRow,
|
|
9035
9050
|
{
|
|
9036
9051
|
match: m,
|
|
9037
|
-
state: states.get((0,
|
|
9052
|
+
state: states.get((0, import_widget_sdk27.matchKey)(m.sport, m.matchId)),
|
|
9038
9053
|
stale,
|
|
9039
9054
|
ui,
|
|
9040
9055
|
monitor
|
|
9041
9056
|
},
|
|
9042
|
-
(0,
|
|
9057
|
+
(0, import_widget_sdk27.matchKey)(m.sport, m.matchId)
|
|
9043
9058
|
)) }),
|
|
9044
9059
|
overflow > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("button", { type: "button", className: "ss-w-today-rowgroup-seeall", onClick: onOpen, children: ui.seeAllFixturesLabel(sorted.length) })
|
|
9045
9060
|
] });
|
|
@@ -9183,7 +9198,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9183
9198
|
(0, import_react53.useEffect)(() => {
|
|
9184
9199
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
9185
9200
|
}, [selectedCompetitionId, openGroup]);
|
|
9186
|
-
const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get((0,
|
|
9201
|
+
const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get((0, import_widget_sdk28.matchKey)(m.sport, m.matchId)), stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
|
|
9187
9202
|
const liveBand = liveRows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
9188
9203
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-sec-head", children: [
|
|
9189
9204
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ss-w-sec-dot", "aria-hidden": "true" }),
|
|
@@ -9193,12 +9208,12 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9193
9208
|
FixtureRow,
|
|
9194
9209
|
{
|
|
9195
9210
|
match,
|
|
9196
|
-
state: states.get((0,
|
|
9211
|
+
state: states.get((0, import_widget_sdk28.matchKey)(match.sport, match.matchId)),
|
|
9197
9212
|
stale,
|
|
9198
9213
|
ui,
|
|
9199
9214
|
monitor
|
|
9200
9215
|
},
|
|
9201
|
-
(0,
|
|
9216
|
+
(0, import_widget_sdk28.matchKey)(match.sport, match.matchId)
|
|
9202
9217
|
)) })
|
|
9203
9218
|
] });
|
|
9204
9219
|
if (openGroup !== void 0) {
|
|
@@ -9272,14 +9287,14 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9272
9287
|
FixtureRow,
|
|
9273
9288
|
{
|
|
9274
9289
|
match,
|
|
9275
|
-
state: states.get((0,
|
|
9290
|
+
state: states.get((0, import_widget_sdk28.matchKey)(match.sport, match.matchId)),
|
|
9276
9291
|
stale,
|
|
9277
9292
|
ui,
|
|
9278
9293
|
monitor
|
|
9279
9294
|
}
|
|
9280
9295
|
)
|
|
9281
9296
|
},
|
|
9282
|
-
(0,
|
|
9297
|
+
(0, import_widget_sdk28.matchKey)(match.sport, match.matchId)
|
|
9283
9298
|
))
|
|
9284
9299
|
] }, group.competitionId)) }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
9285
9300
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ss-w-today-sec", children: [
|
|
@@ -15697,7 +15712,7 @@ function buildClient(props) {
|
|
|
15697
15712
|
return { client: props.client, conversation: props.client.conversation() };
|
|
15698
15713
|
}
|
|
15699
15714
|
const cfg = props.config;
|
|
15700
|
-
const client = new
|
|
15715
|
+
const client = new import_widget_sdk29.StatsWidgetClient(toClientOptions(cfg));
|
|
15701
15716
|
return { client, conversation: client.conversation(toUserContext(cfg)) };
|
|
15702
15717
|
} catch (err) {
|
|
15703
15718
|
console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
|