@xcelsior/ui-chat 1.0.7 → 2.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 (96) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/index.d.mts +69 -69
  3. package/dist/index.d.ts +69 -69
  4. package/dist/index.js +2458 -627
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +2457 -628
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +6 -5
  9. package/src/components/BrandIcons.stories.tsx +95 -0
  10. package/src/components/BrandIcons.tsx +84 -0
  11. package/src/components/Chat.stories.tsx +149 -16
  12. package/src/components/Chat.tsx +116 -96
  13. package/src/components/ChatHeader.tsx +124 -69
  14. package/src/components/ChatInput.tsx +253 -104
  15. package/src/components/ChatWidget.tsx +209 -63
  16. package/src/components/ConversationRating.stories.tsx +33 -0
  17. package/src/components/ConversationRating.tsx +156 -0
  18. package/src/components/MarkdownMessage.tsx +202 -0
  19. package/src/components/MessageItem.stories.tsx +253 -55
  20. package/src/components/MessageItem.tsx +222 -59
  21. package/src/components/MessageList.tsx +164 -35
  22. package/src/components/PreChatForm.tsx +236 -96
  23. package/src/components/ThinkingIndicator.tsx +370 -0
  24. package/src/components/TypingIndicator.tsx +27 -11
  25. package/src/hooks/useDraggablePosition.ts +91 -0
  26. package/src/hooks/useMessages.ts +12 -13
  27. package/src/hooks/useResizableWidget.ts +324 -0
  28. package/src/index.tsx +5 -0
  29. package/src/types.ts +51 -5
  30. package/src/utils/markdown-styles.ts +140 -0
  31. package/storybook-static/assets/BrandIcons-Cjy5INAp.js +4 -0
  32. package/storybook-static/assets/BrandIcons.stories-BeVC6svr.js +64 -0
  33. package/storybook-static/assets/Chat.stories-J_Yp51wU.js +803 -0
  34. package/storybook-static/assets/Color-YHDXOIA2-BMnd3YrF.js +1 -0
  35. package/storybook-static/assets/ConversationRating.stories-B5_QddHN.js +12 -0
  36. package/storybook-static/assets/DocsRenderer-CFRXHY34-i_W8iCu9.js +575 -0
  37. package/storybook-static/assets/MessageItem-DAaKZ9s9.js +14 -0
  38. package/storybook-static/assets/MessageItem.stories-Ckr1_scc.js +255 -0
  39. package/storybook-static/assets/ToastContext-Bty1K7ya.js +1 -0
  40. package/storybook-static/assets/chunk-XP5HYGXS-BpfKkqn7.js +1 -0
  41. package/storybook-static/assets/en-US-BukEqXxE.js +1 -0
  42. package/storybook-static/assets/entry-preview-docs-DHohToDm.js +46 -0
  43. package/storybook-static/assets/entry-preview-oDnntGcx.js +2 -0
  44. package/storybook-static/assets/iframe-CGBtu2Se.js +211 -0
  45. package/storybook-static/assets/index--qcDGAq6.js +1 -0
  46. package/storybook-static/assets/index-BLHw34Di.js +24 -0
  47. package/storybook-static/assets/index-B_4m48Mv.js +1 -0
  48. package/storybook-static/assets/index-DgH-xKnr.js +11 -0
  49. package/storybook-static/assets/index-DrFu-skq.js +6 -0
  50. package/storybook-static/assets/index-DrdPSA1J.js +240 -0
  51. package/storybook-static/assets/index-jvNEZhzf.js +1 -0
  52. package/storybook-static/assets/index-yBjzXJbu.js +9 -0
  53. package/storybook-static/assets/jsx-runtime-Cf8x2fCZ.js +9 -0
  54. package/storybook-static/assets/preview-B8lJiyuQ.js +34 -0
  55. package/storybook-static/assets/preview-BBWR9nbA.js +1 -0
  56. package/storybook-static/assets/preview-BRpahs9B.js +2 -0
  57. package/storybook-static/assets/preview-BWzBA1C2.js +396 -0
  58. package/storybook-static/assets/preview-CvbIS5ZJ.js +1 -0
  59. package/storybook-static/assets/preview-DD_OYowb.js +1 -0
  60. package/storybook-static/assets/preview-DGUiP6tS.js +7 -0
  61. package/storybook-static/assets/preview-DHQbi4pV.js +1 -0
  62. package/storybook-static/assets/preview-DUOvJmsz.js +1 -0
  63. package/storybook-static/assets/preview-DcGwT3kv.css +1 -0
  64. package/storybook-static/assets/preview-DwI0w3cI.js +1 -0
  65. package/storybook-static/assets/react-18-CALspjOX.js +1 -0
  66. package/storybook-static/assets/test-utils-BE0XkMtV.js +9 -0
  67. package/storybook-static/favicon.svg +1 -0
  68. package/storybook-static/iframe.html +666 -0
  69. package/storybook-static/index.html +177 -0
  70. package/storybook-static/index.json +1 -0
  71. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  72. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  73. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  74. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  75. package/storybook-static/project.json +1 -0
  76. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
  77. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +12 -0
  78. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +405 -0
  79. package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js +245 -0
  80. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +3 -0
  81. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +3 -0
  82. package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js +3 -0
  83. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +3 -0
  84. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +222 -0
  85. package/storybook-static/sb-addons/links-1/manager-bundle.js +3 -0
  86. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
  87. package/storybook-static/sb-common-assets/favicon.svg +1 -0
  88. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  89. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  90. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  91. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  92. package/storybook-static/sb-manager/globals-module-info.js +1052 -0
  93. package/storybook-static/sb-manager/globals-runtime.js +42127 -0
  94. package/storybook-static/sb-manager/globals.js +48 -0
  95. package/storybook-static/sb-manager/runtime.js +12048 -0
  96. package/.turbo/turbo-lint.log +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - improve styling
8
+ - Updated dependencies
9
+ - Updated dependencies [f3ec4eb]
10
+ - @xcelsior/ui-fields@1.0.4
11
+ - @xcelsior/design-system@1.0.7
12
+
3
13
  ## 1.0.7
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -13,14 +13,16 @@ interface IMessage {
13
13
  id: string;
14
14
  conversationId: string;
15
15
  senderId: string;
16
- senderType: 'customer' | 'agent' | 'system';
16
+ senderType: 'customer' | 'agent' | 'bot' | 'system';
17
17
  content: string;
18
18
  messageType: MessageType;
19
19
  createdAt: string;
20
20
  status: MessageStatus;
21
+ feedback?: 'good' | 'wrong' | 'corrected' | null;
22
+ confidence?: number | null;
21
23
  metadata?: Record<string, unknown>;
22
24
  }
23
- type ConversationStatus = 'open' | 'pending' | 'closed' | 'archived';
25
+ type ConversationStatus = 'open' | 'pending' | 'closed' | 'archived' | 'bot_handling' | 'pending_agent' | 'agent_active';
24
26
  type ConversationPriority = 'low' | 'medium' | 'high' | 'urgent';
25
27
  type ConversationChannel = 'web' | 'mobile' | 'email';
26
28
  interface IConversation {
@@ -42,7 +44,7 @@ interface IConversation {
42
44
  metadata?: Record<string, unknown>;
43
45
  }
44
46
  interface IWebSocketMessage {
45
- type: 'message' | 'typing' | 'read' | 'connected' | 'error' | 'system';
47
+ type: 'message' | 'typing' | 'read' | 'connected' | 'error' | 'system' | 'escalation_requested' | 'bot_response' | 'conversation_updated';
46
48
  data: any;
47
49
  }
48
50
  interface ISendMessageData {
@@ -71,11 +73,25 @@ interface IUploadedFile {
71
73
  type: string;
72
74
  markdown?: string;
73
75
  }
76
+ interface IChatTheme {
77
+ primary?: string;
78
+ primaryStrong?: string;
79
+ background?: string;
80
+ backgroundAlt?: string;
81
+ text?: string;
82
+ textMuted?: string;
83
+ statusPositive?: string;
84
+ statusCaution?: string;
85
+ statusNegative?: string;
86
+ borderColor?: string;
87
+ }
88
+ type WidgetPosition = 'left' | 'right' | 'auto';
89
+ type IdentityCollectionMode = 'progressive' | 'form' | 'none';
74
90
  interface IChatConfig {
75
91
  websocketUrl: string;
76
92
  conversationId?: string;
77
93
  apiKey: string;
78
- currentUser: IUser;
94
+ currentUser?: IUser;
79
95
  fileUpload?: IFileUploadConfig;
80
96
  httpApiUrl?: string;
81
97
  headers?: Record<string, string>;
@@ -89,17 +105,33 @@ interface IChatConfig {
89
105
  * @default false
90
106
  */
91
107
  disableWebSocket?: boolean;
108
+ theme?: IChatTheme;
109
+ position?: WidgetPosition;
110
+ identityCollection?: IdentityCollectionMode;
92
111
  onMessageSent?: (message: IMessage) => void;
93
112
  onMessageReceived?: (message: IMessage) => void;
94
113
  onConversationChange?: (conversation: IConversation) => void;
95
114
  onConnectionChange?: (connected: boolean) => void;
96
115
  onError?: (error: Error) => void;
116
+ onConversationRated?: (rating: 'positive' | 'negative') => void;
97
117
  toast?: {
98
118
  success: (message: string) => void;
99
119
  error: (message: string) => void;
100
120
  info: (message: string) => void;
101
121
  };
102
122
  }
123
+ interface UseMessagesReturn {
124
+ messages: IMessage[];
125
+ addMessage: (message: IMessage) => void;
126
+ updateMessageStatus: (messageId: string, status: IMessage['status']) => void;
127
+ clearMessages: () => void;
128
+ isLoading: boolean;
129
+ error: Error | null;
130
+ loadMore: () => Promise<void>;
131
+ hasMore: boolean;
132
+ isLoadingMore: boolean;
133
+ isBotThinking: boolean;
134
+ }
103
135
  interface IApiResponse<T> {
104
136
  success: boolean;
105
137
  data?: T;
@@ -115,26 +147,14 @@ interface IApiResponse<T> {
115
147
  interface ChatWidgetProps {
116
148
  config: IChatConfig;
117
149
  className?: string;
118
- /**
119
- * Variant of the chat widget:
120
- * - 'popover': Fixed positioned floating widget (default)
121
- * - 'fullPage': Full page layout that fills the container
122
- */
123
150
  variant?: 'popover' | 'fullPage';
124
- /**
125
- * External WebSocket connection (for agents with global connection)
126
- */
127
151
  externalWebSocket?: WebSocket | null;
128
- /**
129
- * Callback when user wants to minimize the widget
130
- */
131
152
  onMinimize?: () => void;
132
- /**
133
- * Callback when user wants to close the widget
134
- */
135
153
  onClose?: () => void;
154
+ /** Resolved position (left or right) from the parent Chat component */
155
+ resolvedPosition?: 'left' | 'right';
136
156
  }
137
- declare function ChatWidget({ config, className, variant, externalWebSocket, onMinimize, onClose, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
157
+ declare function ChatWidget({ config, className, variant, externalWebSocket, onMinimize, onClose, resolvedPosition, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
138
158
 
139
159
  type ChatWidgetState = 'open' | 'minimized' | 'closed' | 'undefined';
140
160
  interface UseChatWidgetStateOptions {
@@ -173,57 +193,25 @@ interface UseChatWidgetStateReturn {
173
193
  declare function useChatWidgetState({ state: controlledState, defaultState, onStateChange, }: UseChatWidgetStateOptions): UseChatWidgetStateReturn;
174
194
 
175
195
  interface ChatWidgetWrapperProps {
176
- /**
177
- * Base configuration for the chat widget (without user info and conversationId)
178
- */
179
- config: Omit<IChatConfig, 'currentUser' | 'conversationId' | 'userId'> & {
180
- currentUser?: Partial<IUser>;
196
+ config: Omit<IChatConfig, 'conversationId'> & {
181
197
  conversationId?: string;
182
198
  };
183
- /**
184
- * Custom className for the wrapper
185
- */
186
199
  className?: string;
187
- /**
188
- * Storage key prefix for persisting user data
189
- * Defaults to 'xcelsior_chat'
190
- */
191
200
  storageKeyPrefix?: string;
192
- /**
193
- * Callback when user submits the pre-chat form
194
- */
195
201
  onPreChatSubmit?: (user: IUser) => void;
196
- /**
197
- * Controlled state. When provided, the component is controlled.
198
- * - 'open': Fully open with chat interface
199
- * - 'minimized': Show bubble button only
200
- * - 'closed': Fully hidden
201
- */
202
202
  state?: ChatWidgetState;
203
- /**
204
- * Default state for uncontrolled mode
205
- * @default 'minimized'
206
- */
207
203
  defaultState?: ChatWidgetState;
208
- /**
209
- * Callback when state changes
210
- */
211
204
  onStateChange?: (state: ChatWidgetState) => void;
212
205
  }
213
- /**
214
- * Chat component that handles:
215
- * - Automatic conversation ID generation
216
- * - Pre-chat form for collecting user information
217
- * - Session persistence in localStorage
218
- */
219
206
  declare function Chat({ config, className, storageKeyPrefix, onPreChatSubmit, state, defaultState, onStateChange, }: ChatWidgetWrapperProps): react_jsx_runtime.JSX.Element | null;
220
207
 
221
208
  interface ChatHeaderProps {
222
209
  agent?: IUser;
223
210
  onClose?: () => void;
224
211
  onMinimize?: () => void;
212
+ theme?: IChatTheme;
225
213
  }
226
- declare function ChatHeader({ agent, onClose, onMinimize }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
214
+ declare function ChatHeader({ agent, onClose, onMinimize, theme }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
227
215
 
228
216
  interface UseFileUploadReturn {
229
217
  uploadFile: (file: File) => Promise<IUploadedFile | null>;
@@ -243,13 +231,30 @@ interface ChatInputProps {
243
231
  }
244
232
  declare function ChatInput({ onSend, onTyping, config, fileUpload, disabled, }: ChatInputProps): react_jsx_runtime.JSX.Element;
245
233
 
234
+ interface MarkdownMessageProps {
235
+ content: string;
236
+ theme?: IChatTheme;
237
+ }
238
+ declare function MarkdownMessage({ content, theme }: MarkdownMessageProps): react_jsx_runtime.JSX.Element;
239
+
246
240
  interface MessageItemProps {
247
241
  message: IMessage;
248
242
  currentUser: IUser;
249
243
  showAvatar?: boolean;
250
244
  showTimestamp?: boolean;
245
+ theme?: IChatTheme;
251
246
  }
252
- declare function MessageItem({ message, currentUser, showAvatar, showTimestamp, }: MessageItemProps): react_jsx_runtime.JSX.Element;
247
+ declare function MessageItem({ message, currentUser, showAvatar, showTimestamp, theme, }: MessageItemProps): react_jsx_runtime.JSX.Element;
248
+
249
+ interface ThinkingIndicatorProps {
250
+ /** Last message the user sent — used to pick contextual phrases */
251
+ lastUserMessage?: string;
252
+ /** Chat theme for color matching */
253
+ theme?: IChatTheme;
254
+ /** Show avatar next to the indicator */
255
+ showAvatar?: boolean;
256
+ }
257
+ declare function ThinkingIndicator({ lastUserMessage, theme, showAvatar, }: ThinkingIndicatorProps): react_jsx_runtime.JSX.Element;
253
258
 
254
259
  interface MessageListProps {
255
260
  messages: IMessage[];
@@ -261,8 +266,13 @@ interface MessageListProps {
261
266
  onLoadMore?: () => void;
262
267
  hasMore?: boolean;
263
268
  isLoadingMore?: boolean;
269
+ theme?: IChatTheme;
270
+ /** Called when a quick-start action button is clicked — sends the text as a message */
271
+ onQuickAction?: (text: string) => void;
272
+ /** True when user sent a message and bot response hasn't arrived yet */
273
+ isBotThinking?: boolean;
264
274
  }
265
- declare function MessageList({ messages, currentUser, isLoading, isTyping, typingUser, autoScroll, onLoadMore, hasMore, isLoadingMore, }: MessageListProps): react_jsx_runtime.JSX.Element;
275
+ declare function MessageList({ messages, currentUser, isLoading, isTyping, typingUser, autoScroll, onLoadMore, hasMore, isLoadingMore, theme, onQuickAction, isBotThinking, }: MessageListProps): react_jsx_runtime.JSX.Element;
266
276
 
267
277
  interface TypingIndicatorProps {
268
278
  isTyping: boolean;
@@ -285,7 +295,8 @@ interface PreChatFormProps {
285
295
  onClose: () => void;
286
296
  }
287
297
  /**
288
- * PreChatForm component for collecting user information before starting chat
298
+ * PreChatForm component for collecting user information before starting chat.
299
+ * Styled to match the Xcelsior website design system.
289
300
  */
290
301
  declare function PreChatForm({ onSubmit, className, initialName, initialEmail, onMinimize, onClose, }: PreChatFormProps): react_jsx_runtime.JSX.Element;
291
302
 
@@ -302,17 +313,6 @@ interface UseWebSocketReturn {
302
313
  */
303
314
  declare function useWebSocket(config: IChatConfig, externalWebSocket?: WebSocket | null): UseWebSocketReturn;
304
315
 
305
- interface UseMessagesReturn {
306
- messages: IMessage[];
307
- addMessage: (message: IMessage) => void;
308
- updateMessageStatus: (messageId: string, status: IMessage['status']) => void;
309
- clearMessages: () => void;
310
- isLoading: boolean;
311
- error: Error | null;
312
- loadMore: () => Promise<void>;
313
- hasMore: boolean;
314
- isLoadingMore: boolean;
315
- }
316
316
  declare function useMessages(websocket: UseWebSocketReturn, config: IChatConfig): UseMessagesReturn;
317
317
 
318
318
  interface UseTypingIndicatorReturn {
@@ -334,4 +334,4 @@ declare function fetchMessages(baseUrl: string, params: FetchMessagesParams, hea
334
334
  nextPageToken: string | undefined;
335
335
  }>;
336
336
 
337
- export { Chat, ChatHeader, ChatInput, ChatWidget, type ChatWidgetProps, type ChatWidgetState, type ConversationChannel, type ConversationPriority, type ConversationStatus, type IApiResponse, type IChatConfig, type IConversation, type IFileUploadConfig, type IMessage, type IReadMessageData, type ISendMessageData, type ITypingData, type IUploadedFile, type IUser, type IWebSocketMessage, MessageItem, MessageList, type MessageStatus, type MessageType, PreChatForm, TypingIndicator, type UseChatWidgetStateOptions, type UseChatWidgetStateReturn, fetchMessages, useChatWidgetState, useFileUpload, useMessages, useTypingIndicator, useWebSocket };
337
+ export { Chat, ChatHeader, ChatInput, ChatWidget, type ChatWidgetProps, type ChatWidgetState, type ConversationChannel, type ConversationPriority, type ConversationStatus, type IApiResponse, type IChatConfig, type IConversation, type IFileUploadConfig, type IMessage, type IReadMessageData, type ISendMessageData, type ITypingData, type IUploadedFile, type IUser, type IWebSocketMessage, MarkdownMessage, MessageItem, MessageList, type MessageStatus, type MessageType, PreChatForm, ThinkingIndicator, type ThinkingIndicatorProps, TypingIndicator, type UseChatWidgetStateOptions, type UseChatWidgetStateReturn, type UseMessagesReturn, fetchMessages, useChatWidgetState, useFileUpload, useMessages, useTypingIndicator, useWebSocket };
package/dist/index.d.ts CHANGED
@@ -13,14 +13,16 @@ interface IMessage {
13
13
  id: string;
14
14
  conversationId: string;
15
15
  senderId: string;
16
- senderType: 'customer' | 'agent' | 'system';
16
+ senderType: 'customer' | 'agent' | 'bot' | 'system';
17
17
  content: string;
18
18
  messageType: MessageType;
19
19
  createdAt: string;
20
20
  status: MessageStatus;
21
+ feedback?: 'good' | 'wrong' | 'corrected' | null;
22
+ confidence?: number | null;
21
23
  metadata?: Record<string, unknown>;
22
24
  }
23
- type ConversationStatus = 'open' | 'pending' | 'closed' | 'archived';
25
+ type ConversationStatus = 'open' | 'pending' | 'closed' | 'archived' | 'bot_handling' | 'pending_agent' | 'agent_active';
24
26
  type ConversationPriority = 'low' | 'medium' | 'high' | 'urgent';
25
27
  type ConversationChannel = 'web' | 'mobile' | 'email';
26
28
  interface IConversation {
@@ -42,7 +44,7 @@ interface IConversation {
42
44
  metadata?: Record<string, unknown>;
43
45
  }
44
46
  interface IWebSocketMessage {
45
- type: 'message' | 'typing' | 'read' | 'connected' | 'error' | 'system';
47
+ type: 'message' | 'typing' | 'read' | 'connected' | 'error' | 'system' | 'escalation_requested' | 'bot_response' | 'conversation_updated';
46
48
  data: any;
47
49
  }
48
50
  interface ISendMessageData {
@@ -71,11 +73,25 @@ interface IUploadedFile {
71
73
  type: string;
72
74
  markdown?: string;
73
75
  }
76
+ interface IChatTheme {
77
+ primary?: string;
78
+ primaryStrong?: string;
79
+ background?: string;
80
+ backgroundAlt?: string;
81
+ text?: string;
82
+ textMuted?: string;
83
+ statusPositive?: string;
84
+ statusCaution?: string;
85
+ statusNegative?: string;
86
+ borderColor?: string;
87
+ }
88
+ type WidgetPosition = 'left' | 'right' | 'auto';
89
+ type IdentityCollectionMode = 'progressive' | 'form' | 'none';
74
90
  interface IChatConfig {
75
91
  websocketUrl: string;
76
92
  conversationId?: string;
77
93
  apiKey: string;
78
- currentUser: IUser;
94
+ currentUser?: IUser;
79
95
  fileUpload?: IFileUploadConfig;
80
96
  httpApiUrl?: string;
81
97
  headers?: Record<string, string>;
@@ -89,17 +105,33 @@ interface IChatConfig {
89
105
  * @default false
90
106
  */
91
107
  disableWebSocket?: boolean;
108
+ theme?: IChatTheme;
109
+ position?: WidgetPosition;
110
+ identityCollection?: IdentityCollectionMode;
92
111
  onMessageSent?: (message: IMessage) => void;
93
112
  onMessageReceived?: (message: IMessage) => void;
94
113
  onConversationChange?: (conversation: IConversation) => void;
95
114
  onConnectionChange?: (connected: boolean) => void;
96
115
  onError?: (error: Error) => void;
116
+ onConversationRated?: (rating: 'positive' | 'negative') => void;
97
117
  toast?: {
98
118
  success: (message: string) => void;
99
119
  error: (message: string) => void;
100
120
  info: (message: string) => void;
101
121
  };
102
122
  }
123
+ interface UseMessagesReturn {
124
+ messages: IMessage[];
125
+ addMessage: (message: IMessage) => void;
126
+ updateMessageStatus: (messageId: string, status: IMessage['status']) => void;
127
+ clearMessages: () => void;
128
+ isLoading: boolean;
129
+ error: Error | null;
130
+ loadMore: () => Promise<void>;
131
+ hasMore: boolean;
132
+ isLoadingMore: boolean;
133
+ isBotThinking: boolean;
134
+ }
103
135
  interface IApiResponse<T> {
104
136
  success: boolean;
105
137
  data?: T;
@@ -115,26 +147,14 @@ interface IApiResponse<T> {
115
147
  interface ChatWidgetProps {
116
148
  config: IChatConfig;
117
149
  className?: string;
118
- /**
119
- * Variant of the chat widget:
120
- * - 'popover': Fixed positioned floating widget (default)
121
- * - 'fullPage': Full page layout that fills the container
122
- */
123
150
  variant?: 'popover' | 'fullPage';
124
- /**
125
- * External WebSocket connection (for agents with global connection)
126
- */
127
151
  externalWebSocket?: WebSocket | null;
128
- /**
129
- * Callback when user wants to minimize the widget
130
- */
131
152
  onMinimize?: () => void;
132
- /**
133
- * Callback when user wants to close the widget
134
- */
135
153
  onClose?: () => void;
154
+ /** Resolved position (left or right) from the parent Chat component */
155
+ resolvedPosition?: 'left' | 'right';
136
156
  }
137
- declare function ChatWidget({ config, className, variant, externalWebSocket, onMinimize, onClose, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
157
+ declare function ChatWidget({ config, className, variant, externalWebSocket, onMinimize, onClose, resolvedPosition, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
138
158
 
139
159
  type ChatWidgetState = 'open' | 'minimized' | 'closed' | 'undefined';
140
160
  interface UseChatWidgetStateOptions {
@@ -173,57 +193,25 @@ interface UseChatWidgetStateReturn {
173
193
  declare function useChatWidgetState({ state: controlledState, defaultState, onStateChange, }: UseChatWidgetStateOptions): UseChatWidgetStateReturn;
174
194
 
175
195
  interface ChatWidgetWrapperProps {
176
- /**
177
- * Base configuration for the chat widget (without user info and conversationId)
178
- */
179
- config: Omit<IChatConfig, 'currentUser' | 'conversationId' | 'userId'> & {
180
- currentUser?: Partial<IUser>;
196
+ config: Omit<IChatConfig, 'conversationId'> & {
181
197
  conversationId?: string;
182
198
  };
183
- /**
184
- * Custom className for the wrapper
185
- */
186
199
  className?: string;
187
- /**
188
- * Storage key prefix for persisting user data
189
- * Defaults to 'xcelsior_chat'
190
- */
191
200
  storageKeyPrefix?: string;
192
- /**
193
- * Callback when user submits the pre-chat form
194
- */
195
201
  onPreChatSubmit?: (user: IUser) => void;
196
- /**
197
- * Controlled state. When provided, the component is controlled.
198
- * - 'open': Fully open with chat interface
199
- * - 'minimized': Show bubble button only
200
- * - 'closed': Fully hidden
201
- */
202
202
  state?: ChatWidgetState;
203
- /**
204
- * Default state for uncontrolled mode
205
- * @default 'minimized'
206
- */
207
203
  defaultState?: ChatWidgetState;
208
- /**
209
- * Callback when state changes
210
- */
211
204
  onStateChange?: (state: ChatWidgetState) => void;
212
205
  }
213
- /**
214
- * Chat component that handles:
215
- * - Automatic conversation ID generation
216
- * - Pre-chat form for collecting user information
217
- * - Session persistence in localStorage
218
- */
219
206
  declare function Chat({ config, className, storageKeyPrefix, onPreChatSubmit, state, defaultState, onStateChange, }: ChatWidgetWrapperProps): react_jsx_runtime.JSX.Element | null;
220
207
 
221
208
  interface ChatHeaderProps {
222
209
  agent?: IUser;
223
210
  onClose?: () => void;
224
211
  onMinimize?: () => void;
212
+ theme?: IChatTheme;
225
213
  }
226
- declare function ChatHeader({ agent, onClose, onMinimize }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
214
+ declare function ChatHeader({ agent, onClose, onMinimize, theme }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
227
215
 
228
216
  interface UseFileUploadReturn {
229
217
  uploadFile: (file: File) => Promise<IUploadedFile | null>;
@@ -243,13 +231,30 @@ interface ChatInputProps {
243
231
  }
244
232
  declare function ChatInput({ onSend, onTyping, config, fileUpload, disabled, }: ChatInputProps): react_jsx_runtime.JSX.Element;
245
233
 
234
+ interface MarkdownMessageProps {
235
+ content: string;
236
+ theme?: IChatTheme;
237
+ }
238
+ declare function MarkdownMessage({ content, theme }: MarkdownMessageProps): react_jsx_runtime.JSX.Element;
239
+
246
240
  interface MessageItemProps {
247
241
  message: IMessage;
248
242
  currentUser: IUser;
249
243
  showAvatar?: boolean;
250
244
  showTimestamp?: boolean;
245
+ theme?: IChatTheme;
251
246
  }
252
- declare function MessageItem({ message, currentUser, showAvatar, showTimestamp, }: MessageItemProps): react_jsx_runtime.JSX.Element;
247
+ declare function MessageItem({ message, currentUser, showAvatar, showTimestamp, theme, }: MessageItemProps): react_jsx_runtime.JSX.Element;
248
+
249
+ interface ThinkingIndicatorProps {
250
+ /** Last message the user sent — used to pick contextual phrases */
251
+ lastUserMessage?: string;
252
+ /** Chat theme for color matching */
253
+ theme?: IChatTheme;
254
+ /** Show avatar next to the indicator */
255
+ showAvatar?: boolean;
256
+ }
257
+ declare function ThinkingIndicator({ lastUserMessage, theme, showAvatar, }: ThinkingIndicatorProps): react_jsx_runtime.JSX.Element;
253
258
 
254
259
  interface MessageListProps {
255
260
  messages: IMessage[];
@@ -261,8 +266,13 @@ interface MessageListProps {
261
266
  onLoadMore?: () => void;
262
267
  hasMore?: boolean;
263
268
  isLoadingMore?: boolean;
269
+ theme?: IChatTheme;
270
+ /** Called when a quick-start action button is clicked — sends the text as a message */
271
+ onQuickAction?: (text: string) => void;
272
+ /** True when user sent a message and bot response hasn't arrived yet */
273
+ isBotThinking?: boolean;
264
274
  }
265
- declare function MessageList({ messages, currentUser, isLoading, isTyping, typingUser, autoScroll, onLoadMore, hasMore, isLoadingMore, }: MessageListProps): react_jsx_runtime.JSX.Element;
275
+ declare function MessageList({ messages, currentUser, isLoading, isTyping, typingUser, autoScroll, onLoadMore, hasMore, isLoadingMore, theme, onQuickAction, isBotThinking, }: MessageListProps): react_jsx_runtime.JSX.Element;
266
276
 
267
277
  interface TypingIndicatorProps {
268
278
  isTyping: boolean;
@@ -285,7 +295,8 @@ interface PreChatFormProps {
285
295
  onClose: () => void;
286
296
  }
287
297
  /**
288
- * PreChatForm component for collecting user information before starting chat
298
+ * PreChatForm component for collecting user information before starting chat.
299
+ * Styled to match the Xcelsior website design system.
289
300
  */
290
301
  declare function PreChatForm({ onSubmit, className, initialName, initialEmail, onMinimize, onClose, }: PreChatFormProps): react_jsx_runtime.JSX.Element;
291
302
 
@@ -302,17 +313,6 @@ interface UseWebSocketReturn {
302
313
  */
303
314
  declare function useWebSocket(config: IChatConfig, externalWebSocket?: WebSocket | null): UseWebSocketReturn;
304
315
 
305
- interface UseMessagesReturn {
306
- messages: IMessage[];
307
- addMessage: (message: IMessage) => void;
308
- updateMessageStatus: (messageId: string, status: IMessage['status']) => void;
309
- clearMessages: () => void;
310
- isLoading: boolean;
311
- error: Error | null;
312
- loadMore: () => Promise<void>;
313
- hasMore: boolean;
314
- isLoadingMore: boolean;
315
- }
316
316
  declare function useMessages(websocket: UseWebSocketReturn, config: IChatConfig): UseMessagesReturn;
317
317
 
318
318
  interface UseTypingIndicatorReturn {
@@ -334,4 +334,4 @@ declare function fetchMessages(baseUrl: string, params: FetchMessagesParams, hea
334
334
  nextPageToken: string | undefined;
335
335
  }>;
336
336
 
337
- export { Chat, ChatHeader, ChatInput, ChatWidget, type ChatWidgetProps, type ChatWidgetState, type ConversationChannel, type ConversationPriority, type ConversationStatus, type IApiResponse, type IChatConfig, type IConversation, type IFileUploadConfig, type IMessage, type IReadMessageData, type ISendMessageData, type ITypingData, type IUploadedFile, type IUser, type IWebSocketMessage, MessageItem, MessageList, type MessageStatus, type MessageType, PreChatForm, TypingIndicator, type UseChatWidgetStateOptions, type UseChatWidgetStateReturn, fetchMessages, useChatWidgetState, useFileUpload, useMessages, useTypingIndicator, useWebSocket };
337
+ export { Chat, ChatHeader, ChatInput, ChatWidget, type ChatWidgetProps, type ChatWidgetState, type ConversationChannel, type ConversationPriority, type ConversationStatus, type IApiResponse, type IChatConfig, type IConversation, type IFileUploadConfig, type IMessage, type IReadMessageData, type ISendMessageData, type ITypingData, type IUploadedFile, type IUser, type IWebSocketMessage, MarkdownMessage, MessageItem, MessageList, type MessageStatus, type MessageType, PreChatForm, ThinkingIndicator, type ThinkingIndicatorProps, TypingIndicator, type UseChatWidgetStateOptions, type UseChatWidgetStateReturn, type UseMessagesReturn, fetchMessages, useChatWidgetState, useFileUpload, useMessages, useTypingIndicator, useWebSocket };