@sensiblestats/widget-react 0.71.0 → 0.72.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 +18 -0
- package/dist/index.cjs +30 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1102,7 +1102,8 @@ function toComboLegVM(leg) {
|
|
|
1102
1102
|
const insight = leg.insight && typeof leg.insight === "object" ? leg.insight : void 0;
|
|
1103
1103
|
const insightId = str(insight?.insightId);
|
|
1104
1104
|
const statText = str(insight?.text);
|
|
1105
|
-
|
|
1105
|
+
const hasStat = !!insightId && !!statText;
|
|
1106
|
+
if (price === void 0 || matchOddsId === void 0 || matchId === void 0 || !home || !away || !selectionLabel) return null;
|
|
1106
1107
|
const line = str(leg.line);
|
|
1107
1108
|
return {
|
|
1108
1109
|
key: `${matchOddsId}`,
|
|
@@ -1123,8 +1124,7 @@ function toComboLegVM(leg) {
|
|
|
1123
1124
|
oddsDecimal: price,
|
|
1124
1125
|
matchOddsId,
|
|
1125
1126
|
quotedAtUtc: str(leg.quotedAtUtc),
|
|
1126
|
-
insightId,
|
|
1127
|
-
statText,
|
|
1127
|
+
...hasStat ? { insightId, statText } : {},
|
|
1128
1128
|
pinEnabled: leg.pinEnabled === true
|
|
1129
1129
|
};
|
|
1130
1130
|
}
|
|
@@ -1152,9 +1152,9 @@ function comboLegToSlipSelection(leg, conversationId) {
|
|
|
1152
1152
|
const selection = {
|
|
1153
1153
|
matchOddsId: leg.matchOddsId,
|
|
1154
1154
|
matchId: leg.matchId,
|
|
1155
|
-
oddsDecimal: leg.oddsDecimal
|
|
1156
|
-
insightId: leg.insightId
|
|
1155
|
+
oddsDecimal: leg.oddsDecimal
|
|
1157
1156
|
};
|
|
1157
|
+
if (leg.insightId !== void 0) selection.insightId = leg.insightId;
|
|
1158
1158
|
if (leg.quotedAtUtc !== void 0) selection.quotedAtUtc = leg.quotedAtUtc;
|
|
1159
1159
|
if (conversationId !== void 0) selection.conversationId = conversationId;
|
|
1160
1160
|
return selection;
|
|
@@ -1373,7 +1373,7 @@ function ChatHeader({
|
|
|
1373
1373
|
import { useEffect as useEffect7, useRef as useRef4 } from "react";
|
|
1374
1374
|
|
|
1375
1375
|
// src/presets.ts
|
|
1376
|
-
var CLIENT_CAPABILITIES = ["price_presets"];
|
|
1376
|
+
var CLIENT_CAPABILITIES = ["price_presets", "price_presets_open"];
|
|
1377
1377
|
var PRICE_TILE_PREFIX = "goal-preset-";
|
|
1378
1378
|
function isPriceTile(tile) {
|
|
1379
1379
|
const id = tile.signal?.entityId;
|
|
@@ -2086,7 +2086,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor }) {
|
|
|
2086
2086
|
}
|
|
2087
2087
|
)
|
|
2088
2088
|
] }),
|
|
2089
|
-
/* @__PURE__ */ jsx14("p", { className: "ss-w-combo-leg-stat", children: leg.statText })
|
|
2089
|
+
leg.statText ? /* @__PURE__ */ jsx14("p", { className: "ss-w-combo-leg-stat", children: leg.statText }) : null
|
|
2090
2090
|
] });
|
|
2091
2091
|
}
|
|
2092
2092
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
@@ -7066,6 +7066,20 @@ function findCombo(grid, total, legs) {
|
|
|
7066
7066
|
const whole = !!combo && typeof combo.multiplication === "string" && combo.multiplication !== "" && Array.isArray(combo.legs) && combo.legs.length === legs && combo.legs.every(drawable);
|
|
7067
7067
|
return cell && whole ? cell : null;
|
|
7068
7068
|
}
|
|
7069
|
+
function legsForTotal(grid, total, legs) {
|
|
7070
|
+
if (findCombo(grid, total, legs)) return legs;
|
|
7071
|
+
let best = legs;
|
|
7072
|
+
let bestGap = Infinity;
|
|
7073
|
+
for (const n of comboLegChoices(grid)) {
|
|
7074
|
+
if (!findCombo(grid, total, n)) continue;
|
|
7075
|
+
const gap = Math.abs(n - legs);
|
|
7076
|
+
if (gap < bestGap) {
|
|
7077
|
+
best = n;
|
|
7078
|
+
bestGap = gap;
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
return best;
|
|
7082
|
+
}
|
|
7069
7083
|
function idsOf(picks) {
|
|
7070
7084
|
return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
|
|
7071
7085
|
}
|
|
@@ -7209,8 +7223,10 @@ function SetNumbersTool({ grid, strings, streaming, formatKickoff, onSend, onClo
|
|
|
7209
7223
|
};
|
|
7210
7224
|
const nextTotal = () => {
|
|
7211
7225
|
const v = cycle(totals, total);
|
|
7226
|
+
const l = legsForTotal(grid, v, legs);
|
|
7212
7227
|
setTotal(v);
|
|
7213
|
-
|
|
7228
|
+
setLegs(l);
|
|
7229
|
+
announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
|
|
7214
7230
|
};
|
|
7215
7231
|
return /* @__PURE__ */ jsxs73(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
7216
7232
|
/* @__PURE__ */ jsxs73("section", { className: "ss-w-tool-row", children: [
|
|
@@ -7250,7 +7266,10 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
7250
7266
|
const totals = comboTotals(grid);
|
|
7251
7267
|
const legChoices = comboLegChoices(grid);
|
|
7252
7268
|
const [total, setTotal] = useState33(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : startValue(totals, START.comboTotal));
|
|
7253
|
-
const [legs, setLegs] = useState33(() =>
|
|
7269
|
+
const [legs, setLegs] = useState33(() => {
|
|
7270
|
+
const start = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
7271
|
+
return initialTotal !== void 0 ? legsForTotal(grid, nearest(totals, initialTotal), start) : start;
|
|
7272
|
+
});
|
|
7254
7273
|
const [announcement, setAnnouncement] = useState33("");
|
|
7255
7274
|
const cell = findCombo(grid, total, legs);
|
|
7256
7275
|
const minLegs = legChoices[0] ?? legs;
|
|
@@ -7268,7 +7287,7 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
7268
7287
|
return /* @__PURE__ */ jsxs73(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
|
|
7269
7288
|
/* @__PURE__ */ jsxs73("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
|
|
7270
7289
|
/* @__PURE__ */ jsx89("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
|
|
7271
|
-
/* @__PURE__ */ jsx89("div", { className: "ss-w-tool-chips", children: totals.map((t) => /* @__PURE__ */ jsx89("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(t, total), onClick: () => choose(t, legs), children: t.toFixed(1) }, t)) })
|
|
7290
|
+
/* @__PURE__ */ jsx89("div", { className: "ss-w-tool-chips", children: totals.map((t) => /* @__PURE__ */ jsx89("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(t, total), onClick: () => choose(t, samePrice(t, total) ? legs : legsForTotal(grid, t, legs)), children: t.toFixed(1) }, t)) })
|
|
7272
7291
|
] }),
|
|
7273
7292
|
/* @__PURE__ */ jsxs73("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
|
|
7274
7293
|
/* @__PURE__ */ jsx89("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
|
|
@@ -10872,7 +10891,7 @@ function StatsWidget(props) {
|
|
|
10872
10891
|
const gamesResult = useGames(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
10873
10892
|
const leaderboardResult = useLeaderboard(built?.conversation ?? null, { activeTab: monitor.activeTab });
|
|
10874
10893
|
const getPricePresets = useCallback14(
|
|
10875
|
-
(locale2) => built ? built.conversation.getPricePresets(locale2) : Promise.resolve(null),
|
|
10894
|
+
(locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
|
|
10876
10895
|
[built]
|
|
10877
10896
|
);
|
|
10878
10897
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|