mcp-chat-ui 1.0.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 (55) hide show
  1. package/README.md +327 -0
  2. package/dist/ChatUI.d.ts +2 -0
  3. package/dist/ChatUI.js +1781 -0
  4. package/dist/components/Composer.d.ts +35 -0
  5. package/dist/components/Composer.js +19 -0
  6. package/dist/components/DocumentViewer.d.ts +24 -0
  7. package/dist/components/DocumentViewer.js +16 -0
  8. package/dist/components/FormattedText.d.ts +9 -0
  9. package/dist/components/FormattedText.js +98 -0
  10. package/dist/components/InitPanel.d.ts +41 -0
  11. package/dist/components/InitPanel.js +20 -0
  12. package/dist/components/MessageItem.d.ts +19 -0
  13. package/dist/components/MessageItem.js +50 -0
  14. package/dist/components/MessageList.d.ts +22 -0
  15. package/dist/components/MessageList.js +19 -0
  16. package/dist/components/TakeActionModal.d.ts +26 -0
  17. package/dist/components/TakeActionModal.js +26 -0
  18. package/dist/components/TaskCardsModal.d.ts +13 -0
  19. package/dist/components/TaskCardsModal.js +17 -0
  20. package/dist/components/ToolResultOverlay.d.ts +9 -0
  21. package/dist/components/ToolResultOverlay.js +14 -0
  22. package/dist/components/TopBar.d.ts +13 -0
  23. package/dist/components/TopBar.js +9 -0
  24. package/dist/components/TypingDots.d.ts +1 -0
  25. package/dist/components/TypingDots.js +8 -0
  26. package/dist/components/VoiceOverlay.d.ts +11 -0
  27. package/dist/components/VoiceOverlay.js +9 -0
  28. package/dist/config.d.ts +179 -0
  29. package/dist/config.js +24 -0
  30. package/dist/constants/chatDefaults.d.ts +19 -0
  31. package/dist/constants/chatDefaults.js +234 -0
  32. package/dist/helpers/api.d.ts +12 -0
  33. package/dist/helpers/api.js +104 -0
  34. package/dist/helpers/taskAttributes.d.ts +11 -0
  35. package/dist/helpers/taskAttributes.js +41 -0
  36. package/dist/index.d.ts +5 -0
  37. package/dist/index.js +14 -0
  38. package/dist/models/chat.types.d.ts +72 -0
  39. package/dist/models/chat.types.js +2 -0
  40. package/dist/sdkUtilities.d.ts +27 -0
  41. package/dist/sdkUtilities.js +188 -0
  42. package/dist/styles.css +1412 -0
  43. package/dist/utils/classNames.d.ts +1 -0
  44. package/dist/utils/classNames.js +6 -0
  45. package/dist/utils/format.d.ts +2 -0
  46. package/dist/utils/format.js +18 -0
  47. package/dist/utils/generateGuid.d.ts +1 -0
  48. package/dist/utils/generateGuid.js +10 -0
  49. package/dist/utils/localStorage.d.ts +6 -0
  50. package/dist/utils/localStorage.js +39 -0
  51. package/dist/utils/storageKeys.d.ts +16 -0
  52. package/dist/utils/storageKeys.js +25 -0
  53. package/dist/utils/textDirection.d.ts +2 -0
  54. package/dist/utils/textDirection.js +20 -0
  55. package/package.json +52 -0
@@ -0,0 +1,11 @@
1
+ import type { ChatUITextConfig } from "../config";
2
+ type VoiceOverlayProps = {
3
+ voiceMode: boolean;
4
+ waveData: number[];
5
+ voiceUploading: boolean;
6
+ onCancel: () => void;
7
+ onConfirm: () => void;
8
+ text: ChatUITextConfig["voiceOverlay"];
9
+ };
10
+ export default function VoiceOverlay({ voiceMode, waveData, voiceUploading, onCancel, onConfirm, text, }: VoiceOverlayProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = VoiceOverlay;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const framer_motion_1 = require("framer-motion");
6
+ const lucide_react_1 = require("lucide-react");
7
+ function VoiceOverlay({ voiceMode, waveData, voiceUploading, onCancel, onConfirm, text, }) {
8
+ return ((0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: voiceMode && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -8 }, className: "flex w-full justify-center pb-2", style: { transformOrigin: "center" }, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex w-[70%] items-center justify-center gap-1.5", children: [(0, jsx_runtime_1.jsx)("button", { onClick: onCancel, disabled: voiceUploading, className: "inline-flex h-8 w-8 items-center justify-center rounded-full border border-gray-200 text-gray-700 hover:bg-gray-50", title: text.cancelTitle, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex w-[70%] items-center justify-center gap-[3px] overflow-hidden", children: waveData.map((h, i) => ((0, jsx_runtime_1.jsx)("span", { className: "w-[3px] rounded-full bg-gray-900/80 transition-[height] duration-80", style: { height: `${h}px` } }, i))) }), (0, jsx_runtime_1.jsx)("button", { onClick: onConfirm, disabled: voiceUploading, className: "inline-flex h-8 w-8 items-center justify-center rounded-full bg-gray-900 text-white hover:bg-[#252525]", title: text.confirmTitle, children: voiceUploading ? ((0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin text-white" })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" })) })] }) })) }));
9
+ }
@@ -0,0 +1,179 @@
1
+ export type ChatUIFontConfig = {
2
+ base?: string;
3
+ heading?: string;
4
+ mono?: string;
5
+ };
6
+ export type ChatUITheme = {
7
+ appBackground?: string;
8
+ panelBackground?: string;
9
+ panelBackgroundMuted?: string;
10
+ panelBackgroundSubtle?: string;
11
+ brand?: string;
12
+ brandHover?: string;
13
+ brandAlpha30?: string;
14
+ brandAlpha40?: string;
15
+ brandAlpha50?: string;
16
+ textMain?: string;
17
+ textEmphasis?: string;
18
+ textSupporting?: string;
19
+ textMuted?: string;
20
+ textSubtle?: string;
21
+ textDisabled?: string;
22
+ textOnBrand?: string;
23
+ userMessageBackground?: string;
24
+ userMessageText?: string;
25
+ neutralLightest?: string;
26
+ neutralLighter?: string;
27
+ neutralMedium?: string;
28
+ neutralDark?: string;
29
+ neutralDarker?: string;
30
+ neutralDarker80?: string;
31
+ borderDefault?: string;
32
+ accentBackground?: string;
33
+ accentText?: string;
34
+ warningBackground?: string;
35
+ warningText?: string;
36
+ errorBackground?: string;
37
+ errorText?: string;
38
+ focusRing?: string;
39
+ focusRingStrong?: string;
40
+ outlineShadow?: string;
41
+ elevatedShadow?: string;
42
+ selectOptionHover?: string;
43
+ cardSelectedBackground?: string;
44
+ };
45
+ export type ChatUITextConfig = {
46
+ topBar: {
47
+ sessionLabel: string;
48
+ clearButton: string;
49
+ clearTitle: string;
50
+ logoutButton: string;
51
+ logoutTitle: string;
52
+ loginButton: string;
53
+ loginTitle: string;
54
+ };
55
+ emptyState: {
56
+ title: string;
57
+ };
58
+ composer: {
59
+ selectedTaskPrefix: string;
60
+ selectionLineTemplate: string;
61
+ selectedTaskClearTitle: string;
62
+ attachTitle: string;
63
+ placeholderAuthRequired: string;
64
+ placeholderDefault: string;
65
+ voiceStartTitle: string;
66
+ voiceStopTitle: string;
67
+ sendTitle: string;
68
+ };
69
+ voiceOverlay: {
70
+ cancelTitle: string;
71
+ confirmTitle: string;
72
+ };
73
+ messageItem: {
74
+ moreButton: string;
75
+ selectCardTitle: string;
76
+ stopReadingTitle: string;
77
+ readMessageTitle: string;
78
+ linkButtonLabel: string;
79
+ };
80
+ taskCards: {
81
+ modalTitle: string;
82
+ takeActionButton: string;
83
+ showDocumentButton: string;
84
+ };
85
+ documentViewer: {
86
+ title: string;
87
+ downloadButton: string;
88
+ loading: string;
89
+ iframeTitle: string;
90
+ useGoogleViewer: string;
91
+ useDirectViewer: string;
92
+ errorSuffix: string;
93
+ proceedButton: string;
94
+ };
95
+ takeAction: {
96
+ backAriaLabel: string;
97
+ closeAriaLabel: string;
98
+ actionTypeLabel: string;
99
+ selectActionPlaceholder: string;
100
+ approveOption: string;
101
+ rejectOption: string;
102
+ commentsLabel: string;
103
+ commentsPlaceholder: string;
104
+ noEditableAttributes: string;
105
+ selectSignaturePlaceholder: string;
106
+ selectOptionPlaceholder: string;
107
+ signaturePlaceholder: string;
108
+ cancelButton: string;
109
+ submitButton: string;
110
+ nextButton: string;
111
+ };
112
+ toolResult: {
113
+ title: string;
114
+ };
115
+ alerts: {
116
+ clearConfirm: string;
117
+ clearFailedTemplate: string;
118
+ fetchHistoryFailed: string;
119
+ initMissingCredentials: string;
120
+ initMissingBaseUrl: string;
121
+ initMissingSubscriptionKey: string;
122
+ initMissingEndpoint: string;
123
+ initFailed: string;
124
+ initNoToken: string;
125
+ initChatFailedTemplate: string;
126
+ initChatNetworkError: string;
127
+ initChatErrorTemplate: string;
128
+ initRequired: string;
129
+ initNetworkError: string;
130
+ initErrorTemplate: string;
131
+ };
132
+ errors: {
133
+ assistantMessageTemplate: string;
134
+ microphoneAccess: string;
135
+ transcriptionStart: string;
136
+ sasRequestFailedTemplate: string;
137
+ noSasEntries: string;
138
+ invalidSasEntry: string;
139
+ chatFailedTemplate: string;
140
+ takeActionAuthRequired: string;
141
+ takeActionMissingRequestStep: string;
142
+ takeActionMissingSignature: string;
143
+ takeActionNoDocument: string;
144
+ };
145
+ };
146
+ export type ChatUITaskCardSize = {
147
+ width?: number;
148
+ height?: number;
149
+ };
150
+ export type ChatUIInitPreset = {
151
+ username: string;
152
+ password: string;
153
+ };
154
+ export type ChatUIInitPresets = {
155
+ requester?: ChatUIInitPreset;
156
+ provider?: ChatUIInitPreset;
157
+ };
158
+ export type DeepPartial<T> = {
159
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
160
+ };
161
+ export type ChatUITextConfigInput = DeepPartial<ChatUITextConfig>;
162
+ export type ChatUISDKConfig = {
163
+ baseUrl: string;
164
+ apiSubscriptionKey: string;
165
+ loginSubscriptionKey: string;
166
+ token: string;
167
+ isDab: boolean;
168
+ showInitPanel?: boolean;
169
+ initializeChat: boolean;
170
+ contextWindow: string;
171
+ };
172
+ declare class SDKConfigStore {
173
+ private settings;
174
+ setConfig(next: ChatUISDKConfig): void;
175
+ getConfig(): ChatUISDKConfig;
176
+ getValue<Key extends keyof ChatUISDKConfig>(key: Key): ChatUISDKConfig[Key];
177
+ }
178
+ export declare const ChatUISDKConfigStoreInstance: SDKConfigStore;
179
+ export {};
package/dist/config.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatUISDKConfigStoreInstance = void 0;
4
+ class SDKConfigStore {
5
+ constructor() {
6
+ this.settings = null;
7
+ }
8
+ setConfig(next) {
9
+ this.settings = next;
10
+ }
11
+ getConfig() {
12
+ if (!this.settings) {
13
+ throw new Error("Init() must be called before rendering ChatUI.");
14
+ }
15
+ return this.settings;
16
+ }
17
+ getValue(key) {
18
+ if (!this.settings) {
19
+ throw new Error("Init() must be called before reading SDK config.");
20
+ }
21
+ return this.settings[key];
22
+ }
23
+ }
24
+ exports.ChatUISDKConfigStoreInstance = new SDKConfigStore();
@@ -0,0 +1,19 @@
1
+ import type { ChatUIFontConfig, ChatUIInitPresets, ChatUITheme, ChatUITextConfig, ChatUITaskCardSize } from "../config";
2
+ export declare const DEFAULT_API_BASE = "https://nazo-mcp-agents.azurewebsites.net";
3
+ export declare const DEFAULT_API_KEY = "u8lfAaMWb1snOXdZ3foCA1snOXAzLWwQ1snOXdZ3A1ssaXAz";
4
+ export declare const DEFAULT_DOMAIN = "dab.ae";
5
+ export declare const DEFAULT_CONTEXT_WINDOW = "ComposeRequest";
6
+ export declare const DEFAULT_SPEECH_LANG = "en-US";
7
+ export declare const DEFAULT_TTS_LANG = "en-US";
8
+ export declare const DEFAULT_SERVICE_BASE_URL = "";
9
+ export declare const DEFAULT_API_SUBSCRIPTION_KEY = "";
10
+ export declare const DEFAULT_SPEECH_REGION = "swedencentral";
11
+ export declare const DEFAULT_SPEECH_KEY = "ECgw12TXQyOkzwOD5QpTGoMmQHy2MzdRZEzhkakctmrE8SaHHKENJQQJ99BEACfhMk5XJ3w3AAAAACOGgh1l";
12
+ export declare const DEFAULT_INIT_CLIENT_TYPE = "c305d1d6-f2ad-4287-bdd3-29b9afb513f1";
13
+ export declare const DEFAULT_TTS_VOICE_MAP: Record<string, string>;
14
+ export declare const DEFAULT_INIT_PRESETS: ChatUIInitPresets;
15
+ export declare const DEFAULT_THEME: ChatUITheme;
16
+ export declare const DEFAULT_FONTS: ChatUIFontConfig;
17
+ export declare const DEFAULT_TEXT: ChatUITextConfig;
18
+ export declare const DEFAULT_TASK_CARD_SIZE: ChatUITaskCardSize;
19
+ export declare const CHATUI_THEME_CSS = "\n.chatui-root {\n background-color: var(--chat-background);\n color: var(--chat-text-primary);\n font-family: var(--chat-font-base);\n}\n\n.chatui-root .bg-\\[\\#252525\\] { background-color: var(--chat-primary) !important; }\n.chatui-root .hover\\:bg-\\[\\#252525\\]:hover { background-color: var(--chat-primary-hover) !important; }\n.chatui-root .bg-\\[\\#252525\\]\\/30 { background-color: var(--chat-primary-30) !important; }\n.chatui-root .bg-\\[\\#252525\\]\\/40 { background-color: var(--chat-primary-40) !important; }\n.chatui-root .bg-\\[\\#252525\\]\\/50 { background-color: var(--chat-primary-50) !important; }\n\n.chatui-root .bg-white { background-color: var(--chat-surface) !important; }\n.chatui-root .bg-white\\/95 { background-color: var(--chat-surface-muted) !important; }\n.chatui-root .bg-white\\/70 { background-color: var(--chat-surface-subtle) !important; }\n.chatui-root .bg-chat-card-selected { background-color: var(--chat-card-selected-bg) !important; }\n\n.chatui-root .bg-gray-50 { background-color: var(--chat-neutral-50) !important; }\n.chatui-root .bg-gray-100 { background-color: var(--chat-neutral-100) !important; }\n.chatui-root .bg-gray-400 { background-color: var(--chat-neutral-400) !important; }\n.chatui-root .bg-gray-900 { background-color: var(--chat-neutral-900) !important; }\n.chatui-root .bg-gray-900\\/80 { background-color: var(--chat-neutral-900-80) !important; }\n\n.chatui-root .hover\\:bg-gray-50:hover { background-color: var(--chat-neutral-50) !important; }\n.chatui-root .hover\\:bg-gray-100:hover { background-color: var(--chat-neutral-100) !important; }\n.chatui-root .hover\\:bg-gray-800:hover { background-color: var(--chat-neutral-800) !important; }\n.chatui-root .hover\\:bg-white:hover { background-color: var(--chat-surface) !important; }\n.chatui-root .hover\\:text-\\[\\#252525\\]:hover { color: var(--chat-primary) !important; }\n\n.chatui-root .text-white { color: var(--chat-text-inverse) !important; }\n.chatui-root .text-gray-900 { color: var(--chat-text-primary) !important; }\n.chatui-root .text-gray-800 { color: var(--chat-text-strong) !important; }\n.chatui-root .text-gray-700 { color: var(--chat-text-secondary) !important; }\n.chatui-root .text-gray-600 { color: var(--chat-text-muted) !important; }\n.chatui-root .text-gray-500 { color: var(--chat-text-subtle) !important; }\n.chatui-root .text-gray-400 { color: var(--chat-text-faint) !important; }\n\n.chatui-root .bg-blue-100 { background-color: var(--chat-accent-bg) !important; }\n.chatui-root .text-blue-700 { color: var(--chat-accent-text) !important; }\n.chatui-root .bg-amber-50 { background-color: var(--chat-warning-bg) !important; }\n.chatui-root .text-amber-700 { color: var(--chat-warning-text) !important; }\n.chatui-root .bg-red-50 { background-color: var(--chat-error-bg) !important; }\n.chatui-root .text-red-700 { color: var(--chat-error-text) !important; }\n\n.chatui-root .border,\n.chatui-root .border-b,\n.chatui-root .border-t,\n.chatui-root .border-l,\n.chatui-root .border-r,\n.chatui-root .border-x,\n.chatui-root .border-y { border-color: var(--chat-border) !important; }\n.chatui-root .border-gray-200 { border-color: var(--chat-border) !important; }\n.chatui-root .border-\\[\\#252525\\] { border-color: var(--chat-primary) !important; }\n\n.chatui-root .ring-\\[\\#252525\\]\\/5 { --tw-ring-color: var(--chat-ring) !important; }\n.chatui-root .focus\\:ring-\\[\\#252525\\]\\/10:focus { --tw-ring-color: var(--chat-ring-strong) !important; }\n\n.chatui-root .shadow-\\[0_0_0_1px_rgba\\(71,72,72,0\\.12\\)\\] { box-shadow: 0 0 0 1px var(--chat-shadow-outline) !important; }\n.chatui-root .shadow-\\[0_10px_40px_rgba\\(0,0,0,0\\.08\\)\\] { box-shadow: 0 10px 40px var(--chat-shadow-elevated) !important; }\n\n.chatui-root select option:hover,\n.chatui-root select option:focus,\n.chatui-root select option:checked {\n background-color: var(--chat-select-option-hover) !important;\n}\n";
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHATUI_THEME_CSS = exports.DEFAULT_TASK_CARD_SIZE = exports.DEFAULT_TEXT = exports.DEFAULT_FONTS = exports.DEFAULT_THEME = exports.DEFAULT_INIT_PRESETS = exports.DEFAULT_TTS_VOICE_MAP = exports.DEFAULT_INIT_CLIENT_TYPE = exports.DEFAULT_SPEECH_KEY = exports.DEFAULT_SPEECH_REGION = exports.DEFAULT_API_SUBSCRIPTION_KEY = exports.DEFAULT_SERVICE_BASE_URL = exports.DEFAULT_TTS_LANG = exports.DEFAULT_SPEECH_LANG = exports.DEFAULT_CONTEXT_WINDOW = exports.DEFAULT_DOMAIN = exports.DEFAULT_API_KEY = exports.DEFAULT_API_BASE = void 0;
4
+ exports.DEFAULT_API_BASE = "https://nazo-mcp-agents.azurewebsites.net";
5
+ exports.DEFAULT_API_KEY = "u8lfAaMWb1snOXdZ3foCA1snOXAzLWwQ1snOXdZ3A1ssaXAz";
6
+ exports.DEFAULT_DOMAIN = "dab.ae";
7
+ exports.DEFAULT_CONTEXT_WINDOW = "ComposeRequest";
8
+ exports.DEFAULT_SPEECH_LANG = "en-US";
9
+ exports.DEFAULT_TTS_LANG = "en-US";
10
+ exports.DEFAULT_SERVICE_BASE_URL = "";
11
+ exports.DEFAULT_API_SUBSCRIPTION_KEY = "";
12
+ exports.DEFAULT_SPEECH_REGION = "swedencentral";
13
+ exports.DEFAULT_SPEECH_KEY = "ECgw12TXQyOkzwOD5QpTGoMmQHy2MzdRZEzhkakctmrE8SaHHKENJQQJ99BEACfhMk5XJ3w3AAAAACOGgh1l";
14
+ exports.DEFAULT_INIT_CLIENT_TYPE = "c305d1d6-f2ad-4287-bdd3-29b9afb513f1";
15
+ exports.DEFAULT_TTS_VOICE_MAP = {
16
+ "en-US": "en-US-RyanMultilingualNeural",
17
+ "ar-EG": "en-US-RyanMultilingualNeural",
18
+ };
19
+ exports.DEFAULT_INIT_PRESETS = {};
20
+ exports.DEFAULT_THEME = {
21
+ appBackground: "#ffffff",
22
+ panelBackground: "#ffffff",
23
+ panelBackgroundMuted: "rgba(255,255,255,0.95)",
24
+ panelBackgroundSubtle: "rgba(255,255,255,0.7)",
25
+ brand: "#252525",
26
+ brandHover: "#252525",
27
+ brandAlpha30: "rgba(37,37,37,0.3)",
28
+ brandAlpha40: "rgba(37,37,37,0.4)",
29
+ brandAlpha50: "rgba(37,37,37,0.5)",
30
+ textMain: "#111827",
31
+ textEmphasis: "#1f2937",
32
+ textSupporting: "#374151",
33
+ textMuted: "#4b5563",
34
+ textSubtle: "#6b7280",
35
+ textDisabled: "#9ca3af",
36
+ textOnBrand: "#ffffff",
37
+ userMessageBackground: "#f2f2f2",
38
+ userMessageText: "#111827",
39
+ neutralLightest: "#f9fafb",
40
+ neutralLighter: "#f3f4f6",
41
+ neutralMedium: "#9ca3af",
42
+ neutralDark: "#1f2937",
43
+ neutralDarker: "#111827",
44
+ neutralDarker80: "rgba(17,24,39,0.8)",
45
+ borderDefault: "#252525",
46
+ accentBackground: "#dbeafe",
47
+ accentText: "#1d4ed8",
48
+ warningBackground: "#fffbeb",
49
+ warningText: "#b45309",
50
+ errorBackground: "#fef2f2",
51
+ errorText: "#b91c1c",
52
+ focusRing: "rgba(37,37,37,0.05)",
53
+ focusRingStrong: "rgba(37,37,37,0.1)",
54
+ outlineShadow: "rgba(71,72,72,0.12)",
55
+ elevatedShadow: "rgba(0,0,0,0.08)",
56
+ selectOptionHover: "#f3f4f6",
57
+ cardSelectedBackground: "#E8E9EB",
58
+ };
59
+ exports.DEFAULT_FONTS = {
60
+ base: "inherit",
61
+ heading: "inherit",
62
+ mono: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace",
63
+ };
64
+ exports.DEFAULT_TEXT = {
65
+ topBar: {
66
+ sessionLabel: "Session:",
67
+ clearButton: "Clear",
68
+ clearTitle: "Clear chat",
69
+ logoutButton: "Logout",
70
+ logoutTitle: "Logout",
71
+ loginButton: "Login",
72
+ loginTitle: "Login",
73
+ },
74
+ emptyState: {
75
+ title: "Whats on the agenda today?",
76
+ },
77
+ composer: {
78
+ selectedTaskPrefix: "Selected-",
79
+ selectionLineTemplate: "Select '{id}'",
80
+ selectedTaskClearTitle: "Clear selected task",
81
+ attachTitle: "Attach files",
82
+ placeholderAuthRequired: "Enter a Session ID from Login panel…",
83
+ placeholderDefault: "Message Copilot or @ mention a tab",
84
+ voiceStartTitle: "Voice input",
85
+ voiceStopTitle: "Stop voice",
86
+ sendTitle: "Send",
87
+ },
88
+ voiceOverlay: {
89
+ cancelTitle: "Cancel",
90
+ confirmTitle: "Use",
91
+ },
92
+ messageItem: {
93
+ moreButton: "More",
94
+ selectCardTitle: "Select card",
95
+ stopReadingTitle: "Stop reading",
96
+ readMessageTitle: "Read this message",
97
+ linkButtonLabel: "document",
98
+ },
99
+ taskCards: {
100
+ modalTitle: "Task details",
101
+ takeActionButton: "Take Action",
102
+ showDocumentButton: "Show document",
103
+ },
104
+ documentViewer: {
105
+ title: "Document preview",
106
+ downloadButton: "Download",
107
+ loading: "Loading document...",
108
+ iframeTitle: "Document",
109
+ useGoogleViewer: "Use Google Viewer",
110
+ useDirectViewer: "Use Direct Viewer",
111
+ errorSuffix: "If the document doesn't render, the Azure container may force download via headers or block CORS; in that case you can still use the Download button above.",
112
+ proceedButton: "Proceed",
113
+ },
114
+ takeAction: {
115
+ backAriaLabel: "Back",
116
+ closeAriaLabel: "Close",
117
+ actionTypeLabel: "Action Type *",
118
+ selectActionPlaceholder: "Select action",
119
+ approveOption: "Approve",
120
+ rejectOption: "Reject",
121
+ commentsLabel: "Comments",
122
+ commentsPlaceholder: "Comments",
123
+ noEditableAttributes: "No editable attributes available.",
124
+ selectSignaturePlaceholder: "Select signature",
125
+ selectOptionPlaceholder: "Select option",
126
+ signaturePlaceholder: "Signature",
127
+ cancelButton: "Cancel",
128
+ submitButton: "Submit",
129
+ nextButton: "Next",
130
+ },
131
+ toolResult: {
132
+ title: "Tool Result",
133
+ },
134
+ alerts: {
135
+ clearConfirm: "Clear this chat?",
136
+ clearFailedTemplate: "❌ Clear failed: {error}",
137
+ fetchHistoryFailed: "❌ Failed to fetch session history. Verify API Base URL, CORS, and that your server is running.",
138
+ initMissingCredentials: "Enter username and password, or provide an auth token.",
139
+ initMissingBaseUrl: "Base URL is required to initialize the chat.",
140
+ initMissingSubscriptionKey: "API subscription key is required to initialize the chat.",
141
+ initMissingEndpoint: "Initialization endpoint is required when no auth token is provided.",
142
+ initFailed: "Initialization failed",
143
+ initNoToken: "Initialization failed: no access token returned from server.",
144
+ initChatFailedTemplate: "initializeChat failed: {status} {statusText}{details}",
145
+ initChatNetworkError: "Network/CORS error during initializeChat. Check server URL and CORS settings.",
146
+ initChatErrorTemplate: "initializeChat error: {error}",
147
+ initRequired: "Please initialize the chat before sending a message.",
148
+ initNetworkError: "Network/CORS error. Check server URL and CORS settings.",
149
+ initErrorTemplate: "Initialization error: {error}",
150
+ },
151
+ errors: {
152
+ assistantMessageTemplate: "❌ {error}",
153
+ microphoneAccess: "Microphone access failed.",
154
+ transcriptionStart: "Failed to start real-time transcription.",
155
+ sasRequestFailedTemplate: "SAS request failed: {status} {statusText}{details}",
156
+ noSasEntries: "No attachment SAS entries returned from server.",
157
+ invalidSasEntry: "Invalid SAS entry: missing AttachmentName or AttachmentSAS.",
158
+ chatFailedTemplate: "Chat failed: {status} {statusText}{details}",
159
+ takeActionAuthRequired: "Initialization required before taking action.",
160
+ takeActionMissingRequestStep: "Missing request step id for this task.",
161
+ takeActionMissingSignature: "Select a signature before submitting.",
162
+ takeActionNoDocument: "Unable to generate document preview.",
163
+ },
164
+ };
165
+ exports.DEFAULT_TASK_CARD_SIZE = {
166
+ width: 280,
167
+ };
168
+ exports.CHATUI_THEME_CSS = `
169
+ .chatui-root {
170
+ background-color: var(--chat-background);
171
+ color: var(--chat-text-primary);
172
+ font-family: var(--chat-font-base);
173
+ }
174
+
175
+ .chatui-root .bg-\\[\\#252525\\] { background-color: var(--chat-primary) !important; }
176
+ .chatui-root .hover\\:bg-\\[\\#252525\\]:hover { background-color: var(--chat-primary-hover) !important; }
177
+ .chatui-root .bg-\\[\\#252525\\]\\/30 { background-color: var(--chat-primary-30) !important; }
178
+ .chatui-root .bg-\\[\\#252525\\]\\/40 { background-color: var(--chat-primary-40) !important; }
179
+ .chatui-root .bg-\\[\\#252525\\]\\/50 { background-color: var(--chat-primary-50) !important; }
180
+
181
+ .chatui-root .bg-white { background-color: var(--chat-surface) !important; }
182
+ .chatui-root .bg-white\\/95 { background-color: var(--chat-surface-muted) !important; }
183
+ .chatui-root .bg-white\\/70 { background-color: var(--chat-surface-subtle) !important; }
184
+ .chatui-root .bg-chat-card-selected { background-color: var(--chat-card-selected-bg) !important; }
185
+
186
+ .chatui-root .bg-gray-50 { background-color: var(--chat-neutral-50) !important; }
187
+ .chatui-root .bg-gray-100 { background-color: var(--chat-neutral-100) !important; }
188
+ .chatui-root .bg-gray-400 { background-color: var(--chat-neutral-400) !important; }
189
+ .chatui-root .bg-gray-900 { background-color: var(--chat-neutral-900) !important; }
190
+ .chatui-root .bg-gray-900\\/80 { background-color: var(--chat-neutral-900-80) !important; }
191
+
192
+ .chatui-root .hover\\:bg-gray-50:hover { background-color: var(--chat-neutral-50) !important; }
193
+ .chatui-root .hover\\:bg-gray-100:hover { background-color: var(--chat-neutral-100) !important; }
194
+ .chatui-root .hover\\:bg-gray-800:hover { background-color: var(--chat-neutral-800) !important; }
195
+ .chatui-root .hover\\:bg-white:hover { background-color: var(--chat-surface) !important; }
196
+ .chatui-root .hover\\:text-\\[\\#252525\\]:hover { color: var(--chat-primary) !important; }
197
+
198
+ .chatui-root .text-white { color: var(--chat-text-inverse) !important; }
199
+ .chatui-root .text-gray-900 { color: var(--chat-text-primary) !important; }
200
+ .chatui-root .text-gray-800 { color: var(--chat-text-strong) !important; }
201
+ .chatui-root .text-gray-700 { color: var(--chat-text-secondary) !important; }
202
+ .chatui-root .text-gray-600 { color: var(--chat-text-muted) !important; }
203
+ .chatui-root .text-gray-500 { color: var(--chat-text-subtle) !important; }
204
+ .chatui-root .text-gray-400 { color: var(--chat-text-faint) !important; }
205
+
206
+ .chatui-root .bg-blue-100 { background-color: var(--chat-accent-bg) !important; }
207
+ .chatui-root .text-blue-700 { color: var(--chat-accent-text) !important; }
208
+ .chatui-root .bg-amber-50 { background-color: var(--chat-warning-bg) !important; }
209
+ .chatui-root .text-amber-700 { color: var(--chat-warning-text) !important; }
210
+ .chatui-root .bg-red-50 { background-color: var(--chat-error-bg) !important; }
211
+ .chatui-root .text-red-700 { color: var(--chat-error-text) !important; }
212
+
213
+ .chatui-root .border,
214
+ .chatui-root .border-b,
215
+ .chatui-root .border-t,
216
+ .chatui-root .border-l,
217
+ .chatui-root .border-r,
218
+ .chatui-root .border-x,
219
+ .chatui-root .border-y { border-color: var(--chat-border) !important; }
220
+ .chatui-root .border-gray-200 { border-color: var(--chat-border) !important; }
221
+ .chatui-root .border-\\[\\#252525\\] { border-color: var(--chat-primary) !important; }
222
+
223
+ .chatui-root .ring-\\[\\#252525\\]\\/5 { --tw-ring-color: var(--chat-ring) !important; }
224
+ .chatui-root .focus\\:ring-\\[\\#252525\\]\\/10:focus { --tw-ring-color: var(--chat-ring-strong) !important; }
225
+
226
+ .chatui-root .shadow-\\[0_0_0_1px_rgba\\(71,72,72,0\\.12\\)\\] { box-shadow: 0 0 0 1px var(--chat-shadow-outline) !important; }
227
+ .chatui-root .shadow-\\[0_10px_40px_rgba\\(0,0,0,0\\.08\\)\\] { box-shadow: 0 10px 40px var(--chat-shadow-elevated) !important; }
228
+
229
+ .chatui-root select option:hover,
230
+ .chatui-root select option:focus,
231
+ .chatui-root select option:checked {
232
+ background-color: var(--chat-select-option-hover) !important;
233
+ }
234
+ `;
@@ -0,0 +1,12 @@
1
+ export type RequestHeadersConfig = {
2
+ authToken?: string;
3
+ apiSubscriptionKey?: string;
4
+ };
5
+ export declare function buildRequestHeaders({ authToken, apiSubscriptionKey, }: RequestHeadersConfig): {
6
+ Authorization?: string | undefined;
7
+ "ocp-apim-subscription-key"?: string | undefined;
8
+ "Content-Type": string;
9
+ };
10
+ export declare function postJson(url: string, body: unknown, headers: Record<string, string>): Promise<any>;
11
+ export declare function getDocumentUrl(storageBaseUrl: string, documentId: string | number, headers: Record<string, string>): Promise<string>;
12
+ export declare function uploadFileWithSAS(sasUrl: string, blobName: string, file: File): Promise<string>;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.buildRequestHeaders = buildRequestHeaders;
13
+ exports.postJson = postJson;
14
+ exports.getDocumentUrl = getDocumentUrl;
15
+ exports.uploadFileWithSAS = uploadFileWithSAS;
16
+ function buildRequestHeaders({ authToken, apiSubscriptionKey, }) {
17
+ return Object.assign(Object.assign({ "Content-Type": "application/json" }, (apiSubscriptionKey
18
+ ? { "ocp-apim-subscription-key": apiSubscriptionKey }
19
+ : {})), (authToken ? { Authorization: authToken } : {}));
20
+ }
21
+ function postJson(url, body, headers) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const res = yield fetch(url, {
24
+ method: "POST",
25
+ headers,
26
+ body: JSON.stringify(body),
27
+ });
28
+ if (!res.ok) {
29
+ let msg = "";
30
+ try {
31
+ msg = yield res.text();
32
+ }
33
+ catch (_a) { }
34
+ throw new Error(`Request failed: ${res.status} ${res.statusText}${msg ? ` - ${msg}` : ""}`);
35
+ }
36
+ return res.json().catch(() => ({}));
37
+ });
38
+ }
39
+ function getDocumentUrl(storageBaseUrl, documentId, headers) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const sasUrl = `${storageBaseUrl}/api/Storage/CreateReadSAS`;
42
+ const res = yield fetch(sasUrl, {
43
+ method: "GET",
44
+ headers,
45
+ });
46
+ if (!res.ok) {
47
+ let msg = "";
48
+ try {
49
+ msg = yield res.text();
50
+ }
51
+ catch (_a) { }
52
+ throw new Error(`CreateReadSAS failed: ${res.status} ${res.statusText}${msg ? ` - ${msg}` : ""}`);
53
+ }
54
+ const payload = yield res.json().catch(() => ({}));
55
+ const sas = payload === null || payload === void 0 ? void 0 : payload.Result;
56
+ if (!sas)
57
+ return "";
58
+ const parts = String(sas).split("?");
59
+ if (parts.length < 2)
60
+ return "";
61
+ return `${parts[0]}/${documentId}?${parts[1]}`;
62
+ });
63
+ }
64
+ function uploadFileWithSAS(sasUrl, blobName, file) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const url = new URL(sasUrl);
67
+ const parts = url.pathname.replace(/^\/+/, "").split("/");
68
+ if (parts.length === 1) {
69
+ const encodedBlobPath = blobName
70
+ .split("/")
71
+ .map(encodeURIComponent)
72
+ .join("/");
73
+ url.pathname = `/${parts[0]}/${encodedBlobPath}`;
74
+ }
75
+ const blobUrl = url.toString();
76
+ let resp;
77
+ try {
78
+ resp = yield fetch(blobUrl, {
79
+ method: "PUT",
80
+ headers: {
81
+ "x-ms-blob-type": "BlockBlob",
82
+ "x-ms-blob-content-type": file.type || "application/octet-stream",
83
+ "x-ms-version": "2021-08-06",
84
+ },
85
+ body: file,
86
+ });
87
+ }
88
+ catch (err) {
89
+ if ((err === null || err === void 0 ? void 0 : err.name) === "TypeError") {
90
+ throw new Error("Network/CORS error. Ensure your Blob CORS allows your origin, method PUT, and headers x-ms-blob-type,x-ms-blob-content-type.");
91
+ }
92
+ throw err;
93
+ }
94
+ if (!resp.ok) {
95
+ let details = "";
96
+ try {
97
+ details = yield resp.text();
98
+ }
99
+ catch (_a) { }
100
+ throw new Error(`Azure upload failed: ${resp.status} ${resp.statusText}${details ? ` - ${details}` : ""}`);
101
+ }
102
+ return blobUrl;
103
+ });
104
+ }
@@ -0,0 +1,11 @@
1
+ import type { RequestStepAttribute, UserSignatureOption } from "../models/chat.types";
2
+ export declare function getSignatureLabel(sig: UserSignatureOption): string;
3
+ export declare function getAttributeValueByAlias(attrs: RequestStepAttribute[], alias: string | null | undefined): string | number | null;
4
+ export declare function isDocumentAttribute(attr: RequestStepAttribute, documentAttributeName: string | null | undefined): boolean;
5
+ export declare function applyDocumentIdToAttributes(attrs: RequestStepAttribute[], documentAttributeName: string | null | undefined, documentId: string | number): RequestStepAttribute[];
6
+ export declare function buildAttributePayload(attrs: RequestStepAttribute[]): {
7
+ AttributeTypeId: number;
8
+ Name: string;
9
+ Alias: string;
10
+ Value: string | number | null;
11
+ }[];
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSignatureLabel = getSignatureLabel;
4
+ exports.getAttributeValueByAlias = getAttributeValueByAlias;
5
+ exports.isDocumentAttribute = isDocumentAttribute;
6
+ exports.applyDocumentIdToAttributes = applyDocumentIdToAttributes;
7
+ exports.buildAttributePayload = buildAttributePayload;
8
+ function getSignatureLabel(sig) {
9
+ return sig.Name || `Signature ${sig.interactorSignatureId}`;
10
+ }
11
+ function getAttributeValueByAlias(attrs, alias) {
12
+ var _a;
13
+ if (!alias)
14
+ return null;
15
+ const match = attrs.find((attr) => attr.Alias === alias);
16
+ return (_a = match === null || match === void 0 ? void 0 : match.Value) !== null && _a !== void 0 ? _a : null;
17
+ }
18
+ function isDocumentAttribute(attr, documentAttributeName) {
19
+ if (!documentAttributeName)
20
+ return false;
21
+ return attr.Name === documentAttributeName || attr.Alias === documentAttributeName;
22
+ }
23
+ function applyDocumentIdToAttributes(attrs, documentAttributeName, documentId) {
24
+ if (!documentAttributeName)
25
+ return attrs;
26
+ return attrs.map((attr) => {
27
+ const matchesName = attr.Name === documentAttributeName;
28
+ const matchesAlias = attr.Alias === documentAttributeName;
29
+ if (!matchesName && !matchesAlias)
30
+ return attr;
31
+ return Object.assign(Object.assign({}, attr), { Value: String(documentId) });
32
+ });
33
+ }
34
+ function buildAttributePayload(attrs) {
35
+ return attrs.map((attr) => ({
36
+ AttributeTypeId: attr.AttributeTypeId,
37
+ Name: attr.Name,
38
+ Alias: attr.Alias,
39
+ Value: attr.Value,
40
+ }));
41
+ }
@@ -0,0 +1,5 @@
1
+ export { default as ChatUI } from "./ChatUI";
2
+ export type { ChatMessage, ChatUIProps, Role } from "./models/chat.types";
3
+ export { Init, GetConfig, FinalizeSession, InitializeChatClients, InitializeChatSession, } from "./sdkUtilities";
4
+ export type { InitializeChatClientsOptions, FinalizeSessionOptions, InitializeChatOptions, InitializeChatResult, } from "./sdkUtilities";
5
+ export type { ChatUIFontConfig, ChatUIInitPreset, ChatUIInitPresets, ChatUISDKConfig, ChatUITheme, ChatUITaskCardSize, ChatUITextConfig, ChatUITextConfigInput, } from "./config";