impact-chatbot 2.3.99 → 2.3.101
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.cjs.js +37 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +37 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -783,6 +783,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
783
783
|
isDisabled: data?.data?.isDisabled,
|
|
784
784
|
orientation: data?.data?.orientation,
|
|
785
785
|
options: data?.data?.options,
|
|
786
|
+
defaultSelected: data?.data?.defaultSelected,
|
|
786
787
|
paramName: data?.data?.param_name
|
|
787
788
|
}
|
|
788
789
|
};
|
|
@@ -2815,9 +2816,16 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2815
2816
|
else if (data.actionType === "indirect") {
|
|
2816
2817
|
setUserInput(data.displayText);
|
|
2817
2818
|
}
|
|
2818
|
-
else {
|
|
2819
|
+
else if (data.screen_name) {
|
|
2819
2820
|
fetchUserResultsFromQuery(data, true, "", activeConversationId);
|
|
2820
2821
|
}
|
|
2822
|
+
else {
|
|
2823
|
+
// No screen_name (e.g. suggested follow-up chips from navigation-v2):
|
|
2824
|
+
// treat the chip's displayText as a regular user query so it flows
|
|
2825
|
+
// through the navigation streaming endpoint instead of the
|
|
2826
|
+
// fetchRelatedQuestions screen-based endpoint.
|
|
2827
|
+
fetchUserResultsFromQuery(data, false, data.displayText, activeConversationId);
|
|
2828
|
+
}
|
|
2821
2829
|
}, [activeConversationId, baseUrl]);
|
|
2822
2830
|
const fetchUserResultsFromQuery = React.useCallback(async (refObject, fetchQuestions = false, inputValue = userInput, conversationId = activeConversationId) => {
|
|
2823
2831
|
let flowType = refObject?.flow_type ? refObject?.flow_type : currentMode;
|
|
@@ -7897,13 +7905,36 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
|
|
|
7897
7905
|
const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
7898
7906
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
7899
7907
|
const classes = useStyles$b();
|
|
7900
|
-
const { label, isDisabled, orientation, options } = bodyText;
|
|
7908
|
+
const { label, isDisabled, orientation, options, defaultSelected } = bodyText;
|
|
7901
7909
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
7902
7910
|
const chatbotContextRef = React.useRef(chatbotContext);
|
|
7903
7911
|
chatbotContextRef.current = chatbotContext;
|
|
7904
7912
|
const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
7905
7913
|
const dispatch = reactRedux.useDispatch();
|
|
7906
|
-
const [selectedOption, setSelectedOption] = React.useState(persistedFormValues[formKey] ?? null);
|
|
7914
|
+
const [selectedOption, setSelectedOption] = React.useState(persistedFormValues[formKey] ?? defaultSelected ?? null);
|
|
7915
|
+
// When a defaultSelected value is provided and nothing was previously persisted,
|
|
7916
|
+
// seed Redux state so submit-validation and context are aware of the pre-selection.
|
|
7917
|
+
// Uses getState inside a thunk to read the latest chatbotContext at dispatch time,
|
|
7918
|
+
// avoiding stale-ref overwrites when multiple radio widgets mount in the same flush.
|
|
7919
|
+
React.useEffect(() => {
|
|
7920
|
+
if (defaultSelected && !persistedFormValues[formKey]) {
|
|
7921
|
+
dispatch((dispatchAction, getState) => {
|
|
7922
|
+
const currentContext = getState().smartBotReducer.chatbotContext;
|
|
7923
|
+
dispatchAction({
|
|
7924
|
+
type: "SET_CHATBOT_CONTEXT",
|
|
7925
|
+
payload: {
|
|
7926
|
+
...currentContext,
|
|
7927
|
+
[bodyText?.paramName]: {
|
|
7928
|
+
...currentContext?.[bodyText?.paramName],
|
|
7929
|
+
[bodyText?.paramName]: defaultSelected,
|
|
7930
|
+
updated: true,
|
|
7931
|
+
},
|
|
7932
|
+
},
|
|
7933
|
+
});
|
|
7934
|
+
});
|
|
7935
|
+
dispatch(smartBotActions.setPersistedFormValues({ [formKey]: defaultSelected }));
|
|
7936
|
+
}
|
|
7937
|
+
}, []);
|
|
7907
7938
|
if (lodash.isEmpty(bodyText))
|
|
7908
7939
|
return null;
|
|
7909
7940
|
const handleChange = (selectedOption) => {
|
|
@@ -16709,7 +16740,7 @@ const SmartBot = (props) => {
|
|
|
16709
16740
|
}
|
|
16710
16741
|
}, [forceOpen]);
|
|
16711
16742
|
const [historyPanelData, setHistoryPanelData] = React.useState([]);
|
|
16712
|
-
const { fetchConversations, saveCurrentChat, renameConversation, deleteConversation, fetchConversationChats, fetchChatHistory, renameChat, pinChat, deleteChatById, } = useConversationManagement(chatDataRef, currentMode, activeConversationId, setActiveConversationId, setChatDataState, selectedModule, setSelectedModule, isModuleChanged, setIsModuleChanged, undefined, undefined, chatDataInfoRef, setHistoryPanelData, processResponse);
|
|
16743
|
+
const { loading: conversationLoading, fetchConversations, saveCurrentChat, renameConversation, deleteConversation, fetchConversationChats, fetchChatHistory, renameChat, pinChat, deleteChatById, } = useConversationManagement(chatDataRef, currentMode, activeConversationId, setActiveConversationId, setChatDataState, selectedModule, setSelectedModule, isModuleChanged, setIsModuleChanged, undefined, undefined, chatDataInfoRef, setHistoryPanelData, processResponse);
|
|
16713
16744
|
const handleHistoryMenuAction = React.useCallback(async (action, conversationData) => {
|
|
16714
16745
|
const conversationId = conversationData?.conversation_id;
|
|
16715
16746
|
if (!conversationId)
|
|
@@ -16856,7 +16887,7 @@ const SmartBot = (props) => {
|
|
|
16856
16887
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsxRuntime.jsx(MinimizedChatWidget, { onExpand: () => {
|
|
16857
16888
|
setShowModal(true);
|
|
16858
16889
|
setPartialClose(false);
|
|
16859
|
-
} })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16890
|
+
} })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
16860
16891
|
// onSaveClick={saveCurrentChat}
|
|
16861
16892
|
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
|
|
16862
16893
|
const convId = params?.conversation_id;
|
|
@@ -16971,7 +17002,7 @@ const SmartBot = (props) => {
|
|
|
16971
17002
|
}, moduleList: modules, tabList: tabList, utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
16972
17003
|
jsxRuntime.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, setActiveConversationId: setActiveConversationId, selectedFilterSet: selectedFilterSet, answerMode: answerMode })
|
|
16973
17004
|
:
|
|
16974
|
-
jsxRuntime.jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow:
|
|
17005
|
+
jsxRuntime.jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: true, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
16975
17006
|
freeTextHeading: "Try adding more details :",
|
|
16976
17007
|
freeTextContent: "Iris works better when you provide more context and pointed questions",
|
|
16977
17008
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSavedFilters ? false : showSuggestionBanner, onCloseSuggestionBanner: () => {
|