@liiift-studio/sanity-visitor-insights 0.24.0 → 0.26.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/dist/index.d.mts CHANGED
@@ -3,38 +3,6 @@ import React from 'react';
3
3
  import { R as ReportEnvelope, a as ReportName, b as RangeKey, M as MetricValue, A as AcquisitionData, c as MeasurementHealthData, D as DiagnosticReport, J as JourneyData, T as TypefaceInterestData } from './ranges-BUZuS1c-.mjs';
4
4
  export { C as CaptureBasis, d as CaptureEstimate, e as CaptureModel, f as CheckStatus, g as Coverage, h as CrossSourceDay, i as DailyPoint, j as DateRange, k as DiagnosticCheck, E as EmailCampaign, l as EventCutover, m as JourneyOutcome, n as JourneyStep, L as LandingPage, o as LicenceTierRow, P as PREEXISTING, p as REPORT_NAMES, q as ReportError, S as SiteAnalyticsConfig, r as SourceName, s as SourceRow, t as SourceStatus, u as TimelineEvent, v as TypefaceInterestRow, U as UnavailableReason, w as coverageForRange, x as estimated, y as isReportName, z as ok, B as partial, F as previousRange, G as resolveRange, H as unavailable, I as validateSiteConfig, K as valueOrNull } from './ranges-BUZuS1c-.mjs';
5
5
 
6
- /**
7
- * The Visitor Insights Studio tool.
8
- *
9
- * One range control drives every panel, implemented once here as a proper radiogroup with
10
- * roving tabindex — repeating a bespoke toggle per panel is how keyboard behaviour ends up
11
- * inconsistent between them.
12
- */
13
-
14
- /** Options supplied by the plugin config, carried on the Sanity tool definition. */
15
- interface VisitorInsightsToolProps {
16
- apiBaseUrl: string;
17
- siteLabel: string;
18
- }
19
- /**
20
- * What Sanity actually hands a tool component.
21
- *
22
- * Sanity does NOT spread a tool's `options` onto its component's props — it passes the whole tool
23
- * definition as `tool`, with the options nested inside. Destructuring `apiBaseUrl` straight off
24
- * props therefore yields undefined, and the first thing useReport does with it is call .replace(),
25
- * so every panel failed with "Cannot read properties of undefined (reading 'replace')".
26
- *
27
- * Both shapes are accepted: the nested one because that is what the Studio passes, and the flat one
28
- * because the component is exported for direct use and is mounted that way in tests.
29
- */
30
- interface VisitorInsightsToolComponentProps extends Partial<VisitorInsightsToolProps> {
31
- tool?: {
32
- options?: Partial<VisitorInsightsToolProps>;
33
- };
34
- }
35
- /** The tool itself. */
36
- declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
37
-
38
6
  /**
39
7
  * Data hook for the Studio panels.
40
8
  *
@@ -101,6 +69,37 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: Us
101
69
  reload: () => void;
102
70
  };
103
71
 
72
+ /**
73
+ * The Visitor Insights Studio tool.
74
+ *
75
+ * One range control drives every panel, implemented once here as a proper radiogroup with
76
+ * roving tabindex — repeating a bespoke toggle per panel is how keyboard behaviour ends up
77
+ * inconsistent between them.
78
+ */
79
+
80
+ /** Options supplied by the plugin config, carried on the Sanity tool definition. */
81
+ interface VisitorInsightsToolProps {
82
+ apiBaseUrl: string;
83
+ siteLabel: string;
84
+ }
85
+ /**
86
+ * What Sanity actually hands a tool component.
87
+ *
88
+ * Sanity does NOT spread a tool's `options` onto its component's props — it passes the whole tool
89
+ * definition as `tool`, with the options nested inside. Destructuring `apiBaseUrl` straight off
90
+ * props therefore yields undefined, and the first thing useReport does with it is call .replace(),
91
+ * so every panel failed with "Cannot read properties of undefined (reading 'replace')".
92
+ *
93
+ * Both shapes are accepted: the nested one because that is what the Studio passes, and the flat one
94
+ * because the component is exported for direct use and is mounted that way in tests.
95
+ */
96
+ interface VisitorInsightsToolComponentProps extends Partial<VisitorInsightsToolProps> {
97
+ tool?: {
98
+ options?: Partial<VisitorInsightsToolProps>;
99
+ };
100
+ }
101
+ declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
102
+
104
103
  /**
105
104
  * Shared renderers for metric values and comparison bars.
106
105
  *
@@ -200,6 +199,10 @@ interface ChartDataProps<Row> {
200
199
  columns: Array<SortColumn<Row>>;
201
200
  rowKey: (row: Row) => string;
202
201
  exportName?: string;
202
+ /** A line above the table, for anything a column header cannot carry. */
203
+ note?: string;
204
+ /** Which column to filter on, if the table should offer a filter box. */
205
+ filterOn?: (row: Row) => string;
203
206
  }
204
207
  /**
205
208
  * The figures behind a chart, as a table, collapsed by default.
@@ -213,7 +216,7 @@ interface ChartDataProps<Row> {
213
216
  * axis type at any size; and anyone who wants these numbers in a spreadsheet, since the table
214
217
  * brings sorting and CSV copy with it. Collapsed, so it costs a sighted reader one line.
215
218
  */
216
- declare function ChartData<Row>({ label, rows, columns, rowKey, exportName }: ChartDataProps<Row>): React.ReactElement | null;
219
+ declare function ChartData<Row>({ label, rows, columns, rowKey, exportName, note, filterOn }: ChartDataProps<Row>): React.ReactElement | null;
217
220
  /** One bar of a proportion chart. */
218
221
  interface ProportionBar {
219
222
  key: string;
package/dist/index.d.ts CHANGED
@@ -3,38 +3,6 @@ import React from 'react';
3
3
  import { R as ReportEnvelope, a as ReportName, b as RangeKey, M as MetricValue, A as AcquisitionData, c as MeasurementHealthData, D as DiagnosticReport, J as JourneyData, T as TypefaceInterestData } from './ranges-BUZuS1c-.js';
4
4
  export { C as CaptureBasis, d as CaptureEstimate, e as CaptureModel, f as CheckStatus, g as Coverage, h as CrossSourceDay, i as DailyPoint, j as DateRange, k as DiagnosticCheck, E as EmailCampaign, l as EventCutover, m as JourneyOutcome, n as JourneyStep, L as LandingPage, o as LicenceTierRow, P as PREEXISTING, p as REPORT_NAMES, q as ReportError, S as SiteAnalyticsConfig, r as SourceName, s as SourceRow, t as SourceStatus, u as TimelineEvent, v as TypefaceInterestRow, U as UnavailableReason, w as coverageForRange, x as estimated, y as isReportName, z as ok, B as partial, F as previousRange, G as resolveRange, H as unavailable, I as validateSiteConfig, K as valueOrNull } from './ranges-BUZuS1c-.js';
5
5
 
6
- /**
7
- * The Visitor Insights Studio tool.
8
- *
9
- * One range control drives every panel, implemented once here as a proper radiogroup with
10
- * roving tabindex — repeating a bespoke toggle per panel is how keyboard behaviour ends up
11
- * inconsistent between them.
12
- */
13
-
14
- /** Options supplied by the plugin config, carried on the Sanity tool definition. */
15
- interface VisitorInsightsToolProps {
16
- apiBaseUrl: string;
17
- siteLabel: string;
18
- }
19
- /**
20
- * What Sanity actually hands a tool component.
21
- *
22
- * Sanity does NOT spread a tool's `options` onto its component's props — it passes the whole tool
23
- * definition as `tool`, with the options nested inside. Destructuring `apiBaseUrl` straight off
24
- * props therefore yields undefined, and the first thing useReport does with it is call .replace(),
25
- * so every panel failed with "Cannot read properties of undefined (reading 'replace')".
26
- *
27
- * Both shapes are accepted: the nested one because that is what the Studio passes, and the flat one
28
- * because the component is exported for direct use and is mounted that way in tests.
29
- */
30
- interface VisitorInsightsToolComponentProps extends Partial<VisitorInsightsToolProps> {
31
- tool?: {
32
- options?: Partial<VisitorInsightsToolProps>;
33
- };
34
- }
35
- /** The tool itself. */
36
- declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
37
-
38
6
  /**
39
7
  * Data hook for the Studio panels.
40
8
  *
@@ -101,6 +69,37 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: Us
101
69
  reload: () => void;
102
70
  };
103
71
 
72
+ /**
73
+ * The Visitor Insights Studio tool.
74
+ *
75
+ * One range control drives every panel, implemented once here as a proper radiogroup with
76
+ * roving tabindex — repeating a bespoke toggle per panel is how keyboard behaviour ends up
77
+ * inconsistent between them.
78
+ */
79
+
80
+ /** Options supplied by the plugin config, carried on the Sanity tool definition. */
81
+ interface VisitorInsightsToolProps {
82
+ apiBaseUrl: string;
83
+ siteLabel: string;
84
+ }
85
+ /**
86
+ * What Sanity actually hands a tool component.
87
+ *
88
+ * Sanity does NOT spread a tool's `options` onto its component's props — it passes the whole tool
89
+ * definition as `tool`, with the options nested inside. Destructuring `apiBaseUrl` straight off
90
+ * props therefore yields undefined, and the first thing useReport does with it is call .replace(),
91
+ * so every panel failed with "Cannot read properties of undefined (reading 'replace')".
92
+ *
93
+ * Both shapes are accepted: the nested one because that is what the Studio passes, and the flat one
94
+ * because the component is exported for direct use and is mounted that way in tests.
95
+ */
96
+ interface VisitorInsightsToolComponentProps extends Partial<VisitorInsightsToolProps> {
97
+ tool?: {
98
+ options?: Partial<VisitorInsightsToolProps>;
99
+ };
100
+ }
101
+ declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
102
+
104
103
  /**
105
104
  * Shared renderers for metric values and comparison bars.
106
105
  *
@@ -200,6 +199,10 @@ interface ChartDataProps<Row> {
200
199
  columns: Array<SortColumn<Row>>;
201
200
  rowKey: (row: Row) => string;
202
201
  exportName?: string;
202
+ /** A line above the table, for anything a column header cannot carry. */
203
+ note?: string;
204
+ /** Which column to filter on, if the table should offer a filter box. */
205
+ filterOn?: (row: Row) => string;
203
206
  }
204
207
  /**
205
208
  * The figures behind a chart, as a table, collapsed by default.
@@ -213,7 +216,7 @@ interface ChartDataProps<Row> {
213
216
  * axis type at any size; and anyone who wants these numbers in a spreadsheet, since the table
214
217
  * brings sorting and CSV copy with it. Collapsed, so it costs a sighted reader one line.
215
218
  */
216
- declare function ChartData<Row>({ label, rows, columns, rowKey, exportName }: ChartDataProps<Row>): React.ReactElement | null;
219
+ declare function ChartData<Row>({ label, rows, columns, rowKey, exportName, note, filterOn }: ChartDataProps<Row>): React.ReactElement | null;
217
220
  /** One bar of a proportion chart. */
218
221
  interface ProportionBar {
219
222
  key: string;