@sensiblestats/widget-react 0.48.2 → 0.48.4

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,17 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.48.4
4
+
5
+ ### Patch Changes
6
+
7
+ - A suspended market no longer appears on the live match card. The whole betting line is dropped rather than showing a price the bookmaker is not taking next to an Add to slip button that can only fail.
8
+
9
+ ## 0.48.3
10
+
11
+ ### Patch Changes
12
+
13
+ - A finished match now leaves the Today tab instead of showing an FT badge. The schedule endpoint already excludes terminal matches, but a cached schedule kept them on screen for the rest of the session.
14
+
3
15
  ## 0.48.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -129,7 +129,6 @@ var STRINGS = {
129
129
  tabToday: "Today",
130
130
  sectionLive: "Live",
131
131
  halfTime: "HT",
132
- fullTime: "FT",
133
132
  staleStates: "Live scores can't be updated \u2014 showing the last known state."
134
133
  },
135
134
  tr: {
@@ -208,7 +207,6 @@ var STRINGS = {
208
207
  tabToday: "Bug\xFCn",
209
208
  sectionLive: "Canl\u0131",
210
209
  halfTime: "\u0130Y",
211
- fullTime: "MS",
212
210
  staleStates: "Canl\u0131 skorlar g\xFCncellenemiyor \u2014 son bilinen durum g\xF6steriliyor."
213
211
  }
214
212
  };
@@ -288,7 +286,6 @@ function normalizeUi(cfg) {
288
286
  tabToday: strings.tabToday,
289
287
  sectionLive: strings.sectionLive,
290
288
  halfTime: strings.halfTime,
291
- fullTime: strings.fullTime,
292
289
  staleStates: strings.staleStates,
293
290
  pinLabel: strings.pinLabel,
294
291
  unpinLabel: strings.unpinLabel,
@@ -3621,14 +3618,14 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip }) {
3621
3618
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("b", { className: "ss-w-mon-bar-home", style: { width: `${homePct}%` } }),
3622
3619
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("i", { className: "ss-w-mon-bar-away", style: { width: `${awayPct}%` } })
3623
3620
  ] }),
3624
- row.market && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: promoted ? "ss-w-mon-stat-mkt ss-w-mon-mkt" : "ss-w-mon-stat-mkt", children: [
3621
+ row.market && !row.market.isSuspended && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: promoted ? "ss-w-mon-stat-mkt ss-w-mon-mkt" : "ss-w-mon-stat-mkt", children: [
3625
3622
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { children: [
3626
3623
  row.market.marketLabel,
3627
3624
  " \xB7 ",
3628
3625
  row.market.selectionLabel
3629
3626
  ] }),
3630
3627
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "ss-w-mon-stat-mkt-right", children: [
3631
- row.market.isSuspended ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }) : typeof row.market.price === "number" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-price", children: row.market.price.toFixed(2) }),
3628
+ typeof row.market.price === "number" && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "ss-w-mon-price", children: row.market.price.toFixed(2) }),
3632
3629
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
3633
3630
  SlipButton,
3634
3631
  {
@@ -3746,10 +3743,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3746
3743
  const isLive = state?.phase === "live" && !stale;
3747
3744
  const hasScore = (state?.phase === "live" || state?.phase === "fullTime") && typeof state.homeScore === "number" && typeof state.awayScore === "number";
3748
3745
  const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
3749
- const isFinished = state?.phase === "fullTime";
3750
- const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : isFinished ? ui.fullTime : kickoffLabel(match.kickoffUnix);
3751
- const pin = { kind: "match", matchId: match.matchId };
3752
- const showPin = !isFinished || monitor.isPinned(pinKey(pin));
3746
+ const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
3753
3747
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: isLive || state?.isHalfTime ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
3754
3748
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: isLive || state?.isHalfTime ? "ss-w-drow-when ss-w-drow-when--live" : "ss-w-drow-when", children: when }),
3755
3749
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "ss-w-drow-fx", children: [
@@ -3757,7 +3751,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3757
3751
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: hasScore ? `${state.homeScore}\u2013${state.awayScore}` : "\u2013" }),
3758
3752
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Side, { name: match.awayTeamName, crest: match.awayTeamImagePath })
3759
3753
  ] }),
3760
- showPin ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PinToggle, { ui, monitor, pin }) : null
3754
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId } })
3761
3755
  ] });
3762
3756
  }
3763
3757
 
@@ -3765,6 +3759,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
3765
3759
  function isTreatedLive(state, pollStale) {
3766
3760
  return state?.phase === "live" && !pollStale;
3767
3761
  }
3762
+ function isFinished(state) {
3763
+ return state?.phase === "fullTime";
3764
+ }
3768
3765
 
3769
3766
  // src/components/CompetitionGroup.tsx
3770
3767
  var import_jsx_runtime50 = require("react/jsx-runtime");
@@ -3796,8 +3793,9 @@ function CompetitionGroup({ group, open, onToggle, states, stale, ui, monitor, d
3796
3793
  var import_jsx_runtime51 = require("react/jsx-runtime");
3797
3794
  function TodayPanel({ discovery, ui, monitor }) {
3798
3795
  const { groups, states, stale, expanded, toggleGroup } = discovery;
3799
- const liveRows = stale ? [] : groups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states[m.matchId], stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3800
- const nameCounts = groups.reduce((acc, g) => {
3796
+ const visibleGroups = groups.map((group) => ({ ...group, matches: group.matches.filter((m) => !isFinished(states[m.matchId])) })).filter((group) => group.matches.length > 0);
3797
+ const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states[m.matchId], stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
3798
+ const nameCounts = visibleGroups.reduce((acc, g) => {
3801
3799
  acc[g.competitionName] = (acc[g.competitionName] ?? 0) + 1;
3802
3800
  return acc;
3803
3801
  }, {});
@@ -3820,7 +3818,7 @@ function TodayPanel({ discovery, ui, monitor }) {
3820
3818
  match.matchId
3821
3819
  )) })
3822
3820
  ] }),
3823
- groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3821
+ visibleGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3824
3822
  CompetitionGroup,
3825
3823
  {
3826
3824
  group,