@buerokratt-ria/common-gui-components 0.0.24 → 0.0.25
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 +5 -0
- package/buerokratt-ria-common-gui-components-0.0.25.tgz +0 -0
- package/package.json +1 -1
- package/templates/history-page/src/History.scss +34 -0
- package/templates/history-page/src/index.tsx +74 -13
- package/ui-components/FormElements/FormCheckbox/FormCheckbox.scss +16 -1
- package/ui-components/FormElements/FormCheckbox/index.tsx +8 -2
- package/utils/multiDomain-utils.ts +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ 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.25] - 01-09-2025
|
|
8
|
+
|
|
9
|
+
- Added test column to display chats mark for test
|
|
10
|
+
- FIX: refetch based on updated domains
|
|
11
|
+
|
|
7
12
|
## [0.0.24] - 14-08-2025
|
|
8
13
|
|
|
9
14
|
- Modified Start and End dates to send them in payload in iso format
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import 'src/styles/tools/spacing';
|
|
2
2
|
@import 'src/styles/tools/color';
|
|
3
|
+
@import 'src/styles/settings/variables/other';
|
|
3
4
|
@import 'src/styles/settings/variables/typography';
|
|
4
5
|
|
|
5
6
|
.input-wrapper {
|
|
@@ -13,6 +14,39 @@
|
|
|
13
14
|
box-sizing: border-box;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
.checkbox-test {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
|
|
22
|
+
&__item {
|
|
23
|
+
input[type=checkbox] {
|
|
24
|
+
&::before {
|
|
25
|
+
content: '';
|
|
26
|
+
display: block;
|
|
27
|
+
width: 16px;
|
|
28
|
+
height: 16px;
|
|
29
|
+
box-shadow: inset 0 0 0 1px get-color(black-coral-2);
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: 4px;
|
|
33
|
+
top: 4px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:checked {
|
|
38
|
+
&::before {
|
|
39
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTEiIHZpZXdCb3g9IjAgMCAxNCAxMSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuNzQ5NzkgOC4xMjkwNkwxLjYyMjI5IDUuMDAxNTZMMC41NjEwMzUgNi4wNjI4MUw0Ljc0OTc5IDEwLjI1MTZMMTMuNzQ5OCAxLjI1MTU2TDEyLjY4ODUgMC4xOTAzMDhMNC43NDk3OSA4LjEyOTA2WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==');
|
|
40
|
+
background-color: get-color(sapphire-blue-10);
|
|
41
|
+
background-repeat: no-repeat;
|
|
42
|
+
background-position: center;
|
|
43
|
+
background-size: 13px 10px;
|
|
44
|
+
box-shadow: inset 0 0 0 1px get-color(sapphire-blue-10);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
16
50
|
.card-wrapper {
|
|
17
51
|
flex: 1;
|
|
18
52
|
overflow: auto;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {FC, PropsWithChildren, useEffect,
|
|
1
|
+
import React, {FC, PropsWithChildren, useEffect, useMemo, useRef, useState} from 'react';
|
|
2
2
|
import {useTranslation} from 'react-i18next';
|
|
3
3
|
import {useMutation} from '@tanstack/react-query';
|
|
4
4
|
import {ColumnPinningState, createColumnHelper, PaginationState, SortingState,} from '@tanstack/react-table';
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
DataTable,
|
|
14
14
|
Dialog,
|
|
15
15
|
Drawer,
|
|
16
|
+
FormCheckbox,
|
|
16
17
|
FormDatepicker,
|
|
17
18
|
FormInput,
|
|
18
19
|
FormMultiselect,
|
|
@@ -109,6 +110,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
109
110
|
const [updateKey, setUpdateKey] = useState<number>(0)
|
|
110
111
|
const currentDomains = useStore.getState().userDomains;
|
|
111
112
|
const multiDomainEnabled = import.meta.env.REACT_APP_ENABLE_MULTI_DOMAIN?.toLowerCase() === 'true';
|
|
113
|
+
const testMessageEnabled = import.meta.env.REACT_APP_SHOW_TEST_MESSAGE?.toLowerCase() === 'true';
|
|
112
114
|
|
|
113
115
|
const parseDateParam = (dateString: string | null) => {
|
|
114
116
|
if (!dateString) return new Date();
|
|
@@ -143,9 +145,9 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
143
145
|
});
|
|
144
146
|
}, 500);
|
|
145
147
|
|
|
146
|
-
if(multiDomainEnabled) {
|
|
148
|
+
if (multiDomainEnabled) {
|
|
147
149
|
useStore.subscribe((state, prevState) => {
|
|
148
|
-
if(JSON.stringify(state.userDomains) !== JSON.stringify(prevState.userDomains)) {
|
|
150
|
+
if (JSON.stringify(state.userDomains) !== JSON.stringify(prevState.userDomains)) {
|
|
149
151
|
setUpdateKey(prevState => prevState + 1);
|
|
150
152
|
}
|
|
151
153
|
});
|
|
@@ -170,7 +172,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
170
172
|
setValue('endDate', unifyDateFromat(delegatedEndDate));
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
if(initialLoad) {
|
|
175
|
+
if (initialLoad) {
|
|
174
176
|
fetchData()
|
|
175
177
|
} else {
|
|
176
178
|
getAllEndedChats.mutate({
|
|
@@ -248,7 +250,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
248
250
|
search,
|
|
249
251
|
});
|
|
250
252
|
}
|
|
251
|
-
}, [selectedColumns]);
|
|
253
|
+
}, [selectedColumns, currentDomains]);
|
|
252
254
|
|
|
253
255
|
useEffect(() => {
|
|
254
256
|
listCustomerSupportAgents.mutate();
|
|
@@ -356,11 +358,15 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
356
358
|
];
|
|
357
359
|
|
|
358
360
|
if (showEmail) {
|
|
359
|
-
columns.splice(4, 0, {label: t('global.email'), value: 'endUserEmail'});
|
|
361
|
+
columns.splice(4, 0, {label: t('global.email'), value: 'endUserEmail'});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (testMessageEnabled) {
|
|
365
|
+
columns.splice(5, 0, {label: t('global.test'), value: 'istest'});
|
|
360
366
|
}
|
|
361
367
|
|
|
362
368
|
return columns;
|
|
363
|
-
}, [t, showEmail])
|
|
369
|
+
}, [t, showEmail, testMessageEnabled])
|
|
364
370
|
|
|
365
371
|
const chatStatusChangeMutation = useMutation({
|
|
366
372
|
mutationFn: async (data: { chatId: string | number; event: string }) => {
|
|
@@ -451,6 +457,31 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
451
457
|
},
|
|
452
458
|
});
|
|
453
459
|
|
|
460
|
+
const chatTestChangeMutation = useMutation({
|
|
461
|
+
mutationFn: (data: {
|
|
462
|
+
chatId: string | number;
|
|
463
|
+
isTest: boolean;
|
|
464
|
+
}) => apiDev.post('chats/mark-test', data),
|
|
465
|
+
onSuccess: (res, {chatId, isTest}) => {
|
|
466
|
+
const updatedChatList = filteredEndedChatsList.map((chat) =>
|
|
467
|
+
chat.id === chatId ? {...chat, isTest} : chat
|
|
468
|
+
);
|
|
469
|
+
filterChatsList(updatedChatList);
|
|
470
|
+
toast?.open({
|
|
471
|
+
type: 'success',
|
|
472
|
+
title: t('global.notification'),
|
|
473
|
+
message: t('toast.success.updateSuccess'),
|
|
474
|
+
});
|
|
475
|
+
},
|
|
476
|
+
onError: (error: AxiosError) => {
|
|
477
|
+
toast?.open({
|
|
478
|
+
type: 'error',
|
|
479
|
+
title: t('global.notificationError'),
|
|
480
|
+
message: error.message,
|
|
481
|
+
});
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
|
|
454
485
|
const columnHelper = createColumnHelper<ChatType>();
|
|
455
486
|
|
|
456
487
|
const copyValueToClipboard = async (value: string) => {
|
|
@@ -520,6 +551,26 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
520
551
|
</Tooltip>
|
|
521
552
|
);
|
|
522
553
|
|
|
554
|
+
const markConversationAsTest = (props: any) => {
|
|
555
|
+
return <>
|
|
556
|
+
<FormCheckbox
|
|
557
|
+
label={''}
|
|
558
|
+
hideLabel
|
|
559
|
+
emptyItem={true}
|
|
560
|
+
name="active"
|
|
561
|
+
|
|
562
|
+
item={{
|
|
563
|
+
label: '',
|
|
564
|
+
value: 'active',
|
|
565
|
+
checked: props.getValue()
|
|
566
|
+
}}
|
|
567
|
+
onChange={(e) => {
|
|
568
|
+
return chatTestChangeMutation.mutate({chatId: props.row.original.id, isTest: e.target.checked})
|
|
569
|
+
}}
|
|
570
|
+
/>
|
|
571
|
+
</>
|
|
572
|
+
}
|
|
573
|
+
|
|
523
574
|
const detailsView = (props: any) => (
|
|
524
575
|
<Button
|
|
525
576
|
appearance="text"
|
|
@@ -574,8 +625,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
574
625
|
}
|
|
575
626
|
},
|
|
576
627
|
{
|
|
577
|
-
|
|
578
|
-
|
|
628
|
+
id: `customerSupportFullName`,
|
|
629
|
+
header: t('chat.history.csaName') ?? '',
|
|
579
630
|
}
|
|
580
631
|
),
|
|
581
632
|
columnHelper.accessor(
|
|
@@ -660,11 +711,19 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
660
711
|
}));
|
|
661
712
|
}
|
|
662
713
|
|
|
714
|
+
if (testMessageEnabled) {
|
|
715
|
+
columns.splice(4, 0, columnHelper.accessor('istest', {
|
|
716
|
+
id: 'istest',
|
|
717
|
+
header: t('global.test') ?? '',
|
|
718
|
+
cell: markConversationAsTest
|
|
719
|
+
}));
|
|
720
|
+
}
|
|
721
|
+
|
|
663
722
|
return columns;
|
|
664
|
-
}, [t, showEmail])
|
|
723
|
+
}, [t, showEmail, testMessageEnabled])
|
|
665
724
|
|
|
666
725
|
const getSortingString = () => {
|
|
667
|
-
if(sorting && sorting.length > 0) {
|
|
726
|
+
if (sorting && sorting.length > 0) {
|
|
668
727
|
const sortingObject = sorting[0];
|
|
669
728
|
const sortingString = t('sorting.sorting');
|
|
670
729
|
const orderingString = t(`sorting.${sortingObject.desc ? 'desc' : 'asc'}`);
|
|
@@ -675,7 +734,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
675
734
|
}
|
|
676
735
|
}
|
|
677
736
|
|
|
678
|
-
const getColumnTranslation = (column: string)
|
|
737
|
+
const getColumnTranslation = (column: string): string => {
|
|
679
738
|
switch (column) {
|
|
680
739
|
case 'endUserId':
|
|
681
740
|
return t('global.idCode') ?? ''
|
|
@@ -703,6 +762,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
703
762
|
return 'www'
|
|
704
763
|
case 'id':
|
|
705
764
|
return 'id';
|
|
765
|
+
case 'istest':
|
|
766
|
+
return t('global.test') ?? ''
|
|
706
767
|
default:
|
|
707
768
|
return '';
|
|
708
769
|
}
|
|
@@ -902,7 +963,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
902
963
|
</Button>
|
|
903
964
|
</div>)
|
|
904
965
|
}
|
|
905
|
-
<div className="card-drawer-container" style={{
|
|
966
|
+
<div className="card-drawer-container" style={{height: '100%', overflow: 'auto'}}>
|
|
906
967
|
<div className="card-wrapper">
|
|
907
968
|
<Card>
|
|
908
969
|
<DataTable
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
&__item {
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
20
22
|
input[type=checkbox] {
|
|
21
23
|
display: none;
|
|
22
24
|
|
|
@@ -53,5 +55,18 @@
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
&--nolabel {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
width: 100%;
|
|
64
|
+
|
|
65
|
+
&::before {
|
|
66
|
+
position: static !important;
|
|
67
|
+
transform: none !important;
|
|
68
|
+
margin: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
56
71
|
}
|
|
57
|
-
}
|
|
72
|
+
}
|
|
@@ -6,6 +6,7 @@ type FormCheckboxType = InputHTMLAttributes<HTMLInputElement> & {
|
|
|
6
6
|
label: string;
|
|
7
7
|
name: string;
|
|
8
8
|
hideLabel?: boolean;
|
|
9
|
+
emptyItem?: boolean;
|
|
9
10
|
item: {
|
|
10
11
|
label: string;
|
|
11
12
|
value: string;
|
|
@@ -18,6 +19,7 @@ const FormCheckbox = forwardRef<HTMLInputElement, FormCheckboxType>((
|
|
|
18
19
|
label,
|
|
19
20
|
name,
|
|
20
21
|
hideLabel,
|
|
22
|
+
emptyItem,
|
|
21
23
|
item,
|
|
22
24
|
...rest
|
|
23
25
|
},
|
|
@@ -28,9 +30,13 @@ const FormCheckbox = forwardRef<HTMLInputElement, FormCheckboxType>((
|
|
|
28
30
|
return (
|
|
29
31
|
<div className='checkbox'>
|
|
30
32
|
{label && !hideLabel && <label className='checkbox__label'>{label}</label>}
|
|
31
|
-
<div className=
|
|
33
|
+
<div className={`checkbox__item ${!emptyItem ? "checkbox__item--nolabel" : ""}`}>
|
|
32
34
|
<input ref={ref} type='checkbox' name={name} id={uid} value={item.value} defaultChecked={item.checked} {...rest} />
|
|
33
|
-
|
|
35
|
+
{emptyItem ? (
|
|
36
|
+
<label htmlFor={uid} className="checkbox__item--nolabel" />
|
|
37
|
+
) : (
|
|
38
|
+
<label htmlFor={uid}>{item.label}</label>
|
|
39
|
+
)}
|
|
34
40
|
</div>
|
|
35
41
|
</div>
|
|
36
42
|
);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import useStore from "../store";
|
|
2
|
-
|
|
3
1
|
export const getDomainsArray = (currentDomains) => {
|
|
4
|
-
const multiDomainEnabled = import.meta.env.REACT_APP_ENABLE_MULTI_DOMAIN
|
|
2
|
+
const multiDomainEnabled = import.meta.env.REACT_APP_ENABLE_MULTI_DOMAIN?.toLowerCase() === 'true';
|
|
5
3
|
const userDomains = currentDomains || [];
|
|
6
4
|
|
|
7
5
|
return multiDomainEnabled ? (userDomains?.length > 0 ? userDomains : [null]) : [];
|