@burdenoff/microfe-support 2026.624.2 → 2026.625.2
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/support/components/PageLayout.js +64 -51
- package/dist/support/components/PageLayout.js.map +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.js +27 -25
- package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
- package/dist/support/components/analytics/MetricCard.js +20 -15
- package/dist/support/components/analytics/MetricCard.js.map +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.js +28 -26
- package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
- package/dist/support/components/analytics/SLAReport.js +44 -42
- package/dist/support/components/analytics/SLAReport.js.map +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.js +56 -54
- package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
- package/dist/support/components/analytics/TopAgents.js +31 -29
- package/dist/support/components/analytics/TopAgents.js.map +1 -1
- package/dist/support/components/analytics/TrendChart.js +24 -22
- package/dist/support/components/analytics/TrendChart.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.js +1 -1
- package/dist/support/components/kb/ArticleForm.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
- package/dist/support/components/ui.js +2 -2
- package/dist/support/pages/AnalyticsPage.js +129 -126
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +105 -114
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +59 -59
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +49 -63
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +6 -6
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +1 -1
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/JobApplicationDetailPage.js +7 -7
- package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.js +51 -65
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +4 -4
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +80 -78
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +78 -78
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.js +54 -54
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +173 -170
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -17,170 +17,170 @@ import { MarkdownContent as _ } from "../components/tickets/MarkdownContent.js";
|
|
|
17
17
|
import { MessageThread as v } from "../components/tickets/MessageThread.js";
|
|
18
18
|
import { MessageComposer as y } from "../components/tickets/MessageComposer.js";
|
|
19
19
|
import { useEffect as b, useRef as x } from "react";
|
|
20
|
-
import { AlertCircle as S, ArrowLeft as C
|
|
21
|
-
import { useNavigate as
|
|
22
|
-
import { jsx as
|
|
23
|
-
import { useShellUi as
|
|
20
|
+
import { AlertCircle as S, ArrowLeft as C } from "lucide-react";
|
|
21
|
+
import { useNavigate as w, useParams as T } from "react-router-dom";
|
|
22
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
23
|
+
import { useShellUi as O } from "@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider";
|
|
24
24
|
//#region src/support/pages/TicketDetailAdminPage.tsx
|
|
25
|
-
function
|
|
26
|
-
let { ticketId:
|
|
25
|
+
function k() {
|
|
26
|
+
let { ticketId: k } = T(), A = w(), { currentUser: j } = e(), { footerVisible: M, setFooterVisible: N } = O(), P = x(M), { ticketDetail: F, ticketDetailLoading: I, ticketDetailError: L, changeTicketStatus: R, addTicketMessage: z, addMessageLoading: B, setSelectedTicket: V } = c(), H = t(j?.role), { data: U, loading: W } = r({
|
|
27
27
|
variables: {
|
|
28
28
|
filter: { isActive: !0 },
|
|
29
29
|
limit: 100
|
|
30
30
|
},
|
|
31
|
-
skip: !
|
|
32
|
-
}),
|
|
33
|
-
p(
|
|
34
|
-
|
|
35
|
-
}), [
|
|
36
|
-
P
|
|
37
|
-
}), [
|
|
38
|
-
let
|
|
39
|
-
|
|
31
|
+
skip: !H
|
|
32
|
+
}), G = U?.cannedResponses.nodes ?? [], { notification: K, notify: q } = l();
|
|
33
|
+
p(q), b(() => (k && V({ id: k }), () => {
|
|
34
|
+
V(null);
|
|
35
|
+
}), [k, V]), b(() => (N(!1), () => {
|
|
36
|
+
N(P.current);
|
|
37
|
+
}), [N]);
|
|
38
|
+
let J = () => {
|
|
39
|
+
V(null), A("..");
|
|
40
40
|
};
|
|
41
|
-
return
|
|
41
|
+
return I && !F ? /* @__PURE__ */ E(s, {
|
|
42
42
|
showHeader: !1,
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
}) :
|
|
43
|
+
children: /* @__PURE__ */ E(o, { message: "Loading ticket details..." })
|
|
44
|
+
}) : L ? /* @__PURE__ */ E(s, {
|
|
45
45
|
showHeader: !1,
|
|
46
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ D("div", {
|
|
47
47
|
className: "flex flex-col items-center justify-center py-16 text-center",
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ E("div", {
|
|
50
50
|
className: "p-4 rounded-2xl bg-status-error-bg/10 text-status-error-text mb-4",
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ E(S, { size: 48 })
|
|
52
52
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ E("h3", {
|
|
54
54
|
className: "text-lg font-semibold text-text-primary mb-2",
|
|
55
55
|
children: "Failed to load ticket"
|
|
56
56
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ E("p", {
|
|
58
58
|
className: "text-sm text-text-secondary max-w-md mb-4",
|
|
59
|
-
children:
|
|
59
|
+
children: L.message || "An error occurred while loading the ticket. Please try again."
|
|
60
60
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
onClick:
|
|
63
|
-
children: [/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ D(n, {
|
|
62
|
+
onClick: J,
|
|
63
|
+
children: [/* @__PURE__ */ E(C, { size: 18 }), "Back to Tickets"]
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
})
|
|
67
|
-
}) :
|
|
67
|
+
}) : F ? /* @__PURE__ */ D("div", {
|
|
68
68
|
className: "flex h-full min-h-0 flex-col bg-bg-surface",
|
|
69
69
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
ticket:
|
|
73
|
-
onBack:
|
|
70
|
+
/* @__PURE__ */ E(u, { notification: K }),
|
|
71
|
+
/* @__PURE__ */ E(m, {
|
|
72
|
+
ticket: F,
|
|
73
|
+
onBack: J,
|
|
74
74
|
onStatusChange: async (e) => {
|
|
75
|
-
if (
|
|
76
|
-
await
|
|
75
|
+
if (k) try {
|
|
76
|
+
await R(k, e);
|
|
77
77
|
} catch (e) {
|
|
78
|
-
console.error("Failed to change status:", e),
|
|
78
|
+
console.error("Failed to change status:", e), q("error", d(e, "Failed to change ticket status."), 6e3);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ D("div", {
|
|
83
83
|
className: "flex min-h-0 flex-1 overflow-hidden",
|
|
84
|
-
children: [/* @__PURE__ */
|
|
84
|
+
children: [/* @__PURE__ */ D("div", {
|
|
85
85
|
className: "flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ D("div", {
|
|
88
88
|
className: "shrink-0 border-b border-border-subtle bg-bg-surface p-4 sm:p-6",
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ E("h2", {
|
|
91
91
|
className: "text-lg font-semibold mb-2 text-text-primary",
|
|
92
92
|
children: "Description"
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
content:
|
|
94
|
+
/* @__PURE__ */ E(_, {
|
|
95
|
+
content: F.description,
|
|
96
96
|
className: "text-sm"
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
ticketId:
|
|
100
|
-
fileIds:
|
|
98
|
+
/* @__PURE__ */ E(g, {
|
|
99
|
+
ticketId: F.id,
|
|
100
|
+
fileIds: F.metadata?.initialAttachmentIds ?? []
|
|
101
101
|
})
|
|
102
102
|
]
|
|
103
103
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ D("div", {
|
|
105
105
|
className: "min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",
|
|
106
106
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ E("h2", {
|
|
108
108
|
className: "text-lg font-semibold mb-4 text-text-primary",
|
|
109
109
|
children: "Conversation"
|
|
110
110
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
ticketId:
|
|
113
|
-
messages:
|
|
114
|
-
currentUserId:
|
|
111
|
+
/* @__PURE__ */ E(v, {
|
|
112
|
+
ticketId: F.id,
|
|
113
|
+
messages: F.messages || [],
|
|
114
|
+
currentUserId: j?.id,
|
|
115
115
|
viewerRole: "agent",
|
|
116
|
-
showInternalMessages:
|
|
117
|
-
showRealAgentIdentity:
|
|
116
|
+
showInternalMessages: H,
|
|
117
|
+
showRealAgentIdentity: H
|
|
118
118
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
className: "mt-6 rounded-xl border border-border-
|
|
121
|
-
children: /* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ E("div", {
|
|
120
|
+
className: "mt-6 rounded-xl border border-border-seam bg-bg-surface p-4 xl:hidden",
|
|
121
|
+
children: /* @__PURE__ */ E(h, { ticket: F })
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
ticketId:
|
|
125
|
+
/* @__PURE__ */ E(y, {
|
|
126
|
+
ticketId: F.id,
|
|
127
127
|
onSendMessage: async (e, t, n) => {
|
|
128
|
-
if (!
|
|
128
|
+
if (!k) return;
|
|
129
129
|
if (!e.trim() && n.length === 0) {
|
|
130
|
-
|
|
130
|
+
q("error", "Nothing to send.", 6e3);
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
let r, a = null;
|
|
134
134
|
if (n.length > 0) try {
|
|
135
135
|
r = (await f({
|
|
136
|
-
ticketId:
|
|
136
|
+
ticketId: k,
|
|
137
137
|
files: n
|
|
138
138
|
})).files.map((e) => e.id);
|
|
139
139
|
} catch (e) {
|
|
140
140
|
a = d(e, "Failed to upload attachments.");
|
|
141
141
|
}
|
|
142
|
-
if (!e.trim() && !r?.length) return
|
|
142
|
+
if (!e.trim() && !r?.length) return q("error", a ? `Attachment upload failed: ${a}` : "Nothing to send.", 6e3), n.length > 0 ? { preserveAttachedFiles: !0 } : void 0;
|
|
143
143
|
try {
|
|
144
|
-
if (await
|
|
145
|
-
ticketId:
|
|
144
|
+
if (await z({
|
|
145
|
+
ticketId: k,
|
|
146
146
|
message: e,
|
|
147
147
|
type: t ? i.InternalNote : i.AgentReply,
|
|
148
148
|
isInternal: t,
|
|
149
149
|
attachments: r
|
|
150
|
-
}), a) return
|
|
150
|
+
}), a) return q("error", `Message sent, but attachments failed: ${a}`, 6e3), { preserveAttachedFiles: n.length > 0 };
|
|
151
151
|
} catch (e) {
|
|
152
|
-
return console.error("[support] addTicketMessage failed", e),
|
|
152
|
+
return console.error("[support] addTicketMessage failed", e), q("error", d(e, "Failed to send message."), 6e3), {
|
|
153
153
|
preserveMessage: !0,
|
|
154
154
|
preserveAttachedFiles: n.length > 0
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
|
-
disabled:
|
|
159
|
-
allowInternalNotes:
|
|
160
|
-
cannedResponses:
|
|
161
|
-
cannedResponsesLoading:
|
|
158
|
+
disabled: B,
|
|
159
|
+
allowInternalNotes: H,
|
|
160
|
+
cannedResponses: G,
|
|
161
|
+
cannedResponsesLoading: W
|
|
162
162
|
})
|
|
163
163
|
]
|
|
164
|
-
}), /* @__PURE__ */
|
|
164
|
+
}), /* @__PURE__ */ E("div", {
|
|
165
165
|
className: "hidden min-h-0 xl:block",
|
|
166
|
-
children: /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ E(h, { ticket: F })
|
|
167
167
|
})]
|
|
168
168
|
})
|
|
169
169
|
]
|
|
170
|
-
}) : /* @__PURE__ */
|
|
170
|
+
}) : /* @__PURE__ */ E(s, {
|
|
171
171
|
showHeader: !1,
|
|
172
|
-
children: /* @__PURE__ */
|
|
173
|
-
|
|
172
|
+
children: /* @__PURE__ */ E(a, {
|
|
173
|
+
illustration: "empty-search",
|
|
174
174
|
title: "Ticket not found",
|
|
175
175
|
description: "The ticket you're looking for doesn't exist or has been deleted.",
|
|
176
|
-
action: /* @__PURE__ */
|
|
177
|
-
onClick:
|
|
178
|
-
children: [/* @__PURE__ */
|
|
176
|
+
action: /* @__PURE__ */ D(n, {
|
|
177
|
+
onClick: J,
|
|
178
|
+
children: [/* @__PURE__ */ E(C, { size: 18 }), "Back to Tickets"]
|
|
179
179
|
})
|
|
180
180
|
})
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
//#endregion
|
|
184
|
-
export {
|
|
184
|
+
export { k as TicketDetailAdminPage };
|
|
185
185
|
|
|
186
186
|
//# sourceMappingURL=TicketDetailAdminPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TicketDetailAdminPage.js","names":[],"sources":["../../../src/support/pages/TicketDetailAdminPage.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { AlertCircle, Ticket, ArrowLeft } from 'lucide-react';\nimport { Button } from '../components/ui';\nimport { useShellUi } from '@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useGetCannedResponsesQuery } from '../../generated/global-operations';\nimport { useNotification } from '../hooks/useNotification';\nimport { useAttachmentsFailedToast } from '../hooks/useAttachmentsFailedToast';\nimport { TicketHeader } from '../components/tickets/TicketHeader';\nimport { TicketSidebar } from '../components/tickets/TicketSidebar';\nimport { MessageThread } from '../components/tickets/MessageThread';\nimport {\n MessageComposer,\n type MessageComposerSendResult,\n} from '../components/tickets/MessageComposer';\nimport { AttachmentList } from '../components/tickets/AttachmentList';\nimport { MarkdownContent } from '../components/tickets/MarkdownContent';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport {\n MessageType,\n type SupportTicketStatus,\n type SupportTicket,\n} from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { extractErrorMessage } from '../utils/errors';\nimport { isAdminRole } from '../utils';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\n\n/**\n * Admin-facing ticket detail page.\n *\n * Admins/agents get full controls: status changes, ticket assignment,\n * internal notes, and all reply types in addition to the standard\n * ticket view and conversation.\n */\nexport function TicketDetailAdminPage() {\n const { ticketId } = useParams<{ ticketId: string }>();\n const navigate = useNavigate();\n const { currentUser } = useSupport();\n const { footerVisible, setFooterVisible } = useShellUi();\n const initialFooterVisible = useRef(footerVisible);\n const {\n ticketDetail,\n ticketDetailLoading,\n ticketDetailError,\n changeTicketStatus,\n addTicketMessage,\n addMessageLoading,\n setSelectedTicket,\n } = useTicketOperations();\n const canLeaveInternalNotes = isAdminRole(currentUser?.role);\n const { data: cannedResponsesData, loading: cannedResponsesLoading } = useGetCannedResponsesQuery(\n {\n variables: {\n filter: { isActive: true },\n limit: 100,\n },\n skip: !canLeaveInternalNotes,\n }\n );\n const cannedResponses = cannedResponsesData?.cannedResponses.nodes ?? [];\n\n const { notification, notify } = useNotification();\n useAttachmentsFailedToast(notify);\n\n useEffect(() => {\n if (ticketId) {\n setSelectedTicket({ id: ticketId } as SupportTicket);\n }\n return () => {\n setSelectedTicket(null);\n };\n }, [ticketId, setSelectedTicket]);\n\n useEffect(() => {\n setFooterVisible(false);\n\n return () => {\n setFooterVisible(initialFooterVisible.current);\n };\n }, [setFooterVisible]);\n\n const handleBack = () => {\n setSelectedTicket(null);\n navigate('..');\n };\n\n const handleStatusChange = async (status: SupportTicketStatus) => {\n if (!ticketId) return;\n try {\n await changeTicketStatus(ticketId, status);\n } catch (error) {\n console.error('Failed to change status:', error);\n notify('error', extractErrorMessage(error, 'Failed to change ticket status.'), 6000);\n }\n };\n\n const handleSendMessage = async (\n messageText: string,\n isInternal: boolean,\n files: File[]\n ): Promise<MessageComposerSendResult | void> => {\n if (!ticketId) return;\n\n // Synchronous guard: if there is nothing to send AND nothing to upload, bail\n // before touching the network.\n if (!messageText.trim() && files.length === 0) {\n notify('error', 'Nothing to send.', 6000);\n return;\n }\n\n let attachmentIds: string[] | undefined;\n let attachmentError: string | null = null;\n\n if (files.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId,\n files,\n });\n attachmentIds = uploadResult.files.map((file) => file.id);\n } catch (uploadError) {\n attachmentError = extractErrorMessage(uploadError, 'Failed to upload attachments.');\n }\n }\n\n if (!messageText.trim() && !attachmentIds?.length) {\n const errorMessage = attachmentError\n ? `Attachment upload failed: ${attachmentError}`\n : 'Nothing to send.';\n notify('error', errorMessage, 6000);\n return files.length > 0 ? { preserveAttachedFiles: true } : undefined;\n }\n\n try {\n await addTicketMessage({\n ticketId,\n message: messageText,\n type: isInternal ? MessageType.InternalNote : MessageType.AgentReply,\n isInternal,\n attachments: attachmentIds,\n });\n\n if (attachmentError) {\n notify('error', `Message sent, but attachments failed: ${attachmentError}`, 6000);\n return { preserveAttachedFiles: files.length > 0 };\n }\n } catch (sendError) {\n console.error('[support] addTicketMessage failed', sendError);\n notify('error', extractErrorMessage(sendError, 'Failed to send message.'), 6000);\n return {\n preserveMessage: true,\n preserveAttachedFiles: files.length > 0,\n };\n }\n };\n\n if (ticketDetailLoading && !ticketDetail) {\n return (\n <PageLayout showHeader={false}>\n <LoadingState message=\"Loading ticket details...\" />\n </PageLayout>\n );\n }\n\n if (ticketDetailError) {\n return (\n <PageLayout showHeader={false}>\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-status-error-bg/10 text-status-error-text mb-4\">\n <AlertCircle size={48} />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">Failed to load ticket</h3>\n <p className=\"text-sm text-text-secondary max-w-md mb-4\">\n {ticketDetailError.message ||\n 'An error occurred while loading the ticket. Please try again.'}\n </p>\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n Back to Tickets\n </Button>\n </div>\n </PageLayout>\n );\n }\n\n if (!ticketDetail) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n icon={<Ticket size={48} />}\n title=\"Ticket not found\"\n description=\"The ticket you're looking for doesn't exist or has been deleted.\"\n action={\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n Back to Tickets\n </Button>\n }\n />\n </PageLayout>\n );\n }\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-bg-surface\">\n <NotificationToast notification={notification} />\n\n <TicketHeader ticket={ticketDetail} onBack={handleBack} onStatusChange={handleStatusChange} />\n\n <div className=\"flex min-h-0 flex-1 overflow-hidden\">\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden\">\n <div className=\"shrink-0 border-b border-border-subtle bg-bg-surface p-4 sm:p-6\">\n <h2 className=\"text-lg font-semibold mb-2 text-text-primary\">Description</h2>\n <MarkdownContent content={ticketDetail.description} className=\"text-sm\" />\n <AttachmentList\n ticketId={ticketDetail.id}\n fileIds={\n ((ticketDetail.metadata as Record<string, unknown> | null)?.initialAttachmentIds as\n | string[]\n | undefined) ?? []\n }\n />\n </div>\n\n <div className=\"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6\">\n <h2 className=\"text-lg font-semibold mb-4 text-text-primary\">Conversation</h2>\n <MessageThread\n ticketId={ticketDetail.id}\n messages={ticketDetail.messages || []}\n currentUserId={currentUser?.id}\n viewerRole=\"agent\"\n showInternalMessages={canLeaveInternalNotes}\n showRealAgentIdentity={canLeaveInternalNotes}\n />\n\n <div className=\"mt-6 rounded-xl border border-border-subtle bg-bg-surface p-4 xl:hidden\">\n <TicketSidebar ticket={ticketDetail} />\n </div>\n </div>\n\n <MessageComposer\n ticketId={ticketDetail.id}\n onSendMessage={handleSendMessage}\n disabled={addMessageLoading}\n allowInternalNotes={canLeaveInternalNotes}\n cannedResponses={cannedResponses}\n cannedResponsesLoading={cannedResponsesLoading}\n />\n </div>\n\n <div className=\"hidden min-h-0 xl:block\">\n <TicketSidebar ticket={ticketDetail} />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,IAAwB;CACtC,IAAM,EAAE,gBAAa,GAAiC,EAChD,IAAW,GAAa,EACxB,EAAE,mBAAgB,GAAY,EAC9B,EAAE,kBAAe,wBAAqB,GAAY,EAClD,IAAuB,EAAO,E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C,EAAY,MAAM,IAAI,CAAC,GAAe,OAKzC,QADA,EAAO,SAHc,IACjB,6BAA6B,MAC7B,oBAC0B,IAAK,EAC5B,EAAM,SAAS,IAAI,EAAE,uBAAuB,IAAM,GAAG,KAAA;AAG9D,YAAI;AASF,aARA,MAAM,EAAiB;UACrB;UACA,SAAS;UACT,MAAM,IAAa,EAAY,eAAe,EAAY;UAC1D;UACA,aAAa;UACd,CAAC,EAEE,EAEF,QADA,EAAO,SAAS,yCAAyC,KAAmB,IAAK,EAC1E,EAAE,uBAAuB,EAAM,SAAS,GAAG;iBAE7C,GAAW;AAGlB,gBAFA,QAAQ,MAAM,qCAAqC,EAAU,EAC7D,EAAO,SAAS,EAAoB,GAAW,0BAA0B,EAAE,IAAK,EACzE;UACL,iBAAiB;UACjB,uBAAuB,EAAM,SAAS;UACvC;;;OA2FK,UAAU;OACV,oBAAoB;OACH;OACO;OACxB,CAAA;MACE;QAEN,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAe,QAAQ,GAAgB,CAAA;KACnC,CAAA,CACF;;GACF;MAnEJ,kBAAC,GAAD;EAAY,YAAY;YACtB,kBAAC,GAAD;GACE,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;GAC1B,OAAM;GACN,aAAY;GACZ,QACE,kBAAC,GAAD;IAAQ,SAAS;cAAjB,CACE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EAAA,kBAEhB;;GAEX,CAAA;EACS,CAAA"}
|
|
1
|
+
{"version":3,"file":"TicketDetailAdminPage.js","names":[],"sources":["../../../src/support/pages/TicketDetailAdminPage.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { AlertCircle, ArrowLeft } from 'lucide-react';\nimport { Button } from '../components/ui';\nimport { useShellUi } from '@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useGetCannedResponsesQuery } from '../../generated/global-operations';\nimport { useNotification } from '../hooks/useNotification';\nimport { useAttachmentsFailedToast } from '../hooks/useAttachmentsFailedToast';\nimport { TicketHeader } from '../components/tickets/TicketHeader';\nimport { TicketSidebar } from '../components/tickets/TicketSidebar';\nimport { MessageThread } from '../components/tickets/MessageThread';\nimport {\n MessageComposer,\n type MessageComposerSendResult,\n} from '../components/tickets/MessageComposer';\nimport { AttachmentList } from '../components/tickets/AttachmentList';\nimport { MarkdownContent } from '../components/tickets/MarkdownContent';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\nimport {\n MessageType,\n type SupportTicketStatus,\n type SupportTicket,\n} from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { extractErrorMessage } from '../utils/errors';\nimport { isAdminRole } from '../utils';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\n\n/**\n * Admin-facing ticket detail page.\n *\n * Admins/agents get full controls: status changes, ticket assignment,\n * internal notes, and all reply types in addition to the standard\n * ticket view and conversation.\n */\nexport function TicketDetailAdminPage() {\n const { ticketId } = useParams<{ ticketId: string }>();\n const navigate = useNavigate();\n const { currentUser } = useSupport();\n const { footerVisible, setFooterVisible } = useShellUi();\n const initialFooterVisible = useRef(footerVisible);\n const {\n ticketDetail,\n ticketDetailLoading,\n ticketDetailError,\n changeTicketStatus,\n addTicketMessage,\n addMessageLoading,\n setSelectedTicket,\n } = useTicketOperations();\n const canLeaveInternalNotes = isAdminRole(currentUser?.role);\n const { data: cannedResponsesData, loading: cannedResponsesLoading } = useGetCannedResponsesQuery(\n {\n variables: {\n filter: { isActive: true },\n limit: 100,\n },\n skip: !canLeaveInternalNotes,\n }\n );\n const cannedResponses = cannedResponsesData?.cannedResponses.nodes ?? [];\n\n const { notification, notify } = useNotification();\n useAttachmentsFailedToast(notify);\n\n useEffect(() => {\n if (ticketId) {\n setSelectedTicket({ id: ticketId } as SupportTicket);\n }\n return () => {\n setSelectedTicket(null);\n };\n }, [ticketId, setSelectedTicket]);\n\n useEffect(() => {\n setFooterVisible(false);\n\n return () => {\n setFooterVisible(initialFooterVisible.current);\n };\n }, [setFooterVisible]);\n\n const handleBack = () => {\n setSelectedTicket(null);\n navigate('..');\n };\n\n const handleStatusChange = async (status: SupportTicketStatus) => {\n if (!ticketId) return;\n try {\n await changeTicketStatus(ticketId, status);\n } catch (error) {\n console.error('Failed to change status:', error);\n notify('error', extractErrorMessage(error, 'Failed to change ticket status.'), 6000);\n }\n };\n\n const handleSendMessage = async (\n messageText: string,\n isInternal: boolean,\n files: File[]\n ): Promise<MessageComposerSendResult | void> => {\n if (!ticketId) return;\n\n // Synchronous guard: if there is nothing to send AND nothing to upload, bail\n // before touching the network.\n if (!messageText.trim() && files.length === 0) {\n notify('error', 'Nothing to send.', 6000);\n return;\n }\n\n let attachmentIds: string[] | undefined;\n let attachmentError: string | null = null;\n\n if (files.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId,\n files,\n });\n attachmentIds = uploadResult.files.map((file) => file.id);\n } catch (uploadError) {\n attachmentError = extractErrorMessage(uploadError, 'Failed to upload attachments.');\n }\n }\n\n if (!messageText.trim() && !attachmentIds?.length) {\n const errorMessage = attachmentError\n ? `Attachment upload failed: ${attachmentError}`\n : 'Nothing to send.';\n notify('error', errorMessage, 6000);\n return files.length > 0 ? { preserveAttachedFiles: true } : undefined;\n }\n\n try {\n await addTicketMessage({\n ticketId,\n message: messageText,\n type: isInternal ? MessageType.InternalNote : MessageType.AgentReply,\n isInternal,\n attachments: attachmentIds,\n });\n\n if (attachmentError) {\n notify('error', `Message sent, but attachments failed: ${attachmentError}`, 6000);\n return { preserveAttachedFiles: files.length > 0 };\n }\n } catch (sendError) {\n console.error('[support] addTicketMessage failed', sendError);\n notify('error', extractErrorMessage(sendError, 'Failed to send message.'), 6000);\n return {\n preserveMessage: true,\n preserveAttachedFiles: files.length > 0,\n };\n }\n };\n\n if (ticketDetailLoading && !ticketDetail) {\n return (\n <PageLayout showHeader={false}>\n <LoadingState message=\"Loading ticket details...\" />\n </PageLayout>\n );\n }\n\n if (ticketDetailError) {\n return (\n <PageLayout showHeader={false}>\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-status-error-bg/10 text-status-error-text mb-4\">\n <AlertCircle size={48} />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">Failed to load ticket</h3>\n <p className=\"text-sm text-text-secondary max-w-md mb-4\">\n {ticketDetailError.message ||\n 'An error occurred while loading the ticket. Please try again.'}\n </p>\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n Back to Tickets\n </Button>\n </div>\n </PageLayout>\n );\n }\n\n if (!ticketDetail) {\n return (\n <PageLayout showHeader={false}>\n <EmptyState\n illustration=\"empty-search\"\n title=\"Ticket not found\"\n description=\"The ticket you're looking for doesn't exist or has been deleted.\"\n action={\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n Back to Tickets\n </Button>\n }\n />\n </PageLayout>\n );\n }\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-bg-surface\">\n <NotificationToast notification={notification} />\n\n <TicketHeader ticket={ticketDetail} onBack={handleBack} onStatusChange={handleStatusChange} />\n\n <div className=\"flex min-h-0 flex-1 overflow-hidden\">\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden\">\n <div className=\"shrink-0 border-b border-border-subtle bg-bg-surface p-4 sm:p-6\">\n <h2 className=\"text-lg font-semibold mb-2 text-text-primary\">Description</h2>\n <MarkdownContent content={ticketDetail.description} className=\"text-sm\" />\n <AttachmentList\n ticketId={ticketDetail.id}\n fileIds={\n ((ticketDetail.metadata as Record<string, unknown> | null)?.initialAttachmentIds as\n | string[]\n | undefined) ?? []\n }\n />\n </div>\n\n <div className=\"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6\">\n <h2 className=\"text-lg font-semibold mb-4 text-text-primary\">Conversation</h2>\n <MessageThread\n ticketId={ticketDetail.id}\n messages={ticketDetail.messages || []}\n currentUserId={currentUser?.id}\n viewerRole=\"agent\"\n showInternalMessages={canLeaveInternalNotes}\n showRealAgentIdentity={canLeaveInternalNotes}\n />\n\n <div className=\"mt-6 rounded-xl border border-border-seam bg-bg-surface p-4 xl:hidden\">\n <TicketSidebar ticket={ticketDetail} />\n </div>\n </div>\n\n <MessageComposer\n ticketId={ticketDetail.id}\n onSendMessage={handleSendMessage}\n disabled={addMessageLoading}\n allowInternalNotes={canLeaveInternalNotes}\n cannedResponses={cannedResponses}\n cannedResponsesLoading={cannedResponsesLoading}\n />\n </div>\n\n <div className=\"hidden min-h-0 xl:block\">\n <TicketSidebar ticket={ticketDetail} />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,IAAwB;CACtC,IAAM,EAAE,gBAAa,GAAiC,EAChD,IAAW,GAAa,EACxB,EAAE,mBAAgB,GAAY,EAC9B,EAAE,kBAAe,wBAAqB,GAAY,EAClD,IAAuB,EAAO,EAAc,EAC5C,EACJ,iBACA,wBACA,sBACA,uBACA,qBACA,sBACA,yBACE,GAAqB,EACnB,IAAwB,EAAY,GAAa,KAAK,EACtD,EAAE,MAAM,GAAqB,SAAS,MAA2B,EACrE;EACE,WAAW;GACT,QAAQ,EAAE,UAAU,IAAM;GAC1B,OAAO;GACR;EACD,MAAM,CAAC;EACR,CACF,EACK,IAAkB,GAAqB,gBAAgB,SAAS,EAAE,EAElE,EAAE,iBAAc,cAAW,GAAiB;AAYlD,CAXA,EAA0B,EAAO,EAEjC,SACM,KACF,EAAkB,EAAE,IAAI,GAAU,CAAkB,QAEzC;AACX,IAAkB,KAAK;KAExB,CAAC,GAAU,EAAkB,CAAC,EAEjC,SACE,EAAiB,GAAM,QAEV;AACX,IAAiB,EAAqB,QAAQ;KAE/C,CAAC,EAAiB,CAAC;CAEtB,IAAM,UAAmB;AAEvB,EADA,EAAkB,KAAK,EACvB,EAAS,KAAK;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BAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAe,QAAQ,GAAgB,CAAA;KACnC,CAAA,CACF;;GACF;MAnEJ,kBAAC,GAAD;EAAY,YAAY;YACtB,kBAAC,GAAD;GACE,cAAa;GACb,OAAM;GACN,aAAY;GACZ,QACE,kBAAC,GAAD;IAAQ,SAAS;cAAjB,CACE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EAAA,kBAEhB;;GAEX,CAAA;EACS,CAAA"}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { useSupport as e } from "../providers/SupportProvider.js";
|
|
2
2
|
import { joinPath as t } from "../utils/index.js";
|
|
3
|
-
import { Button as n } from "../components/ui.js";
|
|
4
|
-
import { FeedbackCategory as
|
|
5
|
-
import { EmptyState as
|
|
6
|
-
import { useTicketOperations as
|
|
7
|
-
import { useNotification as
|
|
8
|
-
import { NotificationToast as
|
|
9
|
-
import { extractErrorCode as
|
|
10
|
-
import { uploadSupportAttachmentFiles as
|
|
11
|
-
import { useAttachmentsFailedToast as
|
|
12
|
-
import { TicketSidebar as
|
|
13
|
-
import { AttachmentList as
|
|
14
|
-
import { MarkdownContent as
|
|
15
|
-
import { MessageThread as
|
|
3
|
+
import { Button as n, EmphasisPanel as r } from "../components/ui.js";
|
|
4
|
+
import { FeedbackCategory as i, MessageType as ee, SupportTicketStatus as a } from "../../generated/global-types.js";
|
|
5
|
+
import { EmptyState as te, LoadingState as o, PageLayout as s } from "../components/PageLayout.js";
|
|
6
|
+
import { useTicketOperations as c } from "../hooks/useTicketOperations.js";
|
|
7
|
+
import { useNotification as l } from "../hooks/useNotification.js";
|
|
8
|
+
import { NotificationToast as u } from "../components/NotificationToast.js";
|
|
9
|
+
import { extractErrorCode as ne, extractErrorMessage as d } from "../utils/errors.js";
|
|
10
|
+
import { uploadSupportAttachmentFiles as f } from "../utils/supportFiles.js";
|
|
11
|
+
import { useAttachmentsFailedToast as p } from "../hooks/useAttachmentsFailedToast.js";
|
|
12
|
+
import { TicketSidebar as m } from "../components/tickets/TicketSidebar.js";
|
|
13
|
+
import { AttachmentList as h } from "../components/tickets/AttachmentList.js";
|
|
14
|
+
import { MarkdownContent as re } from "../components/tickets/MarkdownContent.js";
|
|
15
|
+
import { MessageThread as g } from "../components/tickets/MessageThread.js";
|
|
16
16
|
import { MessageComposer as _ } from "../components/tickets/MessageComposer.js";
|
|
17
17
|
import { TicketDetailHeader as v } from "../components/tickets/TicketDetailHeader.js";
|
|
18
|
-
import { useCallback as
|
|
19
|
-
import { AlertCircle as
|
|
20
|
-
import { useNavigate as
|
|
18
|
+
import { useCallback as ie, useEffect as y, useRef as b, useState as x } from "react";
|
|
19
|
+
import { AlertCircle as S, ArrowLeft as C } from "lucide-react";
|
|
20
|
+
import { useNavigate as w, useParams as T } from "react-router-dom";
|
|
21
21
|
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
22
22
|
import { useShellUi as O } from "@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider";
|
|
23
23
|
//#region src/support/pages/TicketDetailUserPage.tsx
|
|
24
24
|
function k() {
|
|
25
|
-
let { ticketId: k } =
|
|
26
|
-
|
|
25
|
+
let { ticketId: k } = T(), A = w(), { currentUser: j, basePath: M = "" } = e(), { footerVisible: N, setFooterVisible: P } = O(), F = b(N), { ticketDetail: I, ticketDetailLoading: L, ticketDetailError: R, addTicketMessage: z, addMessageLoading: B, changeStatusLoading: V, changeTicketStatus: H, submitSatisfactionSurvey: ae, submitSurveyLoading: U, setSelectedTicket: W } = c(), [G, K] = x(""), [q, J] = x(""), [Y, X] = x(""), { notification: oe, notify: Z } = l();
|
|
26
|
+
p(Z), y(() => (k && W({ id: k }), () => {
|
|
27
27
|
W(null);
|
|
28
|
-
}), [k, W]),
|
|
28
|
+
}), [k, W]), y(() => (P(!1), () => {
|
|
29
29
|
P(F.current);
|
|
30
30
|
}), [P]);
|
|
31
31
|
let Q = () => {
|
|
32
32
|
W(null), A("..");
|
|
33
|
-
}, se =
|
|
33
|
+
}, se = ie(() => {
|
|
34
34
|
A(t(M, "tickets/new"));
|
|
35
35
|
}, [M, A]), ce = async (e, t, n) => {
|
|
36
36
|
if (!k) return;
|
|
@@ -38,59 +38,59 @@ function k() {
|
|
|
38
38
|
Z("error", "Nothing to send.", 6e3);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
let r,
|
|
41
|
+
let r, i = null;
|
|
42
42
|
if (n.length > 0 && I?.ticketNumber) try {
|
|
43
|
-
r = (await
|
|
43
|
+
r = (await f({
|
|
44
44
|
ticketId: k,
|
|
45
45
|
files: n
|
|
46
46
|
})).files.map((e) => e.id);
|
|
47
47
|
} catch (e) {
|
|
48
|
-
|
|
48
|
+
i = d(e, "Failed to upload attachments.");
|
|
49
49
|
}
|
|
50
|
-
if (!e.trim() && !r?.length) return Z("error",
|
|
50
|
+
if (!e.trim() && !r?.length) return Z("error", i ? `Attachment upload failed: ${i}` : "Nothing to send.", 6e3), n.length > 0 ? { preserveAttachedFiles: !0 } : void 0;
|
|
51
51
|
try {
|
|
52
52
|
if (await z({
|
|
53
53
|
ticketId: k,
|
|
54
54
|
message: e,
|
|
55
|
-
type:
|
|
55
|
+
type: ee.CustomerReply,
|
|
56
56
|
attachments: r
|
|
57
|
-
}),
|
|
57
|
+
}), i) return Z("error", `Message sent, but attachments failed: ${i}`, 6e3), { preserveAttachedFiles: n.length > 0 };
|
|
58
58
|
} catch (e) {
|
|
59
|
-
return console.error("[support] addTicketMessage failed", e), Z("error",
|
|
59
|
+
return console.error("[support] addTicketMessage failed", e), Z("error", d(e, "Failed to send message."), 6e3), {
|
|
60
60
|
preserveMessage: !0,
|
|
61
61
|
preserveAttachedFiles: n.length > 0
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
}, le = async () => {
|
|
65
65
|
if (k) try {
|
|
66
|
-
await
|
|
66
|
+
await H(k, a.Reopened), Z("success", "Ticket reopened.");
|
|
67
67
|
} catch (e) {
|
|
68
|
-
let t =
|
|
68
|
+
let t = ne(e), n = d(e, "Failed to reopen ticket.");
|
|
69
69
|
t === "REOPEN_LIMIT_REACHED" || /REOPEN_LIMIT_REACHED|maximum.*reopen/i.test(n) ? Z("error", "You have reached the maximum number of reopens for this ticket. Please create a new ticket to continue.", 8e3) : Z("error", n, 6e3);
|
|
70
70
|
}
|
|
71
71
|
}, $ = I?.surveys?.[0] ?? null, ue = I?.status === a.Closed && $ && !$.submittedAt, de = async () => {
|
|
72
72
|
if (!(!$ || !G)) try {
|
|
73
|
-
await
|
|
73
|
+
await ae({
|
|
74
74
|
surveyId: $.id,
|
|
75
75
|
rating: Number(G),
|
|
76
76
|
feedbackType: q || void 0,
|
|
77
77
|
comment: Y || void 0
|
|
78
78
|
}), K(""), J(""), X(""), Z("success", "Thanks for your feedback!");
|
|
79
79
|
} catch (e) {
|
|
80
|
-
Z("error",
|
|
80
|
+
Z("error", d(e, "Failed to submit review."), 6e3);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
return L && !I ? /* @__PURE__ */ E(
|
|
83
|
+
return L && !I ? /* @__PURE__ */ E(s, {
|
|
84
84
|
showHeader: !1,
|
|
85
|
-
children: /* @__PURE__ */ E(
|
|
86
|
-
}) : R ? /* @__PURE__ */ E(
|
|
85
|
+
children: /* @__PURE__ */ E(o, { message: "Loading ticket details..." })
|
|
86
|
+
}) : R ? /* @__PURE__ */ E(s, {
|
|
87
87
|
showHeader: !1,
|
|
88
88
|
children: /* @__PURE__ */ D("div", {
|
|
89
89
|
className: "flex flex-col items-center justify-center py-16 text-center",
|
|
90
90
|
children: [
|
|
91
91
|
/* @__PURE__ */ E("div", {
|
|
92
92
|
className: "p-4 rounded-2xl bg-status-error-bg/10 text-status-error-text mb-4",
|
|
93
|
-
children: /* @__PURE__ */ E(
|
|
93
|
+
children: /* @__PURE__ */ E(S, { size: 48 })
|
|
94
94
|
}),
|
|
95
95
|
/* @__PURE__ */ E("h3", {
|
|
96
96
|
className: "text-lg font-semibold text-text-primary mb-2",
|
|
@@ -102,14 +102,14 @@ function k() {
|
|
|
102
102
|
}),
|
|
103
103
|
/* @__PURE__ */ D(n, {
|
|
104
104
|
onClick: Q,
|
|
105
|
-
children: [/* @__PURE__ */ E(
|
|
105
|
+
children: [/* @__PURE__ */ E(C, { size: 18 }), "Back to Tickets"]
|
|
106
106
|
})
|
|
107
107
|
]
|
|
108
108
|
})
|
|
109
109
|
}) : I ? /* @__PURE__ */ D("div", {
|
|
110
110
|
className: "flex h-full min-h-0 flex-col bg-bg-surface",
|
|
111
111
|
children: [
|
|
112
|
-
/* @__PURE__ */ E(
|
|
112
|
+
/* @__PURE__ */ E(u, { notification: oe }),
|
|
113
113
|
/* @__PURE__ */ E(v, {
|
|
114
114
|
ticket: I,
|
|
115
115
|
onBack: Q,
|
|
@@ -130,11 +130,11 @@ function k() {
|
|
|
130
130
|
className: "text-lg font-semibold mb-2 text-text-primary",
|
|
131
131
|
children: "Description"
|
|
132
132
|
}),
|
|
133
|
-
/* @__PURE__ */ E(
|
|
133
|
+
/* @__PURE__ */ E(re, {
|
|
134
134
|
content: I.description,
|
|
135
135
|
className: "text-sm"
|
|
136
136
|
}),
|
|
137
|
-
/* @__PURE__ */ E(
|
|
137
|
+
/* @__PURE__ */ E(h, {
|
|
138
138
|
ticketId: I.id,
|
|
139
139
|
fileIds: I.metadata?.initialAttachmentIds ?? []
|
|
140
140
|
})
|
|
@@ -148,14 +148,14 @@ function k() {
|
|
|
148
148
|
className: "text-lg font-semibold mb-4 text-text-primary",
|
|
149
149
|
children: "Conversation"
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */ E(
|
|
151
|
+
/* @__PURE__ */ E(g, {
|
|
152
152
|
ticketId: I.id,
|
|
153
153
|
messages: I.messages || [],
|
|
154
154
|
currentUserId: j?.id
|
|
155
155
|
}),
|
|
156
|
-
ue && /* @__PURE__ */ D(
|
|
156
|
+
ue && /* @__PURE__ */ D(r, {
|
|
157
157
|
"data-tour": "support-ticket-review",
|
|
158
|
-
className: "mt-6
|
|
158
|
+
className: "mt-6 p-4",
|
|
159
159
|
children: [
|
|
160
160
|
/* @__PURE__ */ E("h3", {
|
|
161
161
|
className: "text-base font-semibold text-text-primary",
|
|
@@ -217,23 +217,23 @@ function k() {
|
|
|
217
217
|
children: "Optional"
|
|
218
218
|
}),
|
|
219
219
|
/* @__PURE__ */ E("option", {
|
|
220
|
-
value:
|
|
220
|
+
value: i.AgentHelpful,
|
|
221
221
|
children: "Agent helpful"
|
|
222
222
|
}),
|
|
223
223
|
/* @__PURE__ */ E("option", {
|
|
224
|
-
value:
|
|
224
|
+
value: i.IssueResolved,
|
|
225
225
|
children: "Issue resolved"
|
|
226
226
|
}),
|
|
227
227
|
/* @__PURE__ */ E("option", {
|
|
228
|
-
value:
|
|
228
|
+
value: i.ResponseTime,
|
|
229
229
|
children: "Response time"
|
|
230
230
|
}),
|
|
231
231
|
/* @__PURE__ */ E("option", {
|
|
232
|
-
value:
|
|
232
|
+
value: i.KnowledgeBase,
|
|
233
233
|
children: "Knowledge base"
|
|
234
234
|
}),
|
|
235
235
|
/* @__PURE__ */ E("option", {
|
|
236
|
-
value:
|
|
236
|
+
value: i.Other,
|
|
237
237
|
children: "Other"
|
|
238
238
|
})
|
|
239
239
|
]
|
|
@@ -266,8 +266,8 @@ function k() {
|
|
|
266
266
|
]
|
|
267
267
|
}),
|
|
268
268
|
/* @__PURE__ */ E("div", {
|
|
269
|
-
className: "mt-6 rounded-xl border border-border-
|
|
270
|
-
children: /* @__PURE__ */ E(
|
|
269
|
+
className: "mt-6 rounded-xl border border-border-seam bg-bg-surface p-4 xl:hidden",
|
|
270
|
+
children: /* @__PURE__ */ E(m, { ticket: I })
|
|
271
271
|
})
|
|
272
272
|
]
|
|
273
273
|
}),
|
|
@@ -280,19 +280,19 @@ function k() {
|
|
|
280
280
|
]
|
|
281
281
|
}), /* @__PURE__ */ E("div", {
|
|
282
282
|
className: "hidden min-h-0 xl:block",
|
|
283
|
-
children: /* @__PURE__ */ E(
|
|
283
|
+
children: /* @__PURE__ */ E(m, { ticket: I })
|
|
284
284
|
})]
|
|
285
285
|
})
|
|
286
286
|
]
|
|
287
|
-
}) : /* @__PURE__ */ E(
|
|
287
|
+
}) : /* @__PURE__ */ E(s, {
|
|
288
288
|
showHeader: !1,
|
|
289
|
-
children: /* @__PURE__ */ E(
|
|
290
|
-
|
|
289
|
+
children: /* @__PURE__ */ E(te, {
|
|
290
|
+
illustration: "empty-search",
|
|
291
291
|
title: "Ticket not found",
|
|
292
292
|
description: "The ticket you're looking for doesn't exist or has been deleted.",
|
|
293
293
|
action: /* @__PURE__ */ D(n, {
|
|
294
294
|
onClick: Q,
|
|
295
|
-
children: [/* @__PURE__ */ E(
|
|
295
|
+
children: [/* @__PURE__ */ E(C, { size: 18 }), "Back to Tickets"]
|
|
296
296
|
})
|
|
297
297
|
})
|
|
298
298
|
});
|