@nivaro/react 0.3.52 → 0.3.54
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,309 +1,335 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useNivaroClient as
|
|
5
|
-
import { get as
|
|
6
|
-
import { useAfterIdle as
|
|
7
|
-
import { formatRelative as
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
queryKey: ["record-integrity",
|
|
11
|
-
enabled:
|
|
12
|
-
queryFn: () =>
|
|
13
|
-
|
|
14
|
-
).then((
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as S, useQueryClient as X, useMutation as Q } from "@tanstack/react-query";
|
|
3
|
+
import { useState as b, useMemo as Y, useEffect as Z } from "react";
|
|
4
|
+
import { useNivaroClient as U } from "../../context.js";
|
|
5
|
+
import { get as z, post as q } from "../../lib/commands.js";
|
|
6
|
+
import { useAfterIdle as J } from "../../lib/defer.js";
|
|
7
|
+
import { formatRelative as ee, cn as F, titleCase as te } from "../../lib/utils.js";
|
|
8
|
+
function ne(n, t, a = !0) {
|
|
9
|
+
const u = U(), { data: i } = S({
|
|
10
|
+
queryKey: ["record-integrity", n, t],
|
|
11
|
+
enabled: a,
|
|
12
|
+
queryFn: () => u.request(
|
|
13
|
+
z(`/config-conformance/record/${n}/${encodeURIComponent(t)}`)
|
|
14
|
+
).then((f) => f.data).catch(() => ({ enabled: !1, findings: [] })),
|
|
15
15
|
staleTime: 5 * 6e4
|
|
16
|
-
}),
|
|
17
|
-
queryKey: ["record-integrity",
|
|
18
|
-
enabled:
|
|
19
|
-
queryFn: () =>
|
|
20
|
-
|
|
21
|
-
).then((
|
|
16
|
+
}), p = J(2e3), { data: g, isFetching: m } = S({
|
|
17
|
+
queryKey: ["record-integrity", n, t, "live"],
|
|
18
|
+
enabled: a && p,
|
|
19
|
+
queryFn: () => u.request(
|
|
20
|
+
q(`/config-conformance/record/${n}/${encodeURIComponent(t)}/check`, {})
|
|
21
|
+
).then((f) => f.data).catch(() => null),
|
|
22
22
|
staleTime: 6e4,
|
|
23
23
|
// Never spin the banner on a background refetch storm — one live check per
|
|
24
24
|
// mount / invalidation is the contract.
|
|
25
25
|
refetchOnWindowFocus: !1
|
|
26
26
|
});
|
|
27
|
-
return { data:
|
|
27
|
+
return { data: g ?? i, checking: m };
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const re = "nvr:own-record-writes";
|
|
30
|
+
function T(n) {
|
|
31
|
+
var a;
|
|
32
|
+
const t = [];
|
|
33
|
+
for (const u of n.writes ?? []) {
|
|
34
|
+
const i = u;
|
|
35
|
+
i && typeof i.collection == "string" && i.item_id != null && i.item_id !== "" && t.push({ collection: i.collection, id: String(i.item_id) });
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return (a = n.pick) != null && a.collection && n.pick.item_id && t.push({ collection: n.pick.collection, id: String(n.pick.item_id) }), t;
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
function V(n) {
|
|
40
|
+
n.length === 0 || typeof window > "u" || window.dispatchEvent(
|
|
41
|
+
new CustomEvent(re, { detail: { writes: n } })
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function ae(n, t) {
|
|
45
|
+
var u;
|
|
46
|
+
const a = t == null ? void 0 : t.find((i) => i.field === n);
|
|
47
|
+
return ((u = a == null ? void 0 : a.label) == null ? void 0 : u.trim()) || te(n);
|
|
48
|
+
}
|
|
49
|
+
function xe(n) {
|
|
50
|
+
const t = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const a of n ?? []) {
|
|
52
|
+
const u = t.get(a.field) ?? [];
|
|
53
|
+
u.push(a), t.set(a.field, u);
|
|
54
|
+
}
|
|
55
|
+
return t;
|
|
56
|
+
}
|
|
57
|
+
const H = {
|
|
38
58
|
high: { dot: "bg-emerald-500", text: "Confident" },
|
|
39
59
|
medium: { dot: "bg-amber-500", text: "Likely" },
|
|
40
60
|
low: { dot: "bg-slate-400", text: "Manual" }
|
|
41
61
|
};
|
|
42
|
-
function
|
|
43
|
-
collection:
|
|
44
|
-
itemId:
|
|
45
|
-
onJumpToField:
|
|
62
|
+
function pe({
|
|
63
|
+
collection: n,
|
|
64
|
+
itemId: t,
|
|
65
|
+
onJumpToField: a
|
|
46
66
|
}) {
|
|
47
|
-
|
|
48
|
-
const i =
|
|
49
|
-
|
|
67
|
+
var _;
|
|
68
|
+
const u = U(), i = X(), [p, g] = b(!1), [m, f] = b(null), { data: s, checking: E } = ne(n, t), { data: y } = S({
|
|
69
|
+
queryKey: ["field-config", n, null],
|
|
70
|
+
queryFn: () => u.request(z(`/field-config/${n}`)).then((l) => l.data ?? []),
|
|
71
|
+
enabled: !!((_ = s == null ? void 0 : s.findings) != null && _.length),
|
|
72
|
+
staleTime: 6e4
|
|
73
|
+
}), K = () => {
|
|
74
|
+
i.invalidateQueries({ queryKey: ["record-integrity", n, t] }), i.invalidateQueries({ queryKey: ["item", n, t] }), i.invalidateQueries({ queryKey: [n, t] }), i.invalidateQueries({ queryKey: ["o2m-rows"] }), i.invalidateQueries({ queryKey: ["revisions"] });
|
|
50
75
|
};
|
|
51
|
-
if (!(
|
|
52
|
-
const
|
|
53
|
-
return /* @__PURE__ */
|
|
76
|
+
if (!(s != null && s.enabled) || s.findings.length === 0) return null;
|
|
77
|
+
const v = s.findings.length;
|
|
78
|
+
return /* @__PURE__ */ d(
|
|
54
79
|
"div",
|
|
55
80
|
{
|
|
56
81
|
"data-record-integrity": !0,
|
|
57
82
|
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",
|
|
58
83
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
84
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
85
|
+
/* @__PURE__ */ d("span", { className: "text-[12.5px] font-medium text-amber-800 dark:text-amber-300", children: [
|
|
86
|
+
v,
|
|
62
87
|
" data integrity issue",
|
|
63
|
-
|
|
88
|
+
v === 1 ? "" : "s",
|
|
64
89
|
" on this record"
|
|
65
90
|
] }),
|
|
66
|
-
|
|
91
|
+
s.live ? /* @__PURE__ */ r(
|
|
67
92
|
"span",
|
|
68
93
|
{
|
|
69
94
|
className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
|
|
70
95
|
"data-integrity-checked": "live",
|
|
71
96
|
children: "checked just now"
|
|
72
97
|
}
|
|
73
|
-
) :
|
|
98
|
+
) : E ? /* @__PURE__ */ r(
|
|
74
99
|
"span",
|
|
75
100
|
{
|
|
76
101
|
className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
|
|
77
102
|
"data-integrity-checked": "checking",
|
|
78
103
|
children: "checking…"
|
|
79
104
|
}
|
|
80
|
-
) :
|
|
105
|
+
) : s.checked_at ? /* @__PURE__ */ d(
|
|
81
106
|
"span",
|
|
82
107
|
{
|
|
83
108
|
className: "text-[11px] text-amber-600/80 dark:text-amber-400/70",
|
|
84
109
|
"data-integrity-checked": "stored",
|
|
85
|
-
title: new Date(
|
|
110
|
+
title: new Date(s.checked_at).toLocaleString(),
|
|
86
111
|
children: [
|
|
87
112
|
"checked ",
|
|
88
|
-
|
|
113
|
+
ee(s.checked_at)
|
|
89
114
|
]
|
|
90
115
|
}
|
|
91
116
|
) : null,
|
|
92
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ r(
|
|
93
118
|
"button",
|
|
94
119
|
{
|
|
95
120
|
type: "button",
|
|
96
|
-
onClick: () =>
|
|
121
|
+
onClick: () => g((l) => !l),
|
|
97
122
|
className: "ml-auto text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
|
|
98
|
-
children:
|
|
123
|
+
children: p ? "Hide" : "View"
|
|
99
124
|
}
|
|
100
125
|
)
|
|
101
126
|
] }),
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
127
|
+
p && /* @__PURE__ */ r("div", { className: "mt-1.5 space-y-1", children: s.findings.map((l, k) => /* @__PURE__ */ d("div", { children: [
|
|
128
|
+
/* @__PURE__ */ d("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
|
|
129
|
+
/* @__PURE__ */ r(
|
|
105
130
|
"button",
|
|
106
131
|
{
|
|
107
132
|
type: "button",
|
|
108
|
-
onClick: () =>
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
onClick: () => a == null ? void 0 : a(l.field),
|
|
134
|
+
"data-integrity-field": l.field,
|
|
135
|
+
className: "shrink-0 text-[11.5px] font-medium text-amber-700 underline decoration-dotted underline-offset-2 dark:text-amber-300",
|
|
136
|
+
children: ae(l.field, y)
|
|
111
137
|
}
|
|
112
138
|
),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
139
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 text-amber-800 dark:text-amber-200/90", children: l.message }),
|
|
140
|
+
l.fixable && /* @__PURE__ */ r(
|
|
115
141
|
"button",
|
|
116
142
|
{
|
|
117
143
|
type: "button",
|
|
118
|
-
onClick: () =>
|
|
119
|
-
className:
|
|
144
|
+
onClick: () => f((h) => h === k ? null : k),
|
|
145
|
+
className: F(
|
|
120
146
|
"shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold transition-colors",
|
|
121
|
-
|
|
147
|
+
m === k ? "bg-amber-200 text-amber-900 dark:bg-amber-400/30 dark:text-amber-100" : "bg-amber-600 text-white hover:bg-amber-700"
|
|
122
148
|
),
|
|
123
|
-
children:
|
|
149
|
+
children: m === k ? "Close" : "Fix…"
|
|
124
150
|
}
|
|
125
151
|
)
|
|
126
152
|
] }),
|
|
127
|
-
|
|
128
|
-
|
|
153
|
+
m === k && /* @__PURE__ */ r(
|
|
154
|
+
ie,
|
|
129
155
|
{
|
|
130
|
-
collection:
|
|
131
|
-
itemId:
|
|
132
|
-
finding:
|
|
133
|
-
onApplied:
|
|
134
|
-
onClose: () =>
|
|
156
|
+
collection: n,
|
|
157
|
+
itemId: t,
|
|
158
|
+
finding: l,
|
|
159
|
+
onApplied: K,
|
|
160
|
+
onClose: () => f(null)
|
|
135
161
|
}
|
|
136
162
|
)
|
|
137
|
-
] }, `${
|
|
163
|
+
] }, `${l.field}|${l.rule}|${k}`)) })
|
|
138
164
|
]
|
|
139
165
|
}
|
|
140
166
|
);
|
|
141
167
|
}
|
|
142
|
-
function
|
|
143
|
-
collection:
|
|
144
|
-
itemId:
|
|
145
|
-
finding:
|
|
146
|
-
onApplied:
|
|
147
|
-
onClose:
|
|
168
|
+
function ie({
|
|
169
|
+
collection: n,
|
|
170
|
+
itemId: t,
|
|
171
|
+
finding: a,
|
|
172
|
+
onApplied: u,
|
|
173
|
+
onClose: i
|
|
148
174
|
}) {
|
|
149
|
-
const
|
|
150
|
-
queryKey: ["integrity-proposals",
|
|
151
|
-
queryFn: () =>
|
|
175
|
+
const p = U(), g = `/config-conformance/record/${n}/${encodeURIComponent(t)}`, m = { field: a.field, rule: a.rule, message: a.message }, { data: f, isLoading: s, error: E } = S({
|
|
176
|
+
queryKey: ["integrity-proposals", n, t, a.field, a.rule],
|
|
177
|
+
queryFn: () => p.request(q(`${g}/proposals`, m)).then((e) => e.data.proposals),
|
|
152
178
|
staleTime: 6e4
|
|
153
|
-
}), [
|
|
154
|
-
|
|
155
|
-
if (!
|
|
156
|
-
|
|
157
|
-
const e = setInterval(() =>
|
|
179
|
+
}), [y, K] = b([]), [v, _] = b({}), [l, k] = b(""), [h, I] = b(null), [W, M] = b(0), [j, N] = b(null), [D, G] = b(null), B = Y(() => [...f ?? [], ...y], [f, y]);
|
|
180
|
+
Z(() => {
|
|
181
|
+
if (!h || h.undo.length === 0) return;
|
|
182
|
+
M(30);
|
|
183
|
+
const e = setInterval(() => M((c) => c <= 1 ? 0 : c - 1), 1e3);
|
|
158
184
|
return () => clearInterval(e);
|
|
159
|
-
}, [
|
|
160
|
-
const
|
|
161
|
-
mutationFn: (e) =>
|
|
162
|
-
|
|
163
|
-
...
|
|
185
|
+
}, [h]);
|
|
186
|
+
const R = Q({
|
|
187
|
+
mutationFn: (e) => p.request(
|
|
188
|
+
q(`${g}/fix`, {
|
|
189
|
+
...m,
|
|
164
190
|
proposal_id: e.id,
|
|
165
|
-
choice: e.kind === "pick" ?
|
|
191
|
+
choice: e.kind === "pick" ? v[e.id] : void 0
|
|
166
192
|
})
|
|
167
193
|
),
|
|
168
|
-
onSuccess: (e,
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
text:
|
|
174
|
-
undo:
|
|
175
|
-
}),
|
|
194
|
+
onSuccess: (e, c) => {
|
|
195
|
+
var C, $, o;
|
|
196
|
+
N(null), V(T(c)), G(c);
|
|
197
|
+
const x = e.data, w = ((C = x.failed) == null ? void 0 : C.length) ?? 0;
|
|
198
|
+
I({
|
|
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: ${((o = x.failed[0]) == null ? void 0 : o.error) ?? ""}` : ""}.`,
|
|
200
|
+
undo: x.undo ?? []
|
|
201
|
+
}), u();
|
|
176
202
|
},
|
|
177
|
-
onError: (e) =>
|
|
178
|
-
}),
|
|
179
|
-
mutationFn: (e) =>
|
|
203
|
+
onError: (e) => N(A(e))
|
|
204
|
+
}), L = Q({
|
|
205
|
+
mutationFn: (e) => p.request(q(`${g}/fix`, { ...m, undo: e })),
|
|
180
206
|
onSuccess: () => {
|
|
181
|
-
|
|
207
|
+
D && V(T(D)), I({ text: "Undone.", undo: [] }), u();
|
|
182
208
|
},
|
|
183
|
-
onError: (e) =>
|
|
184
|
-
}),
|
|
185
|
-
mutationFn: () =>
|
|
209
|
+
onError: (e) => N(A(e))
|
|
210
|
+
}), O = Q({
|
|
211
|
+
mutationFn: () => p.request(q(`${g}/proposals/ai`, m)).then((e) => e.data.proposal),
|
|
186
212
|
onSuccess: (e) => {
|
|
187
|
-
|
|
213
|
+
N(null), K((c) => c.some((x) => x.id === e.id) ? c : [...c, e]);
|
|
188
214
|
},
|
|
189
|
-
onError: (e) =>
|
|
215
|
+
onError: (e) => N(A(e))
|
|
190
216
|
});
|
|
191
|
-
return /* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ d(
|
|
192
218
|
"div",
|
|
193
219
|
{
|
|
194
220
|
"data-integrity-proposals": !0,
|
|
195
221
|
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",
|
|
196
222
|
children: [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
|
|
223
|
+
s && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "Working out what would fix this…" }),
|
|
224
|
+
E && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: A(E) }),
|
|
225
|
+
h ? /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2 text-[11.5px]", children: [
|
|
226
|
+
/* @__PURE__ */ r("span", { className: "font-medium text-emerald-700 dark:text-emerald-400", children: h.text }),
|
|
227
|
+
h.undo.length > 0 && W > 0 && /* @__PURE__ */ r(
|
|
202
228
|
"button",
|
|
203
229
|
{
|
|
204
230
|
type: "button",
|
|
205
|
-
disabled:
|
|
206
|
-
onClick: () =>
|
|
231
|
+
disabled: L.isPending,
|
|
232
|
+
onClick: () => L.mutate(h.undo),
|
|
207
233
|
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",
|
|
208
|
-
children:
|
|
234
|
+
children: L.isPending ? "Undoing…" : `Undo (${W}s)`
|
|
209
235
|
}
|
|
210
236
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ r(
|
|
212
238
|
"button",
|
|
213
239
|
{
|
|
214
240
|
type: "button",
|
|
215
|
-
onClick:
|
|
241
|
+
onClick: i,
|
|
216
242
|
className: "ml-auto text-[11px] text-slate-500 hover:text-slate-700 dark:text-muted-foreground",
|
|
217
243
|
children: "Done"
|
|
218
244
|
}
|
|
219
245
|
)
|
|
220
|
-
] }) : !
|
|
221
|
-
B.length === 0 && /* @__PURE__ */
|
|
246
|
+
] }) : !s && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
247
|
+
B.length === 0 && /* @__PURE__ */ r("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." }),
|
|
222
248
|
B.map((e) => {
|
|
223
|
-
var
|
|
224
|
-
const
|
|
225
|
-
(
|
|
249
|
+
var C, $;
|
|
250
|
+
const c = H[e.confidence] ?? H.low, x = v[e.id], w = (e.choices ?? []).filter(
|
|
251
|
+
(o) => !l || o.label.toLowerCase().includes(l.toLowerCase())
|
|
226
252
|
);
|
|
227
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ r(
|
|
228
254
|
"div",
|
|
229
255
|
{
|
|
230
256
|
className: "rounded border border-slate-200/80 bg-white px-2.5 py-1.5 dark:border-border dark:bg-card",
|
|
231
|
-
children: /* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
257
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-2", children: [
|
|
258
|
+
/* @__PURE__ */ r(
|
|
233
259
|
"span",
|
|
234
260
|
{
|
|
235
|
-
className:
|
|
236
|
-
title:
|
|
237
|
-
"data-tip":
|
|
261
|
+
className: F("mt-1.5 h-2 w-2 shrink-0 rounded-full", c.dot),
|
|
262
|
+
title: c.text,
|
|
263
|
+
"data-tip": c.text
|
|
238
264
|
}
|
|
239
265
|
),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
267
|
+
/* @__PURE__ */ d("p", { className: "text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
|
|
242
268
|
e.label,
|
|
243
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ r("span", { className: "ml-1.5 text-[10px] font-normal uppercase tracking-wide text-slate-400", children: e.kind === "ai" ? "AI" : c.text })
|
|
244
270
|
] }),
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
e.preview.length > 0 && /* @__PURE__ */
|
|
247
|
-
e.preview.slice(0, 8).map((
|
|
271
|
+
/* @__PURE__ */ r("p", { className: "text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.basis }),
|
|
272
|
+
e.preview.length > 0 && /* @__PURE__ */ d("div", { className: "mt-1 flex flex-wrap gap-1", children: [
|
|
273
|
+
e.preview.slice(0, 8).map((o, P) => /* @__PURE__ */ d(
|
|
248
274
|
"span",
|
|
249
275
|
{
|
|
250
276
|
className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10.5px] text-slate-700 dark:bg-muted dark:text-foreground",
|
|
251
277
|
children: [
|
|
252
|
-
|
|
278
|
+
o.label,
|
|
253
279
|
": ",
|
|
254
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ r("span", { className: "line-through opacity-60", children: o.from }),
|
|
255
281
|
" ",
|
|
256
282
|
"→ ",
|
|
257
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ r("span", { className: "font-medium", children: o.to })
|
|
258
284
|
]
|
|
259
285
|
},
|
|
260
|
-
`${
|
|
286
|
+
`${o.item_id}|${o.field}|${P}`
|
|
261
287
|
)),
|
|
262
|
-
e.preview.length > 8 && /* @__PURE__ */
|
|
288
|
+
e.preview.length > 8 && /* @__PURE__ */ d("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
263
289
|
"+",
|
|
264
290
|
e.preview.length - 8,
|
|
265
291
|
" more"
|
|
266
292
|
] })
|
|
267
293
|
] }),
|
|
268
|
-
e.kind === "pick" && /* @__PURE__ */
|
|
269
|
-
(((
|
|
294
|
+
e.kind === "pick" && /* @__PURE__ */ d("div", { className: "mt-1.5", children: [
|
|
295
|
+
(((C = e.choices) == null ? void 0 : C.length) ?? 0) > 8 && /* @__PURE__ */ r(
|
|
270
296
|
"input",
|
|
271
297
|
{
|
|
272
|
-
value:
|
|
273
|
-
onChange: (
|
|
298
|
+
value: l,
|
|
299
|
+
onChange: (o) => k(o.target.value),
|
|
274
300
|
placeholder: "Filter options…",
|
|
275
301
|
className: "mb-1 h-6 w-full rounded border border-slate-200 bg-white px-2 text-[11px] dark:border-border dark:bg-background"
|
|
276
302
|
}
|
|
277
303
|
),
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
304
|
+
/* @__PURE__ */ d("div", { className: "flex max-h-36 flex-wrap gap-1 overflow-y-auto", children: [
|
|
305
|
+
w.map((o) => /* @__PURE__ */ r(
|
|
280
306
|
"button",
|
|
281
307
|
{
|
|
282
308
|
type: "button",
|
|
283
|
-
onClick: () =>
|
|
284
|
-
className:
|
|
309
|
+
onClick: () => _((P) => ({ ...P, [e.id]: o.id })),
|
|
310
|
+
className: F(
|
|
285
311
|
"rounded border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
286
|
-
|
|
312
|
+
x === o.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"
|
|
287
313
|
),
|
|
288
|
-
children:
|
|
314
|
+
children: o.label
|
|
289
315
|
},
|
|
290
|
-
|
|
316
|
+
o.id
|
|
291
317
|
)),
|
|
292
|
-
|
|
318
|
+
w.length === 0 && /* @__PURE__ */ r("span", { className: "text-[11px] text-slate-400", children: "No options match." })
|
|
293
319
|
] })
|
|
294
320
|
] })
|
|
295
321
|
] }),
|
|
296
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ r(
|
|
297
323
|
"button",
|
|
298
324
|
{
|
|
299
325
|
type: "button",
|
|
300
|
-
disabled:
|
|
301
|
-
onClick: () =>
|
|
302
|
-
className:
|
|
326
|
+
disabled: R.isPending || e.kind === "pick" && !x,
|
|
327
|
+
onClick: () => R.mutate(e),
|
|
328
|
+
className: F(
|
|
303
329
|
"shrink-0 rounded px-2 py-0.5 text-[10.5px] font-semibold text-white transition-colors disabled:opacity-50",
|
|
304
330
|
e.kind === "notify" ? "bg-slate-600 hover:bg-slate-700" : "bg-nvr-cyan hover:bg-nvr-cyan-dark"
|
|
305
331
|
),
|
|
306
|
-
children:
|
|
332
|
+
children: R.isPending && (($ = R.variables) == null ? void 0 : $.id) === e.id ? "Applying…" : e.kind === "notify" ? "Send" : "Apply"
|
|
307
333
|
}
|
|
308
334
|
)
|
|
309
335
|
] })
|
|
@@ -311,40 +337,43 @@ function T({
|
|
|
311
337
|
e.id
|
|
312
338
|
);
|
|
313
339
|
}),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
!
|
|
340
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 pt-0.5", children: [
|
|
341
|
+
!y.some((e) => e.kind === "ai") && /* @__PURE__ */ r(
|
|
316
342
|
"button",
|
|
317
343
|
{
|
|
318
344
|
type: "button",
|
|
319
|
-
disabled:
|
|
320
|
-
onClick: () =>
|
|
345
|
+
disabled: O.isPending,
|
|
346
|
+
onClick: () => O.mutate(),
|
|
321
347
|
className: "text-[11px] font-medium text-slate-600 underline decoration-dotted underline-offset-2 hover:text-slate-900 disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground",
|
|
322
|
-
children:
|
|
348
|
+
children: O.isPending ? "Asking AI…" : "Ask AI for a suggestion"
|
|
323
349
|
}
|
|
324
350
|
),
|
|
325
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ r(
|
|
326
352
|
"button",
|
|
327
353
|
{
|
|
328
354
|
type: "button",
|
|
329
|
-
onClick:
|
|
355
|
+
onClick: i,
|
|
330
356
|
className: "ml-auto text-[11px] text-slate-500 hover:text-slate-700 dark:text-muted-foreground",
|
|
331
357
|
children: "Cancel"
|
|
332
358
|
}
|
|
333
359
|
)
|
|
334
360
|
] }),
|
|
335
|
-
j && /* @__PURE__ */
|
|
361
|
+
j && /* @__PURE__ */ r("p", { className: "text-[11px] text-red-600 dark:text-red-400", children: j })
|
|
336
362
|
] })
|
|
337
363
|
]
|
|
338
364
|
}
|
|
339
365
|
);
|
|
340
366
|
}
|
|
341
|
-
function
|
|
342
|
-
var
|
|
343
|
-
const
|
|
344
|
-
return String(((
|
|
367
|
+
function A(n) {
|
|
368
|
+
var a;
|
|
369
|
+
const t = n;
|
|
370
|
+
return String(((a = t == null ? void 0 : t.response) == null ? void 0 : a.error) ?? (t == null ? void 0 : t.message) ?? "Request failed");
|
|
345
371
|
}
|
|
346
372
|
export {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
373
|
+
re as OWN_RECORD_WRITES_EVENT,
|
|
374
|
+
pe as RecordIntegrityBanner,
|
|
375
|
+
ae as findingFieldLabel,
|
|
376
|
+
xe as integrityByField,
|
|
377
|
+
T as ownWritesOf,
|
|
378
|
+
ne as useRecordIntegrity
|
|
350
379
|
};
|