@nivaro/react 0.3.9 → 0.3.11
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/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1632 -1564
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +4386 -4142
- 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 +527 -479
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- 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/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/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- 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/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1026 -957
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- 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/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { latestAsOf as
|
|
3
|
-
import { formatDate as
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { latestAsOf as h } from "../lib/sheet-def.js";
|
|
3
|
+
import { formatDate as n } from "../lib/utils.js";
|
|
4
4
|
import { QueryStatStrip as p } from "./QueryStatStrip.js";
|
|
5
5
|
function y({
|
|
6
6
|
stats: o,
|
|
7
|
-
rows:
|
|
8
|
-
params:
|
|
9
|
-
loading:
|
|
7
|
+
rows: r,
|
|
8
|
+
params: m,
|
|
9
|
+
loading: a,
|
|
10
10
|
error: i,
|
|
11
|
-
asOf: e
|
|
11
|
+
asOf: e,
|
|
12
|
+
note: s
|
|
12
13
|
}) {
|
|
13
14
|
if (i)
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
e &&
|
|
15
|
+
return /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", "data-sheet-header-error": !0, children: "Couldn't load these figures. Close the sheet and open it again to retry." });
|
|
16
|
+
const l = !a && e ? h(r, e.field) : null;
|
|
17
|
+
return /* @__PURE__ */ d(x, { children: [
|
|
18
|
+
/* @__PURE__ */ t(p, { stats: o, rows: r, effectiveParams: m, loading: a }),
|
|
19
|
+
e && l && /* @__PURE__ */ d(
|
|
19
20
|
"p",
|
|
20
21
|
{
|
|
21
22
|
className: "mt-1.5 text-[11px] text-slate-500 dark:text-slate-400",
|
|
@@ -23,10 +24,11 @@ function y({
|
|
|
23
24
|
children: [
|
|
24
25
|
e.label,
|
|
25
26
|
" ",
|
|
26
|
-
|
|
27
|
+
n(l)
|
|
27
28
|
]
|
|
28
29
|
}
|
|
29
|
-
)
|
|
30
|
+
),
|
|
31
|
+
s && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-slate-500 dark:text-slate-400", "data-sheet-header-note": !0, children: s })
|
|
30
32
|
] });
|
|
31
33
|
}
|
|
32
34
|
export {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsxs as a, jsx as n, Fragment as
|
|
1
|
+
import { jsxs as a, jsx as n, Fragment as x } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as w, useQuery as C } from "@tanstack/react-query";
|
|
3
3
|
import { Brain as A, Check as q, X as S } from "lucide-react";
|
|
4
4
|
import { useState as f } from "react";
|
|
5
|
-
import { useOptionalNivaroClient as L, useNavigation as
|
|
6
|
-
import { get as
|
|
5
|
+
import { useOptionalNivaroClient as L, useNavigation as M } from "../../context.js";
|
|
6
|
+
import { get as R, post as _ } from "../../lib/commands.js";
|
|
7
|
+
import { userErrorMessage as j } from "../../lib/safe-error.js";
|
|
7
8
|
import { cn as E } from "../../lib/utils.js";
|
|
8
|
-
function
|
|
9
|
+
function U({
|
|
9
10
|
suggestions: y,
|
|
10
11
|
className: h
|
|
11
12
|
}) {
|
|
12
|
-
const i = L(), g = w(), [c, o] = f({}), [m, u] = f(null), v =
|
|
13
|
+
const i = L(), g = w(), [c, o] = f({}), [m, u] = f(null), v = M(), d = (y ?? []).filter((e) => e && typeof e.text == "string" && e.text), { data: l } = C({
|
|
13
14
|
queryKey: ["nvr-profile-prefs"],
|
|
14
|
-
queryFn: () => i.request(
|
|
15
|
+
queryFn: () => i.request(R("/users/me")).then((e) => {
|
|
15
16
|
var r;
|
|
16
17
|
return ((r = e.data) == null ? void 0 : r.preferences) ?? {};
|
|
17
18
|
}),
|
|
@@ -24,19 +25,19 @@ function P({
|
|
|
24
25
|
var r;
|
|
25
26
|
u(null), o((t) => ({ ...t, [e]: "saving" }));
|
|
26
27
|
try {
|
|
27
|
-
await i.request(
|
|
28
|
+
await i.request(_("/ai/memory", { text: e })), o((t) => ({ ...t, [e]: "saved" })), g.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
|
|
28
29
|
} catch (t) {
|
|
29
30
|
o((N) => ({ ...N, [e]: "idle" }));
|
|
30
31
|
const s = (r = t == null ? void 0 : t.response) == null ? void 0 : r.data;
|
|
31
32
|
u({
|
|
32
|
-
text: (s == null ? void 0 : s.error) ?? (t
|
|
33
|
+
text: (s == null ? void 0 : s.error) ?? j(t, "Could not remember that"),
|
|
33
34
|
// A full memory refuses — nothing is dropped; the person picks on Profile.
|
|
34
35
|
full: (s == null ? void 0 : s.code) === "AI_MEMORY_FULL"
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
},
|
|
38
|
-
return
|
|
39
|
-
|
|
38
|
+
}, p = d.filter((e) => c[e.text] !== "dismissed");
|
|
39
|
+
return p.length === 0 ? null : /* @__PURE__ */ a("div", { className: E("mt-2 space-y-1", h), "data-ai-memory-suggestions": !0, children: [
|
|
40
|
+
p.map((e) => {
|
|
40
41
|
const r = c[e.text] ?? "idle", t = r === "saved" || b.has(e.text.toLowerCase());
|
|
41
42
|
return /* @__PURE__ */ a(
|
|
42
43
|
"div",
|
|
@@ -50,7 +51,7 @@ function P({
|
|
|
50
51
|
"Remembered: “",
|
|
51
52
|
e.text,
|
|
52
53
|
"” — see Profile → Ask AI memory."
|
|
53
|
-
] }) : /* @__PURE__ */ a(
|
|
54
|
+
] }) : /* @__PURE__ */ a(x, { children: [
|
|
54
55
|
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1 text-slate-700 dark:text-slate-200", children: [
|
|
55
56
|
/* @__PURE__ */ n("span", { className: "font-medium", children: "Remember this?" }),
|
|
56
57
|
" ",
|
|
@@ -93,7 +94,7 @@ function P({
|
|
|
93
94
|
}),
|
|
94
95
|
m && /* @__PURE__ */ a("p", { className: "text-[11.5px] text-red-600", "data-ai-memory-error": !0, children: [
|
|
95
96
|
m.text,
|
|
96
|
-
m.full && /* @__PURE__ */ a(
|
|
97
|
+
m.full && /* @__PURE__ */ a(x, { children: [
|
|
97
98
|
" ",
|
|
98
99
|
/* @__PURE__ */ n(
|
|
99
100
|
"button",
|
|
@@ -110,5 +111,5 @@ function P({
|
|
|
110
111
|
] });
|
|
111
112
|
}
|
|
112
113
|
export {
|
|
113
|
-
|
|
114
|
+
U as AiMemorySuggestions
|
|
114
115
|
};
|
|
@@ -5,33 +5,34 @@ import { useState as c, useEffect as y, useRef as R } from "react";
|
|
|
5
5
|
import { createPortal as Ae } from "react-dom";
|
|
6
6
|
import { useNivaroClient as $e, useNavigation as Ce } from "../../context.js";
|
|
7
7
|
import { get as De } from "../../lib/commands.js";
|
|
8
|
-
import {
|
|
8
|
+
import { userErrorMessage as Re } from "../../lib/safe-error.js";
|
|
9
|
+
import { useAiStream as qe } from "../../lib/use-ai-stream.js";
|
|
9
10
|
import { cn as se } from "../../lib/utils.js";
|
|
10
|
-
import { AiFeedbackButtons as
|
|
11
|
+
import { AiFeedbackButtons as Ee } from "./AiFeedbackButtons.js";
|
|
11
12
|
import { AiMarkdown as ae } from "./AiMarkdown.js";
|
|
12
|
-
import { AiStepList as
|
|
13
|
-
import { useAskHost as le, readDroppedRecord as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
13
|
+
import { AiStepList as Se } from "./AiStepList.js";
|
|
14
|
+
import { useAskHost as le, readDroppedRecord as Oe, askContextBody as Te } from "./ask-context.js";
|
|
15
|
+
const Ie = ".pdf,.docx,.xlsx,.xls,.xlsm,.csv,.txt,.md,.eml,.html,.htm", je = 20, q = 5;
|
|
16
|
+
function Ve({
|
|
16
17
|
subscribe: E,
|
|
17
18
|
connected: S,
|
|
18
19
|
askPath: O = "/ask"
|
|
19
20
|
}) {
|
|
20
|
-
const s = le(), [
|
|
21
|
+
const s = le(), [f, T] = c(!1);
|
|
21
22
|
return y(() => {
|
|
22
23
|
s != null && s.open && T(!0);
|
|
23
|
-
}, [s == null ? void 0 : s.open]), !s || !
|
|
24
|
-
/* @__PURE__ */ t(
|
|
24
|
+
}, [s == null ? void 0 : s.open]), !s || !f || typeof document > "u" ? null : Ae(
|
|
25
|
+
/* @__PURE__ */ t(_e, { subscribe: E, connected: S, askPath: O }),
|
|
25
26
|
document.body
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function _e({
|
|
29
30
|
subscribe: E,
|
|
30
31
|
connected: S,
|
|
31
32
|
askPath: O
|
|
32
33
|
}) {
|
|
33
34
|
var Z, ee, te;
|
|
34
|
-
const s = le(),
|
|
35
|
+
const s = le(), f = $e(), { navigate: T } = Ce(), n = s.page, [h, v] = c([]), [k, N] = c(""), [I, M] = c(null), [x, B] = c(/* @__PURE__ */ new Set()), [Q, j] = c([]), [w, _] = c([]), [P, z] = c(0), [X, J] = c([]), [U, F] = c(!1), [W, g] = c(null), H = R(null), K = R(null), G = R(null), V = R(null);
|
|
35
36
|
V.current = I;
|
|
36
37
|
const ie = JSON.stringify(n ?? {});
|
|
37
38
|
y(() => {
|
|
@@ -47,13 +48,13 @@ function je({
|
|
|
47
48
|
}, [s.open]);
|
|
48
49
|
const d = n != null && n.record && !x.has("record") ? n.record : null, { data: A } = he({
|
|
49
50
|
queryKey: ["ask-panel-record-files", d == null ? void 0 : d.collection, d == null ? void 0 : d.id],
|
|
50
|
-
queryFn: () =>
|
|
51
|
+
queryFn: () => f.request(
|
|
51
52
|
De("/ai/ask/record-files", { collection: d.collection, id: d.id })
|
|
52
53
|
).then((e) => e.data),
|
|
53
54
|
enabled: !!d,
|
|
54
55
|
staleTime: 6e4,
|
|
55
56
|
retry: !1
|
|
56
|
-
}),
|
|
57
|
+
}), a = qe(f, {
|
|
57
58
|
subscribe: E,
|
|
58
59
|
connected: S,
|
|
59
60
|
onDone: (e) => {
|
|
@@ -78,19 +79,19 @@ function je({
|
|
|
78
79
|
y(() => {
|
|
79
80
|
var e;
|
|
80
81
|
(e = K.current) == null || e.scrollTo({ top: K.current.scrollHeight });
|
|
81
|
-
}, [h.length,
|
|
82
|
+
}, [h.length, a.text, a.steps.length]);
|
|
82
83
|
const b = ((ee = [...h].reverse().find((e) => e.role === "user")) == null ? void 0 : ee.content) ?? "";
|
|
83
84
|
function $(e, r = {}) {
|
|
84
85
|
const o = (e ?? k).trim();
|
|
85
|
-
if (!o ||
|
|
86
|
+
if (!o || a.active) return;
|
|
86
87
|
g(null), v((m) => [...m, { role: "user", content: o }]), e === void 0 && N("");
|
|
87
|
-
const
|
|
88
|
+
const l = Te(n, {
|
|
88
89
|
dismissed: x,
|
|
89
90
|
records: Q,
|
|
90
91
|
attachments: w.map((m) => m.id),
|
|
91
92
|
recordFiles: X
|
|
92
93
|
}), u = V.current, D = u ? [] : h.slice(-18).map((m) => ({ role: m.role, content: m.content.slice(0, 4e3) }));
|
|
93
|
-
|
|
94
|
+
a.start({
|
|
94
95
|
messages: [...D, { role: "user", content: o }],
|
|
95
96
|
...u ? { conversation_id: u } : { save: !0 },
|
|
96
97
|
...r.fresh ? { fresh: !0 } : {},
|
|
@@ -98,39 +99,39 @@ function je({
|
|
|
98
99
|
try_harder: !0,
|
|
99
100
|
...r.tryHarder.retryOf ? { retry_of: r.tryHarder.retryOf } : {}
|
|
100
101
|
} : {},
|
|
101
|
-
...
|
|
102
|
+
...l ? { context: l } : {}
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
async function Y(e) {
|
|
105
106
|
const r = q - w.length;
|
|
106
107
|
for (const o of e.slice(0, Math.max(0, r))) {
|
|
107
|
-
z((
|
|
108
|
+
z((l) => l + 1);
|
|
108
109
|
try {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
const u =
|
|
110
|
+
const l = new FormData();
|
|
111
|
+
l.append("file", o, o.name);
|
|
112
|
+
const u = f.getToken(), D = await fetch(`${f.url}/api/ai/ask/attachments`, {
|
|
112
113
|
method: "POST",
|
|
113
114
|
headers: u ? { Authorization: `Bearer ${u}` } : {},
|
|
114
115
|
credentials: u ? "omit" : "include",
|
|
115
|
-
body:
|
|
116
|
+
body: l
|
|
116
117
|
}), m = await D.json().catch(() => ({}));
|
|
117
118
|
if (!D.ok || !m.data) throw new Error(m.error || `Could not read ${o.name}`);
|
|
118
|
-
const
|
|
119
|
-
_((
|
|
120
|
-
} catch (
|
|
121
|
-
g(
|
|
119
|
+
const pe = m.data;
|
|
120
|
+
_((fe) => [...fe, pe]);
|
|
121
|
+
} catch (l) {
|
|
122
|
+
g(Re(l, `Could not read ${o.name}`));
|
|
122
123
|
} finally {
|
|
123
|
-
z((
|
|
124
|
+
z((l) => l - 1);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
e.length > r && g(`At most ${q} files per conversation`);
|
|
127
128
|
}
|
|
128
129
|
function de(e) {
|
|
129
130
|
e.preventDefault(), F(!1);
|
|
130
|
-
const r =
|
|
131
|
+
const r = Oe(e.dataTransfer);
|
|
131
132
|
if (r) {
|
|
132
133
|
j(
|
|
133
|
-
(
|
|
134
|
+
(l) => l.some((u) => u.collection === r.collection && u.id === r.id) || l.length >= je ? l : [...l, r]
|
|
134
135
|
);
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
@@ -150,43 +151,43 @@ function je({
|
|
|
150
151
|
e.preventDefault(), N(b);
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
154
|
+
e.key === "Escape" && (e.preventDefault(), a.active ? a.stop() : s.setOpen(!1));
|
|
154
155
|
}
|
|
155
156
|
function me() {
|
|
156
157
|
var e;
|
|
157
|
-
|
|
158
|
+
a.active || (v([]), M(null), j([]), _([]), g(null), (e = H.current) == null || e.focus());
|
|
158
159
|
}
|
|
159
|
-
const
|
|
160
|
-
n != null && n.record && !x.has("record") &&
|
|
160
|
+
const p = [], C = (e) => B((r) => new Set(r).add(e));
|
|
161
|
+
n != null && n.record && !x.has("record") && p.push({
|
|
161
162
|
key: "record",
|
|
162
163
|
icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
|
|
163
164
|
label: n.record.label || `${n.record.collection} ${n.record.id}`,
|
|
164
165
|
onRemove: () => C("record")
|
|
165
|
-
}), n != null && n.list && !x.has("list") &&
|
|
166
|
+
}), n != null && n.list && !x.has("list") && p.push({
|
|
166
167
|
key: "list",
|
|
167
168
|
icon: /* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
168
169
|
label: `${n.list.label || n.list.collection} · ${n.list.ids.length} on screen${n.list.filters.length ? ` · ${n.list.filters.length} filter(s)` : ""}`,
|
|
169
170
|
onRemove: () => C("list")
|
|
170
|
-
}), n != null && n.queue && !x.has("queue") &&
|
|
171
|
+
}), n != null && n.queue && !x.has("queue") && p.push({
|
|
171
172
|
key: "queue",
|
|
172
173
|
icon: /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
173
174
|
label: `${n.queue.label || "Queue"} · ${n.queue.items.length} on screen`,
|
|
174
175
|
onRemove: () => C("queue")
|
|
175
|
-
}), n != null && n.report && !x.has("report") &&
|
|
176
|
+
}), n != null && n.report && !x.has("report") && p.push({
|
|
176
177
|
key: "report",
|
|
177
178
|
icon: /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
|
|
178
179
|
label: `${n.report.label || "Report"}${(te = n.report.entity_filters) != null && te.length ? ` · ${n.report.entity_filters.length} filter(s)` : ""}`,
|
|
179
180
|
onRemove: () => C("report")
|
|
180
181
|
});
|
|
181
182
|
for (const e of Q)
|
|
182
|
-
|
|
183
|
+
p.push({
|
|
183
184
|
key: `rec:${e.collection}:${e.id}`,
|
|
184
185
|
icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
|
|
185
186
|
label: e.label || `${e.collection} ${e.id}`,
|
|
186
187
|
onRemove: () => j((r) => r.filter((o) => !(o.collection === e.collection && o.id === e.id)))
|
|
187
188
|
});
|
|
188
189
|
for (const e of w)
|
|
189
|
-
|
|
190
|
+
p.push({
|
|
190
191
|
key: `doc:${e.id}`,
|
|
191
192
|
icon: /* @__PURE__ */ t(L, { className: "h-3 w-3" }),
|
|
192
193
|
label: `${e.name}${e.truncated ? " (long — first part)" : ""}`,
|
|
@@ -236,7 +237,7 @@ function je({
|
|
|
236
237
|
{
|
|
237
238
|
type: "button",
|
|
238
239
|
onClick: me,
|
|
239
|
-
disabled:
|
|
240
|
+
disabled: a.active,
|
|
240
241
|
"aria-label": "New conversation",
|
|
241
242
|
"data-tip": "New conversation",
|
|
242
243
|
className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",
|
|
@@ -261,7 +262,7 @@ function je({
|
|
|
261
262
|
ref: K,
|
|
262
263
|
className: "min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-3 py-3",
|
|
263
264
|
children: [
|
|
264
|
-
h.length === 0 && !
|
|
265
|
+
h.length === 0 && !a.active && /* @__PURE__ */ i("div", { className: "space-y-2 pt-6 text-center text-[12.5px] text-muted-foreground", children: [
|
|
265
266
|
/* @__PURE__ */ t("p", { children: "Ask about what is on this page — the chips below say what rides along." }),
|
|
266
267
|
/* @__PURE__ */ t("p", { className: "text-[11.5px]", children: "Drop records or a PDF, Word or Excel file here to ask about them too." })
|
|
267
268
|
] }),
|
|
@@ -282,22 +283,22 @@ function je({
|
|
|
282
283
|
"data-ask-panel-try-harder": !0,
|
|
283
284
|
"data-tip": "Quick answer from a smaller model — ask the main one",
|
|
284
285
|
className: "text-[11px] text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground disabled:opacity-40",
|
|
285
|
-
disabled:
|
|
286
|
+
disabled: a.active,
|
|
286
287
|
onClick: () => $(b, { tryHarder: { retryOf: e.requestId ?? null } }),
|
|
287
288
|
children: "Try harder"
|
|
288
289
|
}
|
|
289
290
|
),
|
|
290
|
-
/* @__PURE__ */ t(
|
|
291
|
+
/* @__PURE__ */ t(Ee, { requestId: e.requestId })
|
|
291
292
|
] })
|
|
292
293
|
] }, r)
|
|
293
294
|
)
|
|
294
295
|
),
|
|
295
|
-
|
|
296
|
-
/* @__PURE__ */ t(
|
|
297
|
-
|
|
296
|
+
a.active && /* @__PURE__ */ i("div", { "data-ask-panel-streaming": !0, className: "space-y-1.5", children: [
|
|
297
|
+
/* @__PURE__ */ t(Se, { steps: a.steps, folded: !!a.text }),
|
|
298
|
+
a.text ? /* @__PURE__ */ t(ae, { content: a.text, className: "text-[13px]" }) : /* @__PURE__ */ i("p", { className: "flex items-center gap-1.5 text-[12px] text-muted-foreground", children: [
|
|
298
299
|
/* @__PURE__ */ t(oe, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
299
300
|
" ",
|
|
300
|
-
|
|
301
|
+
a.status ?? "Thinking…"
|
|
301
302
|
] })
|
|
302
303
|
] }),
|
|
303
304
|
W && /* @__PURE__ */ t("p", { className: "rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[12px] text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300", children: W })
|
|
@@ -305,8 +306,8 @@ function je({
|
|
|
305
306
|
}
|
|
306
307
|
),
|
|
307
308
|
/* @__PURE__ */ i("footer", { className: "shrink-0 space-y-2 border-t border-border px-3 py-2.5", children: [
|
|
308
|
-
(
|
|
309
|
-
|
|
309
|
+
(p.length > 0 || P > 0) && /* @__PURE__ */ i("div", { className: "flex flex-wrap gap-1.5", "data-ask-panel-chips": !0, children: [
|
|
310
|
+
p.map((e) => /* @__PURE__ */ i(
|
|
310
311
|
"span",
|
|
311
312
|
{
|
|
312
313
|
className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[11.5px]",
|
|
@@ -342,7 +343,7 @@ function je({
|
|
|
342
343
|
type: "button",
|
|
343
344
|
"aria-pressed": r,
|
|
344
345
|
onClick: () => J(
|
|
345
|
-
(o) => r ? o.filter((
|
|
346
|
+
(o) => r ? o.filter((l) => l !== e.id) : o.length >= q ? o : [...o, e.id]
|
|
346
347
|
),
|
|
347
348
|
className: se(
|
|
348
349
|
"inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-[11.5px]",
|
|
@@ -378,7 +379,7 @@ function je({
|
|
|
378
379
|
{
|
|
379
380
|
ref: G,
|
|
380
381
|
type: "file",
|
|
381
|
-
accept:
|
|
382
|
+
accept: Ie,
|
|
382
383
|
multiple: !0,
|
|
383
384
|
className: "hidden",
|
|
384
385
|
onChange: (e) => {
|
|
@@ -400,11 +401,11 @@ function je({
|
|
|
400
401
|
className: "min-h-[38px] flex-1 resize-none rounded-md border border-border bg-background px-2.5 py-2 text-[13px] outline-none focus:border-nvr-cyan"
|
|
401
402
|
}
|
|
402
403
|
),
|
|
403
|
-
|
|
404
|
+
a.active ? /* @__PURE__ */ t(
|
|
404
405
|
"button",
|
|
405
406
|
{
|
|
406
407
|
type: "button",
|
|
407
|
-
onClick: () => void
|
|
408
|
+
onClick: () => void a.stop(),
|
|
408
409
|
"aria-label": "Stop the answer",
|
|
409
410
|
className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-border hover:bg-muted",
|
|
410
411
|
children: /* @__PURE__ */ t(Ne, { className: "h-3.5 w-3.5" })
|
|
@@ -428,5 +429,5 @@ function je({
|
|
|
428
429
|
);
|
|
429
430
|
}
|
|
430
431
|
export {
|
|
431
|
-
|
|
432
|
+
Ve as AskPanel
|
|
432
433
|
};
|
|
@@ -6,14 +6,15 @@ import { toast as j } from "sonner";
|
|
|
6
6
|
import { useNivaroClient as z } from "../../context.js";
|
|
7
7
|
import { newBulkProgressId as X, startBulkProgress as Y, endBulkProgress as Z } from "../../lib/bulk-progress.js";
|
|
8
8
|
import { get as D, post as O } from "../../lib/commands.js";
|
|
9
|
+
import { userErrorMessage as ee } from "../../lib/safe-error.js";
|
|
9
10
|
import { cn as R } from "../../lib/utils.js";
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { PushBulkButtons as
|
|
11
|
+
import { Popover as te, PopoverTrigger as re, PopoverContent as ne } from "../ui/popover.js";
|
|
12
|
+
import { PushBulkButtons as oe } from "./PushBulkButtons.js";
|
|
12
13
|
function k(t) {
|
|
13
14
|
return t === !0 || t === 1 || t === "1" || t === "true" ? "true" : t === !1 || t === 0 || t === "0" || t === "false" ? "false" : String(t ?? "");
|
|
14
15
|
}
|
|
15
16
|
const U = (t) => t == null || t === "";
|
|
16
|
-
function
|
|
17
|
+
function we(t, i) {
|
|
17
18
|
for (const n of t ?? []) {
|
|
18
19
|
if (!n || typeof n.field != "string") continue;
|
|
19
20
|
if (!(n.field in i)) return null;
|
|
@@ -65,13 +66,13 @@ function G(t) {
|
|
|
65
66
|
function K(t, i, n) {
|
|
66
67
|
return t ? t.includes(n) || t.includes(`${i}:${n}`) : !0;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function ye(t, i) {
|
|
69
70
|
const { data: n } = G(t), s = !!n && Object.values(n).some((o) => o.some((c) => c.source === "builtin"));
|
|
70
71
|
return (o) => s ? t.some(
|
|
71
72
|
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) && K(i, c, o)
|
|
72
73
|
) : !0;
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function se(t, i, n) {
|
|
75
76
|
const s = /* @__PURE__ */ new Map();
|
|
76
77
|
for (const o of i)
|
|
77
78
|
for (const c of (t == null ? void 0 : t[o]) ?? []) {
|
|
@@ -81,18 +82,18 @@ function oe(t, i, n) {
|
|
|
81
82
|
}
|
|
82
83
|
return [...s.values()];
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function ie(t, i, n) {
|
|
85
86
|
const s = [`${i.succeeded} done`];
|
|
86
87
|
return i.skipped && s.push(`${i.skipped} skipped`), i.failed && s.push(`${i.failed} failed`), `${t}: ${s.join(" · ")}${n !== i.succeeded + i.skipped + i.failed ? ` of ${n}` : ""}`;
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function ve({
|
|
89
90
|
targets: t,
|
|
90
91
|
enabledKeys: i,
|
|
91
92
|
tone: n = "light",
|
|
92
93
|
disabled: s,
|
|
93
94
|
onDone: o
|
|
94
95
|
}) {
|
|
95
|
-
const c = z(), g = [...new Set(t.map((e) => e.collection))], { data: x } = G(g), S =
|
|
96
|
+
const c = z(), g = [...new Set(t.map((e) => e.collection))], { data: x } = G(g), S = se(x, g, i), [L, $] = y(null), [N, _] = y(""), [P, C] = y(null), [A, B] = y({}), [E, M] = y(!1), Q = async (e) => {
|
|
96
97
|
const u = `${e.source}:${e.key}`;
|
|
97
98
|
if (e.source === "db") {
|
|
98
99
|
B((a) => ({ ...a, [u]: "loading" }));
|
|
@@ -111,18 +112,18 @@ function we({
|
|
|
111
112
|
B((a) => ({ ...a, [u]: null }));
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
},
|
|
115
|
-
|
|
115
|
+
}, T = /* @__PURE__ */ f(
|
|
116
|
+
oe,
|
|
116
117
|
{
|
|
117
118
|
targets: t,
|
|
118
119
|
enabledKeys: i,
|
|
119
120
|
tone: n,
|
|
120
121
|
disabled: s || !!P,
|
|
121
|
-
onDone: (e) => o == null ? void 0 : o({ ...e, action:
|
|
122
|
+
onDone: (e) => o == null ? void 0 : o({ ...e, action: le })
|
|
122
123
|
}
|
|
123
124
|
);
|
|
124
|
-
if (S.length === 0) return
|
|
125
|
-
const
|
|
125
|
+
if (S.length === 0) return T;
|
|
126
|
+
const F = async (e) => {
|
|
126
127
|
const u = `${e.source}:${e.key}`;
|
|
127
128
|
C(u);
|
|
128
129
|
const a = { succeeded: 0, failed: 0, skipped: 0, errors: [] };
|
|
@@ -141,12 +142,12 @@ function we({
|
|
|
141
142
|
)).data ?? {};
|
|
142
143
|
a.succeeded += v.succeeded ?? (e.source === "extension" ? b.length : 0), a.failed += v.failed ?? 0, a.skipped += v.skipped ?? 0, a.errors.push(...v.errors ?? []);
|
|
143
144
|
}
|
|
144
|
-
const d =
|
|
145
|
+
const d = ie(e.label, a, h), m = a.errors.slice(0, 3).map((r) => `#${r.item}: ${r.error}`).join(`
|
|
145
146
|
`);
|
|
146
147
|
a.failed > 0 ? j.warning(d, { description: m || void 0, duration: 8e3 }) : j.success(d, { duration: 4e3 }), o == null || o({ ...a, action: e }), $(null), _("");
|
|
147
148
|
} catch (d) {
|
|
148
149
|
const m = d.response;
|
|
149
|
-
j.error((m == null ? void 0 : m.error) ?? (d
|
|
150
|
+
j.error((m == null ? void 0 : m.error) ?? ee(d, `${e.label} failed`));
|
|
150
151
|
} finally {
|
|
151
152
|
C(null);
|
|
152
153
|
}
|
|
@@ -163,14 +164,14 @@ function we({
|
|
|
163
164
|
S.map((e) => {
|
|
164
165
|
const u = `${e.source}:${e.key}`, a = L === u, h = P === u, d = t.filter((r) => e.collections.includes(r.collection)).length, m = d > 0 && (!e.require_reason || N.trim().length > 0) && !h;
|
|
165
166
|
return /* @__PURE__ */ p(
|
|
166
|
-
|
|
167
|
+
te,
|
|
167
168
|
{
|
|
168
169
|
open: a,
|
|
169
170
|
onOpenChange: (r) => {
|
|
170
|
-
$(r ? u : null), r ? (
|
|
171
|
+
$(r ? u : null), r ? (M(!1), Q(e)) : _("");
|
|
171
172
|
},
|
|
172
173
|
children: [
|
|
173
|
-
/* @__PURE__ */ f(
|
|
174
|
+
/* @__PURE__ */ f(re, { asChild: !0, children: /* @__PURE__ */ f(
|
|
174
175
|
"button",
|
|
175
176
|
{
|
|
176
177
|
type: "button",
|
|
@@ -182,7 +183,7 @@ function we({
|
|
|
182
183
|
}
|
|
183
184
|
) }),
|
|
184
185
|
/* @__PURE__ */ p(
|
|
185
|
-
|
|
186
|
+
ne,
|
|
186
187
|
{
|
|
187
188
|
align: "center",
|
|
188
189
|
side: "top",
|
|
@@ -224,14 +225,14 @@ function we({
|
|
|
224
225
|
" would change",
|
|
225
226
|
b.length > 0 && /* @__PURE__ */ p("span", { className: "font-normal text-slate-500", children: [
|
|
226
227
|
" · ",
|
|
227
|
-
[...w.entries()].map(([l,
|
|
228
|
+
[...w.entries()].map(([l, I]) => `${I} ${l}`).join(" · ")
|
|
228
229
|
] })
|
|
229
230
|
] }),
|
|
230
231
|
b.length > 0 && /* @__PURE__ */ p(
|
|
231
232
|
"button",
|
|
232
233
|
{
|
|
233
234
|
type: "button",
|
|
234
|
-
onClick: () =>
|
|
235
|
+
onClick: () => M((l) => !l),
|
|
235
236
|
className: "mt-0.5 text-[11px] text-slate-500 underline-offset-2 hover:underline",
|
|
236
237
|
"data-bulk-preview-toggle": !0,
|
|
237
238
|
children: [
|
|
@@ -262,7 +263,7 @@ function we({
|
|
|
262
263
|
value: N,
|
|
263
264
|
onChange: (r) => _(r.target.value),
|
|
264
265
|
onKeyDown: (r) => {
|
|
265
|
-
r.key === "Enter" && (r.metaKey || r.ctrlKey) && m &&
|
|
266
|
+
r.key === "Enter" && (r.metaKey || r.ctrlKey) && m && F(e);
|
|
266
267
|
},
|
|
267
268
|
rows: 2,
|
|
268
269
|
placeholder: "Recorded on every record’s history",
|
|
@@ -284,7 +285,7 @@ function we({
|
|
|
284
285
|
"button",
|
|
285
286
|
{
|
|
286
287
|
type: "button",
|
|
287
|
-
onClick: () => void
|
|
288
|
+
onClick: () => void F(e),
|
|
288
289
|
disabled: !m,
|
|
289
290
|
"data-bulk-action-run": !0,
|
|
290
291
|
className: R(
|
|
@@ -306,10 +307,10 @@ function we({
|
|
|
306
307
|
u
|
|
307
308
|
);
|
|
308
309
|
}),
|
|
309
|
-
|
|
310
|
+
T
|
|
310
311
|
] });
|
|
311
312
|
}
|
|
312
|
-
const
|
|
313
|
+
const le = {
|
|
313
314
|
key: "push",
|
|
314
315
|
source: "builtin",
|
|
315
316
|
collection: null,
|
|
@@ -322,10 +323,10 @@ const ie = {
|
|
|
322
323
|
summary: "Integration push"
|
|
323
324
|
};
|
|
324
325
|
export {
|
|
325
|
-
|
|
326
|
+
ve as BulkActionButtons,
|
|
326
327
|
K as bulkActionEnabled,
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
we as guardMatches,
|
|
329
|
+
se as mergeBulkActions,
|
|
329
330
|
G as useAvailableBulkActions,
|
|
330
|
-
|
|
331
|
+
ye as useBuiltinGate
|
|
331
332
|
};
|