impact-chatbot 2.3.67 → 2.3.69

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
@@ -30,6 +30,7 @@ var utils = require('core/Utils/functions/utils');
30
30
  var impactUiV3 = require('impact-ui-v3');
31
31
  var axios = require('axios');
32
32
  var isArray$1 = require('lodash/isArray');
33
+ var isEmpty$1 = require('lodash/isEmpty');
33
34
  var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
34
35
  var AgGridComponent = require('core/Utils/agGrid');
35
36
  var agGridColumnFormatter = require('core/Utils/agGrid/column-formatter');
@@ -5689,6 +5690,15 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
5689
5690
  }
5690
5691
  }
5691
5692
  else if (data?.status === "completed" || data?.status === "follow-up" || data?.message === "[DONE]") {
5693
+ // Extract widget_data from completed/[DONE] chunks (e.g. graph widgets)
5694
+ if (!isEmpty$1(data?.widget_data)) {
5695
+ chunksRef.push({ ...data, status: "widget" });
5696
+ dispatch(smartBotActions.setStepFormStreamData({
5697
+ status: "widget_chunk",
5698
+ chunks: [{ ...data, status: "widget" }],
5699
+ sessionId,
5700
+ }));
5701
+ }
5692
5702
  // Clear minimized widget on completion
5693
5703
  if (data?.status === "completed") {
5694
5704
  dispatch(smartBotActions.setMinimizedStreamData(null));
@@ -8890,7 +8900,7 @@ const StreamedContent = ({ botData }) => {
8890
8900
  // Append the error message at the bottom of any existing content.
8891
8901
  // If widgets already exist in appendedData, append as the last widget
8892
8902
  // so it renders AFTER the already-received content (not at the top).
8893
- const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
8903
+ const finalMessage = "Please reach out to IA for this, as this didn't work even after retry";
8894
8904
  const hasExistingWidgetsOnErr = messageToStoreRef.current.appendedData &&
8895
8905
  (isArray(messageToStoreRef.current.appendedData)
8896
8906
  ? messageToStoreRef.current.appendedData.length > 0
@@ -10080,7 +10090,13 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10080
10090
  };
10081
10091
  }
10082
10092
  }
10083
- if (data.status === "widget") ;
10093
+ if (data.status === "widget") {
10094
+ const widgetItems = isArray$1(data.widget_data) ? data.widget_data : [data.widget_data];
10095
+ widgetItems.forEach((item) => {
10096
+ if (item)
10097
+ newWidgets.push(item);
10098
+ });
10099
+ }
10084
10100
  if (data.status === "content" && data.message) {
10085
10101
  newWidgets.push({ type: "text", response: data.message });
10086
10102
  }
@@ -10095,7 +10111,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10095
10111
  setQuestionsStepsMapState(lodash.cloneDeep(newQuestionsStepsMap));
10096
10112
  setStepFormDataMapState(lodash.cloneDeep(newStepFormDataMap));
10097
10113
  if (newWidgets.length > 0) {
10098
- setWidgetContent((prev) => [...prev, ...newWidgets]);
10114
+ // Replace (not append) to avoid duplicates from real-time widget_chunk dispatches
10115
+ setWidgetContent(newWidgets);
10099
10116
  }
10100
10117
  // If the response contains a new step_form, reset stepFormSubmitted and mark new form as active
10101
10118
  const lastStepFormChunk = [...chunks].reverse().find((c) => c.status === "step_form");