react-semaphor 0.1.571 → 0.1.573

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.
Files changed (42) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/assistant-protocol/index.js +62 -59
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/{model-change-T1cRkh3m.js → add-to-dashboard-B6Ah8Lub.js} +121 -84
  5. package/dist/chunks/{assistant-chat-SkCraw2C.js → assistant-chat-D95DtCj7.js} +2398 -2300
  6. package/dist/chunks/{bookmark-impact-DCYD-6Fr.js → bookmark-impact-DUWw3wlA.js} +2 -2
  7. package/dist/chunks/{bookmark-state-CflS88gq.js → bookmark-state-BEl_G9vr.js} +54 -54
  8. package/dist/chunks/{card-filter-builder-D-aSYpyr.js → card-filter-builder-B3bEPylu.js} +54 -54
  9. package/dist/chunks/{dashboard-B_w_ekUz.js → dashboard-DdALjmc3.js} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-_g1m2tJ3.js → dashboard-briefing-launcher-D2vevpyl.js} +923 -956
  11. package/dist/chunks/{dashboard-controls-CY0gbcCt.js → dashboard-controls-DxrsGK9A.js} +103 -103
  12. package/dist/chunks/{dashboard-json-DsM79yem.js → dashboard-json-rwds0HjB.js} +1 -1
  13. package/dist/chunks/{dates-RSEzJ9N7.js → dates-DlYMDaF2.js} +5 -5
  14. package/dist/chunks/{edit-dashboard-visual-cX0FM-4i.js → edit-dashboard-visual-BCDz5HOb.js} +1354 -1317
  15. package/dist/chunks/{filter-reach-copy-thzt25Rc.js → filter-reach-copy-BTAXnbwQ.js} +9 -9
  16. package/dist/chunks/{index-y3HUzRNk.js → index-8BxDk8EP.js} +2 -2
  17. package/dist/chunks/{report-preferences-dialog-B_GXs91t.js → report-preferences-dialog-D9nBczmk.js} +725 -801
  18. package/dist/chunks/{resolve-dashboard-input-context-Lkbwycwe.js → resolve-dashboard-input-context-DBFuNhZo.js} +3961 -3923
  19. package/dist/chunks/{saved-dashboard-context-DC_TEd6y.js → saved-dashboard-context-AChHk4tw.js} +3 -3
  20. package/dist/chunks/{semaphor-ready-indicator-CBQamwQY.js → semaphor-ready-indicator-BdOAS4Uw.js} +25293 -24700
  21. package/dist/chunks/{shelf-drop-preview-context-Bkjf0XXw.js → shelf-drop-preview-context-B1goDUYE.js} +259 -259
  22. package/dist/chunks/{stored-dashboard-C0hekXiI.js → stored-dashboard-rpLzf4mk.js} +231 -231
  23. package/dist/chunks/{variable-draft-DvglU8yj.js → variable-draft-DPSMDwqt.js} +2 -2
  24. package/dist/dashboard/index.js +2 -2
  25. package/dist/dashboard-authoring/index.js +1381 -1368
  26. package/dist/index.js +147 -147
  27. package/dist/style.css +1 -1
  28. package/dist/surfboard/index.js +2 -2
  29. package/dist/types/components/dashboard/summary-card.d.ts +5 -0
  30. package/dist/types/index.js +1 -1
  31. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +12 -0
  32. package/dist/types/lib/types/explorer-types.d.ts +6 -0
  33. package/dist/types/shared/assistant-protocol/model-change.d.ts +52 -1
  34. package/dist/types/shared/assistant-protocol/parts.d.ts +49 -2
  35. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +5 -0
  36. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  37. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -0
  38. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +2 -0
  39. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  40. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +4 -0
  41. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +38 -0
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-B_GXs91t.js";
2
- import { C as f, E as D } from "../chunks/bookmark-state-CflS88gq.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-D9nBczmk.js";
2
+ import { C as f, E as D } from "../chunks/bookmark-state-BEl_G9vr.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
5
5
  a as DisplayFormatPreferencesFields,
@@ -5,6 +5,11 @@ export declare function SummaryIncompleteHint({ className, message, showLabel, }
5
5
  message?: string;
6
6
  showLabel?: boolean;
7
7
  }): import("react").JSX.Element;
8
+ /** The summary's narrative, its headline change highlighted; the KPI tile's drivers popover shows it too (KPI tile layout KL-D26). */
9
+ export declare function NarrativeSection({ data, formatter, }: {
10
+ data: Omit<SummaryResponse, 'cardSummaries'>;
11
+ formatter: SummaryNumberFormatter;
12
+ }): import("react").JSX.Element | null;
8
13
  type SummaryDetailsProps = {
9
14
  data: Omit<SummaryResponse, 'cardSummaries'>;
10
15
  applyAction: (action: SummaryAction) => void | Promise<void>;
@@ -1,4 +1,4 @@
1
- import { B as t, y as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, x as p, w as D, l as A, h as I, o as _, v as F, u as S, m as b, n as L, p as f, k as N, q as y, s as R, i as h, r as g, t as x } from "../chunks/bookmark-state-CflS88gq.js";
1
+ import { B as t, y as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, x as p, w as D, l as A, h as I, o as _, v as F, u as S, m as b, n as L, p as f, k as N, q as y, s as R, i as h, r as g, t as x } from "../chunks/bookmark-state-BEl_G9vr.js";
2
2
  import { C as O, D as V, L as w, d as U, g as k, e as z, h as B, f as K, c as v, a as Y, i as q, b as G, n as P, s as Q } from "../chunks/validators-B8fpdinG.js";
3
3
  import { D as j } from "../chunks/token-types-iKMplaBL.js";
4
4
  import { r as X, a as H } from "../chunks/pivot-result-identity-B89X5xjb.js";
@@ -5,6 +5,18 @@ import { ResolvedValueFormatPreferences } from '../../shared/value-format-prefer
5
5
  export type KpiNumberFormatter = {
6
6
  format: (value: number | null) => string;
7
7
  formatSigned: (value: number | null) => string;
8
+ /**
9
+ * The value shortened by its magnitude (22.42M, $1.28B), with at most
10
+ * `maximumFractionDigits`, in the column's own format: for a tile too narrow
11
+ * for the full value (KPI tile layout KL-D5). One rule decides when a value
12
+ * has a short form, so shortening never changes what it says: only a value
13
+ * of 1,000 or more, in a number or currency format that is not scaled.
14
+ * Undefined otherwise: a smaller value (shortening it would only drop
15
+ * decimals, and could show a nonzero value as 0), a percent or scientific
16
+ * value, a scaled format (which already names its unit), a date or a
17
+ * duration. Such a value fits by size alone.
18
+ */
19
+ formatCompact: (value: number | null, maximumFractionDigits: number) => string | undefined;
8
20
  supportsComparisonDeltaInheritance: boolean;
9
21
  /** The KPI's active format, for the comparison indicator's own fallback text. */
10
22
  formatOptions?: TFormatOptions;
@@ -619,6 +619,12 @@ export interface CardConfig {
619
619
  includeInDashboardSummary?: boolean;
620
620
  breakdownDimensions?: GroupByField[];
621
621
  };
622
+ /**
623
+ * A KPI's band (KPI tile layout KL-D29): `trend` shows the value's last
624
+ * periods under it, `none` shows nothing; absent, the band follows the
625
+ * card's summary and target. Written by `writeKpiBand`.
626
+ */
627
+ kpiBand?: 'trend' | 'none';
622
628
  rowAggregates?: Array<{
623
629
  label?: string;
624
630
  function: AggregateFunction;
@@ -5,15 +5,66 @@
5
5
  * reads these words, never the store's messages (written for agents) and
6
6
  * never the product's name (AJ-INV-8).
7
7
  */
8
- /** `POST /api/v1/assistant/proposals/{proposalId}/apply`, answered 200: the relationship is in the domain (or already was). */
8
+ /**
9
+ * What became of one link at the click (assistant relationship changes
10
+ * RC-D3): added, already in the model, left out (not ticked), or not added
11
+ * for a reason the panel words itself.
12
+ */
13
+ export type AssistantModelChangeLinkOutcome = {
14
+ status: 'added' | 'existing' | 'left_out';
15
+ } | {
16
+ status: 'refused';
17
+ reasons: AssistantModelChangeRefusalReason[];
18
+ };
19
+ /** Why a link wasn't added, as a code (the app's `RelationshipRefusalReason`). */
20
+ export type AssistantModelChangeRefusalReason = 'exists' | 'missing_fields' | 'type_mismatch' | 'not_supported';
21
+ /**
22
+ * The apply route's body: the ticked links by index, every link when absent
23
+ * (RC-D4); and the conversation the block is in, where the outcome is
24
+ * recorded (RC-D12). The dismiss route takes the conversation only.
25
+ */
26
+ export type AssistantModelChangeApplyRequest = {
27
+ links?: number[];
28
+ conversationId?: string;
29
+ };
30
+ /** `POST /api/v1/assistant/proposals/{proposalId}/dismiss`, answered 200: Not now is recorded on the conversation (RC-D12). */
31
+ export type AssistantModelChangeDismissed = {
32
+ dismissed: true;
33
+ };
34
+ /**
35
+ * The dismiss route's refusal (rules R2): `already_applied` with each link's
36
+ * outcome when they were added after all; `apply_in_progress` or
37
+ * `apply_outcome_unknown` while that isn't known; another code when it
38
+ * couldn't be saved.
39
+ */
40
+ export type AssistantModelChangeDismissRefusal = {
41
+ code: string;
42
+ message: string;
43
+ links?: AssistantModelChangeLinkOutcome[];
44
+ };
45
+ /** `POST /api/v1/assistant/proposals/{proposalId}/apply`, answered 200: one outcome per link, in order. */
9
46
  export type AssistantModelChangeApplied = {
10
47
  applied: true;
11
48
  replayed: boolean;
49
+ links: AssistantModelChangeLinkOutcome[];
12
50
  };
13
51
  /** The route's refusal body: a change store code and the store's message (for logs, not for the person). */
14
52
  export type AssistantModelChangeRefusal = {
15
53
  code: string;
16
54
  message: string;
17
55
  };
56
+ /**
57
+ * One link's outcome in words, for the next turn's note and the copied
58
+ * conversation alike (RC-INV-4: the two say the same; review CO-08).
59
+ */
60
+ export declare function modelChangeLinkOutcomeWords(outcome: AssistantModelChangeLinkOutcome | undefined, domainLabel: string): string;
61
+ /** The words after "Not added: " for a link refused at the click. */
62
+ export declare function modelChangeLinkRefusal(reasons: readonly AssistantModelChangeRefusalReason[], domainLabel: string): string;
63
+ /**
64
+ * Whether a stored refusal leaves it unclear that nothing was added: an
65
+ * earlier apply started and never reported back, so the links may be in the
66
+ * model. The note and the copy say so instead of "not added" (RC-INV-4).
67
+ */
68
+ export declare function modelChangeOutcomeUnclear(code: string): boolean;
18
69
  /** The panel's words for a refusal code; any other code (a validation failure, a server error) is "couldn't be added". */
19
70
  export declare function modelChangeRefusalMessage(code: unknown): string;
@@ -1,3 +1,4 @@
1
+ import { AssistantModelChangeLinkOutcome } from './model-change.js';
1
2
  import { SemaphorDialect, SemaphorSourceRef } from '../analytics-protocol/contracts.js';
2
3
  import { AssistantArtifact } from './artifact.js';
3
4
  import { ChangeDiagnostic } from '../dashboard-authoring/changes/diagnostics.js';
@@ -93,12 +94,58 @@ export type AssistantModelChangePart = {
93
94
  kind: 'model_change';
94
95
  proposalId: string;
95
96
  domainId: string;
96
- /** The domain's label: "Every dashboard on the {domainLabel} domain can use it." */
97
+ /** The domain's label: "In {domainLabel}: every dashboard on it can use these." */
97
98
  domainLabel: string;
98
- /** One per change (`relationship.add`) and its sentence, as propose returned them. */
99
+ /** One per change (`relationship.add`) and its sentence, as propose returned them; the copy reads these. */
99
100
  changes: AssistantProposalChange[];
101
+ /**
102
+ * The same links, structured for the block's rows (assistant relationship
103
+ * changes RC-D5), in the order of `changes`. A part stored before them has
104
+ * none, and its block shows the sentences (RC-INV-5).
105
+ */
106
+ links?: AssistantModelChangeLink[];
107
+ /**
108
+ * The step the assistant takes once the links are in, in the person's
109
+ * words (RC-D9): the Added footer's button sends it as their message.
110
+ */
111
+ nextStep?: string;
112
+ /**
113
+ * What became of the block, written onto the stored part by the apply and
114
+ * dismiss routes (RC-D12): the block shows it, live and reopened, and the
115
+ * next turn reads it (RC-D13, RC-INV-4). None while it is offered.
116
+ */
117
+ outcome?: AssistantModelChangeOutcome;
100
118
  warnings: ChangeDiagnostic[];
101
119
  };
120
+ /**
121
+ * Added (each link's outcome, in order), Not now, or a click the route
122
+ * refused for good (expired, the model changed during the add, an outcome it
123
+ * can't tell, no permission), by its code, so the block, the copy and the
124
+ * next turn say the same (RC-D12, review P3-07).
125
+ */
126
+ export type AssistantModelChangeOutcome = {
127
+ status: 'applied';
128
+ links: AssistantModelChangeLinkOutcome[];
129
+ } | {
130
+ status: 'dismissed';
131
+ } | {
132
+ status: 'refused';
133
+ code: string;
134
+ };
135
+ /** One relationship of a model change, as its row names it (RC-D6). */
136
+ export type AssistantModelChangeLink = {
137
+ /** The many side. */
138
+ from: AssistantModelChangeEnd;
139
+ /** The key side. */
140
+ to: AssistantModelChangeEnd;
141
+ cardinality: 'many_to_one' | 'one_to_one';
142
+ defaultJoinType: 'LEFT' | 'INNER';
143
+ };
144
+ export type AssistantModelChangeEnd = {
145
+ dataset: string;
146
+ label: string;
147
+ fields: string[];
148
+ };
102
149
  /**
103
150
  * A question the person answers with a click, ending the answer (ledger
104
151
  * D3d-1): the model's alternatives as data, never parsed from its text. Each
@@ -28,6 +28,11 @@ export declare function writeChartOrientation<T extends Pick<TCard, 'type' | 'pr
28
28
  * turns the chart flips its axes (CA-D22).
29
29
  */
30
30
  export declare function writeCardVariant<T extends Pick<TCard, 'type' | 'preferences'>>(card: T, variant: CardVariant): T;
31
+ /**
32
+ * A KPI's band (KPI tile layout KL-D29), as the KPI settings' band control
33
+ * writes it: `trend` or `none`, or null for Automatic, which stores nothing.
34
+ */
35
+ export declare function writeKpiBand<T extends Pick<TCard, 'config'>>(card: T, band: 'trend' | 'none' | null): T;
31
36
  /** A config table's total row on or off, as the table settings' toggle writes it. */
32
37
  export declare function writeTotalsRow(preferences: TCardPreferences | undefined, row: boolean): TCardPreferences;
33
38
  /**
@@ -1,6 +1,6 @@
1
1
  import { TCard } from '../../../lib/types/common-types.js';
2
2
  import { CardType } from '../changes/card-types.js';
3
- export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'inheritComparison';
3
+ export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'inheritComparison' | 'band';
4
4
  export declare const SETTINGS_BY_KIND: Readonly<Record<CardType, readonly SettingName[]>>;
5
5
  export type CardSettingsKind = {
6
6
  type: CardType;
@@ -65,6 +65,8 @@ export type CardSettingsInput = {
65
65
  comparisonDisplay?: ComparisonDisplayInput;
66
66
  /** false: measures without a comparison of their own ignore the dashboard's; true removes the stored opt-out (RC-D16). */
67
67
  inheritComparison?: boolean;
68
+ /** A KPI's band (KPI tile layout KL-D29): `trend` needs a Trend By; `automatic` follows the summary and target. */
69
+ band?: 'automatic' | 'trend' | 'none';
68
70
  };
69
71
  /** The filter operators (CA-D11): formatting and filtering share one condition language. */
70
72
  export type HighlightCondition = {
@@ -48,4 +48,6 @@ export type ResolvedCardSettings = {
48
48
  comparisonDisplay?: ResolvedComparisonDisplay;
49
49
  /** Whether measures without a comparison of their own follow the dashboard's (RC-D16). */
50
50
  inheritComparison?: boolean;
51
+ /** A KPI's band (KL-D29); null returns it to Automatic. */
52
+ band?: 'trend' | 'none' | null;
51
53
  };
@@ -151,6 +151,7 @@ export declare const CARD_CONFIG_KEY_CLASSES: {
151
151
  readonly rowLimit: "query";
152
152
  readonly detailTableBackup: "presentation";
153
153
  readonly summary: "presentation";
154
+ readonly kpiBand: "presentation";
154
155
  readonly rowAggregates: "presentation";
155
156
  readonly columnAggregates: "presentation";
156
157
  };
@@ -6184,11 +6184,15 @@ export declare function buildProposeChangeInputSchema(caller: ProposeChangeCalle
6184
6184
  }[];
6185
6185
  }>;
6186
6186
  };
6187
+ /** The longest next step a relationship proposal may name (RC-D9). */
6188
+ export declare const MAX_NEXT_STEP_CHARS = 80;
6187
6189
  export type ProposeChangeInput = {
6188
6190
  projectId?: string;
6189
6191
  dashboardId?: string;
6190
6192
  create?: CreateTarget;
6191
6193
  domainId?: string;
6194
+ /** On screen, with relationship.add: the step taken once they are added (RC-D9). */
6195
+ then?: string;
6192
6196
  changes: ProposedChange[];
6193
6197
  saveAs?: 'original' | 'copy';
6194
6198
  preview?: 'sample' | 'rows' | 'none';
@@ -2,6 +2,7 @@ import { TCard } from '../../lib/types/common-types.js';
2
2
  import { CardConfig, MetricField } from '../../lib/types/explorer-types.js';
3
3
  import { ComparisonMetadataMap } from '../../lib/types/query-types.js';
4
4
  import { MetricComparisonEvaluation, MetricComparisonPolarity } from '../analytics-protocol/index.js';
5
+ import { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
5
6
  type KpiCard = Pick<TCard, 'sql' | 'config' | 'preferences'>;
6
7
  /**
7
8
  * Which column is the value, by source. The shape reads ids, never formats, so
@@ -56,16 +57,51 @@ export declare function resolveKpiLayout(input: {
56
57
  /**
57
58
  * A config KPI's result rows. Every row names its measure; `current` is a
58
59
  * measure's value and `comparison` its prior or target, in every branch.
60
+ * `trend` rows are the value's per-period values when the card shows a trend
61
+ * (KPI tile layout KL-D28), one per period, each naming its period as the
62
+ * canonical bucket every grouped date uses, in the calendar the response's
63
+ * `trend` metadata names (ledger H-4).
59
64
  */
60
65
  export type KpiResultSegment = {
61
66
  segment: 'current' | 'comparison';
62
67
  value: number | string | null;
63
68
  metricId: string;
69
+ } | {
70
+ segment: 'trend';
71
+ /** Null for a period with no rows: a gap, never a zero. */
72
+ value: number | null;
73
+ metricId: string;
74
+ /** The period's start as a canonical bucket value: `2026-10-01`, or `2026-10-01T14:00:00` below a day. */
75
+ bucket: string;
76
+ /** The point covers less than its whole period: cut by the value's window, or still running. */
77
+ partial?: boolean;
78
+ };
79
+ /** How many periods a trend shows (KL-D28). */
80
+ export declare const KPI_TREND_PERIODS = 12;
81
+ /** A config KPI's Trend By: its date grouping, the field its comparison and trend run over. */
82
+ export declare function kpiTrendBy(config: Pick<CardConfig, 'groupByColumns'> | undefined): import('../../components/index.js').GroupByField | undefined;
83
+ /**
84
+ * Whether a config KPI shows a trend under its value (KL-D29): the author
85
+ * chose Trend and it has a Trend By. The server runs the trend query and the
86
+ * tile draws the band on the same answer.
87
+ */
88
+ export declare function kpiShowsTrend(card: Pick<TCard, 'sql' | 'config'>): boolean;
89
+ export type KpiTrendPoint = {
90
+ bucket: string;
91
+ value: number | null;
92
+ partial: boolean;
93
+ };
94
+ /** The trend's points, oldest first, and the grain and calendar they are counted in. */
95
+ export type KpiTrend = {
96
+ metadata: TemporalBucketMetadata;
97
+ points: KpiTrendPoint[];
64
98
  };
65
99
  /** The metadata a config KPI response carries beside its rows. */
66
100
  export type KpiResultMetadata = {
67
101
  kpiLayout: KpiLayout;
68
102
  comparisonMetadata?: ComparisonMetadataMap;
103
+ /** The trend's grain and calendar, when the response has trend rows (KL-D28). */
104
+ trend?: TemporalBucketMetadata;
69
105
  };
70
106
  /** The id a row names its measure by (`id`, else `name`): the server writes it, the owner reads it. */
71
107
  export declare function kpiSegmentMetricId(metric: Pick<MetricField, 'id' | 'name'>): string;
@@ -102,6 +138,8 @@ export type KpiFigure = {
102
138
  value?: string;
103
139
  previous?: string;
104
140
  };
141
+ /** The value's per-period values, when the card shows a trend and the response has them (KL-D28). */
142
+ trend?: KpiTrend;
105
143
  };
106
144
  type KpiRecords = readonly Record<string, unknown>[] | null | undefined;
107
145
  /** A finite number from a numeric value or a numeric string (thousands commas allowed). */
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.571",
8
+ "version": "0.1.573",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",