impact-chatbot 2.4.0 → 2.4.1
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 +8 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -13718,6 +13718,7 @@ const ChatbotInput = (props) => {
|
|
|
13718
13718
|
const isTransitioningStageRef = useRef(false);
|
|
13719
13719
|
const shouldClearCacheRef = useRef(false);
|
|
13720
13720
|
const allFilterValuesRef = useRef([]);
|
|
13721
|
+
const initialValueOptionsRef = useRef([]);
|
|
13721
13722
|
const windowStartRef = useRef(0);
|
|
13722
13723
|
const INITIAL_DISPLAY_COUNT = 500;
|
|
13723
13724
|
const LOAD_MORE_COUNT = 100;
|
|
@@ -14262,6 +14263,7 @@ const ChatbotInput = (props) => {
|
|
|
14262
14263
|
setSelectionStage("values");
|
|
14263
14264
|
setSelectedFilter(filterConfig);
|
|
14264
14265
|
setCurrentOptions([]);
|
|
14266
|
+
initialValueOptionsRef.current = [];
|
|
14265
14267
|
setSelectedOptions([]);
|
|
14266
14268
|
setShowMentionSelect(true);
|
|
14267
14269
|
setIsSelectOpen(true);
|
|
@@ -14291,10 +14293,13 @@ const ChatbotInput = (props) => {
|
|
|
14291
14293
|
windowStartRef.current = 0;
|
|
14292
14294
|
if (allValues.length > 2000) {
|
|
14293
14295
|
allFilterValuesRef.current = allValues;
|
|
14294
|
-
|
|
14296
|
+
const initialSlice = allValues.slice(0, INITIAL_DISPLAY_COUNT);
|
|
14297
|
+
initialValueOptionsRef.current = initialSlice;
|
|
14298
|
+
setCurrentOptions(initialSlice);
|
|
14295
14299
|
}
|
|
14296
14300
|
else {
|
|
14297
14301
|
allFilterValuesRef.current = [];
|
|
14302
|
+
initialValueOptionsRef.current = allValues;
|
|
14298
14303
|
setCurrentOptions(allValues);
|
|
14299
14304
|
}
|
|
14300
14305
|
// Update dropdown position again after values are loaded (DOM might have shifted)
|
|
@@ -15047,7 +15052,7 @@ const ChatbotInput = (props) => {
|
|
|
15047
15052
|
zIndex: 10000,
|
|
15048
15053
|
}, children: selectionStage === "filter" ? (
|
|
15049
15054
|
// Stage 1: Filter selection - always use Select
|
|
15050
|
-
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions:
|
|
15055
|
+
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: formattedFilterOptions.length > 0 ? formattedFilterOptions : [], placeholder: "Select a filter...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, isMulti: false, disabled: false, isLoading: false, emptyMessage: "No filters available" })) : selectionStage === "values" && selectedFilter?.display_type &&
|
|
15051
15056
|
selectedFilter.display_type !== "dropdown" &&
|
|
15052
15057
|
selectedFilter.display_type !== "autocompleteDropdown" &&
|
|
15053
15058
|
selectedFilter.display_type !== "list" ? (
|
|
@@ -15134,7 +15139,7 @@ const ChatbotInput = (props) => {
|
|
|
15134
15139
|
cursor: "pointer"
|
|
15135
15140
|
}, children: "Cancel" })] })] })) : (
|
|
15136
15141
|
// Stage 2: Value selection with dropdown - use Select
|
|
15137
|
-
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions:
|
|
15142
|
+
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: initialValueOptionsRef.current.length > 0 ? initialValueOptionsRef.current : currentOptions, placeholder: isLoadingValues
|
|
15138
15143
|
? "Loading values..."
|
|
15139
15144
|
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, onMenuScrollToBottom: () => {
|
|
15140
15145
|
const allValues = allFilterValuesRef.current;
|