@cognizant-ai-lab/ui-common 1.4.2 → 1.5.0-main.0690eb2.95

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 (127) hide show
  1. package/dist/Theme/Palettes.d.ts +0 -9
  2. package/dist/Theme/Palettes.js +0 -18
  3. package/dist/Theme/Theme.js +3 -3
  4. package/dist/components/AgentChat/{ChatCommon.d.ts → ChatCommon/ChatCommon.d.ts} +28 -10
  5. package/dist/components/AgentChat/ChatCommon/ChatCommon.js +656 -0
  6. package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +11 -0
  7. package/dist/components/AgentChat/ChatCommon/ChatHistory.js +38 -0
  8. package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
  9. package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
  10. package/dist/components/AgentChat/{ControlButtons.d.ts → ChatCommon/ControlButtons.d.ts} +2 -2
  11. package/dist/components/AgentChat/ChatCommon/ControlButtons.js +29 -0
  12. package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +13 -0
  13. package/dist/components/AgentChat/ChatCommon/Conversation.js +80 -0
  14. package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +23 -0
  15. package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +11 -0
  16. package/dist/components/AgentChat/{FormattedMarkdown.js → ChatCommon/FormattedMarkdown.js} +9 -4
  17. package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +19 -0
  18. package/dist/components/AgentChat/ChatCommon/SampleQueries.js +32 -0
  19. package/dist/components/AgentChat/{SendButton.js → ChatCommon/SendButton.js} +8 -7
  20. package/dist/components/AgentChat/{SyntaxHighlighterThemes.js → ChatCommon/SyntaxHighlighterThemes.js} +1 -1
  21. package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +13 -0
  22. package/dist/components/AgentChat/ChatCommon/Thinking.js +54 -0
  23. package/dist/components/AgentChat/Common/LlmChatButton.d.ts +6 -0
  24. package/dist/components/AgentChat/{LlmChatButton.js → Common/LlmChatButton.js} +6 -9
  25. package/dist/components/AgentChat/{Types.d.ts → Common/Types.d.ts} +6 -5
  26. package/dist/components/AgentChat/{Types.js → Common/Types.js} +5 -0
  27. package/dist/components/AgentChat/{Utils.d.ts → Common/Utils.d.ts} +2 -2
  28. package/dist/components/AgentChat/{Utils.js → Common/Utils.js} +16 -10
  29. package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +13 -11
  30. package/dist/components/ChatBot/ChatBot.d.ts +0 -4
  31. package/dist/components/ChatBot/ChatBot.js +4 -4
  32. package/dist/components/Common/AccordionLite.d.ts +14 -0
  33. package/dist/components/Common/AccordionLite.js +25 -0
  34. package/dist/components/Common/ConfirmationModal.d.ts +1 -0
  35. package/dist/components/Common/ConfirmationModal.js +1 -1
  36. package/dist/components/Common/MUIAlert.d.ts +1 -0
  37. package/dist/components/Common/MUIAlert.js +3 -4
  38. package/dist/components/Common/MUIDialog.d.ts +1 -0
  39. package/dist/components/Common/MUIDialog.js +2 -2
  40. package/dist/components/Common/Navbar.d.ts +2 -1
  41. package/dist/components/Common/Navbar.js +29 -24
  42. package/dist/components/Common/notification.d.ts +1 -1
  43. package/dist/components/Common/notification.js +17 -12
  44. package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
  45. package/dist/components/ErrorPage/ErrorPage.d.ts +3 -3
  46. package/dist/components/ErrorPage/ErrorPage.js +4 -3
  47. package/dist/components/Logo/Common.d.ts +4 -0
  48. package/dist/components/Logo/Common.js +8 -0
  49. package/dist/components/Logo/CustomerLogo.d.ts +20 -0
  50. package/dist/components/Logo/CustomerLogo.js +42 -0
  51. package/dist/components/MultiAgentAccelerator/AgentCounts.d.ts +2 -2
  52. package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +21 -1
  53. package/dist/components/MultiAgentAccelerator/AgentFlow.js +464 -59
  54. package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.d.ts +10 -0
  55. package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.js +20 -0
  56. package/dist/components/MultiAgentAccelerator/AgentNode.d.ts +3 -0
  57. package/dist/components/MultiAgentAccelerator/AgentNode.js +67 -26
  58. package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +30 -0
  59. package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +80 -0
  60. package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +17 -10
  61. package/dist/components/MultiAgentAccelerator/GraphLayouts.js +31 -19
  62. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +3 -8
  63. package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +417 -90
  64. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +1 -0
  65. package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +36 -18
  66. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +2 -0
  67. package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +54 -29
  68. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +6 -4
  69. package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +19 -14
  70. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +31 -0
  71. package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +61 -1
  72. package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.js +34 -20
  73. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.d.ts +7 -0
  74. package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +88 -0
  75. package/dist/components/MultiAgentAccelerator/const.d.ts +23 -0
  76. package/dist/components/MultiAgentAccelerator/const.js +22 -0
  77. package/dist/components/Settings/ApiKeyInput.d.ts +16 -0
  78. package/dist/components/Settings/ApiKeyInput.js +70 -0
  79. package/dist/components/Settings/SettingsDialog.js +245 -121
  80. package/dist/const.d.ts +5 -1
  81. package/dist/const.js +5 -2
  82. package/dist/controller/agent/Agent.d.ts +7 -15
  83. package/dist/controller/agent/Agent.js +18 -40
  84. package/dist/controller/agent/IconSuggestions.d.ts +35 -0
  85. package/dist/controller/agent/IconSuggestions.js +85 -0
  86. package/dist/controller/llm/LlmChat.js +3 -3
  87. package/dist/controller/llm/Providers.d.ts +2 -0
  88. package/dist/controller/llm/Providers.js +41 -0
  89. package/dist/index.d.ts +8 -9
  90. package/dist/index.js +8 -9
  91. package/dist/state/ChatHistory.d.ts +50 -0
  92. package/dist/state/ChatHistory.js +98 -0
  93. package/dist/state/IconSuggestions.d.ts +27 -0
  94. package/dist/state/IconSuggestions.js +50 -0
  95. package/dist/state/IndexedDBStorage.d.ts +14 -0
  96. package/dist/state/IndexedDBStorage.js +65 -0
  97. package/dist/state/Settings.d.ts +16 -3
  98. package/dist/state/Settings.js +21 -1
  99. package/dist/state/TemporaryNetworks.d.ts +13 -0
  100. package/dist/state/TemporaryNetworks.js +24 -0
  101. package/dist/state/Tour.d.ts +29 -0
  102. package/dist/state/Tour.js +22 -0
  103. package/dist/state/UserInfo.d.ts +2 -1
  104. package/dist/tsconfig.build.tsbuildinfo +1 -1
  105. package/dist/utils/Authentication.js +12 -3
  106. package/dist/utils/File.d.ts +7 -0
  107. package/dist/utils/File.js +14 -3
  108. package/dist/utils/text.js +2 -2
  109. package/dist/utils/title.js +2 -2
  110. package/dist/utils/zIndexLayers.js +3 -0
  111. package/package.json +25 -11
  112. package/dist/components/AgentChat/ChatCommon.js +0 -617
  113. package/dist/components/AgentChat/ControlButtons.js +0 -26
  114. package/dist/components/AgentChat/Greetings.d.ts +0 -1
  115. package/dist/components/AgentChat/Greetings.js +0 -38
  116. package/dist/components/AgentChat/LlmChatButton.d.ts +0 -8
  117. package/dist/components/AgentChat/UserQueryDisplay.d.ts +0 -5
  118. package/dist/components/AgentChat/UserQueryDisplay.js +0 -31
  119. package/dist/components/Common/CustomerLogo.d.ts +0 -17
  120. package/dist/components/Common/CustomerLogo.js +0 -49
  121. package/dist/components/Common/LlmChatOptionsButton.d.ts +0 -6
  122. package/dist/components/Common/LlmChatOptionsButton.js +0 -31
  123. package/dist/components/Common/MUIAccordion.d.ts +0 -17
  124. package/dist/components/Common/MUIAccordion.js +0 -66
  125. /package/dist/components/AgentChat/{FormattedMarkdown.d.ts → ChatCommon/FormattedMarkdown.d.ts} +0 -0
  126. /package/dist/components/AgentChat/{SendButton.d.ts → ChatCommon/SendButton.d.ts} +0 -0
  127. /package/dist/components/AgentChat/{SyntaxHighlighterThemes.d.ts → ChatCommon/SyntaxHighlighterThemes.d.ts} +0 -0
@@ -7,12 +7,3 @@ export declare const PALETTES: {
7
7
  coldToHot: string[];
8
8
  visionImpaired: string[];
9
9
  };
10
- export type PaletteKey = keyof typeof PALETTES | "brand";
11
- /**
12
- * Custom hook to get the current color palette based on user settings.
13
- * If the user has selected custom branding, it will return the palette for that.
14
- * Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
15
- *
16
- * @returns An array of color hex codes representing the current color palette.
17
- */
18
- export declare const usePalette: () => string[];
@@ -1,5 +1,4 @@
1
1
  // Palettes for progressive coloring of nodes based on depth or heatmap value
2
- import { useSettingsStore } from "../state/Settings.js";
3
2
  export const PALETTES = {
4
3
  blue: [
5
4
  "#f7fbff",
@@ -75,20 +74,3 @@ export const PALETTES = {
75
74
  "#b6dbff",
76
75
  ],
77
76
  };
78
- /**
79
- * Custom hook to get the current color palette based on user settings.
80
- * If the user has selected custom branding, it will return the palette for that.
81
- * Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
82
- *
83
- * @returns An array of color hex codes representing the current color palette.
84
- */
85
- export const usePalette = () => {
86
- const brandPalette = useSettingsStore((state) => state.settings.branding.rangePalette);
87
- const paletteKey = useSettingsStore((state) => state.settings.appearance.rangePalette);
88
- if (paletteKey === "brand" && brandPalette) {
89
- return brandPalette;
90
- }
91
- else {
92
- return PALETTES[paletteKey];
93
- }
94
- };
@@ -48,9 +48,9 @@ export const isLightColor = (color) => {
48
48
  // Remove # if present
49
49
  const colorWithoutHash = hexColor.replace("#", "");
50
50
  // Convert to RGB
51
- const r = parseInt(colorWithoutHash.substring(0, 2), 16);
52
- const g = parseInt(colorWithoutHash.substring(2, 4), 16);
53
- const b = parseInt(colorWithoutHash.substring(4, 6), 16);
51
+ const r = parseInt(colorWithoutHash.slice(0, 2), 16);
52
+ const g = parseInt(colorWithoutHash.slice(2, 4), 16);
53
+ const b = parseInt(colorWithoutHash.slice(4, 6), 16);
54
54
  // Calculate relative luminance (perceived brightness)
55
55
  const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
56
56
  // Return true if light (threshold 0.5)
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, Ref, SetStateAction } from "react";
2
- import { CombinedAgentType } from "./Types.js";
2
+ import { LLMProvider } from "../../../state/Settings.js";
3
+ import { CombinedAgentType } from "../Common/Types.js";
3
4
  export interface ChatCommonProps {
4
5
  /**
5
6
  * HTML id to use for the outer component
@@ -9,10 +10,6 @@ export interface ChatCommonProps {
9
10
  * The current username of the logged-in user. Used for fetching things from APIs mainly
10
11
  */
11
12
  readonly currentUser: string;
12
- /**
13
- * Path to image for user avatar
14
- */
15
- readonly userImage: string;
16
13
  /**
17
14
  * Function to set the state of the component to indicate whether we are awaiting a response from the LLM
18
15
  */
@@ -22,9 +19,13 @@ export interface ChatCommonProps {
22
19
  */
23
20
  readonly isAwaitingLlm: boolean;
24
21
  /**
25
- * The agent to send the request to.
22
+ * The network to send the request to.
23
+ */
24
+ readonly selectedNetwork: string | null;
25
+ /**
26
+ * Setter for changing the selected network.
26
27
  */
27
- readonly targetAgent: string;
28
+ readonly setSelectedNetwork?: (network: string | null) => void;
28
29
  /**
29
30
  * Special endpoint for legacy agents since they do not have a single unified endpoint like Neuro-san agents.
30
31
  */
@@ -57,10 +58,9 @@ export interface ChatCommonProps {
57
58
  */
58
59
  readonly agentPlaceholders?: Partial<Record<CombinedAgentType, string>>;
59
60
  /**
60
- * Whether to clear the chat window and history when the user starts chatting with a new agent or network.
61
- * Defaults to not clearing the chat.
61
+ * Optional greetings for specific agents to display
62
62
  */
63
- readonly clearChatOnNewAgent?: boolean;
63
+ readonly customAgentGreetings?: Partial<Record<CombinedAgentType, string>>;
64
64
  /**
65
65
  * Extra parameters to send to the server to be forwarded to the agent or used by the server.
66
66
  * @note This is only used for legacy agents to aid in UI consolidation, only Neuro-san agents.
@@ -82,9 +82,27 @@ export interface ChatCommonProps {
82
82
  * The neuro-san server URL
83
83
  */
84
84
  readonly neuroSanURL?: string;
85
+ /**
86
+ * Extra sly_data entries to merge into each outgoing request. Used by parent components (e.g. temp networks)
87
+ * to re-supply data that lives outside the IndexedDB slyData store (e.g. localStorage).
88
+ */
89
+ readonly extraSlyData?: Record<string, unknown>;
90
+ /**
91
+ * Optional description of the network to display in the UI.
92
+ */
93
+ readonly networkDescription?: string;
94
+ /**
95
+ * Sample queries for the current network that the user can "click to send"
96
+ */
97
+ readonly sampleQueries?: string[];
98
+ /**
99
+ * Array of LLM providers for which API keys are required but missing. Only applies to BYOK networks.
100
+ */
101
+ readonly missingApiKeys?: LLMProvider[];
85
102
  }
86
103
  export type ChatCommonHandle = {
87
104
  handleStop: () => void;
105
+ handleClearChat: () => void;
88
106
  };
89
107
  /**
90
108
  * Common chat component for agent chat. This component is used by all agent chat components to provide a consistent