impact-chatbot 2.3.42 → 2.3.43
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 +49 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -12
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5768,6 +5768,15 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5768
5768
|
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(Slider, { header: header, headerOrientation: headerOrentiation, inputPosition: inputPosition, label: label, max: max, min: min, required: required, disabled: disabled || isFormDisabled, onChange: (e) => handleChange(e), value: sliderValue }) }));
|
|
5769
5769
|
};
|
|
5770
5770
|
|
|
5771
|
+
const INITIAL_DISPLAY_COUNT = 100;
|
|
5772
|
+
const LOAD_MORE_COUNT = 100;
|
|
5773
|
+
const formatOption = (option) => ({
|
|
5774
|
+
...option,
|
|
5775
|
+
label: replaceSpecialCharacter(option.label.toString()),
|
|
5776
|
+
});
|
|
5777
|
+
const formatSlice = (options, start, end) => {
|
|
5778
|
+
return options.slice(start, end).map(formatOption);
|
|
5779
|
+
};
|
|
5771
5780
|
const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
5772
5781
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
5773
5782
|
const { header, inputPosition, labelOrientation, label, options, isRequired, isDisabled, isMulti, paramName } = bodyText;
|
|
@@ -5777,6 +5786,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5777
5786
|
const [currentSelectedOptions, setCurrentSelectedOptions] = useState(persistedFormValues?.[formKey] || []);
|
|
5778
5787
|
const [isAllSelected, setIsAllSelected] = useState(false);
|
|
5779
5788
|
const [initialOptions, setInitialOptions] = useState([]);
|
|
5789
|
+
const allOptionsRef = useRef([]);
|
|
5780
5790
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5781
5791
|
const heirarchyKeyValuePairs = useSelector((state) => state.smartBotReducer.heirarchyKeyValuePairs);
|
|
5782
5792
|
const dispatch = useDispatch();
|
|
@@ -5815,19 +5825,46 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5815
5825
|
}
|
|
5816
5826
|
}, [persistedFormValues, formKey]);
|
|
5817
5827
|
useEffect(() => {
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
};
|
|
5823
|
-
});
|
|
5824
|
-
setInitialOptions(formattedOptions);
|
|
5825
|
-
setCurrentOptions(formattedOptions);
|
|
5828
|
+
allOptionsRef.current = options;
|
|
5829
|
+
const initialSlice = formatSlice(options, 0, INITIAL_DISPLAY_COUNT);
|
|
5830
|
+
setInitialOptions(initialSlice);
|
|
5831
|
+
setCurrentOptions(initialSlice);
|
|
5826
5832
|
}, []);
|
|
5827
5833
|
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(Select, { currentOptions: currentOptions, setCurrentOptions: setCurrentOptions, label: heirarchyKeyValuePairs[paramName] || label, labelOrientation: labelOrientation,
|
|
5828
5834
|
// inputPosition={inputPosition}
|
|
5829
5835
|
// header={header}
|
|
5830
|
-
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
|
|
5836
|
+
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, onMenuScrollToBottom: () => {
|
|
5837
|
+
const allRaw = allOptionsRef.current;
|
|
5838
|
+
if (allRaw.length > 0 && currentOptions.length < allRaw.length) {
|
|
5839
|
+
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allRaw.length);
|
|
5840
|
+
const newBatch = formatSlice(allRaw, currentOptions.length, nextCount);
|
|
5841
|
+
const nextOptions = [...currentOptions, ...newBatch];
|
|
5842
|
+
setCurrentOptions(nextOptions);
|
|
5843
|
+
setInitialOptions(nextOptions);
|
|
5844
|
+
if (isAllSelected) {
|
|
5845
|
+
setCurrentSelectedOptions(nextOptions);
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
}, onSelectAll: (e) => {
|
|
5849
|
+
if (e && e.target.checked) {
|
|
5850
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
5851
|
+
setIsAllSelected(true);
|
|
5852
|
+
const allValues = allOptionsRef.current.map((opt) => opt.value);
|
|
5853
|
+
chatbotContext[bodyText?.paramName] = {
|
|
5854
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
5855
|
+
[bodyText?.paramName]: allValues,
|
|
5856
|
+
updated: true,
|
|
5857
|
+
};
|
|
5858
|
+
dispatch(setChatbotContext(chatbotContext));
|
|
5859
|
+
dispatch(setPersistedFormValues({ [formKey]: currentOptions }));
|
|
5860
|
+
}
|
|
5861
|
+
else {
|
|
5862
|
+
setCurrentSelectedOptions([]);
|
|
5863
|
+
setIsAllSelected(false);
|
|
5864
|
+
}
|
|
5865
|
+
}, customPlaceholderAfterSelect: isAllSelected && allOptionsRef.current.length > 0
|
|
5866
|
+
? allOptionsRef.current.length
|
|
5867
|
+
: null }) }));
|
|
5831
5868
|
};
|
|
5832
5869
|
|
|
5833
5870
|
const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
@@ -6981,7 +7018,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
6981
7018
|
widgets: [...formWidgetData, stepFormSubmitButton],
|
|
6982
7019
|
showSavedFilters: data.show_saved_filters !== false,
|
|
6983
7020
|
};
|
|
6984
|
-
setStepFormDataMap(
|
|
7021
|
+
setStepFormDataMap({ ...stepFormDataMapRef.current });
|
|
6985
7022
|
}
|
|
6986
7023
|
setStepChange((prev) => !prev);
|
|
6987
7024
|
// Persist IDs immediately when step_form arrives (AxiosEventSource already set them)
|
|
@@ -7220,7 +7257,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
7220
7257
|
currentTabValue: stepsDone ? "agent_response" : undefined,
|
|
7221
7258
|
questions: cloneDeep(questionsRef.current),
|
|
7222
7259
|
questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
|
|
7223
|
-
stepFormDataMap:
|
|
7260
|
+
stepFormDataMap: { ...stepFormDataMapRef.current },
|
|
7224
7261
|
}, activeConversationId);
|
|
7225
7262
|
// [
|
|
7226
7263
|
// {
|
|
@@ -7306,7 +7343,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
7306
7343
|
currentTabValue: stepsDone ? "agent_response" : undefined,
|
|
7307
7344
|
questions: cloneDeep(questionsRef.current),
|
|
7308
7345
|
questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
|
|
7309
|
-
stepFormDataMap:
|
|
7346
|
+
stepFormDataMap: { ...stepFormDataMapRef.current },
|
|
7310
7347
|
}, activeConversationId);
|
|
7311
7348
|
}
|
|
7312
7349
|
// Clean up module-level Map entry - stream is fully processed
|