@opencxh/domain 1.280.0 → 1.282.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.
@@ -1,6 +1,7 @@
1
+ import { SavedView } from '../saved-view/types';
1
2
  import { OwnerScope } from '../scope/types';
2
3
  import { DimensionId } from './dimensions';
3
- import { WidgetConfig } from './report';
4
+ import { FilterClause, WidgetConfig } from './report';
4
5
  /**
5
6
  * A dashboard SECTION, declaratively. The analytics frontend runs the right widget(s) for the viz and
6
7
  * renders the matching component. `title` and the parent def's `title` are i18n keys resolved against the
@@ -20,6 +21,12 @@ export interface DashboardSection {
20
21
  metricIds: string[];
21
22
  /** Row dimension for bar/table (line/heatmap imply the time axis). */
22
23
  groupBy?: DimensionId;
24
+ /**
25
+ * column only: stack the series into one bar per period. Only the source can
26
+ * say its series add up to a whole (answered + missed = offered); two
27
+ * unrelated counts stacked would draw a total that means nothing.
28
+ */
29
+ stacked?: boolean;
23
30
  }
24
31
  /**
25
32
  * A preset dashboard shipped by an owning app (or by analytics for cross-source ones). Discovered like
@@ -55,3 +62,17 @@ export interface DashboardConfig {
55
62
  createdAt?: number;
56
63
  updatedAt?: number;
57
64
  }
65
+ /** What a report view keeps: the window as the URL writes it (`30d`, `2026-08-01~2026-08-31`) and the filters. */
66
+ export interface ReportViewFilters {
67
+ period: string;
68
+ clauses: FilterClause[];
69
+ }
70
+ /**
71
+ * A saved report view: a preset dashboard with a period and filters, under a name. The shared
72
+ * `SavedView` shape; `layout` is always `"report"` and the dashboard rides in its own column,
73
+ * because the list of dashboards is discovered, not fixed.
74
+ */
75
+ export type ReportView = SavedView<ReportViewFilters, "report"> & {
76
+ dashboardKey: string;
77
+ };
78
+ export declare const REPORT_VIEW_LAYOUTS: readonly ["report"];
@@ -1,3 +1,4 @@
1
+ import { SlaMetric } from '../sla/types';
1
2
  import { DimensionId } from './dimensions';
2
3
  /**
3
4
  * Metric register — the declarative building block. Fixed in code as a typed `const` in the owning app
@@ -8,6 +9,20 @@ import { DimensionId } from './dimensions';
8
9
  */
9
10
  export type MetricValueType = "count" | "duration_ms" | "percent" | "currency";
10
11
  export type MetricAggregation = "sum" | "avg" | "rate" | "distinct" | "p50" | "p90" | "min" | "max";
12
+ /**
13
+ * Which direction of change is good news. `neutral` is for volume: more
14
+ * conversations is more work, not better work, so its delta stays grey.
15
+ */
16
+ export type MetricPolarity = "higher" | "lower" | "neutral";
17
+ /**
18
+ * Where the goal for a metric lives. Only SLA targets today: the minutes an SLA
19
+ * profile sets for one of its metrics. A report shows the goal only when exactly
20
+ * one profile applies — picking between several would be a guess.
21
+ */
22
+ export type MetricTarget = {
23
+ kind: "sla";
24
+ metric: SlaMetric;
25
+ };
11
26
  export interface MetricDefinition {
12
27
  /**
13
28
  * Globally-unique, app-namespaced id: "<source>.<family>.<name>", e.g. "comms.reply_time.first",
@@ -35,4 +50,8 @@ export interface MetricDefinition {
35
50
  description?: string;
36
51
  /** Hidden from the picker (e.g. a numerator/denominator base metric of a rate). */
37
52
  hidden?: boolean;
53
+ /** Good direction for a delta. Omitted = the analytics app guesses from id and aggregation. */
54
+ polarity?: MetricPolarity;
55
+ /** The goal this metric is measured against, if any (a duration metric against an SLA target). */
56
+ target?: MetricTarget;
38
57
  }