impact-chatbot 2.3.65 → 2.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js
CHANGED
|
@@ -337,7 +337,7 @@ const useBotConfiguration = (setRefreshLoader, setEnableRefreshAction, dispatch)
|
|
|
337
337
|
*/
|
|
338
338
|
const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAndName = false, sessionId = "", utilityData = {}, inputBody = null, utilityObject = {}) => {
|
|
339
339
|
const timeString = disableTimeAndName ? "" : moment().format("DD-MM-YYYY HH:mm:ss");
|
|
340
|
-
const userName = disableTimeAndName ? "" : "
|
|
340
|
+
const userName = disableTimeAndName ? "" : "Iris";
|
|
341
341
|
switch (type || data?.type) {
|
|
342
342
|
case "text":
|
|
343
343
|
return {
|
|
@@ -493,7 +493,8 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
493
493
|
minDate: data?.data?.minDate,
|
|
494
494
|
maxDate: data?.data?.maxDate,
|
|
495
495
|
isDisabled: data?.data?.isDisabled,
|
|
496
|
-
paramName: data?.data?.param_name
|
|
496
|
+
paramName: data?.data?.param_name,
|
|
497
|
+
minStartDate: data?.data?.minStartDate
|
|
497
498
|
}
|
|
498
499
|
};
|
|
499
500
|
case "dateRangePicker":
|
|
@@ -513,7 +514,8 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
513
514
|
maxDate: data?.data?.maxDate,
|
|
514
515
|
isDisabled: data?.data?.isDisabled,
|
|
515
516
|
showMonthYearSelect: data?.data?.showMonthYearSelect,
|
|
516
|
-
paramName: data?.data?.param_name
|
|
517
|
+
paramName: data?.data?.param_name,
|
|
518
|
+
minStartDate: data?.data?.minStartDate
|
|
517
519
|
}
|
|
518
520
|
};
|
|
519
521
|
case "checkbox":
|
|
@@ -1414,7 +1416,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1414
1416
|
hasDirectActionType: false,
|
|
1415
1417
|
};
|
|
1416
1418
|
const loaderData = {
|
|
1417
|
-
userName: "
|
|
1419
|
+
userName: "Iris",
|
|
1418
1420
|
timeStamp: currentTimeString,
|
|
1419
1421
|
userType: "loader",
|
|
1420
1422
|
};
|
|
@@ -1980,7 +1982,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1980
1982
|
const failResponseText = {
|
|
1981
1983
|
timeStamp: getCurrentDateTimeString(),
|
|
1982
1984
|
userType: "bot",
|
|
1983
|
-
userName: "
|
|
1985
|
+
userName: "Iris",
|
|
1984
1986
|
bodyText: error?.response?.data?.data?.error?.response
|
|
1985
1987
|
? error?.response?.data?.data?.error?.response
|
|
1986
1988
|
: "Sorry, chatbot is not available now",
|
|
@@ -2224,7 +2226,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2224
2226
|
return {
|
|
2225
2227
|
timeStamp: timeString,
|
|
2226
2228
|
userType: "bot",
|
|
2227
|
-
userName: "
|
|
2229
|
+
userName: "Iris",
|
|
2228
2230
|
headerTitle: headerTitle,
|
|
2229
2231
|
bodyType: "chips",
|
|
2230
2232
|
bodyText: screens.map((screen) => ({
|
|
@@ -2278,7 +2280,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2278
2280
|
flow_type: flowType,
|
|
2279
2281
|
};
|
|
2280
2282
|
const loaderData = {
|
|
2281
|
-
userName: "
|
|
2283
|
+
userName: "Iris",
|
|
2282
2284
|
timeStamp: currentTimeString,
|
|
2283
2285
|
userType: "loader",
|
|
2284
2286
|
};
|
|
@@ -2312,7 +2314,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2312
2314
|
const failResponseText = {
|
|
2313
2315
|
timeStamp: getCurrentDateTimeString(),
|
|
2314
2316
|
userType: "bot",
|
|
2315
|
-
userName: "
|
|
2317
|
+
userName: "Iris",
|
|
2316
2318
|
bodyText: options.data.data.message,
|
|
2317
2319
|
enableLikes: false,
|
|
2318
2320
|
headerTitle: "",
|
|
@@ -2331,7 +2333,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2331
2333
|
const failResponseText = {
|
|
2332
2334
|
timeStamp: getCurrentDateTimeString(),
|
|
2333
2335
|
userType: "bot",
|
|
2334
|
-
userName: "
|
|
2336
|
+
userName: "Iris",
|
|
2335
2337
|
bodyText: "Failed to fetch user screens. Please try again later.",
|
|
2336
2338
|
headerTitle: "",
|
|
2337
2339
|
enableLikes: false,
|
|
@@ -2403,7 +2405,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2403
2405
|
hasDirectActionType: fetchQuestions,
|
|
2404
2406
|
};
|
|
2405
2407
|
const loaderData = {
|
|
2406
|
-
userName: "
|
|
2408
|
+
userName: "Iris",
|
|
2407
2409
|
timeStamp: currentTimeString,
|
|
2408
2410
|
userType: "loader",
|
|
2409
2411
|
};
|
|
@@ -2523,7 +2525,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2523
2525
|
const failResponseText = {
|
|
2524
2526
|
timeStamp: getCurrentDateTimeString(),
|
|
2525
2527
|
userType: "bot",
|
|
2526
|
-
userName: "
|
|
2528
|
+
userName: "Iris",
|
|
2527
2529
|
bodyText: error?.response?.data?.data?.error?.response
|
|
2528
2530
|
? error?.response?.data?.data?.error?.response
|
|
2529
2531
|
: "Sorry, chatbot is not available now",
|
|
@@ -2734,10 +2736,10 @@ const useChatSession = (chatDataRef, setFlowType, setScreenName, setUserInput, s
|
|
|
2734
2736
|
{
|
|
2735
2737
|
timeStamp: getCurrentDateTimeString(),
|
|
2736
2738
|
userType: "bot",
|
|
2737
|
-
userName: "
|
|
2739
|
+
userName: "Iris",
|
|
2738
2740
|
headerTitle: `Hi ${getUserName()}!`,
|
|
2739
2741
|
bodyType: "text",
|
|
2740
|
-
bodyText: `I am
|
|
2742
|
+
bodyText: `I am Iris, your virtual assistant. I am here to help you on anything you are looking for in IA Smart Platform`,
|
|
2741
2743
|
},
|
|
2742
2744
|
];
|
|
2743
2745
|
// chatDataRef.current[currentMode].conversations[
|
|
@@ -4903,7 +4905,7 @@ const ChatPlaceholder = (props) => {
|
|
|
4903
4905
|
agentId: card.agentId || card.id
|
|
4904
4906
|
}));
|
|
4905
4907
|
const dataToMap = legacyAgentScreen || displayQuestions ? transformedCardList : rectangleData;
|
|
4906
|
-
return (jsxRuntime.jsxs("div", { className: classes.placeholderContainer, children: [jsxRuntime.jsx("div", { className: classes.centerIconContainer, children: jsxRuntime.jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsxRuntime.jsxs("div", { className: classes.headingContainer, children: [jsxRuntime.jsx(material.Typography, { variant: "h1", className: classes.heading, children: "
|
|
4908
|
+
return (jsxRuntime.jsxs("div", { className: classes.placeholderContainer, children: [jsxRuntime.jsx("div", { className: classes.centerIconContainer, children: jsxRuntime.jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsxRuntime.jsxs("div", { className: classes.headingContainer, children: [jsxRuntime.jsx(material.Typography, { variant: "h1", className: classes.heading, children: "Iris's Capabilities" }), jsxRuntime.jsx("span", { className: classes.alphaTag, children: "Beta" })] }), jsxRuntime.jsx(material.Typography, { variant: "body1", className: classes.headingHelperText, children: "Discover potential issues & opportunities Iris can help you with!" }), jsxRuntime.jsx("div", { className: classes.rectanglesContainer, children: dataToMap.map((item, index) => (jsxRuntime.jsx(Rectangle, { type: item.type, icon: item.icon, title: item.title, description: item.description, onClick: () => handleRectangleClick(item?.agentId, item?.title), hoverable: legacyAgentScreen || displayQuestions }, index))) })] }));
|
|
4907
4909
|
};
|
|
4908
4910
|
|
|
4909
4911
|
const dateFormat = "DD-MM-YYYY HH:mm:ss";
|
|
@@ -5887,8 +5889,10 @@ const TableContent = ({ bodyText }) => {
|
|
|
5887
5889
|
const onSelectionChanged = (event) => {
|
|
5888
5890
|
try {
|
|
5889
5891
|
const selectedList = event.api.getSelectedRows();
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
5893
|
+
...chatbotContext,
|
|
5894
|
+
tables: { ...chatbotContext?.tables, [table_name]: selectedList },
|
|
5895
|
+
}));
|
|
5892
5896
|
}
|
|
5893
5897
|
catch (error) {
|
|
5894
5898
|
console.error("Error in onSelectionChanged", error);
|
|
@@ -6731,12 +6735,14 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6731
6735
|
const handleChange = (value) => {
|
|
6732
6736
|
try {
|
|
6733
6737
|
setSliderValue(value?.target?.value);
|
|
6734
|
-
|
|
6735
|
-
...chatbotContext
|
|
6736
|
-
[bodyText?.paramName]:
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6738
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
6739
|
+
...chatbotContext,
|
|
6740
|
+
[bodyText?.paramName]: {
|
|
6741
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6742
|
+
[bodyText?.paramName]: value?.target?.value,
|
|
6743
|
+
updated: true,
|
|
6744
|
+
},
|
|
6745
|
+
}));
|
|
6740
6746
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: value?.target?.value }));
|
|
6741
6747
|
}
|
|
6742
6748
|
catch (error) {
|
|
@@ -6783,17 +6789,20 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6783
6789
|
else {
|
|
6784
6790
|
value = selectedOptions.value;
|
|
6785
6791
|
}
|
|
6786
|
-
|
|
6787
|
-
...chatbotContext
|
|
6788
|
-
[bodyText?.paramName]:
|
|
6789
|
-
|
|
6792
|
+
const updatedContext = {
|
|
6793
|
+
...chatbotContext,
|
|
6794
|
+
[bodyText?.paramName]: {
|
|
6795
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6796
|
+
[bodyText?.paramName]: value,
|
|
6797
|
+
updated: true,
|
|
6798
|
+
},
|
|
6790
6799
|
};
|
|
6791
6800
|
// chatbotContext.select = {
|
|
6792
6801
|
// ...chatbotContext?.select,
|
|
6793
6802
|
// [bodyText?.paramName]: selectedOptions,
|
|
6794
6803
|
// updated: true
|
|
6795
6804
|
// };
|
|
6796
|
-
dispatch(smartBotActions.setChatbotContext(
|
|
6805
|
+
dispatch(smartBotActions.setChatbotContext(updatedContext));
|
|
6797
6806
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: Array.isArray(selectedOptions) ? selectedOptions : [selectedOptions] }));
|
|
6798
6807
|
// Notify cross-filter context if cascading is active
|
|
6799
6808
|
if (isCascading) {
|
|
@@ -6833,12 +6842,14 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6833
6842
|
setCurrentSelectedOptions([]);
|
|
6834
6843
|
setIsAllSelected(false);
|
|
6835
6844
|
// Also clear from chatbotContext and persistedFormValues
|
|
6836
|
-
|
|
6837
|
-
...chatbotContext
|
|
6838
|
-
[bodyText?.paramName]:
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6845
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
6846
|
+
...chatbotContext,
|
|
6847
|
+
[bodyText?.paramName]: {
|
|
6848
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6849
|
+
[bodyText?.paramName]: [],
|
|
6850
|
+
updated: true,
|
|
6851
|
+
},
|
|
6852
|
+
}));
|
|
6842
6853
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [] }));
|
|
6843
6854
|
}
|
|
6844
6855
|
}
|
|
@@ -6858,12 +6869,14 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6858
6869
|
isRequired: isRequired, isDisabled: isDisabled || isFormDisabled, isClearable: !(isDisabled || isFormDisabled), onClearAll: () => {
|
|
6859
6870
|
setCurrentSelectedOptions([]);
|
|
6860
6871
|
setIsAllSelected(false);
|
|
6861
|
-
|
|
6862
|
-
...chatbotContext
|
|
6863
|
-
[bodyText?.paramName]:
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6872
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
6873
|
+
...chatbotContext,
|
|
6874
|
+
[bodyText?.paramName]: {
|
|
6875
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6876
|
+
[bodyText?.paramName]: [],
|
|
6877
|
+
updated: true,
|
|
6878
|
+
},
|
|
6879
|
+
}));
|
|
6867
6880
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [] }));
|
|
6868
6881
|
// Notify cross-filter context to clear downstream filters
|
|
6869
6882
|
if (isCascading) {
|
|
@@ -6914,12 +6927,14 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
6914
6927
|
setCurrentSelectedOptions([...currentOptions]);
|
|
6915
6928
|
setIsAllSelected(true);
|
|
6916
6929
|
const allValues = allOptionsRef.current.map((opt) => opt.value);
|
|
6917
|
-
|
|
6918
|
-
...chatbotContext
|
|
6919
|
-
[bodyText?.paramName]:
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6930
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
6931
|
+
...chatbotContext,
|
|
6932
|
+
[bodyText?.paramName]: {
|
|
6933
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6934
|
+
[bodyText?.paramName]: allValues,
|
|
6935
|
+
updated: true,
|
|
6936
|
+
},
|
|
6937
|
+
}));
|
|
6923
6938
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: currentOptions }));
|
|
6924
6939
|
// Notify cross-filter context if cascading is active
|
|
6925
6940
|
if (isCascading) {
|
|
@@ -6951,12 +6966,14 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
|
|
|
6951
6966
|
const handleDateChange = (date) => {
|
|
6952
6967
|
try {
|
|
6953
6968
|
setSelectedDate(date);
|
|
6954
|
-
|
|
6955
|
-
...chatbotContext
|
|
6956
|
-
[bodyText?.paramName]:
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6969
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
6970
|
+
...chatbotContext,
|
|
6971
|
+
[bodyText?.paramName]: {
|
|
6972
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
6973
|
+
[bodyText?.paramName]: moment(date).format(displayFormat),
|
|
6974
|
+
updated: true,
|
|
6975
|
+
},
|
|
6976
|
+
}));
|
|
6960
6977
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: date }));
|
|
6961
6978
|
}
|
|
6962
6979
|
catch (error) {
|
|
@@ -6990,15 +7007,17 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
|
|
|
6990
7007
|
try {
|
|
6991
7008
|
setStartDate(start);
|
|
6992
7009
|
setEndDate(end);
|
|
6993
|
-
|
|
6994
|
-
...chatbotContext
|
|
7010
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
7011
|
+
...chatbotContext,
|
|
6995
7012
|
[bodyText?.paramName]: {
|
|
6996
|
-
|
|
6997
|
-
|
|
7013
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7014
|
+
[bodyText?.paramName]: {
|
|
7015
|
+
startDate: start ? moment(start).format(displayFormat) : null,
|
|
7016
|
+
endDate: end ? moment(end).format(displayFormat) : null,
|
|
7017
|
+
},
|
|
7018
|
+
updated: true,
|
|
6998
7019
|
},
|
|
6999
|
-
|
|
7000
|
-
};
|
|
7001
|
-
dispatch(smartBotActions.setChatbotContext(chatbotContext));
|
|
7020
|
+
}));
|
|
7002
7021
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: { startDate: start, endDate: end } }));
|
|
7003
7022
|
}
|
|
7004
7023
|
catch (error) {
|
|
@@ -7039,12 +7058,14 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
|
|
|
7039
7058
|
// [bodyText?.paramName]: isChecked?.currentTarget?.checked,
|
|
7040
7059
|
// updated: true
|
|
7041
7060
|
// };
|
|
7042
|
-
|
|
7043
|
-
...chatbotContext
|
|
7044
|
-
[bodyText?.paramName]:
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7061
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
7062
|
+
...chatbotContext,
|
|
7063
|
+
[bodyText?.paramName]: {
|
|
7064
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7065
|
+
[bodyText?.paramName]: isChecked?.currentTarget?.checked,
|
|
7066
|
+
updated: true,
|
|
7067
|
+
},
|
|
7068
|
+
}));
|
|
7048
7069
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: isChecked?.currentTarget?.checked }));
|
|
7049
7070
|
}
|
|
7050
7071
|
catch (error) {
|
|
@@ -7073,12 +7094,14 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7073
7094
|
// [bodyText?.paramName]: value,
|
|
7074
7095
|
// updated: true,
|
|
7075
7096
|
// };
|
|
7076
|
-
|
|
7077
|
-
...chatbotContext
|
|
7078
|
-
[bodyText?.paramName]:
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7097
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
7098
|
+
...chatbotContext,
|
|
7099
|
+
[bodyText?.paramName]: {
|
|
7100
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7101
|
+
[bodyText?.paramName]: value,
|
|
7102
|
+
updated: true,
|
|
7103
|
+
},
|
|
7104
|
+
}));
|
|
7082
7105
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: value }));
|
|
7083
7106
|
}
|
|
7084
7107
|
catch (error) {
|
|
@@ -7101,13 +7124,15 @@ const InputContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
7101
7124
|
try {
|
|
7102
7125
|
const newValue = event?.target?.value || event?.currentTarget?.value || "";
|
|
7103
7126
|
setValue(newValue);
|
|
7104
|
-
|
|
7105
|
-
...chatbotContext
|
|
7106
|
-
[bodyText?.paramName]:
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7127
|
+
dispatch(smartBotActions.setChatbotContext({
|
|
7128
|
+
...chatbotContext,
|
|
7129
|
+
[bodyText?.paramName]: {
|
|
7130
|
+
...chatbotContext?.[bodyText?.paramName],
|
|
7131
|
+
[bodyText?.paramName]: replaceSpecialCharToCharCode(newValue),
|
|
7132
|
+
updated: true,
|
|
7133
|
+
type: inputType,
|
|
7134
|
+
},
|
|
7135
|
+
}));
|
|
7111
7136
|
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValue }));
|
|
7112
7137
|
}
|
|
7113
7138
|
catch (error) {
|
|
@@ -7131,6 +7156,8 @@ const ImageContent = ({ bodyText }) => {
|
|
|
7131
7156
|
} })), caption && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(TextRenderer, { text: caption }) }))] }));
|
|
7132
7157
|
};
|
|
7133
7158
|
|
|
7159
|
+
// Key used to persist timeout state in sessionStorage (survives component remounts from tab switches)
|
|
7160
|
+
const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
7134
7161
|
/**
|
|
7135
7162
|
* Renders form widget data inline within a step.
|
|
7136
7163
|
* Reuses the same rendering logic as CombinedContent but designed
|
|
@@ -7149,16 +7176,49 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7149
7176
|
const chatbotFilterOptions = reactRedux.useSelector((state) => state.smartBotReducer.chatbotFilterOptions);
|
|
7150
7177
|
const dimensionHierarchies = reactRedux.useSelector((state) => state.userRoleManagementService?.dimensionHierarchies);
|
|
7151
7178
|
const [isFormSubmitted, setIsFormSubmitted] = React.useState(false);
|
|
7179
|
+
const [isTimedOut, setIsTimedOut] = React.useState(() => sessionStorage.getItem(STEP_FORM_TIMEOUT_KEY) === "true");
|
|
7180
|
+
const timeoutRef = React.useRef(null);
|
|
7181
|
+
const prevIsFormDisabledRef = React.useRef(isFormDisabled);
|
|
7182
|
+
// 30-minute inactivity timeout: disable form and switch to agent_response tab
|
|
7183
|
+
const FORM_TIMEOUT_MS = 30 * 60 * 1000;
|
|
7184
|
+
React.useEffect(() => {
|
|
7185
|
+
if (isFormDisabled || isFormSubmitted || isTimedOut)
|
|
7186
|
+
return;
|
|
7187
|
+
const startTime = Date.now();
|
|
7188
|
+
timeoutRef.current = setTimeout(() => {
|
|
7189
|
+
setIsTimedOut(true);
|
|
7190
|
+
sessionStorage.setItem(STEP_FORM_TIMEOUT_KEY, "true");
|
|
7191
|
+
const elapsedSeconds = Math.floor((Date.now() - startTime) / 1000);
|
|
7192
|
+
window.dispatchEvent(new CustomEvent("stepFormTimeout", { detail: { elapsedSeconds } }));
|
|
7193
|
+
}, FORM_TIMEOUT_MS);
|
|
7194
|
+
return () => {
|
|
7195
|
+
if (timeoutRef.current) {
|
|
7196
|
+
clearTimeout(timeoutRef.current);
|
|
7197
|
+
timeoutRef.current = null;
|
|
7198
|
+
}
|
|
7199
|
+
};
|
|
7200
|
+
}, [isFormDisabled, isFormSubmitted, isTimedOut]);
|
|
7201
|
+
// Clear timeout when form is submitted
|
|
7202
|
+
React.useEffect(() => {
|
|
7203
|
+
if (isFormSubmitted && timeoutRef.current) {
|
|
7204
|
+
clearTimeout(timeoutRef.current);
|
|
7205
|
+
timeoutRef.current = null;
|
|
7206
|
+
}
|
|
7207
|
+
}, [isFormSubmitted]);
|
|
7152
7208
|
React.useEffect(() => {
|
|
7153
7209
|
if (stepFormStreamData?.status === "streaming_start") {
|
|
7154
7210
|
setIsFormSubmitted(true);
|
|
7155
7211
|
}
|
|
7156
7212
|
}, [stepFormStreamData]);
|
|
7157
|
-
// Reset isFormSubmitted when parent signals the form should be enabled (new step_form from restream)
|
|
7213
|
+
// Reset isFormSubmitted and isTimedOut when parent signals the form should be enabled (new step_form from restream)
|
|
7214
|
+
// Only reset on a true→false TRANSITION (not on initial mount)
|
|
7158
7215
|
React.useEffect(() => {
|
|
7159
|
-
if (!isFormDisabled) {
|
|
7216
|
+
if (prevIsFormDisabledRef.current && !isFormDisabled) {
|
|
7160
7217
|
setIsFormSubmitted(false);
|
|
7218
|
+
setIsTimedOut(false);
|
|
7219
|
+
sessionStorage.removeItem(STEP_FORM_TIMEOUT_KEY);
|
|
7161
7220
|
}
|
|
7221
|
+
prevIsFormDisabledRef.current = isFormDisabled;
|
|
7162
7222
|
}, [isFormDisabled]);
|
|
7163
7223
|
const [isFilterSetOpen, setIsFilterSetOpen] = React.useState(false);
|
|
7164
7224
|
const [selectedFilterSet, setSelectedFilterSet] = React.useState(() => {
|
|
@@ -7228,16 +7288,54 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7228
7288
|
return val && (Array.isArray(val) ? val.length > 0 : !!val);
|
|
7229
7289
|
});
|
|
7230
7290
|
}, [persistedFormValues, messageIndex]);
|
|
7231
|
-
const formFieldsDisabled = isFormDisabled || isFilterSelected || isFormSubmitted;
|
|
7232
|
-
const savedFilterDisabled = isFormDisabled || isFormFieldUsed || isFormSubmitted;
|
|
7291
|
+
const formFieldsDisabled = isFormDisabled || isFilterSelected || isFormSubmitted || isTimedOut;
|
|
7292
|
+
const savedFilterDisabled = isFormDisabled || isFormFieldUsed || isFormSubmitted || isTimedOut;
|
|
7233
7293
|
const requiredFieldsFilled = React.useMemo(() => {
|
|
7234
7294
|
if (!formData || !Array.isArray(formData))
|
|
7235
7295
|
return false;
|
|
7296
|
+
// Only validate fields that are both isRequired AND of a type that visually
|
|
7297
|
+
// shows the mandatory indicator (*) to the user (currently only "select" fields).
|
|
7236
7298
|
const requiredParams = formData
|
|
7237
|
-
.filter((item) => item?.data?.isRequired)
|
|
7299
|
+
.filter((item) => item?.data?.isRequired && item?.data?.is_mandatory)
|
|
7238
7300
|
.map((item) => item.data.param_name);
|
|
7239
|
-
if (requiredParams.length === 0)
|
|
7240
|
-
|
|
7301
|
+
if (requiredParams.length === 0) {
|
|
7302
|
+
// Fallback: if no field has is_mandatory, check select-type fields with isRequired
|
|
7303
|
+
const selectRequiredParams = formData
|
|
7304
|
+
.filter((item) => item?.type === "select" && item?.data?.isRequired)
|
|
7305
|
+
.map((item) => item.data.param_name);
|
|
7306
|
+
if (selectRequiredParams.length === 0) {
|
|
7307
|
+
// No mandatory fields at all — require at least one field to be filled
|
|
7308
|
+
const allParams = formData
|
|
7309
|
+
.filter((item) => item?.data?.param_name && item?.type !== "button")
|
|
7310
|
+
.map((item) => item.data.param_name);
|
|
7311
|
+
return allParams.some((param) => {
|
|
7312
|
+
const ctx = chatbotContext?.[param];
|
|
7313
|
+
if (ctx && ctx.updated) {
|
|
7314
|
+
const val = ctx[param];
|
|
7315
|
+
if (val && (Array.isArray(val) ? val.length > 0 : !!val))
|
|
7316
|
+
return true;
|
|
7317
|
+
}
|
|
7318
|
+
const persistedKey = `${messageIndex}_${param}`;
|
|
7319
|
+
const persistedVal = persistedFormValues?.[persistedKey];
|
|
7320
|
+
if (persistedVal && (Array.isArray(persistedVal) ? persistedVal.length > 0 : !!persistedVal))
|
|
7321
|
+
return true;
|
|
7322
|
+
return false;
|
|
7323
|
+
});
|
|
7324
|
+
}
|
|
7325
|
+
return selectRequiredParams.every((param) => {
|
|
7326
|
+
const ctx = chatbotContext?.[param];
|
|
7327
|
+
if (ctx && ctx.updated) {
|
|
7328
|
+
const val = ctx[param];
|
|
7329
|
+
if (val && (Array.isArray(val) ? val.length > 0 : !!val))
|
|
7330
|
+
return true;
|
|
7331
|
+
}
|
|
7332
|
+
const persistedKey = `${messageIndex}_${param}`;
|
|
7333
|
+
const persistedVal = persistedFormValues?.[persistedKey];
|
|
7334
|
+
if (persistedVal && (Array.isArray(persistedVal) ? persistedVal.length > 0 : !!persistedVal))
|
|
7335
|
+
return true;
|
|
7336
|
+
return false;
|
|
7337
|
+
});
|
|
7338
|
+
}
|
|
7241
7339
|
return requiredParams.every((param) => {
|
|
7242
7340
|
// Check chatbotContext (populated by saved filters)
|
|
7243
7341
|
const ctx = chatbotContext?.[param];
|
|
@@ -7352,7 +7450,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7352
7450
|
case "radio":
|
|
7353
7451
|
return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
7354
7452
|
case "button":
|
|
7355
|
-
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted, isStepFormSubmit: true, isFormValid: requiredFieldsFilled }, key);
|
|
7453
|
+
return jsxRuntime.jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled }, key);
|
|
7356
7454
|
case "input":
|
|
7357
7455
|
return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
7358
7456
|
case "image":
|
|
@@ -7388,6 +7486,10 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
7388
7486
|
...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
|
|
7389
7487
|
}, children: crossFilterConfigs.length > 1 ? (jsxRuntime.jsx(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: fetchCrossFilterOptions, initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: formFields })) : (formFields) }), buttonItems] }));
|
|
7390
7488
|
};
|
|
7489
|
+
/** Reset the timeout flag (call when a new conversation/message starts) */
|
|
7490
|
+
const resetStepFormTimeoutFlag = () => {
|
|
7491
|
+
sessionStorage.removeItem(STEP_FORM_TIMEOUT_KEY);
|
|
7492
|
+
};
|
|
7391
7493
|
|
|
7392
7494
|
const useStyles$4 = makeStyles((theme) => ({
|
|
7393
7495
|
"@global": {
|
|
@@ -7817,7 +7919,42 @@ const AgentResponse$1 = (props) => {
|
|
|
7817
7919
|
|
|
7818
7920
|
const StepsResponseTab = (props) => {
|
|
7819
7921
|
const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, stepFormDataMap, isFormDisabled, streamingWidgetData, isRetrying, } = props;
|
|
7922
|
+
const dispatch = reactRedux.useDispatch();
|
|
7923
|
+
const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
|
|
7924
|
+
const streamStartTimeRef = React.useRef(thinkingContext?.streamStartTime);
|
|
7925
|
+
// Keep streamStartTime ref in sync with Redux for use in event handler closures
|
|
7926
|
+
React.useEffect(() => {
|
|
7927
|
+
streamStartTimeRef.current = thinkingContext?.streamStartTime;
|
|
7928
|
+
}, [thinkingContext?.streamStartTime]);
|
|
7820
7929
|
const [tabValue, setTabValue] = React.useState("steps");
|
|
7930
|
+
const [timeoutMessage, setTimeoutMessage] = React.useState("");
|
|
7931
|
+
const [isTimedOut, setIsTimedOut] = React.useState(false);
|
|
7932
|
+
// Switch to agent_response tab on form inactivity timeout (30 min)
|
|
7933
|
+
React.useEffect(() => {
|
|
7934
|
+
const handleStepFormTimeout = () => {
|
|
7935
|
+
setTimeoutMessage("This session timed out due to inactivity. Please start a new message to continue.");
|
|
7936
|
+
setIsTimedOut(true);
|
|
7937
|
+
setTabValue("agent_response");
|
|
7938
|
+
dispatch(smartBotActions.setMinimizedStreamData(null));
|
|
7939
|
+
const elapsed = streamStartTimeRef.current
|
|
7940
|
+
? Math.floor((Date.now() - streamStartTimeRef.current) / 1000)
|
|
7941
|
+
: null;
|
|
7942
|
+
const mins = elapsed != null ? Math.floor(elapsed / 60) : 0;
|
|
7943
|
+
const secs = elapsed != null ? elapsed % 60 : 0;
|
|
7944
|
+
const timedOutLabel = `Worked for ${mins}m:${String(secs).padStart(2, '0')}s`;
|
|
7945
|
+
dispatch(smartBotActions.setThinkingContext({
|
|
7946
|
+
streamStartTime: null,
|
|
7947
|
+
isStreamCompleted: true,
|
|
7948
|
+
finalElapsedSeconds: elapsed,
|
|
7949
|
+
thinkingHeaderMessage: timedOutLabel,
|
|
7950
|
+
thinkingContent: "",
|
|
7951
|
+
}));
|
|
7952
|
+
};
|
|
7953
|
+
window.addEventListener("stepFormTimeout", handleStepFormTimeout);
|
|
7954
|
+
return () => {
|
|
7955
|
+
window.removeEventListener("stepFormTimeout", handleStepFormTimeout);
|
|
7956
|
+
};
|
|
7957
|
+
}, []);
|
|
7821
7958
|
// When retry countdown starts, switch to agent_response to show it.
|
|
7822
7959
|
// When retry actually fires (isRetrying goes false + isStreaming goes true), switch back to steps.
|
|
7823
7960
|
React.useEffect(() => {
|
|
@@ -7845,8 +7982,8 @@ const StepsResponseTab = (props) => {
|
|
|
7845
7982
|
icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
7846
7983
|
},
|
|
7847
7984
|
], tabPanels: [
|
|
7848
|
-
jsxRuntime.jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: isFormDisabled }),
|
|
7849
|
-
jsxRuntime.jsx(AgentResponse$1, { content: content, isStreaming: isStreaming, streamingWidgetData: streamingWidgetData }),
|
|
7985
|
+
jsxRuntime.jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: isFormDisabled || isTimedOut }),
|
|
7986
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AgentResponse$1, { content: content, isStreaming: isStreaming, streamingWidgetData: streamingWidgetData }), timeoutMessage && (jsxRuntime.jsx("div", { style: { marginTop: "8px", padding: "0 8px" }, children: jsxRuntime.jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
|
|
7850
7987
|
], value: tabValue }) }));
|
|
7851
7988
|
};
|
|
7852
7989
|
|
|
@@ -8290,6 +8427,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
8290
8427
|
? botData?.utilityObject?.method
|
|
8291
8428
|
: "PUT";
|
|
8292
8429
|
delete botData.inputBody.chat_input;
|
|
8430
|
+
// Clear any stale timeout flag from a previous session
|
|
8431
|
+
resetStepFormTimeoutFlag();
|
|
8293
8432
|
// Start the timer immediately when the API is called
|
|
8294
8433
|
if (!streamStartTimeRef.current) {
|
|
8295
8434
|
streamStartTimeRef.current = Date.now();
|
|
@@ -8674,6 +8813,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8674
8813
|
// Check if this is a user-initiated abort (should not trigger retry)
|
|
8675
8814
|
const isUserAbort = event.reason === "Network request aborted";
|
|
8676
8815
|
event.statusCode === 503;
|
|
8816
|
+
const isAgentUnavailable = event.statusCode === 502 || event.statusCode === 404;
|
|
8677
8817
|
if (isThinking) {
|
|
8678
8818
|
setIsThinking(false);
|
|
8679
8819
|
const endTime = Date.now();
|
|
@@ -8684,8 +8824,50 @@ const StreamedContent = ({ botData }) => {
|
|
|
8684
8824
|
thinkingStartTimeRef.current = finalThinkingTime;
|
|
8685
8825
|
messageToStoreRef.current.chatData.thinkingResponse.thinkingTime = finalThinkingTime;
|
|
8686
8826
|
}
|
|
8827
|
+
// Agent unavailable (502/404) — show specific message, no retry
|
|
8828
|
+
if (isAgentUnavailable) {
|
|
8829
|
+
setWasStreamingAborted(true);
|
|
8830
|
+
wasStreamingAbortedRef.current = true;
|
|
8831
|
+
const currentSteps = stepRef.current;
|
|
8832
|
+
if (currentSteps.length > 0) {
|
|
8833
|
+
const lastStep = currentSteps[currentSteps.length - 1];
|
|
8834
|
+
if (lastStep.step_status === "not-completed") {
|
|
8835
|
+
lastStep.step_status = "completed";
|
|
8836
|
+
}
|
|
8837
|
+
stepRef.current = [...currentSteps];
|
|
8838
|
+
setSteps([...currentSteps]);
|
|
8839
|
+
}
|
|
8840
|
+
const agentUnavailableMessage = "Agent isn't available right now. Please contact your administrator or try again later.";
|
|
8841
|
+
const hasExistingWidgetsOnUnavail = messageToStoreRef.current.appendedData &&
|
|
8842
|
+
(isArray(messageToStoreRef.current.appendedData)
|
|
8843
|
+
? messageToStoreRef.current.appendedData.length > 0
|
|
8844
|
+
: Object.keys(messageToStoreRef.current.appendedData).length > 0);
|
|
8845
|
+
if (hasExistingWidgetsOnUnavail) {
|
|
8846
|
+
const errorWidget = { type: "text", response: agentUnavailableMessage };
|
|
8847
|
+
if (isArray(messageToStoreRef.current.appendedData)) {
|
|
8848
|
+
messageToStoreRef.current.appendedData.push(errorWidget);
|
|
8849
|
+
}
|
|
8850
|
+
else {
|
|
8851
|
+
messageToStoreRef.current.appendedData = [messageToStoreRef.current.appendedData, errorWidget];
|
|
8852
|
+
}
|
|
8853
|
+
}
|
|
8854
|
+
else {
|
|
8855
|
+
messageToStoreRef.current.chatData.response = agentUnavailableMessage;
|
|
8856
|
+
}
|
|
8857
|
+
setContent(agentUnavailableMessage);
|
|
8858
|
+
dispatch(smartBotActions.setMinimizedStreamData({
|
|
8859
|
+
isStreaming: false,
|
|
8860
|
+
stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Agent unavailable",
|
|
8861
|
+
stepSubHeader: "Connection closed",
|
|
8862
|
+
stepStatus: "completed",
|
|
8863
|
+
streamStartTime: streamStartTimeRef.current,
|
|
8864
|
+
actionCount: questionsRef.current.length || 1,
|
|
8865
|
+
}));
|
|
8866
|
+
setStepsDone(true);
|
|
8867
|
+
setIsStreamingDone(true);
|
|
8868
|
+
}
|
|
8687
8869
|
// Check if we can auto-retry (abrupt close or 503, but not user abort)
|
|
8688
|
-
if (!isUserAbort && retryCountRef.current < MAX_RETRY_COUNT) {
|
|
8870
|
+
else if (!isUserAbort && retryCountRef.current < MAX_RETRY_COUNT) {
|
|
8689
8871
|
// Still have retries left — start countdown instead of showing final error
|
|
8690
8872
|
setStepsDone(true); // Switch to agent_response tab to show countdown
|
|
8691
8873
|
const retryMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
@@ -9003,19 +9185,19 @@ const StreamedContent = ({ botData }) => {
|
|
|
9003
9185
|
// [
|
|
9004
9186
|
// {
|
|
9005
9187
|
// header: "Finding relevant information",
|
|
9006
|
-
// sub_header: "
|
|
9188
|
+
// sub_header: "Iris is working to identify relevant information to user answer user query",
|
|
9007
9189
|
// step_status: "not-completed",
|
|
9008
9190
|
// },
|
|
9009
9191
|
// ];
|
|
9010
9192
|
// [
|
|
9011
9193
|
// {
|
|
9012
9194
|
// header: "Finding relevant information",
|
|
9013
|
-
// sub_header: "
|
|
9195
|
+
// sub_header: "Iris is working to identify relevant information to user answer user query",
|
|
9014
9196
|
// step_status: "completed",
|
|
9015
9197
|
// },
|
|
9016
9198
|
// {
|
|
9017
9199
|
// header: "Output Generation",
|
|
9018
|
-
// sub_header: "
|
|
9200
|
+
// sub_header: "Iris is finalizing response to user query",
|
|
9019
9201
|
// step_status: "not-completed",
|
|
9020
9202
|
// },
|
|
9021
9203
|
// ];
|
|
@@ -9255,7 +9437,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
9255
9437
|
* @returns {JSX.Element} Rendered content with optional blinking cursor
|
|
9256
9438
|
*/
|
|
9257
9439
|
const renderContent = () => {
|
|
9258
|
-
return (jsxRuntime.jsxs("div", { className: classes.streamContainer, children: [jsxRuntime.jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: botData?.isFormDisabled || false, streamingWidgetData: streamingWidgetData, isRetrying: isRetrying }), isRetrying && (jsxRuntime.jsx("div", { className: classes.retryContainer, children: jsxRuntime.
|
|
9440
|
+
return (jsxRuntime.jsxs("div", { className: classes.streamContainer, children: [jsxRuntime.jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap, stepFormDataMap: stepFormDataMap, isFormDisabled: botData?.isFormDisabled || false, streamingWidgetData: streamingWidgetData, isRetrying: isRetrying }), isRetrying && (jsxRuntime.jsx("div", { className: classes.retryContainer, children: jsxRuntime.jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) }))] }));
|
|
9259
9441
|
};
|
|
9260
9442
|
if (currentMode === "agent") {
|
|
9261
9443
|
return renderContent();
|
|
@@ -9526,6 +9708,12 @@ let activeTabularInstanceId = null;
|
|
|
9526
9708
|
const TabularContent = ({ steps: initialSteps, currentTabValue, children, questions: initialQuestions = [], questionsStepsMap: initialQuestionsStepsMap = {}, stepFormDataMap: initialStepFormDataMap = {}, isFormDisabled = false, sessionId: propSessionId = "" }) => {
|
|
9527
9709
|
const dispatch = reactRedux.useDispatch();
|
|
9528
9710
|
const stepFormStreamData = reactRedux.useSelector((state) => state.smartBotReducer.stepFormStreamData);
|
|
9711
|
+
const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
|
|
9712
|
+
const streamStartTimeRef = React.useRef(thinkingContext?.streamStartTime);
|
|
9713
|
+
// Keep streamStartTime ref in sync with Redux for use in event handler closures
|
|
9714
|
+
React.useEffect(() => {
|
|
9715
|
+
streamStartTimeRef.current = thinkingContext?.streamStartTime;
|
|
9716
|
+
}, [thinkingContext?.streamStartTime]);
|
|
9529
9717
|
const [tabValue, setTabValue] = React.useState(currentTabValue);
|
|
9530
9718
|
// Local state — initialized from props, updated by SSE chunks
|
|
9531
9719
|
const [stepsState, setStepsState] = React.useState(() => {
|
|
@@ -9548,6 +9736,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
9548
9736
|
const [hasNewStepFormFromRestream, setHasNewStepFormFromRestream] = React.useState(false);
|
|
9549
9737
|
const [activeFormIntent, setActiveFormIntent] = React.useState(null);
|
|
9550
9738
|
const [retryCountdown, setRetryCountdown] = React.useState(0);
|
|
9739
|
+
const [timeoutMessage, setTimeoutMessage] = React.useState("");
|
|
9740
|
+
const [isTimedOut, setIsTimedOut] = React.useState(false);
|
|
9551
9741
|
// Stable unique instance ID for this TabularContent mount
|
|
9552
9742
|
const instanceIdRef = React.useRef(null);
|
|
9553
9743
|
if (instanceIdRef.current === null) {
|
|
@@ -9572,6 +9762,33 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
9572
9762
|
window.removeEventListener("stepFormStreamCompleted", handleStepFormCompleted);
|
|
9573
9763
|
};
|
|
9574
9764
|
}, []);
|
|
9765
|
+
// Switch to agent_response tab on form inactivity timeout (30 min)
|
|
9766
|
+
React.useEffect(() => {
|
|
9767
|
+
const handleStepFormTimeout = () => {
|
|
9768
|
+
setTimeoutMessage("This session timed out due to inactivity. Please start a new message to continue.");
|
|
9769
|
+
setStepFormSubmitted(true);
|
|
9770
|
+
setIsTimedOut(true);
|
|
9771
|
+
setTabValue("agent_response");
|
|
9772
|
+
dispatch(smartBotActions.setMinimizedStreamData(null));
|
|
9773
|
+
const elapsed = streamStartTimeRef.current
|
|
9774
|
+
? Math.floor((Date.now() - streamStartTimeRef.current) / 1000)
|
|
9775
|
+
: null;
|
|
9776
|
+
const mins = elapsed != null ? Math.floor(elapsed / 60) : 0;
|
|
9777
|
+
const secs = elapsed != null ? elapsed % 60 : 0;
|
|
9778
|
+
const timedOutLabel = `Worked for ${mins}m:${String(secs).padStart(2, '0')}s`;
|
|
9779
|
+
dispatch(smartBotActions.setThinkingContext({
|
|
9780
|
+
streamStartTime: null,
|
|
9781
|
+
isStreamCompleted: true,
|
|
9782
|
+
finalElapsedSeconds: elapsed,
|
|
9783
|
+
thinkingHeaderMessage: timedOutLabel,
|
|
9784
|
+
thinkingContent: "",
|
|
9785
|
+
}));
|
|
9786
|
+
};
|
|
9787
|
+
window.addEventListener("stepFormTimeout", handleStepFormTimeout);
|
|
9788
|
+
return () => {
|
|
9789
|
+
window.removeEventListener("stepFormTimeout", handleStepFormTimeout);
|
|
9790
|
+
};
|
|
9791
|
+
}, []);
|
|
9575
9792
|
// Render a widget item from SSE data
|
|
9576
9793
|
const renderWidget = (item, index) => {
|
|
9577
9794
|
try {
|
|
@@ -9910,8 +10127,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
9910
10127
|
icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
9911
10128
|
},
|
|
9912
10129
|
], tabPanels: [
|
|
9913
|
-
jsxRuntime.jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
|
|
9914
|
-
jsxRuntime.jsxs(AgentResponse, { children: [children, renderedWidgets.length > 0 && (jsxRuntime.jsx("div", { className: "restream-widget-content", children: renderedWidgets })), retryCountdown > 0 && (jsxRuntime.jsx("div", { style: { marginTop: "8px" }, children: jsxRuntime.
|
|
10130
|
+
jsxRuntime.jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted || isTimedOut, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
|
|
10131
|
+
jsxRuntime.jsxs(AgentResponse, { children: [children, renderedWidgets.length > 0 && (jsxRuntime.jsx("div", { className: "restream-widget-content", children: renderedWidgets })), retryCountdown > 0 && (jsxRuntime.jsx("div", { style: { marginTop: "8px" }, children: jsxRuntime.jsx(TextRenderer, { text: `Auto re-trying in ${retryCountdown}s`, thinking: "" }) })), timeoutMessage && (jsxRuntime.jsx("div", { style: { marginTop: "8px" }, children: jsxRuntime.jsx(TextRenderer, { text: timeoutMessage, thinking: "" }) }))] }),
|
|
9915
10132
|
], value: tabValue }) }));
|
|
9916
10133
|
};
|
|
9917
10134
|
/** Reset the active instance tracker (call when a new conversation starts from the input field) */
|
|
@@ -12961,7 +13178,7 @@ let singleConversationNewData = [
|
|
|
12961
13178
|
{
|
|
12962
13179
|
header: "Creating Plan of Action",
|
|
12963
13180
|
step_status: "completed",
|
|
12964
|
-
sub_header: "
|
|
13181
|
+
sub_header: "Iris is working to determine the best approach to answer user query",
|
|
12965
13182
|
current_intent: "List the products which are about to change status in next 10 days"
|
|
12966
13183
|
},
|
|
12967
13184
|
{
|
|
@@ -14885,7 +15102,7 @@ const SmartBot = (props) => {
|
|
|
14885
15102
|
try {
|
|
14886
15103
|
// if (localStorage.getItem("isStreaming") === "true") {
|
|
14887
15104
|
// displaySnackMessages(
|
|
14888
|
-
// "
|
|
15105
|
+
// "Iris is processing request in another tab, This request can be processed once Iris is available",
|
|
14889
15106
|
// "warning"
|
|
14890
15107
|
// );
|
|
14891
15108
|
// return;
|
|
@@ -15227,7 +15444,7 @@ const SmartBot = (props) => {
|
|
|
15227
15444
|
:
|
|
15228
15445
|
jsxRuntime.jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
15229
15446
|
freeTextHeading: "Try adding more details :",
|
|
15230
|
-
freeTextContent: "
|
|
15447
|
+
freeTextContent: "Iris works better when you provide more context and pointed questions",
|
|
15231
15448
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSavedFilters ? false : showSuggestionBanner, onCloseSuggestionBanner: () => {
|
|
15232
15449
|
setShowSuggestionBanner(false);
|
|
15233
15450
|
}, landingScreen: isLandingScreen, onLikeClick: (params, params2) => {
|