@nivaro/react 0.3.8 → 0.3.10
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/components/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/replayUploadQueue.js +107 -93
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +103 -101
- package/dist/index.d.ts +115 -2
- package/dist/index.js +466 -447
- package/dist/shared/components/CollectionBrowserView.js +1058 -1059
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/DataTable.js +230 -223
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +3687 -3580
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +146 -145
- package/dist/shared/components/QueryTable.js +49 -49
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/ChatPanel.js +288 -287
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/InlineTableField.js +301 -300
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/panels/CommentPanel.js +237 -236
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/profile/usePersonPresence.js +42 -37
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueWorklist.js +597 -598
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/presence-live.js +73 -0
- package/dist/shared/lib/presence-state.js +39 -31
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/request-gate.js +120 -102
- package/dist/shared/lib/rum.js +45 -36
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/signed-out.js +114 -0
- package/dist/shared/lib/socket-realtime.js +19 -17
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/use-online-users.js +11 -10
- package/dist/shared/lib/worker-socket.js +89 -79
- package/package.json +1 -1
|
@@ -3,12 +3,13 @@ import { useQueryClient as oe, useQuery as F } from "@tanstack/react-query";
|
|
|
3
3
|
import { Search as ie, X as de, Check as U, ChevronsUpDown as ce } from "lucide-react";
|
|
4
4
|
import { useState as L, useMemo as C } from "react";
|
|
5
5
|
import { useNivaroClient as Y } from "../../context.js";
|
|
6
|
-
import { get as Q, patch as
|
|
6
|
+
import { get as Q, patch as M, del as A, post as X } from "../../lib/commands.js";
|
|
7
|
+
import { userErrorMessage as ue } from "../../lib/safe-error.js";
|
|
7
8
|
import { matchesAllTokens as Z, titleCase as G, cn as K } from "../../lib/utils.js";
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { applyDisplayTemplate as
|
|
10
|
-
import { RelationCombobox as
|
|
11
|
-
const
|
|
9
|
+
import { Popover as me, PopoverTrigger as pe, PopoverContent as be } from "../ui/popover.js";
|
|
10
|
+
import { applyDisplayTemplate as he } from "./helpers.js";
|
|
11
|
+
import { RelationCombobox as fe } from "./RelationCombobox.js";
|
|
12
|
+
const xe = 10;
|
|
12
13
|
async function P(t, l, p) {
|
|
13
14
|
const b = [];
|
|
14
15
|
for (let c = 1; c <= 50; c++) {
|
|
@@ -17,7 +18,7 @@ async function P(t, l, p) {
|
|
|
17
18
|
}
|
|
18
19
|
return b;
|
|
19
20
|
}
|
|
20
|
-
const
|
|
21
|
+
const ye = (t) => [...(t ?? "").matchAll(/\{\{([\w.]+)\}\}/g)].map((l) => l[1]);
|
|
21
22
|
function W(t, l) {
|
|
22
23
|
const p = Y(), { data: b } = F({
|
|
23
24
|
queryKey: ["collection-display-meta", t],
|
|
@@ -30,7 +31,7 @@ function W(t, l) {
|
|
|
30
31
|
}), c = (b == null ? void 0 : b.display_template) ?? null, i = l === "all" ? "all" : [...l].sort().join(","), { data: y = [], isLoading: N } = F({
|
|
31
32
|
queryKey: ["membership-set-labels", t, c, i],
|
|
32
33
|
queryFn: async () => {
|
|
33
|
-
const n =
|
|
34
|
+
const n = ye(c), u = n.length ? { fields: ["id", ...n].join(",") } : {};
|
|
34
35
|
if (l === "all") return P(p, `/items/${t}`, u);
|
|
35
36
|
const h = [];
|
|
36
37
|
for (let g = 0; g < l.length; g += 150)
|
|
@@ -49,12 +50,12 @@ function W(t, l) {
|
|
|
49
50
|
const n = /* @__PURE__ */ new Map();
|
|
50
51
|
for (const u of y) {
|
|
51
52
|
const h = String(u.name ?? u.title ?? u.label ?? `#${u.id}`);
|
|
52
|
-
n.set(String(u.id), (c ?
|
|
53
|
+
n.set(String(u.id), (c ? he(c, u) : "").trim() || h);
|
|
53
54
|
}
|
|
54
55
|
return n;
|
|
55
56
|
}, [y, c]), isLoading: N };
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function Te({
|
|
58
59
|
relatedCollection: t,
|
|
59
60
|
manyField: l,
|
|
60
61
|
parentId: p,
|
|
@@ -98,18 +99,18 @@ function Ke({
|
|
|
98
99
|
await r();
|
|
99
100
|
} catch (a) {
|
|
100
101
|
const d = a == null ? void 0 : a.response;
|
|
101
|
-
O((d == null ? void 0 : d.error) ?? (a
|
|
102
|
+
O((d == null ? void 0 : d.error) ?? ue(a, "Could not save"));
|
|
102
103
|
} finally {
|
|
103
104
|
o(null), re();
|
|
104
105
|
}
|
|
105
106
|
}, ae = (e, r) => j(e, async () => {
|
|
106
107
|
const a = k.get(e) ?? [], d = a.find((w) => w.value === r), S = a.find((w) => w.value === null);
|
|
107
108
|
if (d) {
|
|
108
|
-
a.filter((v) => v.value !== null && v.id !== d.id).length === 0 && !S ? await i.request(
|
|
109
|
+
a.filter((v) => v.value !== null && v.id !== d.id).length === 0 && !S ? await i.request(M(`/items/${t}/${d.id}`, { [n]: null })) : await i.request(A(`/items/${t}/${d.id}`));
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
S ? await i.request(
|
|
112
|
-
|
|
113
|
+
M(`/items/${t}/${S.id}`, { [n]: r })
|
|
113
114
|
) : await i.request(
|
|
114
115
|
X(`/items/${t}`, {
|
|
115
116
|
[l]: p,
|
|
@@ -122,11 +123,11 @@ function Ke({
|
|
|
122
123
|
if (a.length === 0) return;
|
|
123
124
|
const [d, ...S] = a, w = r.find((v) => v.value === null);
|
|
124
125
|
for (const v of w ? a : S)
|
|
125
|
-
await i.request(
|
|
126
|
-
w || await i.request(
|
|
126
|
+
await i.request(A(`/items/${t}/${v.id}`));
|
|
127
|
+
w || await i.request(M(`/items/${t}/${d.id}`, { [n]: null }));
|
|
127
128
|
}), le = (e) => j(e, async () => {
|
|
128
129
|
for (const r of k.get(e) ?? [])
|
|
129
|
-
await i.request(
|
|
130
|
+
await i.request(A(`/items/${t}/${r.id}`));
|
|
130
131
|
}), ne = (e) => {
|
|
131
132
|
e == null || e === "" || k.has(String(e)) || j(
|
|
132
133
|
String(e),
|
|
@@ -145,7 +146,7 @@ function Ke({
|
|
|
145
146
|
] }) : /* @__PURE__ */ m("div", { "data-membership-set": `${t}:${l}`, className: "space-y-2", children: [
|
|
146
147
|
!c && T && /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
147
148
|
/* @__PURE__ */ s("div", { className: "w-[320px] max-w-full", children: /* @__PURE__ */ s(
|
|
148
|
-
|
|
149
|
+
fe,
|
|
149
150
|
{
|
|
150
151
|
collection: T,
|
|
151
152
|
value: null,
|
|
@@ -195,7 +196,7 @@ function Ke({
|
|
|
195
196
|
children: [
|
|
196
197
|
/* @__PURE__ */ s("span", { className: "truncate font-medium text-slate-800 dark:text-foreground", "data-tip": e.label, children: e.label }),
|
|
197
198
|
/* @__PURE__ */ s(
|
|
198
|
-
|
|
199
|
+
ge,
|
|
199
200
|
{
|
|
200
201
|
options: te,
|
|
201
202
|
picked: a,
|
|
@@ -227,7 +228,7 @@ function Ke({
|
|
|
227
228
|
$ && /* @__PURE__ */ s("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: $ })
|
|
228
229
|
] });
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function ge({
|
|
231
232
|
options: t,
|
|
232
233
|
picked: l,
|
|
233
234
|
emptyLabel: p,
|
|
@@ -237,7 +238,7 @@ function ye({
|
|
|
237
238
|
onClear: y
|
|
238
239
|
}) {
|
|
239
240
|
const [N, f] = L(!1), [n, u] = L(""), h = l.size === 0;
|
|
240
|
-
if (t.length <=
|
|
241
|
+
if (t.length <= xe)
|
|
241
242
|
return /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-1", "data-membership-values": !0, children: [
|
|
242
243
|
/* @__PURE__ */ s(
|
|
243
244
|
"button",
|
|
@@ -277,8 +278,8 @@ function ye({
|
|
|
277
278
|
})
|
|
278
279
|
] });
|
|
279
280
|
const g = n.trim() ? t.filter((o) => Z(o.label, n)) : t, q = h ? p : t.filter((o) => l.has(o.id)).map((o) => o.label).join(", ");
|
|
280
|
-
return /* @__PURE__ */ m(
|
|
281
|
-
/* @__PURE__ */ s(
|
|
281
|
+
return /* @__PURE__ */ m(me, { open: N, onOpenChange: f, children: [
|
|
282
|
+
/* @__PURE__ */ s(pe, { asChild: !0, children: /* @__PURE__ */ m(
|
|
282
283
|
"button",
|
|
283
284
|
{
|
|
284
285
|
type: "button",
|
|
@@ -290,7 +291,7 @@ function ye({
|
|
|
290
291
|
]
|
|
291
292
|
}
|
|
292
293
|
) }),
|
|
293
|
-
/* @__PURE__ */ m(
|
|
294
|
+
/* @__PURE__ */ m(be, { align: "start", className: "w-[260px] p-1", children: [
|
|
294
295
|
/* @__PURE__ */ s(
|
|
295
296
|
"input",
|
|
296
297
|
{
|
|
@@ -316,5 +317,5 @@ function ye({
|
|
|
316
317
|
] });
|
|
317
318
|
}
|
|
318
319
|
export {
|
|
319
|
-
|
|
320
|
+
Te as MembershipSetField
|
|
320
321
|
};
|
|
@@ -4,8 +4,9 @@ import { Plus as _, Loader2 as E } from "lucide-react";
|
|
|
4
4
|
import { useState as m } from "react";
|
|
5
5
|
import { useNivaroClient as F, useParentDraft as K } from "../../context.js";
|
|
6
6
|
import { get as P, post as z } from "../../lib/commands.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { userErrorMessage as A } from "../../lib/safe-error.js";
|
|
8
|
+
import { cn as B, titleCase as p } from "../../lib/utils.js";
|
|
9
|
+
function H({
|
|
9
10
|
targetCollection: r,
|
|
10
11
|
config: i,
|
|
11
12
|
onCreated: c
|
|
@@ -40,7 +41,7 @@ function G({
|
|
|
40
41
|
for (const t of q) {
|
|
41
42
|
const n = C(t.from);
|
|
42
43
|
if (f != null && f.has(t.field)) {
|
|
43
|
-
const $ =
|
|
44
|
+
const $ = I(n);
|
|
44
45
|
$.length > 0 && (e[t.field] = $);
|
|
45
46
|
continue;
|
|
46
47
|
}
|
|
@@ -57,7 +58,7 @@ function G({
|
|
|
57
58
|
if (n == null) throw new Error("Created record returned no id");
|
|
58
59
|
d.invalidateQueries({ queryKey: ["relation-opts", r] }), c(n), b(!1), N({});
|
|
59
60
|
} catch (t) {
|
|
60
|
-
u(t
|
|
61
|
+
u(A(t, "Create failed"));
|
|
61
62
|
} finally {
|
|
62
63
|
k(!1);
|
|
63
64
|
}
|
|
@@ -69,7 +70,7 @@ function G({
|
|
|
69
70
|
type: "button",
|
|
70
71
|
title: i.title ?? `New ${p(r)}`,
|
|
71
72
|
onClick: () => b((e) => !e),
|
|
72
|
-
className:
|
|
73
|
+
className: B(
|
|
73
74
|
"inline-flex h-9 items-center gap-1 rounded-md border px-2.5 text-[12px] transition-colors",
|
|
74
75
|
h ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-input text-slate-600 hover:border-slate-400 hover:text-slate-800 dark:text-slate-300"
|
|
75
76
|
),
|
|
@@ -125,7 +126,7 @@ function G({
|
|
|
125
126
|
] })
|
|
126
127
|
] });
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function I(r) {
|
|
129
130
|
const i = Array.isArray(r) ? r : [r], c = [];
|
|
130
131
|
for (const a of i) {
|
|
131
132
|
const d = a != null && typeof a == "object" ? a.id : a;
|
|
@@ -134,5 +135,5 @@ function B(r) {
|
|
|
134
135
|
return c;
|
|
135
136
|
}
|
|
136
137
|
export {
|
|
137
|
-
|
|
138
|
+
H as QuickCreateButton
|
|
138
139
|
};
|
|
@@ -8,8 +8,9 @@ import { get as j, post as pe } from "../../lib/commands.js";
|
|
|
8
8
|
import { useLiveRecord as ge, useLiveEvent as X, useLiveRecordEvent as Z, LIVE_ASPECTS as b, batchTouches as ve } from "../../lib/live.js";
|
|
9
9
|
import { useOptionalRealtime as xe } from "../../lib/realtime.js";
|
|
10
10
|
import { useRecordTabsSignal as we, useRecordTabs as ye } from "../../lib/record-tabs.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import { userErrorMessage as ke } from "../../lib/safe-error.js";
|
|
12
|
+
import { formatRelative as Ne } from "../../lib/utils.js";
|
|
13
|
+
const Te = 8e3, Se = [
|
|
13
14
|
"item",
|
|
14
15
|
"rrv-record",
|
|
15
16
|
"revisions",
|
|
@@ -28,13 +29,13 @@ const Ne = 8e3, Te = [
|
|
|
28
29
|
"record-integrations",
|
|
29
30
|
"record-integrity"
|
|
30
31
|
];
|
|
31
|
-
function
|
|
32
|
-
const S = new Set(
|
|
32
|
+
function Re(e, t, x) {
|
|
33
|
+
const S = new Set(Se), w = String(x);
|
|
33
34
|
e.removeQueries({
|
|
34
|
-
predicate: (m) => S.has(m.queryKey[0]) && m.queryKey[1] ===
|
|
35
|
+
predicate: (m) => S.has(m.queryKey[0]) && m.queryKey[1] === t && String(m.queryKey[2]) === w
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function _e({ onBack: e }) {
|
|
38
39
|
return /* @__PURE__ */ i("div", { className: "p-6", children: /* @__PURE__ */ c(
|
|
39
40
|
"div",
|
|
40
41
|
{
|
|
@@ -64,39 +65,39 @@ function Re({ onBack: e }) {
|
|
|
64
65
|
}
|
|
65
66
|
) });
|
|
66
67
|
}
|
|
67
|
-
const
|
|
68
|
-
var
|
|
69
|
-
return (e == null ? void 0 : e.status) ?? ((
|
|
68
|
+
const Ee = (e) => {
|
|
69
|
+
var t;
|
|
70
|
+
return (e == null ? void 0 : e.status) ?? ((t = e == null ? void 0 : e.response) == null ? void 0 : t.status);
|
|
70
71
|
};
|
|
71
|
-
function
|
|
72
|
+
function Be({
|
|
72
73
|
collection: e,
|
|
73
|
-
itemId:
|
|
74
|
+
itemId: t,
|
|
74
75
|
dirty: x = !1,
|
|
75
76
|
loadDenied: S = !1,
|
|
76
77
|
onGoneChange: w
|
|
77
78
|
}) {
|
|
78
|
-
const m = xe(), R = he(), y = oe(), [$, K] = p(!1), [L, I] = p([]), [o, ee] = p(null), [re, A] = p({}), [U, B] = p(!1), [F, P] = p(!1), k = g(null), N = g(null), _ = g(Date.now()),
|
|
79
|
+
const m = xe(), R = he(), y = oe(), [$, K] = p(!1), [L, I] = p([]), [o, ee] = p(null), [re, A] = p({}), [U, B] = p(!1), [F, P] = p(!1), k = g(null), N = g(null), _ = g(Date.now()), M = g(null), E = g(w);
|
|
79
80
|
E.current = w;
|
|
80
|
-
const h = g(null), T = (
|
|
81
|
+
const h = g(null), T = (s) => {
|
|
81
82
|
var r;
|
|
82
|
-
h.current =
|
|
83
|
+
h.current = s, ee(s), (r = E.current) == null || r.call(E, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => Re(y, e, t), 0);
|
|
83
84
|
};
|
|
84
85
|
v(() => {
|
|
85
|
-
_.current = Date.now(),
|
|
86
|
-
}, [e,
|
|
87
|
-
const u = (
|
|
88
|
-
for (const r of
|
|
89
|
-
},
|
|
86
|
+
_.current = Date.now(), M.current = null, A({}), h.current && T(null);
|
|
87
|
+
}, [e, t]);
|
|
88
|
+
const u = (s) => {
|
|
89
|
+
for (const r of s) y.invalidateQueries({ queryKey: r });
|
|
90
|
+
}, q = async (s) => {
|
|
90
91
|
let r = null;
|
|
91
92
|
try {
|
|
92
93
|
r = (await R.request(
|
|
93
|
-
j("/trash/record", { collection: e, item:
|
|
94
|
+
j("/trash/record", { collection: e, item: t })
|
|
94
95
|
)).data;
|
|
95
96
|
} catch {
|
|
96
97
|
r = null;
|
|
97
98
|
}
|
|
98
99
|
const n = !!(r != null && r.deleted_at) && new Date(r.deleted_at).getTime() >= _.current - 6e4;
|
|
99
|
-
T(n ||
|
|
100
|
+
T(n || s === "deleted" && !r ? {
|
|
100
101
|
kind: "deleted",
|
|
101
102
|
by: (r == null ? void 0 : r.deleted_by_name) ?? null,
|
|
102
103
|
at: (r == null ? void 0 : r.deleted_at) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -104,43 +105,43 @@ function Ke({
|
|
|
104
105
|
canRestore: !!(r != null && r.can_restore)
|
|
105
106
|
} : { kind: "access" });
|
|
106
107
|
}, te = async () => {
|
|
107
|
-
var
|
|
108
|
+
var s;
|
|
108
109
|
try {
|
|
109
110
|
const r = (await R.request(
|
|
110
|
-
j(`/pipelines/instance/${e}/${
|
|
111
|
-
)).data, n = (
|
|
112
|
-
if (!n || n.id ===
|
|
113
|
-
|
|
111
|
+
j(`/pipelines/instance/${e}/${t}`)
|
|
112
|
+
)).data, n = (s = r == null ? void 0 : r.history) == null ? void 0 : s[0];
|
|
113
|
+
if (!n || n.id === M.current || n.timestamp && new Date(n.timestamp).getTime() < _.current - 5e3) return;
|
|
114
|
+
M.current = n.id;
|
|
114
115
|
const d = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.user_email || null, f = n.to_state_label ?? "a new state";
|
|
115
116
|
Q.info(d ? `${d} moved this to ${f}` : `This record moved to ${f}`);
|
|
116
117
|
} catch {
|
|
117
118
|
}
|
|
118
|
-
}, se = (
|
|
119
|
+
}, se = (s) => {
|
|
119
120
|
var n;
|
|
120
|
-
if (
|
|
121
|
-
|
|
121
|
+
if (s.deleted) {
|
|
122
|
+
q("deleted");
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
125
|
if (h.current) return;
|
|
125
|
-
|
|
126
|
-
const r = (d) => ve(
|
|
126
|
+
s.events.some((d) => d.source === "import" && !d.own) && (P(!0), k.current && clearTimeout(k.current), k.current = setTimeout(() => P(!1), Te));
|
|
127
|
+
const r = (d) => ve(s, d);
|
|
127
128
|
if (r(b.state) && (u([
|
|
128
|
-
["pipeline-instance", e,
|
|
129
|
-
["pipeline-all-owners", e,
|
|
130
|
-
["pipeline-instance-owners", e,
|
|
131
|
-
["pipeline-owners-resolved", e,
|
|
132
|
-
["approval-brief", e,
|
|
133
|
-
]), (n =
|
|
134
|
-
["comments", e,
|
|
135
|
-
["comments-related", e,
|
|
136
|
-
]) : (r(b.state) || r(b.integrations) || r(b.addendums) || !
|
|
137
|
-
["erp-submissions", e,
|
|
138
|
-
["record-integrations", e,
|
|
139
|
-
]), !
|
|
140
|
-
if (
|
|
129
|
+
["pipeline-instance", e, t],
|
|
130
|
+
["pipeline-all-owners", e, t],
|
|
131
|
+
["pipeline-instance-owners", e, t],
|
|
132
|
+
["pipeline-owners-resolved", e, t],
|
|
133
|
+
["approval-brief", e, t]
|
|
134
|
+
]), (n = s.changedFields) != null && n.includes(b.state) && te()), r(b.addendums) && u([["addendums", e, t]]), r(b.comments) ? u([
|
|
135
|
+
["comments", e, t],
|
|
136
|
+
["comments-related", e, t]
|
|
137
|
+
]) : (r(b.state) || r(b.integrations) || r(b.addendums) || !s.aspectsOnly) && u([["comments-related", e, t]]), r(b.tasks) && u([["tasks", e, t]]), r(b.integrations) && u([
|
|
138
|
+
["erp-submissions", e, t],
|
|
139
|
+
["record-integrations", e, t]
|
|
140
|
+
]), !s.aspectsOnly) {
|
|
141
|
+
if (s.ids.length > 0 && s.ids.every((d) => d === "*")) {
|
|
141
142
|
u([
|
|
142
|
-
["item", e,
|
|
143
|
-
["pipeline-instance", e,
|
|
143
|
+
["item", e, t],
|
|
144
|
+
["pipeline-instance", e, t]
|
|
144
145
|
]);
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
@@ -148,22 +149,22 @@ function Ke({
|
|
|
148
149
|
}
|
|
149
150
|
}, Y = () => {
|
|
150
151
|
u([
|
|
151
|
-
["item", e,
|
|
152
|
+
["item", e, t],
|
|
152
153
|
// Summary mode reads its own copy (#1869) — it diffs + highlights.
|
|
153
|
-
["rrv-record", e,
|
|
154
|
-
["field-touch", e,
|
|
155
|
-
["revisions", e,
|
|
154
|
+
["rrv-record", e, t],
|
|
155
|
+
["field-touch", e, t],
|
|
156
|
+
["revisions", e, t],
|
|
156
157
|
// Who made the write — the field ghosts (#2) attribute from it.
|
|
157
|
-
["last-touch", e,
|
|
158
|
+
["last-touch", e, t]
|
|
158
159
|
]), K(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => K(!1), 4e3);
|
|
159
160
|
};
|
|
160
|
-
ge(e,
|
|
161
|
+
ge(e, t, se);
|
|
161
162
|
const { userId: H } = fe();
|
|
162
|
-
we(H, "saved", e,
|
|
163
|
+
we(H, "saved", e, t, () => {
|
|
163
164
|
h.current || (Y(), u([
|
|
164
|
-
["pipeline-instance", e,
|
|
165
|
-
["comments", e,
|
|
166
|
-
["tasks", e,
|
|
165
|
+
["pipeline-instance", e, t],
|
|
166
|
+
["comments", e, t],
|
|
167
|
+
["tasks", e, t],
|
|
167
168
|
// Lines and links saved with it (the keys are per relation, not per record).
|
|
168
169
|
["o2m-rows"],
|
|
169
170
|
["m2m-items"]
|
|
@@ -177,22 +178,22 @@ function Ke({
|
|
|
177
178
|
"owners:changed",
|
|
178
179
|
() => {
|
|
179
180
|
h.current || u([
|
|
180
|
-
["pipeline-instance-owners", e,
|
|
181
|
-
["pipeline-owners-resolved", e,
|
|
182
|
-
["pipeline-all-owners", e,
|
|
183
|
-
["approval-brief", e,
|
|
181
|
+
["pipeline-instance-owners", e, t],
|
|
182
|
+
["pipeline-owners-resolved", e, t],
|
|
183
|
+
["pipeline-all-owners", e, t],
|
|
184
|
+
["approval-brief", e, t]
|
|
184
185
|
]);
|
|
185
186
|
},
|
|
186
187
|
{ debounceMs: 400 }
|
|
187
188
|
), Z(
|
|
188
189
|
"record:integrity",
|
|
189
190
|
e,
|
|
190
|
-
|
|
191
|
-
() => u([["record-integrity", e,
|
|
191
|
+
t,
|
|
192
|
+
() => u([["record-integrity", e, t]])
|
|
192
193
|
);
|
|
193
194
|
const V = g(/* @__PURE__ */ new Map());
|
|
194
|
-
Z("record:automation", e,
|
|
195
|
-
const r = String((
|
|
195
|
+
Z("record:automation", e, t, (s) => {
|
|
196
|
+
const r = String((s == null ? void 0 : s.flow_id) ?? "");
|
|
196
197
|
if (!r) return;
|
|
197
198
|
const n = V.current, d = n.get(r);
|
|
198
199
|
d && clearTimeout(d), n.delete(r);
|
|
@@ -200,29 +201,29 @@ function Ke({
|
|
|
200
201
|
const { [r]: l, ...O } = a;
|
|
201
202
|
return O;
|
|
202
203
|
});
|
|
203
|
-
if ((
|
|
204
|
+
if ((s == null ? void 0 : s.state) === "end") {
|
|
204
205
|
f();
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
A((a) => ({ ...a, [r]: String((
|
|
208
|
+
A((a) => ({ ...a, [r]: String((s == null ? void 0 : s.flow_name) || "An automation") })), n.set(r, setTimeout(f, 5 * 6e4));
|
|
208
209
|
}), v(() => {
|
|
209
|
-
const
|
|
210
|
+
const s = V.current;
|
|
210
211
|
return () => {
|
|
211
|
-
for (const r of
|
|
212
|
-
|
|
212
|
+
for (const r of s.values()) clearTimeout(r);
|
|
213
|
+
s.clear();
|
|
213
214
|
};
|
|
214
215
|
}, []), X(
|
|
215
216
|
"access:changed",
|
|
216
217
|
() => {
|
|
217
218
|
setTimeout(
|
|
218
219
|
() => {
|
|
219
|
-
var
|
|
220
|
-
((
|
|
220
|
+
var s;
|
|
221
|
+
((s = h.current) == null ? void 0 : s.kind) !== "deleted" && R.request(j(`/items/${e}/${t}`, { fields: "id" })).then(() => {
|
|
221
222
|
var r;
|
|
222
|
-
((r = h.current) == null ? void 0 : r.kind) === "access" && (T(null), u([["item", e,
|
|
223
|
+
((r = h.current) == null ? void 0 : r.kind) === "access" && (T(null), u([["item", e, t]]));
|
|
223
224
|
}).catch((r) => {
|
|
224
|
-
const n =
|
|
225
|
-
(n === 403 || n === 404) &&
|
|
225
|
+
const n = Ee(r);
|
|
226
|
+
(n === 403 || n === 404) && q("access");
|
|
226
227
|
});
|
|
227
228
|
},
|
|
228
229
|
Math.floor(Math.random() * 1500)
|
|
@@ -230,50 +231,50 @@ function Ke({
|
|
|
230
231
|
},
|
|
231
232
|
{ debounceMs: 300 }
|
|
232
233
|
), v(() => {
|
|
233
|
-
S && !h.current &&
|
|
234
|
+
S && !h.current && q("access");
|
|
234
235
|
}, [S]);
|
|
235
|
-
const D = ye(e,
|
|
236
|
+
const D = ye(e, t, x, H), [ae, z] = p(!1);
|
|
236
237
|
v(() => {
|
|
237
238
|
D.otherDirty || z(!1);
|
|
238
239
|
}, [D.otherDirty]), v(() => {
|
|
239
240
|
if (!m) return;
|
|
240
|
-
const
|
|
241
|
+
const s = (a) => {
|
|
241
242
|
const l = a.detail;
|
|
242
243
|
l != null && l.name && m.emit("record:uploading", {
|
|
243
244
|
collection: e,
|
|
244
|
-
item: String(
|
|
245
|
+
item: String(t),
|
|
245
246
|
name: l.name,
|
|
246
247
|
state: l.state
|
|
247
248
|
});
|
|
248
249
|
};
|
|
249
|
-
window.addEventListener("nvr:upload-state",
|
|
250
|
+
window.addEventListener("nvr:upload-state", s);
|
|
250
251
|
const r = (a) => {
|
|
251
|
-
if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
252
|
+
if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(t)) return;
|
|
252
253
|
const l = String(a.user_name ?? a.user ?? "Someone");
|
|
253
254
|
I((O) => {
|
|
254
255
|
const J = O.filter((W) => !(W.user === l && W.name === a.name));
|
|
255
256
|
return a.state === "start" ? [...J, { user: l, name: String(a.name) }] : J;
|
|
256
257
|
});
|
|
257
258
|
}, n = m.on("record:uploading", r), d = m.on("record:comment", (a) => {
|
|
258
|
-
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
259
|
+
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(t) || (y.invalidateQueries({ queryKey: ["comments", e, t] }), y.invalidateQueries({ queryKey: ["comments-related", e, t] }));
|
|
259
260
|
}), f = (a) => r(a.detail);
|
|
260
261
|
return window.addEventListener("nvr:record-uploading", f), () => {
|
|
261
|
-
window.removeEventListener("nvr:upload-state",
|
|
262
|
+
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", f), n(), d();
|
|
262
263
|
};
|
|
263
|
-
}, [m, e,
|
|
264
|
+
}, [m, e, t, y]);
|
|
264
265
|
const ne = async () => {
|
|
265
266
|
if (o != null && o.trashId) {
|
|
266
267
|
B(!0);
|
|
267
268
|
try {
|
|
268
|
-
await R.request(pe(`/trash/${o.trashId}/restore`, {})), T(null), _.current = Date.now(), u([["item", e,
|
|
269
|
-
} catch (
|
|
270
|
-
Q.error(
|
|
269
|
+
await R.request(pe(`/trash/${o.trashId}/restore`, {})), T(null), _.current = Date.now(), u([["item", e, t]]), Q.success("Record restored");
|
|
270
|
+
} catch (s) {
|
|
271
|
+
Q.error(ke(s, "Restore failed"));
|
|
271
272
|
} finally {
|
|
272
273
|
B(!1);
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
|
-
},
|
|
276
|
-
return !o &&
|
|
276
|
+
}, C = Object.values(re), G = D.otherDirty && !ae && !x && !o;
|
|
277
|
+
return !o && C.length === 0 && !G && !F && (!m || !$ && L.length === 0) ? null : /* @__PURE__ */ c("div", { className: "space-y-2", children: [
|
|
277
278
|
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ c(
|
|
278
279
|
"div",
|
|
279
280
|
{
|
|
@@ -285,7 +286,7 @@ function Ke({
|
|
|
285
286
|
/* @__PURE__ */ c("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
286
287
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
287
288
|
o.by ? ` by ${o.by}` : "",
|
|
288
|
-
o.at ? ` ${
|
|
289
|
+
o.at ? ` ${Ne(o.at)}` : "",
|
|
289
290
|
". Saving is turned off",
|
|
290
291
|
o.canRestore ? " — restore it to keep working." : "."
|
|
291
292
|
] }),
|
|
@@ -302,7 +303,7 @@ function Ke({
|
|
|
302
303
|
]
|
|
303
304
|
}
|
|
304
305
|
),
|
|
305
|
-
(o == null ? void 0 : o.kind) === "access" && !w && /* @__PURE__ */ i(
|
|
306
|
+
(o == null ? void 0 : o.kind) === "access" && !w && /* @__PURE__ */ i(_e, { onBack: () => window.history.back() }),
|
|
306
307
|
G && /* @__PURE__ */ c(
|
|
307
308
|
"div",
|
|
308
309
|
{
|
|
@@ -348,7 +349,7 @@ function Ke({
|
|
|
348
349
|
]
|
|
349
350
|
}
|
|
350
351
|
),
|
|
351
|
-
|
|
352
|
+
C.length > 0 && !o && /* @__PURE__ */ c(
|
|
352
353
|
"div",
|
|
353
354
|
{
|
|
354
355
|
"data-record-automation": !0,
|
|
@@ -360,7 +361,7 @@ function Ke({
|
|
|
360
361
|
/* @__PURE__ */ i("span", { className: "font-semibold", children: "Automation is updating this record" }),
|
|
361
362
|
" —",
|
|
362
363
|
" ",
|
|
363
|
-
|
|
364
|
+
C.join(", "),
|
|
364
365
|
". Its changes appear here when it finishes."
|
|
365
366
|
] })
|
|
366
367
|
]
|
|
@@ -371,26 +372,26 @@ function Ke({
|
|
|
371
372
|
/* @__PURE__ */ i("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
372
373
|
"Updated just now by someone else"
|
|
373
374
|
] }),
|
|
374
|
-
L.map((
|
|
375
|
+
L.map((s) => /* @__PURE__ */ c(
|
|
375
376
|
"span",
|
|
376
377
|
{
|
|
377
378
|
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",
|
|
378
379
|
children: [
|
|
379
380
|
/* @__PURE__ */ i(be, { className: "h-3 w-3 animate-pulse text-nvr-cyan" }),
|
|
380
|
-
|
|
381
|
+
s.user,
|
|
381
382
|
" is uploading “",
|
|
382
|
-
|
|
383
|
+
s.name.length > 32 ? `${s.name.slice(0, 32)}…` : s.name,
|
|
383
384
|
"”"
|
|
384
385
|
]
|
|
385
386
|
},
|
|
386
|
-
`${
|
|
387
|
+
`${s.user}:${s.name}`
|
|
387
388
|
))
|
|
388
389
|
] })
|
|
389
390
|
] });
|
|
390
391
|
}
|
|
391
392
|
export {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
Se as RECORD_QUERY_HEADS,
|
|
394
|
+
_e as RecordAccessLostPanel,
|
|
395
|
+
Be as RecordLiveSync,
|
|
396
|
+
Re as purgeRecordQueries
|
|
396
397
|
};
|