impact-chatbot 2.3.18 → 2.3.19
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/components/message-template/components/message-content/ButtonContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/CheckboxContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/DatePickerContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/DateRangePickerContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/InputContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/RadioContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/SelectContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/SliderContent.d.ts +2 -1
- package/dist/index.cjs.js +37 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +37 -33
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4889,7 +4889,7 @@ const useStyles$4 = styles.makeStyles((theme) => ({
|
|
|
4889
4889
|
marginTop: pxToRem(16),
|
|
4890
4890
|
}
|
|
4891
4891
|
}));
|
|
4892
|
-
const ButtonContent = ({ bodyText }) => {
|
|
4892
|
+
const ButtonContent = ({ bodyText, isFormDisabled = false }) => {
|
|
4893
4893
|
const classes = useStyles$4();
|
|
4894
4894
|
const handleButtonClick = (button) => {
|
|
4895
4895
|
// if (button.onClick) {
|
|
@@ -4906,7 +4906,7 @@ const ButtonContent = ({ bodyText }) => {
|
|
|
4906
4906
|
if (!Array.isArray(bodyText.buttons)) {
|
|
4907
4907
|
return null;
|
|
4908
4908
|
}
|
|
4909
|
-
return bodyText.buttons.map((button, index) => (jsxRuntime.jsx(impactUiV3.Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled, className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }, index)));
|
|
4909
|
+
return bodyText.buttons.map((button, index) => (jsxRuntime.jsx(impactUiV3.Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled || isFormDisabled, className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }, index)));
|
|
4910
4910
|
};
|
|
4911
4911
|
return (jsxRuntime.jsxs("div", { className: classes.buttonContainer, children: [bodyText.message && (jsxRuntime.jsx("div", { className: classes.message, children: bodyText.message })), jsxRuntime.jsx("div", { className: classes.buttonRow, children: renderButtons() })] }));
|
|
4912
4912
|
};
|
|
@@ -6657,7 +6657,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
6657
6657
|
return renderContent();
|
|
6658
6658
|
};
|
|
6659
6659
|
|
|
6660
|
-
const SliderContent = ({ bodyText }) => {
|
|
6660
|
+
const SliderContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6661
6661
|
const { header, headerOrentiation, inputPosition, label, max, min, required, disabled, } = bodyText;
|
|
6662
6662
|
const [sliderValue, setSliderValue] = React.useState(0);
|
|
6663
6663
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
@@ -6678,10 +6678,10 @@ const SliderContent = ({ bodyText }) => {
|
|
|
6678
6678
|
console.error("Error in slider handleChange", error);
|
|
6679
6679
|
}
|
|
6680
6680
|
};
|
|
6681
|
-
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Slider, { header: header, headerOrientation: headerOrentiation, inputPosition: inputPosition, label: label, max: max, min: min, required: required, disabled: disabled, onChange: (e) => handleChange(e), value: sliderValue }) }));
|
|
6681
|
+
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Slider, { header: header, headerOrientation: headerOrentiation, inputPosition: inputPosition, label: label, max: max, min: min, required: required, disabled: disabled || isFormDisabled, onChange: (e) => handleChange(e), value: sliderValue }) }));
|
|
6682
6682
|
};
|
|
6683
6683
|
|
|
6684
|
-
const SelectContent = ({ bodyText }) => {
|
|
6684
|
+
const SelectContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6685
6685
|
const { header, inputPosition, labelOrientation, label, options, isRequired, isDisabled, isMulti, paramName } = bodyText;
|
|
6686
6686
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
6687
6687
|
const [currentOptions, setCurrentOptions] = React.useState([]);
|
|
@@ -6731,10 +6731,10 @@ const SelectContent = ({ bodyText }) => {
|
|
|
6731
6731
|
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: currentOptions, setCurrentOptions: setCurrentOptions, label: heirarchyKeyValuePairs[paramName] || label, labelOrientation: labelOrientation,
|
|
6732
6732
|
// inputPosition={inputPosition}
|
|
6733
6733
|
// header={header}
|
|
6734
|
-
isRequired: isRequired, isDisabled: isDisabled, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: setIsOpen, isOpen: isOpen, selectedOptions: currentSelectedOptions, setSelectedOptions: setCurrentSelectedOptions, initialOptions: initialOptions, isMulti: isMulti, isSelectAll: isAllSelected, setIsSelectAll: setIsAllSelected, toggleSelectAll: true, isWithSearch: isMulti ? true : false }) }));
|
|
6734
|
+
isRequired: isRequired, isDisabled: isDisabled || isFormDisabled, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: setIsOpen, isOpen: isOpen, selectedOptions: currentSelectedOptions, setSelectedOptions: setCurrentSelectedOptions, initialOptions: initialOptions, isMulti: isMulti, isSelectAll: isAllSelected, setIsSelectAll: setIsAllSelected, toggleSelectAll: true, isWithSearch: isMulti ? true : false }) }));
|
|
6735
6735
|
};
|
|
6736
6736
|
|
|
6737
|
-
const DatePickerContent = ({ bodyText }) => {
|
|
6737
|
+
const DatePickerContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6738
6738
|
const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, } = bodyText;
|
|
6739
6739
|
const [selectedDate, setSelectedDate] = React.useState(null);
|
|
6740
6740
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
@@ -6758,13 +6758,13 @@ const DatePickerContent = ({ bodyText }) => {
|
|
|
6758
6758
|
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.DatePicker, { displayFormat: displayFormat, label: label, required: isRequired, labelOrientation: labelOrientation, placeholder: placeholder,
|
|
6759
6759
|
// minDate={minDate}
|
|
6760
6760
|
// maxDate={maxDate}
|
|
6761
|
-
|
|
6761
|
+
isDisabled: isDisabled || isFormDisabled, setSelectedDate: (date) => handleDateChange(date),
|
|
6762
6762
|
// showMonthYearSelect
|
|
6763
6763
|
// showWeekNumbers
|
|
6764
6764
|
selectedDate: selectedDate }) }));
|
|
6765
6765
|
};
|
|
6766
6766
|
|
|
6767
|
-
const DateRangePickerContent = ({ bodyText }) => {
|
|
6767
|
+
const DateRangePickerContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6768
6768
|
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, } = bodyText;
|
|
6769
6769
|
const [startDate, setStartDate] = React.useState(null);
|
|
6770
6770
|
const [endDate, setEndDate] = React.useState(null);
|
|
@@ -6790,7 +6790,7 @@ const DateRangePickerContent = ({ bodyText }) => {
|
|
|
6790
6790
|
console.error("Error in dateRangePicker handleDatesChange", error);
|
|
6791
6791
|
}
|
|
6792
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: () => {
|
|
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 || isFormDisabled, startDate: startDate, setStartDate: setStartDate, endDate: endDate, setEndDate: setEndDate, showMonthYearSelect: showMonthYearSelect, handleDatesChange: handleDatesChange, onPrimaryButtonClick: () => handleDatesChange(startDate, endDate), onSecondaryButtonClick: () => {
|
|
6794
6794
|
setStartDate(null);
|
|
6795
6795
|
setEndDate(null);
|
|
6796
6796
|
}, onResetClick: () => {
|
|
@@ -6800,7 +6800,7 @@ const DateRangePickerContent = ({ bodyText }) => {
|
|
|
6800
6800
|
} }) }));
|
|
6801
6801
|
};
|
|
6802
6802
|
|
|
6803
|
-
const CheckboxContent = ({ bodyText }) => {
|
|
6803
|
+
const CheckboxContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6804
6804
|
const { label, checked: checkedValue, required, disabled, } = bodyText;
|
|
6805
6805
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6806
6806
|
const dispatch = reactRedux.useDispatch();
|
|
@@ -6826,10 +6826,10 @@ const CheckboxContent = ({ bodyText }) => {
|
|
|
6826
6826
|
console.error("Error in checkbox handleChange", error);
|
|
6827
6827
|
}
|
|
6828
6828
|
};
|
|
6829
|
-
return (jsxRuntime.jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsxRuntime.jsx(impactUiV3.Checkbox, { label: label, checked: checked, required: required, disabled: disabled, onChange: (e) => handleChange(e), variant: "default" }) }));
|
|
6829
|
+
return (jsxRuntime.jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsxRuntime.jsx(impactUiV3.Checkbox, { label: label, checked: checked, required: required, disabled: disabled || isFormDisabled, onChange: (e) => handleChange(e), variant: "default" }) }));
|
|
6830
6830
|
};
|
|
6831
6831
|
|
|
6832
|
-
const RadioContent = ({ bodyText }) => {
|
|
6832
|
+
const RadioContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6833
6833
|
const classes = useStyles$6();
|
|
6834
6834
|
const { label, isDisabled, orientation, options } = bodyText;
|
|
6835
6835
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
@@ -6857,10 +6857,10 @@ const RadioContent = ({ bodyText }) => {
|
|
|
6857
6857
|
console.error("Error in radio handleChange", error);
|
|
6858
6858
|
}
|
|
6859
6859
|
};
|
|
6860
|
-
return (jsxRuntime.jsxs("div", { style: { width: "100%", marginTop: "10px" }, children: [bodyText?.label && jsxRuntime.jsx("p", { className: classes.radioGrpLabel, children: bodyText.label }), jsxRuntime.jsx(impactUiV3.RadioButtonGroup, { name: "radio-group", options: options, onChange: (e) => handleChange(e), orientation: orientation,
|
|
6860
|
+
return (jsxRuntime.jsxs("div", { style: { width: "100%", marginTop: "10px" }, children: [bodyText?.label && jsxRuntime.jsx("p", { className: classes.radioGrpLabel, children: bodyText.label }), jsxRuntime.jsx(impactUiV3.RadioButtonGroup, { name: "radio-group", options: options, onChange: (e) => handleChange(e), orientation: orientation, isDisabled: isDisabled || isFormDisabled, selectedOption: selectedOption })] }));
|
|
6861
6861
|
};
|
|
6862
6862
|
|
|
6863
|
-
const InputContent = ({ bodyText }) => {
|
|
6863
|
+
const InputContent = ({ bodyText, isFormDisabled = false }) => {
|
|
6864
6864
|
const { label, placeholder, isRequired, isDisabled, inputType, labelOrientation, defaultValue, maxLength, minLength, } = bodyText;
|
|
6865
6865
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6866
6866
|
const dispatch = reactRedux.useDispatch();
|
|
@@ -6883,7 +6883,7 @@ const InputContent = ({ bodyText }) => {
|
|
|
6883
6883
|
console.error("Error in input handleChange", error);
|
|
6884
6884
|
}
|
|
6885
6885
|
};
|
|
6886
|
-
return (jsxRuntime.jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsxRuntime.jsx(impactUiV3.Input, { label: label, placeholder: placeholder, value: value, onChange: handleChange, required: isRequired,
|
|
6886
|
+
return (jsxRuntime.jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsxRuntime.jsx(impactUiV3.Input, { label: label, placeholder: placeholder, value: value, onChange: handleChange, required: isRequired, isDisabled: isDisabled || isFormDisabled, type: inputType || "text", labelOrientation: labelOrientation, maxLength: maxLength, minLength: minLength }) }));
|
|
6887
6887
|
};
|
|
6888
6888
|
|
|
6889
6889
|
const ImageContent = ({ bodyText }) => {
|
|
@@ -7108,6 +7108,7 @@ const TabularContent = ({ steps, currentTabValue, children, questions = [], ques
|
|
|
7108
7108
|
};
|
|
7109
7109
|
|
|
7110
7110
|
const CombinedContent = ({ botData, props }) => {
|
|
7111
|
+
const isFormDisabled = botData?.isFormDisabled || false;
|
|
7111
7112
|
const isTabEnabled = botData?.utilityData?.isTabEnabled;
|
|
7112
7113
|
// Get the array of content items from bodyText
|
|
7113
7114
|
const contentItems = Array.isArray(botData.bodyText) ? botData.bodyText : [];
|
|
@@ -7131,21 +7132,21 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
7131
7132
|
case "graph":
|
|
7132
7133
|
return jsxRuntime.jsx(GraphContent, { bodyText: parsedData.bodyText }, key);
|
|
7133
7134
|
case "slider":
|
|
7134
|
-
return jsxRuntime.jsx(SliderContent, { bodyText: parsedData.bodyText }, key);
|
|
7135
|
+
return jsxRuntime.jsx(SliderContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7135
7136
|
case "select":
|
|
7136
|
-
return jsxRuntime.jsx(SelectContent, { bodyText: parsedData.bodyText }, key);
|
|
7137
|
+
return jsxRuntime.jsx(SelectContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7137
7138
|
case "datePicker":
|
|
7138
|
-
return jsxRuntime.jsx(DatePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7139
|
+
return jsxRuntime.jsx(DatePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7139
7140
|
case "dateRangePicker":
|
|
7140
|
-
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: parsedData.bodyText }, key);
|
|
7141
|
+
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7141
7142
|
case "checkbox":
|
|
7142
|
-
return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText }, key);
|
|
7143
|
+
return jsxRuntime.jsx(CheckboxContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7143
7144
|
case "radio":
|
|
7144
|
-
return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText }, key);
|
|
7145
|
+
return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7145
7146
|
case "button":
|
|
7146
|
-
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText }, key);
|
|
7147
|
+
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7147
7148
|
case "input":
|
|
7148
|
-
return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText }, key);
|
|
7149
|
+
return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
7149
7150
|
case "image":
|
|
7150
7151
|
return jsxRuntime.jsx(ImageContent, { bodyText: parsedData.bodyText }, key);
|
|
7151
7152
|
default:
|
|
@@ -7227,21 +7228,21 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
|
|
|
7227
7228
|
case "graph":
|
|
7228
7229
|
return jsxRuntime.jsx(GraphContent, { bodyText: botData.bodyText });
|
|
7229
7230
|
case "slider":
|
|
7230
|
-
return jsxRuntime.jsx(SliderContent, { bodyText: botData.bodyText });
|
|
7231
|
+
return jsxRuntime.jsx(SliderContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7231
7232
|
case "select":
|
|
7232
|
-
return jsxRuntime.jsx(SelectContent, { bodyText: botData.bodyText });
|
|
7233
|
+
return jsxRuntime.jsx(SelectContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7233
7234
|
case "datePicker":
|
|
7234
|
-
return jsxRuntime.jsx(DatePickerContent, { bodyText: botData.bodyText });
|
|
7235
|
+
return jsxRuntime.jsx(DatePickerContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7235
7236
|
case "dateRangePicker":
|
|
7236
|
-
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: botData.bodyText });
|
|
7237
|
+
return jsxRuntime.jsx(DateRangePickerContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7237
7238
|
case "checkbox":
|
|
7238
|
-
return jsxRuntime.jsx(CheckboxContent, { bodyText: botData.bodyText });
|
|
7239
|
+
return jsxRuntime.jsx(CheckboxContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7239
7240
|
case "radio":
|
|
7240
|
-
return jsxRuntime.jsx(RadioContent, { bodyText: botData.bodyText });
|
|
7241
|
+
return jsxRuntime.jsx(RadioContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7241
7242
|
case "button":
|
|
7242
|
-
return jsxRuntime.jsx(ButtonContent, { bodyText: botData.bodyText });
|
|
7243
|
+
return jsxRuntime.jsx(ButtonContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7243
7244
|
case "input":
|
|
7244
|
-
return jsxRuntime.jsx(InputContent, { bodyText: botData.bodyText });
|
|
7245
|
+
return jsxRuntime.jsx(InputContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled });
|
|
7245
7246
|
case "image":
|
|
7246
7247
|
return jsxRuntime.jsx(ImageContent, { bodyText: botData.bodyText });
|
|
7247
7248
|
case "combined":
|
|
@@ -10216,7 +10217,9 @@ const SmartBot = (props) => {
|
|
|
10216
10217
|
customChatConfig: customChatConfig,
|
|
10217
10218
|
loader: loader,
|
|
10218
10219
|
};
|
|
10219
|
-
chatDataInfoRef?.current[currentMode]?.conversations?.[1]?.messages
|
|
10220
|
+
const allMessages = chatDataInfoRef?.current[currentMode]?.conversations?.[1]?.messages || [];
|
|
10221
|
+
const lastBotMessageIndex = allMessages.reduce((lastIdx, msg, idx) => msg.userType === "bot" ? idx : lastIdx, -1);
|
|
10222
|
+
allMessages.forEach((message, index) => {
|
|
10220
10223
|
if (message.userType === "bot") {
|
|
10221
10224
|
// let BotMessageJsx =
|
|
10222
10225
|
// <BotMessage
|
|
@@ -10226,6 +10229,7 @@ const SmartBot = (props) => {
|
|
|
10226
10229
|
// props={properties}
|
|
10227
10230
|
// />
|
|
10228
10231
|
// ;
|
|
10232
|
+
message.isFormDisabled = index !== lastBotMessageIndex;
|
|
10229
10233
|
message.jsx = (jsxRuntime.jsx(BotMessage, { botData: message, state: loadingState, handleLikeDislike: handleLikeDislike, props: properties }));
|
|
10230
10234
|
message.firstMessage = true;
|
|
10231
10235
|
// message.enableLikes = true;
|