@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/dist/index.js CHANGED
@@ -1124,7 +1124,8 @@ function toComboLegVM(leg) {
1124
1124
  matchOddsId,
1125
1125
  quotedAtUtc: str(leg.quotedAtUtc),
1126
1126
  insightId,
1127
- statText
1127
+ statText,
1128
+ pinEnabled: leg.pinEnabled === true
1128
1129
  };
1129
1130
  }
1130
1131
  function toComboCardVM(card) {
@@ -2045,16 +2046,20 @@ function usePresetTools() {
2045
2046
 
2046
2047
  // src/components/ComboCardList.tsx
2047
2048
  import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2048
- function ComboLegRow({ leg, addToSlipEnabled, ui, slip }) {
2049
+ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor }) {
2049
2050
  const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
2050
2051
  const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
2051
2052
  const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
2053
+ const showPin = !!monitor && leg.pinEnabled && !!ui;
2052
2054
  return /* @__PURE__ */ jsxs9("li", { className: "ss-w-combo-leg", children: [
2053
- leg.competition || kickoff ? /* @__PURE__ */ jsxs9("div", { className: "ss-w-combo-leg-meta", children: [
2055
+ leg.competition || kickoff || showPin ? /* @__PURE__ */ jsxs9("div", { className: "ss-w-combo-leg-meta", children: [
2054
2056
  /* @__PURE__ */ jsx14("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
2055
- kickoff ? /* @__PURE__ */ jsx14("span", { className: "ss-w-bi-kick", children: kickoff }) : null
2057
+ /* @__PURE__ */ jsxs9("span", { className: "ss-w-bi-meta-right", children: [
2058
+ kickoff ? /* @__PURE__ */ jsx14("span", { className: "ss-w-bi-kick", children: kickoff }) : null,
2059
+ showPin && ui ? /* @__PURE__ */ jsx14(PinToggle, { ui, monitor, pin: { kind: "match", matchId: leg.matchId } }) : null
2060
+ ] })
2056
2061
  ] }) : null,
2057
- /* @__PURE__ */ jsxs9(MatchLink, { as: "div", matchId: leg.matchId, home: leg.homeTeamName, away: leg.awayTeamName, className: "ss-w-bi-fixture-line", children: [
2062
+ /* @__PURE__ */ jsxs9("div", { className: "ss-w-bi-fixture-line", children: [
2058
2063
  /* @__PURE__ */ jsx14(Crest2, { kind: "team", url: leg.homeCrest, name: leg.homeTeamName }),
2059
2064
  /* @__PURE__ */ jsx14("span", { className: "ss-w-bi-team", children: leg.homeTeamName }),
2060
2065
  /* @__PURE__ */ jsx14("span", { className: "ss-w-bi-vs", "aria-hidden": "true", children: "vs" }),
@@ -2084,19 +2089,19 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip }) {
2084
2089
  /* @__PURE__ */ jsx14("p", { className: "ss-w-combo-leg-stat", children: leg.statText })
2085
2090
  ] });
2086
2091
  }
2087
- function ComboCardView({ vm, ui, slip }) {
2092
+ function ComboCardView({ vm, ui, slip, monitor }) {
2088
2093
  const tools = usePresetTools();
2089
2094
  const { target, legCount } = vm;
2090
2095
  return /* @__PURE__ */ jsxs9("div", { className: "ss-w-combo", children: [
2091
- /* @__PURE__ */ jsx14("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ jsx14(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip }, leg.key)) }),
2096
+ /* @__PURE__ */ jsx14("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ jsx14(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip, monitor }, leg.key)) }),
2092
2097
  /* @__PURE__ */ jsx14("div", { className: "ss-w-combo-math", children: vm.multiplication }),
2093
2098
  vm.replacedNote ? /* @__PURE__ */ jsx14("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
2094
2099
  tools && target !== void 0 && legCount !== void 0 ? /* @__PURE__ */ jsx14("button", { type: "button", className: "ss-w-combo-change", onClick: () => tools.openBuilder(target, legCount), children: tools.changeLabel }) : null
2095
2100
  ] });
2096
2101
  }
2097
- function ComboCardList({ cards, ui, slip }) {
2102
+ function ComboCardList({ cards, ui, slip, monitor }) {
2098
2103
  if (!cards || cards.length === 0) return null;
2099
- return /* @__PURE__ */ jsx14("div", { className: "ss-w-combos", children: cards.map((vm) => /* @__PURE__ */ jsx14(ComboCardView, { vm, ui, slip }, vm.id)) });
2104
+ return /* @__PURE__ */ jsx14("div", { className: "ss-w-combos", children: cards.map((vm) => /* @__PURE__ */ jsx14(ComboCardView, { vm, ui, slip, monitor }, vm.id)) });
2100
2105
  }
2101
2106
 
2102
2107
  // src/components/MarketOddsCardList.tsx
@@ -3359,7 +3364,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
3359
3364
  message.clubFanDashboard ? /* @__PURE__ */ jsx43(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
3360
3365
  /* @__PURE__ */ jsx43(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
3361
3366
  /* @__PURE__ */ jsx43(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
3362
- /* @__PURE__ */ jsx43(ComboCardList, { cards: message.comboCards ?? [], ui, slip }),
3367
+ /* @__PURE__ */ jsx43(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
3363
3368
  compact ? /* @__PURE__ */ jsx43(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ jsx43(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
3364
3369
  /* @__PURE__ */ jsx43(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
3365
3370
  /* @__PURE__ */ jsx43(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
@@ -9020,7 +9025,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
9020
9025
  if (age <= GRID_MAX_AGE_MS) return;
9021
9026
  inFlightRef.current = true;
9022
9027
  Promise.resolve().then(() => getRef.current(locale)).then((body) => {
9023
- if (body === null) {
9028
+ if (body === null || isPresetGrid(body) && !hasAnyCell(body)) {
9024
9029
  keptRef.current = null;
9025
9030
  if (mountedRef.current) setGrid(null);
9026
9031
  return;
@@ -9035,6 +9040,9 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
9035
9040
  }, [isOpen, locale]);
9036
9041
  return grid;
9037
9042
  }
9043
+ function hasAnyCell(grid) {
9044
+ return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0;
9045
+ }
9038
9046
 
9039
9047
  // src/popupTelemetry.ts
9040
9048
  import { useCallback as useCallback13, useEffect as useEffect24, useRef as useRef20 } from "react";