@sensiblestats/widget-react 0.17.0 → 0.18.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @sensiblestats/widget-react
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Fact-grounded club dashboard taps: per-fact renderers are now individually tappable and send their grounding back with the chat message.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @sensiblestats/widget-sdk@0.16.0
13
+
3
14
  ## 0.17.0
4
15
 
5
16
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -652,7 +652,7 @@ function useChatStream(conversation, starterTexts, greetingMessage) {
652
652
  const send = (0, import_react.useCallback)((text, opts) => {
653
653
  const trimmed = text.trim();
654
654
  if (!trimmed) return;
655
- run({ message: trimmed, actionId: opts?.actionId }, opts?.displayText);
655
+ run({ message: trimmed, actionId: opts?.actionId, grounding: opts?.grounding }, opts?.displayText);
656
656
  }, [run]);
657
657
  const retry = (0, import_react.useCallback)(() => {
658
658
  const last = stateRef.current.lastUserInput;
@@ -1322,7 +1322,7 @@ function FixtureHeroBlock({
1322
1322
  block.venue ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-cdash-venue", children: block.venue }) : null,
1323
1323
  block.competition ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "ss-w-cdash-comp", children: block.competition }) : null
1324
1324
  ] }),
1325
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "ss-w-cdash-cta", onClick: () => onAction(block.ctaActionValue, block.ctaLabel), children: block.ctaLabel })
1325
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "ss-w-cdash-cta", onClick: () => onAction(block.ctaActionValue, void 0, block.ctaLabel), children: block.ctaLabel })
1326
1326
  ] });
1327
1327
  }
1328
1328
 
@@ -1346,11 +1346,28 @@ function MatchPreviewBlock({
1346
1346
  ui,
1347
1347
  onAction
1348
1348
  }) {
1349
- if (block.lines.length === 0) return null;
1349
+ if (block.facts.length === 0) return null;
1350
1350
  const heading = ui.clubMatchPreviewHeading;
1351
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("button", { type: "button", className: "ss-w-cdash-lines", onClick: () => onAction(block.actionValue, heading), children: [
1351
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "ss-w-cdash-lines", children: [
1352
1352
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "ss-w-cdash-lines-heading", children: heading }),
1353
- block.lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: line }, i))
1353
+ block.facts.map(
1354
+ (f, i) => f.entityRef ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1355
+ "button",
1356
+ {
1357
+ type: "button",
1358
+ className: "ss-w-cdash-fact",
1359
+ onClick: () => onAction(f.question ?? f.sentence, { ...f.entityRef, subject: f.sentence, personaHint: "club" }),
1360
+ children: [
1361
+ f.sentence,
1362
+ f.label ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "ss-w-cdash-fact-label", children: [
1363
+ " ",
1364
+ f.label
1365
+ ] }) : null
1366
+ ]
1367
+ },
1368
+ i
1369
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: f.sentence }, i)
1370
+ )
1354
1371
  ] });
1355
1372
  }
1356
1373
 
@@ -1361,11 +1378,28 @@ function TeamDnaBlock({
1361
1378
  ui,
1362
1379
  onAction
1363
1380
  }) {
1364
- if (block.lines.length === 0) return null;
1381
+ if (block.facts.length === 0) return null;
1365
1382
  const heading = ui.clubTeamDnaHeading;
1366
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("button", { type: "button", className: "ss-w-cdash-lines", onClick: () => onAction(block.actionValue, heading), children: [
1383
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "ss-w-cdash-lines", children: [
1367
1384
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "ss-w-cdash-lines-heading", children: heading }),
1368
- block.lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { children: line }, i))
1385
+ block.facts.map(
1386
+ (f, i) => f.entityRef ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1387
+ "button",
1388
+ {
1389
+ type: "button",
1390
+ className: "ss-w-cdash-fact",
1391
+ onClick: () => onAction(f.question ?? f.sentence, { ...f.entityRef, subject: f.sentence, personaHint: "club" }),
1392
+ children: [
1393
+ f.sentence,
1394
+ f.label ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "ss-w-cdash-fact-label", children: [
1395
+ " ",
1396
+ f.label
1397
+ ] }) : null
1398
+ ]
1399
+ },
1400
+ i
1401
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { children: f.sentence }, i)
1402
+ )
1369
1403
  ] });
1370
1404
  }
1371
1405
 
@@ -1500,7 +1534,7 @@ function MessageList({ controller, ui, slip, onDashboardTap }) {
1500
1534
  send(tile.actionValue, { displayText: tile.title });
1501
1535
  if (m.role === "assistant" && m.greetingDashboard) onDashboardTap?.(tile, index, m.greetingDashboard.layout);
1502
1536
  },
1503
- onClubAction: (actionValue, displayText) => send(actionValue, { displayText }),
1537
+ onClubAction: (message, grounding, displayText) => send(message, { grounding, displayText: displayText ?? message }),
1504
1538
  ui,
1505
1539
  slip
1506
1540
  },
@@ -1950,9 +1984,12 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
1950
1984
  .ss-w-cdash-pill--d { background: var(--ss-w-faint); }
1951
1985
  .ss-w-cdash-pill--l { background: color-mix(in srgb, var(--ss-w-neg) 88%, black); }
1952
1986
 
1953
- .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; font: inherit; cursor: pointer; }
1987
+ .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; }
1954
1988
  .ss-w-cdash-lines-heading { font-size: 12px; font-weight: 700; color: var(--ss-w-accent); }
1955
- .ss-w-cdash-lines p { font-size: 12px; line-height: 1.4; color: var(--ss-w-ink); }
1989
+ .ss-w-cdash-lines p { font-size: 12px; line-height: 1.4; color: var(--ss-w-ink); margin: 0; }
1990
+ .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; }
1991
+ .ss-w-cdash-fact:hover, .ss-w-cdash-fact:focus-visible { color: var(--ss-w-accent); text-decoration: underline; }
1992
+ .ss-w-cdash-fact-label { font-size: 11px; font-weight: 700; color: var(--ss-w-accent); }
1956
1993
 
1957
1994
  .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; }
1958
1995
  .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); }