@sensiblestats/widget-react 0.5.0 → 0.6.1
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 +26 -0
- package/dist/index.cjs +11 -4
- 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 +11 -4
- 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,31 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Stop rendering generic entity cards. Any entity that isn't a team or a player
|
|
8
|
+
(coach, referee, stadium, competition) previously fell through to a low-value
|
|
9
|
+
"generic" card with no identity signal; those are now dropped at the reducer so
|
|
10
|
+
only team and player cards render. The generic rendering path is left intact so
|
|
11
|
+
a purpose-built variant can re-enable it later. widget-embed re-bundles
|
|
12
|
+
widget-react, so it must be republished too.
|
|
13
|
+
|
|
14
|
+
## 0.6.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Show competition name on betting insight cards. This shipped to master in
|
|
19
|
+
`6d629e6b` but never reached npm because the version wasn't bumped, so the
|
|
20
|
+
release workflow's `--tolerate-republish` skipped every package. This changeset
|
|
21
|
+
bumps all three so the change actually publishes (widget-embed re-bundles
|
|
22
|
+
widget-react, so it must be republished too).
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @sensiblestats/widget-sdk@0.5.0
|
|
28
|
+
|
|
3
29
|
## 0.5.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -184,6 +184,7 @@ function toInsightVM(insight) {
|
|
|
184
184
|
const home = str(insight.homeTeamName);
|
|
185
185
|
const away = str(insight.awayTeamName);
|
|
186
186
|
const fixture = home && away ? `${home} vs ${away}` : void 0;
|
|
187
|
+
const competition = str(insight.competitionName);
|
|
187
188
|
const scopes = Array.isArray(insight.scopes) ? insight.scopes.map((s) => ({ key: str(s.key), label: str(s.label), stats: readStatCells(s.stats) })).filter((s) => !!s.key && !!s.label) : void 0;
|
|
188
189
|
return {
|
|
189
190
|
id: str(insight.insightId) ?? `${str(insight.ruleId) ?? "insight"}:${num(insight.matchId) ?? ""}`,
|
|
@@ -195,6 +196,7 @@ function toInsightVM(insight) {
|
|
|
195
196
|
isLive: insight.odds?.isLive === true,
|
|
196
197
|
phase: str(insight.phase),
|
|
197
198
|
fixture,
|
|
199
|
+
competition,
|
|
198
200
|
scopes,
|
|
199
201
|
text: str(insight.text) ?? "",
|
|
200
202
|
stats: readStatCells(insight.stats),
|
|
@@ -222,9 +224,12 @@ function applyEvent(state, event) {
|
|
|
222
224
|
return { ...state, status: event.data.message };
|
|
223
225
|
case "answer":
|
|
224
226
|
return { ...state, messages: mapActive(state, (t) => ({ ...t, text: event.data.text })) };
|
|
225
|
-
case "entity_card":
|
|
227
|
+
case "entity_card": {
|
|
226
228
|
if (event.data.card.isUsed === false) return state;
|
|
227
|
-
|
|
229
|
+
const card = toCardVM(event.data.card);
|
|
230
|
+
if (card.kind === "generic") return state;
|
|
231
|
+
return { ...state, messages: mapActive(state, (t) => ({ ...t, cards: [...t.cards, card] })) };
|
|
232
|
+
}
|
|
228
233
|
case "action_button":
|
|
229
234
|
return { ...state, actionsLoading: false, messages: mapActive(state, (t) => ({ ...t, actions: [...t.actions, toActionVM(event.data.action)] })) };
|
|
230
235
|
case "betting_insight":
|
|
@@ -476,12 +481,13 @@ function ScopedStats({ scopes, ui }) {
|
|
|
476
481
|
function InsightCard({ it, ui }) {
|
|
477
482
|
const live = it.isLive || it.phase === "live";
|
|
478
483
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ss-w-binsight", children: [
|
|
479
|
-
live || it.fixture ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ss-w-bi-status", children: [
|
|
484
|
+
live || it.fixture || it.competition ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ss-w-bi-status", children: [
|
|
480
485
|
live ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ss-w-bi-live", children: [
|
|
481
486
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-bi-live-dot", "aria-hidden": "true" }),
|
|
482
487
|
ui?.liveLabel ?? "Live"
|
|
483
488
|
] }) : null,
|
|
484
|
-
it.fixture ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-bi-fixture", children: it.fixture }) : null
|
|
489
|
+
it.fixture ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-bi-fixture", children: it.fixture }) : null,
|
|
490
|
+
it.competition ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ss-w-bi-comp", children: it.competition }) : null
|
|
485
491
|
] }) : null,
|
|
486
492
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "ss-w-bi-head", children: [
|
|
487
493
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ss-w-bi-mkt", children: [
|
|
@@ -744,6 +750,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
744
750
|
.ss-w-binsight { background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; border-left: 3px solid var(--ss-w-accent); padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
|
|
745
751
|
.ss-w-bi-status { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
746
752
|
.ss-w-bi-fixture { font-size: 11px; color: var(--ss-w-ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
753
|
+
.ss-w-bi-comp { font-size: 10.5px; color: var(--ss-w-faint); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
747
754
|
.ss-w-bi-live { font-size: 8.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: #c0392b; border-radius: 4px; padding: 1px 5px; display: inline-flex; align-items: center; gap: 4px; flex: none; }
|
|
748
755
|
.ss-w-bi-live-dot { width: 5px; height: 5px; border-radius: 50%; background: #fff; }
|
|
749
756
|
.ss-w-bi-head { display: flex; align-items: flex-start; gap: 10px; }
|