@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/dist/index.js CHANGED
@@ -149,7 +149,11 @@ var STRINGS = {
149
149
  maxPriceName: "Max price",
150
150
  minPriceName: "Lowest price",
151
151
  notToday: " \xB7 not today",
152
- changeCombo: "Change total or matches"
152
+ changeCombo: "Change total or matches",
153
+ marketRow: "{market} picks today",
154
+ marketName: "Market",
155
+ 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),
156
+ marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`
153
157
  },
154
158
  games: {
155
159
  lang: "en",
@@ -483,7 +487,11 @@ var STRINGS = {
483
487
  maxPriceName: "En y\xFCksek oran",
484
488
  minPriceName: "En d\xFC\u015F\xFCk oran",
485
489
  notToday: " \xB7 bug\xFCn yok",
486
- changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir"
490
+ changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
491
+ marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
492
+ marketName: "Bahis t\xFCr\xFC",
493
+ 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),
494
+ marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`
487
495
  },
488
496
  games: {
489
497
  lang: "tr",
@@ -2939,6 +2947,16 @@ function comboAsk(cell, s) {
2939
2947
  preset: { kind: "combo", total: cell.total, legs: cell.legs, ...idsOf(cell.combo.legs) }
2940
2948
  };
2941
2949
  }
2950
+ function marketAsk(cell, s) {
2951
+ return {
2952
+ message: s.marketMessage(cell.marketLabel, cell.selectionLabel ?? null, cell.count),
2953
+ displayText: marketDisplay(cell, s),
2954
+ preset: { kind: "market", marketDeveloperName: cell.marketDeveloperName, ...idsOf(cell.picks) }
2955
+ };
2956
+ }
2957
+ function marketDisplay(cell, s) {
2958
+ return s.marketRow.replace("{market}", s.marketShort(cell.marketDeveloperName, cell.marketLabel, cell.selectionLabel ?? null));
2959
+ }
2942
2960
 
2943
2961
  // src/usePresetGrid.ts
2944
2962
  var GRID_MAX_AGE_MS = 6e5;
@@ -2986,7 +3004,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
2986
3004
  return grid;
2987
3005
  }
2988
3006
  function hasAnyCell(grid) {
2989
- return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0;
3007
+ return grid.singles.length > 0 || grid.singlesFrom.length > 0 || grid.combos.length > 0 || grid.markets !== void 0 && grid.markets.length > 0;
2990
3008
  }
2991
3009
 
2992
3010
  // src/liveClock.ts
@@ -8696,6 +8714,13 @@ function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty =
8696
8714
  }, children: choices2.map((c, i) => /* @__PURE__ */ jsx90("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, i)) })
8697
8715
  ] });
8698
8716
  }
8717
+ function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
8718
+ const sizeText = sizeLabels[currentIdx] ?? "";
8719
+ return /* @__PURE__ */ jsxs75("span", { className: "ss-w-tool-num", children: [
8720
+ /* @__PURE__ */ jsx90("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
8721
+ /* @__PURE__ */ jsx90("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__ */ jsx90("option", { value: String(i), children: opt }, i)) })
8722
+ ] });
8723
+ }
8699
8724
  function SendButton({ label, display, disabled, onClick }) {
8700
8725
  return /* @__PURE__ */ jsx90("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
8701
8726
  }
@@ -8759,6 +8784,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8759
8784
  const comboCell = findCombo(grid, total, legs);
8760
8785
  const bigCell = findCombo(grid, bigTotal, bigLegs);
8761
8786
  const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
8787
+ const chooseMarket = (idx) => {
8788
+ setMarketIdx(idx);
8789
+ const cell = markets[idx];
8790
+ if (cell) announce(marketDisplay(cell, strings), cell.count > 0);
8791
+ };
8762
8792
  const chooseMax = (v) => {
8763
8793
  setMaxPrice(v);
8764
8794
  announce(strings.maxPriceDisplay(count, v), !!findSingles(grid.singles, v, count));
@@ -8791,6 +8821,10 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8791
8821
  const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
8792
8822
  const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
8793
8823
  const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
8824
+ const markets = grid.markets ?? [];
8825
+ const [marketIdx, setMarketIdx] = useState41(0);
8826
+ const marketCell = markets[marketIdx] ?? null;
8827
+ const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
8794
8828
  const singlesReady = (cell) => cell ? strings.readyCount(cell.picks.length) : strings.unavailable;
8795
8829
  const comboReady = (cell) => cell ? strings.readyAt(cell.combo.total) : strings.unavailable;
8796
8830
  return /* @__PURE__ */ jsxs75(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
@@ -8850,6 +8884,19 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
8850
8884
  } })
8851
8885
  }
8852
8886
  ),
8887
+ markets.length > 0 && /* @__PURE__ */ jsx90(
8888
+ AskRow,
8889
+ {
8890
+ icon: "\u26BD",
8891
+ ask: fillTemplate(strings.marketRow, {
8892
+ market: /* @__PURE__ */ jsx90(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
8893
+ }),
8894
+ ready: marketCell ? strings.readyCount(marketCell.count) : null,
8895
+ send: /* @__PURE__ */ jsx90(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
8896
+ if (marketCell) onSend(marketAsk(marketCell, strings));
8897
+ } })
8898
+ }
8899
+ ),
8853
8900
  /* @__PURE__ */ jsx90("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
8854
8901
  ] });
8855
8902
  }