@cognizant-ai-lab/ui-common 1.3.3 → 1.4.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 (114) hide show
  1. package/README.md +287 -0
  2. package/dist/Theme/Palettes.d.ts +18 -0
  3. package/dist/Theme/Palettes.js +94 -0
  4. package/dist/Theme/Theme.d.ts +22 -0
  5. package/dist/Theme/Theme.js +58 -0
  6. package/dist/components/AgentChat/ChatCommon.d.ts +4 -2
  7. package/dist/components/AgentChat/ChatCommon.js +141 -105
  8. package/dist/components/AgentChat/ControlButtons.js +3 -1
  9. package/dist/components/AgentChat/FormattedMarkdown.d.ts +4 -4
  10. package/dist/components/AgentChat/FormattedMarkdown.js +5 -7
  11. package/dist/components/AgentChat/LlmChatButton.d.ts +2 -6
  12. package/dist/components/AgentChat/LlmChatButton.js +3 -3
  13. package/dist/components/AgentChat/UserQueryDisplay.js +2 -4
  14. package/dist/components/AgentChat/Utils.d.ts +2 -1
  15. package/dist/components/AgentChat/Utils.js +4 -1
  16. package/dist/components/AgentChat/VoiceChat/MicrophoneButton.d.ts +2 -2
  17. package/dist/components/AgentChat/VoiceChat/VoiceChat.d.ts +3 -3
  18. package/dist/components/AgentChat/VoiceChat/VoiceChat.js +5 -5
  19. package/dist/components/ChatBot/ChatBot.js +2 -2
  20. package/dist/components/Common/Breadcrumbs.js +1 -1
  21. package/dist/components/Common/{confirmationModal.js → ConfirmationModal.js} +2 -5
  22. package/dist/components/Common/CustomerLogo.d.ts +17 -0
  23. package/dist/components/Common/CustomerLogo.js +49 -0
  24. package/dist/components/Common/Footer.d.ts +18 -0
  25. package/dist/components/Common/Footer.js +59 -0
  26. package/dist/components/Common/LlmChatOptionsButton.d.ts +1 -4
  27. package/dist/components/Common/LlmChatOptionsButton.js +4 -4
  28. package/dist/components/Common/LoadingSpinner.js +1 -1
  29. package/dist/components/Common/MUIAccordion.d.ts +2 -2
  30. package/dist/components/Common/MUIAccordion.js +2 -12
  31. package/dist/components/Common/MUIAlert.d.ts +2 -1
  32. package/dist/components/Common/MUIAlert.js +4 -1
  33. package/dist/components/Common/MUIDialog.d.ts +1 -1
  34. package/dist/components/Common/MUIDialog.js +1 -1
  35. package/dist/components/Common/Navbar.d.ts +3 -1
  36. package/dist/components/Common/Navbar.js +60 -35
  37. package/dist/components/Common/PageLoader.js +3 -4
  38. package/dist/components/Common/Snackbar.d.ts +4 -1
  39. package/dist/components/Common/Snackbar.js +11 -19
  40. package/dist/components/Common/notification.d.ts +3 -3
  41. package/dist/components/Common/notification.js +6 -6
  42. package/dist/components/ErrorPage/ErrorBoundary.d.ts +2 -2
  43. package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
  44. package/dist/components/ErrorPage/ErrorPage.js +6 -5
  45. package/dist/components/MultiAgentAccelerator/AgentConversations.d.ts +17 -0
  46. package/dist/components/MultiAgentAccelerator/AgentConversations.js +77 -0
  47. package/dist/components/MultiAgentAccelerator/AgentCounts.d.ts +12 -0
  48. package/dist/components/MultiAgentAccelerator/AgentCounts.js +21 -0
  49. package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +6 -4
  50. package/dist/components/MultiAgentAccelerator/AgentFlow.js +106 -185
  51. package/dist/components/MultiAgentAccelerator/AgentNode.d.ts +7 -5
  52. package/dist/components/MultiAgentAccelerator/AgentNode.js +93 -50
  53. package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +20 -17
  54. package/dist/components/MultiAgentAccelerator/GraphLayouts.js +16 -14
  55. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -3
  56. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +214 -55
  57. package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +1 -1
  58. package/dist/components/MultiAgentAccelerator/PlasmaEdge.js +14 -12
  59. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +15 -0
  60. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +104 -0
  61. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +17 -0
  62. package/dist/components/MultiAgentAccelerator/{Sidebar.js → Sidebar/Sidebar.js} +146 -59
  63. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +19 -0
  64. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +113 -0
  65. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +26 -0
  66. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +20 -0
  67. package/dist/components/MultiAgentAccelerator/ThoughtBubbleEdge.d.ts +10 -8
  68. package/dist/components/MultiAgentAccelerator/ThoughtBubbleEdge.js +1 -1
  69. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.d.ts +3 -2
  70. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.js +10 -13
  71. package/dist/components/MultiAgentAccelerator/const.d.ts +1 -3
  72. package/dist/components/MultiAgentAccelerator/const.js +4 -18
  73. package/dist/components/Settings/FadingCheckmark.d.ts +14 -0
  74. package/dist/components/Settings/FadingCheckmark.js +43 -0
  75. package/dist/components/Settings/SettingsDialog.d.ts +9 -0
  76. package/dist/components/Settings/SettingsDialog.js +265 -0
  77. package/dist/const.d.ts +1 -2
  78. package/dist/const.js +2 -3
  79. package/dist/controller/Types/AgentIconSuggestions.d.ts +4 -0
  80. package/dist/controller/Types/AgentIconSuggestions.js +1 -0
  81. package/dist/controller/Types/Branding.d.ts +12 -0
  82. package/dist/controller/Types/Branding.js +1 -0
  83. package/dist/controller/Types/NetworkIconSuggestions.d.ts +4 -0
  84. package/dist/controller/Types/NetworkIconSuggestions.js +1 -0
  85. package/dist/controller/agent/Agent.d.ts +32 -12
  86. package/dist/controller/agent/Agent.js +71 -19
  87. package/dist/controller/llm/LlmChat.d.ts +1 -1
  88. package/dist/controller/llm/LlmChat.js +2 -2
  89. package/dist/index.d.ts +10 -5
  90. package/dist/index.js +10 -5
  91. package/dist/state/{environment.d.ts → Environment.d.ts} +2 -0
  92. package/dist/state/{environment.js → Environment.js} +2 -0
  93. package/dist/state/Settings.d.ts +62 -0
  94. package/dist/state/Settings.js +62 -0
  95. package/dist/state/TemporaryNetworks.d.ts +32 -0
  96. package/dist/state/TemporaryNetworks.js +26 -0
  97. package/dist/tsconfig.build.tsbuildinfo +1 -1
  98. package/dist/utils/Authentication.d.ts +2 -2
  99. package/dist/utils/Authentication.js +6 -6
  100. package/dist/utils/text.d.ts +2 -2
  101. package/dist/utils/text.js +3 -5
  102. package/dist/utils/title.d.ts +1 -1
  103. package/dist/utils/title.js +2 -2
  104. package/dist/utils/useLocalStorage.d.ts +1 -1
  105. package/dist/utils/useLocalStorage.js +3 -3
  106. package/dist/utils/zIndexLayers.d.ts +1 -1
  107. package/dist/utils/zIndexLayers.js +3 -15
  108. package/package.json +23 -21
  109. package/dist/components/MultiAgentAccelerator/Sidebar.d.ts +0 -12
  110. package/dist/utils/Theme.d.ts +0 -7
  111. package/dist/utils/Theme.js +0 -7
  112. package/dist/utils/agentConversations.d.ts +0 -24
  113. package/dist/utils/agentConversations.js +0 -113
  114. /package/dist/components/Common/{confirmationModal.d.ts → ConfirmationModal.d.ts} +0 -0
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import CheckIcon from "@mui/icons-material/Check";
3
+ import Box from "@mui/material/Box";
4
+ import { useEffect, useRef, useState } from "react";
5
+ // Duration for which the checkmark is shown after changing a setting
6
+ const CHECKMARK_FADE_DURATION_MS = 1500;
7
+ /**
8
+ * Hook to manage the fading checkmark state.
9
+ */
10
+ export const useCheckmarkFade = () => {
11
+ const [show, setShow] = useState(false);
12
+ const timeoutRef = useRef(null);
13
+ const trigger = () => {
14
+ // Clear any existing timeout
15
+ if (timeoutRef.current) {
16
+ clearTimeout(timeoutRef.current);
17
+ }
18
+ // Show the checkmark and set a timeout to hide it
19
+ setShow(true);
20
+ timeoutRef.current = setTimeout(() => {
21
+ setShow(false);
22
+ timeoutRef.current = null;
23
+ }, CHECKMARK_FADE_DURATION_MS);
24
+ };
25
+ // Cleanup on unmount
26
+ useEffect(() => {
27
+ return () => {
28
+ if (timeoutRef.current) {
29
+ clearTimeout(timeoutRef.current);
30
+ }
31
+ };
32
+ }, []);
33
+ return { show, trigger };
34
+ };
35
+ /**
36
+ * A checkmark that fades in and out based on the `show` prop.
37
+ * @param show Whether to show the checkmark.
38
+ */
39
+ export const FadingCheckmark = ({ show }) => (_jsx(Box, { sx: {
40
+ opacity: show ? 1 : 0,
41
+ transition: "opacity 0.5s ease-out",
42
+ color: "var(--bs-success)",
43
+ }, children: _jsx(CheckIcon, {}) }));
@@ -0,0 +1,9 @@
1
+ import { FC } from "react";
2
+ interface SettingsDialogProps {
3
+ readonly id: string;
4
+ readonly isOpen?: boolean;
5
+ readonly logoServiceToken?: string;
6
+ readonly onClose?: () => void;
7
+ }
8
+ export declare const SettingsDialog: FC<SettingsDialogProps>;
9
+ export {};
@@ -0,0 +1,265 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import RestoreIcon from "@mui/icons-material/SettingsBackupRestore";
3
+ import Box from "@mui/material/Box";
4
+ import Button from "@mui/material/Button";
5
+ import Checkbox from "@mui/material/Checkbox";
6
+ import CircularProgress from "@mui/material/CircularProgress";
7
+ import Divider from "@mui/material/Divider";
8
+ import FormLabel from "@mui/material/FormLabel";
9
+ import { createTheme, ThemeProvider, useTheme } from "@mui/material/styles";
10
+ import TextField from "@mui/material/TextField";
11
+ import ToggleButton from "@mui/material/ToggleButton";
12
+ import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
13
+ import Tooltip from "@mui/material/Tooltip";
14
+ import Typography from "@mui/material/Typography";
15
+ import { useEffect, useState } from "react";
16
+ import { FadingCheckmark, useCheckmarkFade } from "./FadingCheckmark.js";
17
+ import { getBrandingSuggestions } from "../../controller/agent/Agent.js";
18
+ import { useSettingsStore } from "../../state/Settings.js";
19
+ import { PALETTES } from "../../Theme/Palettes.js";
20
+ import { ConfirmationModal } from "../Common/ConfirmationModal.js";
21
+ import { CustomerLogo } from "../Common/CustomerLogo.js";
22
+ import { MUIDialog } from "../Common/MUIDialog.js";
23
+ import { NotificationType, sendNotification } from "../Common/notification.js";
24
+ export const SettingsDialog = ({ id, isOpen, logoServiceToken, onClose }) => {
25
+ // Settings store actions
26
+ const updateSettings = useSettingsStore((state) => state.updateSettings);
27
+ const resetSettings = useSettingsStore((state) => state.resetSettings);
28
+ // Reset settings confirmation dialog state
29
+ const [resetToDefaultSettingsOpen, setResetToDefaultSettingsOpen] = useState(false);
30
+ // Plasma color
31
+ const plasmaColor = useSettingsStore((state) => state.settings.appearance.plasmaColor);
32
+ const plasmaColorCheckmark = useCheckmarkFade();
33
+ // Agent node color
34
+ const agentNodeColor = useSettingsStore((state) => state.settings.appearance.agentNodeColor);
35
+ const agentNodeColorCheckmark = useCheckmarkFade();
36
+ // Agent icon color
37
+ const agentIconColor = useSettingsStore((state) => state.settings.appearance.agentIconColor);
38
+ const agentIconColorCheckmark = useCheckmarkFade();
39
+ const autoAgentIconColor = useSettingsStore((state) => state.settings.appearance.autoAgentIconColor);
40
+ // Which palette to use for heatmaps and depth display?
41
+ const paletteKey = useSettingsStore((state) => state.settings.appearance.rangePalette);
42
+ const rangePaletteCheckmark = useCheckmarkFade();
43
+ const brandingRangePalette = useSettingsStore((state) => state.settings.branding.rangePalette);
44
+ // Customer branding
45
+ const customer = useSettingsStore((state) => state.settings.branding.customer);
46
+ const brandingCheckmark = useCheckmarkFade();
47
+ const logoCheckmark = useCheckmarkFade();
48
+ const [customerInput, setCustomerInput] = useState(customer);
49
+ const [isBrandingApplying, setIsBrandingApplying] = useState(false);
50
+ const logoSource = useSettingsStore((state) => state.settings.branding.logoSource);
51
+ // Zen mode
52
+ const enableZenMode = useSettingsStore((state) => state.settings.behavior.enableZenMode);
53
+ const enableZenModeCheckmark = useCheckmarkFade();
54
+ // Record user's current theme so at least the settings dialog (with default MUI theme) matches that
55
+ const theme = useTheme();
56
+ const paletteMode = theme.palette.mode;
57
+ const handlePaletteChange = (_event, newPalette) => {
58
+ if (newPalette) {
59
+ updateSettings({
60
+ appearance: {
61
+ rangePalette: newPalette,
62
+ },
63
+ });
64
+ }
65
+ rangePaletteCheckmark.trigger();
66
+ };
67
+ /**
68
+ * Handle applying branding based on customer input. Calls backend to get colors then updates settings store.
69
+ */
70
+ const handleBrandingApply = async () => {
71
+ setIsBrandingApplying(true);
72
+ updateSettings({
73
+ branding: {
74
+ customer: customerInput,
75
+ },
76
+ });
77
+ let brandingSuggestions;
78
+ try {
79
+ brandingSuggestions = await getBrandingSuggestions(customerInput);
80
+ }
81
+ catch (e) {
82
+ console.warn(`Failed to fetch branding suggestions for customer "${customerInput}"`, e);
83
+ sendNotification(NotificationType.error, `Failed to fetch branding suggestions for "${customerInput}"`, "Please check the name and try again. If the problem persists, there may be an issue with the " +
84
+ "branding service.");
85
+ return;
86
+ }
87
+ updateSettings({
88
+ appearance: {
89
+ rangePalette: "brand",
90
+ },
91
+ });
92
+ if (brandingSuggestions["plasma"]) {
93
+ updateSettings({
94
+ appearance: {
95
+ plasmaColor: brandingSuggestions["plasma"],
96
+ },
97
+ });
98
+ plasmaColorCheckmark.trigger();
99
+ }
100
+ if (brandingSuggestions["nodeColor"]) {
101
+ updateSettings({
102
+ appearance: {
103
+ agentNodeColor: brandingSuggestions["nodeColor"],
104
+ },
105
+ });
106
+ agentNodeColorCheckmark.trigger();
107
+ }
108
+ // primary
109
+ if (brandingSuggestions["primary"]) {
110
+ updateSettings({
111
+ branding: {
112
+ primary: brandingSuggestions["primary"],
113
+ },
114
+ });
115
+ }
116
+ // secondary
117
+ if (brandingSuggestions["secondary"]) {
118
+ updateSettings({
119
+ branding: {
120
+ secondary: brandingSuggestions["secondary"],
121
+ },
122
+ });
123
+ }
124
+ // background
125
+ if (brandingSuggestions["background"]) {
126
+ updateSettings({
127
+ branding: {
128
+ background: brandingSuggestions["background"],
129
+ },
130
+ });
131
+ }
132
+ if (Array.isArray(brandingSuggestions["rangePalette"])) {
133
+ updateSettings({
134
+ branding: {
135
+ rangePalette: brandingSuggestions["rangePalette"],
136
+ },
137
+ });
138
+ }
139
+ if (brandingSuggestions["iconSuggestion"]) {
140
+ updateSettings({
141
+ branding: {
142
+ iconSuggestion: brandingSuggestions["iconSuggestion"],
143
+ },
144
+ });
145
+ }
146
+ brandingCheckmark.trigger();
147
+ setIsBrandingApplying(false);
148
+ };
149
+ // Effect to keep input in sync with state store
150
+ useEffect(() => {
151
+ setCustomerInput(customer ?? "");
152
+ }, [customer]);
153
+ const availablePalettes = customer && brandingRangePalette?.length > 0 ? { brand: brandingRangePalette } : PALETTES;
154
+ const paletteKeys = Object.keys(availablePalettes);
155
+ /* Dev note:
156
+ Before you go removing the "useless" spans in code below that wrap MUI elements: they are required because
157
+ MUI's disabled state on certain components sets pointer-events: none, which prevents tooltips from working.
158
+ Wrapping in a span allows the tooltip to still function while the inner component is disabled.
159
+ See: https://github.com/mui/material-ui/issues/8416
160
+ */
161
+ return (
162
+ // Always use default theme for settings dialog so user can always see to reset. It's possible that with
163
+ // certain custom themes the dialog would be unreadable.
164
+ _jsxs(ThemeProvider, { theme: createTheme({
165
+ palette: {
166
+ mode: paletteMode,
167
+ },
168
+ }), children: [resetToDefaultSettingsOpen ? (_jsx(ConfirmationModal, { id: `${id}-reset-to-default-settings-confirmation-modal`, content: "This will reset all settings to their default values and cannot be undone. " +
169
+ "Are you sure you want to proceed?", handleCancel: () => {
170
+ setResetToDefaultSettingsOpen(false);
171
+ }, handleOk: () => {
172
+ setResetToDefaultSettingsOpen(false);
173
+ resetSettings();
174
+ sendNotification(NotificationType.success, "Settings have been reset to default values.");
175
+ }, title: "Reset to default settings" })) : null, _jsxs(MUIDialog, { id: id, title: _jsx(Box, { sx: { fontSize: "1.5rem" }, children: "Settings" }), isOpen: isOpen, onClose: onClose, paperProps: {
176
+ minWidth: "50%",
177
+ minHeight: "50%",
178
+ border: "1px solid",
179
+ }, children: [_jsxs(Box, { sx: { marginBottom: 3 }, children: [_jsx(Typography, { variant: "h6", sx: { marginBottom: 1 }, children: "Behavior" }), _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [_jsx(FormLabel, { children: "Enable \"Zen\" mode:" }), _jsx(Tooltip, { title: "Hides most of the UI during agent network animations, providing a more immersive experience.", children: _jsx(Checkbox, { checked: enableZenMode, "data-testid": "zen-mode-checkbox", onChange: (_, checked) => {
180
+ updateSettings({ behavior: { enableZenMode: checked } });
181
+ enableZenModeCheckmark.trigger();
182
+ } }) }), _jsx(FadingCheckmark, { show: enableZenModeCheckmark.show })] })] }), _jsxs(Box, { sx: { marginBottom: 3 }, children: [_jsx(Typography, { variant: "h6", sx: { marginBottom: 1 }, children: "Appearance" }), _jsx(Typography, { variant: "subtitle1", sx: { marginBottom: 1, marginTop: 2, fontWeight: 600 }, children: "Branding" }), _jsx(Divider, { sx: { marginBottom: 2 } }), _jsx(Box, { sx: { display: "flex", alignItems: "center" }, children: _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, marginBottom: "1rem", width: "100%" }, children: [_jsx(FormLabel, { children: "Customer:" }), _jsx(TextField, { "aria-label": "branding-input", onChange: (e) => setCustomerInput(e.target.value), onKeyDown: (e) => {
183
+ if (e.key === "Enter" && customerInput?.trim().length > 0) {
184
+ void handleBrandingApply();
185
+ }
186
+ }, value: customerInput ?? "", placeholder: "Company or organization name", size: "small", sx: { width: "100%" }, variant: "outlined" }), _jsx(Button, { disabled: customerInput?.trim().length === 0 ||
187
+ isBrandingApplying ||
188
+ customerInput === customer, variant: "contained", size: "small", onClick: handleBrandingApply, startIcon: isBrandingApplying ? (_jsx(CircularProgress, { size: 16, color: "inherit" })) : undefined, sx: { minWidth: "8rem" }, children: isBrandingApplying ? "Applying..." : "Apply" }), _jsx(FadingCheckmark, { show: brandingCheckmark.show })] }) }), _jsx(Box, { sx: { display: "flex", alignItems: "center" }, children: _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, marginBottom: "1rem", width: "100%" }, children: [_jsx(FormLabel, { children: "Logo:" }), _jsx(Tooltip, { title: customer ? null : "Set a customer name to enable logo options", children: _jsx("span", { children: _jsxs(ToggleButtonGroup, { "aria-label": "logo-selection", disabled: !customer, exclusive: true, onChange: (_, value) => {
189
+ if (value !== null) {
190
+ updateSettings({
191
+ branding: {
192
+ logoSource: value,
193
+ },
194
+ });
195
+ logoCheckmark.trigger();
196
+ }
197
+ }, size: "small", sx: { marginRight: "1rem" }, value: logoSource || "none", children: [_jsx(Tooltip, { title: "No logo will be displayed",
198
+ // Avoids having overlapping tooltips
199
+ disableHoverListener: !customer, disableFocusListener: !customer, disableTouchListener: !customer, children: _jsx("span", { style: { cursor: customer ? "pointer" : "not-allowed" }, children: _jsx(ToggleButton, { value: "none", children: "None" }) }) }), _jsx(Tooltip, { title: "Display a simple, anonymous generic logo based on a generic brand",
200
+ // Avoids having overlapping tooltips
201
+ disableHoverListener: !customer, disableFocusListener: !customer, disableTouchListener: !customer, children: _jsx("span", { style: { cursor: customer ? "pointer" : "not-allowed" }, children: _jsx(ToggleButton, { value: "generic", children: "Generic" }) }) }), _jsx(Tooltip, { title: logoServiceToken
202
+ ? "Use a service to attempt to automatically find a suitable " +
203
+ "logo based on the customer name. Results may vary based " +
204
+ "on the uniqueness of the name and availability of logos online."
205
+ : "No Logo.dev token found, cannot use Auto logo source",
206
+ // Avoids having overlapping tooltips
207
+ disableHoverListener: !customer, disableFocusListener: !customer, disableTouchListener: !customer, children: _jsx("span", { style: {
208
+ cursor: customer && logoServiceToken ? "pointer" : "not-allowed",
209
+ }, children: _jsx(ToggleButton, { disabled: !logoServiceToken, value: "auto", children: "Auto" }) }) })] }) }) }), _jsx(FormLabel, { children: "Preview:" }), _jsx(CustomerLogo, { fallbackElement: "(None)", logoServiceToken: logoServiceToken }), _jsx(FadingCheckmark, { show: logoCheckmark.show })] }) }), _jsx(Typography, { variant: "subtitle1", sx: { marginBottom: 1, marginTop: 2, fontWeight: 600 }, children: "Network display" }), _jsx(Divider, { sx: { marginBottom: 2 } }), _jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [_jsx(FormLabel, { children: "Palette (heatmap and depth):" }), _jsx(Tooltip, { title: customer ? "Palette is locked when branding is applied" : "", children: _jsx("span", { children: _jsx(ToggleButtonGroup, { "aria-label": "depth-heatmap-palette-selection", disabled: Boolean(customer), exclusive: true, onChange: handlePaletteChange, size: "small", sx: {
210
+ cursor: customer ? "not-allowed" : "pointer",
211
+ marginLeft: "1rem",
212
+ marginRight: "1rem",
213
+ opacity: customer ? 0.5 : 1,
214
+ }, value: paletteKey, children: paletteKeys.map((key) => {
215
+ const palette = availablePalettes[key];
216
+ if (!palette || !Array.isArray(palette))
217
+ return null;
218
+ const paletteArray = palette;
219
+ return (_jsx(ToggleButton, { "aria-label": `${key}-palette-button`, value: key, children: _jsxs(Box, { sx: {
220
+ display: "flex",
221
+ flexDirection: "column",
222
+ gap: 0.5,
223
+ alignItems: "center",
224
+ }, children: [_jsx(Typography, { variant: "caption", sx: { textTransform: "capitalize" }, children: key }), _jsx(Box, { sx: { display: "flex", gap: 0.5 }, children: Array.from({ length: 5 }, (_, i) => {
225
+ const paletteLength = paletteArray.length;
226
+ const index = Math.floor((i * paletteLength) / 5);
227
+ return paletteArray[index];
228
+ }).map((color) => (_jsx(Box, { sx: {
229
+ width: "0.75rem",
230
+ height: "0.75rem",
231
+ backgroundColor: color,
232
+ border: "1px solid",
233
+ } }, color))) })] }) }, key));
234
+ }) }) }) }), _jsx(FadingCheckmark, { show: rangePaletteCheckmark.show })] }), _jsx(Typography, { variant: "subtitle1", sx: { marginBottom: 1, marginTop: 2, fontWeight: 600 }, children: "Network animation" }), _jsx(Divider, { sx: { marginBottom: 2 } }), _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [_jsx(FormLabel, { children: "Plasma animation color:" }), _jsx(Tooltip, { title: customer ? "Plasma color is locked when branding is applied" : "", children: _jsx("input", { "aria-label": "plasma-color-picker", disabled: Boolean(customer), onChange: (e) => updateSettings({
235
+ appearance: {
236
+ plasmaColor: e.target.value,
237
+ },
238
+ }), style: { cursor: customer ? "not-allowed" : "pointer", opacity: customer ? 0.5 : 1 }, type: "color", value: plasmaColor }) }), _jsx(FadingCheckmark, { show: plasmaColorCheckmark.show })] }), _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, marginTop: "1rem" }, children: [_jsx(FormLabel, { children: "Agent node color:" }), _jsx(Tooltip, { title: customer ? "Agent node color is locked when branding is applied" : "", children: _jsx("input", { "aria-label": "agent-node-color-picker", disabled: Boolean(customer), onChange: (e) => updateSettings({
239
+ appearance: {
240
+ agentNodeColor: e.target.value,
241
+ },
242
+ }), style: { cursor: customer ? "not-allowed" : "pointer", opacity: customer ? 0.5 : 1 }, type: "color", value: agentNodeColor }) }), _jsx(FadingCheckmark, { show: agentNodeColorCheckmark.show })] }), _jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 2, marginTop: "1rem" }, children: [_jsx(FormLabel, { children: "Agent icon color:" }), _jsx(Tooltip, { title: customer ? "Agent icon color is locked when branding is applied" : "", children: _jsx("span", { children: _jsxs(ToggleButtonGroup, { disabled: Boolean(customer), exclusive: true, value: autoAgentIconColor ? "auto" : "custom", onChange: (_, value) => {
243
+ if (value !== null) {
244
+ updateSettings({
245
+ appearance: {
246
+ autoAgentIconColor: value === "auto",
247
+ },
248
+ });
249
+ agentIconColorCheckmark.trigger();
250
+ }
251
+ }, size: "small", style: { cursor: customer ? "not-allowed" : "pointer", opacity: customer ? 0.5 : 1 }, children: [_jsx(ToggleButton, { "data-testid": "auto-agent-icon-color-button", value: "auto", children: "Auto" }), _jsx(ToggleButton, { value: "custom", children: "Custom" })] }) }) }), _jsx(Tooltip, { title: customer
252
+ ? "Agent icon color is locked when branding is applied"
253
+ : autoAgentIconColor
254
+ ? "Disabled when Auto is selected"
255
+ : "", children: _jsx("input", { "aria-label": "agent-icon-color-picker", disabled: Boolean(customer) || autoAgentIconColor, onChange: (e) => {
256
+ updateSettings({
257
+ appearance: {
258
+ agentIconColor: e.target.value,
259
+ },
260
+ });
261
+ agentIconColorCheckmark.trigger();
262
+ }, style: { cursor: customer ? "not-allowed" : "pointer", opacity: customer ? 0.5 : 1 }, type: "color", value: agentIconColor }) }), _jsx(FadingCheckmark, { show: agentIconColorCheckmark.show })] })] }), _jsx(Box, { sx: { marginTop: 4, paddingTop: 2, borderTop: "1px solid var(--bs-border-color)" }, children: _jsx(Button, { variant: "text", startIcon: _jsx(RestoreIcon, {}), onClick: () => {
263
+ setResetToDefaultSettingsOpen(true);
264
+ }, sx: { color: "var(--bs-secondary)" }, children: "Reset to defaults" }) })] })] }));
265
+ };
package/dist/const.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export declare const LOGO: string;
2
2
  export declare const NEURO_SAN_UI_VERSION: string;
3
- export declare const CONTACT_US_CONFIRMATION_DIALOG_TITLE = "Contact Us";
4
- export declare const CONTACT_US_CONFIRMATION_DIALOG_TEXT: string;
3
+ export declare const getContactUsConfirmationText: (email: string) => string;
5
4
  /**
6
5
  * The default user image to use when the user does not have a profile picture.
7
6
  */
package/dist/const.js CHANGED
@@ -16,11 +16,10 @@ limitations under the License.
16
16
  // Name to use for application
17
17
  export const LOGO = "Neuro® AI";
18
18
  export const NEURO_SAN_UI_VERSION = process.env["NEXT_PUBLIC_NEURO_SAN_UI_VERSION"] ?? "Unknown Version";
19
- export const CONTACT_US_CONFIRMATION_DIALOG_TITLE = "Contact Us";
20
- export const CONTACT_US_CONFIRMATION_DIALOG_TEXT = "Would you like to send the Cognizant Neuro AI support team an email? " +
19
+ export const getContactUsConfirmationText = (email) => "Would you like to send the Cognizant Neuro AI support team an email? " +
21
20
  "You will need to have an email client installed on your device in order " +
22
21
  "to continue. If you don't have an email client, you can still contact us at " +
23
- "NeuroAiSupport@cognizant.com using a web based email client.";
22
+ `${email} using a web based email client.`;
24
23
  /**
25
24
  * The default user image to use when the user does not have a profile picture.
26
25
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Items returned by the agent icon suggestions API
3
+ */
4
+ export type AgentIconSuggestions = Record<string, string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Items returned by the branding API.
3
+ */
4
+ export type BrandingSuggestions = {
5
+ readonly primary: string;
6
+ readonly secondary: string;
7
+ readonly background: string;
8
+ readonly plasma: string;
9
+ readonly nodeColor: string;
10
+ readonly rangePalette: string[];
11
+ readonly iconSuggestion: string;
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Items returned by the network icon suggestions API
3
+ */
4
+ export type NetworkIconSuggestions = Record<string, string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
- /**
2
- * Controller module for interacting with the Agent LLM API.
3
- */
4
- import { ChatContext, ChatResponse, ConnectivityResponse, FunctionResponse } from "../../generated/neuro-san/NeuroSanClient.js";
1
+ import { AgentInfo, ChatContext, ChatResponse, ConnectivityResponse, FunctionResponse } from "../../generated/neuro-san/NeuroSanClient.js";
2
+ import { AgentIconSuggestions } from "../Types/AgentIconSuggestions.js";
3
+ import { BrandingSuggestions } from "../Types/Branding.js";
4
+ import { NetworkIconSuggestions } from "../Types/NetworkIconSuggestions.js";
5
5
  export interface TestConnectionResult {
6
6
  readonly success: boolean;
7
7
  readonly status?: string;
@@ -12,15 +12,35 @@ export interface TestConnectionResult {
12
12
  * @param url The neuro-san server URL.
13
13
  * @returns A boolean indicating whether the connection was successful.
14
14
  */
15
- export declare function testConnection(url: string): Promise<TestConnectionResult>;
15
+ export declare const testConnection: (url: string) => Promise<TestConnectionResult>;
16
+ /**
17
+ * Get LLM suggestions for network icons.
18
+ * @param networks The list of networks to get icon suggestions for.
19
+ * @returns A promise that resolves to a record mapping network names to icon names.
20
+ */
21
+ export declare const getNetworkIconSuggestions: (networks: readonly AgentInfo[]) => Promise<NetworkIconSuggestions>;
22
+ /**
23
+ * Get LLM suggestions for agent icons based on their descriptions from Neuro-san
24
+ * @param connectivity The connectivity information for the agents in the network, including their descriptions,
25
+ * tools, and connections.
26
+ * @return A promise that resolves to a record mapping agent names to suggested icon names.
27
+ */
28
+ export declare const getAgentIconSuggestions: (connectivity: ConnectivityResponse) => Promise<AgentIconSuggestions>;
29
+ /**
30
+ * Get LLM suggestions for branding colors based on the company name. This is used to customize the UI colors
31
+ * to match the user's company branding.
32
+ * @param company The name of the company to get branding color suggestions for.
33
+ * @returns A promise that resolves to a record mapping color types (e.g. "primary", "secondary") to hex color codes.
34
+ */
35
+ export declare const getBrandingSuggestions: (company: string) => Promise<BrandingSuggestions>;
16
36
  /**
17
37
  * Get the list of available agent networks from the concierge service.
18
38
  * @param url The neuro-san server URL
19
- * @returns A promise that resolves to an array of agent network names.
39
+ * @returns A promise that resolves to an array of AgentInfo objects.
20
40
  */
21
- export declare function getAgentNetworks(url: string): Promise<string[]>;
41
+ export declare const getAgentNetworks: (url: string) => Promise<readonly AgentInfo[]>;
22
42
  /**
23
- * Send a chat query to the Agent LLM API. This opens a session with the agent network..
43
+ * Send a chat query to the Agent LLM API. This opens a session with the agent network.
24
44
  * @param url The neuro-san server URL
25
45
  * @param signal The AbortSignal to use for the request. Used to cancel the request on user demand
26
46
  * @param userInput The user input to send to the agent.
@@ -30,11 +50,11 @@ export declare function getAgentNetworks(url: string): Promise<string[]>;
30
50
  * @param callback The callback function to be called when a chunk of data is received from the server.
31
51
  * @param chatContext "Opaque" conversation context for maintaining conversation state with the server. Neuro-san
32
52
  * agents do not use ChatHistory directly, but rather, ChatContext, which is a collection of ChatHistory objects.
33
- * @param slyData Data items that should not be send to the LLM. Generated by the server.
53
+ * @param slyData Data items that should not be sent to the LLM. Generated by the server.
34
54
  * @param userId Current user ID in the session.
35
55
  * @returns The response from the agent network.
36
56
  */
37
- export declare function sendChatQuery(url: string, signal: AbortSignal, userInput: string, targetAgent: string, callback: (chunk: string) => void, chatContext: ChatContext, slyData: Record<string, unknown>, userId: string): Promise<ChatResponse>;
57
+ export declare const sendChatQuery: (url: string, signal: AbortSignal, userInput: string, targetAgent: string, callback: (chunk: string) => void, chatContext: ChatContext, slyData: Record<string, unknown>, userId: string) => Promise<ChatResponse>;
38
58
  /**
39
59
  * Gets information on the agent and tool connections within a network
40
60
  * @param url The neuro-san server URL
@@ -44,7 +64,7 @@ export declare function sendChatQuery(url: string, signal: AbortSignal, userInpu
44
64
  * @throws Various exceptions if anything goes wrong such as network issues or invalid agent type.
45
65
  * Caller is responsible for try-catch.
46
66
  */
47
- export declare function getConnectivity(url: string, network: string, userId: string): Promise<ConnectivityResponse>;
67
+ export declare const getConnectivity: (url: string, network: string, userId: string) => Promise<ConnectivityResponse>;
48
68
  /**
49
69
  * Get the function of a specified agent meaning its brief description
50
70
  * @param url The neuro-san server URL
@@ -53,4 +73,4 @@ export declare function getConnectivity(url: string, network: string, userId: st
53
73
  * @returns The function info as a <code>FunctionResponse</code> object
54
74
  * @throws Various exceptions if anything goes wrong such as network issues or invalid agent type.
55
75
  */
56
- export declare function getAgentFunction(url: string, agent: string, userId: string): Promise<FunctionResponse>;
76
+ export declare const getAgentFunction: (url: string, agent: string, userId: string) => Promise<FunctionResponse>;