impact-chatbot 2.3.79 → 2.3.81
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/hooks/useChatFlow.d.ts +1 -1
- package/dist/index.cjs.js +24 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +25 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -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, navSessionId: any, setNavSessionId: 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, setUniqueChatId: any, setAdditionalArgs: 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>;
|
package/dist/index.cjs.js
CHANGED
|
@@ -2201,11 +2201,17 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
2201
2201
|
};
|
|
2202
2202
|
};
|
|
2203
2203
|
|
|
2204
|
-
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) => {
|
|
2204
|
+
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, setUniqueChatId, setAdditionalArgs) => {
|
|
2205
2205
|
const navSessionIdRef = React.useRef(navSessionId);
|
|
2206
2206
|
React.useEffect(() => {
|
|
2207
2207
|
navSessionIdRef.current = navSessionId;
|
|
2208
2208
|
}, [navSessionId]);
|
|
2209
|
+
// Keep a fresh reference to uniqueChatId so callbacks memoized with narrow
|
|
2210
|
+
// deps (e.g. handleUserAction) don't send a stale/empty chat_id on follow-ups.
|
|
2211
|
+
const uniqueChatIdRef = React.useRef(uniqueChatId);
|
|
2212
|
+
React.useEffect(() => {
|
|
2213
|
+
uniqueChatIdRef.current = uniqueChatId;
|
|
2214
|
+
}, [uniqueChatId]);
|
|
2209
2215
|
const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|
|
2210
2216
|
setChatDataState,
|
|
2211
2217
|
activeConversationId,
|
|
@@ -2228,9 +2234,10 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2228
2234
|
thinkingHeaderMessage,
|
|
2229
2235
|
setThinkingHeaderMessage,
|
|
2230
2236
|
uniqueChatId,
|
|
2237
|
+
setUniqueChatId,
|
|
2231
2238
|
fieldNumber,
|
|
2232
2239
|
setFieldNumber,
|
|
2233
|
-
setAdditionalArgs: () => { },
|
|
2240
|
+
setAdditionalArgs: setAdditionalArgs || (() => { }),
|
|
2234
2241
|
});
|
|
2235
2242
|
const getCurrentDateTimeString = () => {
|
|
2236
2243
|
return moment().format(dateFormat);
|
|
@@ -2393,7 +2400,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2393
2400
|
sessionId: sessionId,
|
|
2394
2401
|
setSessionId: setSessionId,
|
|
2395
2402
|
setInitValue: setInitValue,
|
|
2396
|
-
uniqueChatId:
|
|
2403
|
+
uniqueChatId: uniqueChatIdRef.current,
|
|
2397
2404
|
additionalArgs: additionalArgs,
|
|
2398
2405
|
});
|
|
2399
2406
|
}
|
|
@@ -3613,6 +3620,9 @@ const useStyles$a = styles.makeStyles((theme) => ({
|
|
|
3613
3620
|
boldText: {
|
|
3614
3621
|
fontWeight: 600,
|
|
3615
3622
|
},
|
|
3623
|
+
combinedBlockHeaderTitle: {
|
|
3624
|
+
marginBottom: "0.5rem",
|
|
3625
|
+
},
|
|
3616
3626
|
botViewHeader: {
|
|
3617
3627
|
color: theme.palette.textColours.botDateChipText,
|
|
3618
3628
|
},
|
|
@@ -10645,10 +10655,18 @@ const resetActiveTabularInstance = () => {
|
|
|
10645
10655
|
};
|
|
10646
10656
|
|
|
10647
10657
|
const CombinedContent = ({ botData, props }) => {
|
|
10658
|
+
const classes = useStyles$a();
|
|
10648
10659
|
const isFormDisabled = botData?.isFormDisabled || false;
|
|
10649
10660
|
const isTabEnabled = botData?.utilityData?.isTabEnabled;
|
|
10650
10661
|
// Get the array of content items from bodyText
|
|
10651
10662
|
const contentItems = Array.isArray(botData.bodyText) ? botData.bodyText : [];
|
|
10663
|
+
// Renders the optional block-level header title above a content item
|
|
10664
|
+
const renderHeaderTitle = (parsedData) => {
|
|
10665
|
+
const showHeaderTitle = !parsedData?.noShowHeaderTitle && Boolean(parsedData?.headerTitle?.length);
|
|
10666
|
+
if (!showHeaderTitle)
|
|
10667
|
+
return null;
|
|
10668
|
+
return (jsxRuntime.jsx("div", { className: `${classes.chatbotText} ${classes.boldText} ${classes.combinedBlockHeaderTitle}`, children: parsedData.headerTitle }));
|
|
10669
|
+
};
|
|
10652
10670
|
// Function to render individual content based on its type
|
|
10653
10671
|
const renderIndividualContent = (parsedData, index) => {
|
|
10654
10672
|
const key = `combined-content-${index}`;
|
|
@@ -10701,8 +10719,8 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
10701
10719
|
if (!parsedData) {
|
|
10702
10720
|
return null;
|
|
10703
10721
|
}
|
|
10704
|
-
// Render the parsed content
|
|
10705
|
-
return renderIndividualContent(parsedData, index);
|
|
10722
|
+
// Render the parsed content, preceded by the block's header title when present
|
|
10723
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [renderHeaderTitle(parsedData), renderIndividualContent(parsedData, index)] }, `combined-block-${index}`));
|
|
10706
10724
|
}
|
|
10707
10725
|
catch (error) {
|
|
10708
10726
|
console.error(`Error parsing combined content item at index ${index}:`, error);
|
|
@@ -14913,7 +14931,7 @@ const SmartBot = (props) => {
|
|
|
14913
14931
|
const [chatBotWidth, setChatBotWidth] = React.useState(null);
|
|
14914
14932
|
const [tabList, setTabList] = React.useState([]);
|
|
14915
14933
|
React.useRef(0);
|
|
14916
|
-
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);
|
|
14934
|
+
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, setUniqueChatId, setAdditionalArgs);
|
|
14917
14935
|
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);
|
|
14918
14936
|
const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
|
|
14919
14937
|
const { prepareDataAndSendToAgent, processResponse } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|