@liiift-studio/sanity-visitor-insights 0.13.0 → 0.14.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 +147 -4
- package/dist/index.d.ts +147 -4
- package/dist/index.js +179 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +175 -56
- package/dist/index.mjs.map +1 -1
- package/dist/{ranges-CiTnQEnz.d.mts → ranges-CEHxJQE6.d.mts} +30 -3
- package/dist/{ranges-CiTnQEnz.d.ts → ranges-CEHxJQE6.d.ts} +30 -3
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +194 -55
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +190 -55
- package/dist/server.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -0
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -0
- package/dist/testing.mjs.map +1 -1
- package/dist/vercel-CL2w9Jqs.d.mts +339 -0
- package/dist/vercel-CL2w9Jqs.d.ts +339 -0
- package/package.json +1 -1
- package/src/core/ranges.ts +12 -1
- package/src/core/siteConfig.ts +60 -0
- package/src/index.ts +5 -1
- package/src/reportData.ts +12 -0
- package/src/server/createHandler.ts +34 -5
- package/src/server/diagnostics.ts +9 -1
- package/src/server/ga4.ts +58 -25
- package/src/server/orders.ts +65 -8
- package/src/server/reports/measurementHealth.ts +61 -4
- package/src/server/reports/reports.test.ts +304 -6
- package/src/server/reports/typefaceInterest.ts +94 -45
- package/src/server/vercel.ts +6 -4
- package/src/server.ts +5 -2
- package/src/studio/Figure.tsx +78 -32
- package/src/studio/VisitorInsightsTool.tsx +14 -4
- package/src/studio/panels.test.tsx +79 -0
- package/src/studio/panels.tsx +146 -32
- package/src/testing/fakes.ts +6 -0
- package/src/types.ts +12 -3
- package/dist/vercel-CwILuQVm.d.mts +0 -184
- package/dist/vercel-CwILuQVm.d.ts +0 -184
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +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, D as DiagnosticReport, J as JourneyData, c as MeasurementHealthData, T as TypefaceInterestData } from './ranges-
|
|
4
|
-
export { C as
|
|
3
|
+
import { R as ReportEnvelope, a as ReportName, b as RangeKey, M as MetricValue, A as AcquisitionData, D as DiagnosticReport, J as JourneyData, c as MeasurementHealthData, T as TypefaceInterestData } from './ranges-CEHxJQE6.mjs';
|
|
4
|
+
export { C as CheckStatus, d as Coverage, e as DailyPoint, f as DateRange, g as DiagnosticCheck, E as EventCutover, h as JourneyOutcome, i as JourneyStep, L as LandingPage, P as PREEXISTING, j as REPORT_NAMES, k as ReportError, S as SiteAnalyticsConfig, l as SourceName, m as SourceRow, n as SourceStatus, o as TypefaceInterestRow, U as UnavailableReason, p as coverageForRange, q as isReportName, r as ok, s as partial, t as previousRange, u as resolveRange, v as unavailable, w as validateSiteConfig, x as valueOrNull } from './ranges-CEHxJQE6.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Visitor Insights Studio tool.
|
|
@@ -93,6 +93,35 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom }: UseReportOp
|
|
|
93
93
|
declare function formatCount(value: number): string;
|
|
94
94
|
/** Format a 0–1 ratio as a percentage. */
|
|
95
95
|
declare function formatPercent(ratio: number, digits?: number): string;
|
|
96
|
+
/** Props for MetricFigure. */
|
|
97
|
+
/** Format a money value in the site's currency, falling back to a plain number. */
|
|
98
|
+
declare function formatMoney(value: number, currency: string | null): string;
|
|
99
|
+
/** Props for Delta. */
|
|
100
|
+
interface DeltaProps {
|
|
101
|
+
/** This period's value, or null when it could not be measured. */
|
|
102
|
+
current: number | null;
|
|
103
|
+
/** The previous equivalent period's value, or null when there is no comparison. */
|
|
104
|
+
previous: number | null;
|
|
105
|
+
/**
|
|
106
|
+
* Whether a rise is good. Sessions and revenue: yes. A shortfall or a bounce figure: no.
|
|
107
|
+
* Drives only the wording and the tone, never whether the number is shown.
|
|
108
|
+
*/
|
|
109
|
+
riseIsGood?: boolean;
|
|
110
|
+
/** Render as a percentage-point change rather than a percentage change of a percentage. */
|
|
111
|
+
unit?: 'count' | 'percent';
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A period-over-period change.
|
|
115
|
+
*
|
|
116
|
+
* Every figure in this tool used to be a bare level, which at these volumes is close to
|
|
117
|
+
* meaningless: "389 sessions" is neither good nor bad without last week beside it, and the
|
|
118
|
+
* 24 August collapse would have announced itself on every panel as a delta while going unnoticed
|
|
119
|
+
* for over a week as a level.
|
|
120
|
+
*
|
|
121
|
+
* Renders nothing at all when there is no comparison — an absent delta must never be drawn as
|
|
122
|
+
* "no change", which is a different and much more reassuring claim.
|
|
123
|
+
*/
|
|
124
|
+
declare function Delta({ current, previous, riseIsGood, unit }: DeltaProps): React.ReactElement | null;
|
|
96
125
|
interface MetricFigureProps {
|
|
97
126
|
metric: MetricValue;
|
|
98
127
|
/** Accessible label describing what this number counts. */
|
|
@@ -133,6 +162,38 @@ interface ComparisonBarProps {
|
|
|
133
162
|
* Studio bundle and the theme-token bridging that a chart library would need for light and dark.
|
|
134
163
|
*/
|
|
135
164
|
declare function ComparisonBar({ label, metric, max, tone }: ComparisonBarProps): React.ReactElement;
|
|
165
|
+
/** One rung of the funnel, already filtered to steps that are actually measured. */
|
|
166
|
+
interface FunnelStage {
|
|
167
|
+
key: string;
|
|
168
|
+
label: string;
|
|
169
|
+
/** Distinct users at this step. */
|
|
170
|
+
value: number;
|
|
171
|
+
/** Share of the previous shown step, or null when it could not be computed. */
|
|
172
|
+
conversionFromPrevious: number | null;
|
|
173
|
+
}
|
|
174
|
+
/** Props for FunnelChart. */
|
|
175
|
+
interface FunnelChartProps {
|
|
176
|
+
stages: FunnelStage[];
|
|
177
|
+
/**
|
|
178
|
+
* Whether the stages are a tracked sequence or independent totals. The drawing is the same
|
|
179
|
+
* shape either way, but the words between stages are not: a fallback's gap is a difference
|
|
180
|
+
* between two counts, not people who dropped out.
|
|
181
|
+
*/
|
|
182
|
+
measurement: 'sequence' | 'independent-totals';
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A funnel.
|
|
186
|
+
*
|
|
187
|
+
* Widths are a share of the FIRST stage rather than of the largest, which is what makes it read as
|
|
188
|
+
* a funnel: every rung answers "of everyone who arrived, how many got this far". Anchoring to the
|
|
189
|
+
* max instead would make the widest stage full-width wherever it sat, and a mid-funnel step wider
|
|
190
|
+
* than entry — which happens on the independent-totals fallback, where `add_to_cart` can exceed
|
|
191
|
+
* `page_view` — would silently rescale everything above it.
|
|
192
|
+
*
|
|
193
|
+
* Stages are focusable so the figures are reachable without a pointer; the readout is rendered as
|
|
194
|
+
* text under the stage rather than as a floating tooltip so it is also visible on touch.
|
|
195
|
+
*/
|
|
196
|
+
declare function FunnelChart({ stages, measurement }: FunnelChartProps): React.ReactElement | null;
|
|
136
197
|
/** Props for NoticeList. */
|
|
137
198
|
interface NoticeListProps {
|
|
138
199
|
notices: string[];
|
|
@@ -142,6 +203,87 @@ interface NoticeListProps {
|
|
|
142
203
|
* Rendered in the panel rather than a README: a caveat nobody sees does not prevent a wrong read.
|
|
143
204
|
*/
|
|
144
205
|
declare function NoticeList({ notices }: NoticeListProps): React.ReactElement | null;
|
|
206
|
+
/** Props for TrendChart. */
|
|
207
|
+
interface TrendChartProps {
|
|
208
|
+
/** Daily points, oldest first. */
|
|
209
|
+
points: Array<{
|
|
210
|
+
date: string;
|
|
211
|
+
ga4: number | null;
|
|
212
|
+
vercel: number | null;
|
|
213
|
+
}>;
|
|
214
|
+
/** Accessible description of what the two lines are. */
|
|
215
|
+
label?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Daily GA4 against Vercel, with axes, dated ticks and a hover readout.
|
|
219
|
+
*
|
|
220
|
+
* The shaded band between the lines is the point of the chart rather than decoration: it IS the
|
|
221
|
+
* measurement gap, and seeing where it opens is what distinguishes an incident from a standing
|
|
222
|
+
* difference. Darden's opened overnight on 2026-08-24 and stayed open for over a week, which no
|
|
223
|
+
* scalar on this panel could have shown.
|
|
224
|
+
*
|
|
225
|
+
* Inline SVG with no charting library — one dependency-free element in a Studio that already loads
|
|
226
|
+
* a great deal, and it renders on the server so the tests can assert on it. Strokes use
|
|
227
|
+
* currentColor so the whole thing follows the Studio's theme without a palette of its own.
|
|
228
|
+
*/
|
|
229
|
+
declare function TrendChart({ points, label }: TrendChartProps): React.ReactElement | null;
|
|
230
|
+
/** One column of a sortable table. */
|
|
231
|
+
interface SortColumn<Row> {
|
|
232
|
+
/** Stable key, also used as the sort key. */
|
|
233
|
+
key: string;
|
|
234
|
+
label: string;
|
|
235
|
+
/** Right-aligned and sorted high-to-low first, the way a reader expects of a figure. */
|
|
236
|
+
numeric?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Value to sort on. Return null for "no value" — those always sort last regardless of
|
|
239
|
+
* direction, because an unmeasured row is not a small one and must not lead an ascending sort.
|
|
240
|
+
*/
|
|
241
|
+
sortValue: (row: Row) => number | string | null;
|
|
242
|
+
/**
|
|
243
|
+
* Value written to the CSV, when it differs from the sort key.
|
|
244
|
+
*
|
|
245
|
+
* Defaults to `sortValue`, which is right for a plain count and wrong for anything formatted:
|
|
246
|
+
* a rate sorts on 0.4318 and displays 43%, revenue sorts on a bare number and displays a
|
|
247
|
+
* currency, and a column with a fallback displays something `sortValue` returns null for.
|
|
248
|
+
*/
|
|
249
|
+
exportValue?: (row: Row) => number | string | null;
|
|
250
|
+
render: (row: Row) => React.ReactNode;
|
|
251
|
+
}
|
|
252
|
+
/** Props for SortableTable. */
|
|
253
|
+
interface SortableTableProps<Row> {
|
|
254
|
+
caption: string;
|
|
255
|
+
columns: Array<SortColumn<Row>>;
|
|
256
|
+
rows: Row[];
|
|
257
|
+
rowKey: (row: Row) => string;
|
|
258
|
+
/** Column sorted on first load. Defaults to the server's own ordering. */
|
|
259
|
+
initialSort?: string;
|
|
260
|
+
/**
|
|
261
|
+
* The text a row is matched against when filtering. Omit to render no filter box.
|
|
262
|
+
*
|
|
263
|
+
* Sorting was the tool's entire interaction budget, which meant a reader who spotted an
|
|
264
|
+
* unrelated site's traffic in the table had no way to take it out and see what was left.
|
|
265
|
+
*/
|
|
266
|
+
filterOn?: (row: Row) => string;
|
|
267
|
+
/** Placeholder for the filter box, naming what is searched. */
|
|
268
|
+
filterPlaceholder?: string;
|
|
269
|
+
/** Base filename for the CSV export. Omit to render no export control. */
|
|
270
|
+
exportName?: string;
|
|
271
|
+
/** Shown under the table when the server truncated the row set. */
|
|
272
|
+
truncatedNote?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A table whose columns sort.
|
|
276
|
+
*
|
|
277
|
+
* Both data tables arrived in one server-chosen order — sessions descending, views descending — so
|
|
278
|
+
* the only question they could answer was the one that order encoded. Sorting by any column turns
|
|
279
|
+
* the same rows into several different questions: which family is tested most relative to views,
|
|
280
|
+
* which source is least attributed, which typeface sells without being looked at.
|
|
281
|
+
*
|
|
282
|
+
* Rows with no value for the active column sort last in both directions. That is deliberate: an
|
|
283
|
+
* unavailable metric is not a zero, and letting it lead an ascending sort would restate exactly the
|
|
284
|
+
* confusion the MetricValue type exists to prevent.
|
|
285
|
+
*/
|
|
286
|
+
declare function SortableTable<Row>({ caption, columns, rows, rowKey, initialSort, filterPlaceholder, filterOn, exportName, truncatedNote, }: SortableTableProps<Row>): React.ReactElement;
|
|
145
287
|
|
|
146
288
|
/**
|
|
147
289
|
* The four report panels.
|
|
@@ -163,8 +305,9 @@ declare function NoticeList({ notices }: NoticeListProps): React.ReactElement |
|
|
|
163
305
|
* Compares pageviews to pageviews. Sessions and orders sit alongside as context and are never
|
|
164
306
|
* subtracted from a pageview count.
|
|
165
307
|
*/
|
|
166
|
-
declare function MeasurementHealthPanel({ data }: {
|
|
308
|
+
declare function MeasurementHealthPanel({ data, previous }: {
|
|
167
309
|
data: MeasurementHealthData;
|
|
310
|
+
previous?: MeasurementHealthData;
|
|
168
311
|
}): React.ReactElement;
|
|
169
312
|
/** Acquisition — where visitors came from, with design-industry referrers called out. */
|
|
170
313
|
declare function AcquisitionPanel({ data, previous }: {
|
|
@@ -232,4 +375,4 @@ interface VisitorInsightsPluginOptions {
|
|
|
232
375
|
*/
|
|
233
376
|
declare const visitorInsights: sanity.Plugin<VisitorInsightsPluginOptions>;
|
|
234
377
|
|
|
235
|
-
export { AcquisitionPanel, ComparisonBar, DiagnosticsPanel, JourneyPanel, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, RangeKey, ReportEnvelope, ReportName, type ReportState, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatPercent, useReport, visitorInsights };
|
|
378
|
+
export { AcquisitionData, AcquisitionPanel, ComparisonBar, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, RangeKey, ReportEnvelope, ReportName, type ReportState, type SortColumn, SortableTable, type SortableTableProps, TrendChart, TypefaceInterestData, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatMoney, formatPercent, useReport, visitorInsights };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +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, D as DiagnosticReport, J as JourneyData, c as MeasurementHealthData, T as TypefaceInterestData } from './ranges-
|
|
4
|
-
export { C as
|
|
3
|
+
import { R as ReportEnvelope, a as ReportName, b as RangeKey, M as MetricValue, A as AcquisitionData, D as DiagnosticReport, J as JourneyData, c as MeasurementHealthData, T as TypefaceInterestData } from './ranges-CEHxJQE6.js';
|
|
4
|
+
export { C as CheckStatus, d as Coverage, e as DailyPoint, f as DateRange, g as DiagnosticCheck, E as EventCutover, h as JourneyOutcome, i as JourneyStep, L as LandingPage, P as PREEXISTING, j as REPORT_NAMES, k as ReportError, S as SiteAnalyticsConfig, l as SourceName, m as SourceRow, n as SourceStatus, o as TypefaceInterestRow, U as UnavailableReason, p as coverageForRange, q as isReportName, r as ok, s as partial, t as previousRange, u as resolveRange, v as unavailable, w as validateSiteConfig, x as valueOrNull } from './ranges-CEHxJQE6.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Visitor Insights Studio tool.
|
|
@@ -93,6 +93,35 @@ declare function useReport<T>({ apiBaseUrl, report, range, custom }: UseReportOp
|
|
|
93
93
|
declare function formatCount(value: number): string;
|
|
94
94
|
/** Format a 0–1 ratio as a percentage. */
|
|
95
95
|
declare function formatPercent(ratio: number, digits?: number): string;
|
|
96
|
+
/** Props for MetricFigure. */
|
|
97
|
+
/** Format a money value in the site's currency, falling back to a plain number. */
|
|
98
|
+
declare function formatMoney(value: number, currency: string | null): string;
|
|
99
|
+
/** Props for Delta. */
|
|
100
|
+
interface DeltaProps {
|
|
101
|
+
/** This period's value, or null when it could not be measured. */
|
|
102
|
+
current: number | null;
|
|
103
|
+
/** The previous equivalent period's value, or null when there is no comparison. */
|
|
104
|
+
previous: number | null;
|
|
105
|
+
/**
|
|
106
|
+
* Whether a rise is good. Sessions and revenue: yes. A shortfall or a bounce figure: no.
|
|
107
|
+
* Drives only the wording and the tone, never whether the number is shown.
|
|
108
|
+
*/
|
|
109
|
+
riseIsGood?: boolean;
|
|
110
|
+
/** Render as a percentage-point change rather than a percentage change of a percentage. */
|
|
111
|
+
unit?: 'count' | 'percent';
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A period-over-period change.
|
|
115
|
+
*
|
|
116
|
+
* Every figure in this tool used to be a bare level, which at these volumes is close to
|
|
117
|
+
* meaningless: "389 sessions" is neither good nor bad without last week beside it, and the
|
|
118
|
+
* 24 August collapse would have announced itself on every panel as a delta while going unnoticed
|
|
119
|
+
* for over a week as a level.
|
|
120
|
+
*
|
|
121
|
+
* Renders nothing at all when there is no comparison — an absent delta must never be drawn as
|
|
122
|
+
* "no change", which is a different and much more reassuring claim.
|
|
123
|
+
*/
|
|
124
|
+
declare function Delta({ current, previous, riseIsGood, unit }: DeltaProps): React.ReactElement | null;
|
|
96
125
|
interface MetricFigureProps {
|
|
97
126
|
metric: MetricValue;
|
|
98
127
|
/** Accessible label describing what this number counts. */
|
|
@@ -133,6 +162,38 @@ interface ComparisonBarProps {
|
|
|
133
162
|
* Studio bundle and the theme-token bridging that a chart library would need for light and dark.
|
|
134
163
|
*/
|
|
135
164
|
declare function ComparisonBar({ label, metric, max, tone }: ComparisonBarProps): React.ReactElement;
|
|
165
|
+
/** One rung of the funnel, already filtered to steps that are actually measured. */
|
|
166
|
+
interface FunnelStage {
|
|
167
|
+
key: string;
|
|
168
|
+
label: string;
|
|
169
|
+
/** Distinct users at this step. */
|
|
170
|
+
value: number;
|
|
171
|
+
/** Share of the previous shown step, or null when it could not be computed. */
|
|
172
|
+
conversionFromPrevious: number | null;
|
|
173
|
+
}
|
|
174
|
+
/** Props for FunnelChart. */
|
|
175
|
+
interface FunnelChartProps {
|
|
176
|
+
stages: FunnelStage[];
|
|
177
|
+
/**
|
|
178
|
+
* Whether the stages are a tracked sequence or independent totals. The drawing is the same
|
|
179
|
+
* shape either way, but the words between stages are not: a fallback's gap is a difference
|
|
180
|
+
* between two counts, not people who dropped out.
|
|
181
|
+
*/
|
|
182
|
+
measurement: 'sequence' | 'independent-totals';
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A funnel.
|
|
186
|
+
*
|
|
187
|
+
* Widths are a share of the FIRST stage rather than of the largest, which is what makes it read as
|
|
188
|
+
* a funnel: every rung answers "of everyone who arrived, how many got this far". Anchoring to the
|
|
189
|
+
* max instead would make the widest stage full-width wherever it sat, and a mid-funnel step wider
|
|
190
|
+
* than entry — which happens on the independent-totals fallback, where `add_to_cart` can exceed
|
|
191
|
+
* `page_view` — would silently rescale everything above it.
|
|
192
|
+
*
|
|
193
|
+
* Stages are focusable so the figures are reachable without a pointer; the readout is rendered as
|
|
194
|
+
* text under the stage rather than as a floating tooltip so it is also visible on touch.
|
|
195
|
+
*/
|
|
196
|
+
declare function FunnelChart({ stages, measurement }: FunnelChartProps): React.ReactElement | null;
|
|
136
197
|
/** Props for NoticeList. */
|
|
137
198
|
interface NoticeListProps {
|
|
138
199
|
notices: string[];
|
|
@@ -142,6 +203,87 @@ interface NoticeListProps {
|
|
|
142
203
|
* Rendered in the panel rather than a README: a caveat nobody sees does not prevent a wrong read.
|
|
143
204
|
*/
|
|
144
205
|
declare function NoticeList({ notices }: NoticeListProps): React.ReactElement | null;
|
|
206
|
+
/** Props for TrendChart. */
|
|
207
|
+
interface TrendChartProps {
|
|
208
|
+
/** Daily points, oldest first. */
|
|
209
|
+
points: Array<{
|
|
210
|
+
date: string;
|
|
211
|
+
ga4: number | null;
|
|
212
|
+
vercel: number | null;
|
|
213
|
+
}>;
|
|
214
|
+
/** Accessible description of what the two lines are. */
|
|
215
|
+
label?: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Daily GA4 against Vercel, with axes, dated ticks and a hover readout.
|
|
219
|
+
*
|
|
220
|
+
* The shaded band between the lines is the point of the chart rather than decoration: it IS the
|
|
221
|
+
* measurement gap, and seeing where it opens is what distinguishes an incident from a standing
|
|
222
|
+
* difference. Darden's opened overnight on 2026-08-24 and stayed open for over a week, which no
|
|
223
|
+
* scalar on this panel could have shown.
|
|
224
|
+
*
|
|
225
|
+
* Inline SVG with no charting library — one dependency-free element in a Studio that already loads
|
|
226
|
+
* a great deal, and it renders on the server so the tests can assert on it. Strokes use
|
|
227
|
+
* currentColor so the whole thing follows the Studio's theme without a palette of its own.
|
|
228
|
+
*/
|
|
229
|
+
declare function TrendChart({ points, label }: TrendChartProps): React.ReactElement | null;
|
|
230
|
+
/** One column of a sortable table. */
|
|
231
|
+
interface SortColumn<Row> {
|
|
232
|
+
/** Stable key, also used as the sort key. */
|
|
233
|
+
key: string;
|
|
234
|
+
label: string;
|
|
235
|
+
/** Right-aligned and sorted high-to-low first, the way a reader expects of a figure. */
|
|
236
|
+
numeric?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Value to sort on. Return null for "no value" — those always sort last regardless of
|
|
239
|
+
* direction, because an unmeasured row is not a small one and must not lead an ascending sort.
|
|
240
|
+
*/
|
|
241
|
+
sortValue: (row: Row) => number | string | null;
|
|
242
|
+
/**
|
|
243
|
+
* Value written to the CSV, when it differs from the sort key.
|
|
244
|
+
*
|
|
245
|
+
* Defaults to `sortValue`, which is right for a plain count and wrong for anything formatted:
|
|
246
|
+
* a rate sorts on 0.4318 and displays 43%, revenue sorts on a bare number and displays a
|
|
247
|
+
* currency, and a column with a fallback displays something `sortValue` returns null for.
|
|
248
|
+
*/
|
|
249
|
+
exportValue?: (row: Row) => number | string | null;
|
|
250
|
+
render: (row: Row) => React.ReactNode;
|
|
251
|
+
}
|
|
252
|
+
/** Props for SortableTable. */
|
|
253
|
+
interface SortableTableProps<Row> {
|
|
254
|
+
caption: string;
|
|
255
|
+
columns: Array<SortColumn<Row>>;
|
|
256
|
+
rows: Row[];
|
|
257
|
+
rowKey: (row: Row) => string;
|
|
258
|
+
/** Column sorted on first load. Defaults to the server's own ordering. */
|
|
259
|
+
initialSort?: string;
|
|
260
|
+
/**
|
|
261
|
+
* The text a row is matched against when filtering. Omit to render no filter box.
|
|
262
|
+
*
|
|
263
|
+
* Sorting was the tool's entire interaction budget, which meant a reader who spotted an
|
|
264
|
+
* unrelated site's traffic in the table had no way to take it out and see what was left.
|
|
265
|
+
*/
|
|
266
|
+
filterOn?: (row: Row) => string;
|
|
267
|
+
/** Placeholder for the filter box, naming what is searched. */
|
|
268
|
+
filterPlaceholder?: string;
|
|
269
|
+
/** Base filename for the CSV export. Omit to render no export control. */
|
|
270
|
+
exportName?: string;
|
|
271
|
+
/** Shown under the table when the server truncated the row set. */
|
|
272
|
+
truncatedNote?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A table whose columns sort.
|
|
276
|
+
*
|
|
277
|
+
* Both data tables arrived in one server-chosen order — sessions descending, views descending — so
|
|
278
|
+
* the only question they could answer was the one that order encoded. Sorting by any column turns
|
|
279
|
+
* the same rows into several different questions: which family is tested most relative to views,
|
|
280
|
+
* which source is least attributed, which typeface sells without being looked at.
|
|
281
|
+
*
|
|
282
|
+
* Rows with no value for the active column sort last in both directions. That is deliberate: an
|
|
283
|
+
* unavailable metric is not a zero, and letting it lead an ascending sort would restate exactly the
|
|
284
|
+
* confusion the MetricValue type exists to prevent.
|
|
285
|
+
*/
|
|
286
|
+
declare function SortableTable<Row>({ caption, columns, rows, rowKey, initialSort, filterPlaceholder, filterOn, exportName, truncatedNote, }: SortableTableProps<Row>): React.ReactElement;
|
|
145
287
|
|
|
146
288
|
/**
|
|
147
289
|
* The four report panels.
|
|
@@ -163,8 +305,9 @@ declare function NoticeList({ notices }: NoticeListProps): React.ReactElement |
|
|
|
163
305
|
* Compares pageviews to pageviews. Sessions and orders sit alongside as context and are never
|
|
164
306
|
* subtracted from a pageview count.
|
|
165
307
|
*/
|
|
166
|
-
declare function MeasurementHealthPanel({ data }: {
|
|
308
|
+
declare function MeasurementHealthPanel({ data, previous }: {
|
|
167
309
|
data: MeasurementHealthData;
|
|
310
|
+
previous?: MeasurementHealthData;
|
|
168
311
|
}): React.ReactElement;
|
|
169
312
|
/** Acquisition — where visitors came from, with design-industry referrers called out. */
|
|
170
313
|
declare function AcquisitionPanel({ data, previous }: {
|
|
@@ -232,4 +375,4 @@ interface VisitorInsightsPluginOptions {
|
|
|
232
375
|
*/
|
|
233
376
|
declare const visitorInsights: sanity.Plugin<VisitorInsightsPluginOptions>;
|
|
234
377
|
|
|
235
|
-
export { AcquisitionPanel, ComparisonBar, DiagnosticsPanel, JourneyPanel, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, RangeKey, ReportEnvelope, ReportName, type ReportState, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatPercent, useReport, visitorInsights };
|
|
378
|
+
export { AcquisitionData, AcquisitionPanel, ComparisonBar, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, RangeKey, ReportEnvelope, ReportName, type ReportState, type SortColumn, SortableTable, type SortableTableProps, TrendChart, TypefaceInterestData, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatMoney, formatPercent, useReport, visitorInsights };
|