@nivaro/react 0.3.137 → 0.3.139
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/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/activity-sentence.js +167 -151
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { EyeOff as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsx as d, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as he } from "@tanstack/react-query";
|
|
3
|
+
import { EyeOff as ge, ArrowLeft as ye, Trash2 as be, Copy as ve, FileUp as xe, Bot as we, UploadCloud as I } from "lucide-react";
|
|
4
|
+
import { useState as R, useRef as x, useEffect as q } from "react";
|
|
5
5
|
import { toast as B } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as j, post as
|
|
8
|
-
import { useLiveRecord as
|
|
6
|
+
import { useNivaroClient as ke, useRecordSurface as Se, useItemEditAuth as Ne } from "../../context.js";
|
|
7
|
+
import { get as j, post as Re } from "../../lib/commands.js";
|
|
8
|
+
import { useLiveRecord as Te, useLiveEvent as ee, useLiveRecordEvent as re, LIVE_ASPECTS as c, batchTouches as Qe } from "../../lib/live.js";
|
|
9
9
|
import { useOptionalRealtime as _e } from "../../lib/realtime.js";
|
|
10
|
-
import { useRecordTabsSignal as Ke, useRecordTabs as
|
|
11
|
-
import { userErrorMessage as
|
|
10
|
+
import { useRecordTabsSignal as Ke, useRecordTabs as qe, otherTabNote as Ee } from "../../lib/record-tabs.js";
|
|
11
|
+
import { userErrorMessage as Oe } from "../../lib/safe-error.js";
|
|
12
12
|
import { useRemoteUploads as Ae, UPLOAD_STATE_EVENT as te, uploadSentence as ne, applyRemoteUpload as De } from "../../lib/upload-presence.js";
|
|
13
|
-
import { formatRelative as
|
|
14
|
-
import { CollectionImportBanner as
|
|
13
|
+
import { formatRelative as $e, cn as se } from "../../lib/utils.js";
|
|
14
|
+
import { CollectionImportBanner as Le } from "../CollectionImportBanner.js";
|
|
15
15
|
import { markLiveRecordWrite as ae } from "./live-record-marks.js";
|
|
16
|
-
import { ADDENDUM_DETAIL_KEYS as
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (
|
|
20
|
-
return { text: e ? `${e} moved this to ${
|
|
21
|
-
const
|
|
16
|
+
import { ADDENDUM_DETAIL_KEYS as Ce, wideSpreadDelay as Me, actionQueryOfRecord as Ue, obligationQueryOfRecord as Be, proposalQueryOfRecord as je, integrationQueryOfRecord as Fe, fileQueryOfRecord as Pe, resolvedPathQueryOfRecord as Ye, relatedQueryOfRecord as Ve } from "./live-related.js";
|
|
17
|
+
function We(e, r, u) {
|
|
18
|
+
var v;
|
|
19
|
+
if (u.active)
|
|
20
|
+
return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
|
|
21
|
+
const g = ((v = u.label) == null ? void 0 : v.trim()) || "A record in your tabs";
|
|
22
22
|
return {
|
|
23
|
-
text: e ? `${e} moved ${
|
|
24
|
-
open:
|
|
23
|
+
text: e ? `${e} moved ${g} to ${r}` : `${g} moved to ${r}`,
|
|
24
|
+
open: u.open
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
return typeof
|
|
27
|
+
function He(e, r) {
|
|
28
|
+
const u = e == null ? void 0 : e.user_id;
|
|
29
|
+
return typeof u == "string" && !!r && u.toUpperCase() === String(r).toUpperCase();
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const ze = 8e3, ie = [
|
|
32
32
|
"item",
|
|
33
33
|
"rrv-record",
|
|
34
34
|
"revisions",
|
|
@@ -53,35 +53,40 @@ const Ye = 8e3, ie = [
|
|
|
53
53
|
"item-actions",
|
|
54
54
|
"ext-item-actions",
|
|
55
55
|
// The SLA clock (SlaClock.tsx slaStatusKey).
|
|
56
|
-
"sla-breach"
|
|
56
|
+
"sla-breach",
|
|
57
|
+
// rt-fix C: the Change proposals panel, the partner's external ids, dynamic attributes.
|
|
58
|
+
"change-proposals",
|
|
59
|
+
"record-external-ids",
|
|
60
|
+
"attribute-values"
|
|
57
61
|
];
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
function oe(e, r, u, g) {
|
|
63
|
+
return e[0] === "integration-obligations" ? e[1] === "record" && e[2] === u && g.has(String(e[3])) : r.has(e[0]) && e[1] === u && g.has(String(e[2]));
|
|
64
|
+
}
|
|
65
|
+
function Ge(e, r, u) {
|
|
66
|
+
const g = new Set(ie), v = /* @__PURE__ */ new Set([String(u)]);
|
|
67
|
+
e.removeQueries({ predicate: (b) => oe(b.queryKey, g, r, v) });
|
|
63
68
|
}
|
|
64
|
-
function
|
|
65
|
-
if (!
|
|
66
|
-
const
|
|
69
|
+
function fr(e, r, u) {
|
|
70
|
+
if (!r || u.length === 0) return;
|
|
71
|
+
const g = new Set(ie), v = new Set(u.map(String));
|
|
67
72
|
e.invalidateQueries({
|
|
68
|
-
predicate: (
|
|
73
|
+
predicate: (b) => oe(b.queryKey, g, r, v)
|
|
69
74
|
});
|
|
70
75
|
}
|
|
71
|
-
function
|
|
72
|
-
return /* @__PURE__ */ d("div", { className: "p-6", children: /* @__PURE__ */
|
|
76
|
+
function Je({ onBack: e }) {
|
|
77
|
+
return /* @__PURE__ */ d("div", { className: "p-6", children: /* @__PURE__ */ l(
|
|
73
78
|
"div",
|
|
74
79
|
{
|
|
75
80
|
"data-record-gone": "access",
|
|
76
81
|
role: "alert",
|
|
77
82
|
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",
|
|
78
83
|
children: [
|
|
79
|
-
/* @__PURE__ */ d(
|
|
80
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ d(ge, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
85
|
+
/* @__PURE__ */ l("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
81
86
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "You no longer have access to this record." }),
|
|
82
87
|
" A role, scope or filter change hid it while you had it open."
|
|
83
88
|
] }),
|
|
84
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ l(
|
|
85
90
|
"button",
|
|
86
91
|
{
|
|
87
92
|
type: "button",
|
|
@@ -98,257 +103,264 @@ function We({ onBack: e }) {
|
|
|
98
103
|
}
|
|
99
104
|
) });
|
|
100
105
|
}
|
|
101
|
-
const
|
|
102
|
-
var
|
|
103
|
-
return (e == null ? void 0 : e.status) ?? ((
|
|
106
|
+
const Xe = (e) => {
|
|
107
|
+
var r;
|
|
108
|
+
return (e == null ? void 0 : e.status) ?? ((r = e == null ? void 0 : e.response) == null ? void 0 : r.status);
|
|
104
109
|
};
|
|
105
|
-
function
|
|
110
|
+
function hr({
|
|
106
111
|
collection: e,
|
|
107
|
-
itemId:
|
|
108
|
-
dirty:
|
|
109
|
-
loadDenied:
|
|
110
|
-
onGoneChange:
|
|
112
|
+
itemId: r,
|
|
113
|
+
dirty: u = !1,
|
|
114
|
+
loadDenied: g = !1,
|
|
115
|
+
onGoneChange: v
|
|
111
116
|
}) {
|
|
112
|
-
const
|
|
113
|
-
A.current =
|
|
114
|
-
const
|
|
117
|
+
const b = _e(), E = ke(), m = he(), [$, F] = R(!1), [de, ue] = R(null), w = Ae(e, String(r), "unclaimed"), [o, ce] = R(null), [le, L] = R({}), [P, Y] = R(!1), [V, W] = R(!1), T = x(null), Q = x(null), _ = x(null), O = x(Date.now()), C = x(null), A = x(v);
|
|
118
|
+
A.current = v;
|
|
119
|
+
const k = x(null), H = Se(), z = x(H);
|
|
115
120
|
z.current = H;
|
|
116
|
-
const K = (
|
|
121
|
+
const K = (t) => {
|
|
117
122
|
var n;
|
|
118
|
-
|
|
123
|
+
k.current = t, ce(t), (n = A.current) == null || n.call(A, t), (t == null ? void 0 : t.kind) === "access" && setTimeout(() => Ge(m, e, r), 0);
|
|
119
124
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [e,
|
|
123
|
-
const
|
|
124
|
-
for (const n of
|
|
125
|
-
},
|
|
125
|
+
q(() => {
|
|
126
|
+
O.current = Date.now(), C.current = null, L({}), k.current && K(null);
|
|
127
|
+
}, [e, r]);
|
|
128
|
+
const h = (t) => {
|
|
129
|
+
for (const n of t) m.invalidateQueries({ queryKey: n });
|
|
130
|
+
}, M = async (t) => {
|
|
126
131
|
let n = null;
|
|
127
132
|
try {
|
|
128
133
|
n = (await E.request(
|
|
129
|
-
j("/trash/record", { collection: e, item:
|
|
134
|
+
j("/trash/record", { collection: e, item: r })
|
|
130
135
|
)).data;
|
|
131
136
|
} catch {
|
|
132
137
|
n = null;
|
|
133
138
|
}
|
|
134
|
-
const i = !!(n != null && n.deleted_at) && new Date(n.deleted_at).getTime() >=
|
|
135
|
-
K(i ||
|
|
139
|
+
const i = !!(n != null && n.deleted_at) && new Date(n.deleted_at).getTime() >= O.current - 6e4;
|
|
140
|
+
K(i || t === "deleted" && !n ? {
|
|
136
141
|
kind: "deleted",
|
|
137
142
|
by: (n == null ? void 0 : n.deleted_by_name) ?? null,
|
|
138
143
|
at: (n == null ? void 0 : n.deleted_at) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
139
144
|
trashId: (n == null ? void 0 : n.trash_id) ?? null,
|
|
140
145
|
canRestore: !!(n != null && n.can_restore)
|
|
141
146
|
} : { kind: "access" });
|
|
142
|
-
},
|
|
143
|
-
var
|
|
147
|
+
}, me = async () => {
|
|
148
|
+
var t;
|
|
144
149
|
try {
|
|
145
150
|
const n = (await E.request(
|
|
146
|
-
j(`/pipelines/instance/${e}/${
|
|
147
|
-
)).data, i = (
|
|
148
|
-
if (!i || i.id ===
|
|
149
|
-
const
|
|
151
|
+
j(`/pipelines/instance/${e}/${r}`)
|
|
152
|
+
)).data, i = (t = n == null ? void 0 : n.history) == null ? void 0 : t[0];
|
|
153
|
+
if (!i || i.id === C.current || i.timestamp && new Date(i.timestamp).getTime() < O.current - 5e3 || (C.current = i.id, typeof document < "u" && document.visibilityState === "hidden")) return;
|
|
154
|
+
const p = [i.first_name, i.last_name].filter(Boolean).join(" ") || i.user_email || null, f = i.to_state_label ?? "a new state", a = We(p, f, z.current);
|
|
150
155
|
B.info(
|
|
151
156
|
a.text,
|
|
152
157
|
a.open ? { action: { label: "Open", onClick: a.open } } : {}
|
|
153
158
|
);
|
|
154
159
|
} catch {
|
|
155
160
|
}
|
|
156
|
-
},
|
|
157
|
-
var i,
|
|
158
|
-
if (
|
|
159
|
-
|
|
161
|
+
}, pe = (t) => {
|
|
162
|
+
var i, p, f, a;
|
|
163
|
+
if (t.deleted) {
|
|
164
|
+
M("deleted");
|
|
160
165
|
return;
|
|
161
166
|
}
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
const n = (s) =>
|
|
165
|
-
if (n(
|
|
166
|
-
|
|
167
|
-
["pipeline-instance", e,
|
|
168
|
-
["pipeline-all-owners", e,
|
|
169
|
-
["pipeline-instance-owners", e,
|
|
170
|
-
["pipeline-owners-resolved", e,
|
|
171
|
-
["approval-brief", e,
|
|
167
|
+
if (k.current) return;
|
|
168
|
+
t.events.some((s) => s.source === "import" && !s.own) && (W(!0), T.current && clearTimeout(T.current), T.current = setTimeout(() => W(!1), ze));
|
|
169
|
+
const n = (s) => Qe(t, s);
|
|
170
|
+
if (n(c.state)) {
|
|
171
|
+
h([
|
|
172
|
+
["pipeline-instance", e, r],
|
|
173
|
+
["pipeline-all-owners", e, r],
|
|
174
|
+
["pipeline-instance-owners", e, r],
|
|
175
|
+
["pipeline-owners-resolved", e, r],
|
|
176
|
+
["approval-brief", e, r]
|
|
172
177
|
]);
|
|
173
|
-
const s =
|
|
174
|
-
|
|
178
|
+
const s = Ue(e, String(r));
|
|
179
|
+
m.invalidateQueries({ predicate: (S) => s(S.queryKey) });
|
|
180
|
+
const y = Be(e, String(r));
|
|
181
|
+
m.invalidateQueries({ predicate: (S) => y(S.queryKey) }), (i = t.changedFields) != null && i.includes(c.state) && me();
|
|
175
182
|
}
|
|
176
|
-
if (n(
|
|
177
|
-
["pipeline-all-owners", e,
|
|
178
|
-
["pipeline-instance-owners", e,
|
|
179
|
-
["pipeline-owners-resolved", e,
|
|
180
|
-
["approval-brief", e,
|
|
181
|
-
]), !(
|
|
182
|
-
if (n(
|
|
183
|
-
["comments", e,
|
|
184
|
-
["comments-related", e,
|
|
185
|
-
])
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
if (n(c.owners) && !n(c.state) && h([
|
|
184
|
+
["pipeline-all-owners", e, r],
|
|
185
|
+
["pipeline-instance-owners", e, r],
|
|
186
|
+
["pipeline-owners-resolved", e, r],
|
|
187
|
+
["approval-brief", e, r]
|
|
188
|
+
]), !(t.aspectsOnly && ((p = t.changedFields) != null && p.every((s) => s === c.owners)))) {
|
|
189
|
+
if (n(c.addendums) && h([["addendums", e, r], ...Ce.map((s) => [...s])]), n(c.comments) && h([
|
|
190
|
+
["comments", e, r],
|
|
191
|
+
["comments-related", e, r]
|
|
192
|
+
]), n(c.proposals) || n(c.comments)) {
|
|
193
|
+
const s = je(e, String(r));
|
|
194
|
+
m.invalidateQueries({ predicate: (y) => s(y.queryKey) });
|
|
195
|
+
} else (n(c.state) || n(c.integrations) || n(c.addendums) || !t.aspectsOnly) && h([["comments-related", e, r]]);
|
|
196
|
+
if (n(c.tasks) && h([["tasks", e, r]]), n(c.integrations)) {
|
|
197
|
+
const s = Fe(e, String(r));
|
|
198
|
+
m.invalidateQueries({ predicate: (y) => s(y.queryKey) });
|
|
199
|
+
}
|
|
200
|
+
if (n(c.files)) {
|
|
201
|
+
const s = Pe(e, String(r));
|
|
202
|
+
m.invalidateQueries({ predicate: (y) => s(y.queryKey) });
|
|
191
203
|
}
|
|
192
|
-
if (n(
|
|
193
|
-
const s =
|
|
194
|
-
|
|
204
|
+
if (n(c.related) || n(c.attributes)) {
|
|
205
|
+
const s = Ve(e, String(r)), y = () => void m.invalidateQueries({ predicate: (S) => s(S.queryKey) });
|
|
206
|
+
t.ids.length > 0 && t.ids.every((S) => S === "*") ? (_.current && clearTimeout(_.current), _.current = setTimeout(y, Me())) : y();
|
|
195
207
|
}
|
|
196
|
-
if (
|
|
197
|
-
predicate: (s) => (s.queryKey[0] === "child-summary" || s.queryKey[0] === "field-lineage") && s.queryKey[1] === e && String(s.queryKey[2]) === String(
|
|
198
|
-
}), (
|
|
199
|
-
predicate: (s) => s.queryKey[0] === "o2m-rows" && String(s.queryKey[3]) === String(
|
|
200
|
-
}), !
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
["item", e,
|
|
204
|
-
["pipeline-instance", e,
|
|
208
|
+
if (m.invalidateQueries({
|
|
209
|
+
predicate: (s) => (s.queryKey[0] === "child-summary" || s.queryKey[0] === "field-lineage") && s.queryKey[1] === e && String(s.queryKey[2]) === String(r)
|
|
210
|
+
}), (f = t.changedFields) != null && f.includes(c.related) && m.invalidateQueries({
|
|
211
|
+
predicate: (s) => s.queryKey[0] === "o2m-rows" && String(s.queryKey[3]) === String(r)
|
|
212
|
+
}), !t.aspectsOnly) {
|
|
213
|
+
if (t.ids.length > 0 && t.ids.every((s) => s === "*")) {
|
|
214
|
+
h([
|
|
215
|
+
["item", e, r],
|
|
216
|
+
["pipeline-instance", e, r]
|
|
205
217
|
]);
|
|
206
218
|
return;
|
|
207
219
|
}
|
|
208
|
-
|
|
209
|
-
predicate: (s) => s.queryKey[0] === "o2m-rows" && String(s.queryKey[3]) === String(
|
|
220
|
+
m.invalidateQueries({
|
|
221
|
+
predicate: (s) => s.queryKey[0] === "o2m-rows" && String(s.queryKey[3]) === String(r) || s.queryKey[0] === "o2m-compare"
|
|
210
222
|
}), ae(
|
|
211
223
|
e,
|
|
212
|
-
|
|
213
|
-
((a =
|
|
224
|
+
r,
|
|
225
|
+
((a = t.changedFields) == null ? void 0 : a.filter((s) => !s.startsWith("$"))) ?? null
|
|
214
226
|
), G(!0);
|
|
215
227
|
}
|
|
216
228
|
}
|
|
217
|
-
}, G = async (
|
|
218
|
-
|
|
219
|
-
["item", e,
|
|
229
|
+
}, G = async (t) => {
|
|
230
|
+
h([
|
|
231
|
+
["item", e, r],
|
|
220
232
|
// Summary mode reads its own copy (#1869) — it diffs + highlights.
|
|
221
|
-
["rrv-record", e,
|
|
222
|
-
["field-touch", e,
|
|
223
|
-
["revisions", e,
|
|
233
|
+
["rrv-record", e, r],
|
|
234
|
+
["field-touch", e, r],
|
|
235
|
+
["revisions", e, r]
|
|
224
236
|
]);
|
|
225
|
-
const n =
|
|
226
|
-
|
|
227
|
-
const i = ["last-touch", e, String(
|
|
228
|
-
await
|
|
237
|
+
const n = Ye(e, String(r));
|
|
238
|
+
m.invalidateQueries({ predicate: (a) => n(a.queryKey) });
|
|
239
|
+
const i = ["last-touch", e, String(r)];
|
|
240
|
+
await m.invalidateQueries({ queryKey: i }).catch(() => {
|
|
229
241
|
});
|
|
230
|
-
const
|
|
231
|
-
if (!
|
|
232
|
-
const
|
|
233
|
-
|
|
242
|
+
const p = m.getQueryData(i);
|
|
243
|
+
if (!t || He(p, J.current)) return;
|
|
244
|
+
const f = p == null ? void 0 : p.user_name;
|
|
245
|
+
ue(typeof f == "string" && f.trim() ? f.trim() : null), F(!0), Q.current && clearTimeout(Q.current), Q.current = setTimeout(() => F(!1), 4e3);
|
|
234
246
|
};
|
|
235
|
-
|
|
236
|
-
const { userId: D } =
|
|
237
|
-
J.current = D, Ke(D, "saved", e,
|
|
238
|
-
|
|
239
|
-
["pipeline-instance", e,
|
|
240
|
-
["comments", e,
|
|
241
|
-
["tasks", e,
|
|
247
|
+
Te(e, r, pe);
|
|
248
|
+
const { userId: D } = Ne(), J = x(D);
|
|
249
|
+
J.current = D, Ke(D, "saved", e, r, ({ fields: t }) => {
|
|
250
|
+
k.current || (t && ae(e, String(r), t), G(!1), h([
|
|
251
|
+
["pipeline-instance", e, r],
|
|
252
|
+
["comments", e, r],
|
|
253
|
+
["tasks", e, r],
|
|
242
254
|
// Lines and links saved with it (the keys are per relation, not per record).
|
|
243
255
|
["o2m-rows"],
|
|
244
256
|
["m2m-items"]
|
|
245
257
|
]));
|
|
246
|
-
}),
|
|
258
|
+
}), q(
|
|
247
259
|
() => () => {
|
|
248
|
-
|
|
260
|
+
Q.current && clearTimeout(Q.current), T.current && clearTimeout(T.current), _.current && clearTimeout(_.current);
|
|
249
261
|
},
|
|
250
262
|
[]
|
|
251
263
|
), ee(
|
|
252
264
|
"owners:changed",
|
|
253
|
-
(
|
|
254
|
-
|
|
255
|
-
["pipeline-instance-owners", e,
|
|
256
|
-
["pipeline-owners-resolved", e,
|
|
257
|
-
["pipeline-all-owners", e,
|
|
258
|
-
["approval-brief", e,
|
|
265
|
+
(t) => {
|
|
266
|
+
k.current || t != null && t.checked || t != null && t.queues || Array.isArray(t == null ? void 0 : t.collections) && !t.collections.includes(e) || h([
|
|
267
|
+
["pipeline-instance-owners", e, r],
|
|
268
|
+
["pipeline-owners-resolved", e, r],
|
|
269
|
+
["pipeline-all-owners", e, r],
|
|
270
|
+
["approval-brief", e, r]
|
|
259
271
|
]);
|
|
260
272
|
},
|
|
261
273
|
{ debounceMs: 400 }
|
|
262
274
|
), re(
|
|
263
275
|
"record:integrity",
|
|
264
276
|
e,
|
|
265
|
-
|
|
266
|
-
() =>
|
|
277
|
+
r,
|
|
278
|
+
() => h([["record-integrity", e, r]])
|
|
267
279
|
);
|
|
268
|
-
const X =
|
|
269
|
-
re("record:automation", e,
|
|
270
|
-
const n = String((
|
|
280
|
+
const X = x(/* @__PURE__ */ new Map());
|
|
281
|
+
re("record:automation", e, r, (t) => {
|
|
282
|
+
const n = String((t == null ? void 0 : t.flow_id) ?? "");
|
|
271
283
|
if (!n) return;
|
|
272
|
-
const i = X.current,
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
const { [n]: s, ...
|
|
276
|
-
return
|
|
284
|
+
const i = X.current, p = i.get(n);
|
|
285
|
+
p && clearTimeout(p), i.delete(n);
|
|
286
|
+
const f = () => L((a) => {
|
|
287
|
+
const { [n]: s, ...y } = a;
|
|
288
|
+
return y;
|
|
277
289
|
});
|
|
278
|
-
if ((
|
|
279
|
-
|
|
290
|
+
if ((t == null ? void 0 : t.state) === "end") {
|
|
291
|
+
f();
|
|
280
292
|
return;
|
|
281
293
|
}
|
|
282
|
-
|
|
283
|
-
}),
|
|
284
|
-
const
|
|
294
|
+
L((a) => ({ ...a, [n]: String((t == null ? void 0 : t.flow_name) || "An automation") })), i.set(n, setTimeout(f, 5 * 6e4));
|
|
295
|
+
}), q(() => {
|
|
296
|
+
const t = X.current;
|
|
285
297
|
return () => {
|
|
286
|
-
for (const n of
|
|
287
|
-
|
|
298
|
+
for (const n of t.values()) clearTimeout(n);
|
|
299
|
+
t.clear();
|
|
288
300
|
};
|
|
289
301
|
}, []), ee(
|
|
290
302
|
"access:changed",
|
|
291
303
|
() => {
|
|
292
304
|
setTimeout(
|
|
293
305
|
() => {
|
|
294
|
-
var
|
|
295
|
-
((
|
|
306
|
+
var t;
|
|
307
|
+
((t = k.current) == null ? void 0 : t.kind) !== "deleted" && E.request(j(`/items/${e}/${r}`, { fields: "id" })).then(() => {
|
|
296
308
|
var n;
|
|
297
|
-
((n =
|
|
309
|
+
((n = k.current) == null ? void 0 : n.kind) === "access" && (K(null), h([["item", e, r]]));
|
|
298
310
|
}).catch((n) => {
|
|
299
|
-
const i =
|
|
300
|
-
(i === 403 || i === 404) &&
|
|
311
|
+
const i = Xe(n);
|
|
312
|
+
(i === 403 || i === 404) && M("access");
|
|
301
313
|
});
|
|
302
314
|
},
|
|
303
315
|
Math.floor(Math.random() * 1500)
|
|
304
316
|
);
|
|
305
317
|
},
|
|
306
318
|
{ debounceMs: 300 }
|
|
307
|
-
),
|
|
308
|
-
|
|
309
|
-
}, [
|
|
310
|
-
const Z =
|
|
311
|
-
|
|
312
|
-
if (!
|
|
313
|
-
const
|
|
319
|
+
), q(() => {
|
|
320
|
+
g && !k.current && M("access");
|
|
321
|
+
}, [g]);
|
|
322
|
+
const Z = qe(e, r, u, D), N = o ? null : Ee({ otherDirty: Z.otherDirty, dirty: u });
|
|
323
|
+
q(() => {
|
|
324
|
+
if (!b) return;
|
|
325
|
+
const t = (a) => {
|
|
314
326
|
const s = a.detail;
|
|
315
|
-
s != null && s.name && (s.collection && (s.collection !== e || String(s.item) !== String(
|
|
327
|
+
s != null && s.name && (s.collection && (s.collection !== e || String(s.item) !== String(r)) || b.emit("record:uploading", { ...s, collection: e, item: String(r) }));
|
|
316
328
|
};
|
|
317
|
-
window.addEventListener(te,
|
|
329
|
+
window.addEventListener(te, t);
|
|
318
330
|
const n = (a) => {
|
|
319
|
-
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
320
|
-
}, i =
|
|
321
|
-
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(
|
|
322
|
-
}),
|
|
323
|
-
return window.addEventListener("nvr:record-uploading",
|
|
324
|
-
window.removeEventListener(te,
|
|
331
|
+
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r) || De(a);
|
|
332
|
+
}, i = b.on("record:uploading", n), p = b.on("record:comment", (a) => {
|
|
333
|
+
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r) || (m.invalidateQueries({ queryKey: ["comments", e, r] }), m.invalidateQueries({ queryKey: ["comments-related", e, r] }));
|
|
334
|
+
}), f = (a) => n(a.detail);
|
|
335
|
+
return window.addEventListener("nvr:record-uploading", f), () => {
|
|
336
|
+
window.removeEventListener(te, t), window.removeEventListener("nvr:record-uploading", f), i(), p();
|
|
325
337
|
};
|
|
326
|
-
}, [
|
|
327
|
-
const
|
|
338
|
+
}, [b, e, r, m]);
|
|
339
|
+
const fe = async () => {
|
|
328
340
|
if (o != null && o.trashId) {
|
|
329
341
|
Y(!0);
|
|
330
342
|
try {
|
|
331
|
-
await E.request(
|
|
332
|
-
} catch (
|
|
333
|
-
B.error(
|
|
343
|
+
await E.request(Re(`/trash/${o.trashId}/restore`, {})), K(null), O.current = Date.now(), h([["item", e, r]]), B.success("Record restored");
|
|
344
|
+
} catch (t) {
|
|
345
|
+
B.error(Oe(t, "Restore failed"));
|
|
334
346
|
} finally {
|
|
335
347
|
Y(!1);
|
|
336
348
|
}
|
|
337
349
|
}
|
|
338
|
-
},
|
|
339
|
-
return !o &&
|
|
340
|
-
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */
|
|
350
|
+
}, U = Object.values(le);
|
|
351
|
+
return !o && U.length === 0 && !N && !V && (!b || !$ && w.length === 0) ? null : /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
352
|
+
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ l(
|
|
341
353
|
"div",
|
|
342
354
|
{
|
|
343
355
|
"data-record-gone": "deleted",
|
|
344
356
|
role: "alert",
|
|
345
357
|
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",
|
|
346
358
|
children: [
|
|
347
|
-
/* @__PURE__ */ d(
|
|
348
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ d(be, { className: "h-4 w-4 shrink-0 text-rose-500" }),
|
|
360
|
+
/* @__PURE__ */ l("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
349
361
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
350
362
|
o.by ? ` by ${o.by}` : "",
|
|
351
|
-
o.at ? ` ${
|
|
363
|
+
o.at ? ` ${$e(o.at)}` : "",
|
|
352
364
|
". Saving is turned off",
|
|
353
365
|
o.canRestore ? " — restore it to keep working." : "."
|
|
354
366
|
] }),
|
|
@@ -356,7 +368,7 @@ function lr({
|
|
|
356
368
|
"button",
|
|
357
369
|
{
|
|
358
370
|
type: "button",
|
|
359
|
-
onClick: () => void
|
|
371
|
+
onClick: () => void fe(),
|
|
360
372
|
disabled: P,
|
|
361
373
|
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",
|
|
362
374
|
children: P ? "Restoring…" : "Restore"
|
|
@@ -365,28 +377,28 @@ function lr({
|
|
|
365
377
|
]
|
|
366
378
|
}
|
|
367
379
|
),
|
|
368
|
-
(o == null ? void 0 : o.kind) === "access" && !
|
|
369
|
-
|
|
380
|
+
(o == null ? void 0 : o.kind) === "access" && !v && /* @__PURE__ */ d(Je, { onBack: () => window.history.back() }),
|
|
381
|
+
N && /* @__PURE__ */ l(
|
|
370
382
|
"p",
|
|
371
383
|
{
|
|
372
|
-
"data-record-other-tab":
|
|
384
|
+
"data-record-other-tab": N.tone,
|
|
373
385
|
role: "status",
|
|
374
386
|
className: se(
|
|
375
387
|
"flex flex-wrap items-center gap-x-2 gap-y-0.5 px-0.5 text-[11.5px] leading-5",
|
|
376
|
-
|
|
388
|
+
N.tone === "both" ? "text-amber-800 dark:text-amber-300" : "text-muted-foreground"
|
|
377
389
|
),
|
|
378
390
|
children: [
|
|
379
391
|
/* @__PURE__ */ d(
|
|
380
|
-
|
|
392
|
+
ve,
|
|
381
393
|
{
|
|
382
394
|
className: se(
|
|
383
395
|
"h-3.5 w-3.5 shrink-0",
|
|
384
|
-
|
|
396
|
+
N.tone === "both" ? "text-amber-500" : "text-muted-foreground/70"
|
|
385
397
|
),
|
|
386
398
|
"aria-hidden": !0
|
|
387
399
|
}
|
|
388
400
|
),
|
|
389
|
-
/* @__PURE__ */ d("span", { className: "min-w-0", children:
|
|
401
|
+
/* @__PURE__ */ d("span", { className: "min-w-0", children: N.text }),
|
|
390
402
|
/* @__PURE__ */ d(
|
|
391
403
|
"button",
|
|
392
404
|
{
|
|
@@ -399,62 +411,62 @@ function lr({
|
|
|
399
411
|
]
|
|
400
412
|
}
|
|
401
413
|
),
|
|
402
|
-
V && !o && /* @__PURE__ */
|
|
414
|
+
V && !o && /* @__PURE__ */ l(
|
|
403
415
|
"div",
|
|
404
416
|
{
|
|
405
417
|
"data-record-importing": !0,
|
|
406
418
|
role: "status",
|
|
407
419
|
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",
|
|
408
420
|
children: [
|
|
409
|
-
/* @__PURE__ */ d(
|
|
410
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ d(xe, { className: "h-4 w-4 shrink-0 animate-pulse text-amber-500" }),
|
|
422
|
+
/* @__PURE__ */ l("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
411
423
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "An import is updating this record" }),
|
|
412
424
|
" — the changed fields refresh here as it goes.",
|
|
413
|
-
|
|
425
|
+
u ? " Your unsaved edits may be out of date; check them before saving." : ""
|
|
414
426
|
] })
|
|
415
427
|
]
|
|
416
428
|
}
|
|
417
429
|
),
|
|
418
|
-
!o && /* @__PURE__ */ d(
|
|
419
|
-
|
|
430
|
+
!o && /* @__PURE__ */ d(Le, { collection: e, scope: "record" }),
|
|
431
|
+
U.length > 0 && !o && /* @__PURE__ */ l(
|
|
420
432
|
"div",
|
|
421
433
|
{
|
|
422
434
|
"data-record-automation": !0,
|
|
423
435
|
role: "status",
|
|
424
436
|
className: "flex items-center gap-3 rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/10 px-3.5 py-2.5",
|
|
425
437
|
children: [
|
|
426
|
-
/* @__PURE__ */ d(
|
|
427
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ d(we, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
|
|
439
|
+
/* @__PURE__ */ l("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-slate-200", children: [
|
|
428
440
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "Automation is updating this record" }),
|
|
429
441
|
" —",
|
|
430
442
|
" ",
|
|
431
|
-
|
|
443
|
+
U.join(", "),
|
|
432
444
|
". Its changes appear here when it finishes."
|
|
433
445
|
] })
|
|
434
446
|
]
|
|
435
447
|
}
|
|
436
448
|
),
|
|
437
|
-
|
|
438
|
-
|
|
449
|
+
b && ($ || w.length > 0) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
450
|
+
$ && /* @__PURE__ */ l(
|
|
439
451
|
"span",
|
|
440
452
|
{
|
|
441
453
|
"data-record-updated-by": !0,
|
|
442
454
|
className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-0.5 text-[11px] font-medium text-[#0e7490] dark:text-slate-200",
|
|
443
455
|
children: [
|
|
444
456
|
/* @__PURE__ */ d("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
445
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ l("span", { className: "min-w-0", children: [
|
|
446
458
|
"Updated just now by ",
|
|
447
|
-
|
|
459
|
+
de ?? "someone else"
|
|
448
460
|
] })
|
|
449
461
|
]
|
|
450
462
|
}
|
|
451
463
|
),
|
|
452
|
-
(
|
|
453
|
-
const n = ne({ ...
|
|
454
|
-
return /* @__PURE__ */
|
|
464
|
+
(w.length > 2 ? [] : w).map((t) => {
|
|
465
|
+
const n = ne({ ...t, pct: null });
|
|
466
|
+
return /* @__PURE__ */ l(
|
|
455
467
|
"span",
|
|
456
468
|
{
|
|
457
|
-
"data-remote-upload-chip":
|
|
469
|
+
"data-remote-upload-chip": t.key,
|
|
458
470
|
"data-tip": n,
|
|
459
471
|
className: "inline-flex min-w-0 max-w-full 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",
|
|
460
472
|
children: [
|
|
@@ -466,20 +478,20 @@ function lr({
|
|
|
466
478
|
}
|
|
467
479
|
),
|
|
468
480
|
/* @__PURE__ */ d("span", { className: "min-w-0 truncate", children: n }),
|
|
469
|
-
|
|
470
|
-
|
|
481
|
+
t.pct != null && t.pct > 0 && t.pct < 100 && /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-slate-500 dark:text-slate-400", children: [
|
|
482
|
+
t.pct,
|
|
471
483
|
"%"
|
|
472
484
|
] })
|
|
473
485
|
]
|
|
474
486
|
},
|
|
475
|
-
|
|
487
|
+
t.key
|
|
476
488
|
);
|
|
477
489
|
}),
|
|
478
|
-
|
|
490
|
+
w.length > 2 && /* @__PURE__ */ l(
|
|
479
491
|
"span",
|
|
480
492
|
{
|
|
481
493
|
"data-remote-upload-chip": "many",
|
|
482
|
-
"data-tip":
|
|
494
|
+
"data-tip": w.map((t) => ne(t)).join(`
|
|
483
495
|
`),
|
|
484
496
|
className: "inline-flex min-w-0 max-w-full 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",
|
|
485
497
|
children: [
|
|
@@ -490,11 +502,11 @@ function lr({
|
|
|
490
502
|
"aria-hidden": !0
|
|
491
503
|
}
|
|
492
504
|
),
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
|
|
505
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 truncate", children: [
|
|
506
|
+
w.length,
|
|
495
507
|
" uploads in progress ·",
|
|
496
508
|
" ",
|
|
497
|
-
[...new Set(
|
|
509
|
+
[...new Set(w.map((t) => t.user))].join(", ")
|
|
498
510
|
] })
|
|
499
511
|
]
|
|
500
512
|
}
|
|
@@ -504,10 +516,10 @@ function lr({
|
|
|
504
516
|
}
|
|
505
517
|
export {
|
|
506
518
|
ie as RECORD_QUERY_HEADS,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
519
|
+
Je as RecordAccessLostPanel,
|
|
520
|
+
hr as RecordLiveSync,
|
|
521
|
+
fr as invalidateRecordQueries,
|
|
522
|
+
We as moveNotice,
|
|
523
|
+
Ge as purgeRecordQueries,
|
|
524
|
+
He as writtenBySelf
|
|
513
525
|
};
|