@nivaro/react 0.3.8 → 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/replayUploadQueue.js +107 -93
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +103 -101
- package/dist/index.d.ts +115 -2
- package/dist/index.js +466 -447
- package/dist/shared/components/CollectionBrowserView.js +1058 -1059
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/DataTable.js +230 -223
- 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/QueryTable.js +49 -49
- 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/ChatPanel.js +288 -287
- 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/panels/CommentPanel.js +237 -236
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/profile/usePersonPresence.js +42 -37
- 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 +73 -0
- package/dist/shared/lib/presence-state.js +39 -31
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/request-gate.js +120 -102
- package/dist/shared/lib/rum.js +45 -36
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/signed-out.js +114 -0
- package/dist/shared/lib/socket-realtime.js +19 -17
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/use-online-users.js +11 -10
- package/dist/shared/lib/worker-socket.js +89 -79
- package/package.json +1 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as w, useQuery as C, useMutation as E } from "@tanstack/react-query";
|
|
3
|
-
import { Check as q, X as S, Pencil as I, Trash2 as F, Plus as K, Brain as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { useNivaroClient as
|
|
3
|
+
import { Check as q, X as S, Pencil as I, Trash2 as F, Plus as K, Brain as M, History as _ } from "lucide-react";
|
|
4
|
+
import { useEffect as D, useState as u } from "react";
|
|
5
|
+
import { useNivaroClient as H } from "../../context.js";
|
|
6
6
|
import { get as Q, patch as P } from "../../lib/commands.js";
|
|
7
|
-
import {
|
|
7
|
+
import { userErrorMessage as X } from "../../lib/safe-error.js";
|
|
8
|
+
import { AiHistorySwitch as j } from "../ai/AiHistorySwitch.js";
|
|
8
9
|
import { SectionCard as N } from "./primitives.js";
|
|
9
10
|
const g = 20, k = 300;
|
|
10
|
-
function
|
|
11
|
-
const d =
|
|
11
|
+
function G() {
|
|
12
|
+
const d = H(), A = w(), { data: i } = C({
|
|
12
13
|
queryKey: ["nvr-profile-prefs"],
|
|
13
14
|
queryFn: () => d.request(Q("/users/me")).then((e) => {
|
|
14
15
|
var r;
|
|
15
16
|
return ((r = e.data) == null ? void 0 : r.preferences) ?? {};
|
|
16
17
|
})
|
|
17
18
|
}), h = i !== void 0;
|
|
18
|
-
|
|
19
|
+
D(() => {
|
|
19
20
|
var e;
|
|
20
21
|
!h || typeof window > "u" || window.location.hash !== "#ai-memory" || (e = document.querySelector('[data-profile-card="ai-memory"]')) == null || e.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
21
22
|
}, [h]);
|
|
@@ -27,7 +28,7 @@ function Z() {
|
|
|
27
28
|
onError: (e) => {
|
|
28
29
|
var r, a;
|
|
29
30
|
return y(
|
|
30
|
-
((a = (r = e == null ? void 0 : e.response) == null ? void 0 : r.data) == null ? void 0 : a.error) ?? (e
|
|
31
|
+
((a = (r = e == null ? void 0 : e.response) == null ? void 0 : r.data) == null ? void 0 : a.error) ?? X(e, "Could not save")
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
34
|
}), b = () => {
|
|
@@ -41,7 +42,7 @@ function Z() {
|
|
|
41
42
|
return /* @__PURE__ */ n(
|
|
42
43
|
N,
|
|
43
44
|
{
|
|
44
|
-
icon: /* @__PURE__ */ t(
|
|
45
|
+
icon: /* @__PURE__ */ t(M, { className: "h-4 w-4" }),
|
|
45
46
|
title: "Ask AI memory",
|
|
46
47
|
hint: "Notes every Ask AI answer takes into account. Only you see them.",
|
|
47
48
|
testId: "ai-memory",
|
|
@@ -147,17 +148,17 @@ function Z() {
|
|
|
147
148
|
}
|
|
148
149
|
);
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
+
function J() {
|
|
151
152
|
const d = w();
|
|
152
153
|
return /* @__PURE__ */ t(
|
|
153
154
|
N,
|
|
154
155
|
{
|
|
155
|
-
icon: /* @__PURE__ */ t(
|
|
156
|
+
icon: /* @__PURE__ */ t(_, { className: "h-4 w-4" }),
|
|
156
157
|
title: "Ask AI history",
|
|
157
158
|
hint: "Whether Ask AI keeps your conversations.",
|
|
158
159
|
testId: "ai-history",
|
|
159
160
|
children: /* @__PURE__ */ t(
|
|
160
|
-
|
|
161
|
+
j,
|
|
161
162
|
{
|
|
162
163
|
onDeleted: () => void d.invalidateQueries({ queryKey: ["ask-conversations"] })
|
|
163
164
|
}
|
|
@@ -166,6 +167,6 @@ function z() {
|
|
|
166
167
|
);
|
|
167
168
|
}
|
|
168
169
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
J as AiHistoryCard,
|
|
171
|
+
G as AiMemoryCard
|
|
171
172
|
};
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
-
import { useMutation as
|
|
2
|
+
import { useMutation as v, useQuery as M } from "@tanstack/react-query";
|
|
3
3
|
import { RefreshCw as P, GitMerge as U, UserMinus as B } from "lucide-react";
|
|
4
4
|
import { useState as m } from "react";
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { post as
|
|
5
|
+
import { toast as x } from "sonner";
|
|
6
|
+
import { useNivaroClient as k } from "../../context.js";
|
|
7
|
+
import { post as w, get as $ } from "../../lib/commands.js";
|
|
8
8
|
import { cn as I } from "../../lib/utils.js";
|
|
9
9
|
import { SectionCard as C, EmptyLine as S } from "./primitives.js";
|
|
10
|
-
import { errorText as
|
|
10
|
+
import { errorText as y, useInvalidatePerson as j } from "./types.js";
|
|
11
11
|
function te({ profile: d }) {
|
|
12
|
-
const u =
|
|
12
|
+
const u = k(), [h, t] = m("15"), [p, i] = m(""), l = v({
|
|
13
13
|
mutationFn: () => u.request(
|
|
14
|
-
|
|
14
|
+
w("/realtime/force-refresh", {
|
|
15
15
|
user_ids: [d.id],
|
|
16
|
-
seconds: Number(
|
|
17
|
-
message:
|
|
16
|
+
seconds: Number(h) || 15,
|
|
17
|
+
message: p
|
|
18
18
|
})
|
|
19
|
-
).then((
|
|
19
|
+
).then((a) => a.data),
|
|
20
20
|
// The reload rides the person's room on every server; only the tab count can fall short.
|
|
21
21
|
// A server without `nodes` counts only the tabs on the server that took this request.
|
|
22
|
-
onSuccess: ({ sockets:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
onSuccess: ({ sockets: a, nodes: s, partial: c, remembered: b, remember_hours: r }) => {
|
|
23
|
+
const f = b ? ` Tabs that connect in the next ${r ?? 24} h reload too.` : "";
|
|
24
|
+
x.success(
|
|
25
|
+
(a > 0 ? `Reload pushed to ${a} open tab${a === 1 ? "" : "s"}${c ? " (another server did not answer — there may be more)" : ""}.` : c ? "Reload sent — another server did not answer, so their open tabs could not be counted." : s != null ? "Reload sent — they have no tab open right now." : "Reload sent to every tab they have open (tabs on other servers are not counted).") + f
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
onError: (a) => x.error(y(a, "Failed to push the reload"))
|
|
26
29
|
});
|
|
27
30
|
return /* @__PURE__ */ o(
|
|
28
31
|
C,
|
|
@@ -39,8 +42,8 @@ function te({ profile: d }) {
|
|
|
39
42
|
/* @__PURE__ */ e(
|
|
40
43
|
"input",
|
|
41
44
|
{
|
|
42
|
-
value:
|
|
43
|
-
onChange: (
|
|
45
|
+
value: h,
|
|
46
|
+
onChange: (a) => t(a.target.value),
|
|
44
47
|
inputMode: "numeric",
|
|
45
48
|
className: "h-7 w-14 rounded-md border border-slate-200 bg-white px-2 text-right text-[12px] dark:border-border dark:bg-background"
|
|
46
49
|
}
|
|
@@ -50,8 +53,8 @@ function te({ profile: d }) {
|
|
|
50
53
|
/* @__PURE__ */ e(
|
|
51
54
|
"input",
|
|
52
55
|
{
|
|
53
|
-
value:
|
|
54
|
-
onChange: (
|
|
56
|
+
value: p,
|
|
57
|
+
onChange: (a) => i(a.target.value),
|
|
55
58
|
placeholder: "Optional message in their banner",
|
|
56
59
|
className: "h-7 min-w-[200px] flex-1 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] dark:border-border dark:bg-background"
|
|
57
60
|
}
|
|
@@ -78,12 +81,12 @@ function te({ profile: d }) {
|
|
|
78
81
|
function D({
|
|
79
82
|
excludeId: d,
|
|
80
83
|
value: u,
|
|
81
|
-
label:
|
|
84
|
+
label: h,
|
|
82
85
|
onPick: t
|
|
83
86
|
}) {
|
|
84
|
-
const
|
|
87
|
+
const p = k(), [i, l] = m(""), { data: a = [] } = M({
|
|
85
88
|
queryKey: ["nvr-offboard-user-search", i],
|
|
86
|
-
queryFn: () =>
|
|
89
|
+
queryFn: () => p.request($("/users", { search: i, limit: 8 })).then((s) => s.data),
|
|
87
90
|
enabled: i.length > 1
|
|
88
91
|
});
|
|
89
92
|
return u ? /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan", children: [
|
|
@@ -104,11 +107,11 @@ function D({
|
|
|
104
107
|
{
|
|
105
108
|
value: i,
|
|
106
109
|
onChange: (s) => l(s.target.value),
|
|
107
|
-
placeholder:
|
|
110
|
+
placeholder: h,
|
|
108
111
|
className: "h-8 w-[260px] rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] dark:border-border dark:bg-background"
|
|
109
112
|
}
|
|
110
113
|
),
|
|
111
|
-
i.length > 1 &&
|
|
114
|
+
i.length > 1 && a.length > 0 && /* @__PURE__ */ e("div", { className: "absolute z-10 mt-1 w-[260px] rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card", children: a.filter((s) => s.id.toUpperCase() !== d.toUpperCase()).map((s) => {
|
|
112
115
|
const c = `${s.first_name ?? ""} ${s.last_name ?? ""}`.trim() || s.email;
|
|
113
116
|
return /* @__PURE__ */ o(
|
|
114
117
|
"button",
|
|
@@ -148,18 +151,18 @@ const q = {
|
|
|
148
151
|
field_watches: "notification_subscriptions"
|
|
149
152
|
};
|
|
150
153
|
function re({ profile: d }) {
|
|
151
|
-
const u =
|
|
154
|
+
const u = k(), h = j(d.id), [t, p] = m(null), [i, l] = m({}), [a, s] = m(!0), [c, b] = m(null), { data: r, refetch: f } = M({
|
|
152
155
|
queryKey: ["nvr-offboarding", d.id],
|
|
153
|
-
queryFn: () => u.request($(`/offboarding/${d.id}`)).then((
|
|
154
|
-
}), N =
|
|
156
|
+
queryFn: () => u.request($(`/offboarding/${d.id}`)).then((n) => n.data)
|
|
157
|
+
}), N = v({
|
|
155
158
|
mutationFn: () => u.request(
|
|
156
|
-
|
|
157
|
-
).then((
|
|
158
|
-
onSuccess: (
|
|
159
|
-
|
|
159
|
+
w(`/offboarding/${d.id}/run`, { successor: t == null ? void 0 : t.id, include: i, suspend: a })
|
|
160
|
+
).then((n) => n.data),
|
|
161
|
+
onSuccess: (n) => {
|
|
162
|
+
b(n), x.success("Offboarding complete"), f(), h();
|
|
160
163
|
},
|
|
161
|
-
onError: (
|
|
162
|
-
}), L = Object.values((
|
|
164
|
+
onError: (n) => x.error(y(n, "Offboarding failed"))
|
|
165
|
+
}), L = Object.values((r == null ? void 0 : r.holdings) ?? {}).reduce((n, g) => n + g, 0), [O, T] = m("");
|
|
163
166
|
return /* @__PURE__ */ e(
|
|
164
167
|
C,
|
|
165
168
|
{
|
|
@@ -168,14 +171,14 @@ function re({ profile: d }) {
|
|
|
168
171
|
hint: "Hand everything they hold to a successor in one pass",
|
|
169
172
|
tone: "danger",
|
|
170
173
|
testId: "offboarding",
|
|
171
|
-
children:
|
|
172
|
-
/* @__PURE__ */ e("div", { className: "grid gap-x-6 gap-y-1 sm:grid-cols-2", children: Object.entries(
|
|
173
|
-
const _ = H[
|
|
174
|
+
children: r ? /* @__PURE__ */ o("div", { className: "space-y-3", children: [
|
|
175
|
+
/* @__PURE__ */ e("div", { className: "grid gap-x-6 gap-y-1 sm:grid-cols-2", children: Object.entries(r.holdings).map(([n, g]) => {
|
|
176
|
+
const _ = H[n], F = I(
|
|
174
177
|
"flex items-center gap-2 text-[12.5px]",
|
|
175
|
-
|
|
178
|
+
g === 0 ? "text-slate-300 dark:text-slate-600" : "text-slate-700 dark:text-slate-200"
|
|
176
179
|
), R = /* @__PURE__ */ o(E, { children: [
|
|
177
|
-
/* @__PURE__ */ e("span", { className: "flex-1", children: q[
|
|
178
|
-
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children:
|
|
180
|
+
/* @__PURE__ */ e("span", { className: "flex-1", children: q[n] ?? n }),
|
|
181
|
+
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: g })
|
|
179
182
|
] });
|
|
180
183
|
return _ ? /* @__PURE__ */ o("label", { className: F, children: [
|
|
181
184
|
/* @__PURE__ */ e(
|
|
@@ -183,16 +186,16 @@ function re({ profile: d }) {
|
|
|
183
186
|
{
|
|
184
187
|
type: "checkbox",
|
|
185
188
|
checked: i[_] !== !1,
|
|
186
|
-
disabled:
|
|
187
|
-
onChange: (
|
|
189
|
+
disabled: g === 0,
|
|
190
|
+
onChange: (A) => l((G) => ({ ...G, [_]: A.target.checked })),
|
|
188
191
|
className: "h-3.5 w-3.5"
|
|
189
192
|
}
|
|
190
193
|
),
|
|
191
194
|
R
|
|
192
|
-
] },
|
|
195
|
+
] }, n) : /* @__PURE__ */ o("div", { className: F, children: [
|
|
193
196
|
/* @__PURE__ */ e("span", { className: "w-3.5" }),
|
|
194
197
|
R
|
|
195
|
-
] },
|
|
198
|
+
] }, n);
|
|
196
199
|
}) }),
|
|
197
200
|
L === 0 ? /* @__PURE__ */ e(S, { children: "Nothing to hand over — this account holds no work." }) : /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2.5", children: [
|
|
198
201
|
/* @__PURE__ */ e(
|
|
@@ -201,7 +204,7 @@ function re({ profile: d }) {
|
|
|
201
204
|
excludeId: d.id,
|
|
202
205
|
value: t,
|
|
203
206
|
label: "Successor (who takes it over)…",
|
|
204
|
-
onPick:
|
|
207
|
+
onPick: p
|
|
205
208
|
}
|
|
206
209
|
),
|
|
207
210
|
/* @__PURE__ */ o("label", { className: "flex items-center gap-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: [
|
|
@@ -209,8 +212,8 @@ function re({ profile: d }) {
|
|
|
209
212
|
"input",
|
|
210
213
|
{
|
|
211
214
|
type: "checkbox",
|
|
212
|
-
checked:
|
|
213
|
-
onChange: (
|
|
215
|
+
checked: a,
|
|
216
|
+
onChange: (n) => s(n.target.checked),
|
|
214
217
|
className: "h-3.5 w-3.5"
|
|
215
218
|
}
|
|
216
219
|
),
|
|
@@ -221,7 +224,7 @@ function re({ profile: d }) {
|
|
|
221
224
|
"input",
|
|
222
225
|
{
|
|
223
226
|
value: O,
|
|
224
|
-
onChange: (
|
|
227
|
+
onChange: (n) => T(n.target.value),
|
|
225
228
|
placeholder: "Type OFFBOARD",
|
|
226
229
|
"aria-label": "Type OFFBOARD to confirm",
|
|
227
230
|
className: "h-8 w-[150px] rounded-md border border-amber-300 bg-white px-2.5 text-[12.5px] dark:border-amber-500/40 dark:bg-background"
|
|
@@ -241,25 +244,25 @@ function re({ profile: d }) {
|
|
|
241
244
|
c && /* @__PURE__ */ o("p", { className: "rounded-md bg-emerald-50 px-3 py-2 text-[12px] text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
|
|
242
245
|
"Done:",
|
|
243
246
|
" ",
|
|
244
|
-
Object.entries(c).map(([
|
|
247
|
+
Object.entries(c).map(([n, g]) => `${(q[n] ?? n).toLowerCase()} ${g}`).join(" · ")
|
|
245
248
|
] })
|
|
246
249
|
] }) : /* @__PURE__ */ e(S, { children: "Loading what they hold…" })
|
|
247
250
|
}
|
|
248
251
|
);
|
|
249
252
|
}
|
|
250
253
|
function ne({ profile: d }) {
|
|
251
|
-
const u =
|
|
254
|
+
const u = k(), h = j(d.id), [t, p] = m(null), [i, l] = m(null), [a, s] = m(""), c = v({
|
|
252
255
|
mutationFn: () => u.request(
|
|
253
|
-
|
|
254
|
-
).then((
|
|
255
|
-
onSuccess: (
|
|
256
|
-
onError: (
|
|
257
|
-
}),
|
|
258
|
-
mutationFn: () => u.request(
|
|
256
|
+
w(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id, dry_run: !0 })
|
|
257
|
+
).then((r) => r.data),
|
|
258
|
+
onSuccess: (r) => l(r.references),
|
|
259
|
+
onError: (r) => x.error(y(r, "Preview failed"))
|
|
260
|
+
}), b = v({
|
|
261
|
+
mutationFn: () => u.request(w(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id })),
|
|
259
262
|
onSuccess: () => {
|
|
260
|
-
|
|
263
|
+
x.success("Accounts merged — the duplicate is suspended"), l(null), s(""), h();
|
|
261
264
|
},
|
|
262
|
-
onError: (
|
|
265
|
+
onError: (r) => x.error(y(r, "Merge failed"))
|
|
263
266
|
});
|
|
264
267
|
return /* @__PURE__ */ e(
|
|
265
268
|
C,
|
|
@@ -277,8 +280,8 @@ function ne({ profile: d }) {
|
|
|
277
280
|
excludeId: d.id,
|
|
278
281
|
value: t,
|
|
279
282
|
label: "Survivor account (keeps everything)…",
|
|
280
|
-
onPick: (
|
|
281
|
-
|
|
283
|
+
onPick: (r) => {
|
|
284
|
+
p(r), l(null);
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
),
|
|
@@ -294,23 +297,23 @@ function ne({ profile: d }) {
|
|
|
294
297
|
)
|
|
295
298
|
] }),
|
|
296
299
|
i && /* @__PURE__ */ o(E, { children: [
|
|
297
|
-
/* @__PURE__ */ e("div", { className: "max-h-[220px] overflow-y-auto rounded-md border border-slate-100 dark:border-border/60", children: Object.keys(i).length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Nothing references this account." }) : Object.entries(i).map(([
|
|
300
|
+
/* @__PURE__ */ e("div", { className: "max-h-[220px] overflow-y-auto rounded-md border border-slate-100 dark:border-border/60", children: Object.keys(i).length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Nothing references this account." }) : Object.entries(i).map(([r, f]) => /* @__PURE__ */ o(
|
|
298
301
|
"div",
|
|
299
302
|
{
|
|
300
303
|
className: "flex items-center justify-between border-b border-slate-50 px-3 py-1 text-[12px] last:border-0 dark:border-border/40",
|
|
301
304
|
children: [
|
|
302
|
-
/* @__PURE__ */ e("span", { className: "font-mono text-slate-600 dark:text-slate-300", children:
|
|
303
|
-
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
305
|
+
/* @__PURE__ */ e("span", { className: "font-mono text-slate-600 dark:text-slate-300", children: r }),
|
|
306
|
+
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-700 dark:text-slate-200", children: f })
|
|
304
307
|
]
|
|
305
308
|
},
|
|
306
|
-
|
|
309
|
+
r
|
|
307
310
|
)) }),
|
|
308
311
|
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
309
312
|
/* @__PURE__ */ e(
|
|
310
313
|
"input",
|
|
311
314
|
{
|
|
312
|
-
value:
|
|
313
|
-
onChange: (
|
|
315
|
+
value: a,
|
|
316
|
+
onChange: (r) => s(r.target.value),
|
|
314
317
|
placeholder: "Type MERGE to confirm",
|
|
315
318
|
"aria-label": "Type MERGE to confirm",
|
|
316
319
|
className: "h-8 w-[180px] rounded-md border border-amber-300 bg-white px-2.5 text-[12.5px] dark:border-amber-500/40 dark:bg-background"
|
|
@@ -320,10 +323,10 @@ function ne({ profile: d }) {
|
|
|
320
323
|
"button",
|
|
321
324
|
{
|
|
322
325
|
type: "button",
|
|
323
|
-
disabled:
|
|
324
|
-
onClick: () =>
|
|
326
|
+
disabled: a !== "MERGE" || b.isPending,
|
|
327
|
+
onClick: () => b.mutate(),
|
|
325
328
|
className: "h-8 rounded-md bg-amber-500 px-4 text-[12.5px] font-semibold text-white hover:bg-amber-600 disabled:opacity-50",
|
|
326
|
-
children:
|
|
329
|
+
children: b.isPending ? "Merging…" : `Merge into ${(t == null ? void 0 : t.name) ?? ""}`
|
|
327
330
|
}
|
|
328
331
|
)
|
|
329
332
|
] })
|
|
@@ -1,57 +1,62 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import { useNivaroClient as
|
|
3
|
-
import { get as
|
|
4
|
-
import { useLiveEvent as
|
|
5
|
-
import {
|
|
1
|
+
import { useQueryClient as y, useQuery as u } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as a } from "../../context.js";
|
|
3
|
+
import { get as g } from "../../lib/commands.js";
|
|
4
|
+
import { useLiveEvent as h } from "../../lib/live.js";
|
|
5
|
+
import { usePresenceOnlinePoll as f } from "../../lib/presence-live.js";
|
|
6
|
+
import { presenceChangeTouches as P, prettyPagePath as m } from "../../lib/presence-state.js";
|
|
6
7
|
import { PERSON_PROFILE_KEY as d } from "./types.js";
|
|
7
|
-
function
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
function K(n) {
|
|
9
|
+
var t, o;
|
|
10
|
+
const l = a(), s = y();
|
|
11
|
+
h(
|
|
11
12
|
"presence:changed",
|
|
12
13
|
() => {
|
|
13
|
-
|
|
14
|
+
s.invalidateQueries(
|
|
15
|
+
{ queryKey: [d, n] },
|
|
16
|
+
{ cancelRefetch: !1 }
|
|
17
|
+
);
|
|
14
18
|
},
|
|
15
19
|
{
|
|
16
|
-
enabled: !!
|
|
17
|
-
debounceMs:
|
|
20
|
+
enabled: !!n,
|
|
21
|
+
debounceMs: 1e3,
|
|
18
22
|
includeOwn: !0,
|
|
19
|
-
|
|
23
|
+
// Coalesced server events list every changed id (`user_ids`); older ones carry `user_id`.
|
|
24
|
+
match: (i) => P(i, n)
|
|
20
25
|
}
|
|
21
26
|
);
|
|
22
|
-
const { data: e } =
|
|
27
|
+
const c = f(15e3, !!n), { data: e } = u({
|
|
23
28
|
queryKey: ["presence-online"],
|
|
24
|
-
queryFn: () =>
|
|
25
|
-
|
|
29
|
+
queryFn: () => l.request(
|
|
30
|
+
g("/presence/online")
|
|
26
31
|
),
|
|
27
|
-
enabled: !!
|
|
28
|
-
refetchInterval:
|
|
32
|
+
enabled: !!n,
|
|
33
|
+
refetchInterval: c,
|
|
29
34
|
staleTime: 5e3
|
|
30
|
-
}),
|
|
31
|
-
(
|
|
32
|
-
),
|
|
33
|
-
return { page:
|
|
35
|
+
}), r = (t = e == null ? void 0 : e.data) == null ? void 0 : t.find(
|
|
36
|
+
(i) => String(i.user_id).toUpperCase() === String(n ?? "").toUpperCase()
|
|
37
|
+
), p = (((o = e == null ? void 0 : e.config) == null ? void 0 : o.fields) ?? ["role", "page"]).includes("page");
|
|
38
|
+
return { page: r && p ? r.page ?? m(r.current_path) : null };
|
|
34
39
|
}
|
|
35
|
-
function
|
|
36
|
-
var
|
|
37
|
-
const
|
|
40
|
+
function O(n, l) {
|
|
41
|
+
var t, o;
|
|
42
|
+
const s = a(), c = f(15e3, l && !!n), { data: e } = u({
|
|
38
43
|
queryKey: ["presence-online"],
|
|
39
|
-
queryFn: () =>
|
|
40
|
-
enabled:
|
|
41
|
-
refetchInterval:
|
|
44
|
+
queryFn: () => s.request(g("/presence/online")),
|
|
45
|
+
enabled: l && !!n,
|
|
46
|
+
refetchInterval: c,
|
|
42
47
|
staleTime: 5e3
|
|
43
|
-
}),
|
|
44
|
-
(
|
|
48
|
+
}), r = (t = e == null ? void 0 : e.data) == null ? void 0 : t.find(
|
|
49
|
+
(i) => String(i.user_id).toUpperCase() === String(n ?? "").toUpperCase()
|
|
45
50
|
);
|
|
46
|
-
if (!
|
|
47
|
-
const
|
|
51
|
+
if (!r) return { word: null, page: null, minutes: null };
|
|
52
|
+
const p = (((o = e == null ? void 0 : e.config) == null ? void 0 : o.fields) ?? ["role", "page"]).includes("page");
|
|
48
53
|
return {
|
|
49
|
-
word:
|
|
50
|
-
page:
|
|
51
|
-
minutes:
|
|
54
|
+
word: r.away ? "away" : r.is_idle ? "idle" : "online",
|
|
55
|
+
page: p ? r.page ?? m(r.current_path) : null,
|
|
56
|
+
minutes: r.idle_minutes ?? null
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
59
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
O as useCardPresence,
|
|
61
|
+
K as usePersonPresence
|
|
57
62
|
};
|