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.cjs.js
CHANGED
|
@@ -456,6 +456,26 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
456
456
|
paramName: data?.data?.param_name
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
+
case "dateRangePicker":
|
|
460
|
+
return {
|
|
461
|
+
...data,
|
|
462
|
+
timeStamp: timeString,
|
|
463
|
+
userType: "bot",
|
|
464
|
+
userName: userName,
|
|
465
|
+
headerTitle: data?.data?.label || "",
|
|
466
|
+
bodyType: "dateRangePicker",
|
|
467
|
+
bodyText: {
|
|
468
|
+
displayFormat: data?.data?.displayFormat,
|
|
469
|
+
label: data?.data?.label,
|
|
470
|
+
isRequired: data?.data?.isRequired,
|
|
471
|
+
labelOrientation: data?.data?.labelOrientation,
|
|
472
|
+
minDate: data?.data?.minDate,
|
|
473
|
+
maxDate: data?.data?.maxDate,
|
|
474
|
+
isDisabled: data?.data?.isDisabled,
|
|
475
|
+
showMonthYearSelect: data?.data?.showMonthYearSelect,
|
|
476
|
+
paramName: data?.data?.param_name
|
|
477
|
+
}
|
|
478
|
+
};
|
|
459
479
|
case "checkbox":
|
|
460
480
|
return {
|
|
461
481
|
...data,
|
|
@@ -6744,6 +6764,42 @@ const DatePickerContent = ({ bodyText }) => {
|
|
|
6744
6764
|
selectedDate: selectedDate }) }));
|
|
6745
6765
|
};
|
|
6746
6766
|
|
|
6767
|
+
const DateRangePickerContent = ({ bodyText }) => {
|
|
6768
|
+
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, } = bodyText;
|
|
6769
|
+
const [startDate, setStartDate] = React.useState(null);
|
|
6770
|
+
const [endDate, setEndDate] = React.useState(null);
|
|
6771
|
+
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6772
|
+
const dispatch = reactRedux.useDispatch();
|
|
6773
|
+
if (lodash.isEmpty(bodyText))
|
|
6774
|
+
return null;
|
|
6775
|
+
const handleDatesChange = (start, end) => {
|
|
6776
|
+
try {
|
|
6777
|
+
setStartDate(start);
|
|
6778
|
+
setEndDate(end);
|
|
6779
|
+
chatbotContext[bodyText?.paramName] = {
|
|
6780
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6781
|
+
[bodyText?.paramName]: {
|
|
6782
|
+
startDate: start ? moment(start).format(displayFormat) : null,
|
|
6783
|
+
endDate: end ? moment(end).format(displayFormat) : null,
|
|
6784
|
+
},
|
|
6785
|
+
updated: true,
|
|
6786
|
+
};
|
|
6787
|
+
dispatch(smartBotActions.setChatbotContext(chatbotContext));
|
|
6788
|
+
}
|
|
6789
|
+
catch (error) {
|
|
6790
|
+
console.error("Error in dateRangePicker handleDatesChange", error);
|
|
6791
|
+
}
|
|
6792
|
+
};
|
|
6793
|
+
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.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: () => {
|
|
6794
|
+
setStartDate(null);
|
|
6795
|
+
setEndDate(null);
|
|
6796
|
+
}, onResetClick: () => {
|
|
6797
|
+
setStartDate(null);
|
|
6798
|
+
setEndDate(null);
|
|
6799
|
+
handleDatesChange(null, null);
|
|
6800
|
+
} }) }));
|
|
6801
|
+
};
|
|
6802
|
+
|
|
6747
6803
|
const CheckboxContent = ({ bodyText }) => {
|
|
6748
6804
|
const { label, checked: checkedValue, required, disabled, } = bodyText;
|
|
6749
6805
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
@@ -7080,6 +7136,8 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
7080
7136
|
return jsxRuntime.jsx(SelectContent, { bodyText: parsedData.bodyText }, key);
|
|
7081
7137
|
case "datePicker":
|
|
7082
7138
|
return jsxRuntime.jsx(DatePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7139
|
+
case "dateRangePicker":
|
|
7140
|
+
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7083
7141
|
case "checkbox":
|
|
7084
7142
|
return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText }, key);
|
|
7085
7143
|
case "radio":
|
|
@@ -7174,6 +7232,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
|
|
|
7174
7232
|
return jsxRuntime.jsx(SelectContent, { bodyText: botData.bodyText });
|
|
7175
7233
|
case "datePicker":
|
|
7176
7234
|
return jsxRuntime.jsx(DatePickerContent, { bodyText: botData.bodyText });
|
|
7235
|
+
case "dateRangePicker":
|
|
7236
|
+
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: botData.bodyText });
|
|
7177
7237
|
case "checkbox":
|
|
7178
7238
|
return jsxRuntime.jsx(CheckboxContent, { bodyText: botData.bodyText });
|
|
7179
7239
|
case "radio":
|