@vezlo/assistant-chat 1.5.0 → 1.6.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/PACKAGE_README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
A React component library for integrating AI assistant chat functionality into web applications with realtime updates and human agent support.
|
|
6
6
|
|
|
7
|
+
**📋 [Changelog](https://github.com/vezlo/assistant-chat/blob/main/CHANGELOG.md)** | **🐛 [Report Issue](https://github.com/vezlo/assistant-chat/issues)**
|
|
8
|
+
|
|
7
9
|
> **📦 This is the NPM package documentation**
|
|
8
10
|
> **🏠 Repository**: [assistant-chat](https://github.com/vezlo/assistant-chat) - Contains both this NPM package and a standalone admin application
|
|
9
11
|
> **🖥️ Standalone App**: Want to run the admin dashboard? Visit the [main repository](https://github.com/vezlo/assistant-chat) for setup instructions
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
A complete chat widget solution with both a React component library and standalone admin application for AI-powered customer support.
|
|
6
6
|
|
|
7
|
+
**📋 [Changelog](./CHANGELOG.md)** | **🐛 [Report Issue](https://github.com/vezlo/assistant-chat/issues)**
|
|
8
|
+
|
|
7
9
|
## What's Included
|
|
8
10
|
|
|
9
11
|
### 📦 NPM Package
|
|
@@ -21,6 +21,7 @@ export interface ConversationListItem {
|
|
|
21
21
|
last_message_at: string | null;
|
|
22
22
|
joined_at: string | null;
|
|
23
23
|
closed_at: string | null;
|
|
24
|
+
archived_at: string | null;
|
|
24
25
|
created_at: string;
|
|
25
26
|
updated_at: string;
|
|
26
27
|
}
|
|
@@ -64,7 +65,7 @@ export declare function getConversation(uuid: string, apiUrl?: string): Promise<
|
|
|
64
65
|
/**
|
|
65
66
|
* Get paginated conversations for agent UI
|
|
66
67
|
*/
|
|
67
|
-
export declare function getConversations(token: string, page?: number, pageSize?: number, orderBy?: string, apiUrl?: string): Promise<ConversationListResponse>;
|
|
68
|
+
export declare function getConversations(token: string, page?: number, pageSize?: number, orderBy?: string, apiUrl?: string, status?: 'active' | 'archived'): Promise<ConversationListResponse>;
|
|
68
69
|
/**
|
|
69
70
|
* Get messages within a conversation
|
|
70
71
|
*/
|
|
@@ -77,6 +78,13 @@ export declare function joinConversation(token: string, conversationUuid: string
|
|
|
77
78
|
* Close a conversation as an agent
|
|
78
79
|
*/
|
|
79
80
|
export declare function closeConversation(token: string, conversationUuid: string, apiUrl?: string): Promise<JoinConversationResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Archive a conversation as an agent
|
|
83
|
+
*/
|
|
84
|
+
export declare function archiveConversation(token: string, conversationUuid: string, apiUrl?: string): Promise<{
|
|
85
|
+
success: boolean;
|
|
86
|
+
archived_at: string;
|
|
87
|
+
}>;
|
|
80
88
|
/**
|
|
81
89
|
* Send agent-authored message
|
|
82
90
|
*/
|
package/lib/api/conversation.js
CHANGED
|
@@ -61,9 +61,10 @@ export async function getConversation(uuid, apiUrl) {
|
|
|
61
61
|
/**
|
|
62
62
|
* Get paginated conversations for agent UI
|
|
63
63
|
*/
|
|
64
|
-
export async function getConversations(token, page = 1, pageSize = 20, orderBy = 'last_message_at', apiUrl) {
|
|
64
|
+
export async function getConversations(token, page = 1, pageSize = 20, orderBy = 'last_message_at', apiUrl, status) {
|
|
65
65
|
const API_BASE_URL = apiUrl || DEFAULT_API_BASE_URL;
|
|
66
|
-
const
|
|
66
|
+
const statusParam = status ? `&status=${status}` : '';
|
|
67
|
+
const response = await fetch(`${API_BASE_URL}/api/conversations?page=${page}&page_size=${pageSize}&order_by=${orderBy}${statusParam}`, {
|
|
67
68
|
method: 'GET',
|
|
68
69
|
headers: {
|
|
69
70
|
Accept: 'application/json',
|
|
@@ -130,6 +131,24 @@ export async function closeConversation(token, conversationUuid, apiUrl) {
|
|
|
130
131
|
}
|
|
131
132
|
return (await response.json());
|
|
132
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Archive a conversation as an agent
|
|
136
|
+
*/
|
|
137
|
+
export async function archiveConversation(token, conversationUuid, apiUrl) {
|
|
138
|
+
const API_BASE_URL = apiUrl || DEFAULT_API_BASE_URL;
|
|
139
|
+
const response = await fetch(`${API_BASE_URL}/api/conversations/${conversationUuid}/archive`, {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
headers: {
|
|
142
|
+
Accept: 'application/json',
|
|
143
|
+
Authorization: `Bearer ${token}`,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
const message = await parseErrorMessage(response);
|
|
148
|
+
throw new Error(message);
|
|
149
|
+
}
|
|
150
|
+
return (await response.json());
|
|
151
|
+
}
|
|
133
152
|
/**
|
|
134
153
|
* Send agent-authored message
|
|
135
154
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vezlo/assistant-chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "React component library for AI-powered chat widgets with RAG knowledge base integration, realtime updates, and human agent support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|