impact-chatbot 2.3.79 → 2.3.82
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 +30 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +31 -9
- 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
|
@@ -1173,8 +1173,8 @@ const preprocessMarkdown = (content) => {
|
|
|
1173
1173
|
* Custom components for markdown rendering
|
|
1174
1174
|
*/
|
|
1175
1175
|
const markdownComponents = {
|
|
1176
|
-
// Custom link component
|
|
1177
|
-
a: ({ href, children, ...props }) => (jsxRuntime.jsx("a", { href: href, target: "
|
|
1176
|
+
// Custom link component that opens in the same tab
|
|
1177
|
+
a: ({ href, children, ...props }) => (jsxRuntime.jsx("a", { href: href, target: "_self", ...props, children: children })),
|
|
1178
1178
|
// Custom code component
|
|
1179
1179
|
code: ({ children, className, ...props }) => (jsxRuntime.jsx("code", { className: `markdown-code ${className || ''}`, ...props, children: children })),
|
|
1180
1180
|
// Custom pre component for code blocks
|
|
@@ -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,22 @@ 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
|
+
// Text blocks are skipped because their heading is the echoed user query
|
|
10665
|
+
// (response_heading), which we don't want to duplicate in the response.
|
|
10666
|
+
const renderHeaderTitle = (parsedData) => {
|
|
10667
|
+
const showHeaderTitle = parsedData?.bodyType !== "text" &&
|
|
10668
|
+
!parsedData?.noShowHeaderTitle &&
|
|
10669
|
+
Boolean(parsedData?.headerTitle?.length);
|
|
10670
|
+
if (!showHeaderTitle)
|
|
10671
|
+
return null;
|
|
10672
|
+
return (jsxRuntime.jsx("div", { className: `${classes.chatbotText} ${classes.boldText} ${classes.combinedBlockHeaderTitle}`, children: parsedData.headerTitle }));
|
|
10673
|
+
};
|
|
10652
10674
|
// Function to render individual content based on its type
|
|
10653
10675
|
const renderIndividualContent = (parsedData, index) => {
|
|
10654
10676
|
const key = `combined-content-${index}`;
|
|
@@ -10701,8 +10723,8 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
10701
10723
|
if (!parsedData) {
|
|
10702
10724
|
return null;
|
|
10703
10725
|
}
|
|
10704
|
-
// Render the parsed content
|
|
10705
|
-
return renderIndividualContent(parsedData, index);
|
|
10726
|
+
// Render the parsed content, preceded by the block's header title when present
|
|
10727
|
+
return (jsxRuntime.jsxs(React.Fragment, { children: [renderHeaderTitle(parsedData), renderIndividualContent(parsedData, index)] }, `combined-block-${index}`));
|
|
10706
10728
|
}
|
|
10707
10729
|
catch (error) {
|
|
10708
10730
|
console.error(`Error parsing combined content item at index ${index}:`, error);
|
|
@@ -14913,7 +14935,7 @@ const SmartBot = (props) => {
|
|
|
14913
14935
|
const [chatBotWidth, setChatBotWidth] = React.useState(null);
|
|
14914
14936
|
const [tabList, setTabList] = React.useState([]);
|
|
14915
14937
|
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);
|
|
14938
|
+
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
14939
|
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
14940
|
const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
|
|
14919
14941
|
const { prepareDataAndSendToAgent, processResponse } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|