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.
|
@@ -36,6 +36,7 @@ declare const useCrossFilterCascading: ({ filters, fetchOptionsFn, initialSelect
|
|
|
36
36
|
loadingMap: {};
|
|
37
37
|
selectionsMap: {};
|
|
38
38
|
onFilterChange: (paramName: any, selectedValues: any) => void;
|
|
39
|
+
setSelectionSilent: (paramName: any, values: any) => void;
|
|
39
40
|
resetAll: () => void;
|
|
40
41
|
resetFilter: (paramName: any) => void;
|
|
41
42
|
fetchOptions: (paramName: any) => void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -33,8 +33,8 @@ var isArray$1 = require('lodash/isArray');
|
|
|
33
33
|
var isEmpty$1 = require('lodash/isEmpty');
|
|
34
34
|
var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
|
|
35
35
|
var conversationService = require('core/commonComponents/smartBot/services/conversation-service');
|
|
36
|
-
var AgGridComponent = require('core/Utils/
|
|
37
|
-
var agGridColumnFormatter = require('core/Utils/
|
|
36
|
+
var AgGridComponent = require('core/Utils/agGridV36');
|
|
37
|
+
var agGridColumnFormatter = require('core/Utils/agGridV36/columnFormatter');
|
|
38
38
|
var CoreChart = require('core/Utils/core-charts');
|
|
39
39
|
var makeStyles = require('@mui/styles/makeStyles');
|
|
40
40
|
var ChevronRightIcon$1 = require('@mui/icons-material/ChevronRight');
|
|
@@ -783,6 +783,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
783
783
|
isDisabled: data?.data?.isDisabled,
|
|
784
784
|
orientation: data?.data?.orientation,
|
|
785
785
|
options: data?.data?.options,
|
|
786
|
+
defaultSelected: data?.data?.defaultSelected,
|
|
786
787
|
paramName: data?.data?.param_name
|
|
787
788
|
}
|
|
788
789
|
};
|
|
@@ -6903,6 +6904,19 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
6903
6904
|
*/
|
|
6904
6905
|
const onFilterChange = React.useCallback((paramName, selectedValues) => {
|
|
6905
6906
|
const values = Array.isArray(selectedValues) ? selectedValues : [selectedValues];
|
|
6907
|
+
// Eagerly update the ref so that any code running synchronously after
|
|
6908
|
+
// this call (e.g. fetchUpstreamOptions) sees the latest selections
|
|
6909
|
+
// without waiting for the React state-updater to be flushed.
|
|
6910
|
+
// Also clear downstream selections when the filter is emptied, so the
|
|
6911
|
+
// ref doesn't carry stale downstream values into the next API call.
|
|
6912
|
+
const eagerUpdate = { ...selectionsRef.current, [paramName]: values };
|
|
6913
|
+
if (values.length === 0) {
|
|
6914
|
+
const downstreamFilters = getDownstreamFilters(paramName);
|
|
6915
|
+
downstreamFilters.forEach((f) => {
|
|
6916
|
+
eagerUpdate[getParamName(f)] = [];
|
|
6917
|
+
});
|
|
6918
|
+
}
|
|
6919
|
+
selectionsRef.current = eagerUpdate;
|
|
6906
6920
|
// Update selections
|
|
6907
6921
|
setSelectionsMap((prev) => {
|
|
6908
6922
|
const updated = { ...prev, [paramName]: values };
|
|
@@ -6942,6 +6956,18 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
6942
6956
|
}
|
|
6943
6957
|
}
|
|
6944
6958
|
}, [getDownstreamFilters, getParamName, fetchOptionsForFilter, onSelectionChange]);
|
|
6959
|
+
/**
|
|
6960
|
+
* Update a filter's selection without triggering downstream cascade clears.
|
|
6961
|
+
* Used by saved-filter hydration to clear stale selectionsMap entries for
|
|
6962
|
+
* fields the saved filter doesn't cover, without wiping downstream options.
|
|
6963
|
+
*/
|
|
6964
|
+
const setSelectionSilent = React.useCallback((paramName, values) => {
|
|
6965
|
+
setSelectionsMap((prev) => {
|
|
6966
|
+
const updated = { ...prev, [paramName]: values };
|
|
6967
|
+
selectionsRef.current = updated;
|
|
6968
|
+
return updated;
|
|
6969
|
+
});
|
|
6970
|
+
}, []);
|
|
6945
6971
|
/**
|
|
6946
6972
|
* Reset all filters — clears selections and re-fetches initial options
|
|
6947
6973
|
*/
|
|
@@ -7097,6 +7123,7 @@ const useCrossFilterCascading = ({ filters = [], fetchOptionsFn, initialSelectio
|
|
|
7097
7123
|
loadingMap,
|
|
7098
7124
|
selectionsMap,
|
|
7099
7125
|
onFilterChange,
|
|
7126
|
+
setSelectionSilent,
|
|
7100
7127
|
resetAll,
|
|
7101
7128
|
resetFilter,
|
|
7102
7129
|
fetchOptions,
|
|
@@ -7429,6 +7456,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7429
7456
|
const latestContext = chatbotContextRef.current;
|
|
7430
7457
|
const updatedContext = {
|
|
7431
7458
|
...latestContext,
|
|
7459
|
+
__fromSavedFilter: false,
|
|
7432
7460
|
[bodyText?.paramName]: {
|
|
7433
7461
|
...latestContext?.[bodyText?.paramName],
|
|
7434
7462
|
[bodyText?.paramName]: value,
|
|
@@ -7455,6 +7483,13 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7455
7483
|
const persisted = persistedFormValues?.[formKey];
|
|
7456
7484
|
if (!persisted || (Array.isArray(persisted) && persisted.length === 0)) {
|
|
7457
7485
|
setCurrentSelectedOptions([]);
|
|
7486
|
+
setIsAllSelected(false);
|
|
7487
|
+
selectAllCountRef.current = 0;
|
|
7488
|
+
}
|
|
7489
|
+
else if (chatbotContextRef.current?.__fromSavedFilter) {
|
|
7490
|
+
setCurrentSelectedOptions(persisted);
|
|
7491
|
+
setIsAllSelected(false);
|
|
7492
|
+
selectAllCountRef.current = 0;
|
|
7458
7493
|
}
|
|
7459
7494
|
}, [persistedFormValues, formKey]);
|
|
7460
7495
|
// When cross-filter context provides new options for this filter, update local state
|
|
@@ -7545,6 +7580,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7545
7580
|
const ctx1 = chatbotContextRef.current;
|
|
7546
7581
|
dispatch(smartBotActions.setChatbotContext({
|
|
7547
7582
|
...ctx1,
|
|
7583
|
+
__fromSavedFilter: false,
|
|
7548
7584
|
[bodyText?.paramName]: {
|
|
7549
7585
|
...ctx1?.[bodyText?.paramName],
|
|
7550
7586
|
[bodyText?.paramName]: [],
|
|
@@ -7555,6 +7591,9 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7555
7591
|
// Notify cross-filter context to clear downstream filters
|
|
7556
7592
|
if (isCascading) {
|
|
7557
7593
|
crossFilterCtx.onFilterChange(paramName, []);
|
|
7594
|
+
// Re-fetch upstream options so they are no longer narrowed
|
|
7595
|
+
// by this filter's previous selection
|
|
7596
|
+
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7558
7597
|
}
|
|
7559
7598
|
}, handleChange: (selected) => onChange(selected), isCloseWhenClickOutside: true, setIsOpen: (open) => {
|
|
7560
7599
|
setIsOpen(open);
|
|
@@ -7587,6 +7626,11 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7587
7626
|
}
|
|
7588
7627
|
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7589
7628
|
}
|
|
7629
|
+
else {
|
|
7630
|
+
// Selection was cleared — re-fetch upstream options so they are
|
|
7631
|
+
// no longer narrowed by this filter's previous selection
|
|
7632
|
+
crossFilterCtx.fetchUpstreamOptions(paramName);
|
|
7633
|
+
}
|
|
7590
7634
|
}
|
|
7591
7635
|
}
|
|
7592
7636
|
}, 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: () => {
|
|
@@ -7628,6 +7672,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7628
7672
|
const ctx2 = chatbotContextRef.current;
|
|
7629
7673
|
dispatch(smartBotActions.setChatbotContext({
|
|
7630
7674
|
...ctx2,
|
|
7675
|
+
__fromSavedFilter: false,
|
|
7631
7676
|
[bodyText?.paramName]: {
|
|
7632
7677
|
...ctx2?.[bodyText?.paramName],
|
|
7633
7678
|
[bodyText?.paramName]: valuesToDispatch,
|
|
@@ -7650,6 +7695,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7650
7695
|
const ctx3 = chatbotContextRef.current;
|
|
7651
7696
|
dispatch(smartBotActions.setChatbotContext({
|
|
7652
7697
|
...ctx3,
|
|
7698
|
+
__fromSavedFilter: false,
|
|
7653
7699
|
[bodyText?.paramName]: {
|
|
7654
7700
|
...ctx3?.[bodyText?.paramName],
|
|
7655
7701
|
[bodyText?.paramName]: [],
|
|
@@ -7852,13 +7898,36 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
|
|
|
7852
7898
|
const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
7853
7899
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7854
7900
|
const classes = useStyles$b();
|
|
7855
|
-
const { label, isDisabled, orientation, options } = bodyText;
|
|
7901
|
+
const { label, isDisabled, orientation, options, defaultSelected } = bodyText;
|
|
7856
7902
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7857
7903
|
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7858
7904
|
chatbotContextRef.current = chatbotContext;
|
|
7859
7905
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7860
7906
|
const dispatch = reactRedux.useDispatch();
|
|
7861
|
-
const [selectedOption, setSelectedOption] = React.useState(persistedFormValues[formKey] ?? null);
|
|
7907
|
+
const [selectedOption, setSelectedOption] = React.useState(persistedFormValues[formKey] ?? defaultSelected ?? null);
|
|
7908
|
+
// When a defaultSelected value is provided and nothing was previously persisted,
|
|
7909
|
+
// seed Redux state so submit-validation and context are aware of the pre-selection.
|
|
7910
|
+
// Uses getState inside a thunk to read the latest chatbotContext at dispatch time,
|
|
7911
|
+
// avoiding stale-ref overwrites when multiple radio widgets mount in the same flush.
|
|
7912
|
+
React.useEffect(() => {
|
|
7913
|
+
if (defaultSelected && !persistedFormValues[formKey]) {
|
|
7914
|
+
dispatch((dispatchAction, getState) => {
|
|
7915
|
+
const currentContext = getState().smartBotReducer.chatbotContext;
|
|
7916
|
+
dispatchAction({
|
|
7917
|
+
type: "SET_CHATBOT_CONTEXT",
|
|
7918
|
+
payload: {
|
|
7919
|
+
...currentContext,
|
|
7920
|
+
[bodyText?.paramName]: {
|
|
7921
|
+
...currentContext?.[bodyText?.paramName],
|
|
7922
|
+
[bodyText?.paramName]: defaultSelected,
|
|
7923
|
+
updated: true,
|
|
7924
|
+
},
|
|
7925
|
+
},
|
|
7926
|
+
});
|
|
7927
|
+
});
|
|
7928
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: defaultSelected }));
|
|
7929
|
+
}
|
|
7930
|
+
}, []);
|
|
7862
7931
|
if (lodash.isEmpty(bodyText))
|
|
7863
7932
|
return null;
|
|
7864
7933
|
const handleChange = (selectedOption) => {
|
|
@@ -7938,6 +8007,55 @@ const ImageContent = ({ bodyText }) => {
|
|
|
7938
8007
|
|
|
7939
8008
|
// Key used to persist timeout state in sessionStorage (survives component remounts from tab switches)
|
|
7940
8009
|
const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
8010
|
+
/**
|
|
8011
|
+
* Renderless bridge component that lives inside CrossFilterProvider.
|
|
8012
|
+
* Watches for saved filter selection changes and programmatically triggers
|
|
8013
|
+
* the cross-filter cascading system so downstream fields get their options.
|
|
8014
|
+
*/
|
|
8015
|
+
const SavedFilterCascadeBridge = ({ chatbotContext, crossFilterConfigs }) => {
|
|
8016
|
+
const crossFilterCtx = useCrossFilterContext();
|
|
8017
|
+
const prevSelectionRef = React.useRef(null);
|
|
8018
|
+
React.useEffect(() => {
|
|
8019
|
+
if (!crossFilterCtx?.isEnabled)
|
|
8020
|
+
return;
|
|
8021
|
+
const isFromSaved = chatbotContext?.__fromSavedFilter === true;
|
|
8022
|
+
if (!isFromSaved) {
|
|
8023
|
+
prevSelectionRef.current = null;
|
|
8024
|
+
return;
|
|
8025
|
+
}
|
|
8026
|
+
// Derive a stable key from the saved filter selection to detect switches
|
|
8027
|
+
const currentSelection = chatbotContext?.__savedFilterSelection;
|
|
8028
|
+
const selectionKey = Array.isArray(currentSelection)
|
|
8029
|
+
? currentSelection[0]?.value
|
|
8030
|
+
: currentSelection?.value;
|
|
8031
|
+
// Skip if this is the same saved filter we already processed
|
|
8032
|
+
if (selectionKey === prevSelectionRef.current)
|
|
8033
|
+
return;
|
|
8034
|
+
prevSelectionRef.current = selectionKey;
|
|
8035
|
+
// Set cascading selections for fields the saved filter covers.
|
|
8036
|
+
// For unmatched fields, silently clear selectionsMap without triggering
|
|
8037
|
+
// downstream cascade wipes (which would blank option lists).
|
|
8038
|
+
let lastMatchingParam = null;
|
|
8039
|
+
crossFilterConfigs.forEach((cfg) => {
|
|
8040
|
+
const ctx = chatbotContext[cfg.paramName];
|
|
8041
|
+
if (ctx && ctx.updated && Array.isArray(ctx[cfg.paramName]) && ctx[cfg.paramName].length > 0) {
|
|
8042
|
+
crossFilterCtx.onFilterChange(cfg.paramName, ctx[cfg.paramName]);
|
|
8043
|
+
lastMatchingParam = cfg.paramName;
|
|
8044
|
+
}
|
|
8045
|
+
else {
|
|
8046
|
+
// Clear stale selectionsMap entry without cascade
|
|
8047
|
+
crossFilterCtx.setSelectionSilent(cfg.paramName, []);
|
|
8048
|
+
}
|
|
8049
|
+
});
|
|
8050
|
+
// Fetch downstream options for the lowest matched filter
|
|
8051
|
+
if (lastMatchingParam) {
|
|
8052
|
+
setTimeout(() => {
|
|
8053
|
+
crossFilterCtx.fetchDownstreamOptions(lastMatchingParam);
|
|
8054
|
+
}, 100);
|
|
8055
|
+
}
|
|
8056
|
+
}, [chatbotContext?.__fromSavedFilter, chatbotContext?.__savedFilterSelection]);
|
|
8057
|
+
return null;
|
|
8058
|
+
};
|
|
7941
8059
|
/**
|
|
7942
8060
|
* Renders form widget data inline within a step.
|
|
7943
8061
|
* Reuses the same rendering logic as CombinedContent but designed
|
|
@@ -8014,13 +8132,14 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8014
8132
|
setFilterSetCurrentOptions(opts);
|
|
8015
8133
|
return opts;
|
|
8016
8134
|
}, [savedFilterSets]);
|
|
8017
|
-
|
|
8135
|
+
Array.isArray(selectedFilterSet) ? selectedFilterSet.length > 0 : !!selectedFilterSet && Object.keys(selectedFilterSet).length > 0;
|
|
8018
8136
|
const onFilterSetChange = React.useCallback((selected) => {
|
|
8019
8137
|
try {
|
|
8020
8138
|
const selectedValue = Array.isArray(selected) ? selected[0]?.value : selected?.value;
|
|
8021
8139
|
if (!selectedValue) {
|
|
8022
|
-
|
|
8023
|
-
|
|
8140
|
+
// Only remove saved filter flags; keep dropdown values and persisted state intact
|
|
8141
|
+
const { __fromSavedFilter, __savedFilterSelection, ...rest } = chatbotContext || {};
|
|
8142
|
+
dispatch(smartBotActions.setChatbotContext(rest));
|
|
8024
8143
|
return;
|
|
8025
8144
|
}
|
|
8026
8145
|
const fullFilterObj = (savedFilterSets || []).find((f) => (f.fuc_code || f.name || f.label) === selectedValue);
|
|
@@ -8049,15 +8168,51 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8049
8168
|
};
|
|
8050
8169
|
}
|
|
8051
8170
|
});
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8171
|
+
// Merge into existing context to preserve non-select field values (dates, inputs, sliders).
|
|
8172
|
+
// Clear all select fields first, then overlay saved filter values.
|
|
8173
|
+
const mergedContext = { ...(chatbotContext || {}) };
|
|
8174
|
+
(formData || []).forEach((item) => {
|
|
8175
|
+
const pName = item?.data?.param_name;
|
|
8176
|
+
if (!pName || item?.type !== "select")
|
|
8177
|
+
return;
|
|
8178
|
+
mergedContext[pName] = { [pName]: [], updated: false };
|
|
8179
|
+
});
|
|
8180
|
+
Object.keys(newContext).forEach((key) => {
|
|
8181
|
+
mergedContext[key] = newContext[key];
|
|
8182
|
+
});
|
|
8183
|
+
mergedContext.__fromSavedFilter = true;
|
|
8184
|
+
mergedContext.__savedFilterSelection = selected;
|
|
8185
|
+
dispatch(smartBotActions.setChatbotContext(mergedContext));
|
|
8186
|
+
// Build persisted values for ALL form select fields.
|
|
8187
|
+
// Matching fields get the saved filter values; unmatched fields get [] (cleared).
|
|
8188
|
+
const formPersisted = {};
|
|
8189
|
+
(formData || []).forEach((item) => {
|
|
8190
|
+
const pName = item?.data?.param_name;
|
|
8191
|
+
if (!pName || item?.type !== "select")
|
|
8192
|
+
return;
|
|
8193
|
+
const key = `${messageIndex}_${pName}`;
|
|
8194
|
+
const selectAllKey = `${key}__selectAllCount`;
|
|
8195
|
+
if (newContext[pName] && newContext[pName][pName]) {
|
|
8196
|
+
const values = newContext[pName][pName];
|
|
8197
|
+
formPersisted[key] = values.map((v) => ({
|
|
8198
|
+
label: v,
|
|
8199
|
+
value: v,
|
|
8200
|
+
}));
|
|
8201
|
+
}
|
|
8202
|
+
else {
|
|
8203
|
+
// Clear fields not covered by the saved filter
|
|
8204
|
+
formPersisted[key] = [];
|
|
8205
|
+
}
|
|
8206
|
+
// Always reset select-all count when a saved filter is applied
|
|
8207
|
+
formPersisted[selectAllKey] = 0;
|
|
8208
|
+
});
|
|
8209
|
+
dispatch(smartBotActions.setPersistedFormValues(formPersisted));
|
|
8055
8210
|
}
|
|
8056
8211
|
catch (error) {
|
|
8057
8212
|
console.error("[StepFormContent] onFilterSetChange error:", error);
|
|
8058
8213
|
}
|
|
8059
|
-
}, [savedFilterSets, dispatch]);
|
|
8060
|
-
|
|
8214
|
+
}, [savedFilterSets, dispatch, formData, messageIndex, chatbotContext]);
|
|
8215
|
+
React.useMemo(() => {
|
|
8061
8216
|
if (!persistedFormValues)
|
|
8062
8217
|
return false;
|
|
8063
8218
|
const prefix = `${messageIndex}_`;
|
|
@@ -8068,8 +8223,8 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8068
8223
|
return val && (Array.isArray(val) ? val.length > 0 : !!val);
|
|
8069
8224
|
});
|
|
8070
8225
|
}, [persistedFormValues, messageIndex]);
|
|
8071
|
-
const formFieldsDisabled = isFormDisabled ||
|
|
8072
|
-
const savedFilterDisabled = isFormDisabled ||
|
|
8226
|
+
const formFieldsDisabled = isFormDisabled || isFormSubmitted || isTimedOut;
|
|
8227
|
+
const savedFilterDisabled = isFormDisabled || isFormSubmitted || isTimedOut;
|
|
8073
8228
|
const requiredFieldsFilled = React.useMemo(() => {
|
|
8074
8229
|
if (!formData || !Array.isArray(formData))
|
|
8075
8230
|
return false;
|
|
@@ -8309,9 +8464,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
8309
8464
|
});
|
|
8310
8465
|
if (formFields.length === 0 && buttonItems.length === 0)
|
|
8311
8466
|
return null;
|
|
8312
|
-
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", {
|
|
8313
|
-
...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
|
|
8314
|
-
}, 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] }));
|
|
8467
|
+
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", { children: crossFilterConfigs.length >= 1 ? (jsxRuntime.jsxs(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: [jsxRuntime.jsx(SavedFilterCascadeBridge, { chatbotContext: chatbotContext, crossFilterConfigs: crossFilterConfigs }), formFields] })) : (formFields) }), buttonItems] }));
|
|
8315
8468
|
};
|
|
8316
8469
|
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
8317
8470
|
const resetStepFormTimeoutFlag = () => {
|
|
@@ -16580,7 +16733,7 @@ const SmartBot = (props) => {
|
|
|
16580
16733
|
}
|
|
16581
16734
|
}, [forceOpen]);
|
|
16582
16735
|
const [historyPanelData, setHistoryPanelData] = React.useState([]);
|
|
16583
|
-
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);
|
|
16736
|
+
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);
|
|
16584
16737
|
const handleHistoryMenuAction = React.useCallback(async (action, conversationData) => {
|
|
16585
16738
|
const conversationId = conversationData?.conversation_id;
|
|
16586
16739
|
if (!conversationId)
|
|
@@ -16727,7 +16880,7 @@ const SmartBot = (props) => {
|
|
|
16727
16880
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsxRuntime.jsx(MinimizedChatWidget, { onExpand: () => {
|
|
16728
16881
|
setShowModal(true);
|
|
16729
16882
|
setPartialClose(false);
|
|
16730
|
-
} })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16883
|
+
} })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16731
16884
|
// onSaveClick={saveCurrentChat}
|
|
16732
16885
|
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
|
|
16733
16886
|
const convId = params?.conversation_id;
|