impact-chatbot 2.3.69 → 2.3.71
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/StepFormContent.d.ts +2 -1
- package/dist/components/message-template/components/message-content/utils/crossFilterAdapter.d.ts +3 -1
- package/dist/index.cjs.js +141 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +141 -21
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* @param {Array} props.formData - Array of raw widget_data items from step_form chunk
|
|
8
8
|
* @param {number} props.messageIndex - Index for form state persistence keys
|
|
9
9
|
*/
|
|
10
|
-
declare const StepFormContent: ({ formData, messageIndex, isFormDisabled, showSavedFilters }: {
|
|
10
|
+
declare const StepFormContent: ({ formData, messageIndex, isFormDisabled, showSavedFilters, preSelectedFilters }: {
|
|
11
11
|
formData: any;
|
|
12
12
|
messageIndex?: number;
|
|
13
13
|
isFormDisabled?: boolean;
|
|
14
14
|
showSavedFilters?: boolean;
|
|
15
|
+
preSelectedFilters?: any;
|
|
15
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
17
18
|
export declare const resetStepFormTimeoutFlag: () => void;
|
package/dist/components/message-template/components/message-content/utils/crossFilterAdapter.d.ts
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* @param {Array} existingSelections - Upstream filter selections
|
|
9
9
|
* Each item: { filterName, attributeName, values, checkAll }
|
|
10
10
|
* @param {Array} allFilters - Full array of all filter configs
|
|
11
|
+
* @param {Object|null} preSelectedFilters - Optional pre-selected filters from init response
|
|
12
|
+
* Format: { param_name: { values: [...], label, dimension, is_mandatory } }
|
|
11
13
|
* @returns {Promise<Array<{label, value}>>} - Formatted options
|
|
12
14
|
*/
|
|
13
|
-
export declare const fetchCrossFilterOptions: (filterConfig: any, existingSelections?: any[], allFilters?: any[]) => Promise<{
|
|
15
|
+
export declare const fetchCrossFilterOptions: (filterConfig: any, existingSelections?: any[], allFilters?: any[], preSelectedFilters?: any) => Promise<{
|
|
14
16
|
label: any;
|
|
15
17
|
value: string;
|
|
16
18
|
}[]>;
|
package/dist/index.cjs.js
CHANGED
|
@@ -6620,9 +6620,11 @@ const CrossFilterProvider = ({ filters, fetchOptionsFn, initialSelections = {},
|
|
|
6620
6620
|
* @param {Array} existingSelections - Upstream filter selections
|
|
6621
6621
|
* Each item: { filterName, attributeName, values, checkAll }
|
|
6622
6622
|
* @param {Array} allFilters - Full array of all filter configs
|
|
6623
|
+
* @param {Object|null} preSelectedFilters - Optional pre-selected filters from init response
|
|
6624
|
+
* Format: { param_name: { values: [...], label, dimension, is_mandatory } }
|
|
6623
6625
|
* @returns {Promise<Array<{label, value}>>} - Formatted options
|
|
6624
6626
|
*/
|
|
6625
|
-
const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], allFilters = []) => {
|
|
6627
|
+
const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], allFilters = [], preSelectedFilters = null) => {
|
|
6626
6628
|
try {
|
|
6627
6629
|
const attributeName = filterConfig.column_name ||
|
|
6628
6630
|
filterConfig.attribute_name ||
|
|
@@ -6655,6 +6657,39 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
|
|
|
6655
6657
|
display_order: fullConfig?.display_order || fullConfig?.ordering || 0,
|
|
6656
6658
|
};
|
|
6657
6659
|
});
|
|
6660
|
+
// Build pre-selected filter entries from init response (if provided)
|
|
6661
|
+
// These are always included in the payload alongside user selections
|
|
6662
|
+
const preSelectedEntries = [];
|
|
6663
|
+
if (preSelectedFilters && typeof preSelectedFilters === "object") {
|
|
6664
|
+
Object.entries(preSelectedFilters).forEach(([key, config]) => {
|
|
6665
|
+
// Skip if this filter is the one we're fetching options for
|
|
6666
|
+
if (key === attributeName)
|
|
6667
|
+
return;
|
|
6668
|
+
// Skip if user has already selected values for this filter (user selection takes precedence)
|
|
6669
|
+
const userAlreadySelected = filtersArray.some((f) => f.attribute_name === key || f.filter_id === key);
|
|
6670
|
+
if (userAlreadySelected)
|
|
6671
|
+
return;
|
|
6672
|
+
const values = Array.isArray(config.values) ? config.values : [];
|
|
6673
|
+
if (values.length === 0)
|
|
6674
|
+
return;
|
|
6675
|
+
preSelectedEntries.push({
|
|
6676
|
+
filter_name: config.label || key,
|
|
6677
|
+
filter_id: key,
|
|
6678
|
+
filter_type: "cascaded",
|
|
6679
|
+
dimension: config.dimension || dimension,
|
|
6680
|
+
display_type: "dropdown",
|
|
6681
|
+
check_configuration: [],
|
|
6682
|
+
is_mandatory: config.is_mandatory || false,
|
|
6683
|
+
extra: {},
|
|
6684
|
+
values: values,
|
|
6685
|
+
attribute_name: key,
|
|
6686
|
+
operator: "in",
|
|
6687
|
+
display_order: 0,
|
|
6688
|
+
});
|
|
6689
|
+
});
|
|
6690
|
+
}
|
|
6691
|
+
// Merge: pre-selected filters first, then user selections
|
|
6692
|
+
const combinedFilters = [...preSelectedEntries, ...filtersArray];
|
|
6658
6693
|
const payload = {
|
|
6659
6694
|
attributes: [
|
|
6660
6695
|
{
|
|
@@ -6664,7 +6699,7 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
|
|
|
6664
6699
|
},
|
|
6665
6700
|
],
|
|
6666
6701
|
filter_type: "cascaded",
|
|
6667
|
-
filters:
|
|
6702
|
+
filters: combinedFilters,
|
|
6668
6703
|
is_urm_filter: true,
|
|
6669
6704
|
screen_name: "Chatbot",
|
|
6670
6705
|
application_code: 1,
|
|
@@ -6764,6 +6799,7 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6764
6799
|
|
|
6765
6800
|
const INITIAL_DISPLAY_COUNT = 100;
|
|
6766
6801
|
const LOAD_MORE_COUNT = 100;
|
|
6802
|
+
const SEARCH_DISPLAY_LIMIT = 500;
|
|
6767
6803
|
const formatOption = (option) => ({
|
|
6768
6804
|
...option,
|
|
6769
6805
|
label: replaceSpecialCharacter(option.label.toString()),
|
|
@@ -6778,9 +6814,15 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6778
6814
|
const [currentOptions, setCurrentOptions] = React.useState([]);
|
|
6779
6815
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
6780
6816
|
const [currentSelectedOptions, setCurrentSelectedOptions] = React.useState(persistedFormValues?.[formKey] || []);
|
|
6781
|
-
const
|
|
6817
|
+
const selectAllKey = `${formKey}__selectAllCount`;
|
|
6818
|
+
const [isAllSelected, setIsAllSelected] = React.useState(() => {
|
|
6819
|
+
return (persistedFormValues?.[selectAllKey] || 0) > 0;
|
|
6820
|
+
});
|
|
6782
6821
|
const [initialOptions, setInitialOptions] = React.useState([]);
|
|
6783
6822
|
const allOptionsRef = React.useRef([]);
|
|
6823
|
+
const isSearchActiveRef = React.useRef(false);
|
|
6824
|
+
const searchTermRef = React.useRef("");
|
|
6825
|
+
const selectAllCountRef = React.useRef(persistedFormValues?.[selectAllKey] || 0);
|
|
6784
6826
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6785
6827
|
const heirarchyKeyValuePairs = reactRedux.useSelector((state) => state.smartBotReducer.heirarchyKeyValuePairs);
|
|
6786
6828
|
const dispatch = reactRedux.useDispatch();
|
|
@@ -6873,6 +6915,40 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6873
6915
|
setCurrentOptions(initialSlice);
|
|
6874
6916
|
}
|
|
6875
6917
|
}, [isCascading]);
|
|
6918
|
+
// Custom search handler: searches ALL options (not just the loaded chunk)
|
|
6919
|
+
// Supports comma-separated values for multi-search
|
|
6920
|
+
const handleSearch = React.useCallback((event) => {
|
|
6921
|
+
const rawInput = event?.target?.value || "";
|
|
6922
|
+
searchTermRef.current = rawInput;
|
|
6923
|
+
const trimmed = rawInput.trim();
|
|
6924
|
+
if (!trimmed) {
|
|
6925
|
+
// Reset to initial lazy-loaded chunk
|
|
6926
|
+
isSearchActiveRef.current = false;
|
|
6927
|
+
const resetSlice = formatSlice(allOptionsRef.current, 0, INITIAL_DISPLAY_COUNT);
|
|
6928
|
+
setCurrentOptions(resetSlice);
|
|
6929
|
+
setInitialOptions(resetSlice);
|
|
6930
|
+
setIsAllSelected(false);
|
|
6931
|
+
return;
|
|
6932
|
+
}
|
|
6933
|
+
isSearchActiveRef.current = true;
|
|
6934
|
+
// Parse comma-separated terms
|
|
6935
|
+
const terms = trimmed
|
|
6936
|
+
.split(",")
|
|
6937
|
+
.map((t) => t.trim().toLowerCase())
|
|
6938
|
+
.filter(Boolean);
|
|
6939
|
+
// Search across ALL options, not just the loaded chunk
|
|
6940
|
+
const allRaw = allOptionsRef.current;
|
|
6941
|
+
const filtered = allRaw.filter((option) => {
|
|
6942
|
+
const labelLower = option.label?.toString().toLowerCase() || "";
|
|
6943
|
+
const valueLower = option.value?.toString().toLowerCase() || "";
|
|
6944
|
+
return terms.some((term) => labelLower.includes(term) || valueLower.includes(term));
|
|
6945
|
+
});
|
|
6946
|
+
// Format and cap the results to avoid UI freeze
|
|
6947
|
+
const formatted = filtered.slice(0, SEARCH_DISPLAY_LIMIT).map(formatOption);
|
|
6948
|
+
setCurrentOptions(formatted);
|
|
6949
|
+
setInitialOptions(formatted);
|
|
6950
|
+
setIsAllSelected(false);
|
|
6951
|
+
}, []);
|
|
6876
6952
|
return (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: currentOptions, setCurrentOptions: setCurrentOptions, label: heirarchyKeyValuePairs[paramName] || label, labelOrientation: labelOrientation,
|
|
6877
6953
|
// inputPosition={inputPosition}
|
|
6878
6954
|
// header={header}
|
|
@@ -6887,13 +6963,18 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6887
6963
|
updated: true,
|
|
6888
6964
|
},
|
|
6889
6965
|
}));
|
|
6890
|
-
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [] }));
|
|
6966
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
|
|
6891
6967
|
// Notify cross-filter context to clear downstream filters
|
|
6892
6968
|
if (isCascading) {
|
|
6893
6969
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
6894
6970
|
}
|
|
6895
6971
|
}, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: (open) => {
|
|
6896
6972
|
setIsOpen(open);
|
|
6973
|
+
// When dropdown closes after a search-filtered select-all on a subset,
|
|
6974
|
+
// reset the isAllSelected flag since only a subset was selected
|
|
6975
|
+
if (!open && isAllSelected && isSearchActiveRef.current) {
|
|
6976
|
+
setIsAllSelected(false);
|
|
6977
|
+
}
|
|
6897
6978
|
if (isCascading) {
|
|
6898
6979
|
if (open) {
|
|
6899
6980
|
// Lazy fetch: trigger cross-filter API call when dropdown opens for the first time
|
|
@@ -6920,7 +7001,10 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6920
7001
|
}
|
|
6921
7002
|
}
|
|
6922
7003
|
}
|
|
6923
|
-
}, isOpen: isOpen, selectedOptions: currentSelectedOptions, setSelectedOptions: setCurrentSelectedOptions, initialOptions: initialOptions, isMulti: isMulti, isSelectAll: isAllSelected, setIsSelectAll: setIsAllSelected, toggleSelectAll: true, isLoading: isCascading ? crossFilterCtx.loadingMap[paramName] : false, emptyMessage: isCascading && crossFilterCtx.loadingMap[paramName] ? "Loading values..." : "No options available", isWithSearch: isMulti ? true : false, onMenuScrollToBottom: () => {
|
|
7004
|
+
}, isOpen: isOpen, selectedOptions: currentSelectedOptions, setSelectedOptions: setCurrentSelectedOptions, initialOptions: initialOptions, isMulti: isMulti, isSelectAll: isAllSelected, setIsSelectAll: setIsAllSelected, toggleSelectAll: true, isLoading: isCascading ? crossFilterCtx.loadingMap[paramName] : false, emptyMessage: isCascading && crossFilterCtx.loadingMap[paramName] ? "Loading values..." : "No options available", isWithSearch: isMulti ? true : false, onSearch: handleSearch, onMenuScrollToBottom: () => {
|
|
7005
|
+
// Only allow scroll-to-load-more when NOT in search mode
|
|
7006
|
+
if (isSearchActiveRef.current)
|
|
7007
|
+
return;
|
|
6924
7008
|
const allRaw = allOptionsRef.current;
|
|
6925
7009
|
if (allRaw.length > 0 && currentOptions.length < allRaw.length) {
|
|
6926
7010
|
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allRaw.length);
|
|
@@ -6928,40 +7012,71 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6928
7012
|
const nextOptions = [...currentOptions, ...newBatch];
|
|
6929
7013
|
setCurrentOptions(nextOptions);
|
|
6930
7014
|
setInitialOptions(nextOptions);
|
|
7015
|
+
// When all are selected, mark newly loaded items as selected too
|
|
7016
|
+
// so they render with checkmarks in the dropdown
|
|
6931
7017
|
if (isAllSelected) {
|
|
6932
7018
|
setCurrentSelectedOptions(nextOptions);
|
|
6933
7019
|
}
|
|
6934
7020
|
}
|
|
6935
7021
|
}, onSelectAll: (e) => {
|
|
6936
7022
|
if (e && e.target.checked) {
|
|
6937
|
-
|
|
7023
|
+
// When search is active, select only the filtered/visible options
|
|
7024
|
+
// When no search is active, select ALL options from the full dataset
|
|
7025
|
+
// but only render the currently visible chunk to avoid 100k+ DOM nodes
|
|
7026
|
+
let valuesToDispatch;
|
|
7027
|
+
if (isSearchActiveRef.current) {
|
|
7028
|
+
// Search-filtered select all: only select the visible filtered options
|
|
7029
|
+
valuesToDispatch = currentOptions.map((opt) => opt.value);
|
|
7030
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
7031
|
+
selectAllCountRef.current = currentOptions.length;
|
|
7032
|
+
}
|
|
7033
|
+
else {
|
|
7034
|
+
// Full select all: select all options but only render the visible chunk
|
|
7035
|
+
valuesToDispatch = allOptionsRef.current.map((opt) => opt.value);
|
|
7036
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
7037
|
+
selectAllCountRef.current = allOptionsRef.current.length;
|
|
7038
|
+
}
|
|
6938
7039
|
setIsAllSelected(true);
|
|
6939
|
-
const allValues = allOptionsRef.current.map((opt) => opt.value);
|
|
6940
7040
|
dispatch(smartBotActions.setChatbotContext({
|
|
6941
7041
|
...chatbotContext,
|
|
6942
7042
|
[bodyText?.paramName]: {
|
|
6943
7043
|
...chatbotContext?.[bodyText?.paramName],
|
|
6944
|
-
[bodyText?.paramName]:
|
|
7044
|
+
[bodyText?.paramName]: valuesToDispatch,
|
|
6945
7045
|
updated: true,
|
|
6946
7046
|
},
|
|
6947
7047
|
}));
|
|
6948
|
-
|
|
7048
|
+
// Persist only the currently visible options (not all 100k+) to avoid Redux memory bloat
|
|
7049
|
+
dispatch(smartBotActions.setPersistedFormValues({
|
|
7050
|
+
[formKey]: [...currentOptions],
|
|
7051
|
+
[selectAllKey]: selectAllCountRef.current,
|
|
7052
|
+
}));
|
|
6949
7053
|
// Notify cross-filter context if cascading is active
|
|
6950
7054
|
if (isCascading) {
|
|
6951
|
-
crossFilterCtx.onFilterChange(paramName,
|
|
7055
|
+
crossFilterCtx.onFilterChange(paramName, valuesToDispatch);
|
|
6952
7056
|
}
|
|
6953
7057
|
}
|
|
6954
7058
|
else {
|
|
6955
7059
|
setCurrentSelectedOptions([]);
|
|
6956
7060
|
setIsAllSelected(false);
|
|
7061
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
7062
|
+
...chatbotContext,
|
|
7063
|
+
[bodyText?.paramName]: {
|
|
7064
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7065
|
+
[bodyText?.paramName]: [],
|
|
7066
|
+
updated: true,
|
|
7067
|
+
},
|
|
7068
|
+
}));
|
|
7069
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
|
|
6957
7070
|
// Notify cross-filter context of deselection
|
|
6958
7071
|
if (isCascading) {
|
|
6959
7072
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
6960
7073
|
}
|
|
6961
7074
|
}
|
|
6962
|
-
}, customPlaceholderAfterSelect: isAllSelected
|
|
6963
|
-
?
|
|
6964
|
-
:
|
|
7075
|
+
}, customPlaceholderAfterSelect: isAllSelected
|
|
7076
|
+
? selectAllCountRef.current
|
|
7077
|
+
: currentSelectedOptions.length > 0
|
|
7078
|
+
? currentSelectedOptions.length
|
|
7079
|
+
: null }) }));
|
|
6965
7080
|
};
|
|
6966
7081
|
|
|
6967
7082
|
const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
@@ -7177,7 +7292,7 @@ const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
|
7177
7292
|
* @param {Array} props.formData - Array of raw widget_data items from step_form chunk
|
|
7178
7293
|
* @param {number} props.messageIndex - Index for form state persistence keys
|
|
7179
7294
|
*/
|
|
7180
|
-
const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, showSavedFilters = true }) => {
|
|
7295
|
+
const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, showSavedFilters = true, preSelectedFilters = null }) => {
|
|
7181
7296
|
const dispatch = reactRedux.useDispatch();
|
|
7182
7297
|
const savedFilterSets = reactRedux.useSelector((state) => state.smartBotReducer.savedFilterSets);
|
|
7183
7298
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
@@ -7494,7 +7609,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7494
7609
|
return null;
|
|
7495
7610
|
return (jsxRuntime.jsxs("div", { className: "step-form-content", children: [showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: filterSetCurrentOptions, setCurrentOptions: setFilterSetCurrentOptions, label: "Saved Filter Sets", labelOrientation: "top", isRequired: false, isDisabled: savedFilterDisabled, handleChange: (selected) => onFilterSetChange(selected), isCloseWhenClickOutside: true, setIsOpen: setIsFilterSetOpen, isOpen: isFilterSetOpen, selectedOptions: selectedFilterSet, setSelectedOptions: setSelectedFilterSet, initialOptions: filterSetOptions, isMulti: false, isClearable: true }) })), showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("hr", { style: { border: "none", borderTop: "1px solid #E0E0E0", margin: "12px 0" } })), jsxRuntime.jsx("div", { style: {
|
|
7496
7611
|
...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
|
|
7497
|
-
}, children: crossFilterConfigs.length
|
|
7612
|
+
}, children: crossFilterConfigs.length >= 1 ? (jsxRuntime.jsx(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: formFields })) : (formFields) }), buttonItems] }));
|
|
7498
7613
|
};
|
|
7499
7614
|
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
7500
7615
|
const resetStepFormTimeoutFlag = () => {
|
|
@@ -7770,7 +7885,7 @@ const getQuestionStatus$1 = (questionSteps) => {
|
|
|
7770
7885
|
/**
|
|
7771
7886
|
* Renders a single progress bar item (main point + sub-items)
|
|
7772
7887
|
*/
|
|
7773
|
-
const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, isFormDisabled, onAllSubItemsAnimated = undefined }) => {
|
|
7888
|
+
const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined }) => {
|
|
7774
7889
|
const status = getQuestionStatus$1(questionSteps);
|
|
7775
7890
|
const animatedCountRef = React.useRef(0);
|
|
7776
7891
|
const [isExpanded, setIsExpanded] = React.useState(true);
|
|
@@ -7803,7 +7918,7 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
|
|
|
7803
7918
|
if (animatedCountRef.current >= arr.length && onAllSubItemsAnimated) {
|
|
7804
7919
|
onAllSubItemsAnimated();
|
|
7805
7920
|
}
|
|
7806
|
-
} }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters }) }))] })] }));
|
|
7921
|
+
} }) }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
|
|
7807
7922
|
};
|
|
7808
7923
|
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, }) => {
|
|
7809
7924
|
const classes = useStyles$4();
|
|
@@ -7886,8 +8001,9 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
|
|
|
7886
8001
|
const formEntry = stepFormDataMap[question] || null;
|
|
7887
8002
|
const formData = formEntry ? (Array.isArray(formEntry) ? formEntry : formEntry.widgets) : null;
|
|
7888
8003
|
const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
|
|
8004
|
+
const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
|
|
7889
8005
|
const isLast = index === questions.length - 1;
|
|
7890
|
-
return (jsxRuntime.jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
|
|
8006
|
+
return (jsxRuntime.jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
|
|
7891
8007
|
? () => setShowThinking(true)
|
|
7892
8008
|
: undefined }, index));
|
|
7893
8009
|
}), showThinking && !done && (jsxRuntime.jsx("div", { style: {
|
|
@@ -8705,6 +8821,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8705
8821
|
stepFormDataMapRef.current[currentIntent] = {
|
|
8706
8822
|
widgets: [...formWidgetData, stepFormSubmitButton],
|
|
8707
8823
|
showSavedFilters: data.show_saved_filters !== false,
|
|
8824
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
8708
8825
|
};
|
|
8709
8826
|
setStepFormDataMap({ ...stepFormDataMapRef.current });
|
|
8710
8827
|
}
|
|
@@ -9643,7 +9760,7 @@ const getQuestionStatus = (questionSteps) => {
|
|
|
9643
9760
|
/**
|
|
9644
9761
|
* Renders a single progress bar item (main point + sub-items)
|
|
9645
9762
|
*/
|
|
9646
|
-
const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true }) => {
|
|
9763
|
+
const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null }) => {
|
|
9647
9764
|
const baseStatus = getQuestionStatus(questionSteps);
|
|
9648
9765
|
// When restreaming and this is the last item, show as in-progress
|
|
9649
9766
|
const status = (isRestreaming && isLast) ? "in-progress" : baseStatus;
|
|
@@ -9672,7 +9789,7 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
|
|
|
9672
9789
|
setIsExpanded(true);
|
|
9673
9790
|
}
|
|
9674
9791
|
}, [status, formData]);
|
|
9675
|
-
return (jsxRuntime.jsxs("div", { className: classes.progressItem, children: [jsxRuntime.jsxs("div", { className: classes.progressTrack, children: [jsxRuntime.jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsxRuntime.jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxRuntime.jsxs("div", { className: classes.progressContent, children: [jsxRuntime.jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsxRuntime.jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsxRuntime.jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxRuntime.jsxs("div", { className: classes.reasoningLabel, children: [jsxRuntime.jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.jsxs("div", { className: classes.progressSubItem, children: [step.header, step.sub_header ? ` - ${step.sub_header}` : ""] }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters }) }))] })] }));
|
|
9792
|
+
return (jsxRuntime.jsxs("div", { className: classes.progressItem, children: [jsxRuntime.jsxs("div", { className: classes.progressTrack, children: [jsxRuntime.jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsxRuntime.jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxRuntime.jsxs("div", { className: classes.progressContent, children: [jsxRuntime.jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsxRuntime.jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsxRuntime.jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxRuntime.jsxs("div", { className: classes.reasoningLabel, children: [jsxRuntime.jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsxRuntime.jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxRuntime.jsxs("div", { className: classes.progressSubItem, children: [step.header, step.sub_header ? ` - ${step.sub_header}` : ""] }, idx))) })), formData && isExpanded && (jsxRuntime.jsx("div", { className: classes.stepFormContainer, children: jsxRuntime.jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
|
|
9676
9793
|
};
|
|
9677
9794
|
const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
|
|
9678
9795
|
const classes = useStyles$3();
|
|
@@ -9698,11 +9815,12 @@ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap
|
|
|
9698
9815
|
// Support both old array format and new object format { widgets, showSavedFilters }
|
|
9699
9816
|
const formData = formEntry ? (Array.isArray(formEntry) ? formEntry : formEntry.widgets) : null;
|
|
9700
9817
|
const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
|
|
9818
|
+
const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
|
|
9701
9819
|
// If activeFormIntent is set, only the matching form is enabled; all others stay disabled
|
|
9702
9820
|
const formDisabledForThis = activeFormIntent
|
|
9703
9821
|
? question !== activeFormIntent
|
|
9704
9822
|
: isFormDisabled;
|
|
9705
|
-
return (jsxRuntime.jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters }, index));
|
|
9823
|
+
return (jsxRuntime.jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }, index));
|
|
9706
9824
|
}) }));
|
|
9707
9825
|
};
|
|
9708
9826
|
|
|
@@ -9961,6 +10079,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
9961
10079
|
newStepFormDataMap[currentIntent] = {
|
|
9962
10080
|
widgets: [...formWidgetData, submitButton],
|
|
9963
10081
|
showSavedFilters: data.show_saved_filters !== false,
|
|
10082
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
9964
10083
|
};
|
|
9965
10084
|
}
|
|
9966
10085
|
}
|
|
@@ -10087,6 +10206,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
10087
10206
|
newStepFormDataMap[currentIntent] = {
|
|
10088
10207
|
widgets: [...formWidgetData, submitButton],
|
|
10089
10208
|
showSavedFilters: data.show_saved_filters !== false,
|
|
10209
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
10090
10210
|
};
|
|
10091
10211
|
}
|
|
10092
10212
|
}
|