@nivaro/react 0.3.6 → 0.3.7
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/RecordDrilldownSheet.js +79 -63
- package/dist/shared/components/StaleBuildChip.js +37 -0
- package/dist/shared/components/chat/ChatPanel.js +235 -233
- package/dist/shared/components/profile/PersonAdminTools.js +90 -88
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { normalizeReplaySampling as x, replaySampleDraw as Ae, currentReplayRout
|
|
|
8
8
|
import { emitReplayTap as Ce, setReplayRecorderMode as N, registerReplayCapture as Ie, clipEndOffset as _e, withClipKind as De } from "../shared/lib/replay-capture.js";
|
|
9
9
|
import { instrumentConsole as qe, instrumentRequests as Le, redactSecrets as Te } from "../shared/lib/replay-context.js";
|
|
10
10
|
import { instrumentSocket as Pe } from "../shared/lib/replay-socket.js";
|
|
11
|
-
const Ne = "nivaro-react@0.3.
|
|
11
|
+
const Ne = "nivaro-react@0.3.7", j = 1e4, Me = 150, Oe = 3e3, Ue = 600, We = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
12
12
|
function Fe(n) {
|
|
13
13
|
return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
|
|
14
14
|
const l = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { jsxs as a, Fragment as M, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as T, useQuery as G } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as J, Eye as U, ExternalLink as X } from "lucide-react";
|
|
4
|
+
import { useState as Y, useCallback as R, useMemo as Z, Suspense as $, lazy as j } from "react";
|
|
5
|
+
import { useNivaroClient as L, useItemNavigation as P, useDrilldownViews as ee, DrilldownContext as v } from "../context.js";
|
|
6
|
+
import { get as te } from "../lib/commands.js";
|
|
7
|
+
import { usePresence as le } from "../lib/presence-hooks.js";
|
|
8
|
+
import { titleCase as re } from "../lib/utils.js";
|
|
9
|
+
import { DesignCanvas as oe } from "./layout-editor/design-canvas.js";
|
|
10
|
+
import { Sheet as ne, SheetContent as ae, SheetHeader as ie, SheetTitle as ce } from "./ui/sheet.js";
|
|
11
|
+
const se = j(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEditForm }))), q = j(
|
|
11
12
|
() => import("./RecordReadView.js").then((n) => ({ default: n.RecordReadView }))
|
|
12
13
|
), b = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(
|
|
13
14
|
"div",
|
|
@@ -16,34 +17,37 @@ const ae = q(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEdi
|
|
|
16
17
|
},
|
|
17
18
|
n
|
|
18
19
|
)) });
|
|
19
|
-
function
|
|
20
|
+
function we({
|
|
20
21
|
collection: n,
|
|
21
|
-
itemId:
|
|
22
|
-
layoutId:
|
|
23
|
-
rootLayoutSlug:
|
|
24
|
-
width:
|
|
25
|
-
title:
|
|
26
|
-
stack:
|
|
27
|
-
onPush:
|
|
28
|
-
onPop:
|
|
29
|
-
onClose:
|
|
22
|
+
itemId: E,
|
|
23
|
+
layoutId: W,
|
|
24
|
+
rootLayoutSlug: y,
|
|
25
|
+
width: f,
|
|
26
|
+
title: F,
|
|
27
|
+
stack: p,
|
|
28
|
+
onPush: u,
|
|
29
|
+
onPop: h,
|
|
30
|
+
onClose: K,
|
|
30
31
|
design: l
|
|
31
32
|
}) {
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
{ collection: n, itemId:
|
|
35
|
-
]),
|
|
33
|
+
var D;
|
|
34
|
+
const O = T(), Q = L(), { open: _ } = P(), [A, w] = Y([
|
|
35
|
+
{ collection: n, itemId: E, layoutId: W, width: f, title: F }
|
|
36
|
+
]), s = p != null, i = s && p.length ? p : A, e = l ? i[0] : i[i.length - 1], k = R(
|
|
36
37
|
(o) => {
|
|
37
|
-
|
|
38
|
+
s ? u == null || u(o) : w((H) => [...H, o]);
|
|
38
39
|
},
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
}, [
|
|
40
|
+
[s, u]
|
|
41
|
+
), g = R(() => {
|
|
42
|
+
s ? h == null || h() : w((o) => o.slice(0, -1));
|
|
43
|
+
}, [s, h]), { viewers: c } = le(
|
|
44
|
+
l ? null : e.collection,
|
|
45
|
+
l ? null : e.itemId
|
|
46
|
+
), x = Z(() => l ? null : { open: k }, [l, k]), V = ee(), d = l ? null : V[e.collection] ?? null, m = !l && i.length === 1 && !!y, { data: z, isLoading: B } = G({
|
|
43
47
|
queryKey: ["drilldown-layout", e.collection, e.layoutId ?? null],
|
|
44
|
-
enabled: !
|
|
45
|
-
queryFn: () =>
|
|
46
|
-
|
|
48
|
+
enabled: !m && !l,
|
|
49
|
+
queryFn: () => Q.request(
|
|
50
|
+
te(
|
|
47
51
|
`/collection-layouts/detail/${e.collection}`,
|
|
48
52
|
e.layoutId ? { layout_id: e.layoutId } : {}
|
|
49
53
|
)
|
|
@@ -51,40 +55,52 @@ function xe({
|
|
|
51
55
|
}), r = l ? {
|
|
52
56
|
...l.layout,
|
|
53
57
|
layout: l.layout.layout ?? { id: 0, name: "", slug: null }
|
|
54
|
-
} : z,
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
58
|
+
} : z, N = m ? y ?? void 0 : (r == null ? void 0 : r.layout.slug) ?? void 0, I = (D = r == null ? void 0 : r.layout) == null ? void 0 : D.sheet_width, C = /* @__PURE__ */ a(M, { children: [
|
|
59
|
+
/* @__PURE__ */ a("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
60
|
+
i.length > 1 && /* @__PURE__ */ t(
|
|
57
61
|
"button",
|
|
58
62
|
{
|
|
59
63
|
type: "button",
|
|
60
64
|
"aria-label": "Back",
|
|
61
|
-
onClick:
|
|
65
|
+
onClick: g,
|
|
62
66
|
className: "shrink-0 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
63
|
-
children: /* @__PURE__ */ t(
|
|
67
|
+
children: /* @__PURE__ */ t(J, { className: "h-4 w-4" })
|
|
64
68
|
}
|
|
65
69
|
),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
!
|
|
70
|
+
/* @__PURE__ */ a("span", { className: "truncate", children: [
|
|
71
|
+
re(e.collection),
|
|
72
|
+
!m && r ? ` · ${r.layout.name}` : ""
|
|
69
73
|
] })
|
|
70
74
|
] }),
|
|
71
|
-
!l && /* @__PURE__ */
|
|
75
|
+
!l && c.length > 0 && /* @__PURE__ */ a(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
className: "ml-auto flex min-w-0 items-center gap-1 text-[11px] font-normal text-slate-500 dark:text-slate-400",
|
|
79
|
+
"data-drill-viewers": c.length,
|
|
80
|
+
"data-tip": `Also viewing: ${c.map((o) => o.name).join(", ")}`,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ t(U, { className: "h-3 w-3 shrink-0" }),
|
|
83
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: c.length === 1 ? c[0].name : `${c.length} others` })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
!l && /* @__PURE__ */ a(
|
|
72
88
|
"button",
|
|
73
89
|
{
|
|
74
90
|
type: "button",
|
|
75
|
-
onClick: () =>
|
|
91
|
+
onClick: () => _({ collection: e.collection, itemId: e.itemId }),
|
|
76
92
|
className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
|
|
77
93
|
children: [
|
|
78
94
|
"Open record ",
|
|
79
|
-
/* @__PURE__ */ t(
|
|
95
|
+
/* @__PURE__ */ t(X, { className: "h-3 w-3" })
|
|
80
96
|
]
|
|
81
97
|
}
|
|
82
98
|
)
|
|
83
|
-
] }),
|
|
99
|
+
] }), S = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: d ? /* @__PURE__ */ t(v.Provider, { value: x, children: d.render({ itemId: String(e.itemId) }) }) : B && !m ? b : !m && (r == null ? void 0 : r.layout.display_mode) === "read" ? (
|
|
84
100
|
// Read-only presentation — definition grids + tabbed child lists,
|
|
85
101
|
// no form inputs. Editing lives on the full record page.
|
|
86
|
-
/* @__PURE__ */ t(
|
|
87
|
-
|
|
102
|
+
/* @__PURE__ */ t(v.Provider, { value: x, children: /* @__PURE__ */ t($, { fallback: b, children: l ? /* @__PURE__ */ t(q, { collection: e.collection, design: l }) : /* @__PURE__ */ t(
|
|
103
|
+
q,
|
|
88
104
|
{
|
|
89
105
|
collection: e.collection,
|
|
90
106
|
itemId: e.itemId,
|
|
@@ -92,48 +108,48 @@ function xe({
|
|
|
92
108
|
},
|
|
93
109
|
`${e.collection}:${e.itemId}:read`
|
|
94
110
|
) }) })
|
|
95
|
-
) : /* @__PURE__ */ t(
|
|
96
|
-
|
|
111
|
+
) : /* @__PURE__ */ t(v.Provider, { value: x, children: /* @__PURE__ */ t($, { fallback: b, children: /* @__PURE__ */ t(
|
|
112
|
+
se,
|
|
97
113
|
{
|
|
98
114
|
collection: e.collection,
|
|
99
115
|
itemId: e.itemId,
|
|
100
|
-
layoutSlug:
|
|
116
|
+
layoutSlug: N,
|
|
101
117
|
onSaved: () => {
|
|
102
|
-
|
|
118
|
+
O.invalidateQueries({ queryKey: ["queue-items"] });
|
|
103
119
|
},
|
|
104
120
|
design: l
|
|
105
121
|
},
|
|
106
|
-
`${e.collection}:${e.itemId}:${
|
|
122
|
+
`${e.collection}:${e.itemId}:${N ?? "default"}`
|
|
107
123
|
) }) }) });
|
|
108
|
-
return l ? /* @__PURE__ */ t(
|
|
124
|
+
return l ? /* @__PURE__ */ t(oe, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ a(
|
|
109
125
|
"div",
|
|
110
126
|
{
|
|
111
127
|
"data-design-sheet": !0,
|
|
112
128
|
className: "flex h-full min-h-0 flex-col gap-0 overflow-hidden rounded-lg border border-slate-200 bg-background shadow-sm dark:border-border",
|
|
113
|
-
style: { width: I ??
|
|
129
|
+
style: { width: I ?? f ?? 640, maxWidth: "100%" },
|
|
114
130
|
children: [
|
|
115
|
-
/* @__PURE__ */ t("div", { className: "flex shrink-0 flex-col border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children:
|
|
116
|
-
|
|
131
|
+
/* @__PURE__ */ t("div", { className: "flex shrink-0 flex-col border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: C }) }),
|
|
132
|
+
S
|
|
117
133
|
]
|
|
118
134
|
}
|
|
119
|
-
) }) : /* @__PURE__ */ t(
|
|
120
|
-
|
|
135
|
+
) }) : /* @__PURE__ */ t(ne, { open: !0, onOpenChange: (o) => !o && K(), children: /* @__PURE__ */ a(
|
|
136
|
+
ae,
|
|
121
137
|
{
|
|
122
138
|
className: "flex flex-col gap-0 overflow-hidden p-0",
|
|
123
139
|
style: {
|
|
124
|
-
width: (d == null ? void 0 : d.width) ?? e.width ?? I ??
|
|
140
|
+
width: (d == null ? void 0 : d.width) ?? e.width ?? I ?? f ?? 640,
|
|
125
141
|
maxWidth: "96vw"
|
|
126
142
|
},
|
|
127
|
-
onEscapeKeyDown:
|
|
128
|
-
o.preventDefault(),
|
|
143
|
+
onEscapeKeyDown: i.length > 1 ? (o) => {
|
|
144
|
+
o.preventDefault(), g();
|
|
129
145
|
} : void 0,
|
|
130
146
|
children: [
|
|
131
|
-
/* @__PURE__ */ t(
|
|
132
|
-
|
|
147
|
+
/* @__PURE__ */ t(ie, { className: "shrink-0 border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t(ce, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: C }) }),
|
|
148
|
+
S
|
|
133
149
|
]
|
|
134
150
|
}
|
|
135
151
|
) });
|
|
136
152
|
}
|
|
137
153
|
export {
|
|
138
|
-
|
|
154
|
+
we as RecordDrilldownSheet
|
|
139
155
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "../lib/utils.js";
|
|
3
|
+
function t(e) {
|
|
4
|
+
const n = `${e.tabs} tab${e.tabs === 1 ? "" : "s"}`;
|
|
5
|
+
return e.reason === "api" ? `${e.app}: loaded before the API update (${n})` : `${e.app}: ${e.build ?? "unknown build"}${e.current_build ? ` — current is ${e.current_build}` : ""} (${n})`;
|
|
6
|
+
}
|
|
7
|
+
function s({
|
|
8
|
+
builds: e,
|
|
9
|
+
className: n
|
|
10
|
+
}) {
|
|
11
|
+
if (!(e != null && e.length)) return null;
|
|
12
|
+
const a = `Needs a reload — running an old version
|
|
13
|
+
${e.map(t).join(`
|
|
14
|
+
`)}
|
|
15
|
+
Force client refresh → Old versions on /realtime reloads them.`;
|
|
16
|
+
return /* @__PURE__ */ r(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
className: i(
|
|
20
|
+
"ml-1.5 rounded-full bg-rose-500/10 px-1.5 py-px text-[10px] font-medium text-rose-700 dark:text-rose-300",
|
|
21
|
+
n
|
|
22
|
+
),
|
|
23
|
+
"data-stale-build": e.map((o) => o.app).join(","),
|
|
24
|
+
"data-tip": a,
|
|
25
|
+
children: [
|
|
26
|
+
"Old build",
|
|
27
|
+
/* @__PURE__ */ r("span", { className: "sr-only", children: [
|
|
28
|
+
": needs a reload — ",
|
|
29
|
+
e.map(t).join("; ")
|
|
30
|
+
] })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
s as StaleBuildChip
|
|
37
|
+
};
|