@elqnt/chat 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +73 -6
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +73 -6
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +85 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -6
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.mts +89 -4
- package/dist/models/index.d.ts +89 -4
- package/dist/models/index.js +12 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/index.mjs +8 -0
- package/dist/models/index.mjs.map +1 -1
- package/dist/transport/index.js +70 -4
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +70 -4
- package/dist/transport/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ChatHistoryResult, UseChatHistoryOptions, UseChatMonitoringOptions, UseChatOptions, UseChatReturn, UseHumanAgentSessionsOptions, UseMemoryResult, useChat, useChatHistory, useChatMonitoring, useHumanAgentSessions, useMemory, useOptionsRef } from './hooks/index.js';
|
|
2
2
|
export { UseAsyncOptions, UseAsyncReturn, useApiAsync } from '@elqnt/api-client/hooks';
|
|
3
|
-
export { Action, AgentQueue, AgentSession, AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, AgentStatusTS, AssignChatToAgentRequest, AssignChatToAgentResponse, AssignChatToAgentSubject, Attachment, AttachmentFile, AttachmentProcessingCompleteData, AttachmentProcessingErrorData, AttachmentProcessingProgressData, AttachmentProcessingStartedData, AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, AttachmentTypeTS, AttachmentTypeVideo, Chat, ChatArchivalRequest, ChatArchivalResponse, ChatArchiveSubjectPattern, ChatContext, ChatEvent, ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, 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, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, ChatEventTypeTS, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, ChatFlow, ChatGrading, ChatMessage, ChatProductReference, ChatQueueInfo, ChatRateLimits, ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, ChatRoleTS, ChatRoleTool, ChatRoleUser, ChatSession, ChatSessionPreferences, ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, ChatStatusTS, ChatStatusUpdate, ChatSummary, ChatTool, ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, ChatTypeTS, ChatUser, CompleteChatByAgentRequest, CompleteChatByAgentResponse, CompleteChatByAgentSubject, CreateAgentQueueRequest, CreateAgentQueueResponse, CreateAgentQueueSubject, DeleteAgentQueueRequest, DeleteAgentQueueResponse, DeleteAgentQueueSubject, DocumentSource, EmojiReaction, EndAgentSessionRequest, EndAgentSessionResponse, EndAgentSessionSubject, GetActiveChatCountRequest, GetActiveChatCountResponse, GetActiveChatCountSubject, GetActiveChatsRequest, GetActiveChatsResponse, GetActiveChatsSubject, GetAgentContextRequest, GetAgentContextResponse, GetAgentContextSubject, GetAgentQueuesFilter, GetAgentQueuesRequest, GetAgentQueuesResponse, GetAgentQueuesSubject, GetAgentSessionRequest, GetAgentSessionResponse, GetAgentSessionSubject, GetChatRequest, GetChatResponse, GetChatSubject, GetDailyChatCountRequest, GetDailyChatCountResponse, GetDailyChatCountSubject, GetOnlineAgentCountRequest, GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, GetOnlineAgentsRequest, GetOnlineAgentsResponse, GetOnlineAgentsSubject, GetOnlineUsersRequest, GetOnlineUsersResponse, GetOnlineUsersSubject, GetQueueChatCountRequest, GetQueueChatCountResponse, GetQueueChatCountSubject, GetQueueChatsRequest, GetQueueChatsResponse, GetQueueChatsSubject, GetUserChatsRequest, GetUserChatsResponse, GetUserChatsSubject, GetWaitingForAgentChatCountRequest, GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, GetWaitingForAgentChatsRequest, GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, LLMConfig, LLMFunction, LLMMemoryConfig, LLMResponse, LLMTool, LLMUsage, Location, MemoryContact, MemoryNote, MemoryProfile, MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, MessageStatusTS, QueueType, QueueTypeComplexity, QueueTypeDepartment, QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, QueueTypeTS, QueueTypes, RetryAttachmentData, SetupOrgSubject, StartAgentSessionRequest, StartAgentSessionResponse, StartAgentSessionSubject, SummarizeChatResponse, ToolCall, TriggerAnalyticsScanRequest, TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, TriggerMemorySummarizationSubject, UpdateAgentLastActivityRequest, UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, UpdateAgentQueueRequest, UpdateAgentQueueResponse, UpdateAgentQueueSubject, UpdateAgentStatusRequest, UpdateAgentStatusResponse, UpdateAgentStatusSubject, UpdateUserStatusRequest, UpdateUserStatusResponse, UpdateUserStatusSubject, UserSession, UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, UserStatusTS } from './models/index.js';
|
|
3
|
+
export { Action, AgentQueue, AgentSession, AgentStatus, AgentStatusAway, AgentStatusBusy, AgentStatusOffline, AgentStatusOnline, AgentStatusTS, AssignChatToAgentRequest, AssignChatToAgentResponse, AssignChatToAgentSubject, Attachment, AttachmentFile, AttachmentProcessingCompleteData, AttachmentProcessingErrorData, AttachmentProcessingProgressData, AttachmentProcessingStartedData, AttachmentType, AttachmentTypeActions, AttachmentTypeArticles, AttachmentTypeAudio, AttachmentTypeBullets, AttachmentTypeData, AttachmentTypeDataFile, AttachmentTypeDocument, AttachmentTypeDocumentAnalysis, AttachmentTypeDocumentSources, AttachmentTypeImage, AttachmentTypeKGNodes, AttachmentTypeLocation, AttachmentTypeRecords, AttachmentTypeReferences, AttachmentTypeSpreadsheet, AttachmentTypeSticker, AttachmentTypeSubsections, AttachmentTypeTS, AttachmentTypeVideo, Chat, ChatArchivalRequest, ChatArchivalResponse, ChatArchiveSubjectPattern, ChatContext, ChatEvent, ChatEventType, ChatEventTypeAgentActivityPing, ChatEventTypeAgentChatAssigned, ChatEventTypeAgentChatCompleted, ChatEventTypeAgentContextUpdate, ChatEventTypeAgentExecutionEnded, ChatEventTypeAgentExecutionStarted, ChatEventTypeAgentSessionEnd, ChatEventTypeAgentSessionStart, ChatEventTypeAgentStatusChange, ChatEventTypeAttachmentProcessingComplete, ChatEventTypeAttachmentProcessingError, ChatEventTypeAttachmentProcessingProgress, ChatEventTypeAttachmentProcessingStarted, 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, ChatEventTypeRetryAttachment, ChatEventTypeRoomCreated, ChatEventTypeRoomDeleted, ChatEventTypeRoomUpdated, ChatEventTypeRoomUserJoined, ChatEventTypeRoomUserLeft, ChatEventTypeRoomsResponse, ChatEventTypeSkillActivate, ChatEventTypeSkillDeactivate, ChatEventTypeSkillsChanged, ChatEventTypeStepCompleted, ChatEventTypeStepFailed, ChatEventTypeStepStarted, ChatEventTypeStoppedTyping, ChatEventTypeSummaryUpdate, ChatEventTypeSyncMetadata, ChatEventTypeSyncMetadataResponse, ChatEventTypeSyncUserSession, ChatEventTypeSyncUserSessionResponse, ChatEventTypeTS, ChatEventTypeTransportReconnected, ChatEventTypeTyping, ChatEventTypeUpdateRoom, ChatEventTypeUserActivity, ChatEventTypeUserActivityUpdate, ChatEventTypeUserInvited, ChatEventTypeUserJoined, ChatEventTypeUserLeft, ChatEventTypeUserPresenceChanged, ChatEventTypeUserPresenceEnd, ChatEventTypeUserPresenceStart, ChatEventTypeUserRemoved, ChatEventTypeUserStatusChange, ChatEventTypeUserSuggestedActionSelected, ChatEventTypeUserSuggestedActions, ChatEventTypeWaiting, ChatEventTypeWaitingForAgent, ChatFlow, ChatGrading, ChatMessage, ChatMessageError, ChatProductReference, ChatQueueInfo, ChatRateLimits, ChatRole, ChatRoleAI, ChatRoleDataQuery, ChatRoleEvent, ChatRoleHumanAgent, ChatRoleObserver, ChatRoleSystem, ChatRoleTS, ChatRoleTool, ChatRoleUser, ChatSession, ChatSessionPreferences, ChatSessionStatus, ChatSessionStatusActive, ChatSessionStatusExpired, ChatSessionStatusIdle, ChatStatus, ChatStatusAbandoned, ChatStatusActive, ChatStatusArchived, ChatStatusClosed, ChatStatusCompleted, ChatStatusDisconnected, ChatStatusTS, ChatStatusUpdate, ChatSummary, ChatTool, ChatType, ChatTypeCustomerSupport, ChatTypeDirect, ChatTypeGroup, ChatTypePrivateRoom, ChatTypePublicRoom, ChatTypeTS, ChatUser, CloseAndDeleteChatSubject, CloseChatRequest, CloseChatResponse, CompleteChatByAgentRequest, CompleteChatByAgentResponse, CompleteChatByAgentSubject, CreateAgentQueueRequest, CreateAgentQueueResponse, CreateAgentQueueSubject, DeleteAgentQueueRequest, DeleteAgentQueueResponse, DeleteAgentQueueSubject, DocumentSource, EmojiReaction, EndAgentSessionRequest, EndAgentSessionResponse, EndAgentSessionSubject, GetActiveChatCountRequest, GetActiveChatCountResponse, GetActiveChatCountSubject, GetActiveChatsRequest, GetActiveChatsResponse, GetActiveChatsSubject, GetAgentContextRequest, GetAgentContextResponse, GetAgentContextSubject, GetAgentQueuesFilter, GetAgentQueuesRequest, GetAgentQueuesResponse, GetAgentQueuesSubject, GetAgentSessionRequest, GetAgentSessionResponse, GetAgentSessionSubject, GetChatRequest, GetChatResponse, GetChatSubject, GetDailyChatCountRequest, GetDailyChatCountResponse, GetDailyChatCountSubject, GetOnlineAgentCountRequest, GetOnlineAgentCountResponse, GetOnlineAgentCountSubject, GetOnlineAgentsRequest, GetOnlineAgentsResponse, GetOnlineAgentsSubject, GetOnlineUsersRequest, GetOnlineUsersResponse, GetOnlineUsersSubject, GetQueueChatCountRequest, GetQueueChatCountResponse, GetQueueChatCountSubject, GetQueueChatsRequest, GetQueueChatsResponse, GetQueueChatsSubject, GetUserChatsRequest, GetUserChatsResponse, GetUserChatsSubject, GetWaitingForAgentChatCountRequest, GetWaitingForAgentChatCountResponse, GetWaitingForAgentChatCountSubject, GetWaitingForAgentChatsRequest, GetWaitingForAgentChatsResponse, GetWaitingForAgentChatsSubject, LLMConfig, LLMFunction, LLMMemoryConfig, LLMResponse, LLMTool, LLMUsage, ListIdleChatsRequest, ListIdleChatsResponse, ListIdleChatsSubject, Location, MarkChatClosedSubject, MemoryContact, MemoryNote, MemoryProfile, MessageStatus, MessageStatusDelivered, MessageStatusFailed, MessageStatusRead, MessageStatusSending, MessageStatusSent, MessageStatusTS, QueueType, QueueTypeComplexity, QueueTypeDepartment, QueueTypeOptionTS, QueueTypePriority, QueueTypeSkill, QueueTypeTS, QueueTypes, RetryAttachmentData, SetupOrgSubject, StartAgentSessionRequest, StartAgentSessionResponse, StartAgentSessionSubject, SummarizeChatResponse, ToolCall, TriggerAnalyticsScanRequest, TriggerAnalyticsScanResponse, TriggerAnalyticsScanSubject, TriggerMemorySummarizationSubject, UpdateAgentLastActivityRequest, UpdateAgentLastActivityResponse, UpdateAgentLastActivitySubject, UpdateAgentQueueRequest, UpdateAgentQueueResponse, UpdateAgentQueueSubject, UpdateAgentStatusRequest, UpdateAgentStatusResponse, UpdateAgentStatusSubject, UpdateUserStatusRequest, UpdateUserStatusResponse, UpdateUserStatusSubject, UserSession, UserStatus, UserStatusAway, UserStatusBusy, UserStatusOffline, UserStatusOnline, UserStatusTS } from './models/index.js';
|
|
4
4
|
import './types-7UNI1iYv.js';
|
|
5
5
|
import '@elqnt/api-client';
|
|
6
6
|
import './api/index.js';
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,7 @@ __export(index_exports, {
|
|
|
128
128
|
ChatEventTypeSyncMetadataResponse: () => ChatEventTypeSyncMetadataResponse,
|
|
129
129
|
ChatEventTypeSyncUserSession: () => ChatEventTypeSyncUserSession,
|
|
130
130
|
ChatEventTypeSyncUserSessionResponse: () => ChatEventTypeSyncUserSessionResponse,
|
|
131
|
+
ChatEventTypeTransportReconnected: () => ChatEventTypeTransportReconnected,
|
|
131
132
|
ChatEventTypeTyping: () => ChatEventTypeTyping,
|
|
132
133
|
ChatEventTypeUpdateRoom: () => ChatEventTypeUpdateRoom,
|
|
133
134
|
ChatEventTypeUserActivity: () => ChatEventTypeUserActivity,
|
|
@@ -166,6 +167,7 @@ __export(index_exports, {
|
|
|
166
167
|
ChatTypeGroup: () => ChatTypeGroup,
|
|
167
168
|
ChatTypePrivateRoom: () => ChatTypePrivateRoom,
|
|
168
169
|
ChatTypePublicRoom: () => ChatTypePublicRoom,
|
|
170
|
+
CloseAndDeleteChatSubject: () => CloseAndDeleteChatSubject,
|
|
169
171
|
CompleteChatByAgentSubject: () => CompleteChatByAgentSubject,
|
|
170
172
|
CreateAgentQueueSubject: () => CreateAgentQueueSubject,
|
|
171
173
|
DeleteAgentQueueSubject: () => DeleteAgentQueueSubject,
|
|
@@ -185,6 +187,8 @@ __export(index_exports, {
|
|
|
185
187
|
GetUserChatsSubject: () => GetUserChatsSubject,
|
|
186
188
|
GetWaitingForAgentChatCountSubject: () => GetWaitingForAgentChatCountSubject,
|
|
187
189
|
GetWaitingForAgentChatsSubject: () => GetWaitingForAgentChatsSubject,
|
|
190
|
+
ListIdleChatsSubject: () => ListIdleChatsSubject,
|
|
191
|
+
MarkChatClosedSubject: () => MarkChatClosedSubject,
|
|
188
192
|
MessageStatusDelivered: () => MessageStatusDelivered,
|
|
189
193
|
MessageStatusFailed: () => MessageStatusFailed,
|
|
190
194
|
MessageStatusRead: () => MessageStatusRead,
|
|
@@ -329,6 +333,7 @@ function createSSETransport(options = {}) {
|
|
|
329
333
|
function setupEventListeners(es) {
|
|
330
334
|
es.addEventListener("message", handleMessage);
|
|
331
335
|
const eventTypes = [
|
|
336
|
+
"error",
|
|
332
337
|
"reconnected",
|
|
333
338
|
"typing",
|
|
334
339
|
"stopped_typing",
|
|
@@ -338,21 +343,53 @@ function createSSETransport(options = {}) {
|
|
|
338
343
|
"human_agent_left",
|
|
339
344
|
"chat_ended",
|
|
340
345
|
"chat_updated",
|
|
346
|
+
"chat_removed",
|
|
341
347
|
"load_chat_response",
|
|
342
348
|
"new_chat_created",
|
|
343
349
|
"show_csat_survey",
|
|
344
350
|
"csat_response",
|
|
345
351
|
"user_suggested_actions",
|
|
352
|
+
"user_suggested_action_selected",
|
|
346
353
|
"agent_execution_started",
|
|
347
354
|
"agent_execution_ended",
|
|
348
355
|
"agent_context_update",
|
|
356
|
+
"load_agent_context_response",
|
|
349
357
|
"plan_pending_approval",
|
|
358
|
+
"plan_approved",
|
|
359
|
+
"plan_rejected",
|
|
350
360
|
"step_started",
|
|
351
361
|
"step_completed",
|
|
352
362
|
"step_failed",
|
|
353
363
|
"plan_completed",
|
|
354
364
|
"skills_changed",
|
|
355
|
-
"summary_update"
|
|
365
|
+
"summary_update",
|
|
366
|
+
"message_status_update",
|
|
367
|
+
"delivered",
|
|
368
|
+
"read",
|
|
369
|
+
"sync_metadata_response",
|
|
370
|
+
"sync_user_session_response",
|
|
371
|
+
"client_action",
|
|
372
|
+
"client_action_callback",
|
|
373
|
+
"attachment_processing_started",
|
|
374
|
+
"attachment_processing_progress",
|
|
375
|
+
"attachment_processing_complete",
|
|
376
|
+
"attachment_processing_error",
|
|
377
|
+
"observer_joined",
|
|
378
|
+
"observer_left",
|
|
379
|
+
"block_user",
|
|
380
|
+
"message_edited",
|
|
381
|
+
"message_deleted",
|
|
382
|
+
"message_reaction",
|
|
383
|
+
"user_presence_changed",
|
|
384
|
+
"online_users",
|
|
385
|
+
"get_agents_response",
|
|
386
|
+
"room_created",
|
|
387
|
+
"room_updated",
|
|
388
|
+
"room_deleted",
|
|
389
|
+
"rooms_response",
|
|
390
|
+
"room_user_joined",
|
|
391
|
+
"room_user_left",
|
|
392
|
+
"user_invited"
|
|
356
393
|
];
|
|
357
394
|
eventTypes.forEach((type) => {
|
|
358
395
|
es.addEventListener(type, handleMessage);
|
|
@@ -399,18 +436,34 @@ function createSSETransport(options = {}) {
|
|
|
399
436
|
state = retryCount > 0 ? "reconnecting" : "connecting";
|
|
400
437
|
return new Promise((resolve, reject) => {
|
|
401
438
|
const connectionStart = Date.now();
|
|
402
|
-
const
|
|
439
|
+
const streamParams = new URLSearchParams({
|
|
440
|
+
orgId: cfg.orgId,
|
|
441
|
+
userId: cfg.userId,
|
|
442
|
+
clientType: cfg.clientType
|
|
443
|
+
});
|
|
444
|
+
if (cfg.chatKey) streamParams.set("chatId", cfg.chatKey);
|
|
445
|
+
const url = `${cfg.baseUrl}/stream?${streamParams.toString()}`;
|
|
403
446
|
logger.debug("Connecting to:", url);
|
|
404
447
|
const es = new EventSource(url);
|
|
405
448
|
es.onopen = () => {
|
|
406
449
|
const connectionTime = Date.now() - connectionStart;
|
|
407
450
|
logger.info(`Connected in ${connectionTime}ms`);
|
|
451
|
+
const wasReconnect = retryCount > 0;
|
|
408
452
|
state = "connected";
|
|
409
453
|
error = void 0;
|
|
410
454
|
retryCount = 0;
|
|
411
455
|
metrics.connectedAt = Date.now();
|
|
412
456
|
metrics.latency = connectionTime;
|
|
413
457
|
setupEventListeners(es);
|
|
458
|
+
if (wasReconnect) {
|
|
459
|
+
emit({
|
|
460
|
+
type: "transport_reconnected",
|
|
461
|
+
orgId: cfg.orgId,
|
|
462
|
+
chatKey: cfg.chatKey || "",
|
|
463
|
+
userId: cfg.userId,
|
|
464
|
+
timestamp: Date.now()
|
|
465
|
+
});
|
|
466
|
+
}
|
|
414
467
|
resolve();
|
|
415
468
|
};
|
|
416
469
|
es.onerror = () => {
|
|
@@ -681,7 +734,13 @@ function createFetchSSETransport(options = {}) {
|
|
|
681
734
|
return events;
|
|
682
735
|
}
|
|
683
736
|
async function startStream(cfg) {
|
|
684
|
-
const
|
|
737
|
+
const streamParams = new URLSearchParams({
|
|
738
|
+
orgId: cfg.orgId,
|
|
739
|
+
userId: cfg.userId,
|
|
740
|
+
clientType: cfg.clientType
|
|
741
|
+
});
|
|
742
|
+
if (cfg.chatKey) streamParams.set("chatId", cfg.chatKey);
|
|
743
|
+
const url = `${cfg.baseUrl}/stream?${streamParams.toString()}`;
|
|
685
744
|
logger.debug("Connecting to:", url);
|
|
686
745
|
abortController = new AbortController();
|
|
687
746
|
const response = await customFetch(url, {
|
|
@@ -787,6 +846,7 @@ function createFetchSSETransport(options = {}) {
|
|
|
787
846
|
state = retryCount > 0 ? "reconnecting" : "connecting";
|
|
788
847
|
const connectionStart = Date.now();
|
|
789
848
|
try {
|
|
849
|
+
const wasReconnect = retryCount > 0;
|
|
790
850
|
await startStream(cfg);
|
|
791
851
|
const connectionTime = Date.now() - connectionStart;
|
|
792
852
|
logger.info(`Connected in ${connectionTime}ms`);
|
|
@@ -795,6 +855,15 @@ function createFetchSSETransport(options = {}) {
|
|
|
795
855
|
retryCount = 0;
|
|
796
856
|
metrics.connectedAt = Date.now();
|
|
797
857
|
metrics.latency = connectionTime;
|
|
858
|
+
if (wasReconnect) {
|
|
859
|
+
emit({
|
|
860
|
+
type: "transport_reconnected",
|
|
861
|
+
orgId: cfg.orgId,
|
|
862
|
+
chatKey: cfg.chatKey || "",
|
|
863
|
+
userId: cfg.userId,
|
|
864
|
+
timestamp: Date.now()
|
|
865
|
+
});
|
|
866
|
+
}
|
|
798
867
|
} catch (err) {
|
|
799
868
|
const connectError = {
|
|
800
869
|
code: "CONNECTION_FAILED",
|
|
@@ -836,7 +905,8 @@ function createFetchSSETransport(options = {}) {
|
|
|
836
905
|
orgId: event.orgId,
|
|
837
906
|
chatKey: event.chatKey,
|
|
838
907
|
userId: event.userId,
|
|
839
|
-
message: event.message
|
|
908
|
+
message: event.message,
|
|
909
|
+
...event.data ? { data: event.data } : {}
|
|
840
910
|
});
|
|
841
911
|
break;
|
|
842
912
|
case "typing":
|
|
@@ -1156,7 +1226,7 @@ function useChat(options) {
|
|
|
1156
1226
|
[orgId, userId]
|
|
1157
1227
|
);
|
|
1158
1228
|
const sendMessage = (0, import_react.useCallback)(
|
|
1159
|
-
async (content, attachments) => {
|
|
1229
|
+
async (content, attachments, data) => {
|
|
1160
1230
|
const transport = transportRef.current;
|
|
1161
1231
|
if (!transport) {
|
|
1162
1232
|
throw new Error("Transport not initialized");
|
|
@@ -1181,7 +1251,8 @@ function useChat(options) {
|
|
|
1181
1251
|
chatKey,
|
|
1182
1252
|
userId,
|
|
1183
1253
|
timestamp: Date.now(),
|
|
1184
|
-
message
|
|
1254
|
+
message,
|
|
1255
|
+
...data ? { data } : {}
|
|
1185
1256
|
});
|
|
1186
1257
|
setMetrics((prev) => ({
|
|
1187
1258
|
...prev,
|
|
@@ -1651,6 +1722,7 @@ var ChatEventTypeStoppedTyping = "stopped_typing";
|
|
|
1651
1722
|
var ChatEventTypeRead = "read";
|
|
1652
1723
|
var ChatEventTypeDelivered = "delivered";
|
|
1653
1724
|
var ChatEventTypeReconnected = "reconnected";
|
|
1725
|
+
var ChatEventTypeTransportReconnected = "transport_reconnected";
|
|
1654
1726
|
var ChatEventTypeError = "error";
|
|
1655
1727
|
var ChatEventTypeWaiting = "waiting";
|
|
1656
1728
|
var ChatEventTypeLoadChat = "load_chat";
|
|
@@ -1790,6 +1862,9 @@ var GetActiveChatsSubject = "chat.get_active_chats";
|
|
|
1790
1862
|
var GetUserChatsSubject = "chat.get_user_chats";
|
|
1791
1863
|
var GetChatSubject = "chat.get_chat";
|
|
1792
1864
|
var ChatArchiveSubjectPattern = "chat.archive.%s.server";
|
|
1865
|
+
var ListIdleChatsSubject = "chat.maintenance.list_idle_chats";
|
|
1866
|
+
var CloseAndDeleteChatSubject = "chat.maintenance.close_and_delete_chat";
|
|
1867
|
+
var MarkChatClosedSubject = "chat.maintenance.mark_closed";
|
|
1793
1868
|
var StartAgentSessionSubject = "chat.agent_session.start";
|
|
1794
1869
|
var EndAgentSessionSubject = "chat.agent_session.end";
|
|
1795
1870
|
var UpdateAgentStatusSubject = "chat.agent_session.update_status";
|
|
@@ -1921,6 +1996,7 @@ var TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
|
|
|
1921
1996
|
ChatEventTypeSyncMetadataResponse,
|
|
1922
1997
|
ChatEventTypeSyncUserSession,
|
|
1923
1998
|
ChatEventTypeSyncUserSessionResponse,
|
|
1999
|
+
ChatEventTypeTransportReconnected,
|
|
1924
2000
|
ChatEventTypeTyping,
|
|
1925
2001
|
ChatEventTypeUpdateRoom,
|
|
1926
2002
|
ChatEventTypeUserActivity,
|
|
@@ -1959,6 +2035,7 @@ var TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
|
|
|
1959
2035
|
ChatTypeGroup,
|
|
1960
2036
|
ChatTypePrivateRoom,
|
|
1961
2037
|
ChatTypePublicRoom,
|
|
2038
|
+
CloseAndDeleteChatSubject,
|
|
1962
2039
|
CompleteChatByAgentSubject,
|
|
1963
2040
|
CreateAgentQueueSubject,
|
|
1964
2041
|
DeleteAgentQueueSubject,
|
|
@@ -1978,6 +2055,8 @@ var TriggerMemorySummarizationSubject = "chat.memory.summarize.nightly";
|
|
|
1978
2055
|
GetUserChatsSubject,
|
|
1979
2056
|
GetWaitingForAgentChatCountSubject,
|
|
1980
2057
|
GetWaitingForAgentChatsSubject,
|
|
2058
|
+
ListIdleChatsSubject,
|
|
2059
|
+
MarkChatClosedSubject,
|
|
1981
2060
|
MessageStatusDelivered,
|
|
1982
2061
|
MessageStatusFailed,
|
|
1983
2062
|
MessageStatusRead,
|