@sensiblestats/widget-react 0.163.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 +22 -0
- package/dist/index.cjs +61 -35
- 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 +61 -35
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.165.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Live facts carry Market Moments: the `moment` fact kind with `progressCount` and `progressLine`. The fact block leads with up to two moments, each with its own chip and never in Earlier, and shows a history line only when the server sends one.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sensiblestats/widget-sdk@0.121.0
|
|
13
|
+
|
|
14
|
+
## 0.164.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Send the visitor ids with the live monitor request, as headers.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @sensiblestats/widget-sdk@0.120.0
|
|
24
|
+
|
|
3
25
|
## 0.163.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
1424
|
// src/version.generated.ts
|
|
1425
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1425
|
+
var WIDGET_REACT_VERSION = "0.165.0";
|
|
1426
1426
|
|
|
1427
1427
|
// src/config.ts
|
|
1428
1428
|
var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
|
|
@@ -7487,14 +7487,64 @@ function evidenceText(f, ui) {
|
|
|
7487
7487
|
if (e.since) parts2.push(ui.liveFactSince(e.since));
|
|
7488
7488
|
return parts2.length > 0 ? parts2.join(" \xB7 ") : void 0;
|
|
7489
7489
|
}
|
|
7490
|
+
function secondLine(f, ui) {
|
|
7491
|
+
if (f.kind === "moment") return f.evidence && f.basis ? f.basis : void 0;
|
|
7492
|
+
return evidenceText(f, ui) ?? f.basis;
|
|
7493
|
+
}
|
|
7494
|
+
function Lead({ fact, match, ui, slip, sport, scope }) {
|
|
7495
|
+
const { oddsFormat } = useOddsSettings();
|
|
7496
|
+
const m = fact.market;
|
|
7497
|
+
const open = fact.marketState === "open" && !!m && !m.isSuspended;
|
|
7498
|
+
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
7499
|
+
const kickoff = fact.kickoffPrice != null && fact.kickoffPriceFormats ? ui.liveFactKickoff(formatOdds(fact.kickoffPriceFormats, oddsFormat)) : void 0;
|
|
7500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7501
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ss-w-fact-text", children: fact.text }),
|
|
7502
|
+
secondLine(fact, ui) !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-fact-basis", children: secondLine(fact, ui) }),
|
|
7503
|
+
m && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-mkt", children: [
|
|
7504
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-mkt-row", children: [
|
|
7505
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
7506
|
+
m.marketLabel,
|
|
7507
|
+
" \xB7 ",
|
|
7508
|
+
chipSelectionText(m)
|
|
7509
|
+
] }),
|
|
7510
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7511
|
+
SlipButton,
|
|
7512
|
+
{
|
|
7513
|
+
selection: slipOpenFor(slip, sport) ? chipSelection(m, match, slip.conversationId, scope) : null,
|
|
7514
|
+
marketDeveloperName: m.marketDeveloperName,
|
|
7515
|
+
selectionLabel: m.selectionLabel,
|
|
7516
|
+
slip,
|
|
7517
|
+
ui,
|
|
7518
|
+
fact: { id: fact.id, factKey: fact.factKey },
|
|
7519
|
+
price: { ariaLabel: `${chipSelectionText(m)}, ${chipPrice}`, valueClass: "ss-w-fact-price" }
|
|
7520
|
+
}
|
|
7521
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-state", children: fact.marketState === "held" ? ui.liveFactHeld : ui.liveFactSuspended })
|
|
7522
|
+
] }),
|
|
7523
|
+
kickoff && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-fact-kick", children: kickoff })
|
|
7524
|
+
] })
|
|
7525
|
+
] });
|
|
7526
|
+
}
|
|
7527
|
+
function SecondLead({ sportFields, ...p }) {
|
|
7528
|
+
const ref = (0, import_react45.useRef)(null);
|
|
7529
|
+
const m = p.fact.market;
|
|
7530
|
+
const entity2 = m ? { entityType: "market", entityId: (0, import_widget_sdk21.qualifiedId)(p.sport, "market", m.marketDeveloperName), ...sportFields } : { entityType: "match", entityId: (0, import_widget_sdk21.qualifiedId)(p.sport, "game", (0, import_widget_sdk21.localIdOf)(p.sport, p.match.matchId, p.scope?.tour)), ...sportFields };
|
|
7531
|
+
useFactView(ref, p.fact, entity2);
|
|
7532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref, className: "ss-w-fact-lead2", children: [
|
|
7533
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-k", children: [
|
|
7534
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-min", children: p.fact.minuteLabel }),
|
|
7535
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-subj", children: p.fact.subjectLabel })
|
|
7536
|
+
] }),
|
|
7537
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Lead, { ...p })
|
|
7538
|
+
] });
|
|
7539
|
+
}
|
|
7490
7540
|
function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
7491
7541
|
const [expanded, setExpanded] = (0, import_react45.useState)(false);
|
|
7492
|
-
const { oddsFormat } = useOddsSettings();
|
|
7493
7542
|
const log = useEventLog();
|
|
7494
7543
|
const record2 = useRecord();
|
|
7495
7544
|
const sectionRef = (0, import_react45.useRef)(null);
|
|
7496
|
-
const current = facts.find((f) => f.marketState);
|
|
7497
|
-
const
|
|
7545
|
+
const current = facts.find((f) => f.kind === "moment" && f.marketState) ?? facts.find((f) => f.marketState);
|
|
7546
|
+
const secondLead = current?.kind === "moment" ? facts.find((f) => f !== current && f.kind === "moment" && f.marketState && f.market) : void 0;
|
|
7547
|
+
const earlier = facts.filter((f) => f.marketState && f !== current && f !== secondLead);
|
|
7498
7548
|
const background = facts.filter((f) => !f.marketState).slice(0, BACKGROUND_MAX);
|
|
7499
7549
|
const m = current?.market;
|
|
7500
7550
|
const sport = scope?.sport;
|
|
@@ -7503,9 +7553,6 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7503
7553
|
const entity2 = current?.marketState && m ? { entityType: "market", entityId: (0, import_widget_sdk21.qualifiedId)(sport, "market", m.marketDeveloperName), ...sportFields } : { entityType: "match", entityId: (0, import_widget_sdk21.qualifiedId)(sport, "game", (0, import_widget_sdk21.localIdOf)(sport, match.matchId, scope?.tour)), ...sportFields };
|
|
7504
7554
|
useFactView(sectionRef, current, entity2);
|
|
7505
7555
|
if (facts.length === 0) return null;
|
|
7506
|
-
const open = current?.marketState === "open" && !!m && !m.isSuspended;
|
|
7507
|
-
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
7508
|
-
const kickoff = current?.kickoffPrice != null && current.kickoffPriceFormats ? ui.liveFactKickoff(formatOdds(current.kickoffPriceFormats, oddsFormat)) : void 0;
|
|
7509
7556
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SlipSurfaceProvider, { surface: "live_fact", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
7510
7557
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-k", children: [
|
|
7511
7558
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: ui.liveFactLabel }),
|
|
@@ -7516,30 +7563,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7516
7563
|
current && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-subj", children: current.subjectLabel })
|
|
7517
7564
|
] }),
|
|
7518
7565
|
current && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
7519
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7520
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7521
|
-
m && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-mkt", children: [
|
|
7522
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-mkt-row", children: [
|
|
7523
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
7524
|
-
m.marketLabel,
|
|
7525
|
-
" \xB7 ",
|
|
7526
|
-
chipSelectionText(m)
|
|
7527
|
-
] }),
|
|
7528
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7529
|
-
SlipButton,
|
|
7530
|
-
{
|
|
7531
|
-
selection: slipOpenFor(slip, sport) ? chipSelection(m, match, slip.conversationId, scope) : null,
|
|
7532
|
-
marketDeveloperName: m.marketDeveloperName,
|
|
7533
|
-
selectionLabel: m.selectionLabel,
|
|
7534
|
-
slip,
|
|
7535
|
-
ui,
|
|
7536
|
-
fact: { id: current.id, factKey: current.factKey },
|
|
7537
|
-
price: { ariaLabel: `${chipSelectionText(m)}, ${chipPrice}`, valueClass: "ss-w-fact-price" }
|
|
7538
|
-
}
|
|
7539
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-state", children: current.marketState === "held" ? ui.liveFactHeld : ui.liveFactSuspended })
|
|
7540
|
-
] }),
|
|
7541
|
-
kickoff && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-fact-kick", children: kickoff })
|
|
7542
|
-
] })
|
|
7566
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Lead, { fact: current, match, ui, slip, sport, scope }),
|
|
7567
|
+
secondLead && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SecondLead, { fact: secondLead, match, ui, slip, sport, scope, sportFields })
|
|
7543
7568
|
] }),
|
|
7544
7569
|
background.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "ss-w-fact-bg", children: background.map((f) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("li", { children: [
|
|
7545
7570
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-hmin", children: f.minuteLabel }),
|
|
@@ -7549,7 +7574,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk, scope }) {
|
|
|
7549
7574
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-fact-hmin", children: f.minuteLabel }),
|
|
7550
7575
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
7551
7576
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "ss-w-fact-htext", children: f.text }),
|
|
7552
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-fact-basis", children:
|
|
7577
|
+
secondLine(f, ui) !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-fact-basis", children: secondLine(f, ui) })
|
|
7553
7578
|
] })
|
|
7554
7579
|
] }, f.id)) }),
|
|
7555
7580
|
current && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-fact-foot", children: [
|
|
@@ -22707,6 +22732,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
22707
22732
|
.ss-w-fact-subj { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 650; color: var(--ss-w-faint); }
|
|
22708
22733
|
.ss-w-fact-text { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ss-w-ink); }
|
|
22709
22734
|
.ss-w-fact-basis { font-size: 10.5px; color: var(--ss-w-faint); }
|
|
22735
|
+
.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); }
|
|
22710
22736
|
.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; }
|
|
22711
22737
|
.ss-w-fact-mkt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
22712
22738
|
.ss-w-fact-mkt-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|
|
@@ -23763,8 +23789,10 @@ function StatsWidgetBody(props) {
|
|
|
23763
23789
|
}, [controller.state.messages]);
|
|
23764
23790
|
const requestTag = hostTag(cfg);
|
|
23765
23791
|
const clubFixturesResult = useClubFixtures(built?.conversation ?? null);
|
|
23792
|
+
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
23793
|
+
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
23766
23794
|
const monitor = useLiveMonitor({
|
|
23767
|
-
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins, requestTag) : Promise.resolve(null),
|
|
23795
|
+
getLiveMonitor: (pins) => built ? built.conversation.getLiveMonitor(pins, requestTag, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
23768
23796
|
getMarketOdds: (matchId, dev, sport) => built ? built.conversation.getMarketOdds(matchId, dev, sport) : Promise.resolve(null),
|
|
23769
23797
|
getPlayerProps: (matchId, sport) => built ? built.conversation.getPlayerProps(matchId, sport, requestTag) : Promise.resolve(null),
|
|
23770
23798
|
storageKey: `ss-w-pins:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`,
|
|
@@ -23773,8 +23801,6 @@ function StatsWidgetBody(props) {
|
|
|
23773
23801
|
clubEnabled: clubFixturesResult.enabled,
|
|
23774
23802
|
record: record2
|
|
23775
23803
|
});
|
|
23776
|
-
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
23777
|
-
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
23778
23804
|
const getSchedule = (0, import_react131.useCallback)(
|
|
23779
23805
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
23780
23806
|
[built, operatorUserId, anonymousUserId]
|