@buerokratt-ria/common-gui-components 0.0.16 → 0.0.17
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/CHANGELOG.md
CHANGED
|
@@ -4,18 +4,19 @@ All changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
|
|
6
6
|
|
|
7
|
-
## [0.0.
|
|
8
|
-
|
|
9
|
-
- Updating CSA display and filtering.
|
|
10
|
-
|
|
11
|
-
## [0.0.15] - 09-05-2025
|
|
7
|
+
## [0.0.17] - 13-05-2025
|
|
12
8
|
|
|
13
9
|
- Display feedback rating consistently in history page.
|
|
14
10
|
|
|
15
|
-
## [0.0.
|
|
11
|
+
## [0.0.15] - 05-05-2025
|
|
16
12
|
|
|
17
13
|
- Updated popup duration to be 5 seconds.
|
|
18
14
|
|
|
15
|
+
## [0.0.14] - 30-04-2025
|
|
16
|
+
|
|
17
|
+
- Added sorting configurable (disabled by default)
|
|
18
|
+
- Added Email display configurable (disabled by default)
|
|
19
|
+
|
|
19
20
|
## [0.0.13] - 25-04-2025
|
|
20
21
|
|
|
21
22
|
- Adding double scrollbar to history page when size is small.
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -37,10 +37,12 @@ type HistoryProps = {
|
|
|
37
37
|
toastContext: ToastContextType | null;
|
|
38
38
|
onMessageClick?: (message: any) => void;
|
|
39
39
|
showComment?: boolean;
|
|
40
|
+
showEmail?: boolean;
|
|
41
|
+
showSortingLabel?: boolean;
|
|
40
42
|
showStatus?: boolean;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, onMessageClick, showComment = true, showStatus = true}) => {
|
|
45
|
+
const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, onMessageClick, showComment = true, showEmail = false, showSortingLabel = false,showStatus = true}) => {
|
|
44
46
|
const {t, i18n} = useTranslation();
|
|
45
47
|
const toast = toastContext;
|
|
46
48
|
const userInfo = user;
|
|
@@ -269,8 +271,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
269
271
|
},
|
|
270
272
|
});
|
|
271
273
|
|
|
272
|
-
const visibleColumnOptions = useMemo(
|
|
273
|
-
|
|
274
|
+
const visibleColumnOptions = useMemo(() => {
|
|
275
|
+
const columns = [
|
|
274
276
|
{label: t('chat.history.startTime'), value: 'created'},
|
|
275
277
|
{label: t('chat.history.endTime'), value: 'ended'},
|
|
276
278
|
{label: t('chat.history.csaName'), value: 'customerSupportFullName'},
|
|
@@ -283,9 +285,14 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
283
285
|
{label: t('global.status'), value: 'status'},
|
|
284
286
|
{label: 'ID', value: 'id'},
|
|
285
287
|
{label: 'www', value: 'www'},
|
|
286
|
-
]
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
];
|
|
289
|
+
|
|
290
|
+
if (showEmail) {
|
|
291
|
+
columns.splice(4, 0, {label: t('global.email'), value: 'endUserEmail'}); // insert after name
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return columns;
|
|
295
|
+
}, [t, showEmail])
|
|
289
296
|
|
|
290
297
|
const chatStatusChangeMutation = useMutation({
|
|
291
298
|
mutationFn: async (data: { chatId: string | number; event: string }) => {
|
|
@@ -458,8 +465,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
458
465
|
</Button>
|
|
459
466
|
);
|
|
460
467
|
|
|
461
|
-
const endedChatsColumns = useMemo(
|
|
462
|
-
|
|
468
|
+
const endedChatsColumns = useMemo(() => {
|
|
469
|
+
const columns = [
|
|
463
470
|
columnHelper.accessor('created', {
|
|
464
471
|
id: 'created',
|
|
465
472
|
header: t('chat.history.startTime') ?? '',
|
|
@@ -527,8 +534,10 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
527
534
|
columnHelper.accessor('feedbackRating', {
|
|
528
535
|
id: 'feedbackRating',
|
|
529
536
|
header: t('chat.history.rating') ?? '',
|
|
530
|
-
cell: (props) =>
|
|
531
|
-
|
|
537
|
+
cell: (props) => {
|
|
538
|
+
const value = props.getValue();
|
|
539
|
+
return value !== null && value !== undefined ? <span>{`${value}/10`}</span> : null;
|
|
540
|
+
}
|
|
532
541
|
}),
|
|
533
542
|
columnHelper.accessor('feedbackText', {
|
|
534
543
|
id: 'feedbackText',
|
|
@@ -574,9 +583,62 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
574
583
|
sticky: 'right',
|
|
575
584
|
},
|
|
576
585
|
}),
|
|
577
|
-
]
|
|
578
|
-
|
|
579
|
-
|
|
586
|
+
];
|
|
587
|
+
|
|
588
|
+
if (showEmail) {
|
|
589
|
+
columns.splice(4, 0, columnHelper.accessor('endUserEmail', {
|
|
590
|
+
id: 'endUserEmail',
|
|
591
|
+
header: t('global.email') ?? '',
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return columns;
|
|
596
|
+
}, [t, showEmail])
|
|
597
|
+
|
|
598
|
+
const getSortingString = () => {
|
|
599
|
+
if(sorting && sorting.length > 0) {
|
|
600
|
+
const sortingObject = sorting[0];
|
|
601
|
+
const sortingString = t('sorting.sorting');
|
|
602
|
+
const orderingString = t(`sorting.${sortingObject.desc ? 'desc' : 'asc'}`);
|
|
603
|
+
const column = getColumnTranslation(sortingObject.id);
|
|
604
|
+
return sortingString + ' ' + column + ' ' + orderingString;
|
|
605
|
+
} else {
|
|
606
|
+
return '';
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const getColumnTranslation = (column: string) : string => {
|
|
611
|
+
switch (column) {
|
|
612
|
+
case 'endUserId':
|
|
613
|
+
return t('global.idCode') ?? ''
|
|
614
|
+
case 'created':
|
|
615
|
+
return t('chat.history.startTime') ?? ''
|
|
616
|
+
case 'ended':
|
|
617
|
+
return t('chat.history.endTime') ?? ''
|
|
618
|
+
case 'customerSupportFullName':
|
|
619
|
+
return t('chat.history.csaName') ?? ''
|
|
620
|
+
case 'endUserName':
|
|
621
|
+
return t('global.name') ?? ''
|
|
622
|
+
case 'endUserEmail':
|
|
623
|
+
return t('global.email') ?? ''
|
|
624
|
+
case 'contactsMessage':
|
|
625
|
+
return t('chat.history.contact') ?? ''
|
|
626
|
+
case 'comment':
|
|
627
|
+
return t('chat.history.comment') ?? ''
|
|
628
|
+
case 'feedbackRating':
|
|
629
|
+
return t('chat.history.rating') ?? ''
|
|
630
|
+
case 'feedbackText':
|
|
631
|
+
return t('chat.history.feedback') ?? ''
|
|
632
|
+
case 'status':
|
|
633
|
+
return t('global.status') ?? ''
|
|
634
|
+
case 'endUserUrl':
|
|
635
|
+
return 'www'
|
|
636
|
+
case 'id':
|
|
637
|
+
return 'id';
|
|
638
|
+
default:
|
|
639
|
+
return '';
|
|
640
|
+
}
|
|
641
|
+
}
|
|
580
642
|
|
|
581
643
|
const handleChatStatusChange = (event: string) => {
|
|
582
644
|
if (!selectedChat) return;
|
|
@@ -757,6 +819,13 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({user, toastContext, o
|
|
|
757
819
|
</Track>
|
|
758
820
|
</Card>
|
|
759
821
|
|
|
822
|
+
{sorting && sorting.length > 0 && showSortingLabel && (
|
|
823
|
+
<div>
|
|
824
|
+
<Button disabled={true} appearance="secondary">
|
|
825
|
+
{getSortingString()}
|
|
826
|
+
</Button>
|
|
827
|
+
</div>)
|
|
828
|
+
}
|
|
760
829
|
<div className="card-drawer-container" style={{ height: 'auto', overflow: 'auto' }}>
|
|
761
830
|
<div className="card-wrapper">
|
|
762
831
|
<Card>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"global": {
|
|
3
|
+
"email": "Email",
|
|
3
4
|
"save": "Save",
|
|
4
5
|
"add": "Add",
|
|
5
6
|
"edit": "Edit",
|
|
@@ -46,6 +47,11 @@
|
|
|
46
47
|
"chosen": "Chosen",
|
|
47
48
|
"read": "Read"
|
|
48
49
|
},
|
|
50
|
+
"sorting": {
|
|
51
|
+
"des": "descending",
|
|
52
|
+
"asc": "ascending",
|
|
53
|
+
"sorting": "Sorting"
|
|
54
|
+
},
|
|
49
55
|
"mainMenu": {
|
|
50
56
|
"menuLabel": "Main navigation",
|
|
51
57
|
"closeMenu": "Close menu",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"global": {
|
|
3
|
+
"email": "Email",
|
|
3
4
|
"save": "Salvesta",
|
|
4
5
|
"add": "Lisa",
|
|
5
6
|
"edit": "Muuda",
|
|
@@ -46,6 +47,11 @@
|
|
|
46
47
|
"chosen": "Valitud",
|
|
47
48
|
"read": "Loetud"
|
|
48
49
|
},
|
|
50
|
+
"sorting": {
|
|
51
|
+
"des": "kahanevalt",
|
|
52
|
+
"asc": "Kasvavalt",
|
|
53
|
+
"sorting": "Sorteerimine"
|
|
54
|
+
},
|
|
49
55
|
"mainMenu": {
|
|
50
56
|
"menuLabel": "Põhinavigatsioon",
|
|
51
57
|
"closeMenu": "Kitsenda menüü",
|