@sensiblestats/widget-react 0.70.0 → 0.71.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.71.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8fd2f53: Combo card legs now carry a match pin and no longer link to the match page: a tap on the pin adds the match to the Following tab, and the right arrow that closed the widget on a phone is gone. Adds optional `pinEnabled` to `ComboLeg`; an older server that omits it shows no pin.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8fd2f53]
12
+ - @sensiblestats/widget-sdk@0.46.0
13
+
14
+ ## 0.70.1
15
+
16
+ ### Patch Changes
17
+
18
+ - The round button stays hidden when the price-presets grid has no cell in any row, so a quiet day never opens a tool where every number is unavailable. The next panel open asks again.
19
+
3
20
  ## 0.70.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1162,7 +1162,8 @@ function toComboLegVM(leg) {
1162
1162
  matchOddsId,
1163
1163
  quotedAtUtc: str(leg.quotedAtUtc),
1164
1164
  insightId,
1165
- statText
1165
+ statText,
1166
+ pinEnabled: leg.pinEnabled === true
1166
1167
  };
1167
1168
  }
1168
1169
  function toComboCardVM(card) {
@@ -2083,16 +2084,20 @@ function usePresetTools() {
2083
2084
 
2084
2085
  // src/components/ComboCardList.tsx
2085
2086
  var import_jsx_runtime14 = require("react/jsx-runtime");
2086
- function ComboLegRow({ leg, addToSlipEnabled, ui, slip }) {
2087
+ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor }) {
2087
2088
  const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
2088
2089
  const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
2089
2090
  const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
2091
+ const showPin = !!monitor && leg.pinEnabled && !!ui;
2090
2092
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { className: "ss-w-combo-leg", children: [
2091
- leg.competition || kickoff ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
2093
+ leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
2092
2094
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
2093
- kickoff ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-kick", children: kickoff }) : null
2095
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "ss-w-bi-meta-right", children: [
2096
+ kickoff ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-kick", children: kickoff }) : null,
2097
+ showPin && ui ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: leg.matchId } }) : null
2098
+ ] })
2094
2099
  ] }) : null,
2095
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MatchLink, { as: "div", matchId: leg.matchId, home: leg.homeTeamName, away: leg.awayTeamName, className: "ss-w-bi-fixture-line", children: [
2100
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-bi-fixture-line", children: [
2096
2101
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Crest2, { kind: "team", url: leg.homeCrest, name: leg.homeTeamName }),
2097
2102
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-team", children: leg.homeTeamName }),
2098
2103
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-vs", "aria-hidden": "true", children: "vs" }),
@@ -2122,19 +2127,19 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip }) {
2122
2127
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "ss-w-combo-leg-stat", children: leg.statText })
2123
2128
  ] });
2124
2129
  }
2125
- function ComboCardView({ vm, ui, slip }) {
2130
+ function ComboCardView({ vm, ui, slip, monitor }) {
2126
2131
  const tools = usePresetTools();
2127
2132
  const { target, legCount } = vm;
2128
2133
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-combo", children: [
2129
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip }, leg.key)) }),
2134
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip, monitor }, leg.key)) }),
2130
2135
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-combo-math", children: vm.multiplication }),
2131
2136
  vm.replacedNote ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
2132
2137
  tools && target !== void 0 && legCount !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "ss-w-combo-change", onClick: () => tools.openBuilder(target, legCount), children: tools.changeLabel }) : null
2133
2138
  ] });
2134
2139
  }
2135
- function ComboCardList({ cards, ui, slip }) {
2140
+ function ComboCardList({ cards, ui, slip, monitor }) {
2136
2141
  if (!cards || cards.length === 0) return null;
2137
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-combos", children: cards.map((vm) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ComboCardView, { vm, ui, slip }, vm.id)) });
2142
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-combos", children: cards.map((vm) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ComboCardView, { vm, ui, slip, monitor }, vm.id)) });
2138
2143
  }
2139
2144
 
2140
2145
  // src/components/MarketOddsCardList.tsx
@@ -3397,7 +3402,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
3397
3402
  message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
3398
3403
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
3399
3404
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
3400
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip }),
3405
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
3401
3406
  compact ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
3402
3407
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
3403
3408
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
@@ -9058,7 +9063,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
9058
9063
  if (age <= GRID_MAX_AGE_MS) return;
9059
9064
  inFlightRef.current = true;
9060
9065
  Promise.resolve().then(() => getRef.current(locale)).then((body) => {
9061
- if (body === null) {
9066
+ if (body === null || isPresetGrid(body) && !hasAnyCell(body)) {
9062
9067
  keptRef.current = null;
9063
9068
  if (mountedRef.current) setGrid(null);
9064
9069
  return;
@@ -9073,6 +9078,9 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
9073
9078
  }, [isOpen, locale]);
9074
9079
  return grid;
9075
9080
  }
9081
+ function hasAnyCell(grid) {
9082
+ return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0;
9083
+ }
9076
9084
 
9077
9085
  // src/popupTelemetry.ts
9078
9086
  var import_react53 = require("react");