@nivaro/react 0.3.134 → 0.3.135
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/delivery-analytics/DeliveryAnalyticsView.js +13 -13
- package/dist/shared/components/delivery-analytics/charts.js +23 -23
- package/dist/shared/components/delivery-analytics/drill.js +358 -315
- package/dist/shared/components/delivery-analytics/ui.js +83 -75
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import { noteReplayIdle as Me, createReplayIdleState as Ne, REPLAY_IDLE_RESTART_
|
|
|
10
10
|
import { noteReplayEvent as Ue, createReplayCheckoutState as We } from "../shared/lib/replay-checkout.js";
|
|
11
11
|
import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
|
|
12
12
|
import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
|
|
13
|
-
const ze = "nivaro-react@0.3.
|
|
13
|
+
const ze = "nivaro-react@0.3.135", V = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, X = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
14
14
|
function Je(o) {
|
|
15
15
|
return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
|
|
16
16
|
const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
@@ -11,7 +11,7 @@ import { Skeleton as k } from "../ui/skeleton.js";
|
|
|
11
11
|
import { TrendBars as H } from "./charts.js";
|
|
12
12
|
import { DrillSheet as ce } from "./drill.js";
|
|
13
13
|
import { DrillContext as me, Segmented as K, FilterPicker as A, Panel as $, Num as m, Delta as j, OutcomeChip as G, ShareBar as Z } from "./ui.js";
|
|
14
|
-
import { useParamState as he, writeDrill as pe, titleize as _, fmtRange as ue, pct as L, fmtInt as E, mins as
|
|
14
|
+
import { useParamState as he, writeDrill as pe, titleize as _, fmtRange as ue, pct as L, fmtInt as E, mins as P } from "./url.js";
|
|
15
15
|
const B = [
|
|
16
16
|
{ value: "24h", label: "24h" },
|
|
17
17
|
{ value: "7d", label: "7d" },
|
|
@@ -81,7 +81,7 @@ function fe({
|
|
|
81
81
|
return r.set("by", y), d && (r.set("from", d.window.from), r.set("to", d.window.to), r.set("asof", d.asof)), p.request(q(`/delivery-analytics/breakdown?${r.toString()}`)).then((c) => c.data);
|
|
82
82
|
},
|
|
83
83
|
staleTime: 6e4
|
|
84
|
-
}), R = y === "category" ? d == null ? void 0 : d.breakdown : g.data,
|
|
84
|
+
}), R = y === "category" ? d == null ? void 0 : d.breakdown : g.data, D = ne(
|
|
85
85
|
(r, c, u) => b((v) => {
|
|
86
86
|
pe(v, r, c), u != null && u.sort && v.set("ds", u.sort);
|
|
87
87
|
}),
|
|
@@ -106,8 +106,8 @@ function fe({
|
|
|
106
106
|
for (const c of d.channels)
|
|
107
107
|
for (const u of c.statuses) r.set(`ch.${c.channel}=${u.status}`, u.label);
|
|
108
108
|
return r;
|
|
109
|
-
}, [d, R]),
|
|
110
|
-
return /* @__PURE__ */ l(me.Provider, { value:
|
|
109
|
+
}, [d, R]), M = h.get("window") ?? "7d", Y = Number(h.get("acted") ?? 24);
|
|
110
|
+
return /* @__PURE__ */ l(me.Provider, { value: s.isPlaceholderData ? null : D, children: [
|
|
111
111
|
/* @__PURE__ */ l("div", { className: f("flex flex-1 min-h-0 flex-col", i), "data-nvr-delivery-analytics": "", children: [
|
|
112
112
|
/* @__PURE__ */ l(
|
|
113
113
|
"header",
|
|
@@ -123,7 +123,7 @@ function fe({
|
|
|
123
123
|
K,
|
|
124
124
|
{
|
|
125
125
|
ariaLabel: "Window",
|
|
126
|
-
value: B.some((r) => r.value ===
|
|
126
|
+
value: B.some((r) => r.value === M) ? M : "custom",
|
|
127
127
|
options: [...B],
|
|
128
128
|
onChange: (r) => b((c) => {
|
|
129
129
|
c.set("window", String(r)), c.delete("from"), c.delete("to");
|
|
@@ -133,7 +133,7 @@ function fe({
|
|
|
133
133
|
/* @__PURE__ */ e(
|
|
134
134
|
ge,
|
|
135
135
|
{
|
|
136
|
-
active:
|
|
136
|
+
active: M === "custom",
|
|
137
137
|
from: h.get("from"),
|
|
138
138
|
to: h.get("to"),
|
|
139
139
|
onApply: (r, c) => b((u) => {
|
|
@@ -284,7 +284,7 @@ function ge({
|
|
|
284
284
|
"aria-pressed": i,
|
|
285
285
|
className: f(
|
|
286
286
|
"inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
287
|
-
i ? "border-
|
|
287
|
+
i ? "border-[#0f172a] bg-[#0f172a] text-white dark:border-nvr-cyan dark:bg-nvr-cyan dark:text-[#172940]" : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-muted-foreground dark:hover:bg-muted"
|
|
288
288
|
),
|
|
289
289
|
children: [
|
|
290
290
|
/* @__PURE__ */ e(ee, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
@@ -297,7 +297,7 @@ function ge({
|
|
|
297
297
|
[
|
|
298
298
|
["From", n, N],
|
|
299
299
|
["To", s, d]
|
|
300
|
-
].map(([g, R,
|
|
300
|
+
].map(([g, R, D]) => /* @__PURE__ */ l("label", { className: "block text-[12px] text-slate-600 dark:text-muted-foreground", children: [
|
|
301
301
|
g,
|
|
302
302
|
/* @__PURE__ */ e(
|
|
303
303
|
"input",
|
|
@@ -305,7 +305,7 @@ function ge({
|
|
|
305
305
|
type: "date",
|
|
306
306
|
value: R,
|
|
307
307
|
max: p,
|
|
308
|
-
onChange: (C) =>
|
|
308
|
+
onChange: (C) => D(C.target.value),
|
|
309
309
|
className: "mt-0.5 block h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background dark:text-foreground"
|
|
310
310
|
}
|
|
311
311
|
)
|
|
@@ -481,7 +481,7 @@ function we({ summary: i }) {
|
|
|
481
481
|
label: "Time to read",
|
|
482
482
|
sub: /* @__PURE__ */ l(w, { children: [
|
|
483
483
|
"p90 ",
|
|
484
|
-
|
|
484
|
+
P(t.ttr.p90),
|
|
485
485
|
" · over",
|
|
486
486
|
" ",
|
|
487
487
|
/* @__PURE__ */ e(m, { cell: t.timed, label: "Read, with a read time", sort: "ttr" })
|
|
@@ -493,7 +493,7 @@ function we({ summary: i }) {
|
|
|
493
493
|
label: "Read, slowest first",
|
|
494
494
|
sort: "ttr",
|
|
495
495
|
tip: "Median — show these, slowest first",
|
|
496
|
-
children:
|
|
496
|
+
children: P(t.ttr.p50)
|
|
497
497
|
}
|
|
498
498
|
)
|
|
499
499
|
}
|
|
@@ -1027,10 +1027,10 @@ function _e({
|
|
|
1027
1027
|
label: `${s.label} · read, slowest first`,
|
|
1028
1028
|
sort: "ttr",
|
|
1029
1029
|
tip: "Show the reads behind this, slowest first",
|
|
1030
|
-
children:
|
|
1030
|
+
children: P(s.p50)
|
|
1031
1031
|
}
|
|
1032
1032
|
) }),
|
|
1033
|
-
/* @__PURE__ */ e("td", { className: "px-3 py-1.5 text-right text-slate-500 dark:text-muted-foreground", children:
|
|
1033
|
+
/* @__PURE__ */ e("td", { className: "px-3 py-1.5 text-right text-slate-500 dark:text-muted-foreground", children: P(s.p90) }),
|
|
1034
1034
|
/* @__PURE__ */ e("td", { className: "px-3 py-1.5 text-right", children: /* @__PURE__ */ l("span", { className: "inline-flex items-baseline gap-1", children: [
|
|
1035
1035
|
/* @__PURE__ */ e(m, { cell: s.acted, label: `${s.label} · acted`, children: s.eligible.n ? L(s.acted.n, s.eligible.n) : "–" }),
|
|
1036
1036
|
s.eligible.n > 0 && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-400", children: [
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useContext as N, useMemo as
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as N, useMemo as y, useState as S, useEffect as C } from "react";
|
|
3
3
|
import { RechartsGate as E } from "../charts/RechartsGate.js";
|
|
4
4
|
import { COLOR_ROLES as R } from "../QueryTable.js";
|
|
5
5
|
import { Skeleton as $ } from "../ui/skeleton.js";
|
|
6
6
|
import { DrillContext as D } from "./ui.js";
|
|
7
|
-
import { bucketLabel as f, fmtInt as
|
|
8
|
-
const
|
|
7
|
+
import { bucketLabel as f, fmtInt as h } from "./url.js";
|
|
8
|
+
const v = () => typeof document < "u" && document.documentElement.classList.contains("dark");
|
|
9
9
|
function O() {
|
|
10
|
-
const [a, n] = S(
|
|
10
|
+
const [a, n] = S(v);
|
|
11
11
|
return C(() => {
|
|
12
12
|
if (typeof document > "u") return;
|
|
13
|
-
const d = new MutationObserver(() => n(
|
|
13
|
+
const d = new MutationObserver(() => n(v()));
|
|
14
14
|
return d.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => d.disconnect();
|
|
15
15
|
}, []), a;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const w = (a, n) => R[a][n ? 1 : 0];
|
|
18
18
|
function T({
|
|
19
19
|
summary: a,
|
|
20
20
|
kind: n,
|
|
21
21
|
height: d = 168
|
|
22
22
|
}) {
|
|
23
|
-
const l = O(),
|
|
23
|
+
const l = O(), m = N(D), o = a.window.bucket, s = y(() => {
|
|
24
24
|
const t = a.series;
|
|
25
25
|
return n === "notifications" ? [
|
|
26
26
|
{
|
|
@@ -46,19 +46,19 @@ function T({
|
|
|
46
46
|
{
|
|
47
47
|
key: "delivered",
|
|
48
48
|
label: "Sent",
|
|
49
|
-
color:
|
|
49
|
+
color: w("info", l),
|
|
50
50
|
cells: t.map((e) => e.email_delivered),
|
|
51
51
|
drillLabel: (e) => `Emails sent · ${f(e, o)}`
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
key: "failed",
|
|
55
55
|
label: "Failed",
|
|
56
|
-
color:
|
|
56
|
+
color: w("negative", l),
|
|
57
57
|
cells: t.map((e) => e.email_failed),
|
|
58
58
|
drillLabel: (e) => `Emails failed · ${f(e, o)}`
|
|
59
59
|
}
|
|
60
60
|
];
|
|
61
|
-
}, [a.series, n, l, o]),
|
|
61
|
+
}, [a.series, n, l, o]), k = y(
|
|
62
62
|
() => a.series.map((t, e) => ({
|
|
63
63
|
bucket: t.bucket,
|
|
64
64
|
label: f(t.bucket, o),
|
|
@@ -68,12 +68,12 @@ function T({
|
|
|
68
68
|
}))
|
|
69
69
|
})),
|
|
70
70
|
[a.series, s, o]
|
|
71
|
-
), L =
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */ r("ul", { className: "mb-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[11.5px] text-slate-600 dark:text-muted-foreground", children: s.map((t) => /* @__PURE__ */
|
|
71
|
+
), L = k.every((t) => s.every((e) => t[e.key] === 0)), x = l ? "#94a3b8" : "#64748b";
|
|
72
|
+
return /* @__PURE__ */ p("div", { children: [
|
|
73
|
+
/* @__PURE__ */ r("ul", { className: "mb-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[11.5px] text-slate-600 dark:text-muted-foreground", children: s.map((t) => /* @__PURE__ */ p("li", { className: "inline-flex items-center gap-1.5", children: [
|
|
74
74
|
/* @__PURE__ */ r("span", { className: "h-2 w-2 rounded-sm", style: { background: t.color }, "aria-hidden": !0 }),
|
|
75
75
|
t.label,
|
|
76
|
-
/* @__PURE__ */ r("span", { className: "tabular-nums text-slate-400 dark:text-muted-foreground/70", children:
|
|
76
|
+
/* @__PURE__ */ r("span", { className: "tabular-nums text-slate-400 dark:text-muted-foreground/70", children: h(t.cells.reduce((e, i) => e + i.n, 0)) })
|
|
77
77
|
] }, t.key)) }),
|
|
78
78
|
L ? /* @__PURE__ */ r(
|
|
79
79
|
"p",
|
|
@@ -82,10 +82,10 @@ function T({
|
|
|
82
82
|
style: { height: d },
|
|
83
83
|
children: n === "notifications" ? "No notifications in this window." : "No email in this window."
|
|
84
84
|
}
|
|
85
|
-
) : /* @__PURE__ */ r("div", { style: { height: d }, role: "img", "aria-label": `${n} per ${o}`, children: /* @__PURE__ */ r(E, { fallback: /* @__PURE__ */ r($, { className: "h-full w-full", "aria-busy": "true" }), children: (t) => /* @__PURE__ */ r(t.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */
|
|
85
|
+
) : /* @__PURE__ */ r("div", { style: { height: d }, role: "img", "aria-label": `${n} per ${o}`, children: /* @__PURE__ */ r(E, { fallback: /* @__PURE__ */ r($, { className: "h-full w-full", "aria-busy": "true" }), children: (t) => /* @__PURE__ */ r(t.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ p(
|
|
86
86
|
t.BarChart,
|
|
87
87
|
{
|
|
88
|
-
data:
|
|
88
|
+
data: k,
|
|
89
89
|
margin: { top: 4, right: 4, left: 0, bottom: 0 },
|
|
90
90
|
barCategoryGap: "18%",
|
|
91
91
|
children: [
|
|
@@ -94,7 +94,7 @@ function T({
|
|
|
94
94
|
t.XAxis,
|
|
95
95
|
{
|
|
96
96
|
dataKey: "label",
|
|
97
|
-
tick: { fontSize: 10.5, fill:
|
|
97
|
+
tick: { fontSize: 10.5, fill: x },
|
|
98
98
|
tickLine: !1,
|
|
99
99
|
axisLine: !1,
|
|
100
100
|
interval: "preserveStartEnd",
|
|
@@ -104,7 +104,7 @@ function T({
|
|
|
104
104
|
/* @__PURE__ */ r(
|
|
105
105
|
t.YAxis,
|
|
106
106
|
{
|
|
107
|
-
tick: { fontSize: 10.5, fill:
|
|
107
|
+
tick: { fontSize: 10.5, fill: x },
|
|
108
108
|
tickLine: !1,
|
|
109
109
|
axisLine: !1,
|
|
110
110
|
allowDecimals: !1,
|
|
@@ -125,7 +125,7 @@ function T({
|
|
|
125
125
|
formatter: (e, i) => {
|
|
126
126
|
var c;
|
|
127
127
|
return [
|
|
128
|
-
|
|
128
|
+
h(Number(e)),
|
|
129
129
|
((c = s.find((u) => u.key === i)) == null ? void 0 : c.label) ?? String(i)
|
|
130
130
|
];
|
|
131
131
|
}
|
|
@@ -138,11 +138,11 @@ function T({
|
|
|
138
138
|
stackId: "a",
|
|
139
139
|
fill: e.color,
|
|
140
140
|
radius: i === s.length - 1 ? [2, 2, 0, 0] : 0,
|
|
141
|
-
cursor: "pointer",
|
|
141
|
+
cursor: m ? "pointer" : "default",
|
|
142
142
|
isAnimationActive: !1,
|
|
143
143
|
onClick: (c, u) => {
|
|
144
|
-
const
|
|
145
|
-
m &&
|
|
144
|
+
const b = e.cells[u], g = a.series[u];
|
|
145
|
+
m && b && b.n > 0 && g && m(b, e.drillLabel(g.bucket));
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
e.key
|