@nivaro/react 0.3.98 → 0.3.100
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/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +38 -13
- package/dist/index.js +182 -180
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3021 -3019
- package/dist/shared/components/JobsTray.js +20 -16
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +314 -288
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +175 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/move-failure.js +9 -0
- package/dist/shared/lib/obligation-banner.js +15 -14
- package/dist/shared/lib/partner-failure.js +71 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,94 +1,95 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as S, useQueryClient as Z, useMutation as I } from "@tanstack/react-query";
|
|
3
3
|
import { useState as f, useMemo as J, useEffect as ee } from "react";
|
|
4
4
|
import { useNivaroClient as W } from "../../context.js";
|
|
5
5
|
import { get as G, post as q } from "../../lib/commands.js";
|
|
6
6
|
import { useAfterIdle as te } from "../../lib/defer.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { hasRecordExtras as re } from "../../lib/system-collections.js";
|
|
8
|
+
import { formatRelative as ne, formatDateTime as ae, cn as K, titleCase as ie } from "../../lib/utils.js";
|
|
9
|
+
function de(t, r, a = !0) {
|
|
10
|
+
const u = W(), i = a && re(t), { data: g } = S({
|
|
11
|
+
queryKey: ["record-integrity", t, r],
|
|
12
|
+
enabled: i,
|
|
12
13
|
queryFn: () => u.request(
|
|
13
|
-
G(`/config-conformance/record/${
|
|
14
|
-
).then((
|
|
14
|
+
G(`/config-conformance/record/${t}/${encodeURIComponent(r)}`)
|
|
15
|
+
).then((d) => d.data).catch(() => ({ enabled: !1, findings: [] })),
|
|
15
16
|
staleTime: 5 * 6e4
|
|
16
|
-
}),
|
|
17
|
-
queryKey: ["record-integrity",
|
|
18
|
-
enabled:
|
|
17
|
+
}), h = te(2e3), { data: m, isFetching: k } = S({
|
|
18
|
+
queryKey: ["record-integrity", t, r, "live"],
|
|
19
|
+
enabled: i && h,
|
|
19
20
|
queryFn: () => u.request(
|
|
20
|
-
q(`/config-conformance/record/${
|
|
21
|
-
).then((
|
|
21
|
+
q(`/config-conformance/record/${t}/${encodeURIComponent(r)}/check`, {})
|
|
22
|
+
).then((d) => d.data).catch(() => null),
|
|
22
23
|
staleTime: 6e4,
|
|
23
24
|
// Never spin the banner on a background refetch storm — one live check per
|
|
24
25
|
// mount / invalidation is the contract.
|
|
25
26
|
refetchOnWindowFocus: !1
|
|
26
27
|
});
|
|
27
|
-
return { data:
|
|
28
|
+
return { data: m ?? g, checking: k };
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
function H(
|
|
30
|
+
const oe = "nvr:own-record-writes";
|
|
31
|
+
function H(t) {
|
|
31
32
|
var a;
|
|
32
|
-
const
|
|
33
|
-
for (const u of
|
|
33
|
+
const r = [];
|
|
34
|
+
for (const u of t.writes ?? []) {
|
|
34
35
|
const i = u;
|
|
35
|
-
i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" &&
|
|
36
|
+
i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" && r.push({ collection: i.collection, id: String(i.item_id) });
|
|
36
37
|
}
|
|
37
|
-
return (a =
|
|
38
|
+
return (a = t.pick) != null && a.collection && t.pick.item_id && r.push({ collection: t.pick.collection, id: String(t.pick.item_id) }), r;
|
|
38
39
|
}
|
|
39
|
-
function Y(
|
|
40
|
-
|
|
41
|
-
new CustomEvent(
|
|
40
|
+
function Y(t) {
|
|
41
|
+
t.length === 0 || typeof window > "u" || window.dispatchEvent(
|
|
42
|
+
new CustomEvent(oe, { detail: { writes: t } })
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function se(t, r) {
|
|
45
46
|
var u;
|
|
46
|
-
const a =
|
|
47
|
-
return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) ||
|
|
47
|
+
const a = r == null ? void 0 : r.find((i) => i.field === t);
|
|
48
|
+
return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) || ie(t);
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
for (const a of
|
|
52
|
-
const u =
|
|
53
|
-
u.push(a),
|
|
50
|
+
function be(t) {
|
|
51
|
+
const r = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const a of t ?? []) {
|
|
53
|
+
const u = r.get(a.field) ?? [];
|
|
54
|
+
u.push(a), r.set(a.field, u);
|
|
54
55
|
}
|
|
55
|
-
return
|
|
56
|
+
return r;
|
|
56
57
|
}
|
|
57
58
|
const z = {
|
|
58
59
|
high: { dot: "bg-emerald-500", text: "Confident" },
|
|
59
60
|
medium: { dot: "bg-amber-500", text: "Likely" },
|
|
60
61
|
low: { dot: "bg-slate-400", text: "Manual" }
|
|
61
62
|
};
|
|
62
|
-
function
|
|
63
|
-
collection:
|
|
64
|
-
itemId:
|
|
63
|
+
function ke({
|
|
64
|
+
collection: t,
|
|
65
|
+
itemId: r,
|
|
65
66
|
onJumpToField: a
|
|
66
67
|
}) {
|
|
67
68
|
var R;
|
|
68
|
-
const u = W(), i = Z(), [g,
|
|
69
|
-
queryKey: ["field-config",
|
|
70
|
-
queryFn: () => u.request(G(`/field-config/${
|
|
71
|
-
enabled: !!((R =
|
|
69
|
+
const u = W(), i = Z(), [g, h] = f(!1), [m, k] = f(null), { data: d, checking: E } = de(t, r), { data: y } = S({
|
|
70
|
+
queryKey: ["field-config", t, null],
|
|
71
|
+
queryFn: () => u.request(G(`/field-config/${t}`)).then((l) => l.data ?? []),
|
|
72
|
+
enabled: !!((R = d == null ? void 0 : d.findings) != null && R.length),
|
|
72
73
|
staleTime: 6e4
|
|
73
74
|
}), L = () => {
|
|
74
|
-
i.invalidateQueries({ queryKey: ["record-integrity",
|
|
75
|
+
i.invalidateQueries({ queryKey: ["record-integrity", t, r] }), i.invalidateQueries({ queryKey: ["item", t, r] }), i.invalidateQueries({ queryKey: [t, r] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
|
|
75
76
|
};
|
|
76
|
-
if (!(
|
|
77
|
-
const v =
|
|
78
|
-
return /* @__PURE__ */
|
|
77
|
+
if (!(d != null && d.enabled) || d.findings.length === 0) return null;
|
|
78
|
+
const v = d.findings.length;
|
|
79
|
+
return /* @__PURE__ */ o(
|
|
79
80
|
"div",
|
|
80
81
|
{
|
|
81
82
|
"data-record-integrity": !0,
|
|
82
83
|
className: "nvr-expand-in rounded-lg border border-amber-200 bg-amber-50 px-4 py-2.5 dark:border-amber-500/30 dark:bg-amber-400/10",
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
86
|
+
/* @__PURE__ */ o("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
|
|
86
87
|
v,
|
|
87
88
|
" data integrity issue",
|
|
88
89
|
v === 1 ? "" : "s",
|
|
89
90
|
" on this record"
|
|
90
91
|
] }),
|
|
91
|
-
|
|
92
|
+
d.live ? /* @__PURE__ */ n(
|
|
92
93
|
"span",
|
|
93
94
|
{
|
|
94
95
|
className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
|
|
@@ -102,15 +103,15 @@ function he({
|
|
|
102
103
|
"data-integrity-checked": "checking",
|
|
103
104
|
children: "checking…"
|
|
104
105
|
}
|
|
105
|
-
) :
|
|
106
|
+
) : d.checked_at ? /* @__PURE__ */ o(
|
|
106
107
|
"span",
|
|
107
108
|
{
|
|
108
109
|
className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
|
|
109
110
|
"data-integrity-checked": "stored",
|
|
110
|
-
title:
|
|
111
|
+
title: ae(d.checked_at),
|
|
111
112
|
children: [
|
|
112
113
|
"checked ",
|
|
113
|
-
|
|
114
|
+
ne(d.checked_at)
|
|
114
115
|
]
|
|
115
116
|
}
|
|
116
117
|
) : null,
|
|
@@ -118,14 +119,14 @@ function he({
|
|
|
118
119
|
"button",
|
|
119
120
|
{
|
|
120
121
|
type: "button",
|
|
121
|
-
onClick: () =>
|
|
122
|
+
onClick: () => h((l) => !l),
|
|
122
123
|
className: "ml-auto text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
|
|
123
124
|
children: g ? "Hide" : "View"
|
|
124
125
|
}
|
|
125
126
|
)
|
|
126
127
|
] }),
|
|
127
|
-
g && /* @__PURE__ */ n("div", { className: "mt-1.5 space-y-1", children:
|
|
128
|
-
/* @__PURE__ */
|
|
128
|
+
g && /* @__PURE__ */ n("div", { className: "mt-1.5 space-y-1", children: d.findings.map((l, b) => /* @__PURE__ */ o("div", { children: [
|
|
129
|
+
/* @__PURE__ */ o("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
|
|
129
130
|
/* @__PURE__ */ n(
|
|
130
131
|
"button",
|
|
131
132
|
{
|
|
@@ -133,7 +134,7 @@ function he({
|
|
|
133
134
|
onClick: () => a == null ? void 0 : a(l.field),
|
|
134
135
|
"data-integrity-field": l.field,
|
|
135
136
|
className: "shrink-0 text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
|
|
136
|
-
children:
|
|
137
|
+
children: se(l.field, y)
|
|
137
138
|
}
|
|
138
139
|
),
|
|
139
140
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 text-amber-800 dark:text-amber-200/90", children: l.message }),
|
|
@@ -141,95 +142,95 @@ function he({
|
|
|
141
142
|
"button",
|
|
142
143
|
{
|
|
143
144
|
type: "button",
|
|
144
|
-
onClick: () =>
|
|
145
|
+
onClick: () => k((p) => p === b ? null : b),
|
|
145
146
|
className: K(
|
|
146
147
|
"shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold transition-colors",
|
|
147
|
-
m ===
|
|
148
|
+
m === b ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
|
|
148
149
|
),
|
|
149
|
-
children: m ===
|
|
150
|
+
children: m === b ? "Close" : "Fix…"
|
|
150
151
|
}
|
|
151
152
|
)
|
|
152
153
|
] }),
|
|
153
|
-
m ===
|
|
154
|
-
|
|
154
|
+
m === b && /* @__PURE__ */ n(
|
|
155
|
+
le,
|
|
155
156
|
{
|
|
156
|
-
collection:
|
|
157
|
-
itemId:
|
|
157
|
+
collection: t,
|
|
158
|
+
itemId: r,
|
|
158
159
|
finding: l,
|
|
159
160
|
onApplied: L,
|
|
160
|
-
onClose: () =>
|
|
161
|
+
onClose: () => k(null)
|
|
161
162
|
}
|
|
162
163
|
)
|
|
163
|
-
] }, `${l.field}|${l.rule}|${
|
|
164
|
+
] }, `${l.field}|${l.rule}|${b}`)) })
|
|
164
165
|
]
|
|
165
166
|
}
|
|
166
167
|
);
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
-
collection:
|
|
170
|
-
itemId:
|
|
169
|
+
function le({
|
|
170
|
+
collection: t,
|
|
171
|
+
itemId: r,
|
|
171
172
|
finding: a,
|
|
172
173
|
onApplied: u,
|
|
173
174
|
onClose: i
|
|
174
175
|
}) {
|
|
175
|
-
const g = W(),
|
|
176
|
-
queryKey: ["integrity-proposals",
|
|
177
|
-
queryFn: () => g.request(q(`${
|
|
176
|
+
const g = W(), h = `/config-conformance/record/${t}/${encodeURIComponent(r)}`, m = { field: a.field, rule: a.rule, message: a.message }, { data: k, isLoading: d, error: E } = S({
|
|
177
|
+
queryKey: ["integrity-proposals", t, r, a.field, a.rule],
|
|
178
|
+
queryFn: () => g.request(q(`${h}/proposals`, m)).then((e) => e.data.proposals),
|
|
178
179
|
staleTime: 6e4
|
|
179
|
-
}), [y, L] = f([]), [v, R] = f({}), [l,
|
|
180
|
+
}), [y, L] = f([]), [v, R] = f({}), [l, b] = f(""), [p, M] = f(null), [j, D] = f(0), [T, N] = f(null), [B, X] = f(null), [_, O] = f(null), V = J(() => [...k ?? [], ...y], [k, y]);
|
|
180
181
|
ee(() => {
|
|
181
|
-
if (!
|
|
182
|
+
if (!p || p.undo.length === 0) return;
|
|
182
183
|
D(30);
|
|
183
184
|
const e = setInterval(() => D((c) => c <= 1 ? 0 : c - 1), 1e3);
|
|
184
185
|
return () => clearInterval(e);
|
|
185
|
-
}, [
|
|
186
|
+
}, [p]);
|
|
186
187
|
const A = I({
|
|
187
188
|
mutationFn: (e) => g.request(
|
|
188
|
-
q(`${
|
|
189
|
+
q(`${h}/fix`, {
|
|
189
190
|
...m,
|
|
190
191
|
proposal_id: e.id,
|
|
191
192
|
choice: e.kind === "pick" ? v[e.id] : void 0
|
|
192
193
|
})
|
|
193
194
|
),
|
|
194
195
|
onSuccess: (e, c) => {
|
|
195
|
-
var C, $,
|
|
196
|
+
var C, $, s;
|
|
196
197
|
N(null), Y(H(c)), X(c);
|
|
197
198
|
const x = e.data, w = ((C = x.failed) == null ? void 0 : C.length) ?? 0;
|
|
198
199
|
M({
|
|
199
|
-
text: c.kind === "notify" ? `Sent to ${(($ = c.notify) == null ? void 0 : $.name) ?? "the owner"} as a task.` : `${x.applied} write${x.applied === 1 ? "" : "s"} applied${w ? ` — ${w} failed: ${((
|
|
200
|
+
text: c.kind === "notify" ? `Sent to ${(($ = c.notify) == null ? void 0 : $.name) ?? "the owner"} as a task.` : `${x.applied} write${x.applied === 1 ? "" : "s"} applied${w ? ` — ${w} failed: ${((s = x.failed[0]) == null ? void 0 : s.error) ?? ""}` : ""}.`,
|
|
200
201
|
undo: x.undo ?? []
|
|
201
202
|
}), u();
|
|
202
203
|
},
|
|
203
204
|
onError: (e) => N(F(e))
|
|
204
205
|
}), P = I({
|
|
205
|
-
mutationFn: (e) => g.request(q(`${
|
|
206
|
+
mutationFn: (e) => g.request(q(`${h}/fix`, { ...m, undo: e })),
|
|
206
207
|
onSuccess: () => {
|
|
207
208
|
B && Y(H(B)), M({ text: "Undone.", undo: [] }), u();
|
|
208
209
|
},
|
|
209
210
|
onError: (e) => N(F(e))
|
|
210
211
|
}), Q = I({
|
|
211
|
-
mutationFn: () => g.request(q(`${
|
|
212
|
+
mutationFn: () => g.request(q(`${h}/proposals/ai`, m)).then((e) => e.data.proposal),
|
|
212
213
|
onSuccess: (e) => {
|
|
213
214
|
N(null), L((c) => c.some((x) => x.id === e.id) ? c : [...c, e]);
|
|
214
215
|
},
|
|
215
216
|
onError: (e) => N(F(e))
|
|
216
217
|
});
|
|
217
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ o(
|
|
218
219
|
"div",
|
|
219
220
|
{
|
|
220
221
|
"data-integrity-proposals": !0,
|
|
221
222
|
className: "mt-1.5 rounded-md border border-amber-200/80 bg-white/70 px-3 py-2 dark:border-amber-500/20 dark:bg-black/20",
|
|
222
223
|
children: [
|
|
223
|
-
|
|
224
|
+
d && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
|
|
224
225
|
E && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: F(E) }),
|
|
225
|
-
|
|
226
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children:
|
|
227
|
-
|
|
226
|
+
p ? /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
|
|
227
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: p.text }),
|
|
228
|
+
p.undo.length > 0 && j > 0 && /* @__PURE__ */ n(
|
|
228
229
|
"button",
|
|
229
230
|
{
|
|
230
231
|
type: "button",
|
|
231
232
|
disabled: P.isPending,
|
|
232
|
-
onClick: () => P.mutate(
|
|
233
|
+
onClick: () => P.mutate(p.undo),
|
|
233
234
|
className: "rounded border border-slate-300 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-border dark:text-foreground dark:hover:bg-muted",
|
|
234
235
|
children: P.isPending ? "Undoing…" : `Undo (${j}s)`
|
|
235
236
|
}
|
|
@@ -243,18 +244,18 @@ function se({
|
|
|
243
244
|
children: "Done"
|
|
244
245
|
}
|
|
245
246
|
)
|
|
246
|
-
] }) : !
|
|
247
|
+
] }) : !d && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
247
248
|
V.length === 0 && /* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing on this record can derive a value — fix it by hand on the form." }),
|
|
248
249
|
V.map((e) => {
|
|
249
250
|
var C, $;
|
|
250
251
|
const c = z[e.confidence] ?? z.low, x = v[e.id], w = (e.choices ?? []).filter(
|
|
251
|
-
(
|
|
252
|
+
(s) => !l || s.label.toLowerCase().includes(l.toLowerCase())
|
|
252
253
|
);
|
|
253
254
|
return /* @__PURE__ */ n(
|
|
254
255
|
"div",
|
|
255
256
|
{
|
|
256
257
|
className: "rounded border border-slate-200/80 bg-white px-2.5 py-1.5 dark:border-border dark:bg-card",
|
|
257
|
-
children: /* @__PURE__ */
|
|
258
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start gap-2", children: [
|
|
258
259
|
/* @__PURE__ */ n(
|
|
259
260
|
"span",
|
|
260
261
|
{
|
|
@@ -263,13 +264,13 @@ function se({
|
|
|
263
264
|
"data-tip": c.text
|
|
264
265
|
}
|
|
265
266
|
),
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: [
|
|
268
|
+
/* @__PURE__ */ o("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
|
|
268
269
|
e.label,
|
|
269
270
|
/* @__PURE__ */ n("span", { className: "ml-1.5 text-[10px] font-normal uppercase tracking-wide text-slate-400", children: e.kind === "ai" ? "AI" : c.text })
|
|
270
271
|
] }),
|
|
271
272
|
/* @__PURE__ */ n("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.basis }),
|
|
272
|
-
e.confirm && _ === e.id && /* @__PURE__ */
|
|
273
|
+
e.confirm && _ === e.id && /* @__PURE__ */ o(
|
|
273
274
|
"p",
|
|
274
275
|
{
|
|
275
276
|
role: "alert",
|
|
@@ -290,51 +291,51 @@ function se({
|
|
|
290
291
|
]
|
|
291
292
|
}
|
|
292
293
|
),
|
|
293
|
-
e.preview.length > 0 && /* @__PURE__ */
|
|
294
|
-
e.preview.slice(0, 8).map((
|
|
294
|
+
e.preview.length > 0 && /* @__PURE__ */ o("div", { className: "mt-1 flex flex-wrap gap-1", children: [
|
|
295
|
+
e.preview.slice(0, 8).map((s, U) => /* @__PURE__ */ o(
|
|
295
296
|
"span",
|
|
296
297
|
{
|
|
297
298
|
className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] text-slate-700 dark:bg-muted dark:text-foreground",
|
|
298
299
|
children: [
|
|
299
|
-
|
|
300
|
+
s.label,
|
|
300
301
|
": ",
|
|
301
|
-
/* @__PURE__ */ n("span", { className: "line-through opacity-60", children:
|
|
302
|
+
/* @__PURE__ */ n("span", { className: "line-through opacity-60", children: s.from }),
|
|
302
303
|
" ",
|
|
303
304
|
"→ ",
|
|
304
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children:
|
|
305
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: s.to })
|
|
305
306
|
]
|
|
306
307
|
},
|
|
307
|
-
`${
|
|
308
|
+
`${s.item_id}|${s.field}|${U}`
|
|
308
309
|
)),
|
|
309
|
-
e.preview.length > 8 && /* @__PURE__ */
|
|
310
|
+
e.preview.length > 8 && /* @__PURE__ */ o("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
310
311
|
"+",
|
|
311
312
|
e.preview.length - 8,
|
|
312
313
|
" more"
|
|
313
314
|
] })
|
|
314
315
|
] }),
|
|
315
|
-
e.kind === "pick" && /* @__PURE__ */
|
|
316
|
+
e.kind === "pick" && /* @__PURE__ */ o("div", { className: "mt-1.5", children: [
|
|
316
317
|
(((C = e.choices) == null ? void 0 : C.length) ?? 0) > 8 && /* @__PURE__ */ n(
|
|
317
318
|
"input",
|
|
318
319
|
{
|
|
319
320
|
value: l,
|
|
320
|
-
onChange: (
|
|
321
|
+
onChange: (s) => b(s.target.value),
|
|
321
322
|
placeholder: "Filter options…",
|
|
322
323
|
className: "mb-1 h-6 w-full rounded border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-background"
|
|
323
324
|
}
|
|
324
325
|
),
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
w.map((
|
|
326
|
+
/* @__PURE__ */ o("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
|
|
327
|
+
w.map((s) => /* @__PURE__ */ n(
|
|
327
328
|
"button",
|
|
328
329
|
{
|
|
329
330
|
type: "button",
|
|
330
|
-
onClick: () => R((U) => ({ ...U, [e.id]:
|
|
331
|
+
onClick: () => R((U) => ({ ...U, [e.id]: s.id })),
|
|
331
332
|
className: K(
|
|
332
333
|
"rounded border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
333
|
-
x ===
|
|
334
|
+
x === s.id ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-900 dark:text-foreground" : "border-slate-200 text-slate-700 hover:bg-muted dark:border-border dark:text-foreground"
|
|
334
335
|
),
|
|
335
|
-
children:
|
|
336
|
+
children: s.label
|
|
336
337
|
},
|
|
337
|
-
|
|
338
|
+
s.id
|
|
338
339
|
)),
|
|
339
340
|
w.length === 0 && /* @__PURE__ */ n("span", { className: "text-[11px] text-slate-400", children: "No options match." })
|
|
340
341
|
] })
|
|
@@ -365,7 +366,7 @@ function se({
|
|
|
365
366
|
e.id
|
|
366
367
|
);
|
|
367
368
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 pt-0.5", children: [
|
|
369
370
|
!y.some((e) => e.kind === "ai") && /* @__PURE__ */ n(
|
|
370
371
|
"button",
|
|
371
372
|
{
|
|
@@ -392,16 +393,16 @@ function se({
|
|
|
392
393
|
}
|
|
393
394
|
);
|
|
394
395
|
}
|
|
395
|
-
function F(
|
|
396
|
+
function F(t) {
|
|
396
397
|
var a;
|
|
397
|
-
const
|
|
398
|
-
return String(((a =
|
|
398
|
+
const r = t;
|
|
399
|
+
return String(((a = r == null ? void 0 : r.response) == null ? void 0 : a.error) ?? (r == null ? void 0 : r.message) ?? "Request failed");
|
|
399
400
|
}
|
|
400
401
|
export {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
oe as OWN_RECORD_WRITES_EVENT,
|
|
403
|
+
ke as RecordIntegrityBanner,
|
|
404
|
+
se as findingFieldLabel,
|
|
405
|
+
be as integrityByField,
|
|
405
406
|
H as ownWritesOf,
|
|
406
|
-
|
|
407
|
+
de as useRecordIntegrity
|
|
407
408
|
};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
function
|
|
2
|
-
return { _method: "GET", _path: t, _params:
|
|
1
|
+
function n(t, o) {
|
|
2
|
+
return { _method: "GET", _path: t, _params: o };
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function e(t) {
|
|
5
|
+
return n("/collection-layouts/active", { ...t, optional: 1 });
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return { _method: "
|
|
7
|
+
function u(t, o) {
|
|
8
|
+
return { _method: "POST", _path: t, _body: o };
|
|
9
9
|
}
|
|
10
|
-
function r(t,
|
|
11
|
-
return { _method: "
|
|
10
|
+
function r(t, o) {
|
|
11
|
+
return { _method: "PATCH", _path: t, _body: o };
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function _(t, o) {
|
|
14
|
+
return { _method: "PUT", _path: t, _body: o };
|
|
15
|
+
}
|
|
16
|
+
function a(t) {
|
|
14
17
|
return { _method: "DELETE", _path: t };
|
|
15
18
|
}
|
|
16
19
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
e as
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
a as del,
|
|
21
|
+
n as get,
|
|
22
|
+
e as getActiveLayout,
|
|
23
|
+
r as patch,
|
|
24
|
+
u as post,
|
|
25
|
+
_ as put
|
|
22
26
|
};
|
|
@@ -106,7 +106,7 @@ const h = {
|
|
|
106
106
|
// ── The platform ───────────────────────────────────────────────────────────
|
|
107
107
|
MAINTENANCE: "Wait until maintenance ends, then try again.",
|
|
108
108
|
SERVER_BUSY: "Try again in a few seconds.",
|
|
109
|
-
DB_UNAVAILABLE: "
|
|
109
|
+
DB_UNAVAILABLE: "Try again in a moment.",
|
|
110
110
|
MIGRATION_PENDING: "An update is still being applied. Try again in a few minutes.",
|
|
111
111
|
NOT_CONFIGURED: "Ask an administrator to set this up first.",
|
|
112
112
|
NOT_READY: "This is still being set up. Try again in a few minutes.",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describeError as e } from "./error-message.js";
|
|
2
|
+
import { partnerCallText as n } from "./partner-failure.js";
|
|
3
|
+
import { isRawErrorText as o } from "./safe-error.js";
|
|
4
|
+
function u(i) {
|
|
5
|
+
const r = (i ?? "").trim();
|
|
6
|
+
if (!r) return null;
|
|
7
|
+
const t = n(r);
|
|
8
|
+
return t || (o(r) ? e({ message: r }, "This did not finish").title.trim() || "This did not finish" : r);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
u as jobFailureText
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { partnerCallText as e } from "./partner-failure.js";
|
|
2
|
+
import { serverErrorText as i } from "./safe-error.js";
|
|
3
|
+
function p(n, r) {
|
|
4
|
+
const t = i(n), o = t ? e(t) : null;
|
|
5
|
+
return o ? { title: `${(r == null ? void 0 : r.trim()) || "The move"} did not go through`, description: o } : null;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
p as partnerMoveFailure
|
|
9
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { toneForOutcome as d } from "./obligation-filters.js";
|
|
2
2
|
import { plainObligationReason as f } from "./obligation-reason-text.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { partnerFailureText as p } from "./partner-failure.js";
|
|
4
|
+
import { formatDate as $, getDisplayTimezone as g } from "./utils.js";
|
|
5
|
+
const _ = (o) => {
|
|
6
|
+
const t = g();
|
|
6
7
|
return new Intl.DateTimeFormat("en-US", {
|
|
7
8
|
hour: "numeric",
|
|
8
9
|
minute: "2-digit",
|
|
9
10
|
...t ? { timeZone: t } : {}
|
|
10
11
|
}).format(new Date(o));
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
const
|
|
13
|
+
function h(o, t) {
|
|
14
|
+
const r = t.getTime() - new Date(o).getTime(), e = Math.floor(r / 6e4);
|
|
14
15
|
if (e < 1) return "just now";
|
|
15
16
|
if (e < 60) return `${e}m ago`;
|
|
16
17
|
const n = Math.floor(e / 60);
|
|
@@ -18,25 +19,25 @@ function _(o, t) {
|
|
|
18
19
|
const i = Math.floor(n / 24);
|
|
19
20
|
return i < 7 ? `${i}d ago` : $(o);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function w(o) {
|
|
22
23
|
return o.split(/[._-]+/).filter(Boolean).map((t) => t[0].toUpperCase() + t.slice(1)).join(" ");
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
25
|
+
function M(o, t = /* @__PURE__ */ new Date()) {
|
|
26
|
+
const r = /* @__PURE__ */ new Map();
|
|
26
27
|
for (const e of o) {
|
|
27
28
|
if (e.outcome === "superseded") continue;
|
|
28
|
-
const n =
|
|
29
|
-
(!n || e.id > n.id) &&
|
|
29
|
+
const n = r.get(e.api);
|
|
30
|
+
(!n || e.id > n.id) && r.set(e.api, e);
|
|
30
31
|
}
|
|
31
|
-
return [...
|
|
32
|
+
return [...r.values()].map((e) => {
|
|
32
33
|
var c;
|
|
33
|
-
const n = e.resolved_at ?? e.due_at, i = `${
|
|
34
|
+
const n = e.resolved_at ?? e.due_at, i = `${h(n, t)} (${_(n)})`, l = e.reason ? ` — ${p(e.reason) ?? f(e.reason)}` : "", u = ((c = e.label) == null ? void 0 : c.trim()) || (e.trigger === "transition" ? w(e.kind) : ""), a = u ? ` · ${u}` : "";
|
|
34
35
|
let s;
|
|
35
36
|
if (e.outcome === "sent") s = `told ${i}${a}`;
|
|
36
37
|
else if (e.outcome === "pending") {
|
|
37
38
|
const m = Math.round((t.getTime() - new Date(e.due_at).getTime()) / 6e4);
|
|
38
39
|
s = `sent ${i}${a}, awaiting acknowledgement (${m} min)`;
|
|
39
|
-
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${
|
|
40
|
+
} else e.outcome === "skipped" ? s = `should have been told ${i}${a}${l}` : e.outcome === "failed" ? s = `send failed ${i}${a}${l}` : e.outcome === "missing" ? s = `never told${a}${l}` : s = `still not told${a}${l}`;
|
|
40
41
|
return {
|
|
41
42
|
api: e.api,
|
|
42
43
|
tone: d(e.outcome),
|
|
@@ -53,5 +54,5 @@ function T(o, t = /* @__PURE__ */ new Date()) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
M as bannerLines
|
|
57
58
|
};
|