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.esm.js CHANGED
@@ -27,6 +27,7 @@ import { fetchBaseUrl, replaceSpecialCharacter as replaceSpecialCharacter$1, fet
27
27
  import { Button, Modal, Slider, Select, DatePicker, DateRangePicker, Checkbox, RadioButtonGroup, Input, Tabs, Loader, Tooltip, ChatBotComponent } from 'impact-ui-v3';
28
28
  import axios from 'axios';
29
29
  import isArray$2 from 'lodash/isArray';
30
+ import isEmpty$2 from 'lodash/isEmpty';
30
31
  import { stopAgentFlow } from 'core/commonComponents/smartBot/services/chatbot-services';
31
32
  import AgGridComponent from 'core/Utils/agGrid';
32
33
  import agGridColumnFormatter from 'core/Utils/agGrid/column-formatter';
@@ -5667,6 +5668,15 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
5667
5668
  }
5668
5669
  }
5669
5670
  else if (data?.status === "completed" || data?.status === "follow-up" || data?.message === "[DONE]") {
5671
+ // Extract widget_data from completed/[DONE] chunks (e.g. graph widgets)
5672
+ if (!isEmpty$2(data?.widget_data)) {
5673
+ chunksRef.push({ ...data, status: "widget" });
5674
+ dispatch(setStepFormStreamData({
5675
+ status: "widget_chunk",
5676
+ chunks: [{ ...data, status: "widget" }],
5677
+ sessionId,
5678
+ }));
5679
+ }
5670
5680
  // Clear minimized widget on completion
5671
5681
  if (data?.status === "completed") {
5672
5682
  dispatch(setMinimizedStreamData(null));
@@ -8868,7 +8878,7 @@ const StreamedContent = ({ botData }) => {
8868
8878
  // Append the error message at the bottom of any existing content.
8869
8879
  // If widgets already exist in appendedData, append as the last widget
8870
8880
  // so it renders AFTER the already-received content (not at the top).
8871
- const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
8881
+ const finalMessage = "Please reach out to IA for this, as this didn't work even after retry";
8872
8882
  const hasExistingWidgetsOnErr = messageToStoreRef.current.appendedData &&
8873
8883
  (isArray(messageToStoreRef.current.appendedData)
8874
8884
  ? messageToStoreRef.current.appendedData.length > 0
@@ -10058,7 +10068,13 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10058
10068
  };
10059
10069
  }
10060
10070
  }
10061
- if (data.status === "widget") ;
10071
+ if (data.status === "widget") {
10072
+ const widgetItems = isArray$2(data.widget_data) ? data.widget_data : [data.widget_data];
10073
+ widgetItems.forEach((item) => {
10074
+ if (item)
10075
+ newWidgets.push(item);
10076
+ });
10077
+ }
10062
10078
  if (data.status === "content" && data.message) {
10063
10079
  newWidgets.push({ type: "text", response: data.message });
10064
10080
  }
@@ -10073,7 +10089,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
10073
10089
  setQuestionsStepsMapState(cloneDeep(newQuestionsStepsMap));
10074
10090
  setStepFormDataMapState(cloneDeep(newStepFormDataMap));
10075
10091
  if (newWidgets.length > 0) {
10076
- setWidgetContent((prev) => [...prev, ...newWidgets]);
10092
+ // Replace (not append) to avoid duplicates from real-time widget_chunk dispatches
10093
+ setWidgetContent(newWidgets);
10077
10094
  }
10078
10095
  // If the response contains a new step_form, reset stepFormSubmitted and mark new form as active
10079
10096
  const lastStepFormChunk = [...chunks].reverse().find((c) => c.status === "step_form");