impact-chatbot 2.3.11 → 2.3.13

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
@@ -1208,6 +1208,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
1208
1208
  setUniqueChatId: utilityObjectData?.setUniqueChatId,
1209
1209
  fieldNumber: utilityObjectData?.fieldNumber,
1210
1210
  setFieldNumber: utilityObjectData?.setFieldNumber,
1211
+ setAdditionalArgs: utilityObjectData?.setAdditionalArgs,
1211
1212
  baseUrl: baseUrlTemp,
1212
1213
  };
1213
1214
  response = await parseResponse(null, "stream", "", currentModeValue, false, "", {}, payload, utilityObject);
@@ -1735,6 +1736,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
1735
1736
  chat_input: data?.chatInput,
1736
1737
  delay: 0.3,
1737
1738
  chat_id: utilityObjectData?.uniqueChatId ? utilityObjectData?.uniqueChatId : utilityObjectData?.currentAgentChatId,
1739
+ ...(!isEmpty(utilityObjectData?.additionalArgs) ? utilityObjectData.additionalArgs : {}),
1738
1740
  };
1739
1741
  // Handle @ filter mentions - user_explicit_input contains filter values
1740
1742
  if (!isEmpty(data?.userExplicitInput)) {
@@ -1900,7 +1902,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
1900
1902
  };
1901
1903
  };
1902
1904
 
1903
- const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber) => {
1905
+ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs) => {
1904
1906
  const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
1905
1907
  setChatDataState,
1906
1908
  activeConversationId,
@@ -1925,6 +1927,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
1925
1927
  uniqueChatId,
1926
1928
  fieldNumber,
1927
1929
  setFieldNumber,
1930
+ setAdditionalArgs: () => { },
1928
1931
  });
1929
1932
  const getCurrentDateTimeString = () => {
1930
1933
  return moment().format(dateFormat);
@@ -2088,6 +2091,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2088
2091
  setSessionId: setSessionId,
2089
2092
  setInitValue: setInitValue,
2090
2093
  uniqueChatId: uniqueChatId,
2094
+ additionalArgs: additionalArgs,
2091
2095
  });
2092
2096
  }
2093
2097
  else if (data.actionType === "indirect") {
@@ -3862,6 +3866,7 @@ const useChatState = () => {
3862
3866
  const [isModalOpen, setIsModalOpen] = useState(false);
3863
3867
  const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);
3864
3868
  const [isRefreshTriggered, setIsRefreshTriggered] = useState(false);
3869
+ const [additionalArgs, setAdditionalArgs] = useState({});
3865
3870
  // Selectors
3866
3871
  const filterReducerState = useSelector((state) => state.filterReducer);
3867
3872
  const notificationData = useSelector((state) => state.notificationReducer.notificationData);
@@ -4006,6 +4011,8 @@ const useChatState = () => {
4006
4011
  setIsUploadModalOpen,
4007
4012
  isRefreshTriggered,
4008
4013
  setIsRefreshTriggered,
4014
+ additionalArgs,
4015
+ setAdditionalArgs,
4009
4016
  // Refs
4010
4017
  grabPositionRef,
4011
4018
  chatDataRef,
@@ -4430,7 +4437,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
4430
4437
  return (jsx("div", { className: `${classes.rectangle} ${classes[type]} ${hoverable ? classes.rectangleHoverable : ''}`, onClick: onClick, children: jsxs("div", { className: classes.textContainer, children: [jsx(Typography, { className: classes.title, children: title }), jsx(Typography, { className: classes.description, children: description })] }) }));
4431
4438
  };
4432
4439
  const ChatPlaceholder = (props) => {
4433
- const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, questions, displayQuestions } = props;
4440
+ const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, setAdditionalArgs, questions, displayQuestions } = props;
4434
4441
  const classes = useStyles$5();
4435
4442
  globalStyles();
4436
4443
  const [cardList, setCardList] = useState([]);
@@ -4460,6 +4467,7 @@ const ChatPlaceholder = (props) => {
4460
4467
  setUniqueChatId,
4461
4468
  fieldNumber,
4462
4469
  setFieldNumber,
4470
+ setAdditionalArgs,
4463
4471
  });
4464
4472
  const getBaseUrl = async () => {
4465
4473
  try {
@@ -5080,6 +5088,9 @@ const sseevent = (message, messageToStoreRef) => {
5080
5088
  messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
5081
5089
  ? parsedData.chat_id
5082
5090
  : "";
5091
+ messageToStoreRef.current.additionalArgs = parsedData?.additional_args
5092
+ ? parsedData.additional_args
5093
+ : {};
5083
5094
  }
5084
5095
  // Handle widget status - capture widget_data when status is "widget"
5085
5096
  if (parsedData?.status === "widget" && !isEmpty$1(parsedData?.widget_data)) {
@@ -5100,6 +5111,9 @@ const sseevent = (message, messageToStoreRef) => {
5100
5111
  : "";
5101
5112
  messageToStoreRef.current.initValue = true;
5102
5113
  messageToStoreRef.current.status = "completed";
5114
+ messageToStoreRef.current.additionalArgs = parsedData?.additional_args
5115
+ ? parsedData.additional_args
5116
+ : {};
5103
5117
  }
5104
5118
  if (parsedData?.status === "completed" ||
5105
5119
  parsedData?.status === "follow-up") {
@@ -5925,6 +5939,7 @@ const StreamedContent = ({ botData }) => {
5925
5939
  initValue: false,
5926
5940
  sessionId: "",
5927
5941
  uniqueChatId: "",
5942
+ additionalArgs: {},
5928
5943
  });
5929
5944
  useRef(new Set()); // Tracks processed message chunks to prevent duplicates
5930
5945
  useRef(""); // Tracks current content before adding new chunk
@@ -6230,6 +6245,9 @@ const StreamedContent = ({ botData }) => {
6230
6245
  ];
6231
6246
  botData.utilityObject.setInitValue(messageToStoreRef.current.initValue);
6232
6247
  botData.utilityObject.setSessionId(messageToStoreRef.current.sessionId);
6248
+ botData.utilityObject.setAdditionalArgs(!isEmpty(messageToStoreRef.current.additionalArgs)
6249
+ ? messageToStoreRef.current.additionalArgs
6250
+ : {});
6233
6251
  if (!wasStreamingAbortedRef.current) {
6234
6252
  botData.utilityObject.setUniqueChatId(messageToStoreRef.current.uniqueChatId);
6235
6253
  dispatch(setCurrentAgentChatId(messageToStoreRef.current.uniqueChatId));
@@ -9733,7 +9751,7 @@ let chatbotFilterCustomConfig = {
9733
9751
 
9734
9752
  const SmartBot = (props) => {
9735
9753
  const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
9736
- const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, } = useChatState();
9754
+ const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, additionalArgs, setAdditionalArgs, } = useChatState();
9737
9755
  // Add state for confirmation dialogs
9738
9756
  useState(false);
9739
9757
  useState(null);
@@ -9757,7 +9775,7 @@ const SmartBot = (props) => {
9757
9775
  const [isLandingScreen, setIsLandingScreen] = useState(true);
9758
9776
  const [showSuggestionBanner, setShowSuggestionBanner] = useState(true);
9759
9777
  const [filterOptions, setFilterOptions] = useState([]);
9760
- const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber);
9778
+ const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs);
9761
9779
  const { parseSavedFlow, saveCurrentChanges, endCurrentSession, clearChatSession, initiateNewChat, hasUnsavedChanges, } = useChatSession(chatDataRef, setFlowType, setScreenName, setUserInput, setTemplateData, chatDataScreenLinkRef, setShowModal, setMinimizedMode, setSelectedModule, setChatDataState, currentMode, setUserFlow, getCurrentDateTimeString, setCurrentAppLink, selectedModule, fetchUserResultsFromQuery, props.closeBot, activeConversationId, setActiveConversationId, setShowChatPlaceholder);
9762
9780
  const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
9763
9781
  const { prepareDataAndSendToAgent } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
@@ -9785,6 +9803,7 @@ const SmartBot = (props) => {
9785
9803
  setUniqueChatId,
9786
9804
  fieldNumber,
9787
9805
  setFieldNumber,
9806
+ setAdditionalArgs,
9788
9807
  });
9789
9808
  const fetchCustomBotConfigurations = async () => {
9790
9809
  try {
@@ -10151,7 +10170,8 @@ const SmartBot = (props) => {
10151
10170
  setSessionId: setSessionId,
10152
10171
  setInitValue: setInitValue,
10153
10172
  uniqueChatId: uniqueChatId,
10154
- currentAgentChatId: currentAgentChatId
10173
+ currentAgentChatId: currentAgentChatId,
10174
+ additionalArgs: isEmpty$1(userInput) ? additionalArgs : {}
10155
10175
  });
10156
10176
  setUserInput("");
10157
10177
  }
@@ -10314,6 +10334,7 @@ const SmartBot = (props) => {
10314
10334
  }));
10315
10335
  setInitValue(true);
10316
10336
  setSessionId("");
10337
+ setAdditionalArgs({});
10317
10338
  setIsStop(false);
10318
10339
  setUserInput("");
10319
10340
  setUniqueChatId("");
@@ -10431,7 +10452,7 @@ const SmartBot = (props) => {
10431
10452
  },
10432
10453
  icon: jsx(SvgNavigationIcon, {}),
10433
10454
  },
10434
- ], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId, fieldNumber: fieldNumber, setFieldNumber: setFieldNumber, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
10455
+ ], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId, fieldNumber: fieldNumber, setFieldNumber: setFieldNumber, setAdditionalArgs: setAdditionalArgs, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
10435
10456
  freeTextHeading: "Try adding more details :",
10436
10457
  freeTextContent: "Alan works better when you provide more context and pointed questions",
10437
10458
  }, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {