impact-chatbot 2.3.36 → 2.3.37

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.
@@ -1,4 +1,4 @@
1
- export declare const useChatFlow: (chatDataRef: any, setLoader: any, setFlowType: any, setScreenName: any, setUserInput: any, setQuestionIndex: any, setCurrentAppLink: any, flowType: any, screenName: any, questionIndex: any, userInput: any, dateFormat: any, currentMode: any, activeConversationId: any, setIsModuleChanged: any, chatBodyRef: any, filterReducerState: any, dispatch: any, navigate: any, setShowChatPlaceholder: any, baseUrl: any, setChatDataState: any, setCurrentSessionId: any, customChatConfig: any, chatDataInfoRef: any, chatbotContext: any, setInitValue: any, setSessionId: any, thinkingContent: any, setThinkingContent: any, isThinking: any, setIsThinking: any, chatId: any, setChatId: any, isStop: any, setIsStop: any, functionsRef: any, functionsState: any, setFunctionsState: any, thinkingHeaderMessage: any, setThinkingHeaderMessage: any, uniqueChatId: any, initValue: any, sessionId: any, fieldNumber: any, setFieldNumber: any, additionalArgs: any, setActiveConversationId: any) => {
1
+ export declare const useChatFlow: (chatDataRef: any, setLoader: any, setFlowType: any, setScreenName: any, setUserInput: any, setQuestionIndex: any, setCurrentAppLink: any, flowType: any, screenName: any, questionIndex: any, userInput: any, dateFormat: any, currentMode: any, activeConversationId: any, setIsModuleChanged: any, chatBodyRef: any, filterReducerState: any, dispatch: any, navigate: any, setShowChatPlaceholder: any, baseUrl: any, setChatDataState: any, setCurrentSessionId: any, customChatConfig: any, chatDataInfoRef: any, chatbotContext: any, setInitValue: any, setSessionId: any, thinkingContent: any, setThinkingContent: any, isThinking: any, setIsThinking: any, chatId: any, setChatId: any, isStop: any, setIsStop: any, functionsRef: any, functionsState: any, setFunctionsState: any, thinkingHeaderMessage: any, setThinkingHeaderMessage: any, uniqueChatId: any, initValue: any, sessionId: any, fieldNumber: any, setFieldNumber: any, additionalArgs: any, setActiveConversationId: any, navSessionId: any, setNavSessionId: any) => {
2
2
  setUserFlow: (data: any) => Promise<void>;
3
3
  setUserScreenAndFlow: (data: any) => void;
4
4
  fetchUserResultsFromQuery: (refObject: any, fetchQuestions?: boolean, inputValue?: any, conversationId?: any) => Promise<void>;
@@ -96,6 +96,8 @@ export declare const useChatState: () => {
96
96
  setAdditionalArgs: import("react").Dispatch<import("react").SetStateAction<{}>>;
97
97
  showSavedFilters: boolean;
98
98
  setShowSavedFilters: import("react").Dispatch<import("react").SetStateAction<boolean>>;
99
+ navSessionId: string;
100
+ setNavSessionId: import("react").Dispatch<import("react").SetStateAction<string>>;
99
101
  grabPositionRef: import("react").MutableRefObject<any>;
100
102
  chatDataRef: import("react").MutableRefObject<{
101
103
  insights: {
package/dist/index.cjs.js CHANGED
@@ -2049,7 +2049,11 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
2049
2049
  };
2050
2050
  };
2051
2051
 
2052
- 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) => {
2052
+ 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) => {
2053
+ const navSessionIdRef = React.useRef(navSessionId);
2054
+ React.useEffect(() => {
2055
+ navSessionIdRef.current = navSessionId;
2056
+ }, [navSessionId]);
2053
2057
  const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
2054
2058
  setChatDataState,
2055
2059
  activeConversationId,
@@ -2325,6 +2329,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2325
2329
  else {
2326
2330
  body = {
2327
2331
  query: input,
2332
+ ...(navSessionIdRef.current && { session_id: navSessionIdRef.current }),
2328
2333
  };
2329
2334
  }
2330
2335
  let utitlityObject = {
@@ -2340,6 +2345,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2340
2345
  functionsRef,
2341
2346
  functionsState,
2342
2347
  setFunctionsState,
2348
+ setNavSessionId,
2343
2349
  };
2344
2350
  let response;
2345
2351
  if (input.indexOf("@") > -1) {
@@ -4028,6 +4034,7 @@ const useChatState = () => {
4028
4034
  React.useState(null);
4029
4035
  const [additionalArgs, setAdditionalArgs] = React.useState({});
4030
4036
  const [showSavedFilters, setShowSavedFilters] = React.useState(false);
4037
+ const [navSessionId, setNavSessionId] = React.useState("");
4031
4038
  // Selectors
4032
4039
  const filterReducerState = reactRedux.useSelector((state) => state.filterReducer);
4033
4040
  const notificationData = reactRedux.useSelector((state) => state.notificationReducer.notificationData);
@@ -4180,6 +4187,8 @@ const useChatState = () => {
4180
4187
  setAdditionalArgs,
4181
4188
  showSavedFilters,
4182
4189
  setShowSavedFilters,
4190
+ navSessionId,
4191
+ setNavSessionId,
4183
4192
  // Refs
4184
4193
  grabPositionRef,
4185
4194
  chatDataRef,
@@ -5078,6 +5087,10 @@ const sseevent = (message, messageToStoreRef) => {
5078
5087
  : "";
5079
5088
  messageToStoreRef.current.sessionId = parsedData?.session_id;
5080
5089
  }
5090
+ if (messageToStoreRef.current.currentMode === "navigation" &&
5091
+ parsedData?.session_id) {
5092
+ messageToStoreRef.current.navSessionId = parsedData.session_id;
5093
+ }
5081
5094
  if (parsedData?.is_error) {
5082
5095
  messageToStoreRef.current.chatData.response =
5083
5096
  messageToStoreRef.current.chatData.response +
@@ -6557,7 +6570,7 @@ const formatThinkingTime = (seconds) => {
6557
6570
  * @param {Function} botData.utilityObject.setChatDataState - Function to update chat data state
6558
6571
  */
6559
6572
  const StreamedContent = ({ botData }) => {
6560
- 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 || {};
6573
+ 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 || {};
6561
6574
  const classes = useStyles$4();
6562
6575
  useStyles$7();
6563
6576
  const dispatch = reactRedux.useDispatch();
@@ -6631,6 +6644,7 @@ const StreamedContent = ({ botData }) => {
6631
6644
  appendedDataFromLastChunk: {},
6632
6645
  initValue: false,
6633
6646
  sessionId: "",
6647
+ navSessionId: "",
6634
6648
  uniqueChatId: "",
6635
6649
  additionalArgs: {},
6636
6650
  });
@@ -7162,6 +7176,9 @@ const StreamedContent = ({ botData }) => {
7162
7176
  },
7163
7177
  },
7164
7178
  };
7179
+ if (messageToStoreRef.current.navSessionId && setNavSessionId) {
7180
+ setNavSessionId(messageToStoreRef.current.navSessionId);
7181
+ }
7165
7182
  processResponse(response, botData.inputBody, currentMode, botData.utilityObject.customChatConfig, {
7166
7183
  newChatData: chatDataInfoRef,
7167
7184
  isTabEnabled: true,
@@ -11475,7 +11492,7 @@ var ChatbotSaveFilterComponent$1 = reactRedux.connect(mapStateToProps, mapDispat
11475
11492
 
11476
11493
  const SmartBot = (props) => {
11477
11494
  const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
11478
- 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();
11495
+ 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();
11479
11496
  // Add state for confirmation dialogs
11480
11497
  React.useState(false);
11481
11498
  React.useState(null);
@@ -11506,7 +11523,7 @@ const SmartBot = (props) => {
11506
11523
  const [savedFilterSets, setSavedFilterSets] = React.useState([]);
11507
11524
  const [selectedFilterSet, setSelectedFilterSet] = React.useState(null);
11508
11525
  React.useRef(0);
11509
- 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);
11526
+ 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);
11510
11527
  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);
11511
11528
  const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
11512
11529
  const { prepareDataAndSendToAgent, processResponse } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
@@ -12160,6 +12177,7 @@ const SmartBot = (props) => {
12160
12177
  chatDataRef.current[currentMode] = {
12161
12178
  conversations: {},
12162
12179
  };
12180
+ setNavSessionId("");
12163
12181
  setNewChatScreen(true);
12164
12182
  return {
12165
12183
  tabName: currentMode,