@burdenoff/microfe-support 2026.1014.3 → 2026.1029.1

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.
@@ -2,220 +2,235 @@ import { useTr as e } from "../hooks/useTr.js";
2
2
  import { useSupport as t } from "../providers/SupportProvider.js";
3
3
  import { isAdminRole as n } from "../utils/index.js";
4
4
  import { Button as r, EmphasisPanel as i, NextSteps as a } from "../components/ui.js";
5
- import { useGetCannedResponsesQuery as o } from "../../generated/global-operations.js";
5
+ import { useGetCannedResponsesQuery as o, useGetTicketCategoriesQuery as ee } from "../../generated/global-operations.js";
6
6
  import { MessageType as s, SupportTicketStatus as c } from "../../generated/global-types.js";
7
- import { EmptyState as l, LoadingState as ee, PageLayout as u } from "../components/PageLayout.js";
8
- import { useTicketOperations as d } from "../hooks/useTicketOperations.js";
9
- import { registerBreadcrumbName as f, unregisterBreadcrumbName as p } from "../utils/breadcrumbRegistry.js";
10
- import { useNotification as m } from "../hooks/useNotification.js";
11
- import { NotificationToast as h } from "../components/NotificationToast.js";
12
- import { extractErrorMessage as g } from "../utils/errors.js";
13
- import { uploadSupportAttachmentFiles as _ } from "../utils/supportFiles.js";
14
- import { useAttachmentsFailedToast as v } from "../hooks/useAttachmentsFailedToast.js";
15
- import { TicketHeader as y } from "../components/tickets/TicketHeader.js";
16
- import { TicketSidebar as b } from "../components/tickets/TicketSidebar.js";
7
+ import { EmptyState as l, LoadingState as u, PageLayout as d } from "../components/PageLayout.js";
8
+ import { useTicketOperations as f } from "../hooks/useTicketOperations.js";
9
+ import { registerBreadcrumbName as p, unregisterBreadcrumbName as m } from "../utils/breadcrumbRegistry.js";
10
+ import { useNotification as h } from "../hooks/useNotification.js";
11
+ import { NotificationToast as g } from "../components/NotificationToast.js";
12
+ import { extractErrorMessage as _ } from "../utils/errors.js";
13
+ import { uploadSupportAttachmentFiles as te } from "../utils/supportFiles.js";
14
+ import { useAttachmentsFailedToast as ne } from "../hooks/useAttachmentsFailedToast.js";
15
+ import { TicketHeader as v } from "../components/tickets/TicketHeader.js";
16
+ import { TicketSidebar as y } from "../components/tickets/TicketSidebar.js";
17
+ import { TriagePanel as b } from "../components/tickets/TriagePanel.js";
17
18
  import { AttachmentList as x } from "../components/tickets/AttachmentList.js";
18
19
  import { MarkdownContent as S } from "../components/tickets/MarkdownContent.js";
19
- import { MessageThread as te } from "../components/tickets/MessageThread.js";
20
- import { MessageComposer as ne } from "../components/tickets/MessageComposer.js";
21
- import { useEffect as C, useRef as w } from "react";
22
- import { AlertCircle as T, ArrowLeft as E } from "lucide-react";
23
- import { useNavigate as D, useParams as O } from "react-router";
24
- import { jsx as k, jsxs as A } from "react/jsx-runtime";
25
- import { useShellUi as j } from "@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider";
20
+ import { MessageThread as re } from "../components/tickets/MessageThread.js";
21
+ import { MessageComposer as C } from "../components/tickets/MessageComposer.js";
22
+ import { useEffect as w, useMemo as T, useRef as E } from "react";
23
+ import { AlertCircle as D, ArrowLeft as O } from "lucide-react";
24
+ import { useNavigate as k, useParams as A } from "react-router";
25
+ import { jsx as j, jsxs as M } from "react/jsx-runtime";
26
+ import { useShellUi as N } from "@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider";
26
27
  //#region src/support/pages/TicketDetailAdminPage.tsx
27
- function M() {
28
- let { ticketId: M } = O(), N = D(), { currentUser: P } = t(), { footerVisible: F, setFooterVisible: I } = j(), L = w(F), R = e(), { ticketDetail: z, ticketDetailLoading: B, ticketDetailError: V, changeTicketStatus: H, addTicketMessage: U, addMessageLoading: W, setSelectedTicket: G } = d(), K = n(P?.role), { data: q, loading: J } = o({
28
+ function P() {
29
+ let { ticketId: P } = A(), F = k(), { currentUser: I } = t(), { footerVisible: L, setFooterVisible: R } = N(), ie = E(L), z = e(), { ticketDetail: B, ticketDetailLoading: V, ticketDetailError: H, changeTicketStatus: U, addTicketMessage: W, addMessageLoading: G, refetchTicketDetail: K, setSelectedTicket: q } = f(), J = n(I?.role), { data: Y, loading: ae } = o({
29
30
  variables: {
30
31
  filter: { isActive: !0 },
31
32
  limit: 100
32
33
  },
33
- skip: !K
34
- }), Y = q?.cannedResponses.nodes ?? [], { notification: X, notify: Z } = m();
35
- v(Z), C(() => (M && G({ id: M }), () => {
36
- G(null);
37
- }), [M, G]), C(() => (I(!1), () => {
38
- I(L.current);
39
- }), [I]), C(() => (f(M, z?.ticketNumber), () => p(M)), [M, z?.ticketNumber]);
34
+ skip: !J
35
+ }), oe = Y?.cannedResponses.nodes ?? [], { data: X } = ee({
36
+ variables: {
37
+ limit: 100,
38
+ offset: 0
39
+ },
40
+ skip: !J
41
+ }), se = T(() => Object.fromEntries((X?.ticketCategories.nodes ?? []).map((e) => [e.id, e.name])), [X]), { notification: ce, notify: Z } = h();
42
+ ne(Z), w(() => (P && q({ id: P }), () => {
43
+ q(null);
44
+ }), [P, q]), w(() => (R(!1), () => {
45
+ R(ie.current);
46
+ }), [R]), w(() => (p(P, B?.ticketNumber), () => m(P)), [P, B?.ticketNumber]);
40
47
  let Q = () => {
41
- G(null), N("..");
48
+ q(null), F("..");
42
49
  }, $ = async (e) => {
43
- if (M) try {
44
- await H(M, e);
50
+ if (P) try {
51
+ await U(P, e);
45
52
  } catch (e) {
46
- console.error("Failed to change status:", e), Z("error", g(e, R("support.ticketDetail.errors.changeStatus", "Failed to change ticket status.")), 6e3);
53
+ console.error("Failed to change status:", e), Z("error", _(e, z("support.ticketDetail.errors.changeStatus", "Failed to change ticket status.")), 6e3);
47
54
  }
48
- }, re = async (e, t, n) => {
49
- if (!M) return;
55
+ }, le = async (e, t, n) => {
56
+ if (!P) return;
50
57
  if (!e.trim() && n.length === 0) {
51
- Z("error", R("support.ticketDetail.errors.nothingToSend", "Nothing to send."), 6e3);
58
+ Z("error", z("support.ticketDetail.errors.nothingToSend", "Nothing to send."), 6e3);
52
59
  return;
53
60
  }
54
61
  let r, i = null;
55
62
  if (n.length > 0) try {
56
- r = (await _({
57
- ticketId: M,
63
+ r = (await te({
64
+ ticketId: P,
58
65
  files: n
59
66
  })).files.map((e) => e.id);
60
67
  } catch (e) {
61
- i = g(e, R("support.ticketDetail.errors.uploadAttachments", "Failed to upload attachments."));
68
+ i = _(e, z("support.ticketDetail.errors.uploadAttachments", "Failed to upload attachments."));
62
69
  }
63
70
  if (!e.trim() && !r?.length) {
64
- let e = i ? R("support.ticketDetail.errors.attachmentUploadFailed", "Attachment upload failed: {{message}}", { message: i }) : R("support.ticketDetail.errors.nothingToSend", "Nothing to send.");
71
+ let e = i ? z("support.ticketDetail.errors.attachmentUploadFailed", "Attachment upload failed: {{message}}", { message: i }) : z("support.ticketDetail.errors.nothingToSend", "Nothing to send.");
65
72
  return Z("error", e, 6e3), n.length > 0 ? { preserveAttachedFiles: !0 } : void 0;
66
73
  }
67
74
  try {
68
- if (await U({
69
- ticketId: M,
75
+ if (await W({
76
+ ticketId: P,
70
77
  message: e,
71
78
  type: t ? s.InternalNote : s.AgentReply,
72
79
  isInternal: t,
73
80
  attachments: r
74
- }), i) return Z("error", R("support.ticketDetail.errors.messageSentAttachmentsFailed", "Message sent, but attachments failed: {{message}}", { message: i }), 6e3), { preserveAttachedFiles: n.length > 0 };
81
+ }), i) return Z("error", z("support.ticketDetail.errors.messageSentAttachmentsFailed", "Message sent, but attachments failed: {{message}}", { message: i }), 6e3), { preserveAttachedFiles: n.length > 0 };
75
82
  } catch (e) {
76
- return console.error("[support] addTicketMessage failed", e), Z("error", g(e, R("support.ticketDetail.errors.sendMessage", "Failed to send message.")), 6e3), {
83
+ return console.error("[support] addTicketMessage failed", e), Z("error", _(e, z("support.ticketDetail.errors.sendMessage", "Failed to send message.")), 6e3), {
77
84
  preserveMessage: !0,
78
85
  preserveAttachedFiles: n.length > 0
79
86
  };
80
87
  }
81
88
  };
82
- return B && !z ? /* @__PURE__ */ k(u, {
89
+ return V && !B ? /* @__PURE__ */ j(d, {
83
90
  showHeader: !1,
84
- children: /* @__PURE__ */ k(ee, { message: R("support.ticketDetail.loading", "Loading ticket details...") })
85
- }) : V ? /* @__PURE__ */ k(u, {
91
+ children: /* @__PURE__ */ j(u, { message: z("support.ticketDetail.loading", "Loading ticket details...") })
92
+ }) : H ? /* @__PURE__ */ j(d, {
86
93
  showHeader: !1,
87
- children: /* @__PURE__ */ A("div", {
94
+ children: /* @__PURE__ */ M("div", {
88
95
  className: "flex flex-col items-center justify-center py-16 text-center",
89
96
  children: [
90
- /* @__PURE__ */ k("div", {
97
+ /* @__PURE__ */ j("div", {
91
98
  className: "p-4 rounded-2xl bg-status-error-bg/10 text-status-error-text mb-4",
92
- children: /* @__PURE__ */ k(T, { size: 48 })
99
+ children: /* @__PURE__ */ j(D, { size: 48 })
93
100
  }),
94
- /* @__PURE__ */ k("h3", {
101
+ /* @__PURE__ */ j("h3", {
95
102
  className: "text-lg font-semibold text-text-primary mb-2",
96
- children: R("support.ticketDetail.error.title", "Failed to load ticket")
103
+ children: z("support.ticketDetail.error.title", "Failed to load ticket")
97
104
  }),
98
- /* @__PURE__ */ k("p", {
105
+ /* @__PURE__ */ j("p", {
99
106
  className: "text-sm text-text-secondary max-w-md mb-4",
100
- children: V.message || R("support.ticketDetail.error.description", "An error occurred while loading the ticket. Please try again.")
107
+ children: H.message || z("support.ticketDetail.error.description", "An error occurred while loading the ticket. Please try again.")
101
108
  }),
102
- /* @__PURE__ */ A(r, {
109
+ /* @__PURE__ */ M(r, {
103
110
  onClick: Q,
104
- children: [/* @__PURE__ */ k(E, { size: 18 }), R("support.ticketDetail.actions.back", "Back to Tickets")]
111
+ children: [/* @__PURE__ */ j(O, { size: 18 }), z("support.ticketDetail.actions.back", "Back to Tickets")]
105
112
  })
106
113
  ]
107
114
  })
108
- }) : z ? /* @__PURE__ */ A("div", {
115
+ }) : B ? /* @__PURE__ */ M("div", {
109
116
  className: "flex h-full min-h-0 flex-col bg-bg-surface",
110
117
  children: [
111
- /* @__PURE__ */ k(h, { notification: X }),
112
- /* @__PURE__ */ k(y, {
113
- ticket: z,
118
+ /* @__PURE__ */ j(g, { notification: ce }),
119
+ /* @__PURE__ */ j(v, {
120
+ ticket: B,
114
121
  onBack: Q,
115
122
  onStatusChange: $
116
123
  }),
117
- /* @__PURE__ */ A("div", {
124
+ /* @__PURE__ */ M("div", {
118
125
  className: "flex min-h-0 flex-1 overflow-hidden",
119
- children: [/* @__PURE__ */ A("div", {
126
+ children: [/* @__PURE__ */ M("div", {
120
127
  className: "flex min-h-0 flex-1 flex-col overflow-hidden",
121
128
  children: [
122
- /* @__PURE__ */ k("div", {
129
+ /* @__PURE__ */ j("div", {
123
130
  className: "shrink-0 border-b border-border-subtle bg-bg-surface p-4 sm:p-6",
124
- children: /* @__PURE__ */ A(i, {
131
+ children: /* @__PURE__ */ M(i, {
125
132
  className: "p-4",
126
133
  children: [
127
- /* @__PURE__ */ k("h2", {
134
+ /* @__PURE__ */ j("h2", {
128
135
  className: "text-lg font-semibold mb-2 text-text-primary",
129
- children: R("support.ticketDetail.descriptionTitle", "Customer request — Description")
136
+ children: z("support.ticketDetail.descriptionTitle", "Customer request — Description")
130
137
  }),
131
- /* @__PURE__ */ k(S, {
132
- content: z.description,
138
+ /* @__PURE__ */ j(S, {
139
+ content: B.description,
133
140
  className: "text-sm"
134
141
  }),
135
- /* @__PURE__ */ k(x, {
136
- ticketId: z.id,
137
- fileIds: z.metadata?.initialAttachmentIds ?? []
142
+ /* @__PURE__ */ j(x, {
143
+ ticketId: B.id,
144
+ fileIds: B.metadata?.initialAttachmentIds ?? []
138
145
  })
139
146
  ]
140
147
  })
141
148
  }),
142
- /* @__PURE__ */ A("div", {
149
+ /* @__PURE__ */ M("div", {
143
150
  "data-tour": "support-admin-ticket-conversation",
144
151
  className: "min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",
145
152
  children: [
146
- /* @__PURE__ */ k(a, {
153
+ /* @__PURE__ */ j(a, {
147
154
  storageKey: "support-ticket-detail-admin",
148
- title: R("support.ticketDetail.nextSteps.title", "Agent quick actions"),
155
+ title: z("support.ticketDetail.nextSteps.title", "Agent quick actions"),
149
156
  className: "mb-6",
150
157
  steps: [{
151
158
  id: "reply",
152
- label: R("support.ticketDetail.nextSteps.reply.label", "Reply to the customer"),
153
- description: R("support.ticketDetail.nextSteps.reply.description", "Draft a response in the composer below."),
159
+ label: z("support.ticketDetail.nextSteps.reply.label", "Reply to the customer"),
160
+ description: z("support.ticketDetail.nextSteps.reply.description", "Draft a response in the composer below."),
154
161
  onClick: () => document.querySelector("[data-tour=\"support-admin-ticket-conversation\"]")?.scrollTo({
155
162
  top: 999999,
156
163
  behavior: "smooth"
157
164
  })
158
- }, ...K ? [{
165
+ }, ...J ? [{
159
166
  id: "in-progress",
160
- label: R("support.ticketDetail.nextSteps.inProgress.label", "Mark as In Progress"),
161
- description: R("support.ticketDetail.nextSteps.inProgress.description", "Let the customer know you are working on it."),
167
+ label: z("support.ticketDetail.nextSteps.inProgress.label", "Mark as In Progress"),
168
+ description: z("support.ticketDetail.nextSteps.inProgress.description", "Let the customer know you are working on it."),
162
169
  onClick: () => void $(c.InProgress),
163
- done: z.status === c.InProgress
170
+ done: B.status === c.InProgress
164
171
  }, {
165
172
  id: "resolve",
166
- label: R("support.ticketDetail.nextSteps.resolve.label", "Resolve the ticket"),
167
- description: R("support.ticketDetail.nextSteps.resolve.description", "Close out the request once the issue is fixed."),
173
+ label: z("support.ticketDetail.nextSteps.resolve.label", "Resolve the ticket"),
174
+ description: z("support.ticketDetail.nextSteps.resolve.description", "Close out the request once the issue is fixed."),
168
175
  onClick: () => void $(c.Resolved),
169
- done: z.status === c.Resolved
176
+ done: B.status === c.Resolved
170
177
  }] : []]
171
178
  }),
172
- /* @__PURE__ */ k("h2", {
179
+ J && /* @__PURE__ */ j(b, {
180
+ ticketId: B.id,
181
+ decision: B.triageDecision,
182
+ draft: B.replyDraft,
183
+ categoryNames: se,
184
+ onChanged: () => K(),
185
+ notify: Z
186
+ }),
187
+ /* @__PURE__ */ j("h2", {
173
188
  className: "text-lg font-semibold mb-4 text-text-primary",
174
- children: R("support.ticketDetail.conversationTitle", "Conversation")
189
+ children: z("support.ticketDetail.conversationTitle", "Conversation")
175
190
  }),
176
- /* @__PURE__ */ k(te, {
177
- ticketId: z.id,
178
- messages: z.messages || [],
179
- currentUserId: P?.id,
191
+ /* @__PURE__ */ j(re, {
192
+ ticketId: B.id,
193
+ messages: B.messages || [],
194
+ currentUserId: I?.id,
180
195
  viewerRole: "agent",
181
- showInternalMessages: K,
182
- showRealAgentIdentity: K
196
+ showInternalMessages: J,
197
+ showRealAgentIdentity: J
183
198
  }),
184
- /* @__PURE__ */ k("div", {
199
+ /* @__PURE__ */ j("div", {
185
200
  className: "mt-6 rounded-xl border border-border-seam bg-bg-surface p-4 xl:hidden",
186
- children: /* @__PURE__ */ k(b, { ticket: z })
201
+ children: /* @__PURE__ */ j(y, { ticket: B })
187
202
  })
188
203
  ]
189
204
  }),
190
- /* @__PURE__ */ k(ne, {
191
- ticketId: z.id,
192
- onSendMessage: re,
193
- disabled: W,
194
- allowInternalNotes: K,
195
- cannedResponses: Y,
196
- cannedResponsesLoading: J
205
+ /* @__PURE__ */ j(C, {
206
+ ticketId: B.id,
207
+ onSendMessage: le,
208
+ disabled: G,
209
+ allowInternalNotes: J,
210
+ cannedResponses: oe,
211
+ cannedResponsesLoading: ae
197
212
  })
198
213
  ]
199
- }), /* @__PURE__ */ k("div", {
214
+ }), /* @__PURE__ */ j("div", {
200
215
  className: "hidden min-h-0 xl:block",
201
- children: /* @__PURE__ */ k(b, { ticket: z })
216
+ children: /* @__PURE__ */ j(y, { ticket: B })
202
217
  })]
203
218
  })
204
219
  ]
205
- }) : /* @__PURE__ */ k(u, {
220
+ }) : /* @__PURE__ */ j(d, {
206
221
  showHeader: !1,
207
- children: /* @__PURE__ */ k(l, {
222
+ children: /* @__PURE__ */ j(l, {
208
223
  illustration: "empty-search",
209
- title: R("support.ticketDetail.notFound.title", "Ticket not found"),
210
- description: R("support.ticketDetail.notFound.description", "The ticket you're looking for doesn't exist or has been deleted."),
211
- action: /* @__PURE__ */ A(r, {
224
+ title: z("support.ticketDetail.notFound.title", "Ticket not found"),
225
+ description: z("support.ticketDetail.notFound.description", "The ticket you're looking for doesn't exist or has been deleted."),
226
+ action: /* @__PURE__ */ M(r, {
212
227
  onClick: Q,
213
- children: [/* @__PURE__ */ k(E, { size: 18 }), R("support.ticketDetail.actions.back", "Back to Tickets")]
228
+ children: [/* @__PURE__ */ j(O, { size: 18 }), z("support.ticketDetail.actions.back", "Back to Tickets")]
214
229
  })
215
230
  })
216
231
  });
217
232
  }
218
233
  //#endregion
219
- export { M as TicketDetailAdminPage };
234
+ export { P as TicketDetailAdminPage };
220
235
 
221
236
  //# 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';\nimport { AlertCircle, ArrowLeft } from 'lucide-react';\nimport { Button, EmphasisPanel, NextSteps } from '../components/ui';\nimport { useShellUi } from '@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useTr } from '../hooks/useTr';\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 { MessageType, SupportTicketStatus, type SupportTicket } from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { extractErrorMessage } from '../utils/errors';\nimport { isAdminRole } from '../utils';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { registerBreadcrumbName, unregisterBreadcrumbName } from '../utils/breadcrumbRegistry';\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 tr = useTr();\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 useEffect(() => {\n registerBreadcrumbName(ticketId, ticketDetail?.ticketNumber);\n return () => unregisterBreadcrumbName(ticketId);\n }, [ticketId, ticketDetail?.ticketNumber]);\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(\n 'error',\n extractErrorMessage(\n error,\n tr('support.ticketDetail.errors.changeStatus', 'Failed to change ticket status.')\n ),\n 6000\n );\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', tr('support.ticketDetail.errors.nothingToSend', '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(\n uploadError,\n tr('support.ticketDetail.errors.uploadAttachments', 'Failed to upload attachments.')\n );\n }\n }\n\n if (!messageText.trim() && !attachmentIds?.length) {\n const errorMessage = attachmentError\n ? tr(\n 'support.ticketDetail.errors.attachmentUploadFailed',\n 'Attachment upload failed: {{message}}',\n { message: attachmentError }\n )\n : tr('support.ticketDetail.errors.nothingToSend', '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(\n 'error',\n tr(\n 'support.ticketDetail.errors.messageSentAttachmentsFailed',\n 'Message sent, but attachments failed: {{message}}',\n { message: attachmentError }\n ),\n 6000\n );\n return { preserveAttachedFiles: files.length > 0 };\n }\n } catch (sendError) {\n console.error('[support] addTicketMessage failed', sendError);\n notify(\n 'error',\n extractErrorMessage(\n sendError,\n tr('support.ticketDetail.errors.sendMessage', 'Failed to send message.')\n ),\n 6000\n );\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={tr('support.ticketDetail.loading', '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\">\n {tr('support.ticketDetail.error.title', 'Failed to load ticket')}\n </h3>\n <p className=\"text-sm text-text-secondary max-w-md mb-4\">\n {ticketDetailError.message ||\n tr(\n 'support.ticketDetail.error.description',\n 'An error occurred while loading the ticket. Please try again.'\n )}\n </p>\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n {tr('support.ticketDetail.actions.back', '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={tr('support.ticketDetail.notFound.title', 'Ticket not found')}\n description={tr(\n 'support.ticketDetail.notFound.description',\n \"The ticket you're looking for doesn't exist or has been deleted.\"\n )}\n action={\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n {tr('support.ticketDetail.actions.back', '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 <EmphasisPanel className=\"p-4\">\n <h2 className=\"text-lg font-semibold mb-2 text-text-primary\">\n {tr('support.ticketDetail.descriptionTitle', 'Customer request — Description')}\n </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)\n ?.initialAttachmentIds as string[] | undefined) ?? []\n }\n />\n </EmphasisPanel>\n </div>\n\n <div\n data-tour=\"support-admin-ticket-conversation\"\n className=\"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6\"\n >\n <NextSteps\n storageKey=\"support-ticket-detail-admin\"\n title={tr('support.ticketDetail.nextSteps.title', 'Agent quick actions')}\n className=\"mb-6\"\n steps={[\n {\n id: 'reply',\n label: tr('support.ticketDetail.nextSteps.reply.label', 'Reply to the customer'),\n description: tr(\n 'support.ticketDetail.nextSteps.reply.description',\n 'Draft a response in the composer below.'\n ),\n onClick: () =>\n document\n .querySelector('[data-tour=\"support-admin-ticket-conversation\"]')\n ?.scrollTo({ top: 999999, behavior: 'smooth' }),\n },\n ...(canLeaveInternalNotes\n ? [\n {\n id: 'in-progress',\n label: tr(\n 'support.ticketDetail.nextSteps.inProgress.label',\n 'Mark as In Progress'\n ),\n description: tr(\n 'support.ticketDetail.nextSteps.inProgress.description',\n 'Let the customer know you are working on it.'\n ),\n onClick: () => void handleStatusChange(SupportTicketStatus.InProgress),\n done: ticketDetail.status === SupportTicketStatus.InProgress,\n },\n {\n id: 'resolve',\n label: tr(\n 'support.ticketDetail.nextSteps.resolve.label',\n 'Resolve the ticket'\n ),\n description: tr(\n 'support.ticketDetail.nextSteps.resolve.description',\n 'Close out the request once the issue is fixed.'\n ),\n onClick: () => void handleStatusChange(SupportTicketStatus.Resolved),\n done: ticketDetail.status === SupportTicketStatus.Resolved,\n },\n ]\n : []),\n ]}\n />\n <h2 className=\"text-lg font-semibold mb-4 text-text-primary\">\n {tr('support.ticketDetail.conversationTitle', 'Conversation')}\n </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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,IAAwB;CACtC,IAAM,EAAE,gBAAa,EAAgC,GAC/C,IAAW,EAAY,GACvB,EAAE,mBAAgB,EAAW,GAC7B,EAAE,kBAAe,wBAAqB,EAAW,GACjD,IAAuB,EAAO,CAAa,GAC3C,IAAK,EAAM,GACX,EACJ,iBACA,wBACA,sBACA,uBACA,qBACA,sBACA,yBACE,EAAoB,GAClB,IAAwB,EAAY,GAAa,IAAI,GACrD,EAAE,MAAM,GAAqB,SAAS,MAA2B,EACrE;EACE,WAAW;GACT,QAAQ,EAAE,UAAU,GAAK;GACzB,OAAO;EACT;EACA,MAAM,CAAC;CACT,CACF,GACM,IAAkB,GAAqB,gBAAgB,SAAS,CAAC,GAEjE,EAAE,iBAAc,cAAW,EAAgB;CAoBjD,AAnBA,EAA0B,CAAM,GAEhC,SACM,KACF,EAAkB,EAAE,IAAI,EAAS,CAAkB,SAExC;EACX,EAAkB,IAAI;CACxB,IACC,CAAC,GAAU,CAAiB,CAAC,GAEhC,SACE,EAAiB,EAAK,SAET;EACX,EAAiB,EAAqB,OAAO;CAC/C,IACC,CAAC,CAAgB,CAAC,GAErB,SACE,EAAuB,GAAU,GAAc,YAAY,SAC9C,EAAyB,CAAQ,IAC7C,CAAC,GAAU,GAAc,YAAY,CAAC;CA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A;IACnC,CAAA,CACF;;EACF;MA/HH,kBAAC,GAAD;EAAY,YAAY;EACtB,UAAA,kBAAC,GAAD;GACE,cAAa;GACb,OAAO,EAAG,uCAAuC,kBAAkB;GACnE,aAAa,EACX,6CACA,kEACF;GACA,QACE,kBAAC,GAAD;IAAQ,SAAS;IAAjB,UAAA,CACE,kBAAC,GAAD,EAAW,MAAM,GAAK,CAAA,GACrB,EAAG,qCAAqC,iBAAiB,CACpD;;EAEX,CAAA;CACS,CAAA;AAkHlB"}
1
+ {"version":3,"file":"TicketDetailAdminPage.js","names":[],"sources":["../../../src/support/pages/TicketDetailAdminPage.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport { useParams, useNavigate } from 'react-router';\nimport { AlertCircle, ArrowLeft } from 'lucide-react';\nimport { Button, EmphasisPanel, NextSteps } from '../components/ui';\nimport { useShellUi } from '@burdenoff/fe-libs/shared/providers/shell/ShellUiProvider';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useTr } from '../hooks/useTr';\nimport {\n useGetCannedResponsesQuery,\n useGetTicketCategoriesQuery,\n} 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 { TriagePanel } from '../components/tickets/TriagePanel';\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 { MessageType, SupportTicketStatus, type SupportTicket } from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { extractErrorMessage } from '../utils/errors';\nimport { isAdminRole } from '../utils';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { registerBreadcrumbName, unregisterBreadcrumbName } from '../utils/breadcrumbRegistry';\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 tr = useTr();\n const {\n ticketDetail,\n ticketDetailLoading,\n ticketDetailError,\n changeTicketStatus,\n addTicketMessage,\n addMessageLoading,\n refetchTicketDetail,\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 const { data: categoriesData } = useGetTicketCategoriesQuery({\n variables: { limit: 100, offset: 0 },\n skip: !canLeaveInternalNotes,\n });\n const categoryNames = useMemo(\n () =>\n Object.fromEntries(\n (categoriesData?.ticketCategories.nodes ?? []).map(\n (category: { id: string; name: string }) => [category.id, category.name]\n )\n ),\n [categoriesData]\n );\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 useEffect(() => {\n registerBreadcrumbName(ticketId, ticketDetail?.ticketNumber);\n return () => unregisterBreadcrumbName(ticketId);\n }, [ticketId, ticketDetail?.ticketNumber]);\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(\n 'error',\n extractErrorMessage(\n error,\n tr('support.ticketDetail.errors.changeStatus', 'Failed to change ticket status.')\n ),\n 6000\n );\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', tr('support.ticketDetail.errors.nothingToSend', '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(\n uploadError,\n tr('support.ticketDetail.errors.uploadAttachments', 'Failed to upload attachments.')\n );\n }\n }\n\n if (!messageText.trim() && !attachmentIds?.length) {\n const errorMessage = attachmentError\n ? tr(\n 'support.ticketDetail.errors.attachmentUploadFailed',\n 'Attachment upload failed: {{message}}',\n { message: attachmentError }\n )\n : tr('support.ticketDetail.errors.nothingToSend', '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(\n 'error',\n tr(\n 'support.ticketDetail.errors.messageSentAttachmentsFailed',\n 'Message sent, but attachments failed: {{message}}',\n { message: attachmentError }\n ),\n 6000\n );\n return { preserveAttachedFiles: files.length > 0 };\n }\n } catch (sendError) {\n console.error('[support] addTicketMessage failed', sendError);\n notify(\n 'error',\n extractErrorMessage(\n sendError,\n tr('support.ticketDetail.errors.sendMessage', 'Failed to send message.')\n ),\n 6000\n );\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={tr('support.ticketDetail.loading', '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\">\n {tr('support.ticketDetail.error.title', 'Failed to load ticket')}\n </h3>\n <p className=\"text-sm text-text-secondary max-w-md mb-4\">\n {ticketDetailError.message ||\n tr(\n 'support.ticketDetail.error.description',\n 'An error occurred while loading the ticket. Please try again.'\n )}\n </p>\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n {tr('support.ticketDetail.actions.back', '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={tr('support.ticketDetail.notFound.title', 'Ticket not found')}\n description={tr(\n 'support.ticketDetail.notFound.description',\n \"The ticket you're looking for doesn't exist or has been deleted.\"\n )}\n action={\n <Button onClick={handleBack}>\n <ArrowLeft size={18} />\n {tr('support.ticketDetail.actions.back', '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 <EmphasisPanel className=\"p-4\">\n <h2 className=\"text-lg font-semibold mb-2 text-text-primary\">\n {tr('support.ticketDetail.descriptionTitle', 'Customer request — Description')}\n </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)\n ?.initialAttachmentIds as string[] | undefined) ?? []\n }\n />\n </EmphasisPanel>\n </div>\n\n <div\n data-tour=\"support-admin-ticket-conversation\"\n className=\"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6\"\n >\n <NextSteps\n storageKey=\"support-ticket-detail-admin\"\n title={tr('support.ticketDetail.nextSteps.title', 'Agent quick actions')}\n className=\"mb-6\"\n steps={[\n {\n id: 'reply',\n label: tr('support.ticketDetail.nextSteps.reply.label', 'Reply to the customer'),\n description: tr(\n 'support.ticketDetail.nextSteps.reply.description',\n 'Draft a response in the composer below.'\n ),\n onClick: () =>\n document\n .querySelector('[data-tour=\"support-admin-ticket-conversation\"]')\n ?.scrollTo({ top: 999999, behavior: 'smooth' }),\n },\n ...(canLeaveInternalNotes\n ? [\n {\n id: 'in-progress',\n label: tr(\n 'support.ticketDetail.nextSteps.inProgress.label',\n 'Mark as In Progress'\n ),\n description: tr(\n 'support.ticketDetail.nextSteps.inProgress.description',\n 'Let the customer know you are working on it.'\n ),\n onClick: () => void handleStatusChange(SupportTicketStatus.InProgress),\n done: ticketDetail.status === SupportTicketStatus.InProgress,\n },\n {\n id: 'resolve',\n label: tr(\n 'support.ticketDetail.nextSteps.resolve.label',\n 'Resolve the ticket'\n ),\n description: tr(\n 'support.ticketDetail.nextSteps.resolve.description',\n 'Close out the request once the issue is fixed.'\n ),\n onClick: () => void handleStatusChange(SupportTicketStatus.Resolved),\n done: ticketDetail.status === SupportTicketStatus.Resolved,\n },\n ]\n : []),\n ]}\n />\n {canLeaveInternalNotes && (\n <TriagePanel\n ticketId={ticketDetail.id}\n decision={ticketDetail.triageDecision}\n draft={ticketDetail.replyDraft}\n categoryNames={categoryNames}\n onChanged={() => refetchTicketDetail()}\n notify={notify}\n />\n )}\n <h2 className=\"text-lg font-semibold mb-4 text-text-primary\">\n {tr('support.ticketDetail.conversationTitle', 'Conversation')}\n </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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,IAAwB;CACtC,IAAM,EAAE,gBAAa,EAAgC,GAC/C,IAAW,EAAY,GACvB,EAAE,mBAAgB,EAAW,GAC7B,EAAE,kBAAe,wBAAqB,EAAW,GACjD,KAAuB,EAAO,CAAa,GAC3C,IAAK,EAAM,GACX,EACJ,iBACA,wBACA,sBACA,uBACA,qBACA,sBACA,wBACA,yBACE,EAAoB,GAClB,IAAwB,EAAY,GAAa,IAAI,GACrD,EAAE,MAAM,GAAqB,SAAS,OAA2B,EACrE;EACE,WAAW;GACT,QAAQ,EAAE,UAAU,GAAK;GACzB,OAAO;EACT;EACA,MAAM,CAAC;CACT,CACF,GACM,KAAkB,GAAqB,gBAAgB,SAAS,CAAC,GACjE,EAAE,MAAM,MAAmB,GAA4B;EAC3D,WAAW;GAAE,OAAO;GAAK,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W,EAAoB;SACpD,CACF,IACA,CAAC,CACP;QACD,CAAA;QACA,KACC,kBAAC,GAAD;SACE,UAAU,EAAa;SACvB,UAAU,EAAa;SACvB,OAAO,EAAa;SACL;SACf,iBAAiB,EAAoB;SAC7B;QACT,CAAA;QAEH,kBAAC,MAAD;SAAI,WAAU;SACX,UAAA,EAAG,0CAA0C,cAAc;QAC1D,CAAA;QACJ,kBAAC,IAAD;SACE,UAAU,EAAa;SACvB,UAAU,EAAa,YAAY,CAAC;SACpC,eAAe,GAAa;SAC5B,YAAW;SACX,sBAAsB;SACtB,uBAAuB;QACxB,CAAA;QAED,kBAAC,OAAD;SAAK,WAAU;SACb,UAAA,kBAAC,GAAD,EAAe,QAAQ,EAAe,CAAA;QACnC,CAAA;OACF;;MAEL,kBAAC,GAAD;OACE,UAAU,EAAa;OACvB,eAAe;OACf,UAAU;OACV,oBAAoB;OACH;OACO;MACzB,CAAA;KACE;IAEL,CAAA,GAAA,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAAC,GAAD,EAAe,QAAQ,EAAe,CAAA;IACnC,CAAA,CACF;;EACF;MAzIH,kBAAC,GAAD;EAAY,YAAY;EACtB,UAAA,kBAAC,GAAD;GACE,cAAa;GACb,OAAO,EAAG,uCAAuC,kBAAkB;GACnE,aAAa,EACX,6CACA,kEACF;GACA,QACE,kBAAC,GAAD;IAAQ,SAAS;IAAjB,UAAA,CACE,kBAAC,GAAD,EAAW,MAAM,GAAK,CAAA,GACrB,EAAG,qCAAqC,iBAAiB,CACpD;;EAEX,CAAA;CACS,CAAA;AA4HlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-support",
3
- "version": "2026.1014.3",
3
+ "version": "2026.1029.1",
4
4
  "description": "Burdenoff Support Microfrontend - Complete customer support and ticketing interface",
5
5
  "type": "module",
6
6
  "files": [