@nivaro/react 0.3.12 → 0.3.13
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/index.d.ts +17 -0
- package/dist/index.js +583 -582
- package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
- package/dist/shared/context.js +71 -66
- package/package.json +1 -1
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { EyeOff as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsx as i, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as de } from "@tanstack/react-query";
|
|
3
|
+
import { EyeOff as ce, ArrowLeft as ue, Trash2 as me, Copy as le, FileUp as be, Bot as fe, UploadCloud as pe } from "lucide-react";
|
|
4
|
+
import { useState as y, useRef as g, useEffect as k } from "react";
|
|
5
5
|
import { toast as Q } from "sonner";
|
|
6
|
-
import { useNivaroClient as he, useItemEditAuth as
|
|
7
|
-
import { get as j, post as
|
|
8
|
-
import { useLiveRecord as
|
|
9
|
-
import { useOptionalRealtime as
|
|
10
|
-
import { useRecordTabsSignal as
|
|
11
|
-
import { userErrorMessage as
|
|
12
|
-
import { formatRelative as
|
|
13
|
-
|
|
6
|
+
import { useNivaroClient as he, useRecordSurface as ge, useItemEditAuth as ve } from "../../context.js";
|
|
7
|
+
import { get as j, post as xe } from "../../lib/commands.js";
|
|
8
|
+
import { useLiveRecord as ye, useLiveEvent as I, useLiveRecordEvent as ee, LIVE_ASPECTS as f, batchTouches as ke } from "../../lib/live.js";
|
|
9
|
+
import { useOptionalRealtime as we } from "../../lib/realtime.js";
|
|
10
|
+
import { useRecordTabsSignal as Ne, useRecordTabs as Te } from "../../lib/record-tabs.js";
|
|
11
|
+
import { userErrorMessage as Se } from "../../lib/safe-error.js";
|
|
12
|
+
import { formatRelative as Re } from "../../lib/utils.js";
|
|
13
|
+
function _e(e, r, l) {
|
|
14
|
+
var p;
|
|
15
|
+
if (l.active)
|
|
16
|
+
return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
|
|
17
|
+
const v = ((p = l.label) == null ? void 0 : p.trim()) || "A record in your tabs";
|
|
18
|
+
return {
|
|
19
|
+
text: e ? `${e} moved ${v} to ${r}` : `${v} moved to ${r}`,
|
|
20
|
+
open: l.open
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const $e = 8e3, Ee = [
|
|
14
24
|
"item",
|
|
15
25
|
"rrv-record",
|
|
16
26
|
"revisions",
|
|
@@ -29,26 +39,26 @@ const Te = 8e3, Se = [
|
|
|
29
39
|
"record-integrations",
|
|
30
40
|
"record-integrity"
|
|
31
41
|
];
|
|
32
|
-
function
|
|
33
|
-
const
|
|
42
|
+
function De(e, r, l) {
|
|
43
|
+
const v = new Set(Ee), p = String(l);
|
|
34
44
|
e.removeQueries({
|
|
35
|
-
predicate: (m) =>
|
|
45
|
+
predicate: (m) => v.has(m.queryKey[0]) && m.queryKey[1] === r && String(m.queryKey[2]) === p
|
|
36
46
|
});
|
|
37
47
|
}
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */ i("div", { className: "p-6", children: /* @__PURE__ */
|
|
48
|
+
function Ae({ onBack: e }) {
|
|
49
|
+
return /* @__PURE__ */ i("div", { className: "p-6", children: /* @__PURE__ */ d(
|
|
40
50
|
"div",
|
|
41
51
|
{
|
|
42
52
|
"data-record-gone": "access",
|
|
43
53
|
role: "alert",
|
|
44
54
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
45
55
|
children: [
|
|
46
|
-
/* @__PURE__ */ i(
|
|
47
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ i(ce, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
57
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
48
58
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "You no longer have access to this record." }),
|
|
49
59
|
" A role, scope or filter change hid it while you had it open."
|
|
50
60
|
] }),
|
|
51
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ d(
|
|
52
62
|
"button",
|
|
53
63
|
{
|
|
54
64
|
type: "button",
|
|
@@ -56,7 +66,7 @@ function _e({ onBack: e }) {
|
|
|
56
66
|
"data-record-gone-back": !0,
|
|
57
67
|
className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
|
|
58
68
|
children: [
|
|
59
|
-
/* @__PURE__ */ i(
|
|
69
|
+
/* @__PURE__ */ i(ue, { className: "h-3.5 w-3.5" }),
|
|
60
70
|
"Back"
|
|
61
71
|
]
|
|
62
72
|
}
|
|
@@ -65,228 +75,232 @@ function _e({ onBack: e }) {
|
|
|
65
75
|
}
|
|
66
76
|
) });
|
|
67
77
|
}
|
|
68
|
-
const
|
|
69
|
-
var
|
|
70
|
-
return (e == null ? void 0 : e.status) ?? ((
|
|
78
|
+
const Le = (e) => {
|
|
79
|
+
var r;
|
|
80
|
+
return (e == null ? void 0 : e.status) ?? ((r = e == null ? void 0 : e.response) == null ? void 0 : r.status);
|
|
71
81
|
};
|
|
72
|
-
function
|
|
82
|
+
function He({
|
|
73
83
|
collection: e,
|
|
74
|
-
itemId:
|
|
75
|
-
dirty:
|
|
76
|
-
loadDenied:
|
|
77
|
-
onGoneChange:
|
|
84
|
+
itemId: r,
|
|
85
|
+
dirty: l = !1,
|
|
86
|
+
loadDenied: v = !1,
|
|
87
|
+
onGoneChange: p
|
|
78
88
|
}) {
|
|
79
|
-
const m =
|
|
80
|
-
|
|
81
|
-
const h = g(null),
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const m = we(), R = he(), w = de(), [D, K] = y(!1), [A, re] = y([]), [o, te] = y(null), [se, L] = y({}), [U, B] = y(!1), [F, P] = y(!1), N = g(null), T = g(null), _ = g(Date.now()), C = g(null), $ = g(p);
|
|
90
|
+
$.current = p;
|
|
91
|
+
const h = g(null), Y = ge(), H = g(Y);
|
|
92
|
+
H.current = Y;
|
|
93
|
+
const S = (s) => {
|
|
94
|
+
var t;
|
|
95
|
+
h.current = s, te(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => De(w, e, r), 0);
|
|
84
96
|
};
|
|
85
|
-
|
|
86
|
-
_.current = Date.now(),
|
|
87
|
-
}, [e,
|
|
88
|
-
const
|
|
89
|
-
for (const
|
|
90
|
-
},
|
|
91
|
-
let
|
|
97
|
+
k(() => {
|
|
98
|
+
_.current = Date.now(), C.current = null, L({}), h.current && S(null);
|
|
99
|
+
}, [e, r]);
|
|
100
|
+
const c = (s) => {
|
|
101
|
+
for (const t of s) w.invalidateQueries({ queryKey: t });
|
|
102
|
+
}, M = async (s) => {
|
|
103
|
+
let t = null;
|
|
92
104
|
try {
|
|
93
|
-
|
|
94
|
-
j("/trash/record", { collection: e, item:
|
|
105
|
+
t = (await R.request(
|
|
106
|
+
j("/trash/record", { collection: e, item: r })
|
|
95
107
|
)).data;
|
|
96
108
|
} catch {
|
|
97
|
-
|
|
109
|
+
t = null;
|
|
98
110
|
}
|
|
99
|
-
const n = !!(
|
|
100
|
-
|
|
111
|
+
const n = !!(t != null && t.deleted_at) && new Date(t.deleted_at).getTime() >= _.current - 6e4;
|
|
112
|
+
S(n || s === "deleted" && !t ? {
|
|
101
113
|
kind: "deleted",
|
|
102
|
-
by: (
|
|
103
|
-
at: (
|
|
104
|
-
trashId: (
|
|
105
|
-
canRestore: !!(
|
|
114
|
+
by: (t == null ? void 0 : t.deleted_by_name) ?? null,
|
|
115
|
+
at: (t == null ? void 0 : t.deleted_at) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
116
|
+
trashId: (t == null ? void 0 : t.trash_id) ?? null,
|
|
117
|
+
canRestore: !!(t != null && t.can_restore)
|
|
106
118
|
} : { kind: "access" });
|
|
107
|
-
},
|
|
119
|
+
}, ae = async () => {
|
|
108
120
|
var s;
|
|
109
121
|
try {
|
|
110
|
-
const
|
|
111
|
-
j(`/pipelines/instance/${e}/${
|
|
112
|
-
)).data, n = (s =
|
|
113
|
-
if (!n || n.id ===
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
const t = (await R.request(
|
|
123
|
+
j(`/pipelines/instance/${e}/${r}`)
|
|
124
|
+
)).data, n = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
|
|
125
|
+
if (!n || n.id === C.current || n.timestamp && new Date(n.timestamp).getTime() < _.current - 5e3 || (C.current = n.id, typeof document < "u" && document.visibilityState === "hidden")) return;
|
|
126
|
+
const u = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.user_email || null, x = n.to_state_label ?? "a new state", a = _e(u, x, H.current);
|
|
127
|
+
Q.info(
|
|
128
|
+
a.text,
|
|
129
|
+
a.open ? { action: { label: "Open", onClick: a.open } } : {}
|
|
130
|
+
);
|
|
117
131
|
} catch {
|
|
118
132
|
}
|
|
119
|
-
},
|
|
133
|
+
}, ne = (s) => {
|
|
120
134
|
var n;
|
|
121
135
|
if (s.deleted) {
|
|
122
|
-
|
|
136
|
+
M("deleted");
|
|
123
137
|
return;
|
|
124
138
|
}
|
|
125
139
|
if (h.current) return;
|
|
126
|
-
s.events.some((
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
["pipeline-instance", e,
|
|
130
|
-
["pipeline-all-owners", e,
|
|
131
|
-
["pipeline-instance-owners", e,
|
|
132
|
-
["pipeline-owners-resolved", e,
|
|
133
|
-
["approval-brief", e,
|
|
134
|
-
]), (n = s.changedFields) != null && n.includes(
|
|
135
|
-
["comments", e,
|
|
136
|
-
["comments-related", e,
|
|
137
|
-
]) : (
|
|
138
|
-
["erp-submissions", e,
|
|
139
|
-
["record-integrations", e,
|
|
140
|
+
s.events.some((u) => u.source === "import" && !u.own) && (P(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => P(!1), $e));
|
|
141
|
+
const t = (u) => ke(s, u);
|
|
142
|
+
if (t(f.state) && (c([
|
|
143
|
+
["pipeline-instance", e, r],
|
|
144
|
+
["pipeline-all-owners", e, r],
|
|
145
|
+
["pipeline-instance-owners", e, r],
|
|
146
|
+
["pipeline-owners-resolved", e, r],
|
|
147
|
+
["approval-brief", e, r]
|
|
148
|
+
]), (n = s.changedFields) != null && n.includes(f.state) && ae()), t(f.addendums) && c([["addendums", e, r]]), t(f.comments) ? c([
|
|
149
|
+
["comments", e, r],
|
|
150
|
+
["comments-related", e, r]
|
|
151
|
+
]) : (t(f.state) || t(f.integrations) || t(f.addendums) || !s.aspectsOnly) && c([["comments-related", e, r]]), t(f.tasks) && c([["tasks", e, r]]), t(f.integrations) && c([
|
|
152
|
+
["erp-submissions", e, r],
|
|
153
|
+
["record-integrations", e, r]
|
|
140
154
|
]), !s.aspectsOnly) {
|
|
141
|
-
if (s.ids.length > 0 && s.ids.every((
|
|
142
|
-
|
|
143
|
-
["item", e,
|
|
144
|
-
["pipeline-instance", e,
|
|
155
|
+
if (s.ids.length > 0 && s.ids.every((u) => u === "*")) {
|
|
156
|
+
c([
|
|
157
|
+
["item", e, r],
|
|
158
|
+
["pipeline-instance", e, r]
|
|
145
159
|
]);
|
|
146
160
|
return;
|
|
147
161
|
}
|
|
148
|
-
|
|
162
|
+
V();
|
|
149
163
|
}
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
["item", e,
|
|
164
|
+
}, V = () => {
|
|
165
|
+
c([
|
|
166
|
+
["item", e, r],
|
|
153
167
|
// Summary mode reads its own copy (#1869) — it diffs + highlights.
|
|
154
|
-
["rrv-record", e,
|
|
155
|
-
["field-touch", e,
|
|
156
|
-
["revisions", e,
|
|
168
|
+
["rrv-record", e, r],
|
|
169
|
+
["field-touch", e, r],
|
|
170
|
+
["revisions", e, r],
|
|
157
171
|
// Who made the write — the field ghosts (#2) attribute from it.
|
|
158
|
-
["last-touch", e,
|
|
159
|
-
]), K(!0),
|
|
172
|
+
["last-touch", e, r]
|
|
173
|
+
]), K(!0), T.current && clearTimeout(T.current), T.current = setTimeout(() => K(!1), 4e3);
|
|
160
174
|
};
|
|
161
|
-
|
|
162
|
-
const { userId:
|
|
163
|
-
|
|
164
|
-
h.current || (
|
|
165
|
-
["pipeline-instance", e,
|
|
166
|
-
["comments", e,
|
|
167
|
-
["tasks", e,
|
|
175
|
+
ye(e, r, ne);
|
|
176
|
+
const { userId: z } = ve();
|
|
177
|
+
Ne(z, "saved", e, r, () => {
|
|
178
|
+
h.current || (V(), c([
|
|
179
|
+
["pipeline-instance", e, r],
|
|
180
|
+
["comments", e, r],
|
|
181
|
+
["tasks", e, r],
|
|
168
182
|
// Lines and links saved with it (the keys are per relation, not per record).
|
|
169
183
|
["o2m-rows"],
|
|
170
184
|
["m2m-items"]
|
|
171
185
|
]));
|
|
172
|
-
}),
|
|
186
|
+
}), k(
|
|
173
187
|
() => () => {
|
|
174
|
-
|
|
188
|
+
T.current && clearTimeout(T.current), N.current && clearTimeout(N.current);
|
|
175
189
|
},
|
|
176
190
|
[]
|
|
177
|
-
),
|
|
191
|
+
), I(
|
|
178
192
|
"owners:changed",
|
|
179
193
|
() => {
|
|
180
|
-
h.current ||
|
|
181
|
-
["pipeline-instance-owners", e,
|
|
182
|
-
["pipeline-owners-resolved", e,
|
|
183
|
-
["pipeline-all-owners", e,
|
|
184
|
-
["approval-brief", e,
|
|
194
|
+
h.current || c([
|
|
195
|
+
["pipeline-instance-owners", e, r],
|
|
196
|
+
["pipeline-owners-resolved", e, r],
|
|
197
|
+
["pipeline-all-owners", e, r],
|
|
198
|
+
["approval-brief", e, r]
|
|
185
199
|
]);
|
|
186
200
|
},
|
|
187
201
|
{ debounceMs: 400 }
|
|
188
|
-
),
|
|
202
|
+
), ee(
|
|
189
203
|
"record:integrity",
|
|
190
204
|
e,
|
|
191
|
-
|
|
192
|
-
() =>
|
|
205
|
+
r,
|
|
206
|
+
() => c([["record-integrity", e, r]])
|
|
193
207
|
);
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
const n =
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
const { [
|
|
202
|
-
return
|
|
208
|
+
const G = g(/* @__PURE__ */ new Map());
|
|
209
|
+
ee("record:automation", e, r, (s) => {
|
|
210
|
+
const t = String((s == null ? void 0 : s.flow_id) ?? "");
|
|
211
|
+
if (!t) return;
|
|
212
|
+
const n = G.current, u = n.get(t);
|
|
213
|
+
u && clearTimeout(u), n.delete(t);
|
|
214
|
+
const x = () => L((a) => {
|
|
215
|
+
const { [t]: b, ...q } = a;
|
|
216
|
+
return q;
|
|
203
217
|
});
|
|
204
218
|
if ((s == null ? void 0 : s.state) === "end") {
|
|
205
|
-
|
|
219
|
+
x();
|
|
206
220
|
return;
|
|
207
221
|
}
|
|
208
|
-
|
|
209
|
-
}),
|
|
210
|
-
const s =
|
|
222
|
+
L((a) => ({ ...a, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), n.set(t, setTimeout(x, 5 * 6e4));
|
|
223
|
+
}), k(() => {
|
|
224
|
+
const s = G.current;
|
|
211
225
|
return () => {
|
|
212
|
-
for (const
|
|
226
|
+
for (const t of s.values()) clearTimeout(t);
|
|
213
227
|
s.clear();
|
|
214
228
|
};
|
|
215
|
-
}, []),
|
|
229
|
+
}, []), I(
|
|
216
230
|
"access:changed",
|
|
217
231
|
() => {
|
|
218
232
|
setTimeout(
|
|
219
233
|
() => {
|
|
220
234
|
var s;
|
|
221
|
-
((s = h.current) == null ? void 0 : s.kind) !== "deleted" && R.request(j(`/items/${e}/${
|
|
222
|
-
var
|
|
223
|
-
((
|
|
224
|
-
}).catch((
|
|
225
|
-
const n =
|
|
226
|
-
(n === 403 || n === 404) &&
|
|
235
|
+
((s = h.current) == null ? void 0 : s.kind) !== "deleted" && R.request(j(`/items/${e}/${r}`, { fields: "id" })).then(() => {
|
|
236
|
+
var t;
|
|
237
|
+
((t = h.current) == null ? void 0 : t.kind) === "access" && (S(null), c([["item", e, r]]));
|
|
238
|
+
}).catch((t) => {
|
|
239
|
+
const n = Le(t);
|
|
240
|
+
(n === 403 || n === 404) && M("access");
|
|
227
241
|
});
|
|
228
242
|
},
|
|
229
243
|
Math.floor(Math.random() * 1500)
|
|
230
244
|
);
|
|
231
245
|
},
|
|
232
246
|
{ debounceMs: 300 }
|
|
233
|
-
),
|
|
234
|
-
|
|
235
|
-
}, [
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}, [
|
|
247
|
+
), k(() => {
|
|
248
|
+
v && !h.current && M("access");
|
|
249
|
+
}, [v]);
|
|
250
|
+
const E = Te(e, r, l, z), [oe, J] = y(!1);
|
|
251
|
+
k(() => {
|
|
252
|
+
E.otherDirty || J(!1);
|
|
253
|
+
}, [E.otherDirty]), k(() => {
|
|
240
254
|
if (!m) return;
|
|
241
255
|
const s = (a) => {
|
|
242
|
-
const
|
|
243
|
-
|
|
256
|
+
const b = a.detail;
|
|
257
|
+
b != null && b.name && m.emit("record:uploading", {
|
|
244
258
|
collection: e,
|
|
245
|
-
item: String(
|
|
246
|
-
name:
|
|
247
|
-
state:
|
|
259
|
+
item: String(r),
|
|
260
|
+
name: b.name,
|
|
261
|
+
state: b.state
|
|
248
262
|
});
|
|
249
263
|
};
|
|
250
264
|
window.addEventListener("nvr:upload-state", s);
|
|
251
|
-
const
|
|
252
|
-
if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
return a.state === "start" ? [...
|
|
265
|
+
const t = (a) => {
|
|
266
|
+
if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r)) return;
|
|
267
|
+
const b = String(a.user_name ?? a.user ?? "Someone");
|
|
268
|
+
re((q) => {
|
|
269
|
+
const X = q.filter((Z) => !(Z.user === b && Z.name === a.name));
|
|
270
|
+
return a.state === "start" ? [...X, { user: b, name: String(a.name) }] : X;
|
|
257
271
|
});
|
|
258
|
-
}, n = m.on("record:uploading",
|
|
259
|
-
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
260
|
-
}),
|
|
261
|
-
return window.addEventListener("nvr:record-uploading",
|
|
262
|
-
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading",
|
|
272
|
+
}, n = m.on("record:uploading", t), u = m.on("record:comment", (a) => {
|
|
273
|
+
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r) || (w.invalidateQueries({ queryKey: ["comments", e, r] }), w.invalidateQueries({ queryKey: ["comments-related", e, r] }));
|
|
274
|
+
}), x = (a) => t(a.detail);
|
|
275
|
+
return window.addEventListener("nvr:record-uploading", x), () => {
|
|
276
|
+
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", x), n(), u();
|
|
263
277
|
};
|
|
264
|
-
}, [m, e,
|
|
265
|
-
const
|
|
278
|
+
}, [m, e, r, w]);
|
|
279
|
+
const ie = async () => {
|
|
266
280
|
if (o != null && o.trashId) {
|
|
267
281
|
B(!0);
|
|
268
282
|
try {
|
|
269
|
-
await R.request(
|
|
283
|
+
await R.request(xe(`/trash/${o.trashId}/restore`, {})), S(null), _.current = Date.now(), c([["item", e, r]]), Q.success("Record restored");
|
|
270
284
|
} catch (s) {
|
|
271
|
-
Q.error(
|
|
285
|
+
Q.error(Se(s, "Restore failed"));
|
|
272
286
|
} finally {
|
|
273
287
|
B(!1);
|
|
274
288
|
}
|
|
275
289
|
}
|
|
276
|
-
},
|
|
277
|
-
return !o &&
|
|
278
|
-
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */
|
|
290
|
+
}, O = Object.values(se), W = E.otherDirty && !oe && !l && !o;
|
|
291
|
+
return !o && O.length === 0 && !W && !F && (!m || !D && A.length === 0) ? null : /* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
292
|
+
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ d(
|
|
279
293
|
"div",
|
|
280
294
|
{
|
|
281
295
|
"data-record-gone": "deleted",
|
|
282
296
|
role: "alert",
|
|
283
297
|
className: "flex items-center gap-3 rounded-lg border border-rose-300 bg-rose-50 px-3.5 py-2.5 dark:border-rose-500/40 dark:bg-rose-500/10",
|
|
284
298
|
children: [
|
|
285
|
-
/* @__PURE__ */ i(
|
|
286
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ i(me, { className: "h-4 w-4 shrink-0 text-rose-500" }),
|
|
300
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
287
301
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
288
302
|
o.by ? ` by ${o.by}` : "",
|
|
289
|
-
o.at ? ` ${
|
|
303
|
+
o.at ? ` ${Re(o.at)}` : "",
|
|
290
304
|
". Saving is turned off",
|
|
291
305
|
o.canRestore ? " — restore it to keep working." : "."
|
|
292
306
|
] }),
|
|
@@ -294,7 +308,7 @@ function Be({
|
|
|
294
308
|
"button",
|
|
295
309
|
{
|
|
296
310
|
type: "button",
|
|
297
|
-
onClick: () => void
|
|
311
|
+
onClick: () => void ie(),
|
|
298
312
|
disabled: U,
|
|
299
313
|
className: "h-7 shrink-0 rounded-md border border-rose-300 bg-white px-2.5 text-[11.5px] font-medium text-rose-700 hover:bg-rose-100 disabled:opacity-50 dark:border-rose-500/40 dark:bg-transparent dark:text-rose-300 dark:hover:bg-rose-500/10",
|
|
300
314
|
children: U ? "Restoring…" : "Restore"
|
|
@@ -303,20 +317,20 @@ function Be({
|
|
|
303
317
|
]
|
|
304
318
|
}
|
|
305
319
|
),
|
|
306
|
-
(o == null ? void 0 : o.kind) === "access" && !
|
|
307
|
-
|
|
320
|
+
(o == null ? void 0 : o.kind) === "access" && !p && /* @__PURE__ */ i(Ae, { onBack: () => window.history.back() }),
|
|
321
|
+
W && /* @__PURE__ */ d(
|
|
308
322
|
"div",
|
|
309
323
|
{
|
|
310
324
|
"data-record-other-tab": !0,
|
|
311
325
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
312
326
|
children: [
|
|
313
|
-
/* @__PURE__ */ i(
|
|
327
|
+
/* @__PURE__ */ i(le, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
314
328
|
/* @__PURE__ */ i("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: "This record is open with unsaved changes in another tab — editing it here too may overwrite them." }),
|
|
315
329
|
/* @__PURE__ */ i(
|
|
316
330
|
"button",
|
|
317
331
|
{
|
|
318
332
|
type: "button",
|
|
319
|
-
onClick:
|
|
333
|
+
onClick: E.focusOther,
|
|
320
334
|
className: "h-7 shrink-0 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
|
|
321
335
|
children: "Switch to that tab"
|
|
322
336
|
}
|
|
@@ -325,7 +339,7 @@ function Be({
|
|
|
325
339
|
"button",
|
|
326
340
|
{
|
|
327
341
|
type: "button",
|
|
328
|
-
onClick: () =>
|
|
342
|
+
onClick: () => J(!0),
|
|
329
343
|
className: "h-7 shrink-0 rounded-md px-2 text-[11.5px] text-amber-700 hover:bg-amber-100 dark:text-amber-300 dark:hover:bg-amber-500/10",
|
|
330
344
|
children: "Dismiss"
|
|
331
345
|
}
|
|
@@ -333,51 +347,51 @@ function Be({
|
|
|
333
347
|
]
|
|
334
348
|
}
|
|
335
349
|
),
|
|
336
|
-
F && !o && /* @__PURE__ */
|
|
350
|
+
F && !o && /* @__PURE__ */ d(
|
|
337
351
|
"div",
|
|
338
352
|
{
|
|
339
353
|
"data-record-importing": !0,
|
|
340
354
|
role: "status",
|
|
341
355
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
342
356
|
children: [
|
|
343
|
-
/* @__PURE__ */ i(
|
|
344
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ i(be, { className: "h-4 w-4 shrink-0 animate-pulse text-amber-500" }),
|
|
358
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
345
359
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "An import is updating this record" }),
|
|
346
360
|
" — the changed fields refresh here as it goes.",
|
|
347
|
-
|
|
361
|
+
l ? " Your unsaved edits may be out of date; check them before saving." : ""
|
|
348
362
|
] })
|
|
349
363
|
]
|
|
350
364
|
}
|
|
351
365
|
),
|
|
352
|
-
|
|
366
|
+
O.length > 0 && !o && /* @__PURE__ */ d(
|
|
353
367
|
"div",
|
|
354
368
|
{
|
|
355
369
|
"data-record-automation": !0,
|
|
356
370
|
role: "status",
|
|
357
371
|
className: "flex items-center gap-3 rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/10 px-3.5 py-2.5",
|
|
358
372
|
children: [
|
|
359
|
-
/* @__PURE__ */ i(
|
|
360
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ i(fe, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
|
|
374
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-[#67e8f9]", children: [
|
|
361
375
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "Automation is updating this record" }),
|
|
362
376
|
" —",
|
|
363
377
|
" ",
|
|
364
|
-
|
|
378
|
+
O.join(", "),
|
|
365
379
|
". Its changes appear here when it finishes."
|
|
366
380
|
] })
|
|
367
381
|
]
|
|
368
382
|
}
|
|
369
383
|
),
|
|
370
|
-
m && (
|
|
371
|
-
|
|
384
|
+
m && (D || A.length > 0) && /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
385
|
+
D && /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-0.5 text-[11px] font-medium text-[#0e7490] dark:text-[#67e8f9]", children: [
|
|
372
386
|
/* @__PURE__ */ i("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
373
387
|
"Updated just now by someone else"
|
|
374
388
|
] }),
|
|
375
|
-
|
|
389
|
+
A.map((s) => /* @__PURE__ */ d(
|
|
376
390
|
"span",
|
|
377
391
|
{
|
|
378
392
|
className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300",
|
|
379
393
|
children: [
|
|
380
|
-
/* @__PURE__ */ i(
|
|
394
|
+
/* @__PURE__ */ i(pe, { className: "h-3 w-3 animate-pulse text-nvr-cyan" }),
|
|
381
395
|
s.user,
|
|
382
396
|
" is uploading “",
|
|
383
397
|
s.name.length > 32 ? `${s.name.slice(0, 32)}…` : s.name,
|
|
@@ -390,8 +404,9 @@ function Be({
|
|
|
390
404
|
] });
|
|
391
405
|
}
|
|
392
406
|
export {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
407
|
+
Ee as RECORD_QUERY_HEADS,
|
|
408
|
+
Ae as RecordAccessLostPanel,
|
|
409
|
+
He as RecordLiveSync,
|
|
410
|
+
_e as moveNotice,
|
|
411
|
+
De as purgeRecordQueries
|
|
397
412
|
};
|