@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
@@ -15,55 +15,36 @@ limitations under the License.
15
15
  */
16
16
  import { create } from "zustand";
17
17
  import { persist } from "zustand/middleware";
18
- // UUID v4 suffix pattern: 8-4-4-4-12 hex chars separated by dashes
19
- const UUID_SUFFIX_RE = /-[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
20
- /**
21
- * Derives the canonical network name from a reservation ID.
22
- *
23
- * The backend encodes the network name as a prefix in the reservation ID, followed by a UUID suffix:
24
- * `{network_name}-{uuid}`, e.g. `travel_agency_ops-7876642e-fe75-4d44-a61e-300688a1a6c5`.
25
- *
26
- * Stripping the UUID suffix gives the stable name that can be used for deduplication across reservations.
27
- * Returns `undefined` when the reservation ID doesn't match the expected format.
28
- */
29
- export const extractNetworkNameFromReservationId = (reservationId) => {
30
- const stripped = reservationId.replace(UUID_SUFFIX_RE, "");
31
- return stripped !== reservationId ? stripped : undefined;
32
- };
33
- /**
34
- * Returns the best available canonical name for a network, used as the dedup key in upsert.
35
- * The UUID-stripped reservation_id is preferred because it is always consistent regardless of
36
- * what prefix the backend may place in `agentNetworkName` (e.g. `"generated/travel_agency_ops"`
37
- * vs `"travel_agency_ops"`). Falls back to `agentNetworkName` when the reservation_id has no
38
- * UUID suffix (legacy reservations with static IDs).
39
- */
40
- const effectiveNetworkName = (n) => extractNetworkNameFromReservationId(n.reservation.reservation_id) ?? n.agentNetworkName;
41
18
  /**
42
19
  * The hook that lets apps use the store.
43
20
  */
44
21
  export const useTempNetworksStore = create()(persist((set) => ({
45
22
  tempNetworks: [],
46
23
  setTempNetworks: (tempNetworks) => set({ tempNetworks }),
47
- upsertTempNetworks: (newNetworks) => {
24
+ upsertTempNetworks: (incomingNetworks) => {
48
25
  set((state) => {
49
26
  const updated = [...state.tempNetworks];
50
- for (const newNetwork of newNetworks) {
51
- const newName = effectiveNetworkName(newNetwork);
52
- const existingIdx = newName ? updated.findIndex((n) => effectiveNetworkName(n) === newName) : -1;
53
- if (existingIdx >= 0) {
54
- updated[existingIdx] = newNetwork;
27
+ for (const incomingNetwork of incomingNetworks) {
28
+ const existingIndex = updated.findIndex((network) => network.agentNetworkName === incomingNetwork.agentNetworkName);
29
+ if (existingIndex >= 0) {
30
+ updated[existingIndex] = incomingNetwork; // replace the existing entry in-place
55
31
  }
56
32
  else {
57
- updated.push(newNetwork);
33
+ updated.push(incomingNetwork); // no existing entry — add as new
58
34
  }
59
35
  }
60
36
  return { tempNetworks: updated };
61
37
  });
62
- return newNetworks;
38
+ return incomingNetworks;
63
39
  },
64
- updateTempNetworkDefinition: (networkName, definition) => set((state) => ({
65
- tempNetworks: state.tempNetworks.map((n) => n.agentInfo.agent_name === networkName ? { ...n, agentNetworkDefinition: definition } : n),
66
- })),
40
+ updateTempNetworkDefinition: (networkName, agentNetworkDefinition) => set((state) => {
41
+ const updated = [...state.tempNetworks];
42
+ const existingIndex = updated.findIndex((network) => network.agentInfo.agent_name === networkName);
43
+ if (existingIndex >= 0) {
44
+ updated[existingIndex] = { ...updated[existingIndex], agentNetworkDefinition };
45
+ }
46
+ return { tempNetworks: updated };
47
+ }),
67
48
  }), {
68
49
  name: "temp-networks",
69
50
  }));
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Possible states for whether the user has been shown / taken the tour.
3
+ */
4
+ export declare enum TourPromptState {
5
+ NotPrompted = "NotPrompted",
6
+ Taken = "Taken",
7
+ DontShowAgain = "DontShowAgain"
8
+ }
9
+ interface TourStore {
10
+ readonly status: TourPromptState;
11
+ readonly setStatus: (s: TourPromptState) => void;
12
+ readonly reset: () => void;
13
+ }
14
+ /**
15
+ * Persisted zustand store for the tour prompt state.
16
+ * Persists to localStorage under the key "tour".
17
+ */
18
+ export declare const useTourStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TourStore>, "persist"> & {
19
+ persist: {
20
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TourStore, TourStore>>) => void;
21
+ clearStorage: () => void;
22
+ rehydrate: () => Promise<void> | void;
23
+ hasHydrated: () => boolean;
24
+ onHydrate: (fn: (state: TourStore) => void) => () => void;
25
+ onFinishHydration: (fn: (state: TourStore) => void) => () => void;
26
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<TourStore, TourStore>>;
27
+ };
28
+ }>;
29
+ export {};
@@ -0,0 +1,22 @@
1
+ import { create } from "zustand";
2
+ import { persist } from "zustand/middleware";
3
+ /**
4
+ * Possible states for whether the user has been shown / taken the tour.
5
+ */
6
+ export var TourPromptState;
7
+ (function (TourPromptState) {
8
+ TourPromptState["NotPrompted"] = "NotPrompted";
9
+ TourPromptState["Taken"] = "Taken";
10
+ TourPromptState["DontShowAgain"] = "DontShowAgain";
11
+ })(TourPromptState || (TourPromptState = {}));
12
+ /**
13
+ * Persisted zustand store for the tour prompt state.
14
+ * Persists to localStorage under the key "tour".
15
+ */
16
+ export const useTourStore = create()(persist((set) => ({
17
+ status: TourPromptState.NotPrompted,
18
+ setStatus: (s) => set({ status: s }),
19
+ reset: () => set({ status: TourPromptState.NotPrompted }),
20
+ }), {
21
+ name: "tour",
22
+ }));
@@ -2,7 +2,7 @@ import { OidcProvider } from "../utils/types.js";
2
2
  /**
3
3
  * Zustand state store for "feature flags" like, "generic branding".
4
4
  */
5
- export interface UserInfoStore {
5
+ interface UserInfoStore {
6
6
  currentUser: string | undefined;
7
7
  setCurrentUser: (username: string) => void;
8
8
  picture: string | undefined;
@@ -14,3 +14,4 @@ export interface UserInfoStore {
14
14
  * The hook that lets apps use the store
15
15
  */
16
16
  export declare const useUserInfoStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UserInfoStore>>;
17
+ export {};