impact-chatbot 2.3.5 → 2.3.7

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,19 @@ const ChatPlaceholder = (props) => {
4510
4509
  setLoading(false);
4511
4510
  }
4512
4511
  };
4513
- if (baseUrl && legacyAgentScreen) {
4512
+ if (baseUrl &&
4513
+ legacyAgentScreen &&
4514
+ !displayQuestions &&
4515
+ lodash.isEmpty(cardList)) {
4514
4516
  loadCards();
4515
4517
  }
4516
- }, [baseUrl]);
4518
+ if (questions &&
4519
+ Array.isArray(questions) &&
4520
+ questions.length > 0 &&
4521
+ displayQuestions) {
4522
+ setCardList(questions);
4523
+ }
4524
+ }, [baseUrl, questions, displayQuestions]);
4517
4525
  React.useEffect(() => {
4518
4526
  getBaseUrl();
4519
4527
  }, []);
@@ -4566,7 +4574,7 @@ const ChatPlaceholder = (props) => {
4566
4574
  description: card.description || card.helpText || "",
4567
4575
  agentId: card.agentId || card.id
4568
4576
  }));
4569
- const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
4577
+ const dataToMap = legacyAgentScreen || displayQuestions ? transformedCardList : rectangleData;
4570
4578
  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
4579
  };
4572
4580
 
@@ -5454,6 +5462,68 @@ const useStyles$2 = makeStyles((theme) => ({
5454
5462
  transform: "rotate(360deg)",
5455
5463
  },
5456
5464
  },
5465
+ "@keyframes skeletonRowExpand": {
5466
+ "0%": {
5467
+ width: pxToRem(31),
5468
+ gap: 0,
5469
+ },
5470
+ "20%": {
5471
+ width: "40%",
5472
+ gap: 0,
5473
+ },
5474
+ "30%": {
5475
+ width: "70%",
5476
+ gap: pxToRem(2),
5477
+ },
5478
+ "40%": {
5479
+ width: "100%",
5480
+ gap: pxToRem(4),
5481
+ },
5482
+ "70%": {
5483
+ width: "70%",
5484
+ gap: pxToRem(2),
5485
+ },
5486
+ "80%": {
5487
+ width: "40%",
5488
+ gap: 0,
5489
+ },
5490
+ "100%": {
5491
+ width: pxToRem(31),
5492
+ gap: 0,
5493
+ },
5494
+ },
5495
+ "@keyframes skeletonSquareFade": {
5496
+ "0%": {
5497
+ opacity: 0,
5498
+ width: 0,
5499
+ marginRight: 0,
5500
+ },
5501
+ "35%": {
5502
+ opacity: 0,
5503
+ width: 0,
5504
+ marginRight: 0,
5505
+ },
5506
+ "45%": {
5507
+ opacity: 1,
5508
+ width: pxToRem(31),
5509
+ marginRight: pxToRem(8),
5510
+ },
5511
+ "60%": {
5512
+ opacity: 1,
5513
+ width: pxToRem(31),
5514
+ marginRight: pxToRem(8),
5515
+ },
5516
+ "75%": {
5517
+ opacity: 0,
5518
+ width: 0,
5519
+ marginRight: 0,
5520
+ },
5521
+ "100%": {
5522
+ opacity: 0,
5523
+ width: 0,
5524
+ marginRight: 0,
5525
+ },
5526
+ },
5457
5527
  },
5458
5528
  stepsContainer: {
5459
5529
  display: "flex",
@@ -5535,19 +5605,46 @@ const useStyles$2 = makeStyles((theme) => ({
5535
5605
  loaderContainer: {
5536
5606
  display: "flex",
5537
5607
  flexDirection: "column",
5538
- justifyContent: "center",
5608
+ gap: pxToRem(10),
5609
+ padding: `${pxToRem(20)} ${pxToRem(16)}`,
5610
+ },
5611
+ skeletonRowWrapper: {
5612
+ display: "flex",
5539
5613
  alignItems: "center",
5540
- padding: pxToRem(40),
5541
5614
  },
5542
- loader: {
5543
- color: "#435af0",
5615
+ skeletonSquare: {
5616
+ width: 0,
5617
+ height: pxToRem(30),
5618
+ borderRadius: pxToRem(4),
5619
+ 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%)",
5620
+ opacity: 0.2,
5621
+ flexShrink: 0,
5622
+ animation: "skeletonSquareFade 1.8s ease-out infinite",
5544
5623
  },
5545
- loaderCaption: {
5546
- color: colours.neutrals,
5547
- fontFamily: "Manrope",
5548
- fontSize: pxToRem(13),
5549
- fontWeight: 500,
5550
- marginTop: pxToRem(12),
5624
+ skeletonSquareDelayed: {
5625
+ animationDelay: "0.2s",
5626
+ },
5627
+ skeletonRow: {
5628
+ display: "flex",
5629
+ flexDirection: "column",
5630
+ gap: 0,
5631
+ overflow: "hidden",
5632
+ animation: "skeletonRowExpand 1.8s ease-out infinite",
5633
+ },
5634
+ skeletonRowDelayed: {
5635
+ animationDelay: "0.2s",
5636
+ },
5637
+ skeletonBlock: {
5638
+ width: "100%",
5639
+ height: pxToRem(15),
5640
+ 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%)",
5641
+ opacity: 0.2,
5642
+ "&:first-child": {
5643
+ borderRadius: `${pxToRem(4)} ${pxToRem(4)} 0 0`,
5644
+ },
5645
+ "&:last-child": {
5646
+ borderRadius: `0 0 ${pxToRem(4)} ${pxToRem(4)}`,
5647
+ },
5551
5648
  },
5552
5649
  accordionAnimated: {
5553
5650
  animation: "$slideDown 0.4s ease-out forwards",
@@ -5677,7 +5774,7 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
5677
5774
  const hasQuestions = questions.length > 0;
5678
5775
  if (!hasQuestions) {
5679
5776
  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..." })] }));
5777
+ 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
5778
  }
5682
5779
  if (steps.length > 0) {
5683
5780
  const fallbackQuestion = "Processing Request";
@@ -9620,7 +9717,7 @@ let chatbotFilterCustomConfig = {
9620
9717
  };
9621
9718
 
9622
9719
  const SmartBot = (props) => {
9623
- const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "" } = props;
9720
+ const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
9624
9721
  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
9722
  // Add state for confirmation dialogs
9626
9723
  React.useState(false);
@@ -10319,7 +10416,7 @@ const SmartBot = (props) => {
10319
10416
  },
10320
10417
  icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
10321
10418
  },
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: {
10419
+ ], 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
10420
  freeTextHeading: "Try adding more details :",
10324
10421
  freeTextContent: "Alan works better when you provide more context and pointed questions",
10325
10422
  }, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {