@liiift-studio/sanity-visitor-insights 0.18.0 → 0.20.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
@@ -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-B_OrmcdP.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-B_OrmcdP.mjs';
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
+ 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
6
  /**
7
7
  * The Visitor Insights Studio tool.
@@ -51,6 +51,7 @@ type ReportState<T> = {
51
51
  } | {
52
52
  status: 'ready';
53
53
  envelope: ReportEnvelope<T>;
54
+ stale?: boolean;
54
55
  } | {
55
56
  status: 'error';
56
57
  message: string;
@@ -67,13 +68,20 @@ interface UseReportOptions {
67
68
  apiBaseUrl: string;
68
69
  report: ReportName;
69
70
  range: RangeKey;
71
+ /**
72
+ * Whether to fetch at all. Defaults to true.
73
+ *
74
+ * Lets a panel declare a secondary report it only needs on one tab, without the other four
75
+ * paying a request for data they will not draw.
76
+ */
77
+ enabled?: boolean;
70
78
  }
71
79
  /**
72
80
  * Fetch a report, re-fetching when the range changes.
73
81
  *
74
82
  * @returns the current state plus a `reload` for manual refresh
75
83
  */
76
- declare function useReport<T>({ apiBaseUrl, report, range, custom }: UseReportOptions): {
84
+ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: UseReportOptions): {
77
85
  state: ReportState<T>;
78
86
  reload: () => void;
79
87
  };
@@ -373,14 +381,6 @@ interface Series {
373
381
  source: Series['source'];
374
382
  points: SeriesPoint[];
375
383
  };
376
- /**
377
- * Multiplier from observed to estimated-true, where the line itself is the lossy source.
378
- *
379
- * This one IS a symmetric band, because it is genuine uncertainty rather than a known blind
380
- * spot. The two must not look alike: one says "we do not know exactly", the other says "we know
381
- * exactly, and this much was invisible".
382
- */
383
- grossUpFactor?: number;
384
384
  }
385
385
  /** A dated event drawn through every row, e.g. a campaign send. */
386
386
  interface TimelineMarker {
@@ -423,10 +423,29 @@ declare function CrossSourceTimeline({ series, markers, currency }: CrossSourceT
423
423
  * Compares pageviews to pageviews. Sessions and orders sit alongside as context and are never
424
424
  * subtracted from a pageview count.
425
425
  */
426
- declare function MeasurementHealthPanel({ data, previous }: {
426
+ /**
427
+ * Overview — the five-minute read.
428
+ *
429
+ * Revenue, orders, the mailing list, the cross-source timeline and the campaign table all used to
430
+ * live on a tab called "Measurement health", whose own blurb announced it was about how much of
431
+ * reality each source sees. Four of the five questions a foundry owner opens this for were filed
432
+ * under plumbing, on tab four, behind a door labelled for the instrument. This is the same data,
433
+ * first, under a heading that says what it is.
434
+ */
435
+ declare function OverviewPanel({ data, previous }: {
427
436
  data: MeasurementHealthData;
428
437
  previous?: MeasurementHealthData;
429
438
  }): React.ReactElement;
439
+ /**
440
+ * Data health — the instrument, deliberately last.
441
+ *
442
+ * Everything here answers one question: can I trust the numbers on the other tabs. It was two
443
+ * separate tabs answering that question, which is one more than it deserves out of five.
444
+ */
445
+ declare function DataHealthPanel({ data, diagnostics }: {
446
+ data: MeasurementHealthData;
447
+ diagnostics?: DiagnosticReport;
448
+ }): React.ReactElement;
430
449
  /** Acquisition — where visitors came from, with design-industry referrers called out. */
431
450
  declare function AcquisitionPanel({ data, previous }: {
432
451
  data: AcquisitionData;
@@ -493,4 +512,4 @@ interface VisitorInsightsPluginOptions {
493
512
  */
494
513
  declare const visitorInsights: sanity.Plugin<VisitorInsightsPluginOptions>;
495
514
 
496
- export { AcquisitionData, AcquisitionPanel, ComparisonBar, CrossSourceTimeline, type CrossSourceTimelineProps, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, type ProportionBar, ProportionChart, type ProportionChartProps, RangeKey, ReportEnvelope, ReportName, type ReportState, type Series, type SeriesPoint, type SortColumn, SortableTable, type SortableTableProps, type TimelineMarker, TrendChart, TypefaceInterestData, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatMoney, formatPercent, useReport, visitorInsights };
515
+ export { AcquisitionData, AcquisitionPanel, ComparisonBar, CrossSourceTimeline, type CrossSourceTimelineProps, DataHealthPanel, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MetricFigure, MetricValue, NoticeList, OverviewPanel, type ProportionBar, ProportionChart, type ProportionChartProps, RangeKey, ReportEnvelope, ReportName, type ReportState, type Series, type SeriesPoint, type SortColumn, SortableTable, type SortableTableProps, type TimelineMarker, 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-B_OrmcdP.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-B_OrmcdP.js';
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
+ 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
6
  /**
7
7
  * The Visitor Insights Studio tool.
@@ -51,6 +51,7 @@ type ReportState<T> = {
51
51
  } | {
52
52
  status: 'ready';
53
53
  envelope: ReportEnvelope<T>;
54
+ stale?: boolean;
54
55
  } | {
55
56
  status: 'error';
56
57
  message: string;
@@ -67,13 +68,20 @@ interface UseReportOptions {
67
68
  apiBaseUrl: string;
68
69
  report: ReportName;
69
70
  range: RangeKey;
71
+ /**
72
+ * Whether to fetch at all. Defaults to true.
73
+ *
74
+ * Lets a panel declare a secondary report it only needs on one tab, without the other four
75
+ * paying a request for data they will not draw.
76
+ */
77
+ enabled?: boolean;
70
78
  }
71
79
  /**
72
80
  * Fetch a report, re-fetching when the range changes.
73
81
  *
74
82
  * @returns the current state plus a `reload` for manual refresh
75
83
  */
76
- declare function useReport<T>({ apiBaseUrl, report, range, custom }: UseReportOptions): {
84
+ declare function useReport<T>({ apiBaseUrl, report, range, custom, enabled }: UseReportOptions): {
77
85
  state: ReportState<T>;
78
86
  reload: () => void;
79
87
  };
@@ -373,14 +381,6 @@ interface Series {
373
381
  source: Series['source'];
374
382
  points: SeriesPoint[];
375
383
  };
376
- /**
377
- * Multiplier from observed to estimated-true, where the line itself is the lossy source.
378
- *
379
- * This one IS a symmetric band, because it is genuine uncertainty rather than a known blind
380
- * spot. The two must not look alike: one says "we do not know exactly", the other says "we know
381
- * exactly, and this much was invisible".
382
- */
383
- grossUpFactor?: number;
384
384
  }
385
385
  /** A dated event drawn through every row, e.g. a campaign send. */
386
386
  interface TimelineMarker {
@@ -423,10 +423,29 @@ declare function CrossSourceTimeline({ series, markers, currency }: CrossSourceT
423
423
  * Compares pageviews to pageviews. Sessions and orders sit alongside as context and are never
424
424
  * subtracted from a pageview count.
425
425
  */
426
- declare function MeasurementHealthPanel({ data, previous }: {
426
+ /**
427
+ * Overview — the five-minute read.
428
+ *
429
+ * Revenue, orders, the mailing list, the cross-source timeline and the campaign table all used to
430
+ * live on a tab called "Measurement health", whose own blurb announced it was about how much of
431
+ * reality each source sees. Four of the five questions a foundry owner opens this for were filed
432
+ * under plumbing, on tab four, behind a door labelled for the instrument. This is the same data,
433
+ * first, under a heading that says what it is.
434
+ */
435
+ declare function OverviewPanel({ data, previous }: {
427
436
  data: MeasurementHealthData;
428
437
  previous?: MeasurementHealthData;
429
438
  }): React.ReactElement;
439
+ /**
440
+ * Data health — the instrument, deliberately last.
441
+ *
442
+ * Everything here answers one question: can I trust the numbers on the other tabs. It was two
443
+ * separate tabs answering that question, which is one more than it deserves out of five.
444
+ */
445
+ declare function DataHealthPanel({ data, diagnostics }: {
446
+ data: MeasurementHealthData;
447
+ diagnostics?: DiagnosticReport;
448
+ }): React.ReactElement;
430
449
  /** Acquisition — where visitors came from, with design-industry referrers called out. */
431
450
  declare function AcquisitionPanel({ data, previous }: {
432
451
  data: AcquisitionData;
@@ -493,4 +512,4 @@ interface VisitorInsightsPluginOptions {
493
512
  */
494
513
  declare const visitorInsights: sanity.Plugin<VisitorInsightsPluginOptions>;
495
514
 
496
- export { AcquisitionData, AcquisitionPanel, ComparisonBar, CrossSourceTimeline, type CrossSourceTimelineProps, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MeasurementHealthPanel, MetricFigure, MetricValue, NoticeList, type ProportionBar, ProportionChart, type ProportionChartProps, RangeKey, ReportEnvelope, ReportName, type ReportState, type Series, type SeriesPoint, type SortColumn, SortableTable, type SortableTableProps, type TimelineMarker, TrendChart, TypefaceInterestData, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatMoney, formatPercent, useReport, visitorInsights };
515
+ export { AcquisitionData, AcquisitionPanel, ComparisonBar, CrossSourceTimeline, type CrossSourceTimelineProps, DataHealthPanel, Delta, type DeltaProps, DiagnosticReport, DiagnosticsPanel, FunnelChart, JourneyData, JourneyPanel, MeasurementHealthData, MetricFigure, MetricValue, NoticeList, OverviewPanel, type ProportionBar, ProportionChart, type ProportionChartProps, RangeKey, ReportEnvelope, ReportName, type ReportState, type Series, type SeriesPoint, type SortColumn, SortableTable, type SortableTableProps, type TimelineMarker, TrendChart, TypefaceInterestData, TypefaceInterestPanel, type UseReportOptions, type VisitorInsightsPluginOptions, VisitorInsightsTool, type VisitorInsightsToolProps, visitorInsights as default, formatCount, formatMoney, formatPercent, useReport, visitorInsights };