@ohos-ports/zca-js 2.2.0-beta.1
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 +225 -0
- package/dist/Errors/ZaloApiError.d.ts +4 -0
- package/dist/Errors/ZaloApiError.js +7 -0
- package/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/dist/Errors/index.d.ts +4 -0
- package/dist/Errors/index.js +4 -0
- package/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/dist/apis/acceptFriendRequest.js +28 -0
- package/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/dist/apis/addGroupBlockedMember.js +28 -0
- package/dist/apis/addGroupDeputy.d.ts +2 -0
- package/dist/apis/addGroupDeputy.js +30 -0
- package/dist/apis/addPollOptions.d.ts +14 -0
- package/dist/apis/addPollOptions.js +26 -0
- package/dist/apis/addQuickMessage.d.ts +11 -0
- package/dist/apis/addQuickMessage.js +60 -0
- package/dist/apis/addReaction.d.ts +18 -0
- package/dist/apis/addReaction.js +294 -0
- package/dist/apis/addUnreadMark.d.ts +8 -0
- package/dist/apis/addUnreadMark.js +52 -0
- package/dist/apis/addUserToGroup.d.ts +5 -0
- package/dist/apis/addUserToGroup.js +34 -0
- package/dist/apis/blockUser.d.ts +2 -0
- package/dist/apis/blockUser.js +28 -0
- package/dist/apis/blockViewFeed.d.ts +2 -0
- package/dist/apis/blockViewFeed.js +30 -0
- package/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/dist/apis/changeAccountAvatar.js +52 -0
- package/dist/apis/changeFriendAlias.d.ts +2 -0
- package/dist/apis/changeFriendAlias.js +27 -0
- package/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/dist/apis/changeGroupAvatar.js +44 -0
- package/dist/apis/changeGroupName.d.ts +4 -0
- package/dist/apis/changeGroupName.js +32 -0
- package/dist/apis/changeGroupOwner.d.ts +4 -0
- package/dist/apis/changeGroupOwner.js +30 -0
- package/dist/apis/createAutoReply.d.ts +14 -0
- package/dist/apis/createAutoReply.js +37 -0
- package/dist/apis/createBankAccount.d.ts +8 -0
- package/dist/apis/createBankAccount.js +32 -0
- package/dist/apis/createCatalog.d.ts +7 -0
- package/dist/apis/createCatalog.js +29 -0
- package/dist/apis/createGroup.d.ts +28 -0
- package/dist/apis/createGroup.js +43 -0
- package/dist/apis/createNote.d.ts +7 -0
- package/dist/apis/createNote.js +47 -0
- package/dist/apis/createPoll.d.ts +36 -0
- package/dist/apis/createPoll.js +40 -0
- package/dist/apis/createProductCatalog.d.ts +23 -0
- package/dist/apis/createProductCatalog.js +50 -0
- package/dist/apis/createReminder.d.ts +12 -0
- package/dist/apis/createReminder.js +63 -0
- package/dist/apis/custom.d.ts +9 -0
- package/dist/apis/custom.js +15 -0
- package/dist/apis/deleteAutoReply.d.ts +5 -0
- package/dist/apis/deleteAutoReply.js +29 -0
- package/dist/apis/deleteAvatar.d.ts +9 -0
- package/dist/apis/deleteAvatar.js +27 -0
- package/dist/apis/deleteBankAccount.d.ts +11 -0
- package/dist/apis/deleteBankAccount.js +32 -0
- package/dist/apis/deleteCatalog.d.ts +2 -0
- package/dist/apis/deleteCatalog.js +28 -0
- package/dist/apis/deleteChat.d.ts +19 -0
- package/dist/apis/deleteChat.js +50 -0
- package/dist/apis/deleteGroupInviteBox.d.ts +9 -0
- package/dist/apis/deleteGroupInviteBox.js +27 -0
- package/dist/apis/deleteMessage.d.ts +14 -0
- package/dist/apis/deleteMessage.js +52 -0
- package/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/dist/apis/deleteProductCatalog.js +31 -0
- package/dist/apis/disableGroupLink.d.ts +2 -0
- package/dist/apis/disableGroupLink.js +24 -0
- package/dist/apis/disperseGroup.d.ts +2 -0
- package/dist/apis/disperseGroup.js +28 -0
- package/dist/apis/editNote.d.ts +17 -0
- package/dist/apis/editNote.js +46 -0
- package/dist/apis/editReminder.d.ts +13 -0
- package/dist/apis/editReminder.js +61 -0
- package/dist/apis/enableGroupLink.d.ts +6 -0
- package/dist/apis/enableGroupLink.js +25 -0
- package/dist/apis/fetchAccountInfo.d.ts +5 -0
- package/dist/apis/fetchAccountInfo.js +10 -0
- package/dist/apis/findUser.d.ts +3 -0
- package/dist/apis/findUser.js +42 -0
- package/dist/apis/findUserByUsername.d.ts +3 -0
- package/dist/apis/findUserByUsername.js +27 -0
- package/dist/apis/forwardMessage.d.ts +24 -0
- package/dist/apis/forwardMessage.js +99 -0
- package/dist/apis/getAliasList.d.ts +8 -0
- package/dist/apis/getAliasList.js +27 -0
- package/dist/apis/getAllFriends.d.ts +3 -0
- package/dist/apis/getAllFriends.js +34 -0
- package/dist/apis/getAllGroups.d.ts +7 -0
- package/dist/apis/getAllGroups.js +10 -0
- package/dist/apis/getArchivedChatList.d.ts +5 -0
- package/dist/apis/getArchivedChatList.js +23 -0
- package/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/dist/apis/getAutoDeleteChat.js +21 -0
- package/dist/apis/getAutoReplyList.d.ts +6 -0
- package/dist/apis/getAutoReplyList.js +24 -0
- package/dist/apis/getAvatarList.d.ts +12 -0
- package/dist/apis/getAvatarList.js +28 -0
- package/dist/apis/getAvatarUrlProfile.d.ts +7 -0
- package/dist/apis/getAvatarUrlProfile.js +30 -0
- package/dist/apis/getBizAccount.d.ts +24 -0
- package/dist/apis/getBizAccount.js +27 -0
- package/dist/apis/getCatalogList.d.ts +18 -0
- package/dist/apis/getCatalogList.js +32 -0
- package/dist/apis/getCloseFriends.d.ts +3 -0
- package/dist/apis/getCloseFriends.js +20 -0
- package/dist/apis/getContext.d.ts +1 -0
- package/dist/apis/getContext.js +4 -0
- package/dist/apis/getCookie.d.ts +1 -0
- package/dist/apis/getCookie.js +9 -0
- package/dist/apis/getFriendBoardList.d.ts +5 -0
- package/dist/apis/getFriendBoardList.js +26 -0
- package/dist/apis/getFriendOnlines.d.ts +10 -0
- package/dist/apis/getFriendOnlines.js +35 -0
- package/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/dist/apis/getFriendRecommendations.js +27 -0
- package/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/apis/getFriendRequestStatus.js +25 -0
- package/dist/apis/getFullAvatar.d.ts +5 -0
- package/dist/apis/getFullAvatar.js +25 -0
- package/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/dist/apis/getGroupBlockedMember.js +29 -0
- package/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/dist/apis/getGroupChatHistory.js +36 -0
- package/dist/apis/getGroupInfo.d.ts +16 -0
- package/dist/apis/getGroupInfo.js +32 -0
- package/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/dist/apis/getGroupInviteBoxList.js +31 -0
- package/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/dist/apis/getGroupLinkDetail.js +25 -0
- package/dist/apis/getGroupLinkInfo.d.ts +34 -0
- package/dist/apis/getGroupLinkInfo.js +28 -0
- package/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/dist/apis/getGroupMembersInfo.js +24 -0
- package/dist/apis/getHiddenConversations.d.ts +11 -0
- package/dist/apis/getHiddenConversations.js +23 -0
- package/dist/apis/getLabels.d.ts +7 -0
- package/dist/apis/getLabels.js +28 -0
- package/dist/apis/getListBank.d.ts +5 -0
- package/dist/apis/getListBank.js +20 -0
- package/dist/apis/getListBankAccount.d.ts +7 -0
- package/dist/apis/getListBankAccount.js +27 -0
- package/dist/apis/getListBoard.d.ts +21 -0
- package/dist/apis/getListBoard.js +45 -0
- package/dist/apis/getListDevice.d.ts +10 -0
- package/dist/apis/getListDevice.js +22 -0
- package/dist/apis/getListReminder.d.ts +28 -0
- package/dist/apis/getListReminder.js +47 -0
- package/dist/apis/getMultiUsersByPhones.d.ts +5 -0
- package/dist/apis/getMultiUsersByPhones.js +39 -0
- package/dist/apis/getMute.d.ts +13 -0
- package/dist/apis/getMute.js +22 -0
- package/dist/apis/getOwnId.d.ts +1 -0
- package/dist/apis/getOwnId.js +4 -0
- package/dist/apis/getPendingGroupMembers.d.ts +11 -0
- package/dist/apis/getPendingGroupMembers.js +27 -0
- package/dist/apis/getPinConversations.d.ts +5 -0
- package/dist/apis/getPinConversations.js +22 -0
- package/dist/apis/getPollDetail.d.ts +3 -0
- package/dist/apis/getPollDetail.js +30 -0
- package/dist/apis/getProductCatalogList.d.ts +20 -0
- package/dist/apis/getProductCatalogList.js +33 -0
- package/dist/apis/getQR.d.ts +4 -0
- package/dist/apis/getQR.js +29 -0
- package/dist/apis/getQuickMessageList.d.ts +7 -0
- package/dist/apis/getQuickMessageList.js +24 -0
- package/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/dist/apis/getRelatedFriendGroup.js +30 -0
- package/dist/apis/getReminder.d.ts +3 -0
- package/dist/apis/getReminder.js +25 -0
- package/dist/apis/getReminderResponses.d.ts +5 -0
- package/dist/apis/getReminderResponses.js +24 -0
- package/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/dist/apis/getSentFriendRequest.js +24 -0
- package/dist/apis/getSettings.d.ts +3 -0
- package/dist/apis/getSettings.js +20 -0
- package/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/dist/apis/getStickerCategoryDetail.js +24 -0
- package/dist/apis/getStickers.d.ts +1 -0
- package/dist/apis/getStickers.js +40 -0
- package/dist/apis/getStickersDetail.d.ts +3 -0
- package/dist/apis/getStickersDetail.js +40 -0
- package/dist/apis/getUnreadMark.d.ts +14 -0
- package/dist/apis/getUnreadMark.js +30 -0
- package/dist/apis/getUserInfo.d.ts +8 -0
- package/dist/apis/getUserInfo.js +44 -0
- package/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/apis/inviteUserToGroups.js +30 -0
- package/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/dist/apis/joinGroupInviteBox.js +25 -0
- package/dist/apis/joinGroupLink.d.ts +2 -0
- package/dist/apis/joinGroupLink.js +27 -0
- package/dist/apis/keepAlive.d.ts +4 -0
- package/dist/apis/keepAlive.js +22 -0
- package/dist/apis/lastOnline.d.ts +7 -0
- package/dist/apis/lastOnline.js +26 -0
- package/dist/apis/leaveGroup.d.ts +4 -0
- package/dist/apis/leaveGroup.js +33 -0
- package/dist/apis/listen.d.ts +102 -0
- package/dist/apis/listen.js +425 -0
- package/dist/apis/lockPoll.d.ts +2 -0
- package/dist/apis/lockPoll.js +28 -0
- package/dist/apis/login.d.ts +3 -0
- package/dist/apis/login.js +96 -0
- package/dist/apis/loginQR.d.ts +71 -0
- package/dist/apis/loginQR.js +365 -0
- package/dist/apis/lostFocus.d.ts +4 -0
- package/dist/apis/lostFocus.js +23 -0
- package/dist/apis/parseLink.d.ts +21 -0
- package/dist/apis/parseLink.js +27 -0
- package/dist/apis/registerCatalog.d.ts +2 -0
- package/dist/apis/registerCatalog.js +27 -0
- package/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/dist/apis/rejectFriendRequest.js +27 -0
- package/dist/apis/removeFriend.d.ts +2 -0
- package/dist/apis/removeFriend.js +28 -0
- package/dist/apis/removeFriendAlias.d.ts +2 -0
- package/dist/apis/removeFriendAlias.js +24 -0
- package/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/dist/apis/removeGroupBlockedMember.js +28 -0
- package/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/dist/apis/removeGroupDeputy.js +30 -0
- package/dist/apis/removeQuickMessage.d.ts +5 -0
- package/dist/apis/removeQuickMessage.js +27 -0
- package/dist/apis/removeReminder.d.ts +3 -0
- package/dist/apis/removeReminder.js +40 -0
- package/dist/apis/removeUnreadMark.d.ts +8 -0
- package/dist/apis/removeUnreadMark.js +50 -0
- package/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/dist/apis/removeUserFromGroup.js +34 -0
- package/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/dist/apis/resetHiddenConversPin.js +20 -0
- package/dist/apis/reuseAvatar.d.ts +2 -0
- package/dist/apis/reuseAvatar.js +26 -0
- package/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
- package/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/dist/apis/scanURL.d.ts +4 -0
- package/dist/apis/scanURL.js +28 -0
- package/dist/apis/searchSticker.d.ts +3 -0
- package/dist/apis/searchSticker.js +28 -0
- package/dist/apis/sendBankCard.d.ts +9 -0
- package/dist/apis/sendBankCard.js +37 -0
- package/dist/apis/sendCard.d.ts +10 -0
- package/dist/apis/sendCard.js +59 -0
- package/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/dist/apis/sendDeliveredEvent.js +55 -0
- package/dist/apis/sendFriendRequest.d.ts +2 -0
- package/dist/apis/sendFriendRequest.js +39 -0
- package/dist/apis/sendLink.d.ts +10 -0
- package/dist/apis/sendLink.js +61 -0
- package/dist/apis/sendMessage.d.ts +99 -0
- package/dist/apis/sendMessage.js +452 -0
- package/dist/apis/sendReport.d.ts +17 -0
- package/dist/apis/sendReport.js +53 -0
- package/dist/apis/sendSeenEvent.d.ts +16 -0
- package/dist/apis/sendSeenEvent.js +63 -0
- package/dist/apis/sendSticker.d.ts +10 -0
- package/dist/apis/sendSticker.js +57 -0
- package/dist/apis/sendTypingEvent.d.ts +5 -0
- package/dist/apis/sendTypingEvent.js +33 -0
- package/dist/apis/sendVideo.d.ts +35 -0
- package/dist/apis/sendVideo.js +118 -0
- package/dist/apis/sendVoice.d.ts +12 -0
- package/dist/apis/sendVoice.js +73 -0
- package/dist/apis/setHiddenConversations.d.ts +3 -0
- package/dist/apis/setHiddenConversations.js +39 -0
- package/dist/apis/setMute.d.ts +20 -0
- package/dist/apis/setMute.js +67 -0
- package/dist/apis/setPinnedConversations.d.ts +3 -0
- package/dist/apis/setPinnedConversations.js +34 -0
- package/dist/apis/sharePoll.d.ts +2 -0
- package/dist/apis/sharePoll.js +28 -0
- package/dist/apis/unblockUser.d.ts +2 -0
- package/dist/apis/unblockUser.js +28 -0
- package/dist/apis/undo.d.ts +9 -0
- package/dist/apis/undo.js +42 -0
- package/dist/apis/undoFriendRequest.d.ts +2 -0
- package/dist/apis/undoFriendRequest.js +27 -0
- package/dist/apis/updateActiveStatus.d.ts +4 -0
- package/dist/apis/updateActiveStatus.js +27 -0
- package/dist/apis/updateArchivedChatList.d.ts +10 -0
- package/dist/apis/updateArchivedChatList.js +34 -0
- package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/apis/updateAutoDeleteChat.js +40 -0
- package/dist/apis/updateAutoReply.d.ts +15 -0
- package/dist/apis/updateAutoReply.js +38 -0
- package/dist/apis/updateBankAccount.d.ts +9 -0
- package/dist/apis/updateBankAccount.js +31 -0
- package/dist/apis/updateCatalog.d.ts +11 -0
- package/dist/apis/updateCatalog.js +30 -0
- package/dist/apis/updateGroupSettings.d.ts +40 -0
- package/dist/apis/updateGroupSettings.js +43 -0
- package/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/dist/apis/updateHiddenConversPin.js +30 -0
- package/dist/apis/updateLabels.d.ts +15 -0
- package/dist/apis/updateLabels.js +34 -0
- package/dist/apis/updateLang.d.ts +6 -0
- package/dist/apis/updateLang.js +30 -0
- package/dist/apis/updateProductCatalog.d.ts +25 -0
- package/dist/apis/updateProductCatalog.js +51 -0
- package/dist/apis/updateProfile.d.ts +20 -0
- package/dist/apis/updateProfile.js +43 -0
- package/dist/apis/updateProfileBio.d.ts +2 -0
- package/dist/apis/updateProfileBio.js +27 -0
- package/dist/apis/updateQuickMessage.d.ts +11 -0
- package/dist/apis/updateQuickMessage.js +61 -0
- package/dist/apis/updateSettings.d.ts +16 -0
- package/dist/apis/updateSettings.js +90 -0
- package/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
- package/dist/apis/upgradeGroupToCommunity.js +27 -0
- package/dist/apis/uploadAttachment.d.ts +50 -0
- package/dist/apis/uploadAttachment.js +197 -0
- package/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/apis/uploadProductPhoto.js +50 -0
- package/dist/apis/votePoll.d.ts +5 -0
- package/dist/apis/votePoll.js +29 -0
- package/dist/apis.d.ts +317 -0
- package/dist/apis.js +317 -0
- package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
- package/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/addPollOptions.cjs +31 -0
- package/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/dist/cjs/apis/addReaction.cjs +308 -0
- package/dist/cjs/apis/addUnreadMark.cjs +66 -0
- package/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/dist/cjs/apis/blockUser.cjs +33 -0
- package/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/dist/cjs/apis/createBankAccount.cjs +37 -0
- package/dist/cjs/apis/createCatalog.cjs +34 -0
- package/dist/cjs/apis/createGroup.cjs +48 -0
- package/dist/cjs/apis/createNote.cjs +52 -0
- package/dist/cjs/apis/createPoll.cjs +45 -0
- package/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/dist/cjs/apis/createReminder.cjs +77 -0
- package/dist/cjs/apis/custom.cjs +19 -0
- package/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/dist/cjs/apis/deleteBankAccount.cjs +37 -0
- package/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/dist/cjs/apis/deleteChat.cjs +64 -0
- package/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/dist/cjs/apis/deleteMessage.cjs +66 -0
- package/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/dist/cjs/apis/editNote.cjs +51 -0
- package/dist/cjs/apis/editReminder.cjs +75 -0
- package/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/dist/cjs/apis/findUser.cjs +56 -0
- package/dist/cjs/apis/findUserByUsername.cjs +41 -0
- package/dist/cjs/apis/forwardMessage.cjs +113 -0
- package/dist/cjs/apis/getAliasList.cjs +32 -0
- package/dist/cjs/apis/getAllFriends.cjs +48 -0
- package/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
- package/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/dist/cjs/apis/getCloseFriends.cjs +25 -0
- package/dist/cjs/apis/getContext.cjs +9 -0
- package/dist/cjs/apis/getCookie.cjs +14 -0
- package/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/dist/cjs/apis/getFriendOnlines.cjs +40 -0
- package/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
- package/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
- package/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/dist/cjs/apis/getLabels.cjs +33 -0
- package/dist/cjs/apis/getListBank.cjs +25 -0
- package/dist/cjs/apis/getListBankAccount.cjs +32 -0
- package/dist/cjs/apis/getListBoard.cjs +59 -0
- package/dist/cjs/apis/getListDevice.cjs +27 -0
- package/dist/cjs/apis/getListReminder.cjs +61 -0
- package/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
- package/dist/cjs/apis/getMute.cjs +27 -0
- package/dist/cjs/apis/getOwnId.cjs +9 -0
- package/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/dist/cjs/apis/getQR.cjs +34 -0
- package/dist/cjs/apis/getQuickMessageList.cjs +29 -0
- package/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/dist/cjs/apis/getReminder.cjs +30 -0
- package/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/dist/cjs/apis/getSettings.cjs +25 -0
- package/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
- package/dist/cjs/apis/getStickers.cjs +45 -0
- package/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/dist/cjs/apis/getUserInfo.cjs +58 -0
- package/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
- package/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/dist/cjs/apis/keepAlive.cjs +27 -0
- package/dist/cjs/apis/lastOnline.cjs +31 -0
- package/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/dist/cjs/apis/listen.cjs +440 -0
- package/dist/cjs/apis/lockPoll.cjs +33 -0
- package/dist/cjs/apis/login.cjs +102 -0
- package/dist/cjs/apis/loginQR.cjs +370 -0
- package/dist/cjs/apis/lostFocus.cjs +28 -0
- package/dist/cjs/apis/parseLink.cjs +32 -0
- package/dist/cjs/apis/registerCatalog.cjs +32 -0
- package/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
- package/dist/cjs/apis/removeFriend.cjs +33 -0
- package/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/dist/cjs/apis/removeReminder.cjs +54 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +64 -0
- package/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
- package/dist/cjs/apis/scanURL.cjs +33 -0
- package/dist/cjs/apis/searchSticker.cjs +33 -0
- package/dist/cjs/apis/sendBankCard.cjs +51 -0
- package/dist/cjs/apis/sendCard.cjs +73 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
- package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/dist/cjs/apis/sendLink.cjs +75 -0
- package/dist/cjs/apis/sendMessage.cjs +466 -0
- package/dist/cjs/apis/sendReport.cjs +67 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +77 -0
- package/dist/cjs/apis/sendSticker.cjs +71 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +47 -0
- package/dist/cjs/apis/sendVideo.cjs +132 -0
- package/dist/cjs/apis/sendVoice.cjs +87 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +53 -0
- package/dist/cjs/apis/setMute.cjs +81 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +48 -0
- package/dist/cjs/apis/sharePoll.cjs +33 -0
- package/dist/cjs/apis/unblockUser.cjs +33 -0
- package/dist/cjs/apis/undo.cjs +56 -0
- package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
- package/dist/cjs/apis/updateAutoReply.cjs +43 -0
- package/dist/cjs/apis/updateBankAccount.cjs +36 -0
- package/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/dist/cjs/apis/updateLabels.cjs +39 -0
- package/dist/cjs/apis/updateLang.cjs +35 -0
- package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/dist/cjs/apis/updateProfile.cjs +48 -0
- package/dist/cjs/apis/updateProfileBio.cjs +32 -0
- package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/dist/cjs/apis/updateSettings.cjs +95 -0
- package/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
- package/dist/cjs/apis/uploadAttachment.cjs +211 -0
- package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/dist/cjs/apis/votePoll.cjs +34 -0
- package/dist/cjs/apis.cjs +322 -0
- package/dist/cjs/context.cjs +34 -0
- package/dist/cjs/index.cjs +159 -0
- package/dist/cjs/models/AutoReply.cjs +9 -0
- package/dist/cjs/models/Bank.cjs +263 -0
- package/dist/cjs/models/Board.cjs +8 -0
- package/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/dist/cjs/models/Enum.cjs +27 -0
- package/dist/cjs/models/FriendEvent.cjs +87 -0
- package/dist/cjs/models/Group.cjs +13 -0
- package/dist/cjs/models/GroupEvent.cjs +94 -0
- package/dist/cjs/models/Message.cjs +35 -0
- package/dist/cjs/models/Reaction.cjs +74 -0
- package/dist/cjs/models/Reminder.cjs +9 -0
- package/dist/cjs/models/SeenMessage.cjs +23 -0
- package/dist/cjs/models/Typing.cjs +23 -0
- package/dist/cjs/models/Undo.cjs +16 -0
- package/dist/cjs/models/ZBusiness.cjs +39 -0
- package/dist/cjs/update.cjs +34 -0
- package/dist/cjs/utils.cjs +703 -0
- package/dist/cjs/zalo.cjs +112 -0
- package/dist/context.d.ts +179 -0
- package/dist/context.js +28 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +14 -0
- package/dist/models/Attachment.d.ts +9 -0
- package/dist/models/Attachment.js +1 -0
- package/dist/models/AutoReply.d.ts +20 -0
- package/dist/models/AutoReply.js +7 -0
- package/dist/models/Bank.d.ts +291 -0
- package/dist/models/Bank.js +262 -0
- package/dist/models/Board.d.ts +60 -0
- package/dist/models/Board.js +6 -0
- package/dist/models/Catalog.d.ts +16 -0
- package/dist/models/Catalog.js +1 -0
- package/dist/models/DeliveredMessage.d.ts +27 -0
- package/dist/models/DeliveredMessage.js +17 -0
- package/dist/models/Enum.d.ts +21 -0
- package/dist/models/Enum.js +25 -0
- package/dist/models/FriendEvent.d.ts +107 -0
- package/dist/models/FriendEvent.js +83 -0
- package/dist/models/Group.d.ts +125 -0
- package/dist/models/Group.js +11 -0
- package/dist/models/GroupEvent.d.ts +178 -0
- package/dist/models/GroupEvent.js +90 -0
- package/dist/models/Label.d.ts +10 -0
- package/dist/models/Label.js +1 -0
- package/dist/models/Message.d.ts +91 -0
- package/dist/models/Message.js +29 -0
- package/dist/models/ProductCatalog.d.ts +17 -0
- package/dist/models/ProductCatalog.js +1 -0
- package/dist/models/QuickMessage.d.ts +25 -0
- package/dist/models/QuickMessage.js +1 -0
- package/dist/models/Reaction.d.ts +85 -0
- package/dist/models/Reaction.js +70 -0
- package/dist/models/Reminder.d.ts +51 -0
- package/dist/models/Reminder.js +7 -0
- package/dist/models/SeenMessage.d.ts +26 -0
- package/dist/models/SeenMessage.js +17 -0
- package/dist/models/Sticker.d.ts +27 -0
- package/dist/models/Sticker.js +1 -0
- package/dist/models/Typing.d.ts +24 -0
- package/dist/models/Typing.js +17 -0
- package/dist/models/Undo.d.ts +34 -0
- package/dist/models/Undo.js +12 -0
- package/dist/models/User.d.ts +70 -0
- package/dist/models/User.js +1 -0
- package/dist/models/ZBusiness.d.ts +22 -0
- package/dist/models/ZBusiness.js +35 -0
- package/dist/models/index.d.ts +22 -0
- package/dist/models/index.js +22 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +29 -0
- package/dist/utils.d.ts +167 -0
- package/dist/utils.js +719 -0
- package/dist/zalo.d.ts +41 -0
- package/dist/zalo.js +107 -0
- package/index.d.ts +2 -0
- package/package.json +85 -0
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var cryptojs = require('crypto-js');
|
|
4
|
+
var crypto = require('node:crypto');
|
|
5
|
+
var fs = require('node:fs');
|
|
6
|
+
var path = require('node:path');
|
|
7
|
+
var pako = require('pako');
|
|
8
|
+
var SparkMD5 = require('spark-md5');
|
|
9
|
+
var toughCookie = require('tough-cookie');
|
|
10
|
+
var JSONBig = require('json-bigint');
|
|
11
|
+
var context = require('./context.cjs');
|
|
12
|
+
var ZaloApiError = require('./Errors/ZaloApiError.cjs');
|
|
13
|
+
var ZaloApiMissingImageMetadataGetter = require('./Errors/ZaloApiMissingImageMetadataGetter.cjs');
|
|
14
|
+
var FriendEvent = require('./models/FriendEvent.cjs');
|
|
15
|
+
var GroupEvent = require('./models/GroupEvent.cjs');
|
|
16
|
+
|
|
17
|
+
const isBun = typeof Bun !== "undefined";
|
|
18
|
+
function hasOwn(obj, key) {
|
|
19
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get signed key for API requests.
|
|
23
|
+
*
|
|
24
|
+
* @param type
|
|
25
|
+
* @param params
|
|
26
|
+
* @returns MD5 hash
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
function getSignKey(type, params) {
|
|
30
|
+
const n = [];
|
|
31
|
+
for (const s in params) {
|
|
32
|
+
if (hasOwn(params, s)) {
|
|
33
|
+
n.push(s);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
n.sort();
|
|
37
|
+
let a = "zsecure" + type;
|
|
38
|
+
for (let s = 0; s < n.length; s++)
|
|
39
|
+
a += params[n[s]];
|
|
40
|
+
return cryptojs.MD5(a).toString();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param baseURL
|
|
45
|
+
* @param params
|
|
46
|
+
* @param apiVersion automatically add zalo api version to url params
|
|
47
|
+
* @returns
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
function makeURL(ctx, baseURL, params = {}, apiVersion = true) {
|
|
51
|
+
const url = new URL(baseURL);
|
|
52
|
+
for (const key in params) {
|
|
53
|
+
if (hasOwn(params, key)) {
|
|
54
|
+
url.searchParams.append(key, params[key].toString());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (apiVersion) {
|
|
58
|
+
if (!url.searchParams.has("zpw_ver"))
|
|
59
|
+
url.searchParams.set("zpw_ver", ctx.API_VERSION.toString());
|
|
60
|
+
if (!url.searchParams.has("zpw_type"))
|
|
61
|
+
url.searchParams.set("zpw_type", ctx.API_TYPE.toString());
|
|
62
|
+
}
|
|
63
|
+
return url.toString();
|
|
64
|
+
}
|
|
65
|
+
class ParamsEncryptor {
|
|
66
|
+
constructor({ type, imei, firstLaunchTime }) {
|
|
67
|
+
this.zcid = null;
|
|
68
|
+
this.enc_ver = "v2";
|
|
69
|
+
this.zcid = null;
|
|
70
|
+
this.encryptKey = null;
|
|
71
|
+
this.createZcid(type, imei, firstLaunchTime);
|
|
72
|
+
this.zcid_ext = ParamsEncryptor.randomString();
|
|
73
|
+
this.createEncryptKey();
|
|
74
|
+
}
|
|
75
|
+
getEncryptKey() {
|
|
76
|
+
if (!this.encryptKey)
|
|
77
|
+
throw new ZaloApiError.ZaloApiError("getEncryptKey: didn't create encryptKey yet");
|
|
78
|
+
return this.encryptKey;
|
|
79
|
+
}
|
|
80
|
+
createZcid(type, imei, firstLaunchTime) {
|
|
81
|
+
if (!type || !imei || !firstLaunchTime)
|
|
82
|
+
throw new ZaloApiError.ZaloApiError("createZcid: missing params");
|
|
83
|
+
const msg = `${type},${imei},${firstLaunchTime}`;
|
|
84
|
+
const s = ParamsEncryptor.encodeAES("3FC4F0D2AB50057BCE0D90D9187A22B1", msg, "hex", true);
|
|
85
|
+
this.zcid = s;
|
|
86
|
+
}
|
|
87
|
+
createEncryptKey(e = 0) {
|
|
88
|
+
const t = (e, t) => {
|
|
89
|
+
const { even: n } = ParamsEncryptor.processStr(e), { even: a, odd: s } = ParamsEncryptor.processStr(t);
|
|
90
|
+
if (!n || !a || !s)
|
|
91
|
+
return !1;
|
|
92
|
+
const i = n.slice(0, 8).join("") + a.slice(0, 12).join("") + s.reverse().slice(0, 12).join("");
|
|
93
|
+
return (this.encryptKey = i), !0;
|
|
94
|
+
};
|
|
95
|
+
if (!this.zcid || !this.zcid_ext)
|
|
96
|
+
throw new ZaloApiError.ZaloApiError("createEncryptKey: zcid or zcid_ext is null");
|
|
97
|
+
try {
|
|
98
|
+
const n = cryptojs.MD5(this.zcid_ext).toString().toUpperCase();
|
|
99
|
+
if (t(n, this.zcid) || !(e < 3))
|
|
100
|
+
return !1;
|
|
101
|
+
this.createEncryptKey(e + 1);
|
|
102
|
+
}
|
|
103
|
+
catch (_a) {
|
|
104
|
+
if (e < 3)
|
|
105
|
+
this.createEncryptKey(e + 1);
|
|
106
|
+
}
|
|
107
|
+
return !0;
|
|
108
|
+
}
|
|
109
|
+
getParams() {
|
|
110
|
+
return this.zcid
|
|
111
|
+
? {
|
|
112
|
+
zcid: this.zcid,
|
|
113
|
+
zcid_ext: this.zcid_ext,
|
|
114
|
+
enc_ver: this.enc_ver,
|
|
115
|
+
}
|
|
116
|
+
: null;
|
|
117
|
+
}
|
|
118
|
+
static processStr(e) {
|
|
119
|
+
if (!e || "string" != typeof e)
|
|
120
|
+
return {
|
|
121
|
+
even: null,
|
|
122
|
+
odd: null,
|
|
123
|
+
};
|
|
124
|
+
const [t, n] = [...e].reduce((e, t, n) => (e[n % 2].push(t), e), [[], []]);
|
|
125
|
+
return {
|
|
126
|
+
even: t,
|
|
127
|
+
odd: n,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
static randomString(e, t) {
|
|
131
|
+
const n = e || 6, a = t && e && t > e ? t : 12;
|
|
132
|
+
let s = Math.floor(Math.random() * (a - n + 1)) + n;
|
|
133
|
+
if (s > 12) {
|
|
134
|
+
let e = "";
|
|
135
|
+
for (; s > 0;) {
|
|
136
|
+
e += Math.random()
|
|
137
|
+
.toString(16)
|
|
138
|
+
.substr(2, s > 12 ? 12 : s);
|
|
139
|
+
s -= 12;
|
|
140
|
+
}
|
|
141
|
+
return e;
|
|
142
|
+
}
|
|
143
|
+
return Math.random().toString(16).substr(2, s);
|
|
144
|
+
}
|
|
145
|
+
static encodeAES(e, message, type, uppercase, s = 0) {
|
|
146
|
+
if (!message)
|
|
147
|
+
return null;
|
|
148
|
+
try {
|
|
149
|
+
{
|
|
150
|
+
const encoder = "hex" == type ? cryptojs.enc.Hex : cryptojs.enc.Base64;
|
|
151
|
+
const key = cryptojs.enc.Utf8.parse(e);
|
|
152
|
+
const cfg = {
|
|
153
|
+
words: [0, 0, 0, 0],
|
|
154
|
+
sigBytes: 16,
|
|
155
|
+
};
|
|
156
|
+
const encrypted = cryptojs.AES.encrypt(message, key, {
|
|
157
|
+
iv: cfg,
|
|
158
|
+
mode: cryptojs.mode.CBC,
|
|
159
|
+
padding: cryptojs.pad.Pkcs7,
|
|
160
|
+
}).ciphertext.toString(encoder);
|
|
161
|
+
return uppercase ? encrypted.toUpperCase() : encrypted;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (_a) {
|
|
165
|
+
return s < 3 ? ParamsEncryptor.encodeAES(e, message, type, uppercase, s + 1) : null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function decryptResp(key, data) {
|
|
170
|
+
let n = null;
|
|
171
|
+
try {
|
|
172
|
+
n = decodeRespAES(key, data);
|
|
173
|
+
const parsed = JSON.parse(n);
|
|
174
|
+
return parsed;
|
|
175
|
+
}
|
|
176
|
+
catch (_a) {
|
|
177
|
+
return n;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function decodeRespAES(key, data) {
|
|
181
|
+
data = decodeURIComponent(data);
|
|
182
|
+
const parsedKey = cryptojs.enc.Utf8.parse(key);
|
|
183
|
+
const n = {
|
|
184
|
+
words: [0, 0, 0, 0],
|
|
185
|
+
sigBytes: 16,
|
|
186
|
+
};
|
|
187
|
+
return cryptojs.AES.decrypt({
|
|
188
|
+
ciphertext: cryptojs.enc.Base64.parse(data),
|
|
189
|
+
}, parsedKey, {
|
|
190
|
+
iv: n,
|
|
191
|
+
mode: cryptojs.mode.CBC,
|
|
192
|
+
padding: cryptojs.pad.Pkcs7,
|
|
193
|
+
}).toString(cryptojs.enc.Utf8);
|
|
194
|
+
}
|
|
195
|
+
function decodeBase64ToBuffer(data) {
|
|
196
|
+
return Buffer.from(data, "base64");
|
|
197
|
+
}
|
|
198
|
+
function decodeUnit8Array(data) {
|
|
199
|
+
try {
|
|
200
|
+
return new TextDecoder().decode(data);
|
|
201
|
+
}
|
|
202
|
+
catch (_a) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function encodeAES(secretKey, data, t = 0) {
|
|
207
|
+
try {
|
|
208
|
+
const key = cryptojs.enc.Base64.parse(secretKey);
|
|
209
|
+
return cryptojs.AES.encrypt(data, key, {
|
|
210
|
+
iv: cryptojs.enc.Hex.parse("00000000000000000000000000000000"),
|
|
211
|
+
mode: cryptojs.mode.CBC,
|
|
212
|
+
padding: cryptojs.pad.Pkcs7,
|
|
213
|
+
}).ciphertext.toString(cryptojs.enc.Base64);
|
|
214
|
+
}
|
|
215
|
+
catch (_a) {
|
|
216
|
+
return t < 3 ? encodeAES(secretKey, data, t + 1) : null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function decodeAES(secretKey, data, t = 0) {
|
|
220
|
+
try {
|
|
221
|
+
data = decodeURIComponent(data);
|
|
222
|
+
const key = cryptojs.enc.Base64.parse(secretKey);
|
|
223
|
+
return cryptojs.AES.decrypt({
|
|
224
|
+
ciphertext: cryptojs.enc.Base64.parse(data),
|
|
225
|
+
}, key, {
|
|
226
|
+
iv: cryptojs.enc.Hex.parse("00000000000000000000000000000000"),
|
|
227
|
+
mode: cryptojs.mode.CBC,
|
|
228
|
+
padding: cryptojs.pad.Pkcs7,
|
|
229
|
+
}).toString(cryptojs.enc.Utf8);
|
|
230
|
+
}
|
|
231
|
+
catch (_a) {
|
|
232
|
+
return t < 3 ? decodeAES(secretKey, data, t + 1) : null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async function getDefaultHeaders(ctx, origin = "https://chat.zalo.me") {
|
|
236
|
+
if (!ctx.cookie)
|
|
237
|
+
throw new ZaloApiError.ZaloApiError("Cookie is not available");
|
|
238
|
+
if (!ctx.userAgent)
|
|
239
|
+
throw new ZaloApiError.ZaloApiError("User agent is not available");
|
|
240
|
+
return {
|
|
241
|
+
Accept: "application/json, text/plain, */*",
|
|
242
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
243
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
244
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
245
|
+
Cookie: await ctx.cookie.getCookieString(origin),
|
|
246
|
+
Origin: "https://chat.zalo.me",
|
|
247
|
+
Referer: "https://chat.zalo.me/",
|
|
248
|
+
"User-Agent": ctx.userAgent,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
async function request(ctx, url, options, raw = false) {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
if (!ctx.cookie)
|
|
254
|
+
ctx.cookie = new toughCookie.CookieJar();
|
|
255
|
+
const origin = new URL(url).origin;
|
|
256
|
+
const defaultHeaders = await getDefaultHeaders(ctx, origin);
|
|
257
|
+
if (!raw) {
|
|
258
|
+
if (options) {
|
|
259
|
+
options.headers = Object.assign(defaultHeaders, options.headers || {});
|
|
260
|
+
}
|
|
261
|
+
else
|
|
262
|
+
options = { headers: defaultHeaders };
|
|
263
|
+
}
|
|
264
|
+
const _options = Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), (isBun ? {
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
266
|
+
// @ts-ignore
|
|
267
|
+
proxy: (_b = (_a = ctx.options.agent) === null || _a === void 0 ? void 0 : _a.proxy) === null || _b === void 0 ? void 0 : _b.href
|
|
268
|
+
} : { agent: ctx.options.agent }));
|
|
269
|
+
const response = await ctx.options.polyfill(url, _options);
|
|
270
|
+
const setCookieRaw = response.headers.get("set-cookie");
|
|
271
|
+
if (setCookieRaw && !raw) {
|
|
272
|
+
// Use getSetCookie() (Node.js 18+) to properly parse multi-cookie headers.
|
|
273
|
+
// The split(", ") method breaks cookies containing Expires dates with commas
|
|
274
|
+
// (e.g., "Expires=Wed, 18 Mar 2026..."), causing critical cookies like
|
|
275
|
+
// zpsid and zpw_sek to be lost during QR login flow.
|
|
276
|
+
let cookieStrings;
|
|
277
|
+
if (typeof response.headers.getSetCookie === "function") {
|
|
278
|
+
cookieStrings = response.headers.getSetCookie();
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
cookieStrings = setCookieRaw.split(", ");
|
|
282
|
+
}
|
|
283
|
+
for (const cookie of cookieStrings) {
|
|
284
|
+
const parsed = toughCookie.Cookie.parse(cookie);
|
|
285
|
+
try {
|
|
286
|
+
if (parsed)
|
|
287
|
+
await ctx.cookie.setCookie(parsed, parsed.domain != "zalo.me" ? `https://${parsed.domain}` : origin);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
logger(ctx).error(error);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const redirectURL = response.headers.get("location");
|
|
295
|
+
if (redirectURL) {
|
|
296
|
+
const redirectOptions = Object.assign({}, options);
|
|
297
|
+
redirectOptions.method = "GET";
|
|
298
|
+
if (!raw) {
|
|
299
|
+
redirectOptions.headers = new Headers(redirectOptions.headers);
|
|
300
|
+
redirectOptions.headers.set("Referer", "https://id.zalo.me/");
|
|
301
|
+
}
|
|
302
|
+
return await request(ctx, redirectURL, redirectOptions);
|
|
303
|
+
}
|
|
304
|
+
return response;
|
|
305
|
+
}
|
|
306
|
+
async function getImageMetaData(ctx, filePath) {
|
|
307
|
+
if (!ctx.options.imageMetadataGetter) {
|
|
308
|
+
throw new ZaloApiMissingImageMetadataGetter.ZaloApiMissingImageMetadataGetter();
|
|
309
|
+
}
|
|
310
|
+
const imageData = await ctx.options.imageMetadataGetter(filePath);
|
|
311
|
+
if (!imageData) {
|
|
312
|
+
throw new ZaloApiError.ZaloApiError("Failed to get image metadata");
|
|
313
|
+
}
|
|
314
|
+
const fileName = filePath.split("/").pop();
|
|
315
|
+
return {
|
|
316
|
+
fileName,
|
|
317
|
+
totalSize: imageData.size,
|
|
318
|
+
width: imageData.width,
|
|
319
|
+
height: imageData.height,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async function getFileSize(filePath) {
|
|
323
|
+
return fs.promises.stat(filePath).then((s) => s.size);
|
|
324
|
+
}
|
|
325
|
+
async function getGifMetaData(ctx, filePath) {
|
|
326
|
+
if (!ctx.options.imageMetadataGetter) {
|
|
327
|
+
throw new ZaloApiMissingImageMetadataGetter.ZaloApiMissingImageMetadataGetter();
|
|
328
|
+
}
|
|
329
|
+
const gifData = await ctx.options.imageMetadataGetter(filePath);
|
|
330
|
+
if (!gifData) {
|
|
331
|
+
throw new ZaloApiError.ZaloApiError("Failed to get gif metadata");
|
|
332
|
+
}
|
|
333
|
+
const fileName = path.basename(filePath);
|
|
334
|
+
return {
|
|
335
|
+
fileName,
|
|
336
|
+
totalSize: gifData.size,
|
|
337
|
+
width: gifData.width,
|
|
338
|
+
height: gifData.height,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
async function decodeEventData(parsed, cipherKey) {
|
|
342
|
+
if (typeof parsed.data !== "string")
|
|
343
|
+
throw new ZaloApiError.ZaloApiError(`Invalid data, expected string but got ${typeof parsed.data}`);
|
|
344
|
+
if (typeof parsed.encrypt !== "number")
|
|
345
|
+
throw new ZaloApiError.ZaloApiError(`Invalid encrypt type, expected number but got ${typeof parsed.encrypt}`);
|
|
346
|
+
if (parsed.encrypt < 0 || parsed.encrypt > 3)
|
|
347
|
+
throw new ZaloApiError.ZaloApiError(`Invalid encrypt type, expected 0-3 but got ${parsed.encrypt}`);
|
|
348
|
+
const rawData = parsed.data;
|
|
349
|
+
const encryptType = parsed.encrypt;
|
|
350
|
+
if (encryptType === 0)
|
|
351
|
+
return JSON.parse(rawData);
|
|
352
|
+
const decodedBuffer = decodeBase64ToBuffer(encryptType === 1 ? rawData : decodeURIComponent(rawData));
|
|
353
|
+
let decryptedBuffer = decodedBuffer;
|
|
354
|
+
if (encryptType !== 1) {
|
|
355
|
+
if (cipherKey && decodedBuffer.length >= 48) {
|
|
356
|
+
const algorithm = {
|
|
357
|
+
name: "AES-GCM",
|
|
358
|
+
iv: decodedBuffer.subarray(0, 16),
|
|
359
|
+
tagLength: 128,
|
|
360
|
+
additionalData: decodedBuffer.subarray(16, 32),
|
|
361
|
+
};
|
|
362
|
+
const dataSource = decodedBuffer.subarray(32);
|
|
363
|
+
const cryptoKey = await crypto.subtle.importKey("raw", decodeBase64ToBuffer(cipherKey), algorithm, false, [
|
|
364
|
+
"decrypt",
|
|
365
|
+
]);
|
|
366
|
+
decryptedBuffer = await crypto.subtle.decrypt(algorithm, cryptoKey, dataSource);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
throw new ZaloApiError.ZaloApiError("Invalid data length or missing cipher key");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const decompressedBuffer = encryptType === 3 ? new Uint8Array(decryptedBuffer) : pako.inflate(decryptedBuffer);
|
|
373
|
+
const decodedData = decodeUnit8Array(decompressedBuffer);
|
|
374
|
+
if (!decodedData)
|
|
375
|
+
return;
|
|
376
|
+
return JSONBig.parse(decodedData);
|
|
377
|
+
}
|
|
378
|
+
async function getMd5LargeFileObject(source, fileSize) {
|
|
379
|
+
const buffer = typeof source == "string" ? await fs.promises.readFile(source) : source.data;
|
|
380
|
+
return new Promise((resolve) => {
|
|
381
|
+
let currentChunk = 0;
|
|
382
|
+
const chunkSize = 2097152, // Read in chunks of 2MB
|
|
383
|
+
chunks = Math.ceil(fileSize / chunkSize), spark = new SparkMD5.ArrayBuffer();
|
|
384
|
+
function loadNext() {
|
|
385
|
+
const start = currentChunk * chunkSize, end = start + chunkSize >= fileSize ? fileSize : start + chunkSize;
|
|
386
|
+
spark.append(new Uint8Array(buffer.subarray(start, end)).buffer);
|
|
387
|
+
currentChunk++;
|
|
388
|
+
if (currentChunk < chunks) {
|
|
389
|
+
loadNext();
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
resolve({
|
|
393
|
+
currentChunk,
|
|
394
|
+
data: spark.end(),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
loadNext();
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
const logger = (ctx) => ({
|
|
402
|
+
verbose: (...args) => {
|
|
403
|
+
if (ctx.options.logging)
|
|
404
|
+
console.log("\x1b[35m🚀 VERBOSE\x1b[0m", ...args);
|
|
405
|
+
},
|
|
406
|
+
info: (...args) => {
|
|
407
|
+
if (ctx.options.logging)
|
|
408
|
+
console.log("\x1b[34mINFO\x1b[0m", ...args);
|
|
409
|
+
},
|
|
410
|
+
warn: (...args) => {
|
|
411
|
+
if (ctx.options.logging)
|
|
412
|
+
console.log("\x1b[33mWARN\x1b[0m", ...args);
|
|
413
|
+
},
|
|
414
|
+
error: (...args) => {
|
|
415
|
+
if (ctx.options.logging)
|
|
416
|
+
console.log("\x1b[31mERROR\x1b[0m", ...args);
|
|
417
|
+
},
|
|
418
|
+
success: (...args) => {
|
|
419
|
+
if (ctx.options.logging)
|
|
420
|
+
console.log("\x1b[32mSUCCESS\x1b[0m", ...args);
|
|
421
|
+
},
|
|
422
|
+
timestamp: (...args) => {
|
|
423
|
+
const now = new Date().toISOString();
|
|
424
|
+
if (ctx.options.logging)
|
|
425
|
+
console.log(`\x1b[90m[${now}]\x1b[0m`, ...args);
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
function getClientMessageType(msgType) {
|
|
429
|
+
if (msgType === "webchat")
|
|
430
|
+
return 1;
|
|
431
|
+
if (msgType === "chat.voice")
|
|
432
|
+
return 31;
|
|
433
|
+
if (msgType === "chat.photo")
|
|
434
|
+
return 32;
|
|
435
|
+
if (msgType === "chat.sticker")
|
|
436
|
+
return 36;
|
|
437
|
+
if (msgType === "chat.doodle")
|
|
438
|
+
return 37;
|
|
439
|
+
if (msgType === "chat.recommended")
|
|
440
|
+
return 38;
|
|
441
|
+
if (msgType === "chat.link")
|
|
442
|
+
return 38; // don't know || if (msgType === "chat.link") return 1;
|
|
443
|
+
if (msgType === "chat.video.msg")
|
|
444
|
+
return 44; // not sure
|
|
445
|
+
if (msgType === "share.file")
|
|
446
|
+
return 46;
|
|
447
|
+
if (msgType === "chat.gif")
|
|
448
|
+
return 49;
|
|
449
|
+
if (msgType === "chat.location.new")
|
|
450
|
+
return 43;
|
|
451
|
+
return 1;
|
|
452
|
+
}
|
|
453
|
+
function strPadLeft(e, t, n) {
|
|
454
|
+
const a = (e = "" + e).length;
|
|
455
|
+
return a === n ? e : a > n ? e.slice(-n) : t.repeat(n - a) + e;
|
|
456
|
+
}
|
|
457
|
+
function formatTime(format, timestamp = Date.now()) {
|
|
458
|
+
const date = new Date(timestamp);
|
|
459
|
+
// using lib Intl
|
|
460
|
+
const options = {
|
|
461
|
+
year: "numeric",
|
|
462
|
+
month: "2-digit",
|
|
463
|
+
day: "2-digit",
|
|
464
|
+
hour: "2-digit",
|
|
465
|
+
minute: "2-digit",
|
|
466
|
+
second: "2-digit",
|
|
467
|
+
// hour12: false, // true or false is same <(")
|
|
468
|
+
};
|
|
469
|
+
const formatted = new Intl.DateTimeFormat("vi-VN", options).format(date);
|
|
470
|
+
if (format.includes("%H") || format.includes("%d")) {
|
|
471
|
+
return format
|
|
472
|
+
.replace("%H", date.getHours().toString().padStart(2, "0"))
|
|
473
|
+
.replace("%M", date.getMinutes().toString().padStart(2, "0"))
|
|
474
|
+
.replace("%S", date.getSeconds().toString().padStart(2, "0"))
|
|
475
|
+
.replace("%d", date.getDate().toString().padStart(2, "0"))
|
|
476
|
+
.replace("%m", (date.getMonth() + 1).toString().padStart(2, "0"))
|
|
477
|
+
.replace("%Y", date.getFullYear().toString());
|
|
478
|
+
}
|
|
479
|
+
return formatted;
|
|
480
|
+
}
|
|
481
|
+
function getFullTimeFromMillisecond(e) {
|
|
482
|
+
const t = new Date(e);
|
|
483
|
+
return (strPadLeft(t.getHours(), "0", 2) +
|
|
484
|
+
":" +
|
|
485
|
+
strPadLeft(t.getMinutes(), "0", 2) +
|
|
486
|
+
" " +
|
|
487
|
+
strPadLeft(t.getDate(), "0", 2) +
|
|
488
|
+
"/" +
|
|
489
|
+
strPadLeft(t.getMonth() + 1, "0", 2) +
|
|
490
|
+
"/" +
|
|
491
|
+
t.getFullYear());
|
|
492
|
+
}
|
|
493
|
+
function getFileExtension(e) {
|
|
494
|
+
return path.extname(e).slice(1);
|
|
495
|
+
}
|
|
496
|
+
function getFileName(e) {
|
|
497
|
+
return path.basename(e);
|
|
498
|
+
}
|
|
499
|
+
function removeUndefinedKeys(e) {
|
|
500
|
+
for (const t in e)
|
|
501
|
+
if (e[t] === undefined)
|
|
502
|
+
delete e[t];
|
|
503
|
+
return e;
|
|
504
|
+
}
|
|
505
|
+
function getGroupEventType(act) {
|
|
506
|
+
if (act == "join_request")
|
|
507
|
+
return GroupEvent.GroupEventType.JOIN_REQUEST;
|
|
508
|
+
if (act == "join")
|
|
509
|
+
return GroupEvent.GroupEventType.JOIN;
|
|
510
|
+
if (act == "leave")
|
|
511
|
+
return GroupEvent.GroupEventType.LEAVE;
|
|
512
|
+
if (act == "remove_member")
|
|
513
|
+
return GroupEvent.GroupEventType.REMOVE_MEMBER;
|
|
514
|
+
if (act == "block_member")
|
|
515
|
+
return GroupEvent.GroupEventType.BLOCK_MEMBER;
|
|
516
|
+
if (act == "update_setting")
|
|
517
|
+
return GroupEvent.GroupEventType.UPDATE_SETTING;
|
|
518
|
+
if (act == "update_avatar")
|
|
519
|
+
return GroupEvent.GroupEventType.UPDATE_AVATAR;
|
|
520
|
+
if (act == "update")
|
|
521
|
+
return GroupEvent.GroupEventType.UPDATE;
|
|
522
|
+
if (act == "new_link")
|
|
523
|
+
return GroupEvent.GroupEventType.NEW_LINK;
|
|
524
|
+
if (act == "add_admin")
|
|
525
|
+
return GroupEvent.GroupEventType.ADD_ADMIN;
|
|
526
|
+
if (act == "remove_admin")
|
|
527
|
+
return GroupEvent.GroupEventType.REMOVE_ADMIN;
|
|
528
|
+
if (act == "new_pin_topic")
|
|
529
|
+
return GroupEvent.GroupEventType.NEW_PIN_TOPIC;
|
|
530
|
+
if (act == "update_pin_topic")
|
|
531
|
+
return GroupEvent.GroupEventType.UPDATE_PIN_TOPIC;
|
|
532
|
+
if (act == "update_topic")
|
|
533
|
+
return GroupEvent.GroupEventType.UPDATE_TOPIC;
|
|
534
|
+
if (act == "update_board")
|
|
535
|
+
return GroupEvent.GroupEventType.UPDATE_BOARD;
|
|
536
|
+
if (act == "remove_board")
|
|
537
|
+
return GroupEvent.GroupEventType.REMOVE_BOARD;
|
|
538
|
+
if (act == "reorder_pin_topic")
|
|
539
|
+
return GroupEvent.GroupEventType.REORDER_PIN_TOPIC;
|
|
540
|
+
if (act == "unpin_topic")
|
|
541
|
+
return GroupEvent.GroupEventType.UNPIN_TOPIC;
|
|
542
|
+
if (act == "remove_topic")
|
|
543
|
+
return GroupEvent.GroupEventType.REMOVE_TOPIC;
|
|
544
|
+
if (act == "accept_remind")
|
|
545
|
+
return GroupEvent.GroupEventType.ACCEPT_REMIND;
|
|
546
|
+
if (act == "reject_remind")
|
|
547
|
+
return GroupEvent.GroupEventType.REJECT_REMIND;
|
|
548
|
+
if (act == "remind_topic")
|
|
549
|
+
return GroupEvent.GroupEventType.REMIND_TOPIC;
|
|
550
|
+
return GroupEvent.GroupEventType.UNKNOWN;
|
|
551
|
+
}
|
|
552
|
+
function getFriendEventType(act) {
|
|
553
|
+
if (act == "add")
|
|
554
|
+
return FriendEvent.FriendEventType.ADD;
|
|
555
|
+
if (act == "remove")
|
|
556
|
+
return FriendEvent.FriendEventType.REMOVE;
|
|
557
|
+
if (act == "block")
|
|
558
|
+
return FriendEvent.FriendEventType.BLOCK;
|
|
559
|
+
if (act == "unblock")
|
|
560
|
+
return FriendEvent.FriendEventType.UNBLOCK;
|
|
561
|
+
if (act == "block_call")
|
|
562
|
+
return FriendEvent.FriendEventType.BLOCK_CALL;
|
|
563
|
+
if (act == "unblock_call")
|
|
564
|
+
return FriendEvent.FriendEventType.UNBLOCK_CALL;
|
|
565
|
+
if (act == "req_v2")
|
|
566
|
+
return FriendEvent.FriendEventType.REQUEST;
|
|
567
|
+
if (act == "reject")
|
|
568
|
+
return FriendEvent.FriendEventType.REJECT_REQUEST;
|
|
569
|
+
if (act == "undo_req")
|
|
570
|
+
return FriendEvent.FriendEventType.UNDO_REQUEST;
|
|
571
|
+
if (act == "seen_fr_req")
|
|
572
|
+
return FriendEvent.FriendEventType.SEEN_FRIEND_REQUEST;
|
|
573
|
+
if (act == "pin_unpin")
|
|
574
|
+
return FriendEvent.FriendEventType.PIN_UNPIN;
|
|
575
|
+
if (act == "pin_create")
|
|
576
|
+
return FriendEvent.FriendEventType.PIN_CREATE;
|
|
577
|
+
return FriendEvent.FriendEventType.UNKNOWN;
|
|
578
|
+
}
|
|
579
|
+
async function handleZaloResponse(ctx, response, isEncrypted = true) {
|
|
580
|
+
const result = {
|
|
581
|
+
data: null,
|
|
582
|
+
error: null,
|
|
583
|
+
};
|
|
584
|
+
if (!response.ok) {
|
|
585
|
+
result.error = {
|
|
586
|
+
message: "Request failed with status code " + response.status,
|
|
587
|
+
};
|
|
588
|
+
return result;
|
|
589
|
+
}
|
|
590
|
+
try {
|
|
591
|
+
const jsonData = await response.json();
|
|
592
|
+
if (jsonData.error_code != 0) {
|
|
593
|
+
result.error = {
|
|
594
|
+
message: jsonData.error_message,
|
|
595
|
+
code: jsonData.error_code,
|
|
596
|
+
};
|
|
597
|
+
return result;
|
|
598
|
+
}
|
|
599
|
+
const decodedData = isEncrypted ? JSON.parse(decodeAES(ctx.secretKey, jsonData.data)) : jsonData;
|
|
600
|
+
if (decodedData.error_code != 0) {
|
|
601
|
+
result.error = {
|
|
602
|
+
message: decodedData.error_message,
|
|
603
|
+
code: decodedData.error_code,
|
|
604
|
+
};
|
|
605
|
+
return result;
|
|
606
|
+
}
|
|
607
|
+
result.data = decodedData.data;
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
logger(ctx).error("Failed to parse response data:", error);
|
|
611
|
+
result.error = {
|
|
612
|
+
message: "Failed to parse response data",
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
return result;
|
|
616
|
+
}
|
|
617
|
+
async function resolveResponse(ctx, res, cb, isEncrypted) {
|
|
618
|
+
const result = await handleZaloResponse(ctx, res, isEncrypted);
|
|
619
|
+
if (result.error)
|
|
620
|
+
throw new ZaloApiError.ZaloApiError(result.error.message, result.error.code);
|
|
621
|
+
if (cb)
|
|
622
|
+
return cb(result);
|
|
623
|
+
return result.data;
|
|
624
|
+
}
|
|
625
|
+
function apiFactory() {
|
|
626
|
+
return (callback) => {
|
|
627
|
+
return (ctx, api) => {
|
|
628
|
+
if (!context.isContextSession(ctx))
|
|
629
|
+
throw new ZaloApiError.ZaloApiError("Invalid context " + JSON.stringify(ctx, null, 2));
|
|
630
|
+
const utils = {
|
|
631
|
+
makeURL(baseURL, params, apiVersion) {
|
|
632
|
+
return makeURL(ctx, baseURL, params, apiVersion);
|
|
633
|
+
},
|
|
634
|
+
encodeAES(data, t) {
|
|
635
|
+
return encodeAES(ctx.secretKey, data, t);
|
|
636
|
+
},
|
|
637
|
+
request(url, options, raw) {
|
|
638
|
+
return request(ctx, url, options, raw);
|
|
639
|
+
},
|
|
640
|
+
logger: logger(ctx),
|
|
641
|
+
resolve: (res, cb, isEncrypted) => resolveResponse(ctx, res, cb, isEncrypted),
|
|
642
|
+
};
|
|
643
|
+
return callback(api, ctx, utils);
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function generateZaloUUID(userAgent) {
|
|
648
|
+
return crypto.randomUUID() + "-" + cryptojs.MD5(userAgent).toString();
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Encrypts a 4-digit PIN to a 32-character hex string
|
|
652
|
+
* @param pin 4-digit PIN number
|
|
653
|
+
* @returns 32-character hex string
|
|
654
|
+
*/
|
|
655
|
+
function encryptPin(pin) {
|
|
656
|
+
return crypto.createHash("md5").update(pin).digest("hex");
|
|
657
|
+
}
|
|
658
|
+
function normalizeHolderName(input) {
|
|
659
|
+
if (!input)
|
|
660
|
+
return undefined;
|
|
661
|
+
const normalized = input
|
|
662
|
+
.normalize("NFD")
|
|
663
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
664
|
+
.replace(/[đĐ]/g, "d")
|
|
665
|
+
.toUpperCase()
|
|
666
|
+
.replace(/[^A-Z0-9]+/g, " ")
|
|
667
|
+
.trim();
|
|
668
|
+
return normalized.length >= 5 ? normalized : undefined;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
exports.ParamsEncryptor = ParamsEncryptor;
|
|
672
|
+
exports.apiFactory = apiFactory;
|
|
673
|
+
exports.decodeAES = decodeAES;
|
|
674
|
+
exports.decodeBase64ToBuffer = decodeBase64ToBuffer;
|
|
675
|
+
exports.decodeEventData = decodeEventData;
|
|
676
|
+
exports.decodeUnit8Array = decodeUnit8Array;
|
|
677
|
+
exports.decryptResp = decryptResp;
|
|
678
|
+
exports.encodeAES = encodeAES;
|
|
679
|
+
exports.encryptPin = encryptPin;
|
|
680
|
+
exports.formatTime = formatTime;
|
|
681
|
+
exports.generateZaloUUID = generateZaloUUID;
|
|
682
|
+
exports.getClientMessageType = getClientMessageType;
|
|
683
|
+
exports.getDefaultHeaders = getDefaultHeaders;
|
|
684
|
+
exports.getFileExtension = getFileExtension;
|
|
685
|
+
exports.getFileName = getFileName;
|
|
686
|
+
exports.getFileSize = getFileSize;
|
|
687
|
+
exports.getFriendEventType = getFriendEventType;
|
|
688
|
+
exports.getFullTimeFromMillisecond = getFullTimeFromMillisecond;
|
|
689
|
+
exports.getGifMetaData = getGifMetaData;
|
|
690
|
+
exports.getGroupEventType = getGroupEventType;
|
|
691
|
+
exports.getImageMetaData = getImageMetaData;
|
|
692
|
+
exports.getMd5LargeFileObject = getMd5LargeFileObject;
|
|
693
|
+
exports.getSignKey = getSignKey;
|
|
694
|
+
exports.handleZaloResponse = handleZaloResponse;
|
|
695
|
+
exports.hasOwn = hasOwn;
|
|
696
|
+
exports.isBun = isBun;
|
|
697
|
+
exports.logger = logger;
|
|
698
|
+
exports.makeURL = makeURL;
|
|
699
|
+
exports.normalizeHolderName = normalizeHolderName;
|
|
700
|
+
exports.removeUndefinedKeys = removeUndefinedKeys;
|
|
701
|
+
exports.request = request;
|
|
702
|
+
exports.resolveResponse = resolveResponse;
|
|
703
|
+
exports.strPadLeft = strPadLeft;
|