@liiift-studio/sanity-visitor-insights 0.61.0 → 0.62.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.js CHANGED
@@ -2289,16 +2289,21 @@ function Verdict({ data, previous }) {
2289
2289
  parts.push(Math.abs(change) < 5e-3 ? `${label} flat` : `${label} little changed (${change > 0 ? "+" : "\u2212"}${formatPercent(Math.abs(change), 0)})`);
2290
2290
  } else if (unit === "money") {
2291
2291
  parts.push(`${label} ${change > 0 ? "up" : "down"} to ${formatMoney(a, data.currency ?? null)} from ${formatMoney(b, data.currency ?? null)}`);
2292
+ } else if (Math.abs(b) < MIN_DELTA_BASE) {
2293
+ parts.push(`${label} ${formatCount(a)}, was ${formatCount(b)}`);
2292
2294
  } else parts.push(`${label} ${change > 0 ? "up" : "down"} ${formatPercent(Math.abs(change), 0)}`);
2293
2295
  };
2294
2296
  say("Revenue", data.revenue, previous?.revenue, "money");
2297
+ say("Orders", data.orders, previous?.orders, "count");
2295
2298
  say("Traffic", data.vercelPageviews, previous?.vercelPageviews, "count");
2296
2299
  const sends = data.campaigns?.length ?? 0;
2297
2300
  const shortfall = data.shortfallRatio;
2298
2301
  const seeing = shortfall !== null && shortfall !== void 0 ? `GA4 is seeing ${formatPercent(1 - shortfall, 0)} of your traffic` : null;
2299
2302
  const broken = shortfall === null || shortfall === void 0 ? data.capture?.discrepancy ? "measurement disagrees between sources" : null : shortfall > 0.6 ? `${seeing} \u2014 treat its figures as broken` : shortfall > 0.35 ? `${seeing} \u2014 its figures are undercounts, not what happened` : data.capture?.discrepancy ? "measurement disagrees between sources" : null;
2300
2303
  if (broken) parts.push(broken);
2301
- if (parts.length === 0) return null;
2304
+ if (parts.length === 0) {
2305
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Card, { padding: 3, radius: 2, tone: "transparent", border: true, style: { borderLeftWidth: 3, borderLeftStyle: "solid" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 4, children: "No figures arrived for this window." }) });
2306
+ }
2302
2307
  const noticeable = shortfall !== null && shortfall !== void 0 && shortfall > 0.2;
2303
2308
  const closing = broken || !noticeable ? "" : ` \xB7 ${seeing}`;
2304
2309
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -3085,11 +3090,11 @@ var RANGES = [
3085
3090
  ];
3086
3091
  var GA4_ONLY_TABS = ["acquisition", "journey", "typeface-interest"];
3087
3092
  var PANELS = [
3088
- { id: "overview", report: "measurement-health", label: "Overview", blurb: "Money, traffic and what moved this period" },
3089
- { id: "acquisition", report: "acquisition", label: "Acquisition", blurb: "Where visitors come from" },
3090
- { id: "journey", report: "journey", label: "Journey", blurb: "How far visitors get" },
3091
- { id: "typeface-interest", report: "typeface-interest", label: "Typeface interest", blurb: "Viewed, tested and bought, by family" },
3092
- { id: "data-health", report: "measurement-health", label: "Data health", blurb: "Whether to trust what the other tabs are telling you" }
3093
+ { id: "overview", report: "measurement-health", label: "Overview" },
3094
+ { id: "acquisition", report: "acquisition", label: "Acquisition" },
3095
+ { id: "journey", report: "journey", label: "Journey" },
3096
+ { id: "typeface-interest", report: "typeface-interest", label: "Typeface interest" },
3097
+ { id: "data-health", report: "measurement-health", label: "Data health" }
3093
3098
  ];
3094
3099
  function RangeSelector({
3095
3100
  value,
@@ -3495,7 +3500,7 @@ function VisitorInsightsTool(props) {
3495
3500
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_sanity_ui_compat4.Heading, { size: 2, children: "Visitor insights" }),
3496
3501
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_sanity_ui_compat4.Stack, { space: 2, children: [
3497
3502
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RangeSelector, { value: range, custom, onChange: setRange, onCustomChange: setCustom }),
3498
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasisSelector, { value: compare, onChange: setCompare })
3503
+ COMPARED_TABS.includes(activePanel) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasisSelector, { value: compare, onChange: setCompare })
3499
3504
  ] })
3500
3505
  ] }),
3501
3506
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PanelTabs, { value: activePanel, onChange: setActivePanel }),
@@ -3555,25 +3560,22 @@ function VisitorInsightsTool(props) {
3555
3560
  "aria-labelledby": `tab-${activePanel}`,
3556
3561
  tabIndex: 0,
3557
3562
  style: { position: "relative" },
3558
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_sanity_ui_compat4.Stack, { space: 4, children: [
3559
- active && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_sanity_ui_compat4.Text, { size: 1, muted: true, children: active.blurb }),
3560
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PanelBoundary, { resetKey: `${activePanel}|${range}|${custom.start}|${custom.end}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3561
- ReportPanel,
3562
- {
3563
- tabId: active?.id ?? "overview",
3564
- report: active?.report ?? "measurement-health",
3565
- apiBaseUrl,
3566
- range,
3567
- custom,
3568
- compare,
3569
- onBrush: (start, end) => {
3570
- if (range !== "custom") setRangeBeforeBrush(range);
3571
- setCustom({ start, end });
3572
- setRange("custom");
3573
- }
3563
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_sanity_ui_compat4.Stack, { space: 4, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PanelBoundary, { resetKey: `${activePanel}|${range}|${custom.start}|${custom.end}`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3564
+ ReportPanel,
3565
+ {
3566
+ tabId: active?.id ?? "overview",
3567
+ report: active?.report ?? "measurement-health",
3568
+ apiBaseUrl,
3569
+ range,
3570
+ custom,
3571
+ compare,
3572
+ onBrush: (start, end) => {
3573
+ if (range !== "custom") setRangeBeforeBrush(range);
3574
+ setCustom({ start, end });
3575
+ setRange("custom");
3574
3576
  }
3575
- ) })
3576
- ] })
3577
+ }
3578
+ ) }) })
3577
3579
  }
3578
3580
  )
3579
3581
  ] }) })