impact-chatbot 2.3.5 → 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/index.cjs.js CHANGED
@@ -32,7 +32,6 @@ 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
34
  var globalStyles$1 = require('core/Styles/globalStyles');
35
- var CircularProgress = require('@mui/material/CircularProgress');
36
35
  var FormatListBulletedOutlinedIcon = require('@mui/icons-material/FormatListBulletedOutlined');
37
36
  var PsychologyOutlinedIcon = require('@mui/icons-material/PsychologyOutlined');
38
37
  var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
@@ -4453,7 +4452,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
4453
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 })] }) }));
4454
4453
  };
4455
4454
  const ChatPlaceholder = (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;
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;
4457
4456
  const classes = useStyles$5();
4458
4457
  globalStyles();
4459
4458
  const [cardList, setCardList] = React.useState([]);
@@ -4510,10 +4509,16 @@ const ChatPlaceholder = (props) => {
4510
4509
  setLoading(false);
4511
4510
  }
4512
4511
  };
4513
- if (baseUrl && legacyAgentScreen) {
4512
+ if (baseUrl && legacyAgentScreen && !displayQuestions) {
4514
4513
  loadCards();
4515
4514
  }
4516
- }, [baseUrl]);
4515
+ if (questions &&
4516
+ Array.isArray(questions) &&
4517
+ questions.length > 0 &&
4518
+ displayQuestions) {
4519
+ setCardList(questions);
4520
+ }
4521
+ }, [baseUrl, questions, displayQuestions]);
4517
4522
  React.useEffect(() => {
4518
4523
  getBaseUrl();
4519
4524
  }, []);
@@ -4566,7 +4571,7 @@ const ChatPlaceholder = (props) => {
4566
4571
  description: card.description || card.helpText || "",
4567
4572
  agentId: card.agentId || card.id
4568
4573
  }));
4569
- const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
4574
+ const dataToMap = legacyAgentScreen || displayQuestions ? transformedCardList : rectangleData;
4570
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))) })] }));
4571
4576
  };
4572
4577
 
@@ -5454,6 +5459,68 @@ const useStyles$2 = makeStyles((theme) => ({
5454
5459
  transform: "rotate(360deg)",
5455
5460
  },
5456
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
+ },
5457
5524
  },
5458
5525
  stepsContainer: {
5459
5526
  display: "flex",
@@ -5535,19 +5602,46 @@ const useStyles$2 = makeStyles((theme) => ({
5535
5602
  loaderContainer: {
5536
5603
  display: "flex",
5537
5604
  flexDirection: "column",
5538
- justifyContent: "center",
5605
+ gap: pxToRem(10),
5606
+ padding: `${pxToRem(20)} ${pxToRem(16)}`,
5607
+ },
5608
+ skeletonRowWrapper: {
5609
+ display: "flex",
5539
5610
  alignItems: "center",
5540
- padding: pxToRem(40),
5541
5611
  },
5542
- loader: {
5543
- color: "#435af0",
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",
5544
5620
  },
5545
- loaderCaption: {
5546
- color: colours.neutrals,
5547
- fontFamily: "Manrope",
5548
- fontSize: pxToRem(13),
5549
- fontWeight: 500,
5550
- marginTop: pxToRem(12),
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
+ },
5551
5645
  },
5552
5646
  accordionAnimated: {
5553
5647
  animation: "$slideDown 0.4s ease-out forwards",
@@ -5677,7 +5771,7 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
5677
5771
  const hasQuestions = questions.length > 0;
5678
5772
  if (!hasQuestions) {
5679
5773
  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..." })] }));
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 })] })] })] }));
5681
5775
  }
5682
5776
  if (steps.length > 0) {
5683
5777
  const fallbackQuestion = "Processing Request";
@@ -9620,7 +9714,7 @@ let chatbotFilterCustomConfig = {
9620
9714
  };
9621
9715
 
9622
9716
  const SmartBot = (props) => {
9623
- const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "" } = props;
9717
+ const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
9624
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();
9625
9719
  // Add state for confirmation dialogs
9626
9720
  React.useState(false);
@@ -10319,7 +10413,7 @@ const SmartBot = (props) => {
10319
10413
  },
10320
10414
  icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
10321
10415
  },
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: {
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: {
10323
10417
  freeTextHeading: "Try adding more details :",
10324
10418
  freeTextContent: "Alan works better when you provide more context and pointed questions",
10325
10419
  }, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {