@nivaro/react 0.3.100 → 0.3.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +46 -3
- package/dist/index.js +623 -620
- package/dist/shared/components/ActivityEntry.js +5 -5
- package/dist/shared/components/CollectionBrowserView.js +183 -175
- package/dist/shared/components/ItemEditForm.js +2708 -2704
- package/dist/shared/components/JobsTray.js +74 -63
- package/dist/shared/components/NotificationBell.js +80 -73
- package/dist/shared/components/TipLayer.js +56 -41
- package/dist/shared/components/cbv-file-label.js +46 -0
- package/dist/shared/components/integrations/console/SignalCard.js +40 -40
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
- package/dist/shared/components/integrations/console/drill/status.js +23 -18
- package/dist/shared/components/item-edit/RecordInsights.js +86 -86
- package/dist/shared/components/item-edit/header-path-preview.js +46 -34
- package/dist/shared/components/notifications/DeliveryChips.js +1 -2
- package/dist/shared/components/panels/BackgroundMove.js +152 -85
- package/dist/shared/components/panels/PipelinePanel.js +602 -594
- package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
- package/dist/shared/components/profile/DayTimeline.js +145 -140
- package/dist/shared/components/profile/PersonAccess.js +679 -383
- package/dist/shared/components/profile/PersonActivity.js +404 -427
- package/dist/shared/components/profile/PersonDidPanel.js +248 -134
- package/dist/shared/components/profile/PersonProfile.js +33 -32
- package/dist/shared/components/profile/journey-view.js +166 -0
- package/dist/shared/lib/activity-sentence.js +319 -236
- package/dist/shared/lib/jobs-tray.js +60 -41
- package/dist/shared/lib/move-failure.js +16 -6
- package/dist/shared/lib/obligation-banner.js +16 -16
- package/dist/shared/lib/partner-failure.js +44 -32
- package/package.json +1 -1
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { TONE_TEXT as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../../../lib/utils.js";
|
|
3
|
+
import { TONE_TEXT as n, TONE_SOFT as s } from "../tone.js";
|
|
4
|
+
const k = {
|
|
5
5
|
accepted: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400",
|
|
6
6
|
failed: "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-400",
|
|
7
7
|
rejected: "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-400",
|
|
8
8
|
pending: "bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-400",
|
|
9
|
-
submitted: "bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-400"
|
|
9
|
+
submitted: "bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-400",
|
|
10
|
+
// Written before the partner call, still in flight (api erp-unanswered.ts).
|
|
11
|
+
sending: "bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-400",
|
|
12
|
+
// …and past its time: the partner may already have it (the ERP tab's "no answer").
|
|
13
|
+
"no answer": "bg-orange-50 text-orange-700 dark:bg-orange-500/10 dark:text-orange-300"
|
|
10
14
|
};
|
|
11
|
-
function
|
|
12
|
-
|
|
15
|
+
function i({ status: t, stale: r }) {
|
|
16
|
+
const e = t === "sending" && r ? "no answer" : t;
|
|
17
|
+
return /* @__PURE__ */ d(
|
|
13
18
|
"span",
|
|
14
19
|
{
|
|
15
|
-
className:
|
|
20
|
+
className: a(
|
|
16
21
|
"rounded px-1.5 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide",
|
|
17
|
-
|
|
22
|
+
k[e] ?? "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300"
|
|
18
23
|
),
|
|
19
24
|
children: e
|
|
20
25
|
}
|
|
21
26
|
);
|
|
22
27
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return /* @__PURE__ */
|
|
28
|
+
function b({ status: t, ok: r }) {
|
|
29
|
+
const e = r ? "positive" : "negative";
|
|
30
|
+
return /* @__PURE__ */ d(
|
|
26
31
|
"span",
|
|
27
32
|
{
|
|
28
|
-
className:
|
|
33
|
+
className: a(
|
|
29
34
|
"inline-flex items-center rounded px-1.5 py-0.5 text-[11px] font-semibold tabular-nums",
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
s[e],
|
|
36
|
+
n[e]
|
|
32
37
|
),
|
|
33
|
-
children:
|
|
38
|
+
children: t ?? "No response"
|
|
34
39
|
}
|
|
35
40
|
);
|
|
36
41
|
}
|
|
37
42
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
b as HttpStatusChip,
|
|
44
|
+
i as StatusPill
|
|
40
45
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsxs as o, jsx as
|
|
1
|
+
import { jsxs as o, jsx as n, Fragment as w } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as p } from "@tanstack/react-query";
|
|
3
3
|
import { Info as N } from "lucide-react";
|
|
4
4
|
import { useState as y, useRef as k, useEffect as _ } from "react";
|
|
5
|
-
import { useNivaroClient as
|
|
5
|
+
import { useNivaroClient as h } from "../../context.js";
|
|
6
6
|
import { get as u } from "../../lib/commands.js";
|
|
7
7
|
import { toLocalDateString as f, formatDateTime as v } from "../../lib/utils.js";
|
|
8
|
-
function P(a, t,
|
|
9
|
-
for (const
|
|
10
|
-
["record-audience", t,
|
|
11
|
-
["erp-submissions", t, String(
|
|
12
|
-
["integration-obligations", "record", t, String(
|
|
13
|
-
["record-integrations", t,
|
|
14
|
-
["record-external-ids", t,
|
|
15
|
-
["record-owner-history", t,
|
|
16
|
-
["record-mail-log", t,
|
|
17
|
-
["record-chat-mentions", t,
|
|
8
|
+
function P(a, t, r) {
|
|
9
|
+
for (const s of [
|
|
10
|
+
["record-audience", t, r],
|
|
11
|
+
["erp-submissions", t, String(r)],
|
|
12
|
+
["integration-obligations", "record", t, String(r)],
|
|
13
|
+
["record-integrations", t, r],
|
|
14
|
+
["record-external-ids", t, r],
|
|
15
|
+
["record-owner-history", t, r],
|
|
16
|
+
["record-mail-log", t, r],
|
|
17
|
+
["record-chat-mentions", t, r]
|
|
18
18
|
])
|
|
19
|
-
a.invalidateQueries({ queryKey:
|
|
19
|
+
a.invalidateQueries({ queryKey: s });
|
|
20
20
|
}
|
|
21
|
-
function U(a, t,
|
|
22
|
-
a.invalidateQueries({ queryKey: ["item", t,
|
|
23
|
-
predicate: (
|
|
24
|
-
}), a.invalidateQueries({ queryKey: ["child-summary", t,
|
|
25
|
-
predicate: (
|
|
26
|
-
}), q(a, t,
|
|
21
|
+
function U(a, t, r) {
|
|
22
|
+
a.invalidateQueries({ queryKey: ["item", t, r] }), a.invalidateQueries({ queryKey: ["resolve-paths", t, r] }), a.invalidateQueries({
|
|
23
|
+
predicate: (s) => s.queryKey[0] === "o2m-rows" && String(s.queryKey[3]) === r
|
|
24
|
+
}), a.invalidateQueries({ queryKey: ["child-summary", t, r] }), a.invalidateQueries({ queryKey: ["last-touch", t, r] }), a.invalidateQueries({ queryKey: ["sla-breach", t, r] }), a.invalidateQueries({
|
|
25
|
+
predicate: (s) => (s.queryKey[0] === "item-actions" || s.queryKey[0] === "ext-item-actions") && s.queryKey[1] === t && String(s.queryKey[2]) === r
|
|
26
|
+
}), q(a, t, r);
|
|
27
27
|
}
|
|
28
28
|
const $ = 4e3;
|
|
29
|
-
function q(a, t,
|
|
29
|
+
function q(a, t, r) {
|
|
30
30
|
var e;
|
|
31
|
-
const
|
|
32
|
-
a.invalidateQueries({ queryKey: ["comments", t,
|
|
31
|
+
const s = () => {
|
|
32
|
+
a.invalidateQueries({ queryKey: ["comments", t, r] }), a.invalidateQueries({ queryKey: ["comments-related", t, r] });
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
const l = setTimeout(
|
|
34
|
+
s();
|
|
35
|
+
const l = setTimeout(s, $);
|
|
36
36
|
(e = l.unref) == null || e.call(l);
|
|
37
37
|
}
|
|
38
38
|
function W({
|
|
39
39
|
collection: a,
|
|
40
40
|
itemId: t,
|
|
41
|
-
compact:
|
|
41
|
+
compact: r
|
|
42
42
|
}) {
|
|
43
|
-
const [
|
|
43
|
+
const [s, l] = y(!1), [e, i] = y("audience"), c = k(null);
|
|
44
44
|
return _(() => {
|
|
45
|
-
if (!
|
|
45
|
+
if (!s) return;
|
|
46
46
|
const d = (x) => {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
47
|
+
var m;
|
|
48
|
+
(m = c.current) != null && m.contains(x.target) || l(!1);
|
|
49
49
|
};
|
|
50
50
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
51
|
-
}, [
|
|
52
|
-
/* @__PURE__ */
|
|
51
|
+
}, [s]), /* @__PURE__ */ o("div", { ref: c, className: "relative", children: [
|
|
52
|
+
/* @__PURE__ */ n(
|
|
53
53
|
"button",
|
|
54
54
|
{
|
|
55
55
|
type: "button",
|
|
@@ -57,18 +57,18 @@ function W({
|
|
|
57
57
|
"data-tip": "Record insights — audience, integrations, owner history",
|
|
58
58
|
title: "Record insights",
|
|
59
59
|
"aria-label": "Record insights",
|
|
60
|
-
className:
|
|
61
|
-
children: /* @__PURE__ */
|
|
60
|
+
className: r ? "inline-flex h-8 w-8 items-center justify-center transition-colors hover:bg-accent hover:text-accent-foreground" : "inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
61
|
+
children: /* @__PURE__ */ n(N, { className: r ? "h-4 w-4" : "h-3.5 w-3.5" })
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */
|
|
64
|
+
s && /* @__PURE__ */ o("div", { className: "absolute right-0 top-full z-[60] mt-1 w-[480px] max-w-[92vw] rounded-lg border border-slate-200 bg-white p-3 shadow-xl dark:border-border dark:bg-card", children: [
|
|
65
|
+
/* @__PURE__ */ n("div", { className: "mb-2 flex gap-1", children: [
|
|
66
66
|
["audience", "Audience"],
|
|
67
67
|
["integrations", "Integrations"],
|
|
68
68
|
["owners", "Owner history"],
|
|
69
69
|
["mail", "Mail"],
|
|
70
70
|
["chat", "Chat"]
|
|
71
|
-
].map(([d, x]) => /* @__PURE__ */
|
|
71
|
+
].map(([d, x]) => /* @__PURE__ */ n(
|
|
72
72
|
"button",
|
|
73
73
|
{
|
|
74
74
|
type: "button",
|
|
@@ -78,11 +78,11 @@ function W({
|
|
|
78
78
|
},
|
|
79
79
|
d
|
|
80
80
|
)) }),
|
|
81
|
-
e === "audience" && /* @__PURE__ */
|
|
82
|
-
e === "integrations" && /* @__PURE__ */
|
|
83
|
-
e === "owners" && /* @__PURE__ */
|
|
84
|
-
e === "mail" && /* @__PURE__ */
|
|
85
|
-
e === "chat" && /* @__PURE__ */
|
|
81
|
+
e === "audience" && /* @__PURE__ */ n(K, { collection: a, itemId: t }),
|
|
82
|
+
e === "integrations" && /* @__PURE__ */ n(L, { collection: a, itemId: t }),
|
|
83
|
+
e === "owners" && /* @__PURE__ */ n(S, { collection: a, itemId: t }),
|
|
84
|
+
e === "mail" && /* @__PURE__ */ n(E, { collection: a, itemId: t }),
|
|
85
|
+
e === "chat" && /* @__PURE__ */ n(Q, { collection: a, itemId: t })
|
|
86
86
|
] })
|
|
87
87
|
] });
|
|
88
88
|
}
|
|
@@ -93,15 +93,15 @@ const T = {
|
|
|
93
93
|
delete: "deletions",
|
|
94
94
|
workflow_transition: "state changes"
|
|
95
95
|
};
|
|
96
|
-
function
|
|
97
|
-
const
|
|
96
|
+
function K({ collection: a, itemId: t }) {
|
|
97
|
+
const r = h(), { data: s, isLoading: l } = p({
|
|
98
98
|
queryKey: ["record-audience", a, t],
|
|
99
|
-
queryFn: () =>
|
|
99
|
+
queryFn: () => r.request(u(`/audience/${a}/${t}`)).then((i) => i.data),
|
|
100
100
|
staleTime: 3e4
|
|
101
101
|
});
|
|
102
|
-
if (l) return /* @__PURE__ */
|
|
103
|
-
const e = (
|
|
104
|
-
return e.length === 0 ? /* @__PURE__ */
|
|
102
|
+
if (l) return /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "Loading…" });
|
|
103
|
+
const e = (s == null ? void 0 : s.people) ?? [];
|
|
104
|
+
return e.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "Nobody hears about changes here automatically — no owners, watchers, or subscribers." }) : /* @__PURE__ */ o("div", { className: "max-h-72 overflow-y-auto", children: [
|
|
105
105
|
/* @__PURE__ */ o("p", { className: "pb-1.5 text-[10.5px] text-slate-400", children: [
|
|
106
106
|
e.length,
|
|
107
107
|
" ",
|
|
@@ -113,9 +113,9 @@ function L({ collection: a, itemId: t }) {
|
|
|
113
113
|
{
|
|
114
114
|
className: "border-t border-slate-100 py-1.5 first:border-t-0 dark:border-border/50",
|
|
115
115
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ n("p", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: i.name }),
|
|
117
117
|
/* @__PURE__ */ o("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [
|
|
118
|
-
i.owner && /* @__PURE__ */
|
|
118
|
+
i.owner && /* @__PURE__ */ n("span", { className: "rounded-full bg-nvr-cyan/10 px-1.5 py-px text-[10.5px] font-medium text-nvr-navy dark:text-nvr-cyan", children: "Owner — notified on transitions" }),
|
|
119
119
|
i.watch_fields.length > 0 && /* @__PURE__ */ o(
|
|
120
120
|
"span",
|
|
121
121
|
{
|
|
@@ -149,29 +149,29 @@ function L({ collection: a, itemId: t }) {
|
|
|
149
149
|
))
|
|
150
150
|
] });
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
const
|
|
152
|
+
function L({ collection: a, itemId: t }) {
|
|
153
|
+
const r = h(), { data: s = [], isLoading: l } = p({
|
|
154
154
|
queryKey: ["erp-submissions", a, String(t)],
|
|
155
|
-
queryFn: () =>
|
|
155
|
+
queryFn: () => r.request(
|
|
156
156
|
u(`/erp-submissions/${a}/${encodeURIComponent(t)}`)
|
|
157
157
|
).then((d) => d.data ?? []).catch(() => []),
|
|
158
158
|
staleTime: 3e4
|
|
159
159
|
}), { data: e, isLoading: i } = p({
|
|
160
160
|
queryKey: ["record-integrations", a, t],
|
|
161
|
-
queryFn: () =>
|
|
161
|
+
queryFn: () => r.request(u(`/record-integrations/${a}/${t}`)).then((d) => d.data),
|
|
162
162
|
staleTime: 3e4
|
|
163
163
|
}), { data: c = [] } = p({
|
|
164
164
|
queryKey: ["record-external-ids", a, t],
|
|
165
|
-
queryFn: () =>
|
|
166
|
-
const x = d.data ?? {},
|
|
167
|
-
return Object.entries(x).filter(([b, g]) => b !== "id" && g != null && g !== "" &&
|
|
165
|
+
queryFn: () => r.request(u(`/items/${a}/${t}`)).then((d) => {
|
|
166
|
+
const x = d.data ?? {}, m = /(external|nuvolo|mwf|oracle|sap|erp|legacy|fusion|mdsi).*(id|number|ref)|^(order_number|requisition_id|sales_order_id)$/i;
|
|
167
|
+
return Object.entries(x).filter(([b, g]) => b !== "id" && g != null && g !== "" && m.test(b)).map(([b, g]) => ({ field: b, value: String(g).slice(0, 60) })).slice(0, 12);
|
|
168
168
|
}).catch(() => []),
|
|
169
169
|
staleTime: 6e4
|
|
170
170
|
});
|
|
171
|
-
return i || l ? /* @__PURE__ */
|
|
171
|
+
return i || l ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : s.length + ((e == null ? void 0 : e.webhooks.length) ?? 0) === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No integration activity for this record." }) : /* @__PURE__ */ o(w, { children: [
|
|
172
172
|
c.length > 0 && /* @__PURE__ */ o("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border/50", children: [
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "External identifiers" }),
|
|
174
|
+
/* @__PURE__ */ n("div", { className: "mt-1 flex flex-wrap gap-1.5", children: c.map((d) => /* @__PURE__ */ o(
|
|
175
175
|
"span",
|
|
176
176
|
{
|
|
177
177
|
className: "inline-flex items-center gap-1 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[11px] dark:border-border dark:bg-muted/40",
|
|
@@ -180,15 +180,15 @@ function K({ collection: a, itemId: t }) {
|
|
|
180
180
|
d.field,
|
|
181
181
|
":"
|
|
182
182
|
] }),
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ n("span", { className: "font-mono text-slate-700 dark:text-slate-200", children: d.value })
|
|
184
184
|
]
|
|
185
185
|
},
|
|
186
186
|
d.field
|
|
187
187
|
)) })
|
|
188
188
|
] }),
|
|
189
189
|
/* @__PURE__ */ o("div", { className: "max-h-72 space-y-1 overflow-y-auto text-[12px]", children: [
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */
|
|
190
|
+
s.map((d) => /* @__PURE__ */ o("p", { className: "flex items-baseline justify-between gap-2", children: [
|
|
191
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: d.external_api_name ?? d.target ?? d.endpoint_path ?? "ERP push" }),
|
|
192
192
|
/* @__PURE__ */ o(
|
|
193
193
|
"span",
|
|
194
194
|
{
|
|
@@ -216,14 +216,14 @@ function K({ collection: a, itemId: t }) {
|
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
218
218
|
function S({ collection: a, itemId: t }) {
|
|
219
|
-
const
|
|
219
|
+
const r = h(), { data: s = [], isLoading: l } = p({
|
|
220
220
|
queryKey: ["record-owner-history", a, t],
|
|
221
|
-
queryFn: () =>
|
|
221
|
+
queryFn: () => r.request(u(`/owner-history/${a}/${t}`)).then((e) => e.data),
|
|
222
222
|
staleTime: 3e4
|
|
223
223
|
});
|
|
224
|
-
return l ? /* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
|
|
224
|
+
return l ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : s.length === 0 ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-400", children: "No workflow history on this record." }) : /* @__PURE__ */ o("div", { className: "max-h-72 space-y-2 overflow-y-auto text-[12px]", children: [
|
|
225
|
+
/* @__PURE__ */ n("p", { className: "text-[10.5px] text-amber-600 dark:text-amber-400", children: "Owners shown are resolved with TODAY's matrix config — membership changes since then aren't snapshotted." }),
|
|
226
|
+
s.map((e, i) => (
|
|
227
227
|
// biome-ignore lint/suspicious/noArrayIndexKey: ordered stays
|
|
228
228
|
/* @__PURE__ */ o("div", { children: [
|
|
229
229
|
/* @__PURE__ */ o("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
|
|
@@ -236,7 +236,7 @@ function S({ collection: a, itemId: t }) {
|
|
|
236
236
|
e.moved_by ? ` · moved by ${e.moved_by}` : ""
|
|
237
237
|
] })
|
|
238
238
|
] }),
|
|
239
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ n("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: e.owners.length > 0 ? e.owners.map((c) => c.name).join(", ") : "no resolved owners" })
|
|
240
240
|
] }, i)
|
|
241
241
|
))
|
|
242
242
|
] });
|
|
@@ -251,16 +251,16 @@ const R = {
|
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
function j(a) {
|
|
254
|
-
const t = a.split(/[,;]/).map((
|
|
255
|
-
return t.slice(0, 2).map((
|
|
254
|
+
const t = a.split(/[,;]/).map((s) => s.trim()).filter(Boolean);
|
|
255
|
+
return t.slice(0, 2).map((s) => s.split("@")[0]).join(", ") + (t.length > 2 ? ` +${t.length - 2}` : "");
|
|
256
256
|
}
|
|
257
257
|
function E({ collection: a, itemId: t }) {
|
|
258
|
-
const
|
|
258
|
+
const r = h(), { data: s = [], isLoading: l } = p({
|
|
259
259
|
queryKey: ["record-mail-log", a, t],
|
|
260
|
-
queryFn: () =>
|
|
260
|
+
queryFn: () => r.request(u(`/mail-log/record/${a}/${t}`)).then((e) => e.data ?? []).catch(() => []),
|
|
261
261
|
staleTime: 3e4
|
|
262
262
|
});
|
|
263
|
-
return l ? /* @__PURE__ */
|
|
263
|
+
return l ? /* @__PURE__ */ n("p", { className: "p-3 text-[12px] text-slate-400", children: "Loading…" }) : s.length === 0 ? /* @__PURE__ */ n("p", { className: "p-3 text-[12px] text-slate-400", children: "No emails have been sent about this record." }) : /* @__PURE__ */ n("div", { className: "max-h-80 overflow-y-auto", children: s.map((e) => {
|
|
264
264
|
const i = R[e.status] ?? {
|
|
265
265
|
label: e.status,
|
|
266
266
|
cls: "bg-slate-500/10 text-slate-500"
|
|
@@ -271,7 +271,7 @@ function E({ collection: a, itemId: t }) {
|
|
|
271
271
|
className: "border-t border-slate-100 py-2 first:border-t-0 dark:border-border/50",
|
|
272
272
|
children: [
|
|
273
273
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-2", children: [
|
|
274
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ n(
|
|
275
275
|
"p",
|
|
276
276
|
{
|
|
277
277
|
className: "min-w-0 text-[12px] leading-snug text-slate-700 [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden dark:text-slate-200",
|
|
@@ -279,7 +279,7 @@ function E({ collection: a, itemId: t }) {
|
|
|
279
279
|
children: e.subject
|
|
280
280
|
}
|
|
281
281
|
),
|
|
282
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ n(
|
|
283
283
|
"span",
|
|
284
284
|
{
|
|
285
285
|
className: `shrink-0 rounded-full px-1.5 py-px text-[10px] font-medium ${i.cls}`,
|
|
@@ -293,12 +293,12 @@ function E({ collection: a, itemId: t }) {
|
|
|
293
293
|
j(e.to)
|
|
294
294
|
] }),
|
|
295
295
|
" · ",
|
|
296
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ n("span", { "data-tip": v(e.created_at), children: new Date(e.created_at).toLocaleDateString(void 0, {
|
|
297
297
|
month: "short",
|
|
298
298
|
day: "numeric"
|
|
299
299
|
}) })
|
|
300
300
|
] }),
|
|
301
|
-
e.status === "failed" && e.error && /* @__PURE__ */
|
|
301
|
+
e.status === "failed" && e.error && /* @__PURE__ */ n(
|
|
302
302
|
"p",
|
|
303
303
|
{
|
|
304
304
|
className: "mt-0.5 truncate rounded bg-red-500/5 px-1.5 py-0.5 text-[10.5px] text-red-600 dark:text-red-400",
|
|
@@ -313,30 +313,30 @@ function E({ collection: a, itemId: t }) {
|
|
|
313
313
|
}) });
|
|
314
314
|
}
|
|
315
315
|
function Q({ collection: a, itemId: t }) {
|
|
316
|
-
const
|
|
316
|
+
const r = h(), { data: s = [], isLoading: l } = p({
|
|
317
317
|
queryKey: ["record-chat-mentions", a, t],
|
|
318
|
-
queryFn: () =>
|
|
318
|
+
queryFn: () => r.request(u(`/chat/record-mentions/${a}/${t}`)).then((i) => i.data ?? []).catch(() => []),
|
|
319
319
|
staleTime: 6e4
|
|
320
320
|
});
|
|
321
|
-
if (l) return /* @__PURE__ */
|
|
322
|
-
if (
|
|
323
|
-
return /* @__PURE__ */
|
|
321
|
+
if (l) return /* @__PURE__ */ n("p", { className: "p-3 text-[12px] text-slate-400", children: "Loading…" });
|
|
322
|
+
if (s.length === 0)
|
|
323
|
+
return /* @__PURE__ */ n("p", { className: "p-3 text-[12px] text-slate-400", children: "No chat messages mention this record outside its own room." });
|
|
324
324
|
const e = (i) => i === "global" ? "#global" : i.startsWith("ch:") ? `#${i.slice(3)}` : i.startsWith("dm:") ? "a direct message" : i;
|
|
325
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ n("div", { className: "max-h-72 overflow-y-auto", children: s.map((i) => /* @__PURE__ */ o(
|
|
326
326
|
"div",
|
|
327
327
|
{
|
|
328
328
|
className: "border-b border-slate-100 px-3 py-1.5 last:border-b-0 dark:border-border/50",
|
|
329
329
|
children: [
|
|
330
330
|
/* @__PURE__ */ o("p", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
331
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: i.sender_name ?? "Someone" }),
|
|
332
332
|
" ",
|
|
333
333
|
/* @__PURE__ */ o("span", { className: "text-slate-400", children: [
|
|
334
334
|
"in ",
|
|
335
335
|
e(i.room)
|
|
336
336
|
] })
|
|
337
337
|
] }),
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ n("p", { className: "truncate text-[11.5px] text-slate-500", children: i.message.slice(0, 160) }),
|
|
339
|
+
/* @__PURE__ */ n("p", { className: "text-[10px] text-slate-400", children: v(i.date_created) })
|
|
340
340
|
]
|
|
341
341
|
},
|
|
342
342
|
i.id
|
|
@@ -1,52 +1,64 @@
|
|
|
1
|
-
import { useQueries as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useNivaroClient as
|
|
4
|
-
import { get as
|
|
5
|
-
|
|
1
|
+
import { useQueries as m } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo as h } from "react";
|
|
3
|
+
import { useNivaroClient as w } from "../../context.js";
|
|
4
|
+
import { get as j } from "../../lib/commands.js";
|
|
5
|
+
const p = (e) => String((e != null && typeof e == "object" ? e.id : e) ?? "");
|
|
6
|
+
function _(e, c) {
|
|
7
|
+
let r = null;
|
|
8
|
+
for (const [i, d] of Object.entries(e)) {
|
|
9
|
+
const l = i.indexOf(".");
|
|
10
|
+
if (l <= 0 || i in c) continue;
|
|
11
|
+
const s = i.slice(0, l);
|
|
12
|
+
!(s in c) || p(e[s]) !== p(c[s]) || (r ?? (r = { ...c }), r[i] = d);
|
|
13
|
+
}
|
|
14
|
+
return r ?? c;
|
|
15
|
+
}
|
|
16
|
+
function y(e, c, r, i) {
|
|
6
17
|
const d = [];
|
|
7
|
-
for (const l of
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const [t,
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
!
|
|
18
|
+
for (const l of e) {
|
|
19
|
+
const s = l.split(".");
|
|
20
|
+
if (s.length !== 2 || !s[0] || !s[1]) continue;
|
|
21
|
+
const [t, n] = s, o = c[t], a = o != null && typeof o == "object" ? o.id : o;
|
|
22
|
+
if (a == null || a === "") continue;
|
|
23
|
+
const u = r[t], f = u != null && typeof u == "object" ? u.id : u;
|
|
24
|
+
!i && String(f ?? "") === String(a) || d.push({ path: l, hop: t, rest: n, id: String(a) });
|
|
14
25
|
}
|
|
15
26
|
return d;
|
|
16
27
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
(
|
|
28
|
+
function b(e) {
|
|
29
|
+
const c = w(), r = y(e.paths, e.draft, e.saved, e.isNew).map((t) => {
|
|
30
|
+
const n = e.relations.find(
|
|
31
|
+
(o) => o.many_collection === e.collection && o.many_field === t.hop && !o.junction_field
|
|
21
32
|
);
|
|
22
|
-
return
|
|
23
|
-
}).filter((t) => !!t),
|
|
24
|
-
for (const t of
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
return n != null && n.one_collection ? { ...t, target: n.one_collection } : null;
|
|
34
|
+
}).filter((t) => !!t), i = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const t of r) {
|
|
36
|
+
const n = `${t.target}:${t.id}`, o = i.get(n) ?? { target: t.target, id: t.id, fields: /* @__PURE__ */ new Set() };
|
|
37
|
+
o.fields.add(t.rest), i.set(n, o);
|
|
27
38
|
}
|
|
28
|
-
const d = [...
|
|
39
|
+
const d = [...i.values()], l = m({
|
|
29
40
|
queries: d.map((t) => ({
|
|
30
41
|
queryKey: ["header-path-preview", t.target, t.id, [...t.fields].sort().join(",")],
|
|
31
|
-
queryFn: () =>
|
|
32
|
-
|
|
42
|
+
queryFn: () => c.request(
|
|
43
|
+
j(`/items/${t.target}/${encodeURIComponent(t.id)}`, {
|
|
33
44
|
fields: [...t.fields].join(",")
|
|
34
45
|
})
|
|
35
|
-
).then((
|
|
46
|
+
).then((n) => n.data ?? null).catch(() => null),
|
|
36
47
|
staleTime: 3e4
|
|
37
48
|
}))
|
|
38
|
-
}),
|
|
39
|
-
return
|
|
40
|
-
var
|
|
49
|
+
}), s = l.map((t) => t.dataUpdatedAt).join(",");
|
|
50
|
+
return h(() => {
|
|
51
|
+
var n;
|
|
41
52
|
const t = {};
|
|
42
|
-
for (const
|
|
43
|
-
const
|
|
44
|
-
|
|
53
|
+
for (const o of r) {
|
|
54
|
+
const a = d.findIndex((f) => f.target === o.target && f.id === o.id), u = (n = l[a]) == null ? void 0 : n.data;
|
|
55
|
+
u && (t[o.path] = u[o.rest] ?? null);
|
|
45
56
|
}
|
|
46
57
|
return t;
|
|
47
|
-
}, [
|
|
58
|
+
}, [s, r.map((t) => `${t.path}=${t.id}`).join("|")]);
|
|
48
59
|
}
|
|
49
60
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
_ as keepResolvedPaths,
|
|
62
|
+
y as pathsToPreview,
|
|
63
|
+
b as useHeaderPathPreview
|
|
52
64
|
};
|
|
@@ -81,7 +81,6 @@ function w({ delivery: n, mailLogUrl: e, onNavigate: s, className: o }) {
|
|
|
81
81
|
{
|
|
82
82
|
type: "button",
|
|
83
83
|
"data-tip": `${a.tip} · open mail log`,
|
|
84
|
-
title: a.tip,
|
|
85
84
|
onClick: (p) => {
|
|
86
85
|
p.stopPropagation(), s == null || s(i);
|
|
87
86
|
},
|
|
@@ -89,7 +88,7 @@ function w({ delivery: n, mailLogUrl: e, onNavigate: s, className: o }) {
|
|
|
89
88
|
children: t
|
|
90
89
|
},
|
|
91
90
|
a.key
|
|
92
|
-
) : /* @__PURE__ */ m("span", { "data-tip": a.tip,
|
|
91
|
+
) : /* @__PURE__ */ m("span", { "data-tip": a.tip, className: d, children: t }, a.key);
|
|
93
92
|
})
|
|
94
93
|
}
|
|
95
94
|
);
|