@burdenoff/microfe-support 2026.510.52 → 2026.511.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/generated/global-operations.js +177 -93
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +225 -181
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +211 -169
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/support/SupportAdminRoutes.js +15 -12
- package/dist/support/SupportAdminRoutes.js.map +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.js +204 -71
- package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
- package/dist/support/components/tickets/MessageComposer.js +137 -107
- package/dist/support/components/tickets/MessageComposer.js.map +1 -1
- package/dist/support/components/tickets/MessageThread.js +11 -11
- package/dist/support/components/tickets/MessageThread.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +55 -45
- package/dist/support/components/tickets/TicketHeader.js.map +1 -1
- package/dist/support/components/tickets/TicketSidebar.js +105 -114
- package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
- package/dist/support/hooks/useKnowledgeBaseOperations.js +79 -76
- package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
- package/dist/support/hooks/useSettingsOperations.js +15 -9
- package/dist/support/hooks/useSettingsOperations.js.map +1 -1
- package/dist/support/hooks/useTicketOperations.js +130 -86
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/pages/AnalyticsPage.js +41 -45
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.js +148 -147
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.js +71 -70
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.js +120 -138
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.js +27 -24
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.js +27 -24
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.js +3 -1
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +121 -94
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.js +168 -157
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/dist/support/utils/index.js +19 -14
- package/dist/support/utils/index.js.map +1 -1
- package/dist/support/utils/supportFiles.js +27 -24
- package/dist/support/utils/supportFiles.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,272 +1,254 @@
|
|
|
1
1
|
import { useSupport as e } from "../providers/SupportProvider.js";
|
|
2
2
|
import { joinPath as t } from "../utils/index.js";
|
|
3
3
|
import { Button as n, Input as r } from "../components/ui.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
4
|
+
import { useGetTicketCategoriesQuery as i } from "../../generated/global-operations.js";
|
|
5
|
+
import { SupportTicketPriority as a } from "../../generated/global-types.js";
|
|
6
|
+
import { useTicketOperations as o } from "../hooks/useTicketOperations.js";
|
|
7
|
+
import { PageLayout as s } from "../components/PageLayout.js";
|
|
8
|
+
import { useNotification as c } from "../hooks/useNotification.js";
|
|
9
|
+
import { NotificationToast as l } from "../components/NotificationToast.js";
|
|
10
|
+
import { extractErrorMessage as u } from "../utils/errors.js";
|
|
11
|
+
import { uploadSupportAttachmentFiles as d } from "../utils/supportFiles.js";
|
|
12
|
+
import { ATTACHMENTS_FAILED_PARAM as f } from "../constants.js";
|
|
13
|
+
import { useEffect as p, useRef as m, useState as h } from "react";
|
|
14
|
+
import { ArrowLeft as g, Loader2 as _, Paperclip as v, Plus as y } from "lucide-react";
|
|
15
|
+
import { useNavigate as b } from "react-router-dom";
|
|
16
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
17
|
//#region src/support/pages/CreateTicketPage.tsx
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
let
|
|
18
|
+
var w = 5, T = 10;
|
|
19
|
+
function E() {
|
|
20
|
+
let E = b(), { basePath: D = "" } = e(), { createTicket: O, createTicketLoading: k, updateTicket: A } = o(), { data: j, loading: M } = i({ variables: {
|
|
21
|
+
filter: { isActive: !0 },
|
|
22
|
+
limit: 100,
|
|
23
|
+
offset: 0
|
|
24
|
+
} }), N = [...j?.ticketCategories?.nodes ?? []].sort((e, t) => e.displayOrder - t.displayOrder), [P, F] = h({
|
|
20
25
|
subject: "",
|
|
21
26
|
description: "",
|
|
22
|
-
priority:
|
|
23
|
-
|
|
24
|
-
}), [
|
|
25
|
-
|
|
27
|
+
priority: a.Normal,
|
|
28
|
+
categoryId: void 0
|
|
29
|
+
}), [I, L] = h([]), [R, z] = h(null), { notification: B, notify: V } = c(), H = m(null), U = () => {
|
|
30
|
+
H.current &&= (clearTimeout(H.current), null);
|
|
26
31
|
};
|
|
27
|
-
|
|
28
|
-
let
|
|
29
|
-
if (e.preventDefault(),
|
|
30
|
-
|
|
32
|
+
p(() => U, []);
|
|
33
|
+
let W = async (e) => {
|
|
34
|
+
if (e.preventDefault(), P.subject.trim().length < w) {
|
|
35
|
+
V("error", `Subject must be at least ${w} characters long.`);
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
|
-
if ((
|
|
34
|
-
|
|
38
|
+
if ((P.description ?? "").trim().length < T) {
|
|
39
|
+
V("error", `Description must be at least ${T} characters long.`);
|
|
35
40
|
return;
|
|
36
41
|
}
|
|
37
42
|
try {
|
|
38
|
-
let e = await
|
|
39
|
-
...
|
|
40
|
-
priority:
|
|
41
|
-
categoryId:
|
|
43
|
+
let e = await O({
|
|
44
|
+
...P,
|
|
45
|
+
priority: P.priority ?? void 0,
|
|
46
|
+
categoryId: P.categoryId ?? void 0
|
|
42
47
|
});
|
|
43
48
|
if (!e) return;
|
|
44
|
-
if (
|
|
45
|
-
let t = await
|
|
49
|
+
if (I.length > 0) try {
|
|
50
|
+
let t = await d({
|
|
46
51
|
ticketId: e.id,
|
|
47
|
-
files:
|
|
52
|
+
files: I,
|
|
48
53
|
onFileProgress: (e, t) => {
|
|
49
|
-
t < 100 &&
|
|
54
|
+
t < 100 && z(e);
|
|
50
55
|
}
|
|
51
56
|
});
|
|
52
|
-
await
|
|
53
|
-
initialAttachmentIds: t.files.map((e) => e.id),
|
|
54
|
-
attachmentFolderId: t.folderId,
|
|
55
|
-
attachmentFolderPath: t.folderPath
|
|
56
|
-
} }), F(null), N([]);
|
|
57
|
+
await A(e.id, { metadata: { initialAttachmentIds: t.files.map((e) => e.id) } }), z(null), L([]);
|
|
57
58
|
} catch (n) {
|
|
58
|
-
|
|
59
|
-
let r = new URLSearchParams({ [
|
|
60
|
-
|
|
59
|
+
z(null), console.error("[support] create ticket: attachments failed", n);
|
|
60
|
+
let r = new URLSearchParams({ [f]: "1" });
|
|
61
|
+
E(t(D, `tickets/${e.id}?${r.toString()}`));
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
V("success", "Ticket created successfully!"), U(), H.current = setTimeout(() => {
|
|
65
|
+
E(t(D, `tickets/${e.id}`)), H.current = null;
|
|
65
66
|
}, 1e3);
|
|
66
67
|
} catch (e) {
|
|
67
|
-
|
|
68
|
+
V("error", u(e, "Failed to create ticket. Please try again."), 5e3);
|
|
68
69
|
}
|
|
69
|
-
},
|
|
70
|
+
}, G = (e) => {
|
|
70
71
|
let t = Array.from(e.target.files || []);
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
72
|
+
L((e) => [...e, ...t]), e.target.value = "";
|
|
73
|
+
}, K = (e) => {
|
|
74
|
+
L((t) => t.filter((t, n) => n !== e));
|
|
74
75
|
};
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ C(s, {
|
|
76
77
|
showHeader: !1,
|
|
77
78
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ S(l, { notification: B }),
|
|
80
|
+
/* @__PURE__ */ C("div", {
|
|
80
81
|
className: "flex items-center gap-4 mb-6",
|
|
81
|
-
children: [/* @__PURE__ */
|
|
82
|
+
children: [/* @__PURE__ */ S(n, {
|
|
82
83
|
variant: "ghost",
|
|
83
84
|
size: "sm",
|
|
84
|
-
onClick: () =>
|
|
85
|
+
onClick: () => E(".."),
|
|
85
86
|
className: "p-2",
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
}), /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ S(g, { size: 20 })
|
|
88
|
+
}), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("h1", {
|
|
88
89
|
className: "text-2xl font-bold text-foreground",
|
|
89
90
|
children: "Create New Ticket"
|
|
90
|
-
}), /* @__PURE__ */
|
|
91
|
+
}), /* @__PURE__ */ S("p", {
|
|
91
92
|
className: "text-sm text-muted-foreground",
|
|
92
93
|
children: "Submit a new support request"
|
|
93
94
|
})] })]
|
|
94
95
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ S("div", {
|
|
96
97
|
className: "max-w-2xl",
|
|
97
|
-
children: /* @__PURE__ */
|
|
98
|
-
onSubmit:
|
|
98
|
+
children: /* @__PURE__ */ C("form", {
|
|
99
|
+
onSubmit: W,
|
|
99
100
|
className: "space-y-6",
|
|
100
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ C("div", {
|
|
101
102
|
className: "p-6 rounded-xl border bg-card space-y-6",
|
|
102
103
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("label", {
|
|
104
105
|
className: "block text-sm font-medium mb-2 text-foreground",
|
|
105
|
-
children: ["Subject ", /* @__PURE__ */
|
|
106
|
+
children: ["Subject ", /* @__PURE__ */ S("span", {
|
|
106
107
|
className: "text-destructive",
|
|
107
108
|
children: "*"
|
|
108
109
|
})]
|
|
109
|
-
}), /* @__PURE__ */
|
|
110
|
+
}), /* @__PURE__ */ S(r, {
|
|
110
111
|
type: "text",
|
|
111
112
|
required: !0,
|
|
112
|
-
value:
|
|
113
|
-
onChange: (e) =>
|
|
114
|
-
...
|
|
113
|
+
value: P.subject,
|
|
114
|
+
onChange: (e) => F({
|
|
115
|
+
...P,
|
|
115
116
|
subject: e.target.value
|
|
116
117
|
}),
|
|
117
118
|
placeholder: "Brief description of your issue"
|
|
118
119
|
})] }),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ C("div", { children: [
|
|
121
|
+
/* @__PURE__ */ C("label", {
|
|
121
122
|
className: "block text-sm font-medium mb-2 text-foreground",
|
|
122
|
-
children: ["Description ", /* @__PURE__ */
|
|
123
|
+
children: ["Description ", /* @__PURE__ */ S("span", {
|
|
123
124
|
className: "text-destructive",
|
|
124
125
|
children: "*"
|
|
125
126
|
})]
|
|
126
127
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ S("textarea", {
|
|
128
129
|
required: !0,
|
|
129
130
|
rows: 6,
|
|
130
|
-
value:
|
|
131
|
-
onChange: (e) =>
|
|
132
|
-
...
|
|
131
|
+
value: P.description || "",
|
|
132
|
+
onChange: (e) => F({
|
|
133
|
+
...P,
|
|
133
134
|
description: e.target.value
|
|
134
135
|
}),
|
|
135
136
|
className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
|
|
136
137
|
placeholder: "Provide detailed information about your issue"
|
|
137
138
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ S("p", {
|
|
139
140
|
className: "mt-2 text-xs text-muted-foreground",
|
|
140
141
|
children: "Markdown is supported, including fenced code blocks."
|
|
141
142
|
})
|
|
142
143
|
] }),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
144
145
|
className: "block text-sm font-medium mb-2 text-foreground",
|
|
145
146
|
children: "Priority"
|
|
146
|
-
}), /* @__PURE__ */
|
|
147
|
-
value:
|
|
148
|
-
onChange: (e) =>
|
|
149
|
-
...
|
|
147
|
+
}), /* @__PURE__ */ C("select", {
|
|
148
|
+
value: P.priority || "NORMAL",
|
|
149
|
+
onChange: (e) => F({
|
|
150
|
+
...P,
|
|
150
151
|
priority: e.target.value
|
|
151
152
|
}),
|
|
152
153
|
className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
|
|
153
154
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ S("option", {
|
|
155
156
|
value: "LOW",
|
|
156
157
|
children: "Low - General question or minor issue"
|
|
157
158
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ S("option", {
|
|
159
160
|
value: "NORMAL",
|
|
160
161
|
children: "Normal - Standard support request"
|
|
161
162
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ S("option", {
|
|
163
164
|
value: "HIGH",
|
|
164
165
|
children: "High - Significant impact on work"
|
|
165
166
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ S("option", {
|
|
167
168
|
value: "CRITICAL",
|
|
168
169
|
children: "Critical - Complete blocker, urgent"
|
|
169
170
|
})
|
|
170
171
|
]
|
|
171
172
|
})] }),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
173
174
|
className: "block text-sm font-medium mb-2 text-foreground",
|
|
174
175
|
children: "Category"
|
|
175
|
-
}), /* @__PURE__ */
|
|
176
|
-
value:
|
|
177
|
-
onChange: (e) =>
|
|
178
|
-
...
|
|
179
|
-
|
|
176
|
+
}), /* @__PURE__ */ C("select", {
|
|
177
|
+
value: P.categoryId || "",
|
|
178
|
+
onChange: (e) => F({
|
|
179
|
+
...P,
|
|
180
|
+
categoryId: e.target.value || void 0
|
|
180
181
|
}),
|
|
181
182
|
className: "w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",
|
|
182
|
-
children: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
children: "General Support"
|
|
190
|
-
}),
|
|
191
|
-
/* @__PURE__ */ x("option", {
|
|
192
|
-
value: "TECHNICAL_SUPPORT",
|
|
193
|
-
children: "Technical Support"
|
|
194
|
-
}),
|
|
195
|
-
/* @__PURE__ */ x("option", {
|
|
196
|
-
value: "BILLING_ACCOUNT",
|
|
197
|
-
children: "Billing & Account"
|
|
198
|
-
}),
|
|
199
|
-
/* @__PURE__ */ x("option", {
|
|
200
|
-
value: "BUG_REPORT",
|
|
201
|
-
children: "Bug Report"
|
|
202
|
-
}),
|
|
203
|
-
/* @__PURE__ */ x("option", {
|
|
204
|
-
value: "FEATURE_REQUEST",
|
|
205
|
-
children: "Feature Request"
|
|
206
|
-
})
|
|
207
|
-
]
|
|
183
|
+
children: [/* @__PURE__ */ S("option", {
|
|
184
|
+
value: "",
|
|
185
|
+
children: M ? "Loading categories..." : "Select a category"
|
|
186
|
+
}), N.map((e) => /* @__PURE__ */ S("option", {
|
|
187
|
+
value: e.id,
|
|
188
|
+
children: e.name
|
|
189
|
+
}, e.id))]
|
|
208
190
|
})] }),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ C("div", { children: [
|
|
192
|
+
/* @__PURE__ */ S("label", {
|
|
211
193
|
className: "block text-sm font-medium mb-2 text-foreground",
|
|
212
194
|
children: "Attachments"
|
|
213
195
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ C("label", {
|
|
215
197
|
className: "flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/20 px-4 py-4 text-sm text-muted-foreground transition-colors hover:bg-muted/40",
|
|
216
198
|
children: [
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ S(v, { size: 16 }),
|
|
200
|
+
/* @__PURE__ */ S("span", { children: "Attach files, screenshots, logs, or documents" }),
|
|
201
|
+
/* @__PURE__ */ S("input", {
|
|
220
202
|
type: "file",
|
|
221
203
|
multiple: !0,
|
|
222
204
|
className: "hidden",
|
|
223
|
-
onChange:
|
|
205
|
+
onChange: G
|
|
224
206
|
})
|
|
225
207
|
]
|
|
226
208
|
}),
|
|
227
|
-
|
|
209
|
+
I.length > 0 && /* @__PURE__ */ S("div", {
|
|
228
210
|
className: "mt-3 flex flex-wrap gap-2",
|
|
229
|
-
children:
|
|
211
|
+
children: I.map((e, t) => /* @__PURE__ */ C("div", {
|
|
230
212
|
className: "flex items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm",
|
|
231
213
|
children: [
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ S(v, { size: 14 }),
|
|
215
|
+
/* @__PURE__ */ S("span", {
|
|
234
216
|
className: "max-w-[240px] truncate",
|
|
235
217
|
children: e.name
|
|
236
218
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ S("button", {
|
|
238
220
|
type: "button",
|
|
239
221
|
className: "text-muted-foreground hover:text-foreground",
|
|
240
|
-
onClick: () =>
|
|
222
|
+
onClick: () => K(t),
|
|
241
223
|
children: "×"
|
|
242
224
|
})
|
|
243
225
|
]
|
|
244
226
|
}, `${e.name}-${t}`))
|
|
245
227
|
}),
|
|
246
|
-
|
|
228
|
+
R && /* @__PURE__ */ C("p", {
|
|
247
229
|
className: "mt-2 text-xs text-muted-foreground",
|
|
248
230
|
children: [
|
|
249
231
|
"Uploading ",
|
|
250
|
-
|
|
232
|
+
R,
|
|
251
233
|
"..."
|
|
252
234
|
]
|
|
253
235
|
})
|
|
254
236
|
] })
|
|
255
237
|
]
|
|
256
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ C("div", {
|
|
257
239
|
className: "flex gap-3",
|
|
258
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ S(n, {
|
|
259
241
|
type: "submit",
|
|
260
|
-
disabled:
|
|
242
|
+
disabled: k || !P.subject || !P.description,
|
|
261
243
|
className: "flex-1",
|
|
262
|
-
children:
|
|
244
|
+
children: k ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(_, {
|
|
263
245
|
size: 18,
|
|
264
246
|
className: "animate-spin"
|
|
265
|
-
}), "Creating..."] }) : /* @__PURE__ */
|
|
266
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), "Creating..."] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(y, { size: 18 }), "Create Ticket"] })
|
|
248
|
+
}), /* @__PURE__ */ S(n, {
|
|
267
249
|
type: "button",
|
|
268
250
|
variant: "outline",
|
|
269
|
-
onClick: () =>
|
|
251
|
+
onClick: () => E(".."),
|
|
270
252
|
children: "Cancel"
|
|
271
253
|
})]
|
|
272
254
|
})]
|
|
@@ -276,6 +258,6 @@ function T() {
|
|
|
276
258
|
});
|
|
277
259
|
}
|
|
278
260
|
//#endregion
|
|
279
|
-
export {
|
|
261
|
+
export { E as CreateTicketPage };
|
|
280
262
|
|
|
281
263
|
//# sourceMappingURL=CreateTicketPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateTicketPage.js","names":[],"sources":["../../../src/support/pages/CreateTicketPage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowLeft, Loader2, Plus, Paperclip } from 'lucide-react';\nimport { Button, Input } from '../components/ui';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useNotification } from '../hooks/useNotification';\nimport { PageLayout } from '../components/PageLayout';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\nimport { extractErrorMessage } from '../utils/errors';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport {\n SupportTicketPriority,\n type CreateSupportTicketInput,\n type SupportTicketCategory,\n} from '../../generated/global-types';\n\n/**\n * Client-side minimum lengths. Keep these in lockstep with the server-side\n * validators in global-support-svc/src/modules/support/utils/validation.ts —\n * when the server tightens or loosens these, update them here too. These are\n * best-effort UX hints only; the server's validation error is authoritative\n * and surfaces through `extractErrorMessage` on the catch path.\n */\nconst MIN_SUBJECT_LENGTH = 5;\nconst MIN_DESCRIPTION_LENGTH = 10;\n\nexport function CreateTicketPage() {\n const navigate = useNavigate();\n const { basePath = '' } = useSupport();\n const { createTicket, createTicketLoading, updateTicket } = useTicketOperations();\n const [formData, setFormData] = useState<CreateSupportTicketInput>({\n subject: '',\n description: '',\n priority: SupportTicketPriority.Normal,\n category: undefined,\n });\n const [attachedFiles, setAttachedFiles] = useState<File[]>([]);\n const [uploadingFileName, setUploadingFileName] = useState<string | null>(null);\n const { notification, notify: showNotification } = useNotification();\n\n // Track the post-success navigate timer so unmounting mid-flight (Cancel\n // / back button / fast subsequent create) doesn't fire a delayed navigate.\n const navigateTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const clearNavigateTimeout = (): void => {\n if (navigateTimeoutRef.current) {\n clearTimeout(navigateTimeoutRef.current);\n navigateTimeoutRef.current = null;\n }\n };\n\n useEffect(() => clearNavigateTimeout, []);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (formData.subject.trim().length < MIN_SUBJECT_LENGTH) {\n showNotification('error', `Subject must be at least ${MIN_SUBJECT_LENGTH} characters long.`);\n return;\n }\n if ((formData.description ?? '').trim().length < MIN_DESCRIPTION_LENGTH) {\n showNotification(\n 'error',\n `Description must be at least ${MIN_DESCRIPTION_LENGTH} characters long.`\n );\n return;\n }\n\n try {\n const ticket = await createTicket({\n ...formData,\n priority: formData.priority ?? undefined,\n categoryId: formData.categoryId ?? undefined,\n });\n if (!ticket) {\n return;\n }\n\n if (attachedFiles.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId: ticket.id,\n files: attachedFiles,\n onFileProgress: (fileName, progress) => {\n if (progress < 100) {\n setUploadingFileName(fileName);\n }\n },\n });\n\n await updateTicket(ticket.id, {\n metadata: {\n initialAttachmentIds: uploadResult.files.map((file) => file.id),\n attachmentFolderId: uploadResult.folderId,\n attachmentFolderPath: uploadResult.folderPath,\n },\n });\n setUploadingFileName(null);\n setAttachedFiles([]);\n } catch (uploadError) {\n setUploadingFileName(null);\n // Carry only a code-level flag in the URL — never the raw backend\n // error. Query strings persist in browser history, referer, proxy\n // logs, and analytics; a verbose server error (e.g. an S3 key, a\n // tenant id, a stack line) landing there is an information leak.\n // The destination page composes the user-facing message entirely\n // client-side via useAttachmentsFailedToast.\n console.error('[support] create ticket: attachments failed', uploadError);\n const nextParams = new URLSearchParams({\n [ATTACHMENTS_FAILED_PARAM]: '1',\n });\n navigate(joinPath(basePath, `tickets/${ticket.id}?${nextParams.toString()}`));\n return;\n }\n }\n\n showNotification('success', 'Ticket created successfully!');\n clearNavigateTimeout();\n navigateTimeoutRef.current = setTimeout(() => {\n navigate(joinPath(basePath, `tickets/${ticket.id}`));\n navigateTimeoutRef.current = null;\n }, 1000);\n } catch (error) {\n // Prefer the server error message when available — client-side\n // validation (`MIN_SUBJECT_LENGTH` etc.) is best-effort; the server\n // is authoritative and its message is what should reach the user\n // if we reached the `createTicket` call and it rejected.\n const message = extractErrorMessage(error, 'Failed to create ticket. Please try again.');\n showNotification('error', message, 5000);\n }\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files || []);\n setAttachedFiles((current) => [...current, ...files]);\n event.target.value = '';\n };\n\n const removeAttachedFile = (fileIndex: number) => {\n setAttachedFiles((current) => current.filter((_, index) => index !== fileIndex));\n };\n\n return (\n <PageLayout showHeader={false}>\n <NotificationToast notification={notification} />\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div>\n <h1 className=\"text-2xl font-bold text-foreground\">Create New Ticket</h1>\n <p className=\"text-sm text-muted-foreground\">Submit a new support request</p>\n </div>\n </div>\n\n {/* Form */}\n <div className=\"max-w-2xl\">\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div className=\"p-6 rounded-xl border bg-card space-y-6\">\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">\n Subject <span className=\"text-destructive\">*</span>\n </label>\n <Input\n type=\"text\"\n required\n value={formData.subject}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n setFormData({ ...formData, subject: e.target.value })\n }\n placeholder=\"Brief description of your issue\"\n />\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">\n Description <span className=\"text-destructive\">*</span>\n </label>\n <textarea\n required\n rows={6}\n value={formData.description || ''}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n placeholder=\"Provide detailed information about your issue\"\n />\n <p className=\"mt-2 text-xs text-muted-foreground\">\n Markdown is supported, including fenced code blocks.\n </p>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Priority</label>\n <select\n value={formData.priority || 'NORMAL'}\n onChange={(e) =>\n setFormData({ ...formData, priority: e.target.value as SupportTicketPriority })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"LOW\">Low - General question or minor issue</option>\n <option value=\"NORMAL\">Normal - Standard support request</option>\n <option value=\"HIGH\">High - Significant impact on work</option>\n <option value=\"CRITICAL\">Critical - Complete blocker, urgent</option>\n </select>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Category</label>\n <select\n value={formData.category || ''}\n onChange={(e) =>\n setFormData({\n ...formData,\n category: (e.target.value as SupportTicketCategory) || undefined,\n })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"\">Select a category</option>\n <option value=\"GENERAL_SUPPORT\">General Support</option>\n <option value=\"TECHNICAL_SUPPORT\">Technical Support</option>\n <option value=\"BILLING_ACCOUNT\">Billing & Account</option>\n <option value=\"BUG_REPORT\">Bug Report</option>\n <option value=\"FEATURE_REQUEST\">Feature Request</option>\n </select>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Attachments</label>\n <label className=\"flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/20 px-4 py-4 text-sm text-muted-foreground transition-colors hover:bg-muted/40\">\n <Paperclip size={16} />\n <span>Attach files, screenshots, logs, or documents</span>\n <input type=\"file\" multiple className=\"hidden\" onChange={handleFileChange} />\n </label>\n\n {attachedFiles.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {attachedFiles.map((file, index) => (\n <div\n key={`${file.name}-${index}`}\n className=\"flex items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm\"\n >\n <Paperclip size={14} />\n <span className=\"max-w-[240px] truncate\">{file.name}</span>\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground\"\n onClick={() => removeAttachedFile(index)}\n >\n ×\n </button>\n </div>\n ))}\n </div>\n )}\n\n {uploadingFileName && (\n <p className=\"mt-2 text-xs text-muted-foreground\">\n Uploading {uploadingFileName}...\n </p>\n )}\n </div>\n </div>\n\n <div className=\"flex gap-3\">\n <Button\n type=\"submit\"\n disabled={createTicketLoading || !formData.subject || !formData.description}\n className=\"flex-1\"\n >\n {createTicketLoading ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n Creating...\n </>\n ) : (\n <>\n <Plus size={18} />\n Create Ticket\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => navigate('..')}>\n Cancel\n </Button>\n </div>\n </form>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,IAAM,IAAqB,GACrB,IAAyB;AAE/B,SAAgB,IAAmB;CACjC,IAAM,IAAW,GAAa,EACxB,EAAE,cAAW,OAAO,GAAY,EAChC,EAAE,iBAAc,wBAAqB,oBAAiB,GAAqB,EAC3E,CAAC,GAAU,KAAe,EAAmC;EACjE,SAAS;EACT,aAAa;EACb,UAAU,EAAsB;EAChC,UAAU,KAAA;EACX,CAAC,EACI,CAAC,GAAe,KAAoB,EAAiB,EAAE,CAAC,EACxD,CAAC,GAAmB,KAAwB,EAAwB,KAAK,EACzE,EAAE,iBAAc,QAAQ,MAAqB,GAAiB,EAI9D,IAAqB,EAA6C,KAAK,EACvE,UAAmC;AACvC,EAEE,EAAmB,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;OAAS,SAAQ;OAAU,eAAe,EAAS,KAAK;iBAAE;OAE9D,CAAA,CACL;QACD;;IACH,CAAA;GACK"}
|
|
1
|
+
{"version":3,"file":"CreateTicketPage.js","names":[],"sources":["../../../src/support/pages/CreateTicketPage.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowLeft, Loader2, Plus, Paperclip } from 'lucide-react';\nimport { Button, Input } from '../components/ui';\nimport { useTicketOperations } from '../hooks/useTicketOperations';\nimport { useGetTicketCategoriesQuery } from '../../generated/global-operations';\nimport { useNotification } from '../hooks/useNotification';\nimport { PageLayout } from '../components/PageLayout';\nimport { NotificationToast } from '../components/NotificationToast';\nimport { useSupport } from '../providers/SupportProvider';\nimport { joinPath } from '../utils';\nimport { extractErrorMessage } from '../utils/errors';\nimport { uploadSupportAttachmentFiles } from '../utils/supportFiles';\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport { SupportTicketPriority, type CreateSupportTicketInput } from '../../generated/global-types';\n\n/**\n * Client-side minimum lengths. Keep these in lockstep with the server-side\n * validators in global-support-svc/src/modules/support/utils/validation.ts —\n * when the server tightens or loosens these, update them here too. These are\n * best-effort UX hints only; the server's validation error is authoritative\n * and surfaces through `extractErrorMessage` on the catch path.\n */\nconst MIN_SUBJECT_LENGTH = 5;\nconst MIN_DESCRIPTION_LENGTH = 10;\n\nexport function CreateTicketPage() {\n const navigate = useNavigate();\n const { basePath = '' } = useSupport();\n const { createTicket, createTicketLoading, updateTicket } = useTicketOperations();\n const { data: categoriesData, loading: categoriesLoading } = useGetTicketCategoriesQuery({\n variables: {\n filter: { isActive: true },\n limit: 100,\n offset: 0,\n },\n });\n const activeCategories = [...(categoriesData?.ticketCategories?.nodes ?? [])].sort(\n (first, second) => first.displayOrder - second.displayOrder\n );\n const [formData, setFormData] = useState<CreateSupportTicketInput>({\n subject: '',\n description: '',\n priority: SupportTicketPriority.Normal,\n categoryId: undefined,\n });\n const [attachedFiles, setAttachedFiles] = useState<File[]>([]);\n const [uploadingFileName, setUploadingFileName] = useState<string | null>(null);\n const { notification, notify: showNotification } = useNotification();\n\n // Track the post-success navigate timer so unmounting mid-flight (Cancel\n // / back button / fast subsequent create) doesn't fire a delayed navigate.\n const navigateTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const clearNavigateTimeout = (): void => {\n if (navigateTimeoutRef.current) {\n clearTimeout(navigateTimeoutRef.current);\n navigateTimeoutRef.current = null;\n }\n };\n\n useEffect(() => clearNavigateTimeout, []);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (formData.subject.trim().length < MIN_SUBJECT_LENGTH) {\n showNotification('error', `Subject must be at least ${MIN_SUBJECT_LENGTH} characters long.`);\n return;\n }\n if ((formData.description ?? '').trim().length < MIN_DESCRIPTION_LENGTH) {\n showNotification(\n 'error',\n `Description must be at least ${MIN_DESCRIPTION_LENGTH} characters long.`\n );\n return;\n }\n\n try {\n const ticket = await createTicket({\n ...formData,\n priority: formData.priority ?? undefined,\n categoryId: formData.categoryId ?? undefined,\n });\n if (!ticket) {\n return;\n }\n\n if (attachedFiles.length > 0) {\n try {\n const uploadResult = await uploadSupportAttachmentFiles({\n ticketId: ticket.id,\n files: attachedFiles,\n onFileProgress: (fileName, progress) => {\n if (progress < 100) {\n setUploadingFileName(fileName);\n }\n },\n });\n\n await updateTicket(ticket.id, {\n metadata: {\n initialAttachmentIds: uploadResult.files.map((file) => file.id),\n },\n });\n setUploadingFileName(null);\n setAttachedFiles([]);\n } catch (uploadError) {\n setUploadingFileName(null);\n // Carry only a code-level flag in the URL — never the raw backend\n // error. Query strings persist in browser history, referer, proxy\n // logs, and analytics; a verbose server error (e.g. an S3 key, a\n // tenant id, a stack line) landing there is an information leak.\n // The destination page composes the user-facing message entirely\n // client-side via useAttachmentsFailedToast.\n console.error('[support] create ticket: attachments failed', uploadError);\n const nextParams = new URLSearchParams({\n [ATTACHMENTS_FAILED_PARAM]: '1',\n });\n navigate(joinPath(basePath, `tickets/${ticket.id}?${nextParams.toString()}`));\n return;\n }\n }\n\n showNotification('success', 'Ticket created successfully!');\n clearNavigateTimeout();\n navigateTimeoutRef.current = setTimeout(() => {\n navigate(joinPath(basePath, `tickets/${ticket.id}`));\n navigateTimeoutRef.current = null;\n }, 1000);\n } catch (error) {\n // Prefer the server error message when available — client-side\n // validation (`MIN_SUBJECT_LENGTH` etc.) is best-effort; the server\n // is authoritative and its message is what should reach the user\n // if we reached the `createTicket` call and it rejected.\n const message = extractErrorMessage(error, 'Failed to create ticket. Please try again.');\n showNotification('error', message, 5000);\n }\n };\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files || []);\n setAttachedFiles((current) => [...current, ...files]);\n event.target.value = '';\n };\n\n const removeAttachedFile = (fileIndex: number) => {\n setAttachedFiles((current) => current.filter((_, index) => index !== fileIndex));\n };\n\n return (\n <PageLayout showHeader={false}>\n <NotificationToast notification={notification} />\n\n {/* Header */}\n <div className=\"flex items-center gap-4 mb-6\">\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate('..')} className=\"p-2\">\n <ArrowLeft size={20} />\n </Button>\n <div>\n <h1 className=\"text-2xl font-bold text-foreground\">Create New Ticket</h1>\n <p className=\"text-sm text-muted-foreground\">Submit a new support request</p>\n </div>\n </div>\n\n {/* Form */}\n <div className=\"max-w-2xl\">\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n <div className=\"p-6 rounded-xl border bg-card space-y-6\">\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">\n Subject <span className=\"text-destructive\">*</span>\n </label>\n <Input\n type=\"text\"\n required\n value={formData.subject}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\n setFormData({ ...formData, subject: e.target.value })\n }\n placeholder=\"Brief description of your issue\"\n />\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">\n Description <span className=\"text-destructive\">*</span>\n </label>\n <textarea\n required\n rows={6}\n value={formData.description || ''}\n onChange={(e) => setFormData({ ...formData, description: e.target.value })}\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n placeholder=\"Provide detailed information about your issue\"\n />\n <p className=\"mt-2 text-xs text-muted-foreground\">\n Markdown is supported, including fenced code blocks.\n </p>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Priority</label>\n <select\n value={formData.priority || 'NORMAL'}\n onChange={(e) =>\n setFormData({ ...formData, priority: e.target.value as SupportTicketPriority })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"LOW\">Low - General question or minor issue</option>\n <option value=\"NORMAL\">Normal - Standard support request</option>\n <option value=\"HIGH\">High - Significant impact on work</option>\n <option value=\"CRITICAL\">Critical - Complete blocker, urgent</option>\n </select>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Category</label>\n <select\n value={formData.categoryId || ''}\n onChange={(e) =>\n setFormData({\n ...formData,\n categoryId: e.target.value || undefined,\n })\n }\n className=\"w-full px-4 py-3 rounded-lg border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors\"\n >\n <option value=\"\">\n {categoriesLoading ? 'Loading categories...' : 'Select a category'}\n </option>\n {activeCategories.map((category) => (\n <option key={category.id} value={category.id}>\n {category.name}\n </option>\n ))}\n </select>\n </div>\n\n <div>\n <label className=\"block text-sm font-medium mb-2 text-foreground\">Attachments</label>\n <label className=\"flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/20 px-4 py-4 text-sm text-muted-foreground transition-colors hover:bg-muted/40\">\n <Paperclip size={16} />\n <span>Attach files, screenshots, logs, or documents</span>\n <input type=\"file\" multiple className=\"hidden\" onChange={handleFileChange} />\n </label>\n\n {attachedFiles.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {attachedFiles.map((file, index) => (\n <div\n key={`${file.name}-${index}`}\n className=\"flex items-center gap-2 rounded-lg border bg-background px-3 py-2 text-sm\"\n >\n <Paperclip size={14} />\n <span className=\"max-w-[240px] truncate\">{file.name}</span>\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground\"\n onClick={() => removeAttachedFile(index)}\n >\n ×\n </button>\n </div>\n ))}\n </div>\n )}\n\n {uploadingFileName && (\n <p className=\"mt-2 text-xs text-muted-foreground\">\n Uploading {uploadingFileName}...\n </p>\n )}\n </div>\n </div>\n\n <div className=\"flex gap-3\">\n <Button\n type=\"submit\"\n disabled={createTicketLoading || !formData.subject || !formData.description}\n className=\"flex-1\"\n >\n {createTicketLoading ? (\n <>\n <Loader2 size={18} className=\"animate-spin\" />\n Creating...\n </>\n ) : (\n <>\n <Plus size={18} />\n Create Ticket\n </>\n )}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={() => navigate('..')}>\n Cancel\n </Button>\n </div>\n </form>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,IAAM,IAAqB,GACrB,IAAyB;AAE/B,SAAgB,IAAmB;CACjC,IAAM,IAAW,GAAa,EACxB,EAAE,cAAW,OAAO,GAAY,EAChC,EAAE,iBAAc,wBAAqB,oBAAiB,GAAqB,EAC3E,EAAE,MAAM,GAAgB,SAAS,MAAsB,EAA4B,EACvF,WAAW;EACT,QAAQ,EAAE,UAAU,IAAM;EAC1B,OAAO;EACP,QAAQ;EACT,EACF,CAAC,EACI,IAAmB,CAAC,GAAI,GAAgB,kBAAkB,SAAS,EAAE,CAAE,CAAC,MAC3E,GAAO,MAAW,EAAM,eAAe,EAAO,aAChD,EACK,CAAC,GAAU,KAAe,EAAmC;EACjE,SAAS;EACT,aAAa;EACb,UAAU,EAAsB;EAChC,YAAY,KAAA;EACb,CAAC,EACI,CAAC,G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AK;iBAAE;OAE9D,CAAA,CACL;QACD;;IACH,CAAA;GACK"}
|
|
@@ -8,11 +8,14 @@ import { useNavigate as v } from "react-router-dom";
|
|
|
8
8
|
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
9
9
|
//#region src/support/pages/KnowledgeBaseAdminPage.tsx
|
|
10
10
|
function S() {
|
|
11
|
-
let S = v(), { basePath: C = "" } = e(), { articles: w, popularArticles: T, categories: E, searchResults: D, articlesLoading: O, popularLoading: k, categoriesLoading: A, searchLoading: j, searchArticles: M,
|
|
12
|
-
e.preventDefault(),
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
let S = v(), { basePath: C = "" } = e(), { articles: w, popularArticles: T, categories: E, searchResults: D, articlesLoading: O, popularLoading: k, categoriesLoading: A, searchLoading: j, searchArticles: M, filterArticles: N, hasMoreArticles: P, loadMoreArticles: F } = s(), [I, L] = c(""), [R, z] = c(null), [B, V] = c(!1), H = (e) => {
|
|
12
|
+
e.preventDefault(), I.trim() && (M(I, { categoryId: R ?? void 0 }), V(!0));
|
|
13
|
+
}, U = () => {
|
|
14
|
+
L(""), V(!1), z(null), N({
|
|
15
|
+
categoryId: void 0,
|
|
16
|
+
tags: []
|
|
17
|
+
});
|
|
18
|
+
}, W = E.find((e) => e.id === R)?.name, G = B && I ? D : w, K = B ? j : O;
|
|
16
19
|
return /* @__PURE__ */ x(o, {
|
|
17
20
|
title: "Knowledge Base",
|
|
18
21
|
subtitle: "Manage help articles and documentation",
|
|
@@ -25,7 +28,7 @@ function S() {
|
|
|
25
28
|
/* @__PURE__ */ b("div", {
|
|
26
29
|
className: "relative max-w-2xl",
|
|
27
30
|
children: /* @__PURE__ */ x("form", {
|
|
28
|
-
onSubmit:
|
|
31
|
+
onSubmit: H,
|
|
29
32
|
className: "relative",
|
|
30
33
|
children: [
|
|
31
34
|
/* @__PURE__ */ b(h, {
|
|
@@ -34,23 +37,23 @@ function S() {
|
|
|
34
37
|
}),
|
|
35
38
|
/* @__PURE__ */ b(r, {
|
|
36
39
|
type: "text",
|
|
37
|
-
value:
|
|
38
|
-
onChange: (e) =>
|
|
40
|
+
value: I,
|
|
41
|
+
onChange: (e) => L(e.target.value),
|
|
39
42
|
placeholder: "Search for help articles...",
|
|
40
43
|
className: "pl-12 pr-4 py-6 text-lg"
|
|
41
44
|
}),
|
|
42
|
-
|
|
45
|
+
I && /* @__PURE__ */ b(n, {
|
|
43
46
|
type: "button",
|
|
44
47
|
variant: "ghost",
|
|
45
48
|
size: "sm",
|
|
46
|
-
onClick:
|
|
49
|
+
onClick: U,
|
|
47
50
|
className: "absolute right-2 top-1/2 -translate-y-1/2",
|
|
48
51
|
children: "Clear"
|
|
49
52
|
})
|
|
50
53
|
]
|
|
51
54
|
})
|
|
52
55
|
}),
|
|
53
|
-
!
|
|
56
|
+
!B && !A && E.length > 0 && /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ x("h2", {
|
|
54
57
|
className: "text-lg font-semibold mb-4 flex items-center gap-2 text-foreground",
|
|
55
58
|
children: [/* @__PURE__ */ b(f, {
|
|
56
59
|
size: 20,
|
|
@@ -60,9 +63,9 @@ function S() {
|
|
|
60
63
|
className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",
|
|
61
64
|
children: E.slice(0, 8).map((e) => /* @__PURE__ */ x("button", {
|
|
62
65
|
onClick: () => {
|
|
63
|
-
|
|
66
|
+
z(e.id), V(!1), N({ categoryId: e.id });
|
|
64
67
|
},
|
|
65
|
-
className: `p-4 rounded-xl border text-left transition-all hover:shadow-md hover:border-primary/50 bg-card ${
|
|
68
|
+
className: `p-4 rounded-xl border text-left transition-all hover:shadow-md hover:border-primary/50 bg-card ${R === e.id ? "border-primary ring-2 ring-primary/20" : ""}`,
|
|
66
69
|
children: [
|
|
67
70
|
/* @__PURE__ */ b("div", {
|
|
68
71
|
className: "text-2xl mb-2",
|
|
@@ -79,7 +82,7 @@ function S() {
|
|
|
79
82
|
]
|
|
80
83
|
}, e.id))
|
|
81
84
|
})] }),
|
|
82
|
-
!
|
|
85
|
+
!B && !k && T.length > 0 && /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ x("h2", {
|
|
83
86
|
className: "text-lg font-semibold mb-4 flex items-center gap-2 text-foreground",
|
|
84
87
|
children: [/* @__PURE__ */ b(_, {
|
|
85
88
|
size: 20,
|
|
@@ -124,16 +127,16 @@ function S() {
|
|
|
124
127
|
className: "flex items-center justify-between mb-4",
|
|
125
128
|
children: [/* @__PURE__ */ b("h2", {
|
|
126
129
|
className: "text-lg font-semibold text-foreground",
|
|
127
|
-
children:
|
|
128
|
-
}),
|
|
130
|
+
children: B && I ? `Search Results for "${I}"` : W || "All Articles"
|
|
131
|
+
}), (B || R) && /* @__PURE__ */ b(n, {
|
|
129
132
|
variant: "outline",
|
|
130
133
|
size: "sm",
|
|
131
|
-
onClick:
|
|
132
|
-
children: "Clear Search"
|
|
134
|
+
onClick: U,
|
|
135
|
+
children: B ? "Clear Search" : "All Articles"
|
|
133
136
|
})]
|
|
134
|
-
}),
|
|
137
|
+
}), K ? /* @__PURE__ */ b(a, { message: "Loading articles..." }) : G.length > 0 ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
|
|
135
138
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
136
|
-
children:
|
|
139
|
+
children: G.map((e) => /* @__PURE__ */ x("button", {
|
|
137
140
|
onClick: () => S(`${C}/kb/articles/${e.slug}`),
|
|
138
141
|
className: "p-6 rounded-xl border bg-card text-left transition-all hover:shadow-md hover:border-primary/50 group",
|
|
139
142
|
children: [
|
|
@@ -187,17 +190,17 @@ function S() {
|
|
|
187
190
|
})
|
|
188
191
|
]
|
|
189
192
|
}, e.id))
|
|
190
|
-
}),
|
|
193
|
+
}), P && /* @__PURE__ */ b("div", {
|
|
191
194
|
className: "flex justify-center mt-6",
|
|
192
195
|
children: /* @__PURE__ */ b(n, {
|
|
193
196
|
variant: "outline",
|
|
194
|
-
onClick:
|
|
197
|
+
onClick: F,
|
|
195
198
|
children: "Load More"
|
|
196
199
|
})
|
|
197
200
|
})] }) : /* @__PURE__ */ b(i, {
|
|
198
201
|
icon: /* @__PURE__ */ b(u, { size: 48 }),
|
|
199
|
-
title:
|
|
200
|
-
description:
|
|
202
|
+
title: B ? "No articles found" : "No articles available",
|
|
203
|
+
description: B ? "Try adjusting your search terms or browse by category" : "Check back later for helpful articles and guides"
|
|
201
204
|
})] })
|
|
202
205
|
]
|
|
203
206
|
});
|