@nivaro/react 0.3.14 → 0.3.16
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 +127 -6
- package/dist/index.js +736 -734
- package/dist/shared/components/CollectionBrowserView.js +2316 -2281
- package/dist/shared/components/ItemEditForm.js +3773 -3604
- package/dist/shared/components/RecordGridEditor.js +319 -282
- package/dist/shared/components/RecordReadView.js +202 -200
- package/dist/shared/components/cbv/unknown-fields.js +18 -8
- package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
- package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
- package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
- package/dist/shared/components/item-edit/FieldRow.js +198 -184
- package/dist/shared/components/item-edit/HeaderTools.js +107 -99
- package/dist/shared/components/item-edit/InlineTableField.js +138 -136
- package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
- package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
- package/dist/shared/components/item-edit/column-length.js +12 -0
- package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
- package/dist/shared/components/panels/ItemLockBanner.js +307 -285
- package/dist/shared/components/panels/PipelinePanel.js +486 -465
- package/dist/shared/components/panels/RevisionsPanel.js +210 -204
- package/dist/shared/components/profile/DelegationCard.js +178 -121
- package/dist/shared/components/profile/PersonActivity.js +152 -139
- package/dist/shared/components/queue/QueueWorklist.js +668 -659
- package/dist/shared/components/queue/transition-note.js +90 -0
- package/dist/shared/components/support/SupportRequestDialog.js +100 -89
- package/dist/shared/components/support/TicketDetailSheet.js +104 -91
- package/dist/shared/lib/autofill-runs.js +33 -26
- package/dist/shared/lib/draft-store.js +40 -24
- package/dist/shared/lib/live-queries.js +10 -9
- package/dist/shared/lib/restore-skipped.js +10 -0
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as a, jsxs as r, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { useTopicPresence as
|
|
8
|
-
import { replayHref as
|
|
9
|
-
import { TaskDoButton as
|
|
10
|
-
import { RelationCombobox as
|
|
11
|
-
import { SimpleSelect as
|
|
12
|
-
import { Sheet as
|
|
13
|
-
import { TicketTraffic as
|
|
14
|
-
import { STATUS_TONE as
|
|
15
|
-
const
|
|
1
|
+
import { jsx as a, jsxs as r, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as O, useQuery as _, useMutation as f } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as H, PlayCircle as W, Paperclip as B } from "lucide-react";
|
|
4
|
+
import { useState as S } from "react";
|
|
5
|
+
import { useNivaroClient as G, useApiFetchConfig as M, useItemNavigation as z, useNavigation as J } from "../../context.js";
|
|
6
|
+
import { get as q, post as T, patch as V } from "../../lib/commands.js";
|
|
7
|
+
import { useTopicPresence as X, signalSentence as C } from "../../lib/presence-signals.js";
|
|
8
|
+
import { replayHref as Y } from "../../lib/replay-capture.js";
|
|
9
|
+
import { TaskDoButton as Z } from "../ai/TaskDo.js";
|
|
10
|
+
import { RelationCombobox as I } from "../item-edit/RelationCombobox.js";
|
|
11
|
+
import { SimpleSelect as $ } from "../ui/SimpleSelect.js";
|
|
12
|
+
import { Sheet as ee, SheetContent as te, SheetTitle as K, SheetDescription as F, SheetHeader as ae } from "../ui/sheet.js";
|
|
13
|
+
import { TicketTraffic as re } from "./TicketTraffic.js";
|
|
14
|
+
import { STATUS_TONE as R } from "./types.js";
|
|
15
|
+
const P = [
|
|
16
16
|
{ value: "open", label: "Open" },
|
|
17
17
|
{ value: "in_progress", label: "In progress" },
|
|
18
18
|
{ value: "done", label: "Done" },
|
|
19
19
|
{ value: "cancelled", label: "Cancelled" }
|
|
20
20
|
];
|
|
21
|
-
function
|
|
21
|
+
function b(n) {
|
|
22
22
|
return n ? new Date(n).toLocaleString(void 0, {
|
|
23
23
|
month: "short",
|
|
24
24
|
day: "numeric",
|
|
@@ -26,92 +26,105 @@ function y(n) {
|
|
|
26
26
|
minute: "2-digit"
|
|
27
27
|
}) : "";
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
var
|
|
29
|
+
function ne({ status: n, label: c }) {
|
|
30
|
+
var l;
|
|
31
31
|
return /* @__PURE__ */ a(
|
|
32
32
|
"span",
|
|
33
33
|
{
|
|
34
34
|
"data-ticket-status": n,
|
|
35
|
-
className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${
|
|
36
|
-
children: c ?? ((
|
|
35
|
+
className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${R[n] ?? R.open}`,
|
|
36
|
+
children: c ?? ((l = P.find((i) => i.value === n)) == null ? void 0 : l.label) ?? n
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function be({
|
|
41
41
|
ticketId: n,
|
|
42
42
|
onOpenChange: c
|
|
43
43
|
}) {
|
|
44
|
-
const
|
|
44
|
+
const l = G(), i = O(), { apiBase: j } = M(), { urlFor: D, open: Q } = z(), m = J(), [u, v] = S(""), [k, A] = S(null), o = X(
|
|
45
|
+
n != null && Number.isSafeInteger(n) && n > 0 ? `ticket:${n}` : null
|
|
46
|
+
), p = n != null && Number.isSafeInteger(n) && n > 0, {
|
|
47
|
+
data: e,
|
|
48
|
+
isLoading: U,
|
|
49
|
+
isError: L
|
|
50
|
+
} = _({
|
|
45
51
|
queryKey: ["support-ticket", n],
|
|
46
|
-
queryFn: () =>
|
|
47
|
-
enabled:
|
|
48
|
-
|
|
52
|
+
queryFn: () => l.request(q(`/support/tickets/${n}`)).then((t) => t.data),
|
|
53
|
+
enabled: p,
|
|
54
|
+
retry: (t, s) => {
|
|
55
|
+
const g = s == null ? void 0 : s.status;
|
|
56
|
+
return g !== 404 && g !== 403 && g !== 400 && t < 2;
|
|
57
|
+
}
|
|
58
|
+
}), { data: E = [] } = _({
|
|
49
59
|
queryKey: ["support-categories", "all-for", (e == null ? void 0 : e.collection) ?? null],
|
|
50
|
-
queryFn: () =>
|
|
51
|
-
|
|
60
|
+
queryFn: () => l.request(
|
|
61
|
+
q("/support/categories", e != null && e.collection ? { collection: e.collection } : void 0)
|
|
52
62
|
).then((t) => t.data ?? []),
|
|
53
63
|
enabled: !!(e != null && e.can.work)
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
mutationFn: () =>
|
|
58
|
-
onSuccess:
|
|
59
|
-
onError:
|
|
60
|
-
}),
|
|
61
|
-
mutationFn: (t) =>
|
|
62
|
-
onSuccess:
|
|
63
|
-
onError:
|
|
64
|
-
}),
|
|
65
|
-
mutationFn: () =>
|
|
64
|
+
}), x = () => {
|
|
65
|
+
i.invalidateQueries({ queryKey: ["support-ticket", n] }), i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), i.invalidateQueries({ queryKey: ["my-work"] });
|
|
66
|
+
}, h = (t) => A(t.message || "That did not work"), N = f({
|
|
67
|
+
mutationFn: () => l.request(T(`/support/tickets/${n}/claim`)),
|
|
68
|
+
onSuccess: x,
|
|
69
|
+
onError: h
|
|
70
|
+
}), d = f({
|
|
71
|
+
mutationFn: (t) => l.request(V(`/support/tickets/${n}`, t)),
|
|
72
|
+
onSuccess: x,
|
|
73
|
+
onError: h
|
|
74
|
+
}), w = f({
|
|
75
|
+
mutationFn: () => l.request(T(`/support/tickets/${n}/comments`, { text: u.trim() })),
|
|
66
76
|
onSuccess: () => {
|
|
67
|
-
|
|
77
|
+
v(""), o.signalReplying(!1), x();
|
|
68
78
|
},
|
|
69
|
-
onError:
|
|
79
|
+
onError: h
|
|
70
80
|
});
|
|
71
|
-
return /* @__PURE__ */ a(
|
|
72
|
-
|
|
81
|
+
return /* @__PURE__ */ a(ee, { open: n != null, onOpenChange: c, children: /* @__PURE__ */ a(
|
|
82
|
+
te,
|
|
73
83
|
{
|
|
74
84
|
side: "right",
|
|
75
85
|
className: "flex w-[560px] max-w-[96vw] flex-col gap-0 p-0 sm:max-w-[560px] dark:bg-card",
|
|
76
86
|
"data-support-ticket": n ?? "",
|
|
77
|
-
children:
|
|
78
|
-
/* @__PURE__ */
|
|
87
|
+
children: !p || L ? /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center gap-1 px-6 text-center", children: [
|
|
88
|
+
/* @__PURE__ */ a(K, { className: "text-[14px] font-semibold text-slate-800 dark:text-slate-100", children: "Request not found" }),
|
|
89
|
+
/* @__PURE__ */ a(F, { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: p ? `Request #${n} does not exist, or it is not one you can open.` : "This link does not point to a request." })
|
|
90
|
+
] }) : U || !e ? /* @__PURE__ */ a("div", { className: "flex flex-1 items-center justify-center text-slate-400", children: /* @__PURE__ */ a(H, { className: "h-5 w-5 animate-spin" }) }) : /* @__PURE__ */ r(y, { children: [
|
|
91
|
+
/* @__PURE__ */ r(ae, { className: "border-b border-slate-200 px-5 py-4 dark:border-border", children: [
|
|
79
92
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 pr-6", children: [
|
|
80
93
|
/* @__PURE__ */ r("span", { className: "font-mono text-[11.5px] text-slate-400", children: [
|
|
81
94
|
"#",
|
|
82
95
|
e.id
|
|
83
96
|
] }),
|
|
84
|
-
/* @__PURE__ */ a(
|
|
97
|
+
/* @__PURE__ */ a(ne, { status: e.status, label: e.status_label }),
|
|
85
98
|
e.priority === "urgent" && /* @__PURE__ */ a("span", { className: "rounded bg-red-500/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" })
|
|
86
99
|
] }),
|
|
87
|
-
/* @__PURE__ */ a(
|
|
88
|
-
/* @__PURE__ */ r(
|
|
100
|
+
/* @__PURE__ */ a(K, { className: "mt-1 text-left text-[16px] font-semibold text-slate-900 dark:text-slate-100", children: e.title }),
|
|
101
|
+
/* @__PURE__ */ r(F, { className: "text-left text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
89
102
|
e.requester_name ?? "Someone",
|
|
90
103
|
" · ",
|
|
91
|
-
|
|
104
|
+
b(e.created_at),
|
|
92
105
|
e.category_name ? ` · ${e.category_name}` : ""
|
|
93
106
|
] }),
|
|
94
107
|
/* @__PURE__ */ a("div", { className: "mt-1 text-[12px]", children: e.collection && e.item ? /* @__PURE__ */ a(
|
|
95
108
|
"a",
|
|
96
109
|
{
|
|
97
|
-
href:
|
|
110
|
+
href: D({ collection: e.collection, itemId: e.item }),
|
|
98
111
|
onClick: (t) => {
|
|
99
|
-
t.metaKey || t.ctrlKey || t.shiftKey || t.button !== 0 || (t.preventDefault(),
|
|
112
|
+
t.metaKey || t.ctrlKey || t.shiftKey || t.button !== 0 || (t.preventDefault(), Q({ collection: e.collection, itemId: e.item }));
|
|
100
113
|
},
|
|
101
114
|
"data-ticket-record": !0,
|
|
102
115
|
className: "font-medium text-[#00789a] hover:underline dark:text-nvr-cyan",
|
|
103
116
|
children: e.record_label ?? e.item
|
|
104
117
|
}
|
|
105
118
|
) : /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: "General Support" }) }),
|
|
106
|
-
|
|
119
|
+
o.viewers.length > 0 && /* @__PURE__ */ r(
|
|
107
120
|
"p",
|
|
108
121
|
{
|
|
109
122
|
className: "mt-1 flex items-center gap-1.5 text-[11.5px] text-sky-700 dark:text-sky-300",
|
|
110
123
|
"data-ticket-viewing": !0,
|
|
111
124
|
children: [
|
|
112
125
|
/* @__PURE__ */ a("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400" }),
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
C(
|
|
127
|
+
o.viewers.map((t) => t.name),
|
|
115
128
|
"looking at this"
|
|
116
129
|
)
|
|
117
130
|
]
|
|
@@ -126,15 +139,15 @@ function ge({
|
|
|
126
139
|
className: "grid grid-cols-2 gap-3 rounded-lg border border-slate-200 p-3 dark:border-border",
|
|
127
140
|
children: [
|
|
128
141
|
/* @__PURE__ */ r("div", { className: "col-span-2 flex items-center justify-between gap-2", children: [
|
|
129
|
-
/* @__PURE__ */ a("span", { className: "text-[12px] text-slate-600 dark:text-slate-300", children: e.assignee_name ? /* @__PURE__ */ r(
|
|
142
|
+
/* @__PURE__ */ a("span", { className: "text-[12px] text-slate-600 dark:text-slate-300", children: e.assignee_name ? /* @__PURE__ */ r(y, { children: [
|
|
130
143
|
"Assigned to ",
|
|
131
144
|
/* @__PURE__ */ a("b", { className: "font-medium", children: e.assignee_name })
|
|
132
|
-
] }) : /* @__PURE__ */ r(
|
|
145
|
+
] }) : /* @__PURE__ */ r(y, { children: [
|
|
133
146
|
"Not picked up yet",
|
|
134
147
|
e.team_name ? ` · ${e.team_name}` : " · Administrators"
|
|
135
148
|
] }) }),
|
|
136
149
|
/* @__PURE__ */ a(
|
|
137
|
-
|
|
150
|
+
Z,
|
|
138
151
|
{
|
|
139
152
|
task: {
|
|
140
153
|
id: e.id,
|
|
@@ -144,7 +157,7 @@ function ge({
|
|
|
144
157
|
category_id: e.category_id,
|
|
145
158
|
title: e.title
|
|
146
159
|
},
|
|
147
|
-
onTaskChanged: () => void
|
|
160
|
+
onTaskChanged: () => void i.invalidateQueries({ queryKey: ["support-ticket", n] })
|
|
148
161
|
}
|
|
149
162
|
),
|
|
150
163
|
(e.status === "open" || e.status === "in_progress") && /* @__PURE__ */ a(
|
|
@@ -152,8 +165,8 @@ function ge({
|
|
|
152
165
|
{
|
|
153
166
|
type: "button",
|
|
154
167
|
"data-ticket-claim": !0,
|
|
155
|
-
disabled:
|
|
156
|
-
onClick: () =>
|
|
168
|
+
disabled: N.isPending,
|
|
169
|
+
onClick: () => N.mutate(),
|
|
157
170
|
className: "h-7 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 disabled:opacity-50 dark:text-nvr-cyan",
|
|
158
171
|
children: e.assignee ? "Take it over" : "Pick it up"
|
|
159
172
|
}
|
|
@@ -162,11 +175,11 @@ function ge({
|
|
|
162
175
|
/* @__PURE__ */ r("div", { className: "block text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
|
|
163
176
|
"Status",
|
|
164
177
|
/* @__PURE__ */ a(
|
|
165
|
-
|
|
178
|
+
$,
|
|
166
179
|
{
|
|
167
180
|
value: e.status,
|
|
168
|
-
onChange: (t) =>
|
|
169
|
-
options:
|
|
181
|
+
onChange: (t) => d.mutate({ status: t }),
|
|
182
|
+
options: P,
|
|
170
183
|
ariaLabel: "Status",
|
|
171
184
|
className: "mt-1"
|
|
172
185
|
}
|
|
@@ -175,13 +188,13 @@ function ge({
|
|
|
175
188
|
/* @__PURE__ */ r("div", { className: "block text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
|
|
176
189
|
"Type",
|
|
177
190
|
/* @__PURE__ */ a(
|
|
178
|
-
|
|
191
|
+
$,
|
|
179
192
|
{
|
|
180
193
|
value: e.category_id != null ? String(e.category_id) : "",
|
|
181
|
-
onChange: (t) =>
|
|
194
|
+
onChange: (t) => d.mutate({ category_id: t ? Number(t) : null }),
|
|
182
195
|
options: [
|
|
183
196
|
{ value: "", label: "No type" },
|
|
184
|
-
...
|
|
197
|
+
...E.map((t) => ({ value: String(t.id), label: t.name }))
|
|
185
198
|
],
|
|
186
199
|
ariaLabel: "Type",
|
|
187
200
|
className: "mt-1"
|
|
@@ -191,11 +204,11 @@ function ge({
|
|
|
191
204
|
/* @__PURE__ */ r("div", { className: "col-span-2 text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
|
|
192
205
|
"Assignee",
|
|
193
206
|
/* @__PURE__ */ a("div", { className: "mt-1", children: /* @__PURE__ */ a(
|
|
194
|
-
|
|
207
|
+
I,
|
|
195
208
|
{
|
|
196
209
|
collection: "nivaro_users",
|
|
197
210
|
value: e.assignee,
|
|
198
|
-
onChange: (t) =>
|
|
211
|
+
onChange: (t) => d.mutate({ assignee: t ? String(t) : null }),
|
|
199
212
|
placeholder: "Nobody yet"
|
|
200
213
|
}
|
|
201
214
|
) })
|
|
@@ -207,28 +220,28 @@ function ge({
|
|
|
207
220
|
/* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Request" }),
|
|
208
221
|
/* @__PURE__ */ a("p", { className: "whitespace-pre-wrap text-[13px] leading-relaxed text-slate-800 dark:text-slate-200", children: e.description || /* @__PURE__ */ a("span", { className: "text-slate-400", children: "No details given." }) }),
|
|
209
222
|
e.replay && e.can.work && (() => {
|
|
210
|
-
const t =
|
|
211
|
-
return
|
|
223
|
+
const t = Y(e.replay), s = m.consoleUrl ? m.consoleUrl(t) : t;
|
|
224
|
+
return s ? /* @__PURE__ */ r(
|
|
212
225
|
"a",
|
|
213
226
|
{
|
|
214
|
-
href:
|
|
227
|
+
href: s,
|
|
215
228
|
target: "_blank",
|
|
216
229
|
rel: "noreferrer",
|
|
217
230
|
"data-ticket-replay": e.replay.recording_id,
|
|
218
231
|
className: "mt-2 inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/50 bg-nvr-cyan/10 px-2 py-1 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 dark:text-nvr-cyan",
|
|
219
232
|
children: [
|
|
220
|
-
/* @__PURE__ */ a(
|
|
233
|
+
/* @__PURE__ */ a(W, { className: "h-3.5 w-3.5" }),
|
|
221
234
|
"Watch what they saw"
|
|
222
235
|
]
|
|
223
236
|
}
|
|
224
237
|
) : null;
|
|
225
238
|
})(),
|
|
226
239
|
e.issue_id != null && e.can.work && (() => {
|
|
227
|
-
const t = `/issues/${e.issue_id}`,
|
|
228
|
-
return
|
|
240
|
+
const t = `/issues/${e.issue_id}`, s = m.consoleUrl ? m.consoleUrl(t) : t;
|
|
241
|
+
return s ? /* @__PURE__ */ r(
|
|
229
242
|
"a",
|
|
230
243
|
{
|
|
231
|
-
href:
|
|
244
|
+
href: s,
|
|
232
245
|
target: "_blank",
|
|
233
246
|
rel: "noreferrer",
|
|
234
247
|
"data-ticket-issue": e.issue_id,
|
|
@@ -243,18 +256,18 @@ function ge({
|
|
|
243
256
|
e.files.length > 0 && /* @__PURE__ */ a("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: e.files.map((t) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ r(
|
|
244
257
|
"a",
|
|
245
258
|
{
|
|
246
|
-
href: `${
|
|
259
|
+
href: `${j}/files/${t.id}`,
|
|
247
260
|
target: "_blank",
|
|
248
261
|
rel: "noreferrer",
|
|
249
262
|
className: "inline-flex items-center gap-1 rounded bg-slate-100 px-2 py-0.5 text-[11.5px] text-slate-700 hover:underline dark:bg-white/10 dark:text-slate-200",
|
|
250
263
|
children: [
|
|
251
|
-
/* @__PURE__ */ a(
|
|
264
|
+
/* @__PURE__ */ a(B, { className: "h-3 w-3" }),
|
|
252
265
|
t.title || t.filename_download || "File"
|
|
253
266
|
]
|
|
254
267
|
}
|
|
255
268
|
) }, t.id)) })
|
|
256
269
|
] }),
|
|
257
|
-
e.can.work && /* @__PURE__ */ a(
|
|
270
|
+
e.can.work && /* @__PURE__ */ a(re, { ticketId: e.id }),
|
|
258
271
|
/* @__PURE__ */ r("section", { "data-ticket-thread": !0, children: [
|
|
259
272
|
/* @__PURE__ */ a("h3", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Conversation" }),
|
|
260
273
|
e.thread.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-400", children: "No replies yet." }) : /* @__PURE__ */ a("ul", { className: "space-y-2.5", children: e.thread.map((t) => /* @__PURE__ */ r(
|
|
@@ -264,7 +277,7 @@ function ge({
|
|
|
264
277
|
children: [
|
|
265
278
|
/* @__PURE__ */ r("div", { className: "mb-0.5 flex items-baseline justify-between gap-2 text-[11.5px]", children: [
|
|
266
279
|
/* @__PURE__ */ a("b", { className: "font-medium text-slate-800 dark:text-slate-100", children: t.user_name ?? "Someone" }),
|
|
267
|
-
/* @__PURE__ */ a("span", { className: "text-slate-400", children:
|
|
280
|
+
/* @__PURE__ */ a("span", { className: "text-slate-400", children: b(t.created_at) })
|
|
268
281
|
] }),
|
|
269
282
|
/* @__PURE__ */ a("p", { className: "whitespace-pre-wrap text-[12.5px] text-slate-700 dark:text-slate-200", children: t.text })
|
|
270
283
|
]
|
|
@@ -276,30 +289,30 @@ function ge({
|
|
|
276
289
|
{
|
|
277
290
|
className: "mt-3",
|
|
278
291
|
onSubmit: (t) => {
|
|
279
|
-
t.preventDefault(),
|
|
292
|
+
t.preventDefault(), u.trim() && w.mutate();
|
|
280
293
|
},
|
|
281
294
|
children: [
|
|
282
295
|
/* @__PURE__ */ a(
|
|
283
296
|
"textarea",
|
|
284
297
|
{
|
|
285
298
|
"data-ticket-reply": !0,
|
|
286
|
-
value:
|
|
299
|
+
value: u,
|
|
287
300
|
onChange: (t) => {
|
|
288
|
-
|
|
301
|
+
v(t.target.value), o.signalReplying(!!t.target.value.trim());
|
|
289
302
|
},
|
|
290
303
|
rows: 3,
|
|
291
304
|
placeholder: "Write a reply",
|
|
292
305
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-[12.5px] text-slate-900 outline-none focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100"
|
|
293
306
|
}
|
|
294
307
|
),
|
|
295
|
-
|
|
308
|
+
o.replying.length > 0 && /* @__PURE__ */ r(
|
|
296
309
|
"p",
|
|
297
310
|
{
|
|
298
311
|
className: "mt-1 flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
|
|
299
312
|
"data-ticket-replying": !0,
|
|
300
313
|
children: [
|
|
301
314
|
/* @__PURE__ */ a("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
302
|
-
|
|
315
|
+
C(o.replying, "replying"),
|
|
303
316
|
"…"
|
|
304
317
|
]
|
|
305
318
|
}
|
|
@@ -310,7 +323,7 @@ function ge({
|
|
|
310
323
|
{
|
|
311
324
|
type: "button",
|
|
312
325
|
"data-ticket-cancel": !0,
|
|
313
|
-
onClick: () =>
|
|
326
|
+
onClick: () => d.mutate({ status: "cancelled" }),
|
|
314
327
|
className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500 hover:text-slate-800 dark:hover:text-slate-100",
|
|
315
328
|
children: "Withdraw request"
|
|
316
329
|
}
|
|
@@ -320,7 +333,7 @@ function ge({
|
|
|
320
333
|
{
|
|
321
334
|
type: "button",
|
|
322
335
|
"data-ticket-reopen": !0,
|
|
323
|
-
onClick: () =>
|
|
336
|
+
onClick: () => d.mutate({ status: "open" }),
|
|
324
337
|
className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500 hover:text-slate-800 dark:hover:text-slate-100",
|
|
325
338
|
children: "Reopen"
|
|
326
339
|
}
|
|
@@ -330,7 +343,7 @@ function ge({
|
|
|
330
343
|
{
|
|
331
344
|
type: "submit",
|
|
332
345
|
"data-ticket-send": !0,
|
|
333
|
-
disabled: !
|
|
346
|
+
disabled: !u.trim() || w.isPending,
|
|
334
347
|
className: "h-7 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 disabled:opacity-50 dark:text-nvr-cyan",
|
|
335
348
|
children: "Reply"
|
|
336
349
|
}
|
|
@@ -339,7 +352,7 @@ function ge({
|
|
|
339
352
|
]
|
|
340
353
|
}
|
|
341
354
|
),
|
|
342
|
-
|
|
355
|
+
k && /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-red-600 dark:text-red-400", role: "alert", children: k })
|
|
343
356
|
] }),
|
|
344
357
|
/* @__PURE__ */ r("section", { "data-ticket-history": !0, children: [
|
|
345
358
|
/* @__PURE__ */ a("h3", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "History" }),
|
|
@@ -350,7 +363,7 @@ function ge({
|
|
|
350
363
|
"· ",
|
|
351
364
|
t.user_name ?? "System",
|
|
352
365
|
" · ",
|
|
353
|
-
|
|
366
|
+
b(t.at)
|
|
354
367
|
] })
|
|
355
368
|
] }, t.id)) })
|
|
356
369
|
] })
|
|
@@ -360,6 +373,6 @@ function ge({
|
|
|
360
373
|
) });
|
|
361
374
|
}
|
|
362
375
|
export {
|
|
363
|
-
|
|
364
|
-
|
|
376
|
+
ne as StatusPill,
|
|
377
|
+
be as TicketDetailSheet
|
|
365
378
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useSyncExternalStore as g } from "react";
|
|
2
|
-
import { pollProposal as
|
|
2
|
+
import { pollProposal as A } from "./autofill-poll.js";
|
|
3
3
|
let n = [];
|
|
4
4
|
const r = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), c = "nvr:autofill-runs";
|
|
5
|
-
function
|
|
5
|
+
function R() {
|
|
6
6
|
try {
|
|
7
7
|
const e = n.map((t) => ({
|
|
8
8
|
id: t.id,
|
|
@@ -15,32 +15,35 @@ function h() {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
function a() {
|
|
18
|
-
n = [...n],
|
|
18
|
+
n = [...n], R();
|
|
19
19
|
for (const e of u) e();
|
|
20
20
|
}
|
|
21
21
|
function l(e, t) {
|
|
22
22
|
const o = n.findIndex((i) => i.id === e);
|
|
23
23
|
o < 0 || (n[o] = { ...n[o], ...t }, a());
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function p() {
|
|
26
26
|
return n;
|
|
27
27
|
}
|
|
28
28
|
function d(e) {
|
|
29
29
|
return n.find((t) => t.id === e);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function h(e) {
|
|
32
32
|
return u.add(e), () => {
|
|
33
33
|
u.delete(e);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return g(
|
|
36
|
+
function I() {
|
|
37
|
+
return g(h, p, p);
|
|
38
38
|
}
|
|
39
39
|
function E(e) {
|
|
40
|
-
const t =
|
|
40
|
+
const t = I();
|
|
41
41
|
return e ? t.find((o) => o.id === e) : void 0;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function v(e) {
|
|
44
|
+
return typeof e == "string" && /^[A-Za-z0-9-]{8,64}$/.test(e);
|
|
45
|
+
}
|
|
46
|
+
function S(e, t, o = {}) {
|
|
44
47
|
const i = d(t.id);
|
|
45
48
|
if (i) return i;
|
|
46
49
|
const f = {
|
|
@@ -55,12 +58,15 @@ function I(e, t, o = {}) {
|
|
|
55
58
|
presented: !1
|
|
56
59
|
};
|
|
57
60
|
n = [...n, f], a();
|
|
58
|
-
const
|
|
61
|
+
const m = (o.poll ?? A)({
|
|
59
62
|
fetchResult: async () => {
|
|
60
|
-
const s = await fetch(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const s = await fetch(
|
|
64
|
+
`${e.apiBase}/ai/extract-record/result/${encodeURIComponent(t.id)}`,
|
|
65
|
+
{
|
|
66
|
+
headers: e.authHeaders,
|
|
67
|
+
credentials: e.credentials
|
|
68
|
+
}
|
|
69
|
+
), y = await s.json().catch(() => ({}));
|
|
64
70
|
return { status: s.status, ok: s.ok, json: y };
|
|
65
71
|
},
|
|
66
72
|
onRunning: (s) => {
|
|
@@ -70,17 +76,17 @@ function I(e, t, o = {}) {
|
|
|
70
76
|
onError: (s) => l(t.id, { status: "failed", error: s }),
|
|
71
77
|
onSettled: () => r.delete(t.id)
|
|
72
78
|
});
|
|
73
|
-
return r.set(t.id,
|
|
79
|
+
return r.set(t.id, m), f;
|
|
74
80
|
}
|
|
75
|
-
function
|
|
81
|
+
function O(e, t) {
|
|
76
82
|
const o = d(e);
|
|
77
83
|
o && o.presented !== t && l(e, { presented: t });
|
|
78
84
|
}
|
|
79
|
-
function
|
|
85
|
+
function P(e) {
|
|
80
86
|
var t;
|
|
81
87
|
(t = r.get(e)) == null || t(), r.delete(e), d(e) && (n = n.filter((o) => o.id !== e), a());
|
|
82
88
|
}
|
|
83
|
-
function
|
|
89
|
+
function $(e) {
|
|
84
90
|
let t = [];
|
|
85
91
|
try {
|
|
86
92
|
const o = sessionStorage.getItem(c);
|
|
@@ -89,16 +95,17 @@ function b(e) {
|
|
|
89
95
|
t = [];
|
|
90
96
|
}
|
|
91
97
|
for (const o of t)
|
|
92
|
-
o && typeof o.id == "string" && typeof o.collection == "string" &&
|
|
98
|
+
o && typeof o.id == "string" && typeof o.collection == "string" && S(e, o);
|
|
93
99
|
}
|
|
94
100
|
export {
|
|
95
|
-
|
|
101
|
+
P as dismissAutofillRun,
|
|
96
102
|
d as getAutofillRun,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
v as
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
p as getAutofillRuns,
|
|
104
|
+
$ as hydrateAutofillRuns,
|
|
105
|
+
v as isAutofillProposalId,
|
|
106
|
+
O as setAutofillRunPresented,
|
|
107
|
+
S as startAutofillRun,
|
|
108
|
+
h as subscribeAutofillRuns,
|
|
102
109
|
E as useAutofillRun,
|
|
103
|
-
|
|
110
|
+
I as useAutofillRuns
|
|
104
111
|
};
|