impact-chatbot 2.3.4 → 2.3.6
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/components/message-template/components/message-content/tabular-content/components/Steps.d.ts +3 -1
- package/dist/components/message-template/components/message-content/tabular-content/index.d.ts +3 -1
- package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/Steps.d.ts +3 -1
- package/dist/core/commonComponents/custom-group-accordion/index.d.ts +5 -0
- package/dist/index.cjs.js +457 -113
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +459 -115
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -31,6 +31,7 @@ var AgGridComponent = require('core/Utils/agGrid');
|
|
|
31
31
|
var agGridColumnFormatter = require('core/Utils/agGrid/column-formatter');
|
|
32
32
|
var CoreChart = require('core/Utils/core-charts');
|
|
33
33
|
var makeStyles = require('@mui/styles/makeStyles');
|
|
34
|
+
var globalStyles$1 = require('core/Styles/globalStyles');
|
|
34
35
|
var FormatListBulletedOutlinedIcon = require('@mui/icons-material/FormatListBulletedOutlined');
|
|
35
36
|
var PsychologyOutlinedIcon = require('@mui/icons-material/PsychologyOutlined');
|
|
36
37
|
var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
|
|
@@ -940,14 +941,6 @@ const getFormattedApplicationName = (applicationURL) => {
|
|
|
940
941
|
}
|
|
941
942
|
};
|
|
942
943
|
|
|
943
|
-
// Fetch legacy agent screen - stub implementation
|
|
944
|
-
const fetchLegacyAgentScreen = () => {
|
|
945
|
-
// This function is kept as a stub since it's rarely used
|
|
946
|
-
// The actual implementation will be provided by the host app if needed
|
|
947
|
-
console.warn("fetchLegacyAgentScreen called - this is a stub implementation");
|
|
948
|
-
return null;
|
|
949
|
-
};
|
|
950
|
-
|
|
951
944
|
/**
|
|
952
945
|
* Preprocesses markdown content to improve list formatting
|
|
953
946
|
*/
|
|
@@ -1868,6 +1861,8 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1868
1861
|
isTabEnabled: utilsObject?.isTabEnabled,
|
|
1869
1862
|
steps: utilsObject?.steps,
|
|
1870
1863
|
currentTabValue: utilsObject?.currentTabValue,
|
|
1864
|
+
questions: utilsObject?.questions,
|
|
1865
|
+
questionsStepsMap: utilsObject?.questionsStepsMap,
|
|
1871
1866
|
}, null, { thinkingResponse: thinkingInfo });
|
|
1872
1867
|
}
|
|
1873
1868
|
}
|
|
@@ -4457,7 +4452,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
|
|
|
4457
4452
|
return (jsxRuntime.jsx("div", { className: `${classes.rectangle} ${classes[type]} ${hoverable ? classes.rectangleHoverable : ''}`, onClick: onClick, children: jsxRuntime.jsxs("div", { className: classes.textContainer, children: [jsxRuntime.jsx(material.Typography, { className: classes.title, children: title }), jsxRuntime.jsx(material.Typography, { className: classes.description, children: description })] }) }));
|
|
4458
4453
|
};
|
|
4459
4454
|
const ChatPlaceholder = (props) => {
|
|
4460
|
-
const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, } = props;
|
|
4455
|
+
const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, questions, displayQuestions } = props;
|
|
4461
4456
|
const classes = useStyles$5();
|
|
4462
4457
|
globalStyles();
|
|
4463
4458
|
const [cardList, setCardList] = React.useState([]);
|
|
@@ -4485,6 +4480,8 @@ const ChatPlaceholder = (props) => {
|
|
|
4485
4480
|
setThinkingHeaderMessage,
|
|
4486
4481
|
uniqueChatId,
|
|
4487
4482
|
setUniqueChatId,
|
|
4483
|
+
fieldNumber,
|
|
4484
|
+
setFieldNumber,
|
|
4488
4485
|
});
|
|
4489
4486
|
const getBaseUrl = async () => {
|
|
4490
4487
|
try {
|
|
@@ -4512,10 +4509,16 @@ const ChatPlaceholder = (props) => {
|
|
|
4512
4509
|
setLoading(false);
|
|
4513
4510
|
}
|
|
4514
4511
|
};
|
|
4515
|
-
if (baseUrl && legacyAgentScreen) {
|
|
4512
|
+
if (baseUrl && legacyAgentScreen && !displayQuestions) {
|
|
4516
4513
|
loadCards();
|
|
4517
4514
|
}
|
|
4518
|
-
|
|
4515
|
+
if (questions &&
|
|
4516
|
+
Array.isArray(questions) &&
|
|
4517
|
+
questions.length > 0 &&
|
|
4518
|
+
displayQuestions) {
|
|
4519
|
+
setCardList(questions);
|
|
4520
|
+
}
|
|
4521
|
+
}, [baseUrl, questions, displayQuestions]);
|
|
4519
4522
|
React.useEffect(() => {
|
|
4520
4523
|
getBaseUrl();
|
|
4521
4524
|
}, []);
|
|
@@ -4565,10 +4568,10 @@ const ChatPlaceholder = (props) => {
|
|
|
4565
4568
|
type: "blue",
|
|
4566
4569
|
icon: jsxRuntime.jsx(SvgCircular3D, {}),
|
|
4567
4570
|
title: card.name || card.title || "Agent",
|
|
4568
|
-
description: card.description || card.helpText || "
|
|
4571
|
+
description: card.description || card.helpText || "",
|
|
4569
4572
|
agentId: card.agentId || card.id
|
|
4570
4573
|
}));
|
|
4571
|
-
const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
|
|
4574
|
+
const dataToMap = legacyAgentScreen || displayQuestions ? transformedCardList : rectangleData;
|
|
4572
4575
|
return (jsxRuntime.jsxs("div", { className: classes.placeholderContainer, children: [jsxRuntime.jsx("div", { className: classes.centerIconContainer, children: jsxRuntime.jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsxRuntime.jsx(material.Typography, { variant: "h1", className: classes.heading, children: "Alan's Capabilities" }), jsxRuntime.jsx(material.Typography, { variant: "body1", className: classes.headingHelperText, children: "Discover potential issues & opportunities Alan can help you with!" }), jsxRuntime.jsx("div", { className: classes.rectanglesContainer, children: dataToMap.map((item, index) => (jsxRuntime.jsx(Rectangle, { type: item.type, icon: item.icon, title: item.title, description: item.description, onClick: () => handleRectangleClick(item?.agentId, item?.title), hoverable: legacyAgentScreen }, index))) })] }));
|
|
4573
4576
|
};
|
|
4574
4577
|
|
|
@@ -5420,26 +5423,119 @@ var SvgStepError = function SvgStepError(props) {
|
|
|
5420
5423
|
})));
|
|
5421
5424
|
};
|
|
5422
5425
|
|
|
5426
|
+
const CustomGroupAccordion = ({ children, onExpandChange, }) => {
|
|
5427
|
+
const globalClasses = globalStyles$1();
|
|
5428
|
+
const [accordionData, setAccordionData] = React.useState([]);
|
|
5429
|
+
const [activeAccordion, setActiveAccordion] = React.useState("");
|
|
5430
|
+
const prepareAccordionData = () => {
|
|
5431
|
+
const data = [];
|
|
5432
|
+
React.Children.toArray(children).forEach((child, index) => {
|
|
5433
|
+
data.push({
|
|
5434
|
+
id: index + 1,
|
|
5435
|
+
header: child.props.accordionName,
|
|
5436
|
+
content: child,
|
|
5437
|
+
value: child.props.accordionValue || child.props.accordionName,
|
|
5438
|
+
childCount: child.props.accordionChildCount,
|
|
5439
|
+
});
|
|
5440
|
+
});
|
|
5441
|
+
setAccordionData(data);
|
|
5442
|
+
};
|
|
5443
|
+
React.useEffect(() => {
|
|
5444
|
+
prepareAccordionData();
|
|
5445
|
+
}, [children]);
|
|
5446
|
+
return (jsxRuntime.jsx("div", { className: globalClasses.accordianWrapper, children: jsxRuntime.jsx(impactUiV3.AccordionModern, { data: accordionData, expanded: activeAccordion, setExpanded: (val) => {
|
|
5447
|
+
setActiveAccordion(val);
|
|
5448
|
+
onExpandChange?.(val);
|
|
5449
|
+
} }) }));
|
|
5450
|
+
};
|
|
5451
|
+
|
|
5423
5452
|
const useStyles$2 = makeStyles((theme) => ({
|
|
5453
|
+
"@global": {
|
|
5454
|
+
"@keyframes stepsLoaderSpin": {
|
|
5455
|
+
"0%": {
|
|
5456
|
+
transform: "rotate(0deg)",
|
|
5457
|
+
},
|
|
5458
|
+
"100%": {
|
|
5459
|
+
transform: "rotate(360deg)",
|
|
5460
|
+
},
|
|
5461
|
+
},
|
|
5462
|
+
"@keyframes skeletonRowExpand": {
|
|
5463
|
+
"0%": {
|
|
5464
|
+
width: pxToRem(31),
|
|
5465
|
+
gap: 0,
|
|
5466
|
+
},
|
|
5467
|
+
"20%": {
|
|
5468
|
+
width: "40%",
|
|
5469
|
+
gap: 0,
|
|
5470
|
+
},
|
|
5471
|
+
"30%": {
|
|
5472
|
+
width: "70%",
|
|
5473
|
+
gap: pxToRem(2),
|
|
5474
|
+
},
|
|
5475
|
+
"40%": {
|
|
5476
|
+
width: "100%",
|
|
5477
|
+
gap: pxToRem(4),
|
|
5478
|
+
},
|
|
5479
|
+
"70%": {
|
|
5480
|
+
width: "70%",
|
|
5481
|
+
gap: pxToRem(2),
|
|
5482
|
+
},
|
|
5483
|
+
"80%": {
|
|
5484
|
+
width: "40%",
|
|
5485
|
+
gap: 0,
|
|
5486
|
+
},
|
|
5487
|
+
"100%": {
|
|
5488
|
+
width: pxToRem(31),
|
|
5489
|
+
gap: 0,
|
|
5490
|
+
},
|
|
5491
|
+
},
|
|
5492
|
+
"@keyframes skeletonSquareFade": {
|
|
5493
|
+
"0%": {
|
|
5494
|
+
opacity: 0,
|
|
5495
|
+
width: 0,
|
|
5496
|
+
marginRight: 0,
|
|
5497
|
+
},
|
|
5498
|
+
"35%": {
|
|
5499
|
+
opacity: 0,
|
|
5500
|
+
width: 0,
|
|
5501
|
+
marginRight: 0,
|
|
5502
|
+
},
|
|
5503
|
+
"45%": {
|
|
5504
|
+
opacity: 1,
|
|
5505
|
+
width: pxToRem(31),
|
|
5506
|
+
marginRight: pxToRem(8),
|
|
5507
|
+
},
|
|
5508
|
+
"60%": {
|
|
5509
|
+
opacity: 1,
|
|
5510
|
+
width: pxToRem(31),
|
|
5511
|
+
marginRight: pxToRem(8),
|
|
5512
|
+
},
|
|
5513
|
+
"75%": {
|
|
5514
|
+
opacity: 0,
|
|
5515
|
+
width: 0,
|
|
5516
|
+
marginRight: 0,
|
|
5517
|
+
},
|
|
5518
|
+
"100%": {
|
|
5519
|
+
opacity: 0,
|
|
5520
|
+
width: 0,
|
|
5521
|
+
marginRight: 0,
|
|
5522
|
+
},
|
|
5523
|
+
},
|
|
5524
|
+
},
|
|
5424
5525
|
stepsContainer: {
|
|
5425
5526
|
display: "flex",
|
|
5426
5527
|
flexDirection: "column",
|
|
5427
|
-
gap:
|
|
5528
|
+
gap: pxToRem(20),
|
|
5428
5529
|
background: colours.white,
|
|
5429
|
-
marginTop:
|
|
5530
|
+
marginTop: pxToRem(20),
|
|
5430
5531
|
},
|
|
5431
5532
|
stepItem: {
|
|
5432
5533
|
display: "flex",
|
|
5433
5534
|
alignItems: "center",
|
|
5434
5535
|
gap: "12px",
|
|
5435
5536
|
},
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
transform: "rotate(0deg)",
|
|
5439
|
-
},
|
|
5440
|
-
"100%": {
|
|
5441
|
-
transform: "rotate(360deg)",
|
|
5442
|
-
}
|
|
5537
|
+
mt12: {
|
|
5538
|
+
marginTop: pxToRem(12),
|
|
5443
5539
|
},
|
|
5444
5540
|
stepStatus: {
|
|
5445
5541
|
display: "flex",
|
|
@@ -5453,7 +5549,7 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
5453
5549
|
"&.loading": {
|
|
5454
5550
|
background: colours.backgroundChat,
|
|
5455
5551
|
"& svg": {
|
|
5456
|
-
animation: "
|
|
5552
|
+
animation: "stepsLoaderSpin 1s linear infinite",
|
|
5457
5553
|
}
|
|
5458
5554
|
},
|
|
5459
5555
|
"&.error": {
|
|
@@ -5472,10 +5568,10 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
5472
5568
|
stepHeader: {
|
|
5473
5569
|
color: colours.oceanGreen,
|
|
5474
5570
|
fontFamily: "Manrope",
|
|
5475
|
-
fontSize:
|
|
5571
|
+
fontSize: pxToRem(14),
|
|
5476
5572
|
fontStyle: "normal",
|
|
5477
5573
|
fontWeight: 500,
|
|
5478
|
-
lineHeight:
|
|
5574
|
+
lineHeight: pxToRem(20),
|
|
5479
5575
|
"&.loading": {
|
|
5480
5576
|
color: colours.brightRoyalBlue,
|
|
5481
5577
|
},
|
|
@@ -5486,25 +5582,158 @@ const useStyles$2 = makeStyles((theme) => ({
|
|
|
5486
5582
|
stepSubheader: {
|
|
5487
5583
|
color: colours.neutrals,
|
|
5488
5584
|
fontFamily: "Manrope",
|
|
5489
|
-
fontSize:
|
|
5585
|
+
fontSize: pxToRem(12),
|
|
5490
5586
|
fontStyle: "normal",
|
|
5491
5587
|
fontWeight: 500,
|
|
5492
|
-
lineHeight:
|
|
5588
|
+
lineHeight: pxToRem(16),
|
|
5589
|
+
},
|
|
5590
|
+
"@keyframes slideDown": {
|
|
5591
|
+
"0%": {
|
|
5592
|
+
opacity: 0,
|
|
5593
|
+
maxHeight: 0,
|
|
5594
|
+
transform: "translateY(-12px)",
|
|
5595
|
+
},
|
|
5596
|
+
"100%": {
|
|
5597
|
+
opacity: 1,
|
|
5598
|
+
maxHeight: "2000px",
|
|
5599
|
+
transform: "translateY(0)",
|
|
5600
|
+
},
|
|
5601
|
+
},
|
|
5602
|
+
loaderContainer: {
|
|
5603
|
+
display: "flex",
|
|
5604
|
+
flexDirection: "column",
|
|
5605
|
+
gap: pxToRem(10),
|
|
5606
|
+
padding: `${pxToRem(20)} ${pxToRem(16)}`,
|
|
5607
|
+
},
|
|
5608
|
+
skeletonRowWrapper: {
|
|
5609
|
+
display: "flex",
|
|
5610
|
+
alignItems: "center",
|
|
5611
|
+
},
|
|
5612
|
+
skeletonSquare: {
|
|
5613
|
+
width: 0,
|
|
5614
|
+
height: pxToRem(30),
|
|
5615
|
+
borderRadius: pxToRem(4),
|
|
5616
|
+
background: "linear-gradient(266deg, rgba(220, 220, 220, 0.60) -5.22%, rgba(255, 255, 255, 0.80) 4.31%, rgba(200, 200, 200, 0.40) 17.94%)",
|
|
5617
|
+
opacity: 0.2,
|
|
5618
|
+
flexShrink: 0,
|
|
5619
|
+
animation: "skeletonSquareFade 1.8s ease-out infinite",
|
|
5620
|
+
},
|
|
5621
|
+
skeletonSquareDelayed: {
|
|
5622
|
+
animationDelay: "0.2s",
|
|
5623
|
+
},
|
|
5624
|
+
skeletonRow: {
|
|
5625
|
+
display: "flex",
|
|
5626
|
+
flexDirection: "column",
|
|
5627
|
+
gap: 0,
|
|
5628
|
+
overflow: "hidden",
|
|
5629
|
+
animation: "skeletonRowExpand 1.8s ease-out infinite",
|
|
5630
|
+
},
|
|
5631
|
+
skeletonRowDelayed: {
|
|
5632
|
+
animationDelay: "0.2s",
|
|
5633
|
+
},
|
|
5634
|
+
skeletonBlock: {
|
|
5635
|
+
width: "100%",
|
|
5636
|
+
height: pxToRem(15),
|
|
5637
|
+
background: "linear-gradient(266deg, rgba(220, 220, 220, 0.60) -5.22%, rgba(255, 255, 255, 0.80) 4.31%, rgba(200, 200, 200, 0.40) 17.94%)",
|
|
5638
|
+
opacity: 0.2,
|
|
5639
|
+
"&:first-child": {
|
|
5640
|
+
borderRadius: `${pxToRem(4)} ${pxToRem(4)} 0 0`,
|
|
5641
|
+
},
|
|
5642
|
+
"&:last-child": {
|
|
5643
|
+
borderRadius: `0 0 ${pxToRem(4)} ${pxToRem(4)}`,
|
|
5644
|
+
},
|
|
5645
|
+
},
|
|
5646
|
+
accordionAnimated: {
|
|
5647
|
+
animation: "$slideDown 0.4s ease-out forwards",
|
|
5648
|
+
overflow: "hidden",
|
|
5649
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header": {
|
|
5650
|
+
height: "auto",
|
|
5651
|
+
alignItems: "flex-start",
|
|
5652
|
+
padding: `${pxToRem(16)} ${pxToRem(16)} ${pxToRem(8)} ${pxToRem(16)} !important`
|
|
5653
|
+
},
|
|
5654
|
+
"& .loading svg": {
|
|
5655
|
+
animation: "stepsLoaderSpin 1s linear infinite !important",
|
|
5656
|
+
},
|
|
5657
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
5658
|
+
padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
|
|
5659
|
+
},
|
|
5660
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
|
|
5661
|
+
width: `${pxToRem(24)} !important`,
|
|
5662
|
+
height: `${pxToRem(24)} !important`,
|
|
5663
|
+
}
|
|
5664
|
+
},
|
|
5665
|
+
accordionStepsWrapper: {
|
|
5666
|
+
display: "flex",
|
|
5667
|
+
flexDirection: "column",
|
|
5668
|
+
gap: pxToRem(12),
|
|
5669
|
+
},
|
|
5670
|
+
accordionHeaderWrapper: {
|
|
5671
|
+
display: "flex",
|
|
5672
|
+
flexDirection: "column",
|
|
5673
|
+
gap: pxToRem(16),
|
|
5674
|
+
width: "100%",
|
|
5675
|
+
},
|
|
5676
|
+
accordionHeaderQuestion: {
|
|
5677
|
+
fontFamily: "Manrope",
|
|
5678
|
+
fontSize: pxToRem(14),
|
|
5679
|
+
fontWeight: 600,
|
|
5680
|
+
},
|
|
5681
|
+
headerStepPreview: {
|
|
5682
|
+
marginLeft: pxToRem(-20),
|
|
5683
|
+
},
|
|
5684
|
+
closedAccordionStep: {
|
|
5685
|
+
display: "flex",
|
|
5686
|
+
alignItems: "center",
|
|
5687
|
+
gap: "8px",
|
|
5688
|
+
marginTop: pxToRem(4),
|
|
5689
|
+
"& svg": {
|
|
5690
|
+
width: "14px",
|
|
5691
|
+
height: "14px",
|
|
5692
|
+
flexShrink: 0,
|
|
5693
|
+
},
|
|
5694
|
+
},
|
|
5695
|
+
closedStepLoading: {
|
|
5696
|
+
"& svg": {
|
|
5697
|
+
animation: "stepsLoaderSpin 1s linear infinite",
|
|
5698
|
+
},
|
|
5699
|
+
},
|
|
5700
|
+
closedStepText: {
|
|
5701
|
+
fontFamily: "Manrope",
|
|
5702
|
+
fontSize: pxToRem(12),
|
|
5703
|
+
fontWeight: 500,
|
|
5704
|
+
color: colours.neutrals,
|
|
5705
|
+
"&.loading": {
|
|
5706
|
+
color: colours.brightRoyalBlue,
|
|
5707
|
+
},
|
|
5708
|
+
"&.completed": {
|
|
5709
|
+
color: colours.oceanGreen,
|
|
5710
|
+
},
|
|
5493
5711
|
},
|
|
5494
5712
|
}));
|
|
5495
|
-
const
|
|
5713
|
+
const StepItemRenderer$1 = ({ step, classes }) => (jsxRuntime.jsxs("div", { className: classes.stepItem, children: [jsxRuntime.jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
5714
|
+
? "loading"
|
|
5715
|
+
: step.step_status === "error"
|
|
5716
|
+
? "error"
|
|
5717
|
+
: ""}`, children: step.step_status === "not-completed" ? (jsxRuntime.jsx(SvgStepsLoader, {})) : step.step_status === "error" ? (jsxRuntime.jsx(SvgStepError, {})) : (jsxRuntime.jsx(SvgStepDone, {})) }), jsxRuntime.jsxs("div", { className: classes.stepContent, children: [jsxRuntime.jsx("div", { className: `${classes.stepHeader} ${step.step_status === "not-completed"
|
|
5718
|
+
? "loading"
|
|
5719
|
+
: step.step_status === "error"
|
|
5720
|
+
? "error"
|
|
5721
|
+
: ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
|
|
5722
|
+
const getActiveStep = (stepsForQuestion) => {
|
|
5723
|
+
if (!stepsForQuestion || stepsForQuestion.length === 0)
|
|
5724
|
+
return null;
|
|
5725
|
+
const loadingStep = stepsForQuestion.find((s) => s.step_status === "not-completed");
|
|
5726
|
+
if (loadingStep)
|
|
5727
|
+
return loadingStep;
|
|
5728
|
+
return stepsForQuestion[stepsForQuestion.length - 1];
|
|
5729
|
+
};
|
|
5730
|
+
const AccordionStepsContent$1 = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
|
|
5731
|
+
return (jsxRuntime.jsx("div", { className: classes.accordionStepsWrapper, children: jsxRuntime.jsx("div", { className: `${classes.stepsContainer} ${classes.mt12}`, children: questionSteps.map((step, index) => (jsxRuntime.jsx(StepItemRenderer$1, { step: step, classes: classes }, index))) }) }));
|
|
5732
|
+
};
|
|
5733
|
+
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, }) => {
|
|
5496
5734
|
const classes = useStyles$2();
|
|
5497
5735
|
React.useState(false);
|
|
5498
|
-
|
|
5499
|
-
// if (steps.length > 0) {
|
|
5500
|
-
// // Mark all previous steps as done and last step as loading
|
|
5501
|
-
// const updatedSteps = steps.map((step, index) => ({
|
|
5502
|
-
// ...step,
|
|
5503
|
-
// status: index === steps.length - 1 ? "loading" : "done"
|
|
5504
|
-
// }));
|
|
5505
|
-
// setSteps(updatedSteps);
|
|
5506
|
-
// }
|
|
5507
|
-
// }, [steps]);
|
|
5736
|
+
const [expandedAccordion, setExpandedAccordion] = React.useState("");
|
|
5508
5737
|
React.useEffect(() => {
|
|
5509
5738
|
if (done) {
|
|
5510
5739
|
// Add finished step when done is true
|
|
@@ -5539,15 +5768,38 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
|
|
|
5539
5768
|
}
|
|
5540
5769
|
}
|
|
5541
5770
|
}, [done]);
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5771
|
+
const hasQuestions = questions.length > 0;
|
|
5772
|
+
if (!hasQuestions) {
|
|
5773
|
+
if (currentMode === "agent" && steps.length === 1) {
|
|
5774
|
+
return (jsxRuntime.jsxs("div", { className: classes.loaderContainer, children: [jsxRuntime.jsxs("div", { className: classes.skeletonRowWrapper, children: [jsxRuntime.jsx("div", { className: classes.skeletonSquare }), jsxRuntime.jsxs("div", { className: classes.skeletonRow, children: [jsxRuntime.jsx("div", { className: classes.skeletonBlock }), jsxRuntime.jsx("div", { className: classes.skeletonBlock })] })] }), jsxRuntime.jsxs("div", { className: classes.skeletonRowWrapper, children: [jsxRuntime.jsx("div", { className: `${classes.skeletonSquare} ${classes.skeletonSquareDelayed}` }), jsxRuntime.jsxs("div", { className: `${classes.skeletonRow} ${classes.skeletonRowDelayed}`, children: [jsxRuntime.jsx("div", { className: classes.skeletonBlock }), jsxRuntime.jsx("div", { className: classes.skeletonBlock })] })] })] }));
|
|
5775
|
+
}
|
|
5776
|
+
if (steps.length > 0) {
|
|
5777
|
+
const fallbackQuestion = "Processing Request";
|
|
5778
|
+
const activeStep = getActiveStep(steps);
|
|
5779
|
+
const isExpanded = expandedAccordion === fallbackQuestion;
|
|
5780
|
+
const accordionHeader = (jsxRuntime.jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsxRuntime.jsx("div", { className: classes.accordionHeaderQuestion, children: fallbackQuestion }), !isExpanded && activeStep && (jsxRuntime.jsx("div", { className: classes.headerStepPreview, children: jsxRuntime.jsx(StepItemRenderer$1, { step: activeStep, classes: classes }) }))] }));
|
|
5781
|
+
return (jsxRuntime.jsx("div", { className: `${classes.stepsContainer} ${classes.accordionAnimated}`, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: jsxRuntime.jsx(AccordionStepsContent$1, { questionSteps: steps, classes: classes, accordionName: accordionHeader, accordionValue: fallbackQuestion }) }) }));
|
|
5782
|
+
}
|
|
5783
|
+
return null;
|
|
5784
|
+
}
|
|
5785
|
+
return (jsxRuntime.jsx("div", { className: `${classes.stepsContainer} ${classes.accordionAnimated}`, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
|
|
5786
|
+
const questionSteps = questionsStepsMap[question] || [
|
|
5787
|
+
{
|
|
5788
|
+
header: "Processing Request",
|
|
5789
|
+
sub_header: "Analyzing the current request",
|
|
5790
|
+
step_status: "not-completed",
|
|
5791
|
+
},
|
|
5792
|
+
];
|
|
5793
|
+
const activeStep = getActiveStep(questionSteps);
|
|
5794
|
+
const stepCount = questionSteps.length;
|
|
5795
|
+
const completedCount = questionSteps.filter((s) => s.step_status === "completed").length;
|
|
5796
|
+
activeStep
|
|
5797
|
+
? `${activeStep.header} - Step ${completedCount}/${stepCount}`
|
|
5798
|
+
: "";
|
|
5799
|
+
const isExpanded = expandedAccordion === question;
|
|
5800
|
+
const accordionHeader = (jsxRuntime.jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsxRuntime.jsx("div", { className: classes.accordionHeaderQuestion, children: question }), !isExpanded && activeStep && (jsxRuntime.jsx("div", { className: classes.headerStepPreview, children: jsxRuntime.jsx(StepItemRenderer$1, { step: activeStep, classes: classes }) }))] }));
|
|
5801
|
+
return (jsxRuntime.jsx(AccordionStepsContent$1, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
|
|
5802
|
+
}) }) }));
|
|
5551
5803
|
};
|
|
5552
5804
|
|
|
5553
5805
|
const AgentResponse$1 = (props) => {
|
|
@@ -5560,7 +5812,7 @@ const AgentResponse$1 = (props) => {
|
|
|
5560
5812
|
};
|
|
5561
5813
|
|
|
5562
5814
|
const StepsResponseTab = (props) => {
|
|
5563
|
-
const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, } = props;
|
|
5815
|
+
const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, } = props;
|
|
5564
5816
|
const [tabValue, setTabValue] = React.useState("steps");
|
|
5565
5817
|
const handleChangeTabValue = (_event, newValue) => {
|
|
5566
5818
|
setTabValue(newValue);
|
|
@@ -5577,7 +5829,7 @@ const StepsResponseTab = (props) => {
|
|
|
5577
5829
|
icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
5578
5830
|
},
|
|
5579
5831
|
], tabPanels: [
|
|
5580
|
-
jsxRuntime.jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode }),
|
|
5832
|
+
jsxRuntime.jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap }),
|
|
5581
5833
|
jsxRuntime.jsx(AgentResponse$1, { content: content, isStreaming: isStreaming }),
|
|
5582
5834
|
], value: tabValue }) }));
|
|
5583
5835
|
};
|
|
@@ -5635,6 +5887,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
5635
5887
|
step_status: "not-completed"
|
|
5636
5888
|
}
|
|
5637
5889
|
]);
|
|
5890
|
+
const [questions, setQuestions] = React.useState([]);
|
|
5891
|
+
const [questionsStepsMap, setQuestionsStepsMap] = React.useState({});
|
|
5638
5892
|
const [stepChange, setStepChange] = React.useState(false);
|
|
5639
5893
|
const [stepsDone, setStepsDone] = React.useState(false);
|
|
5640
5894
|
const [finalStepDone, setFinalStepDone] = React.useState(false);
|
|
@@ -5651,6 +5905,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
5651
5905
|
step_status: "not-completed"
|
|
5652
5906
|
}
|
|
5653
5907
|
]);
|
|
5908
|
+
const questionsRef = React.useRef([]);
|
|
5909
|
+
const questionsStepsMapRef = React.useRef({});
|
|
5654
5910
|
// Refs to maintain data across renders
|
|
5655
5911
|
const sourceRef = React.useRef(null); // Holds the SSE source instance
|
|
5656
5912
|
React.useRef(""); // Tracks the last received message
|
|
@@ -5740,8 +5996,25 @@ const StreamedContent = ({ botData }) => {
|
|
|
5740
5996
|
thinkingStartTimeRef.current = Date.now();
|
|
5741
5997
|
}
|
|
5742
5998
|
const data = JSON.parse(event.data);
|
|
5743
|
-
if (data?.message || data?.status === "step" || data?.status === "thinking") {
|
|
5744
|
-
if (data.status === "
|
|
5999
|
+
if (data?.message || data?.status === "step" || data?.status === "thinking" || data?.status === "questions") {
|
|
6000
|
+
if (data.status === "questions") {
|
|
6001
|
+
const incomingQuestions = data.widget_data?.[0]?.questions || [];
|
|
6002
|
+
questionsRef.current = incomingQuestions;
|
|
6003
|
+
setQuestions(incomingQuestions);
|
|
6004
|
+
const initialMap = {};
|
|
6005
|
+
incomingQuestions.forEach((q) => {
|
|
6006
|
+
initialMap[q] = [
|
|
6007
|
+
{
|
|
6008
|
+
header: "Processing Request",
|
|
6009
|
+
sub_header: "Analyzing the current request",
|
|
6010
|
+
step_status: "not-completed",
|
|
6011
|
+
},
|
|
6012
|
+
];
|
|
6013
|
+
});
|
|
6014
|
+
questionsStepsMapRef.current = initialMap;
|
|
6015
|
+
setQuestionsStepsMap(lodash.cloneDeep(initialMap));
|
|
6016
|
+
}
|
|
6017
|
+
else if (data.status === "thinking") {
|
|
5745
6018
|
messageToStoreRef.current.chatData.thinkingResponse.thinkingHeading = "Planning next moves";
|
|
5746
6019
|
// Start thinking if not already started
|
|
5747
6020
|
if (!isThinking) {
|
|
@@ -5780,6 +6053,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
5780
6053
|
}
|
|
5781
6054
|
else if (data.status === "step") {
|
|
5782
6055
|
let newStep = data.widget_data[0];
|
|
6056
|
+
const currentIntent = data.widget_data[0]?.current_intent;
|
|
5783
6057
|
setSteps([...steps, newStep]);
|
|
5784
6058
|
let newSteps = lodash.cloneDeep(stepRef.current);
|
|
5785
6059
|
if (newSteps.length === 1) {
|
|
@@ -5789,15 +6063,28 @@ const StreamedContent = ({ botData }) => {
|
|
|
5789
6063
|
}
|
|
5790
6064
|
const existingStepIndex = newSteps.findIndex((step) => step.header === newStep.header);
|
|
5791
6065
|
if (existingStepIndex !== -1) {
|
|
5792
|
-
// Replace the existing step at the same position
|
|
5793
6066
|
newSteps[existingStepIndex] = newStep;
|
|
5794
6067
|
}
|
|
5795
6068
|
else {
|
|
5796
|
-
// If no matching step found, add it to the end
|
|
5797
6069
|
newSteps.push(newStep);
|
|
5798
6070
|
}
|
|
5799
6071
|
stepRef.current = newSteps;
|
|
5800
6072
|
setSteps(newSteps);
|
|
6073
|
+
if (currentIntent && questionsStepsMapRef.current[currentIntent]) {
|
|
6074
|
+
let intentSteps = lodash.cloneDeep(questionsStepsMapRef.current[currentIntent]);
|
|
6075
|
+
if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
|
|
6076
|
+
intentSteps[0].step_status = "completed";
|
|
6077
|
+
}
|
|
6078
|
+
const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
|
|
6079
|
+
if (existingIdx !== -1) {
|
|
6080
|
+
intentSteps[existingIdx] = newStep;
|
|
6081
|
+
}
|
|
6082
|
+
else {
|
|
6083
|
+
intentSteps.push(newStep);
|
|
6084
|
+
}
|
|
6085
|
+
questionsStepsMapRef.current[currentIntent] = intentSteps;
|
|
6086
|
+
setQuestionsStepsMap(lodash.cloneDeep(questionsStepsMapRef.current));
|
|
6087
|
+
}
|
|
5801
6088
|
setStepChange((prev) => !prev);
|
|
5802
6089
|
}
|
|
5803
6090
|
else if (data.message !== "[DONE]") {
|
|
@@ -6029,6 +6316,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
6029
6316
|
isTabEnabled: true,
|
|
6030
6317
|
steps: lodash.cloneDeep(stepRef.current),
|
|
6031
6318
|
currentTabValue: "agent_response",
|
|
6319
|
+
questions: lodash.cloneDeep(questionsRef.current),
|
|
6320
|
+
questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
|
|
6032
6321
|
});
|
|
6033
6322
|
// [
|
|
6034
6323
|
// {
|
|
@@ -6107,6 +6396,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
6107
6396
|
isTabEnabled: true,
|
|
6108
6397
|
steps: lodash.cloneDeep(stepRef.current),
|
|
6109
6398
|
currentTabValue: "agent_response",
|
|
6399
|
+
questions: lodash.cloneDeep(questionsRef.current),
|
|
6400
|
+
questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
|
|
6110
6401
|
});
|
|
6111
6402
|
}
|
|
6112
6403
|
// Trigger re-render by updating chatDataState
|
|
@@ -6243,7 +6534,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
6243
6534
|
* @returns {JSX.Element} Rendered content with optional blinking cursor
|
|
6244
6535
|
*/
|
|
6245
6536
|
const renderContent = () => {
|
|
6246
|
-
return (jsxRuntime.jsx("div", { className: classes.streamContainer, children: jsxRuntime.jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode }) }));
|
|
6537
|
+
return (jsxRuntime.jsx("div", { className: classes.streamContainer, children: jsxRuntime.jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap }) }));
|
|
6247
6538
|
};
|
|
6248
6539
|
if (currentMode === "agent") {
|
|
6249
6540
|
return renderContent();
|
|
@@ -6462,9 +6753,28 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
6462
6753
|
stepsContainer: {
|
|
6463
6754
|
display: "flex",
|
|
6464
6755
|
flexDirection: "column",
|
|
6465
|
-
gap:
|
|
6756
|
+
gap: pxToRem(20),
|
|
6466
6757
|
background: colours.white,
|
|
6467
|
-
marginTop:
|
|
6758
|
+
marginTop: pxToRem(20),
|
|
6759
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header": {
|
|
6760
|
+
height: "auto",
|
|
6761
|
+
alignItems: "flex-start"
|
|
6762
|
+
},
|
|
6763
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
6764
|
+
padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
|
|
6765
|
+
},
|
|
6766
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
|
|
6767
|
+
width: `${pxToRem(24)} !important`,
|
|
6768
|
+
height: `${pxToRem(24)} !important`,
|
|
6769
|
+
}
|
|
6770
|
+
},
|
|
6771
|
+
hideContentDiv: {
|
|
6772
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
6773
|
+
display: "none",
|
|
6774
|
+
}
|
|
6775
|
+
},
|
|
6776
|
+
mt12: {
|
|
6777
|
+
marginTop: pxToRem(12),
|
|
6468
6778
|
},
|
|
6469
6779
|
stepItem: {
|
|
6470
6780
|
display: "flex",
|
|
@@ -6510,10 +6820,10 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
6510
6820
|
stepHeader: {
|
|
6511
6821
|
color: colours.oceanGreen,
|
|
6512
6822
|
fontFamily: "Manrope",
|
|
6513
|
-
fontSize:
|
|
6823
|
+
fontSize: pxToRem(14),
|
|
6514
6824
|
fontStyle: "normal",
|
|
6515
6825
|
fontWeight: 500,
|
|
6516
|
-
lineHeight:
|
|
6826
|
+
lineHeight: pxToRem(20),
|
|
6517
6827
|
"&.loading": {
|
|
6518
6828
|
color: colours.brightRoyalBlue,
|
|
6519
6829
|
},
|
|
@@ -6524,62 +6834,89 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
6524
6834
|
stepSubheader: {
|
|
6525
6835
|
color: colours.neutrals,
|
|
6526
6836
|
fontFamily: "Manrope",
|
|
6527
|
-
fontSize:
|
|
6837
|
+
fontSize: pxToRem(12),
|
|
6528
6838
|
fontStyle: "normal",
|
|
6529
6839
|
fontWeight: 500,
|
|
6530
|
-
lineHeight:
|
|
6840
|
+
lineHeight: pxToRem(16),
|
|
6841
|
+
},
|
|
6842
|
+
accordionStepsWrapper: {
|
|
6843
|
+
display: "flex",
|
|
6844
|
+
flexDirection: "column",
|
|
6845
|
+
gap: pxToRem(12),
|
|
6846
|
+
},
|
|
6847
|
+
accordionHeaderWrapper: {
|
|
6848
|
+
display: "flex",
|
|
6849
|
+
flexDirection: "column",
|
|
6850
|
+
gap: pxToRem(16),
|
|
6851
|
+
width: "100%",
|
|
6852
|
+
},
|
|
6853
|
+
accordionHeaderQuestion: {
|
|
6854
|
+
fontFamily: "Manrope",
|
|
6855
|
+
fontSize: pxToRem(14),
|
|
6856
|
+
fontWeight: 600,
|
|
6857
|
+
},
|
|
6858
|
+
headerStepPreview: {
|
|
6859
|
+
marginLeft: pxToRem(-20),
|
|
6860
|
+
},
|
|
6861
|
+
closedAccordionStep: {
|
|
6862
|
+
display: "flex",
|
|
6863
|
+
alignItems: "center",
|
|
6864
|
+
gap: "8px",
|
|
6865
|
+
marginTop: pxToRem(4),
|
|
6866
|
+
"& svg": {
|
|
6867
|
+
width: "14px",
|
|
6868
|
+
height: "14px",
|
|
6869
|
+
flexShrink: 0,
|
|
6870
|
+
},
|
|
6871
|
+
},
|
|
6872
|
+
closedStepText: {
|
|
6873
|
+
fontFamily: "Manrope",
|
|
6874
|
+
fontSize: pxToRem(12),
|
|
6875
|
+
fontWeight: 500,
|
|
6876
|
+
color: colours.oceanGreen,
|
|
6531
6877
|
},
|
|
6532
6878
|
}));
|
|
6533
|
-
const
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
// // Mark all previous steps as done and last step as loading
|
|
6539
|
-
// const updatedSteps = steps.map((step, index) => ({
|
|
6540
|
-
// ...step,
|
|
6541
|
-
// status: index === steps.length - 1 ? "loading" : "done"
|
|
6542
|
-
// }));
|
|
6543
|
-
// setSteps(updatedSteps);
|
|
6544
|
-
// }
|
|
6545
|
-
// }, [steps]);
|
|
6546
|
-
// useEffect(() => {
|
|
6547
|
-
// if (done) {
|
|
6548
|
-
// // Add finished step when done is true
|
|
6549
|
-
// if (!finalStepDone) {
|
|
6550
|
-
// let updatedSteps = steps.map((step) => ({
|
|
6551
|
-
// ...step,
|
|
6552
|
-
// step_status: "completed",
|
|
6553
|
-
// }));
|
|
6554
|
-
// updatedSteps = [...updatedSteps, {
|
|
6555
|
-
// header: "Finished",
|
|
6556
|
-
// sub_header: "Analysis complete",
|
|
6557
|
-
// step_status: "not-completed",
|
|
6558
|
-
// }];
|
|
6559
|
-
// setSteps(cloneDeep(updatedSteps));
|
|
6560
|
-
// setTimeout(() => {
|
|
6561
|
-
// updatedSteps = updatedSteps.map((step) => ({
|
|
6562
|
-
// ...step,
|
|
6563
|
-
// step_status: "completed",
|
|
6564
|
-
// }));
|
|
6565
|
-
// setSteps(cloneDeep(updatedSteps));
|
|
6566
|
-
// setFinalStepDone(true);
|
|
6567
|
-
// }, 4000);
|
|
6568
|
-
// setTimeout(() => {
|
|
6569
|
-
// setTabValue("agent_response");
|
|
6570
|
-
// }, 4300);
|
|
6571
|
-
// }
|
|
6572
|
-
// }
|
|
6573
|
-
// }, [done]);
|
|
6574
|
-
return (jsxRuntime.jsx("div", { className: classes.stepsContainer, children: steps.map((step, index) => (jsxRuntime.jsxs("div", { className: classes.stepItem, children: [jsxRuntime.jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
6879
|
+
const StepItemRenderer = ({ step, classes }) => (jsxRuntime.jsxs("div", { className: classes.stepItem, children: [jsxRuntime.jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
6880
|
+
? "loading"
|
|
6881
|
+
: step.step_status === "error"
|
|
6882
|
+
? "error"
|
|
6883
|
+
: ""}`, children: step.step_status === "not-completed" ? (jsxRuntime.jsx(SvgStepsLoader, {})) : step.step_status === "error" ? (jsxRuntime.jsx(SvgStepError, {})) : (jsxRuntime.jsx(SvgStepDone, {})) }), jsxRuntime.jsxs("div", { className: classes.stepContent, children: [jsxRuntime.jsx("div", { className: `${classes.stepHeader} ${step.step_status === "not-completed"
|
|
6575
6884
|
? "loading"
|
|
6576
6885
|
: step.step_status === "error"
|
|
6577
6886
|
? "error"
|
|
6578
|
-
: ""}`, children: step.
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6887
|
+
: ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
|
|
6888
|
+
const AccordionStepsContent = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
|
|
6889
|
+
return (jsxRuntime.jsx("div", { className: classes.accordionStepsWrapper, children: jsxRuntime.jsx("div", { className: `${classes.stepsContainer} ${classes.mt12}`, children: questionSteps.map((step, index) => (jsxRuntime.jsx(StepItemRenderer, { step: step, classes: classes }, index))) }) }));
|
|
6890
|
+
};
|
|
6891
|
+
const Steps = ({ steps, questions = [], questionsStepsMap = {} }) => {
|
|
6892
|
+
const classes = useStyles$1();
|
|
6893
|
+
React.useState(false);
|
|
6894
|
+
const [expandedAccordion, setExpandedAccordion] = React.useState("");
|
|
6895
|
+
const hasQuestions = questions.length > 0;
|
|
6896
|
+
if (!hasQuestions) {
|
|
6897
|
+
if (steps.length > 0) {
|
|
6898
|
+
const fallbackQuestion = "Processing Request";
|
|
6899
|
+
const lastStep = steps[steps.length - 1];
|
|
6900
|
+
const isExpanded = expandedAccordion === fallbackQuestion;
|
|
6901
|
+
const accordionHeader = (jsxRuntime.jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsxRuntime.jsx("div", { className: classes.accordionHeaderQuestion, children: fallbackQuestion }), !isExpanded && lastStep && (jsxRuntime.jsx("div", { className: classes.headerStepPreview, children: jsxRuntime.jsx(StepItemRenderer, { step: lastStep, classes: classes }) }))] }));
|
|
6902
|
+
return (jsxRuntime.jsx("div", { className: classes.stepsContainer, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: jsxRuntime.jsx(AccordionStepsContent, { questionSteps: steps, classes: classes, accordionName: accordionHeader, accordionValue: fallbackQuestion }) }) }));
|
|
6903
|
+
}
|
|
6904
|
+
return null;
|
|
6905
|
+
}
|
|
6906
|
+
return (jsxRuntime.jsx("div", { className: classes.stepsContainer, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
|
|
6907
|
+
const questionSteps = questionsStepsMap[question] || [
|
|
6908
|
+
{
|
|
6909
|
+
header: "Processing Request",
|
|
6910
|
+
sub_header: "Analyzing the current request",
|
|
6911
|
+
step_status: "completed",
|
|
6912
|
+
},
|
|
6913
|
+
];
|
|
6914
|
+
questionSteps.length;
|
|
6915
|
+
const lastStep = questionSteps[questionSteps.length - 1];
|
|
6916
|
+
const isExpanded = expandedAccordion === question;
|
|
6917
|
+
const accordionHeader = (jsxRuntime.jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsxRuntime.jsx("div", { className: classes.accordionHeaderQuestion, children: question }), !isExpanded && lastStep && (jsxRuntime.jsx("div", { className: classes.headerStepPreview, children: jsxRuntime.jsx(StepItemRenderer, { step: lastStep, classes: classes }) }))] }));
|
|
6918
|
+
return (jsxRuntime.jsx(AccordionStepsContent, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
|
|
6919
|
+
}) }) }));
|
|
6583
6920
|
};
|
|
6584
6921
|
|
|
6585
6922
|
const AgentResponse = ({ children }) => {
|
|
@@ -6587,7 +6924,7 @@ const AgentResponse = ({ children }) => {
|
|
|
6587
6924
|
return (jsxRuntime.jsx("div", { className: classes.agentResponseContainer, children: children }));
|
|
6588
6925
|
};
|
|
6589
6926
|
|
|
6590
|
-
const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
6927
|
+
const TabularContent = ({ steps, currentTabValue, children, questions = [], questionsStepsMap = {} }) => {
|
|
6591
6928
|
const [tabValue, setTabValue] = React.useState(currentTabValue);
|
|
6592
6929
|
const handleChangeTabValue = (_event, newValue) => {
|
|
6593
6930
|
setTabValue(newValue);
|
|
@@ -6595,6 +6932,13 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
|
6595
6932
|
steps.forEach((step) => {
|
|
6596
6933
|
step.step_status = "completed";
|
|
6597
6934
|
});
|
|
6935
|
+
if (Object.keys(questionsStepsMap).length > 0) {
|
|
6936
|
+
Object.keys(questionsStepsMap).forEach((key) => {
|
|
6937
|
+
questionsStepsMap[key].forEach((step) => {
|
|
6938
|
+
step.step_status = "completed";
|
|
6939
|
+
});
|
|
6940
|
+
});
|
|
6941
|
+
}
|
|
6598
6942
|
return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(impactUiV3.Tabs, { onChange: handleChangeTabValue, orientation: "horizontal", tabNames: [
|
|
6599
6943
|
{
|
|
6600
6944
|
label: "Steps",
|
|
@@ -6607,7 +6951,7 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
|
6607
6951
|
icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
6608
6952
|
},
|
|
6609
6953
|
], tabPanels: [
|
|
6610
|
-
jsxRuntime.jsx(Steps, { steps: steps }),
|
|
6954
|
+
jsxRuntime.jsx(Steps, { steps: steps, questions: questions, questionsStepsMap: questionsStepsMap }),
|
|
6611
6955
|
jsxRuntime.jsx(AgentResponse, { children: children }),
|
|
6612
6956
|
], value: tabValue }) }));
|
|
6613
6957
|
};
|
|
@@ -6676,7 +7020,7 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
6676
7020
|
const validContent = renderedContent.filter(content => content !== null);
|
|
6677
7021
|
const renderCombinedContent = () => (jsxRuntime.jsx("div", { className: "combined-content-container", children: validContent.length > 0 ? (validContent.map((content, index) => (jsxRuntime.jsx("div", { className: "combined-content-item", children: content }, `wrapper-${index}`)))) : (jsxRuntime.jsx("div", { children: "No valid content to display" })) }));
|
|
6678
7022
|
if (isTabEnabled) {
|
|
6679
|
-
return (jsxRuntime.jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", children: renderCombinedContent() }));
|
|
7023
|
+
return (jsxRuntime.jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", questions: botData?.utilityData?.questions || [], questionsStepsMap: botData?.utilityData?.questionsStepsMap || {}, children: renderCombinedContent() }));
|
|
6680
7024
|
}
|
|
6681
7025
|
return renderCombinedContent();
|
|
6682
7026
|
};
|
|
@@ -9370,7 +9714,7 @@ let chatbotFilterCustomConfig = {
|
|
|
9370
9714
|
};
|
|
9371
9715
|
|
|
9372
9716
|
const SmartBot = (props) => {
|
|
9373
|
-
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "" } = props;
|
|
9717
|
+
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
|
|
9374
9718
|
const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, } = useChatState();
|
|
9375
9719
|
// Add state for confirmation dialogs
|
|
9376
9720
|
React.useState(false);
|
|
@@ -9698,7 +10042,7 @@ const SmartBot = (props) => {
|
|
|
9698
10042
|
}, [chatDataState, currentMode]);
|
|
9699
10043
|
const fetchLegacyAgentInfo = async () => {
|
|
9700
10044
|
try {
|
|
9701
|
-
let legacyAgentScreenData = await fetchLegacyAgentScreen();
|
|
10045
|
+
let legacyAgentScreenData = await utils.fetchLegacyAgentScreen();
|
|
9702
10046
|
setLegacyAgentScreen(legacyAgentScreenData);
|
|
9703
10047
|
}
|
|
9704
10048
|
catch (error) {
|
|
@@ -10069,7 +10413,7 @@ const SmartBot = (props) => {
|
|
|
10069
10413
|
},
|
|
10070
10414
|
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
10071
10415
|
},
|
|
10072
|
-
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: 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 }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10416
|
+
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: 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, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10073
10417
|
freeTextHeading: "Try adding more details :",
|
|
10074
10418
|
freeTextContent: "Alan works better when you provide more context and pointed questions",
|
|
10075
10419
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {
|