@nivaro/react 0.3.9 → 0.3.10
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 +69 -1
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1000 -1001
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +3687 -3580
- 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 +146 -145
- package/dist/shared/components/RecordGridEditor.js +76 -75
- 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/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/InlineTableField.js +301 -300
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- 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/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/QueueWorklist.js +597 -598
- 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/presence-live.js +54 -35
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/package.json +1 -1
|
@@ -5,34 +5,35 @@ import { useMemo as K, useState as x } from "react";
|
|
|
5
5
|
import { toast as q } from "sonner";
|
|
6
6
|
import { useNivaroClient as pe } from "../../context.js";
|
|
7
7
|
import { get as he, post as U } from "../../lib/commands.js";
|
|
8
|
+
import { userErrorMessage as fe } from "../../lib/safe-error.js";
|
|
8
9
|
import { cn as G } from "../../lib/utils.js";
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { useAvailableBulkActions as
|
|
11
|
-
function H(i,
|
|
12
|
-
return ((i == null ? void 0 : i[t]) ?? []).some((u) => u.source === "builtin" && u.key === d) &&
|
|
10
|
+
import { Popover as be, PopoverTrigger as ke, PopoverContent as xe } from "../ui/popover.js";
|
|
11
|
+
import { useAvailableBulkActions as ge, bulkActionEnabled as ye } from "./BulkActionButtons.js";
|
|
12
|
+
function H(i, r, t, d) {
|
|
13
|
+
return ((i == null ? void 0 : i[t]) ?? []).some((u) => u.source === "builtin" && u.key === d) && ye(r, t, d);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
15
|
+
function ve(i) {
|
|
16
|
+
const r = { succeeded: 0, failed: 0, skipped: 0, errors: [], outcomes: [] };
|
|
16
17
|
for (const { collection: t, data: d } of i) {
|
|
17
|
-
|
|
18
|
+
r.succeeded += d.succeeded ?? 0, r.failed += d.failed ?? 0, r.skipped += d.skipped ?? 0, r.errors.push(...d.errors ?? []);
|
|
18
19
|
for (const u of d.outcomes ?? [])
|
|
19
|
-
|
|
20
|
+
r.outcomes.push({ ...u, item: `${t}:${u.item}` });
|
|
20
21
|
}
|
|
21
|
-
return
|
|
22
|
+
return r;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
const t = [`${
|
|
25
|
-
return
|
|
24
|
+
function we(i, r) {
|
|
25
|
+
const t = [`${r.succeeded} done`];
|
|
26
|
+
return r.skipped && t.push(`${r.skipped} skipped`), r.failed && t.push(`${r.failed} failed`), `${i}: ${t.join(" · ")}`;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function Qe({
|
|
28
29
|
targets: i,
|
|
29
|
-
enabledKeys:
|
|
30
|
+
enabledKeys: r,
|
|
30
31
|
tone: t = "light",
|
|
31
32
|
disabled: d,
|
|
32
33
|
onDone: u
|
|
33
34
|
}) {
|
|
34
|
-
const v = pe(), J = oe(), w = K(() => [...new Set(i.map((e) => e.collection))], [i]), { data: j } =
|
|
35
|
-
(e) => H(j,
|
|
35
|
+
const v = pe(), J = oe(), w = K(() => [...new Set(i.map((e) => e.collection))], [i]), { data: j } = ge(w), N = w.filter((e) => H(j, r, e, "push")), O = w.filter(
|
|
36
|
+
(e) => H(j, r, e, "retry-push")
|
|
36
37
|
), P = le({
|
|
37
38
|
queries: N.map((e) => ({
|
|
38
39
|
queryKey: ["bulk-push-actions", e],
|
|
@@ -41,19 +42,19 @@ function Ee({
|
|
|
41
42
|
}))
|
|
42
43
|
}), V = P.map((e) => e.dataUpdatedAt).join(","), W = K(() => {
|
|
43
44
|
const e = /* @__PURE__ */ new Map();
|
|
44
|
-
return N.forEach((s,
|
|
45
|
+
return N.forEach((s, a) => {
|
|
45
46
|
var o;
|
|
46
|
-
for (const n of ((o = P[
|
|
47
|
+
for (const n of ((o = P[a]) == null ? void 0 : o.data) ?? []) {
|
|
47
48
|
const m = e.get(n.id);
|
|
48
49
|
m ? m.collections.push(s) : e.set(n.id, { ...n, collections: [s] });
|
|
49
50
|
}
|
|
50
51
|
}), [...e.values()];
|
|
51
|
-
}, [V, N.join(",")]), [X, S] = x(null), [g, A] = x(""), [
|
|
52
|
-
const [s, ...
|
|
52
|
+
}, [V, N.join(",")]), [X, S] = x(null), [g, A] = x(""), [M, _] = x(null), [Y, $] = x({}), [Z, E] = x({}), D = (e) => {
|
|
53
|
+
const [s, ...a] = e.split(":"), o = a.join(":"), n = i.find((m) => m.collection === s && String(m.id) === o);
|
|
53
54
|
return n != null && n.label ? String(n.label) : `#${o}`;
|
|
54
55
|
}, Q = async (e, s) => {
|
|
55
|
-
const
|
|
56
|
-
for (const n of
|
|
56
|
+
const a = e.kind === "push" ? e.action.collections : e.collections, o = [];
|
|
57
|
+
for (const n of a) {
|
|
57
58
|
const m = i.filter((p) => p.collection === n).map((p) => p.id);
|
|
58
59
|
if (m.length === 0) continue;
|
|
59
60
|
const k = e.kind === "push" ? await v.request(
|
|
@@ -69,24 +70,24 @@ function Ee({
|
|
|
69
70
|
);
|
|
70
71
|
o.push({ collection: n, data: k.data });
|
|
71
72
|
}
|
|
72
|
-
return
|
|
73
|
+
return ve(o);
|
|
73
74
|
}, C = (e) => e.kind === "push" ? `push:${e.action.id}` : "retry-push", R = (e) => e.kind === "push" ? e.action.label : "Retry failed pushes", ee = async (e) => {
|
|
74
75
|
const s = C(e);
|
|
75
|
-
$((
|
|
76
|
+
$((a) => ({ ...a, [s]: "loading" }));
|
|
76
77
|
try {
|
|
77
|
-
const
|
|
78
|
-
$((o) => ({ ...o, [s]:
|
|
78
|
+
const a = await Q(e, !0);
|
|
79
|
+
$((o) => ({ ...o, [s]: a }));
|
|
79
80
|
} catch {
|
|
80
|
-
$((
|
|
81
|
+
$((a) => ({ ...a, [s]: null }));
|
|
81
82
|
}
|
|
82
83
|
}, te = async (e) => {
|
|
83
84
|
const s = C(e);
|
|
84
|
-
|
|
85
|
+
_(s);
|
|
85
86
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const o =
|
|
89
|
-
|
|
87
|
+
const a = await Q(e, !1);
|
|
88
|
+
E((n) => ({ ...n, [s]: a }));
|
|
89
|
+
const o = we(R(e), a);
|
|
90
|
+
a.failed > 0 ? q.warning(o, { duration: 8e3 }) : q.success(o, { duration: 4e3 });
|
|
90
91
|
for (const n of [
|
|
91
92
|
"erp-submissions",
|
|
92
93
|
"row-push-state",
|
|
@@ -96,11 +97,11 @@ function Ee({
|
|
|
96
97
|
"item-actions"
|
|
97
98
|
])
|
|
98
99
|
J.invalidateQueries({ queryKey: [n] });
|
|
99
|
-
} catch (
|
|
100
|
-
const o =
|
|
101
|
-
q.error((o == null ? void 0 : o.error) ?? (
|
|
100
|
+
} catch (a) {
|
|
101
|
+
const o = a.response;
|
|
102
|
+
q.error((o == null ? void 0 : o.error) ?? fe(a, `${R(e)} failed`));
|
|
102
103
|
} finally {
|
|
103
|
-
|
|
104
|
+
_(null);
|
|
104
105
|
}
|
|
105
106
|
}, B = [
|
|
106
107
|
...W.map((e) => ({ kind: "push", action: e })),
|
|
@@ -116,32 +117,32 @@ function Ee({
|
|
|
116
117
|
);
|
|
117
118
|
return /* @__PURE__ */ l(ie, { children: B.map((e) => {
|
|
118
119
|
var F, L, z, T;
|
|
119
|
-
const s = C(e),
|
|
120
|
+
const s = C(e), a = R(e), o = e.kind === "push" ? e.action.collections : e.collections, n = i.filter((b) => o.includes(b.collection)).length, m = X === s, k = M === s, p = e.kind === "push" ? (F = e.action.confirm) == null ? void 0 : F.input : void 0, h = Y[s], f = Z[s] ?? null, y = h && h !== "loading" ? h.succeeded : null, ne = n > 0 && !k && y !== 0 && (!(p != null && p.required) || g.trim().length > 0), re = e.kind === "push" ? ((L = e.action.confirm) == null ? void 0 : L.body) ?? `Runs "${e.action.label}" on each selected record, one at a time. Every record is a real request to the partner.` : "Re-sends the latest failed push of each selected record, partner by partner — the same stored request the record’s own Retry button sends.";
|
|
120
121
|
return /* @__PURE__ */ c(
|
|
121
|
-
|
|
122
|
+
be,
|
|
122
123
|
{
|
|
123
124
|
open: m,
|
|
124
125
|
onOpenChange: (b) => {
|
|
125
|
-
S(b ? s : null), b ? (A(""),
|
|
126
|
+
S(b ? s : null), b ? (A(""), E((ae) => ({ ...ae, [s]: null })), ee(e)) : f && (u == null || u(f));
|
|
126
127
|
},
|
|
127
128
|
children: [
|
|
128
|
-
/* @__PURE__ */ l(
|
|
129
|
+
/* @__PURE__ */ l(ke, { asChild: !0, children: /* @__PURE__ */ c(
|
|
129
130
|
"button",
|
|
130
131
|
{
|
|
131
132
|
type: "button",
|
|
132
|
-
disabled: d || !!
|
|
133
|
+
disabled: d || !!M,
|
|
133
134
|
"data-bulk-push-action": e.kind === "push" ? e.action.id : void 0,
|
|
134
135
|
"data-bulk-retry-push": e.kind === "retry" ? "" : void 0,
|
|
135
136
|
title: e.kind === "push" ? `Run ${e.action.label} on the selected records` : "Re-send each selected record’s latest failed push",
|
|
136
137
|
className: se(m),
|
|
137
138
|
children: [
|
|
138
139
|
k ? /* @__PURE__ */ l(I, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ l(ce, { className: "h-3.5 w-3.5" }),
|
|
139
|
-
|
|
140
|
+
a
|
|
140
141
|
]
|
|
141
142
|
}
|
|
142
143
|
) }),
|
|
143
144
|
/* @__PURE__ */ c(
|
|
144
|
-
|
|
145
|
+
xe,
|
|
145
146
|
{
|
|
146
147
|
align: "center",
|
|
147
148
|
side: "top",
|
|
@@ -150,7 +151,7 @@ function Ee({
|
|
|
150
151
|
"data-bulk-push-popover": s,
|
|
151
152
|
children: [
|
|
152
153
|
/* @__PURE__ */ c("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
|
|
153
|
-
|
|
154
|
+
a,
|
|
154
155
|
/* @__PURE__ */ c("span", { className: "ml-1.5 font-normal text-slate-500 dark:text-slate-400", children: [
|
|
155
156
|
"· ",
|
|
156
157
|
n,
|
|
@@ -172,7 +173,7 @@ function Ee({
|
|
|
172
173
|
e.kind === "push" ? "run" : "be retried",
|
|
173
174
|
h.skipped + h.failed > 0 && /* @__PURE__ */ c("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
|
|
174
175
|
" · ",
|
|
175
|
-
|
|
176
|
+
Ne(h)
|
|
176
177
|
] })
|
|
177
178
|
]
|
|
178
179
|
}
|
|
@@ -193,7 +194,7 @@ function Ee({
|
|
|
193
194
|
}
|
|
194
195
|
)
|
|
195
196
|
] }),
|
|
196
|
-
f && /* @__PURE__ */ l(
|
|
197
|
+
f && /* @__PURE__ */ l($e, { result: f, labelFor: D }),
|
|
197
198
|
/* @__PURE__ */ c("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
|
|
198
199
|
/* @__PURE__ */ l(
|
|
199
200
|
"button",
|
|
@@ -214,7 +215,7 @@ function Ee({
|
|
|
214
215
|
disabled: !ne,
|
|
215
216
|
"data-bulk-push-run": !0,
|
|
216
217
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#172940] hover:bg-nvr-cyan-dark disabled:opacity-40",
|
|
217
|
-
children: k ? /* @__PURE__ */ l(I, { className: "h-3.5 w-3.5 animate-spin" }) : y != null && y !== n ? `${e.kind === "push" ? ((z = e.action.confirm) == null ? void 0 : z.confirm_label) ??
|
|
218
|
+
children: k ? /* @__PURE__ */ l(I, { className: "h-3.5 w-3.5 animate-spin" }) : y != null && y !== n ? `${e.kind === "push" ? ((z = e.action.confirm) == null ? void 0 : z.confirm_label) ?? a : "Retry"} · ${y} of ${n}` : `${e.kind === "push" ? ((T = e.action.confirm) == null ? void 0 : T.confirm_label) ?? a : "Retry"} ${n}`
|
|
218
219
|
}
|
|
219
220
|
)
|
|
220
221
|
] })
|
|
@@ -227,18 +228,18 @@ function Ee({
|
|
|
227
228
|
);
|
|
228
229
|
}) });
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
-
const
|
|
231
|
+
function Ne(i) {
|
|
232
|
+
const r = /* @__PURE__ */ new Map();
|
|
232
233
|
for (const t of i.outcomes) {
|
|
233
234
|
if (t.outcome === "change") continue;
|
|
234
235
|
const d = t.reason ?? t.outcome;
|
|
235
|
-
|
|
236
|
+
r.set(d, (r.get(d) ?? 0) + 1);
|
|
236
237
|
}
|
|
237
|
-
return [...
|
|
238
|
+
return [...r.entries()].map(([t, d]) => `${d} ${t}`).join(" · ");
|
|
238
239
|
}
|
|
239
|
-
function
|
|
240
|
+
function $e({
|
|
240
241
|
result: i,
|
|
241
|
-
labelFor:
|
|
242
|
+
labelFor: r
|
|
242
243
|
}) {
|
|
243
244
|
return /* @__PURE__ */ c("div", { className: "mt-2", "data-bulk-push-results": !0, children: [
|
|
244
245
|
/* @__PURE__ */ c("p", { className: "text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
@@ -260,7 +261,7 @@ function Ne({
|
|
|
260
261
|
children: [
|
|
261
262
|
t.outcome === "change" ? /* @__PURE__ */ l(de, { className: "mt-px h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }) : t.outcome === "fail" ? /* @__PURE__ */ l(ue, { className: "mt-px h-3.5 w-3.5 shrink-0 text-red-600 dark:text-red-400" }) : /* @__PURE__ */ l(me, { className: "mt-px h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
262
263
|
/* @__PURE__ */ c("span", { className: "min-w-0", children: [
|
|
263
|
-
/* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", children:
|
|
264
|
+
/* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: r(t.item) }),
|
|
264
265
|
t.reason && /* @__PURE__ */ c("span", { className: "break-words text-slate-500 dark:text-slate-400", children: [
|
|
265
266
|
" ",
|
|
266
267
|
"— ",
|
|
@@ -274,7 +275,7 @@ function Ne({
|
|
|
274
275
|
] });
|
|
275
276
|
}
|
|
276
277
|
export {
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
Qe as PushBulkButtons,
|
|
279
|
+
$e as PushResultList,
|
|
279
280
|
H as builtinListed
|
|
280
281
|
};
|
|
@@ -5,28 +5,29 @@ import { useState as c } from "react";
|
|
|
5
5
|
import { toast as K } from "sonner";
|
|
6
6
|
import { useNivaroClient as W } from "../../context.js";
|
|
7
7
|
import { get as ne, post as k } from "../../lib/commands.js";
|
|
8
|
-
import { cn as x } from "../../lib/utils.js";
|
|
9
8
|
import { invalidateRecordTasks as se } from "../../lib/record-tasks.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
9
|
+
import { userErrorMessage as le } from "../../lib/safe-error.js";
|
|
10
|
+
import { cn as x } from "../../lib/utils.js";
|
|
11
|
+
import { useChatConfig as ie, useUserSearch as ce } from "./chat-core.js";
|
|
12
|
+
import { useRoomRecord as me } from "./chat-hooks.js";
|
|
13
|
+
const ue = [
|
|
13
14
|
{ name: "task", description: "Create a task on this record or for a person", builtin: !0 },
|
|
14
15
|
{ name: "remind", description: "Remind yourself about something", builtin: !0 },
|
|
15
16
|
{ name: "poll", description: "Ask the room a question with options", builtin: !0 },
|
|
16
17
|
{ name: "note", description: "Add a note to this room’s record", builtin: !0 }
|
|
17
18
|
];
|
|
18
|
-
function
|
|
19
|
+
function Ce(t, n) {
|
|
19
20
|
const m = t.slice(0, n).match(/^\/([a-z0-9-]{0,23})$/i);
|
|
20
21
|
return m ? m[1].toLowerCase() : null;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function Se(t) {
|
|
23
24
|
const n = t.match(/^\/([a-z][a-z0-9-]{1,23})(?:\s+([\s\S]*))?$/i);
|
|
24
25
|
return n ? { name: n[1].toLowerCase(), args: (n[2] ?? "").trim() } : null;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function De(t, n) {
|
|
27
28
|
return t.filter((l) => l.name.startsWith(n.toLowerCase())).sort((l, m) => Number(m.builtin) - Number(l.builtin) || l.name.localeCompare(m.name));
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function Ae() {
|
|
30
31
|
const t = W(), { data: n } = ee({
|
|
31
32
|
queryKey: ["nvr-chat-commands"],
|
|
32
33
|
queryFn: () => t.request(
|
|
@@ -34,9 +35,9 @@ function Se() {
|
|
|
34
35
|
).then((l) => l.data ?? []).catch(() => []),
|
|
35
36
|
staleTime: 5 * 6e4
|
|
36
37
|
});
|
|
37
|
-
return [...
|
|
38
|
+
return [...ue, ...(n ?? []).map((l) => ({ ...l, builtin: !1 }))];
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function qe({
|
|
40
41
|
entries: t,
|
|
41
42
|
index: n,
|
|
42
43
|
onPick: l,
|
|
@@ -72,7 +73,7 @@ function C(t) {
|
|
|
72
73
|
function P(t) {
|
|
73
74
|
return `${t.getFullYear()}-${C(t.getMonth() + 1)}-${C(t.getDate())}T${C(t.getHours())}:${C(t.getMinutes())}`;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function Re({
|
|
76
77
|
kind: t,
|
|
77
78
|
room: n,
|
|
78
79
|
initialText: l,
|
|
@@ -80,16 +81,16 @@ function Ae({
|
|
|
80
81
|
onClose: h,
|
|
81
82
|
th: v
|
|
82
83
|
}) {
|
|
83
|
-
const b = W(), S = te(), N =
|
|
84
|
+
const b = W(), S = te(), N = ie(), r = me(n, t === "task" || t === "note"), [i, F] = c(l), [M, B] = c(!0), [u, L] = c(
|
|
84
85
|
N.me ? { id: N.me.id, name: "Me" } : null
|
|
85
|
-
), [g, D] = c(""), [A, H] = c(""), U =
|
|
86
|
+
), [g, D] = c(""), [A, H] = c(""), U = ce(g, t === "task" && g.trim().length >= 2), [_, j] = c(() => P(new Date(Date.now() + 60 * 6e4))), [y, q] = c(["", ""]), [O, G] = c(!1), [I, X] = c(!1), [R, Y] = c(""), J = (e) => {
|
|
86
87
|
K.success(e), h();
|
|
87
88
|
}, V = (e, s) => {
|
|
88
|
-
var
|
|
89
|
-
return K.error(((
|
|
89
|
+
var d;
|
|
90
|
+
return K.error(((d = e == null ? void 0 : e.response) == null ? void 0 : d.error) ?? s);
|
|
90
91
|
}, $ = ae({
|
|
91
92
|
mutationFn: async () => {
|
|
92
|
-
var s,
|
|
93
|
+
var s, d;
|
|
93
94
|
if (t === "task") {
|
|
94
95
|
if (!i.trim()) throw new Error("A task needs a title");
|
|
95
96
|
const p = M && !!r;
|
|
@@ -97,10 +98,10 @@ function Ae({
|
|
|
97
98
|
k("/tasks", {
|
|
98
99
|
...p ? { collection: r == null ? void 0 : r.collection, item: String(r == null ? void 0 : r.id) } : {},
|
|
99
100
|
title: i.trim().slice(0, 200),
|
|
100
|
-
assignee: (
|
|
101
|
+
assignee: (u == null ? void 0 : u.id) ?? ((s = N.me) == null ? void 0 : s.id),
|
|
101
102
|
...A ? { due_date: A } : {}
|
|
102
103
|
})
|
|
103
|
-
), p && r && se(S, r.collection, r.id),
|
|
104
|
+
), p && r && se(S, r.collection, r.id), u && u.id !== ((d = N.me) == null ? void 0 : d.id) ? `Task created for ${u.name}` : "Task created";
|
|
104
105
|
}
|
|
105
106
|
if (t === "remind") {
|
|
106
107
|
if (!i.trim()) throw new Error("Say what to remind you about");
|
|
@@ -136,7 +137,7 @@ function Ae({
|
|
|
136
137
|
), S.invalidateQueries({ queryKey: ["nvr-chat", n] }), "Poll posted";
|
|
137
138
|
},
|
|
138
139
|
onSuccess: (e) => J(e),
|
|
139
|
-
onError: (e) => V(e, e
|
|
140
|
+
onError: (e) => V(e, le(e, "That did not work"))
|
|
140
141
|
}), Z = { task: "New task", remind: "Remind me", poll: "New poll", note: "Add a note" }[t], Q = {
|
|
141
142
|
task: "What needs doing?",
|
|
142
143
|
remind: "Remind me to…",
|
|
@@ -211,7 +212,7 @@ function Ae({
|
|
|
211
212
|
/* @__PURE__ */ a(
|
|
212
213
|
"input",
|
|
213
214
|
{
|
|
214
|
-
value:
|
|
215
|
+
value: u && !g ? u.name : g,
|
|
215
216
|
onFocus: () => {
|
|
216
217
|
D("");
|
|
217
218
|
},
|
|
@@ -234,7 +235,7 @@ function Ae({
|
|
|
234
235
|
}
|
|
235
236
|
)
|
|
236
237
|
] }),
|
|
237
|
-
!
|
|
238
|
+
!u && g.trim().length >= 2 && /* @__PURE__ */ a("ul", { className: "max-h-24 overflow-y-auto rounded-md border border-slate-200 text-[12px] dark:border-border", children: U.users.slice(0, 6).map((e) => {
|
|
238
239
|
const s = [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email || "";
|
|
239
240
|
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
240
241
|
"button",
|
|
@@ -289,7 +290,7 @@ function Ae({
|
|
|
289
290
|
"input",
|
|
290
291
|
{
|
|
291
292
|
value: e,
|
|
292
|
-
onChange: (
|
|
293
|
+
onChange: (d) => q((p) => p.map((w, T) => T === s ? d.target.value : w)),
|
|
293
294
|
placeholder: `Option ${s + 1}`,
|
|
294
295
|
className: f
|
|
295
296
|
}
|
|
@@ -299,7 +300,7 @@ function Ae({
|
|
|
299
300
|
{
|
|
300
301
|
type: "button",
|
|
301
302
|
"aria-label": "Remove option",
|
|
302
|
-
onClick: () => q((
|
|
303
|
+
onClick: () => q((d) => d.filter((p, w) => w !== s)),
|
|
303
304
|
className: "text-slate-400 hover:text-slate-700",
|
|
304
305
|
children: /* @__PURE__ */ a(z, { className: "h-3.5 w-3.5" })
|
|
305
306
|
}
|
|
@@ -373,11 +374,11 @@ function Ae({
|
|
|
373
374
|
);
|
|
374
375
|
}
|
|
375
376
|
export {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
377
|
+
Re as SlashForm,
|
|
378
|
+
qe as SlashMenu,
|
|
379
|
+
De as filterSlash,
|
|
380
|
+
Se as parseSlashLine,
|
|
381
|
+
Ce as slashQuery,
|
|
381
382
|
P as toLocalInput,
|
|
382
|
-
|
|
383
|
+
Ae as useChatCommands
|
|
383
384
|
};
|