@softtynet/zca-js 2.3.3 → 2.3.4

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.
Files changed (74) hide show
  1. package/README.md +63 -21
  2. package/dist/apis/auth/exportSession.d.ts +7 -0
  3. package/dist/apis/auth/exportSession.js +17 -0
  4. package/dist/apis/chat/getDirectMessageStatus.d.ts +14 -0
  5. package/dist/apis/chat/getDirectMessageStatus.js +52 -0
  6. package/dist/apis/chat/getSuggestedConversations.d.ts +5 -0
  7. package/dist/apis/chat/getSuggestedConversations.js +24 -0
  8. package/dist/apis/chat/updatePinConversations.d.ts +24 -0
  9. package/dist/apis/chat/updatePinConversations.js +40 -0
  10. package/dist/apis/friend/getFriendProfilesV2.d.ts +26 -0
  11. package/dist/apis/friend/getFriendProfilesV2.js +38 -0
  12. package/dist/apis/friend/getFriendsActivePCWeb.d.ts +6 -0
  13. package/dist/apis/friend/getFriendsActivePCWeb.js +15 -0
  14. package/dist/apis/friend/verifyFriend.d.ts +11 -0
  15. package/dist/apis/friend/verifyFriend.js +37 -0
  16. package/dist/apis/group/analyseGroup.d.ts +4 -0
  17. package/dist/apis/group/analyseGroup.js +28 -0
  18. package/dist/apis/group/checkQuotaCommunityMember.d.ts +6 -0
  19. package/dist/apis/group/checkQuotaCommunityMember.js +34 -0
  20. package/dist/apis/group/getE2eeGroupList.d.ts +7 -0
  21. package/dist/apis/group/getE2eeGroupList.js +15 -0
  22. package/dist/apis/group/getGroupCloudMessagePath.d.ts +19 -0
  23. package/dist/apis/group/getGroupCloudMessagePath.js +51 -0
  24. package/dist/apis/group/getMultiGroupCloudMessages.d.ts +5 -0
  25. package/dist/apis/group/getMultiGroupCloudMessages.js +29 -0
  26. package/dist/apis/media/getPersonalMedia.d.ts +8 -0
  27. package/dist/apis/media/getPersonalMedia.js +31 -0
  28. package/dist/apis/media/getPersonalMediaPreview.d.ts +3 -0
  29. package/dist/apis/media/getPersonalMediaPreview.js +24 -0
  30. package/dist/apis/media/removePersonalMedia.d.ts +9 -0
  31. package/dist/apis/media/removePersonalMedia.js +28 -0
  32. package/dist/apis.d.ts +45 -0
  33. package/dist/apis.js +75 -0
  34. package/dist/cjs/apis/auth/exportSession.cjs +22 -0
  35. package/dist/cjs/apis/chat/getDirectMessageStatus.cjs +58 -0
  36. package/dist/cjs/apis/chat/getSuggestedConversations.cjs +29 -0
  37. package/dist/cjs/apis/chat/updatePinConversations.cjs +45 -0
  38. package/dist/cjs/apis/friend/getFriendProfilesV2.cjs +43 -0
  39. package/dist/cjs/apis/friend/getFriendsActivePCWeb.cjs +20 -0
  40. package/dist/cjs/apis/friend/verifyFriend.cjs +42 -0
  41. package/dist/cjs/apis/group/analyseGroup.cjs +33 -0
  42. package/dist/cjs/apis/group/checkQuotaCommunityMember.cjs +39 -0
  43. package/dist/cjs/apis/group/getE2eeGroupList.cjs +20 -0
  44. package/dist/cjs/apis/group/getGroupChatHistory.cjs +8 -7
  45. package/dist/cjs/apis/group/getGroupCloudMessagePath.cjs +69 -0
  46. package/dist/cjs/apis/group/getGroupHistoryLegacy.cjs +7 -6
  47. package/dist/cjs/apis/group/getGroupMessageStatus.cjs +7 -6
  48. package/dist/cjs/apis/group/getMultiGroupCloudMessages.cjs +34 -0
  49. package/dist/cjs/apis/media/getPersonalMedia.cjs +36 -0
  50. package/dist/cjs/apis/media/getPersonalMediaPreview.cjs +29 -0
  51. package/dist/cjs/apis/media/removePersonalMedia.cjs +33 -0
  52. package/dist/cjs/apis.cjs +75 -0
  53. package/dist/cjs/constants/protocol.cjs +1 -1
  54. package/dist/cjs/context.cjs +20 -2
  55. package/dist/cjs/core/zcloud-client.cjs +1 -2
  56. package/dist/cjs/crypto/ws-cipher.cjs +66 -2
  57. package/dist/cjs/index.cjs +9 -2
  58. package/dist/cjs/realtime/listener.cjs +18 -6
  59. package/dist/cjs/update.cjs +10 -1
  60. package/dist/cjs/utils.cjs +21 -68
  61. package/dist/constants/protocol.d.ts +1 -1
  62. package/dist/constants/protocol.js +1 -1
  63. package/dist/context.d.ts +10 -0
  64. package/dist/context.js +20 -2
  65. package/dist/crypto/ws-cipher.d.ts +7 -0
  66. package/dist/crypto/ws-cipher.js +64 -2
  67. package/dist/index.d.ts +15 -0
  68. package/dist/realtime/listener.d.ts +1 -0
  69. package/dist/realtime/listener.js +18 -6
  70. package/dist/update.js +10 -1
  71. package/dist/utils.d.ts +0 -7
  72. package/dist/utils.js +15 -64
  73. package/index.d.ts +1 -1
  74. package/package.json +15 -5
package/dist/cjs/apis.cjs CHANGED
@@ -10,6 +10,7 @@ var addQuickMessage = require('./apis/business/addQuickMessage.cjs');
10
10
  var addReaction = require('./apis/chat/addReaction.cjs');
11
11
  var addUnreadMark = require('./apis/chat/addUnreadMark.cjs');
12
12
  var addUserToGroup = require('./apis/group/addUserToGroup.cjs');
13
+ var analyseGroup = require('./apis/group/analyseGroup.cjs');
13
14
  var blockUser = require('./apis/friend/blockUser.cjs');
14
15
  var blockViewFeed = require('./apis/friend/blockViewFeed.cjs');
15
16
  var cancelPullMobile = require('./apis/sync/cancelPullMobile.cjs');
@@ -19,6 +20,7 @@ var changeFriendAlias = require('./apis/friend/changeFriendAlias.cjs');
19
20
  var changeGroupAvatar = require('./apis/group/changeGroupAvatar.cjs');
20
21
  var changeGroupName = require('./apis/group/changeGroupName.cjs');
21
22
  var changeGroupOwner = require('./apis/group/changeGroupOwner.cjs');
23
+ var checkQuotaCommunityMember = require('./apis/group/checkQuotaCommunityMember.cjs');
22
24
  var clearUnreadFriendRequests = require('./apis/friend/clearUnreadFriendRequests.cjs');
23
25
  var createAutoReply = require('./apis/business/createAutoReply.cjs');
24
26
  var createBankAccount = require('./apis/business/createBankAccount.cjs');
@@ -45,6 +47,7 @@ var editReminder = require('./apis/board/editReminder.cjs');
45
47
  var enableGroupLink = require('./apis/group/enableGroupLink.cjs');
46
48
  var encryptGids = require('./apis/auth/encryptGids.cjs');
47
49
  var endVoiceCall = require('./apis/call/endVoiceCall.cjs');
50
+ var exportSession = require('./apis/auth/exportSession.cjs');
48
51
  var fetchAccountInfo = require('./apis/profile/fetchAccountInfo.cjs');
49
52
  var findUser = require('./apis/friend/findUser.cjs');
50
53
  var findUserByUsername = require('./apis/friend/findUserByUsername.cjs');
@@ -68,6 +71,8 @@ var getCloudViewerKey = require('./apis/zcloud/getCloudViewerKey.cjs');
68
71
  var getContext = require('./apis/auth/getContext.cjs');
69
72
  var getConversationMedia = require('./apis/media/getConversationMedia.cjs');
70
73
  var getCookie = require('./apis/auth/getCookie.cjs');
74
+ var getDirectMessageStatus = require('./apis/chat/getDirectMessageStatus.cjs');
75
+ var getE2eeGroupList = require('./apis/group/getE2eeGroupList.cjs');
71
76
  var getEmojiStatusConfig = require('./apis/profile/getEmojiStatusConfig.cjs');
72
77
  var getExtraFriendInfo = require('./apis/friend/getExtraFriendInfo.cjs');
73
78
  var getExtraGroupInfo = require('./apis/group/getExtraGroupInfo.cjs');
@@ -76,13 +81,16 @@ var getFamilyUsage = require('./apis/zcloud/getFamilyUsage.cjs');
76
81
  var getFamilyViewerKey = require('./apis/zcloud/getFamilyViewerKey.cjs');
77
82
  var getFriendBoardList = require('./apis/friend/getFriendBoardList.cjs');
78
83
  var getFriendOnlines = require('./apis/friend/getFriendOnlines.cjs');
84
+ var getFriendProfilesV2 = require('./apis/friend/getFriendProfilesV2.cjs');
79
85
  var getFriendRecommendations = require('./apis/friend/getFriendRecommendations.cjs');
80
86
  var getFriendRequestStatus = require('./apis/friend/getFriendRequestStatus.cjs');
87
+ var getFriendsActivePCWeb = require('./apis/friend/getFriendsActivePCWeb.cjs');
81
88
  var getFriendsEmojiStatus = require('./apis/friend/getFriendsEmojiStatus.cjs');
82
89
  var getFullAvatar = require('./apis/profile/getFullAvatar.cjs');
83
90
  var getGroupBlockedMember = require('./apis/group/getGroupBlockedMember.cjs');
84
91
  var getGroupChatHistory = require('./apis/group/getGroupChatHistory.cjs');
85
92
  var getGroupCloudMessageJump = require('./apis/group/getGroupCloudMessageJump.cjs');
93
+ var getGroupCloudMessagePath = require('./apis/group/getGroupCloudMessagePath.cjs');
86
94
  var getGroupHistoryLegacy = require('./apis/group/getGroupHistoryLegacy.cjs');
87
95
  var getGroupInfo = require('./apis/group/getGroupInfo.cjs');
88
96
  var getGroupInfoV2 = require('./apis/group/getGroupInfoV2.cjs');
@@ -106,12 +114,15 @@ var getListPinTopics = require('./apis/board/getListPinTopics.cjs');
106
114
  var getListReminder = require('./apis/board/getListReminder.cjs');
107
115
  var getMediaStorePreview = require('./apis/media/getMediaStorePreview.cjs');
108
116
  var getMiniProfile = require('./apis/profile/getMiniProfile.cjs');
117
+ var getMultiGroupCloudMessages = require('./apis/group/getMultiGroupCloudMessages.cjs');
109
118
  var getMultiUsersByPhones = require('./apis/friend/getMultiUsersByPhones.cjs');
110
119
  var getMute = require('./apis/chat/getMute.cjs');
111
120
  var getNoisedIds = require('./apis/auth/getNoisedIds.cjs');
112
121
  var getOwnId = require('./apis/auth/getOwnId.cjs');
113
122
  var getPendingGroupMembers = require('./apis/group/getPendingGroupMembers.cjs');
114
123
  var getPersonalizedStickerList = require('./apis/sticker/getPersonalizedStickerList.cjs');
124
+ var getPersonalMedia = require('./apis/media/getPersonalMedia.cjs');
125
+ var getPersonalMediaPreview = require('./apis/media/getPersonalMediaPreview.cjs');
115
126
  var getPhonebookV2 = require('./apis/friend/getPhonebookV2.cjs');
116
127
  var getPinConversations = require('./apis/chat/getPinConversations.cjs');
117
128
  var getPollDetail = require('./apis/board/getPollDetail.cjs');
@@ -135,6 +146,7 @@ var getStickers = require('./apis/sticker/getStickers.cjs');
135
146
  var getStickersDetail = require('./apis/sticker/getStickersDetail.cjs');
136
147
  var getStickerSuggestion = require('./apis/sticker/getStickerSuggestion.cjs');
137
148
  var getStickerSuggestKeywords = require('./apis/sticker/getStickerSuggestKeywords.cjs');
149
+ var getSuggestedConversations = require('./apis/chat/getSuggestedConversations.cjs');
138
150
  var getSyncData = require('./apis/sync/getSyncData.cjs');
139
151
  var getUnreadMark = require('./apis/chat/getUnreadMark.cjs');
140
152
  var getUsageMyCloud = require('./apis/zcloud/getUsageMyCloud.cjs');
@@ -159,6 +171,7 @@ var removeFriend = require('./apis/friend/removeFriend.cjs');
159
171
  var removeFriendAlias = require('./apis/friend/removeFriendAlias.cjs');
160
172
  var removeGroupBlockedMember = require('./apis/group/removeGroupBlockedMember.cjs');
161
173
  var removeGroupDeputy = require('./apis/group/removeGroupDeputy.cjs');
174
+ var removePersonalMedia = require('./apis/media/removePersonalMedia.cjs');
162
175
  var removeQuickMessage = require('./apis/business/removeQuickMessage.cjs');
163
176
  var removeReminder = require('./apis/board/removeReminder.cjs');
164
177
  var removeUnreadMark = require('./apis/chat/removeUnreadMark.cjs');
@@ -200,6 +213,7 @@ var updateGroupSettings = require('./apis/group/updateGroupSettings.cjs');
200
213
  var updateHiddenConversPin = require('./apis/chat/updateHiddenConversPin.cjs');
201
214
  var updateLabels = require('./apis/business/updateLabels.cjs');
202
215
  var updateLang = require('./apis/auth/updateLang.cjs');
216
+ var updatePinConversations = require('./apis/chat/updatePinConversations.cjs');
203
217
  var updateProductCatalog = require('./apis/business/updateProductCatalog.cjs');
204
218
  var updateProfile = require('./apis/profile/updateProfile.cjs');
205
219
  var updateProfileBio = require('./apis/profile/updateProfileBio.cjs');
@@ -210,6 +224,7 @@ var upgradeGroupToCommunity = require('./apis/group/upgradeGroupToCommunity.cjs'
210
224
  var uploadAttachment = require('./apis/media/uploadAttachment.cjs');
211
225
  var uploadProductPhoto = require('./apis/business/uploadProductPhoto.cjs');
212
226
  var verifyCloudMedia = require('./apis/zcloud/verifyCloudMedia.cjs');
227
+ var verifyFriend = require('./apis/friend/verifyFriend.cjs');
213
228
  var voiceToText = require('./apis/media/voiceToText.cjs');
214
229
  var votePoll = require('./apis/board/votePoll.cjs');
215
230
  var custom = require('./apis/custom.cjs');
@@ -235,6 +250,7 @@ class API {
235
250
  const createNamespace = (api) => ({
236
251
  get decryptGids() { return api.decryptGids; },
237
252
  get encryptGids() { return api.encryptGids; },
253
+ get exportSession() { return api.exportSession; },
238
254
  get getContext() { return api.getContext; },
239
255
  get getCookie() { return api.getCookie; },
240
256
  get getListDevice() { return api.getListDevice; },
@@ -330,12 +346,14 @@ class API {
330
346
  get forwardMessage() { return api.forwardMessage; },
331
347
  get getArchivedChatList() { return api.getArchivedChatList; },
332
348
  get getAutoDeleteChat() { return api.getAutoDeleteChat; },
349
+ get getDirectMessageStatus() { return api.getDirectMessageStatus; },
333
350
  get getHiddenConversations() { return api.getHiddenConversations; },
334
351
  get getLastSeen() { return api.getLastSeen; },
335
352
  get getLastSeenReaction() { return api.getLastSeenReaction; },
336
353
  get getMute() { return api.getMute; },
337
354
  get getPinConversations() { return api.getPinConversations; },
338
355
  get getRecentSearchList() { return api.getRecentSearchList; },
356
+ get getSuggestedConversations() { return api.getSuggestedConversations; },
339
357
  get getUnreadMark() { return api.getUnreadMark; },
340
358
  get parseLink() { return api.parseLink; },
341
359
  get preloadConversations() { return api.preloadConversations; },
@@ -360,6 +378,7 @@ class API {
360
378
  get updateArchivedChatList() { return api.updateArchivedChatList; },
361
379
  get updateAutoDeleteChat() { return api.updateAutoDeleteChat; },
362
380
  get updateHiddenConversPin() { return api.updateHiddenConversPin; },
381
+ get updatePinConversations() { return api.updatePinConversations; },
363
382
  get updateRecentSearch() { return api.updateRecentSearch; },
364
383
  });
365
384
  this._domains.chat = createNamespace(this);
@@ -384,8 +403,10 @@ class API {
384
403
  get getExtraFriendInfo() { return api.getExtraFriendInfo; },
385
404
  get getFriendBoardList() { return api.getFriendBoardList; },
386
405
  get getFriendOnlines() { return api.getFriendOnlines; },
406
+ get getFriendProfilesV2() { return api.getFriendProfilesV2; },
387
407
  get getFriendRecommendations() { return api.getFriendRecommendations; },
388
408
  get getFriendRequestStatus() { return api.getFriendRequestStatus; },
409
+ get getFriendsActivePCWeb() { return api.getFriendsActivePCWeb; },
389
410
  get getFriendsEmojiStatus() { return api.getFriendsEmojiStatus; },
390
411
  get getLastReadContactTab() { return api.getLastReadContactTab; },
391
412
  get getMultiUsersByPhones() { return api.getMultiUsersByPhones; },
@@ -399,6 +420,7 @@ class API {
399
420
  get sendFriendRequest() { return api.sendFriendRequest; },
400
421
  get unblockUser() { return api.unblockUser; },
401
422
  get undoFriendRequest() { return api.undoFriendRequest; },
423
+ get verifyFriend() { return api.verifyFriend; },
402
424
  });
403
425
  this._domains.friend = createNamespace(this);
404
426
  }
@@ -410,19 +432,23 @@ class API {
410
432
  get addGroupBlockedMember() { return api.addGroupBlockedMember; },
411
433
  get addGroupDeputy() { return api.addGroupDeputy; },
412
434
  get addUserToGroup() { return api.addUserToGroup; },
435
+ get analyseGroup() { return api.analyseGroup; },
413
436
  get changeGroupAvatar() { return api.changeGroupAvatar; },
414
437
  get changeGroupName() { return api.changeGroupName; },
415
438
  get changeGroupOwner() { return api.changeGroupOwner; },
439
+ get checkQuotaCommunityMember() { return api.checkQuotaCommunityMember; },
416
440
  get createGroup() { return api.createGroup; },
417
441
  get deleteGroupInviteBox() { return api.deleteGroupInviteBox; },
418
442
  get disableGroupLink() { return api.disableGroupLink; },
419
443
  get disperseGroup() { return api.disperseGroup; },
420
444
  get enableGroupLink() { return api.enableGroupLink; },
421
445
  get getAllGroups() { return api.getAllGroups; },
446
+ get getE2eeGroupList() { return api.getE2eeGroupList; },
422
447
  get getExtraGroupInfo() { return api.getExtraGroupInfo; },
423
448
  get getGroupBlockedMember() { return api.getGroupBlockedMember; },
424
449
  get getGroupChatHistory() { return api.getGroupChatHistory; },
425
450
  get getGroupCloudMessageJump() { return api.getGroupCloudMessageJump; },
451
+ get getGroupCloudMessagePath() { return api.getGroupCloudMessagePath; },
426
452
  get getGroupHistoryLegacy() { return api.getGroupHistoryLegacy; },
427
453
  get getGroupInfo() { return api.getGroupInfo; },
428
454
  get getGroupInfoV2() { return api.getGroupInfoV2; },
@@ -433,6 +459,7 @@ class API {
433
459
  get getGroupListV3() { return api.getGroupListV3; },
434
460
  get getGroupMembersInfo() { return api.getGroupMembersInfo; },
435
461
  get getGroupMessageStatus() { return api.getGroupMessageStatus; },
462
+ get getMultiGroupCloudMessages() { return api.getMultiGroupCloudMessages; },
436
463
  get getPendingGroupMembers() { return api.getPendingGroupMembers; },
437
464
  get getQuotaCommunity() { return api.getQuotaCommunity; },
438
465
  get getRelatedFriendGroup() { return api.getRelatedFriendGroup; },
@@ -456,7 +483,10 @@ class API {
456
483
  const createNamespace = (api) => ({
457
484
  get getConversationMedia() { return api.getConversationMedia; },
458
485
  get getMediaStorePreview() { return api.getMediaStorePreview; },
486
+ get getPersonalMedia() { return api.getPersonalMedia; },
487
+ get getPersonalMediaPreview() { return api.getPersonalMediaPreview; },
459
488
  get removeConversationMedia() { return api.removeConversationMedia; },
489
+ get removePersonalMedia() { return api.removePersonalMedia; },
460
490
  get uploadAttachment() { return api.uploadAttachment; },
461
491
  get voiceToText() { return api.voiceToText; },
462
492
  });
@@ -563,6 +593,9 @@ class API {
563
593
  get addUserToGroup() {
564
594
  return (this._cache.addUserToGroup ??= addUserToGroup.addUserToGroupFactory(this.ctx, this));
565
595
  }
596
+ get analyseGroup() {
597
+ return (this._cache.analyseGroup ??= analyseGroup.analyseGroupFactory(this.ctx, this));
598
+ }
566
599
  get blockUser() {
567
600
  return (this._cache.blockUser ??= blockUser.blockUserFactory(this.ctx, this));
568
601
  }
@@ -590,6 +623,9 @@ class API {
590
623
  get changeGroupOwner() {
591
624
  return (this._cache.changeGroupOwner ??= changeGroupOwner.changeGroupOwnerFactory(this.ctx, this));
592
625
  }
626
+ get checkQuotaCommunityMember() {
627
+ return (this._cache.checkQuotaCommunityMember ??= checkQuotaCommunityMember.checkQuotaCommunityMemberFactory(this.ctx, this));
628
+ }
593
629
  get clearUnreadFriendRequests() {
594
630
  return (this._cache.clearUnreadFriendRequests ??= clearUnreadFriendRequests.clearUnreadFriendRequestsFactory(this.ctx, this));
595
631
  }
@@ -668,6 +704,9 @@ class API {
668
704
  get endVoiceCall() {
669
705
  return (this._cache.endVoiceCall ??= endVoiceCall.endVoiceCallFactory(this.ctx, this));
670
706
  }
707
+ get exportSession() {
708
+ return (this._cache.exportSession ??= exportSession.exportSessionFactory(this.ctx, this));
709
+ }
671
710
  get fetchAccountInfo() {
672
711
  return (this._cache.fetchAccountInfo ??= fetchAccountInfo.fetchAccountInfoFactory(this.ctx, this));
673
712
  }
@@ -737,6 +776,12 @@ class API {
737
776
  get getCookie() {
738
777
  return (this._cache.getCookie ??= getCookie.getCookieFactory(this.ctx, this));
739
778
  }
779
+ get getDirectMessageStatus() {
780
+ return (this._cache.getDirectMessageStatus ??= getDirectMessageStatus.getDirectMessageStatusFactory(this.ctx, this));
781
+ }
782
+ get getE2eeGroupList() {
783
+ return (this._cache.getE2eeGroupList ??= getE2eeGroupList.getE2eeGroupListFactory(this.ctx, this));
784
+ }
740
785
  get getEmojiStatusConfig() {
741
786
  return (this._cache.getEmojiStatusConfig ??= getEmojiStatusConfig.getEmojiStatusConfigFactory(this.ctx, this));
742
787
  }
@@ -761,12 +806,18 @@ class API {
761
806
  get getFriendOnlines() {
762
807
  return (this._cache.getFriendOnlines ??= getFriendOnlines.getFriendOnlinesFactory(this.ctx, this));
763
808
  }
809
+ get getFriendProfilesV2() {
810
+ return (this._cache.getFriendProfilesV2 ??= getFriendProfilesV2.getFriendProfilesV2Factory(this.ctx, this));
811
+ }
764
812
  get getFriendRecommendations() {
765
813
  return (this._cache.getFriendRecommendations ??= getFriendRecommendations.getFriendRecommendationsFactory(this.ctx, this));
766
814
  }
767
815
  get getFriendRequestStatus() {
768
816
  return (this._cache.getFriendRequestStatus ??= getFriendRequestStatus.getFriendRequestStatusFactory(this.ctx, this));
769
817
  }
818
+ get getFriendsActivePCWeb() {
819
+ return (this._cache.getFriendsActivePCWeb ??= getFriendsActivePCWeb.getFriendsActivePCWebFactory(this.ctx, this));
820
+ }
770
821
  get getFriendsEmojiStatus() {
771
822
  return (this._cache.getFriendsEmojiStatus ??= getFriendsEmojiStatus.getFriendsEmojiStatusFactory(this.ctx, this));
772
823
  }
@@ -782,6 +833,9 @@ class API {
782
833
  get getGroupCloudMessageJump() {
783
834
  return (this._cache.getGroupCloudMessageJump ??= getGroupCloudMessageJump.getGroupCloudMessageJumpFactory(this.ctx, this));
784
835
  }
836
+ get getGroupCloudMessagePath() {
837
+ return (this._cache.getGroupCloudMessagePath ??= getGroupCloudMessagePath.getGroupCloudMessagePathFactory(this.ctx, this));
838
+ }
785
839
  get getGroupHistoryLegacy() {
786
840
  return (this._cache.getGroupHistoryLegacy ??= getGroupHistoryLegacy.getGroupHistoryLegacyFactory(this.ctx, this));
787
841
  }
@@ -851,6 +905,9 @@ class API {
851
905
  get getMiniProfile() {
852
906
  return (this._cache.getMiniProfile ??= getMiniProfile.getMiniProfileFactory(this.ctx, this));
853
907
  }
908
+ get getMultiGroupCloudMessages() {
909
+ return (this._cache.getMultiGroupCloudMessages ??= getMultiGroupCloudMessages.getMultiGroupCloudMessagesFactory(this.ctx, this));
910
+ }
854
911
  get getMultiUsersByPhones() {
855
912
  return (this._cache.getMultiUsersByPhones ??= getMultiUsersByPhones.getMultiUsersByPhonesFactory(this.ctx, this));
856
913
  }
@@ -869,6 +926,12 @@ class API {
869
926
  get getPersonalizedStickerList() {
870
927
  return (this._cache.getPersonalizedStickerList ??= getPersonalizedStickerList.getPersonalizedStickerListFactory(this.ctx, this));
871
928
  }
929
+ get getPersonalMedia() {
930
+ return (this._cache.getPersonalMedia ??= getPersonalMedia.getPersonalMediaFactory(this.ctx, this));
931
+ }
932
+ get getPersonalMediaPreview() {
933
+ return (this._cache.getPersonalMediaPreview ??= getPersonalMediaPreview.getPersonalMediaPreviewFactory(this.ctx, this));
934
+ }
872
935
  get getPhonebookV2() {
873
936
  return (this._cache.getPhonebookV2 ??= getPhonebookV2.getPhonebookV2Factory(this.ctx, this));
874
937
  }
@@ -938,6 +1001,9 @@ class API {
938
1001
  get getStickerSuggestKeywords() {
939
1002
  return (this._cache.getStickerSuggestKeywords ??= getStickerSuggestKeywords.getStickerSuggestKeywordsFactory(this.ctx, this));
940
1003
  }
1004
+ get getSuggestedConversations() {
1005
+ return (this._cache.getSuggestedConversations ??= getSuggestedConversations.getSuggestedConversationsFactory(this.ctx, this));
1006
+ }
941
1007
  get getSyncData() {
942
1008
  return (this._cache.getSyncData ??= getSyncData.getSyncDataFactory(this.ctx, this));
943
1009
  }
@@ -1010,6 +1076,9 @@ class API {
1010
1076
  get removeGroupDeputy() {
1011
1077
  return (this._cache.removeGroupDeputy ??= removeGroupDeputy.removeGroupDeputyFactory(this.ctx, this));
1012
1078
  }
1079
+ get removePersonalMedia() {
1080
+ return (this._cache.removePersonalMedia ??= removePersonalMedia.removePersonalMediaFactory(this.ctx, this));
1081
+ }
1013
1082
  get removeQuickMessage() {
1014
1083
  return (this._cache.removeQuickMessage ??= removeQuickMessage.removeQuickMessageFactory(this.ctx, this));
1015
1084
  }
@@ -1133,6 +1202,9 @@ class API {
1133
1202
  get updateLang() {
1134
1203
  return (this._cache.updateLang ??= updateLang.updateLangFactory(this.ctx, this));
1135
1204
  }
1205
+ get updatePinConversations() {
1206
+ return (this._cache.updatePinConversations ??= updatePinConversations.updatePinConversationsFactory(this.ctx, this));
1207
+ }
1136
1208
  get updateProductCatalog() {
1137
1209
  return (this._cache.updateProductCatalog ??= updateProductCatalog.updateProductCatalogFactory(this.ctx, this));
1138
1210
  }
@@ -1163,6 +1235,9 @@ class API {
1163
1235
  get verifyCloudMedia() {
1164
1236
  return (this._cache.verifyCloudMedia ??= verifyCloudMedia.verifyCloudMediaFactory(this.ctx, this));
1165
1237
  }
1238
+ get verifyFriend() {
1239
+ return (this._cache.verifyFriend ??= verifyFriend.verifyFriendFactory(this.ctx, this));
1240
+ }
1166
1241
  get voiceToText() {
1167
1242
  return (this._cache.voiceToText ??= voiceToText.voiceToTextFactory(this.ctx, this));
1168
1243
  }
@@ -12,7 +12,7 @@ const ZALO_PROTOCOL = {
12
12
  API_VERSION: 689,
13
13
  DEFAULT_API_VERSION: 689,
14
14
  /** Phiên bản SDK hiện tại */
15
- SDK_VERSION: "2.3.3",
15
+ SDK_VERSION: "2.3.4",
16
16
  /** Mã zpw_type đặc thù dành riêng cho phân hệ Gọi Thoại & Video (binary C++ ZaloCall) */
17
17
  VOICECALL_API_TYPE: 24,
18
18
  /** Phiên bản mã hóa ZCID (ParamDecryptor) */
@@ -5,15 +5,32 @@ var defaults = require('./constants/defaults.cjs');
5
5
 
6
6
  const _5_MINUTES = defaults.ZALO_DEFAULTS.UPLOAD.CALLBACK_TTL_MS;
7
7
  class CallbacksMap extends Map {
8
+ timers = new Map();
8
9
  /**
9
10
  * @param ttl Time to live in milliseconds. Default is 5 minutes.
10
11
  */
11
12
  set(key, value, ttl = _5_MINUTES) {
12
- setTimeout(() => {
13
- this.delete(key);
13
+ const existing = this.timers.get(key);
14
+ if (existing)
15
+ clearTimeout(existing);
16
+ const timer = setTimeout(() => {
17
+ this.timers.delete(key);
18
+ super.delete(key);
14
19
  }, ttl);
20
+ if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
21
+ timer.unref();
22
+ }
23
+ this.timers.set(key, timer);
15
24
  return super.set(key, value);
16
25
  }
26
+ delete(key) {
27
+ const existing = this.timers.get(key);
28
+ if (existing) {
29
+ clearTimeout(existing);
30
+ this.timers.delete(key);
31
+ }
32
+ return super.delete(key);
33
+ }
17
34
  }
18
35
  const createContext = (apiType = protocol.ZALO_PROTOCOL.API_TYPE, apiVersion = protocol.ZALO_PROTOCOL.API_VERSION) => ({
19
36
  API_TYPE: apiType,
@@ -24,6 +41,7 @@ const createContext = (apiType = protocol.ZALO_PROTOCOL.API_TYPE, apiVersion = p
24
41
  checkUpdate: defaults.ZALO_DEFAULTS.OPTIONS.CHECK_UPDATE,
25
42
  logging: defaults.ZALO_DEFAULTS.OPTIONS.LOGGING,
26
43
  polyfill: global.fetch,
44
+ requestTimeout: 30000,
27
45
  },
28
46
  secretKey: null,
29
47
  });
@@ -4,8 +4,7 @@ var ZaloApiError = require('../Errors/ZaloApiError.cjs');
4
4
  require('crypto-js');
5
5
  require('node:crypto');
6
6
  var zcloudCipher = require('../crypto/zcloud-cipher.cjs');
7
- require('pako');
8
- require('json-bigint');
7
+ require('../crypto/ws-cipher.cjs');
9
8
 
10
9
  /**
11
10
  * Thực thi request tới hệ sinh thái ZCloud (`zcld.chat.zalo.me`) kèm cơ chế:
@@ -5,6 +5,68 @@ var pako = require('pako');
5
5
  var JSONBig = require('json-bigint');
6
6
  var ZaloApiError = require('../Errors/ZaloApiError.cjs');
7
7
 
8
+ const jsonBigString = JSONBig({ storeAsString: true });
9
+ const DEFAULT_BIGINT_ID_FIELDS = [
10
+ "owner_id",
11
+ "group_id",
12
+ "uidFrom",
13
+ "uidTo",
14
+ "uid",
15
+ "ownerId",
16
+ "destId",
17
+ "srcId",
18
+ "fromUid",
19
+ "threadId",
20
+ "globalMsgId",
21
+ "global_msg_id",
22
+ "globalDelMsgId",
23
+ "msgId",
24
+ "refMessageId",
25
+ "cliMsgId",
26
+ "client_msg_id",
27
+ "actionId",
28
+ "lastActionIdOther",
29
+ "lastActionId",
30
+ "resetLastActionId",
31
+ "lastId",
32
+ "ids",
33
+ "topicId",
34
+ "reminderId",
35
+ "eventId",
36
+ ];
37
+ /**
38
+ * Tiền xử lý chuỗi JSON trước khi `JSON.parse` (tương đương `preParse(e, t)` trong `app.asar` của Zalo PC).
39
+ * Bọc dấu ngoặc kép quanh các trường định danh 64-bit (`owner_id`, `group_id`, hoặc các số nguyên >= 16 chữ số
40
+ * vượt quá `Number.MAX_SAFE_INTEGER`) để tránh mất 3 chữ số cuối của UID/MsgId do làm tròn IEEE-754.
41
+ */
42
+ function preParseJsonIds(jsonStr, alwaysStringFields = ["owner_id", "group_id"], bigIntSafeFields = DEFAULT_BIGINT_ID_FIELDS) {
43
+ if (!jsonStr || typeof jsonStr !== "string")
44
+ return jsonStr;
45
+ const alwaysSet = new Set(alwaysStringFields);
46
+ const allFields = Array.from(new Set([...alwaysStringFields, ...bigIntSafeFields]));
47
+ if (allFields.length === 0)
48
+ return jsonStr;
49
+ const escapedKeys = allFields.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
50
+ const keyValueRegex = new RegExp(`"(${escapedKeys})"(\\s*:\\s*)(\\d+|\\[\\s*\\d+(?:\\s*,\\s*\\d+)*\\s*\\])`, "g");
51
+ return jsonStr.replace(keyValueRegex, (fullMatch, key, sep, rawVal) => {
52
+ const forceString = alwaysSet.has(key);
53
+ if (rawVal.startsWith("[")) {
54
+ const inner = rawVal.slice(1, -1);
55
+ const parts = inner.split(",").map((part) => {
56
+ const trimmed = part.trim();
57
+ if (forceString || trimmed.length >= 16 || Number(trimmed) > Number.MAX_SAFE_INTEGER) {
58
+ return `"${trimmed}"`;
59
+ }
60
+ return trimmed;
61
+ });
62
+ return `"${key}"${sep}[${parts.join(",")}]`;
63
+ }
64
+ if (forceString || rawVal.length >= 16 || Number(rawVal) > Number.MAX_SAFE_INTEGER) {
65
+ return `"${key}"${sep}"${rawVal}"`;
66
+ }
67
+ return fullMatch;
68
+ });
69
+ }
8
70
  function decodeBase64ToBuffer(data) {
9
71
  return Buffer.from(data, "base64");
10
72
  }
@@ -26,7 +88,7 @@ async function decodeEventData(parsed, cipherKey) {
26
88
  const rawData = parsed.data;
27
89
  const encryptType = parsed.encrypt;
28
90
  if (encryptType === 0)
29
- return JSON.parse(rawData);
91
+ return jsonBigString.parse(preParseJsonIds(rawData));
30
92
  const decodedBuffer = decodeBase64ToBuffer(encryptType === 1 ? rawData : decodeURIComponent(rawData));
31
93
  let decryptedBuffer = decodedBuffer;
32
94
  if (encryptType !== 1) {
@@ -51,9 +113,11 @@ async function decodeEventData(parsed, cipherKey) {
51
113
  const decodedData = decodeUnit8Array(decompressedBuffer);
52
114
  if (!decodedData)
53
115
  return;
54
- return JSONBig.parse(decodedData);
116
+ return jsonBigString.parse(preParseJsonIds(decodedData));
55
117
  }
56
118
 
119
+ exports.DEFAULT_BIGINT_ID_FIELDS = DEFAULT_BIGINT_ID_FIELDS;
57
120
  exports.decodeBase64ToBuffer = decodeBase64ToBuffer;
58
121
  exports.decodeEventData = decodeEventData;
59
122
  exports.decodeUnit8Array = decodeUnit8Array;
123
+ exports.preParseJsonIds = preParseJsonIds;
@@ -36,7 +36,13 @@ var zalo = require('./zalo.cjs');
36
36
  var types = require('./realtime/types.cjs');
37
37
  require('events');
38
38
  require('ws');
39
- var utils = require('./utils.cjs');
39
+ require('crypto-js');
40
+ require('node:crypto');
41
+ require('node:fs');
42
+ require('node:path');
43
+ require('spark-md5');
44
+ require('tough-cookie');
45
+ require('./context.cjs');
40
46
  var loginQR = require('./apis/loginQR.cjs');
41
47
  var getFriendRecommendations = require('./apis/friend/getFriendRecommendations.cjs');
42
48
  var reviewPendingMemberRequest = require('./apis/group/reviewPendingMemberRequest.cjs');
@@ -153,9 +159,11 @@ exports.deriveZdbAesKey = zdbCipher.deriveZdbAesKey;
153
159
  exports.generateRSAKeyPair = zdbCipher.generateRSAKeyPair;
154
160
  exports.parseZdbHeader = zdbCipher.parseZdbHeader;
155
161
  exports.rsaDecryptPkcs1Manual = zdbCipher.rsaDecryptPkcs1Manual;
162
+ exports.DEFAULT_BIGINT_ID_FIELDS = wsCipher.DEFAULT_BIGINT_ID_FIELDS;
156
163
  exports.decodeBase64ToBuffer = wsCipher.decodeBase64ToBuffer;
157
164
  exports.decodeEventData = wsCipher.decodeEventData;
158
165
  exports.decodeUnit8Array = wsCipher.decodeUnit8Array;
166
+ exports.preParseJsonIds = wsCipher.preParseJsonIds;
159
167
  exports.getServiceEndpoint = serviceRouter.getServiceEndpoint;
160
168
  exports.getServiceEndpoints = serviceRouter.getServiceEndpoints;
161
169
  exports.requestZCloudDecrypted = zcloudClient.requestZCloudDecrypted;
@@ -165,7 +173,6 @@ Object.defineProperty(exports, "CloseReason", {
165
173
  enumerable: true,
166
174
  get: function () { return types.CloseReason; }
167
175
  });
168
- exports.preParseJsonIds = utils.preParseJsonIds;
169
176
  Object.defineProperty(exports, "LoginQRCallbackEventType", {
170
177
  enumerable: true,
171
178
  get: function () { return loginQR.LoginQRCallbackEventType; }
@@ -43,6 +43,7 @@ class Listener extends EventEmitter {
43
43
  retryTimeout;
44
44
  watchdogTimeout;
45
45
  consecutive1006Count = 0;
46
+ isManualStop = false;
46
47
  id = 0;
47
48
  constructor(ctx, urls) {
48
49
  super();
@@ -168,6 +169,7 @@ class Listener extends EventEmitter {
168
169
  utils.logger(this.ctx).verbose(`Rotating endpoint to ${this.wsURL}`);
169
170
  }
170
171
  start({ retryOnClose = false } = {}) {
172
+ this.isManualStop = false;
171
173
  if (this.retryTimeout) {
172
174
  clearTimeout(this.retryTimeout);
173
175
  this.retryTimeout = undefined;
@@ -191,6 +193,10 @@ class Listener extends EventEmitter {
191
193
  t: Date.now(),
192
194
  });
193
195
  const cookie = this.ctx.cookie.getCookieStringSync(domains.ZALO_DOMAINS.CHAT_WEB);
196
+ const wsAgent = this.ctx.options.agent &&
197
+ typeof this.ctx.options.agent.dispatch !== "function"
198
+ ? this.ctx.options.agent
199
+ : undefined;
194
200
  const ws = new WebSocket(this.wsURL, {
195
201
  headers: {
196
202
  "accept-language": utils.getBrowserLanguage(this.ctx.language),
@@ -205,7 +211,7 @@ class Listener extends EventEmitter {
205
211
  "user-agent": this.userAgent,
206
212
  cookie,
207
213
  },
208
- agent: this.ctx.options.agent,
214
+ ...(wsAgent ? { agent: wsAgent } : {}),
209
215
  });
210
216
  this.ws = ws;
211
217
  ws.onopen = () => {
@@ -218,7 +224,8 @@ class Listener extends EventEmitter {
218
224
  ws.onclose = (event) => {
219
225
  this.reset();
220
226
  this.emit("disconnected", event.code, event.reason);
221
- const retry = retryOnClose &&
227
+ const retry = !this.isManualStop &&
228
+ retryOnClose &&
222
229
  this.isRetryable(event.code) &&
223
230
  this.canRetry(event.code);
224
231
  if (retry && retryOnClose) {
@@ -304,19 +311,24 @@ class Listener extends EventEmitter {
304
311
  };
305
312
  }
306
313
  stop() {
307
- if (this.retryTimeout)
314
+ this.isManualStop = true;
315
+ if (this.retryTimeout) {
308
316
  clearTimeout(this.retryTimeout);
309
- if (this.watchdogTimeout)
317
+ this.retryTimeout = undefined;
318
+ }
319
+ if (this.watchdogTimeout) {
310
320
  clearTimeout(this.watchdogTimeout);
321
+ this.watchdogTimeout = undefined;
322
+ }
311
323
  if (this.ws) {
312
- if (this.ws.readyState !== WebSocket.CLOSED) {
324
+ if (this.ws.readyState !== WebSocket.CLOSED && this.ws.readyState !== WebSocket.CLOSING) {
313
325
  this.ws.close(types.CloseReason.ManualClosure);
314
326
  }
315
327
  }
316
328
  this.reset();
317
329
  }
318
330
  sendWs(payload, requireId = true) {
319
- if (this.ws) {
331
+ if (this.ws && (this.ws.readyState === undefined || this.ws.readyState === WebSocket.OPEN)) {
320
332
  if (requireId)
321
333
  payload.data["req_id"] = `req_${this.id++}`;
322
334
  const encodedData = new TextEncoder().encode(JSON.stringify(payload.data));
@@ -10,6 +10,9 @@ const NPM_REGISTRY = domains.ZALO_DOMAINS.NPM_REGISTRY;
10
10
  async function checkUpdate(ctx) {
11
11
  if (!ctx.options.checkUpdate)
12
12
  return;
13
+ const isAgentUndiciDispatcher = Boolean(ctx.options.agent && typeof ctx.options.agent.dispatch === "function");
14
+ const resolvedDispatcher = ctx.options.dispatcher ?? (isAgentUndiciDispatcher ? ctx.options.agent : undefined);
15
+ const resolvedAgent = ctx.options.agent && !isAgentUndiciDispatcher ? ctx.options.agent : undefined;
13
16
  const _options = {
14
17
  ...(utils.isBun
15
18
  ? {
@@ -17,7 +20,13 @@ async function checkUpdate(ctx) {
17
20
  // @ts-ignore
18
21
  proxy: ctx.options.agent?.proxy?.href,
19
22
  }
20
- : { agent: ctx.options.agent }),
23
+ : {
24
+ ...(resolvedAgent ? { agent: resolvedAgent } : {}),
25
+ ...(resolvedDispatcher ? { dispatcher: resolvedDispatcher } : {}),
26
+ }),
27
+ ...(typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function"
28
+ ? { signal: AbortSignal.timeout(3000) }
29
+ : {}),
21
30
  };
22
31
  const response = await ctx.options.polyfill(NPM_REGISTRY, _options).catch(() => null);
23
32
  if (!response || !response.ok)