impact-chatbot 2.3.56 → 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 +292 -154
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +292 -154
- 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({
|
|
@@ -7505,20 +7526,11 @@ const StreamedContent = ({ botData }) => {
|
|
|
7505
7526
|
if (!questionsStepsMapRef.current[currentIntent]) {
|
|
7506
7527
|
questionsStepsMapRef.current[currentIntent] = [];
|
|
7507
7528
|
if (!questionsRef.current.includes(currentIntent)) {
|
|
7508
|
-
questionsRef.current = [
|
|
7509
|
-
...questionsRef.current,
|
|
7510
|
-
currentIntent,
|
|
7511
|
-
];
|
|
7529
|
+
questionsRef.current = [...questionsRef.current, currentIntent];
|
|
7512
7530
|
setQuestions([...questionsRef.current]);
|
|
7513
7531
|
}
|
|
7532
|
+
setQuestionsStepsMap(cloneDeep(questionsStepsMapRef.current));
|
|
7514
7533
|
}
|
|
7515
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
7516
|
-
if (questionsStepsMapRef.current[currentIntent]?.length > 0) {
|
|
7517
|
-
questionsStepsMapRef.current[currentIntent].forEach((s) => {
|
|
7518
|
-
s.step_status = "completed";
|
|
7519
|
-
});
|
|
7520
|
-
}
|
|
7521
|
-
setQuestionsStepsMap(cloneDeep(questionsStepsMapRef.current));
|
|
7522
7534
|
const sendButton = document.getElementById("chat-input-send-button");
|
|
7523
7535
|
const stepFormSubmitButton = {
|
|
7524
7536
|
type: "button",
|
|
@@ -8629,12 +8641,6 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
8629
8641
|
newQuestions.push(currentIntent);
|
|
8630
8642
|
}
|
|
8631
8643
|
}
|
|
8632
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
8633
|
-
if (newQuestionsStepsMap[currentIntent]?.length > 0) {
|
|
8634
|
-
newQuestionsStepsMap[currentIntent].forEach((s) => {
|
|
8635
|
-
s.step_status = "completed";
|
|
8636
|
-
});
|
|
8637
|
-
}
|
|
8638
8644
|
const submitButton = {
|
|
8639
8645
|
type: "button",
|
|
8640
8646
|
data: {
|
|
@@ -8759,12 +8765,6 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
8759
8765
|
newQuestions.push(currentIntent);
|
|
8760
8766
|
}
|
|
8761
8767
|
}
|
|
8762
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
8763
|
-
if (newQuestionsStepsMap[currentIntent]?.length > 0) {
|
|
8764
|
-
newQuestionsStepsMap[currentIntent].forEach((s) => {
|
|
8765
|
-
s.step_status = "completed";
|
|
8766
|
-
});
|
|
8767
|
-
}
|
|
8768
8768
|
const submitButton = {
|
|
8769
8769
|
type: "button",
|
|
8770
8770
|
data: {
|
|
@@ -13110,6 +13110,7 @@ const SmartBot = (props) => {
|
|
|
13110
13110
|
const [selectedFilterSet, setSelectedFilterSet] = useState(null);
|
|
13111
13111
|
const [answerMode, setAnswerMode] = useState("auto");
|
|
13112
13112
|
const [chatBotWidth, setChatBotWidth] = useState(null);
|
|
13113
|
+
const [tabList, setTabList] = useState([]);
|
|
13113
13114
|
useRef(0);
|
|
13114
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);
|
|
13115
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);
|
|
@@ -13285,6 +13286,271 @@ const SmartBot = (props) => {
|
|
|
13285
13286
|
console.error("handleUploadAccess error", error);
|
|
13286
13287
|
}
|
|
13287
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
|
+
};
|
|
13288
13554
|
const fetchSavedFilterSets = async () => {
|
|
13289
13555
|
try {
|
|
13290
13556
|
const savedFilters = await getFilterUserConfiguration("Chatbot");
|
|
@@ -13317,6 +13583,7 @@ const SmartBot = (props) => {
|
|
|
13317
13583
|
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages, activeConversationId, sessionId, baseUrl]);
|
|
13318
13584
|
useEffect(() => {
|
|
13319
13585
|
handleUploadAccess();
|
|
13586
|
+
handleAgentAccess();
|
|
13320
13587
|
}, []);
|
|
13321
13588
|
useEffect(() => {
|
|
13322
13589
|
configureBotActions();
|
|
@@ -13881,136 +14148,7 @@ const SmartBot = (props) => {
|
|
|
13881
14148
|
onSendIconClick: onSendIconClick, conversation: conversation, onModuleClick: (id, name, param) => {
|
|
13882
14149
|
// activeTab.current.activeTab = name.toLowerCase();
|
|
13883
14150
|
handleModuleSelect(name);
|
|
13884
|
-
}, moduleList: modules, tabList:
|
|
13885
|
-
{
|
|
13886
|
-
name: "Agent",
|
|
13887
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13888
|
-
initialClick: true,
|
|
13889
|
-
onClick: (params) => {
|
|
13890
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13891
|
-
// displaySnackMessages(
|
|
13892
|
-
// "Please wait till the current request is completed",
|
|
13893
|
-
// "warning"
|
|
13894
|
-
// );
|
|
13895
|
-
// return;
|
|
13896
|
-
// } else {
|
|
13897
|
-
setShowSavedFilters(false);
|
|
13898
|
-
const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13899
|
-
const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13900
|
-
if (params?.name?.toLowerCase() === "agent") {
|
|
13901
|
-
if (!isEmpty$1(agentConversations?.[firstConversationId]?.messages)) {
|
|
13902
|
-
setShowChatPlaceholder(false);
|
|
13903
|
-
}
|
|
13904
|
-
else {
|
|
13905
|
-
setShowChatPlaceholder(true);
|
|
13906
|
-
}
|
|
13907
|
-
}
|
|
13908
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13909
|
-
if (firstConversationId) {
|
|
13910
|
-
setActiveConversationId(firstConversationId);
|
|
13911
|
-
}
|
|
13912
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13913
|
-
setNewChatScreen(false);
|
|
13914
|
-
activeTab.current.activeTab = "agent";
|
|
13915
|
-
setIsStop(false);
|
|
13916
|
-
// }
|
|
13917
|
-
// setConversation([]);
|
|
13918
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13919
|
-
},
|
|
13920
|
-
icon: jsx(SvgAgentIcon, {}),
|
|
13921
|
-
},
|
|
13922
|
-
{
|
|
13923
|
-
name: "Navigation",
|
|
13924
|
-
// isActive: activeTab.current.activeTab === "navigation",
|
|
13925
|
-
// initialClick: true,
|
|
13926
|
-
onClick: (params) => {
|
|
13927
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13928
|
-
// displaySnackMessages(
|
|
13929
|
-
// "Please wait till the current request is completed",
|
|
13930
|
-
// "warning"
|
|
13931
|
-
// );
|
|
13932
|
-
// return;
|
|
13933
|
-
// } else {
|
|
13934
|
-
setShowSavedFilters(false);
|
|
13935
|
-
let currentModeValue = params?.name?.toLowerCase();
|
|
13936
|
-
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13937
|
-
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13938
|
-
if (!isEmpty$1(modeConversations?.[firstConversationId]?.messages)) {
|
|
13939
|
-
setNewChatScreen(false);
|
|
13940
|
-
}
|
|
13941
|
-
else {
|
|
13942
|
-
setNewChatScreen(true);
|
|
13943
|
-
}
|
|
13944
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13945
|
-
setShowChatPlaceholder(false);
|
|
13946
|
-
// setConversation({});
|
|
13947
|
-
setLoader(false);
|
|
13948
|
-
activeTab.current.activeTab = "navigation";
|
|
13949
|
-
setHideMenu(false);
|
|
13950
|
-
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13951
|
-
let currentModeData = localStorage.getItem("currentModeData");
|
|
13952
|
-
if (chatDataForReference && currentModeData === "navigation") {
|
|
13953
|
-
let parsedData = JSON.parse(chatDataForReference);
|
|
13954
|
-
chatDataInfoRef.current = cloneDeep(parsedData);
|
|
13955
|
-
}
|
|
13956
|
-
// setNewChatScreen(true);
|
|
13957
|
-
setIsStop(false);
|
|
13958
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13959
|
-
if (firstConversationId) {
|
|
13960
|
-
setActiveConversationId(firstConversationId);
|
|
13961
|
-
}
|
|
13962
|
-
// setConversation([]);
|
|
13963
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13964
|
-
// }
|
|
13965
|
-
},
|
|
13966
|
-
icon: jsx(SvgNavigationIcon, {}),
|
|
13967
|
-
},
|
|
13968
|
-
{
|
|
13969
|
-
name: "Saved Filters",
|
|
13970
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13971
|
-
// initialClick: true,
|
|
13972
|
-
onClick: (params) => {
|
|
13973
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13974
|
-
// displaySnackMessages(
|
|
13975
|
-
// "Please wait till the current request is completed",
|
|
13976
|
-
// "warning"
|
|
13977
|
-
// );
|
|
13978
|
-
// return;
|
|
13979
|
-
// } else {
|
|
13980
|
-
// const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13981
|
-
// const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13982
|
-
if (params?.name?.toLowerCase() === "saved filters") {
|
|
13983
|
-
setNewChatScreen(false);
|
|
13984
|
-
setShowChatPlaceholder(false);
|
|
13985
|
-
setShowSavedFilters(true);
|
|
13986
|
-
// if (
|
|
13987
|
-
// !isEmpty(
|
|
13988
|
-
// agentConversations?.[firstConversationId]?.messages
|
|
13989
|
-
// )
|
|
13990
|
-
// ) {
|
|
13991
|
-
// setShowChatPlaceholder(false);
|
|
13992
|
-
// } else {
|
|
13993
|
-
// setShowChatPlaceholder(true);
|
|
13994
|
-
// }
|
|
13995
|
-
}
|
|
13996
|
-
// setCurrentMode(params?.name?.toLowerCase());
|
|
13997
|
-
// if (firstConversationId) {
|
|
13998
|
-
// setActiveConversationId(firstConversationId);
|
|
13999
|
-
// }
|
|
14000
|
-
// localStorage.setItem(
|
|
14001
|
-
// "currentModeData",
|
|
14002
|
-
// params?.name?.toLowerCase()
|
|
14003
|
-
// );
|
|
14004
|
-
// setNewChatScreen(false);
|
|
14005
|
-
// activeTab.current.activeTab = "agent";
|
|
14006
|
-
// setIsStop(false);
|
|
14007
|
-
// }
|
|
14008
|
-
// setConversation([]);
|
|
14009
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
14010
|
-
},
|
|
14011
|
-
icon: jsx(SvgSaveFilterTab, {}),
|
|
14012
|
-
},
|
|
14013
|
-
], 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 ?
|
|
14014
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 })
|
|
14015
14153
|
:
|
|
14016
14154
|
jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|