@sensiblestats/widget-react 0.164.0 → 0.165.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 +58 -32
- 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 +58 -32
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1383,7 +1383,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
1385
|
// src/version.generated.ts
|
|
1386
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1386
|
+
var WIDGET_REACT_VERSION = "0.165.0";
|
|
1387
1387
|
|
|
1388
1388
|
// src/config.ts
|
|
1389
1389
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -7448,14 +7448,64 @@ function evidenceText(f, ui) {
|
|
|
7448
7448
|
if (e.since) parts2.push(ui.liveFactSince(e.since));
|
|
7449
7449
|
return parts2.length > 0 ? parts2.join(" \xB7 ") : void 0;
|
|
7450
7450
|
}
|
|
7451
|
+
function secondLine(f, ui) {
|
|
7452
|
+
if (f.kind === "moment") return f.evidence && f.basis ? f.basis : void 0;
|
|
7453
|
+
return evidenceText(f, ui) ?? f.basis;
|
|
7454
|
+
}
|
|
7455
|
+
function Lead({ fact, match, ui, slip, sport, scope }) {
|
|
7456
|
+
const { oddsFormat } = useOddsSettings();
|
|
7457
|
+
const m = fact.market;
|
|
7458
|
+
const open = fact.marketState === "open" && !!m && !m.isSuspended;
|
|
7459
|
+
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
7460
|
+
const kickoff = fact.kickoffPrice != null && fact.kickoffPriceFormats ? ui.liveFactKickoff(formatOdds(fact.kickoffPriceFormats, oddsFormat)) : void 0;
|
|
7461
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
7462
|
+
/* @__PURE__ */ jsx19("p", { className: "ss-w-fact-text", children: fact.text }),
|
|
7463
|
+
secondLine(fact, ui) !== void 0 && /* @__PURE__ */ jsx19("div", { className: "ss-w-fact-basis", children: secondLine(fact, ui) }),
|
|
7464
|
+
m && /* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-mkt", children: [
|
|
7465
|
+
/* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-mkt-row", children: [
|
|
7466
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
7467
|
+
m.marketLabel,
|
|
7468
|
+
" \xB7 ",
|
|
7469
|
+
chipSelectionText(m)
|
|
7470
|
+
] }),
|
|
7471
|
+
open ? /* @__PURE__ */ jsx19(
|
|
7472
|
+
SlipButton,
|
|
7473
|
+
{
|
|
7474
|
+
selection: slipOpenFor(slip, sport) ? chipSelection(m, match, slip.conversationId, scope) : null,
|
|
7475
|
+
marketDeveloperName: m.marketDeveloperName,
|
|
7476
|
+
selectionLabel: m.selectionLabel,
|
|
7477
|
+
slip,
|
|
7478
|
+
ui,
|
|
7479
|
+
fact: { id: fact.id, factKey: fact.factKey },
|
|
7480
|
+
price: { ariaLabel: `${chipSelectionText(m)}, ${chipPrice}`, valueClass: "ss-w-fact-price" }
|
|
7481
|
+
}
|
|
7482
|
+
) : /* @__PURE__ */ jsx19("span", { className: "ss-w-fact-state", children: fact.marketState === "held" ? ui.liveFactHeld : ui.liveFactSuspended })
|
|
7483
|
+
] }),
|
|
7484
|
+
kickoff && /* @__PURE__ */ jsx19("div", { className: "ss-w-fact-kick", children: kickoff })
|
|
7485
|
+
] })
|
|
7486
|
+
] });
|
|
7487
|
+
}
|
|
7488
|
+
function SecondLead({ sportFields, ...p }) {
|
|
7489
|
+
const ref = useRef24(null);
|
|
7490
|
+
const m = p.fact.market;
|
|
7491
|
+
const entity2 = m ? { entityType: "market", entityId: qualifiedId2(p.sport, "market", m.marketDeveloperName), ...sportFields } : { entityType: "match", entityId: qualifiedId2(p.sport, "game", localIdOf4(p.sport, p.match.matchId, p.scope?.tour)), ...sportFields };
|
|
7492
|
+
useFactView(ref, p.fact, entity2);
|
|
7493
|
+
return /* @__PURE__ */ jsxs15("div", { ref, className: "ss-w-fact-lead2", children: [
|
|
7494
|
+
/* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-k", children: [
|
|
7495
|
+
/* @__PURE__ */ jsx19("span", { className: "ss-w-fact-min", children: p.fact.minuteLabel }),
|
|
7496
|
+
/* @__PURE__ */ jsx19("span", { className: "ss-w-fact-subj", children: p.fact.subjectLabel })
|
|
7497
|
+
] }),
|
|
7498
|
+
/* @__PURE__ */ jsx19(Lead, { ...p })
|
|
7499
|
+
] });
|
|
7500
|
+
}
|
|
7451
7501
|
function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
7452
7502
|
const [expanded, setExpanded] = useState28(false);
|
|
7453
|
-
const { oddsFormat } = useOddsSettings();
|
|
7454
7503
|
const log = useEventLog();
|
|
7455
7504
|
const record2 = useRecord();
|
|
7456
7505
|
const sectionRef = useRef24(null);
|
|
7457
|
-
const current = facts.find((f) => f.marketState);
|
|
7458
|
-
const
|
|
7506
|
+
const current = facts.find((f) => f.kind === "moment" && f.marketState) ?? facts.find((f) => f.marketState);
|
|
7507
|
+
const secondLead = current?.kind === "moment" ? facts.find((f) => f !== current && f.kind === "moment" && f.marketState && f.market) : void 0;
|
|
7508
|
+
const earlier = facts.filter((f) => f.marketState && f !== current && f !== secondLead);
|
|
7459
7509
|
const background = facts.filter((f) => !f.marketState).slice(0, BACKGROUND_MAX);
|
|
7460
7510
|
const m = current?.market;
|
|
7461
7511
|
const sport = scope?.sport;
|
|
@@ -7464,9 +7514,6 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7464
7514
|
const entity2 = current?.marketState && m ? { entityType: "market", entityId: qualifiedId2(sport, "market", m.marketDeveloperName), ...sportFields } : { entityType: "match", entityId: qualifiedId2(sport, "game", localIdOf4(sport, match.matchId, scope?.tour)), ...sportFields };
|
|
7465
7515
|
useFactView(sectionRef, current, entity2);
|
|
7466
7516
|
if (facts.length === 0) return null;
|
|
7467
|
-
const open = current?.marketState === "open" && !!m && !m.isSuspended;
|
|
7468
|
-
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
7469
|
-
const kickoff = current?.kickoffPrice != null && current.kickoffPriceFormats ? ui.liveFactKickoff(formatOdds(current.kickoffPriceFormats, oddsFormat)) : void 0;
|
|
7470
7517
|
return /* @__PURE__ */ jsx19(SlipSurfaceProvider, { surface: "live_fact", children: /* @__PURE__ */ jsxs15("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
7471
7518
|
/* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-k", children: [
|
|
7472
7519
|
/* @__PURE__ */ jsx19("span", { children: ui.liveFactLabel }),
|
|
@@ -7477,30 +7524,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7477
7524
|
current && /* @__PURE__ */ jsx19("span", { className: "ss-w-fact-subj", children: current.subjectLabel })
|
|
7478
7525
|
] }),
|
|
7479
7526
|
current && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
7480
|
-
/* @__PURE__ */ jsx19(
|
|
7481
|
-
/* @__PURE__ */ jsx19(
|
|
7482
|
-
m && /* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-mkt", children: [
|
|
7483
|
-
/* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-mkt-row", children: [
|
|
7484
|
-
/* @__PURE__ */ jsxs15("span", { children: [
|
|
7485
|
-
m.marketLabel,
|
|
7486
|
-
" \xB7 ",
|
|
7487
|
-
chipSelectionText(m)
|
|
7488
|
-
] }),
|
|
7489
|
-
open ? /* @__PURE__ */ jsx19(
|
|
7490
|
-
SlipButton,
|
|
7491
|
-
{
|
|
7492
|
-
selection: slipOpenFor(slip, sport) ? chipSelection(m, match, slip.conversationId, scope) : null,
|
|
7493
|
-
marketDeveloperName: m.marketDeveloperName,
|
|
7494
|
-
selectionLabel: m.selectionLabel,
|
|
7495
|
-
slip,
|
|
7496
|
-
ui,
|
|
7497
|
-
fact: { id: current.id, factKey: current.factKey },
|
|
7498
|
-
price: { ariaLabel: `${chipSelectionText(m)}, ${chipPrice}`, valueClass: "ss-w-fact-price" }
|
|
7499
|
-
}
|
|
7500
|
-
) : /* @__PURE__ */ jsx19("span", { className: "ss-w-fact-state", children: current.marketState === "held" ? ui.liveFactHeld : ui.liveFactSuspended })
|
|
7501
|
-
] }),
|
|
7502
|
-
kickoff && /* @__PURE__ */ jsx19("div", { className: "ss-w-fact-kick", children: kickoff })
|
|
7503
|
-
] })
|
|
7527
|
+
/* @__PURE__ */ jsx19(Lead, { fact: current, match, ui, slip, sport, scope }),
|
|
7528
|
+
secondLead && /* @__PURE__ */ jsx19(SecondLead, { fact: secondLead, match, ui, slip, sport, scope, sportFields })
|
|
7504
7529
|
] }),
|
|
7505
7530
|
background.length > 0 && /* @__PURE__ */ jsx19("ul", { className: "ss-w-fact-bg", children: background.map((f) => /* @__PURE__ */ jsxs15("li", { children: [
|
|
7506
7531
|
/* @__PURE__ */ jsx19("span", { className: "ss-w-fact-hmin", children: f.minuteLabel }),
|
|
@@ -7510,7 +7535,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7510
7535
|
/* @__PURE__ */ jsx19("span", { className: "ss-w-fact-hmin", children: f.minuteLabel }),
|
|
7511
7536
|
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7512
7537
|
/* @__PURE__ */ jsx19("p", { className: "ss-w-fact-htext", children: f.text }),
|
|
7513
|
-
/* @__PURE__ */ jsx19("div", { className: "ss-w-fact-basis", children:
|
|
7538
|
+
secondLine(f, ui) !== void 0 && /* @__PURE__ */ jsx19("div", { className: "ss-w-fact-basis", children: secondLine(f, ui) })
|
|
7514
7539
|
] })
|
|
7515
7540
|
] }, f.id)) }),
|
|
7516
7541
|
current && /* @__PURE__ */ jsxs15("div", { className: "ss-w-fact-foot", children: [
|
|
@@ -22668,6 +22693,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
22668
22693
|
.ss-w-fact-subj { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 650; color: var(--ss-w-faint); }
|
|
22669
22694
|
.ss-w-fact-text { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ss-w-ink); }
|
|
22670
22695
|
.ss-w-fact-basis { font-size: 10.5px; color: var(--ss-w-faint); }
|
|
22696
|
+
.ss-w-fact-lead2 { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding-top: 8px; border-top: 1px solid var(--ss-w-line); }
|
|
22671
22697
|
.ss-w-fact-mkt { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; border: 1px solid var(--ss-w-line); border-radius: 8px; padding: 6px 8px; }
|
|
22672
22698
|
.ss-w-fact-mkt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
22673
22699
|
.ss-w-fact-mkt-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|