@elqnt/chat 3.0.2 → 3.0.3
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/README.md +27 -0
- package/dist/api/index.d.mts +37 -1
- package/dist/api/index.d.ts +37 -1
- package/dist/api/index.js +40 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +35 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +99 -2
- package/dist/hooks/index.d.ts +99 -2
- package/dist/hooks/index.js +619 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +613 -7
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +625 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +617 -7
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.mts +36 -3
- package/dist/models/index.d.ts +36 -3
- package/dist/models/index.js +6 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/index.mjs +4 -0
- package/dist/models/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
export { UseAsyncOptions, UseAsyncReturn, useApiAsync } from '@elqnt/api-client/hooks';
|
|
2
|
+
import { ChatEvent, Chat, ChatMessage, ChatSummary } from '../models/index.js';
|
|
2
3
|
import { C as ChatTransport, e as TransportError, g as TransportState, R as RetryConfig, b as ConnectionMetrics, U as Unsubscribe } from '../types-7UNI1iYv.js';
|
|
4
|
+
import { ApiClientOptions } from '@elqnt/api-client';
|
|
5
|
+
import { Queue, AgentSession } from '../api/index.js';
|
|
3
6
|
import '@elqnt/kg';
|
|
4
7
|
import '@elqnt/types';
|
|
5
8
|
import '@elqnt/docs';
|
|
@@ -79,4 +82,98 @@ interface UseChatReturn {
|
|
|
79
82
|
*/
|
|
80
83
|
declare function useChat(options: UseChatOptions): UseChatReturn;
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
type UseChatHistoryOptions = ApiClientOptions;
|
|
86
|
+
interface ChatHistoryResult {
|
|
87
|
+
chats: ChatSummary[];
|
|
88
|
+
total: number;
|
|
89
|
+
hasMore: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Hook for chat history CRUD operations
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* const { loading, error, getChatHistory, deleteChat } = useChatHistory({
|
|
97
|
+
* baseUrl: apiGatewayUrl,
|
|
98
|
+
* orgId: selectedOrgId,
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* const { chats, total, hasMore } = await getChatHistory({ limit: 20 });
|
|
102
|
+
* await deleteChat(chatKey);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function useChatHistory(options: UseChatHistoryOptions): {
|
|
106
|
+
loading: boolean;
|
|
107
|
+
error: string | null;
|
|
108
|
+
getChatHistory: (params?: {
|
|
109
|
+
limit?: number;
|
|
110
|
+
offset?: number;
|
|
111
|
+
skipCache?: boolean;
|
|
112
|
+
} | undefined) => Promise<{
|
|
113
|
+
chats: ChatSummary[];
|
|
114
|
+
total: number;
|
|
115
|
+
hasMore: boolean;
|
|
116
|
+
}>;
|
|
117
|
+
getChat: (chatKey: string) => Promise<ChatSummary | null>;
|
|
118
|
+
updateChat: (chatKey: string, updates: {
|
|
119
|
+
title?: string;
|
|
120
|
+
pinned?: boolean;
|
|
121
|
+
}) => Promise<boolean>;
|
|
122
|
+
deleteChat: (chatKey: string) => Promise<boolean>;
|
|
123
|
+
getChatsByUser: (userEmail: string) => Promise<ChatSummary[]>;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
type UseChatMonitoringOptions = ApiClientOptions;
|
|
127
|
+
/**
|
|
128
|
+
* Hook for monitoring active/waiting chats and queues
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```tsx
|
|
132
|
+
* const { loading, error, getActiveChats, getWaitingChatsCount } = useChatMonitoring({
|
|
133
|
+
* baseUrl: apiGatewayUrl,
|
|
134
|
+
* orgId: selectedOrgId,
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* const activeChats = await getActiveChats(24); // last 24 hours
|
|
138
|
+
* const waitingCount = await getWaitingChatsCount();
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare function useChatMonitoring(options: UseChatMonitoringOptions): {
|
|
142
|
+
loading: boolean;
|
|
143
|
+
error: string | null;
|
|
144
|
+
getActiveChats: (pastHours?: number | undefined) => Promise<ChatSummary[]>;
|
|
145
|
+
getActiveChatsCount: () => Promise<number>;
|
|
146
|
+
getWaitingChatsCount: () => Promise<number>;
|
|
147
|
+
listQueues: () => Promise<Queue[]>;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
type UseHumanAgentSessionsOptions = ApiClientOptions;
|
|
151
|
+
/**
|
|
152
|
+
* Hook for human agent session management
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```tsx
|
|
156
|
+
* const { loading, error, getOnlineSessions, getAgentSession } = useHumanAgentSessions({
|
|
157
|
+
* baseUrl: apiGatewayUrl,
|
|
158
|
+
* orgId: selectedOrgId,
|
|
159
|
+
* });
|
|
160
|
+
*
|
|
161
|
+
* const sessions = await getOnlineSessions();
|
|
162
|
+
* const session = await getAgentSession(agentId);
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare function useHumanAgentSessions(options: UseHumanAgentSessionsOptions): {
|
|
166
|
+
loading: boolean;
|
|
167
|
+
error: string | null;
|
|
168
|
+
getOnlineSessions: () => Promise<AgentSession[]>;
|
|
169
|
+
getAgentSession: (agentId: string) => Promise<AgentSession | null>;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Creates a ref that stays synchronized with the provided options.
|
|
174
|
+
* Useful for accessing current options values in callbacks without
|
|
175
|
+
* causing re-renders or stale closure issues.
|
|
176
|
+
*/
|
|
177
|
+
declare function useOptionsRef<T>(options: T): React.MutableRefObject<T>;
|
|
178
|
+
|
|
179
|
+
export { type ChatHistoryResult, type UseChatHistoryOptions, type UseChatMonitoringOptions, type UseChatOptions, type UseChatReturn, type UseHumanAgentSessionsOptions, useChat, useChatHistory, useChatMonitoring, useHumanAgentSessions, useOptionsRef };
|