@liiift-studio/sanity-visitor-insights 0.43.0 → 0.44.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 +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +19 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +19 -2
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/server/mailchimp.ts +23 -3
- package/src/studio/panels.test.tsx +40 -0
- package/src/studio/panels.tsx +60 -3
package/dist/index.js
CHANGED
|
@@ -1575,7 +1575,10 @@ function OverviewPanel({ data, previous, onBrush }) {
|
|
|
1575
1575
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MetricFigure, { metric: metricOr(data.audience, OLDER_ROUTE), label: "Mailing list members" }),
|
|
1576
1576
|
(() => {
|
|
1577
1577
|
const growth = metricSortValue(data.audienceGrowth);
|
|
1578
|
-
if (growth === null)
|
|
1578
|
+
if (growth === null) {
|
|
1579
|
+
const reason = data.audienceGrowth?.status === "unavailable" ? data.audienceGrowth.detail : null;
|
|
1580
|
+
return reason ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 0, muted: true, children: reason }) : null;
|
|
1581
|
+
}
|
|
1579
1582
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_sanity_ui_compat3.Text, { size: 1, muted: true, children: [
|
|
1580
1583
|
growth > 0 ? "+" : "",
|
|
1581
1584
|
formatCount(growth),
|
|
@@ -2181,6 +2184,7 @@ function JourneyPanel({ data }) {
|
|
|
2181
2184
|
] })
|
|
2182
2185
|
] });
|
|
2183
2186
|
}
|
|
2187
|
+
var MIN_FAMILY_VIEWS = 30;
|
|
2184
2188
|
function catalogueRate(rows) {
|
|
2185
2189
|
let views = 0;
|
|
2186
2190
|
let sales = 0;
|
|
@@ -2197,6 +2201,8 @@ function buyRateIndex(row, benchmark) {
|
|
|
2197
2201
|
const rate = row.buyRate;
|
|
2198
2202
|
if (benchmark === null || benchmark <= 0) return null;
|
|
2199
2203
|
if (rate === null || rate === void 0 || !Number.isFinite(rate) || rate < 0) return null;
|
|
2204
|
+
const views = metricSortValue(row.viewed);
|
|
2205
|
+
if (views === null || views < MIN_FAMILY_VIEWS) return null;
|
|
2200
2206
|
return rate / benchmark;
|
|
2201
2207
|
}
|
|
2202
2208
|
function TypefaceInterestPanel({ data }) {
|
|
@@ -2208,7 +2214,9 @@ function TypefaceInterestPanel({ data }) {
|
|
|
2208
2214
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_sanity_ui_compat3.Text, { size: 1, muted: true, children: [
|
|
2209
2215
|
"Sort by any column. \u201CSells vs catalogue\u201D compares each family\u2019s sales-per-view against the catalogue as a whole \u2014 1.0\xD7 is average, and sorting up finds the families that are looked at and do not sell. It is a comparison between your families, not the share of visitors who buy: Google Analytics sees only a fraction of the views, which moves every family together and so cancels out here. With one or two sales a family will still swing a long way, so read it alongside the order counts beside it.",
|
|
2210
2216
|
" ",
|
|
2211
|
-
"Bought and Revenue come from your own orders and are exact \u2014 do not scale those up."
|
|
2217
|
+
"Bought and Revenue come from your own orders and are exact \u2014 do not scale those up.",
|
|
2218
|
+
" ",
|
|
2219
|
+
"A family needs a reasonable number of views before it gets a comparison at all; below that it says so rather than ranking one order against the catalogue."
|
|
2212
2220
|
] }),
|
|
2213
2221
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2214
2222
|
SortableTable,
|
|
@@ -2308,7 +2316,9 @@ function TypefaceInterestPanel({ data }) {
|
|
|
2308
2316
|
render: (row) => {
|
|
2309
2317
|
const index = buyRateIndex(row, benchmark);
|
|
2310
2318
|
if (index === null) {
|
|
2311
|
-
|
|
2319
|
+
const views = metricSortValue(row.viewed);
|
|
2320
|
+
const tooQuiet = views !== null && views < MIN_FAMILY_VIEWS;
|
|
2321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, muted: true, "aria-label": `${row.typeface} not comparable`, children: tooQuiet ? "too few views to compare" : "\u2014" });
|
|
2312
2322
|
}
|
|
2313
2323
|
if (index === 0) {
|
|
2314
2324
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sanity_ui_compat3.Text, { size: 1, children: "No sales" });
|