impact-chatbot 2.3.3 → 2.3.5

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 CHANGED
@@ -26,14 +26,16 @@ var RefreshIcon = require('@mui/icons-material/Refresh');
26
26
  var styled = require('styled-components');
27
27
  var material = require('@mui/material');
28
28
  var utils = require('core/Utils/functions/utils');
29
- var impactUiChatbot = require('impact-ui-chatbot');
30
29
  var impactUiV3 = require('impact-ui-v3');
31
30
  var AgGridComponent = require('core/Utils/agGrid');
32
31
  var agGridColumnFormatter = require('core/Utils/agGrid/column-formatter');
33
32
  var CoreChart = require('core/Utils/core-charts');
34
33
  var makeStyles = require('@mui/styles/makeStyles');
34
+ var globalStyles$1 = require('core/Styles/globalStyles');
35
+ var CircularProgress = require('@mui/material/CircularProgress');
35
36
  var FormatListBulletedOutlinedIcon = require('@mui/icons-material/FormatListBulletedOutlined');
36
37
  var PsychologyOutlinedIcon = require('@mui/icons-material/PsychologyOutlined');
38
+ var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
37
39
  var RangePicker = require('core/commonComponents/dateRangePicker');
38
40
 
39
41
  function _interopNamespaceDefault(e) {
@@ -940,14 +942,6 @@ const getFormattedApplicationName = (applicationURL) => {
940
942
  }
941
943
  };
942
944
 
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
945
  /**
952
946
  * Preprocesses markdown content to improve list formatting
953
947
  */
@@ -1237,6 +1231,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
1237
1231
  setUniqueChatId: utilityObjectData?.setUniqueChatId,
1238
1232
  fieldNumber: utilityObjectData?.fieldNumber,
1239
1233
  setFieldNumber: utilityObjectData?.setFieldNumber,
1234
+ baseUrl: baseUrlTemp,
1240
1235
  };
1241
1236
  response = await parseResponse(null, "stream", "", currentModeValue, false, "", {}, payload, utilityObject);
1242
1237
  let chatDataMessages = chatDataInfoRef.current[currentModeValue].conversations[1].messages;
@@ -1867,6 +1862,8 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
1867
1862
  isTabEnabled: utilsObject?.isTabEnabled,
1868
1863
  steps: utilsObject?.steps,
1869
1864
  currentTabValue: utilsObject?.currentTabValue,
1865
+ questions: utilsObject?.questions,
1866
+ questionsStepsMap: utilsObject?.questionsStepsMap,
1870
1867
  }, null, { thinkingResponse: thinkingInfo });
1871
1868
  }
1872
1869
  }
@@ -4370,6 +4367,13 @@ const useRectangleStyles = styles.makeStyles((theme) => ({
4370
4367
  transition: "all 0.2s ease-in-out",
4371
4368
  position: "relative",
4372
4369
  overflow: "hidden",
4370
+ },
4371
+ rectangleHoverable: {
4372
+ cursor: "pointer",
4373
+ "&:hover": {
4374
+ transform: "translateY(-2px)",
4375
+ boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
4376
+ },
4373
4377
  "&::before": {
4374
4378
  content: '""',
4375
4379
  position: "absolute",
@@ -4444,12 +4448,12 @@ const useRectangleStyles = styles.makeStyles((theme) => ({
4444
4448
  color: "#60697D",
4445
4449
  },
4446
4450
  }));
4447
- const Rectangle = ({ type, icon, title, description, onClick }) => {
4451
+ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
4448
4452
  const classes = useRectangleStyles();
4449
- return (jsxRuntime.jsx("div", { className: `${classes.rectangle} ${classes[type]}`, 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 })] }) }));
4453
+ 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 })] }) }));
4450
4454
  };
4451
4455
  const ChatPlaceholder = (props) => {
4452
- 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;
4456
+ 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, } = props;
4453
4457
  const classes = useStyles$5();
4454
4458
  globalStyles();
4455
4459
  const [cardList, setCardList] = React.useState([]);
@@ -4477,6 +4481,8 @@ const ChatPlaceholder = (props) => {
4477
4481
  setThinkingHeaderMessage,
4478
4482
  uniqueChatId,
4479
4483
  setUniqueChatId,
4484
+ fieldNumber,
4485
+ setFieldNumber,
4480
4486
  });
4481
4487
  const getBaseUrl = async () => {
4482
4488
  try {
@@ -4511,15 +4517,15 @@ const ChatPlaceholder = (props) => {
4511
4517
  React.useEffect(() => {
4512
4518
  getBaseUrl();
4513
4519
  }, []);
4514
- const handleRectangleClick = (agentId) => {
4520
+ const handleRectangleClick = (agentId, title) => {
4515
4521
  if (legacyAgentScreen) {
4516
4522
  setCurrentAgentId(agentId);
4517
4523
  const initiateAgentPayload = {
4518
4524
  agent_id: agentId,
4519
4525
  session_id: null,
4520
- user_input: userInput,
4526
+ user_input: title,
4521
4527
  init: true,
4522
- delay: 0,
4528
+ delay: 0.3,
4523
4529
  };
4524
4530
  setAgentFlow(initiateAgentPayload, "", baseUrl);
4525
4531
  }
@@ -4557,11 +4563,11 @@ const ChatPlaceholder = (props) => {
4557
4563
  type: "blue",
4558
4564
  icon: jsxRuntime.jsx(SvgCircular3D, {}),
4559
4565
  title: card.name || card.title || "Agent",
4560
- description: card.description || card.helpText || "Agent description",
4566
+ description: card.description || card.helpText || "",
4561
4567
  agentId: card.agentId || card.id
4562
4568
  }));
4563
4569
  const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
4564
- 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) }, index))) })] }));
4570
+ 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))) })] }));
4565
4571
  };
4566
4572
 
4567
4573
  const dateFormat = "DD-MM-YYYY HH:mm:ss";
@@ -5044,6 +5050,13 @@ const sseevent = (message, messageToStoreRef) => {
5044
5050
  };
5045
5051
  }
5046
5052
  }
5053
+ if (messageToStoreRef.current.currentMode === "agent" &&
5054
+ (parsedData?.chat_id || parsedData?.session_id)) {
5055
+ messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
5056
+ ? parsedData.chat_id
5057
+ : "";
5058
+ messageToStoreRef.current.sessionId = parsedData?.session_id;
5059
+ }
5047
5060
  if (parsedData?.is_error) {
5048
5061
  messageToStoreRef.current.chatData.response =
5049
5062
  messageToStoreRef.current.chatData.response +
@@ -5405,26 +5418,57 @@ var SvgStepError = function SvgStepError(props) {
5405
5418
  })));
5406
5419
  };
5407
5420
 
5421
+ const CustomGroupAccordion = ({ children, onExpandChange, }) => {
5422
+ const globalClasses = globalStyles$1();
5423
+ const [accordionData, setAccordionData] = React.useState([]);
5424
+ const [activeAccordion, setActiveAccordion] = React.useState("");
5425
+ const prepareAccordionData = () => {
5426
+ const data = [];
5427
+ React.Children.toArray(children).forEach((child, index) => {
5428
+ data.push({
5429
+ id: index + 1,
5430
+ header: child.props.accordionName,
5431
+ content: child,
5432
+ value: child.props.accordionValue || child.props.accordionName,
5433
+ childCount: child.props.accordionChildCount,
5434
+ });
5435
+ });
5436
+ setAccordionData(data);
5437
+ };
5438
+ React.useEffect(() => {
5439
+ prepareAccordionData();
5440
+ }, [children]);
5441
+ return (jsxRuntime.jsx("div", { className: globalClasses.accordianWrapper, children: jsxRuntime.jsx(impactUiV3.AccordionModern, { data: accordionData, expanded: activeAccordion, setExpanded: (val) => {
5442
+ setActiveAccordion(val);
5443
+ onExpandChange?.(val);
5444
+ } }) }));
5445
+ };
5446
+
5408
5447
  const useStyles$2 = makeStyles((theme) => ({
5448
+ "@global": {
5449
+ "@keyframes stepsLoaderSpin": {
5450
+ "0%": {
5451
+ transform: "rotate(0deg)",
5452
+ },
5453
+ "100%": {
5454
+ transform: "rotate(360deg)",
5455
+ },
5456
+ },
5457
+ },
5409
5458
  stepsContainer: {
5410
5459
  display: "flex",
5411
5460
  flexDirection: "column",
5412
- gap: "20px",
5461
+ gap: pxToRem(20),
5413
5462
  background: colours.white,
5414
- marginTop: "20px",
5463
+ marginTop: pxToRem(20),
5415
5464
  },
5416
5465
  stepItem: {
5417
5466
  display: "flex",
5418
5467
  alignItems: "center",
5419
5468
  gap: "12px",
5420
5469
  },
5421
- "@keyframes rotate": {
5422
- "0%": {
5423
- transform: "rotate(0deg)",
5424
- },
5425
- "100%": {
5426
- transform: "rotate(360deg)",
5427
- }
5470
+ mt12: {
5471
+ marginTop: pxToRem(12),
5428
5472
  },
5429
5473
  stepStatus: {
5430
5474
  display: "flex",
@@ -5438,7 +5482,7 @@ const useStyles$2 = makeStyles((theme) => ({
5438
5482
  "&.loading": {
5439
5483
  background: colours.backgroundChat,
5440
5484
  "& svg": {
5441
- animation: "$rotate 1s linear infinite",
5485
+ animation: "stepsLoaderSpin 1s linear infinite",
5442
5486
  }
5443
5487
  },
5444
5488
  "&.error": {
@@ -5457,10 +5501,10 @@ const useStyles$2 = makeStyles((theme) => ({
5457
5501
  stepHeader: {
5458
5502
  color: colours.oceanGreen,
5459
5503
  fontFamily: "Manrope",
5460
- fontSize: "14px",
5504
+ fontSize: pxToRem(14),
5461
5505
  fontStyle: "normal",
5462
5506
  fontWeight: 500,
5463
- lineHeight: "20px",
5507
+ lineHeight: pxToRem(20),
5464
5508
  "&.loading": {
5465
5509
  color: colours.brightRoyalBlue,
5466
5510
  },
@@ -5471,25 +5515,131 @@ const useStyles$2 = makeStyles((theme) => ({
5471
5515
  stepSubheader: {
5472
5516
  color: colours.neutrals,
5473
5517
  fontFamily: "Manrope",
5474
- fontSize: "12px",
5518
+ fontSize: pxToRem(12),
5475
5519
  fontStyle: "normal",
5476
5520
  fontWeight: 500,
5477
- lineHeight: "16px",
5521
+ lineHeight: pxToRem(16),
5522
+ },
5523
+ "@keyframes slideDown": {
5524
+ "0%": {
5525
+ opacity: 0,
5526
+ maxHeight: 0,
5527
+ transform: "translateY(-12px)",
5528
+ },
5529
+ "100%": {
5530
+ opacity: 1,
5531
+ maxHeight: "2000px",
5532
+ transform: "translateY(0)",
5533
+ },
5534
+ },
5535
+ loaderContainer: {
5536
+ display: "flex",
5537
+ flexDirection: "column",
5538
+ justifyContent: "center",
5539
+ alignItems: "center",
5540
+ padding: pxToRem(40),
5541
+ },
5542
+ loader: {
5543
+ color: "#435af0",
5544
+ },
5545
+ loaderCaption: {
5546
+ color: colours.neutrals,
5547
+ fontFamily: "Manrope",
5548
+ fontSize: pxToRem(13),
5549
+ fontWeight: 500,
5550
+ marginTop: pxToRem(12),
5551
+ },
5552
+ accordionAnimated: {
5553
+ animation: "$slideDown 0.4s ease-out forwards",
5554
+ overflow: "hidden",
5555
+ "& .impact-modern-accordion-item .impact-modern-accordion-header": {
5556
+ height: "auto",
5557
+ alignItems: "flex-start",
5558
+ padding: `${pxToRem(16)} ${pxToRem(16)} ${pxToRem(8)} ${pxToRem(16)} !important`
5559
+ },
5560
+ "& .loading svg": {
5561
+ animation: "stepsLoaderSpin 1s linear infinite !important",
5562
+ },
5563
+ "& .impact-modern-accordion-item .impact-modern-accordion-content": {
5564
+ padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
5565
+ },
5566
+ "& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
5567
+ width: `${pxToRem(24)} !important`,
5568
+ height: `${pxToRem(24)} !important`,
5569
+ }
5570
+ },
5571
+ accordionStepsWrapper: {
5572
+ display: "flex",
5573
+ flexDirection: "column",
5574
+ gap: pxToRem(12),
5575
+ },
5576
+ accordionHeaderWrapper: {
5577
+ display: "flex",
5578
+ flexDirection: "column",
5579
+ gap: pxToRem(16),
5580
+ width: "100%",
5581
+ },
5582
+ accordionHeaderQuestion: {
5583
+ fontFamily: "Manrope",
5584
+ fontSize: pxToRem(14),
5585
+ fontWeight: 600,
5586
+ },
5587
+ headerStepPreview: {
5588
+ marginLeft: pxToRem(-20),
5589
+ },
5590
+ closedAccordionStep: {
5591
+ display: "flex",
5592
+ alignItems: "center",
5593
+ gap: "8px",
5594
+ marginTop: pxToRem(4),
5595
+ "& svg": {
5596
+ width: "14px",
5597
+ height: "14px",
5598
+ flexShrink: 0,
5599
+ },
5600
+ },
5601
+ closedStepLoading: {
5602
+ "& svg": {
5603
+ animation: "stepsLoaderSpin 1s linear infinite",
5604
+ },
5605
+ },
5606
+ closedStepText: {
5607
+ fontFamily: "Manrope",
5608
+ fontSize: pxToRem(12),
5609
+ fontWeight: 500,
5610
+ color: colours.neutrals,
5611
+ "&.loading": {
5612
+ color: colours.brightRoyalBlue,
5613
+ },
5614
+ "&.completed": {
5615
+ color: colours.oceanGreen,
5616
+ },
5478
5617
  },
5479
5618
  }));
5480
- const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, }) => {
5619
+ const StepItemRenderer$1 = ({ step, classes }) => (jsxRuntime.jsxs("div", { className: classes.stepItem, children: [jsxRuntime.jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
5620
+ ? "loading"
5621
+ : step.step_status === "error"
5622
+ ? "error"
5623
+ : ""}`, 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"
5624
+ ? "loading"
5625
+ : step.step_status === "error"
5626
+ ? "error"
5627
+ : ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
5628
+ const getActiveStep = (stepsForQuestion) => {
5629
+ if (!stepsForQuestion || stepsForQuestion.length === 0)
5630
+ return null;
5631
+ const loadingStep = stepsForQuestion.find((s) => s.step_status === "not-completed");
5632
+ if (loadingStep)
5633
+ return loadingStep;
5634
+ return stepsForQuestion[stepsForQuestion.length - 1];
5635
+ };
5636
+ const AccordionStepsContent$1 = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
5637
+ 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))) }) }));
5638
+ };
5639
+ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, }) => {
5481
5640
  const classes = useStyles$2();
5482
5641
  React.useState(false);
5483
- // useEffect(() => {
5484
- // if (steps.length > 0) {
5485
- // // Mark all previous steps as done and last step as loading
5486
- // const updatedSteps = steps.map((step, index) => ({
5487
- // ...step,
5488
- // status: index === steps.length - 1 ? "loading" : "done"
5489
- // }));
5490
- // setSteps(updatedSteps);
5491
- // }
5492
- // }, [steps]);
5642
+ const [expandedAccordion, setExpandedAccordion] = React.useState("");
5493
5643
  React.useEffect(() => {
5494
5644
  if (done) {
5495
5645
  // Add finished step when done is true
@@ -5524,15 +5674,38 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
5524
5674
  }
5525
5675
  }
5526
5676
  }, [done]);
5527
- 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"
5528
- ? "loading"
5529
- : step.step_status === "error"
5530
- ? "error"
5531
- : ""}`, 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"
5532
- ? "loading"
5533
- : step.step_status === "error"
5534
- ? "error"
5535
- : ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }, index))) }));
5677
+ const hasQuestions = questions.length > 0;
5678
+ if (!hasQuestions) {
5679
+ if (currentMode === "agent" && steps.length === 1) {
5680
+ return (jsxRuntime.jsxs("div", { className: classes.loaderContainer, children: [jsxRuntime.jsx(CircularProgress, { className: classes.loader, size: 50, thickness: 4 }), jsxRuntime.jsx("span", { className: classes.loaderCaption, children: "Analyzing next steps..." })] }));
5681
+ }
5682
+ if (steps.length > 0) {
5683
+ const fallbackQuestion = "Processing Request";
5684
+ const activeStep = getActiveStep(steps);
5685
+ const isExpanded = expandedAccordion === fallbackQuestion;
5686
+ 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 }) }))] }));
5687
+ 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 }) }) }));
5688
+ }
5689
+ return null;
5690
+ }
5691
+ return (jsxRuntime.jsx("div", { className: `${classes.stepsContainer} ${classes.accordionAnimated}`, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
5692
+ const questionSteps = questionsStepsMap[question] || [
5693
+ {
5694
+ header: "Processing Request",
5695
+ sub_header: "Analyzing the current request",
5696
+ step_status: "not-completed",
5697
+ },
5698
+ ];
5699
+ const activeStep = getActiveStep(questionSteps);
5700
+ const stepCount = questionSteps.length;
5701
+ const completedCount = questionSteps.filter((s) => s.step_status === "completed").length;
5702
+ activeStep
5703
+ ? `${activeStep.header} - Step ${completedCount}/${stepCount}`
5704
+ : "";
5705
+ const isExpanded = expandedAccordion === question;
5706
+ 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 }) }))] }));
5707
+ return (jsxRuntime.jsx(AccordionStepsContent$1, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
5708
+ }) }) }));
5536
5709
  };
5537
5710
 
5538
5711
  const AgentResponse$1 = (props) => {
@@ -5545,7 +5718,7 @@ const AgentResponse$1 = (props) => {
5545
5718
  };
5546
5719
 
5547
5720
  const StepsResponseTab = (props) => {
5548
- const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, } = props;
5721
+ const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, } = props;
5549
5722
  const [tabValue, setTabValue] = React.useState("steps");
5550
5723
  const handleChangeTabValue = (_event, newValue) => {
5551
5724
  setTabValue(newValue);
@@ -5562,7 +5735,7 @@ const StepsResponseTab = (props) => {
5562
5735
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
5563
5736
  },
5564
5737
  ], tabPanels: [
5565
- jsxRuntime.jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode }),
5738
+ 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 }),
5566
5739
  jsxRuntime.jsx(AgentResponse$1, { content: content, isStreaming: isStreaming }),
5567
5740
  ], value: tabValue }) }));
5568
5741
  };
@@ -5598,7 +5771,7 @@ const formatThinkingTime = (seconds) => {
5598
5771
  * @param {Function} botData.utilityObject.setChatDataState - Function to update chat data state
5599
5772
  */
5600
5773
  const StreamedContent = ({ botData }) => {
5601
- const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, } = botData.utilityObject;
5774
+ const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, baseUrl } = botData.utilityObject;
5602
5775
  const classes = useStyles$3();
5603
5776
  useStyles$6();
5604
5777
  const dispatch = reactRedux.useDispatch();
@@ -5620,6 +5793,8 @@ const StreamedContent = ({ botData }) => {
5620
5793
  step_status: "not-completed"
5621
5794
  }
5622
5795
  ]);
5796
+ const [questions, setQuestions] = React.useState([]);
5797
+ const [questionsStepsMap, setQuestionsStepsMap] = React.useState({});
5623
5798
  const [stepChange, setStepChange] = React.useState(false);
5624
5799
  const [stepsDone, setStepsDone] = React.useState(false);
5625
5800
  const [finalStepDone, setFinalStepDone] = React.useState(false);
@@ -5636,6 +5811,8 @@ const StreamedContent = ({ botData }) => {
5636
5811
  step_status: "not-completed"
5637
5812
  }
5638
5813
  ]);
5814
+ const questionsRef = React.useRef([]);
5815
+ const questionsStepsMapRef = React.useRef({});
5639
5816
  // Refs to maintain data across renders
5640
5817
  const sourceRef = React.useRef(null); // Holds the SSE source instance
5641
5818
  React.useRef(""); // Tracks the last received message
@@ -5725,8 +5902,25 @@ const StreamedContent = ({ botData }) => {
5725
5902
  thinkingStartTimeRef.current = Date.now();
5726
5903
  }
5727
5904
  const data = JSON.parse(event.data);
5728
- if (data?.message || data?.status === "step" || data?.status === "thinking") {
5729
- if (data.status === "thinking") {
5905
+ if (data?.message || data?.status === "step" || data?.status === "thinking" || data?.status === "questions") {
5906
+ if (data.status === "questions") {
5907
+ const incomingQuestions = data.widget_data?.[0]?.questions || [];
5908
+ questionsRef.current = incomingQuestions;
5909
+ setQuestions(incomingQuestions);
5910
+ const initialMap = {};
5911
+ incomingQuestions.forEach((q) => {
5912
+ initialMap[q] = [
5913
+ {
5914
+ header: "Processing Request",
5915
+ sub_header: "Analyzing the current request",
5916
+ step_status: "not-completed",
5917
+ },
5918
+ ];
5919
+ });
5920
+ questionsStepsMapRef.current = initialMap;
5921
+ setQuestionsStepsMap(lodash.cloneDeep(initialMap));
5922
+ }
5923
+ else if (data.status === "thinking") {
5730
5924
  messageToStoreRef.current.chatData.thinkingResponse.thinkingHeading = "Planning next moves";
5731
5925
  // Start thinking if not already started
5732
5926
  if (!isThinking) {
@@ -5765,6 +5959,7 @@ const StreamedContent = ({ botData }) => {
5765
5959
  }
5766
5960
  else if (data.status === "step") {
5767
5961
  let newStep = data.widget_data[0];
5962
+ const currentIntent = data.widget_data[0]?.current_intent;
5768
5963
  setSteps([...steps, newStep]);
5769
5964
  let newSteps = lodash.cloneDeep(stepRef.current);
5770
5965
  if (newSteps.length === 1) {
@@ -5774,15 +5969,28 @@ const StreamedContent = ({ botData }) => {
5774
5969
  }
5775
5970
  const existingStepIndex = newSteps.findIndex((step) => step.header === newStep.header);
5776
5971
  if (existingStepIndex !== -1) {
5777
- // Replace the existing step at the same position
5778
5972
  newSteps[existingStepIndex] = newStep;
5779
5973
  }
5780
5974
  else {
5781
- // If no matching step found, add it to the end
5782
5975
  newSteps.push(newStep);
5783
5976
  }
5784
5977
  stepRef.current = newSteps;
5785
5978
  setSteps(newSteps);
5979
+ if (currentIntent && questionsStepsMapRef.current[currentIntent]) {
5980
+ let intentSteps = lodash.cloneDeep(questionsStepsMapRef.current[currentIntent]);
5981
+ if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
5982
+ intentSteps[0].step_status = "completed";
5983
+ }
5984
+ const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
5985
+ if (existingIdx !== -1) {
5986
+ intentSteps[existingIdx] = newStep;
5987
+ }
5988
+ else {
5989
+ intentSteps.push(newStep);
5990
+ }
5991
+ questionsStepsMapRef.current[currentIntent] = intentSteps;
5992
+ setQuestionsStepsMap(lodash.cloneDeep(questionsStepsMapRef.current));
5993
+ }
5786
5994
  setStepChange((prev) => !prev);
5787
5995
  }
5788
5996
  else if (data.message !== "[DONE]") {
@@ -6014,6 +6222,8 @@ const StreamedContent = ({ botData }) => {
6014
6222
  isTabEnabled: true,
6015
6223
  steps: lodash.cloneDeep(stepRef.current),
6016
6224
  currentTabValue: "agent_response",
6225
+ questions: lodash.cloneDeep(questionsRef.current),
6226
+ questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
6017
6227
  });
6018
6228
  // [
6019
6229
  // {
@@ -6092,6 +6302,8 @@ const StreamedContent = ({ botData }) => {
6092
6302
  isTabEnabled: true,
6093
6303
  steps: lodash.cloneDeep(stepRef.current),
6094
6304
  currentTabValue: "agent_response",
6305
+ questions: lodash.cloneDeep(questionsRef.current),
6306
+ questionsStepsMap: lodash.cloneDeep(questionsStepsMapRef.current),
6095
6307
  });
6096
6308
  }
6097
6309
  // Trigger re-render by updating chatDataState
@@ -6125,6 +6337,10 @@ const StreamedContent = ({ botData }) => {
6125
6337
  sourceRef.current.close();
6126
6338
  setIsStreaming(false);
6127
6339
  setIsStreamingDone(true);
6340
+ // Stop the agent flow on the backend
6341
+ if (messageToStoreRef.current.sessionId) {
6342
+ chatbotServices.stopAgentFlow({ session_id: messageToStoreRef.current.sessionId }, baseUrl);
6343
+ }
6128
6344
  // Clear timeout if exists
6129
6345
  if (streamTimeoutRef.current) {
6130
6346
  clearTimeout(streamTimeoutRef.current);
@@ -6224,7 +6440,7 @@ const StreamedContent = ({ botData }) => {
6224
6440
  * @returns {JSX.Element} Rendered content with optional blinking cursor
6225
6441
  */
6226
6442
  const renderContent = () => {
6227
- 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 }) }));
6443
+ 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 }) }));
6228
6444
  };
6229
6445
  if (currentMode === "agent") {
6230
6446
  return renderContent();
@@ -6443,9 +6659,28 @@ const useStyles$1 = makeStyles((theme) => ({
6443
6659
  stepsContainer: {
6444
6660
  display: "flex",
6445
6661
  flexDirection: "column",
6446
- gap: "20px",
6662
+ gap: pxToRem(20),
6447
6663
  background: colours.white,
6448
- marginTop: "20px",
6664
+ marginTop: pxToRem(20),
6665
+ "& .impact-modern-accordion-item .impact-modern-accordion-header": {
6666
+ height: "auto",
6667
+ alignItems: "flex-start"
6668
+ },
6669
+ "& .impact-modern-accordion-item .impact-modern-accordion-content": {
6670
+ padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
6671
+ },
6672
+ "& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
6673
+ width: `${pxToRem(24)} !important`,
6674
+ height: `${pxToRem(24)} !important`,
6675
+ }
6676
+ },
6677
+ hideContentDiv: {
6678
+ "& .impact-modern-accordion-item .impact-modern-accordion-content": {
6679
+ display: "none",
6680
+ }
6681
+ },
6682
+ mt12: {
6683
+ marginTop: pxToRem(12),
6449
6684
  },
6450
6685
  stepItem: {
6451
6686
  display: "flex",
@@ -6491,10 +6726,10 @@ const useStyles$1 = makeStyles((theme) => ({
6491
6726
  stepHeader: {
6492
6727
  color: colours.oceanGreen,
6493
6728
  fontFamily: "Manrope",
6494
- fontSize: "14px",
6729
+ fontSize: pxToRem(14),
6495
6730
  fontStyle: "normal",
6496
6731
  fontWeight: 500,
6497
- lineHeight: "20px",
6732
+ lineHeight: pxToRem(20),
6498
6733
  "&.loading": {
6499
6734
  color: colours.brightRoyalBlue,
6500
6735
  },
@@ -6505,62 +6740,89 @@ const useStyles$1 = makeStyles((theme) => ({
6505
6740
  stepSubheader: {
6506
6741
  color: colours.neutrals,
6507
6742
  fontFamily: "Manrope",
6508
- fontSize: "12px",
6743
+ fontSize: pxToRem(12),
6509
6744
  fontStyle: "normal",
6510
6745
  fontWeight: 500,
6511
- lineHeight: "16px",
6746
+ lineHeight: pxToRem(16),
6747
+ },
6748
+ accordionStepsWrapper: {
6749
+ display: "flex",
6750
+ flexDirection: "column",
6751
+ gap: pxToRem(12),
6752
+ },
6753
+ accordionHeaderWrapper: {
6754
+ display: "flex",
6755
+ flexDirection: "column",
6756
+ gap: pxToRem(16),
6757
+ width: "100%",
6758
+ },
6759
+ accordionHeaderQuestion: {
6760
+ fontFamily: "Manrope",
6761
+ fontSize: pxToRem(14),
6762
+ fontWeight: 600,
6763
+ },
6764
+ headerStepPreview: {
6765
+ marginLeft: pxToRem(-20),
6766
+ },
6767
+ closedAccordionStep: {
6768
+ display: "flex",
6769
+ alignItems: "center",
6770
+ gap: "8px",
6771
+ marginTop: pxToRem(4),
6772
+ "& svg": {
6773
+ width: "14px",
6774
+ height: "14px",
6775
+ flexShrink: 0,
6776
+ },
6777
+ },
6778
+ closedStepText: {
6779
+ fontFamily: "Manrope",
6780
+ fontSize: pxToRem(12),
6781
+ fontWeight: 500,
6782
+ color: colours.oceanGreen,
6512
6783
  },
6513
6784
  }));
6514
- const Steps = ({ steps }) => {
6515
- const classes = useStyles$1();
6516
- React.useState(false);
6517
- // useEffect(() => {
6518
- // if (steps.length > 0) {
6519
- // // Mark all previous steps as done and last step as loading
6520
- // const updatedSteps = steps.map((step, index) => ({
6521
- // ...step,
6522
- // status: index === steps.length - 1 ? "loading" : "done"
6523
- // }));
6524
- // setSteps(updatedSteps);
6525
- // }
6526
- // }, [steps]);
6527
- // useEffect(() => {
6528
- // if (done) {
6529
- // // Add finished step when done is true
6530
- // if (!finalStepDone) {
6531
- // let updatedSteps = steps.map((step) => ({
6532
- // ...step,
6533
- // step_status: "completed",
6534
- // }));
6535
- // updatedSteps = [...updatedSteps, {
6536
- // header: "Finished",
6537
- // sub_header: "Analysis complete",
6538
- // step_status: "not-completed",
6539
- // }];
6540
- // setSteps(cloneDeep(updatedSteps));
6541
- // setTimeout(() => {
6542
- // updatedSteps = updatedSteps.map((step) => ({
6543
- // ...step,
6544
- // step_status: "completed",
6545
- // }));
6546
- // setSteps(cloneDeep(updatedSteps));
6547
- // setFinalStepDone(true);
6548
- // }, 4000);
6549
- // setTimeout(() => {
6550
- // setTabValue("agent_response");
6551
- // }, 4300);
6552
- // }
6553
- // }
6554
- // }, [done]);
6555
- 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"
6785
+ const StepItemRenderer = ({ step, classes }) => (jsxRuntime.jsxs("div", { className: classes.stepItem, children: [jsxRuntime.jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
6786
+ ? "loading"
6787
+ : step.step_status === "error"
6788
+ ? "error"
6789
+ : ""}`, 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"
6556
6790
  ? "loading"
6557
6791
  : step.step_status === "error"
6558
6792
  ? "error"
6559
- : ""}`, 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"
6560
- ? "loading"
6561
- : step.step_status === "error"
6562
- ? "error"
6563
- : ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }, index))) }));
6793
+ : ""}`, children: step.header }), jsxRuntime.jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
6794
+ const AccordionStepsContent = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
6795
+ 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))) }) }));
6796
+ };
6797
+ const Steps = ({ steps, questions = [], questionsStepsMap = {} }) => {
6798
+ const classes = useStyles$1();
6799
+ React.useState(false);
6800
+ const [expandedAccordion, setExpandedAccordion] = React.useState("");
6801
+ const hasQuestions = questions.length > 0;
6802
+ if (!hasQuestions) {
6803
+ if (steps.length > 0) {
6804
+ const fallbackQuestion = "Processing Request";
6805
+ const lastStep = steps[steps.length - 1];
6806
+ const isExpanded = expandedAccordion === fallbackQuestion;
6807
+ 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 }) }))] }));
6808
+ 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 }) }) }));
6809
+ }
6810
+ return null;
6811
+ }
6812
+ return (jsxRuntime.jsx("div", { className: classes.stepsContainer, children: jsxRuntime.jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
6813
+ const questionSteps = questionsStepsMap[question] || [
6814
+ {
6815
+ header: "Processing Request",
6816
+ sub_header: "Analyzing the current request",
6817
+ step_status: "completed",
6818
+ },
6819
+ ];
6820
+ questionSteps.length;
6821
+ const lastStep = questionSteps[questionSteps.length - 1];
6822
+ const isExpanded = expandedAccordion === question;
6823
+ 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 }) }))] }));
6824
+ return (jsxRuntime.jsx(AccordionStepsContent, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
6825
+ }) }) }));
6564
6826
  };
6565
6827
 
6566
6828
  const AgentResponse = ({ children }) => {
@@ -6568,7 +6830,7 @@ const AgentResponse = ({ children }) => {
6568
6830
  return (jsxRuntime.jsx("div", { className: classes.agentResponseContainer, children: children }));
6569
6831
  };
6570
6832
 
6571
- const TabularContent = ({ steps, currentTabValue, children }) => {
6833
+ const TabularContent = ({ steps, currentTabValue, children, questions = [], questionsStepsMap = {} }) => {
6572
6834
  const [tabValue, setTabValue] = React.useState(currentTabValue);
6573
6835
  const handleChangeTabValue = (_event, newValue) => {
6574
6836
  setTabValue(newValue);
@@ -6576,6 +6838,13 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
6576
6838
  steps.forEach((step) => {
6577
6839
  step.step_status = "completed";
6578
6840
  });
6841
+ if (Object.keys(questionsStepsMap).length > 0) {
6842
+ Object.keys(questionsStepsMap).forEach((key) => {
6843
+ questionsStepsMap[key].forEach((step) => {
6844
+ step.step_status = "completed";
6845
+ });
6846
+ });
6847
+ }
6579
6848
  return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(impactUiV3.Tabs, { onChange: handleChangeTabValue, orientation: "horizontal", tabNames: [
6580
6849
  {
6581
6850
  label: "Steps",
@@ -6588,7 +6857,7 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
6588
6857
  icon: jsxRuntime.jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
6589
6858
  },
6590
6859
  ], tabPanels: [
6591
- jsxRuntime.jsx(Steps, { steps: steps }),
6860
+ jsxRuntime.jsx(Steps, { steps: steps, questions: questions, questionsStepsMap: questionsStepsMap }),
6592
6861
  jsxRuntime.jsx(AgentResponse, { children: children }),
6593
6862
  ], value: tabValue }) }));
6594
6863
  };
@@ -6657,7 +6926,7 @@ const CombinedContent = ({ botData, props }) => {
6657
6926
  const validContent = renderedContent.filter(content => content !== null);
6658
6927
  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" })) }));
6659
6928
  if (isTabEnabled) {
6660
- return (jsxRuntime.jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", children: renderCombinedContent() }));
6929
+ return (jsxRuntime.jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", questions: botData?.utilityData?.questions || [], questionsStepsMap: botData?.utilityData?.questionsStepsMap || {}, children: renderCombinedContent() }));
6661
6930
  }
6662
6931
  return renderCombinedContent();
6663
6932
  };
@@ -9679,7 +9948,7 @@ const SmartBot = (props) => {
9679
9948
  }, [chatDataState, currentMode]);
9680
9949
  const fetchLegacyAgentInfo = async () => {
9681
9950
  try {
9682
- let legacyAgentScreenData = await fetchLegacyAgentScreen();
9951
+ let legacyAgentScreenData = await utils.fetchLegacyAgentScreen();
9683
9952
  setLegacyAgentScreen(legacyAgentScreenData);
9684
9953
  }
9685
9954
  catch (error) {
@@ -9917,7 +10186,7 @@ const SmartBot = (props) => {
9917
10186
  setBaseUrl(customBaseUrl);
9918
10187
  }
9919
10188
  }, [forceOpen]);
9920
- return (jsxRuntime.jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""}`, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiChatbot.ChatBotComponent, { isFullWidth: true, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions })) : null, isChatBotOpen: showModal || forceOpen,
10189
+ return (jsxRuntime.jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""}`, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions })) : null, isChatBotOpen: showModal || forceOpen,
9921
10190
  // landingScreen={true}
9922
10191
  handleNewChatClick: () => {
9923
10192
  localStorage.setItem("isStreaming", "false");
@@ -10050,7 +10319,7 @@ const SmartBot = (props) => {
10050
10319
  },
10051
10320
  icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
10052
10321
  },
10053
- ], 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: {
10322
+ ], 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 }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
10054
10323
  freeTextHeading: "Try adding more details :",
10055
10324
  freeTextContent: "Alan works better when you provide more context and pointed questions",
10056
10325
  }, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {