@warriorteam/redai-zalo-sdk 1.1.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/LICENSE +21 -0
- package/README.md +448 -0
- package/dist/clients/base-client.d.ts +67 -0
- package/dist/clients/base-client.d.ts.map +1 -0
- package/dist/clients/base-client.js +297 -0
- package/dist/clients/base-client.js.map +1 -0
- package/dist/clients/zalo-client.d.ts +131 -0
- package/dist/clients/zalo-client.d.ts.map +1 -0
- package/dist/clients/zalo-client.js +215 -0
- package/dist/clients/zalo-client.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/services/article.service.d.ts +144 -0
- package/dist/services/article.service.d.ts.map +1 -0
- package/dist/services/article.service.js +518 -0
- package/dist/services/article.service.js.map +1 -0
- package/dist/services/auth.service.d.ts +55 -0
- package/dist/services/auth.service.d.ts.map +1 -0
- package/dist/services/auth.service.js +269 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/consultation.service.d.ts +73 -0
- package/dist/services/consultation.service.d.ts.map +1 -0
- package/dist/services/consultation.service.js +208 -0
- package/dist/services/consultation.service.js.map +1 -0
- package/dist/services/general-message.service.d.ts +85 -0
- package/dist/services/general-message.service.d.ts.map +1 -0
- package/dist/services/general-message.service.js +248 -0
- package/dist/services/general-message.service.js.map +1 -0
- package/dist/services/group-management.service.d.ts +220 -0
- package/dist/services/group-management.service.d.ts.map +1 -0
- package/dist/services/group-management.service.js +562 -0
- package/dist/services/group-management.service.js.map +1 -0
- package/dist/services/group-message.service.d.ts +102 -0
- package/dist/services/group-message.service.d.ts.map +1 -0
- package/dist/services/group-message.service.js +233 -0
- package/dist/services/group-message.service.js.map +1 -0
- package/dist/services/message-management.service.d.ts +135 -0
- package/dist/services/message-management.service.d.ts.map +1 -0
- package/dist/services/message-management.service.js +237 -0
- package/dist/services/message-management.service.js.map +1 -0
- package/dist/services/oa.service.d.ts +67 -0
- package/dist/services/oa.service.d.ts.map +1 -0
- package/dist/services/oa.service.js +223 -0
- package/dist/services/oa.service.js.map +1 -0
- package/dist/services/promotion.service.d.ts +114 -0
- package/dist/services/promotion.service.d.ts.map +1 -0
- package/dist/services/promotion.service.js +247 -0
- package/dist/services/promotion.service.js.map +1 -0
- package/dist/services/tag.service.d.ts +144 -0
- package/dist/services/tag.service.d.ts.map +1 -0
- package/dist/services/tag.service.js +184 -0
- package/dist/services/tag.service.js.map +1 -0
- package/dist/services/transaction.service.d.ts +110 -0
- package/dist/services/transaction.service.d.ts.map +1 -0
- package/dist/services/transaction.service.js +231 -0
- package/dist/services/transaction.service.js.map +1 -0
- package/dist/services/user-management.service.d.ts +117 -0
- package/dist/services/user-management.service.d.ts.map +1 -0
- package/dist/services/user-management.service.js +239 -0
- package/dist/services/user-management.service.js.map +1 -0
- package/dist/services/user.service.d.ts +84 -0
- package/dist/services/user.service.d.ts.map +1 -0
- package/dist/services/user.service.js +323 -0
- package/dist/services/user.service.js.map +1 -0
- package/dist/services/video-upload.service.d.ts +83 -0
- package/dist/services/video-upload.service.d.ts.map +1 -0
- package/dist/services/video-upload.service.js +267 -0
- package/dist/services/video-upload.service.js.map +1 -0
- package/dist/services/zns.service.d.ts +116 -0
- package/dist/services/zns.service.d.ts.map +1 -0
- package/dist/services/zns.service.js +234 -0
- package/dist/services/zns.service.js.map +1 -0
- package/dist/types/article.d.ts +352 -0
- package/dist/types/article.d.ts.map +1 -0
- package/dist/types/article.js +70 -0
- package/dist/types/article.js.map +1 -0
- package/dist/types/auth.d.ts +233 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +39 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/common.d.ts +237 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +42 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/group.d.ts +523 -0
- package/dist/types/group.d.ts.map +1 -0
- package/dist/types/group.js +6 -0
- package/dist/types/group.js.map +1 -0
- package/dist/types/message.d.ts +333 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/message.js +17 -0
- package/dist/types/message.js.map +1 -0
- package/dist/types/oa.d.ts +285 -0
- package/dist/types/oa.d.ts.map +1 -0
- package/dist/types/oa.js +25 -0
- package/dist/types/oa.js.map +1 -0
- package/dist/types/social.d.ts +427 -0
- package/dist/types/social.d.ts.map +1 -0
- package/dist/types/social.js +6 -0
- package/dist/types/social.js.map +1 -0
- package/dist/types/user-management.d.ts +280 -0
- package/dist/types/user-management.d.ts.map +1 -0
- package/dist/types/user-management.js +6 -0
- package/dist/types/user-management.js.map +1 -0
- package/dist/types/user.d.ts +365 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +17 -0
- package/dist/types/user.js.map +1 -0
- package/dist/types/webhook.d.ts +1972 -0
- package/dist/types/webhook.d.ts.map +1 -0
- package/dist/types/webhook.js +419 -0
- package/dist/types/webhook.js.map +1 -0
- package/dist/types/zns.d.ts +277 -0
- package/dist/types/zns.d.ts.map +1 -0
- package/dist/types/zns.js +6 -0
- package/dist/types/zns.js.map +1 -0
- package/dist/zalo-sdk.d.ts +228 -0
- package/dist/zalo-sdk.d.ts.map +1 -0
- package/dist/zalo-sdk.js +307 -0
- package/dist/zalo-sdk.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageManagementService = void 0;
|
|
4
|
+
const common_1 = require("../types/common");
|
|
5
|
+
/**
|
|
6
|
+
* Service xử lý các API quản lý tin nhắn của Zalo Official Account
|
|
7
|
+
*
|
|
8
|
+
* Bao gồm các chức năng:
|
|
9
|
+
* - Kiểm tra hạn mức gửi tin nhắn
|
|
10
|
+
* - Lấy danh sách tin nhắn trong cuộc hội thoại
|
|
11
|
+
* - Lấy danh sách cuộc hội thoại
|
|
12
|
+
* - Upload file và hình ảnh
|
|
13
|
+
* - Quản lý trạng thái tin nhắn
|
|
14
|
+
*
|
|
15
|
+
* ĐIỀU KIỆN SỬ DỤNG:
|
|
16
|
+
*
|
|
17
|
+
* 1. KIỂM TRA HẠN MỨC:
|
|
18
|
+
* - Cần quyền truy cập thông tin quota từ Zalo
|
|
19
|
+
* - Quota được reset hàng ngày vào 00:00 GMT+7
|
|
20
|
+
*
|
|
21
|
+
* 2. LẤY TIN NHẮN:
|
|
22
|
+
* - Chỉ có thể lấy tin nhắn trong vòng 7 ngày gần nhất
|
|
23
|
+
* - Tối đa 50 tin nhắn mỗi lần gọi API
|
|
24
|
+
*
|
|
25
|
+
* 3. UPLOAD FILE:
|
|
26
|
+
* - Kích thước tối đa 25MB
|
|
27
|
+
* - Hỗ trợ các định dạng: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX
|
|
28
|
+
*
|
|
29
|
+
* 4. UPLOAD HÌNH ẢNH:
|
|
30
|
+
* - Kích thước tối đa 5MB
|
|
31
|
+
* - Hỗ trợ các định dạng: JPG, PNG, GIF
|
|
32
|
+
*/
|
|
33
|
+
class MessageManagementService {
|
|
34
|
+
constructor(client) {
|
|
35
|
+
this.client = client;
|
|
36
|
+
this.baseApiUrl = "https://openapi.zalo.me/v2.0/oa";
|
|
37
|
+
this.uploadApiUrl = "https://openapi.zalo.me/v2.0/oa/upload";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Kiểm tra hạn mức gửi tin nhắn đến user cụ thể
|
|
41
|
+
* @param accessToken Access token của Official Account
|
|
42
|
+
* @param userId ID của người dùng Zalo
|
|
43
|
+
* @returns Thông tin hạn mức gửi tin nhắn
|
|
44
|
+
*/
|
|
45
|
+
async checkMessageQuota(accessToken, userId) {
|
|
46
|
+
try {
|
|
47
|
+
const result = await this.client.apiGet(`${this.baseApiUrl}/quota`, accessToken, { user_id: userId });
|
|
48
|
+
if (result.error !== 0) {
|
|
49
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to check message quota", result.error, result);
|
|
50
|
+
}
|
|
51
|
+
if (!result.data) {
|
|
52
|
+
throw new common_1.ZaloSDKError("No quota data received", -1);
|
|
53
|
+
}
|
|
54
|
+
return result.data;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
throw new common_1.ZaloSDKError(`Failed to check message quota: ${error.message}`, -1, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Lấy danh sách tin nhắn trong cuộc hội thoại với user
|
|
65
|
+
* @param accessToken Access token của Official Account
|
|
66
|
+
* @param userId ID của người dùng Zalo
|
|
67
|
+
* @param offset Vị trí bắt đầu lấy tin nhắn (mặc định: 0)
|
|
68
|
+
* @param count Số lượng tin nhắn cần lấy (mặc định: 20, tối đa: 50)
|
|
69
|
+
* @returns Danh sách tin nhắn và thông tin phân trang
|
|
70
|
+
*/
|
|
71
|
+
async getConversationMessages(accessToken, userId, offset = 0, count = 20) {
|
|
72
|
+
try {
|
|
73
|
+
if (count > 50) {
|
|
74
|
+
throw new common_1.ZaloSDKError("Số lượng tin nhắn tối đa là 50", -1);
|
|
75
|
+
}
|
|
76
|
+
const result = await this.client.apiGet(`${this.baseApiUrl}/conversation`, accessToken, {
|
|
77
|
+
user_id: userId,
|
|
78
|
+
offset,
|
|
79
|
+
count,
|
|
80
|
+
});
|
|
81
|
+
if (result.error !== 0) {
|
|
82
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get conversation messages", result.error, result);
|
|
83
|
+
}
|
|
84
|
+
if (!result.data) {
|
|
85
|
+
throw new common_1.ZaloSDKError("No conversation data received", -1);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
messages: result.data.messages,
|
|
89
|
+
pagination: {
|
|
90
|
+
offset,
|
|
91
|
+
count,
|
|
92
|
+
total: result.data.total,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
throw new common_1.ZaloSDKError(`Failed to get conversation messages: ${error.message}`, -1, error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Lấy danh sách cuộc hội thoại gần đây
|
|
105
|
+
* @param accessToken Access token của Official Account
|
|
106
|
+
* @param offset Vị trí bắt đầu lấy cuộc hội thoại (mặc định: 0)
|
|
107
|
+
* @param count Số lượng cuộc hội thoại cần lấy (mặc định: 20, tối đa: 50)
|
|
108
|
+
* @returns Danh sách cuộc hội thoại và thông tin phân trang
|
|
109
|
+
*/
|
|
110
|
+
async getRecentConversations(accessToken, offset = 0, count = 20) {
|
|
111
|
+
try {
|
|
112
|
+
if (count > 50) {
|
|
113
|
+
throw new common_1.ZaloSDKError("Số lượng cuộc hội thoại tối đa là 50", -1);
|
|
114
|
+
}
|
|
115
|
+
const result = await this.client.apiGet(`${this.baseApiUrl}/listrecentchat`, accessToken, {
|
|
116
|
+
offset,
|
|
117
|
+
count,
|
|
118
|
+
});
|
|
119
|
+
if (result.error !== 0) {
|
|
120
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to get recent conversations", result.error, result);
|
|
121
|
+
}
|
|
122
|
+
if (!result.data) {
|
|
123
|
+
throw new common_1.ZaloSDKError("No conversations data received", -1);
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
conversations: result.data.conversations,
|
|
127
|
+
pagination: {
|
|
128
|
+
offset,
|
|
129
|
+
count,
|
|
130
|
+
total: result.data.total,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
throw new common_1.ZaloSDKError(`Failed to get recent conversations: ${error.message}`, -1, error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Upload file để sử dụng trong tin nhắn
|
|
143
|
+
* @param accessToken Access token của Official Account
|
|
144
|
+
* @param fileData Dữ liệu file (base64 hoặc buffer)
|
|
145
|
+
* @param fileName Tên file
|
|
146
|
+
* @returns Thông tin file đã upload
|
|
147
|
+
*/
|
|
148
|
+
async uploadFile(accessToken, fileData, fileName) {
|
|
149
|
+
try {
|
|
150
|
+
// Validate file size (max 25MB)
|
|
151
|
+
const maxSize = 25 * 1024 * 1024; // 25MB
|
|
152
|
+
let fileSize;
|
|
153
|
+
if (typeof fileData === "string") {
|
|
154
|
+
// Base64 string
|
|
155
|
+
fileSize = Buffer.from(fileData, "base64").length;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
// Buffer
|
|
159
|
+
fileSize = fileData.length;
|
|
160
|
+
}
|
|
161
|
+
if (fileSize > maxSize) {
|
|
162
|
+
throw new common_1.ZaloSDKError("Kích thước file không được vượt quá 25MB", -1);
|
|
163
|
+
}
|
|
164
|
+
const formData = new FormData();
|
|
165
|
+
if (typeof fileData === "string") {
|
|
166
|
+
const buffer = Buffer.from(fileData, "base64");
|
|
167
|
+
formData.append("file", new Blob([new Uint8Array(buffer)]), fileName);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
formData.append("file", new Blob([new Uint8Array(fileData)]), fileName);
|
|
171
|
+
}
|
|
172
|
+
const result = await this.client.apiPost(`${this.uploadApiUrl}/file`, accessToken, formData);
|
|
173
|
+
if (result.error !== 0) {
|
|
174
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to upload file", result.error, result);
|
|
175
|
+
}
|
|
176
|
+
if (!result.data) {
|
|
177
|
+
throw new common_1.ZaloSDKError("No upload result received", -1);
|
|
178
|
+
}
|
|
179
|
+
return result.data;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
throw new common_1.ZaloSDKError(`Failed to upload file: ${error.message}`, -1, error);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Upload hình ảnh để sử dụng trong tin nhắn
|
|
190
|
+
* @param accessToken Access token của Official Account
|
|
191
|
+
* @param imageData Dữ liệu hình ảnh (base64 hoặc buffer)
|
|
192
|
+
* @param fileName Tên file hình ảnh
|
|
193
|
+
* @returns Thông tin hình ảnh đã upload
|
|
194
|
+
*/
|
|
195
|
+
async uploadImage(accessToken, imageData, fileName) {
|
|
196
|
+
try {
|
|
197
|
+
// Validate image size (max 5MB)
|
|
198
|
+
const maxSize = 5 * 1024 * 1024; // 5MB
|
|
199
|
+
let imageSize;
|
|
200
|
+
if (typeof imageData === "string") {
|
|
201
|
+
// Base64 string
|
|
202
|
+
imageSize = Buffer.from(imageData, "base64").length;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// Buffer
|
|
206
|
+
imageSize = imageData.length;
|
|
207
|
+
}
|
|
208
|
+
if (imageSize > maxSize) {
|
|
209
|
+
throw new common_1.ZaloSDKError("Kích thước hình ảnh không được vượt quá 5MB", -1);
|
|
210
|
+
}
|
|
211
|
+
const formData = new FormData();
|
|
212
|
+
if (typeof imageData === "string") {
|
|
213
|
+
const buffer = Buffer.from(imageData, "base64");
|
|
214
|
+
formData.append("file", new Blob([new Uint8Array(buffer)]), fileName);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
formData.append("file", new Blob([new Uint8Array(imageData)]), fileName);
|
|
218
|
+
}
|
|
219
|
+
const result = await this.client.apiPost(`${this.uploadApiUrl}/image`, accessToken, formData);
|
|
220
|
+
if (result.error !== 0) {
|
|
221
|
+
throw new common_1.ZaloSDKError(result.message || "Failed to upload image", result.error, result);
|
|
222
|
+
}
|
|
223
|
+
if (!result.data) {
|
|
224
|
+
throw new common_1.ZaloSDKError("No upload result received", -1);
|
|
225
|
+
}
|
|
226
|
+
return result.data;
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
throw new common_1.ZaloSDKError(`Failed to upload image: ${error.message}`, -1, error);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
exports.MessageManagementService = MessageManagementService;
|
|
237
|
+
//# sourceMappingURL=message-management.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-management.service.js","sourceRoot":"","sources":["../../src/services/message-management.service.ts"],"names":[],"mappings":";;;AACA,4CAA6D;AA4D7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,wBAAwB;IAInC,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH9B,eAAU,GAAG,iCAAiC,CAAC;QAC/C,iBAAY,GAAG,wCAAwC,CAAC;IAEvB,CAAC;IAEnD;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,WAAmB,EACnB,MAAc;QAEd,IAAI,CAAC;YACH,MAAM,MAAM,GAAmC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACrE,GAAG,IAAI,CAAC,UAAU,QAAQ,EAC1B,WAAW,EACX,EAAE,OAAO,EAAE,MAAM,EAAE,CACpB,CAAC;YAEF,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,qBAAY,CACpB,MAAM,CAAC,OAAO,IAAI,+BAA+B,EACjD,MAAM,CAAC,KAAK,EACZ,MAAM,CACP,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,IAAI,qBAAY,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,CAAC;YACvD,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,O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
* Official Account (OA) service for Zalo API
|
|
3
|
+
*/
|
|
4
|
+
import { ZaloClient } from '../clients/zalo-client';
|
|
5
|
+
import { OAInfo, MessageQuota, QuotaMessageRequest, QuotaAsset, OAStatistics, UpdateOAProfileRequest, GMFProductType } from '../types/oa';
|
|
6
|
+
/**
|
|
7
|
+
* Official Account service for managing OA information and settings
|
|
8
|
+
*/
|
|
9
|
+
export declare class OAService {
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(client: ZaloClient);
|
|
12
|
+
/**
|
|
13
|
+
* Get Official Account information
|
|
14
|
+
*/
|
|
15
|
+
getOAInfo(accessToken: string): Promise<OAInfo>;
|
|
16
|
+
/**
|
|
17
|
+
* Get message quota information
|
|
18
|
+
*/
|
|
19
|
+
getMessageQuota(accessToken: string): Promise<MessageQuota>;
|
|
20
|
+
/**
|
|
21
|
+
* Get detailed quota message information
|
|
22
|
+
*/
|
|
23
|
+
getDetailedQuotaMessage(accessToken: string, request: QuotaMessageRequest): Promise<QuotaAsset[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Get quota for specific product type
|
|
26
|
+
*/
|
|
27
|
+
getQuotaByProductType(accessToken: string, productType: 'cs' | 'transaction' | 'gmf10' | 'gmf50' | 'gmf100', quotaType?: 'sub_quota' | 'purchase_quota' | 'reward_quota'): Promise<QuotaAsset[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get available GMF quota
|
|
30
|
+
*/
|
|
31
|
+
getGMFQuota(accessToken: string, gmfType?: GMFProductType): Promise<QuotaAsset[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Get consultation message quota
|
|
34
|
+
*/
|
|
35
|
+
getConsultationQuota(accessToken: string): Promise<QuotaAsset[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Get transaction message quota
|
|
38
|
+
*/
|
|
39
|
+
getTransactionQuota(accessToken: string): Promise<QuotaAsset[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Update OA profile information
|
|
42
|
+
*/
|
|
43
|
+
updateOAProfile(accessToken: string, profileData: UpdateOAProfileRequest): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Get OA statistics (if available)
|
|
46
|
+
*/
|
|
47
|
+
getOAStatistics(accessToken: string): Promise<OAStatistics>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if OA has sufficient quota for message type
|
|
50
|
+
*/
|
|
51
|
+
hasQuotaForMessageType(accessToken: string, messageType: 'cs' | 'transaction' | 'promotion', requiredCount?: number): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Get quota summary for all message types
|
|
54
|
+
*/
|
|
55
|
+
getQuotaSummary(accessToken: string): Promise<{
|
|
56
|
+
consultation: QuotaAsset[];
|
|
57
|
+
transaction: QuotaAsset[];
|
|
58
|
+
gmf10: QuotaAsset[];
|
|
59
|
+
gmf50: QuotaAsset[];
|
|
60
|
+
gmf100: QuotaAsset[];
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Validate OA access token by getting OA info
|
|
64
|
+
*/
|
|
65
|
+
validateOAToken(accessToken: string): Promise<boolean>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=oa.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oa.service.d.ts","sourceRoot":"","sources":["../../src/services/oa.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,mBAAmB,EAEnB,UAAU,EAEV,YAAY,EACZ,sBAAsB,EAEtB,cAAc,EAEf,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C;;OAEG;IACU,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B5D;;OAEG;IACU,eAAe,CAAC,WAAW,EAAE,MAA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E,UAAU,EAAE,CAAC;KACtB,CAAC;IAyBF;;OAEG;IACU,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAQpE"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Official Account (OA) service for Zalo API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OAService = void 0;
|
|
7
|
+
const oa_1 = require("../types/oa");
|
|
8
|
+
const common_1 = require("../types/common");
|
|
9
|
+
/**
|
|
10
|
+
* Official Account service for managing OA information and settings
|
|
11
|
+
*/
|
|
12
|
+
class OAService {
|
|
13
|
+
constructor(client) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get Official Account information
|
|
18
|
+
*/
|
|
19
|
+
async getOAInfo(accessToken) {
|
|
20
|
+
try {
|
|
21
|
+
const endpoint = this.client.endpoints.oa.info;
|
|
22
|
+
const result = await this.client.apiGet(endpoint, accessToken);
|
|
23
|
+
if (result.error !== 0) {
|
|
24
|
+
throw new common_1.ZaloSDKError(result.message || 'Failed to get OA information', result.error, result);
|
|
25
|
+
}
|
|
26
|
+
if (!result.data) {
|
|
27
|
+
throw new common_1.ZaloSDKError('No OA data received', -1);
|
|
28
|
+
}
|
|
29
|
+
return result.data;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
throw new common_1.ZaloSDKError(`Failed to get OA info: ${error.message}`, -1, error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get message quota information
|
|
40
|
+
*/
|
|
41
|
+
async getMessageQuota(accessToken) {
|
|
42
|
+
try {
|
|
43
|
+
const endpoint = this.client.endpoints.oa.quota;
|
|
44
|
+
const result = await this.client.apiGet(endpoint, accessToken);
|
|
45
|
+
if (result.error !== 0) {
|
|
46
|
+
throw new common_1.ZaloSDKError(result.message || 'Failed to get message quota', result.error, result);
|
|
47
|
+
}
|
|
48
|
+
if (!result.data) {
|
|
49
|
+
throw new common_1.ZaloSDKError('No quota data received', -1);
|
|
50
|
+
}
|
|
51
|
+
return result.data;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
throw new common_1.ZaloSDKError(`Failed to get message quota: ${error.message}`, -1, error);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get detailed quota message information
|
|
62
|
+
*/
|
|
63
|
+
async getDetailedQuotaMessage(accessToken, request) {
|
|
64
|
+
try {
|
|
65
|
+
const endpoint = this.client.endpoints.oa.quotaMessage;
|
|
66
|
+
const result = await this.client.apiPost(endpoint, accessToken, request);
|
|
67
|
+
if (result.error !== 0) {
|
|
68
|
+
throw new common_1.ZaloSDKError(result.message || 'Failed to get detailed quota message', result.error, result);
|
|
69
|
+
}
|
|
70
|
+
return result.data || [];
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
throw new common_1.ZaloSDKError(`Failed to get detailed quota message: ${error.message}`, -1, error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get quota for specific product type
|
|
81
|
+
*/
|
|
82
|
+
async getQuotaByProductType(accessToken, productType, quotaType) {
|
|
83
|
+
const request = {
|
|
84
|
+
quota_owner: 'OA',
|
|
85
|
+
product_type: productType,
|
|
86
|
+
quota_type: quotaType,
|
|
87
|
+
};
|
|
88
|
+
return this.getDetailedQuotaMessage(accessToken, request);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get available GMF quota
|
|
92
|
+
*/
|
|
93
|
+
async getGMFQuota(accessToken, gmfType = oa_1.GMFProductType.GMF10) {
|
|
94
|
+
return this.getQuotaByProductType(accessToken, gmfType);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get consultation message quota
|
|
98
|
+
*/
|
|
99
|
+
async getConsultationQuota(accessToken) {
|
|
100
|
+
return this.getQuotaByProductType(accessToken, 'cs');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get transaction message quota
|
|
104
|
+
*/
|
|
105
|
+
async getTransactionQuota(accessToken) {
|
|
106
|
+
return this.getQuotaByProductType(accessToken, 'transaction');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Update OA profile information
|
|
110
|
+
*/
|
|
111
|
+
async updateOAProfile(accessToken, profileData) {
|
|
112
|
+
try {
|
|
113
|
+
// Note: This endpoint might not be available in all Zalo API versions
|
|
114
|
+
// This is a placeholder implementation
|
|
115
|
+
const endpoint = '/v2.0/oa/update';
|
|
116
|
+
const result = await this.client.apiPost(endpoint, accessToken, profileData);
|
|
117
|
+
if (result.error !== 0) {
|
|
118
|
+
throw new common_1.ZaloSDKError(result.message || 'Failed to update OA profile', result.error, result);
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
throw new common_1.ZaloSDKError(`Failed to update OA profile: ${error.message}`, -1, error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get OA statistics (if available)
|
|
131
|
+
*/
|
|
132
|
+
async getOAStatistics(accessToken) {
|
|
133
|
+
try {
|
|
134
|
+
// Note: This endpoint might not be available in all Zalo API versions
|
|
135
|
+
// This is a placeholder implementation
|
|
136
|
+
const endpoint = '/v2.0/oa/statistics';
|
|
137
|
+
const result = await this.client.apiGet(endpoint, accessToken);
|
|
138
|
+
if (result.error !== 0) {
|
|
139
|
+
throw new common_1.ZaloSDKError(result.message || 'Failed to get OA statistics', result.error, result);
|
|
140
|
+
}
|
|
141
|
+
return result.data || {
|
|
142
|
+
total_followers: 0,
|
|
143
|
+
new_followers_today: 0,
|
|
144
|
+
messages_sent_today: 0,
|
|
145
|
+
messages_received_today: 0,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
throw new common_1.ZaloSDKError(`Failed to get OA statistics: ${error.message}`, -1, error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Check if OA has sufficient quota for message type
|
|
157
|
+
*/
|
|
158
|
+
async hasQuotaForMessageType(accessToken, messageType, requiredCount = 1) {
|
|
159
|
+
try {
|
|
160
|
+
let productType;
|
|
161
|
+
if (messageType === 'promotion') {
|
|
162
|
+
// Promotion messages might use different quota logic
|
|
163
|
+
return true; // Placeholder
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
productType = messageType;
|
|
167
|
+
}
|
|
168
|
+
const quotaAssets = await this.getQuotaByProductType(accessToken, productType);
|
|
169
|
+
// Check if there are available assets
|
|
170
|
+
const availableAssets = quotaAssets.filter(asset => asset.status === 'available');
|
|
171
|
+
if (availableAssets.length === 0) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
// For simplicity, assume each available asset can handle the required count
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
// If we can't check quota, assume it's available to avoid blocking
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get quota summary for all message types
|
|
184
|
+
*/
|
|
185
|
+
async getQuotaSummary(accessToken) {
|
|
186
|
+
try {
|
|
187
|
+
const [consultation, transaction, gmf10, gmf50, gmf100] = await Promise.all([
|
|
188
|
+
this.getConsultationQuota(accessToken),
|
|
189
|
+
this.getTransactionQuota(accessToken),
|
|
190
|
+
this.getGMFQuota(accessToken, oa_1.GMFProductType.GMF10),
|
|
191
|
+
this.getGMFQuota(accessToken, oa_1.GMFProductType.GMF50),
|
|
192
|
+
this.getGMFQuota(accessToken, oa_1.GMFProductType.GMF100),
|
|
193
|
+
]);
|
|
194
|
+
return {
|
|
195
|
+
consultation,
|
|
196
|
+
transaction,
|
|
197
|
+
gmf10,
|
|
198
|
+
gmf50,
|
|
199
|
+
gmf100,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
throw new common_1.ZaloSDKError(`Failed to get quota summary: ${error.message}`, -1, error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Validate OA access token by getting OA info
|
|
211
|
+
*/
|
|
212
|
+
async validateOAToken(accessToken) {
|
|
213
|
+
try {
|
|
214
|
+
await this.getOAInfo(accessToken);
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.OAService = OAService;
|
|
223
|
+
//# sourceMappingURL=oa.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oa.service.js","sourceRoot":"","sources":["../../src/services/oa.service.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,oCAYqB;AACrB,4CAA6D;AAE7D;;GAEG;AACH,MAAa,SAAS;IACpB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;OAEG;IACI,KAAK,CAAC,SAAS,CAAC,WAAmB;QACxC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM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C,WAAmB;QAC9C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAhRD,8BAgRC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ZaloClient } from "../clients/zalo-client";
|
|
2
|
+
import { SendMessageResponse, PromotionMessage, MessageRecipient } from "../types/message";
|
|
3
|
+
/**
|
|
4
|
+
* Service xử lý các API tin nhắn truyền thông/quảng cáo của Zalo Official Account
|
|
5
|
+
*
|
|
6
|
+
* ĐIỀU KIỆN GỬI TIN TRUYỀN THÔNG:
|
|
7
|
+
*
|
|
8
|
+
* 1. THỜI GIAN GỬI:
|
|
9
|
+
* - Chỉ được gửi trong khung giờ từ 8:00 - 22:00 hàng ngày
|
|
10
|
+
* - Không được gửi vào các ngày lễ, tết theo quy định
|
|
11
|
+
*
|
|
12
|
+
* 2. NỘI DUNG TIN NHẮN:
|
|
13
|
+
* - Phải là nội dung quảng cáo, khuyến mãi, tin tức
|
|
14
|
+
* - Không được chứa nội dung vi phạm pháp luật
|
|
15
|
+
* - Phải tuân thủ quy định về quảng cáo của Việt Nam
|
|
16
|
+
*
|
|
17
|
+
* 3. TẦN SUẤT GỬI:
|
|
18
|
+
* - Tối đa 1 tin nhắn truyền thông/ngày cho mỗi người dùng
|
|
19
|
+
* - Người dùng có thể từ chối nhận tin truyền thông
|
|
20
|
+
*
|
|
21
|
+
* 4. ĐỊNH DẠNG:
|
|
22
|
+
* - Phải sử dụng template được Zalo phê duyệt trước
|
|
23
|
+
* - Template phải tuân thủ format chuẩn của tin truyền thông
|
|
24
|
+
*
|
|
25
|
+
* 5. NGƯỜI DÙNG:
|
|
26
|
+
* - Người dùng phải đã follow OA
|
|
27
|
+
* - Người dùng không được block OA
|
|
28
|
+
* - Người dùng không được từ chối nhận tin truyền thông
|
|
29
|
+
*
|
|
30
|
+
* 6. OFFICIAL ACCOUNT:
|
|
31
|
+
* - OA phải được xác minh (verified)
|
|
32
|
+
* - OA phải có quyền gửi tin truyền thông được Zalo cấp phép
|
|
33
|
+
* - OA không được vi phạm chính sách về quảng cáo
|
|
34
|
+
*
|
|
35
|
+
* LỖI THƯỜNG GẶP:
|
|
36
|
+
* - 2001: Ngoài khung giờ cho phép (8:00-22:00)
|
|
37
|
+
* - 2002: Người dùng đã từ chối nhận tin truyền thông
|
|
38
|
+
* - 2003: Vượt quá giới hạn 1 tin/ngày
|
|
39
|
+
* - 2004: Template chưa được phê duyệt
|
|
40
|
+
* - 2005: Nội dung vi phạm chính sách quảng cáo
|
|
41
|
+
* - 2006: OA chưa có quyền gửi tin truyền thông
|
|
42
|
+
*/
|
|
43
|
+
export declare class PromotionService {
|
|
44
|
+
private readonly client;
|
|
45
|
+
private readonly promotionApiUrl;
|
|
46
|
+
constructor(client: ZaloClient);
|
|
47
|
+
/**
|
|
48
|
+
* Gửi tin nhắn truyền thông/quảng cáo
|
|
49
|
+
* @param accessToken Access token của Official Account
|
|
50
|
+
* @param recipient Thông tin người nhận
|
|
51
|
+
* @param message Nội dung tin nhắn truyền thông
|
|
52
|
+
* @returns Thông tin tin nhắn đã gửi
|
|
53
|
+
*/
|
|
54
|
+
sendPromotionMessage(accessToken: string, recipient: MessageRecipient, message: PromotionMessage): Promise<SendMessageResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Gửi tin nhắn khuyến mãi sản phẩm
|
|
57
|
+
* @param accessToken Access token của Official Account
|
|
58
|
+
* @param recipient Thông tin người nhận
|
|
59
|
+
* @param promotionInfo Thông tin khuyến mãi
|
|
60
|
+
* @returns Thông tin tin nhắn đã gửi
|
|
61
|
+
*/
|
|
62
|
+
sendProductPromotion(accessToken: string, recipient: MessageRecipient, promotionInfo: {
|
|
63
|
+
title: string;
|
|
64
|
+
description: string;
|
|
65
|
+
imageUrl: string;
|
|
66
|
+
originalPrice: number;
|
|
67
|
+
discountPrice: number;
|
|
68
|
+
discountPercent: number;
|
|
69
|
+
validUntil: string;
|
|
70
|
+
productUrl: string;
|
|
71
|
+
}): Promise<SendMessageResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Gửi tin nhắn thông báo sự kiện
|
|
74
|
+
* @param accessToken Access token của Official Account
|
|
75
|
+
* @param recipient Thông tin người nhận
|
|
76
|
+
* @param eventInfo Thông tin sự kiện
|
|
77
|
+
* @returns Thông tin tin nhắn đã gửi
|
|
78
|
+
*/
|
|
79
|
+
sendEventNotification(accessToken: string, recipient: MessageRecipient, eventInfo: {
|
|
80
|
+
title: string;
|
|
81
|
+
description: string;
|
|
82
|
+
imageUrl: string;
|
|
83
|
+
eventDate: string;
|
|
84
|
+
location: string;
|
|
85
|
+
registrationUrl: string;
|
|
86
|
+
}): Promise<SendMessageResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Gửi tin nhắn newsletter
|
|
89
|
+
* @param accessToken Access token của Official Account
|
|
90
|
+
* @param recipient Thông tin người nhận
|
|
91
|
+
* @param newsletterInfo Thông tin newsletter
|
|
92
|
+
* @returns Thông tin tin nhắn đã gửi
|
|
93
|
+
*/
|
|
94
|
+
sendNewsletter(accessToken: string, recipient: MessageRecipient, newsletterInfo: {
|
|
95
|
+
title: string;
|
|
96
|
+
summary: string;
|
|
97
|
+
imageUrl: string;
|
|
98
|
+
articles: Array<{
|
|
99
|
+
title: string;
|
|
100
|
+
url: string;
|
|
101
|
+
}>;
|
|
102
|
+
unsubscribeUrl: string;
|
|
103
|
+
}): Promise<SendMessageResponse>;
|
|
104
|
+
/**
|
|
105
|
+
* Validate promotion message format
|
|
106
|
+
* @param message Promotion message to validate
|
|
107
|
+
*/
|
|
108
|
+
private validatePromotionMessage;
|
|
109
|
+
/**
|
|
110
|
+
* Validate sending time (8:00 - 22:00)
|
|
111
|
+
*/
|
|
112
|
+
private validateSendingTime;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=promotion.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotion.service.d.ts","sourceRoot":"","sources":["../../src/services/promotion.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,gBAAgB;IAIf,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CACsB;gBAEzB,MAAM,EAAE,UAAU;IAE/C;;;;;;OAMG;IACU,oBAAoB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC;IAyC/B;;;;;;OAMG;IACU,oBAAoB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,gBAAgB,EAC3B,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,mBAAmB,CAAC;IA6C/B;;;;;;OAMG;IACU,qBAAqB,CAChC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB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