@burdenoff/microfe-bigconsole 2026.1121.4 → 2026.1122.2

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.
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ export interface KpiChangeDialogProps {
3
+ widgetId: string;
4
+ open: boolean;
5
+ onClose: () => void;
6
+ }
7
+ export declare const KpiChangeDialog: FC<KpiChangeDialogProps>;
8
+ export default KpiChangeDialog;
@@ -0,0 +1,28 @@
1
+ import { KpiChangePanel as e } from "./KpiChangePanel.js";
2
+ import { ResponsiveDialog as t, ResponsiveDialogContent as n, ResponsiveDialogDescription as r, ResponsiveDialogHeader as i, ResponsiveDialogTitle as a } from "@burdenoff/fe-libs/ui";
3
+ import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ // src/bigconsole/components/kpi-change/KpiChangeDialog.tsx
6
+ var l = "flex flex-col gap-3 px-3 py-1 sm:px-4", u = ({ widgetId: u, open: d, onClose: f }) => {
7
+ let { t: p } = o();
8
+ return /* @__PURE__ */ s(t, {
9
+ open: d,
10
+ onOpenChange: (e) => !e && f(),
11
+ children: /* @__PURE__ */ c(n, {
12
+ className: "sm:max-w-2xl flex max-h-[calc(100dvh-3rem)] flex-col overflow-hidden",
13
+ "data-testid": "kpi-change-dialog",
14
+ children: [/* @__PURE__ */ c(i, {
15
+ className: "shrink-0",
16
+ children: [/* @__PURE__ */ s(a, { children: p("bigconsole.kpiChange.dialogTitle", "Why did it move?") }), /* @__PURE__ */ s(r, { children: p("bigconsole.kpiChange.dialogDescription", "What the system’s own records say about this card’s movement, with the evidence behind every finding.") })]
17
+ }), /* @__PURE__ */ s("div", {
18
+ className: "min-h-0 flex-1 overflow-y-auto",
19
+ children: /* @__PURE__ */ s(e, {
20
+ widgetId: u,
21
+ open: d,
22
+ surfaceClassName: l
23
+ })
24
+ })]
25
+ })
26
+ });
27
+ };
28
+ export { u as KpiChangeDialog, u as default };
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ interface KpiChangePanelProps {
3
+ widgetId: string;
4
+ /** The panel runs the analysis when it opens. */
5
+ open: boolean;
6
+ /** The surface the panel sits on: inside a card, or inside the dialog. */
7
+ surfaceClassName?: string;
8
+ }
9
+ export declare const KpiChangePanel: FC<KpiChangePanelProps>;
10
+ export default KpiChangePanel;
@@ -0,0 +1,241 @@
1
+ import { useAppNavigate as e } from "../../contexts/NavigationContext.js";
2
+ import "../../contexts/index.js";
3
+ import { useBigConsole as t } from "../../context/BigConsoleContext.js";
4
+ import "../../context/index.js";
5
+ import n from "../../hooks/useKpiChange.js";
6
+ import { confidenceLabel as r, confidenceTone as i, emptyLaneText as a, explainedPercentLabel as o, formatEvidenceDate as s, formatSignedPercent as c, formatSignedValue as l, laneLabel as u, movementHeadline as d, safeEvidenceRoute as f, statusNotice as p } from "./kpiChangeModel.js";
7
+ import { useEffect as m, useRef as h } from "react";
8
+ import { Badge as g } from "@burdenoff/fe-libs/ui";
9
+ import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
11
+ // src/bigconsole/components/kpi-change/KpiChangePanel.tsx
12
+ var x = "flex flex-col gap-3 border-t border-[var(--color-border-subtle)] bg-bg-sunken px-3 py-3 sm:px-4", S = ({ widgetId: e, open: a, surfaceClassName: s }) => {
13
+ let { t: c } = _(), { explanation: l, loading: u, error: f, quotaRefused: S, explain: w, reset: T } = n(e), { workspaceId: E } = t(), D = h(null), O = `${E ?? ""}\u0000${e}`;
14
+ m(() => {
15
+ a ? D.current !== O && (D.current = O, w()) : (D.current = null, T());
16
+ }, [
17
+ a,
18
+ O,
19
+ w,
20
+ T
21
+ ]);
22
+ let k = s ?? x;
23
+ if (!a) return null;
24
+ if (u && !l) return /* @__PURE__ */ y("div", {
25
+ className: k,
26
+ "data-testid": "kpi-change-panel",
27
+ children: /* @__PURE__ */ y("p", {
28
+ className: "text-xs text-text-secondary",
29
+ role: "status",
30
+ "aria-live": "polite",
31
+ children: c("bigconsole.kpiChange.loading", "Working out why this number moved…")
32
+ })
33
+ });
34
+ if (f && !l) return /* @__PURE__ */ b("div", {
35
+ className: k,
36
+ "data-testid": "kpi-change-panel",
37
+ children: [/* @__PURE__ */ y("p", {
38
+ className: "text-xs text-status-error-text",
39
+ role: "alert",
40
+ children: f
41
+ }), !S && /* @__PURE__ */ y("div", { children: /* @__PURE__ */ y("button", {
42
+ type: "button",
43
+ onClick: () => void w(),
44
+ className: "text-xs text-action-primary-text underline decoration-dotted underline-offset-2 hover:decoration-solid",
45
+ children: c("bigconsole.kpiChange.retry", "Try again")
46
+ }) })]
47
+ });
48
+ if (!l) return /* @__PURE__ */ y("div", {
49
+ className: k,
50
+ "data-testid": "kpi-change-panel",
51
+ children: /* @__PURE__ */ y("p", {
52
+ className: "text-xs text-text-secondary",
53
+ children: c("bigconsole.kpiChange.empty", "No explanation is available for this card yet.")
54
+ })
55
+ });
56
+ let A = l.movement, j = l.status === "DECLINED", M = [
57
+ ...l.businessFindings,
58
+ ...l.dataIncidentFindings,
59
+ ...l.definitionFindings
60
+ ], N = !j && M.some((e) => e.contributions.length > 0) ? o(l.explainedPercent) : null, P = p(l.status);
61
+ return /* @__PURE__ */ b("div", {
62
+ className: k,
63
+ "data-testid": "kpi-change-panel",
64
+ children: [
65
+ /* @__PURE__ */ b("div", {
66
+ className: "flex flex-wrap items-start justify-between gap-2",
67
+ children: [/* @__PURE__ */ b("div", {
68
+ className: "min-w-0",
69
+ children: [/* @__PURE__ */ y("span", {
70
+ className: "text-[10px] font-medium uppercase tracking-wide text-text-secondary",
71
+ children: c("bigconsole.kpiChange.title", "Why did it move?")
72
+ }), A ? /* @__PURE__ */ y("p", {
73
+ className: "text-sm font-medium text-text-primary",
74
+ children: d(A)
75
+ }) : /* @__PURE__ */ y("p", {
76
+ className: "text-sm font-medium text-text-primary",
77
+ children: c("bigconsole.kpiChange.noMovement", "This card could not be compared.")
78
+ })]
79
+ }), /* @__PURE__ */ y(g, {
80
+ variant: i(l.confidence),
81
+ children: r(l.confidence)
82
+ })]
83
+ }),
84
+ A && /* @__PURE__ */ b("p", {
85
+ className: "text-xs text-text-secondary",
86
+ children: [
87
+ A.previousWindow.label,
88
+ " → ",
89
+ A.currentWindow.label,
90
+ ". ",
91
+ A.comparisonBasis
92
+ ]
93
+ }),
94
+ /* @__PURE__ */ y("p", {
95
+ className: "text-sm leading-relaxed text-text-primary",
96
+ children: l.summary
97
+ }),
98
+ j && l.declineReason && /* @__PURE__ */ y("p", {
99
+ className: "text-xs text-status-warning-text",
100
+ children: l.declineReason
101
+ }),
102
+ P && /* @__PURE__ */ y("p", {
103
+ className: "text-xs text-status-warning-text",
104
+ "data-testid": "kpi-change-status-notice",
105
+ children: P
106
+ }),
107
+ !j && /* @__PURE__ */ b(v, { children: [
108
+ /* @__PURE__ */ y(C, {
109
+ lane: "BUSINESS",
110
+ status: l.status,
111
+ findings: l.businessFindings
112
+ }),
113
+ /* @__PURE__ */ y(C, {
114
+ lane: "DATA_INCIDENT",
115
+ status: l.status,
116
+ findings: l.dataIncidentFindings
117
+ }),
118
+ /* @__PURE__ */ y(C, {
119
+ lane: "DEFINITION",
120
+ status: l.status,
121
+ findings: l.definitionFindings
122
+ })
123
+ ] }),
124
+ N && /* @__PURE__ */ y("p", {
125
+ className: "text-xs text-text-secondary",
126
+ children: N
127
+ }),
128
+ l.limitations.length > 0 && /* @__PURE__ */ b("details", {
129
+ className: "text-xs text-text-secondary",
130
+ "data-testid": "kpi-change-limitations",
131
+ children: [/* @__PURE__ */ b("summary", {
132
+ className: "cursor-pointer font-medium text-text-primary",
133
+ children: [
134
+ c("bigconsole.kpiChange.limitations", "What this explanation cannot show"),
135
+ " (",
136
+ l.limitations.length,
137
+ ")"
138
+ ]
139
+ }), /* @__PURE__ */ y("ul", {
140
+ className: "mt-1 list-disc pl-4",
141
+ children: l.limitations.map((e, t) => /* @__PURE__ */ y("li", {
142
+ className: "mt-0.5",
143
+ children: e
144
+ }, t))
145
+ })]
146
+ }),
147
+ l.summarySource === "MODEL" && /* @__PURE__ */ y("p", {
148
+ className: "text-[10px] text-text-secondary",
149
+ children: c("bigconsole.kpiChange.writtenByModel", "Written by the model from the findings above.")
150
+ }),
151
+ l.summarySource === "DETERMINISTIC" && /* @__PURE__ */ y("p", {
152
+ className: "text-[10px] text-text-secondary",
153
+ children: c("bigconsole.kpiChange.writtenByService", "Assembled from the system’s own records.")
154
+ })
155
+ ]
156
+ });
157
+ }, C = ({ lane: e, status: t, findings: n }) => {
158
+ let { t: r } = _(), i = u(e);
159
+ return /* @__PURE__ */ b("section", {
160
+ className: "flex flex-col gap-1.5",
161
+ "aria-label": i,
162
+ children: [/* @__PURE__ */ y("h3", {
163
+ className: "text-[10px] font-medium uppercase tracking-wide text-text-secondary",
164
+ children: i
165
+ }), n.length === 0 ? /* @__PURE__ */ y("p", {
166
+ className: "text-xs text-text-secondary",
167
+ children: r(`bigconsole.kpiChange.empty.${e}.${t === "PARTIAL" || t === "INCONCLUSIVE" ? "unproven" : "none"}`, a(e, t))
168
+ }) : n.map((e) => /* @__PURE__ */ y(w, { finding: e }, e.id))]
169
+ });
170
+ }, w = ({ finding: t }) => {
171
+ let n = e();
172
+ return /* @__PURE__ */ b("div", {
173
+ className: "rounded-md border border-[var(--color-border-subtle)] bg-bg-surface p-2",
174
+ children: [
175
+ /* @__PURE__ */ b("div", {
176
+ className: "flex flex-wrap items-start justify-between gap-2",
177
+ children: [/* @__PURE__ */ y("p", {
178
+ className: "min-w-0 text-xs font-medium text-text-primary",
179
+ children: t.title
180
+ }), /* @__PURE__ */ y(g, {
181
+ variant: i(t.confidence),
182
+ children: r(t.confidence)
183
+ })]
184
+ }),
185
+ /* @__PURE__ */ y("p", {
186
+ className: "mt-1 text-xs leading-relaxed text-text-secondary",
187
+ children: t.detail
188
+ }),
189
+ t.confidenceReason && /* @__PURE__ */ y("p", {
190
+ className: "mt-1 text-xs text-text-secondary",
191
+ "data-testid": "kpi-change-confidence-reason",
192
+ children: t.confidenceReason
193
+ }),
194
+ t.contributions.length > 0 && /* @__PURE__ */ y("ul", {
195
+ className: "mt-1.5 flex flex-col gap-0.5",
196
+ children: t.contributions.map((e, t) => /* @__PURE__ */ b("li", {
197
+ className: "flex flex-wrap items-baseline justify-between gap-2 text-xs",
198
+ children: [/* @__PURE__ */ y("span", {
199
+ className: "text-text-primary",
200
+ children: e.label
201
+ }), /* @__PURE__ */ b("span", {
202
+ className: "tabular-nums text-text-secondary",
203
+ children: [l(e.absolute), e.percentOfMovement === null ? "" : ` (${c(e.percentOfMovement)})`]
204
+ })]
205
+ }, t))
206
+ }),
207
+ t.evidence.length > 0 && /* @__PURE__ */ b("details", {
208
+ className: "mt-1.5 text-xs",
209
+ "data-testid": "kpi-change-evidence",
210
+ children: [/* @__PURE__ */ y("summary", {
211
+ className: "cursor-pointer text-text-secondary",
212
+ children: `Evidence (${t.evidence.length})`
213
+ }), /* @__PURE__ */ y("ul", {
214
+ className: "mt-1 flex flex-col gap-1",
215
+ children: t.evidence.map((e, t) => {
216
+ let r = f(e.route), i = s(e.occurredAt);
217
+ return /* @__PURE__ */ b("li", {
218
+ className: "text-text-secondary",
219
+ children: [
220
+ /* @__PURE__ */ y("span", {
221
+ className: "text-text-primary",
222
+ children: e.label
223
+ }),
224
+ e.detail ? ` — ${e.detail}` : "",
225
+ i ? ` · ${i}` : "",
226
+ r && /* @__PURE__ */ y("button", {
227
+ type: "button",
228
+ onClick: () => n(r),
229
+ className: "ml-1 text-action-primary-text underline decoration-dotted underline-offset-2 hover:decoration-solid",
230
+ "aria-label": `Open ${e.label}`,
231
+ children: "open"
232
+ })
233
+ ]
234
+ }, t);
235
+ })
236
+ })]
237
+ })
238
+ ]
239
+ });
240
+ };
241
+ export { S as KpiChangePanel, S as default };
@@ -0,0 +1,3 @@
1
+ export { KpiChangeDialog } from './KpiChangeDialog';
2
+ export { KpiChangePanel } from './KpiChangePanel';
3
+ export { canExplainKpiChange, confidenceLabel, confidenceTone, directionLabel, explainedPercentLabel, formatMetricValue, formatSignedPercent, formatSignedValue, laneLabel, movementHeadline, } from './kpiChangeModel';
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Presentation helpers for the "Why did it move?" panel (BOFF-13365).
3
+ *
4
+ * Pure and React-free so the wording and the tone can be unit-tested without
5
+ * a DOM. The panel reads these; nothing here reads data.
6
+ */
7
+ export type KpiChangeLane = 'BUSINESS' | 'DATA_INCIDENT' | 'DEFINITION';
8
+ export type KpiChangeConfidence = 'CONFIRMED' | 'LIKELY' | 'CORRELATION' | 'INSUFFICIENT_EVIDENCE';
9
+ /** The badge variants fe-libs ships; `secondary` is the neutral one. */
10
+ export type ConfidenceTone = 'success' | 'info' | 'secondary' | 'warning';
11
+ /**
12
+ * Whether a card offers the explanation. Only single-value KPI cards can be
13
+ * explained: the analysis compares one metric over two snapshots, so a chart
14
+ * or a multi-KPI card has nothing to compare. The builder stores a metric card
15
+ * as the federated `KPI` type, which maps back to `kpi_card_comparison` unless
16
+ * it kept `_internalWidgetType`, so both are offered.
17
+ *
18
+ * A card with no data source is not offered either: the analysis declines a
19
+ * card with no bound DataSink, and every run is metered against the
20
+ * workspace's command quota, so a sample card must not spend it.
21
+ */
22
+ export interface KpiChangeEligibility {
23
+ /** Whether the card reads a DataSink the analysis can look at. */
24
+ readsDataSink: boolean;
25
+ /** The card's own internal type, when the builder stored one. */
26
+ internalType?: string;
27
+ /** Whether a dashboard or drilldown filter is narrowing the card's data. */
28
+ filtered?: boolean;
29
+ }
30
+ /**
31
+ * Whether a card offers the explanation. Only single-value KPI cards can be
32
+ * explained: the analysis compares one metric over two snapshots, so a chart
33
+ * has nothing to compare.
34
+ *
35
+ * The API returns a metric card as the federated `KPI` type, which maps back
36
+ * to `kpi_card_comparison`. A comparison card shows several independently
37
+ * identified metrics and the request carries only the card, so there is no
38
+ * way to say which one to explain — only a card the builder stored as a
39
+ * single-value metric card is offered.
40
+ */
41
+ export declare function canExplainKpiChange(type: string, previewOnly: boolean, eligibility?: KpiChangeEligibility): boolean;
42
+ export interface KpiChangeBinding {
43
+ /** The kind of source the card reads. */
44
+ kind: string;
45
+ /** The managed DataSink reference, when there is one. */
46
+ ref?: string;
47
+ /** The card's parser, whose input sink the analysis reads. */
48
+ parserId?: string | null;
49
+ /** The card's own DataSink. */
50
+ dataSinkId?: string | null;
51
+ /** A DataSink the card names by key. */
52
+ dataSinkKey?: string | null;
53
+ }
54
+ /**
55
+ * Whether the card reads a DataSink the analysis can look at.
56
+ *
57
+ * The analysis compares two snapshots of a DataSink, so a card bound to a
58
+ * REST, GraphQL, SQL or WebSocket source cannot be explained — and every run
59
+ * is metered against the workspace's command quota.
60
+ */
61
+ export declare function readsAnalyzableSource(binding: KpiChangeBinding): boolean;
62
+ /** A signed number, e.g. "+120" or "-30.5". */
63
+ export declare function formatSignedValue(value: number | null | undefined): string;
64
+ /** A percentage with its sign, e.g. "+18%". */
65
+ export declare function formatSignedPercent(value: number | null | undefined): string;
66
+ /** A plain number for a metric value, e.g. "1,180". */
67
+ export declare function formatMetricValue(value: number | null | undefined): string;
68
+ /** The badge variant for a confidence level. */
69
+ export declare function confidenceTone(confidence: string): ConfidenceTone;
70
+ /** The word shown on a confidence badge. */
71
+ export declare function confidenceLabel(confidence: string): string;
72
+ /** The heading of a lane. */
73
+ export declare function laneLabel(lane: KpiChangeLane): string;
74
+ /** The word used for the direction of the movement. */
75
+ export declare function directionLabel(direction: string): string | null;
76
+ /**
77
+ * The headline of the movement: how much it moved, between which two
78
+ * snapshots. Never claims a calendar period the analysis did not measure.
79
+ */
80
+ export declare function movementHeadline(movement: {
81
+ metricName: string;
82
+ previousValue: number | null;
83
+ currentValue: number | null;
84
+ absoluteChange: number | null;
85
+ percentChange: number | null;
86
+ direction: string;
87
+ unit: string | null;
88
+ }): string;
89
+ /** The share of the movement the quantified findings account for, as a sentence. */
90
+ export declare function explainedPercentLabel(explainedPercent: number | null | undefined): string | null;
91
+ /**
92
+ * A caveat for an analysis that ended short of a full explanation, or null.
93
+ * PARTIAL and INCONCLUSIVE must not read as a clean result: an empty lane then
94
+ * means "nothing was recorded", not "nothing happened".
95
+ */
96
+ export declare function statusNotice(status: string): string | null;
97
+ /** What an empty lane says, given how the analysis ended. */
98
+ export declare function emptyLaneText(lane: KpiChangeLane, status: string): string;
99
+ /**
100
+ * The BigConsole route an evidence record points at, as a path the
101
+ * base-path-aware navigator can take, or null when the route is not a plain
102
+ * BigConsole path. Evidence routes come from the server, so anything else
103
+ * (another origin, a protocol, a protocol-relative `//`, dot segments) is not
104
+ * made into a link.
105
+ */
106
+ export declare function safeEvidenceRoute(route: string | null | undefined): string | null;
107
+ /** An evidence date as `YYYY-MM-DD UTC`, or null when the server's timestamp is not a date. */
108
+ export declare function formatEvidenceDate(value: string | null | undefined): string | null;
109
+ /**
110
+ * Plain wording for a failed analysis. The raw client error is never shown:
111
+ * it can carry internal detail, and a quota or access failure deserves its own
112
+ * explanation.
113
+ */
114
+ export declare function describeKpiChangeError(error: unknown): string;
@@ -0,0 +1,89 @@
1
+ import { classifyBigConsoleQuotaError as e } from "../../utils/quota.js";
2
+ // src/bigconsole/components/kpi-change/kpiChangeModel.ts
3
+ function t(e, t, n = { readsDataSink: !0 }) {
4
+ return t || !n.readsDataSink || n.filtered ? !1 : e === "metric_card" || e === "kpi_card_comparison" && n.internalType === "metric_card";
5
+ }
6
+ function n(e) {
7
+ return e.kind === "DATASINK" && !!(e.ref || e.dataSinkId || e.parserId || e.dataSinkKey);
8
+ }
9
+ function r(e) {
10
+ if (e == null || !Number.isFinite(e)) return "—";
11
+ let t = Math.round(e * 100) / 100;
12
+ return `${t > 0 ? "+" : ""}${t.toLocaleString("en-US")}`;
13
+ }
14
+ function i(e) {
15
+ if (e == null || !Number.isFinite(e)) return "—";
16
+ let t = Math.round(e * 10) / 10;
17
+ return `${t > 0 ? "+" : ""}${t.toLocaleString("en-US")}%`;
18
+ }
19
+ function a(e) {
20
+ return e == null || !Number.isFinite(e) ? "—" : e.toLocaleString("en-US", { maximumFractionDigits: 2 });
21
+ }
22
+ function o(e) {
23
+ switch (e) {
24
+ case "CONFIRMED": return "success";
25
+ case "LIKELY": return "info";
26
+ case "INSUFFICIENT_EVIDENCE": return "warning";
27
+ default: return "secondary";
28
+ }
29
+ }
30
+ function s(e) {
31
+ switch (e) {
32
+ case "CONFIRMED": return "Confirmed cause";
33
+ case "LIKELY": return "Likely factor";
34
+ case "CORRELATION": return "Correlation only";
35
+ case "INSUFFICIENT_EVIDENCE": return "Not enough evidence";
36
+ default: return "Unrated";
37
+ }
38
+ }
39
+ function c(e) {
40
+ switch (e) {
41
+ case "BUSINESS": return "Business change";
42
+ case "DATA_INCIDENT": return "Data incidents";
43
+ default: return "Definition changes";
44
+ }
45
+ }
46
+ function l(e) {
47
+ return e === "UP" ? "up" : e === "DOWN" ? "down" : e === "FLAT" ? "unchanged" : null;
48
+ }
49
+ function u(e) {
50
+ let t = e.unit ? ` ${e.unit}` : "", n = e.percentChange !== null && e.percentChange !== void 0 ? ` (${i(e.percentChange)})` : "", o = `from ${a(e.previousValue)}${t} to ${a(e.currentValue)}${t}`, s = l(e.direction);
51
+ return s === "unchanged" ? `${e.metricName} is unchanged, ${o}.` : s === null ? `${e.metricName} changed ${r(e.absoluteChange)}${n}, ${o}.` : `${e.metricName} is ${s} ${r(e.absoluteChange)}${n}, ${o}.`;
52
+ }
53
+ function d(e) {
54
+ return e == null || !Number.isFinite(e) ? null : `${Math.round(Math.min(100, Math.max(0, e)))}% of the change is accounted for by the split above.`;
55
+ }
56
+ function f(e) {
57
+ switch (e) {
58
+ case "PARTIAL": return "The analysis covers only part of this movement. Treat the findings below as incomplete.";
59
+ case "INCONCLUSIVE": return "The analysis could not establish what moved this number. An empty section below means nothing was recorded, not that nothing happened.";
60
+ case "UNCHANGED": return "The value did not change between the two snapshots.";
61
+ default: return null;
62
+ }
63
+ }
64
+ function p(e, t) {
65
+ if (t === "PARTIAL" || t === "INCONCLUSIVE") return "No finding was recorded.";
66
+ switch (e) {
67
+ case "BUSINESS": return "No business driver could be identified from the rows behind this card.";
68
+ case "DATA_INCIDENT": return "No ingestion incident was identified in this window.";
69
+ default: return "No definition change was identified in this window.";
70
+ }
71
+ }
72
+ function m(e) {
73
+ if (!e || !/^\/bigconsole\/[A-Za-z0-9_\-/]*(\?[A-Za-z0-9_\-=&%.]*)?$/.test(e)) return null;
74
+ let t = e.split("?")[0];
75
+ return t.includes("//") || t.includes("..") ? null : e.slice(11);
76
+ }
77
+ function h(e) {
78
+ if (!e) return null;
79
+ let t = new Date(e);
80
+ return Number.isNaN(t.getTime()) ? null : `${t.toISOString().slice(0, 10)} UTC`;
81
+ }
82
+ function g(t) {
83
+ let n = e(t, "command");
84
+ if (n?.kind === "billing-setup") return "Billing is not set up for this organization, so the analysis was not run.";
85
+ if (n) return "The workspace has used up its command quota, so the analysis was not run.";
86
+ let r = (t instanceof Error ? t.message : String(t ?? "")).toLowerCase();
87
+ return r.includes("quota") ? "The workspace has used up its command quota, so the analysis was not run." : r.includes("forbidden") || r.includes("not authorized") || r.includes("permission") ? "You do not have access to explain this card." : r.includes("failed to fetch") || r.includes("network") ? "The analysis could not reach the server. Check the connection and try again." : "The change explanation failed. Please try again.";
88
+ }
89
+ export { t as canExplainKpiChange, s as confidenceLabel, o as confidenceTone, g as describeKpiChangeError, l as directionLabel, p as emptyLaneText, d as explainedPercentLabel, h as formatEvidenceDate, a as formatMetricValue, i as formatSignedPercent, r as formatSignedValue, c as laneLabel, u as movementHeadline, n as readsAnalyzableSource, m as safeEvidenceRoute, f as statusNotice };
@@ -196,7 +196,8 @@ function j({ dashboardId: e, live: t, expectedWidgetId: n }) {
196
196
  children: /* @__PURE__ */ v(i, {
197
197
  widget: e,
198
198
  error: null,
199
- filterValues: {}
199
+ filterValues: {},
200
+ observeOnly: !0
200
201
  })
201
202
  }, e.id))]
202
203
  }) : /* @__PURE__ */ v(C, {
@@ -45,6 +45,10 @@ export interface WidgetHeaderProps {
45
45
  explainOpen?: boolean;
46
46
  /** Open the Reconcile dialog for this KPI card (BOFF-14093) */
47
47
  onReconcile?: () => void;
48
+ /** Open the "Why did it move?" explanation for this KPI card (BOFF-13365) */
49
+ onWhyDidItMove?: () => void;
50
+ /** Whether the change explanation panel is currently open */
51
+ whyDidItMoveOpen?: boolean;
48
52
  }
49
53
  export declare const WidgetHeader: FC<WidgetHeaderProps>;
50
54
  export default WidgetHeader;