zalo-toolkit 1.1.6 → 1.1.8
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/apis/getAvatarUrlProfile.d.ts +7 -0
- package/dist/apis/getAvatarUrlProfile.js +30 -0
- package/dist/apis/getFullAvatar.d.ts +5 -0
- package/dist/apis/getFullAvatar.js +25 -0
- package/dist/apis/listen.js +20 -18
- package/dist/apis.d.ts +4 -0
- package/dist/apis.js +4 -0
- package/dist/cjs/apis/getAvatarUrlProfile.cjs +43 -0
- package/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/dist/cjs/apis/listen.cjs +20 -18
- package/dist/cjs/apis.cjs +4 -0
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/models/Enum.cjs +5 -0
- package/dist/models/Enum.d.ts +4 -0
- package/dist/models/Enum.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AvatarSize } from '../models/index.js';
|
|
2
|
+
export type GetAvatarUrlProfileResponse = {
|
|
3
|
+
[userId: string]: {
|
|
4
|
+
avatar: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const getAvatarUrlProfileFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").ZaloAPI) => (friendIds: string | string[], avatarSize?: AvatarSize) => Promise<GetAvatarUrlProfileResponse>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ZaloApiError } from '../Errors/ZaloApiError.js';
|
|
2
|
+
import { AvatarSize } from '../models/index.js';
|
|
3
|
+
import { apiFactory } from '../utils.js';
|
|
4
|
+
export const getAvatarUrlProfileFactory = apiFactory()((api, _ctx, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/avatar-url`);
|
|
6
|
+
/**
|
|
7
|
+
* Get avatar url profile
|
|
8
|
+
*
|
|
9
|
+
* @param friendId friend id(s)
|
|
10
|
+
* @param avatarSize Avatar size (default: AvatarSize.Large)
|
|
11
|
+
*
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function getAvatarUrlProfile(friendIds, avatarSize = AvatarSize.Large) {
|
|
15
|
+
if (!Array.isArray(friendIds))
|
|
16
|
+
friendIds = [friendIds];
|
|
17
|
+
const params = {
|
|
18
|
+
friend_ids: friendIds,
|
|
19
|
+
avatar_size: avatarSize,
|
|
20
|
+
srcReq: -1,
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError('Failed to encrypt params');
|
|
25
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
26
|
+
method: 'GET',
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ZaloApiError } from '../Errors/ZaloApiError.js';
|
|
2
|
+
import { apiFactory } from '../utils.js';
|
|
3
|
+
export const getFullAvatarFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/avatar`);
|
|
5
|
+
/**
|
|
6
|
+
* Get full avatar
|
|
7
|
+
*
|
|
8
|
+
* @param friendId friend id
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function getFullAvatar(friendId) {
|
|
13
|
+
const params = {
|
|
14
|
+
fid: friendId,
|
|
15
|
+
imei: ctx.imei,
|
|
16
|
+
};
|
|
17
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
18
|
+
if (!encryptedParams)
|
|
19
|
+
throw new ZaloApiError('Failed to encrypt params');
|
|
20
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
21
|
+
method: 'GET',
|
|
22
|
+
});
|
|
23
|
+
return utils.resolve(response);
|
|
24
|
+
};
|
|
25
|
+
});
|
package/dist/apis/listen.js
CHANGED
|
@@ -210,9 +210,9 @@ export class Listener extends EventEmitter {
|
|
|
210
210
|
}
|
|
211
211
|
const lastMsg = last(msgs);
|
|
212
212
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
213
|
-
this.onUndoMessageCallback(listUndo);
|
|
214
|
-
this.onMessageCallback(listMessages);
|
|
215
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
213
|
+
await this.onUndoMessageCallback(listUndo);
|
|
214
|
+
await this.onMessageCallback(listMessages);
|
|
215
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
216
216
|
}
|
|
217
217
|
if (version == 1 && cmd == 521) {
|
|
218
218
|
const parsedData = (await decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -237,9 +237,9 @@ export class Listener extends EventEmitter {
|
|
|
237
237
|
}
|
|
238
238
|
const lastMsg = last(groupMsgs);
|
|
239
239
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
240
|
-
this.onUndoMessageCallback(listUndo);
|
|
241
|
-
this.onMessageCallback(listMessages);
|
|
242
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
240
|
+
await this.onUndoMessageCallback(listUndo);
|
|
241
|
+
await this.onMessageCallback(listMessages);
|
|
242
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
243
243
|
}
|
|
244
244
|
if ([510, 511, 610, 611, 603, 604].includes(cmd)) {
|
|
245
245
|
const parsedData = (await decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -342,8 +342,8 @@ export class Listener extends EventEmitter {
|
|
|
342
342
|
}
|
|
343
343
|
const lastMsg = reacts.length > 0 ? last(reacts) : reactGroups.length > 0 ? last(reactGroups) : null;
|
|
344
344
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
345
|
-
this.onReactionCallback(listReactions);
|
|
346
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
345
|
+
await this.onReactionCallback(listReactions);
|
|
346
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
347
347
|
}
|
|
348
348
|
if (cmd == 510) {
|
|
349
349
|
const parsedData = (await decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -362,9 +362,9 @@ export class Listener extends EventEmitter {
|
|
|
362
362
|
});
|
|
363
363
|
const lastMsg = last(msgs);
|
|
364
364
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
365
|
-
this.
|
|
366
|
-
this.onOldMessageCallback(responseMsgs);
|
|
367
|
-
this.
|
|
365
|
+
await this.onUndoMessageCallback(responseUndos);
|
|
366
|
+
await this.onOldMessageCallback(responseMsgs);
|
|
367
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
368
368
|
this.emit('old_messages', responseMsgs);
|
|
369
369
|
}
|
|
370
370
|
if (cmd == 511) {
|
|
@@ -384,9 +384,9 @@ export class Listener extends EventEmitter {
|
|
|
384
384
|
}
|
|
385
385
|
const lastMsg = last(groupMsgs);
|
|
386
386
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
387
|
-
this.
|
|
388
|
-
this.onOldMessageCallback(responseMsgs);
|
|
389
|
-
this.
|
|
387
|
+
await this.onUndoMessageCallback(responseUndos);
|
|
388
|
+
await this.onOldMessageCallback(responseMsgs);
|
|
389
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
390
390
|
this.emit('old_messages', responseMsgs);
|
|
391
391
|
}
|
|
392
392
|
if (cmd == 518) {
|
|
@@ -397,8 +397,8 @@ export class Listener extends EventEmitter {
|
|
|
397
397
|
const listMessage = [...parseMsgs, ...parseGroupMsgs];
|
|
398
398
|
const lastMsg = last(listMessage);
|
|
399
399
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
400
|
-
this.
|
|
401
|
-
this.
|
|
400
|
+
await this.onOldMessageCallback(listMessage);
|
|
401
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
402
402
|
this.emit('old_messages', listMessage);
|
|
403
403
|
}
|
|
404
404
|
if (cmd == 602 && subCmd == 0) {
|
|
@@ -656,9 +656,11 @@ export class Listener extends EventEmitter {
|
|
|
656
656
|
const retryConfig = this.retries[errorCode];
|
|
657
657
|
if (retryConfig) {
|
|
658
658
|
let { times, count, max } = retryConfig;
|
|
659
|
-
if (max != null && count >= max) {
|
|
659
|
+
// if (max != null && count >= max) {
|
|
660
|
+
// return null;
|
|
661
|
+
// }
|
|
662
|
+
if (count >= 3)
|
|
660
663
|
return null;
|
|
661
|
-
}
|
|
662
664
|
this.retries[errorCode].count = ((_a = this.retries[errorCode].count) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
663
665
|
if (typeof times === 'number') {
|
|
664
666
|
return times;
|
package/dist/apis.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ import { updateLabelsFactory } from "./apis/updateLabels.js";
|
|
|
80
80
|
import { updateActiveStatusFactory } from "./apis/updateActiveStatus.js";
|
|
81
81
|
import { sendTypingEventFactory } from "./apis/sendTypingEvent.js";
|
|
82
82
|
import { removeGroupBlockedMemberFactory } from "./apis/removeGroupBlockedMember.js";
|
|
83
|
+
import { getFullAvatarFactory } from "./apis/getFullAvatar.js";
|
|
83
84
|
import { getAutoDeleteChatFactory } from "./apis/getAutoDeleteChat.js";
|
|
84
85
|
import { getAliasListFactory } from "./apis/getAliasList.js";
|
|
85
86
|
import { getLabelsFactory } from "./apis/getLabels.js";
|
|
@@ -121,6 +122,7 @@ import { sendCardFactory } from "./apis/sendCard.js";
|
|
|
121
122
|
import { getRelatedFriendGroupFactory } from "./apis/getRelatedFriendGroup.js";
|
|
122
123
|
import { inviteUserToGroupsFactory } from "./apis/inviteUserToGroups.js";
|
|
123
124
|
import { blockUserFactory } from "./apis/blockUser.js";
|
|
125
|
+
import { getAvatarUrlProfileFactory } from "./apis/getAvatarUrlProfile.js";
|
|
124
126
|
import { sendMessageFactory } from "./apis/sendMessage.js";
|
|
125
127
|
import { updateProfileFactory } from "./apis/updateProfile.js";
|
|
126
128
|
import { getHiddenConversationsFactory } from "./apis/getHiddenConversations.js";
|
|
@@ -231,6 +233,7 @@ export declare class ZaloAPI {
|
|
|
231
233
|
updateActiveStatus: ReturnType<typeof updateActiveStatusFactory>;
|
|
232
234
|
sendTypingEvent: ReturnType<typeof sendTypingEventFactory>;
|
|
233
235
|
removeGroupBlockedMember: ReturnType<typeof removeGroupBlockedMemberFactory>;
|
|
236
|
+
getFullAvatar: ReturnType<typeof getFullAvatarFactory>;
|
|
234
237
|
getAutoDeleteChat: ReturnType<typeof getAutoDeleteChatFactory>;
|
|
235
238
|
getAliasList: ReturnType<typeof getAliasListFactory>;
|
|
236
239
|
getLabels: ReturnType<typeof getLabelsFactory>;
|
|
@@ -272,6 +275,7 @@ export declare class ZaloAPI {
|
|
|
272
275
|
getRelatedFriendGroup: ReturnType<typeof getRelatedFriendGroupFactory>;
|
|
273
276
|
inviteUserToGroups: ReturnType<typeof inviteUserToGroupsFactory>;
|
|
274
277
|
blockUser: ReturnType<typeof blockUserFactory>;
|
|
278
|
+
getAvatarUrlProfile: ReturnType<typeof getAvatarUrlProfileFactory>;
|
|
275
279
|
sendMessage: ReturnType<typeof sendMessageFactory>;
|
|
276
280
|
updateProfile: ReturnType<typeof updateProfileFactory>;
|
|
277
281
|
getHiddenConversations: ReturnType<typeof getHiddenConversationsFactory>;
|
package/dist/apis.js
CHANGED
|
@@ -79,6 +79,7 @@ import { updateLabelsFactory } from "./apis/updateLabels.js";
|
|
|
79
79
|
import { updateActiveStatusFactory } from "./apis/updateActiveStatus.js";
|
|
80
80
|
import { sendTypingEventFactory } from "./apis/sendTypingEvent.js";
|
|
81
81
|
import { removeGroupBlockedMemberFactory } from "./apis/removeGroupBlockedMember.js";
|
|
82
|
+
import { getFullAvatarFactory } from "./apis/getFullAvatar.js";
|
|
82
83
|
import { getAutoDeleteChatFactory } from "./apis/getAutoDeleteChat.js";
|
|
83
84
|
import { getAliasListFactory } from "./apis/getAliasList.js";
|
|
84
85
|
import { getLabelsFactory } from "./apis/getLabels.js";
|
|
@@ -120,6 +121,7 @@ import { sendCardFactory } from "./apis/sendCard.js";
|
|
|
120
121
|
import { getRelatedFriendGroupFactory } from "./apis/getRelatedFriendGroup.js";
|
|
121
122
|
import { inviteUserToGroupsFactory } from "./apis/inviteUserToGroups.js";
|
|
122
123
|
import { blockUserFactory } from "./apis/blockUser.js";
|
|
124
|
+
import { getAvatarUrlProfileFactory } from "./apis/getAvatarUrlProfile.js";
|
|
123
125
|
import { sendMessageFactory } from "./apis/sendMessage.js";
|
|
124
126
|
import { updateProfileFactory } from "./apis/updateProfile.js";
|
|
125
127
|
import { getHiddenConversationsFactory } from "./apis/getHiddenConversations.js";
|
|
@@ -225,6 +227,7 @@ export class ZaloAPI {
|
|
|
225
227
|
this.updateActiveStatus = updateActiveStatusFactory(ctx, this);
|
|
226
228
|
this.sendTypingEvent = sendTypingEventFactory(ctx, this);
|
|
227
229
|
this.removeGroupBlockedMember = removeGroupBlockedMemberFactory(ctx, this);
|
|
230
|
+
this.getFullAvatar = getFullAvatarFactory(ctx, this);
|
|
228
231
|
this.getAutoDeleteChat = getAutoDeleteChatFactory(ctx, this);
|
|
229
232
|
this.getAliasList = getAliasListFactory(ctx, this);
|
|
230
233
|
this.getLabels = getLabelsFactory(ctx, this);
|
|
@@ -266,6 +269,7 @@ export class ZaloAPI {
|
|
|
266
269
|
this.getRelatedFriendGroup = getRelatedFriendGroupFactory(ctx, this);
|
|
267
270
|
this.inviteUserToGroups = inviteUserToGroupsFactory(ctx, this);
|
|
268
271
|
this.blockUser = blockUserFactory(ctx, this);
|
|
272
|
+
this.getAvatarUrlProfile = getAvatarUrlProfileFactory(ctx, this);
|
|
269
273
|
this.sendMessage = sendMessageFactory(ctx, this);
|
|
270
274
|
this.updateProfile = updateProfileFactory(ctx, this);
|
|
271
275
|
this.getHiddenConversations = getHiddenConversationsFactory(ctx, this);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
require('../models/AutoReply.cjs');
|
|
5
|
+
require('../models/Board.cjs');
|
|
6
|
+
var Enum = require('../models/Enum.cjs');
|
|
7
|
+
require('../models/FriendEvent.cjs');
|
|
8
|
+
require('../models/Group.cjs');
|
|
9
|
+
require('../models/GroupEvent.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
require('../models/Reaction.cjs');
|
|
12
|
+
require('../models/Reminder.cjs');
|
|
13
|
+
require('../models/ZBusiness.cjs');
|
|
14
|
+
|
|
15
|
+
const getAvatarUrlProfileFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
16
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/avatar-url`);
|
|
17
|
+
/**
|
|
18
|
+
* Get avatar url profile
|
|
19
|
+
*
|
|
20
|
+
* @param friendId friend id(s)
|
|
21
|
+
* @param avatarSize Avatar size (default: AvatarSize.Large)
|
|
22
|
+
*
|
|
23
|
+
* @throws {ZaloApiError}
|
|
24
|
+
*/
|
|
25
|
+
return async function getAvatarUrlProfile(friendIds, avatarSize = Enum.AvatarSize.Large) {
|
|
26
|
+
if (!Array.isArray(friendIds))
|
|
27
|
+
friendIds = [friendIds];
|
|
28
|
+
const params = {
|
|
29
|
+
friend_ids: friendIds,
|
|
30
|
+
avatar_size: avatarSize,
|
|
31
|
+
srcReq: -1,
|
|
32
|
+
};
|
|
33
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
34
|
+
if (!encryptedParams)
|
|
35
|
+
throw new ZaloApiError.ZaloApiError('Failed to encrypt params');
|
|
36
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
37
|
+
method: 'GET',
|
|
38
|
+
});
|
|
39
|
+
return utils.resolve(response);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
exports.getAvatarUrlProfileFactory = getAvatarUrlProfileFactory;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const getFullAvatarFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/avatar`);
|
|
8
|
+
/**
|
|
9
|
+
* Get full avatar
|
|
10
|
+
*
|
|
11
|
+
* @param friendId friend id
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function getFullAvatar(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: friendId,
|
|
18
|
+
imei: ctx.imei,
|
|
19
|
+
};
|
|
20
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
21
|
+
if (!encryptedParams)
|
|
22
|
+
throw new ZaloApiError.ZaloApiError('Failed to encrypt params');
|
|
23
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
});
|
|
26
|
+
return utils.resolve(response);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
exports.getFullAvatarFactory = getFullAvatarFactory;
|
package/dist/cjs/apis/listen.cjs
CHANGED
|
@@ -213,9 +213,9 @@ class Listener extends stream.EventEmitter {
|
|
|
213
213
|
}
|
|
214
214
|
const lastMsg = lodash.last(msgs);
|
|
215
215
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
216
|
-
this.onUndoMessageCallback(listUndo);
|
|
217
|
-
this.onMessageCallback(listMessages);
|
|
218
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
216
|
+
await this.onUndoMessageCallback(listUndo);
|
|
217
|
+
await this.onMessageCallback(listMessages);
|
|
218
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
219
219
|
}
|
|
220
220
|
if (version == 1 && cmd == 521) {
|
|
221
221
|
const parsedData = (await utils.decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -240,9 +240,9 @@ class Listener extends stream.EventEmitter {
|
|
|
240
240
|
}
|
|
241
241
|
const lastMsg = lodash.last(groupMsgs);
|
|
242
242
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
243
|
-
this.onUndoMessageCallback(listUndo);
|
|
244
|
-
this.onMessageCallback(listMessages);
|
|
245
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
243
|
+
await this.onUndoMessageCallback(listUndo);
|
|
244
|
+
await this.onMessageCallback(listMessages);
|
|
245
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
246
246
|
}
|
|
247
247
|
if ([510, 511, 610, 611, 603, 604].includes(cmd)) {
|
|
248
248
|
const parsedData = (await utils.decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -345,8 +345,8 @@ class Listener extends stream.EventEmitter {
|
|
|
345
345
|
}
|
|
346
346
|
const lastMsg = reacts.length > 0 ? lodash.last(reacts) : reactGroups.length > 0 ? lodash.last(reactGroups) : null;
|
|
347
347
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
348
|
-
this.onReactionCallback(listReactions);
|
|
349
|
-
this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
348
|
+
await this.onReactionCallback(listReactions);
|
|
349
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
350
350
|
}
|
|
351
351
|
if (cmd == 510) {
|
|
352
352
|
const parsedData = (await utils.decodeEventData(parsed, this.cipherKey)).data;
|
|
@@ -365,9 +365,9 @@ class Listener extends stream.EventEmitter {
|
|
|
365
365
|
});
|
|
366
366
|
const lastMsg = lodash.last(msgs);
|
|
367
367
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
368
|
-
this.
|
|
369
|
-
this.onOldMessageCallback(responseMsgs);
|
|
370
|
-
this.
|
|
368
|
+
await this.onUndoMessageCallback(responseUndos);
|
|
369
|
+
await this.onOldMessageCallback(responseMsgs);
|
|
370
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
371
371
|
this.emit('old_messages', responseMsgs);
|
|
372
372
|
}
|
|
373
373
|
if (cmd == 511) {
|
|
@@ -387,9 +387,9 @@ class Listener extends stream.EventEmitter {
|
|
|
387
387
|
}
|
|
388
388
|
const lastMsg = lodash.last(groupMsgs);
|
|
389
389
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
390
|
-
this.
|
|
391
|
-
this.onOldMessageCallback(responseMsgs);
|
|
392
|
-
this.
|
|
390
|
+
await this.onUndoMessageCallback(responseUndos);
|
|
391
|
+
await this.onOldMessageCallback(responseMsgs);
|
|
392
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
393
393
|
this.emit('old_messages', responseMsgs);
|
|
394
394
|
}
|
|
395
395
|
if (cmd == 518) {
|
|
@@ -400,8 +400,8 @@ class Listener extends stream.EventEmitter {
|
|
|
400
400
|
const listMessage = [...parseMsgs, ...parseGroupMsgs];
|
|
401
401
|
const lastMsg = lodash.last(listMessage);
|
|
402
402
|
const timestamp = lastMsg ? Number(lastMsg.ts) : Date.now();
|
|
403
|
-
this.
|
|
404
|
-
this.
|
|
403
|
+
await this.onOldMessageCallback(listMessage);
|
|
404
|
+
await this.onUpdateQueueStatusCallback(queueStatus, timestamp);
|
|
405
405
|
this.emit('old_messages', listMessage);
|
|
406
406
|
}
|
|
407
407
|
if (cmd == 602 && subCmd == 0) {
|
|
@@ -659,9 +659,11 @@ class Listener extends stream.EventEmitter {
|
|
|
659
659
|
const retryConfig = this.retries[errorCode];
|
|
660
660
|
if (retryConfig) {
|
|
661
661
|
let { times, count, max } = retryConfig;
|
|
662
|
-
if (max != null && count >= max) {
|
|
662
|
+
// if (max != null && count >= max) {
|
|
663
|
+
// return null;
|
|
664
|
+
// }
|
|
665
|
+
if (count >= 3)
|
|
663
666
|
return null;
|
|
664
|
-
}
|
|
665
667
|
this.retries[errorCode].count = ((_a = this.retries[errorCode].count) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
666
668
|
if (typeof times === 'number') {
|
|
667
669
|
return times;
|
package/dist/cjs/apis.cjs
CHANGED
|
@@ -81,6 +81,7 @@ var updateLabels = require('./apis/updateLabels.cjs');
|
|
|
81
81
|
var updateActiveStatus = require('./apis/updateActiveStatus.cjs');
|
|
82
82
|
var sendTypingEvent = require('./apis/sendTypingEvent.cjs');
|
|
83
83
|
var removeGroupBlockedMember = require('./apis/removeGroupBlockedMember.cjs');
|
|
84
|
+
var getFullAvatar = require('./apis/getFullAvatar.cjs');
|
|
84
85
|
var getAutoDeleteChat = require('./apis/getAutoDeleteChat.cjs');
|
|
85
86
|
var getAliasList = require('./apis/getAliasList.cjs');
|
|
86
87
|
var getLabels = require('./apis/getLabels.cjs');
|
|
@@ -122,6 +123,7 @@ var sendCard = require('./apis/sendCard.cjs');
|
|
|
122
123
|
var getRelatedFriendGroup = require('./apis/getRelatedFriendGroup.cjs');
|
|
123
124
|
var inviteUserToGroups = require('./apis/inviteUserToGroups.cjs');
|
|
124
125
|
var blockUser = require('./apis/blockUser.cjs');
|
|
126
|
+
var getAvatarUrlProfile = require('./apis/getAvatarUrlProfile.cjs');
|
|
125
127
|
var sendMessage = require('./apis/sendMessage.cjs');
|
|
126
128
|
var updateProfile = require('./apis/updateProfile.cjs');
|
|
127
129
|
var getHiddenConversations = require('./apis/getHiddenConversations.cjs');
|
|
@@ -228,6 +230,7 @@ class ZaloAPI {
|
|
|
228
230
|
this.updateActiveStatus = updateActiveStatus.updateActiveStatusFactory(ctx, this);
|
|
229
231
|
this.sendTypingEvent = sendTypingEvent.sendTypingEventFactory(ctx, this);
|
|
230
232
|
this.removeGroupBlockedMember = removeGroupBlockedMember.removeGroupBlockedMemberFactory(ctx, this);
|
|
233
|
+
this.getFullAvatar = getFullAvatar.getFullAvatarFactory(ctx, this);
|
|
231
234
|
this.getAutoDeleteChat = getAutoDeleteChat.getAutoDeleteChatFactory(ctx, this);
|
|
232
235
|
this.getAliasList = getAliasList.getAliasListFactory(ctx, this);
|
|
233
236
|
this.getLabels = getLabels.getLabelsFactory(ctx, this);
|
|
@@ -269,6 +272,7 @@ class ZaloAPI {
|
|
|
269
272
|
this.getRelatedFriendGroup = getRelatedFriendGroup.getRelatedFriendGroupFactory(ctx, this);
|
|
270
273
|
this.inviteUserToGroups = inviteUserToGroups.inviteUserToGroupsFactory(ctx, this);
|
|
271
274
|
this.blockUser = blockUser.blockUserFactory(ctx, this);
|
|
275
|
+
this.getAvatarUrlProfile = getAvatarUrlProfile.getAvatarUrlProfileFactory(ctx, this);
|
|
272
276
|
this.sendMessage = sendMessage.sendMessageFactory(ctx, this);
|
|
273
277
|
this.updateProfile = updateProfile.updateProfileFactory(ctx, this);
|
|
274
278
|
this.getHiddenConversations = getHiddenConversations.getHiddenConversationsFactory(ctx, this);
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -48,6 +48,10 @@ Object.defineProperty(exports, "BoardType", {
|
|
|
48
48
|
});
|
|
49
49
|
exports.GroupDeliveredMessage = DeliveredMessage.GroupDeliveredMessage;
|
|
50
50
|
exports.UserDeliveredMessage = DeliveredMessage.UserDeliveredMessage;
|
|
51
|
+
Object.defineProperty(exports, "AvatarSize", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return Enum.AvatarSize; }
|
|
54
|
+
});
|
|
51
55
|
Object.defineProperty(exports, "BinBankCard", {
|
|
52
56
|
enumerable: true,
|
|
53
57
|
get: function () { return Enum.BinBankCard; }
|
package/dist/cjs/models/Enum.cjs
CHANGED
|
@@ -16,6 +16,11 @@ exports.Gender = void 0;
|
|
|
16
16
|
Gender[Gender["Male"] = 0] = "Male";
|
|
17
17
|
Gender[Gender["Female"] = 1] = "Female";
|
|
18
18
|
})(exports.Gender || (exports.Gender = {}));
|
|
19
|
+
exports.AvatarSize = void 0;
|
|
20
|
+
(function (AvatarSize) {
|
|
21
|
+
AvatarSize[AvatarSize["Small"] = 120] = "Small";
|
|
22
|
+
AvatarSize[AvatarSize["Large"] = 240] = "Large";
|
|
23
|
+
})(exports.AvatarSize || (exports.AvatarSize = {}));
|
|
19
24
|
/**
|
|
20
25
|
* @note Bank codes list after Mitm on Mobile and Bank's supported by Zalo
|
|
21
26
|
* @documents https://developers.zalo.me/docs/zalo-notification-service/phu-luc/danh-sach-bin-code - docs missing bin code and short_name bank
|
package/dist/models/Enum.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare enum Gender {
|
|
|
11
11
|
Male = 0,
|
|
12
12
|
Female = 1
|
|
13
13
|
}
|
|
14
|
+
export declare enum AvatarSize {
|
|
15
|
+
Small = 120,
|
|
16
|
+
Large = 240
|
|
17
|
+
}
|
|
14
18
|
/**
|
|
15
19
|
* @note Bank codes list after Mitm on Mobile and Bank's supported by Zalo
|
|
16
20
|
* @documents https://developers.zalo.me/docs/zalo-notification-service/phu-luc/danh-sach-bin-code - docs missing bin code and short_name bank
|
package/dist/models/Enum.js
CHANGED
|
@@ -14,6 +14,11 @@ export var Gender;
|
|
|
14
14
|
Gender[Gender["Male"] = 0] = "Male";
|
|
15
15
|
Gender[Gender["Female"] = 1] = "Female";
|
|
16
16
|
})(Gender || (Gender = {}));
|
|
17
|
+
export var AvatarSize;
|
|
18
|
+
(function (AvatarSize) {
|
|
19
|
+
AvatarSize[AvatarSize["Small"] = 120] = "Small";
|
|
20
|
+
AvatarSize[AvatarSize["Large"] = 240] = "Large";
|
|
21
|
+
})(AvatarSize || (AvatarSize = {}));
|
|
17
22
|
/**
|
|
18
23
|
* @note Bank codes list after Mitm on Mobile and Bank's supported by Zalo
|
|
19
24
|
* @documents https://developers.zalo.me/docs/zalo-notification-service/phu-luc/danh-sach-bin-code - docs missing bin code and short_name bank
|