@nivaro/react 0.3.132 → 0.3.133
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.
|
@@ -10,7 +10,7 @@ import { noteReplayIdle as Me, createReplayIdleState as Ne, REPLAY_IDLE_RESTART_
|
|
|
10
10
|
import { noteReplayEvent as Ue, createReplayCheckoutState as We } from "../shared/lib/replay-checkout.js";
|
|
11
11
|
import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
|
|
12
12
|
import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
|
|
13
|
-
const ze = "nivaro-react@0.3.
|
|
13
|
+
const ze = "nivaro-react@0.3.133", V = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, X = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
14
14
|
function Je(o) {
|
|
15
15
|
return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
|
|
16
16
|
const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Info as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { toLocalDateString as
|
|
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,
|
|
1
|
+
import { jsxs as l, jsx as d, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as x } from "@tanstack/react-query";
|
|
3
|
+
import { Info as k } from "lucide-react";
|
|
4
|
+
import { useState as v, useRef as _, useEffect as $ } from "react";
|
|
5
|
+
import { useNivaroClient as m } from "../../context.js";
|
|
6
|
+
import { get as h } from "../../lib/commands.js";
|
|
7
|
+
import { toLocalDateString as g, formatDateTime as y } from "../../lib/utils.js";
|
|
8
|
+
function P(a, t, i) {
|
|
9
|
+
for (const n of [
|
|
10
|
+
["record-audience", t, i],
|
|
11
|
+
["erp-submissions", t, String(i)],
|
|
12
|
+
["integration-obligations", "record", t, String(i)],
|
|
13
|
+
["record-integrations", t, i],
|
|
14
|
+
["record-external-ids", t, i],
|
|
15
|
+
["record-owner-history", t, i],
|
|
16
|
+
["record-mail-log", t, i],
|
|
17
|
+
["record-chat-mentions", t, i]
|
|
18
18
|
])
|
|
19
|
-
a.invalidateQueries({ queryKey:
|
|
19
|
+
a.invalidateQueries({ queryKey: n });
|
|
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
|
-
}),
|
|
21
|
+
function U(a, t, i) {
|
|
22
|
+
a.invalidateQueries({ queryKey: ["item", t, i] }), a.invalidateQueries({ queryKey: ["resolve-paths", t, i] }), a.invalidateQueries({
|
|
23
|
+
predicate: (n) => n.queryKey[0] === "o2m-rows" && String(n.queryKey[3]) === i
|
|
24
|
+
}), a.invalidateQueries({ queryKey: ["child-summary", t, i] }), a.invalidateQueries({ queryKey: ["last-touch", t, i] }), a.invalidateQueries({ queryKey: ["sla-breach", t, i] }), a.invalidateQueries({
|
|
25
|
+
predicate: (n) => (n.queryKey[0] === "item-actions" || n.queryKey[0] === "ext-item-actions") && n.queryKey[1] === t && String(n.queryKey[2]) === i
|
|
26
|
+
}), T(a, t, i);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
a.invalidateQueries({ queryKey: ["comments", t,
|
|
28
|
+
const q = 4e3;
|
|
29
|
+
function T(a, t, i) {
|
|
30
|
+
var r;
|
|
31
|
+
const n = () => {
|
|
32
|
+
a.invalidateQueries({ queryKey: ["comments", t, i] }), a.invalidateQueries({ queryKey: ["comments-related", t, i] });
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
(
|
|
34
|
+
n();
|
|
35
|
+
const c = setTimeout(n, q);
|
|
36
|
+
(r = c.unref) == null || r.call(c);
|
|
37
37
|
}
|
|
38
38
|
function W({
|
|
39
39
|
collection: a,
|
|
40
40
|
itemId: t,
|
|
41
|
-
compact:
|
|
41
|
+
compact: i
|
|
42
42
|
}) {
|
|
43
|
-
const [
|
|
44
|
-
return
|
|
45
|
-
if (!
|
|
46
|
-
const
|
|
47
|
-
var
|
|
48
|
-
(
|
|
43
|
+
const [n, c] = v(!1), [r, e] = v("audience"), o = _(null);
|
|
44
|
+
return $(() => {
|
|
45
|
+
if (!n) return;
|
|
46
|
+
const s = (p) => {
|
|
47
|
+
var u;
|
|
48
|
+
(u = o.current) != null && u.contains(p.target) || c(!1);
|
|
49
49
|
};
|
|
50
|
-
return document.addEventListener("mousedown",
|
|
51
|
-
}, [
|
|
52
|
-
/* @__PURE__ */
|
|
50
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
51
|
+
}, [n]), /* @__PURE__ */ l("div", { ref: o, className: "relative", children: [
|
|
52
|
+
/* @__PURE__ */ d(
|
|
53
53
|
"button",
|
|
54
54
|
{
|
|
55
55
|
type: "button",
|
|
56
|
-
onClick: () =>
|
|
56
|
+
onClick: () => c((s) => !s),
|
|
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: i ? "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__ */ d(k, { className: i ? "h-4 w-4" : "h-3.5 w-3.5" })
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */
|
|
64
|
+
n && /* @__PURE__ */ l("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__ */ d("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(([
|
|
71
|
+
].map(([s, p]) => /* @__PURE__ */ d(
|
|
72
72
|
"button",
|
|
73
73
|
{
|
|
74
74
|
type: "button",
|
|
75
|
-
onClick: () =>
|
|
76
|
-
className:
|
|
77
|
-
children:
|
|
75
|
+
onClick: () => e(s),
|
|
76
|
+
className: r === s ? "whitespace-nowrap rounded-md bg-nvr-cyan/10 px-2 py-1 text-[11.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "whitespace-nowrap rounded-md px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted",
|
|
77
|
+
children: p
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
s
|
|
80
80
|
)) }),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
r === "audience" && /* @__PURE__ */ d(L, { collection: a, itemId: t }),
|
|
82
|
+
r === "integrations" && /* @__PURE__ */ d(S, { collection: a, itemId: t }),
|
|
83
|
+
r === "owners" && /* @__PURE__ */ d(R, { collection: a, itemId: t }),
|
|
84
|
+
r === "mail" && /* @__PURE__ */ d(E, { collection: a, itemId: t }),
|
|
85
|
+
r === "chat" && /* @__PURE__ */ d(Q, { collection: a, itemId: t })
|
|
86
86
|
] })
|
|
87
87
|
] });
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const K = {
|
|
90
90
|
all: "all changes",
|
|
91
91
|
create: "new records",
|
|
92
92
|
update: "updates",
|
|
93
93
|
delete: "deletions",
|
|
94
94
|
workflow_transition: "state changes"
|
|
95
95
|
};
|
|
96
|
-
function
|
|
97
|
-
const
|
|
96
|
+
function L({ collection: a, itemId: t }) {
|
|
97
|
+
const i = m(), { data: n, isLoading: c } = x({
|
|
98
98
|
queryKey: ["record-audience", a, t],
|
|
99
|
-
queryFn: () =>
|
|
99
|
+
queryFn: () => i.request(h(`/audience/${a}/${t}`)).then((e) => e.data),
|
|
100
100
|
staleTime: 3e4
|
|
101
101
|
});
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
return
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
102
|
+
if (c) return /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "Loading…" });
|
|
103
|
+
const r = (n == null ? void 0 : n.people) ?? [];
|
|
104
|
+
return r.length === 0 ? /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "Nobody hears about changes here automatically — no owners, watchers, or subscribers." }) : /* @__PURE__ */ l("div", { className: "max-h-72 overflow-y-auto", children: [
|
|
105
|
+
/* @__PURE__ */ l("p", { className: "pb-1.5 text-[10.5px] text-slate-400", children: [
|
|
106
|
+
r.length,
|
|
107
107
|
" ",
|
|
108
|
-
|
|
108
|
+
r.length === 1 ? "person hears" : "people hear",
|
|
109
109
|
" about changes to this record"
|
|
110
110
|
] }),
|
|
111
|
-
|
|
111
|
+
r.map((e) => /* @__PURE__ */ l(
|
|
112
112
|
"div",
|
|
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__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
/* @__PURE__ */ d("p", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: e.name }),
|
|
117
|
+
/* @__PURE__ */ l("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [
|
|
118
|
+
e.owner && /* @__PURE__ */ d("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
|
+
e.watch_fields.length > 0 && /* @__PURE__ */ l(
|
|
120
120
|
"span",
|
|
121
121
|
{
|
|
122
122
|
className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
123
|
-
"data-tip":
|
|
123
|
+
"data-tip": e.watch_fields.join(", "),
|
|
124
124
|
children: [
|
|
125
125
|
"Chose to watch ",
|
|
126
|
-
|
|
126
|
+
e.watch_fields.length,
|
|
127
127
|
" ",
|
|
128
|
-
|
|
128
|
+
e.watch_fields.length === 1 ? "field" : "fields"
|
|
129
129
|
]
|
|
130
130
|
}
|
|
131
131
|
),
|
|
132
|
-
|
|
132
|
+
e.subscriptions.map((o) => /* @__PURE__ */ l(
|
|
133
133
|
"span",
|
|
134
134
|
{
|
|
135
135
|
className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
136
136
|
children: [
|
|
137
|
-
|
|
137
|
+
o.reason ?? `Subscribed to ${K[o.event_type] ?? o.event_type}`,
|
|
138
138
|
" ·",
|
|
139
139
|
" ",
|
|
140
|
-
|
|
140
|
+
o.cadence
|
|
141
141
|
]
|
|
142
142
|
},
|
|
143
|
-
`${
|
|
143
|
+
`${o.event_type}:${o.cadence}:${o.reason ?? ""}`
|
|
144
144
|
))
|
|
145
145
|
] })
|
|
146
146
|
]
|
|
147
147
|
},
|
|
148
|
-
|
|
148
|
+
e.id
|
|
149
149
|
))
|
|
150
150
|
] });
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
const
|
|
152
|
+
function S({ collection: a, itemId: t }) {
|
|
153
|
+
const i = m(), { data: n = [], isLoading: c } = x({
|
|
154
154
|
queryKey: ["erp-submissions", a, String(t)],
|
|
155
|
-
queryFn: () =>
|
|
156
|
-
|
|
157
|
-
).then((
|
|
155
|
+
queryFn: () => i.request(
|
|
156
|
+
h(`/erp-submissions/${a}/${encodeURIComponent(t)}`)
|
|
157
|
+
).then((s) => s.data ?? []).catch(() => []),
|
|
158
158
|
staleTime: 3e4
|
|
159
|
-
}), { data:
|
|
159
|
+
}), { data: r, isLoading: e } = x({
|
|
160
160
|
queryKey: ["record-integrations", a, t],
|
|
161
|
-
queryFn: () =>
|
|
161
|
+
queryFn: () => i.request(h(`/record-integrations/${a}/${t}`)).then((s) => s.data),
|
|
162
162
|
staleTime: 3e4
|
|
163
|
-
}), { data:
|
|
163
|
+
}), { data: o = [] } = x({
|
|
164
164
|
queryKey: ["record-external-ids", a, t],
|
|
165
|
-
queryFn: () =>
|
|
166
|
-
const
|
|
167
|
-
return Object.entries(
|
|
165
|
+
queryFn: () => i.request(h(`/items/${a}/${t}`)).then((s) => {
|
|
166
|
+
const p = s.data ?? {}, u = /(external|nuvolo|mwf|oracle|sap|erp|legacy|fusion|mdsi).*(id|number|ref)|^(order_number|requisition_id|sales_order_id)$/i;
|
|
167
|
+
return Object.entries(p).filter(([b, f]) => b !== "id" && f != null && f !== "" && u.test(b)).map(([b, f]) => ({ field: b, value: String(f).slice(0, 60) })).slice(0, 12);
|
|
168
168
|
}).catch(() => []),
|
|
169
169
|
staleTime: 6e4
|
|
170
170
|
});
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
171
|
+
return e || c ? /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : n.length + ((r == null ? void 0 : r.webhooks.length) ?? 0) === 0 ? /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "No integration activity for this record." }) : /* @__PURE__ */ l(N, { children: [
|
|
172
|
+
o.length > 0 && /* @__PURE__ */ l("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border/50", children: [
|
|
173
|
+
/* @__PURE__ */ d("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "External identifiers" }),
|
|
174
|
+
/* @__PURE__ */ d("div", { className: "mt-1 flex flex-wrap gap-1.5", children: o.map((s) => /* @__PURE__ */ l(
|
|
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",
|
|
178
178
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
|
|
179
|
+
/* @__PURE__ */ l("span", { className: "text-slate-400", children: [
|
|
180
|
+
s.field,
|
|
181
181
|
":"
|
|
182
182
|
] }),
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ d("span", { className: "font-mono text-slate-700 dark:text-slate-200", children: s.value })
|
|
184
184
|
]
|
|
185
185
|
},
|
|
186
|
-
|
|
186
|
+
s.field
|
|
187
187
|
)) })
|
|
188
188
|
] }),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ l("div", { className: "max-h-72 space-y-1 overflow-y-auto text-[12px]", children: [
|
|
190
|
+
n.map((s) => /* @__PURE__ */ l("p", { className: "flex items-baseline justify-between gap-2", children: [
|
|
191
|
+
/* @__PURE__ */ d("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: s.external_api_name ?? s.target ?? s.endpoint_path ?? "ERP push" }),
|
|
192
|
+
/* @__PURE__ */ l(
|
|
193
193
|
"span",
|
|
194
194
|
{
|
|
195
|
-
className:
|
|
195
|
+
className: s.status === "failed" ? "shrink-0 text-red-500" : s.status === "accepted" ? "shrink-0 text-emerald-600" : "shrink-0 text-slate-400",
|
|
196
196
|
children: [
|
|
197
|
-
|
|
197
|
+
s.status,
|
|
198
198
|
" · ",
|
|
199
|
-
|
|
199
|
+
g(s.created_at)
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
|
-
] }, `e${
|
|
204
|
-
|
|
205
|
-
/* @__PURE__ */
|
|
203
|
+
] }, `e${s.id}`)),
|
|
204
|
+
r == null ? void 0 : r.webhooks.map((s) => /* @__PURE__ */ l("p", { className: "flex items-baseline justify-between gap-2", children: [
|
|
205
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: [
|
|
206
206
|
"webhook: ",
|
|
207
|
-
|
|
207
|
+
s.webhook
|
|
208
208
|
] }),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
|
|
209
|
+
/* @__PURE__ */ l("span", { className: "shrink-0 text-slate-400", children: [
|
|
210
|
+
s.response_status,
|
|
211
211
|
" · ",
|
|
212
|
-
|
|
212
|
+
g(s.created_at)
|
|
213
213
|
] })
|
|
214
|
-
] }, `w${
|
|
214
|
+
] }, `w${s.id}`))
|
|
215
215
|
] })
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
218
|
+
function R({ collection: a, itemId: t }) {
|
|
219
|
+
const i = m(), { data: n = [], isLoading: c } = x({
|
|
220
220
|
queryKey: ["record-owner-history", a, t],
|
|
221
|
-
queryFn: () =>
|
|
221
|
+
queryFn: () => i.request(h(`/owner-history/${a}/${t}`)).then((r) => r.data),
|
|
222
222
|
staleTime: 3e4
|
|
223
223
|
});
|
|
224
|
-
return
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
|
|
224
|
+
return c ? /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : n.length === 0 ? /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-400", children: "No workflow history on this record." }) : /* @__PURE__ */ l("div", { className: "max-h-72 space-y-2 overflow-y-auto text-[12px]", children: [
|
|
225
|
+
/* @__PURE__ */ d("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
|
+
n.map((r, e) => (
|
|
227
227
|
// biome-ignore lint/suspicious/noArrayIndexKey: ordered stays
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
|
|
228
|
+
/* @__PURE__ */ l("div", { children: [
|
|
229
|
+
/* @__PURE__ */ l("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
|
|
230
|
+
r.state_label ?? "—",
|
|
231
231
|
" ",
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
232
|
+
/* @__PURE__ */ l("span", { className: "font-normal text-[10.5px] text-slate-400", children: [
|
|
233
|
+
g(r.entered_at),
|
|
234
234
|
" → ",
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
r.left_at ? g(r.left_at) : "now",
|
|
236
|
+
r.moved_by ? ` · moved by ${r.moved_by}` : ""
|
|
237
237
|
] })
|
|
238
238
|
] }),
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
] },
|
|
239
|
+
/* @__PURE__ */ d("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: r.owners.length > 0 ? r.owners.map((o) => o.name).join(", ") : "no resolved owners" })
|
|
240
|
+
] }, e)
|
|
241
241
|
))
|
|
242
242
|
] });
|
|
243
243
|
}
|
|
244
|
-
const
|
|
244
|
+
const w = {
|
|
245
245
|
sent: { label: "Sent", cls: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
|
|
246
246
|
failed: { label: "Failed", cls: "bg-red-500/10 text-red-600 dark:text-red-400" },
|
|
247
247
|
deferred: { label: "In daily digest", cls: "bg-amber-500/10 text-amber-600 dark:text-amber-400" },
|
|
@@ -251,27 +251,36 @@ 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((n) => n.trim()).filter(Boolean);
|
|
255
|
+
return t.slice(0, 2).map((n) => n.split("@")[0]).join(", ") + (t.length > 2 ? ` +${t.length - 2}` : "");
|
|
256
256
|
}
|
|
257
257
|
function E({ collection: a, itemId: t }) {
|
|
258
|
-
const
|
|
258
|
+
const i = m(), { data: n = [], isLoading: c } = x({
|
|
259
259
|
queryKey: ["record-mail-log", a, t],
|
|
260
|
-
queryFn: () =>
|
|
260
|
+
queryFn: () => i.request(h(`/mail-log/record/${a}/${t}`)).then((e) => e.data ?? []).catch(() => []),
|
|
261
261
|
staleTime: 3e4
|
|
262
262
|
});
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
if (c) return /* @__PURE__ */ d("p", { className: "p-3 text-[12px] text-slate-400", children: "Loading…" });
|
|
264
|
+
if (n.length === 0)
|
|
265
|
+
return /* @__PURE__ */ d("p", { className: "p-3 text-[12px] text-slate-400", children: "No emails have been sent about this record." });
|
|
266
|
+
const r = /* @__PURE__ */ new Map();
|
|
267
|
+
for (const e of n) {
|
|
268
|
+
if (e.resend_of == null) continue;
|
|
269
|
+
const o = r.get(Number(e.resend_of)) ?? [];
|
|
270
|
+
o.push(e), r.set(Number(e.resend_of), o);
|
|
271
|
+
}
|
|
272
|
+
return /* @__PURE__ */ d("div", { className: "max-h-80 overflow-y-auto", children: n.map((e) => {
|
|
273
|
+
const o = w[e.status] ?? {
|
|
265
274
|
label: e.status,
|
|
266
275
|
cls: "bg-slate-500/10 text-slate-500"
|
|
267
|
-
};
|
|
268
|
-
return /* @__PURE__ */
|
|
276
|
+
}, s = r.get(e.id) ?? [], p = s[0], u = p ? w[p.status] ?? { label: p.status, cls: o.cls } : null;
|
|
277
|
+
return /* @__PURE__ */ l(
|
|
269
278
|
"div",
|
|
270
279
|
{
|
|
271
280
|
className: "border-t border-slate-100 py-2 first:border-t-0 dark:border-border/50",
|
|
272
281
|
children: [
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ l("div", { className: "flex items-start justify-between gap-2", children: [
|
|
283
|
+
/* @__PURE__ */ d(
|
|
275
284
|
"p",
|
|
276
285
|
{
|
|
277
286
|
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,26 +288,36 @@ function E({ collection: a, itemId: t }) {
|
|
|
279
288
|
children: e.subject
|
|
280
289
|
}
|
|
281
290
|
),
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
"span",
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
/* @__PURE__ */ l("span", { className: "flex shrink-0 flex-col items-end gap-0.5", children: [
|
|
292
|
+
/* @__PURE__ */ d("span", { className: `rounded-full px-1.5 py-px text-[10px] font-medium ${o.cls}`, children: e.resend_of != null ? `Resend · ${o.label}` : o.label }),
|
|
293
|
+
p && u && /* @__PURE__ */ l(
|
|
294
|
+
"span",
|
|
295
|
+
{
|
|
296
|
+
"data-mail-resend-chip": p.status,
|
|
297
|
+
"data-tip": `Resent ${s.length === 1 ? "once" : `${s.length} times`} · last ${y(p.created_at)}`,
|
|
298
|
+
className: `whitespace-nowrap rounded-full px-1.5 py-px text-[10px] font-medium ${u.cls}`,
|
|
299
|
+
children: [
|
|
300
|
+
"Resent",
|
|
301
|
+
s.length > 1 ? ` ×${s.length}` : "",
|
|
302
|
+
" · ",
|
|
303
|
+
u.label
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
] })
|
|
289
308
|
] }),
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ l("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
|
|
310
|
+
/* @__PURE__ */ l("span", { "data-tip": e.to, children: [
|
|
292
311
|
"to ",
|
|
293
312
|
j(e.to)
|
|
294
313
|
] }),
|
|
295
314
|
" · ",
|
|
296
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ d("span", { "data-tip": y(e.created_at), children: new Date(e.created_at).toLocaleDateString(void 0, {
|
|
297
316
|
month: "short",
|
|
298
317
|
day: "numeric"
|
|
299
318
|
}) })
|
|
300
319
|
] }),
|
|
301
|
-
e.status === "failed" && e.error && /* @__PURE__ */
|
|
320
|
+
e.status === "failed" && e.error && /* @__PURE__ */ d(
|
|
302
321
|
"p",
|
|
303
322
|
{
|
|
304
323
|
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,39 +332,39 @@ function E({ collection: a, itemId: t }) {
|
|
|
313
332
|
}) });
|
|
314
333
|
}
|
|
315
334
|
function Q({ collection: a, itemId: t }) {
|
|
316
|
-
const
|
|
335
|
+
const i = m(), { data: n = [], isLoading: c } = x({
|
|
317
336
|
queryKey: ["record-chat-mentions", a, t],
|
|
318
|
-
queryFn: () =>
|
|
337
|
+
queryFn: () => i.request(h(`/chat/record-mentions/${a}/${t}`)).then((e) => e.data ?? []).catch(() => []),
|
|
319
338
|
staleTime: 6e4
|
|
320
339
|
});
|
|
321
|
-
if (
|
|
322
|
-
if (
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
const
|
|
325
|
-
return /* @__PURE__ */
|
|
340
|
+
if (c) return /* @__PURE__ */ d("p", { className: "p-3 text-[12px] text-slate-400", children: "Loading…" });
|
|
341
|
+
if (n.length === 0)
|
|
342
|
+
return /* @__PURE__ */ d("p", { className: "p-3 text-[12px] text-slate-400", children: "No chat messages mention this record outside its own room." });
|
|
343
|
+
const r = (e) => e === "global" ? "#global" : e.startsWith("ch:") ? `#${e.slice(3)}` : e.startsWith("dm:") ? "a direct message" : e;
|
|
344
|
+
return /* @__PURE__ */ d("div", { className: "max-h-72 overflow-y-auto", children: n.map((e) => /* @__PURE__ */ l(
|
|
326
345
|
"div",
|
|
327
346
|
{
|
|
328
347
|
className: "border-b border-slate-100 px-3 py-1.5 last:border-b-0 dark:border-border/50",
|
|
329
348
|
children: [
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ l("p", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
350
|
+
/* @__PURE__ */ d("span", { className: "font-medium", children: e.sender_name ?? "Someone" }),
|
|
332
351
|
" ",
|
|
333
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ l("span", { className: "text-slate-400", children: [
|
|
334
353
|
"in ",
|
|
335
|
-
e
|
|
354
|
+
r(e.room)
|
|
336
355
|
] })
|
|
337
356
|
] }),
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ d("p", { className: "truncate text-[11.5px] text-slate-500", children: e.message.slice(0, 160) }),
|
|
358
|
+
/* @__PURE__ */ d("p", { className: "text-[10px] text-slate-400", children: y(e.date_created) })
|
|
340
359
|
]
|
|
341
360
|
},
|
|
342
|
-
|
|
361
|
+
e.id
|
|
343
362
|
)) });
|
|
344
363
|
}
|
|
345
364
|
export {
|
|
346
|
-
|
|
365
|
+
q as NOTES_SETTLE_MS,
|
|
347
366
|
W as RecordInsightsButton,
|
|
348
367
|
U as invalidateRecordData,
|
|
349
368
|
P as invalidateRecordInsights,
|
|
350
|
-
|
|
369
|
+
T as invalidateRecordNotes
|
|
351
370
|
};
|