@webority/support-react 0.13.1 → 0.13.4
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/README.md +31 -5
- package/dist/support-react.js +306 -233
- package/dist/types/ReportIssue.d.ts +6 -1
- package/dist/types/SupportCenter.d.ts +1 -0
- package/dist/types/client.d.ts +63 -2
- package/dist/types/components/AttachmentField.d.ts +4 -0
- package/dist/types/components/TicketList.d.ts +25 -3
- package/dist/types/context.d.ts +18 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/files.d.ts +5 -3
- package/dist/types/lib/useDebouncedValue.d.ts +10 -0
- package/package.json +3 -3
package/dist/support-react.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
-
import { AppAlert as c, AppAvatar as l, AppBadge as u, AppButton as d, AppCard as f, AppCopyButton as p, AppDataTable as m, AppFileAttachment as h, AppIcon as g, AppInfoList as _, AppInput as v, AppLink as y, AppModal as b, AppSearch as x, AppSelect as S, AppSkeleton as C, AppSpinner as w, AppStatusBadge as T, AppTableEmptyState as E, AppTabs as D, AppTextarea as O
|
|
3
|
-
import { toBlob as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { AppAlert as c, AppAvatar as l, AppBadge as u, AppButton as d, AppCard as f, AppCopyButton as p, AppDataTable as m, AppFileAttachment as h, AppIcon as g, AppInfoList as _, AppInput as v, AppLink as y, AppModal as b, AppSearch as x, AppSelect as S, AppSkeleton as C, AppSpinner as w, AppStatusBadge as T, AppTableEmptyState as E, AppTabs as D, AppTextarea as O } from "@webority/ui-react";
|
|
3
|
+
import { toBlob as k } from "html-to-image";
|
|
4
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
5
5
|
//#region src/client.js
|
|
6
6
|
var N = "Something went wrong. Please try again.", P = class extends Error {
|
|
7
7
|
constructor(e, t, n) {
|
|
8
8
|
super(t), this.name = "SupportApiError", this.code = e, this.status = n;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
async function
|
|
11
|
+
async function F(e) {
|
|
12
12
|
if (e && typeof Blob < "u" && e instanceof Blob) try {
|
|
13
13
|
return JSON.parse(await e.text());
|
|
14
14
|
} catch {
|
|
@@ -21,63 +21,69 @@ async function te(e) {
|
|
|
21
21
|
}
|
|
22
22
|
return e ?? null;
|
|
23
23
|
}
|
|
24
|
-
async function
|
|
24
|
+
async function I(e) {
|
|
25
25
|
if (e instanceof P) return e;
|
|
26
26
|
let t = e?.response;
|
|
27
27
|
if (!t) return new P("network", N);
|
|
28
|
-
let n = await
|
|
28
|
+
let n = await F(t.data);
|
|
29
29
|
return new P(typeof n?.code == "string" && n.code ? n.code : "unknown", typeof n?.message == "string" && n.message ? n.message : N, t.status);
|
|
30
30
|
}
|
|
31
|
-
async function
|
|
31
|
+
async function L(e) {
|
|
32
32
|
try {
|
|
33
33
|
return (await e()).data;
|
|
34
34
|
} catch (e) {
|
|
35
|
-
throw await
|
|
35
|
+
throw await I(e);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function R(e, t, n) {
|
|
39
39
|
n != null && String(n).trim() !== "" && e.append(t, String(n));
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function z(e, t, n, r) {
|
|
42
42
|
(n ?? []).forEach((n, i) => {
|
|
43
43
|
let a = n?.name || `${r}-${i + 1}.png`;
|
|
44
44
|
e.append(t, n, a);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function ee(e, t = "/api/support") {
|
|
48
48
|
let n = t.replace(/\/+$/, ""), r = (e) => `${n}/tickets/${encodeURIComponent(e)}`;
|
|
49
49
|
return {
|
|
50
|
-
getConfig: () =>
|
|
51
|
-
listTickets: (
|
|
52
|
-
|
|
50
|
+
getConfig: () => L(() => e.get(`${n}/settings`)),
|
|
51
|
+
listTickets: ({ status: t, search: r, page: i, pageSize: a } = {}) => {
|
|
52
|
+
let o = new URLSearchParams();
|
|
53
|
+
R(o, "status", t), R(o, "search", r?.trim()), R(o, "page", i), R(o, "pageSize", a);
|
|
54
|
+
let s = o.toString();
|
|
55
|
+
return L(() => e.get(`${n}/tickets${s ? `?${s}` : ""}`));
|
|
56
|
+
},
|
|
57
|
+
getTicketCounts: () => L(() => e.get(`${n}/tickets/counts`)),
|
|
58
|
+
getTicket: (t) => L(() => e.get(r(t))),
|
|
53
59
|
createTicket: ({ category: t, subject: r, body: i, pageUrl: a, userAgent: o, appVersion: s, files: c, screenshots: l }) => {
|
|
54
60
|
let u = new FormData();
|
|
55
|
-
return u.append("category", t ?? ""), u.append("subject", r ?? ""), u.append("body", i ?? ""),
|
|
61
|
+
return u.append("category", t ?? ""), u.append("subject", r ?? ""), u.append("body", i ?? ""), R(u, "pageUrl", a), R(u, "userAgent", o), R(u, "appVersion", s), z(u, "files", c, "file"), z(u, "screenshots", l, "screenshot"), L(() => e.post(`${n}/tickets`, u));
|
|
56
62
|
},
|
|
57
63
|
reply: (t, { body: n, files: i, screenshots: a }) => {
|
|
58
64
|
let o = new FormData();
|
|
59
|
-
return o.append("body", n ?? ""),
|
|
65
|
+
return o.append("body", n ?? ""), z(o, "files", i, "file"), z(o, "screenshots", a, "screenshot"), L(() => e.post(`${r(t)}/replies`, o));
|
|
60
66
|
},
|
|
61
|
-
reopen: (t) =>
|
|
67
|
+
reopen: (t) => L(() => e.post(`${r(t)}/reopen`)),
|
|
62
68
|
rate: (t, { satisfaction: n, comment: i }) => {
|
|
63
69
|
let a = { satisfaction: n };
|
|
64
|
-
return i != null && i.trim() !== "" && (a.comment = i.trim()),
|
|
70
|
+
return i != null && i.trim() !== "" && (a.comment = i.trim()), L(() => e.post(`${r(t)}/rating`, a));
|
|
65
71
|
},
|
|
66
|
-
fetchAttachment: (t) =>
|
|
72
|
+
fetchAttachment: (t) => L(() => e.get(`${n}/attachments/${encodeURIComponent(t)}`, { responseType: "blob" }))
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
75
|
//#endregion
|
|
70
76
|
//#region src/context.js
|
|
71
|
-
var
|
|
72
|
-
function
|
|
73
|
-
let e = n(
|
|
77
|
+
var B = e(null);
|
|
78
|
+
function V() {
|
|
79
|
+
let e = n(B);
|
|
74
80
|
if (!e) throw Error("Support components and hooks must be used inside <SupportProvider>.");
|
|
75
81
|
return e;
|
|
76
82
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
83
|
+
function H() {
|
|
84
|
+
return V().client;
|
|
79
85
|
}
|
|
80
|
-
function
|
|
86
|
+
function U(e, n, i = !0) {
|
|
81
87
|
let [a, c] = s({
|
|
82
88
|
data: null,
|
|
83
89
|
loading: i,
|
|
@@ -126,8 +132,8 @@ function z(e, n, i = !0) {
|
|
|
126
132
|
setData: m
|
|
127
133
|
};
|
|
128
134
|
}
|
|
129
|
-
function
|
|
130
|
-
let { loadConfig: e } =
|
|
135
|
+
function W() {
|
|
136
|
+
let { loadConfig: e } = V(), { data: t, loading: n, error: r, reload: i } = U(e, "config");
|
|
131
137
|
return {
|
|
132
138
|
config: t,
|
|
133
139
|
loading: n,
|
|
@@ -135,17 +141,39 @@ function B() {
|
|
|
135
141
|
reload: i
|
|
136
142
|
};
|
|
137
143
|
}
|
|
138
|
-
function
|
|
139
|
-
let
|
|
144
|
+
function te(e = {}) {
|
|
145
|
+
let t = H(), { status: n, search: r, page: i, pageSize: a } = e, { data: o, loading: s, error: c, reload: l } = U(() => t.listTickets({
|
|
146
|
+
status: n,
|
|
147
|
+
search: r,
|
|
148
|
+
page: i,
|
|
149
|
+
pageSize: a
|
|
150
|
+
}), JSON.stringify([
|
|
151
|
+
"tickets",
|
|
152
|
+
n ?? null,
|
|
153
|
+
r ?? null,
|
|
154
|
+
i ?? null,
|
|
155
|
+
a ?? null
|
|
156
|
+
]));
|
|
140
157
|
return {
|
|
141
|
-
tickets:
|
|
158
|
+
tickets: o?.items ?? [],
|
|
159
|
+
totalCount: o?.totalCount ?? 0,
|
|
160
|
+
totalPages: o?.totalPages ?? 0,
|
|
161
|
+
loading: s,
|
|
162
|
+
error: c,
|
|
163
|
+
reload: l
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function ne() {
|
|
167
|
+
let e = H(), { data: t, loading: n, error: r, reload: i } = U(() => e.getTicketCounts(), "ticket-counts");
|
|
168
|
+
return {
|
|
169
|
+
counts: t,
|
|
142
170
|
loading: n,
|
|
143
171
|
error: r,
|
|
144
172
|
reload: i
|
|
145
173
|
};
|
|
146
174
|
}
|
|
147
|
-
function
|
|
148
|
-
let n =
|
|
175
|
+
function G(e) {
|
|
176
|
+
let n = H(), { data: r, loading: i, error: a, reload: o, setData: s } = U(() => n.getTicket(e), e ?? "", !!e), c = t(async (e) => {
|
|
149
177
|
let t = await e();
|
|
150
178
|
return s(t), t;
|
|
151
179
|
}, [s]);
|
|
@@ -173,7 +201,7 @@ function H(e) {
|
|
|
173
201
|
}
|
|
174
202
|
//#endregion
|
|
175
203
|
//#region src/lib/format.js
|
|
176
|
-
var
|
|
204
|
+
var re = new Intl.DateTimeFormat(void 0, {
|
|
177
205
|
day: "numeric",
|
|
178
206
|
month: "short",
|
|
179
207
|
year: "numeric",
|
|
@@ -181,12 +209,12 @@ var oe = new Intl.DateTimeFormat(void 0, {
|
|
|
181
209
|
minute: "2-digit",
|
|
182
210
|
timeZoneName: "short"
|
|
183
211
|
});
|
|
184
|
-
function
|
|
212
|
+
function K(e) {
|
|
185
213
|
if (!e) return "-";
|
|
186
214
|
let t = new Date(e);
|
|
187
|
-
return Number.isNaN(t.getTime()) ? "-" :
|
|
215
|
+
return Number.isNaN(t.getTime()) ? "-" : re.format(t);
|
|
188
216
|
}
|
|
189
|
-
function
|
|
217
|
+
function q(e) {
|
|
190
218
|
if (!Number.isFinite(e) || e < 0) return "-";
|
|
191
219
|
if (e < 1024) return `${e} B`;
|
|
192
220
|
if (e < 1024 * 1024) return `${Math.round(e / 1024)} KB`;
|
|
@@ -195,11 +223,10 @@ function W(e) {
|
|
|
195
223
|
}
|
|
196
224
|
//#endregion
|
|
197
225
|
//#region src/lib/files.js
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
-
return t.length > 0 ? t.join(",") : void 0;
|
|
226
|
+
function ie(e) {
|
|
227
|
+
return (e?.allowedContentTypes ?? []).join(",");
|
|
201
228
|
}
|
|
202
|
-
function
|
|
229
|
+
function ae(e, t) {
|
|
203
230
|
if (t.length === 0) return !0;
|
|
204
231
|
let n = (e || "").toLowerCase();
|
|
205
232
|
return t.some((e) => {
|
|
@@ -207,17 +234,17 @@ function ce(e, t) {
|
|
|
207
234
|
return t.endsWith("/*") ? n.startsWith(t.slice(0, -1)) : n === t;
|
|
208
235
|
});
|
|
209
236
|
}
|
|
210
|
-
function
|
|
237
|
+
function J(e, t) {
|
|
211
238
|
let n = e ?? [], r = t?.maxAttachmentsPerMessage ?? 0, i = t?.maxAttachmentBytes ?? 0, a = t?.allowedContentTypes ?? [];
|
|
212
239
|
if (r > 0 && n.length > r) return r === 1 ? "You can attach one file." : `You can attach up to ${r} files.`;
|
|
213
240
|
for (let e of n) {
|
|
214
241
|
let t = e.name || "This file";
|
|
215
|
-
if (!
|
|
216
|
-
if (i > 0 && e.size > i) return `${t} is larger than ${
|
|
242
|
+
if (!ae(e.type, a)) return `${t} is a file type we cannot accept.`;
|
|
243
|
+
if (i > 0 && e.size > i) return `${t} is larger than ${q(i)}.`;
|
|
217
244
|
}
|
|
218
245
|
return null;
|
|
219
246
|
}
|
|
220
|
-
function
|
|
247
|
+
function Y(e) {
|
|
221
248
|
let t = Array.from(e.clipboardData?.items ?? []), n = Date.now();
|
|
222
249
|
return t.filter((e) => e.kind === "file" && e.type.startsWith("image/")).map((e) => e.getAsFile()).filter(Boolean).map((e, t) => {
|
|
223
250
|
let r = (e.type.split("/")[1] || "png").replace("jpeg", "jpg");
|
|
@@ -226,8 +253,8 @@ function K(e) {
|
|
|
226
253
|
}
|
|
227
254
|
//#endregion
|
|
228
255
|
//#region src/components/AttachmentField.jsx
|
|
229
|
-
function
|
|
230
|
-
let o = i?.maxAttachmentBytes ?? 0, s = o > 0 ? Math.round(o / (1024 * 1024) * 10) / 10 :
|
|
256
|
+
function X({ id: e, label: t = "Attachments", files: n, onChange: r, config: i, error: a }) {
|
|
257
|
+
let o = i?.maxAttachmentBytes ?? 0, s = o > 0 ? Math.max(.1, Math.round(o / (1024 * 1024) * 10) / 10) : 0;
|
|
231
258
|
return /* @__PURE__ */ j(h, {
|
|
232
259
|
id: e,
|
|
233
260
|
label: t,
|
|
@@ -235,30 +262,31 @@ function q({ id: e, label: t = "Attachments", files: n, onChange: r, config: i,
|
|
|
235
262
|
multiple: !0,
|
|
236
263
|
value: n,
|
|
237
264
|
onChange: r,
|
|
238
|
-
accept:
|
|
265
|
+
accept: ie(i),
|
|
239
266
|
maxSizeMb: s,
|
|
267
|
+
validate: !1,
|
|
240
268
|
error: a || void 0
|
|
241
269
|
});
|
|
242
270
|
}
|
|
243
271
|
//#endregion
|
|
244
272
|
//#region src/components/TicketForm.jsx
|
|
245
|
-
function
|
|
273
|
+
function oe(e, t) {
|
|
246
274
|
return t && e.includes(t) ? t : e[0] ?? "";
|
|
247
275
|
}
|
|
248
|
-
function
|
|
249
|
-
let l = t?.categories ?? [], [u, d] = s(() =>
|
|
276
|
+
function se({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit: i, onBusyChange: a, children: o }) {
|
|
277
|
+
let l = t?.categories ?? [], [u, d] = s(() => oe(l, n)), [f, p] = s(""), [m, h] = s(""), [g, _] = s([]), [y, b] = s({}), [x, C] = s(""), w = (e) => {
|
|
250
278
|
_(e), b((n) => ({
|
|
251
279
|
...n,
|
|
252
|
-
files:
|
|
280
|
+
files: J([...r, ...e], t) ?? void 0
|
|
253
281
|
}));
|
|
254
282
|
}, T = (e) => {
|
|
255
|
-
let t =
|
|
283
|
+
let t = Y(e);
|
|
256
284
|
t.length > 0 && w([...g, ...t]);
|
|
257
285
|
};
|
|
258
286
|
function E() {
|
|
259
287
|
let e = {};
|
|
260
288
|
u || (e.category = "Choose a category."), f.trim() || (e.subject = "Give your ticket a subject."), m.trim() || (e.body = "Tell us what happened.");
|
|
261
|
-
let n =
|
|
289
|
+
let n = J([...r, ...g], t);
|
|
262
290
|
return n && (e.files = n), b(e), Object.keys(e).length === 0;
|
|
263
291
|
}
|
|
264
292
|
async function D(e) {
|
|
@@ -325,7 +353,7 @@ function J({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit:
|
|
|
325
353
|
error: y.body
|
|
326
354
|
}),
|
|
327
355
|
o,
|
|
328
|
-
/* @__PURE__ */ j(
|
|
356
|
+
/* @__PURE__ */ j(X, {
|
|
329
357
|
id: `${e}-files`,
|
|
330
358
|
files: g,
|
|
331
359
|
onChange: w,
|
|
@@ -337,16 +365,16 @@ function J({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit:
|
|
|
337
365
|
}
|
|
338
366
|
//#endregion
|
|
339
367
|
//#region src/ReportIssue.jsx
|
|
340
|
-
var
|
|
341
|
-
async function
|
|
342
|
-
let e = await
|
|
343
|
-
filter:
|
|
368
|
+
var ce = "supportCapture", le = { zIndex: "var(--wui-z-fixed)" }, ue = (e) => e?.dataset?.[ce] !== "exclude";
|
|
369
|
+
async function de() {
|
|
370
|
+
let e = await k(document.body, {
|
|
371
|
+
filter: ue,
|
|
344
372
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2)
|
|
345
373
|
});
|
|
346
374
|
if (!e) throw Error("The page capture came back empty.");
|
|
347
375
|
return new File([e], "screenshot.png", { type: "image/png" });
|
|
348
376
|
}
|
|
349
|
-
function
|
|
377
|
+
function fe({ file: e, onRemove: t }) {
|
|
350
378
|
let [n, i] = s(null);
|
|
351
379
|
return r(() => {
|
|
352
380
|
let t = URL.createObjectURL(e);
|
|
@@ -374,109 +402,112 @@ function me({ file: e, onRemove: t }) {
|
|
|
374
402
|
]
|
|
375
403
|
});
|
|
376
404
|
}
|
|
377
|
-
function
|
|
378
|
-
let
|
|
379
|
-
async function
|
|
380
|
-
|
|
405
|
+
function pe({ label: e = "Report an issue", floating: t = !1, defaultCategory: n = "Bug report", appVersion: r, getTicketHref: a, onOpenTicket: o, onCreated: l, className: u, style: f }) {
|
|
406
|
+
let p = H(), { config: m, error: h } = W(), g = `support-report-${i().replace(/[^a-zA-Z0-9-]/g, "")}`, [_, v] = s(!1), [y, x] = s(!1), [S, C] = s(null), [w, T] = s(!1), [E, D] = s(!1), [O, k] = s(null);
|
|
407
|
+
async function N() {
|
|
408
|
+
x(!0), k(null);
|
|
381
409
|
try {
|
|
382
|
-
|
|
410
|
+
C(await de()), T(!1);
|
|
383
411
|
} catch {
|
|
384
|
-
|
|
412
|
+
C(null), T(!0);
|
|
385
413
|
} finally {
|
|
386
|
-
|
|
414
|
+
x(!1), v(!0);
|
|
387
415
|
}
|
|
388
416
|
}
|
|
389
|
-
let
|
|
390
|
-
|
|
417
|
+
let P = () => {
|
|
418
|
+
E || (v(!1), C(null), k(null));
|
|
391
419
|
};
|
|
392
|
-
async function
|
|
393
|
-
let t = await
|
|
420
|
+
async function F(e) {
|
|
421
|
+
let t = await p.createTicket({
|
|
394
422
|
...e,
|
|
395
423
|
pageUrl: window.location.href,
|
|
396
424
|
userAgent: navigator.userAgent,
|
|
397
425
|
appVersion: r,
|
|
398
|
-
screenshots:
|
|
426
|
+
screenshots: S ? [S] : []
|
|
399
427
|
});
|
|
400
|
-
|
|
428
|
+
k(t), C(null), l?.(t);
|
|
401
429
|
}
|
|
402
|
-
let
|
|
403
|
-
|
|
430
|
+
let I = O && a ? a(O.id) : void 0, L = O ? /* @__PURE__ */ M("div", {
|
|
431
|
+
className: "d-flex justify-content-end gap-2 w-100",
|
|
432
|
+
children: [/* @__PURE__ */ j(d, {
|
|
433
|
+
variant: "secondary",
|
|
434
|
+
onClick: P,
|
|
435
|
+
children: "Close"
|
|
436
|
+
}), O && (I || o) ? /* @__PURE__ */ j(d, {
|
|
437
|
+
href: I,
|
|
438
|
+
onClick: I ? void 0 : () => {
|
|
439
|
+
v(!1), k(null), o(O);
|
|
440
|
+
},
|
|
441
|
+
children: "View ticket"
|
|
442
|
+
}) : null]
|
|
443
|
+
}) : /* @__PURE__ */ M("div", {
|
|
444
|
+
className: "d-flex justify-content-end gap-2 w-100",
|
|
445
|
+
children: [/* @__PURE__ */ j(d, {
|
|
446
|
+
variant: "secondary",
|
|
447
|
+
onClick: P,
|
|
448
|
+
disabled: E,
|
|
449
|
+
children: "Cancel"
|
|
450
|
+
}), /* @__PURE__ */ j(d, {
|
|
451
|
+
type: "submit",
|
|
452
|
+
form: g,
|
|
453
|
+
loading: E,
|
|
454
|
+
disabled: !m,
|
|
455
|
+
children: "Send report"
|
|
456
|
+
})]
|
|
457
|
+
});
|
|
458
|
+
return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j("span", {
|
|
404
459
|
"data-support-capture": "exclude",
|
|
405
|
-
className: t ? "position-fixed bottom-0 end-0 m-3" : "d-inline-block",
|
|
406
|
-
style: t ?
|
|
460
|
+
className: [t ? "position-fixed bottom-0 end-0 m-3" : "d-inline-block", u].filter(Boolean).join(" "),
|
|
461
|
+
style: t ? {
|
|
462
|
+
...le,
|
|
463
|
+
...f
|
|
464
|
+
} : f,
|
|
407
465
|
children: /* @__PURE__ */ j(d, {
|
|
408
466
|
leftIcon: "bug",
|
|
409
467
|
variant: t ? "primary" : "outline",
|
|
410
|
-
loading:
|
|
411
|
-
onClick:
|
|
468
|
+
loading: y,
|
|
469
|
+
onClick: N,
|
|
412
470
|
"aria-haspopup": "dialog",
|
|
413
471
|
children: e
|
|
414
472
|
})
|
|
415
473
|
}), /* @__PURE__ */ j(b, {
|
|
416
|
-
open:
|
|
474
|
+
open: _,
|
|
417
475
|
size: "lg",
|
|
418
476
|
title: "Report an issue",
|
|
419
477
|
subtitle: "Tell us what went wrong. We attach a screenshot of this page to help us see it.",
|
|
420
478
|
headerIcon: "bug",
|
|
421
479
|
staticBackdrop: !0,
|
|
422
|
-
onClose:
|
|
423
|
-
footer:
|
|
424
|
-
|
|
425
|
-
children: [/* @__PURE__ */ j(d, {
|
|
426
|
-
variant: "secondary",
|
|
427
|
-
onClick: k,
|
|
428
|
-
children: "Close"
|
|
429
|
-
}), E && (N || o) ? /* @__PURE__ */ j(d, {
|
|
430
|
-
href: N,
|
|
431
|
-
onClick: N ? void 0 : () => {
|
|
432
|
-
g(!1), D(null), o(E);
|
|
433
|
-
},
|
|
434
|
-
children: "View ticket"
|
|
435
|
-
}) : null]
|
|
436
|
-
}) : /* @__PURE__ */ M("div", {
|
|
437
|
-
className: "d-flex justify-content-end gap-2 w-100",
|
|
438
|
-
children: [/* @__PURE__ */ j(d, {
|
|
439
|
-
variant: "secondary",
|
|
440
|
-
onClick: k,
|
|
441
|
-
disabled: w,
|
|
442
|
-
children: "Cancel"
|
|
443
|
-
}), /* @__PURE__ */ j(d, {
|
|
444
|
-
type: "submit",
|
|
445
|
-
form: m,
|
|
446
|
-
loading: w,
|
|
447
|
-
disabled: !f,
|
|
448
|
-
children: "Send report"
|
|
449
|
-
})]
|
|
450
|
-
}),
|
|
451
|
-
children: E ? /* @__PURE__ */ j(c, {
|
|
480
|
+
onClose: P,
|
|
481
|
+
footer: L,
|
|
482
|
+
children: O ? /* @__PURE__ */ j(c, {
|
|
452
483
|
variant: "success",
|
|
453
484
|
role: "status",
|
|
454
|
-
title: `Ticket ${
|
|
485
|
+
title: `Ticket ${O.number} is with the support team`,
|
|
455
486
|
children: "We reply by email. You can follow the ticket on your support page."
|
|
456
|
-
}) :
|
|
457
|
-
id:
|
|
458
|
-
config:
|
|
487
|
+
}) : m ? /* @__PURE__ */ j(se, {
|
|
488
|
+
id: g,
|
|
489
|
+
config: m,
|
|
459
490
|
defaultCategory: n,
|
|
460
|
-
extraFiles:
|
|
461
|
-
onSubmit:
|
|
462
|
-
onBusyChange:
|
|
463
|
-
children:
|
|
464
|
-
file:
|
|
465
|
-
onRemove: () =>
|
|
466
|
-
}) :
|
|
491
|
+
extraFiles: S ? [S] : [],
|
|
492
|
+
onSubmit: F,
|
|
493
|
+
onBusyChange: D,
|
|
494
|
+
children: S ? /* @__PURE__ */ j(fe, {
|
|
495
|
+
file: S,
|
|
496
|
+
onRemove: () => C(null)
|
|
497
|
+
}) : w ? /* @__PURE__ */ j(c, {
|
|
467
498
|
variant: "info",
|
|
468
499
|
children: "We could not take a screenshot of this page. You can attach an image instead."
|
|
469
500
|
}) : null
|
|
470
501
|
}) : /* @__PURE__ */ j(c, {
|
|
471
|
-
variant:
|
|
472
|
-
children:
|
|
502
|
+
variant: h ? "danger" : "info",
|
|
503
|
+
children: h ? h.message || "We could not load the support settings." : "Loading the form."
|
|
473
504
|
})
|
|
474
505
|
})] });
|
|
475
506
|
}
|
|
476
507
|
//#endregion
|
|
477
508
|
//#region src/components/NewTicketModal.jsx
|
|
478
|
-
function
|
|
479
|
-
let c =
|
|
509
|
+
function me({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a, appVersion: o }) {
|
|
510
|
+
let c = H(), l = `support-new-${i().replace(/[^a-zA-Z0-9-]/g, "")}`, [u, f] = s(!1);
|
|
480
511
|
async function p(e) {
|
|
481
512
|
n(await c.createTicket({
|
|
482
513
|
...e,
|
|
@@ -508,7 +539,7 @@ function ge({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a,
|
|
|
508
539
|
children: "Send ticket"
|
|
509
540
|
})]
|
|
510
541
|
}),
|
|
511
|
-
children: e && /* @__PURE__ */ j(
|
|
542
|
+
children: e && /* @__PURE__ */ j(se, {
|
|
512
543
|
id: l,
|
|
513
544
|
config: r,
|
|
514
545
|
defaultCategory: a,
|
|
@@ -519,23 +550,23 @@ function ge({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a,
|
|
|
519
550
|
}
|
|
520
551
|
//#endregion
|
|
521
552
|
//#region src/lib/status.js
|
|
522
|
-
var
|
|
553
|
+
var he = {
|
|
523
554
|
Open: "warning",
|
|
524
555
|
InProgress: "info",
|
|
525
556
|
Resolved: "success",
|
|
526
557
|
Closed: "neutral"
|
|
527
558
|
};
|
|
528
|
-
function
|
|
529
|
-
return
|
|
559
|
+
function ge(e) {
|
|
560
|
+
return he[e] ?? "neutral";
|
|
530
561
|
}
|
|
531
562
|
//#endregion
|
|
532
563
|
//#region src/components/AttachmentThumb.jsx
|
|
533
|
-
var
|
|
564
|
+
var _e = {
|
|
534
565
|
width: 140,
|
|
535
566
|
maxWidth: "100%"
|
|
536
|
-
},
|
|
537
|
-
function
|
|
538
|
-
let t =
|
|
567
|
+
}, ve = { height: 84 };
|
|
568
|
+
function ye({ attachment: e }) {
|
|
569
|
+
let t = H(), n = (e.contentType || "").startsWith("image/"), [i, a] = s(null), [o, c] = s(!1);
|
|
539
570
|
r(() => {
|
|
540
571
|
let n = !0, r = null;
|
|
541
572
|
return a(null), c(!1), t.fetchAttachment(e.id).then((e) => {
|
|
@@ -549,12 +580,12 @@ function be({ attachment: e }) {
|
|
|
549
580
|
children: [
|
|
550
581
|
e.fileName,
|
|
551
582
|
", ",
|
|
552
|
-
|
|
583
|
+
q(e.sizeBytes)
|
|
553
584
|
]
|
|
554
585
|
});
|
|
555
586
|
return o ? /* @__PURE__ */ M("span", {
|
|
556
587
|
className: "d-inline-flex flex-column border rounded overflow-hidden",
|
|
557
|
-
style:
|
|
588
|
+
style: _e,
|
|
558
589
|
children: [/* @__PURE__ */ M("span", {
|
|
559
590
|
className: "d-flex align-items-center justify-content-center gap-1 p-2 wui-text-xs text-body-secondary",
|
|
560
591
|
children: [/* @__PURE__ */ j(g, {
|
|
@@ -564,7 +595,7 @@ function be({ attachment: e }) {
|
|
|
564
595
|
}), u]
|
|
565
596
|
}) : /* @__PURE__ */ M("a", {
|
|
566
597
|
className: "d-inline-flex flex-column border rounded overflow-hidden text-decoration-none",
|
|
567
|
-
style:
|
|
598
|
+
style: _e,
|
|
568
599
|
href: i ?? void 0,
|
|
569
600
|
target: "_blank",
|
|
570
601
|
rel: "noopener noreferrer",
|
|
@@ -572,7 +603,7 @@ function be({ attachment: e }) {
|
|
|
572
603
|
"aria-busy": !i || void 0,
|
|
573
604
|
children: [/* @__PURE__ */ j("span", {
|
|
574
605
|
className: "d-flex align-items-center justify-content-center bg-body-tertiary",
|
|
575
|
-
style:
|
|
606
|
+
style: ve,
|
|
576
607
|
children: i ? n ? /* @__PURE__ */ j("img", {
|
|
577
608
|
src: i,
|
|
578
609
|
alt: e.fileName,
|
|
@@ -589,11 +620,11 @@ function be({ attachment: e }) {
|
|
|
589
620
|
}
|
|
590
621
|
//#endregion
|
|
591
622
|
//#region src/components/MessageThread.jsx
|
|
592
|
-
var
|
|
623
|
+
var be = {
|
|
593
624
|
whiteSpace: "pre-wrap",
|
|
594
625
|
overflowWrap: "anywhere"
|
|
595
626
|
};
|
|
596
|
-
function
|
|
627
|
+
function xe({ messages: e }) {
|
|
597
628
|
return /* @__PURE__ */ j("ol", {
|
|
598
629
|
className: "list-unstyled d-flex flex-column gap-3 mb-0",
|
|
599
630
|
"aria-label": "Conversation",
|
|
@@ -601,7 +632,7 @@ function Se({ messages: e }) {
|
|
|
601
632
|
let t = /* @__PURE__ */ j("time", {
|
|
602
633
|
dateTime: e.createdDateTimeUtc,
|
|
603
634
|
className: "wui-text-xs text-body-secondary text-nowrap",
|
|
604
|
-
children:
|
|
635
|
+
children: K(e.createdDateTimeUtc)
|
|
605
636
|
});
|
|
606
637
|
if (e.authorKind === "System") return /* @__PURE__ */ M("li", {
|
|
607
638
|
className: "text-center wui-text-xs text-body-secondary",
|
|
@@ -637,12 +668,12 @@ function Se({ messages: e }) {
|
|
|
637
668
|
}),
|
|
638
669
|
/* @__PURE__ */ j("div", {
|
|
639
670
|
className: "wui-text-sm",
|
|
640
|
-
style:
|
|
671
|
+
style: be,
|
|
641
672
|
children: e.body
|
|
642
673
|
}),
|
|
643
674
|
e.attachments?.length > 0 && /* @__PURE__ */ j("div", {
|
|
644
675
|
className: "d-flex flex-wrap gap-2 mt-2",
|
|
645
|
-
children: e.attachments.map((e) => /* @__PURE__ */ j(
|
|
676
|
+
children: e.attachments.map((e) => /* @__PURE__ */ j(ye, { attachment: e }, e.id))
|
|
646
677
|
})
|
|
647
678
|
]
|
|
648
679
|
})]
|
|
@@ -652,7 +683,7 @@ function Se({ messages: e }) {
|
|
|
652
683
|
}
|
|
653
684
|
//#endregion
|
|
654
685
|
//#region src/components/RatingPanel.jsx
|
|
655
|
-
function
|
|
686
|
+
function Se({ satisfaction: e, comment: t, canRate: n = !1, commentMaxLength: r, onRate: a }) {
|
|
656
687
|
let o = i(), [l, u] = s(""), [p, m] = s(null), [h, g] = s("");
|
|
657
688
|
if (e) return /* @__PURE__ */ M(c, {
|
|
658
689
|
variant: e === "Satisfied" ? "success" : "info",
|
|
@@ -720,11 +751,11 @@ function Ce({ satisfaction: e, comment: t, canRate: n = !1, commentMaxLength: r,
|
|
|
720
751
|
}
|
|
721
752
|
//#endregion
|
|
722
753
|
//#region src/components/ReplyBox.jsx
|
|
723
|
-
function
|
|
754
|
+
function Ce({ onSend: e, config: t, reopens: n = !1 }) {
|
|
724
755
|
let r = i(), [a, o] = s(""), [l, u] = s([]), [f, p] = s(""), [m, h] = s(""), [g, _] = s(!1), v = (e) => {
|
|
725
|
-
u(e), p(
|
|
756
|
+
u(e), p(J(e, t) ?? "");
|
|
726
757
|
}, y = (e) => {
|
|
727
|
-
let t =
|
|
758
|
+
let t = Y(e);
|
|
728
759
|
t.length > 0 && v([...l, ...t]);
|
|
729
760
|
};
|
|
730
761
|
async function b(n) {
|
|
@@ -734,7 +765,7 @@ function we({ onSend: e, config: t, reopens: n = !1 }) {
|
|
|
734
765
|
h("Write a message before you send it.");
|
|
735
766
|
return;
|
|
736
767
|
}
|
|
737
|
-
let i =
|
|
768
|
+
let i = J(l, t);
|
|
738
769
|
if (i) {
|
|
739
770
|
p(i);
|
|
740
771
|
return;
|
|
@@ -773,7 +804,7 @@ function we({ onSend: e, config: t, reopens: n = !1 }) {
|
|
|
773
804
|
hint: n ? "Sending a reply reopens this ticket. You can paste an image into the message." : "You can paste an image into the message.",
|
|
774
805
|
required: !0
|
|
775
806
|
}),
|
|
776
|
-
/* @__PURE__ */ j(
|
|
807
|
+
/* @__PURE__ */ j(X, {
|
|
777
808
|
id: `${r}-files`,
|
|
778
809
|
files: l,
|
|
779
810
|
onChange: v,
|
|
@@ -794,7 +825,7 @@ function we({ onSend: e, config: t, reopens: n = !1 }) {
|
|
|
794
825
|
}
|
|
795
826
|
//#endregion
|
|
796
827
|
//#region src/components/TicketDetail.jsx
|
|
797
|
-
function
|
|
828
|
+
function Z({ label: e, children: t }) {
|
|
798
829
|
return /* @__PURE__ */ M("div", {
|
|
799
830
|
className: "d-flex flex-column",
|
|
800
831
|
children: [/* @__PURE__ */ j("span", {
|
|
@@ -806,8 +837,8 @@ function X({ label: e, children: t }) {
|
|
|
806
837
|
})]
|
|
807
838
|
});
|
|
808
839
|
}
|
|
809
|
-
function
|
|
810
|
-
let { config: r } =
|
|
840
|
+
function we({ ticketId: e, onBack: t, onChanged: n }) {
|
|
841
|
+
let { config: r } = W(), { ticket: i, loading: a, error: o, reload: l, reply: u, reopen: f, rate: p } = G(e), [m, h] = s(!1), [g, _] = s(""), v = async (e) => {
|
|
811
842
|
let t = await e();
|
|
812
843
|
return n?.(), t;
|
|
813
844
|
};
|
|
@@ -863,32 +894,32 @@ function Te({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
863
894
|
children: i.subject
|
|
864
895
|
}), i.statusLabel && /* @__PURE__ */ j(T, {
|
|
865
896
|
label: i.statusLabel,
|
|
866
|
-
tone:
|
|
897
|
+
tone: ge(i.status)
|
|
867
898
|
})]
|
|
868
899
|
}),
|
|
869
900
|
/* @__PURE__ */ M("div", {
|
|
870
901
|
className: "row row-cols-2 row-cols-md-4 g-3",
|
|
871
902
|
children: [
|
|
872
|
-
/* @__PURE__ */ j(
|
|
903
|
+
/* @__PURE__ */ j(Z, {
|
|
873
904
|
label: "Ticket",
|
|
874
905
|
children: i.number
|
|
875
906
|
}),
|
|
876
|
-
/* @__PURE__ */ j(
|
|
907
|
+
/* @__PURE__ */ j(Z, {
|
|
877
908
|
label: "Category",
|
|
878
909
|
children: i.category || "-"
|
|
879
910
|
}),
|
|
880
|
-
/* @__PURE__ */ j(
|
|
911
|
+
/* @__PURE__ */ j(Z, {
|
|
881
912
|
label: "Opened",
|
|
882
913
|
children: /* @__PURE__ */ j("time", {
|
|
883
914
|
dateTime: i.createdDateTimeUtc,
|
|
884
|
-
children:
|
|
915
|
+
children: K(i.createdDateTimeUtc)
|
|
885
916
|
})
|
|
886
917
|
}),
|
|
887
|
-
/* @__PURE__ */ j(
|
|
918
|
+
/* @__PURE__ */ j(Z, {
|
|
888
919
|
label: "Last update",
|
|
889
920
|
children: /* @__PURE__ */ j("time", {
|
|
890
921
|
dateTime: i.updatedDateTimeUtc,
|
|
891
|
-
children:
|
|
922
|
+
children: K(i.updatedDateTimeUtc)
|
|
892
923
|
})
|
|
893
924
|
})
|
|
894
925
|
]
|
|
@@ -916,15 +947,15 @@ function Te({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
916
947
|
className: "align-self-start",
|
|
917
948
|
children: "Reopen ticket"
|
|
918
949
|
}),
|
|
919
|
-
/* @__PURE__ */ j(
|
|
950
|
+
/* @__PURE__ */ j(Se, {
|
|
920
951
|
satisfaction: i.satisfaction,
|
|
921
952
|
comment: i.satisfactionComment,
|
|
922
953
|
canRate: i.canRate,
|
|
923
954
|
commentMaxLength: r?.satisfactionCommentMaxLength,
|
|
924
955
|
onRate: (e) => v(() => p(e))
|
|
925
956
|
}),
|
|
926
|
-
/* @__PURE__ */ j(
|
|
927
|
-
/* @__PURE__ */ j(
|
|
957
|
+
/* @__PURE__ */ j(xe, { messages: i.messages ?? [] }),
|
|
958
|
+
/* @__PURE__ */ j(Ce, {
|
|
928
959
|
config: r,
|
|
929
960
|
reopens: x,
|
|
930
961
|
onSend: (e) => v(() => u(e))
|
|
@@ -934,60 +965,50 @@ function Te({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
934
965
|
}
|
|
935
966
|
//#endregion
|
|
936
967
|
//#region src/lib/url.js
|
|
937
|
-
var
|
|
938
|
-
function
|
|
939
|
-
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get(
|
|
968
|
+
var Q = "ticket";
|
|
969
|
+
function Te() {
|
|
970
|
+
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get(Q);
|
|
940
971
|
}
|
|
941
|
-
function
|
|
942
|
-
if (typeof window > "u") return e ? `?${
|
|
972
|
+
function Ee(e) {
|
|
973
|
+
if (typeof window > "u") return e ? `?${Q}=${encodeURIComponent(e)}` : "?";
|
|
943
974
|
let t = new URL(window.location.href);
|
|
944
|
-
return e ? t.searchParams.set(
|
|
975
|
+
return e ? t.searchParams.set(Q, e) : t.searchParams.delete(Q), `${t.pathname}${t.search}${t.hash}`;
|
|
945
976
|
}
|
|
946
|
-
function
|
|
977
|
+
function De(e) {
|
|
947
978
|
if (typeof window > "u") return;
|
|
948
|
-
let t =
|
|
979
|
+
let t = Ee(e);
|
|
949
980
|
t !== `${window.location.pathname}${window.location.search}${window.location.hash}` && window.history.replaceState(window.history.state, "", t);
|
|
950
981
|
}
|
|
951
982
|
//#endregion
|
|
952
983
|
//#region src/components/TicketList.jsx
|
|
953
|
-
var
|
|
984
|
+
var Oe = [
|
|
954
985
|
{
|
|
955
|
-
key: "
|
|
956
|
-
label: "
|
|
986
|
+
key: "all",
|
|
987
|
+
label: "All",
|
|
988
|
+
countKey: "total"
|
|
957
989
|
},
|
|
958
990
|
{
|
|
959
991
|
key: "Open",
|
|
960
|
-
label: "Open"
|
|
992
|
+
label: "Open",
|
|
993
|
+
countKey: "open"
|
|
961
994
|
},
|
|
962
995
|
{
|
|
963
996
|
key: "InProgress",
|
|
964
|
-
label: "In progress"
|
|
997
|
+
label: "In progress",
|
|
998
|
+
countKey: "inProgress"
|
|
965
999
|
},
|
|
966
1000
|
{
|
|
967
1001
|
key: "Resolved",
|
|
968
|
-
label: "Resolved"
|
|
1002
|
+
label: "Resolved",
|
|
1003
|
+
countKey: "resolved"
|
|
969
1004
|
},
|
|
970
1005
|
{
|
|
971
1006
|
key: "Closed",
|
|
972
|
-
label: "Closed"
|
|
973
|
-
|
|
974
|
-
{
|
|
975
|
-
key: "all",
|
|
976
|
-
label: "All"
|
|
1007
|
+
label: "Closed",
|
|
1008
|
+
countKey: "closed"
|
|
977
1009
|
}
|
|
978
1010
|
];
|
|
979
|
-
function ke(e, t) {
|
|
980
|
-
return t === "all" ? !0 : t === "active" ? e.status === "Open" || e.status === "InProgress" : e.status === t;
|
|
981
|
-
}
|
|
982
|
-
function Ae(e, t) {
|
|
983
|
-
return !t || [
|
|
984
|
-
e.number,
|
|
985
|
-
e.subject,
|
|
986
|
-
e.category
|
|
987
|
-
].some((e) => (e || "").toLowerCase().includes(t));
|
|
988
|
-
}
|
|
989
|
-
function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
990
|
-
let [o, l] = s("active"), [u, f] = s(""), p = u.trim().toLowerCase(), h = a(() => e.filter((e) => Ae(e, p)), [e, p]), g = a(() => Object.fromEntries(Q.map((e) => [e.key, h.filter((t) => ke(t, e.key)).length])), [h]), _ = k(a(() => h.filter((e) => ke(e, o)), [h, o]));
|
|
1011
|
+
function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a, onStatusChange: o, counts: s, search: l, onSearchChange: u, pagination: f }) {
|
|
991
1012
|
return /* @__PURE__ */ M("div", {
|
|
992
1013
|
className: "d-flex flex-column gap-3",
|
|
993
1014
|
children: [
|
|
@@ -1007,17 +1028,18 @@ function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
|
1007
1028
|
/* @__PURE__ */ M("div", {
|
|
1008
1029
|
className: "d-flex flex-column flex-md-row gap-2 align-items-md-center justify-content-between",
|
|
1009
1030
|
children: [/* @__PURE__ */ j(D, {
|
|
1010
|
-
tabs:
|
|
1011
|
-
|
|
1012
|
-
|
|
1031
|
+
tabs: Oe.map(({ key: e, label: t, countKey: n }) => ({
|
|
1032
|
+
key: e,
|
|
1033
|
+
label: t,
|
|
1034
|
+
count: s?.[n]
|
|
1013
1035
|
})),
|
|
1014
|
-
value:
|
|
1015
|
-
onChange:
|
|
1036
|
+
value: a,
|
|
1037
|
+
onChange: o,
|
|
1016
1038
|
ariaLabel: "Filter tickets by status",
|
|
1017
1039
|
className: "flex-grow-1"
|
|
1018
1040
|
}), /* @__PURE__ */ j(x, {
|
|
1019
|
-
value:
|
|
1020
|
-
onChange:
|
|
1041
|
+
value: l,
|
|
1042
|
+
onChange: u,
|
|
1021
1043
|
placeholder: "Search tickets",
|
|
1022
1044
|
ariaLabel: "Search tickets"
|
|
1023
1045
|
})]
|
|
@@ -1031,7 +1053,7 @@ function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
|
1031
1053
|
className: "d-flex flex-column",
|
|
1032
1054
|
style: { minWidth: 0 },
|
|
1033
1055
|
children: [/* @__PURE__ */ j(y, {
|
|
1034
|
-
href:
|
|
1056
|
+
href: Ee(e.id),
|
|
1035
1057
|
animation: "none",
|
|
1036
1058
|
className: "fw-semibold text-break",
|
|
1037
1059
|
onClick: (t) => {
|
|
@@ -1054,7 +1076,7 @@ function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
|
1054
1076
|
label: "Status",
|
|
1055
1077
|
render: (e) => e.statusLabel ? /* @__PURE__ */ j(T, {
|
|
1056
1078
|
label: e.statusLabel,
|
|
1057
|
-
tone:
|
|
1079
|
+
tone: ge(e.status)
|
|
1058
1080
|
}) : "-"
|
|
1059
1081
|
},
|
|
1060
1082
|
{
|
|
@@ -1069,16 +1091,16 @@ function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
|
1069
1091
|
cellClassName: "wui-text-sm text-body-secondary text-nowrap",
|
|
1070
1092
|
render: (e) => /* @__PURE__ */ j("time", {
|
|
1071
1093
|
dateTime: e.updatedDateTimeUtc,
|
|
1072
|
-
children:
|
|
1094
|
+
children: K(e.updatedDateTimeUtc)
|
|
1073
1095
|
})
|
|
1074
1096
|
}
|
|
1075
1097
|
],
|
|
1076
|
-
rows:
|
|
1098
|
+
rows: e,
|
|
1077
1099
|
loading: t,
|
|
1078
1100
|
skeletonRows: 4,
|
|
1079
1101
|
ariaLabel: "Support tickets",
|
|
1080
|
-
sourceCount:
|
|
1081
|
-
pagination:
|
|
1102
|
+
sourceCount: s?.total ?? 0,
|
|
1103
|
+
pagination: f,
|
|
1082
1104
|
empty: /* @__PURE__ */ j(E, {
|
|
1083
1105
|
icon: "message-square",
|
|
1084
1106
|
title: "No tickets yet",
|
|
@@ -1094,16 +1116,61 @@ function je({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i }) {
|
|
|
1094
1116
|
});
|
|
1095
1117
|
}
|
|
1096
1118
|
//#endregion
|
|
1119
|
+
//#region src/lib/useDebouncedValue.js
|
|
1120
|
+
function Ae(e, t) {
|
|
1121
|
+
let [n, i] = s(e);
|
|
1122
|
+
return r(() => {
|
|
1123
|
+
let n = setTimeout(() => i(e), t);
|
|
1124
|
+
return () => clearTimeout(n);
|
|
1125
|
+
}, [e, t]), n;
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1097
1128
|
//#region src/SupportCenter.jsx
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1129
|
+
var je = 300, Me = 10;
|
|
1130
|
+
function Ne({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
1131
|
+
let { config: i, error: a, reload: o } = W(), [l, u] = s("all"), [f, p] = s(""), m = Ae(f.trim(), je), [h, g] = s(Me), _ = `${l}|${m}|${h}`, [v, y] = s({
|
|
1132
|
+
key: _,
|
|
1133
|
+
page: 1
|
|
1134
|
+
}), b = v.key === _ ? v.page : 1, x = (e) => y({
|
|
1135
|
+
key: _,
|
|
1136
|
+
page: e
|
|
1137
|
+
}), S = te({
|
|
1138
|
+
status: l === "all" ? void 0 : l,
|
|
1139
|
+
search: m || void 0,
|
|
1140
|
+
page: b,
|
|
1141
|
+
pageSize: h
|
|
1142
|
+
}), { counts: C, reload: w } = ne(), [T, E] = s(() => e || Te()), [D, O] = s(!1), k = S.totalPages;
|
|
1143
|
+
r(() => {
|
|
1144
|
+
k > 0 && b > k && y({
|
|
1145
|
+
key: _,
|
|
1146
|
+
page: k
|
|
1147
|
+
});
|
|
1148
|
+
}, [
|
|
1149
|
+
k,
|
|
1150
|
+
b,
|
|
1151
|
+
_
|
|
1152
|
+
]);
|
|
1153
|
+
let A = () => {
|
|
1154
|
+
S.reload(), w();
|
|
1155
|
+
}, N = (e) => {
|
|
1156
|
+
E(e), De(e);
|
|
1101
1157
|
};
|
|
1102
|
-
|
|
1103
|
-
ticketId:
|
|
1104
|
-
onBack: () =>
|
|
1105
|
-
onChanged:
|
|
1106
|
-
},
|
|
1158
|
+
if (T) return /* @__PURE__ */ j(we, {
|
|
1159
|
+
ticketId: T,
|
|
1160
|
+
onBack: () => N(null),
|
|
1161
|
+
onChanged: A
|
|
1162
|
+
}, T);
|
|
1163
|
+
let P = S.totalCount === 0 ? 0 : (b - 1) * h + 1, F = {
|
|
1164
|
+
page: b,
|
|
1165
|
+
totalPages: Math.max(1, S.totalPages),
|
|
1166
|
+
pageSize: h,
|
|
1167
|
+
total: S.totalCount,
|
|
1168
|
+
firstRow: P,
|
|
1169
|
+
lastRow: Math.min(S.totalCount, P + S.tickets.length - 1),
|
|
1170
|
+
setPage: x,
|
|
1171
|
+
setPageSize: g
|
|
1172
|
+
};
|
|
1173
|
+
return /* @__PURE__ */ M("section", {
|
|
1107
1174
|
className: "d-flex flex-column gap-3",
|
|
1108
1175
|
"aria-labelledby": "support-center-title",
|
|
1109
1176
|
children: [
|
|
@@ -1115,39 +1182,45 @@ function Me({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1115
1182
|
children: "Your tickets"
|
|
1116
1183
|
}), /* @__PURE__ */ j(d, {
|
|
1117
1184
|
leftIcon: "plus",
|
|
1118
|
-
onClick: () =>
|
|
1119
|
-
disabled: !
|
|
1185
|
+
onClick: () => O(!0),
|
|
1186
|
+
disabled: !i,
|
|
1120
1187
|
children: "New ticket"
|
|
1121
1188
|
})]
|
|
1122
1189
|
}),
|
|
1123
|
-
|
|
1190
|
+
a && /* @__PURE__ */ M(c, {
|
|
1124
1191
|
variant: "warning",
|
|
1125
1192
|
children: [
|
|
1126
|
-
|
|
1193
|
+
a.message || "We could not load the support settings.",
|
|
1127
1194
|
" ",
|
|
1128
1195
|
/* @__PURE__ */ j(d, {
|
|
1129
1196
|
variant: "ghost",
|
|
1130
1197
|
size: "sm",
|
|
1131
|
-
onClick:
|
|
1198
|
+
onClick: o,
|
|
1132
1199
|
children: "Try again"
|
|
1133
1200
|
})
|
|
1134
1201
|
]
|
|
1135
1202
|
}),
|
|
1136
|
-
/* @__PURE__ */ j(
|
|
1137
|
-
tickets:
|
|
1138
|
-
loading:
|
|
1139
|
-
error:
|
|
1140
|
-
onRetry:
|
|
1141
|
-
onOpen:
|
|
1203
|
+
/* @__PURE__ */ j(ke, {
|
|
1204
|
+
tickets: S.tickets,
|
|
1205
|
+
loading: S.loading,
|
|
1206
|
+
error: S.error,
|
|
1207
|
+
onRetry: A,
|
|
1208
|
+
onOpen: N,
|
|
1209
|
+
status: l,
|
|
1210
|
+
onStatusChange: u,
|
|
1211
|
+
counts: C,
|
|
1212
|
+
search: f,
|
|
1213
|
+
onSearchChange: p,
|
|
1214
|
+
pagination: F
|
|
1142
1215
|
}),
|
|
1143
|
-
|
|
1144
|
-
open:
|
|
1145
|
-
onClose: () =>
|
|
1146
|
-
config:
|
|
1216
|
+
i && /* @__PURE__ */ j(me, {
|
|
1217
|
+
open: D,
|
|
1218
|
+
onClose: () => O(!1),
|
|
1219
|
+
config: i,
|
|
1147
1220
|
defaultCategory: t,
|
|
1148
1221
|
appVersion: n,
|
|
1149
1222
|
onCreated: (e) => {
|
|
1150
|
-
|
|
1223
|
+
O(!1), A(), N(e.id);
|
|
1151
1224
|
}
|
|
1152
1225
|
})
|
|
1153
1226
|
]
|
|
@@ -1156,8 +1229,8 @@ function Me({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1156
1229
|
//#endregion
|
|
1157
1230
|
//#region src/SupportContact.jsx
|
|
1158
1231
|
var $ = (e) => typeof e == "string" && e.trim() !== "";
|
|
1159
|
-
function
|
|
1160
|
-
let { config: t } =
|
|
1232
|
+
function Pe({ className: e }) {
|
|
1233
|
+
let { config: t } = W();
|
|
1161
1234
|
if (!t) return null;
|
|
1162
1235
|
let n = [];
|
|
1163
1236
|
return $(t.supportEmail) && n.push({
|
|
@@ -1199,7 +1272,7 @@ function Ne({ className: e }) {
|
|
|
1199
1272
|
}
|
|
1200
1273
|
//#endregion
|
|
1201
1274
|
//#region src/SupportProvider.jsx
|
|
1202
|
-
function
|
|
1275
|
+
function Fe({ client: e, children: n }) {
|
|
1203
1276
|
let r = o(null), i = t((t = !1) => {
|
|
1204
1277
|
let n = r.current;
|
|
1205
1278
|
if (t || !n || n.client !== e) {
|
|
@@ -1216,10 +1289,10 @@ function Pe({ client: e, children: n }) {
|
|
|
1216
1289
|
client: e,
|
|
1217
1290
|
loadConfig: i
|
|
1218
1291
|
}), [e, i]);
|
|
1219
|
-
return /* @__PURE__ */ j(
|
|
1292
|
+
return /* @__PURE__ */ j(B.Provider, {
|
|
1220
1293
|
value: s,
|
|
1221
1294
|
children: n
|
|
1222
1295
|
});
|
|
1223
1296
|
}
|
|
1224
1297
|
//#endregion
|
|
1225
|
-
export {
|
|
1298
|
+
export { pe as ReportIssue, P as SupportApiError, Ne as SupportCenter, Pe as SupportContact, Fe as SupportProvider, ee as createSupportClient, H as useSupportClient, W as useSupportConfig, G as useSupportTicket, ne as useSupportTicketCounts, te as useSupportTickets };
|