impact-chatbot 2.3.55 → 2.3.57
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 +290 -131
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +290 -131
- package/dist/index.esm.js.map +1 -1
- package/dist/services/chatbot-services.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { useCallback, useState, useEffect, useRef, useMemo } from 'react';
|
|
5
5
|
import { COMBINED_CROSS_DIMENSIONAL_API, BASE_API } from 'config/api';
|
|
6
6
|
import axiosInstance from 'core/Utils/axios';
|
|
7
|
-
import 'core/actions/tenantConfigActions';
|
|
7
|
+
import { tenantConfigApiCache } from 'core/actions/tenantConfigActions';
|
|
8
8
|
import { getModuleLevelAccessUtility } from 'core/actions/userAccessActions';
|
|
9
9
|
import { addSnack } from 'core/actions/snackbarActions';
|
|
10
10
|
import moment from 'moment';
|
|
@@ -40,6 +40,7 @@ import RangePicker from 'core/commonComponents/dateRangePicker';
|
|
|
40
40
|
import NoFilterSetSavedIcon from 'core/coreAssets/chatbot/noFilterSetSaved.svg';
|
|
41
41
|
import CoreComponentScreen from 'core/commonComponents/coreComponentScreen';
|
|
42
42
|
import { fetchFilterFieldValues, formattedFilterConfiguration } from 'core/commonComponents/coreComponentScreen/utils';
|
|
43
|
+
import { getApplicationCodeFromURL } from 'core/Utils/utils';
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* Constants extracted from core/constants
|
|
@@ -73,6 +74,26 @@ const fetchRelatedQuestions = (flowType, screen_name) => {
|
|
|
73
74
|
return null;
|
|
74
75
|
}
|
|
75
76
|
};
|
|
77
|
+
const getAgentVisibilityData = () => {
|
|
78
|
+
try {
|
|
79
|
+
return tenantConfigApiCache(3, {
|
|
80
|
+
attribute_name: "show_agent_icon",
|
|
81
|
+
})();
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error("getSmartBotVisibilityData error", error);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const getAgentExceptionUserList = (applicationCode) => {
|
|
88
|
+
try {
|
|
89
|
+
return tenantConfigApiCache(applicationCode, {
|
|
90
|
+
attribute_name: "agent_exception_user_list",
|
|
91
|
+
})();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error("getAgentExceptionUserList error", error);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
76
97
|
const refreshAndUpdateUserManualApi = async (body) => {
|
|
77
98
|
try {
|
|
78
99
|
return axiosInstance({
|
|
@@ -13089,6 +13110,7 @@ const SmartBot = (props) => {
|
|
|
13089
13110
|
const [selectedFilterSet, setSelectedFilterSet] = useState(null);
|
|
13090
13111
|
const [answerMode, setAnswerMode] = useState("auto");
|
|
13091
13112
|
const [chatBotWidth, setChatBotWidth] = useState(null);
|
|
13113
|
+
const [tabList, setTabList] = useState([]);
|
|
13092
13114
|
useRef(0);
|
|
13093
13115
|
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);
|
|
13094
13116
|
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);
|
|
@@ -13264,6 +13286,271 @@ const SmartBot = (props) => {
|
|
|
13264
13286
|
console.error("handleUploadAccess error", error);
|
|
13265
13287
|
}
|
|
13266
13288
|
};
|
|
13289
|
+
const handleAgentAccess = async () => {
|
|
13290
|
+
try {
|
|
13291
|
+
let applicationURL = window.location.pathname.split("/")?.[1];
|
|
13292
|
+
let applicationName = getFormattedApplicationName(applicationURL).toLowerCase();
|
|
13293
|
+
let accessDataResponse = await getModuleLevelAccessUtility({
|
|
13294
|
+
app: applicationName,
|
|
13295
|
+
module: ["ChatbotAgent"],
|
|
13296
|
+
skipHierarchyCall: true,
|
|
13297
|
+
})();
|
|
13298
|
+
let showAgentIcon = await getAgentVisibilityData();
|
|
13299
|
+
if (!isEmpty$1(accessDataResponse) && showAgentIcon) {
|
|
13300
|
+
let appCode = getApplicationCodeFromURL(applicationName);
|
|
13301
|
+
let list = await getAgentExceptionUserList(appCode);
|
|
13302
|
+
let isWhitelisted = false;
|
|
13303
|
+
if (list?.data?.data[0]?.attribute_value?.allow_all) {
|
|
13304
|
+
isWhitelisted = true;
|
|
13305
|
+
}
|
|
13306
|
+
else if (list?.data?.data[0]?.attribute_value?.allow_patterns) {
|
|
13307
|
+
const allowedPatterns = list?.data?.data[0]?.attribute_value?.allow_patterns;
|
|
13308
|
+
const currentUserEmail = localStorage.getItem("name");
|
|
13309
|
+
isWhitelisted = allowedPatterns.some((pattern) => currentUserEmail.includes(pattern));
|
|
13310
|
+
}
|
|
13311
|
+
else if (list?.data?.data[0]?.attribute_value?.allowed_mail_list) {
|
|
13312
|
+
const allowedMailList = list?.data?.data[0]?.attribute_value?.allowed_mail_list;
|
|
13313
|
+
const currentUserEmail = localStorage.getItem("name");
|
|
13314
|
+
isWhitelisted = allowedMailList.includes(currentUserEmail);
|
|
13315
|
+
}
|
|
13316
|
+
let tabListData = isWhitelisted
|
|
13317
|
+
? [
|
|
13318
|
+
{
|
|
13319
|
+
name: "Agent",
|
|
13320
|
+
// isActive: activeTab.current.activeTab === "agent",
|
|
13321
|
+
initialClick: true,
|
|
13322
|
+
onClick: (params) => {
|
|
13323
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13324
|
+
// displaySnackMessages(
|
|
13325
|
+
// "Please wait till the current request is completed",
|
|
13326
|
+
// "warning"
|
|
13327
|
+
// );
|
|
13328
|
+
// return;
|
|
13329
|
+
// } else {
|
|
13330
|
+
setShowSavedFilters(false);
|
|
13331
|
+
const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13332
|
+
const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13333
|
+
if (params?.name?.toLowerCase() === "agent") {
|
|
13334
|
+
if (!isEmpty$1(agentConversations?.[firstConversationId]?.messages)) {
|
|
13335
|
+
setShowChatPlaceholder(false);
|
|
13336
|
+
}
|
|
13337
|
+
else {
|
|
13338
|
+
setShowChatPlaceholder(true);
|
|
13339
|
+
}
|
|
13340
|
+
}
|
|
13341
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13342
|
+
if (firstConversationId) {
|
|
13343
|
+
setActiveConversationId(firstConversationId);
|
|
13344
|
+
}
|
|
13345
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13346
|
+
setNewChatScreen(false);
|
|
13347
|
+
activeTab.current.activeTab = "agent";
|
|
13348
|
+
setIsStop(false);
|
|
13349
|
+
// }
|
|
13350
|
+
// setConversation([]);
|
|
13351
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13352
|
+
},
|
|
13353
|
+
icon: jsx(SvgAgentIcon, {}),
|
|
13354
|
+
},
|
|
13355
|
+
{
|
|
13356
|
+
name: "Navigation",
|
|
13357
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13358
|
+
// initialClick: true,
|
|
13359
|
+
onClick: (params) => {
|
|
13360
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13361
|
+
// displaySnackMessages(
|
|
13362
|
+
// "Please wait till the current request is completed",
|
|
13363
|
+
// "warning"
|
|
13364
|
+
// );
|
|
13365
|
+
// return;
|
|
13366
|
+
// } else {
|
|
13367
|
+
setShowSavedFilters(false);
|
|
13368
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13369
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13370
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13371
|
+
if (!isEmpty$1(modeConversations?.[firstConversationId]?.messages)) {
|
|
13372
|
+
setNewChatScreen(false);
|
|
13373
|
+
}
|
|
13374
|
+
else {
|
|
13375
|
+
setNewChatScreen(true);
|
|
13376
|
+
}
|
|
13377
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13378
|
+
setShowChatPlaceholder(false);
|
|
13379
|
+
// setConversation({});
|
|
13380
|
+
setLoader(false);
|
|
13381
|
+
activeTab.current.activeTab = "navigation";
|
|
13382
|
+
setHideMenu(false);
|
|
13383
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13384
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13385
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13386
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13387
|
+
chatDataInfoRef.current = cloneDeep(parsedData);
|
|
13388
|
+
}
|
|
13389
|
+
// setNewChatScreen(true);
|
|
13390
|
+
setIsStop(false);
|
|
13391
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13392
|
+
if (firstConversationId) {
|
|
13393
|
+
setActiveConversationId(firstConversationId);
|
|
13394
|
+
}
|
|
13395
|
+
// setConversation([]);
|
|
13396
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13397
|
+
// }
|
|
13398
|
+
},
|
|
13399
|
+
icon: jsx(SvgNavigationIcon, {}),
|
|
13400
|
+
},
|
|
13401
|
+
{
|
|
13402
|
+
name: "Saved Filters",
|
|
13403
|
+
// isActive: activeTab.current.activeTab === "agent",
|
|
13404
|
+
// initialClick: true,
|
|
13405
|
+
onClick: (params) => {
|
|
13406
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13407
|
+
// displaySnackMessages(
|
|
13408
|
+
// "Please wait till the current request is completed",
|
|
13409
|
+
// "warning"
|
|
13410
|
+
// );
|
|
13411
|
+
// return;
|
|
13412
|
+
// } else {
|
|
13413
|
+
// const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13414
|
+
// const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13415
|
+
if (params?.name?.toLowerCase() === "saved filters") {
|
|
13416
|
+
setNewChatScreen(false);
|
|
13417
|
+
setShowChatPlaceholder(false);
|
|
13418
|
+
setShowSavedFilters(true);
|
|
13419
|
+
// if (
|
|
13420
|
+
// !isEmpty(
|
|
13421
|
+
// agentConversations?.[firstConversationId]?.messages
|
|
13422
|
+
// )
|
|
13423
|
+
// ) {
|
|
13424
|
+
// setShowChatPlaceholder(false);
|
|
13425
|
+
// } else {
|
|
13426
|
+
// setShowChatPlaceholder(true);
|
|
13427
|
+
// }
|
|
13428
|
+
}
|
|
13429
|
+
// setCurrentMode(params?.name?.toLowerCase());
|
|
13430
|
+
// if (firstConversationId) {
|
|
13431
|
+
// setActiveConversationId(firstConversationId);
|
|
13432
|
+
// }
|
|
13433
|
+
// localStorage.setItem(
|
|
13434
|
+
// "currentModeData",
|
|
13435
|
+
// params?.name?.toLowerCase()
|
|
13436
|
+
// );
|
|
13437
|
+
// setNewChatScreen(false);
|
|
13438
|
+
// activeTab.current.activeTab = "agent";
|
|
13439
|
+
// setIsStop(false);
|
|
13440
|
+
// }
|
|
13441
|
+
// setConversation([]);
|
|
13442
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13443
|
+
},
|
|
13444
|
+
icon: jsx(SvgSaveFilterTab, {}),
|
|
13445
|
+
},
|
|
13446
|
+
] : [
|
|
13447
|
+
{
|
|
13448
|
+
name: "Navigation",
|
|
13449
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13450
|
+
initialClick: true,
|
|
13451
|
+
onClick: (params) => {
|
|
13452
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13453
|
+
// displaySnackMessages(
|
|
13454
|
+
// "Please wait till the current request is completed",
|
|
13455
|
+
// "warning"
|
|
13456
|
+
// );
|
|
13457
|
+
// return;
|
|
13458
|
+
// } else {
|
|
13459
|
+
setShowSavedFilters(false);
|
|
13460
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13461
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13462
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13463
|
+
if (!isEmpty$1(modeConversations?.[firstConversationId]?.messages)) {
|
|
13464
|
+
setNewChatScreen(false);
|
|
13465
|
+
}
|
|
13466
|
+
else {
|
|
13467
|
+
setNewChatScreen(true);
|
|
13468
|
+
}
|
|
13469
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13470
|
+
setShowChatPlaceholder(false);
|
|
13471
|
+
// setConversation({});
|
|
13472
|
+
setLoader(false);
|
|
13473
|
+
activeTab.current.activeTab = "navigation";
|
|
13474
|
+
setHideMenu(false);
|
|
13475
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13476
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13477
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13478
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13479
|
+
chatDataInfoRef.current = cloneDeep(parsedData);
|
|
13480
|
+
}
|
|
13481
|
+
// setNewChatScreen(true);
|
|
13482
|
+
setIsStop(false);
|
|
13483
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13484
|
+
if (firstConversationId) {
|
|
13485
|
+
setActiveConversationId(firstConversationId);
|
|
13486
|
+
}
|
|
13487
|
+
// setConversation([]);
|
|
13488
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13489
|
+
// }
|
|
13490
|
+
},
|
|
13491
|
+
icon: jsx(SvgNavigationIcon, {}),
|
|
13492
|
+
}
|
|
13493
|
+
];
|
|
13494
|
+
setTabList(tabListData);
|
|
13495
|
+
}
|
|
13496
|
+
else {
|
|
13497
|
+
setCurrentMode("navigation");
|
|
13498
|
+
setNewChatScreen(true);
|
|
13499
|
+
setShowChatPlaceholder(false);
|
|
13500
|
+
setTabList([
|
|
13501
|
+
{
|
|
13502
|
+
name: "Navigation",
|
|
13503
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13504
|
+
initialClick: true,
|
|
13505
|
+
onClick: (params) => {
|
|
13506
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13507
|
+
// displaySnackMessages(
|
|
13508
|
+
// "Please wait till the current request is completed",
|
|
13509
|
+
// "warning"
|
|
13510
|
+
// );
|
|
13511
|
+
// return;
|
|
13512
|
+
// } else {
|
|
13513
|
+
setShowSavedFilters(false);
|
|
13514
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13515
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13516
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13517
|
+
if (!isEmpty$1(modeConversations?.[firstConversationId]?.messages)) {
|
|
13518
|
+
setNewChatScreen(false);
|
|
13519
|
+
}
|
|
13520
|
+
else {
|
|
13521
|
+
setNewChatScreen(true);
|
|
13522
|
+
}
|
|
13523
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13524
|
+
setShowChatPlaceholder(false);
|
|
13525
|
+
// setConversation({});
|
|
13526
|
+
setLoader(false);
|
|
13527
|
+
activeTab.current.activeTab = "navigation";
|
|
13528
|
+
setHideMenu(false);
|
|
13529
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13530
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13531
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13532
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13533
|
+
chatDataInfoRef.current = cloneDeep(parsedData);
|
|
13534
|
+
}
|
|
13535
|
+
// setNewChatScreen(true);
|
|
13536
|
+
setIsStop(false);
|
|
13537
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13538
|
+
if (firstConversationId) {
|
|
13539
|
+
setActiveConversationId(firstConversationId);
|
|
13540
|
+
}
|
|
13541
|
+
// setConversation([]);
|
|
13542
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13543
|
+
// }
|
|
13544
|
+
},
|
|
13545
|
+
icon: jsx(SvgNavigationIcon, {}),
|
|
13546
|
+
}
|
|
13547
|
+
]);
|
|
13548
|
+
}
|
|
13549
|
+
}
|
|
13550
|
+
catch (error) {
|
|
13551
|
+
console.error("handleAgentAccess error", error);
|
|
13552
|
+
}
|
|
13553
|
+
};
|
|
13267
13554
|
const fetchSavedFilterSets = async () => {
|
|
13268
13555
|
try {
|
|
13269
13556
|
const savedFilters = await getFilterUserConfiguration("Chatbot");
|
|
@@ -13296,6 +13583,7 @@ const SmartBot = (props) => {
|
|
|
13296
13583
|
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages, activeConversationId, sessionId, baseUrl]);
|
|
13297
13584
|
useEffect(() => {
|
|
13298
13585
|
handleUploadAccess();
|
|
13586
|
+
handleAgentAccess();
|
|
13299
13587
|
}, []);
|
|
13300
13588
|
useEffect(() => {
|
|
13301
13589
|
configureBotActions();
|
|
@@ -13860,136 +14148,7 @@ const SmartBot = (props) => {
|
|
|
13860
14148
|
onSendIconClick: onSendIconClick, conversation: conversation, onModuleClick: (id, name, param) => {
|
|
13861
14149
|
// activeTab.current.activeTab = name.toLowerCase();
|
|
13862
14150
|
handleModuleSelect(name);
|
|
13863
|
-
}, moduleList: modules, tabList:
|
|
13864
|
-
{
|
|
13865
|
-
name: "Agent",
|
|
13866
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13867
|
-
initialClick: true,
|
|
13868
|
-
onClick: (params) => {
|
|
13869
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13870
|
-
// displaySnackMessages(
|
|
13871
|
-
// "Please wait till the current request is completed",
|
|
13872
|
-
// "warning"
|
|
13873
|
-
// );
|
|
13874
|
-
// return;
|
|
13875
|
-
// } else {
|
|
13876
|
-
setShowSavedFilters(false);
|
|
13877
|
-
const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13878
|
-
const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13879
|
-
if (params?.name?.toLowerCase() === "agent") {
|
|
13880
|
-
if (!isEmpty$1(agentConversations?.[firstConversationId]?.messages)) {
|
|
13881
|
-
setShowChatPlaceholder(false);
|
|
13882
|
-
}
|
|
13883
|
-
else {
|
|
13884
|
-
setShowChatPlaceholder(true);
|
|
13885
|
-
}
|
|
13886
|
-
}
|
|
13887
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13888
|
-
if (firstConversationId) {
|
|
13889
|
-
setActiveConversationId(firstConversationId);
|
|
13890
|
-
}
|
|
13891
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13892
|
-
setNewChatScreen(false);
|
|
13893
|
-
activeTab.current.activeTab = "agent";
|
|
13894
|
-
setIsStop(false);
|
|
13895
|
-
// }
|
|
13896
|
-
// setConversation([]);
|
|
13897
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13898
|
-
},
|
|
13899
|
-
icon: jsx(SvgAgentIcon, {}),
|
|
13900
|
-
},
|
|
13901
|
-
{
|
|
13902
|
-
name: "Navigation",
|
|
13903
|
-
// isActive: activeTab.current.activeTab === "navigation",
|
|
13904
|
-
// initialClick: true,
|
|
13905
|
-
onClick: (params) => {
|
|
13906
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13907
|
-
// displaySnackMessages(
|
|
13908
|
-
// "Please wait till the current request is completed",
|
|
13909
|
-
// "warning"
|
|
13910
|
-
// );
|
|
13911
|
-
// return;
|
|
13912
|
-
// } else {
|
|
13913
|
-
setShowSavedFilters(false);
|
|
13914
|
-
let currentModeValue = params?.name?.toLowerCase();
|
|
13915
|
-
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13916
|
-
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13917
|
-
if (!isEmpty$1(modeConversations?.[firstConversationId]?.messages)) {
|
|
13918
|
-
setNewChatScreen(false);
|
|
13919
|
-
}
|
|
13920
|
-
else {
|
|
13921
|
-
setNewChatScreen(true);
|
|
13922
|
-
}
|
|
13923
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13924
|
-
setShowChatPlaceholder(false);
|
|
13925
|
-
// setConversation({});
|
|
13926
|
-
setLoader(false);
|
|
13927
|
-
activeTab.current.activeTab = "navigation";
|
|
13928
|
-
setHideMenu(false);
|
|
13929
|
-
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13930
|
-
let currentModeData = localStorage.getItem("currentModeData");
|
|
13931
|
-
if (chatDataForReference && currentModeData === "navigation") {
|
|
13932
|
-
let parsedData = JSON.parse(chatDataForReference);
|
|
13933
|
-
chatDataInfoRef.current = cloneDeep(parsedData);
|
|
13934
|
-
}
|
|
13935
|
-
// setNewChatScreen(true);
|
|
13936
|
-
setIsStop(false);
|
|
13937
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13938
|
-
if (firstConversationId) {
|
|
13939
|
-
setActiveConversationId(firstConversationId);
|
|
13940
|
-
}
|
|
13941
|
-
// setConversation([]);
|
|
13942
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13943
|
-
// }
|
|
13944
|
-
},
|
|
13945
|
-
icon: jsx(SvgNavigationIcon, {}),
|
|
13946
|
-
},
|
|
13947
|
-
{
|
|
13948
|
-
name: "Saved Filters",
|
|
13949
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13950
|
-
// initialClick: true,
|
|
13951
|
-
onClick: (params) => {
|
|
13952
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13953
|
-
// displaySnackMessages(
|
|
13954
|
-
// "Please wait till the current request is completed",
|
|
13955
|
-
// "warning"
|
|
13956
|
-
// );
|
|
13957
|
-
// return;
|
|
13958
|
-
// } else {
|
|
13959
|
-
// const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13960
|
-
// const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13961
|
-
if (params?.name?.toLowerCase() === "saved filters") {
|
|
13962
|
-
setNewChatScreen(false);
|
|
13963
|
-
setShowChatPlaceholder(false);
|
|
13964
|
-
setShowSavedFilters(true);
|
|
13965
|
-
// if (
|
|
13966
|
-
// !isEmpty(
|
|
13967
|
-
// agentConversations?.[firstConversationId]?.messages
|
|
13968
|
-
// )
|
|
13969
|
-
// ) {
|
|
13970
|
-
// setShowChatPlaceholder(false);
|
|
13971
|
-
// } else {
|
|
13972
|
-
// setShowChatPlaceholder(true);
|
|
13973
|
-
// }
|
|
13974
|
-
}
|
|
13975
|
-
// setCurrentMode(params?.name?.toLowerCase());
|
|
13976
|
-
// if (firstConversationId) {
|
|
13977
|
-
// setActiveConversationId(firstConversationId);
|
|
13978
|
-
// }
|
|
13979
|
-
// localStorage.setItem(
|
|
13980
|
-
// "currentModeData",
|
|
13981
|
-
// params?.name?.toLowerCase()
|
|
13982
|
-
// );
|
|
13983
|
-
// setNewChatScreen(false);
|
|
13984
|
-
// activeTab.current.activeTab = "agent";
|
|
13985
|
-
// setIsStop(false);
|
|
13986
|
-
// }
|
|
13987
|
-
// setConversation([]);
|
|
13988
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13989
|
-
},
|
|
13990
|
-
icon: jsx(SvgSaveFilterTab, {}),
|
|
13991
|
-
},
|
|
13992
|
-
], utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
14151
|
+
}, moduleList: modules, tabList: tabList, utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
13993
14152
|
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 })
|
|
13994
14153
|
:
|
|
13995
14154
|
jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|