@liiift-studio/sanity-visitor-insights 0.25.0 → 0.27.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 +38 -34
- package/dist/index.d.ts +38 -34
- package/dist/index.js +211 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +211 -81
- package/dist/index.mjs.map +1 -1
- package/dist/{ranges-BUZuS1c-.d.mts → ranges-_SBvGBJx.d.mts} +20 -0
- package/dist/{ranges-BUZuS1c-.d.ts → ranges-_SBvGBJx.d.ts} +20 -0
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +109 -75
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +109 -75
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/reportData.ts +20 -0
- package/src/server/createHandler.ts +12 -3
- package/src/server/reports/acquisition.ts +47 -2
- package/src/studio/CrossSourceTimeline.tsx +80 -20
- package/src/studio/Figure.tsx +7 -1
- package/src/studio/VisitorInsightsTool.tsx +132 -86
- package/src/studio/panels.test.tsx +219 -39
- package/src/studio/panels.tsx +139 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
1
|
import * as sanity from 'sanity';
|
|
2
2
|
import React from 'react';
|
|
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-
|
|
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-
|
|
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
|
-
declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
|
|
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-_SBvGBJx.mjs';
|
|
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-_SBvGBJx.mjs';
|
|
36
5
|
|
|
37
6
|
/**
|
|
38
7
|
* Data hook for the Studio panels.
|
|
@@ -100,6 +69,37 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: Us
|
|
|
100
69
|
reload: () => void;
|
|
101
70
|
};
|
|
102
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
|
+
|
|
103
103
|
/**
|
|
104
104
|
* Shared renderers for metric values and comparison bars.
|
|
105
105
|
*
|
|
@@ -199,6 +199,10 @@ interface ChartDataProps<Row> {
|
|
|
199
199
|
columns: Array<SortColumn<Row>>;
|
|
200
200
|
rowKey: (row: Row) => string;
|
|
201
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;
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
204
208
|
* The figures behind a chart, as a table, collapsed by default.
|
|
@@ -212,7 +216,7 @@ interface ChartDataProps<Row> {
|
|
|
212
216
|
* axis type at any size; and anyone who wants these numbers in a spreadsheet, since the table
|
|
213
217
|
* brings sorting and CSV copy with it. Collapsed, so it costs a sighted reader one line.
|
|
214
218
|
*/
|
|
215
|
-
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;
|
|
216
220
|
/** One bar of a proportion chart. */
|
|
217
221
|
interface ProportionBar {
|
|
218
222
|
key: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
1
|
import * as sanity from 'sanity';
|
|
2
2
|
import React from 'react';
|
|
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-
|
|
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-
|
|
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
|
-
declare function VisitorInsightsTool(props: VisitorInsightsToolComponentProps): React.ReactElement;
|
|
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-_SBvGBJx.js';
|
|
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-_SBvGBJx.js';
|
|
36
5
|
|
|
37
6
|
/**
|
|
38
7
|
* Data hook for the Studio panels.
|
|
@@ -100,6 +69,37 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: Us
|
|
|
100
69
|
reload: () => void;
|
|
101
70
|
};
|
|
102
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
|
+
|
|
103
103
|
/**
|
|
104
104
|
* Shared renderers for metric values and comparison bars.
|
|
105
105
|
*
|
|
@@ -199,6 +199,10 @@ interface ChartDataProps<Row> {
|
|
|
199
199
|
columns: Array<SortColumn<Row>>;
|
|
200
200
|
rowKey: (row: Row) => string;
|
|
201
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;
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
204
208
|
* The figures behind a chart, as a table, collapsed by default.
|
|
@@ -212,7 +216,7 @@ interface ChartDataProps<Row> {
|
|
|
212
216
|
* axis type at any size; and anyone who wants these numbers in a spreadsheet, since the table
|
|
213
217
|
* brings sorting and CSV copy with it. Collapsed, so it costs a sighted reader one line.
|
|
214
218
|
*/
|
|
215
|
-
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;
|
|
216
220
|
/** One bar of a proportion chart. */
|
|
217
221
|
interface ProportionBar {
|
|
218
222
|
key: string;
|