@liiift-studio/sanity-visitor-insights 0.27.0 → 0.27.1

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
@@ -2034,13 +2034,18 @@ function AcquisitionPanel({ data, previous }) {
2034
2034
  label: "Revenue (est.)",
2035
2035
  numeric: true,
2036
2036
  sortValue: (row) => finiteOrNull(row.revenueShare),
2037
- exportValue: (row) => row.apportionedRevenue === null ? null : formatMoney(row.apportionedRevenue, data.currency ?? null),
2037
+ exportValue: (row) => {
2038
+ const money = finiteOrNull(row.apportionedRevenue);
2039
+ return money === null ? null : formatMoney(money, data.currency ?? null);
2040
+ },
2038
2041
  render: (row) => {
2039
- if (row.revenueShare === null) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, muted: true, children: "\u2014" });
2042
+ const share = finiteOrNull(row.revenueShare);
2043
+ if (share === null) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, muted: true, children: "\u2014" });
2044
+ const money = finiteOrNull(row.apportionedRevenue);
2040
2045
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_sanity_ui_compat3.Stack, { space: 1, children: [
2041
- row.apportionedRevenue !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, children: formatMoney(row.apportionedRevenue, data.currency ?? null) }),
2046
+ money !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, children: formatMoney(money, data.currency ?? null) }),
2042
2047
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_sanity_ui_compat3.Text, { size: 0, muted: true, children: [
2043
- formatPercent(row.revenueShare, 0),
2048
+ formatPercent(share, 0),
2044
2049
  " of tracked sales"
2045
2050
  ] })
2046
2051
  ] });
@@ -2049,16 +2054,16 @@ function AcquisitionPanel({ data, previous }) {
2049
2054
  ]
2050
2055
  }
2051
2056
  ),
2052
- data.trackedPurchases > 0 && data.actualRevenue !== null && // Says exactly what was combined and what was estimated. The money in that column
2057
+ (data.trackedPurchases ?? 0) > 0 && finiteOrNull(data.actualRevenue) !== null && // Says exactly what was combined and what was estimated. The money in that column
2053
2058
  // is Sanity's real total spread across GA4's split — right in scale, and derived,
2054
2059
  // which is a different claim from measured. Saying so here is what makes the
2055
2060
  // column usable rather than another figure to distrust.
2056
2061
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_sanity_ui_compat3.Text, { size: 0, muted: true, children: [
2057
2062
  "Revenue is ",
2058
- formatMoney(data.actualRevenue, data.currency ?? null),
2063
+ formatMoney(finiteOrNull(data.actualRevenue) ?? 0, data.currency ?? null),
2059
2064
  " from",
2060
2065
  " ",
2061
- data.actualOrders === null ? "your orders" : `${formatCount(data.actualOrders)} orders`,
2066
+ finiteOrNull(data.actualOrders) === null ? "your orders" : `${formatCount(data.actualOrders)} orders`,
2062
2067
  " in Sanity, split across the ",
2063
2068
  formatCount(data.trackedPurchases),
2064
2069
  " purchase",