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.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var lodash = require('lodash');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var api = require('config/api');
|
|
9
9
|
var axiosInstance = require('core/Utils/axios');
|
|
10
|
-
require('core/actions/tenantConfigActions');
|
|
10
|
+
var tenantConfigActions = require('core/actions/tenantConfigActions');
|
|
11
11
|
var userAccessActions = require('core/actions/userAccessActions');
|
|
12
12
|
var snackbarActions = require('core/actions/snackbarActions');
|
|
13
13
|
var moment = require('moment');
|
|
@@ -43,6 +43,7 @@ var RangePicker = require('core/commonComponents/dateRangePicker');
|
|
|
43
43
|
var NoFilterSetSavedIcon = require('core/coreAssets/chatbot/noFilterSetSaved.svg');
|
|
44
44
|
var CoreComponentScreen = require('core/commonComponents/coreComponentScreen');
|
|
45
45
|
var utils$1 = require('core/commonComponents/coreComponentScreen/utils');
|
|
46
|
+
var utils$2 = require('core/Utils/utils');
|
|
46
47
|
|
|
47
48
|
function _interopNamespaceDefault(e) {
|
|
48
49
|
var n = Object.create(null);
|
|
@@ -95,6 +96,26 @@ const fetchRelatedQuestions = (flowType, screen_name) => {
|
|
|
95
96
|
return null;
|
|
96
97
|
}
|
|
97
98
|
};
|
|
99
|
+
const getAgentVisibilityData = () => {
|
|
100
|
+
try {
|
|
101
|
+
return tenantConfigActions.tenantConfigApiCache(3, {
|
|
102
|
+
attribute_name: "show_agent_icon",
|
|
103
|
+
})();
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error("getSmartBotVisibilityData error", error);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const getAgentExceptionUserList = (applicationCode) => {
|
|
110
|
+
try {
|
|
111
|
+
return tenantConfigActions.tenantConfigApiCache(applicationCode, {
|
|
112
|
+
attribute_name: "agent_exception_user_list",
|
|
113
|
+
})();
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error("getAgentExceptionUserList error", error);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
98
119
|
const refreshAndUpdateUserManualApi = async (body) => {
|
|
99
120
|
try {
|
|
100
121
|
return axiosInstance({
|
|
@@ -7527,20 +7548,11 @@ const StreamedContent = ({ botData }) => {
|
|
|
7527
7548
|
if (!questionsStepsMapRef.current[currentIntent]) {
|
|
7528
7549
|
questionsStepsMapRef.current[currentIntent] = [];
|
|
7529
7550
|
if (!questionsRef.current.includes(currentIntent)) {
|
|
7530
|
-
questionsRef.current = [
|
|
7531
|
-
...questionsRef.current,
|
|
7532
|
-
currentIntent,
|
|
7533
|
-
];
|
|
7551
|
+
questionsRef.current = [...questionsRef.current, currentIntent];
|
|
7534
7552
|
setQuestions([...questionsRef.current]);
|
|
7535
7553
|
}
|
|
7554
|
+
setQuestionsStepsMap(lodash.cloneDeep(questionsStepsMapRef.current));
|
|
7536
7555
|
}
|
|
7537
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
7538
|
-
if (questionsStepsMapRef.current[currentIntent]?.length > 0) {
|
|
7539
|
-
questionsStepsMapRef.current[currentIntent].forEach((s) => {
|
|
7540
|
-
s.step_status = "completed";
|
|
7541
|
-
});
|
|
7542
|
-
}
|
|
7543
|
-
setQuestionsStepsMap(lodash.cloneDeep(questionsStepsMapRef.current));
|
|
7544
7556
|
const sendButton = document.getElementById("chat-input-send-button");
|
|
7545
7557
|
const stepFormSubmitButton = {
|
|
7546
7558
|
type: "button",
|
|
@@ -8651,12 +8663,6 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
8651
8663
|
newQuestions.push(currentIntent);
|
|
8652
8664
|
}
|
|
8653
8665
|
}
|
|
8654
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
8655
|
-
if (newQuestionsStepsMap[currentIntent]?.length > 0) {
|
|
8656
|
-
newQuestionsStepsMap[currentIntent].forEach((s) => {
|
|
8657
|
-
s.step_status = "completed";
|
|
8658
|
-
});
|
|
8659
|
-
}
|
|
8660
8666
|
const submitButton = {
|
|
8661
8667
|
type: "button",
|
|
8662
8668
|
data: {
|
|
@@ -8781,12 +8787,6 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
8781
8787
|
newQuestions.push(currentIntent);
|
|
8782
8788
|
}
|
|
8783
8789
|
}
|
|
8784
|
-
// Mark all steps under this intent as completed — the form is the final state
|
|
8785
|
-
if (newQuestionsStepsMap[currentIntent]?.length > 0) {
|
|
8786
|
-
newQuestionsStepsMap[currentIntent].forEach((s) => {
|
|
8787
|
-
s.step_status = "completed";
|
|
8788
|
-
});
|
|
8789
|
-
}
|
|
8790
8790
|
const submitButton = {
|
|
8791
8791
|
type: "button",
|
|
8792
8792
|
data: {
|
|
@@ -13132,6 +13132,7 @@ const SmartBot = (props) => {
|
|
|
13132
13132
|
const [selectedFilterSet, setSelectedFilterSet] = React.useState(null);
|
|
13133
13133
|
const [answerMode, setAnswerMode] = React.useState("auto");
|
|
13134
13134
|
const [chatBotWidth, setChatBotWidth] = React.useState(null);
|
|
13135
|
+
const [tabList, setTabList] = React.useState([]);
|
|
13135
13136
|
React.useRef(0);
|
|
13136
13137
|
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);
|
|
13137
13138
|
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);
|
|
@@ -13307,6 +13308,271 @@ const SmartBot = (props) => {
|
|
|
13307
13308
|
console.error("handleUploadAccess error", error);
|
|
13308
13309
|
}
|
|
13309
13310
|
};
|
|
13311
|
+
const handleAgentAccess = async () => {
|
|
13312
|
+
try {
|
|
13313
|
+
let applicationURL = window.location.pathname.split("/")?.[1];
|
|
13314
|
+
let applicationName = getFormattedApplicationName(applicationURL).toLowerCase();
|
|
13315
|
+
let accessDataResponse = await userAccessActions.getModuleLevelAccessUtility({
|
|
13316
|
+
app: applicationName,
|
|
13317
|
+
module: ["ChatbotAgent"],
|
|
13318
|
+
skipHierarchyCall: true,
|
|
13319
|
+
})();
|
|
13320
|
+
let showAgentIcon = await getAgentVisibilityData();
|
|
13321
|
+
if (!lodash.isEmpty(accessDataResponse) && showAgentIcon) {
|
|
13322
|
+
let appCode = utils$2.getApplicationCodeFromURL(applicationName);
|
|
13323
|
+
let list = await getAgentExceptionUserList(appCode);
|
|
13324
|
+
let isWhitelisted = false;
|
|
13325
|
+
if (list?.data?.data[0]?.attribute_value?.allow_all) {
|
|
13326
|
+
isWhitelisted = true;
|
|
13327
|
+
}
|
|
13328
|
+
else if (list?.data?.data[0]?.attribute_value?.allow_patterns) {
|
|
13329
|
+
const allowedPatterns = list?.data?.data[0]?.attribute_value?.allow_patterns;
|
|
13330
|
+
const currentUserEmail = localStorage.getItem("name");
|
|
13331
|
+
isWhitelisted = allowedPatterns.some((pattern) => currentUserEmail.includes(pattern));
|
|
13332
|
+
}
|
|
13333
|
+
else if (list?.data?.data[0]?.attribute_value?.allowed_mail_list) {
|
|
13334
|
+
const allowedMailList = list?.data?.data[0]?.attribute_value?.allowed_mail_list;
|
|
13335
|
+
const currentUserEmail = localStorage.getItem("name");
|
|
13336
|
+
isWhitelisted = allowedMailList.includes(currentUserEmail);
|
|
13337
|
+
}
|
|
13338
|
+
let tabListData = isWhitelisted
|
|
13339
|
+
? [
|
|
13340
|
+
{
|
|
13341
|
+
name: "Agent",
|
|
13342
|
+
// isActive: activeTab.current.activeTab === "agent",
|
|
13343
|
+
initialClick: true,
|
|
13344
|
+
onClick: (params) => {
|
|
13345
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13346
|
+
// displaySnackMessages(
|
|
13347
|
+
// "Please wait till the current request is completed",
|
|
13348
|
+
// "warning"
|
|
13349
|
+
// );
|
|
13350
|
+
// return;
|
|
13351
|
+
// } else {
|
|
13352
|
+
setShowSavedFilters(false);
|
|
13353
|
+
const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13354
|
+
const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13355
|
+
if (params?.name?.toLowerCase() === "agent") {
|
|
13356
|
+
if (!lodash.isEmpty(agentConversations?.[firstConversationId]?.messages)) {
|
|
13357
|
+
setShowChatPlaceholder(false);
|
|
13358
|
+
}
|
|
13359
|
+
else {
|
|
13360
|
+
setShowChatPlaceholder(true);
|
|
13361
|
+
}
|
|
13362
|
+
}
|
|
13363
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13364
|
+
if (firstConversationId) {
|
|
13365
|
+
setActiveConversationId(firstConversationId);
|
|
13366
|
+
}
|
|
13367
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13368
|
+
setNewChatScreen(false);
|
|
13369
|
+
activeTab.current.activeTab = "agent";
|
|
13370
|
+
setIsStop(false);
|
|
13371
|
+
// }
|
|
13372
|
+
// setConversation([]);
|
|
13373
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13374
|
+
},
|
|
13375
|
+
icon: jsxRuntime.jsx(SvgAgentIcon, {}),
|
|
13376
|
+
},
|
|
13377
|
+
{
|
|
13378
|
+
name: "Navigation",
|
|
13379
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13380
|
+
// initialClick: true,
|
|
13381
|
+
onClick: (params) => {
|
|
13382
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13383
|
+
// displaySnackMessages(
|
|
13384
|
+
// "Please wait till the current request is completed",
|
|
13385
|
+
// "warning"
|
|
13386
|
+
// );
|
|
13387
|
+
// return;
|
|
13388
|
+
// } else {
|
|
13389
|
+
setShowSavedFilters(false);
|
|
13390
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13391
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13392
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13393
|
+
if (!lodash.isEmpty(modeConversations?.[firstConversationId]?.messages)) {
|
|
13394
|
+
setNewChatScreen(false);
|
|
13395
|
+
}
|
|
13396
|
+
else {
|
|
13397
|
+
setNewChatScreen(true);
|
|
13398
|
+
}
|
|
13399
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13400
|
+
setShowChatPlaceholder(false);
|
|
13401
|
+
// setConversation({});
|
|
13402
|
+
setLoader(false);
|
|
13403
|
+
activeTab.current.activeTab = "navigation";
|
|
13404
|
+
setHideMenu(false);
|
|
13405
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13406
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13407
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13408
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13409
|
+
chatDataInfoRef.current = lodash.cloneDeep(parsedData);
|
|
13410
|
+
}
|
|
13411
|
+
// setNewChatScreen(true);
|
|
13412
|
+
setIsStop(false);
|
|
13413
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13414
|
+
if (firstConversationId) {
|
|
13415
|
+
setActiveConversationId(firstConversationId);
|
|
13416
|
+
}
|
|
13417
|
+
// setConversation([]);
|
|
13418
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13419
|
+
// }
|
|
13420
|
+
},
|
|
13421
|
+
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
13422
|
+
},
|
|
13423
|
+
{
|
|
13424
|
+
name: "Saved Filters",
|
|
13425
|
+
// isActive: activeTab.current.activeTab === "agent",
|
|
13426
|
+
// initialClick: true,
|
|
13427
|
+
onClick: (params) => {
|
|
13428
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13429
|
+
// displaySnackMessages(
|
|
13430
|
+
// "Please wait till the current request is completed",
|
|
13431
|
+
// "warning"
|
|
13432
|
+
// );
|
|
13433
|
+
// return;
|
|
13434
|
+
// } else {
|
|
13435
|
+
// const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13436
|
+
// const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13437
|
+
if (params?.name?.toLowerCase() === "saved filters") {
|
|
13438
|
+
setNewChatScreen(false);
|
|
13439
|
+
setShowChatPlaceholder(false);
|
|
13440
|
+
setShowSavedFilters(true);
|
|
13441
|
+
// if (
|
|
13442
|
+
// !isEmpty(
|
|
13443
|
+
// agentConversations?.[firstConversationId]?.messages
|
|
13444
|
+
// )
|
|
13445
|
+
// ) {
|
|
13446
|
+
// setShowChatPlaceholder(false);
|
|
13447
|
+
// } else {
|
|
13448
|
+
// setShowChatPlaceholder(true);
|
|
13449
|
+
// }
|
|
13450
|
+
}
|
|
13451
|
+
// setCurrentMode(params?.name?.toLowerCase());
|
|
13452
|
+
// if (firstConversationId) {
|
|
13453
|
+
// setActiveConversationId(firstConversationId);
|
|
13454
|
+
// }
|
|
13455
|
+
// localStorage.setItem(
|
|
13456
|
+
// "currentModeData",
|
|
13457
|
+
// params?.name?.toLowerCase()
|
|
13458
|
+
// );
|
|
13459
|
+
// setNewChatScreen(false);
|
|
13460
|
+
// activeTab.current.activeTab = "agent";
|
|
13461
|
+
// setIsStop(false);
|
|
13462
|
+
// }
|
|
13463
|
+
// setConversation([]);
|
|
13464
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13465
|
+
},
|
|
13466
|
+
icon: jsxRuntime.jsx(SvgSaveFilterTab, {}),
|
|
13467
|
+
},
|
|
13468
|
+
] : [
|
|
13469
|
+
{
|
|
13470
|
+
name: "Navigation",
|
|
13471
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13472
|
+
initialClick: true,
|
|
13473
|
+
onClick: (params) => {
|
|
13474
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13475
|
+
// displaySnackMessages(
|
|
13476
|
+
// "Please wait till the current request is completed",
|
|
13477
|
+
// "warning"
|
|
13478
|
+
// );
|
|
13479
|
+
// return;
|
|
13480
|
+
// } else {
|
|
13481
|
+
setShowSavedFilters(false);
|
|
13482
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13483
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13484
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13485
|
+
if (!lodash.isEmpty(modeConversations?.[firstConversationId]?.messages)) {
|
|
13486
|
+
setNewChatScreen(false);
|
|
13487
|
+
}
|
|
13488
|
+
else {
|
|
13489
|
+
setNewChatScreen(true);
|
|
13490
|
+
}
|
|
13491
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13492
|
+
setShowChatPlaceholder(false);
|
|
13493
|
+
// setConversation({});
|
|
13494
|
+
setLoader(false);
|
|
13495
|
+
activeTab.current.activeTab = "navigation";
|
|
13496
|
+
setHideMenu(false);
|
|
13497
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13498
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13499
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13500
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13501
|
+
chatDataInfoRef.current = lodash.cloneDeep(parsedData);
|
|
13502
|
+
}
|
|
13503
|
+
// setNewChatScreen(true);
|
|
13504
|
+
setIsStop(false);
|
|
13505
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13506
|
+
if (firstConversationId) {
|
|
13507
|
+
setActiveConversationId(firstConversationId);
|
|
13508
|
+
}
|
|
13509
|
+
// setConversation([]);
|
|
13510
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13511
|
+
// }
|
|
13512
|
+
},
|
|
13513
|
+
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
13514
|
+
}
|
|
13515
|
+
];
|
|
13516
|
+
setTabList(tabListData);
|
|
13517
|
+
}
|
|
13518
|
+
else {
|
|
13519
|
+
setCurrentMode("navigation");
|
|
13520
|
+
setNewChatScreen(true);
|
|
13521
|
+
setShowChatPlaceholder(false);
|
|
13522
|
+
setTabList([
|
|
13523
|
+
{
|
|
13524
|
+
name: "Navigation",
|
|
13525
|
+
// isActive: activeTab.current.activeTab === "navigation",
|
|
13526
|
+
initialClick: true,
|
|
13527
|
+
onClick: (params) => {
|
|
13528
|
+
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13529
|
+
// displaySnackMessages(
|
|
13530
|
+
// "Please wait till the current request is completed",
|
|
13531
|
+
// "warning"
|
|
13532
|
+
// );
|
|
13533
|
+
// return;
|
|
13534
|
+
// } else {
|
|
13535
|
+
setShowSavedFilters(false);
|
|
13536
|
+
let currentModeValue = params?.name?.toLowerCase();
|
|
13537
|
+
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13538
|
+
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13539
|
+
if (!lodash.isEmpty(modeConversations?.[firstConversationId]?.messages)) {
|
|
13540
|
+
setNewChatScreen(false);
|
|
13541
|
+
}
|
|
13542
|
+
else {
|
|
13543
|
+
setNewChatScreen(true);
|
|
13544
|
+
}
|
|
13545
|
+
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13546
|
+
setShowChatPlaceholder(false);
|
|
13547
|
+
// setConversation({});
|
|
13548
|
+
setLoader(false);
|
|
13549
|
+
activeTab.current.activeTab = "navigation";
|
|
13550
|
+
setHideMenu(false);
|
|
13551
|
+
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13552
|
+
let currentModeData = localStorage.getItem("currentModeData");
|
|
13553
|
+
if (chatDataForReference && currentModeData === "navigation") {
|
|
13554
|
+
let parsedData = JSON.parse(chatDataForReference);
|
|
13555
|
+
chatDataInfoRef.current = lodash.cloneDeep(parsedData);
|
|
13556
|
+
}
|
|
13557
|
+
// setNewChatScreen(true);
|
|
13558
|
+
setIsStop(false);
|
|
13559
|
+
setCurrentMode(params?.name?.toLowerCase());
|
|
13560
|
+
if (firstConversationId) {
|
|
13561
|
+
setActiveConversationId(firstConversationId);
|
|
13562
|
+
}
|
|
13563
|
+
// setConversation([]);
|
|
13564
|
+
// chatDataInfoRef.current[currentMode] = [];
|
|
13565
|
+
// }
|
|
13566
|
+
},
|
|
13567
|
+
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
13568
|
+
}
|
|
13569
|
+
]);
|
|
13570
|
+
}
|
|
13571
|
+
}
|
|
13572
|
+
catch (error) {
|
|
13573
|
+
console.error("handleAgentAccess error", error);
|
|
13574
|
+
}
|
|
13575
|
+
};
|
|
13310
13576
|
const fetchSavedFilterSets = async () => {
|
|
13311
13577
|
try {
|
|
13312
13578
|
const savedFilters = await filterAction.getFilterUserConfiguration("Chatbot");
|
|
@@ -13339,6 +13605,7 @@ const SmartBot = (props) => {
|
|
|
13339
13605
|
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages, activeConversationId, sessionId, baseUrl]);
|
|
13340
13606
|
React.useEffect(() => {
|
|
13341
13607
|
handleUploadAccess();
|
|
13608
|
+
handleAgentAccess();
|
|
13342
13609
|
}, []);
|
|
13343
13610
|
React.useEffect(() => {
|
|
13344
13611
|
configureBotActions();
|
|
@@ -13903,136 +14170,7 @@ const SmartBot = (props) => {
|
|
|
13903
14170
|
onSendIconClick: onSendIconClick, conversation: conversation, onModuleClick: (id, name, param) => {
|
|
13904
14171
|
// activeTab.current.activeTab = name.toLowerCase();
|
|
13905
14172
|
handleModuleSelect(name);
|
|
13906
|
-
}, moduleList: modules, tabList:
|
|
13907
|
-
{
|
|
13908
|
-
name: "Agent",
|
|
13909
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13910
|
-
initialClick: true,
|
|
13911
|
-
onClick: (params) => {
|
|
13912
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13913
|
-
// displaySnackMessages(
|
|
13914
|
-
// "Please wait till the current request is completed",
|
|
13915
|
-
// "warning"
|
|
13916
|
-
// );
|
|
13917
|
-
// return;
|
|
13918
|
-
// } else {
|
|
13919
|
-
setShowSavedFilters(false);
|
|
13920
|
-
const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
13921
|
-
const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
13922
|
-
if (params?.name?.toLowerCase() === "agent") {
|
|
13923
|
-
if (!lodash.isEmpty(agentConversations?.[firstConversationId]?.messages)) {
|
|
13924
|
-
setShowChatPlaceholder(false);
|
|
13925
|
-
}
|
|
13926
|
-
else {
|
|
13927
|
-
setShowChatPlaceholder(true);
|
|
13928
|
-
}
|
|
13929
|
-
}
|
|
13930
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13931
|
-
if (firstConversationId) {
|
|
13932
|
-
setActiveConversationId(firstConversationId);
|
|
13933
|
-
}
|
|
13934
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13935
|
-
setNewChatScreen(false);
|
|
13936
|
-
activeTab.current.activeTab = "agent";
|
|
13937
|
-
setIsStop(false);
|
|
13938
|
-
// }
|
|
13939
|
-
// setConversation([]);
|
|
13940
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13941
|
-
},
|
|
13942
|
-
icon: jsxRuntime.jsx(SvgAgentIcon, {}),
|
|
13943
|
-
},
|
|
13944
|
-
{
|
|
13945
|
-
name: "Navigation",
|
|
13946
|
-
// isActive: activeTab.current.activeTab === "navigation",
|
|
13947
|
-
// initialClick: true,
|
|
13948
|
-
onClick: (params) => {
|
|
13949
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13950
|
-
// displaySnackMessages(
|
|
13951
|
-
// "Please wait till the current request is completed",
|
|
13952
|
-
// "warning"
|
|
13953
|
-
// );
|
|
13954
|
-
// return;
|
|
13955
|
-
// } else {
|
|
13956
|
-
setShowSavedFilters(false);
|
|
13957
|
-
let currentModeValue = params?.name?.toLowerCase();
|
|
13958
|
-
const modeConversations = chatDataInfoRef?.current[currentModeValue]?.conversations;
|
|
13959
|
-
const firstConversationId = modeConversations ? Object.keys(modeConversations)[0] : undefined;
|
|
13960
|
-
if (!lodash.isEmpty(modeConversations?.[firstConversationId]?.messages)) {
|
|
13961
|
-
setNewChatScreen(false);
|
|
13962
|
-
}
|
|
13963
|
-
else {
|
|
13964
|
-
setNewChatScreen(true);
|
|
13965
|
-
}
|
|
13966
|
-
localStorage.setItem("currentModeData", params?.name?.toLowerCase());
|
|
13967
|
-
setShowChatPlaceholder(false);
|
|
13968
|
-
// setConversation({});
|
|
13969
|
-
setLoader(false);
|
|
13970
|
-
activeTab.current.activeTab = "navigation";
|
|
13971
|
-
setHideMenu(false);
|
|
13972
|
-
let chatDataForReference = localStorage.getItem("chatDataForReference");
|
|
13973
|
-
let currentModeData = localStorage.getItem("currentModeData");
|
|
13974
|
-
if (chatDataForReference && currentModeData === "navigation") {
|
|
13975
|
-
let parsedData = JSON.parse(chatDataForReference);
|
|
13976
|
-
chatDataInfoRef.current = lodash.cloneDeep(parsedData);
|
|
13977
|
-
}
|
|
13978
|
-
// setNewChatScreen(true);
|
|
13979
|
-
setIsStop(false);
|
|
13980
|
-
setCurrentMode(params?.name?.toLowerCase());
|
|
13981
|
-
if (firstConversationId) {
|
|
13982
|
-
setActiveConversationId(firstConversationId);
|
|
13983
|
-
}
|
|
13984
|
-
// setConversation([]);
|
|
13985
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
13986
|
-
// }
|
|
13987
|
-
},
|
|
13988
|
-
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
13989
|
-
},
|
|
13990
|
-
{
|
|
13991
|
-
name: "Saved Filters",
|
|
13992
|
-
// isActive: activeTab.current.activeTab === "agent",
|
|
13993
|
-
// initialClick: true,
|
|
13994
|
-
onClick: (params) => {
|
|
13995
|
-
// if (localStorage.getItem("isStreaming") === "true") {
|
|
13996
|
-
// displaySnackMessages(
|
|
13997
|
-
// "Please wait till the current request is completed",
|
|
13998
|
-
// "warning"
|
|
13999
|
-
// );
|
|
14000
|
-
// return;
|
|
14001
|
-
// } else {
|
|
14002
|
-
// const agentConversations = chatDataInfoRef?.current[params?.name?.toLowerCase()]?.conversations;
|
|
14003
|
-
// const firstConversationId = agentConversations ? Object.keys(agentConversations)[0] : undefined;
|
|
14004
|
-
if (params?.name?.toLowerCase() === "saved filters") {
|
|
14005
|
-
setNewChatScreen(false);
|
|
14006
|
-
setShowChatPlaceholder(false);
|
|
14007
|
-
setShowSavedFilters(true);
|
|
14008
|
-
// if (
|
|
14009
|
-
// !isEmpty(
|
|
14010
|
-
// agentConversations?.[firstConversationId]?.messages
|
|
14011
|
-
// )
|
|
14012
|
-
// ) {
|
|
14013
|
-
// setShowChatPlaceholder(false);
|
|
14014
|
-
// } else {
|
|
14015
|
-
// setShowChatPlaceholder(true);
|
|
14016
|
-
// }
|
|
14017
|
-
}
|
|
14018
|
-
// setCurrentMode(params?.name?.toLowerCase());
|
|
14019
|
-
// if (firstConversationId) {
|
|
14020
|
-
// setActiveConversationId(firstConversationId);
|
|
14021
|
-
// }
|
|
14022
|
-
// localStorage.setItem(
|
|
14023
|
-
// "currentModeData",
|
|
14024
|
-
// params?.name?.toLowerCase()
|
|
14025
|
-
// );
|
|
14026
|
-
// setNewChatScreen(false);
|
|
14027
|
-
// activeTab.current.activeTab = "agent";
|
|
14028
|
-
// setIsStop(false);
|
|
14029
|
-
// }
|
|
14030
|
-
// setConversation([]);
|
|
14031
|
-
// chatDataInfoRef.current[currentMode] = [];
|
|
14032
|
-
},
|
|
14033
|
-
icon: jsxRuntime.jsx(SvgSaveFilterTab, {}),
|
|
14034
|
-
},
|
|
14035
|
-
], utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
14173
|
+
}, moduleList: modules, tabList: tabList, utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
14036
14174
|
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 })
|
|
14037
14175
|
:
|
|
14038
14176
|
jsxRuntime.jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|