@buerokratt-ria/common-gui-components 0.0.23 → 0.0.24
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,6 +4,10 @@ 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.24] - 14-08-2025
|
|
8
|
+
|
|
9
|
+
- Modified Start and End dates to send them in payload in iso format
|
|
10
|
+
|
|
7
11
|
## [0.0.23] - 21-07-2025
|
|
8
12
|
|
|
9
13
|
- Initial support of multidomains
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React, {FC, PropsWithChildren, useEffect, useRef, useMemo, useState} from
|
|
|
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';
|
|
5
|
-
import {format} from
|
|
5
|
+
import { format, startOfDay, endOfDay, formatISO } from "date-fns";
|
|
6
6
|
import {AxiosError} from 'axios';
|
|
7
7
|
import './History.scss';
|
|
8
8
|
import {MdOutlineRemoveRedEye} from 'react-icons/md';
|
|
@@ -72,8 +72,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
72
72
|
const routerLocation = useLocation();
|
|
73
73
|
const params = new URLSearchParams(routerLocation.search);
|
|
74
74
|
let passedChatId = new URLSearchParams(routerLocation.search).get('chat');
|
|
75
|
-
const passedStartDate = delegatedStartDate ?? params.get(
|
|
76
|
-
const passedEndDate =
|
|
75
|
+
const passedStartDate = delegatedStartDate ?? params.get("start");
|
|
76
|
+
const passedEndDate = delegatedEndDate ?? params.get("end");
|
|
77
77
|
const skipNextSelectedColumnsEffect = useRef(false);
|
|
78
78
|
const passedCustomerSupportIds = params.getAll('customerSupportIds');
|
|
79
79
|
const [search, setSearch] = useState('');
|
|
@@ -108,7 +108,12 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
108
108
|
const useStore = userDomains;
|
|
109
109
|
const [updateKey, setUpdateKey] = useState<number>(0)
|
|
110
110
|
const currentDomains = useStore.getState().userDomains;
|
|
111
|
-
const multiDomainEnabled = import.meta.env.REACT_APP_ENABLE_MULTI_DOMAIN
|
|
111
|
+
const multiDomainEnabled = import.meta.env.REACT_APP_ENABLE_MULTI_DOMAIN?.toLowerCase() === 'true';
|
|
112
|
+
|
|
113
|
+
const parseDateParam = (dateString: string | null) => {
|
|
114
|
+
if (!dateString) return new Date();
|
|
115
|
+
return new Date(dateString.split("+")[0]);
|
|
116
|
+
};
|
|
112
117
|
|
|
113
118
|
const {control, setValue, watch} = useForm<{
|
|
114
119
|
startDate: Date | string;
|
|
@@ -116,19 +121,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
116
121
|
}>({
|
|
117
122
|
defaultValues: {
|
|
118
123
|
startDate: passedStartDate
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
endDate: passedEndDate
|
|
126
|
-
? unifyDateFromat(passedEndDate)
|
|
127
|
-
: new Date(
|
|
128
|
-
new Date().getUTCFullYear(),
|
|
129
|
-
new Date().getUTCMonth(),
|
|
130
|
-
new Date().getUTCDate()
|
|
131
|
-
),
|
|
124
|
+
? parseDateParam(passedStartDate)
|
|
125
|
+
: new Date(new Date().setUTCHours(0, 0, 0, 0)),
|
|
126
|
+
endDate: passedEndDate
|
|
127
|
+
? parseDateParam(passedEndDate)
|
|
128
|
+
: new Date(new Date().setUTCHours(23, 59, 59, 999)),
|
|
132
129
|
},
|
|
133
130
|
});
|
|
134
131
|
|
|
@@ -137,8 +134,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
137
134
|
|
|
138
135
|
const debouncedGetAllEnded = useDebouncedCallback((search) => {
|
|
139
136
|
getAllEndedChats.mutate({
|
|
140
|
-
startDate:
|
|
141
|
-
endDate:
|
|
137
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
138
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
142
139
|
customerSupportIds: passedCustomerSupportIds,
|
|
143
140
|
pagination,
|
|
144
141
|
sorting,
|
|
@@ -177,8 +174,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
177
174
|
fetchData()
|
|
178
175
|
} else {
|
|
179
176
|
getAllEndedChats.mutate({
|
|
180
|
-
startDate: hasStart ? unifyDateFromat(delegatedStartDate) :
|
|
181
|
-
endDate: hasEnd ? unifyDateFromat(delegatedEndDate) :
|
|
177
|
+
startDate: hasStart ? unifyDateFromat(delegatedStartDate) : formatISO(startOfDay(new Date(startDate))),
|
|
178
|
+
endDate: hasEnd ? unifyDateFromat(delegatedEndDate) : formatISO(endOfDay(new Date(endDate))),
|
|
182
179
|
customerSupportIds: passedCustomerSupportIds,
|
|
183
180
|
pagination,
|
|
184
181
|
sorting,
|
|
@@ -214,8 +211,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
214
211
|
setCounterKey(prev => prev + 1);
|
|
215
212
|
|
|
216
213
|
getAllEndedChats.mutate({
|
|
217
|
-
startDate:
|
|
218
|
-
endDate:
|
|
214
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
215
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
219
216
|
customerSupportIds: passedCustomerSupportIds,
|
|
220
217
|
pagination: updatedPagination,
|
|
221
218
|
sorting,
|
|
@@ -243,8 +240,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
243
240
|
skipNextSelectedColumnsEffect.current = false;
|
|
244
241
|
} else {
|
|
245
242
|
getAllEndedChats.mutate({
|
|
246
|
-
startDate:
|
|
247
|
-
endDate:
|
|
243
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
244
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
248
245
|
customerSupportIds: passedCustomerSupportIds,
|
|
249
246
|
pagination,
|
|
250
247
|
sorting,
|
|
@@ -288,8 +285,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
288
285
|
|
|
289
286
|
return apiDev.post('agents/chats/ended', {
|
|
290
287
|
customerSupportIds: data.customerSupportIds,
|
|
291
|
-
startDate:
|
|
292
|
-
endDate:
|
|
288
|
+
startDate: formatISO(startOfDay(new Date(data.startDate))),
|
|
289
|
+
endDate: formatISO(endOfDay(new Date(data.endDate))),
|
|
293
290
|
urls: getDomainsArray(currentDomains),
|
|
294
291
|
page: data.pagination.pageIndex + 1,
|
|
295
292
|
page_size: data.pagination.pageSize,
|
|
@@ -397,8 +394,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
397
394
|
onSuccess: () => {
|
|
398
395
|
setMessagesTrigger(!messagesTrigger);
|
|
399
396
|
getAllEndedChats.mutate({
|
|
400
|
-
startDate:
|
|
401
|
-
endDate:
|
|
397
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
398
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
402
399
|
customerSupportIds: passedCustomerSupportIds,
|
|
403
400
|
pagination,
|
|
404
401
|
sorting,
|
|
@@ -793,14 +790,14 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
793
790
|
value={field.value ?? new Date()}
|
|
794
791
|
onChange={(v) => {
|
|
795
792
|
field.onChange(v);
|
|
796
|
-
const start =
|
|
793
|
+
const start = formatISO(startOfDay(new Date(v)));
|
|
797
794
|
setSearchParams((params) => {
|
|
798
795
|
params.set('start', start);
|
|
799
796
|
return params;
|
|
800
797
|
});
|
|
801
798
|
getAllEndedChats.mutate({
|
|
802
799
|
startDate: start,
|
|
803
|
-
endDate:
|
|
800
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
804
801
|
customerSupportIds: passedCustomerSupportIds,
|
|
805
802
|
pagination,
|
|
806
803
|
sorting,
|
|
@@ -825,13 +822,13 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
825
822
|
value={field.value ?? new Date()}
|
|
826
823
|
onChange={(v) => {
|
|
827
824
|
field.onChange(v);
|
|
828
|
-
const end =
|
|
825
|
+
const end = formatISO(endOfDay(new Date(v)));
|
|
829
826
|
setSearchParams((params) => {
|
|
830
827
|
params.set('end', end);
|
|
831
828
|
return params;
|
|
832
829
|
});
|
|
833
830
|
getAllEndedChats.mutate({
|
|
834
|
-
startDate:
|
|
831
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
835
832
|
endDate: end,
|
|
836
833
|
customerSupportIds: passedCustomerSupportIds,
|
|
837
834
|
pagination,
|
|
@@ -928,8 +925,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
928
925
|
selected_columns: selectedColumns
|
|
929
926
|
});
|
|
930
927
|
getAllEndedChats.mutate({
|
|
931
|
-
startDate:
|
|
932
|
-
endDate:
|
|
928
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
929
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
933
930
|
customerSupportIds: passedCustomerSupportIds,
|
|
934
931
|
pagination: state,
|
|
935
932
|
sorting,
|
|
@@ -939,8 +936,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
939
936
|
setSorting={(state: SortingState) => {
|
|
940
937
|
setSorting(state);
|
|
941
938
|
getAllEndedChats.mutate({
|
|
942
|
-
startDate:
|
|
943
|
-
endDate:
|
|
939
|
+
startDate: formatISO(startOfDay(new Date(startDate))),
|
|
940
|
+
endDate: formatISO(endOfDay(new Date(endDate))),
|
|
944
941
|
customerSupportIds: passedCustomerSupportIds,
|
|
945
942
|
pagination,
|
|
946
943
|
sorting: state,
|
|
Binary file
|