@sensiblestats/widget-react 0.95.0 → 0.96.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.96.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5cf2439: The NBA card on the Following tab shows player props while the game is live, from in-game prices only; a pre-tip bundle still held after the tip is never shown as live.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5cf2439]
12
+ - @sensiblestats/widget-sdk@0.65.0
13
+
14
+ ## 0.95.1
15
+
16
+ ### Patch Changes
17
+
18
+ - d7807c3: NBA line score shows OT columns only once a game reaches overtime, and dashes quarters not yet played instead of the feed's 0.
19
+
3
20
  ## 0.95.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1137,7 +1137,7 @@ function isEnglishLocale(locale) {
1137
1137
  }
1138
1138
 
1139
1139
  // src/version.generated.ts
1140
- var WIDGET_REACT_VERSION = "0.95.0";
1140
+ var WIDGET_REACT_VERSION = "0.96.0";
1141
1141
 
1142
1142
  // src/config.ts
1143
1143
  function normalizeUi(cfg) {
@@ -7582,18 +7582,20 @@ function Roster({ bundle, players, side, ui, slip }) {
7582
7582
  function NbaPropsSection({ match, monitor, ui, slip }) {
7583
7583
  const [side, setSide] = (0, import_react46.useState)("home");
7584
7584
  const [, setTick] = (0, import_react46.useState)(0);
7585
- const open = preTip(match);
7585
+ const pre = preTip(match);
7586
+ const live = match.phase === "live";
7587
+ const open = pre || live;
7586
7588
  (0, import_react46.useEffect)(() => {
7587
7589
  if (open) monitor.loadPlayerProps?.(match.matchId);
7588
7590
  }, [match.matchId, match.asOfUtc, open]);
7589
7591
  (0, import_react46.useEffect)(() => {
7590
- if (!open || !match.kickoffUtc) return;
7592
+ if (!pre || !match.kickoffUtc) return;
7591
7593
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
7592
7594
  const id = setTimeout(() => setTick((t) => t + 1), wait);
7593
7595
  return () => clearTimeout(id);
7594
- }, [open, match.kickoffUtc]);
7596
+ }, [pre, match.kickoffUtc]);
7595
7597
  const bundle = monitor.playerProps?.[match.matchId]?.bundle;
7596
- if (!open || !bundle || bundle.players.length === 0) return null;
7598
+ if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
7597
7599
  const bySide = (s) => bundle.players.filter((p) => p.side === s);
7598
7600
  const other = side === "home" ? "away" : "home";
7599
7601
  const shown = bySide(side).length > 0 ? side : other;
@@ -7634,6 +7636,12 @@ function Side({ abbreviation, nickname, teamName, away }) {
7634
7636
  ] })
7635
7637
  ] });
7636
7638
  }
7639
+ function lastScored(scores) {
7640
+ for (let i = scores.length - 1; i >= 0; i--) {
7641
+ if (typeof scores[i] === "number") return i + 1;
7642
+ }
7643
+ return 0;
7644
+ }
7637
7645
  function cell(value) {
7638
7646
  return typeof value === "number" ? String(value) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ss-w-nbamon-dash", children: "\u2013" });
7639
7647
  }
@@ -7662,8 +7670,9 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
7662
7670
  const inPlay = live && !atBreak(match);
7663
7671
  const scored = live || match.phase === "fullTime";
7664
7672
  const kickoff = match.phase === "preMatch" && match.kickoffUtc ? ui.bettingKickoff(match.kickoffUtc) : void 0;
7665
- const periods = Math.max(REGULATION_PERIODS, b.homePeriods.length, b.awayPeriods.length);
7673
+ const periods = Math.max(REGULATION_PERIODS, b.period, lastScored(b.homePeriods), lastScored(b.awayPeriods));
7666
7674
  const columns = Array.from({ length: periods }, (_, i) => i);
7675
+ const played = (i) => !live || i < b.period;
7667
7676
  const timeouts = [
7668
7677
  { key: "away", value: b.awayTimeoutsLeft },
7669
7678
  { key: "home", value: b.homeTimeoutsLeft }
@@ -7710,7 +7719,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
7710
7719
  { abbreviation: b.homeAbbreviation, scores: b.homePeriods, total: match.homeScore }
7711
7720
  ].map((row) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("tr", { children: [
7712
7721
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("th", { scope: "row", children: row.abbreviation }),
7713
- columns.map((i) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("td", { className: inPlay && i === b.period - 1 ? "ss-w-nbamon-cur" : void 0, children: cell(row.scores[i]) }, i)),
7722
+ columns.map((i) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("td", { className: inPlay && i === b.period - 1 ? "ss-w-nbamon-cur" : void 0, children: cell(played(i) ? row.scores[i] : null) }, i)),
7714
7723
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("td", { className: "ss-w-nbamon-total", children: row.total ?? 0 })
7715
7724
  ] }, row.abbreviation)) })
7716
7725
  ] }),