impact-chatbot 2.3.66 → 2.3.68

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.
@@ -13,4 +13,6 @@ declare const StepFormContent: ({ formData, messageIndex, isFormDisabled, showSa
13
13
  isFormDisabled?: boolean;
14
14
  showSavedFilters?: boolean;
15
15
  }) => import("react/jsx-runtime").JSX.Element;
16
+ /** Reset the timeout flag (call when a new conversation/message starts) */
17
+ export declare const resetStepFormTimeoutFlag: () => void;
16
18
  export default StepFormContent;
package/dist/index.cjs.js CHANGED
@@ -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":
@@ -5887,8 +5889,10 @@ const TableContent = ({ bodyText }) => {
5887
5889
  const onSelectionChanged = (event) => {
5888
5890
  try {
5889
5891
  const selectedList = event.api.getSelectedRows();
5890
- chatbotContext.tables = { ...chatbotContext?.tables, [table_name]: selectedList };
5891
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6735
- ...chatbotContext?.[bodyText?.paramName],
6736
- [bodyText?.paramName]: value?.target?.value,
6737
- updated: true
6738
- };
6739
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6787
- ...chatbotContext?.[bodyText?.paramName],
6788
- [bodyText?.paramName]: value,
6789
- updated: true,
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(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6837
- ...chatbotContext?.[bodyText?.paramName],
6838
- [bodyText?.paramName]: [],
6839
- updated: true,
6840
- };
6841
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6862
- ...chatbotContext?.[bodyText?.paramName],
6863
- [bodyText?.paramName]: [],
6864
- updated: true,
6865
- };
6866
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6918
- ...chatbotContext?.[bodyText?.paramName],
6919
- [bodyText?.paramName]: allValues,
6920
- updated: true,
6921
- };
6922
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6955
- ...chatbotContext?.[bodyText?.paramName],
6956
- [bodyText?.paramName]: moment(date).format(displayFormat),
6957
- updated: true
6958
- };
6959
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
6994
- ...chatbotContext?.[bodyText?.paramName],
7010
+ dispatch(smartBotActions.setChatbotContext({
7011
+ ...chatbotContext,
6995
7012
  [bodyText?.paramName]: {
6996
- startDate: start ? moment(start).format(displayFormat) : null,
6997
- endDate: end ? moment(end).format(displayFormat) : null,
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
- updated: true,
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
- chatbotContext[bodyText?.paramName] = {
7043
- ...chatbotContext?.[bodyText?.paramName],
7044
- [bodyText?.paramName]: isChecked?.currentTarget?.checked,
7045
- updated: true
7046
- };
7047
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
7077
- ...chatbotContext?.[bodyText?.paramName],
7078
- [bodyText?.paramName]: value,
7079
- updated: true
7080
- };
7081
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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
- chatbotContext[bodyText?.paramName] = {
7105
- ...chatbotContext?.[bodyText?.paramName],
7106
- [bodyText?.paramName]: replaceSpecialCharToCharCode(newValue),
7107
- updated: true,
7108
- type: inputType,
7109
- };
7110
- dispatch(smartBotActions.setChatbotContext(chatbotContext));
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,8 +7176,9 @@ 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);
7152
- const [isTimedOut, setIsTimedOut] = React.useState(false);
7179
+ const [isTimedOut, setIsTimedOut] = React.useState(() => sessionStorage.getItem(STEP_FORM_TIMEOUT_KEY) === "true");
7153
7180
  const timeoutRef = React.useRef(null);
7181
+ const prevIsFormDisabledRef = React.useRef(isFormDisabled);
7154
7182
  // 30-minute inactivity timeout: disable form and switch to agent_response tab
7155
7183
  const FORM_TIMEOUT_MS = 30 * 60 * 1000;
7156
7184
  React.useEffect(() => {
@@ -7159,6 +7187,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7159
7187
  const startTime = Date.now();
7160
7188
  timeoutRef.current = setTimeout(() => {
7161
7189
  setIsTimedOut(true);
7190
+ sessionStorage.setItem(STEP_FORM_TIMEOUT_KEY, "true");
7162
7191
  const elapsedSeconds = Math.floor((Date.now() - startTime) / 1000);
7163
7192
  window.dispatchEvent(new CustomEvent("stepFormTimeout", { detail: { elapsedSeconds } }));
7164
7193
  }, FORM_TIMEOUT_MS);
@@ -7182,11 +7211,14 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7182
7211
  }
7183
7212
  }, [stepFormStreamData]);
7184
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)
7185
7215
  React.useEffect(() => {
7186
- if (!isFormDisabled) {
7216
+ if (prevIsFormDisabledRef.current && !isFormDisabled) {
7187
7217
  setIsFormSubmitted(false);
7188
7218
  setIsTimedOut(false);
7219
+ sessionStorage.removeItem(STEP_FORM_TIMEOUT_KEY);
7189
7220
  }
7221
+ prevIsFormDisabledRef.current = isFormDisabled;
7190
7222
  }, [isFormDisabled]);
7191
7223
  const [isFilterSetOpen, setIsFilterSetOpen] = React.useState(false);
7192
7224
  const [selectedFilterSet, setSelectedFilterSet] = React.useState(() => {
@@ -7261,11 +7293,49 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7261
7293
  const requiredFieldsFilled = React.useMemo(() => {
7262
7294
  if (!formData || !Array.isArray(formData))
7263
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).
7264
7298
  const requiredParams = formData
7265
- .filter((item) => item?.data?.isRequired)
7299
+ .filter((item) => item?.data?.isRequired && item?.data?.is_mandatory)
7266
7300
  .map((item) => item.data.param_name);
7267
- if (requiredParams.length === 0)
7268
- return true;
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
+ }
7269
7339
  return requiredParams.every((param) => {
7270
7340
  // Check chatbotContext (populated by saved filters)
7271
7341
  const ctx = chatbotContext?.[param];
@@ -7380,7 +7450,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7380
7450
  case "radio":
7381
7451
  return jsxRuntime.jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7382
7452
  case "button":
7383
- 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);
7384
7454
  case "input":
7385
7455
  return jsxRuntime.jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
7386
7456
  case "image":
@@ -7416,6 +7486,10 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
7416
7486
  ...(isFilterSelected && !isFormDisabled ? { pointerEvents: "none", opacity: 0.5 } : {}),
7417
7487
  }, children: crossFilterConfigs.length > 1 ? (jsxRuntime.jsx(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: fetchCrossFilterOptions, initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: formFields })) : (formFields) }), buttonItems] }));
7418
7488
  };
7489
+ /** Reset the timeout flag (call when a new conversation/message starts) */
7490
+ const resetStepFormTimeoutFlag = () => {
7491
+ sessionStorage.removeItem(STEP_FORM_TIMEOUT_KEY);
7492
+ };
7419
7493
 
7420
7494
  const useStyles$4 = makeStyles((theme) => ({
7421
7495
  "@global": {
@@ -7854,10 +7928,12 @@ const StepsResponseTab = (props) => {
7854
7928
  }, [thinkingContext?.streamStartTime]);
7855
7929
  const [tabValue, setTabValue] = React.useState("steps");
7856
7930
  const [timeoutMessage, setTimeoutMessage] = React.useState("");
7931
+ const [isTimedOut, setIsTimedOut] = React.useState(false);
7857
7932
  // Switch to agent_response tab on form inactivity timeout (30 min)
7858
7933
  React.useEffect(() => {
7859
7934
  const handleStepFormTimeout = () => {
7860
7935
  setTimeoutMessage("This session timed out due to inactivity. Please start a new message to continue.");
7936
+ setIsTimedOut(true);
7861
7937
  setTabValue("agent_response");
7862
7938
  dispatch(smartBotActions.setMinimizedStreamData(null));
7863
7939
  const elapsed = streamStartTimeRef.current
@@ -7906,7 +7982,7 @@ const StepsResponseTab = (props) => {
7906
7982
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
7907
7983
  },
7908
7984
  ], tabPanels: [
7909
- 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 }),
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 }),
7910
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: "" }) }))] }),
7911
7987
  ], value: tabValue }) }));
7912
7988
  };
@@ -8351,6 +8427,8 @@ const StreamedContent = ({ botData }) => {
8351
8427
  ? botData?.utilityObject?.method
8352
8428
  : "PUT";
8353
8429
  delete botData.inputBody.chat_input;
8430
+ // Clear any stale timeout flag from a previous session
8431
+ resetStepFormTimeoutFlag();
8354
8432
  // Start the timer immediately when the API is called
8355
8433
  if (!streamStartTimeRef.current) {
8356
8434
  streamStartTimeRef.current = Date.now();
@@ -8812,7 +8890,7 @@ const StreamedContent = ({ botData }) => {
8812
8890
  // Append the error message at the bottom of any existing content.
8813
8891
  // If widgets already exist in appendedData, append as the last widget
8814
8892
  // so it renders AFTER the already-received content (not at the top).
8815
- const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
8893
+ const finalMessage = "Please reach out to IA for this, as this didn't work even after retry";
8816
8894
  const hasExistingWidgetsOnErr = messageToStoreRef.current.appendedData &&
8817
8895
  (isArray(messageToStoreRef.current.appendedData)
8818
8896
  ? messageToStoreRef.current.appendedData.length > 0
@@ -9659,6 +9737,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
9659
9737
  const [activeFormIntent, setActiveFormIntent] = React.useState(null);
9660
9738
  const [retryCountdown, setRetryCountdown] = React.useState(0);
9661
9739
  const [timeoutMessage, setTimeoutMessage] = React.useState("");
9740
+ const [isTimedOut, setIsTimedOut] = React.useState(false);
9662
9741
  // Stable unique instance ID for this TabularContent mount
9663
9742
  const instanceIdRef = React.useRef(null);
9664
9743
  if (instanceIdRef.current === null) {
@@ -9688,6 +9767,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
9688
9767
  const handleStepFormTimeout = () => {
9689
9768
  setTimeoutMessage("This session timed out due to inactivity. Please start a new message to continue.");
9690
9769
  setStepFormSubmitted(true);
9770
+ setIsTimedOut(true);
9691
9771
  setTabValue("agent_response");
9692
9772
  dispatch(smartBotActions.setMinimizedStreamData(null));
9693
9773
  const elapsed = streamStartTimeRef.current
@@ -10047,7 +10127,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10047
10127
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
10048
10128
  },
10049
10129
  ], tabPanels: [
10050
- jsxRuntime.jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
10130
+ jsxRuntime.jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted || isTimedOut, activeFormIntent: hasNewStepFormFromRestream ? activeFormIntent : null, isRestreaming: isRestreaming }),
10051
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: "" }) }))] }),
10052
10132
  ], value: tabValue }) }));
10053
10133
  };