@nivaro/react 0.3.139 → 0.3.141
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/InlineGridField.js +95 -92
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +39 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2702 -2671
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3475 -3458
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/RowPresence.js +83 -76
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/UnseenDot.js +183 -22
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/delivery-analytics/drill.js +32 -32
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
- package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
- package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
- package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
- package/dist/shared/components/layout-editor/settings/controls.js +98 -90
- package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +884 -872
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +123 -123
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +251 -229
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/layout-resolve.js +64 -48
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { formatCurrency as n } from "../../../lib/number-format.js";
|
|
2
|
+
const s = (e, t = 2) => e == null || Number.isNaN(e) ? "–" : e > 0 && e < 1e-4 ? "<$0.0001" : n(e, { decimals: e < 0.1 && e > 0 ? 4 : t }), a = (e) => e == null || Number.isNaN(e) ? "–" : e.toLocaleString("en-US"), c = (e) => e == null ? "–" : e >= 1e6 ? `${(e / 1e6).toFixed(2)}M` : e >= 1e4 ? `${(e / 1e3).toFixed(1)}k` : e.toLocaleString("en-US"), l = (e) => e == null ? "–" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`, m = (e, t) => t > 0 ? `${e / t < 0.1 && e > 0 ? (e / t * 100).toFixed(1) : Math.round(e / t * 100)}%` : "–", i = {
|
|
2
3
|
ok: "OK",
|
|
3
4
|
end_turn: "Answered",
|
|
4
5
|
tool_use: "Called tools",
|
|
@@ -6,8 +7,8 @@ const i = (e, t = 2) => e == null || Number.isNaN(e) ? "–" : e > 0 && e < 1e-4
|
|
|
6
7
|
stopped: "Stopped by the person",
|
|
7
8
|
stop_sequence: "Stop sequence",
|
|
8
9
|
error: "Error"
|
|
9
|
-
},
|
|
10
|
-
function
|
|
10
|
+
}, d = (e) => i[e ?? "ok"] ?? String(e).replace(/_/g, " "), g = (e) => e.status === "error" ? "error" : e.stop_reason ?? "ok", h = (e) => e === "chat" ? "Ask AI" : e === "chat-bot" ? "Chat bot" : e.replace(/[-_]+/g, " ").replace(/^\w/, (t) => t.toUpperCase());
|
|
11
|
+
function N(e, t) {
|
|
11
12
|
if (t === "hour") {
|
|
12
13
|
const r = /* @__PURE__ */ new Date(`${e}:00:00.000Z`);
|
|
13
14
|
return Number.isNaN(r.getTime()) ? e : r.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric" });
|
|
@@ -15,13 +16,13 @@ function g(e, t) {
|
|
|
15
16
|
const o = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
16
17
|
return Number.isNaN(o.getTime()) ? e : o.toLocaleDateString(void 0, { month: "short", day: "numeric", timeZone: "UTC" });
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function S(e, t) {
|
|
19
20
|
const o = t === "hour" ? /* @__PURE__ */ new Date(`${e}:00:00.000Z`) : /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
20
21
|
if (Number.isNaN(o.getTime())) return null;
|
|
21
22
|
const r = new Date(o.getTime() + (t === "hour" ? 36e5 : 864e5));
|
|
22
23
|
return { from: o.toISOString(), to: r.toISOString() };
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function b(e) {
|
|
25
26
|
if (!e) return "–";
|
|
26
27
|
const t = new Date(e);
|
|
27
28
|
return Number.isNaN(t.getTime()) ? "–" : t.toLocaleString(void 0, {
|
|
@@ -32,15 +33,15 @@ function N(e) {
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
N as bucketLabel,
|
|
37
|
+
S as bucketRange,
|
|
38
|
+
h as featureLabel,
|
|
39
|
+
a as num,
|
|
40
|
+
m as pctOf,
|
|
41
|
+
d as resultLabel,
|
|
42
|
+
g as resultOf,
|
|
43
|
+
l as secs,
|
|
44
|
+
c as tok,
|
|
45
|
+
s as usd,
|
|
46
|
+
b as whenShort
|
|
46
47
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
1
|
+
import { jsxs as p, Fragment as Y, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Z, useQuery as D } from "@tanstack/react-query";
|
|
3
3
|
import { Loader2 as Q } from "lucide-react";
|
|
4
4
|
import { useState as y } from "react";
|
|
5
5
|
import { toast as O } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
6
|
+
import { useNivaroClient as G } from "../../context.js";
|
|
7
7
|
import { outcomeName as H } from "../../lib/bulk-copy.js";
|
|
8
|
-
import { newBulkProgressId as
|
|
9
|
-
import { get as
|
|
10
|
-
import { errorToastOptions as
|
|
11
|
-
import { userErrorMessage as
|
|
12
|
-
import { cn as j } from "../../lib/utils.js";
|
|
13
|
-
import { invalidateRecordQueries as
|
|
14
|
-
import { Popover as
|
|
15
|
-
import { PushBulkButtons as
|
|
8
|
+
import { newBulkProgressId as ee, startBulkProgress as te, endBulkProgress as re } from "../../lib/bulk-progress.js";
|
|
9
|
+
import { get as ne, post as R } from "../../lib/commands.js";
|
|
10
|
+
import { errorToastOptions as oe } from "../../lib/error-toast.js";
|
|
11
|
+
import { userErrorMessage as se } from "../../lib/safe-error.js";
|
|
12
|
+
import { formatNumber as U, cn as j } from "../../lib/utils.js";
|
|
13
|
+
import { invalidateRecordQueries as ie } from "../item-edit/RecordLiveSync.js";
|
|
14
|
+
import { Popover as le, PopoverTrigger as ae, PopoverContent as ce } from "../ui/popover.js";
|
|
15
|
+
import { PushBulkButtons as de } from "./PushBulkButtons.js";
|
|
16
16
|
function x(t) {
|
|
17
17
|
return t === !0 || t === 1 || t === "1" || t === "true" ? "true" : t === !1 || t === 0 || t === "0" || t === "false" ? "false" : String(t ?? "");
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
19
|
+
const z = (t) => t == null || t === "";
|
|
20
|
+
function Oe(t, i) {
|
|
21
21
|
for (const n of t ?? []) {
|
|
22
22
|
if (!n || typeof n.field != "string") continue;
|
|
23
23
|
if (!(n.field in i)) return null;
|
|
@@ -29,9 +29,9 @@ function Be(t, i) {
|
|
|
29
29
|
case "neq":
|
|
30
30
|
return x(s) !== x(o);
|
|
31
31
|
case "null":
|
|
32
|
-
return
|
|
32
|
+
return z(s);
|
|
33
33
|
case "nnull":
|
|
34
|
-
return !
|
|
34
|
+
return !z(s);
|
|
35
35
|
case "in":
|
|
36
36
|
return c().includes(x(s));
|
|
37
37
|
case "nin":
|
|
@@ -43,9 +43,9 @@ function Be(t, i) {
|
|
|
43
43
|
}
|
|
44
44
|
return !0;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const i =
|
|
48
|
-
return
|
|
46
|
+
function K(t) {
|
|
47
|
+
const i = G(), n = [...new Set(t)].sort().join(",");
|
|
48
|
+
return D({
|
|
49
49
|
queryKey: ["bulk-actions-available", n],
|
|
50
50
|
queryFn: async () => {
|
|
51
51
|
const s = {};
|
|
@@ -53,7 +53,7 @@ function G(t) {
|
|
|
53
53
|
n.split(",").map(async (o) => {
|
|
54
54
|
try {
|
|
55
55
|
const c = await i.request(
|
|
56
|
-
|
|
56
|
+
ne("/bulk-actions/available", { collection: o })
|
|
57
57
|
);
|
|
58
58
|
s[o] = c.data ?? [];
|
|
59
59
|
} catch {
|
|
@@ -66,63 +66,63 @@ function G(t) {
|
|
|
66
66
|
staleTime: 6e4
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function L(t, i, n) {
|
|
70
70
|
return t ? t.includes(n) || t.includes(`${i}:${n}`) : !0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const { data: n } =
|
|
72
|
+
function Re(t, i) {
|
|
73
|
+
const { data: n } = K(t), s = !!n && Object.values(n).some((o) => o.some((c) => c.source === "builtin"));
|
|
74
74
|
return (o) => s ? t.some(
|
|
75
|
-
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) &&
|
|
75
|
+
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) && L(i, c, o)
|
|
76
76
|
) : !0;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ue(t, i, n) {
|
|
79
79
|
const s = /* @__PURE__ */ new Map();
|
|
80
80
|
for (const o of i)
|
|
81
81
|
for (const c of (t == null ? void 0 : t[o]) ?? []) {
|
|
82
|
-
if (c.source === "builtin" || !
|
|
82
|
+
if (c.source === "builtin" || !L(n, o, c.key)) continue;
|
|
83
83
|
const g = `${c.source}:${c.key}`, k = s.get(g);
|
|
84
84
|
k ? k.collections.push(o) : s.set(g, { ...c, collections: [o] });
|
|
85
85
|
}
|
|
86
86
|
return [...s.values()];
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function me(t, i, n) {
|
|
89
89
|
const s = [`${i.succeeded} done`];
|
|
90
90
|
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}` : ""}`;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function je({
|
|
93
93
|
targets: t,
|
|
94
94
|
enabledKeys: i,
|
|
95
95
|
tone: n = "light",
|
|
96
96
|
disabled: s,
|
|
97
97
|
onDone: o
|
|
98
98
|
}) {
|
|
99
|
-
const c =
|
|
99
|
+
const c = G(), g = Z(), k = [...new Set(t.map((e) => e.collection))], { data: J } = K(k), C = ue(J, k, i), [V, $] = y(null), [N, _] = y(""), [P, S] = y(null), [A, q] = y({}), [T, E] = y(!1), W = async (e) => {
|
|
100
100
|
const u = `${e.source}:${e.key}`;
|
|
101
101
|
if (e.source === "db") {
|
|
102
102
|
q((l) => ({ ...l, [u]: "loading" }));
|
|
103
103
|
try {
|
|
104
104
|
const l = { would_change: 0, skipped: 0, failed: 0, outcomes: [] };
|
|
105
|
-
for (const
|
|
106
|
-
const d = t.filter((r) => r.collection ===
|
|
105
|
+
for (const b of e.collections) {
|
|
106
|
+
const d = t.filter((r) => r.collection === b).map((r) => r.id);
|
|
107
107
|
if (d.length === 0) continue;
|
|
108
|
-
const
|
|
109
|
-
R("/bulk-actions/preview", { collection:
|
|
108
|
+
const h = await c.request(
|
|
109
|
+
R("/bulk-actions/preview", { collection: b, key: e.key, ids: d })
|
|
110
110
|
);
|
|
111
|
-
l.would_change +=
|
|
111
|
+
l.would_change += h.data.would_change, l.skipped += h.data.skipped, l.failed += h.data.failed, l.outcomes.push(...h.data.outcomes);
|
|
112
112
|
}
|
|
113
|
-
q((
|
|
113
|
+
q((b) => ({ ...b, [u]: l }));
|
|
114
114
|
} catch {
|
|
115
115
|
q((l) => ({ ...l, [u]: null }));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}, M = /* @__PURE__ */ f(
|
|
119
|
-
|
|
119
|
+
de,
|
|
120
120
|
{
|
|
121
121
|
targets: t,
|
|
122
122
|
enabledKeys: i,
|
|
123
123
|
tone: n,
|
|
124
124
|
disabled: s || !!P,
|
|
125
|
-
onDone: (e) => o == null ? void 0 : o({ ...e, action:
|
|
125
|
+
onDone: (e) => o == null ? void 0 : o({ ...e, action: pe })
|
|
126
126
|
}
|
|
127
127
|
);
|
|
128
128
|
if (C.length === 0) return M;
|
|
@@ -130,39 +130,39 @@ function Re({
|
|
|
130
130
|
const u = `${e.source}:${e.key}`;
|
|
131
131
|
S(u);
|
|
132
132
|
const l = { succeeded: 0, failed: 0, skipped: 0, errors: [] };
|
|
133
|
-
let
|
|
133
|
+
let b = 0;
|
|
134
134
|
try {
|
|
135
135
|
for (const r of e.collections) {
|
|
136
136
|
const m = t.filter((B) => B.collection === r).map((B) => B.id);
|
|
137
137
|
if (m.length === 0) continue;
|
|
138
|
-
|
|
139
|
-
const w = { collection: r, ids: m, reason: N.trim() || null }, a = e.source === "db" ?
|
|
140
|
-
a &&
|
|
138
|
+
b += m.length;
|
|
139
|
+
const w = { collection: r, ids: m, reason: N.trim() || null }, a = e.source === "db" ? ee() : null;
|
|
140
|
+
a && te(a, m);
|
|
141
141
|
const v = (e.source === "db" ? await c.request(
|
|
142
142
|
R(`/bulk-actions/run?progress=${a}`, { ...w, key: e.key })
|
|
143
|
-
).finally(() =>
|
|
143
|
+
).finally(() => re(a)) : await c.request(
|
|
144
144
|
R(`/bulk-actions/${e.key}/execute`, w)
|
|
145
145
|
)).data ?? {};
|
|
146
146
|
l.succeeded += v.succeeded ?? (e.source === "extension" ? m.length : 0), l.failed += v.failed ?? 0, l.skipped += v.skipped ?? 0, l.errors.push(...v.errors ?? []);
|
|
147
147
|
}
|
|
148
148
|
for (const r of e.collections)
|
|
149
|
-
|
|
149
|
+
ie(
|
|
150
150
|
g,
|
|
151
151
|
r,
|
|
152
152
|
t.filter((m) => m.collection === r).map((m) => m.id)
|
|
153
153
|
);
|
|
154
|
-
const d =
|
|
154
|
+
const d = me(e.label, l, b), h = l.errors.slice(0, 3).map((r) => `${H(r, t)}: ${r.error}`).join(`
|
|
155
155
|
`);
|
|
156
|
-
l.failed > 0 ? O.warning(d, { description:
|
|
156
|
+
l.failed > 0 ? O.warning(d, { description: h || void 0, duration: 8e3 }) : O.success(d, { duration: 4e3 }), o == null || o({ ...l, action: e }), $(null), _("");
|
|
157
157
|
} catch (d) {
|
|
158
158
|
O.error(
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
se(d, `${e.label} failed`),
|
|
160
|
+
oe(d, { action: e.label })
|
|
161
161
|
);
|
|
162
162
|
} finally {
|
|
163
163
|
S(null);
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, X = (e, u) => n === "dark" ? j(
|
|
166
166
|
"h-8 rounded-md px-3 text-[12.5px] font-medium transition-colors disabled:opacity-50",
|
|
167
167
|
e.variant === "danger" ? "border border-red-400/50 text-red-200 hover:bg-red-500/20 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10" : "border border-white/20 hover:bg-white/10 dark:border-border dark:hover:bg-muted",
|
|
168
168
|
u && (e.variant === "danger" ? "bg-red-500/20" : "bg-white/10")
|
|
@@ -171,30 +171,30 @@ function Re({
|
|
|
171
171
|
e.variant === "danger" ? "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
172
172
|
u && (e.variant === "danger" ? "bg-red-50 dark:bg-red-500/10" : "bg-slate-100 dark:bg-muted")
|
|
173
173
|
);
|
|
174
|
-
return /* @__PURE__ */ p(
|
|
174
|
+
return /* @__PURE__ */ p(Y, { children: [
|
|
175
175
|
C.map((e) => {
|
|
176
|
-
const u = `${e.source}:${e.key}`, l =
|
|
176
|
+
const u = `${e.source}:${e.key}`, l = V === u, b = P === u, d = t.filter((r) => e.collections.includes(r.collection)).length, h = d > 0 && (!e.require_reason || N.trim().length > 0) && !b;
|
|
177
177
|
return /* @__PURE__ */ p(
|
|
178
|
-
|
|
178
|
+
le,
|
|
179
179
|
{
|
|
180
180
|
open: l,
|
|
181
181
|
onOpenChange: (r) => {
|
|
182
|
-
$(r ? u : null), r ? (E(!1),
|
|
182
|
+
$(r ? u : null), r ? (E(!1), W(e)) : _("");
|
|
183
183
|
},
|
|
184
184
|
children: [
|
|
185
|
-
/* @__PURE__ */ f(
|
|
185
|
+
/* @__PURE__ */ f(ae, { asChild: !0, children: /* @__PURE__ */ f(
|
|
186
186
|
"button",
|
|
187
187
|
{
|
|
188
188
|
type: "button",
|
|
189
189
|
disabled: s || !!P,
|
|
190
190
|
"data-bulk-action": e.key,
|
|
191
191
|
title: e.summary,
|
|
192
|
-
className:
|
|
193
|
-
children:
|
|
192
|
+
className: X(e, l),
|
|
193
|
+
children: b ? /* @__PURE__ */ f(Q, { className: "inline h-3.5 w-3.5 animate-spin" }) : e.label
|
|
194
194
|
}
|
|
195
195
|
) }),
|
|
196
196
|
/* @__PURE__ */ p(
|
|
197
|
-
|
|
197
|
+
ce,
|
|
198
198
|
{
|
|
199
199
|
align: "center",
|
|
200
200
|
side: "top",
|
|
@@ -273,7 +273,7 @@ function Re({
|
|
|
273
273
|
value: N,
|
|
274
274
|
onChange: (r) => _(r.target.value),
|
|
275
275
|
onKeyDown: (r) => {
|
|
276
|
-
r.key === "Enter" && (r.metaKey || r.ctrlKey) &&
|
|
276
|
+
r.key === "Enter" && (r.metaKey || r.ctrlKey) && h && F(e);
|
|
277
277
|
},
|
|
278
278
|
rows: 2,
|
|
279
279
|
placeholder: "Recorded on every record’s history",
|
|
@@ -296,15 +296,15 @@ function Re({
|
|
|
296
296
|
{
|
|
297
297
|
type: "button",
|
|
298
298
|
onClick: () => void F(e),
|
|
299
|
-
disabled: !
|
|
299
|
+
disabled: !h,
|
|
300
300
|
"data-bulk-action-run": !0,
|
|
301
301
|
className: j(
|
|
302
302
|
"h-8 rounded-md px-3 text-[12.5px] font-semibold disabled:opacity-40",
|
|
303
303
|
e.variant === "danger" ? "bg-red-600 text-white hover:bg-red-700" : "bg-nvr-cyan text-[#172940] hover:bg-nvr-cyan-dark"
|
|
304
304
|
),
|
|
305
|
-
children:
|
|
305
|
+
children: b ? /* @__PURE__ */ f(Q, { className: "h-3.5 w-3.5 animate-spin" }) : (() => {
|
|
306
306
|
const r = A[u];
|
|
307
|
-
return r && r !== "loading" && r.would_change !== d ? `${e.label} · ${r.would_change} of ${d}` : `${e.label} ${d}`;
|
|
307
|
+
return r && r !== "loading" && r.would_change !== d ? `${e.label} · ${U(r.would_change)} of ${U(d)}` : `${e.label} ${d}`;
|
|
308
308
|
})()
|
|
309
309
|
}
|
|
310
310
|
)
|
|
@@ -320,7 +320,7 @@ function Re({
|
|
|
320
320
|
M
|
|
321
321
|
] });
|
|
322
322
|
}
|
|
323
|
-
const
|
|
323
|
+
const pe = {
|
|
324
324
|
key: "push",
|
|
325
325
|
source: "builtin",
|
|
326
326
|
collection: null,
|
|
@@ -333,10 +333,10 @@ const me = {
|
|
|
333
333
|
summary: "Integration push"
|
|
334
334
|
};
|
|
335
335
|
export {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
je as BulkActionButtons,
|
|
337
|
+
L as bulkActionEnabled,
|
|
338
|
+
Oe as guardMatches,
|
|
339
|
+
ue as mergeBulkActions,
|
|
340
|
+
K as useAvailableBulkActions,
|
|
341
|
+
Re as useBuiltinGate
|
|
342
342
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as a, jsx as t, Fragment as
|
|
1
|
+
import { jsxs as a, jsx as t, Fragment as te } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as A } from "@tanstack/react-query";
|
|
3
|
-
import { ArrowLeft as
|
|
4
|
-
import { useState as g, useRef as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { post as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { FieldRenderer as
|
|
10
|
-
import { Command as
|
|
11
|
-
import { Popover as
|
|
3
|
+
import { ArrowLeft as re, Lock as ae } from "lucide-react";
|
|
4
|
+
import { useState as g, useRef as X, useEffect as Z, useMemo as j } from "react";
|
|
5
|
+
import { useNivaroClient as le } from "../../context.js";
|
|
6
|
+
import { useDebounced as ne } from "../../hooks/useDebounced.js";
|
|
7
|
+
import { post as z, get as H } from "../../lib/commands.js";
|
|
8
|
+
import { formatNumber as R, cn as W } from "../../lib/utils.js";
|
|
9
|
+
import { FieldRenderer as oe } from "../item-edit/FieldRenderer.js";
|
|
10
|
+
import { Command as de, CommandInput as se, CommandList as ie, CommandEmpty as ue, CommandGroup as ce, CommandItem as me } from "../ui/command.js";
|
|
11
|
+
import { Popover as pe, PopoverTrigger as fe, PopoverContent as be } from "../ui/popover.js";
|
|
12
12
|
import { Skeleton as x } from "../ui/skeleton.js";
|
|
13
|
-
import { BulkLinksValue as
|
|
14
|
-
import { bulkFieldSections as
|
|
15
|
-
import { bulkLinksValue as
|
|
16
|
-
function
|
|
13
|
+
import { BulkLinksValue as he } from "./BulkLinksValue.js";
|
|
14
|
+
import { bulkFieldSections as xe, bulkFieldNote as _ } from "./bulk-field-options.js";
|
|
15
|
+
import { bulkLinksValue as ge, bulkPreviewSentence as ye } from "./bulk-update-preview.js";
|
|
16
|
+
function Ve({
|
|
17
17
|
collection: d,
|
|
18
18
|
selectedIds: b,
|
|
19
19
|
disabled: i,
|
|
@@ -22,18 +22,18 @@ function Ee({
|
|
|
22
22
|
onSaveRecipe: w,
|
|
23
23
|
pointAt: u
|
|
24
24
|
}) {
|
|
25
|
-
const [C, l] = g(!1), [y, L] = g(null), v =
|
|
26
|
-
return
|
|
25
|
+
const [C, l] = g(!1), [y, L] = g(null), v = X(null);
|
|
26
|
+
return Z(() => {
|
|
27
27
|
!u || i || u.nonce === v.current || (v.current = u.nonce, L(u.field), l(!0));
|
|
28
28
|
}, [u, i]), /* @__PURE__ */ a(
|
|
29
|
-
|
|
29
|
+
pe,
|
|
30
30
|
{
|
|
31
31
|
open: C,
|
|
32
32
|
onOpenChange: (o) => {
|
|
33
33
|
(!i || !o) && l(o), o || L(null);
|
|
34
34
|
},
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */ t(
|
|
36
|
+
/* @__PURE__ */ t(fe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
37
37
|
"button",
|
|
38
38
|
{
|
|
39
39
|
type: "button",
|
|
@@ -45,7 +45,7 @@ function Ee({
|
|
|
45
45
|
}
|
|
46
46
|
) }),
|
|
47
47
|
/* @__PURE__ */ t(
|
|
48
|
-
|
|
48
|
+
be,
|
|
49
49
|
{
|
|
50
50
|
side: "top",
|
|
51
51
|
align: "end",
|
|
@@ -53,7 +53,7 @@ function Ee({
|
|
|
53
53
|
className: "w-[380px] max-w-[calc(100vw-24px)] p-0",
|
|
54
54
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
55
55
|
children: C && /* @__PURE__ */ t(
|
|
56
|
-
|
|
56
|
+
ve,
|
|
57
57
|
{
|
|
58
58
|
collection: d,
|
|
59
59
|
selectedIds: b,
|
|
@@ -74,7 +74,7 @@ function Ee({
|
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ve({
|
|
78
78
|
collection: d,
|
|
79
79
|
selectedIds: b,
|
|
80
80
|
initialField: i,
|
|
@@ -82,51 +82,51 @@ function ye({
|
|
|
82
82
|
onApply: T,
|
|
83
83
|
onSaveRecipe: w
|
|
84
84
|
}) {
|
|
85
|
-
var
|
|
86
|
-
const u =
|
|
85
|
+
var D, G, Q, Y;
|
|
86
|
+
const u = le(), C = j(() => b.map(String).join(","), [b]), l = A({
|
|
87
87
|
queryKey: ["bulk-fields", d, C],
|
|
88
88
|
queryFn: () => u.request(
|
|
89
|
-
|
|
89
|
+
z(`/items/${d}/bulk-fields`, { ids: b })
|
|
90
90
|
).then((r) => r.data),
|
|
91
91
|
staleTime: 15e3,
|
|
92
92
|
retry: !1
|
|
93
93
|
}), y = A({
|
|
94
94
|
queryKey: ["bulk-fields-config", d],
|
|
95
|
-
queryFn: () => u.request(
|
|
95
|
+
queryFn: () => u.request(H(`/field-config/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
|
|
96
96
|
staleTime: 6e4
|
|
97
97
|
}), L = A({
|
|
98
98
|
queryKey: ["bulk-fields-relations", d],
|
|
99
|
-
queryFn: () => u.request(
|
|
99
|
+
queryFn: () => u.request(H(`/data-model/relations/for/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
|
|
100
100
|
staleTime: 6e4
|
|
101
101
|
}), v = j(() => {
|
|
102
102
|
const r = {};
|
|
103
103
|
for (const n of y.data ?? []) r[n.field] = n.label;
|
|
104
104
|
return r;
|
|
105
105
|
}, [y.data]), o = j(
|
|
106
|
-
() => l.data ?
|
|
106
|
+
() => l.data ? xe(l.data, v) : [],
|
|
107
107
|
[l.data, v]
|
|
108
|
-
), [e, M] = g(null), [c, $] = g(null), [m, E] = g("append"), [F, V] = g([]), [S,
|
|
109
|
-
|
|
110
|
-
if (!i ||
|
|
111
|
-
|
|
108
|
+
), [e, M] = g(null), [c, $] = g(null), [m, E] = g("append"), [F, V] = g([]), [S, ee] = g(null), B = X(!1);
|
|
109
|
+
Z(() => {
|
|
110
|
+
if (!i || B.current || !l.data) return;
|
|
111
|
+
B.current = !0;
|
|
112
112
|
const r = o.flatMap((n) => n.options).find((n) => n.field === i);
|
|
113
|
-
r && r.writable > 0 ? (M(r), $(null)) :
|
|
113
|
+
r && r.writable > 0 ? (M(r), $(null)) : ee(r ? _(r, l.data.readable) ?? null : "");
|
|
114
114
|
}, [i, l.data, o]);
|
|
115
|
-
const p = !!(e != null && e.m2m), K = p ?
|
|
115
|
+
const p = !!(e != null && e.m2m), K = p ? ge(m, F) : c, U = ne(JSON.stringify(K ?? null), 300), I = !!e && (!p || m === "replace" || F.length > 0), k = A({
|
|
116
116
|
queryKey: ["bulk-update-preview", d, C, (e == null ? void 0 : e.field) ?? "", U],
|
|
117
117
|
queryFn: () => u.request(
|
|
118
|
-
|
|
118
|
+
z(`/items/${d}/bulk-update?dry_run=1`, {
|
|
119
119
|
ids: b,
|
|
120
120
|
data: { [e == null ? void 0 : e.field]: JSON.parse(U) },
|
|
121
121
|
by_form: !0
|
|
122
122
|
})
|
|
123
123
|
).then((r) => r.data),
|
|
124
|
-
enabled:
|
|
124
|
+
enabled: I && U === JSON.stringify(K ?? null),
|
|
125
125
|
staleTime: 1e4,
|
|
126
126
|
retry: !1
|
|
127
|
-
}), h = ((
|
|
127
|
+
}), h = ((D = l.data) == null ? void 0 : D.readable) ?? b.length, q = ((G = l.data) == null ? void 0 : G.forms) ?? [], J = l.data ? q.length === 0 ? "These records have no form, so every field you may change is listed." : q.length === 1 ? `Fields on their form, ${q[0].name}.` : `Fields on their ${q.length} forms, ${q[0].name} first.` : null;
|
|
128
128
|
if (e) {
|
|
129
|
-
const r = (y.data ?? []).find((N) => N.field === e.field), n =
|
|
129
|
+
const r = (y.data ?? []).find((N) => N.field === e.field), n = _(e, h), s = p ? F.length === 0 : c == null || typeof c == "string" && c.trim() === "" || Array.isArray(c) && c.length === 0, f = p ? s && (m !== "replace" || e.required) : e.required && s, O = k.data ? ye(k.data, { mode: p ? m : null }) : null;
|
|
130
130
|
return /* @__PURE__ */ a("div", { className: "flex flex-col", "data-bulk-field-value": !0, children: [
|
|
131
131
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
132
132
|
/* @__PURE__ */ t(
|
|
@@ -139,7 +139,7 @@ function ye({
|
|
|
139
139
|
"aria-label": "Choose another field",
|
|
140
140
|
"data-tip": "Choose another field",
|
|
141
141
|
className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
142
|
-
children: /* @__PURE__ */ t(
|
|
142
|
+
children: /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5" })
|
|
143
143
|
}
|
|
144
144
|
),
|
|
145
145
|
/* @__PURE__ */ a("div", { className: "min-w-0", children: [
|
|
@@ -149,9 +149,9 @@ function ye({
|
|
|
149
149
|
] }),
|
|
150
150
|
/* @__PURE__ */ a("p", { className: "text-[11.5px] text-muted-foreground", children: [
|
|
151
151
|
"On ",
|
|
152
|
-
e.writable,
|
|
152
|
+
R(e.writable),
|
|
153
153
|
" of ",
|
|
154
|
-
h,
|
|
154
|
+
R(h),
|
|
155
155
|
" record",
|
|
156
156
|
h === 1 ? "" : "s"
|
|
157
157
|
] })
|
|
@@ -159,7 +159,7 @@ function ye({
|
|
|
159
159
|
] }),
|
|
160
160
|
/* @__PURE__ */ a("div", { className: "space-y-2 px-3 py-3", children: [
|
|
161
161
|
e.m2m ? /* @__PURE__ */ t(
|
|
162
|
-
|
|
162
|
+
he,
|
|
163
163
|
{
|
|
164
164
|
related: e.m2m.related,
|
|
165
165
|
fieldLabel: e.label,
|
|
@@ -170,7 +170,7 @@ function ye({
|
|
|
170
170
|
onIds: V
|
|
171
171
|
}
|
|
172
172
|
) : r ? /* @__PURE__ */ t(
|
|
173
|
-
|
|
173
|
+
oe,
|
|
174
174
|
{
|
|
175
175
|
field: { ...r, readonly: !1 },
|
|
176
176
|
value: c,
|
|
@@ -211,13 +211,13 @@ function ye({
|
|
|
211
211
|
]
|
|
212
212
|
}
|
|
213
213
|
),
|
|
214
|
-
!f &&
|
|
214
|
+
!f && I && /* @__PURE__ */ t(
|
|
215
215
|
"div",
|
|
216
216
|
{
|
|
217
217
|
"aria-live": "polite",
|
|
218
218
|
"data-bulk-update-preview": !0,
|
|
219
219
|
className: "rounded-md bg-muted/60 px-2 py-1.5 text-[11.5px] leading-4",
|
|
220
|
-
children: k.isError ? /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Could not count the changes — Apply still checks every record." }) : O ? /* @__PURE__ */ a(
|
|
220
|
+
children: k.isError ? /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Could not count the changes — Apply still checks every record." }) : O ? /* @__PURE__ */ a(te, { children: [
|
|
221
221
|
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", "data-bulk-update-preview-headline": !0, children: O.headline }),
|
|
222
222
|
O.notes.length > 0 && /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: [
|
|
223
223
|
" · ",
|
|
@@ -263,7 +263,7 @@ function ye({
|
|
|
263
263
|
"button",
|
|
264
264
|
{
|
|
265
265
|
type: "button",
|
|
266
|
-
disabled: e.writable === 0 || f || ((
|
|
266
|
+
disabled: e.writable === 0 || f || ((Q = k.data) == null ? void 0 : Q.would_update) === 0,
|
|
267
267
|
"aria-describedby": f ? "bulk-field-hint" : void 0,
|
|
268
268
|
onClick: () => T(e.field, K),
|
|
269
269
|
"data-bulk-field-apply": !0,
|
|
@@ -281,7 +281,7 @@ function ye({
|
|
|
281
281
|
/* @__PURE__ */ a("div", { className: "border-b border-border px-3 py-2.5", children: [
|
|
282
282
|
/* @__PURE__ */ a("p", { className: "text-[13px] font-semibold text-foreground", children: [
|
|
283
283
|
"Update a field on ",
|
|
284
|
-
h,
|
|
284
|
+
R(h),
|
|
285
285
|
" record",
|
|
286
286
|
h === 1 ? "" : "s"
|
|
287
287
|
] }),
|
|
@@ -298,7 +298,7 @@ function ye({
|
|
|
298
298
|
]
|
|
299
299
|
}
|
|
300
300
|
),
|
|
301
|
-
|
|
301
|
+
J ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", children: J }) : /* @__PURE__ */ t(x, { className: "mt-1 h-3 w-48" })
|
|
302
302
|
] }),
|
|
303
303
|
l.isLoading ? /* @__PURE__ */ a("div", { className: "space-y-2 p-3", "aria-busy": "true", children: [
|
|
304
304
|
/* @__PURE__ */ t(x, { className: "h-3 w-20" }),
|
|
@@ -317,14 +317,14 @@ function ye({
|
|
|
317
317
|
children: "Try again"
|
|
318
318
|
}
|
|
319
319
|
)
|
|
320
|
-
] }) : o.length === 0 ? /* @__PURE__ */ t("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children: h === 0 ? "You cannot open any of the selected records." : "Their form has no field you can change in bulk. Open a record to edit it there." }) : /* @__PURE__ */ a(
|
|
321
|
-
/* @__PURE__ */ t(
|
|
322
|
-
/* @__PURE__ */ a(
|
|
323
|
-
/* @__PURE__ */ t(
|
|
324
|
-
o.map((r) => /* @__PURE__ */ t(
|
|
325
|
-
const s = n.writable === 0, f =
|
|
320
|
+
] }) : o.length === 0 ? /* @__PURE__ */ t("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children: h === 0 ? "You cannot open any of the selected records." : "Their form has no field you can change in bulk. Open a record to edit it there." }) : /* @__PURE__ */ a(de, { className: "rounded-none bg-transparent", children: [
|
|
321
|
+
/* @__PURE__ */ t(se, { placeholder: "Find a field…", className: "h-9 text-[13px]" }),
|
|
322
|
+
/* @__PURE__ */ a(ie, { className: "max-h-[320px]", children: [
|
|
323
|
+
/* @__PURE__ */ t(ue, { className: "py-5 text-center text-[12.5px] text-muted-foreground", children: "No field on the form matches." }),
|
|
324
|
+
o.map((r) => /* @__PURE__ */ t(ce, { heading: r.label, children: r.options.map((n) => {
|
|
325
|
+
const s = n.writable === 0, f = _(n, h);
|
|
326
326
|
return /* @__PURE__ */ a(
|
|
327
|
-
|
|
327
|
+
me,
|
|
328
328
|
{
|
|
329
329
|
value: `${r.label} ${n.label} ${n.field}`,
|
|
330
330
|
disabled: s,
|
|
@@ -338,7 +338,7 @@ function ye({
|
|
|
338
338
|
/* @__PURE__ */ t(
|
|
339
339
|
"span",
|
|
340
340
|
{
|
|
341
|
-
className:
|
|
341
|
+
className: W(
|
|
342
342
|
"block truncate",
|
|
343
343
|
s ? "text-muted-foreground" : "text-foreground"
|
|
344
344
|
),
|
|
@@ -348,7 +348,7 @@ function ye({
|
|
|
348
348
|
f && /* @__PURE__ */ t(
|
|
349
349
|
"span",
|
|
350
350
|
{
|
|
351
|
-
className:
|
|
351
|
+
className: W(
|
|
352
352
|
"block truncate text-[11px] leading-4",
|
|
353
353
|
s ? "text-muted-foreground" : "text-amber-700 dark:text-amber-300"
|
|
354
354
|
),
|
|
@@ -357,7 +357,7 @@ function ye({
|
|
|
357
357
|
)
|
|
358
358
|
] }),
|
|
359
359
|
s && /* @__PURE__ */ t(
|
|
360
|
-
|
|
360
|
+
ae,
|
|
361
361
|
{
|
|
362
362
|
className: "mt-0.5 h-3.5 w-3.5 text-muted-foreground",
|
|
363
363
|
"aria-label": "Locked"
|
|
@@ -370,9 +370,9 @@ function ye({
|
|
|
370
370
|
}) }, r.key))
|
|
371
371
|
] })
|
|
372
372
|
] }),
|
|
373
|
-
((
|
|
373
|
+
((Y = l.data) == null ? void 0 : Y.capped) && /* @__PURE__ */ t("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checked the first 1,000 selected records." })
|
|
374
374
|
] });
|
|
375
375
|
}
|
|
376
376
|
export {
|
|
377
|
-
|
|
377
|
+
Ve as BulkFieldUpdate
|
|
378
378
|
};
|