@sensiblestats/widget-react 0.66.0 → 0.67.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.67.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Match odds card, stage 3: a price card the server sends for the market the user bets on carries `tag: "your_market"`, and the card shows a "Your market" / "İlgilendiğin bahis" label on its market line. A card with no tag or an unknown tag shows no label.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @sensiblestats/widget-sdk@0.42.0
13
+
14
+ ## 0.66.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Match odds card polish: a compact list price with Add to slip off has a name screen readers read, and the 1 X 2 heads are hidden from them; "Show more" moves focus to the first new row; a list price already in the slip shows a tick; the Odds tab never draws a card stat.
19
+
3
20
  ## 0.66.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -72,6 +72,7 @@ var STRINGS = {
72
72
  showMore: (n) => `Show ${n} more`,
73
73
  oddsLabel: "Odds",
74
74
  liveLabel: "Live",
75
+ yourMarketTag: "Your market",
75
76
  marketFloorLabel: "Market price \xB7 not a value pick",
76
77
  addToSlip: "Add to slip",
77
78
  marketPrices: "Market prices",
@@ -371,6 +372,7 @@ var STRINGS = {
371
372
  showMore: (n) => `${n} tane daha g\xF6ster`,
372
373
  oddsLabel: "Oran",
373
374
  liveLabel: "Canl\u0131",
375
+ yourMarketTag: "\u0130lgilendi\u011Fin bahis",
374
376
  marketFloorLabel: "Piyasa oran\u0131 \xB7 de\u011Fer bahsi de\u011Fil",
375
377
  addToSlip: "Kupona ekle",
376
378
  marketPrices: "Piyasa fiyatlar\u0131",
@@ -698,6 +700,7 @@ function normalizeUi(cfg) {
698
700
  showMore: strings.showMore,
699
701
  oddsLabel: strings.oddsLabel,
700
702
  liveLabel: strings.liveLabel,
703
+ yourMarketTag: strings.yourMarketTag,
701
704
  marketFloorLabel: strings.marketFloorLabel,
702
705
  marketPrices: strings.marketPrices,
703
706
  moreLines: strings.moreLines,
@@ -1333,7 +1336,8 @@ function toMarketOddsVM(card) {
1333
1336
  marketDeveloperName: str(card.marketDeveloperName),
1334
1337
  mainLine: str(card.mainLine),
1335
1338
  pinEnabled: card.pinEnabled === true,
1336
- statText: card.insight && typeof card.insight === "object" ? str(card.insight.text) : void 0
1339
+ statText: card.insight && typeof card.insight === "object" ? str(card.insight.text) : void 0,
1340
+ tag: card.tag === "your_market" ? "your_market" : void 0
1337
1341
  };
1338
1342
  }
1339
1343
  function toOddsMovementVM(card) {
@@ -1480,8 +1484,9 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
1480
1484
  disabled: pending || settled,
1481
1485
  onClick,
1482
1486
  children: [
1487
+ settled ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
1483
1488
  price.label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-mol-lab", children: price.label }) : null,
1484
- shownOdds
1489
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: shownOdds })
1485
1490
  ]
1486
1491
  }
1487
1492
  ) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -1948,10 +1953,13 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
1948
1953
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-bi-team", children: vm.awayTeamName }),
1949
1954
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Crest2, { kind: "team", url: vm.awayCrest, name: vm.awayTeamName })
1950
1955
  ] }) : vm.fixture ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-mo-teams", children: vm.fixture }) : null,
1951
- vm.market ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-market-row", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-mo-market", children: vm.market }) }) : null
1956
+ vm.market ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-mo-market-row", children: [
1957
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-mo-market", children: vm.market }),
1958
+ vm.tag === "your_market" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ss-w-mo-tag", children: ui?.yourMarketTag ?? "Your market" }) : null
1959
+ ] }) : null
1952
1960
  ] }) : null
1953
1961
  ] }),
1954
- vm.statText && !hideHeader ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-stat", children: vm.statText }) : null,
1962
+ vm.statText && !hideHeader && !pinRef ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "ss-w-mo-stat", children: vm.statText }) : null,
1955
1963
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "ss-w-mo-rows", children: [
1956
1964
  vm.mainRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OddsRow, { vm, row, ui, slip, inSlipIds, history }, row.key)),
1957
1965
  open ? vm.moreRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(OddsRow, { vm, row, ui, slip, inSlipIds, history }, row.key)) : null
@@ -2032,6 +2040,7 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
2032
2040
  function Cell({ row, cell, ui, slip }) {
2033
2041
  const vm = row.card;
2034
2042
  const selection = vm.addToSlipEnabled ? marketOddsRowToSlipSelection(vm, cell.row, slip.conversationId) : null;
2043
+ const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell.row.selection} ${cell.row.odds}`;
2035
2044
  const button = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2036
2045
  SlipButton,
2037
2046
  {
@@ -2042,7 +2051,7 @@ function Cell({ row, cell, ui, slip }) {
2042
2051
  line: cell.row.line,
2043
2052
  slip,
2044
2053
  ui,
2045
- price: { label: cell.label, ariaLabel: `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell.row.selection} ${cell.row.odds}` }
2054
+ price: { label: cell.label, ariaLabel: name }
2046
2055
  }
2047
2056
  );
2048
2057
  return (
@@ -2050,18 +2059,19 @@ function Cell({ row, cell, ui, slip }) {
2050
2059
  // and 101.00 two.
2051
2060
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: ["ss-w-mol-cell", cell.row.odds.length >= 5 && "ss-w-mol-cell--wide", cell.row.odds.length >= 6 && "ss-w-mol-cell--wider"].filter(Boolean).join(" "), children: [
2052
2061
  selection && slip.onAddToSlip && ui ? button : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "ss-w-mol-price", children: [
2053
- cell.label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-lab", children: cell.label }) : null,
2054
- cell.row.odds
2062
+ cell.label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-lab", "aria-hidden": "true", children: cell.label }) : null,
2063
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-hidden": "true", children: cell.row.odds }),
2064
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-vh", children: name })
2055
2065
  ] }),
2056
2066
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OddsMovementBadge, { previous: cell.row.previousOdds, current: cell.row.odds, direction: cell.row.movementDirection, ui })
2057
2067
  ] })
2058
2068
  );
2059
2069
  }
2060
- function Row({ row, columns, ui, slip, monitor }) {
2070
+ function Row({ row, columns, ui, slip, monitor, rowRef }) {
2061
2071
  const vm = row.card;
2062
2072
  const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
2063
2073
  const when = vm.isLive ? ui?.liveLabel ?? "Live" : vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
2064
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-row", children: [
2074
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-row", ref: rowRef, tabIndex: rowRef ? -1 : void 0, children: [
2065
2075
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(MatchLink, { as: "div", matchId: vm.matchId, home: vm.homeTeamName, away: vm.awayTeamName, className: "ss-w-mol-fx", children: [
2066
2076
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "ss-w-mol-team", children: [
2067
2077
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Crest2, { kind: "team", url: vm.homeCrest, name: vm.homeTeamName ?? "" }),
@@ -2083,11 +2093,17 @@ function Row({ row, columns, ui, slip, monitor }) {
2083
2093
  function CompactOddsList({ list, ui, slip, monitor }) {
2084
2094
  const [shown, setShown] = (0, import_react13.useState)(COMPACT_PAGE);
2085
2095
  const hidden = list.rowCount - shown;
2096
+ const [focusIndex, setFocusIndex] = (0, import_react13.useState)(null);
2097
+ const focusRef = (0, import_react13.useRef)(null);
2098
+ (0, import_react13.useEffect)(() => {
2099
+ if (focusIndex !== null) focusRef.current?.focus();
2100
+ }, [focusIndex]);
2086
2101
  let left = shown;
2102
+ let index = 0;
2087
2103
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol", children: [
2088
2104
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "ss-w-mol-head", children: [
2089
2105
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-market", children: list.market }),
2090
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-cols", style: { gridTemplateColumns: `repeat(${list.columns.length}, minmax(0, 1fr))` }, children: list.columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-col", children: c }, `${c}:${i}`)) }),
2106
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-cols", "aria-hidden": "true", style: { gridTemplateColumns: `repeat(${list.columns.length}, minmax(0, 1fr))` }, children: list.columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-col", children: c }, `${c}:${i}`)) }),
2091
2107
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mol-side", "aria-hidden": "true" })
2092
2108
  ] }),
2093
2109
  list.groups.map((group, gi) => {
@@ -2099,10 +2115,16 @@ function CompactOddsList({ list, ui, slip, monitor }) {
2099
2115
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Crest2, { kind: "comp", url: group.competitionCrest, name: group.competition }),
2100
2116
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: group.competition })
2101
2117
  ] }) : null,
2102
- rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Row, { row, columns: list.columns.length, ui, slip, monitor }, row.card.id))
2118
+ rows.map((row) => {
2119
+ const at = index++;
2120
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Row, { row, columns: list.columns.length, ui, slip, monitor, rowRef: at === focusIndex ? focusRef : void 0 }, row.card.id);
2121
+ })
2103
2122
  ] }, `${group.competition ?? ""}:${gi}`);
2104
2123
  }),
2105
- hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "ss-w-mo-more", onClick: () => setShown((n) => n + COMPACT_PAGE), children: [
2124
+ hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "button", className: "ss-w-mo-more", onClick: () => {
2125
+ setFocusIndex(shown);
2126
+ setShown((n) => n + COMPACT_PAGE);
2127
+ }, children: [
2106
2128
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: ui?.showMore ? ui.showMore(Math.min(COMPACT_PAGE, hidden)) : `Show ${Math.min(COMPACT_PAGE, hidden)} more` }),
2107
2129
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "ss-w-mo-more-chev", "aria-hidden": "true" })
2108
2130
  ] }) : null,
@@ -8569,6 +8591,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
8569
8591
  .ss-w-mo-teams { font-size: 13px; font-weight: 650; color: var(--ss-w-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8570
8592
  .ss-w-mo-market-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
8571
8593
  .ss-w-mo-market { font-size: 11.5px; font-weight: 600; color: var(--ss-w-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8594
+ .ss-w-mo-tag { flex: none; font-size: 10.5px; font-weight: 700; line-height: 1.4; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
8572
8595
  .ss-w-mo-more { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; background: none; border: none; color: var(--ss-w-accent); font: inherit; font-size: 11.5px; font-weight: 600; padding: 2px 0; cursor: pointer; }
8573
8596
  .ss-w-mo-more:hover { text-decoration: underline; }
8574
8597
  .ss-w-mo-more-chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
@@ -8601,6 +8624,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
8601
8624
  .ss-w-mol-col { font-size: 10px; font-weight: 700; color: var(--ss-w-faint); text-align: center; overflow-wrap: break-word; min-width: 0; }
8602
8625
  .ss-w-mol-comp { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-w-faint); padding-top: 4px; }
8603
8626
  .ss-w-mol-row { padding: 6px 0; border-bottom: 1px dashed var(--ss-w-line); min-height: 48px; box-sizing: border-box; }
8627
+ .ss-w-mol-row:focus { outline: none; }
8628
+ .ss-w-mol-row:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; border-radius: 6px; }
8629
+ .ss-w-mol-tick { font-family: inherit; font-size: 9.5px; font-weight: 700; line-height: 1.1; }
8630
+ .ss-w-vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
8604
8631
  .ss-w-mol-group .ss-w-mol-row:last-child { border-bottom: none; }
8605
8632
  .ss-w-mol-fx { display: flex; flex-direction: column; gap: 3px; min-width: 0; background: none; border: none; padding: 0; text-align: left; font: inherit; color: inherit; }
8606
8633
  .ss-w-mol-team { display: flex; align-items: center; gap: 5px; min-width: 0; }