impact-chatbot 2.3.36 → 2.3.38

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
@@ -2027,7 +2027,11 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
2027
2027
  };
2028
2028
  };
2029
2029
 
2030
- 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, setActiveConversationId) => {
2030
+ 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, setActiveConversationId, navSessionId, setNavSessionId) => {
2031
+ const navSessionIdRef = useRef(navSessionId);
2032
+ useEffect(() => {
2033
+ navSessionIdRef.current = navSessionId;
2034
+ }, [navSessionId]);
2031
2035
  const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
2032
2036
  setChatDataState,
2033
2037
  activeConversationId,
@@ -2303,6 +2307,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2303
2307
  else {
2304
2308
  body = {
2305
2309
  query: input,
2310
+ ...(navSessionIdRef.current && { session_id: navSessionIdRef.current }),
2306
2311
  };
2307
2312
  }
2308
2313
  let utitlityObject = {
@@ -2318,6 +2323,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2318
2323
  functionsRef,
2319
2324
  functionsState,
2320
2325
  setFunctionsState,
2326
+ setNavSessionId,
2321
2327
  };
2322
2328
  let response;
2323
2329
  if (input.indexOf("@") > -1) {
@@ -4006,6 +4012,7 @@ const useChatState = () => {
4006
4012
  useState(null);
4007
4013
  const [additionalArgs, setAdditionalArgs] = useState({});
4008
4014
  const [showSavedFilters, setShowSavedFilters] = useState(false);
4015
+ const [navSessionId, setNavSessionId] = useState("");
4009
4016
  // Selectors
4010
4017
  const filterReducerState = useSelector((state) => state.filterReducer);
4011
4018
  const notificationData = useSelector((state) => state.notificationReducer.notificationData);
@@ -4158,6 +4165,8 @@ const useChatState = () => {
4158
4165
  setAdditionalArgs,
4159
4166
  showSavedFilters,
4160
4167
  setShowSavedFilters,
4168
+ navSessionId,
4169
+ setNavSessionId,
4161
4170
  // Refs
4162
4171
  grabPositionRef,
4163
4172
  chatDataRef,
@@ -5056,6 +5065,10 @@ const sseevent = (message, messageToStoreRef) => {
5056
5065
  : "";
5057
5066
  messageToStoreRef.current.sessionId = parsedData?.session_id;
5058
5067
  }
5068
+ if (messageToStoreRef.current.currentMode === "navigation" &&
5069
+ parsedData?.session_id) {
5070
+ messageToStoreRef.current.navSessionId = parsedData.session_id;
5071
+ }
5059
5072
  if (parsedData?.is_error) {
5060
5073
  messageToStoreRef.current.chatData.response =
5061
5074
  messageToStoreRef.current.chatData.response +
@@ -6535,7 +6548,7 @@ const formatThinkingTime = (seconds) => {
6535
6548
  * @param {Function} botData.utilityObject.setChatDataState - Function to update chat data state
6536
6549
  */
6537
6550
  const StreamedContent = ({ botData }) => {
6538
- const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, baseUrl } = botData.utilityObject || {};
6551
+ const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, baseUrl, setNavSessionId } = botData.utilityObject || {};
6539
6552
  const classes = useStyles$4();
6540
6553
  useStyles$7();
6541
6554
  const dispatch = useDispatch();
@@ -6609,6 +6622,7 @@ const StreamedContent = ({ botData }) => {
6609
6622
  appendedDataFromLastChunk: {},
6610
6623
  initValue: false,
6611
6624
  sessionId: "",
6625
+ navSessionId: "",
6612
6626
  uniqueChatId: "",
6613
6627
  additionalArgs: {},
6614
6628
  });
@@ -6643,7 +6657,7 @@ const StreamedContent = ({ botData }) => {
6643
6657
  // }
6644
6658
  let endPoint = botData?.utilityObject?.endpoint
6645
6659
  ? `${BASE_API}${botData?.utilityObject?.endpoint}`
6646
- : `${BASE_API}/core/chatbot/navigation-v3`;
6660
+ : `${BASE_API}/core/chatbot/navigation-v2`;
6647
6661
  let method = botData?.utilityObject?.method
6648
6662
  ? botData?.utilityObject?.method
6649
6663
  : "PUT";
@@ -7140,6 +7154,9 @@ const StreamedContent = ({ botData }) => {
7140
7154
  },
7141
7155
  },
7142
7156
  };
7157
+ if (messageToStoreRef.current.navSessionId && setNavSessionId) {
7158
+ setNavSessionId(messageToStoreRef.current.navSessionId);
7159
+ }
7143
7160
  processResponse(response, botData.inputBody, currentMode, botData.utilityObject.customChatConfig, {
7144
7161
  newChatData: chatDataInfoRef,
7145
7162
  isTabEnabled: true,
@@ -11453,7 +11470,7 @@ var ChatbotSaveFilterComponent$1 = connect(mapStateToProps, mapDispatchToProps)(
11453
11470
 
11454
11471
  const SmartBot = (props) => {
11455
11472
  const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
11456
- 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, showSavedFilters, setShowSavedFilters, } = useChatState();
11473
+ 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, showSavedFilters, setShowSavedFilters, navSessionId, setNavSessionId, } = useChatState();
11457
11474
  // Add state for confirmation dialogs
11458
11475
  useState(false);
11459
11476
  useState(null);
@@ -11484,7 +11501,7 @@ const SmartBot = (props) => {
11484
11501
  const [savedFilterSets, setSavedFilterSets$1] = useState([]);
11485
11502
  const [selectedFilterSet, setSelectedFilterSet] = useState(null);
11486
11503
  useRef(0);
11487
- 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, setActiveConversationId);
11504
+ 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, setActiveConversationId, navSessionId, setNavSessionId);
11488
11505
  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);
11489
11506
  const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
11490
11507
  const { prepareDataAndSendToAgent, processResponse } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
@@ -12138,6 +12155,7 @@ const SmartBot = (props) => {
12138
12155
  chatDataRef.current[currentMode] = {
12139
12156
  conversations: {},
12140
12157
  };
12158
+ setNavSessionId("");
12141
12159
  setNewChatScreen(true);
12142
12160
  return {
12143
12161
  tabName: currentMode,