@elqnt/chat 1.0.1 → 1.0.2

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 (39) hide show
  1. package/dist/chunk-3PXNBY7J.js +73 -0
  2. package/dist/chunk-3PXNBY7J.js.map +1 -0
  3. package/dist/chunk-AC5J5LX5.mjs +529 -0
  4. package/dist/chunk-AC5J5LX5.mjs.map +1 -0
  5. package/dist/chunk-DTFTLFSY.js +637 -0
  6. package/dist/chunk-DTFTLFSY.js.map +1 -0
  7. package/dist/chunk-E2FJX52R.js +529 -0
  8. package/dist/chunk-E2FJX52R.js.map +1 -0
  9. package/dist/chunk-F6OOS4ZM.mjs +637 -0
  10. package/dist/chunk-F6OOS4ZM.mjs.map +1 -0
  11. package/dist/chunk-XVYABY2Z.mjs +73 -0
  12. package/dist/chunk-XVYABY2Z.mjs.map +1 -0
  13. package/dist/hooks/use-websocket-chat-admin.d.mts +16 -0
  14. package/dist/hooks/use-websocket-chat-admin.d.ts +16 -0
  15. package/dist/hooks/use-websocket-chat-admin.js +9 -0
  16. package/dist/hooks/use-websocket-chat-admin.js.map +1 -0
  17. package/dist/hooks/use-websocket-chat-admin.mjs +9 -0
  18. package/dist/hooks/use-websocket-chat-admin.mjs.map +1 -0
  19. package/dist/hooks/use-websocket-chat-base.d.mts +4 -0
  20. package/dist/hooks/use-websocket-chat-base.d.ts +4 -0
  21. package/dist/hooks/use-websocket-chat-base.js +8 -0
  22. package/dist/hooks/use-websocket-chat-base.js.map +1 -0
  23. package/dist/hooks/use-websocket-chat-base.mjs +8 -0
  24. package/dist/hooks/use-websocket-chat-base.mjs.map +1 -0
  25. package/dist/hooks/use-websocket-chat-customer.d.mts +23 -0
  26. package/dist/hooks/use-websocket-chat-customer.d.ts +23 -0
  27. package/dist/hooks/use-websocket-chat-customer.js +9 -0
  28. package/dist/hooks/use-websocket-chat-customer.js.map +1 -0
  29. package/dist/hooks/use-websocket-chat-customer.mjs +9 -0
  30. package/dist/hooks/use-websocket-chat-customer.mjs.map +1 -0
  31. package/dist/index.d.mts +10 -1015
  32. package/dist/index.d.ts +10 -1015
  33. package/dist/index.js +616 -1710
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +198 -1063
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/use-websocket-chat-base-CZDONnTz.d.mts +989 -0
  38. package/dist/use-websocket-chat-base-CZDONnTz.d.ts +989 -0
  39. package/package.json +16 -1
package/dist/index.d.mts CHANGED
@@ -1,8 +1,14 @@
1
1
  import React$1 from 'react';
2
- import { KGNode } from '@elqnt/kg';
3
- import { Variable, ResponseMetadata, ProductNameTS } from '@elqnt/types';
4
- import { DocumentAnalysisResult, BoundingRegion, PageInfo } from '@elqnt/docs';
2
+ import { C as Chat, a as ChatMessage } from './use-websocket-chat-base-CZDONnTz.mjs';
3
+ export { bP as Action, d1 as AgentQueue, P as AgentSession, J as AgentStatus, M as AgentStatusAway, N as AgentStatusBusy, O as AgentStatusOffline, K as AgentStatusOnline, I as AgentStatusTS, ci as AssignChatToAgentRequest, cj as AssignChatToAgentResponse, dn as AssignChatToAgentSubject, bO as Attachment, bu as AttachmentFile, bv as AttachmentType, bG as AttachmentTypeActions, bE as AttachmentTypeArticles, bz as AttachmentTypeAudio, bH as AttachmentTypeBullets, bJ as AttachmentTypeData, bw as AttachmentTypeDocument, bx as AttachmentTypeDocumentAnalysis, bL as AttachmentTypeDocumentSources, by as AttachmentTypeImage, bK as AttachmentTypeKGNodes, bB as AttachmentTypeLocation, bF as AttachmentTypeRecords, bC as AttachmentTypeReferences, bI as AttachmentTypeSticker, bD as AttachmentTypeSubsections, bM as AttachmentTypeTS, bA as AttachmentTypeVideo, c8 as ChatArchivalRequest, c9 as ChatArchivalResponse, di as ChatArchiveSubjectPattern, s as ChatContext, bQ as ChatEvent, S as ChatEventType, aV as ChatEventTypeAgentActivityPing, aW as ChatEventTypeAgentChatAssigned, aX as ChatEventTypeAgentChatCompleted, b4 as ChatEventTypeAgentContextUpdate, b6 as ChatEventTypeAgentExecutionEnded, b5 as ChatEventTypeAgentExecutionStarted, aT as ChatEventTypeAgentSessionEnd, aS as ChatEventTypeAgentSessionStart, aU as ChatEventTypeAgentStatusChange, ak as ChatEventTypeBlockUser, a_ as ChatEventTypeCSATRequest, b0 as ChatEventTypeCSATResponse, a$ as ChatEventTypeCSATSurvey, aR as ChatEventTypeChatEnded, ad as ChatEventTypeChatRemoved, ac as ChatEventTypeChatUpdated, ai as ChatEventTypeClientAction, aj as ChatEventTypeClientActionCallback, al as ChatEventTypeCreateRoom, ap as ChatEventTypeDeleteRoom, _ as ChatEventTypeDelivered, aQ as ChatEventTypeEndChat, a0 as ChatEventTypeError, aY as ChatEventTypeGetAgents, aZ as ChatEventTypeGetAgentsResponse, aO as ChatEventTypeGetOnlineUsers, a7 as ChatEventTypeHumanAgentJoined, a8 as ChatEventTypeHumanAgentLeft, at as ChatEventTypeInviteUser, an as ChatEventTypeJoinRoom, ao as ChatEventTypeLeaveRoom, ab as ChatEventTypeListChats, ay as ChatEventTypeListRooms, b7 as ChatEventTypeLoadAgentContext, b8 as ChatEventTypeLoadAgentContextResponse, a2 as ChatEventTypeLoadChat, a3 as ChatEventTypeLoadChatResponse, aE as ChatEventTypeMentionUser, a4 as ChatEventTypeMessage, aB as ChatEventTypeMessageDeleted, aG as ChatEventTypeMessageDeletedResponse, aA as ChatEventTypeMessageEdited, aF as ChatEventTypeMessageEditedResponse, aC as ChatEventTypeMessageReaction, aH as ChatEventTypeMessageReactionResponse, aD as ChatEventTypeMessageReply, a6 as ChatEventTypeMessageStatusUpdate, bg as ChatEventTypeNewChat, bh as ChatEventTypeNewChatCreated, a9 as ChatEventTypeObserverJoined, aa as ChatEventTypeObserverLeft, aP as ChatEventTypeOnlineUsersResponse, bi as ChatEventTypePing, ba as ChatEventTypePlanApproved, bc as ChatEventTypePlanCompleted, b9 as ChatEventTypePlanPendingApproval, bb as ChatEventTypePlanRejected, bj as ChatEventTypePong, Z as ChatEventTypeRead, $ as ChatEventTypeReconnected, am as ChatEventTypeRoomCreated, aq as ChatEventTypeRoomDeleted, as as ChatEventTypeRoomUpdated, av as ChatEventTypeRoomUserJoined, aw as ChatEventTypeRoomUserLeft, az as ChatEventTypeRoomsResponse, be as ChatEventTypeStepCompleted, bf as ChatEventTypeStepFailed, bd as ChatEventTypeStepStarted, Y as ChatEventTypeStoppedTyping, b3 as ChatEventTypeSummaryUpdate, ae as ChatEventTypeSyncMetadata, af as ChatEventTypeSyncMetadataResponse, ag as ChatEventTypeSyncUserSession, ah as ChatEventTypeSyncUserSessionResponse, bk as ChatEventTypeTS, X as ChatEventTypeTyping, ar as ChatEventTypeUpdateRoom, aL as ChatEventTypeUserActivity, aN as ChatEventTypeUserActivityUpdate, au as ChatEventTypeUserInvited, T as ChatEventTypeUserJoined, V as ChatEventTypeUserLeft, aM as ChatEventTypeUserPresenceChanged, aJ as ChatEventTypeUserPresenceEnd, aI as ChatEventTypeUserPresenceStart, ax as ChatEventTypeUserRemoved, aK as ChatEventTypeUserStatusChange, b2 as ChatEventTypeUserSuggestedActionSelected, b1 as ChatEventTypeUserSuggestedActions, a1 as ChatEventTypeWaiting, a5 as ChatEventTypeWaitingForAgent, t as ChatFlow, bR as ChatGrading, c7 as ChatProductReference, db as ChatQueueInfo, bY as ChatRateLimits, x as ChatRole, z as ChatRoleAI, E as ChatRoleDataQuery, A as ChatRoleEvent, B as ChatRoleHumanAgent, D as ChatRoleObserver, F as ChatRoleSystem, w as ChatRoleTS, G as ChatRoleTool, y as ChatRoleUser, bS as ChatSession, bX as ChatSessionPreferences, bT as ChatSessionStatus, bU as ChatSessionStatusActive, bW as ChatSessionStatusExpired, bV as ChatSessionStatusIdle, f as ChatStatus, i as ChatStatusAbandoned, g as ChatStatusActive, k as ChatStatusArchived, j as ChatStatusClosed, h as ChatStatusDisconnected, e as ChatStatusTS, c4 as ChatSummary, v as ChatTool, m as ChatType, n as ChatTypeCustomerSupport, q as ChatTypeDirect, r as ChatTypeGroup, p as ChatTypePrivateRoom, o as ChatTypePublicRoom, l as ChatTypeTS, H as ChatUser, ck as CompleteChatByAgentRequest, cl as CompleteChatByAgentResponse, dp as CompleteChatByAgentSubject, c as ConnectionMetrics, b as ConnectionState, d3 as CreateAgentQueueRequest, d4 as CreateAgentQueueResponse, dt as CreateAgentQueueSubject, d9 as DeleteAgentQueueRequest, da as DeleteAgentQueueResponse, dw as DeleteAgentQueueSubject, bN as DocumentSource, bs as EmojiReaction, cc as EndAgentSessionRequest, cd as EndAgentSessionResponse, dk as EndAgentSessionSubject, cJ as GetActiveChatCountRequest, cK as GetActiveChatCountResponse, dd as GetActiveChatCountSubject, cL as GetActiveChatsRequest, cM as GetActiveChatsResponse, df as GetActiveChatsSubject, d2 as GetAgentQueuesFilter, d5 as GetAgentQueuesRequest, d6 as GetAgentQueuesResponse, du as GetAgentQueuesSubject, cm as GetAgentSessionRequest, cn as GetAgentSessionResponse, dq as GetAgentSessionSubject, c5 as GetChatRequest, c6 as GetChatResponse, dh as GetChatSubject, cT as GetDailyChatCountRequest, cU as GetDailyChatCountResponse, dz as GetDailyChatCountSubject, cq as GetOnlineAgentCountRequest, cr as GetOnlineAgentCountResponse, ds as GetOnlineAgentCountSubject, co as GetOnlineAgentsRequest, cp as GetOnlineAgentsResponse, dr as GetOnlineAgentsSubject, cF as GetOnlineUsersRequest, cG as GetOnlineUsersResponse, dB as GetOnlineUsersSubject, cu as GetQueueChatCountRequest, cv as GetQueueChatCountResponse, dy as GetQueueChatCountSubject, cs as GetQueueChatsRequest, ct as GetQueueChatsResponse, dx as GetQueueChatsSubject, cR as GetUserChatsRequest, cS as GetUserChatsResponse, dg as GetUserChatsSubject, cN as GetWaitingForAgentChatCountRequest, cO as GetWaitingForAgentChatCountResponse, dc as GetWaitingForAgentChatCountSubject, cP as GetWaitingForAgentChatsRequest, cQ as GetWaitingForAgentChatsResponse, de as GetWaitingForAgentChatsSubject, bZ as LLMConfig, c0 as LLMFunction, b_ as LLMMemoryConfig, c2 as LLMResponse, b$ as LLMTool, c3 as LLMUsage, bt as Location, L as Logger, bl as MessageStatus, bo as MessageStatusDelivered, bq as MessageStatusFailed, bp as MessageStatusRead, bm as MessageStatusSending, bn as MessageStatusSent, br as MessageStatusTS, Q as QueueConfig, cY as QueueType, d0 as QueueTypeComplexity, c$ as QueueTypeDepartment, cX as QueueTypeOptionTS, c_ as QueueTypePriority, cZ as QueueTypeSkill, cW as QueueTypeTS, cV as QueueTypes, R as RetryConfig, dD as SetupOrgSubject, ca as StartAgentSessionRequest, cb as StartAgentSessionResponse, dj as StartAgentSessionSubject, c1 as ToolCall, cH as TriggerAnalyticsScanRequest, cI as TriggerAnalyticsScanResponse, dC as TriggerAnalyticsScanSubject, cg as UpdateAgentLastActivityRequest, ch as UpdateAgentLastActivityResponse, dm as UpdateAgentLastActivitySubject, d7 as UpdateAgentQueueRequest, d8 as UpdateAgentQueueResponse, dv as UpdateAgentQueueSubject, ce as UpdateAgentStatusRequest, cf as UpdateAgentStatusResponse, dl as UpdateAgentStatusSubject, cD as UpdateUserStatusRequest, cE as UpdateUserStatusResponse, dA as UpdateUserStatusSubject, U as UseWebSocketChatBaseConfig, d as UseWebSocketChatBaseReturn, cC as UserSession, cx as UserStatus, cz as UserStatusAway, cA as UserStatusBusy, cB as UserStatusOffline, cy as UserStatusOnline, cw as UserStatusTS, W as WebSocketError, u as useWebSocketChatBase } from './use-websocket-chat-base-CZDONnTz.mjs';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ProductNameTS } from '@elqnt/types';
6
+ import { UseWebSocketChatCustomerReturn } from './hooks/use-websocket-chat-customer.mjs';
7
+ export { UseWebSocketChatCustomerConfig, useWebSocketChatCustomer } from './hooks/use-websocket-chat-customer.mjs';
8
+ import { UseWebSocketChatAdminReturn } from './hooks/use-websocket-chat-admin.mjs';
9
+ export { useWebSocketChatAdmin } from './hooks/use-websocket-chat-admin.mjs';
10
+ import '@elqnt/kg';
11
+ import '@elqnt/docs';
6
12
 
7
13
  interface AdminChatInputProps {
8
14
  onFileUpload?: (file: File) => Promise<string>;
@@ -14,926 +20,6 @@ interface ChatHumanAgentActionsProps {
14
20
  }
15
21
  declare const ChatHumanAgentActions: React$1.FC<ChatHumanAgentActionsProps>;
16
22
 
17
- type ChatStatusTS = 'active' | 'disconnected' | 'abandoned' | 'closed' | 'archived';
18
- type ChatStatus = string;
19
- declare const ChatStatusActive: ChatStatus;
20
- declare const ChatStatusDisconnected: ChatStatus;
21
- declare const ChatStatusAbandoned: ChatStatus;
22
- declare const ChatStatusClosed: ChatStatus;
23
- declare const ChatStatusArchived: ChatStatus;
24
- type ChatTypeTS = 'customer_support' | 'public_room' | 'private_room' | 'direct' | 'group';
25
- type ChatType = string;
26
- declare const ChatTypeCustomerSupport: ChatType;
27
- declare const ChatTypePublicRoom: ChatType;
28
- declare const ChatTypePrivateRoom: ChatType;
29
- declare const ChatTypeDirect: ChatType;
30
- declare const ChatTypeGroup: ChatType;
31
- interface Chat {
32
- orgId: string;
33
- key: string;
34
- title: string;
35
- messages: ChatMessage[];
36
- lastUpdated: number;
37
- startTime: number;
38
- users: ChatUser[];
39
- status: ChatStatusTS;
40
- aiEngaged: boolean;
41
- humanAgentEngaged: boolean;
42
- isWaiting: boolean;
43
- isWaitingForAgent: boolean;
44
- callRequested?: boolean;
45
- callStarted?: boolean;
46
- userRating?: number;
47
- metadata?: {
48
- [key: string]: any;
49
- };
50
- grading?: ChatGrading;
51
- flow?: ChatFlow;
52
- context?: ChatContext;
53
- csatSent?: boolean;
54
- csatSentTime?: number;
55
- csatResponse?: any;
56
- /**
57
- * OpenAI Responses API - stores the last response ID for conversation continuity
58
- */
59
- lastResponseId?: string;
60
- /**
61
- * AgentContext - reference to structured context stored in separate NATS KV bucket
62
- * Key format: {agentId}:{chatKey} in bucket agent-contexts-org-{orgId}
63
- */
64
- agentContextKey?: string;
65
- /**
66
- * Collab-specific fields
67
- */
68
- chatType?: ChatTypeTS;
69
- description?: string;
70
- }
71
- interface ChatContext {
72
- memory: {
73
- [key: string]: any;
74
- };
75
- turnCount: number;
76
- lastIntent: string;
77
- activeTopic: string;
78
- }
79
- interface ChatFlow {
80
- flowDefinitionId: string;
81
- flowInstanceId?: string;
82
- flowInstanceLastUpdated?: number;
83
- tools?: ChatTool[];
84
- }
85
- interface ChatTool {
86
- name: string;
87
- description: string;
88
- type: string;
89
- parameters?: {
90
- [key: string]: any;
91
- };
92
- }
93
- type ChatRoleTS = 'user' | 'ai' | 'event' | 'humanAgent' | 'observer' | 'dataQuery' | 'system' | 'tool';
94
- type ChatRole = string;
95
- declare const ChatRoleUser: ChatRole;
96
- declare const ChatRoleAI: ChatRole;
97
- declare const ChatRoleEvent: ChatRole;
98
- declare const ChatRoleHumanAgent: ChatRole;
99
- declare const ChatRoleObserver: ChatRole;
100
- declare const ChatRoleDataQuery: ChatRole;
101
- declare const ChatRoleSystem: ChatRole;
102
- declare const ChatRoleTool: ChatRole;
103
- interface ChatUser {
104
- id: string;
105
- role: ChatRoleTS;
106
- name: string;
107
- email: string;
108
- phone?: string;
109
- authProvider: string;
110
- authToken: string;
111
- metadata?: {
112
- [key: string]: any;
113
- };
114
- }
115
- type AgentStatusTS = 'online' | 'away' | 'busy' | 'offline';
116
- type AgentStatus = string;
117
- declare const AgentStatusOnline: AgentStatus;
118
- declare const AgentStatusAway: AgentStatus;
119
- declare const AgentStatusBusy: AgentStatus;
120
- declare const AgentStatusOffline: AgentStatus;
121
- /**
122
- * AgentSession represents an active agent session stored in Redis
123
- */
124
- interface AgentSession {
125
- agentId: string;
126
- orgId: string;
127
- onlineSince: number;
128
- lastActivity: number;
129
- status: AgentStatusTS;
130
- chatsHandled: number;
131
- activeChats: string[];
132
- userAgent?: string;
133
- ipAddress?: string;
134
- metadata?: {
135
- [key: string]: any;
136
- };
137
- }
138
- type ChatEventType = string;
139
- /**
140
- * ** user events
141
- */
142
- declare const ChatEventTypeUserJoined: ChatEventType;
143
- declare const ChatEventTypeUserLeft: ChatEventType;
144
- declare const ChatEventTypeTyping: ChatEventType;
145
- declare const ChatEventTypeStoppedTyping: ChatEventType;
146
- declare const ChatEventTypeRead: ChatEventType;
147
- declare const ChatEventTypeDelivered: ChatEventType;
148
- declare const ChatEventTypeReconnected: ChatEventType;
149
- declare const ChatEventTypeError: ChatEventType;
150
- declare const ChatEventTypeWaiting: ChatEventType;
151
- declare const ChatEventTypeLoadChat: ChatEventType;
152
- declare const ChatEventTypeLoadChatResponse: ChatEventType;
153
- declare const ChatEventTypeMessage: ChatEventType;
154
- declare const ChatEventTypeWaitingForAgent: ChatEventType;
155
- declare const ChatEventTypeMessageStatusUpdate: ChatEventType;
156
- declare const ChatEventTypeHumanAgentJoined: ChatEventType;
157
- declare const ChatEventTypeHumanAgentLeft: ChatEventType;
158
- declare const ChatEventTypeObserverJoined: ChatEventType;
159
- declare const ChatEventTypeObserverLeft: ChatEventType;
160
- declare const ChatEventTypeListChats: ChatEventType;
161
- declare const ChatEventTypeChatUpdated: ChatEventType;
162
- declare const ChatEventTypeChatRemoved: ChatEventType;
163
- declare const ChatEventTypeSyncMetadata: ChatEventType;
164
- declare const ChatEventTypeSyncMetadataResponse: ChatEventType;
165
- declare const ChatEventTypeSyncUserSession: ChatEventType;
166
- declare const ChatEventTypeSyncUserSessionResponse: ChatEventType;
167
- declare const ChatEventTypeClientAction: ChatEventType;
168
- declare const ChatEventTypeClientActionCallback: ChatEventType;
169
- declare const ChatEventTypeBlockUser: ChatEventType;
170
- /**
171
- * ** collab room management events
172
- */
173
- declare const ChatEventTypeCreateRoom: ChatEventType;
174
- declare const ChatEventTypeRoomCreated: ChatEventType;
175
- declare const ChatEventTypeJoinRoom: ChatEventType;
176
- declare const ChatEventTypeLeaveRoom: ChatEventType;
177
- declare const ChatEventTypeDeleteRoom: ChatEventType;
178
- declare const ChatEventTypeRoomDeleted: ChatEventType;
179
- declare const ChatEventTypeUpdateRoom: ChatEventType;
180
- declare const ChatEventTypeRoomUpdated: ChatEventType;
181
- declare const ChatEventTypeInviteUser: ChatEventType;
182
- declare const ChatEventTypeUserInvited: ChatEventType;
183
- declare const ChatEventTypeRoomUserJoined: ChatEventType;
184
- declare const ChatEventTypeRoomUserLeft: ChatEventType;
185
- declare const ChatEventTypeUserRemoved: ChatEventType;
186
- declare const ChatEventTypeListRooms: ChatEventType;
187
- declare const ChatEventTypeRoomsResponse: ChatEventType;
188
- /**
189
- * ** collab message events
190
- */
191
- declare const ChatEventTypeMessageEdited: ChatEventType;
192
- declare const ChatEventTypeMessageDeleted: ChatEventType;
193
- declare const ChatEventTypeMessageReaction: ChatEventType;
194
- declare const ChatEventTypeMessageReply: ChatEventType;
195
- declare const ChatEventTypeMentionUser: ChatEventType;
196
- declare const ChatEventTypeMessageEditedResponse: ChatEventType;
197
- declare const ChatEventTypeMessageDeletedResponse: ChatEventType;
198
- declare const ChatEventTypeMessageReactionResponse: ChatEventType;
199
- /**
200
- * ** collab user presence events
201
- */
202
- declare const ChatEventTypeUserPresenceStart: ChatEventType;
203
- declare const ChatEventTypeUserPresenceEnd: ChatEventType;
204
- declare const ChatEventTypeUserStatusChange: ChatEventType;
205
- declare const ChatEventTypeUserActivity: ChatEventType;
206
- declare const ChatEventTypeUserPresenceChanged: ChatEventType;
207
- declare const ChatEventTypeUserActivityUpdate: ChatEventType;
208
- declare const ChatEventTypeGetOnlineUsers: ChatEventType;
209
- declare const ChatEventTypeOnlineUsersResponse: ChatEventType;
210
- /**
211
- * ** shop assist events
212
- */
213
- declare const ChatEventTypeEndChat: ChatEventType;
214
- declare const ChatEventTypeChatEnded: ChatEventType;
215
- /**
216
- * ** agent session events
217
- */
218
- declare const ChatEventTypeAgentSessionStart: ChatEventType;
219
- declare const ChatEventTypeAgentSessionEnd: ChatEventType;
220
- declare const ChatEventTypeAgentStatusChange: ChatEventType;
221
- declare const ChatEventTypeAgentActivityPing: ChatEventType;
222
- declare const ChatEventTypeAgentChatAssigned: ChatEventType;
223
- declare const ChatEventTypeAgentChatCompleted: ChatEventType;
224
- /**
225
- * ** AI agents retrieval events
226
- */
227
- declare const ChatEventTypeGetAgents: ChatEventType;
228
- declare const ChatEventTypeGetAgentsResponse: ChatEventType;
229
- /**
230
- * ** CSAT events
231
- */
232
- declare const ChatEventTypeCSATRequest: ChatEventType;
233
- declare const ChatEventTypeCSATSurvey: ChatEventType;
234
- declare const ChatEventTypeCSATResponse: ChatEventType;
235
- /**
236
- * ** User Suggested Actions events
237
- */
238
- declare const ChatEventTypeUserSuggestedActions: ChatEventType;
239
- declare const ChatEventTypeUserSuggestedActionSelected: ChatEventType;
240
- /**
241
- * ** Summary events
242
- */
243
- declare const ChatEventTypeSummaryUpdate: ChatEventType;
244
- /**
245
- * ** Agent Context events
246
- */
247
- declare const ChatEventTypeAgentContextUpdate: ChatEventType;
248
- declare const ChatEventTypeAgentExecutionStarted: ChatEventType;
249
- declare const ChatEventTypeAgentExecutionEnded: ChatEventType;
250
- declare const ChatEventTypeLoadAgentContext: ChatEventType;
251
- declare const ChatEventTypeLoadAgentContextResponse: ChatEventType;
252
- /**
253
- * ** Plan → Approve → Execute events
254
- */
255
- declare const ChatEventTypePlanPendingApproval: ChatEventType;
256
- declare const ChatEventTypePlanApproved: ChatEventType;
257
- declare const ChatEventTypePlanRejected: ChatEventType;
258
- declare const ChatEventTypePlanCompleted: ChatEventType;
259
- declare const ChatEventTypeStepStarted: ChatEventType;
260
- declare const ChatEventTypeStepCompleted: ChatEventType;
261
- declare const ChatEventTypeStepFailed: ChatEventType;
262
- /**
263
- * ** New Chat events
264
- */
265
- declare const ChatEventTypeNewChat: ChatEventType;
266
- declare const ChatEventTypeNewChatCreated: ChatEventType;
267
- /**
268
- * ** Heartbeat events
269
- */
270
- declare const ChatEventTypePing: ChatEventType;
271
- declare const ChatEventTypePong: ChatEventType;
272
- type ChatEventTypeTS = "message" | "user_joined" | "user_left" | "typing" | "stopped_typing" | "read" | "delivered" | "reconnected" | "error" | "message_status_update" | "load_chat" | "load_chat_response" | "waiting" | "waiting_for_agent" | "human_agent_joined" | "end_chat" | "chat_ended" | "human_agent_left" | "observer_joined" | "observer_left" | "list_chats" | "chat_updated" | "chat_removed" | "sync_metadata" | "sync_metadata_response" | "sync_user_session" | "sync_user_session_response" | "agent_session_start" | "agent_session_end" | "agent_status_change" | "agent_activity_ping" | "agent_chat_assigned" | "agent_chat_completed" | "client_action" | "client_action_callback" | "show_csat_survey" | "csat_response" | "user_suggested_actions" | "user_suggested_action_selected" | "summary_update" | "agent_context_update" | "agent_execution_started" | "agent_execution_ended" | "load_agent_context" | "load_agent_context_response" | "plan_pending_approval" | "plan_approved" | "plan_rejected" | "plan_completed" | "step_started" | "step_completed" | "step_failed" | "new_chat" | "new_chat_created" | "block_user" | "ping" | "pong" | "create_room" | "room_created" | "join_room" | "leave_room" | "delete_room" | "room_deleted" | "update_room" | "room_updated" | "invite_user" | "user_invited" | "room_user_joined" | "room_user_left" | "user_removed" | "list_rooms" | "rooms_response" | "message_edited" | "message_deleted" | "message_reaction" | "message_reply" | "mention_user" | "message_edited_response" | "message_deleted_response" | "message_reaction_response" | "user_presence_start" | "user_presence_end" | "user_status_change" | "user_activity" | "user_presence_changed" | "user_activity_update" | "get_online_users" | "online_users" | "get_agents" | "get_agents_response";
273
- type MessageStatus = string;
274
- declare const MessageStatusSending: MessageStatus;
275
- declare const MessageStatusSent: MessageStatus;
276
- declare const MessageStatusDelivered: MessageStatus;
277
- declare const MessageStatusRead: MessageStatus;
278
- declare const MessageStatusFailed: MessageStatus;
279
- type MessageStatusTS = "sending" | "sent" | "delivered" | "read" | "failed";
280
- /**
281
- * EmojiReaction represents an emoji reaction to a message
282
- */
283
- interface EmojiReaction {
284
- emoji: string;
285
- count: number;
286
- users?: string[];
287
- }
288
- /**
289
- * Location represents geographical coordinates
290
- */
291
- interface Location {
292
- latitude: number;
293
- longitude: number;
294
- address?: string;
295
- }
296
- /**
297
- * AttachmentFile represents a file within an attachment
298
- */
299
- interface AttachmentFile {
300
- type: string;
301
- url: string;
302
- thumbnailUrl?: string;
303
- name?: string;
304
- size?: number;
305
- }
306
- type AttachmentType = string;
307
- /**
308
- * Attachment types for both user and system attachments
309
- */
310
- declare const AttachmentTypeDocument: AttachmentType;
311
- declare const AttachmentTypeDocumentAnalysis: AttachmentType;
312
- declare const AttachmentTypeImage: AttachmentType;
313
- declare const AttachmentTypeAudio: AttachmentType;
314
- declare const AttachmentTypeVideo: AttachmentType;
315
- declare const AttachmentTypeLocation: AttachmentType;
316
- declare const AttachmentTypeReferences: AttachmentType;
317
- declare const AttachmentTypeSubsections: AttachmentType;
318
- declare const AttachmentTypeArticles: AttachmentType;
319
- declare const AttachmentTypeRecords: AttachmentType;
320
- declare const AttachmentTypeActions: AttachmentType;
321
- declare const AttachmentTypeBullets: AttachmentType;
322
- declare const AttachmentTypeSticker: AttachmentType;
323
- declare const AttachmentTypeData: AttachmentType;
324
- declare const AttachmentTypeKGNodes: AttachmentType;
325
- declare const AttachmentTypeDocumentSources: AttachmentType;
326
- type AttachmentTypeTS = "document" | "document_analysis" | "document_sources" | "image" | "audio" | "video" | "location" | "references" | "subsections" | "articles" | "records" | "actions" | "bullets" | "sticker" | "data" | "kgNodes";
327
- /**
328
- * DocumentSource represents an aggregated document source with page references
329
- */
330
- interface DocumentSource {
331
- doc_id: string;
332
- title: string;
333
- url: string;
334
- page_numbers: number[];
335
- reference_count: number;
336
- bounding_regions?: BoundingRegion[];
337
- page_infos?: PageInfo[];
338
- }
339
- /**
340
- * Attachment represents any type of attachment to a message
341
- */
342
- interface Attachment {
343
- type: AttachmentTypeTS;
344
- documentAnalysis?: DocumentAnalysisResult;
345
- documentSources?: DocumentSource[];
346
- title?: string;
347
- url: string;
348
- files?: AttachmentFile[];
349
- location?: Location;
350
- data?: {
351
- [key: string]: Variable;
352
- };
353
- kgNodes?: KGNode[];
354
- actions?: Action[];
355
- }
356
- interface Action {
357
- id: string;
358
- title: string;
359
- icon?: string;
360
- description?: string;
361
- onAction?: () => void;
362
- }
363
- /**
364
- * ChatMessage represents the core message structure
365
- */
366
- interface ChatMessage {
367
- /**
368
- * Core fields
369
- */
370
- id: string;
371
- role: ChatRoleTS;
372
- content: string;
373
- time: number;
374
- status: MessageStatusTS;
375
- /**
376
- * Sender information
377
- */
378
- senderId: string;
379
- senderName?: string;
380
- /**
381
- * Timing
382
- */
383
- createdAt: number;
384
- updatedAt?: number;
385
- /**
386
- * Message relations
387
- */
388
- replyTo?: string;
389
- threadId?: string;
390
- mentions?: string[];
391
- /**
392
- * Attachments and reactions
393
- */
394
- attachments?: Attachment[];
395
- reactions?: EmojiReaction[];
396
- /**
397
- * Additional data
398
- */
399
- variables?: {
400
- [key: string]: Variable;
401
- };
402
- /**
403
- * Tool call
404
- */
405
- name?: string;
406
- toolCallId?: string;
407
- toolCalls?: ToolCall[];
408
- /**
409
- * LLM usage
410
- */
411
- llmUsage?: LLMUsage;
412
- }
413
- interface ChatEvent {
414
- type: ChatEventTypeTS;
415
- orgId: string;
416
- chatKey: string;
417
- userId: string;
418
- timestamp: number;
419
- data?: {
420
- [key: string]: any;
421
- };
422
- message?: ChatMessage;
423
- }
424
- interface ChatGrading {
425
- chatKey: string;
426
- grade: number;
427
- topic: string;
428
- summary: string;
429
- }
430
- interface ChatSession {
431
- id: string;
432
- status: ChatSessionStatus;
433
- user?: ChatUser;
434
- activeChatKey?: string;
435
- preferences?: ChatSessionPreferences;
436
- lastActivity: number;
437
- expiresAt: number;
438
- metadata?: {
439
- [key: string]: any;
440
- };
441
- }
442
- type ChatSessionStatus = string;
443
- declare const ChatSessionStatusActive: ChatSessionStatus;
444
- declare const ChatSessionStatusIdle: ChatSessionStatus;
445
- declare const ChatSessionStatusExpired: ChatSessionStatus;
446
- interface ChatSessionPreferences {
447
- language: string;
448
- theme: string;
449
- notifications: boolean;
450
- timeZone: string;
451
- messageDisplay: string;
452
- autoTranslate: boolean;
453
- rateLimits?: ChatRateLimits;
454
- }
455
- interface ChatRateLimits {
456
- maxMessagesPerMinute: number;
457
- maxTokensPerDay: number;
458
- cooldownPeriod: number;
459
- }
460
- /**
461
- * ==========================
462
- * todo: move to common/llm
463
- */
464
- interface LLMConfig {
465
- Provider: string;
466
- Model: string;
467
- Temperature: number;
468
- MaxTokens: number;
469
- SystemPrompt: string;
470
- Tools: LLMTool[];
471
- Memory?: LLMMemoryConfig;
472
- }
473
- interface LLMMemoryConfig {
474
- MaxMessages: number;
475
- IncludeSystem: boolean;
476
- WindowSize: number;
477
- Strategy: string;
478
- }
479
- interface LLMTool {
480
- Name: string;
481
- Type: string;
482
- Function: LLMFunction;
483
- }
484
- interface LLMFunction {
485
- Name: string;
486
- Description: string;
487
- Parameters: any;
488
- }
489
- interface ToolCall {
490
- Name: string;
491
- Arguments: {
492
- [key: string]: any;
493
- };
494
- ID: string;
495
- Description: string;
496
- }
497
- interface LLMResponse {
498
- Content: string;
499
- ToolCalls: ToolCall[];
500
- Usage?: LLMUsage;
501
- ResponseId: string;
502
- }
503
- interface LLMUsage {
504
- inputTokens: number;
505
- outputTokens: number;
506
- totalTokens: number;
507
- }
508
- /**
509
- * ChatSummary represents lightweight chat information for caching and listing
510
- */
511
- interface ChatSummary {
512
- chatKey: string;
513
- title: string;
514
- userId?: string;
515
- status: ChatStatus;
516
- lastUpdated: number;
517
- waitingSince?: number;
518
- metadata?: {
519
- [key: string]: any;
520
- };
521
- }
522
- interface GetChatRequest {
523
- orgId: string;
524
- chatKey: string;
525
- }
526
- interface GetChatResponse {
527
- chat?: Chat;
528
- metadata: ResponseMetadata;
529
- }
530
- interface ChatProductReference {
531
- id: string;
532
- title: string;
533
- price: number;
534
- image?: string;
535
- url?: string;
536
- }
537
- /**
538
- * Chat Archival Models
539
- */
540
- interface ChatArchivalRequest {
541
- orgId: string;
542
- chatKey: string;
543
- chat: Chat;
544
- }
545
- interface ChatArchivalResponse {
546
- success: boolean;
547
- error?: string;
548
- message?: string;
549
- }
550
- /**
551
- * Agent Session Request/Response Models
552
- */
553
- interface StartAgentSessionRequest {
554
- orgId: string;
555
- agentId: string;
556
- userAgent?: string;
557
- ipAddress?: string;
558
- }
559
- interface StartAgentSessionResponse {
560
- metadata: ResponseMetadata;
561
- }
562
- interface EndAgentSessionRequest {
563
- orgId: string;
564
- agentId: string;
565
- }
566
- interface EndAgentSessionResponse {
567
- metadata: ResponseMetadata;
568
- }
569
- interface UpdateAgentStatusRequest {
570
- orgId: string;
571
- agentId: string;
572
- status: AgentStatusTS;
573
- }
574
- interface UpdateAgentStatusResponse {
575
- metadata: ResponseMetadata;
576
- }
577
- interface UpdateAgentLastActivityRequest {
578
- orgId: string;
579
- agentId: string;
580
- }
581
- interface UpdateAgentLastActivityResponse {
582
- metadata: ResponseMetadata;
583
- }
584
- interface AssignChatToAgentRequest {
585
- orgId: string;
586
- agentId: string;
587
- chatKey: string;
588
- }
589
- interface AssignChatToAgentResponse {
590
- metadata: ResponseMetadata;
591
- }
592
- interface CompleteChatByAgentRequest {
593
- orgId: string;
594
- agentId: string;
595
- chatKey: string;
596
- }
597
- interface CompleteChatByAgentResponse {
598
- metadata: ResponseMetadata;
599
- }
600
- interface GetAgentSessionRequest {
601
- orgId: string;
602
- agentId: string;
603
- }
604
- interface GetAgentSessionResponse {
605
- session?: AgentSession;
606
- metadata: ResponseMetadata;
607
- }
608
- interface GetOnlineAgentsRequest {
609
- orgId: string;
610
- }
611
- interface GetOnlineAgentsResponse {
612
- sessions: AgentSession[];
613
- metadata: ResponseMetadata;
614
- }
615
- interface GetOnlineAgentCountRequest {
616
- orgId: string;
617
- }
618
- interface GetOnlineAgentCountResponse {
619
- count: number;
620
- metadata: ResponseMetadata;
621
- }
622
- /**
623
- * Queue-specific chat request/response types
624
- */
625
- interface GetQueueChatsRequest {
626
- orgId: string;
627
- queueId: string;
628
- }
629
- interface GetQueueChatsResponse {
630
- chats: ChatSummary[];
631
- metadata: ResponseMetadata;
632
- }
633
- interface GetQueueChatCountRequest {
634
- orgId: string;
635
- queueId: string;
636
- }
637
- interface GetQueueChatCountResponse {
638
- count: number;
639
- metadata: ResponseMetadata;
640
- }
641
- type UserStatusTS = 'online' | 'away' | 'busy' | 'offline';
642
- type UserStatus = string;
643
- declare const UserStatusOnline: UserStatus;
644
- declare const UserStatusAway: UserStatus;
645
- declare const UserStatusBusy: UserStatus;
646
- declare const UserStatusOffline: UserStatus;
647
- /**
648
- * UserSession for tracking online users
649
- */
650
- interface UserSession {
651
- orgId: string;
652
- userId: string;
653
- userName: string;
654
- status: UserStatusTS;
655
- onlineSince: number;
656
- lastActivity: number;
657
- }
658
- /**
659
- * User status update requests
660
- */
661
- interface UpdateUserStatusRequest {
662
- orgId: string;
663
- userId: string;
664
- status: UserStatusTS;
665
- }
666
- interface UpdateUserStatusResponse {
667
- metadata: ResponseMetadata;
668
- }
669
- /**
670
- * Get online users
671
- */
672
- interface GetOnlineUsersRequest {
673
- orgId: string;
674
- }
675
- interface GetOnlineUsersResponse {
676
- metadata: ResponseMetadata;
677
- users: UserSession[];
678
- }
679
- /**
680
- * Analytics Trigger Models
681
- */
682
- interface TriggerAnalyticsScanRequest {
683
- org_id?: string;
684
- }
685
- interface TriggerAnalyticsScanResponse {
686
- metadata: ResponseMetadata;
687
- chats_archived: number;
688
- }
689
- /**
690
- * Active chat requests/responses
691
- */
692
- interface GetActiveChatCountRequest {
693
- orgId: string;
694
- }
695
- interface GetActiveChatCountResponse {
696
- count: number;
697
- metadata: ResponseMetadata;
698
- }
699
- interface GetActiveChatsRequest {
700
- orgId: string;
701
- pastHours?: number;
702
- }
703
- interface GetActiveChatsResponse {
704
- chats: ChatSummary[];
705
- metadata: ResponseMetadata;
706
- }
707
- /**
708
- * Waiting for agent requests/responses
709
- */
710
- interface GetWaitingForAgentChatCountRequest {
711
- orgId: string;
712
- }
713
- interface GetWaitingForAgentChatCountResponse {
714
- count: number;
715
- metadata: ResponseMetadata;
716
- }
717
- interface GetWaitingForAgentChatsRequest {
718
- orgId: string;
719
- }
720
- interface GetWaitingForAgentChatsResponse {
721
- chats: ChatSummary[];
722
- metadata: ResponseMetadata;
723
- }
724
- /**
725
- * User chats requests/responses
726
- */
727
- interface GetUserChatsRequest {
728
- orgId: string;
729
- userId: string;
730
- }
731
- interface GetUserChatsResponse {
732
- chats: ChatSummary[];
733
- metadata: ResponseMetadata;
734
- }
735
- /**
736
- * Daily counter requests/responses
737
- */
738
- interface GetDailyChatCountRequest {
739
- orgId: string;
740
- date: string;
741
- timezone: string;
742
- }
743
- interface GetDailyChatCountResponse {
744
- count: number;
745
- date: string;
746
- timezone: string;
747
- metadata: any;
748
- }
749
- declare const QueueTypes: {
750
- readonly skill: {
751
- readonly value: "skill";
752
- readonly label: "Skill-based";
753
- readonly description: "Route by agent expertise and skills";
754
- };
755
- readonly priority: {
756
- readonly value: "priority";
757
- readonly label: "Priority-based";
758
- readonly description: "Route by customer tier and urgency level";
759
- };
760
- readonly department: {
761
- readonly value: "department";
762
- readonly label: "Department-based";
763
- readonly description: "Route by business function alignment";
764
- };
765
- readonly complexity: {
766
- readonly value: "complexity";
767
- readonly label: "Complexity-based";
768
- readonly description: "Route by issue difficulty assessment";
769
- };
770
- };
771
- type QueueTypeTS = keyof typeof QueueTypes;
772
- type QueueTypeOptionTS = typeof QueueTypes[QueueTypeTS];
773
- /**
774
- * QueueType represents the routing algorithm type
775
- */
776
- type QueueType = string;
777
- /**
778
- * Queue Type Constants - These are hardcoded routing algorithms, not admin-configurable
779
- */
780
- declare const QueueTypeSkill: QueueType;
781
- /**
782
- * Queue Type Constants - These are hardcoded routing algorithms, not admin-configurable
783
- */
784
- declare const QueueTypePriority: QueueType;
785
- /**
786
- * Queue Type Constants - These are hardcoded routing algorithms, not admin-configurable
787
- */
788
- declare const QueueTypeDepartment: QueueType;
789
- /**
790
- * Queue Type Constants - These are hardcoded routing algorithms, not admin-configurable
791
- */
792
- declare const QueueTypeComplexity: QueueType;
793
- /**
794
- * AgentQueue represents an individual queue within a queue type
795
- */
796
- interface AgentQueue {
797
- id: string;
798
- orgId: string;
799
- type: QueueTypeTS;
800
- name: string;
801
- title: string;
802
- description: string;
803
- agentIds: string[];
804
- config: {
805
- [key: string]: any;
806
- };
807
- isActive: boolean;
808
- isDefault: boolean;
809
- createdAt: string;
810
- updatedAt: string;
811
- createdBy?: string;
812
- updatedBy?: string;
813
- }
814
- /**
815
- * GetAgentQueuesFilter represents filtering options for agent queues
816
- */
817
- interface GetAgentQueuesFilter {
818
- type?: QueueType;
819
- isActive?: boolean;
820
- }
821
- /**
822
- * Agent Queue Operations
823
- */
824
- interface CreateAgentQueueRequest {
825
- orgId: string;
826
- type: QueueType;
827
- name: string;
828
- title: string;
829
- description: string;
830
- agentIds?: string[];
831
- config?: {
832
- [key: string]: any;
833
- };
834
- isDefault?: boolean;
835
- createdBy?: string;
836
- updatedBy?: string;
837
- }
838
- interface CreateAgentQueueResponse {
839
- queue?: AgentQueue;
840
- metadata: any;
841
- }
842
- interface GetAgentQueuesRequest {
843
- orgId: string;
844
- type?: QueueType;
845
- isActive?: boolean;
846
- }
847
- interface GetAgentQueuesResponse {
848
- queues: (AgentQueue | undefined)[];
849
- metadata: any;
850
- }
851
- interface UpdateAgentQueueRequest {
852
- orgId: string;
853
- id: string;
854
- type: QueueType;
855
- name: string;
856
- title: string;
857
- description: string;
858
- agentIds?: string[];
859
- config?: {
860
- [key: string]: any;
861
- };
862
- isDefault?: boolean;
863
- updatedBy?: string;
864
- }
865
- interface UpdateAgentQueueResponse {
866
- queue?: AgentQueue;
867
- metadata: any;
868
- }
869
- interface DeleteAgentQueueRequest {
870
- orgId: string;
871
- id: string;
872
- }
873
- interface DeleteAgentQueueResponse {
874
- metadata: any;
875
- }
876
- /**
877
- * ChatQueueInfo extends Chat with queue routing information
878
- */
879
- interface ChatQueueInfo {
880
- recommendedQueueId?: string;
881
- recommendedQueueName?: string;
882
- assignedQueueId?: string;
883
- assignedQueueName?: string;
884
- }
885
- declare const GetWaitingForAgentChatCountSubject = "chat.get_waiting_for_agent_chat_count";
886
- declare const GetActiveChatCountSubject = "chat.get_active_chat_count";
887
- declare const GetWaitingForAgentChatsSubject = "chat.get_waiting_for_agent_chats";
888
- declare const GetActiveChatsSubject = "chat.get_active_chats";
889
- declare const GetUserChatsSubject = "chat.get_user_chats";
890
- declare const GetChatSubject = "chat.get_chat";
891
- /**
892
- * Chat Archival Subjects
893
- */
894
- declare const ChatArchiveSubjectPattern = "chat.archive.%s.server";
895
- /**
896
- * Agent Session Subjects
897
- */
898
- declare const StartAgentSessionSubject = "chat.agent_session.start";
899
- declare const EndAgentSessionSubject = "chat.agent_session.end";
900
- declare const UpdateAgentStatusSubject = "chat.agent_session.update_status";
901
- declare const UpdateAgentLastActivitySubject = "chat.agent_session.update_last_activity";
902
- declare const AssignChatToAgentSubject = "chat.agent_session.assign_chat";
903
- declare const CompleteChatByAgentSubject = "chat.agent_session.complete_chat";
904
- declare const GetAgentSessionSubject = "chat.agent_session.get";
905
- declare const GetOnlineAgentsSubject = "chat.agent_session.get_online_agents";
906
- declare const GetOnlineAgentCountSubject = "chat.agent_session.get_online_agent_count";
907
- /**
908
- * Queue Management Subjects
909
- */
910
- declare const CreateAgentQueueSubject = "chat.agent_queue.create";
911
- declare const GetAgentQueuesSubject = "chat.agent_queue.get";
912
- declare const UpdateAgentQueueSubject = "chat.agent_queue.update";
913
- declare const DeleteAgentQueueSubject = "chat.agent_queue.delete";
914
- /**
915
- * Queue-specific Chat Subjects
916
- */
917
- declare const GetQueueChatsSubject = "chat.queue.get_chats";
918
- declare const GetQueueChatCountSubject = "chat.queue.get_chat_count";
919
- /**
920
- * Daily Counter Subjects
921
- */
922
- declare const GetDailyChatCountSubject = "chat.get_daily_chat_count";
923
- /**
924
- * User Status Subjects
925
- */
926
- declare const UpdateUserStatusSubject = "chat.user.status.update";
927
- declare const GetOnlineUsersSubject = "chat.users.online.get";
928
- /**
929
- * Analytics Trigger Subjects
930
- */
931
- declare const TriggerAnalyticsScanSubject = "chat.analytics.trigger-scan";
932
- /**
933
- * Org Setup Subject
934
- */
935
- declare const SetupOrgSubject = "chat.org.setup";
936
-
937
23
  interface AdminChatListProps {
938
24
  className?: string;
939
25
  }
@@ -978,97 +64,6 @@ interface GenericChatWidgetProps {
978
64
  }
979
65
  declare const GenericChatWidget: React$1.FC<GenericChatWidgetProps>;
980
66
 
981
- type ConnectionState = "disconnected" | "connecting" | "connected" | "reconnecting";
982
- interface WebSocketError {
983
- code: "CONNECTION_FAILED" | "PARSE_ERROR" | "SEND_FAILED" | "TIMEOUT" | "NETWORK_ERROR";
984
- message: string;
985
- retryable: boolean;
986
- timestamp: number;
987
- }
988
- interface RetryConfig {
989
- maxRetries?: number;
990
- intervals?: number[];
991
- backoffMultiplier?: number;
992
- maxBackoffTime?: number;
993
- }
994
- interface ConnectionMetrics {
995
- latency: number;
996
- messagesSent: number;
997
- messagesReceived: number;
998
- messagesQueued: number;
999
- reconnectCount: number;
1000
- lastError?: WebSocketError;
1001
- connectedAt?: number;
1002
- lastMessageAt?: number;
1003
- }
1004
- interface QueueConfig {
1005
- maxSize?: number;
1006
- dropStrategy?: "oldest" | "newest";
1007
- }
1008
- interface Logger {
1009
- debug: (message: string, ...args: any[]) => void;
1010
- info: (message: string, ...args: any[]) => void;
1011
- warn: (message: string, ...args: any[]) => void;
1012
- error: (message: string, ...args: any[]) => void;
1013
- }
1014
- interface UseWebSocketChatBaseConfig {
1015
- serverBaseUrl: string;
1016
- orgId: string;
1017
- clientType: "customer" | "humanAgent" | "observer";
1018
- product: ProductNameTS;
1019
- onMessage?: (event: ChatEvent) => void;
1020
- retryConfig?: RetryConfig;
1021
- queueConfig?: QueueConfig;
1022
- debug?: boolean;
1023
- logger?: Logger;
1024
- heartbeatInterval?: number;
1025
- heartbeatTimeout?: number;
1026
- }
1027
- interface UseWebSocketChatBaseReturn {
1028
- connectionState: ConnectionState;
1029
- isConnected: boolean;
1030
- sendMessage: (event: Omit<ChatEvent, "timestamp">, overrideUserId?: string) => Promise<void>;
1031
- error: WebSocketError | undefined;
1032
- connect: (userId: string) => Promise<void>;
1033
- startNewChat: (userId: string, data?: {
1034
- [key: string]: any;
1035
- }) => Promise<string>;
1036
- startTime: Date | undefined;
1037
- disconnect: (intentional?: boolean) => void;
1038
- metrics: ConnectionMetrics;
1039
- on: (eventType: string, handler: (data: any) => void) => () => void;
1040
- off: (eventType: string, handler: (data: any) => void) => void;
1041
- clearError: () => void;
1042
- }
1043
- declare const useWebSocketChatBase: ({ serverBaseUrl, orgId, clientType, product, onMessage, retryConfig, queueConfig, debug, logger, heartbeatInterval, heartbeatTimeout, }: UseWebSocketChatBaseConfig) => UseWebSocketChatBaseReturn;
1044
-
1045
- interface UseWebSocketChatAdminReturn extends UseWebSocketChatBaseReturn {
1046
- chats: Map<string, Chat>;
1047
- selectedChat: Chat | undefined;
1048
- selectChat: (chatId: string) => void;
1049
- addUserToChat: (orgId: string, chatKey: string, user: ChatUser) => void;
1050
- removeUserFromChat: (orgId: string, chatKey: string, userId: string) => void;
1051
- blockUser: (orgId: string, chatKey: string, userId: string) => void;
1052
- }
1053
- declare const useWebSocketChatAdmin: ({ serverBaseUrl, orgId, product, }: Omit<UseWebSocketChatBaseConfig, "clientType" | "onMessage">) => UseWebSocketChatAdminReturn;
1054
-
1055
- interface UseWebSocketChatCustomerReturn extends UseWebSocketChatBaseReturn {
1056
- title: string | undefined;
1057
- messages: ChatMessage[];
1058
- users: ChatUser[];
1059
- isWaiting: boolean;
1060
- isWaitingForAgent: boolean;
1061
- aiEngaged: boolean;
1062
- humanAgentEngaged: boolean;
1063
- metadata: Record<string, string>;
1064
- status: string | undefined;
1065
- chatKey: string;
1066
- }
1067
- interface UseWebSocketChatCustomerConfig extends Omit<UseWebSocketChatBaseConfig, "clientType" | "onMessage"> {
1068
- chatKey: string;
1069
- }
1070
- declare const useWebSocketChatCustomer: ({ serverBaseUrl, orgId, chatKey, product, }: UseWebSocketChatCustomerConfig) => UseWebSocketChatCustomerReturn;
1071
-
1072
67
  declare const WebSocketChatCustomerContext: React$1.Context<UseWebSocketChatCustomerReturn | undefined>;
1073
68
  type WebSocketChatCustomerProviderProps = {
1074
69
  children: React$1.ReactNode;
@@ -1092,4 +87,4 @@ type WebSocketChatAdminProviderProps = {
1092
87
  declare function WebSocketChatAdminProvider(props: WebSocketChatAdminProviderProps): react_jsx_runtime.JSX.Element;
1093
88
  declare const useWebSocketChatAdminContext: () => UseWebSocketChatAdminReturn;
1094
89
 
1095
- export { type Action, AdminChatHeader, AdminChatInput, AdminChatList, AdminChatListItem, type AgentQueue, type AgentSession, type AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, type AgentStatusTS, type AssignChatToAgentRequest, type AssignChatToAgentResponse, AssignChatToAgentSubject, type Attachment, type AttachmentFile, type AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSticker, AttachmentTypeSubsections, type AttachmentTypeTS, AttachmentTypeVideo, type Chat, type ChatArchivalRequest, type ChatArchivalResponse, ChatArchiveSubjectPattern, type ChatContext, type ChatEvent, type ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeBlockUser, ChatEventTypeCSATRequest, ChatEventTypeCSATResponse, ChatEventTypeCSATSurvey, ChatEventTypeChatEnded, ChatEventTypeChatRemoved, ChatEventTypeChatUpdated, ChatEventTypeClientAction, ChatEventTypeClientActionCallback, ChatEventTypeCreateRoom, ChatEventTypeDeleteRoom, ChatEventTypeDelivered, ChatEventTypeEndChat, ChatEventTypeError, ChatEventTypeGetAgents, ChatEventTypeGetAgentsResponse, ChatEventTypeGetOnlineUsers, ChatEventTypeHumanAgentJoined, ChatEventTypeHumanAgentLeft, ChatEventTypeInviteUser, ChatEventTypeJoinRoom, ChatEventTypeLeaveRoom, ChatEventTypeListChats, ChatEventTypeListRooms, ChatEventTypeLoadAgentContext, ChatEventTypeLoadAgentContextResponse, ChatEventTypeLoadChat, ChatEventTypeLoadChatResponse, ChatEventTypeMentionUser, ChatEventTypeMessage, ChatEventTypeMessageDeleted, ChatEventTypeMessageDeletedResponse, ChatEventTypeMessageEdited, ChatEventTypeMessageEditedResponse, ChatEventTypeMessageReaction, ChatEventTypeMessageReactionResponse, ChatEventTypeMessageReply, ChatEventTypeMessageStatusUpdate, ChatEventTypeNewChat, ChatEventTypeNewChatCreated, ChatEventTypeObserverJoined, ChatEventTypeObserverLeft, ChatEventTypeOnlineUsersResponse, ChatEventTypePing, ChatEventTypePlanApproved, ChatEventTypePlanCompleted, ChatEventTypePlanPendingApproval, ChatEventTypePlanRejected, ChatEventTypePong, ChatEventTypeRead, ChatEventTypeReconnected, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, type ChatEventTypeTS, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, type ChatFlow, type ChatGrading, ChatHeader, ChatHumanAgentActions, ChatInput, type ChatMessage, ChatMessages, type ChatProductReference, type ChatQueueInfo, type ChatRateLimits, type ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, type ChatRoleTS, ChatRoleTool, ChatRoleUser, type ChatSession, type ChatSessionPreferences, type ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, type ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCustomerUI, ChatStatusDisconnected, type ChatStatusTS, type ChatSummary, type ChatTool, type ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, type ChatTypeTS, ChatTypingIndicator, type ChatUser, type CompleteChatByAgentRequest, type CompleteChatByAgentResponse, CompleteChatByAgentSubject, type ConnectionMetrics, type ConnectionState, type CreateAgentQueueRequest, type CreateAgentQueueResponse, CreateAgentQueueSubject, type DeleteAgentQueueRequest, type DeleteAgentQueueResponse, DeleteAgentQueueSubject, type DocumentSource, type EmojiReaction, type EndAgentSessionRequest, type EndAgentSessionResponse, EndAgentSessionSubject, GenericChatWidget, type GetActiveChatCountRequest, type GetActiveChatCountResponse, GetActiveChatCountSubject, type GetActiveChatsRequest, type GetActiveChatsResponse, GetActiveChatsSubject, type GetAgentQueuesFilter, type GetAgentQueuesRequest, type GetAgentQueuesResponse, GetAgentQueuesSubject, type GetAgentSessionRequest, type GetAgentSessionResponse, GetAgentSessionSubject, type GetChatRequest, type GetChatResponse, GetChatSubject, type GetDailyChatCountRequest, type GetDailyChatCountResponse, GetDailyChatCountSubject, type GetOnlineAgentCountRequest, type GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, type GetOnlineAgentsRequest, type GetOnlineAgentsResponse, GetOnlineAgentsSubject, type GetOnlineUsersRequest, type GetOnlineUsersResponse, GetOnlineUsersSubject, type GetQueueChatCountRequest, type GetQueueChatCountResponse, GetQueueChatCountSubject, type GetQueueChatsRequest, type GetQueueChatsResponse, GetQueueChatsSubject, type GetUserChatsRequest, type GetUserChatsResponse, GetUserChatsSubject, type GetWaitingForAgentChatCountRequest, type GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, type GetWaitingForAgentChatsRequest, type GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, type LLMConfig, type LLMFunction, type LLMMemoryConfig, type LLMResponse, type LLMTool, type LLMUsage, type Location, type Logger, type MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, type MessageStatusTS, type QueueConfig, type QueueType, QueueTypeComplexity, QueueTypeDepartment, type QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, type QueueTypeTS, QueueTypes, type RetryConfig, SetupOrgSubject, type StartAgentSessionRequest, type StartAgentSessionResponse, StartAgentSessionSubject, type ToolCall, type TriggerAnalyticsScanRequest, type TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, type UpdateAgentLastActivityRequest, type UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, type UpdateAgentQueueRequest, type UpdateAgentQueueResponse, UpdateAgentQueueSubject, type UpdateAgentStatusRequest, type UpdateAgentStatusResponse, UpdateAgentStatusSubject, type UpdateUserStatusRequest, type UpdateUserStatusResponse, UpdateUserStatusSubject, type UseWebSocketChatAdminReturn, type UseWebSocketChatBaseConfig, type UseWebSocketChatBaseReturn, type UseWebSocketChatCustomerConfig, type UseWebSocketChatCustomerReturn, type UserSession, type UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, type UserStatusTS, WebSocketChatAdminContext, WebSocketChatAdminProvider, WebSocketChatCustomerContext, WebSocketChatCustomerProvider, type WebSocketError, useWebSocketChatAdmin, useWebSocketChatAdminContext, useWebSocketChatBase, useWebSocketChatCustomer, useWebSocketChatCustomerContext };
90
+ export { AdminChatHeader, AdminChatInput, AdminChatList, AdminChatListItem, Chat, ChatHeader, ChatHumanAgentActions, ChatInput, ChatMessage, ChatMessages, ChatStatusCustomerUI, ChatTypingIndicator, GenericChatWidget, UseWebSocketChatAdminReturn, UseWebSocketChatCustomerReturn, WebSocketChatAdminContext, WebSocketChatAdminProvider, WebSocketChatCustomerContext, WebSocketChatCustomerProvider, useWebSocketChatAdminContext, useWebSocketChatCustomerContext };