@sensiblestats/widget-react 0.73.1 → 0.74.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,11 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.74.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Set the numbers: a fifth row, "BTTS picks today", with a market dropdown (BTTS, Over 2.5, Under 2.5, Double chance, Match winner), an "N ready" pill and the round send. It shows only when the server's preset grid has a `markets` section.
8
+
3
9
  ## 0.73.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -187,7 +187,11 @@ var STRINGS = {
187
187
  maxPriceName: "Max price",
188
188
  minPriceName: "Lowest price",
189
189
  notToday: " \xB7 not today",
190
- changeCombo: "Change total or matches"
190
+ changeCombo: "Change total or matches",
191
+ marketRow: "{market} picks today",
192
+ marketName: "Market",
193
+ marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
194
+ marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`
191
195
  },
192
196
  games: {
193
197
  lang: "en",
@@ -521,7 +525,11 @@ var STRINGS = {
521
525
  maxPriceName: "En y\xFCksek oran",
522
526
  minPriceName: "En d\xFC\u015F\xFCk oran",
523
527
  notToday: " \xB7 bug\xFCn yok",
524
- changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir"
528
+ changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
529
+ marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
530
+ marketName: "Bahis t\xFCr\xFC",
531
+ marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
532
+ marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`
525
533
  },
526
534
  games: {
527
535
  lang: "tr",
@@ -2977,6 +2985,16 @@ function comboAsk(cell, s) {
2977
2985
  preset: { kind: "combo", total: cell.total, legs: cell.legs, ...idsOf(cell.combo.legs) }
2978
2986
  };
2979
2987
  }
2988
+ function marketAsk(cell, s) {
2989
+ return {
2990
+ message: s.marketMessage(cell.marketLabel, cell.selectionLabel ?? null, cell.count),
2991
+ displayText: marketDisplay(cell, s),
2992
+ preset: { kind: "market", marketDeveloperName: cell.marketDeveloperName, ...idsOf(cell.picks) }
2993
+ };
2994
+ }
2995
+ function marketDisplay(cell, s) {
2996
+ return s.marketRow.replace("{market}", s.marketShort(cell.marketDeveloperName, cell.marketLabel, cell.selectionLabel ?? null));
2997
+ }
2980
2998
 
2981
2999
  // src/usePresetGrid.ts
2982
3000
  var GRID_MAX_AGE_MS = 6e5;
@@ -3024,7 +3042,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
3024
3042
  return grid;
3025
3043
  }
3026
3044
  function hasAnyCell(grid) {
3027
- return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0;
3045
+ return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0 || grid.markets !== void 0 && grid.markets.length > 0;
3028
3046
  }
3029
3047
 
3030
3048
  // src/liveClock.ts
@@ -8734,6 +8752,13 @@ function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty =
8734
8752
  }, children: choices2.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, i)) })
8735
8753
  ] });
8736
8754
  }
8755
+ function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
8756
+ const sizeText = sizeLabels[currentIdx] ?? "";
8757
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { className: "ss-w-tool-num", children: [
8758
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
8759
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(currentIdx), onChange: (e) => onChoose(Number(e.target.value)), children: optionLabels.map((opt, i) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("option", { value: String(i), children: opt }, i)) })
8760
+ ] });
8761
+ }
8737
8762
  function SendButton({ label, display, disabled, onClick }) {
8738
8763
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
8739
8764
  }
@@ -8797,6 +8822,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8797
8822
  const comboCell = findCombo(grid, total, legs);
8798
8823
  const bigCell = findCombo(grid, bigTotal, bigLegs);
8799
8824
  const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
8825
+ const chooseMarket = (idx) => {
8826
+ setMarketIdx(idx);
8827
+ const cell = markets[idx];
8828
+ if (cell) announce(marketDisplay(cell, strings), cell.count > 0);
8829
+ };
8800
8830
  const chooseMax = (v) => {
8801
8831
  setMaxPrice(v);
8802
8832
  announce(strings.maxPriceDisplay(count, v), !!findSingles(grid.singles, v, count));
@@ -8829,6 +8859,10 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8829
8859
  const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
8830
8860
  const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
8831
8861
  const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
8862
+ const markets = grid.markets ?? [];
8863
+ const [marketIdx, setMarketIdx] = (0, import_react51.useState)(0);
8864
+ const marketCell = markets[marketIdx] ?? null;
8865
+ const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
8832
8866
  const singlesReady = (cell) => cell ? strings.readyCount(cell.picks.length) : strings.unavailable;
8833
8867
  const comboReady = (cell) => cell ? strings.readyAt(cell.combo.total) : strings.unavailable;
8834
8868
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
@@ -8888,6 +8922,19 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8888
8922
  } })
8889
8923
  }
8890
8924
  ),
8925
+ markets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8926
+ AskRow,
8927
+ {
8928
+ icon: "\u26BD",
8929
+ ask: fillTemplate(strings.marketRow, {
8930
+ market: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
8931
+ }),
8932
+ ready: marketCell ? strings.readyCount(marketCell.count) : null,
8933
+ send: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
8934
+ if (marketCell) onSend(marketAsk(marketCell, strings));
8935
+ } })
8936
+ }
8937
+ ),
8891
8938
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
8892
8939
  ] });
8893
8940
  }