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.cjs.js
CHANGED
|
@@ -5790,6 +5790,15 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5790
5790
|
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 }) }));
|
|
5791
5791
|
};
|
|
5792
5792
|
|
|
5793
|
+
const INITIAL_DISPLAY_COUNT = 100;
|
|
5794
|
+
const LOAD_MORE_COUNT = 100;
|
|
5795
|
+
const formatOption = (option) => ({
|
|
5796
|
+
...option,
|
|
5797
|
+
label: replaceSpecialCharacter(option.label.toString()),
|
|
5798
|
+
});
|
|
5799
|
+
const formatSlice = (options, start, end) => {
|
|
5800
|
+
return options.slice(start, end).map(formatOption);
|
|
5801
|
+
};
|
|
5793
5802
|
const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
5794
5803
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
5795
5804
|
const { header, inputPosition, labelOrientation, label, options, isRequired, isDisabled, isMulti, paramName } = bodyText;
|
|
@@ -5799,6 +5808,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5799
5808
|
const [currentSelectedOptions, setCurrentSelectedOptions] = React.useState(persistedFormValues?.[formKey] || []);
|
|
5800
5809
|
const [isAllSelected, setIsAllSelected] = React.useState(false);
|
|
5801
5810
|
const [initialOptions, setInitialOptions] = React.useState([]);
|
|
5811
|
+
const allOptionsRef = React.useRef([]);
|
|
5802
5812
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5803
5813
|
const heirarchyKeyValuePairs = reactRedux.useSelector((state) => state.smartBotReducer.heirarchyKeyValuePairs);
|
|
5804
5814
|
const dispatch = reactRedux.useDispatch();
|
|
@@ -5837,19 +5847,46 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5837
5847
|
}
|
|
5838
5848
|
}, [persistedFormValues, formKey]);
|
|
5839
5849
|
React.useEffect(() => {
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
};
|
|
5845
|
-
});
|
|
5846
|
-
setInitialOptions(formattedOptions);
|
|
5847
|
-
setCurrentOptions(formattedOptions);
|
|
5850
|
+
allOptionsRef.current = options;
|
|
5851
|
+
const initialSlice = formatSlice(options, 0, INITIAL_DISPLAY_COUNT);
|
|
5852
|
+
setInitialOptions(initialSlice);
|
|
5853
|
+
setCurrentOptions(initialSlice);
|
|
5848
5854
|
}, []);
|
|
5849
5855
|
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: currentOptions, setCurrentOptions: setCurrentOptions, label: heirarchyKeyValuePairs[paramName] || label, labelOrientation: labelOrientation,
|
|
5850
5856
|
// inputPosition={inputPosition}
|
|
5851
5857
|
// header={header}
|
|
5852
|
-
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
|
|
5858
|
+
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: () => {
|
|
5859
|
+
const allRaw = allOptionsRef.current;
|
|
5860
|
+
if (allRaw.length > 0 && currentOptions.length < allRaw.length) {
|
|
5861
|
+
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allRaw.length);
|
|
5862
|
+
const newBatch = formatSlice(allRaw, currentOptions.length, nextCount);
|
|
5863
|
+
const nextOptions = [...currentOptions, ...newBatch];
|
|
5864
|
+
setCurrentOptions(nextOptions);
|
|
5865
|
+
setInitialOptions(nextOptions);
|
|
5866
|
+
if (isAllSelected) {
|
|
5867
|
+
setCurrentSelectedOptions(nextOptions);
|
|
5868
|
+
}
|
|
5869
|
+
}
|
|
5870
|
+
}, onSelectAll: (e) => {
|
|
5871
|
+
if (e && e.target.checked) {
|
|
5872
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
5873
|
+
setIsAllSelected(true);
|
|
5874
|
+
const allValues = allOptionsRef.current.map((opt) => opt.value);
|
|
5875
|
+
chatbotContext[bodyText?.paramName] = {
|
|
5876
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
5877
|
+
[bodyText?.paramName]: allValues,
|
|
5878
|
+
updated: true,
|
|
5879
|
+
};
|
|
5880
|
+
dispatch(smartBotActions.setChatbotContext(chatbotContext));
|
|
5881
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: currentOptions }));
|
|
5882
|
+
}
|
|
5883
|
+
else {
|
|
5884
|
+
setCurrentSelectedOptions([]);
|
|
5885
|
+
setIsAllSelected(false);
|
|
5886
|
+
}
|
|
5887
|
+
}, customPlaceholderAfterSelect: isAllSelected && allOptionsRef.current.length > 0
|
|
5888
|
+
? allOptionsRef.current.length
|
|
5889
|
+
: null }) }));
|
|
5853
5890
|
};
|
|
5854
5891
|
|
|
5855
5892
|
const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
@@ -7003,7 +7040,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
7003
7040
|
widgets: [...formWidgetData, stepFormSubmitButton],
|
|
7004
7041
|
showSavedFilters: data.show_saved_filters !== false,
|
|
7005
7042
|
};
|
|
7006
|
-
setStepFormDataMap(
|
|
7043
|
+
setStepFormDataMap({ ...stepFormDataMapRef.current });
|
|
7007
7044
|
}
|
|
7008
7045
|
setStepChange((prev) => !prev);
|
|
7009
7046
|
// Persist IDs immediately when step_form arrives (AxiosEventSource already set them)
|
|
@@ -7242,7 +7279,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
7242
7279
|
currentTabValue: stepsDone ? "agent_response" : undefined,
|
|
7243
7280
|
questions: lodash.cloneDeep(questionsRef.current),
|
|
7244
7281
|
questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
|
|
7245
|
-
stepFormDataMap:
|
|
7282
|
+
stepFormDataMap: { ...stepFormDataMapRef.current },
|
|
7246
7283
|
}, activeConversationId);
|
|
7247
7284
|
// [
|
|
7248
7285
|
// {
|
|
@@ -7328,7 +7365,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
7328
7365
|
currentTabValue: stepsDone ? "agent_response" : undefined,
|
|
7329
7366
|
questions: lodash.cloneDeep(questionsRef.current),
|
|
7330
7367
|
questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
|
|
7331
|
-
stepFormDataMap:
|
|
7368
|
+
stepFormDataMap: { ...stepFormDataMapRef.current },
|
|
7332
7369
|
}, activeConversationId);
|
|
7333
7370
|
}
|
|
7334
7371
|
// Clean up module-level Map entry - stream is fully processed
|