@cognizant-ai-lab/ui-common 1.5.0 → 1.6.0

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.
Files changed (81) hide show
  1. package/dist/Theme/Theme.js +3 -3
  2. package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +11 -1
  3. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +284 -285
  4. package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +1 -7
  5. package/dist/components/AgentChat/ChatCommon/ChatHistory.js +33 -22
  6. package/dist/components/AgentChat/ChatCommon/ControlButtons.js +2 -2
  7. package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +13 -0
  8. package/dist/components/AgentChat/ChatCommon/Conversation.js +80 -0
  9. package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +23 -0
  10. package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +11 -0
  11. package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +5 -3
  12. package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +3 -0
  13. package/dist/components/AgentChat/ChatCommon/SampleQueries.js +6 -3
  14. package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +12 -0
  15. package/dist/components/AgentChat/ChatCommon/Thinking.js +51 -0
  16. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +2 -2
  17. package/dist/components/AgentChat/Common/Types.d.ts +6 -5
  18. package/dist/components/AgentChat/Common/Types.js +5 -0
  19. package/dist/components/AgentChat/Common/Utils.d.ts +1 -1
  20. package/dist/components/AgentChat/Common/Utils.js +14 -9
  21. package/dist/components/Common/AccordionLite.d.ts +14 -0
  22. package/dist/components/Common/AccordionLite.js +25 -0
  23. package/dist/components/Common/ConfirmationModal.d.ts +1 -0
  24. package/dist/components/Common/ConfirmationModal.js +1 -1
  25. package/dist/components/Common/CustomerLogo.js +1 -1
  26. package/dist/components/Common/MUIAlert.d.ts +1 -0
  27. package/dist/components/Common/MUIAlert.js +3 -4
  28. package/dist/components/Common/Navbar.d.ts +2 -1
  29. package/dist/components/Common/Navbar.js +8 -4
  30. package/dist/components/Common/notification.d.ts +1 -1
  31. package/dist/components/Common/notification.js +17 -12
  32. package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +8 -0
  33. package/dist/components/MultiAgentAccelerator/AgentFlow.js +282 -82
  34. package/dist/components/MultiAgentAccelerator/AgentNode.d.ts +3 -1
  35. package/dist/components/MultiAgentAccelerator/AgentNode.js +64 -28
  36. package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +1 -4
  37. package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +4 -5
  38. package/dist/components/MultiAgentAccelerator/GraphLayouts.js +19 -9
  39. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -2
  40. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +268 -60
  41. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +1 -0
  42. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +28 -12
  43. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +1 -0
  44. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +21 -5
  45. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +4 -3
  46. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +8 -2
  47. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +19 -2
  48. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +40 -5
  49. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.js +27 -14
  50. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.d.ts +7 -0
  51. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +88 -0
  52. package/dist/components/MultiAgentAccelerator/const.d.ts +7 -10
  53. package/dist/components/MultiAgentAccelerator/const.js +9 -10
  54. package/dist/const.d.ts +5 -1
  55. package/dist/const.js +5 -2
  56. package/dist/controller/agent/Agent.d.ts +10 -0
  57. package/dist/controller/agent/Agent.js +17 -1
  58. package/dist/controller/llm/LlmChat.js +2 -2
  59. package/dist/index.d.ts +0 -1
  60. package/dist/index.js +0 -1
  61. package/dist/state/TemporaryNetworks.d.ts +5 -15
  62. package/dist/state/TemporaryNetworks.js +15 -34
  63. package/dist/state/Tour.d.ts +29 -0
  64. package/dist/state/Tour.js +22 -0
  65. package/dist/state/UserInfo.d.ts +2 -1
  66. package/dist/tsconfig.build.tsbuildinfo +1 -1
  67. package/dist/utils/Authentication.js +12 -3
  68. package/dist/utils/File.d.ts +7 -0
  69. package/dist/utils/File.js +14 -3
  70. package/dist/utils/text.js +2 -2
  71. package/dist/utils/title.js +1 -1
  72. package/dist/utils/zIndexLayers.js +3 -0
  73. package/package.json +15 -11
  74. package/dist/components/AgentChat/ChatCommon/AgentConnectivity.d.ts +0 -14
  75. package/dist/components/AgentChat/ChatCommon/AgentConnectivity.js +0 -23
  76. package/dist/components/AgentChat/ChatCommon/Greetings.d.ts +0 -1
  77. package/dist/components/AgentChat/ChatCommon/Greetings.js +0 -38
  78. package/dist/components/AgentChat/ChatCommon/UserQueryDisplay.d.ts +0 -7
  79. package/dist/components/AgentChat/ChatCommon/UserQueryDisplay.js +0 -32
  80. package/dist/components/Common/LlmChatOptionsButton.d.ts +0 -6
  81. package/dist/components/Common/LlmChatOptionsButton.js +0 -31
@@ -52,7 +52,7 @@ const DISABLE_OUTLINE_PROPS = {
52
52
  outline: "none",
53
53
  },
54
54
  };
55
- export const Navbar = ({ authenticationType, id, logo, logoServiceToken, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
55
+ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
56
56
  // For email dialog
57
57
  const [emailDialogOpen, setEmailDialogOpen] = useState(false);
58
58
  // Dark mode
@@ -88,7 +88,8 @@ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, pathnam
88
88
  const customer = useSettingsStore((state) => state.settings.branding.customer);
89
89
  const primary = useSettingsStore((state) => state.settings.branding.primary);
90
90
  const hasCustomer = customer?.trim().length > 0;
91
- return hydrated ? (_jsxs(Grid, { id: "nav-bar-container", container: true, alignItems: "center", sx: {
91
+ return hydrated ? (_jsxs(Grid, { id: "nav-bar-container", container: true, sx: {
92
+ alignItems: "center",
92
93
  ...MENU_ITEM_TEXT_PROPS,
93
94
  padding: "0.5rem",
94
95
  }, children: [settingsDialogOpen && (_jsx(SettingsDialog, { id: "settings-dialog", isOpen: settingsDialogOpen, logoServiceToken: logoServiceToken, onClose: () => setSettingsDialogOpen(false) })), _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [_jsx(CustomerLogo, { logoServiceToken: logoServiceToken }), hasCustomer && (_jsx(Typography, { "data-testid": "customer-branding", sx: {
@@ -130,7 +131,10 @@ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, pathnam
130
131
  alignItems: "center",
131
132
  }, onClick: (event) => {
132
133
  setHelpMenuAnchorEl(event.currentTarget);
133
- }, children: ["Help", _jsx(ArrowDropDownIcon, { id: "nav-help-dropdown-arrow", sx: { color: primary || "var(--bs-white)", fontSize: 22 } })] }), _jsxs(Menu, { id: "help-menu", anchorEl: helpMenuAnchorEl, open: helpMenuOpen, onClose: handleCloseHelpMenu, children: [_jsx(MenuItem, { id: "user-guide", component: "a", href: "/userguide", target: "_blank", sx: { ...DISABLE_OUTLINE_PROPS }, children: "User guide" }, "user-guide"), _jsx(MenuItem, { href: null, id: "contact-us-help", onClick: () => setEmailDialogOpen(true), children: "Contact Us" }, "contact-us-help")] })] }), emailDialogOpen ? (_jsx(ConfirmationModal, { id: "email-dialog", content: getContactUsConfirmationText(supportEmailAddress), handleCancel: () => {
134
+ }, children: ["Help", _jsx(ArrowDropDownIcon, { id: "nav-help-dropdown-arrow", sx: { color: primary || "var(--bs-white)", fontSize: 22 } })] }), _jsxs(Menu, { id: "help-menu", anchorEl: helpMenuAnchorEl, open: helpMenuOpen, onClose: handleCloseHelpMenu, children: [_jsx(MenuItem, { id: "user-guide", component: "a", href: "/userguide", target: "_blank", sx: { ...DISABLE_OUTLINE_PROPS }, children: "User guide" }, "user-guide"), _jsx(MenuItem, { id: "take-a-tour", onClick: () => {
135
+ handleCloseHelpMenu();
136
+ onStartTour?.();
137
+ }, sx: { ...DISABLE_OUTLINE_PROPS }, children: "Take a tour" }, "take-a-tour"), _jsx(MenuItem, { href: null, id: "contact-us-help", onClick: () => setEmailDialogOpen(true), children: "Contact Us" }, "contact-us-help")] })] }), emailDialogOpen ? (_jsx(ConfirmationModal, { id: "email-dialog", content: getContactUsConfirmationText(supportEmailAddress), handleCancel: () => {
134
138
  setEmailDialogOpen(false);
135
139
  }, handleOk: () => {
136
140
  navigateToUrl(`mailto:${supportEmailAddress}`);
@@ -152,7 +156,7 @@ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, pathnam
152
156
  color: darkMode ? "var(--bs-yellow)" : "var(--bs-gray-dark)",
153
157
  }, onClick: () => {
154
158
  !hasCustomer && setMode(darkMode ? "light" : "dark");
155
- } }) }), showSettingsButton && (_jsx(Tooltip, { title: "Settings", children: _jsx(SettingsIcon, { sx: {
159
+ } }) }), showSettingsButton && (_jsx(Tooltip, { title: "Settings", children: _jsx(SettingsIcon, { id: "settings-icon", sx: {
156
160
  ...MENU_ITEM_TEXT_PROPS,
157
161
  marginRight: "1rem",
158
162
  fontSize: "1rem",
@@ -15,4 +15,4 @@ export declare const closeNotification: () => void;
15
15
  * @param description More complete description of the notification
16
16
  * @param placement Where to show notification. Defaults to top-right.
17
17
  */
18
- export declare const sendNotification: (variantType: NotificationType, message: string, description?: string | ReactJSX.Element, placement?: SnackbarOrigin) => void;
18
+ export declare const sendNotification: (variantType: NotificationType, message: string, description?: string | ReactJSX.Element, placement?: SnackbarOrigin, durationOverride?: number | null) => void;
@@ -43,27 +43,32 @@ export const sendNotification = (variantType, message, description = "",
43
43
  placement = {
44
44
  vertical: "top",
45
45
  horizontal: "right",
46
- }) => {
46
+ }, durationOverride) => {
47
47
  // Log a copy to the console for troubleshooting
48
48
  const descriptionAsString = typeof description === "string" ? description : renderToString(description);
49
49
  console.debug(`Notification: Message: "${message}" Description: "${descriptionAsString}"`);
50
50
  // Show error and warnings for longer
51
51
  let duration;
52
- switch (variantType) {
53
- case NotificationType.info:
54
- case NotificationType.success:
55
- duration = SUCCESS_NOTIFICATION_DURATION_MS;
56
- break;
57
- case NotificationType.warning:
58
- case NotificationType.error:
59
- default:
60
- duration = ERROR_WARNING_NOTIFICATION_DURATION_MS;
61
- break;
52
+ if (durationOverride !== undefined) {
53
+ duration = durationOverride;
54
+ }
55
+ else {
56
+ switch (variantType) {
57
+ case NotificationType.info:
58
+ case NotificationType.success:
59
+ duration = SUCCESS_NOTIFICATION_DURATION_MS;
60
+ break;
61
+ case NotificationType.warning:
62
+ case NotificationType.error:
63
+ default:
64
+ duration = ERROR_WARNING_NOTIFICATION_DURATION_MS;
65
+ break;
66
+ }
62
67
  }
63
68
  // Use some minor customization to be able to inject ids for testing
64
69
  const messageForId = message
65
70
  .replaceAll(" ", "-")
66
- .replace(/[^a-zA-Z0-9-]/gu, "")
71
+ .replaceAll(/[^a-zA-Z0-9-]/gu, "")
67
72
  .toLowerCase();
68
73
  const baseId = `notification-message-${messageForId}-${NotificationType[variantType]}`;
69
74
  const messageSpan = _jsx("span", { id: `${baseId}-span`, children: message });
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, FC, SetStateAction } from "react";
2
2
  import { AgentConversation } from "./AgentConversations.js";
3
+ import { AgentNetworkDefinitionEntry } from "./const.js";
3
4
  import { ThoughtBubbleEdgeShape } from "./ThoughtBubbleEdge.js";
4
5
  import { AgentIconSuggestions } from "../../controller/Types/AgentIconSuggestions.js";
5
6
  import { ConnectivityInfo } from "../../generated/neuro-san/NeuroSanClient.js";
@@ -12,6 +13,7 @@ export interface AgentFlowProps {
12
13
  readonly id: string;
13
14
  readonly isAwaitingLlm?: boolean;
14
15
  readonly isAgentNetworkDesignerMode?: boolean;
16
+ readonly isEditMode?: boolean;
15
17
  readonly isStreaming?: boolean;
16
18
  readonly isSelectedNetworkTemporary?: boolean;
17
19
  /** The history key for the currently selected network (used to scope sly_data reads/writes per network). */
@@ -22,7 +24,12 @@ export interface AgentFlowProps {
22
24
  * @param oldNetworkId The agent_name of the network that was replaced.
23
25
  * @param newNetworkId The agent_name of the replacement network to navigate to.
24
26
  */
27
+ readonly networkDisplayName?: string;
28
+ readonly onEnterEditMode?: () => void;
25
29
  readonly onNetworkReplaced?: (oldNetworkId: string, newNetworkId: string) => void;
30
+ /** Called when the user closes the edit-mode dock. */
31
+ readonly onExitEditMode?: () => void;
32
+ readonly onSaveAgent?: (agentName: string, updated: AgentNetworkDefinitionEntry[], agentNetworkName: string | undefined, signal: AbortSignal) => Promise<void>;
26
33
  readonly thoughtBubbleEdges: Map<string, {
27
34
  edge: ThoughtBubbleEdgeShape;
28
35
  timestamp: number;
@@ -32,4 +39,5 @@ export interface AgentFlowProps {
32
39
  timestamp: number;
33
40
  }>>>;
34
41
  }
42
+ export declare const DOCK_BANNER_AUTO_DISMISS_MS = 5000;
35
43
  export declare const AgentFlow: FC<AgentFlowProps>;