@sensiblestats/widget-react 0.21.0 → 0.22.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 +53 -360
- 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 +45 -352
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -56
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sensiblestats/widget-react
|
|
2
2
|
|
|
3
|
+
## 0.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Remove club match-day dashboard renderers and SDK types. The server no longer emits the `clubDashboard` block; the corresponding widget renderers, CSS, and SDK type union are stripped in this forward bump.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @sensiblestats/widget-sdk@0.19.0
|
|
13
|
+
|
|
3
14
|
## 0.21.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
|
|
38
38
|
// src/StatsWidget.tsx
|
|
39
|
-
var
|
|
39
|
+
var import_react11 = require("react");
|
|
40
40
|
var import_widget_sdk5 = require("@sensiblestats/widget-sdk");
|
|
41
41
|
|
|
42
42
|
// src/kickoff.ts
|
|
@@ -92,12 +92,6 @@ var STRINGS = {
|
|
|
92
92
|
const drift = direction ? `, ${direction}` : "";
|
|
93
93
|
return `Price movement over the last ${span}: opened at ${opening}, currently ${current}${drift}.`;
|
|
94
94
|
},
|
|
95
|
-
clubMatchPreviewHeading: "Match preview",
|
|
96
|
-
clubTeamDnaHeading: "How they play",
|
|
97
|
-
clubFormHeading: "Recent form",
|
|
98
|
-
clubCountdownLabel: "Countdown to kick-off",
|
|
99
|
-
clubKickoff: (ms) => new Intl.DateTimeFormat("en-GB", { weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }).format(new Date(ms)),
|
|
100
|
-
clubKickoffAria: (ms) => `Kick-off ${new Intl.DateTimeFormat("en-GB", { weekday: "long", day: "numeric", month: "long", hour: "2-digit", minute: "2-digit" }).format(new Date(ms))}`,
|
|
101
95
|
inSlip: "In slip",
|
|
102
96
|
slipAdded: (n) => n === void 0 ? "Added to slip" : `Added to slip (${n} selection${n === 1 ? "" : "s"})`,
|
|
103
97
|
slipDuplicate: "Already in your slip",
|
|
@@ -149,12 +143,6 @@ var STRINGS = {
|
|
|
149
143
|
const drift = direction ? `, ${direction}` : "";
|
|
150
144
|
return `Son ${span} i\xE7indeki oran hareketi: ${opening} ile a\xE7\u0131ld\u0131, \u015Fu anda ${current}${drift}.`;
|
|
151
145
|
},
|
|
152
|
-
clubMatchPreviewHeading: "Ma\xE7 \xF6nizlemesi",
|
|
153
|
-
clubTeamDnaHeading: "Nas\u0131l oynuyorlar",
|
|
154
|
-
clubFormHeading: "Son form",
|
|
155
|
-
clubCountdownLabel: "Ba\u015Flama vuru\u015Funa kalan",
|
|
156
|
-
clubKickoff: (ms) => new Intl.DateTimeFormat("tr-TR", { weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }).format(new Date(ms)),
|
|
157
|
-
clubKickoffAria: (ms) => `Ba\u015Flama vuru\u015Fu ${new Intl.DateTimeFormat("tr-TR", { weekday: "long", day: "numeric", month: "long", hour: "2-digit", minute: "2-digit" }).format(new Date(ms))}`,
|
|
158
146
|
inSlip: "Kuponda",
|
|
159
147
|
slipAdded: (n) => n === void 0 ? "Kupona eklendi" : `Kupona eklendi (${n} se\xE7im)`,
|
|
160
148
|
slipDuplicate: "Bu se\xE7im kuponunuzda zaten var",
|
|
@@ -218,12 +206,6 @@ function normalizeUi(cfg) {
|
|
|
218
206
|
excludedSuspended: strings.excludedSuspended,
|
|
219
207
|
chartTimeLabel: strings.chartTimeLabel,
|
|
220
208
|
chartAria: strings.chartAria,
|
|
221
|
-
clubMatchPreviewHeading: strings.clubMatchPreviewHeading,
|
|
222
|
-
clubTeamDnaHeading: strings.clubTeamDnaHeading,
|
|
223
|
-
clubFormHeading: strings.clubFormHeading,
|
|
224
|
-
clubCountdownLabel: strings.clubCountdownLabel,
|
|
225
|
-
clubKickoff: strings.clubKickoff,
|
|
226
|
-
clubKickoffAria: strings.clubKickoffAria,
|
|
227
209
|
addToSlip: strings.addToSlip,
|
|
228
210
|
inSlip: strings.inSlip,
|
|
229
211
|
slipAdded: strings.slipAdded,
|
|
@@ -586,8 +568,7 @@ function applyEvent(state, event) {
|
|
|
586
568
|
messages: mapActive(state, (t) => ({
|
|
587
569
|
...t,
|
|
588
570
|
done: true,
|
|
589
|
-
greetingDashboard: event.data.dashboard ?? void 0
|
|
590
|
-
clubDashboard: event.data.clubDashboard ?? void 0
|
|
571
|
+
greetingDashboard: event.data.dashboard ?? void 0
|
|
591
572
|
}))
|
|
592
573
|
};
|
|
593
574
|
}
|
|
@@ -784,7 +765,7 @@ function ChatFab({ label, greeting, popupText, onOpen, onDismissPopup, dismissLa
|
|
|
784
765
|
}
|
|
785
766
|
|
|
786
767
|
// src/components/ChatPanel.tsx
|
|
787
|
-
var
|
|
768
|
+
var import_react10 = require("react");
|
|
788
769
|
|
|
789
770
|
// src/components/ChatHeader.tsx
|
|
790
771
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -797,7 +778,7 @@ function ChatHeader({ onClose, closeLabel = "Close chat" }) {
|
|
|
797
778
|
}
|
|
798
779
|
|
|
799
780
|
// src/components/MessageList.tsx
|
|
800
|
-
var
|
|
781
|
+
var import_react8 = require("react");
|
|
801
782
|
|
|
802
783
|
// src/components/Markdown.tsx
|
|
803
784
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -1343,259 +1324,28 @@ function GreetingDashboard({ dashboard, onTap }) {
|
|
|
1343
1324
|
] });
|
|
1344
1325
|
}
|
|
1345
1326
|
|
|
1346
|
-
// src/components/club-dashboard/GreetingHeaderBlock.tsx
|
|
1347
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1348
|
-
function GreetingHeaderBlock({ block }) {
|
|
1349
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-cdash-greeting", children: [
|
|
1350
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ss-w-cdash-greeting-title", children: block.title }),
|
|
1351
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ss-w-cdash-greeting-subtitle", children: block.subtitle })
|
|
1352
|
-
] });
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
// src/components/club-dashboard/FixtureHeroBlock.tsx
|
|
1356
|
-
var import_react8 = require("react");
|
|
1357
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1358
|
-
function initials3(name) {
|
|
1359
|
-
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
1360
|
-
}
|
|
1361
|
-
function Crest3({ url, name }) {
|
|
1362
|
-
const [broken, setBroken] = (0, import_react8.useState)(false);
|
|
1363
|
-
if (!url || broken) {
|
|
1364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-crest ss-w-cdash-crest--fallback", "aria-hidden": "true", children: initials3(name) });
|
|
1365
|
-
}
|
|
1366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { className: "ss-w-cdash-crest", src: url, alt: "", "aria-hidden": "true", onError: () => setBroken(true) });
|
|
1367
|
-
}
|
|
1368
|
-
function FixtureHeroBlock({
|
|
1369
|
-
block,
|
|
1370
|
-
ui,
|
|
1371
|
-
onAction
|
|
1372
|
-
}) {
|
|
1373
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ss-w-cdash-fixture", children: [
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ss-w-cdash-tie", children: [
|
|
1375
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Crest3, { url: block.homeCrestUrl, name: block.homeName }),
|
|
1376
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-team", children: block.homeName }),
|
|
1377
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-vs", children: "v" }),
|
|
1378
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-team", children: block.awayName }),
|
|
1379
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Crest3, { url: block.awayCrestUrl, name: block.awayName })
|
|
1380
|
-
] }),
|
|
1381
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "ss-w-cdash-fixture-meta", children: [
|
|
1382
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-kickoff", children: ui.clubKickoff(block.kickoffUnix * 1e3) }),
|
|
1383
|
-
block.venue ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-venue", children: block.venue }) : null,
|
|
1384
|
-
block.competition ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "ss-w-cdash-comp", children: block.competition }) : null
|
|
1385
|
-
] }),
|
|
1386
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "ss-w-cdash-cta", onClick: () => onAction(block.ctaLabel, { actionRef: block.ctaActionRef }), children: block.ctaLabel })
|
|
1387
|
-
] });
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
// src/components/club-dashboard/ResultPills.tsx
|
|
1391
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1392
|
-
function ResultPills({ results }) {
|
|
1393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: `ss-w-cdash-pill ss-w-cdash-pill--${r.toLowerCase()}`, children: r }, i)) });
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
// src/components/club-dashboard/FormGuideBlock.tsx
|
|
1397
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1398
|
-
function FormGuideBlock({ block }) {
|
|
1399
|
-
if (block.rows.length === 0) return null;
|
|
1400
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "ss-w-cdash-form", children: block.rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "ss-w-cdash-form-row", children: [
|
|
1401
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "ss-w-cdash-form-name", children: [
|
|
1402
|
-
row.name,
|
|
1403
|
-
row.position != null ? ` #${row.position}` : ""
|
|
1404
|
-
] }),
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "ss-w-cdash-form-pills", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ResultPills, { results: row.last5 }) })
|
|
1406
|
-
] }, row.name)) });
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
// src/components/club-dashboard/MatchPreviewBlock.tsx
|
|
1410
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1411
|
-
function MatchPreviewBlock({
|
|
1412
|
-
block,
|
|
1413
|
-
ui,
|
|
1414
|
-
onAction
|
|
1415
|
-
}) {
|
|
1416
|
-
if (block.facts.length === 0) return null;
|
|
1417
|
-
const heading = ui.clubMatchPreviewHeading;
|
|
1418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-cdash-lines", children: [
|
|
1419
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "ss-w-cdash-lines-heading", children: heading }),
|
|
1420
|
-
block.facts.map(
|
|
1421
|
-
(f, i) => f.actionRef ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1422
|
-
"button",
|
|
1423
|
-
{
|
|
1424
|
-
type: "button",
|
|
1425
|
-
className: "ss-w-cdash-fact",
|
|
1426
|
-
onClick: () => onAction(f.label ?? f.sentence, { actionRef: f.actionRef }),
|
|
1427
|
-
children: [
|
|
1428
|
-
f.sentence,
|
|
1429
|
-
f.label ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "ss-w-cdash-fact-label", children: [
|
|
1430
|
-
" ",
|
|
1431
|
-
f.label
|
|
1432
|
-
] }) : null
|
|
1433
|
-
]
|
|
1434
|
-
},
|
|
1435
|
-
i
|
|
1436
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: f.sentence }, i)
|
|
1437
|
-
)
|
|
1438
|
-
] });
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
// src/components/club-dashboard/MatchPreviewCardBlock.tsx
|
|
1442
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1443
|
-
function position(p) {
|
|
1444
|
-
return p != null ? `#${p}` : "\u2014";
|
|
1445
|
-
}
|
|
1446
|
-
function MatchPreviewCardBlock({ block }) {
|
|
1447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ss-w-cdash-preview", children: [
|
|
1448
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ss-w-cdash-preview-header", children: [
|
|
1449
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-team", children: block.homeName }),
|
|
1450
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-vs", children: "v" }),
|
|
1451
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-team", children: block.awayName })
|
|
1452
|
-
] }),
|
|
1453
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ss-w-cdash-preview-row", children: [
|
|
1454
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-value", children: position(block.homePosition) }),
|
|
1455
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-label", children: block.tableLabel }),
|
|
1456
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-value", children: position(block.awayPosition) })
|
|
1457
|
-
] }),
|
|
1458
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ss-w-cdash-preview-row", children: [
|
|
1459
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-pills", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResultPills, { results: block.homeLast5 }) }),
|
|
1460
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-label", children: block.last5Label }),
|
|
1461
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "ss-w-cdash-preview-pills", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ResultPills, { results: block.awayLast5 }) })
|
|
1462
|
-
] }),
|
|
1463
|
-
block.edgeTeamName ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "ss-w-cdash-preview-edge", children: [
|
|
1464
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", children: "\u25B8" }),
|
|
1465
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("strong", { children: block.edgeTeamName }),
|
|
1466
|
-
block.edgeReason ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
|
|
1467
|
-
" \u2014 ",
|
|
1468
|
-
block.edgeReason
|
|
1469
|
-
] }) : null
|
|
1470
|
-
] }) : null,
|
|
1471
|
-
block.h2HLines.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ss-w-cdash-preview-h2h", children: block.h2HLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { children: line }, i)) }) : null
|
|
1472
|
-
] });
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
// src/components/club-dashboard/TeamDnaBlock.tsx
|
|
1476
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1477
|
-
function TeamDnaBlock({
|
|
1478
|
-
block,
|
|
1479
|
-
ui,
|
|
1480
|
-
onAction
|
|
1481
|
-
}) {
|
|
1482
|
-
if (block.facts.length === 0) return null;
|
|
1483
|
-
const heading = ui.clubTeamDnaHeading;
|
|
1484
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "ss-w-cdash-lines", children: [
|
|
1485
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "ss-w-cdash-lines-heading", children: heading }),
|
|
1486
|
-
block.facts.map(
|
|
1487
|
-
(f, i) => f.actionRef ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1488
|
-
"button",
|
|
1489
|
-
{
|
|
1490
|
-
type: "button",
|
|
1491
|
-
className: "ss-w-cdash-fact",
|
|
1492
|
-
onClick: () => onAction(f.label ?? f.sentence, { actionRef: f.actionRef }),
|
|
1493
|
-
children: [
|
|
1494
|
-
f.sentence,
|
|
1495
|
-
f.label ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "ss-w-cdash-fact-label", children: [
|
|
1496
|
-
" ",
|
|
1497
|
-
f.label
|
|
1498
|
-
] }) : null
|
|
1499
|
-
]
|
|
1500
|
-
},
|
|
1501
|
-
i
|
|
1502
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: f.sentence }, i)
|
|
1503
|
-
)
|
|
1504
|
-
] });
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
// src/components/club-dashboard/CountdownBlock.tsx
|
|
1508
|
-
var import_react9 = require("react");
|
|
1509
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1510
|
-
var DAY_MS = 24 * 3600 * 1e3;
|
|
1511
|
-
function pad2(n) {
|
|
1512
|
-
return String(n).padStart(2, "0");
|
|
1513
|
-
}
|
|
1514
|
-
function splitRemaining(remainingMs) {
|
|
1515
|
-
const totalSeconds = Math.max(0, Math.floor(remainingMs / 1e3));
|
|
1516
|
-
const h = Math.floor(totalSeconds / 3600);
|
|
1517
|
-
const m = Math.floor(totalSeconds % 3600 / 60);
|
|
1518
|
-
const s = totalSeconds % 60;
|
|
1519
|
-
return { h: pad2(h), m: pad2(m), s: pad2(s) };
|
|
1520
|
-
}
|
|
1521
|
-
function CountdownBlock({ block, ui }) {
|
|
1522
|
-
const [remainingMs, setRemainingMs] = (0, import_react9.useState)(() => block.kickoffUnix * 1e3 - Date.now());
|
|
1523
|
-
(0, import_react9.useEffect)(() => {
|
|
1524
|
-
setRemainingMs(block.kickoffUnix * 1e3 - Date.now());
|
|
1525
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
1526
|
-
const id = setInterval(() => {
|
|
1527
|
-
setRemainingMs(block.kickoffUnix * 1e3 - Date.now());
|
|
1528
|
-
}, 1e3);
|
|
1529
|
-
return () => clearInterval(id);
|
|
1530
|
-
}, [block.kickoffUnix]);
|
|
1531
|
-
if (remainingMs <= 0) return null;
|
|
1532
|
-
if (remainingMs > DAY_MS) return null;
|
|
1533
|
-
const { h, m, s } = splitRemaining(remainingMs);
|
|
1534
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ss-w-cdash-cd", "aria-label": ui.clubKickoffAria(block.kickoffUnix * 1e3), children: [
|
|
1535
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ss-w-cdash-cd-clock", "aria-hidden": "true", children: [
|
|
1536
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ss-w-cdash-cd-h", children: h }),
|
|
1537
|
-
"h",
|
|
1538
|
-
" ",
|
|
1539
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ss-w-cdash-cd-m", children: m }),
|
|
1540
|
-
"m",
|
|
1541
|
-
" ",
|
|
1542
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ss-w-cdash-cd-s", children: s }),
|
|
1543
|
-
"s"
|
|
1544
|
-
] }),
|
|
1545
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "ss-w-cdash-cd-label", children: ui.clubCountdownLabel })
|
|
1546
|
-
] });
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
// src/components/club-dashboard/ClubDashboard.tsx
|
|
1550
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1551
|
-
var CLUB_BLOCK_REGISTRY = {
|
|
1552
|
-
greetingHeader: ({ block }) => block.type === "greetingHeader" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GreetingHeaderBlock, { block }) : null,
|
|
1553
|
-
fixtureHero: ({ block, ui, onAction }) => block.type === "fixtureHero" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FixtureHeroBlock, { block, ui, onAction }) : null,
|
|
1554
|
-
formGuide: ({ block, ui }) => block.type === "formGuide" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormGuideBlock, { block, ui }) : null,
|
|
1555
|
-
matchPreview: ({ block, ui, onAction }) => block.type === "matchPreview" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MatchPreviewBlock, { block, ui, onAction }) : null,
|
|
1556
|
-
matchPreviewCard: ({ block, ui }) => block.type === "matchPreviewCard" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MatchPreviewCardBlock, { block, ui }) : null,
|
|
1557
|
-
teamDna: ({ block, ui, onAction }) => block.type === "teamDna" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TeamDnaBlock, { block, ui, onAction }) : null,
|
|
1558
|
-
countdown: ({ block, ui }) => block.type === "countdown" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CountdownBlock, { block, ui }) : null
|
|
1559
|
-
};
|
|
1560
|
-
function ClubDashboard({
|
|
1561
|
-
dashboard,
|
|
1562
|
-
ui,
|
|
1563
|
-
onAction
|
|
1564
|
-
}) {
|
|
1565
|
-
if (!dashboard.blocks.length) return null;
|
|
1566
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "ss-w-cdash", children: dashboard.blocks.map((block, i) => {
|
|
1567
|
-
const Comp = Object.prototype.hasOwnProperty.call(CLUB_BLOCK_REGISTRY, block.type) ? CLUB_BLOCK_REGISTRY[block.type] : void 0;
|
|
1568
|
-
if (!Comp) {
|
|
1569
|
-
console.warn(`[club-dashboard] no renderer for block type "${block.type}"`);
|
|
1570
|
-
return null;
|
|
1571
|
-
}
|
|
1572
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "ss-w-cdash-block", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Comp, { block, ui, onAction }) }, i);
|
|
1573
|
-
}) });
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
1327
|
// src/components/ChatMessage.tsx
|
|
1577
|
-
var
|
|
1578
|
-
function ChatMessage({ message, disabled, onAct, onTap,
|
|
1328
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1329
|
+
function ChatMessage({ message, disabled, onAct, onTap, ui, slip }) {
|
|
1579
1330
|
if (message.role === "user") {
|
|
1580
|
-
return /* @__PURE__ */ (0,
|
|
1331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ss-w-msg ss-w-user", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
1581
1332
|
}
|
|
1582
|
-
return /* @__PURE__ */ (0,
|
|
1583
|
-
message.text && !message.greetingDashboard
|
|
1584
|
-
message.greetingDashboard ? /* @__PURE__ */ (0,
|
|
1585
|
-
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1587
|
-
/* @__PURE__ */ (0,
|
|
1588
|
-
/* @__PURE__ */ (0,
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
|
|
1333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ss-w-msg ss-w-bot", children: [
|
|
1334
|
+
message.text && !message.greetingDashboard ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Markdown, { text: message.text }) : null,
|
|
1335
|
+
message.greetingDashboard ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GreetingDashboard, { dashboard: message.greetingDashboard, onTap }) : null,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BettingInsightList, { insights: message.insights, ui, slip }),
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MarketOddsCardList, { cards: message.marketOdds, ui, slip }),
|
|
1339
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui }),
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
|
|
1591
1341
|
] });
|
|
1592
1342
|
}
|
|
1593
1343
|
|
|
1594
1344
|
// src/components/IntentChips.tsx
|
|
1595
|
-
var
|
|
1345
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1596
1346
|
function IntentChips({ chips, onPick }) {
|
|
1597
1347
|
if (chips.length === 0) return null;
|
|
1598
|
-
return /* @__PURE__ */ (0,
|
|
1348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "ss-w-chips", children: chips.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "ss-w-chip", onClick: () => onPick(c.text), children: c.text }, `${c.text}-${i}`)) });
|
|
1599
1349
|
}
|
|
1600
1350
|
|
|
1601
1351
|
// src/scroll.ts
|
|
@@ -1605,18 +1355,18 @@ function isPinnedToBottom(el, threshold = PIN_THRESHOLD) {
|
|
|
1605
1355
|
}
|
|
1606
1356
|
|
|
1607
1357
|
// src/components/MessageList.tsx
|
|
1608
|
-
var
|
|
1358
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1609
1359
|
function MessageList({ controller, ui, slip, onDashboardTap }) {
|
|
1610
1360
|
const { state, send } = controller;
|
|
1611
|
-
const listRef = (0,
|
|
1612
|
-
const endRef = (0,
|
|
1613
|
-
const pinnedRef = (0,
|
|
1614
|
-
(0,
|
|
1361
|
+
const listRef = (0, import_react8.useRef)(null);
|
|
1362
|
+
const endRef = (0, import_react8.useRef)(null);
|
|
1363
|
+
const pinnedRef = (0, import_react8.useRef)(true);
|
|
1364
|
+
(0, import_react8.useEffect)(() => {
|
|
1615
1365
|
if (pinnedRef.current) endRef.current?.scrollIntoView({ block: "end" });
|
|
1616
1366
|
}, [state.messages, state.status]);
|
|
1617
1367
|
const hasUserMessage = state.messages.some((m) => m.role === "user");
|
|
1618
1368
|
const hasDashboard = state.messages.some((m) => m.role === "assistant" && m.greetingDashboard);
|
|
1619
|
-
return /* @__PURE__ */ (0,
|
|
1369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1620
1370
|
"div",
|
|
1621
1371
|
{
|
|
1622
1372
|
className: "ss-w-list",
|
|
@@ -1626,7 +1376,7 @@ function MessageList({ controller, ui, slip, onDashboardTap }) {
|
|
|
1626
1376
|
if (listRef.current) pinnedRef.current = isPinnedToBottom(listRef.current);
|
|
1627
1377
|
},
|
|
1628
1378
|
children: [
|
|
1629
|
-
state.messages.map((m) => /* @__PURE__ */ (0,
|
|
1379
|
+
state.messages.map((m) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1630
1380
|
ChatMessage,
|
|
1631
1381
|
{
|
|
1632
1382
|
message: m,
|
|
@@ -1636,31 +1386,30 @@ function MessageList({ controller, ui, slip, onDashboardTap }) {
|
|
|
1636
1386
|
send(tile.actionValue, { displayText: tile.title });
|
|
1637
1387
|
if (m.role === "assistant" && m.greetingDashboard) onDashboardTap?.(tile, index, m.greetingDashboard.layout);
|
|
1638
1388
|
},
|
|
1639
|
-
onClubAction: (label, opts) => send(label, { actionRef: opts.actionRef }),
|
|
1640
1389
|
ui,
|
|
1641
1390
|
slip
|
|
1642
1391
|
},
|
|
1643
1392
|
m.id
|
|
1644
1393
|
)),
|
|
1645
|
-
state.isStreaming && state.actionsLoading ? /* @__PURE__ */ (0,
|
|
1394
|
+
state.isStreaming && state.actionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionButtons, { actions: [], loading: true, onAct: () => {
|
|
1646
1395
|
} }) : null,
|
|
1647
|
-
state.status ? /* @__PURE__ */ (0,
|
|
1648
|
-
state.error ? /* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1396
|
+
state.status ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "ss-w-status", children: state.status }) : null,
|
|
1397
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-error", role: "alert", children: [
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "message" in state.error ? state.error.message : ui.somethingWentWrong }),
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "ss-w-retry", onClick: () => controller.retry(), children: ui.retry })
|
|
1651
1400
|
] }) : null,
|
|
1652
|
-
!hasUserMessage && !hasDashboard ? /* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
!hasUserMessage && !hasDashboard ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IntentChips, { chips: state.starters, onPick: (t) => send(t) }) : null,
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: endRef })
|
|
1654
1403
|
]
|
|
1655
1404
|
}
|
|
1656
1405
|
);
|
|
1657
1406
|
}
|
|
1658
1407
|
|
|
1659
1408
|
// src/components/ChatInput.tsx
|
|
1660
|
-
var
|
|
1661
|
-
var
|
|
1409
|
+
var import_react9 = require("react");
|
|
1410
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1662
1411
|
function ChatInput({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message" }) {
|
|
1663
|
-
const [value, setValue] = (0,
|
|
1412
|
+
const [value, setValue] = (0, import_react9.useState)("");
|
|
1664
1413
|
const submit = () => {
|
|
1665
1414
|
const t = value.trim();
|
|
1666
1415
|
if (!t) return;
|
|
@@ -1673,18 +1422,18 @@ function ChatInput({ placeholder, streaming, onSend, onStop, stopLabel = "Stop r
|
|
|
1673
1422
|
submit();
|
|
1674
1423
|
}
|
|
1675
1424
|
};
|
|
1676
|
-
return /* @__PURE__ */ (0,
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
1678
|
-
streaming ? /* @__PURE__ */ (0,
|
|
1425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "ss-w-input", children: [
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", { className: "ss-w-textarea", rows: 1, placeholder, value, disabled: streaming, onChange: (e) => setValue(e.target.value), onKeyDown }),
|
|
1427
|
+
streaming ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "ss-w-send ss-w-stop", "aria-label": stopLabel, onClick: onStop, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "ss-w-stop-glyph" }) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "ss-w-send", "aria-label": sendLabel, onClick: submit, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SendIcon, {}) })
|
|
1679
1428
|
] });
|
|
1680
1429
|
}
|
|
1681
1430
|
|
|
1682
1431
|
// src/components/ChatPanel.tsx
|
|
1683
|
-
var
|
|
1432
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1684
1433
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
1685
1434
|
function useIsModal() {
|
|
1686
|
-
const [modal, setModal] = (0,
|
|
1687
|
-
(0,
|
|
1435
|
+
const [modal, setModal] = (0, import_react10.useState)(false);
|
|
1436
|
+
(0, import_react10.useEffect)(() => {
|
|
1688
1437
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1689
1438
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
1690
1439
|
const sync = () => setModal(mql.matches);
|
|
@@ -1697,17 +1446,17 @@ function useIsModal() {
|
|
|
1697
1446
|
function ChatPanel({ controller, ui, slip, onDashboardTap }) {
|
|
1698
1447
|
const { state, close, stop, send } = controller;
|
|
1699
1448
|
const isModal = useIsModal();
|
|
1700
|
-
(0,
|
|
1449
|
+
(0, import_react10.useEffect)(() => {
|
|
1701
1450
|
const onKey = (e) => {
|
|
1702
1451
|
if (e.key === "Escape") close();
|
|
1703
1452
|
};
|
|
1704
1453
|
window.addEventListener("keydown", onKey);
|
|
1705
1454
|
return () => window.removeEventListener("keydown", onKey);
|
|
1706
1455
|
}, [close]);
|
|
1707
|
-
return /* @__PURE__ */ (0,
|
|
1708
|
-
/* @__PURE__ */ (0,
|
|
1709
|
-
/* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatHeader, { onClose: close, closeLabel: ui.closeChat }),
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MessageList, { controller, ui, slip, onDashboardTap }),
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChatInput, { placeholder: ui.placeholder, streaming: state.isStreaming, onSend: (t) => send(t), onStop: stop, stopLabel: ui.stopResponse, sendLabel: ui.sendMessage })
|
|
1711
1460
|
] });
|
|
1712
1461
|
}
|
|
1713
1462
|
|
|
@@ -2060,66 +1809,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
2060
1809
|
.ss-w-dash--discovery .ss-w-dash-tile:nth-child(2) { background: #eef3fb; }
|
|
2061
1810
|
.ss-w-dash--discovery .ss-w-dash-tile:nth-child(3) { background: #fdf6ec; }
|
|
2062
1811
|
.ss-w-dash--discovery .ss-w-dash-tile:nth-child(4) { background: #f5eefb; }
|
|
2063
|
-
|
|
2064
|
-
/* club match-day dashboard */
|
|
2065
|
-
.ss-w-cdash { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
|
|
2066
|
-
.ss-w-cdash-block { display: flex; flex-direction: column; }
|
|
2067
|
-
|
|
2068
|
-
.ss-w-cdash-greeting { display: flex; flex-direction: column; gap: 2px; }
|
|
2069
|
-
.ss-w-cdash-greeting-title { font-weight: 700; font-size: 14px; color: var(--ss-w-ink); }
|
|
2070
|
-
.ss-w-cdash-greeting-subtitle { font-size: 11.5px; color: var(--ss-w-faint); }
|
|
2071
|
-
|
|
2072
|
-
.ss-w-cdash-fixture { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; padding: 12px; text-align: center; }
|
|
2073
|
-
.ss-w-cdash-tie { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
|
|
2074
|
-
.ss-w-cdash-team { font-weight: 650; font-size: 13px; color: var(--ss-w-ink); min-width: 0; overflow-wrap: anywhere; }
|
|
2075
|
-
.ss-w-cdash-vs { font-size: 11px; color: var(--ss-w-faint); font-weight: 600; }
|
|
2076
|
-
.ss-w-cdash-crest { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--ss-w-bubble); }
|
|
2077
|
-
.ss-w-cdash-crest--fallback { display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 16%, var(--ss-w-panel)); }
|
|
2078
|
-
.ss-w-cdash-fixture-meta { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--ss-w-faint); }
|
|
2079
|
-
.ss-w-cdash-kickoff { font-weight: 700; color: var(--ss-w-ink); }
|
|
2080
|
-
.ss-w-cdash-cta { font: inherit; font-weight: 700; font-size: 12px; color: var(--ss-w-cta-ink); background: var(--ss-w-cta); border: none; border-radius: 999px; padding: 8px 18px; cursor: pointer; }
|
|
2081
|
-
|
|
2082
|
-
.ss-w-cdash-form { display: flex; flex-direction: column; gap: 6px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; padding: 10px 12px; }
|
|
2083
|
-
.ss-w-cdash-form-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
2084
|
-
.ss-w-cdash-form-name { font-size: 12px; font-weight: 600; color: var(--ss-w-ink); min-width: 0; overflow-wrap: anywhere; }
|
|
2085
|
-
.ss-w-cdash-form-pills { flex: none; display: flex; align-items: center; gap: 3px; }
|
|
2086
|
-
.ss-w-cdash-pill { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 9.5px; font-weight: 700; color: #fff; }
|
|
2087
|
-
.ss-w-cdash-pill--w { background: color-mix(in srgb, var(--ss-w-pos) 88%, black); }
|
|
2088
|
-
.ss-w-cdash-pill--d { background: var(--ss-w-faint); }
|
|
2089
|
-
.ss-w-cdash-pill--l { background: color-mix(in srgb, var(--ss-w-neg) 88%, black); }
|
|
2090
|
-
|
|
2091
|
-
.ss-w-cdash-lines { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-left: 3px solid var(--ss-w-accent); border-radius: 12px; padding: 10px 12px; }
|
|
2092
|
-
.ss-w-cdash-lines-heading { font-size: 12px; font-weight: 700; color: var(--ss-w-accent); }
|
|
2093
|
-
.ss-w-cdash-lines p { font-size: 12px; line-height: 1.4; color: var(--ss-w-ink); margin: 0; }
|
|
2094
|
-
.ss-w-cdash-fact { display: block; width: 100%; text-align: left; font: inherit; font-size: 12px; line-height: 1.4; color: var(--ss-w-ink); background: none; border: none; padding: 0; cursor: pointer; }
|
|
2095
|
-
.ss-w-cdash-fact:hover, .ss-w-cdash-fact:focus-visible { color: var(--ss-w-accent); text-decoration: underline; }
|
|
2096
|
-
.ss-w-cdash-fact-label { font-size: 11px; font-weight: 700; color: var(--ss-w-accent); }
|
|
2097
|
-
|
|
2098
|
-
.ss-w-cdash-cd { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; padding: 10px 12px; text-align: center; }
|
|
2099
|
-
.ss-w-cdash-cd-clock { display: flex; align-items: baseline; justify-content: center; gap: 2px; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-weight: 700; font-size: 18px; color: var(--ss-w-ink); }
|
|
2100
|
-
.ss-w-cdash-cd-h, .ss-w-cdash-cd-m, .ss-w-cdash-cd-s { color: var(--ss-w-accent); }
|
|
2101
|
-
.ss-w-cdash-cd-label { font-size: 11px; font-weight: 600; color: var(--ss-w-faint); }
|
|
2102
|
-
|
|
2103
|
-
.ss-w-cdash-preview { display: flex; flex-direction: column; gap: 8px; background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 12px; padding: 10px 12px; }
|
|
2104
|
-
.ss-w-cdash-preview-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 6px; }
|
|
2105
|
-
.ss-w-cdash-preview-header .ss-w-cdash-team:first-child { justify-self: start; text-align: left; }
|
|
2106
|
-
.ss-w-cdash-preview-header .ss-w-cdash-team:last-child { justify-self: end; text-align: right; }
|
|
2107
|
-
.ss-w-cdash-preview-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
|
|
2108
|
-
.ss-w-cdash-preview-label { font-size: 10.5px; font-weight: 600; color: var(--ss-w-faint); text-align: center; text-transform: uppercase; letter-spacing: 0.03em; }
|
|
2109
|
-
.ss-w-cdash-preview-value { font-size: 12px; font-weight: 700; color: var(--ss-w-ink); text-align: center; }
|
|
2110
|
-
.ss-w-cdash-preview-pills { display: flex; align-items: center; justify-content: center; gap: 3px; }
|
|
2111
|
-
.ss-w-cdash-preview-row:first-of-type .ss-w-cdash-preview-value { justify-self: start; }
|
|
2112
|
-
.ss-w-cdash-preview-row:first-of-type .ss-w-cdash-preview-value:last-child { justify-self: end; }
|
|
2113
|
-
.ss-w-cdash-preview-row:last-of-type .ss-w-cdash-preview-pills:first-child { justify-self: start; }
|
|
2114
|
-
.ss-w-cdash-preview-row:last-of-type .ss-w-cdash-preview-pills:last-child { justify-self: end; }
|
|
2115
|
-
.ss-w-cdash-preview-edge { display: flex; align-items: baseline; gap: 4px; font-size: 12px; line-height: 1.4; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 10%, transparent); border-radius: 8px; padding: 6px 8px; }
|
|
2116
|
-
.ss-w-cdash-preview-edge strong { color: var(--ss-w-ink); }
|
|
2117
|
-
.ss-w-cdash-preview-h2h { display: flex; flex-direction: column; gap: 2px; }
|
|
2118
|
-
.ss-w-cdash-preview-h2h p { font-size: 11.5px; line-height: 1.4; color: var(--ss-w-faint); margin: 0; }
|
|
2119
1812
|
`;
|
|
2120
1813
|
|
|
2121
1814
|
// src/StatsWidget.tsx
|
|
2122
|
-
var
|
|
1815
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2123
1816
|
function buildClient(props) {
|
|
2124
1817
|
try {
|
|
2125
1818
|
if ("client" in props && props.client) {
|
|
@@ -2144,11 +1837,11 @@ function injectStyles(root) {
|
|
|
2144
1837
|
function StatsWidget(props) {
|
|
2145
1838
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
2146
1839
|
const cfg = props.config;
|
|
2147
|
-
const built = (0,
|
|
2148
|
-
const ui = (0,
|
|
2149
|
-
const rootRef = (0,
|
|
1840
|
+
const built = (0, import_react11.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
1841
|
+
const ui = (0, import_react11.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
1842
|
+
const rootRef = (0, import_react11.useRef)(null);
|
|
2150
1843
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0);
|
|
2151
|
-
const slip = (0,
|
|
1844
|
+
const slip = (0, import_react11.useMemo)(
|
|
2152
1845
|
() => ({
|
|
2153
1846
|
onAddToSlip: props.config?.onAddToSlip,
|
|
2154
1847
|
conversationId: controller.state.conversationId ?? void 0,
|
|
@@ -2161,18 +1854,18 @@ function StatsWidget(props) {
|
|
|
2161
1854
|
}),
|
|
2162
1855
|
[props.config?.onAddToSlip, controller.state.conversationId, built]
|
|
2163
1856
|
);
|
|
2164
|
-
const onDashboardTap = (0,
|
|
1857
|
+
const onDashboardTap = (0, import_react11.useMemo)(
|
|
2165
1858
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input)) : void 0,
|
|
2166
1859
|
[built]
|
|
2167
1860
|
);
|
|
2168
|
-
(0,
|
|
1861
|
+
(0, import_react11.useEffect)(() => {
|
|
2169
1862
|
if (!built || !ui.injectStyles) return;
|
|
2170
1863
|
const node = rootRef.current?.getRootNode();
|
|
2171
1864
|
if (node) injectStyles(node);
|
|
2172
1865
|
}, [built, ui.injectStyles]);
|
|
2173
1866
|
if (!built) return null;
|
|
2174
1867
|
const attrs = themeAttrs(ui);
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatPanel, { controller, ui, slip, onDashboardTap }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2176
1869
|
ChatFab,
|
|
2177
1870
|
{
|
|
2178
1871
|
label: ui.launcherLabel,
|