@webority/support-react 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/support-react.js +118 -102
- package/dist/types/lib/format.d.ts +2 -2
- package/package.json +3 -3
package/dist/support-react.js
CHANGED
|
@@ -74,16 +74,16 @@ function ee(e, t = "/api/support") {
|
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/context.js
|
|
77
|
-
var
|
|
78
|
-
function
|
|
79
|
-
let e = n(
|
|
77
|
+
var B = e(null);
|
|
78
|
+
function V() {
|
|
79
|
+
let e = n(B);
|
|
80
80
|
if (!e) throw Error("Support components and hooks must be used inside <SupportProvider>.");
|
|
81
81
|
return e;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
83
|
+
function H() {
|
|
84
|
+
return V().client;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function U(e, n, i = !0) {
|
|
87
87
|
let [a, c] = s({
|
|
88
88
|
data: null,
|
|
89
89
|
loading: i,
|
|
@@ -132,8 +132,8 @@ function H(e, n, i = !0) {
|
|
|
132
132
|
setData: m
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
let { loadConfig: e } =
|
|
135
|
+
function W() {
|
|
136
|
+
let { loadConfig: e } = V(), { data: t, loading: n, error: r, reload: i } = U(e, "config");
|
|
137
137
|
return {
|
|
138
138
|
config: t,
|
|
139
139
|
loading: n,
|
|
@@ -141,8 +141,8 @@ function U() {
|
|
|
141
141
|
reload: i
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
let t =
|
|
144
|
+
function G(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
146
|
status: n,
|
|
147
147
|
search: r,
|
|
148
148
|
page: i,
|
|
@@ -163,8 +163,8 @@ function ne(e = {}) {
|
|
|
163
163
|
reload: l
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
let e =
|
|
166
|
+
function K() {
|
|
167
|
+
let e = H(), { data: t, loading: n, error: r, reload: i } = U(() => e.getTicketCounts(), "ticket-counts");
|
|
168
168
|
return {
|
|
169
169
|
counts: t,
|
|
170
170
|
loading: n,
|
|
@@ -172,8 +172,8 @@ function W() {
|
|
|
172
172
|
reload: i
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
let n =
|
|
175
|
+
function q(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) => {
|
|
177
177
|
let t = await e();
|
|
178
178
|
return s(t), t;
|
|
179
179
|
}, [s]);
|
|
@@ -201,20 +201,36 @@ function re(e) {
|
|
|
201
201
|
}
|
|
202
202
|
//#endregion
|
|
203
203
|
//#region src/lib/format.js
|
|
204
|
-
var
|
|
205
|
-
day: "
|
|
206
|
-
month: "
|
|
204
|
+
var te = new Intl.DateTimeFormat("en-IN", {
|
|
205
|
+
day: "2-digit",
|
|
206
|
+
month: "numeric",
|
|
207
207
|
year: "numeric",
|
|
208
208
|
hour: "numeric",
|
|
209
209
|
minute: "2-digit",
|
|
210
|
+
hour12: !0,
|
|
210
211
|
timeZoneName: "short"
|
|
211
|
-
})
|
|
212
|
-
|
|
212
|
+
}), ne = [
|
|
213
|
+
"Jan",
|
|
214
|
+
"Feb",
|
|
215
|
+
"Mar",
|
|
216
|
+
"Apr",
|
|
217
|
+
"May",
|
|
218
|
+
"Jun",
|
|
219
|
+
"Jul",
|
|
220
|
+
"Aug",
|
|
221
|
+
"Sep",
|
|
222
|
+
"Oct",
|
|
223
|
+
"Nov",
|
|
224
|
+
"Dec"
|
|
225
|
+
];
|
|
226
|
+
function J(e) {
|
|
213
227
|
if (!e) return "-";
|
|
214
228
|
let t = new Date(e);
|
|
215
|
-
|
|
229
|
+
if (Number.isNaN(t.getTime())) return "-";
|
|
230
|
+
let n = Object.fromEntries(te.formatToParts(t).map((e) => [e.type, e.value]));
|
|
231
|
+
return `${n.day} ${ne[Number(n.month) - 1]} ${n.year}, ${n.hour}:${n.minute} ${n.dayPeriod.toLowerCase()} ${n.timeZoneName}`;
|
|
216
232
|
}
|
|
217
|
-
function
|
|
233
|
+
function Y(e) {
|
|
218
234
|
if (!Number.isFinite(e) || e < 0) return "-";
|
|
219
235
|
if (e < 1024) return `${e} B`;
|
|
220
236
|
if (e < 1024 * 1024) return `${Math.round(e / 1024)} KB`;
|
|
@@ -223,10 +239,10 @@ function K(e) {
|
|
|
223
239
|
}
|
|
224
240
|
//#endregion
|
|
225
241
|
//#region src/lib/files.js
|
|
226
|
-
function
|
|
242
|
+
function re(e) {
|
|
227
243
|
return (e?.allowedContentTypes ?? []).join(",");
|
|
228
244
|
}
|
|
229
|
-
function
|
|
245
|
+
function ie(e, t) {
|
|
230
246
|
if (t.length === 0) return !0;
|
|
231
247
|
let n = (e || "").toLowerCase();
|
|
232
248
|
return t.some((e) => {
|
|
@@ -234,17 +250,17 @@ function oe(e, t) {
|
|
|
234
250
|
return t.endsWith("/*") ? n.startsWith(t.slice(0, -1)) : n === t;
|
|
235
251
|
});
|
|
236
252
|
}
|
|
237
|
-
function
|
|
253
|
+
function X(e, t) {
|
|
238
254
|
let n = e ?? [], r = t?.maxAttachmentsPerMessage ?? 0, i = t?.maxAttachmentBytes ?? 0, a = t?.allowedContentTypes ?? [];
|
|
239
255
|
if (r > 0 && n.length > r) return r === 1 ? "You can attach one file." : `You can attach up to ${r} files.`;
|
|
240
256
|
for (let e of n) {
|
|
241
257
|
let t = e.name || "This file";
|
|
242
|
-
if (!
|
|
243
|
-
if (i > 0 && e.size > i) return `${t} is larger than ${
|
|
258
|
+
if (!ie(e.type, a)) return `${t} is a file type we cannot accept.`;
|
|
259
|
+
if (i > 0 && e.size > i) return `${t} is larger than ${Y(i)}.`;
|
|
244
260
|
}
|
|
245
261
|
return null;
|
|
246
262
|
}
|
|
247
|
-
function
|
|
263
|
+
function ae(e) {
|
|
248
264
|
let t = Array.from(e.clipboardData?.items ?? []), n = Date.now();
|
|
249
265
|
return t.filter((e) => e.kind === "file" && e.type.startsWith("image/")).map((e) => e.getAsFile()).filter(Boolean).map((e, t) => {
|
|
250
266
|
let r = (e.type.split("/")[1] || "png").replace("jpeg", "jpg");
|
|
@@ -253,7 +269,7 @@ function J(e) {
|
|
|
253
269
|
}
|
|
254
270
|
//#endregion
|
|
255
271
|
//#region src/components/AttachmentField.jsx
|
|
256
|
-
function
|
|
272
|
+
function oe({ id: e, label: t = "Attachments", files: n, onChange: r, config: i, error: a }) {
|
|
257
273
|
let o = i?.maxAttachmentBytes ?? 0, s = o > 0 ? Math.max(.1, Math.round(o / (1024 * 1024) * 10) / 10) : 0;
|
|
258
274
|
return /* @__PURE__ */ j(h, {
|
|
259
275
|
id: e,
|
|
@@ -262,7 +278,7 @@ function Y({ id: e, label: t = "Attachments", files: n, onChange: r, config: i,
|
|
|
262
278
|
multiple: !0,
|
|
263
279
|
value: n,
|
|
264
280
|
onChange: r,
|
|
265
|
-
accept:
|
|
281
|
+
accept: re(i),
|
|
266
282
|
maxSizeMb: s,
|
|
267
283
|
validate: !1,
|
|
268
284
|
error: a || void 0
|
|
@@ -273,20 +289,20 @@ function Y({ id: e, label: t = "Attachments", files: n, onChange: r, config: i,
|
|
|
273
289
|
function se(e, t) {
|
|
274
290
|
return t && e.includes(t) ? t : e[0] ?? "";
|
|
275
291
|
}
|
|
276
|
-
function
|
|
292
|
+
function ce({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit: i, onBusyChange: a, children: o }) {
|
|
277
293
|
let l = t?.categories ?? [], [u, d] = s(() => se(l, n)), [f, p] = s(""), [m, h] = s(""), [g, _] = s([]), [y, b] = s({}), [x, C] = s(""), w = (e) => {
|
|
278
294
|
_(e), b((n) => ({
|
|
279
295
|
...n,
|
|
280
|
-
files:
|
|
296
|
+
files: X([...r, ...e], t) ?? void 0
|
|
281
297
|
}));
|
|
282
298
|
}, T = (e) => {
|
|
283
|
-
let t =
|
|
299
|
+
let t = ae(e);
|
|
284
300
|
t.length > 0 && w([...g, ...t]);
|
|
285
301
|
};
|
|
286
302
|
function E() {
|
|
287
303
|
let e = {};
|
|
288
304
|
u || (e.category = "Choose a category."), f.trim() || (e.subject = "Give your ticket a subject."), m.trim() || (e.body = "Tell us what happened.");
|
|
289
|
-
let n =
|
|
305
|
+
let n = X([...r, ...g], t);
|
|
290
306
|
return n && (e.files = n), b(e), Object.keys(e).length === 0;
|
|
291
307
|
}
|
|
292
308
|
async function D(e) {
|
|
@@ -353,7 +369,7 @@ function X({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit:
|
|
|
353
369
|
error: y.body
|
|
354
370
|
}),
|
|
355
371
|
o,
|
|
356
|
-
/* @__PURE__ */ j(
|
|
372
|
+
/* @__PURE__ */ j(oe, {
|
|
357
373
|
id: `${e}-files`,
|
|
358
374
|
files: g,
|
|
359
375
|
onChange: w,
|
|
@@ -365,16 +381,16 @@ function X({ id: e, config: t, defaultCategory: n, extraFiles: r = [], onSubmit:
|
|
|
365
381
|
}
|
|
366
382
|
//#endregion
|
|
367
383
|
//#region src/ReportIssue.jsx
|
|
368
|
-
var
|
|
369
|
-
async function
|
|
384
|
+
var le = "supportCapture", ue = { zIndex: "var(--wui-z-fixed)" }, de = (e) => e?.dataset?.[le] !== "exclude";
|
|
385
|
+
async function fe() {
|
|
370
386
|
let e = await k(document.body, {
|
|
371
|
-
filter:
|
|
387
|
+
filter: de,
|
|
372
388
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2)
|
|
373
389
|
});
|
|
374
390
|
if (!e) throw Error("The page capture came back empty.");
|
|
375
391
|
return new File([e], "screenshot.png", { type: "image/png" });
|
|
376
392
|
}
|
|
377
|
-
function
|
|
393
|
+
function pe({ file: e, onRemove: t }) {
|
|
378
394
|
let [n, i] = s(null);
|
|
379
395
|
return r(() => {
|
|
380
396
|
let t = URL.createObjectURL(e);
|
|
@@ -402,12 +418,12 @@ function fe({ file: e, onRemove: t }) {
|
|
|
402
418
|
]
|
|
403
419
|
});
|
|
404
420
|
}
|
|
405
|
-
function
|
|
406
|
-
let p =
|
|
421
|
+
function me({ label: e = "Report an issue", floating: t = !1, defaultCategory: n = "Bug report", appVersion: r, getTicketHref: a, onOpenTicket: o, onCreated: l, className: u, style: f }) {
|
|
422
|
+
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
423
|
async function N() {
|
|
408
424
|
x(!0), k(null);
|
|
409
425
|
try {
|
|
410
|
-
C(await
|
|
426
|
+
C(await fe()), T(!1);
|
|
411
427
|
} catch {
|
|
412
428
|
C(null), T(!0);
|
|
413
429
|
} finally {
|
|
@@ -459,7 +475,7 @@ function pe({ label: e = "Report an issue", floating: t = !1, defaultCategory: n
|
|
|
459
475
|
"data-support-capture": "exclude",
|
|
460
476
|
className: [t ? "position-fixed bottom-0 end-0 m-3" : "d-inline-block", u].filter(Boolean).join(" "),
|
|
461
477
|
style: t ? {
|
|
462
|
-
...
|
|
478
|
+
...ue,
|
|
463
479
|
...f
|
|
464
480
|
} : f,
|
|
465
481
|
children: /* @__PURE__ */ j(d, {
|
|
@@ -484,14 +500,14 @@ function pe({ label: e = "Report an issue", floating: t = !1, defaultCategory: n
|
|
|
484
500
|
role: "status",
|
|
485
501
|
title: `Ticket ${O.number} is with the support team`,
|
|
486
502
|
children: "We reply by email. You can follow the ticket on your support page."
|
|
487
|
-
}) : m ? /* @__PURE__ */ j(
|
|
503
|
+
}) : m ? /* @__PURE__ */ j(ce, {
|
|
488
504
|
id: g,
|
|
489
505
|
config: m,
|
|
490
506
|
defaultCategory: n,
|
|
491
507
|
extraFiles: S ? [S] : [],
|
|
492
508
|
onSubmit: F,
|
|
493
509
|
onBusyChange: D,
|
|
494
|
-
children: S ? /* @__PURE__ */ j(
|
|
510
|
+
children: S ? /* @__PURE__ */ j(pe, {
|
|
495
511
|
file: S,
|
|
496
512
|
onRemove: () => C(null)
|
|
497
513
|
}) : w ? /* @__PURE__ */ j(c, {
|
|
@@ -506,8 +522,8 @@ function pe({ label: e = "Report an issue", floating: t = !1, defaultCategory: n
|
|
|
506
522
|
}
|
|
507
523
|
//#endregion
|
|
508
524
|
//#region src/components/NewTicketModal.jsx
|
|
509
|
-
function
|
|
510
|
-
let c =
|
|
525
|
+
function he({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a, appVersion: o }) {
|
|
526
|
+
let c = H(), l = `support-new-${i().replace(/[^a-zA-Z0-9-]/g, "")}`, [u, f] = s(!1);
|
|
511
527
|
async function p(e) {
|
|
512
528
|
n(await c.createTicket({
|
|
513
529
|
...e,
|
|
@@ -539,7 +555,7 @@ function me({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a,
|
|
|
539
555
|
children: "Send ticket"
|
|
540
556
|
})]
|
|
541
557
|
}),
|
|
542
|
-
children: e && /* @__PURE__ */ j(
|
|
558
|
+
children: e && /* @__PURE__ */ j(ce, {
|
|
543
559
|
id: l,
|
|
544
560
|
config: r,
|
|
545
561
|
defaultCategory: a,
|
|
@@ -550,23 +566,23 @@ function me({ open: e, onClose: t, onCreated: n, config: r, defaultCategory: a,
|
|
|
550
566
|
}
|
|
551
567
|
//#endregion
|
|
552
568
|
//#region src/lib/status.js
|
|
553
|
-
var
|
|
569
|
+
var ge = {
|
|
554
570
|
Open: "warning",
|
|
555
571
|
InProgress: "info",
|
|
556
572
|
Resolved: "success",
|
|
557
573
|
Closed: "neutral"
|
|
558
574
|
};
|
|
559
|
-
function
|
|
560
|
-
return
|
|
575
|
+
function _e(e) {
|
|
576
|
+
return ge[e] ?? "neutral";
|
|
561
577
|
}
|
|
562
578
|
//#endregion
|
|
563
579
|
//#region src/components/AttachmentThumb.jsx
|
|
564
|
-
var
|
|
580
|
+
var ve = {
|
|
565
581
|
width: 140,
|
|
566
582
|
maxWidth: "100%"
|
|
567
|
-
},
|
|
568
|
-
function
|
|
569
|
-
let t =
|
|
583
|
+
}, ye = { height: 84 };
|
|
584
|
+
function be({ attachment: e }) {
|
|
585
|
+
let t = H(), n = (e.contentType || "").startsWith("image/"), [i, a] = s(null), [o, c] = s(!1);
|
|
570
586
|
r(() => {
|
|
571
587
|
let n = !0, r = null;
|
|
572
588
|
return a(null), c(!1), t.fetchAttachment(e.id).then((e) => {
|
|
@@ -580,12 +596,12 @@ function ye({ attachment: e }) {
|
|
|
580
596
|
children: [
|
|
581
597
|
e.fileName,
|
|
582
598
|
", ",
|
|
583
|
-
|
|
599
|
+
Y(e.sizeBytes)
|
|
584
600
|
]
|
|
585
601
|
});
|
|
586
602
|
return o ? /* @__PURE__ */ M("span", {
|
|
587
603
|
className: "d-inline-flex flex-column border rounded overflow-hidden",
|
|
588
|
-
style:
|
|
604
|
+
style: ve,
|
|
589
605
|
children: [/* @__PURE__ */ M("span", {
|
|
590
606
|
className: "d-flex align-items-center justify-content-center gap-1 p-2 wui-text-xs text-body-secondary",
|
|
591
607
|
children: [/* @__PURE__ */ j(g, {
|
|
@@ -595,7 +611,7 @@ function ye({ attachment: e }) {
|
|
|
595
611
|
}), u]
|
|
596
612
|
}) : /* @__PURE__ */ M("a", {
|
|
597
613
|
className: "d-inline-flex flex-column border rounded overflow-hidden text-decoration-none",
|
|
598
|
-
style:
|
|
614
|
+
style: ve,
|
|
599
615
|
href: i ?? void 0,
|
|
600
616
|
target: "_blank",
|
|
601
617
|
rel: "noopener noreferrer",
|
|
@@ -603,7 +619,7 @@ function ye({ attachment: e }) {
|
|
|
603
619
|
"aria-busy": !i || void 0,
|
|
604
620
|
children: [/* @__PURE__ */ j("span", {
|
|
605
621
|
className: "d-flex align-items-center justify-content-center bg-body-tertiary",
|
|
606
|
-
style:
|
|
622
|
+
style: ye,
|
|
607
623
|
children: i ? n ? /* @__PURE__ */ j("img", {
|
|
608
624
|
src: i,
|
|
609
625
|
alt: e.fileName,
|
|
@@ -620,11 +636,11 @@ function ye({ attachment: e }) {
|
|
|
620
636
|
}
|
|
621
637
|
//#endregion
|
|
622
638
|
//#region src/components/MessageThread.jsx
|
|
623
|
-
var
|
|
639
|
+
var xe = {
|
|
624
640
|
whiteSpace: "pre-wrap",
|
|
625
641
|
overflowWrap: "anywhere"
|
|
626
642
|
};
|
|
627
|
-
function
|
|
643
|
+
function Se({ messages: e }) {
|
|
628
644
|
return /* @__PURE__ */ j("ol", {
|
|
629
645
|
className: "list-unstyled d-flex flex-column gap-3 mb-0",
|
|
630
646
|
"aria-label": "Conversation",
|
|
@@ -632,7 +648,7 @@ function xe({ messages: e }) {
|
|
|
632
648
|
let t = /* @__PURE__ */ j("time", {
|
|
633
649
|
dateTime: e.createdDateTimeUtc,
|
|
634
650
|
className: "wui-text-xs text-body-secondary text-nowrap",
|
|
635
|
-
children:
|
|
651
|
+
children: J(e.createdDateTimeUtc)
|
|
636
652
|
});
|
|
637
653
|
if (e.authorKind === "System") return /* @__PURE__ */ M("li", {
|
|
638
654
|
className: "text-center wui-text-xs text-body-secondary",
|
|
@@ -668,12 +684,12 @@ function xe({ messages: e }) {
|
|
|
668
684
|
}),
|
|
669
685
|
/* @__PURE__ */ j("div", {
|
|
670
686
|
className: "wui-text-sm",
|
|
671
|
-
style:
|
|
687
|
+
style: xe,
|
|
672
688
|
children: e.body
|
|
673
689
|
}),
|
|
674
690
|
e.attachments?.length > 0 && /* @__PURE__ */ j("div", {
|
|
675
691
|
className: "d-flex flex-wrap gap-2 mt-2",
|
|
676
|
-
children: e.attachments.map((e) => /* @__PURE__ */ j(
|
|
692
|
+
children: e.attachments.map((e) => /* @__PURE__ */ j(be, { attachment: e }, e.id))
|
|
677
693
|
})
|
|
678
694
|
]
|
|
679
695
|
})]
|
|
@@ -683,7 +699,7 @@ function xe({ messages: e }) {
|
|
|
683
699
|
}
|
|
684
700
|
//#endregion
|
|
685
701
|
//#region src/components/RatingPanel.jsx
|
|
686
|
-
function
|
|
702
|
+
function Ce({ satisfaction: e, comment: t, canRate: n = !1, commentMaxLength: r, onRate: a }) {
|
|
687
703
|
let o = i(), [l, u] = s(""), [p, m] = s(null), [h, g] = s("");
|
|
688
704
|
if (e) return /* @__PURE__ */ M(c, {
|
|
689
705
|
variant: e === "Satisfied" ? "success" : "info",
|
|
@@ -751,11 +767,11 @@ function Se({ satisfaction: e, comment: t, canRate: n = !1, commentMaxLength: r,
|
|
|
751
767
|
}
|
|
752
768
|
//#endregion
|
|
753
769
|
//#region src/components/ReplyBox.jsx
|
|
754
|
-
function
|
|
770
|
+
function we({ onSend: e, config: t, reopens: n = !1 }) {
|
|
755
771
|
let r = i(), [a, o] = s(""), [l, u] = s([]), [f, p] = s(""), [m, h] = s(""), [g, _] = s(!1), v = (e) => {
|
|
756
|
-
u(e), p(
|
|
772
|
+
u(e), p(X(e, t) ?? "");
|
|
757
773
|
}, y = (e) => {
|
|
758
|
-
let t =
|
|
774
|
+
let t = ae(e);
|
|
759
775
|
t.length > 0 && v([...l, ...t]);
|
|
760
776
|
};
|
|
761
777
|
async function b(n) {
|
|
@@ -765,7 +781,7 @@ function Ce({ onSend: e, config: t, reopens: n = !1 }) {
|
|
|
765
781
|
h("Write a message before you send it.");
|
|
766
782
|
return;
|
|
767
783
|
}
|
|
768
|
-
let i =
|
|
784
|
+
let i = X(l, t);
|
|
769
785
|
if (i) {
|
|
770
786
|
p(i);
|
|
771
787
|
return;
|
|
@@ -804,7 +820,7 @@ function Ce({ onSend: e, config: t, reopens: n = !1 }) {
|
|
|
804
820
|
hint: n ? "Sending a reply reopens this ticket. You can paste an image into the message." : "You can paste an image into the message.",
|
|
805
821
|
required: !0
|
|
806
822
|
}),
|
|
807
|
-
/* @__PURE__ */ j(
|
|
823
|
+
/* @__PURE__ */ j(oe, {
|
|
808
824
|
id: `${r}-files`,
|
|
809
825
|
files: l,
|
|
810
826
|
onChange: v,
|
|
@@ -837,8 +853,8 @@ function Z({ label: e, children: t }) {
|
|
|
837
853
|
})]
|
|
838
854
|
});
|
|
839
855
|
}
|
|
840
|
-
function
|
|
841
|
-
let { config: r } =
|
|
856
|
+
function Te({ ticketId: e, onBack: t, onChanged: n }) {
|
|
857
|
+
let { config: r } = W(), { ticket: i, loading: a, error: o, reload: l, reply: u, reopen: f, rate: p } = q(e), [m, h] = s(!1), [g, _] = s(""), v = async (e) => {
|
|
842
858
|
let t = await e();
|
|
843
859
|
return n?.(), t;
|
|
844
860
|
};
|
|
@@ -894,7 +910,7 @@ function we({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
894
910
|
children: i.subject
|
|
895
911
|
}), i.statusLabel && /* @__PURE__ */ j(T, {
|
|
896
912
|
label: i.statusLabel,
|
|
897
|
-
tone:
|
|
913
|
+
tone: _e(i.status)
|
|
898
914
|
})]
|
|
899
915
|
}),
|
|
900
916
|
/* @__PURE__ */ M("div", {
|
|
@@ -912,14 +928,14 @@ function we({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
912
928
|
label: "Opened",
|
|
913
929
|
children: /* @__PURE__ */ j("time", {
|
|
914
930
|
dateTime: i.createdDateTimeUtc,
|
|
915
|
-
children:
|
|
931
|
+
children: J(i.createdDateTimeUtc)
|
|
916
932
|
})
|
|
917
933
|
}),
|
|
918
934
|
/* @__PURE__ */ j(Z, {
|
|
919
935
|
label: "Last update",
|
|
920
936
|
children: /* @__PURE__ */ j("time", {
|
|
921
937
|
dateTime: i.updatedDateTimeUtc,
|
|
922
|
-
children:
|
|
938
|
+
children: J(i.updatedDateTimeUtc)
|
|
923
939
|
})
|
|
924
940
|
})
|
|
925
941
|
]
|
|
@@ -947,15 +963,15 @@ function we({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
947
963
|
className: "align-self-start",
|
|
948
964
|
children: "Reopen ticket"
|
|
949
965
|
}),
|
|
950
|
-
/* @__PURE__ */ j(
|
|
966
|
+
/* @__PURE__ */ j(Ce, {
|
|
951
967
|
satisfaction: i.satisfaction,
|
|
952
968
|
comment: i.satisfactionComment,
|
|
953
969
|
canRate: i.canRate,
|
|
954
970
|
commentMaxLength: r?.satisfactionCommentMaxLength,
|
|
955
971
|
onRate: (e) => v(() => p(e))
|
|
956
972
|
}),
|
|
957
|
-
/* @__PURE__ */ j(
|
|
958
|
-
/* @__PURE__ */ j(
|
|
973
|
+
/* @__PURE__ */ j(Se, { messages: i.messages ?? [] }),
|
|
974
|
+
/* @__PURE__ */ j(we, {
|
|
959
975
|
config: r,
|
|
960
976
|
reopens: x,
|
|
961
977
|
onSend: (e) => v(() => u(e))
|
|
@@ -966,22 +982,22 @@ function we({ ticketId: e, onBack: t, onChanged: n }) {
|
|
|
966
982
|
//#endregion
|
|
967
983
|
//#region src/lib/url.js
|
|
968
984
|
var Q = "ticket";
|
|
969
|
-
function
|
|
985
|
+
function Ee() {
|
|
970
986
|
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get(Q);
|
|
971
987
|
}
|
|
972
|
-
function
|
|
988
|
+
function De(e) {
|
|
973
989
|
if (typeof window > "u") return e ? `?${Q}=${encodeURIComponent(e)}` : "?";
|
|
974
990
|
let t = new URL(window.location.href);
|
|
975
991
|
return e ? t.searchParams.set(Q, e) : t.searchParams.delete(Q), `${t.pathname}${t.search}${t.hash}`;
|
|
976
992
|
}
|
|
977
|
-
function
|
|
993
|
+
function Oe(e) {
|
|
978
994
|
if (typeof window > "u") return;
|
|
979
|
-
let t =
|
|
995
|
+
let t = De(e);
|
|
980
996
|
t !== `${window.location.pathname}${window.location.search}${window.location.hash}` && window.history.replaceState(window.history.state, "", t);
|
|
981
997
|
}
|
|
982
998
|
//#endregion
|
|
983
999
|
//#region src/components/TicketList.jsx
|
|
984
|
-
var
|
|
1000
|
+
var ke = [
|
|
985
1001
|
{
|
|
986
1002
|
key: "all",
|
|
987
1003
|
label: "All",
|
|
@@ -1008,7 +1024,7 @@ var Oe = [
|
|
|
1008
1024
|
countKey: "closed"
|
|
1009
1025
|
}
|
|
1010
1026
|
];
|
|
1011
|
-
function
|
|
1027
|
+
function Ae({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a, onStatusChange: o, counts: s, search: l, onSearchChange: u, pagination: f }) {
|
|
1012
1028
|
return /* @__PURE__ */ M("div", {
|
|
1013
1029
|
className: "d-flex flex-column gap-3",
|
|
1014
1030
|
children: [
|
|
@@ -1028,7 +1044,7 @@ function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a
|
|
|
1028
1044
|
/* @__PURE__ */ M("div", {
|
|
1029
1045
|
className: "d-flex flex-column flex-md-row gap-2 align-items-md-center justify-content-between",
|
|
1030
1046
|
children: [/* @__PURE__ */ j(D, {
|
|
1031
|
-
tabs:
|
|
1047
|
+
tabs: ke.map(({ key: e, label: t, countKey: n }) => ({
|
|
1032
1048
|
key: e,
|
|
1033
1049
|
label: t,
|
|
1034
1050
|
count: s?.[n]
|
|
@@ -1053,7 +1069,7 @@ function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a
|
|
|
1053
1069
|
className: "d-flex flex-column",
|
|
1054
1070
|
style: { minWidth: 0 },
|
|
1055
1071
|
children: [/* @__PURE__ */ j(y, {
|
|
1056
|
-
href:
|
|
1072
|
+
href: De(e.id),
|
|
1057
1073
|
animation: "none",
|
|
1058
1074
|
className: "fw-semibold text-break",
|
|
1059
1075
|
onClick: (t) => {
|
|
@@ -1076,7 +1092,7 @@ function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a
|
|
|
1076
1092
|
label: "Status",
|
|
1077
1093
|
render: (e) => e.statusLabel ? /* @__PURE__ */ j(T, {
|
|
1078
1094
|
label: e.statusLabel,
|
|
1079
|
-
tone:
|
|
1095
|
+
tone: _e(e.status)
|
|
1080
1096
|
}) : "-"
|
|
1081
1097
|
},
|
|
1082
1098
|
{
|
|
@@ -1091,7 +1107,7 @@ function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a
|
|
|
1091
1107
|
cellClassName: "wui-text-sm text-body-secondary text-nowrap",
|
|
1092
1108
|
render: (e) => /* @__PURE__ */ j("time", {
|
|
1093
1109
|
dateTime: e.updatedDateTimeUtc,
|
|
1094
|
-
children:
|
|
1110
|
+
children: J(e.updatedDateTimeUtc)
|
|
1095
1111
|
})
|
|
1096
1112
|
}
|
|
1097
1113
|
],
|
|
@@ -1117,7 +1133,7 @@ function ke({ tickets: e, loading: t, error: n, onRetry: r, onOpen: i, status: a
|
|
|
1117
1133
|
}
|
|
1118
1134
|
//#endregion
|
|
1119
1135
|
//#region src/lib/useDebouncedValue.js
|
|
1120
|
-
function
|
|
1136
|
+
function je(e, t) {
|
|
1121
1137
|
let [n, i] = s(e);
|
|
1122
1138
|
return r(() => {
|
|
1123
1139
|
let n = setTimeout(() => i(e), t);
|
|
@@ -1126,20 +1142,20 @@ function Ae(e, t) {
|
|
|
1126
1142
|
}
|
|
1127
1143
|
//#endregion
|
|
1128
1144
|
//#region src/SupportCenter.jsx
|
|
1129
|
-
var
|
|
1130
|
-
function
|
|
1131
|
-
let { config: i, error: a, reload: o } =
|
|
1145
|
+
var Me = 300, Ne = 10;
|
|
1146
|
+
function Pe({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
1147
|
+
let { config: i, error: a, reload: o } = W(), [l, u] = s("all"), [f, p] = s(""), m = je(f.trim(), Me), [h, g] = s(Ne), _ = `${l}|${m}|${h}`, [v, y] = s({
|
|
1132
1148
|
key: _,
|
|
1133
1149
|
page: 1
|
|
1134
1150
|
}), b = v.key === _ ? v.page : 1, x = (e) => y({
|
|
1135
1151
|
key: _,
|
|
1136
1152
|
page: e
|
|
1137
|
-
}), S =
|
|
1153
|
+
}), S = G({
|
|
1138
1154
|
status: l === "all" ? void 0 : l,
|
|
1139
1155
|
search: m || void 0,
|
|
1140
1156
|
page: b,
|
|
1141
1157
|
pageSize: h
|
|
1142
|
-
}), { counts: C, reload: w } =
|
|
1158
|
+
}), { counts: C, reload: w } = K(), [T, E] = s(() => e || Ee()), [D, O] = s(!1), k = S.totalPages;
|
|
1143
1159
|
r(() => {
|
|
1144
1160
|
k > 0 && b > k && y({
|
|
1145
1161
|
key: _,
|
|
@@ -1153,9 +1169,9 @@ function Ne({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1153
1169
|
let A = () => {
|
|
1154
1170
|
S.reload(), w();
|
|
1155
1171
|
}, N = (e) => {
|
|
1156
|
-
E(e),
|
|
1172
|
+
E(e), Oe(e);
|
|
1157
1173
|
};
|
|
1158
|
-
if (T) return /* @__PURE__ */ j(
|
|
1174
|
+
if (T) return /* @__PURE__ */ j(Te, {
|
|
1159
1175
|
ticketId: T,
|
|
1160
1176
|
onBack: () => N(null),
|
|
1161
1177
|
onChanged: A
|
|
@@ -1198,7 +1214,7 @@ function Ne({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1198
1214
|
})
|
|
1199
1215
|
]
|
|
1200
1216
|
}),
|
|
1201
|
-
/* @__PURE__ */ j(
|
|
1217
|
+
/* @__PURE__ */ j(Ae, {
|
|
1202
1218
|
tickets: S.tickets,
|
|
1203
1219
|
loading: S.loading,
|
|
1204
1220
|
error: S.error,
|
|
@@ -1211,7 +1227,7 @@ function Ne({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1211
1227
|
onSearchChange: p,
|
|
1212
1228
|
pagination: P
|
|
1213
1229
|
}),
|
|
1214
|
-
i && /* @__PURE__ */ j(
|
|
1230
|
+
i && /* @__PURE__ */ j(he, {
|
|
1215
1231
|
open: D,
|
|
1216
1232
|
onClose: () => O(!1),
|
|
1217
1233
|
config: i,
|
|
@@ -1227,8 +1243,8 @@ function Ne({ initialTicketId: e, defaultCategory: t, appVersion: n }) {
|
|
|
1227
1243
|
//#endregion
|
|
1228
1244
|
//#region src/SupportContact.jsx
|
|
1229
1245
|
var $ = (e) => typeof e == "string" && e.trim() !== "";
|
|
1230
|
-
function
|
|
1231
|
-
let { config: t } =
|
|
1246
|
+
function Fe({ className: e }) {
|
|
1247
|
+
let { config: t } = W();
|
|
1232
1248
|
if (!t) return null;
|
|
1233
1249
|
let n = [];
|
|
1234
1250
|
return $(t.supportEmail) && n.push({
|
|
@@ -1270,7 +1286,7 @@ function Pe({ className: e }) {
|
|
|
1270
1286
|
}
|
|
1271
1287
|
//#endregion
|
|
1272
1288
|
//#region src/SupportProvider.jsx
|
|
1273
|
-
function
|
|
1289
|
+
function Ie({ client: e, children: n }) {
|
|
1274
1290
|
let r = o(null), i = t((t = !1) => {
|
|
1275
1291
|
let n = r.current;
|
|
1276
1292
|
if (t || !n || n.client !== e) {
|
|
@@ -1287,10 +1303,10 @@ function Fe({ client: e, children: n }) {
|
|
|
1287
1303
|
client: e,
|
|
1288
1304
|
loadConfig: i
|
|
1289
1305
|
}), [e, i]);
|
|
1290
|
-
return /* @__PURE__ */ j(
|
|
1306
|
+
return /* @__PURE__ */ j(B.Provider, {
|
|
1291
1307
|
value: s,
|
|
1292
1308
|
children: n
|
|
1293
1309
|
});
|
|
1294
1310
|
}
|
|
1295
1311
|
//#endregion
|
|
1296
|
-
export {
|
|
1312
|
+
export { me as ReportIssue, P as SupportApiError, Pe as SupportCenter, Fe as SupportContact, Ie as SupportProvider, ee as createSupportClient, H as useSupportClient, W as useSupportConfig, q as useSupportTicket, K as useSupportTicketCounts, G as useSupportTickets };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A timestamp in the viewer's own time zone
|
|
3
|
-
* it is. Returns a plain hyphen for a missing or unreadable value.
|
|
2
|
+
* A timestamp in the viewer's own time zone as "21 Sep 2026, 3:30 pm IST", with the zone named
|
|
3
|
+
* so the reader knows which clock it is. Returns a plain hyphen for a missing or unreadable value.
|
|
4
4
|
*
|
|
5
5
|
* @param {string|null|undefined} iso
|
|
6
6
|
* @returns {string}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/support-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Webority customer support for React portals: ticket centre, report-an-issue with a page screenshot, and support contact details, built on @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react": "^19.0.0",
|
|
33
33
|
"react-bootstrap": "^2.10.0",
|
|
34
34
|
"react-dom": "^19.0.0",
|
|
35
|
-
"@webority/ui-react": "0.
|
|
35
|
+
"@webority/ui-react": "0.20.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@testing-library/dom": "10.4.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"typescript": "^7.0.2",
|
|
51
51
|
"vite": "^8.0.12",
|
|
52
52
|
"vitest": "5.0.1",
|
|
53
|
-
"@webority/ui-react": "0.
|
|
53
|
+
"@webority/ui-react": "0.20.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"html-to-image": "^1.11.13"
|