@sensiblestats/widget-react 0.140.0 → 0.142.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 +22 -0
- package/README.md +1 -1
- package/dist/index.cjs +241 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +242 -48
- package/dist/index.js.map +1 -1
- package/dist/styles.css +20 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.142.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 087796d: The sentence builder takes a typed total: a pencil chip beside the totals opens an input in the visitor's odds format. `combo_add_click.total` reads `custom` for it. The total row is a four-column grid. Input that can't be read says how to type it in the visitor's format; a number outside 1.01 to 1000 says the range. A trailing `.` or `,` after a whole number is ignored in every format, a bare fractional `7` reads as 7/1 and shows that way on the chip, and `evs` reads as evens.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [087796d]
|
|
12
|
+
- @sensiblestats/widget-sdk@0.104.0
|
|
13
|
+
|
|
14
|
+
## 0.141.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 3e4fd4c: Write a player-prop leg's recent-games count ("went over in 7 of the last 10 games") under the leg in the combo builder, in every supported language. A leg with no fact renders as before. The tab strip fits narrow panels in every language: a tighter level draws the counts flat, and if the tabs still overflow the strip scrolls with an end fade, keeping a keyboard-focused tab clear of the fade.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [3e4fd4c]
|
|
23
|
+
- @sensiblestats/widget-sdk@0.103.0
|
|
24
|
+
|
|
3
25
|
## 0.140.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -236,7 +236,7 @@ Rules:
|
|
|
236
236
|
| `pin_click` | `action` (`add`, `remove`), `target` (`match`, `market`), `matchId?`, `market?`, `sport?` | A pin is tapped |
|
|
237
237
|
| `add_to_slip_click` | `matchOddsId`, `matchId`, `odds`, `market?`, `sport?`, `factKey?` | "Add to slip" is tapped. `factKey` is set when the add came from a live fact's market, so you can attribute the add to that fact |
|
|
238
238
|
| `add_to_slip_result` | as above, plus `outcome` | Your `onAddToSlip` has answered |
|
|
239
|
-
| `combo_add_click` | `surface`, `sport`, `legs`, `total` | "Add all" has added every leg of a combo: `surface` is `builder` for the bet builder and `chat` for a combo card in an answer. `total` is the total the visitor asked for. A partial add or a refused leg fires none. Each leg also fires its own `add_to_slip_click` and `add_to_slip_result` |
|
|
239
|
+
| `combo_add_click` | `surface`, `sport`, `legs`, `total` | "Add all" has added every leg of a combo: `surface` is `builder` for the bet builder and `chat` for a combo card in an answer. `total` is the chip key the visitor chose in the builder (`custom` for a typed total), or the total the visitor asked for in chat (empty when they asked for none). A partial add or a refused leg fires none. Each leg also fires its own `add_to_slip_click` and `add_to_slip_result` |
|
|
240
240
|
| `all_markets_click` | `matchId`, `market?`, `surface` | "All markets" is tapped |
|
|
241
241
|
| `dashboard_tile_click` | `entityType`, `entityId` | A dashboard tile is tapped |
|
|
242
242
|
| `sport_switch` | `sport` | The visitor switches sport on the dashboard |
|
package/dist/index.cjs
CHANGED
|
@@ -254,6 +254,12 @@ var BUNDLED_EN_GB = {
|
|
|
254
254
|
"widget.v8BuilderSingles": "Singles",
|
|
255
255
|
"widget.v8BuilderTotal": "total",
|
|
256
256
|
"widget.v8BuilderAny": "Any",
|
|
257
|
+
"widget.v8BuilderCustomLabel": "Type your own total",
|
|
258
|
+
"widget.v8BuilderCustomPlaceholder": "e.g. {example}",
|
|
259
|
+
"widget.v8BuilderCustomSet": "Set",
|
|
260
|
+
"widget.v8BuilderCustomRange": "Enter a total above 1.01 and up to 1000.",
|
|
261
|
+
"widget.v8BuilderCustomUnreadable": "Type the total like {example}.",
|
|
262
|
+
"widget.v8BuilderCustomEdit": "Your total {total}, edit",
|
|
257
263
|
"widget.v8BuilderLoading": "Loading\u2026",
|
|
258
264
|
"widget.v8BuilderError": "Couldn't load this right now.",
|
|
259
265
|
"widget.v8BuilderRetry": "Try again",
|
|
@@ -323,6 +329,8 @@ var BUNDLED_EN_GB = {
|
|
|
323
329
|
"widget.presets.moreMatches": "More matches",
|
|
324
330
|
"widget.presets.changeCombo": "Change total or matches",
|
|
325
331
|
"widget.presets.standoutAsk": "Standout matches today",
|
|
332
|
+
"widget.presets.legFactOver": "Went over in {hits} of the last {games} games",
|
|
333
|
+
"widget.presets.legFactUnder": "Went under in {hits} of the last {games} games",
|
|
326
334
|
"widget.nba.with": "With",
|
|
327
335
|
"widget.nba.without": "Without",
|
|
328
336
|
"widget.nba.line": "Line",
|
|
@@ -1145,6 +1153,9 @@ var ROW_LEAVES = {
|
|
|
1145
1153
|
favRemove: (c) => (name) => c.t("widget.favRemove", { name }),
|
|
1146
1154
|
favStar: (c) => (name) => c.t("widget.favStar", { name }),
|
|
1147
1155
|
favUnstar: (c) => (name) => c.t("widget.favUnstar", { name }),
|
|
1156
|
+
v8BuilderCustomPlaceholder: (c) => (example) => c.t("widget.v8BuilderCustomPlaceholder", { example }),
|
|
1157
|
+
v8BuilderCustomUnreadable: (c) => (example) => c.t("widget.v8BuilderCustomUnreadable", { example }),
|
|
1158
|
+
v8BuilderCustomEdit: (c) => (total) => c.t("widget.v8BuilderCustomEdit", { total }),
|
|
1148
1159
|
v8Follow: (c) => (name) => c.t("widget.v8Follow", { name }),
|
|
1149
1160
|
v8PricesAsOf: (c) => (time) => c.t("widget.v8PricesAsOf", { time }),
|
|
1150
1161
|
v8InjuryAsOf: (c) => (time) => c.t("widget.v8InjuryAsOf", { time }),
|
|
@@ -1160,6 +1171,8 @@ var ROW_LEAVES = {
|
|
|
1160
1171
|
v8Hits: (c) => (hits, window2) => c.t("widget.v8Hits", { hits, window: window2 }),
|
|
1161
1172
|
"presets.comboDisplay": (c) => (legs, total) => c.t("widget.presets.comboDisplay", { legs, total }),
|
|
1162
1173
|
"presets.comboMessage": (c) => (legs, total) => c.t("widget.presets.comboMessage", { legs, total }),
|
|
1174
|
+
"presets.legFactOver": (c) => (hits, games) => c.t("widget.presets.legFactOver", { hits, games }),
|
|
1175
|
+
"presets.legFactUnder": (c) => (hits, games) => c.t("widget.presets.legFactUnder", { hits, games }),
|
|
1163
1176
|
"nba.over": (c) => (line) => c.t("widget.nba.over", { line }),
|
|
1164
1177
|
"nba.under": (c) => (line) => c.t("widget.nba.under", { line }),
|
|
1165
1178
|
"nba.lastN": (c) => (n) => c.t("widget.nba.lastN", { count: n }),
|
|
@@ -1336,9 +1349,29 @@ function parseOddsFormat(value) {
|
|
|
1336
1349
|
const v = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
1337
1350
|
return v === "decimal" || v === "american" || v === "fractional" ? v : void 0;
|
|
1338
1351
|
}
|
|
1352
|
+
var CUSTOM_TOTAL_EXAMPLE = { decimal: "7.50", fractional: "13/2", american: "+650" };
|
|
1353
|
+
var roundCents = (x) => Math.round(x * 100 + 1e-9) / 100;
|
|
1354
|
+
function parseCustomTotal(text2, format2) {
|
|
1355
|
+
const t = text2.trim().replace(/\u2212/g, "-").replace(/^([+-]?\d+)[.,]$/, "$1");
|
|
1356
|
+
const point = /^(\d{0,9})[.,](\d{1,9})$/.exec(t);
|
|
1357
|
+
const whole = /^\d{1,12}$/.test(t);
|
|
1358
|
+
const fraction = format2 === "fractional" ? /^(\d{1,9})\s*\/\s*(\d{1,9})$/.exec(t) : null;
|
|
1359
|
+
const american = format2 === "american" ? /^([+-]?)(\d{1,12})$/.exec(t) : null;
|
|
1360
|
+
let value = null;
|
|
1361
|
+
if (point) value = Number(`${point[1] || "0"}.${point[2]}`);
|
|
1362
|
+
else if (format2 === "decimal" && whole) value = Number(t);
|
|
1363
|
+
else if (format2 === "fractional" && whole) value = 1 + Number(t);
|
|
1364
|
+
else if (format2 === "fractional" && /^ev(s|ens)$/i.test(t)) value = 2;
|
|
1365
|
+
else if (fraction && Number(fraction[2]) > 0) value = 1 + Number(fraction[1]) / Number(fraction[2]);
|
|
1366
|
+
else if (american && Number(american[2]) >= 100) value = american[1] === "-" ? 1 + 100 / Number(american[2]) : 1 + Number(american[2]) / 100;
|
|
1367
|
+
if (value === null) return { error: "unreadable" };
|
|
1368
|
+
const cents2 = roundCents(value);
|
|
1369
|
+
if (!(cents2 > 1.01 && cents2 <= 1e3)) return { error: "range" };
|
|
1370
|
+
return { decimal: cents2.toFixed(2), text: format2 === "fractional" && whole ? `${t}/1` : t };
|
|
1371
|
+
}
|
|
1339
1372
|
|
|
1340
1373
|
// src/version.generated.ts
|
|
1341
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1374
|
+
var WIDGET_REACT_VERSION = "0.142.0";
|
|
1342
1375
|
|
|
1343
1376
|
// src/config.ts
|
|
1344
1377
|
function hostTag(cfg) {
|
|
@@ -1648,6 +1681,12 @@ function normalizeUi(cfg, loaded) {
|
|
|
1648
1681
|
v8BuilderSingles: strings.v8BuilderSingles,
|
|
1649
1682
|
v8BuilderTotal: strings.v8BuilderTotal,
|
|
1650
1683
|
v8BuilderAny: strings.v8BuilderAny,
|
|
1684
|
+
v8BuilderCustomLabel: strings.v8BuilderCustomLabel,
|
|
1685
|
+
v8BuilderCustomPlaceholder: strings.v8BuilderCustomPlaceholder,
|
|
1686
|
+
v8BuilderCustomSet: strings.v8BuilderCustomSet,
|
|
1687
|
+
v8BuilderCustomRange: strings.v8BuilderCustomRange,
|
|
1688
|
+
v8BuilderCustomUnreadable: strings.v8BuilderCustomUnreadable,
|
|
1689
|
+
v8BuilderCustomEdit: strings.v8BuilderCustomEdit,
|
|
1651
1690
|
v8BuilderLoading: strings.v8BuilderLoading,
|
|
1652
1691
|
v8BuilderError: strings.v8BuilderError,
|
|
1653
1692
|
v8BuilderRetry: strings.v8BuilderRetry,
|
|
@@ -2181,6 +2220,9 @@ function toComboLegVM(leg) {
|
|
|
2181
2220
|
const hasStat = !!insightId && !!statText;
|
|
2182
2221
|
if (price === void 0 || matchOddsId === void 0 || matchId === void 0 || !home || !away || !selectionLabel) return null;
|
|
2183
2222
|
const line = str(leg.line);
|
|
2223
|
+
const rawFact = leg.fact && typeof leg.fact === "object" ? leg.fact : void 0;
|
|
2224
|
+
const direction2 = leg.direction === "over" || leg.direction === "under" ? leg.direction : void 0;
|
|
2225
|
+
const fact = rawFact && direction2 && Number.isInteger(rawFact.hits) && Number.isInteger(rawFact.games) && Number.isInteger(rawFact.window) && rawFact.games >= 5 && rawFact.hits >= 0 && rawFact.hits <= rawFact.games && rawFact.games <= rawFact.window ? { hits: rawFact.hits, games: rawFact.games, window: rawFact.window, direction: direction2 } : void 0;
|
|
2184
2226
|
return {
|
|
2185
2227
|
key: `${matchOddsId}`,
|
|
2186
2228
|
matchId,
|
|
@@ -2201,6 +2243,7 @@ function toComboLegVM(leg) {
|
|
|
2201
2243
|
matchOddsId,
|
|
2202
2244
|
quotedAtUtc: str(leg.quotedAtUtc),
|
|
2203
2245
|
...hasStat ? { insightId, statText } : {},
|
|
2246
|
+
...fact ? { fact } : {},
|
|
2204
2247
|
pinEnabled: leg.pinEnabled === true
|
|
2205
2248
|
};
|
|
2206
2249
|
}
|
|
@@ -8391,6 +8434,8 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
8391
8434
|
const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
8392
8435
|
const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
|
|
8393
8436
|
const showPin = !!monitor && leg.pinEnabled;
|
|
8437
|
+
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
8438
|
+
const line = leg.statText ?? factText;
|
|
8394
8439
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
8395
8440
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
8396
8441
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -8426,7 +8471,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
8426
8471
|
}
|
|
8427
8472
|
)
|
|
8428
8473
|
] }),
|
|
8429
|
-
|
|
8474
|
+
line ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-combo-leg-stat", children: line }) : null
|
|
8430
8475
|
] });
|
|
8431
8476
|
}
|
|
8432
8477
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
@@ -10891,7 +10936,8 @@ var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder
|
|
|
10891
10936
|
// src/components/TabBar.tsx
|
|
10892
10937
|
var import_react69 = require("react");
|
|
10893
10938
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10894
|
-
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6];
|
|
10939
|
+
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
10940
|
+
var FOCUS_EDGE = 24;
|
|
10895
10941
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled }) {
|
|
10896
10942
|
const tabs = [
|
|
10897
10943
|
{ tab: "chat", label: ui.tabChat, count: 0, dot: monitor.chatDot },
|
|
@@ -10924,11 +10970,15 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10924
10970
|
const strip = listRef.current;
|
|
10925
10971
|
if (!strip) return;
|
|
10926
10972
|
const measure = () => {
|
|
10973
|
+
strip.removeAttribute("data-scroll");
|
|
10927
10974
|
for (const tight of TIGHT_LEVELS) {
|
|
10928
10975
|
if (tight === 0) strip.removeAttribute("data-tight");
|
|
10929
10976
|
else strip.setAttribute("data-tight", String(tight));
|
|
10930
10977
|
if (strip.scrollWidth <= strip.clientWidth) return;
|
|
10931
10978
|
}
|
|
10979
|
+
strip.setAttribute("data-scroll", "");
|
|
10980
|
+
const on = strip.querySelector("[data-on]");
|
|
10981
|
+
if (on) strip.scrollLeft = Math.max(0, on.offsetLeft - 16);
|
|
10932
10982
|
};
|
|
10933
10983
|
measure();
|
|
10934
10984
|
const fonts = typeof document !== "undefined" ? document.fonts : void 0;
|
|
@@ -10940,31 +10990,63 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10940
10990
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
10941
10991
|
};
|
|
10942
10992
|
}, [labelSignature]);
|
|
10993
|
+
const pointerDown = (0, import_react69.useRef)(false);
|
|
10994
|
+
const keepFocusedTabInView = (e) => {
|
|
10995
|
+
const strip = e.currentTarget;
|
|
10996
|
+
const tab = e.target;
|
|
10997
|
+
if (pointerDown.current) {
|
|
10998
|
+
pointerDown.current = false;
|
|
10999
|
+
return;
|
|
11000
|
+
}
|
|
11001
|
+
if (!strip.hasAttribute("data-scroll") || !(tab instanceof HTMLElement) || tab === strip) return;
|
|
11002
|
+
const left = tab.offsetLeft - FOCUS_EDGE;
|
|
11003
|
+
const right = tab.offsetLeft + tab.offsetWidth + FOCUS_EDGE - strip.clientWidth;
|
|
11004
|
+
if (strip.scrollLeft > left) strip.scrollLeft = Math.max(0, left);
|
|
11005
|
+
else if (strip.scrollLeft < right) strip.scrollLeft = right;
|
|
11006
|
+
};
|
|
10943
11007
|
if (tabs.length < 2) return null;
|
|
10944
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
"
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
"aria-label": tab === "live" && count2 > 0 ? `${label} \xB7 ${ui.liveCountLabel(count2)}` : void 0,
|
|
10954
|
-
className: "ss-w-tab",
|
|
10955
|
-
onClick: () => {
|
|
10956
|
-
if (tab !== monitor.activeTab) track({ name: "tab_change", from: monitor.activeTab, to: tab });
|
|
10957
|
-
monitor.setActiveTab(tab);
|
|
10958
|
-
},
|
|
10959
|
-
children: [
|
|
10960
|
-
label,
|
|
10961
|
-
count2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-count", "aria-hidden": tab === "live" ? true : void 0, children: count2 }),
|
|
10962
|
-
dot && !active && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-dot", "aria-hidden": "true" })
|
|
10963
|
-
]
|
|
11008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
11009
|
+
"div",
|
|
11010
|
+
{
|
|
11011
|
+
className: "ss-w-tabs",
|
|
11012
|
+
role: "tablist",
|
|
11013
|
+
ref: listRef,
|
|
11014
|
+
onFocus: keepFocusedTabInView,
|
|
11015
|
+
onPointerDown: () => {
|
|
11016
|
+
pointerDown.current = true;
|
|
10964
11017
|
},
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
11018
|
+
onClick: () => {
|
|
11019
|
+
pointerDown.current = false;
|
|
11020
|
+
},
|
|
11021
|
+
onPointerCancel: () => {
|
|
11022
|
+
pointerDown.current = false;
|
|
11023
|
+
},
|
|
11024
|
+
children: tabs.map(({ tab, label, count: count2, dot }) => {
|
|
11025
|
+
const active = monitor.activeTab === tab;
|
|
11026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
11027
|
+
"button",
|
|
11028
|
+
{
|
|
11029
|
+
type: "button",
|
|
11030
|
+
role: "tab",
|
|
11031
|
+
"aria-selected": active,
|
|
11032
|
+
"data-on": active ? "" : void 0,
|
|
11033
|
+
"aria-label": tab === "live" && count2 > 0 ? `${label} \xB7 ${ui.liveCountLabel(count2)}` : void 0,
|
|
11034
|
+
className: "ss-w-tab",
|
|
11035
|
+
onClick: () => {
|
|
11036
|
+
if (tab !== monitor.activeTab) track({ name: "tab_change", from: monitor.activeTab, to: tab });
|
|
11037
|
+
monitor.setActiveTab(tab);
|
|
11038
|
+
},
|
|
11039
|
+
children: [
|
|
11040
|
+
label,
|
|
11041
|
+
count2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-count", "aria-hidden": tab === "live" ? true : void 0, children: count2 }),
|
|
11042
|
+
dot && !active && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ss-w-tab-dot", "aria-hidden": "true" })
|
|
11043
|
+
]
|
|
11044
|
+
},
|
|
11045
|
+
tab
|
|
11046
|
+
);
|
|
11047
|
+
})
|
|
11048
|
+
}
|
|
11049
|
+
);
|
|
10968
11050
|
}
|
|
10969
11051
|
|
|
10970
11052
|
// src/components/MonitorTabs.tsx
|
|
@@ -17257,6 +17339,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17257
17339
|
const openingView = {
|
|
17258
17340
|
legs: preset.legs,
|
|
17259
17341
|
total: asTotal(preset.totalTarget, totals),
|
|
17342
|
+
custom: null,
|
|
17260
17343
|
// All markets opens unless the visitor has a usual market, which is never beaten.
|
|
17261
17344
|
marketKey: marketOptions && !marketOptions.some((m) => m.usual) ? null : preset.marketKey,
|
|
17262
17345
|
gamesId: opening.option?.id ?? null,
|
|
@@ -17273,11 +17356,38 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17273
17356
|
matchIds: v.widen ? [] : v.matchIds,
|
|
17274
17357
|
legs: v.legs,
|
|
17275
17358
|
// The total row is hidden for Singles, so a total picked earlier must not narrow them; the pick stays in state for the way back.
|
|
17276
|
-
total: v.legs === 1 ? "any" : v.total,
|
|
17359
|
+
total: v.legs === 1 ? "any" : v.custom?.decimal ?? v.total,
|
|
17277
17360
|
widen: v.widen,
|
|
17278
17361
|
...operatorUserId ? { operatorUserId } : {},
|
|
17279
17362
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17280
17363
|
});
|
|
17364
|
+
const [editing, setEditing] = (0, import_react108.useState)(false);
|
|
17365
|
+
const [draft, setDraft] = (0, import_react108.useState)("");
|
|
17366
|
+
const [invalid, setInvalid] = (0, import_react108.useState)(null);
|
|
17367
|
+
const inputRef = (0, import_react108.useRef)(null);
|
|
17368
|
+
const pencilRef = (0, import_react108.useRef)(null);
|
|
17369
|
+
const noteId = (0, import_react108.useId)();
|
|
17370
|
+
const customId = (0, import_react108.useId)();
|
|
17371
|
+
(0, import_react108.useEffect)(() => {
|
|
17372
|
+
if (editing) inputRef.current?.focus();
|
|
17373
|
+
}, [editing]);
|
|
17374
|
+
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
17375
|
+
(0, import_react108.useEffect)(() => {
|
|
17376
|
+
if (view.legs === 1) {
|
|
17377
|
+
setEditing(false);
|
|
17378
|
+
setDraft("");
|
|
17379
|
+
setInvalid(null);
|
|
17380
|
+
}
|
|
17381
|
+
}, [view.legs]);
|
|
17382
|
+
const openCustom = () => {
|
|
17383
|
+
setDraft(view.custom ? customLabel(view.custom) : "");
|
|
17384
|
+
setInvalid(null);
|
|
17385
|
+
setEditing(true);
|
|
17386
|
+
};
|
|
17387
|
+
const closeCustom = () => {
|
|
17388
|
+
setEditing(false);
|
|
17389
|
+
pencilRef.current?.focus();
|
|
17390
|
+
};
|
|
17281
17391
|
const [first] = (0, import_react108.useState)(() => requestFor(view));
|
|
17282
17392
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
17283
17393
|
const lastRequest = (0, import_react108.useRef)(first);
|
|
@@ -17299,6 +17409,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17299
17409
|
commit(next, false);
|
|
17300
17410
|
send(requestFor(next));
|
|
17301
17411
|
};
|
|
17412
|
+
const setCustom = () => {
|
|
17413
|
+
const parsed = parseCustomTotal(draft, oddsFormat);
|
|
17414
|
+
if ("error" in parsed) {
|
|
17415
|
+
setInvalid(parsed.error);
|
|
17416
|
+
return;
|
|
17417
|
+
}
|
|
17418
|
+
closeCustom();
|
|
17419
|
+
setInvalid(null);
|
|
17420
|
+
const custom = { decimal: parsed.decimal, text: parsed.text, format: oddsFormat };
|
|
17421
|
+
if (view.custom?.decimal === parsed.decimal) commit({ ...view, custom }, widenedNote);
|
|
17422
|
+
else ask({ ...view, custom });
|
|
17423
|
+
};
|
|
17302
17424
|
const allGames = gamesOptions?.find((o) => o.matchIds.length === 0) ?? null;
|
|
17303
17425
|
const pickGames = (option) => {
|
|
17304
17426
|
const next = { ...view, gamesId: option.id, matchIds: option.matchIds, widen: option.matchIds.length === 0 };
|
|
@@ -17332,7 +17454,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17332
17454
|
const singles = view.legs === 1;
|
|
17333
17455
|
const onOpeningChoice = view.marketKey === openingView.marketKey && view.widen === openingView.widen && view.gamesId === openingView.gamesId && sameIds(view.matchIds, openingView.matchIds);
|
|
17334
17456
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
17335
|
-
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
17457
|
+
const combo = ready && grid.total !== null ? { sport, totalChosen: view.custom ? "custom" : view.total, totalActual: grid.total } : void 0;
|
|
17336
17458
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
17337
17459
|
(0, import_react108.useEffect)(() => {
|
|
17338
17460
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
@@ -17414,19 +17536,72 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17414
17536
|
] }),
|
|
17415
17537
|
view.legs > 1 ? /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "ss-w-v8-builder-ln ss-w-v8-builder-ln--total", children: [
|
|
17416
17538
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("span", { className: "ss-w-v8-builder-w", children: ui.v8BuilderTotal }),
|
|
17417
|
-
/* @__PURE__ */ (0, import_jsx_runtime141.
|
|
17418
|
-
|
|
17419
|
-
|
|
17420
|
-
|
|
17421
|
-
|
|
17422
|
-
|
|
17423
|
-
|
|
17424
|
-
|
|
17539
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "ss-w-v8-builder-btns", role: "group", "aria-label": ui.v8BuilderTotal, children: [
|
|
17540
|
+
totals.map((t) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
17541
|
+
"button",
|
|
17542
|
+
{
|
|
17543
|
+
type: "button",
|
|
17544
|
+
className: "ss-w-v8-builder-btn",
|
|
17545
|
+
"aria-pressed": view.custom === null && view.total === t,
|
|
17546
|
+
onClick: () => {
|
|
17547
|
+
if (view.total !== t || view.custom) {
|
|
17548
|
+
setEditing(false);
|
|
17549
|
+
ask({ ...view, total: t, custom: null });
|
|
17550
|
+
}
|
|
17551
|
+
},
|
|
17552
|
+
children: totalLabel(t, preset.totalOptions, oddsFormat, ui)
|
|
17425
17553
|
},
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
|
|
17554
|
+
t
|
|
17555
|
+
)),
|
|
17556
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
17557
|
+
"button",
|
|
17558
|
+
{
|
|
17559
|
+
ref: pencilRef,
|
|
17560
|
+
type: "button",
|
|
17561
|
+
className: "ss-w-v8-builder-btn",
|
|
17562
|
+
"data-custom": true,
|
|
17563
|
+
"aria-pressed": view.custom !== null,
|
|
17564
|
+
"aria-expanded": editing,
|
|
17565
|
+
"aria-controls": editing ? customId : void 0,
|
|
17566
|
+
"aria-label": view.custom ? ui.v8BuilderCustomEdit(customLabel(view.custom)) : ui.v8BuilderCustomLabel,
|
|
17567
|
+
onClick: () => editing ? closeCustom() : openCustom(),
|
|
17568
|
+
children: view.custom ? customLabel(view.custom) : /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(PencilIcon, {})
|
|
17569
|
+
}
|
|
17570
|
+
)
|
|
17571
|
+
] }),
|
|
17572
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { id: customId, className: "ss-w-v8-builder-custom", children: [
|
|
17573
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
17574
|
+
"input",
|
|
17575
|
+
{
|
|
17576
|
+
ref: inputRef,
|
|
17577
|
+
className: "ss-w-v8-builder-input",
|
|
17578
|
+
type: "text",
|
|
17579
|
+
inputMode: oddsFormat === "decimal" ? "decimal" : "text",
|
|
17580
|
+
maxLength: 12,
|
|
17581
|
+
value: draft,
|
|
17582
|
+
placeholder: ui.v8BuilderCustomPlaceholder(CUSTOM_TOTAL_EXAMPLE[oddsFormat]),
|
|
17583
|
+
"aria-label": ui.v8BuilderCustomLabel,
|
|
17584
|
+
"aria-invalid": invalid !== null,
|
|
17585
|
+
"aria-describedby": invalid ? noteId : void 0,
|
|
17586
|
+
onChange: (e) => {
|
|
17587
|
+
setDraft(e.target.value);
|
|
17588
|
+
setInvalid(null);
|
|
17589
|
+
},
|
|
17590
|
+
onKeyDown: (e) => {
|
|
17591
|
+
if (e.key === "Enter") {
|
|
17592
|
+
e.preventDefault();
|
|
17593
|
+
setCustom();
|
|
17594
|
+
} else if (e.key === "Escape") {
|
|
17595
|
+
e.preventDefault();
|
|
17596
|
+
e.stopPropagation();
|
|
17597
|
+
closeCustom();
|
|
17598
|
+
}
|
|
17599
|
+
}
|
|
17600
|
+
}
|
|
17601
|
+
),
|
|
17602
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("button", { type: "button", className: "ss-w-v8-builder-btn", onClick: setCustom, children: ui.v8BuilderCustomSet }),
|
|
17603
|
+
invalid ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { id: noteId, className: "ss-w-v8-builder-note", "data-kind": `custom-${invalid}`, role: "alert", children: invalid === "range" ? ui.v8BuilderCustomRange : ui.v8BuilderCustomUnreadable(CUSTOM_TOTAL_EXAMPLE[oddsFormat]) }) : null
|
|
17604
|
+
] }) : null
|
|
17430
17605
|
] }) : null,
|
|
17431
17606
|
ready && singles && widenedNote && !empty2 ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "widened", children: ui.v8SinglesWidened(marketName) }) : null,
|
|
17432
17607
|
ready && !widenedNote && !empty2 && preset.widenedForMarket === true && onOpeningChoice && view.marketKey !== null ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "ss-w-v8-builder-note", children: ui.v8Widened }) : null,
|
|
@@ -17458,6 +17633,12 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17458
17633
|
] }) : null
|
|
17459
17634
|
] }) : null });
|
|
17460
17635
|
}
|
|
17636
|
+
function PencilIcon() {
|
|
17637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: [
|
|
17638
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("path", { d: "M12 20h9" }),
|
|
17639
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("path", { d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
17640
|
+
] });
|
|
17641
|
+
}
|
|
17461
17642
|
function GamesOptions({ options, ui }) {
|
|
17462
17643
|
const top = options.filter((o) => o.group !== "league" && o.group !== "game");
|
|
17463
17644
|
const leagues = options.filter((o) => o.group === "league");
|
|
@@ -19710,6 +19891,13 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
19710
19891
|
.ss-w-tabs[data-tight="5"] .ss-w-tab { font-size: 11px; }
|
|
19711
19892
|
.ss-w-tabs[data-tight="6"] .ss-w-tab { font-size: 11px; padding-left: 2px; padding-right: 2px; gap: 3px; letter-spacing: -.01em; }
|
|
19712
19893
|
.ss-w-tabs[data-tight="6"] .ss-w-tab-count { padding-left: 3px; padding-right: 3px; }
|
|
19894
|
+
.ss-w-tabs[data-tight="7"], .ss-w-tabs[data-scroll] { gap: 0; }
|
|
19895
|
+
.ss-w-tabs[data-tight="7"] .ss-w-tab { font-size: 11px; padding-left: 2px; padding-right: 2px; gap: 3px; letter-spacing: -.01em; }
|
|
19896
|
+
.ss-w-tabs[data-tight="7"] .ss-w-tab-count { background: none; padding: 0; min-width: 0; }
|
|
19897
|
+
.ss-w-tabs[data-scroll] { overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 16px 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent); }
|
|
19898
|
+
.ss-w-tabs[data-scroll]::-webkit-scrollbar { display: none; }
|
|
19899
|
+
/* A flex item, not padding: WebKit leaves a flex scroller's end padding out of the scroll range, so the fade would cover the last tab. */
|
|
19900
|
+
.ss-w-tabs[data-scroll]::after { content: ''; flex: 0 0 24px; }
|
|
19713
19901
|
.ss-w-tab-count { font-size: 10.5px; font-weight: 700; color: var(--ss-w-faint); background: var(--ss-w-bubble); border-radius: 999px; padding: 1px 6px; }
|
|
19714
19902
|
.ss-w-tab[data-on] .ss-w-tab-count { color: var(--ss-w-accent); }
|
|
19715
19903
|
/* The dot sits on the tab's corner and takes no width: a poll landing late must not push the last tab out of a strip that already fits to the pixel */
|
|
@@ -20086,9 +20274,18 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20086
20274
|
.ss-w-v8-builder-btn:disabled:not([aria-pressed="true"]) { opacity: .55; }
|
|
20087
20275
|
.ss-w-v8-builder-btn[data-suggested]:not([aria-pressed="true"]) { border-style: dashed; border-color: var(--ss-v8-mint); }
|
|
20088
20276
|
.ss-w-v8-builder button:focus-visible { outline: 2px solid var(--ss-v8-mint); outline-offset: 1px; }
|
|
20089
|
-
.ss-w-v8-builder-ln--total > .ss-w-v8-builder-btns { display: grid; grid-template-columns:
|
|
20090
|
-
.ss-w-v8-builder-ln--total .ss-w-v8-builder-btn { min-width: 0; padding: 4px 2px; font-size: 13.5px; }
|
|
20091
|
-
.ss-w-v8-builder-ln--total .ss-w-v8-builder-btn:first-child { padding: 4px 9px; }
|
|
20277
|
+
.ss-w-v8-builder-ln--total > .ss-w-v8-builder-btns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
20278
|
+
.ss-w-v8-builder-ln--total .ss-w-v8-builder-btn { min-width: 0; padding: 4px 2px; font-size: 13.5px; overflow-wrap: normal; }
|
|
20279
|
+
.ss-w-v8-builder-ln--total .ss-w-v8-builder-btn:first-child { padding: 4px 9px; grid-column: span 2; }
|
|
20280
|
+
.ss-w-v8-builder-btn[data-custom] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
20281
|
+
.ss-w-v8-builder-btn[data-custom] svg { width: 16px; height: 16px; vertical-align: middle; }
|
|
20282
|
+
.ss-w-v8-builder-custom { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; box-sizing: border-box; padding-left: 84px; }
|
|
20283
|
+
.ss-w-v8-builder-input { flex: 1 1 0; min-width: 0; box-sizing: border-box; height: 40px; margin: 0; padding: 8px 10px; border: 1px solid var(--ss-v8-chip-line); border-radius: 10px; background: var(--ss-v8-chip); color: #fff; font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; }
|
|
20284
|
+
.ss-w-v8-builder-input::placeholder { color: color-mix(in srgb, #fff 78%, var(--ss-w-nav)); opacity: 1; }
|
|
20285
|
+
.ss-w-v8-builder-custom > .ss-w-v8-builder-btn { flex: 0 0 auto; min-height: 40px; padding: 6px 14px; }
|
|
20286
|
+
.ss-w-v8-builder-input:focus-visible { outline: 2px solid var(--ss-v8-mint); outline-offset: 1px; }
|
|
20287
|
+
.ss-w-v8-builder-input[aria-invalid="true"] { border-color: #f2b8b5; }
|
|
20288
|
+
.ss-w-v8-builder-custom > .ss-w-v8-builder-note { flex: 1 1 100%; }
|
|
20092
20289
|
.ss-w-v8-builder > .ss-w-v8-builder-btn { align-self: flex-start; min-height: 40px; padding: 6px 14px; }
|
|
20093
20290
|
.ss-w-v8-builder .ss-w-slip-btn { min-height: 36px; }
|
|
20094
20291
|
.ss-w-v8-builder .ss-w-combo-addall .ss-w-slip-btn { min-height: 44px; }
|
|
@@ -20103,10 +20300,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20103
20300
|
}
|
|
20104
20301
|
@container (max-width: 400px) {
|
|
20105
20302
|
.ss-w-v8-builder-ln--total .ss-w-v8-builder-w { flex-basis: 100%; }
|
|
20106
|
-
}
|
|
20107
|
-
/* Stacked, six targets still split "10.00" below this: three to a row, two rows. */
|
|
20108
|
-
@container (max-width: 360px) {
|
|
20109
|
-
.ss-w-v8-builder-ln--total > .ss-w-v8-builder-btns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
20303
|
+
.ss-w-v8-builder-custom { padding-left: 0; }
|
|
20110
20304
|
}
|
|
20111
20305
|
|
|
20112
20306
|
@media (prefers-reduced-motion: reduce) {
|