impact-chatbot 2.3.98 → 2.3.100
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.esm.js
CHANGED
|
@@ -20,7 +20,7 @@ import remarkGfm from 'remark-gfm';
|
|
|
20
20
|
import DOMPurify from 'dompurify';
|
|
21
21
|
import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
|
|
22
22
|
import { setSelectedFilters, setFilterConfiguration, getFilterUserConfiguration } from 'core/actions/filterAction';
|
|
23
|
-
import { setThinkingContext, setChatbotContext, setStepFormStreamData, setMinimizedStreamData, setPersistedFormValues,
|
|
23
|
+
import { setThinkingContext, setChatbotContext, setStepFormStreamData, setMinimizedStreamData, setPersistedFormValues, setCurrentAgentChatId, clearPersistedFormValues, setHierarchyKeyValue, setChatbotFilterOptions, setSavedFilterSets } from 'core/actions/smartBotActions';
|
|
24
24
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
25
25
|
import styled from 'styled-components';
|
|
26
26
|
import { CircularProgress, Typography, Grid } from '@mui/material';
|
|
@@ -30,8 +30,8 @@ import isArray$2 from 'lodash/isArray';
|
|
|
30
30
|
import isEmpty$2 from 'lodash/isEmpty';
|
|
31
31
|
import { stopAgentFlow } from 'core/commonComponents/smartBot/services/chatbot-services';
|
|
32
32
|
import { updateQuestionTiming } from 'core/commonComponents/smartBot/services/conversation-service';
|
|
33
|
-
import AgGridComponent from 'core/Utils/
|
|
34
|
-
import agGridColumnFormatter from 'core/Utils/
|
|
33
|
+
import AgGridComponent from 'core/Utils/agGridV36';
|
|
34
|
+
import agGridColumnFormatter from 'core/Utils/agGridV36/columnFormatter';
|
|
35
35
|
import CoreChart from 'core/Utils/core-charts';
|
|
36
36
|
import makeStyles$1 from '@mui/styles/makeStyles';
|
|
37
37
|
import ChevronRightIcon$1 from '@mui/icons-material/ChevronRight';
|
|
@@ -761,6 +761,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
761
761
|
isDisabled: data?.data?.isDisabled,
|
|
762
762
|
orientation: data?.data?.orientation,
|
|
763
763
|
options: data?.data?.options,
|
|
764
|
+
defaultSelected: data?.data?.defaultSelected,
|
|
764
765
|
paramName: data?.data?.param_name
|
|
765
766
|
}
|
|
766
767
|
};
|
|
@@ -6881,6 +6882,19 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
6881
6882
|
*/
|
|
6882
6883
|
const onFilterChange = useCallback((paramName, selectedValues) => {
|
|
6883
6884
|
const values = Array.isArray(selectedValues) ? selectedValues : [selectedValues];
|
|
6885
|
+
// Eagerly update the ref so that any code running synchronously after
|
|
6886
|
+
// this call (e.g. fetchUpstreamOptions) sees the latest selections
|
|
6887
|
+
// without waiting for the React state-updater to be flushed.
|
|
6888
|
+
// Also clear downstream selections when the filter is emptied, so the
|
|
6889
|
+
// ref doesn't carry stale downstream values into the next API call.
|
|
6890
|
+
const eagerUpdate = { ...selectionsRef.current, [paramName]: values };
|
|
6891
|
+
if (values.length === 0) {
|
|
6892
|
+
const downstreamFilters = getDownstreamFilters(paramName);
|
|
6893
|
+
downstreamFilters.forEach((f) => {
|
|
6894
|
+
eagerUpdate[getParamName(f)] = [];
|
|
6895
|
+
});
|
|
6896
|
+
}
|
|
6897
|
+
selectionsRef.current = eagerUpdate;
|
|
6884
6898
|
// Update selections
|
|
6885
6899
|
setSelectionsMap((prev) => {
|
|
6886
6900
|
const updated = { ...prev, [paramName]: values };
|
|
@@ -6920,6 +6934,18 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
6920
6934
|
}
|
|
6921
6935
|
}
|
|
6922
6936
|
}, [getDownstreamFilters, getParamName, fetchOptionsForFilter, onSelectionChange]);
|
|
6937
|
+
/**
|
|
6938
|
+
* Update a filter's selection without triggering downstream cascade clears.
|
|
6939
|
+
* Used by saved-filter hydration to clear stale selectionsMap entries for
|
|
6940
|
+
* fields the saved filter doesn't cover, without wiping downstream options.
|
|
6941
|
+
*/
|
|
6942
|
+
const setSelectionSilent = useCallback((paramName, values) => {
|
|
6943
|
+
setSelectionsMap((prev) => {
|
|
6944
|
+
const updated = { ...prev, [paramName]: values };
|
|
6945
|
+
selectionsRef.current = updated;
|
|
6946
|
+
return updated;
|
|
6947
|
+
});
|
|
6948
|
+
}, []);
|
|
6923
6949
|
/**
|
|
6924
6950
|
* Reset all filters — clears selections and re-fetches initial options
|
|
6925
6951
|
*/
|
|
@@ -7075,6 +7101,7 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
7075
7101
|
loadingMap,
|
|
7076
7102
|
selectionsMap,
|
|
7077
7103
|
onFilterChange,
|
|
7104
|
+
setSelectionSilent,
|
|
7078
7105
|
resetAll,
|
|
7079
7106
|
resetFilter,
|
|
7080
7107
|
fetchOptions,
|
|
@@ -7407,6 +7434,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7407
7434
|
const latestContext = chatbotContextRef.current;
|
|
7408
7435
|
const updatedContext = {
|
|
7409
7436
|
...latestContext,
|
|
7437
|
+
__fromSavedFilter: false,
|
|
7410
7438
|
[bodyText?.paramName]: {
|
|
7411
7439
|
...latestContext?.[bodyText?.paramName],
|
|
7412
7440
|
[bodyText?.paramName]: value,
|
|
@@ -7433,6 +7461,13 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7433
7461
|
const persisted = persistedFormValues?.[formKey];
|
|
7434
7462
|
if (!persisted || (Array.isArray(persisted) && persisted.length === 0)) {
|
|
7435
7463
|
setCurrentSelectedOptions([]);
|
|
7464
|
+
setIsAllSelected(false);
|
|
7465
|
+
selectAllCountRef.current = 0;
|
|
7466
|
+
}
|
|
7467
|
+
else if (chatbotContextRef.current?.__fromSavedFilter) {
|
|
7468
|
+
setCurrentSelectedOptions(persisted);
|
|
7469
|
+
setIsAllSelected(false);
|
|
7470
|
+
selectAllCountRef.current = 0;
|
|
7436
7471
|
}
|
|
7437
7472
|
}, [persistedFormValues, formKey]);
|
|
7438
7473
|
// When cross-filter context provides new options for this filter, update local state
|
|
@@ -7523,6 +7558,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7523
7558
|
const ctx1 = chatbotContextRef.current;
|
|
7524
7559
|
dispatch(setChatbotContext({
|
|
7525
7560
|
...ctx1,
|
|
7561
|
+
__fromSavedFilter: false,
|
|
7526
7562
|
[bodyText?.paramName]: {
|
|
7527
7563
|
...ctx1?.[bodyText?.paramName],
|
|
7528
7564
|
[bodyText?.paramName]: [],
|
|
@@ -7533,6 +7569,9 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7533
7569
|
// Notify cross-filter context to clear downstream filters
|
|
7534
7570
|
if (isCascading) {
|
|
7535
7571
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
7572
|
+
// Re-fetch upstream options so they are no longer narrowed
|
|
7573
|
+
// by this filter's previous selection
|
|
7574
|
+
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7536
7575
|
}
|
|
7537
7576
|
}, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: (open) => {
|
|
7538
7577
|
setIsOpen(open);
|
|
@@ -7565,6 +7604,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7565
7604
|
}
|
|
7566
7605
|
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7567
7606
|
}
|
|
7607
|
+
else {
|
|
7608
|
+
// Selection was cleared — re-fetch upstream options so they are
|
|
7609
|
+
// no longer narrowed by this filter's previous selection
|
|
7610
|
+
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7611
|
+
}
|
|
7568
7612
|
}
|
|
7569
7613
|
}
|
|
7570
7614
|
}, 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: () => {
|
|
@@ -7606,6 +7650,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7606
7650
|
const ctx2 = chatbotContextRef.current;
|
|
7607
7651
|
dispatch(setChatbotContext({
|
|
7608
7652
|
...ctx2,
|
|
7653
|
+
__fromSavedFilter: false,
|
|
7609
7654
|
[bodyText?.paramName]: {
|
|
7610
7655
|
...ctx2?.[bodyText?.paramName],
|
|
7611
7656
|
[bodyText?.paramName]: valuesToDispatch,
|
|
@@ -7628,6 +7673,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7628
7673
|
const ctx3 = chatbotContextRef.current;
|
|
7629
7674
|
dispatch(setChatbotContext({
|
|
7630
7675
|
...ctx3,
|
|
7676
|
+
__fromSavedFilter: false,
|
|
7631
7677
|
[bodyText?.paramName]: {
|
|
7632
7678
|
...ctx3?.[bodyText?.paramName],
|
|
7633
7679
|
[bodyText?.paramName]: [],
|
|
@@ -7830,13 +7876,36 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
|
|
|
7830
7876
|
const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
7831
7877
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7832
7878
|
const classes = useStyles$b();
|
|
7833
|
-
const { label, isDisabled, orientation, options } = bodyText;
|
|
7879
|
+
const { label, isDisabled, orientation, options, defaultSelected } = bodyText;
|
|
7834
7880
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7835
7881
|
const chatbotContextRef = useRef(chatbotContext);
|
|
7836
7882
|
chatbotContextRef.current = chatbotContext;
|
|
7837
7883
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7838
7884
|
const dispatch = useDispatch();
|
|
7839
|
-
const [selectedOption, setSelectedOption] = useState(persistedFormValues[formKey] ?? null);
|
|
7885
|
+
const [selectedOption, setSelectedOption] = useState(persistedFormValues[formKey] ?? defaultSelected ?? null);
|
|
7886
|
+
// When a defaultSelected value is provided and nothing was previously persisted,
|
|
7887
|
+
// seed Redux state so submit-validation and context are aware of the pre-selection.
|
|
7888
|
+
// Uses getState inside a thunk to read the latest chatbotContext at dispatch time,
|
|
7889
|
+
// avoiding stale-ref overwrites when multiple radio widgets mount in the same flush.
|
|
7890
|
+
useEffect(() => {
|
|
7891
|
+
if (defaultSelected && !persistedFormValues[formKey]) {
|
|
7892
|
+
dispatch((dispatchAction, getState) => {
|
|
7893
|
+
const currentContext = getState().smartBotReducer.chatbotContext;
|
|
7894
|
+
dispatchAction({
|
|
7895
|
+
type: "SET_CHATBOT_CONTEXT",
|
|
7896
|
+
payload: {
|
|
7897
|
+
...currentContext,
|
|
7898
|
+
[bodyText?.paramName]: {
|
|
7899
|
+
...currentContext?.[bodyText?.paramName],
|
|
7900
|
+
[bodyText?.paramName]: defaultSelected,
|
|
7901
|
+
updated: true,
|
|
7902
|
+
},
|
|
7903
|
+
},
|
|
7904
|
+
});
|
|
7905
|
+
});
|
|
7906
|
+
dispatch(setPersistedFormValues({ [formKey]: defaultSelected }));
|
|
7907
|
+
}
|
|
7908
|
+
}, []);
|
|
7840
7909
|
if (isEmpty$1(bodyText))
|
|
7841
7910
|
return null;
|
|
7842
7911
|
const handleChange = (selectedOption) => {
|
|
@@ -7916,6 +7985,55 @@ const ImageContent = ({ bodyText }) => {
|
|
|
7916
7985
|
|
|
7917
7986
|
// Key used to persist timeout state in sessionStorage (survives component remounts from tab switches)
|
|
7918
7987
|
const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
7988
|
+
/**
|
|
7989
|
+
* Renderless bridge component that lives inside CrossFilterProvider.
|
|
7990
|
+
* Watches for saved filter selection changes and programmatically triggers
|
|
7991
|
+
* the cross-filter cascading system so downstream fields get their options.
|
|
7992
|
+
*/
|
|
7993
|
+
const SavedFilterCascadeBridge = ({ chatbotContext, crossFilterConfigs }) => {
|
|
7994
|
+
const crossFilterCtx = useCrossFilterContext();
|
|
7995
|
+
const prevSelectionRef = useRef(null);
|
|
7996
|
+
useEffect(() => {
|
|
7997
|
+
if (!crossFilterCtx?.isEnabled)
|
|
7998
|
+
return;
|
|
7999
|
+
const isFromSaved = chatbotContext?.__fromSavedFilter === true;
|
|
8000
|
+
if (!isFromSaved) {
|
|
8001
|
+
prevSelectionRef.current = null;
|
|
8002
|
+
return;
|
|
8003
|
+
}
|
|
8004
|
+
// Derive a stable key from the saved filter selection to detect switches
|
|
8005
|
+
const currentSelection = chatbotContext?.__savedFilterSelection;
|
|
8006
|
+
const selectionKey = Array.isArray(currentSelection)
|
|
8007
|
+
? currentSelection[0]?.value
|
|
8008
|
+
: currentSelection?.value;
|
|
8009
|
+
// Skip if this is the same saved filter we already processed
|
|
8010
|
+
if (selectionKey === prevSelectionRef.current)
|
|
8011
|
+
return;
|
|
8012
|
+
prevSelectionRef.current = selectionKey;
|
|
8013
|
+
// Set cascading selections for fields the saved filter covers.
|
|
8014
|
+
// For unmatched fields, silently clear selectionsMap without triggering
|
|
8015
|
+
// downstream cascade wipes (which would blank option lists).
|
|
8016
|
+
let lastMatchingParam = null;
|
|
8017
|
+
crossFilterConfigs.forEach((cfg) => {
|
|
8018
|
+
const ctx = chatbotContext[cfg.paramName];
|
|
8019
|
+
if (ctx && ctx.updated && Array.isArray(ctx[cfg.paramName]) && ctx[cfg.paramName].length > 0) {
|
|
8020
|
+
crossFilterCtx.onFilterChange(cfg.paramName, ctx[cfg.paramName]);
|
|
8021
|
+
lastMatchingParam = cfg.paramName;
|
|
8022
|
+
}
|
|
8023
|
+
else {
|
|
8024
|
+
// Clear stale selectionsMap entry without cascade
|
|
8025
|
+
crossFilterCtx.setSelectionSilent(cfg.paramName, []);
|
|
8026
|
+
}
|
|
8027
|
+
});
|
|
8028
|
+
// Fetch downstream options for the lowest matched filter
|
|
8029
|
+
if (lastMatchingParam) {
|
|
8030
|
+
setTimeout(() => {
|
|
8031
|
+
crossFilterCtx.fetchDownstreamOptions(lastMatchingParam);
|
|
8032
|
+
}, 100);
|
|
8033
|
+
}
|
|
8034
|
+
}, [chatbotContext?.__fromSavedFilter, chatbotContext?.__savedFilterSelection]);
|
|
8035
|
+
return null;
|
|
8036
|
+
};
|
|
7919
8037
|
/**
|
|
7920
8038
|
* Renders form widget data inline within a step.
|
|
7921
8039
|
* Reuses the same rendering logic as CombinedContent but designed
|
|
@@ -7992,13 +8110,14 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7992
8110
|
setFilterSetCurrentOptions(opts);
|
|
7993
8111
|
return opts;
|
|
7994
8112
|
}, [savedFilterSets]);
|
|
7995
|
-
|
|
8113
|
+
Array.isArray(selectedFilterSet) ? selectedFilterSet.length > 0 : !!selectedFilterSet && Object.keys(selectedFilterSet).length > 0;
|
|
7996
8114
|
const onFilterSetChange = useCallback((selected) => {
|
|
7997
8115
|
try {
|
|
7998
8116
|
const selectedValue = Array.isArray(selected) ? selected[0]?.value : selected?.value;
|
|
7999
8117
|
if (!selectedValue) {
|
|
8000
|
-
|
|
8001
|
-
|
|
8118
|
+
// Only remove saved filter flags; keep dropdown values and persisted state intact
|
|
8119
|
+
const { __fromSavedFilter, __savedFilterSelection, ...rest } = chatbotContext || {};
|
|
8120
|
+
dispatch(setChatbotContext(rest));
|
|
8002
8121
|
return;
|
|
8003
8122
|
}
|
|
8004
8123
|
const fullFilterObj = (savedFilterSets || []).find((f) => (f.fuc_code || f.name || f.label) === selectedValue);
|
|
@@ -8027,15 +8146,51 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8027
8146
|
};
|
|
8028
8147
|
}
|
|
8029
8148
|
});
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8149
|
+
// Merge into existing context to preserve non-select field values (dates, inputs, sliders).
|
|
8150
|
+
// Clear all select fields first, then overlay saved filter values.
|
|
8151
|
+
const mergedContext = { ...(chatbotContext || {}) };
|
|
8152
|
+
(formData || []).forEach((item) => {
|
|
8153
|
+
const pName = item?.data?.param_name;
|
|
8154
|
+
if (!pName || item?.type !== "select")
|
|
8155
|
+
return;
|
|
8156
|
+
mergedContext[pName] = { [pName]: [], updated: false };
|
|
8157
|
+
});
|
|
8158
|
+
Object.keys(newContext).forEach((key) => {
|
|
8159
|
+
mergedContext[key] = newContext[key];
|
|
8160
|
+
});
|
|
8161
|
+
mergedContext.__fromSavedFilter = true;
|
|
8162
|
+
mergedContext.__savedFilterSelection = selected;
|
|
8163
|
+
dispatch(setChatbotContext(mergedContext));
|
|
8164
|
+
// Build persisted values for ALL form select fields.
|
|
8165
|
+
// Matching fields get the saved filter values; unmatched fields get [] (cleared).
|
|
8166
|
+
const formPersisted = {};
|
|
8167
|
+
(formData || []).forEach((item) => {
|
|
8168
|
+
const pName = item?.data?.param_name;
|
|
8169
|
+
if (!pName || item?.type !== "select")
|
|
8170
|
+
return;
|
|
8171
|
+
const key = `${messageIndex}_${pName}`;
|
|
8172
|
+
const selectAllKey = `${key}__selectAllCount`;
|
|
8173
|
+
if (newContext[pName] && newContext[pName][pName]) {
|
|
8174
|
+
const values = newContext[pName][pName];
|
|
8175
|
+
formPersisted[key] = values.map((v) => ({
|
|
8176
|
+
label: v,
|
|
8177
|
+
value: v,
|
|
8178
|
+
}));
|
|
8179
|
+
}
|
|
8180
|
+
else {
|
|
8181
|
+
// Clear fields not covered by the saved filter
|
|
8182
|
+
formPersisted[key] = [];
|
|
8183
|
+
}
|
|
8184
|
+
// Always reset select-all count when a saved filter is applied
|
|
8185
|
+
formPersisted[selectAllKey] = 0;
|
|
8186
|
+
});
|
|
8187
|
+
dispatch(setPersistedFormValues(formPersisted));
|
|
8033
8188
|
}
|
|
8034
8189
|
catch (error) {
|
|
8035
8190
|
console.error("[StepFormContent] onFilterSetChange error:", error);
|
|
8036
8191
|
}
|
|
8037
|
-
}, [savedFilterSets, dispatch]);
|
|
8038
|
-
|
|
8192
|
+
}, [savedFilterSets, dispatch, formData, messageIndex, chatbotContext]);
|
|
8193
|
+
useMemo(() => {
|
|
8039
8194
|
if (!persistedFormValues)
|
|
8040
8195
|
return false;
|
|
8041
8196
|
const prefix = `${messageIndex}_`;
|
|
@@ -8046,8 +8201,8 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8046
8201
|
return val && (Array.isArray(val) ? val.length > 0 : !!val);
|
|
8047
8202
|
});
|
|
8048
8203
|
}, [persistedFormValues, messageIndex]);
|
|
8049
|
-
const formFieldsDisabled = isFormDisabled ||
|
|
8050
|
-
const savedFilterDisabled = isFormDisabled ||
|
|
8204
|
+
const formFieldsDisabled = isFormDisabled || isFormSubmitted || isTimedOut;
|
|
8205
|
+
const savedFilterDisabled = isFormDisabled || isFormSubmitted || isTimedOut;
|
|
8051
8206
|
const requiredFieldsFilled = useMemo(() => {
|
|
8052
8207
|
if (!formData || !Array.isArray(formData))
|
|
8053
8208
|
return false;
|
|
@@ -8287,9 +8442,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8287
8442
|
});
|
|
8288
8443
|
if (formFields.length === 0 && buttonItems.length === 0)
|
|
8289
8444
|
return null;
|
|
8290
|
-
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", {
|
|
8291
|
-
...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
|
|
8292
|
-
}, 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] }));
|
|
8445
|
+
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", { children: crossFilterConfigs.length >= 1 ? (jsxs(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: [jsx(SavedFilterCascadeBridge, { chatbotContext: chatbotContext, crossFilterConfigs: crossFilterConfigs }), formFields] })) : (formFields) }), buttonItems] }));
|
|
8293
8446
|
};
|
|
8294
8447
|
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
8295
8448
|
const resetStepFormTimeoutFlag = () => {
|
|
@@ -16558,7 +16711,7 @@ const SmartBot = (props) => {
|
|
|
16558
16711
|
}
|
|
16559
16712
|
}, [forceOpen]);
|
|
16560
16713
|
const [historyPanelData, setHistoryPanelData] = useState([]);
|
|
16561
|
-
const { fetchConversations, saveCurrentChat, renameConversation, deleteConversation, fetchConversationChats, fetchChatHistory, renameChat, pinChat, deleteChatById, } = useConversationManagement(chatDataRef, currentMode, activeConversationId, setActiveConversationId, setChatDataState, selectedModule, setSelectedModule, isModuleChanged, setIsModuleChanged, undefined, undefined, chatDataInfoRef, setHistoryPanelData, processResponse);
|
|
16714
|
+
const { loading: conversationLoading, fetchConversations, saveCurrentChat, renameConversation, deleteConversation, fetchConversationChats, fetchChatHistory, renameChat, pinChat, deleteChatById, } = useConversationManagement(chatDataRef, currentMode, activeConversationId, setActiveConversationId, setChatDataState, selectedModule, setSelectedModule, isModuleChanged, setIsModuleChanged, undefined, undefined, chatDataInfoRef, setHistoryPanelData, processResponse);
|
|
16562
16715
|
const handleHistoryMenuAction = useCallback(async (action, conversationData) => {
|
|
16563
16716
|
const conversationId = conversationData?.conversation_id;
|
|
16564
16717
|
if (!conversationId)
|
|
@@ -16705,7 +16858,7 @@ const SmartBot = (props) => {
|
|
|
16705
16858
|
return (jsxs(Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsx(MinimizedChatWidget, { onExpand: () => {
|
|
16706
16859
|
setShowModal(true);
|
|
16707
16860
|
setPartialClose(false);
|
|
16708
|
-
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16861
|
+
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16709
16862
|
// onSaveClick={saveCurrentChat}
|
|
16710
16863
|
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsx(Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
|
|
16711
16864
|
const convId = params?.conversation_id;
|