@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.
- package/dist/Theme/Theme.js +3 -3
- package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +11 -1
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +284 -285
- package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +1 -7
- package/dist/components/AgentChat/ChatCommon/ChatHistory.js +33 -22
- package/dist/components/AgentChat/ChatCommon/ControlButtons.js +2 -2
- package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +13 -0
- package/dist/components/AgentChat/ChatCommon/Conversation.js +80 -0
- package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +23 -0
- package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +11 -0
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +5 -3
- package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +3 -0
- package/dist/components/AgentChat/ChatCommon/SampleQueries.js +6 -3
- package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +12 -0
- package/dist/components/AgentChat/ChatCommon/Thinking.js +51 -0
- package/dist/components/AgentChat/Common/LlmChatButton.d.ts +2 -2
- package/dist/components/AgentChat/Common/Types.d.ts +6 -5
- package/dist/components/AgentChat/Common/Types.js +5 -0
- package/dist/components/AgentChat/Common/Utils.d.ts +1 -1
- package/dist/components/AgentChat/Common/Utils.js +14 -9
- package/dist/components/Common/AccordionLite.d.ts +14 -0
- package/dist/components/Common/AccordionLite.js +25 -0
- package/dist/components/Common/ConfirmationModal.d.ts +1 -0
- package/dist/components/Common/ConfirmationModal.js +1 -1
- package/dist/components/Common/CustomerLogo.js +1 -1
- package/dist/components/Common/MUIAlert.d.ts +1 -0
- package/dist/components/Common/MUIAlert.js +3 -4
- package/dist/components/Common/Navbar.d.ts +2 -1
- package/dist/components/Common/Navbar.js +8 -4
- package/dist/components/Common/notification.d.ts +1 -1
- package/dist/components/Common/notification.js +17 -12
- package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +8 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow.js +282 -82
- package/dist/components/MultiAgentAccelerator/AgentNode.d.ts +3 -1
- package/dist/components/MultiAgentAccelerator/AgentNode.js +64 -28
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +1 -4
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +4 -5
- package/dist/components/MultiAgentAccelerator/GraphLayouts.js +19 -9
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +2 -2
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +268 -60
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +1 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +28 -12
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +1 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +21 -5
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +4 -3
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +8 -2
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +19 -2
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +40 -5
- package/dist/components/MultiAgentAccelerator/ThoughtBubbleOverlay.js +27 -14
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.d.ts +7 -0
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +88 -0
- package/dist/components/MultiAgentAccelerator/const.d.ts +7 -10
- package/dist/components/MultiAgentAccelerator/const.js +9 -10
- package/dist/const.d.ts +5 -1
- package/dist/const.js +5 -2
- package/dist/controller/agent/Agent.d.ts +10 -0
- package/dist/controller/agent/Agent.js +17 -1
- package/dist/controller/llm/LlmChat.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/state/TemporaryNetworks.d.ts +5 -15
- package/dist/state/TemporaryNetworks.js +15 -34
- package/dist/state/Tour.d.ts +29 -0
- package/dist/state/Tour.js +22 -0
- package/dist/state/UserInfo.d.ts +2 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/Authentication.js +12 -3
- package/dist/utils/File.d.ts +7 -0
- package/dist/utils/File.js +14 -3
- package/dist/utils/text.js +2 -2
- package/dist/utils/title.js +1 -1
- package/dist/utils/zIndexLayers.js +3 -0
- package/package.json +15 -11
- package/dist/components/AgentChat/ChatCommon/AgentConnectivity.d.ts +0 -14
- package/dist/components/AgentChat/ChatCommon/AgentConnectivity.js +0 -23
- package/dist/components/AgentChat/ChatCommon/Greetings.d.ts +0 -1
- package/dist/components/AgentChat/ChatCommon/Greetings.js +0 -38
- package/dist/components/AgentChat/ChatCommon/UserQueryDisplay.d.ts +0 -7
- package/dist/components/AgentChat/ChatCommon/UserQueryDisplay.js +0 -32
- package/dist/components/Common/LlmChatOptionsButton.d.ts +0 -6
- 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: (
|
|
24
|
+
upsertTempNetworks: (incomingNetworks) => {
|
|
48
25
|
set((state) => {
|
|
49
26
|
const updated = [...state.tempNetworks];
|
|
50
|
-
for (const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
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(
|
|
33
|
+
updated.push(incomingNetwork); // no existing entry — add as new
|
|
58
34
|
}
|
|
59
35
|
}
|
|
60
36
|
return { tempNetworks: updated };
|
|
61
37
|
});
|
|
62
|
-
return
|
|
38
|
+
return incomingNetworks;
|
|
63
39
|
},
|
|
64
|
-
updateTempNetworkDefinition: (networkName,
|
|
65
|
-
|
|
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
|
+
}));
|
package/dist/state/UserInfo.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 {};
|