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
package/dist/index.esm.js
CHANGED
|
@@ -6598,9 +6598,11 @@ const CrossFilterProvider = ({ filters, fetchOptionsFn, initialSelections = {},
|
|
|
6598
6598
|
* @param {Array} existingSelections - Upstream filter selections
|
|
6599
6599
|
* Each item: { filterName, attributeName, values, checkAll }
|
|
6600
6600
|
* @param {Array} allFilters - Full array of all filter configs
|
|
6601
|
+
* @param {Object|null} preSelectedFilters - Optional pre-selected filters from init response
|
|
6602
|
+
* Format: { param_name: { values: [...], label, dimension, is_mandatory } }
|
|
6601
6603
|
* @returns {Promise<Array<{label, value}>>} - Formatted options
|
|
6602
6604
|
*/
|
|
6603
|
-
const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], allFilters = []) => {
|
|
6605
|
+
const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], allFilters = [], preSelectedFilters = null) => {
|
|
6604
6606
|
try {
|
|
6605
6607
|
const attributeName = filterConfig.column_name ||
|
|
6606
6608
|
filterConfig.attribute_name ||
|
|
@@ -6633,6 +6635,39 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
|
|
|
6633
6635
|
display_order: fullConfig?.display_order || fullConfig?.ordering || 0,
|
|
6634
6636
|
};
|
|
6635
6637
|
});
|
|
6638
|
+
// Build pre-selected filter entries from init response (if provided)
|
|
6639
|
+
// These are always included in the payload alongside user selections
|
|
6640
|
+
const preSelectedEntries = [];
|
|
6641
|
+
if (preSelectedFilters && typeof preSelectedFilters === "object") {
|
|
6642
|
+
Object.entries(preSelectedFilters).forEach(([key, config]) => {
|
|
6643
|
+
// Skip if this filter is the one we're fetching options for
|
|
6644
|
+
if (key === attributeName)
|
|
6645
|
+
return;
|
|
6646
|
+
// Skip if user has already selected values for this filter (user selection takes precedence)
|
|
6647
|
+
const userAlreadySelected = filtersArray.some((f) => f.attribute_name === key || f.filter_id === key);
|
|
6648
|
+
if (userAlreadySelected)
|
|
6649
|
+
return;
|
|
6650
|
+
const values = Array.isArray(config.values) ? config.values : [];
|
|
6651
|
+
if (values.length === 0)
|
|
6652
|
+
return;
|
|
6653
|
+
preSelectedEntries.push({
|
|
6654
|
+
filter_name: config.label || key,
|
|
6655
|
+
filter_id: key,
|
|
6656
|
+
filter_type: "cascaded",
|
|
6657
|
+
dimension: config.dimension || dimension,
|
|
6658
|
+
display_type: "dropdown",
|
|
6659
|
+
check_configuration: [],
|
|
6660
|
+
is_mandatory: config.is_mandatory || false,
|
|
6661
|
+
extra: {},
|
|
6662
|
+
values: values,
|
|
6663
|
+
attribute_name: key,
|
|
6664
|
+
operator: "in",
|
|
6665
|
+
display_order: 0,
|
|
6666
|
+
});
|
|
6667
|
+
});
|
|
6668
|
+
}
|
|
6669
|
+
// Merge: pre-selected filters first, then user selections
|
|
6670
|
+
const combinedFilters = [...preSelectedEntries, ...filtersArray];
|
|
6636
6671
|
const payload = {
|
|
6637
6672
|
attributes: [
|
|
6638
6673
|
{
|
|
@@ -6642,7 +6677,7 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
|
|
|
6642
6677
|
},
|
|
6643
6678
|
],
|
|
6644
6679
|
filter_type: "cascaded",
|
|
6645
|
-
filters:
|
|
6680
|
+
filters: combinedFilters,
|
|
6646
6681
|
is_urm_filter: true,
|
|
6647
6682
|
screen_name: "Chatbot",
|
|
6648
6683
|
application_code: 1,
|
|
@@ -6742,6 +6777,7 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6742
6777
|
|
|
6743
6778
|
const INITIAL_DISPLAY_COUNT = 100;
|
|
6744
6779
|
const LOAD_MORE_COUNT = 100;
|
|
6780
|
+
const SEARCH_DISPLAY_LIMIT = 500;
|
|
6745
6781
|
const formatOption = (option) => ({
|
|
6746
6782
|
...option,
|
|
6747
6783
|
label: replaceSpecialCharacter(option.label.toString()),
|
|
@@ -6756,9 +6792,15 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6756
6792
|
const [currentOptions, setCurrentOptions] = useState([]);
|
|
6757
6793
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
6758
6794
|
const [currentSelectedOptions, setCurrentSelectedOptions] = useState(persistedFormValues?.[formKey] || []);
|
|
6759
|
-
const
|
|
6795
|
+
const selectAllKey = `${formKey}__selectAllCount`;
|
|
6796
|
+
const [isAllSelected, setIsAllSelected] = useState(() => {
|
|
6797
|
+
return (persistedFormValues?.[selectAllKey] || 0) > 0;
|
|
6798
|
+
});
|
|
6760
6799
|
const [initialOptions, setInitialOptions] = useState([]);
|
|
6761
6800
|
const allOptionsRef = useRef([]);
|
|
6801
|
+
const isSearchActiveRef = useRef(false);
|
|
6802
|
+
const searchTermRef = useRef("");
|
|
6803
|
+
const selectAllCountRef = useRef(persistedFormValues?.[selectAllKey] || 0);
|
|
6762
6804
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
6763
6805
|
const heirarchyKeyValuePairs = useSelector((state) => state.smartBotReducer.heirarchyKeyValuePairs);
|
|
6764
6806
|
const dispatch = useDispatch();
|
|
@@ -6851,6 +6893,40 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6851
6893
|
setCurrentOptions(initialSlice);
|
|
6852
6894
|
}
|
|
6853
6895
|
}, [isCascading]);
|
|
6896
|
+
// Custom search handler: searches ALL options (not just the loaded chunk)
|
|
6897
|
+
// Supports comma-separated values for multi-search
|
|
6898
|
+
const handleSearch = useCallback((event) => {
|
|
6899
|
+
const rawInput = event?.target?.value || "";
|
|
6900
|
+
searchTermRef.current = rawInput;
|
|
6901
|
+
const trimmed = rawInput.trim();
|
|
6902
|
+
if (!trimmed) {
|
|
6903
|
+
// Reset to initial lazy-loaded chunk
|
|
6904
|
+
isSearchActiveRef.current = false;
|
|
6905
|
+
const resetSlice = formatSlice(allOptionsRef.current, 0, INITIAL_DISPLAY_COUNT);
|
|
6906
|
+
setCurrentOptions(resetSlice);
|
|
6907
|
+
setInitialOptions(resetSlice);
|
|
6908
|
+
setIsAllSelected(false);
|
|
6909
|
+
return;
|
|
6910
|
+
}
|
|
6911
|
+
isSearchActiveRef.current = true;
|
|
6912
|
+
// Parse comma-separated terms
|
|
6913
|
+
const terms = trimmed
|
|
6914
|
+
.split(",")
|
|
6915
|
+
.map((t) => t.trim().toLowerCase())
|
|
6916
|
+
.filter(Boolean);
|
|
6917
|
+
// Search across ALL options, not just the loaded chunk
|
|
6918
|
+
const allRaw = allOptionsRef.current;
|
|
6919
|
+
const filtered = allRaw.filter((option) => {
|
|
6920
|
+
const labelLower = option.label?.toString().toLowerCase() || "";
|
|
6921
|
+
const valueLower = option.value?.toString().toLowerCase() || "";
|
|
6922
|
+
return terms.some((term) => labelLower.includes(term) || valueLower.includes(term));
|
|
6923
|
+
});
|
|
6924
|
+
// Format and cap the results to avoid UI freeze
|
|
6925
|
+
const formatted = filtered.slice(0, SEARCH_DISPLAY_LIMIT).map(formatOption);
|
|
6926
|
+
setCurrentOptions(formatted);
|
|
6927
|
+
setInitialOptions(formatted);
|
|
6928
|
+
setIsAllSelected(false);
|
|
6929
|
+
}, []);
|
|
6854
6930
|
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(Select, { currentOptions: currentOptions, setCurrentOptions: setCurrentOptions, label: heirarchyKeyValuePairs[paramName] || label, labelOrientation: labelOrientation,
|
|
6855
6931
|
// inputPosition={inputPosition}
|
|
6856
6932
|
// header={header}
|
|
@@ -6865,13 +6941,18 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6865
6941
|
updated: true,
|
|
6866
6942
|
},
|
|
6867
6943
|
}));
|
|
6868
|
-
dispatch(setPersistedFormValues({ [formKey]: [] }));
|
|
6944
|
+
dispatch(setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
|
|
6869
6945
|
// Notify cross-filter context to clear downstream filters
|
|
6870
6946
|
if (isCascading) {
|
|
6871
6947
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
6872
6948
|
}
|
|
6873
6949
|
}, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: (open) => {
|
|
6874
6950
|
setIsOpen(open);
|
|
6951
|
+
// When dropdown closes after a search-filtered select-all on a subset,
|
|
6952
|
+
// reset the isAllSelected flag since only a subset was selected
|
|
6953
|
+
if (!open && isAllSelected && isSearchActiveRef.current) {
|
|
6954
|
+
setIsAllSelected(false);
|
|
6955
|
+
}
|
|
6875
6956
|
if (isCascading) {
|
|
6876
6957
|
if (open) {
|
|
6877
6958
|
// Lazy fetch: trigger cross-filter API call when dropdown opens for the first time
|
|
@@ -6898,7 +6979,10 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6898
6979
|
}
|
|
6899
6980
|
}
|
|
6900
6981
|
}
|
|
6901
|
-
}, 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: () => {
|
|
6982
|
+
}, 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: () => {
|
|
6983
|
+
// Only allow scroll-to-load-more when NOT in search mode
|
|
6984
|
+
if (isSearchActiveRef.current)
|
|
6985
|
+
return;
|
|
6902
6986
|
const allRaw = allOptionsRef.current;
|
|
6903
6987
|
if (allRaw.length > 0 && currentOptions.length < allRaw.length) {
|
|
6904
6988
|
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allRaw.length);
|
|
@@ -6906,40 +6990,71 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6906
6990
|
const nextOptions = [...currentOptions, ...newBatch];
|
|
6907
6991
|
setCurrentOptions(nextOptions);
|
|
6908
6992
|
setInitialOptions(nextOptions);
|
|
6993
|
+
// When all are selected, mark newly loaded items as selected too
|
|
6994
|
+
// so they render with checkmarks in the dropdown
|
|
6909
6995
|
if (isAllSelected) {
|
|
6910
6996
|
setCurrentSelectedOptions(nextOptions);
|
|
6911
6997
|
}
|
|
6912
6998
|
}
|
|
6913
6999
|
}, onSelectAll: (e) => {
|
|
6914
7000
|
if (e && e.target.checked) {
|
|
6915
|
-
|
|
7001
|
+
// When search is active, select only the filtered/visible options
|
|
7002
|
+
// When no search is active, select ALL options from the full dataset
|
|
7003
|
+
// but only render the currently visible chunk to avoid 100k+ DOM nodes
|
|
7004
|
+
let valuesToDispatch;
|
|
7005
|
+
if (isSearchActiveRef.current) {
|
|
7006
|
+
// Search-filtered select all: only select the visible filtered options
|
|
7007
|
+
valuesToDispatch = currentOptions.map((opt) => opt.value);
|
|
7008
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
7009
|
+
selectAllCountRef.current = currentOptions.length;
|
|
7010
|
+
}
|
|
7011
|
+
else {
|
|
7012
|
+
// Full select all: select all options but only render the visible chunk
|
|
7013
|
+
valuesToDispatch = allOptionsRef.current.map((opt) => opt.value);
|
|
7014
|
+
setCurrentSelectedOptions([...currentOptions]);
|
|
7015
|
+
selectAllCountRef.current = allOptionsRef.current.length;
|
|
7016
|
+
}
|
|
6916
7017
|
setIsAllSelected(true);
|
|
6917
|
-
const allValues = allOptionsRef.current.map((opt) => opt.value);
|
|
6918
7018
|
dispatch(setChatbotContext({
|
|
6919
7019
|
...chatbotContext,
|
|
6920
7020
|
[bodyText?.paramName]: {
|
|
6921
7021
|
...chatbotContext?.[bodyText?.paramName],
|
|
6922
|
-
[bodyText?.paramName]:
|
|
7022
|
+
[bodyText?.paramName]: valuesToDispatch,
|
|
6923
7023
|
updated: true,
|
|
6924
7024
|
},
|
|
6925
7025
|
}));
|
|
6926
|
-
|
|
7026
|
+
// Persist only the currently visible options (not all 100k+) to avoid Redux memory bloat
|
|
7027
|
+
dispatch(setPersistedFormValues({
|
|
7028
|
+
[formKey]: [...currentOptions],
|
|
7029
|
+
[selectAllKey]: selectAllCountRef.current,
|
|
7030
|
+
}));
|
|
6927
7031
|
// Notify cross-filter context if cascading is active
|
|
6928
7032
|
if (isCascading) {
|
|
6929
|
-
crossFilterCtx.onFilterChange(paramName,
|
|
7033
|
+
crossFilterCtx.onFilterChange(paramName, valuesToDispatch);
|
|
6930
7034
|
}
|
|
6931
7035
|
}
|
|
6932
7036
|
else {
|
|
6933
7037
|
setCurrentSelectedOptions([]);
|
|
6934
7038
|
setIsAllSelected(false);
|
|
7039
|
+
dispatch(setChatbotContext({
|
|
7040
|
+
...chatbotContext,
|
|
7041
|
+
[bodyText?.paramName]: {
|
|
7042
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7043
|
+
[bodyText?.paramName]: [],
|
|
7044
|
+
updated: true,
|
|
7045
|
+
},
|
|
7046
|
+
}));
|
|
7047
|
+
dispatch(setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
|
|
6935
7048
|
// Notify cross-filter context of deselection
|
|
6936
7049
|
if (isCascading) {
|
|
6937
7050
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
6938
7051
|
}
|
|
6939
7052
|
}
|
|
6940
|
-
}, customPlaceholderAfterSelect: isAllSelected
|
|
6941
|
-
?
|
|
6942
|
-
:
|
|
7053
|
+
}, customPlaceholderAfterSelect: isAllSelected
|
|
7054
|
+
? selectAllCountRef.current
|
|
7055
|
+
: currentSelectedOptions.length > 0
|
|
7056
|
+
? currentSelectedOptions.length
|
|
7057
|
+
: null }) }));
|
|
6943
7058
|
};
|
|
6944
7059
|
|
|
6945
7060
|
const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
@@ -7155,7 +7270,7 @@ const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
|
7155
7270
|
* @param {Array} props.formData - Array of raw widget_data items from step_form chunk
|
|
7156
7271
|
* @param {number} props.messageIndex - Index for form state persistence keys
|
|
7157
7272
|
*/
|
|
7158
|
-
const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, showSavedFilters = true }) => {
|
|
7273
|
+
const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, showSavedFilters = true, preSelectedFilters = null }) => {
|
|
7159
7274
|
const dispatch = useDispatch();
|
|
7160
7275
|
const savedFilterSets = useSelector((state) => state.smartBotReducer.savedFilterSets);
|
|
7161
7276
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
@@ -7472,7 +7587,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7472
7587
|
return null;
|
|
7473
7588
|
return (jsxs("div", { className: "step-form-content", children: [showSavedFilters && filterSetOptions.length > 0 && (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(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 && (jsx("hr", { style: { border: "none", borderTop: "1px solid #E0E0E0", margin: "12px 0" } })), jsx("div", { style: {
|
|
7474
7589
|
...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
|
|
7475
|
-
}, children: crossFilterConfigs.length
|
|
7590
|
+
}, children: crossFilterConfigs.length >= 1 ? (jsx(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: formFields })) : (formFields) }), buttonItems] }));
|
|
7476
7591
|
};
|
|
7477
7592
|
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
7478
7593
|
const resetStepFormTimeoutFlag = () => {
|
|
@@ -7748,7 +7863,7 @@ const getQuestionStatus$1 = (questionSteps) => {
|
|
|
7748
7863
|
/**
|
|
7749
7864
|
* Renders a single progress bar item (main point + sub-items)
|
|
7750
7865
|
*/
|
|
7751
|
-
const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, isFormDisabled, onAllSubItemsAnimated = undefined }) => {
|
|
7866
|
+
const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData, showSavedFilters = true, preSelectedFilters = null, isFormDisabled, onAllSubItemsAnimated = undefined }) => {
|
|
7752
7867
|
const status = getQuestionStatus$1(questionSteps);
|
|
7753
7868
|
const animatedCountRef = useRef(0);
|
|
7754
7869
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
@@ -7781,7 +7896,7 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
|
|
|
7781
7896
|
if (animatedCountRef.current >= arr.length && onAllSubItemsAnimated) {
|
|
7782
7897
|
onAllSubItemsAnimated();
|
|
7783
7898
|
}
|
|
7784
|
-
} }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters }) }))] })] }));
|
|
7899
|
+
} }) }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
|
|
7785
7900
|
};
|
|
7786
7901
|
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, }) => {
|
|
7787
7902
|
const classes = useStyles$4();
|
|
@@ -7864,8 +7979,9 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
|
|
|
7864
7979
|
const formEntry = stepFormDataMap[question] || null;
|
|
7865
7980
|
const formData = formEntry ? (Array.isArray(formEntry) ? formEntry : formEntry.widgets) : null;
|
|
7866
7981
|
const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
|
|
7982
|
+
const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
|
|
7867
7983
|
const isLast = index === questions.length - 1;
|
|
7868
|
-
return (jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
|
|
7984
|
+
return (jsx(ProgressBarItem$1, { question: question, questionSteps: questionSteps, isLast: isLast && !showThinking, classes: classes, formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters, onAllSubItemsAnimated: isLast && lastQuestionCompleted && !done
|
|
7869
7985
|
? () => setShowThinking(true)
|
|
7870
7986
|
: undefined }, index));
|
|
7871
7987
|
}), showThinking && !done && (jsx("div", { style: {
|
|
@@ -8683,6 +8799,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8683
8799
|
stepFormDataMapRef.current[currentIntent] = {
|
|
8684
8800
|
widgets: [...formWidgetData, stepFormSubmitButton],
|
|
8685
8801
|
showSavedFilters: data.show_saved_filters !== false,
|
|
8802
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
8686
8803
|
};
|
|
8687
8804
|
setStepFormDataMap({ ...stepFormDataMapRef.current });
|
|
8688
8805
|
}
|
|
@@ -9621,7 +9738,7 @@ const getQuestionStatus = (questionSteps) => {
|
|
|
9621
9738
|
/**
|
|
9622
9739
|
* Renders a single progress bar item (main point + sub-items)
|
|
9623
9740
|
*/
|
|
9624
|
-
const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true }) => {
|
|
9741
|
+
const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, isFormDisabled, isRestreaming = false, showSavedFilters = true, preSelectedFilters = null }) => {
|
|
9625
9742
|
const baseStatus = getQuestionStatus(questionSteps);
|
|
9626
9743
|
// When restreaming and this is the last item, show as in-progress
|
|
9627
9744
|
const status = (isRestreaming && isLast) ? "in-progress" : baseStatus;
|
|
@@ -9650,7 +9767,7 @@ const ProgressBarItem = ({ question, questionSteps, isLast, classes, formData, i
|
|
|
9650
9767
|
setIsExpanded(true);
|
|
9651
9768
|
}
|
|
9652
9769
|
}, [status, formData]);
|
|
9653
|
-
return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxs("div", { className: classes.progressSubItem, children: [step.header, step.sub_header ? ` - ${step.sub_header}` : ""] }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters }) }))] })] }));
|
|
9770
|
+
return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { maxHeight: isExpanded ? "500px" : "0", opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxs("div", { className: classes.progressSubItem, children: [step.header, step.sub_header ? ` - ${step.sub_header}` : ""] }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }) }))] })] }));
|
|
9654
9771
|
};
|
|
9655
9772
|
const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, activeFormIntent = null, isRestreaming = false }) => {
|
|
9656
9773
|
const classes = useStyles$3();
|
|
@@ -9676,11 +9793,12 @@ const Steps = ({ steps, questions = [], questionsStepsMap = {}, stepFormDataMap
|
|
|
9676
9793
|
// Support both old array format and new object format { widgets, showSavedFilters }
|
|
9677
9794
|
const formData = formEntry ? (Array.isArray(formEntry) ? formEntry : formEntry.widgets) : null;
|
|
9678
9795
|
const showSavedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.showSavedFilters : true;
|
|
9796
|
+
const preSelectedFilters = formEntry && !Array.isArray(formEntry) ? formEntry.preSelectedFilters : null;
|
|
9679
9797
|
// If activeFormIntent is set, only the matching form is enabled; all others stay disabled
|
|
9680
9798
|
const formDisabledForThis = activeFormIntent
|
|
9681
9799
|
? question !== activeFormIntent
|
|
9682
9800
|
: isFormDisabled;
|
|
9683
|
-
return (jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters }, index));
|
|
9801
|
+
return (jsx(ProgressBarItem, { question: question, questionSteps: questionSteps, isLast: index === questions.length - 1, classes: classes, formData: formData, isFormDisabled: formDisabledForThis, isRestreaming: isRestreaming, showSavedFilters: showSavedFilters, preSelectedFilters: preSelectedFilters }, index));
|
|
9684
9802
|
}) }));
|
|
9685
9803
|
};
|
|
9686
9804
|
|
|
@@ -9939,6 +10057,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
9939
10057
|
newStepFormDataMap[currentIntent] = {
|
|
9940
10058
|
widgets: [...formWidgetData, submitButton],
|
|
9941
10059
|
showSavedFilters: data.show_saved_filters !== false,
|
|
10060
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
9942
10061
|
};
|
|
9943
10062
|
}
|
|
9944
10063
|
}
|
|
@@ -10065,6 +10184,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
10065
10184
|
newStepFormDataMap[currentIntent] = {
|
|
10066
10185
|
widgets: [...formWidgetData, submitButton],
|
|
10067
10186
|
showSavedFilters: data.show_saved_filters !== false,
|
|
10187
|
+
preSelectedFilters: data.pre_selected_filters || null,
|
|
10068
10188
|
};
|
|
10069
10189
|
}
|
|
10070
10190
|
}
|