@sensiblestats/widget-react 0.10.1 → 0.11.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 +11 -0
- package/dist/index.cjs +30 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Neutral odds price-movement display on market_odds card rows.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sensiblestats/widget-sdk@0.9.0
|
|
13
|
+
|
|
3
14
|
## 0.10.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,9 @@ var STRINGS = {
|
|
|
61
61
|
marketPrices: "Market prices",
|
|
62
62
|
moreLines: "More lines",
|
|
63
63
|
hideLines: "Hide lines",
|
|
64
|
+
oddsMoved: (was, now, direction) => `was ${was}, now ${now}, ${direction}`,
|
|
65
|
+
oddsShortened: "shortened",
|
|
66
|
+
oddsDrifted: "drifted",
|
|
64
67
|
updatedLabel: "updated",
|
|
65
68
|
inSlip: "In slip",
|
|
66
69
|
slipAdded: (n) => n === void 0 ? "Added to slip" : `Added to slip (${n} selection${n === 1 ? "" : "s"})`,
|
|
@@ -91,6 +94,9 @@ var STRINGS = {
|
|
|
91
94
|
marketPrices: "Piyasa fiyatlar\u0131",
|
|
92
95
|
moreLines: "Di\u011Fer \xE7izgiler",
|
|
93
96
|
hideLines: "\xC7izgileri gizle",
|
|
97
|
+
oddsMoved: (was, now, direction) => `\xF6nce ${was}, \u015Fimdi ${now}, ${direction}`,
|
|
98
|
+
oddsShortened: "d\xFC\u015Ft\xFC",
|
|
99
|
+
oddsDrifted: "y\xFCkseldi",
|
|
94
100
|
updatedLabel: "g\xFCncellendi",
|
|
95
101
|
inSlip: "Kuponda",
|
|
96
102
|
slipAdded: (n) => n === void 0 ? "Kupona eklendi" : `Kupona eklendi (${n} se\xE7im)`,
|
|
@@ -137,6 +143,9 @@ function normalizeUi(cfg) {
|
|
|
137
143
|
marketPrices: strings.marketPrices,
|
|
138
144
|
moreLines: strings.moreLines,
|
|
139
145
|
hideLines: strings.hideLines,
|
|
146
|
+
oddsMoved: strings.oddsMoved,
|
|
147
|
+
oddsShortened: strings.oddsShortened,
|
|
148
|
+
oddsDrifted: strings.oddsDrifted,
|
|
140
149
|
updatedLabel: strings.updatedLabel,
|
|
141
150
|
addToSlip: strings.addToSlip,
|
|
142
151
|
inSlip: strings.inSlip,
|
|
@@ -280,6 +289,8 @@ function toMarketOddsVM(card) {
|
|
|
280
289
|
const toRow = (r, i) => {
|
|
281
290
|
const selection = [str(r.selectionLabel), str(r.line)].filter(Boolean).join(" ");
|
|
282
291
|
const price = typeof r.price === "number" && Number.isFinite(r.price) ? r.price : void 0;
|
|
292
|
+
const previous = typeof r.previousPrice === "number" && Number.isFinite(r.previousPrice) ? r.previousPrice : void 0;
|
|
293
|
+
const direction = r.movementDirection === "shortened" || r.movementDirection === "drifted" ? r.movementDirection : void 0;
|
|
283
294
|
return {
|
|
284
295
|
key: `${selection}:${str(r.line) ?? ""}:${i}`,
|
|
285
296
|
selection,
|
|
@@ -287,7 +298,9 @@ function toMarketOddsVM(card) {
|
|
|
287
298
|
oddsDecimal: price,
|
|
288
299
|
matchOddsId: typeof r.matchOddsId === "number" ? r.matchOddsId : void 0,
|
|
289
300
|
quotedAtUtc: str(r.quotedAtUtc),
|
|
290
|
-
isMain: r.isMainLine !== false
|
|
301
|
+
isMain: r.isMainLine !== false,
|
|
302
|
+
previousOdds: previous !== void 0 && direction !== void 0 ? previous.toFixed(2) : void 0,
|
|
303
|
+
movementDirection: previous !== void 0 && direction !== void 0 ? direction : void 0
|
|
291
304
|
};
|
|
292
305
|
};
|
|
293
306
|
const vms = rows.map(toRow).filter((r) => r.selection && r.odds);
|
|
@@ -823,8 +836,18 @@ var import_react6 = require("react");
|
|
|
823
836
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
824
837
|
function OddsRow({ vm, row, ui, slip }) {
|
|
825
838
|
const selection = vm.addToSlipEnabled ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
839
|
+
const directionWord = row.movementDirection === "shortened" ? ui?.oddsShortened ?? "shortened" : ui?.oddsDrifted ?? "drifted";
|
|
840
|
+
const movementLabel = row.previousOdds !== void 0 ? ui?.oddsMoved?.(row.previousOdds, row.odds, directionWord) ?? `was ${row.previousOdds}, now ${row.odds}, ${directionWord}` : void 0;
|
|
826
841
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "ss-w-mo-row", children: [
|
|
827
842
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-mo-sel", children: row.selection }),
|
|
843
|
+
row.previousOdds !== void 0 ? (
|
|
844
|
+
// Strikethrough is invisible to screen readers, so the whole was/now/direction sentence
|
|
845
|
+
// rides on one aria-label and the visual glyphs are hidden from the accessibility tree.
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "ss-w-mo-move", role: "img", "aria-label": movementLabel, children: [
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-mo-prev", "aria-hidden": "true", children: row.previousOdds }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-mo-arrow", "aria-hidden": "true", children: row.movementDirection === "shortened" ? "\u25BC" : "\u25B2" })
|
|
849
|
+
] })
|
|
850
|
+
) : null,
|
|
828
851
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-mo-price", children: row.odds }),
|
|
829
852
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SlipButton, { selection, shownOdds: row.odds, marketName: vm.market, slip, ui })
|
|
830
853
|
] });
|
|
@@ -1182,6 +1205,12 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
1182
1205
|
.ss-w-mo-row:last-child { border-bottom: none; }
|
|
1183
1206
|
.ss-w-mo-sel { font-size: 12.5px; font-weight: 600; color: var(--ss-w-ink); }
|
|
1184
1207
|
.ss-w-mo-price { margin-left: auto; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; color: var(--ss-w-accent); }
|
|
1208
|
+
/* Movement: BOTH directions share --ss-w-faint on purpose. Green-good/red-bad would frame a
|
|
1209
|
+
shortening price as a discount, which inverts what it actually means for the bettor. */
|
|
1210
|
+
.ss-w-mo-move { margin-left: auto; display: inline-flex; align-items: baseline; gap: 4px; color: var(--ss-w-faint); }
|
|
1211
|
+
.ss-w-mo-prev { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 12px; text-decoration: line-through; }
|
|
1212
|
+
.ss-w-mo-arrow { font-size: 9px; line-height: 1; }
|
|
1213
|
+
.ss-w-mo-move + .ss-w-mo-price { margin-left: 0; }
|
|
1185
1214
|
.ss-w-mo-row .ss-w-slip { margin: 0; }
|
|
1186
1215
|
.ss-w-mo-foot { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--ss-w-faint); }
|
|
1187
1216
|
|