impact-chatbot 2.3.17 → 2.3.18
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/index.esm.js
CHANGED
|
@@ -23,7 +23,7 @@ import RefreshIcon from '@mui/icons-material/Refresh';
|
|
|
23
23
|
import styled from 'styled-components';
|
|
24
24
|
import { CircularProgress, Typography, Grid } from '@mui/material';
|
|
25
25
|
import { fetchBaseUrl, replaceSpecialCharacter as replaceSpecialCharacter$1, fetchLegacyAgentScreen } from 'core/Utils/functions/utils';
|
|
26
|
-
import { Button, Modal, AccordionModern, Tabs, Slider, Select, DatePicker, Checkbox, RadioButtonGroup, Input, Loader, ChatBotComponent } from 'impact-ui-v3';
|
|
26
|
+
import { Button, Modal, AccordionModern, Tabs, Slider, Select, DatePicker, DateRangePicker, Checkbox, RadioButtonGroup, Input, Loader, ChatBotComponent } from 'impact-ui-v3';
|
|
27
27
|
import AgGridComponent from 'core/Utils/agGrid';
|
|
28
28
|
import agGridColumnFormatter from 'core/Utils/agGrid/column-formatter';
|
|
29
29
|
import CoreChart from 'core/Utils/core-charts';
|
|
@@ -434,6 +434,26 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
434
434
|
paramName: data?.data?.param_name
|
|
435
435
|
}
|
|
436
436
|
};
|
|
437
|
+
case "dateRangePicker":
|
|
438
|
+
return {
|
|
439
|
+
...data,
|
|
440
|
+
timeStamp: timeString,
|
|
441
|
+
userType: "bot",
|
|
442
|
+
userName: userName,
|
|
443
|
+
headerTitle: data?.data?.label || "",
|
|
444
|
+
bodyType: "dateRangePicker",
|
|
445
|
+
bodyText: {
|
|
446
|
+
displayFormat: data?.data?.displayFormat,
|
|
447
|
+
label: data?.data?.label,
|
|
448
|
+
isRequired: data?.data?.isRequired,
|
|
449
|
+
labelOrientation: data?.data?.labelOrientation,
|
|
450
|
+
minDate: data?.data?.minDate,
|
|
451
|
+
maxDate: data?.data?.maxDate,
|
|
452
|
+
isDisabled: data?.data?.isDisabled,
|
|
453
|
+
showMonthYearSelect: data?.data?.showMonthYearSelect,
|
|
454
|
+
paramName: data?.data?.param_name
|
|
455
|
+
}
|
|
456
|
+
};
|
|
437
457
|
case "checkbox":
|
|
438
458
|
return {
|
|
439
459
|
...data,
|
|
@@ -6722,6 +6742,42 @@ const DatePickerContent = ({ bodyText }) => {
|
|
|
6722
6742
|
selectedDate: selectedDate }) }));
|
|
6723
6743
|
};
|
|
6724
6744
|
|
|
6745
|
+
const DateRangePickerContent = ({ bodyText }) => {
|
|
6746
|
+
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, } = bodyText;
|
|
6747
|
+
const [startDate, setStartDate] = useState(null);
|
|
6748
|
+
const [endDate, setEndDate] = useState(null);
|
|
6749
|
+
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6750
|
+
const dispatch = useDispatch();
|
|
6751
|
+
if (isEmpty$1(bodyText))
|
|
6752
|
+
return null;
|
|
6753
|
+
const handleDatesChange = (start, end) => {
|
|
6754
|
+
try {
|
|
6755
|
+
setStartDate(start);
|
|
6756
|
+
setEndDate(end);
|
|
6757
|
+
chatbotContext[bodyText?.paramName] = {
|
|
6758
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6759
|
+
[bodyText?.paramName]: {
|
|
6760
|
+
startDate: start ? moment(start).format(displayFormat) : null,
|
|
6761
|
+
endDate: end ? moment(end).format(displayFormat) : null,
|
|
6762
|
+
},
|
|
6763
|
+
updated: true,
|
|
6764
|
+
};
|
|
6765
|
+
dispatch(setChatbotContext(chatbotContext));
|
|
6766
|
+
}
|
|
6767
|
+
catch (error) {
|
|
6768
|
+
console.error("Error in dateRangePicker handleDatesChange", error);
|
|
6769
|
+
}
|
|
6770
|
+
};
|
|
6771
|
+
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DateRangePicker, { displayFormat: displayFormat, label: label, isRequired: isRequired, labelOrientation: labelOrientation || "top", minDate: minDate, maxDate: maxDate, isDisabled: isDisabled, startDate: startDate, setStartDate: setStartDate, endDate: endDate, setEndDate: setEndDate, showMonthYearSelect: showMonthYearSelect, handleDatesChange: handleDatesChange, onPrimaryButtonClick: () => handleDatesChange(startDate, endDate), onSecondaryButtonClick: () => {
|
|
6772
|
+
setStartDate(null);
|
|
6773
|
+
setEndDate(null);
|
|
6774
|
+
}, onResetClick: () => {
|
|
6775
|
+
setStartDate(null);
|
|
6776
|
+
setEndDate(null);
|
|
6777
|
+
handleDatesChange(null, null);
|
|
6778
|
+
} }) }));
|
|
6779
|
+
};
|
|
6780
|
+
|
|
6725
6781
|
const CheckboxContent = ({ bodyText }) => {
|
|
6726
6782
|
const { label, checked: checkedValue, required, disabled, } = bodyText;
|
|
6727
6783
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
@@ -7058,6 +7114,8 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
7058
7114
|
return jsx(SelectContent, { bodyText: parsedData.bodyText }, key);
|
|
7059
7115
|
case "datePicker":
|
|
7060
7116
|
return jsx(DatePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7117
|
+
case "dateRangePicker":
|
|
7118
|
+
return jsx(DateRangePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7061
7119
|
case "checkbox":
|
|
7062
7120
|
return jsx(CheckboxContent, { bodyText: parsedData.bodyText }, key);
|
|
7063
7121
|
case "radio":
|
|
@@ -7152,6 +7210,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
|
|
|
7152
7210
|
return jsx(SelectContent, { bodyText: botData.bodyText });
|
|
7153
7211
|
case "datePicker":
|
|
7154
7212
|
return jsx(DatePickerContent, { bodyText: botData.bodyText });
|
|
7213
|
+
case "dateRangePicker":
|
|
7214
|
+
return jsx(DateRangePickerContent, { bodyText: botData.bodyText });
|
|
7155
7215
|
case "checkbox":
|
|
7156
7216
|
return jsx(CheckboxContent, { bodyText: botData.bodyText });
|
|
7157
7217
|
case "radio":
|