@another-trial/whatsapp-web.js 1.34.1 → 1.34.5-alpha.3

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 (56) hide show
  1. package/.env.example +2 -2
  2. package/CODE_OF_CONDUCT.md +133 -133
  3. package/LICENSE +201 -201
  4. package/README.md +155 -185
  5. package/example.js +706 -690
  6. package/index.d.ts +2259 -2202
  7. package/index.js +35 -35
  8. package/package.json +59 -59
  9. package/shell.js +36 -36
  10. package/src/Client.js +2533 -2361
  11. package/src/authStrategies/BaseAuthStrategy.js +26 -26
  12. package/src/authStrategies/LocalAuth.js +58 -58
  13. package/src/authStrategies/NoAuth.js +11 -11
  14. package/src/authStrategies/RemoteAuth.js +210 -210
  15. package/src/factories/ChatFactory.js +21 -21
  16. package/src/factories/ContactFactory.js +15 -15
  17. package/src/structures/Base.js +21 -21
  18. package/src/structures/Broadcast.js +69 -69
  19. package/src/structures/BusinessContact.js +20 -20
  20. package/src/structures/Buttons.js +81 -81
  21. package/src/structures/Call.js +75 -75
  22. package/src/structures/Channel.js +382 -382
  23. package/src/structures/Chat.js +329 -299
  24. package/src/structures/ClientInfo.js +70 -70
  25. package/src/structures/Contact.js +215 -208
  26. package/src/structures/GroupChat.js +485 -485
  27. package/src/structures/GroupNotification.js +104 -104
  28. package/src/structures/Label.js +49 -49
  29. package/src/structures/List.js +79 -79
  30. package/src/structures/Location.js +61 -61
  31. package/src/structures/Message.js +787 -747
  32. package/src/structures/MessageMedia.js +111 -111
  33. package/src/structures/Order.js +51 -51
  34. package/src/structures/Payment.js +79 -79
  35. package/src/structures/Poll.js +44 -44
  36. package/src/structures/PollVote.js +75 -75
  37. package/src/structures/PrivateChat.js +12 -12
  38. package/src/structures/PrivateContact.js +12 -12
  39. package/src/structures/Product.js +67 -67
  40. package/src/structures/ProductMetadata.js +24 -24
  41. package/src/structures/Reaction.js +68 -68
  42. package/src/structures/ScheduledEvent.js +71 -71
  43. package/src/structures/index.js +27 -27
  44. package/src/util/Constants.js +186 -183
  45. package/src/util/Injected/AuthStore/AuthStore.js +16 -16
  46. package/src/util/Injected/AuthStore/LegacyAuthStore.js +21 -21
  47. package/src/util/Injected/LegacyStore.js +145 -145
  48. package/src/util/Injected/Store.js +263 -233
  49. package/src/util/Injected/Utils.js +1221 -1169
  50. package/src/util/InterfaceController.js +126 -126
  51. package/src/util/Puppeteer.js +23 -23
  52. package/src/util/Util.js +186 -186
  53. package/src/webCache/LocalWebCache.js +40 -40
  54. package/src/webCache/RemoteWebCache.js +39 -39
  55. package/src/webCache/WebCache.js +13 -13
  56. package/src/webCache/WebCacheFactory.js +19 -19
@@ -1,233 +1,263 @@
1
- 'use strict';
2
-
3
- exports.ExposeStore = () => {
4
- /**
5
- * Helper function that compares between two WWeb versions. Its purpose is to help the developer to choose the correct code implementation depending on the comparison value and the WWeb version.
6
- * @param {string} lOperand The left operand for the WWeb version string to compare with
7
- * @param {string} operator The comparison operator
8
- * @param {string} rOperand The right operand for the WWeb version string to compare with
9
- * @returns {boolean} Boolean value that indicates the result of the comparison
10
- */
11
- window.compareWwebVersions = (lOperand, operator, rOperand) => {
12
- if (!['>', '>=', '<', '<=', '='].includes(operator)) {
13
- throw new class _ extends Error {
14
- constructor(m) { super(m); this.name = 'CompareWwebVersionsError'; }
15
- }('Invalid comparison operator is provided');
16
-
17
- }
18
- if (typeof lOperand !== 'string' || typeof rOperand !== 'string') {
19
- throw new class _ extends Error {
20
- constructor(m) { super(m); this.name = 'CompareWwebVersionsError'; }
21
- }('A non-string WWeb version type is provided');
22
- }
23
-
24
- lOperand = lOperand.replace(/-beta$/, '');
25
- rOperand = rOperand.replace(/-beta$/, '');
26
-
27
- while (lOperand.length !== rOperand.length) {
28
- lOperand.length > rOperand.length
29
- ? rOperand = rOperand.concat('0')
30
- : lOperand = lOperand.concat('0');
31
- }
32
-
33
- lOperand = Number(lOperand.replace(/\./g, ''));
34
- rOperand = Number(rOperand.replace(/\./g, ''));
35
-
36
- return (
37
- operator === '>' ? lOperand > rOperand :
38
- operator === '>=' ? lOperand >= rOperand :
39
- operator === '<' ? lOperand < rOperand :
40
- operator === '<=' ? lOperand <= rOperand :
41
- operator === '=' ? lOperand === rOperand :
42
- false
43
- );
44
- };
45
-
46
- window.Store = Object.assign({}, window.require('WAWebCollections'));
47
- window.Store.AppState = window.require('WAWebSocketModel').Socket;
48
- window.Store.BlockContact = window.require('WAWebBlockContactAction');
49
- window.Store.Conn = window.require('WAWebConnModel').Conn;
50
- window.Store.Cmd = window.require('WAWebCmd').Cmd;
51
- window.Store.DownloadManager = window.require('WAWebDownloadManager').downloadManager;
52
- window.Store.GroupQueryAndUpdate = window.require('WAWebGroupQueryJob').queryAndUpdateGroupMetadataById;
53
- window.Store.MediaPrep = window.require('WAWebPrepRawMedia');
54
- window.Store.MediaObject = window.require('WAWebMediaStorage');
55
- window.Store.MediaTypes = window.require('WAWebMmsMediaTypes');
56
- window.Store.MediaUpload = window.require('WAWebMediaMmsV4Upload');
57
- window.Store.MsgKey = window.require('WAWebMsgKey');
58
- window.Store.OpaqueData = window.require('WAWebMediaOpaqueData');
59
- window.Store.QueryProduct = window.require('WAWebBizProductCatalogBridge');
60
- window.Store.QueryOrder = window.require('WAWebBizOrderBridge');
61
- window.Store.SendClear = window.require('WAWebChatClearBridge');
62
- window.Store.SendDelete = window.require('WAWebDeleteChatAction');
63
- window.Store.SendMessage = window.require('WAWebSendMsgChatAction');
64
- window.Store.EditMessage = window.require('WAWebSendMessageEditAction');
65
- window.Store.SendSeen = window.require('WAWebUpdateUnreadChatAction');
66
- window.Store.User = window.require('WAWebUserPrefsMeUser');
67
- window.Store.ContactMethods = window.require('WAWebContactGetters');
68
- window.Store.UserConstructor = window.require('WAWebWid');
69
- window.Store.Validators = window.require('WALinkify');
70
- window.Store.WidFactory = window.require('WAWebWidFactory');
71
- window.Store.ProfilePic = window.require('WAWebContactProfilePicThumbBridge');
72
- window.Store.PresenceUtils = window.require('WAWebPresenceChatAction');
73
- window.Store.ChatState = window.require('WAWebChatStateBridge');
74
- window.Store.findCommonGroups = window.require('WAWebFindCommonGroupsContactAction').findCommonGroups;
75
- window.Store.StatusUtils = window.require('WAWebContactStatusBridge');
76
- window.Store.ConversationMsgs = window.require('WAWebChatLoadMessages');
77
- window.Store.sendReactionToMsg = window.require('WAWebSendReactionMsgAction').sendReactionToMsg;
78
- window.Store.createOrUpdateReactionsModule = window.require('WAWebDBCreateOrUpdateReactions');
79
- window.Store.EphemeralFields = window.require('WAWebGetEphemeralFieldsMsgActionsUtils');
80
- window.Store.MsgActionChecks = window.require('WAWebMsgActionCapability');
81
- window.Store.QuotedMsg = window.require('WAWebQuotedMsgModelUtils');
82
- window.Store.LinkPreview = window.require('WAWebLinkPreviewChatAction');
83
- window.Store.Socket = window.require('WADeprecatedSendIq');
84
- window.Store.SocketWap = window.require('WAWap');
85
- window.Store.SearchContext = window.require('WAWebChatMessageSearch');
86
- window.Store.DrawerManager = window.require('WAWebDrawerManager').DrawerManager;
87
- window.Store.LidUtils = window.require('WAWebApiContact');
88
- window.Store.WidToJid = window.require('WAWebWidToJid');
89
- window.Store.JidToWid = window.require('WAWebJidToWid');
90
- window.Store.getMsgInfo = window.require('WAWebApiMessageInfoStore').queryMsgInfo;
91
- window.Store.QueryExist = window.require('WAWebQueryExistsJob').queryWidExists;
92
- window.Store.ReplyUtils = window.require('WAWebMsgReply');
93
- window.Store.BotSecret = window.require('WAWebBotMessageSecret');
94
- window.Store.BotProfiles = window.require('WAWebBotProfileCollection');
95
- window.Store.ContactCollection = window.require('WAWebContactCollection').ContactCollection;
96
- window.Store.DeviceList = window.require('WAWebApiDeviceList');
97
- window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest');
98
- window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode;
99
- window.Store.AddonPollVoteTable = window.require('WAWebAddonPollVoteTableMode').pollVoteTableMode;
100
- window.Store.PinnedMsgUtils = window.require('WAWebPinInChatSchema');
101
- window.Store.ChatGetters = window.require('WAWebChatGetters');
102
- window.Store.PinnedMsgUtils = window.require('WAWebSendPinMessageAction');
103
- window.Store.UploadUtils = window.require('WAWebUploadManager');
104
- window.Store.WAWebStreamModel = window.require('WAWebStreamModel');
105
- window.Store.FindOrCreateChat = window.require('WAWebFindChatAction');
106
-
107
- window.Store.Settings = {
108
- ...window.require('WAWebUserPrefsGeneral'),
109
- ...window.require('WAWebUserPrefsNotifications'),
110
- setPushname: window.require('WAWebSetPushnameConnAction').setPushname
111
- };
112
- window.Store.NumberInfo = {
113
- ...window.require('WAPhoneUtils'),
114
- ...window.require('WAPhoneFindCC')
115
- };
116
- window.Store.ForwardUtils = {
117
- ...window.require('WAWebChatForwardMessage')
118
- };
119
- window.Store.ScheduledEventMsgUtils = {
120
- ...window.require('WAWebGenerateEventCallLink'),
121
- ...window.require('WAWebSendEventEditMsgAction'),
122
- ...window.require('WAWebSendEventResponseMsgAction')
123
- };
124
- window.Store.VCard = {
125
- ...window.require('WAWebFrontendVcardUtils'),
126
- ...window.require('WAWebVcardParsingUtils'),
127
- ...window.require('WAWebVcardGetNameFromParsed')
128
- };
129
- window.Store.StickerTools = {
130
- ...window.require('WAWebImageUtils'),
131
- ...window.require('WAWebAddWebpMetadata')
132
- };
133
- window.Store.GroupUtils = {
134
- ...window.require('WAWebGroupCreateJob'),
135
- ...window.require('WAWebGroupModifyInfoJob'),
136
- ...window.require('WAWebExitGroupAction'),
137
- ...window.require('WAWebContactProfilePicThumbBridge')
138
- };
139
- window.Store.GroupParticipants = {
140
- ...window.require('WAWebModifyParticipantsGroupAction'),
141
- ...window.require('WASmaxGroupsAddParticipantsRPC')
142
- };
143
- window.Store.GroupInvite = {
144
- ...window.require('WAWebGroupInviteJob'),
145
- ...window.require('WAWebGroupQueryJob'),
146
- ...window.require('WAWebMexFetchGroupInviteCodeJob')
147
- };
148
- window.Store.GroupInviteV4 = {
149
- ...window.require('WAWebGroupInviteV4Job'),
150
- ...window.require('WAWebChatSendMessages')
151
- };
152
- window.Store.MembershipRequestUtils = {
153
- ...window.require('WAWebApiMembershipApprovalRequestStore'),
154
- ...window.require('WASmaxGroupsMembershipRequestsActionRPC')
155
- };
156
- window.Store.ChannelUtils = {
157
- ...window.require('WAWebLoadNewsletterPreviewChatAction'),
158
- ...window.require('WAWebNewsletterMetadataQueryJob'),
159
- ...window.require('WAWebNewsletterCreateQueryJob'),
160
- ...window.require('WAWebEditNewsletterMetadataAction'),
161
- ...window.require('WAWebNewsletterDeleteAction'),
162
- ...window.require('WAWebNewsletterSubscribeAction'),
163
- ...window.require('WAWebNewsletterUnsubscribeAction'),
164
- ...window.require('WAWebNewsletterDirectorySearchAction'),
165
- ...window.require('WAWebNewsletterToggleMuteStateJob'),
166
- ...window.require('WAWebNewsletterGatingUtils'),
167
- ...window.require('WAWebNewsletterModelUtils'),
168
- ...window.require('WAWebMexAcceptNewsletterAdminInviteJob'),
169
- ...window.require('WAWebMexRevokeNewsletterAdminInviteJob'),
170
- ...window.require('WAWebChangeNewsletterOwnerAction'),
171
- ...window.require('WAWebDemoteNewsletterAdminAction'),
172
- ...window.require('WAWebNewsletterDemoteAdminJob'),
173
- countryCodesIso: window.require('WAWebCountriesNativeCountryNames'),
174
- currentRegion: window.require('WAWebL10N').getRegion(),
175
- };
176
- window.Store.SendChannelMessage = {
177
- ...window.require('WAWebNewsletterUpdateMsgsRecordsJob'),
178
- ...window.require('WAWebMsgDataFromModel'),
179
- ...window.require('WAWebNewsletterSendMessageJob'),
180
- ...window.require('WAWebNewsletterSendMsgAction'),
181
- ...window.require('WAMediaCalculateFilehash')
182
- };
183
- window.Store.ChannelSubscribers = {
184
- ...window.require('WAWebMexFetchNewsletterSubscribersJob'),
185
- ...window.require('WAWebNewsletterSubscriberListAction')
186
- };
187
- window.Store.AddressbookContactUtils = {
188
- ...window.require('WAWebSaveContactAction'),
189
- ...window.require('WAWebDeleteContactAction')
190
- };
191
-
192
- if (!window.Store.Chat._find || !window.Store.Chat.findImpl) {
193
- window.Store.Chat._find = e => {
194
- const target = window.Store.Chat.get(e);
195
- return target ? Promise.resolve(target) : Promise.resolve({
196
- id: e
197
- });
198
- };
199
- window.Store.Chat.findImpl = window.Store.Chat._find;
200
- }
201
-
202
- /**
203
- * Target options object description
204
- * @typedef {Object} TargetOptions
205
- * @property {string|number} module The target module
206
- * @property {string} function The function name to get from a module
207
- */
208
- /**
209
- * Function to modify functions
210
- * @param {TargetOptions} target Options specifying the target function to search for modifying
211
- * @param {Function} callback Modified function
212
- */
213
- window.injectToFunction = (target, callback) => {
214
- let module = window.require(target.module);
215
-
216
- if (!module) return;
217
-
218
- const path = target.function.split('.');
219
- const funcName = path.pop();
220
- for (const key of path) {
221
- module = module[key];
222
- }
223
-
224
- const originalFunction = module[funcName];
225
- module[funcName] = (...args) => callback(originalFunction, ...args);
226
- };
227
-
228
- window.injectToFunction({ module: 'WAWebBackendJobsCommon', function: 'mediaTypeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage ? null : func(...args); });
229
-
230
- window.injectToFunction({ module: 'WAWebE2EProtoUtils', function: 'typeAttributeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage || proto.groupInviteMessage ? 'text' : func(...args); });
231
-
232
- window.injectToFunction({ module: 'WAWebLid1X1MigrationGating', function: 'Lid1X1MigrationUtils.isLidMigrated' }, () => false);
233
- };
1
+ 'use strict';
2
+
3
+ exports.ExposeStore = () => {
4
+ /**
5
+ * Helper function that compares between two WWeb versions. Its purpose is to help the developer to choose the correct code implementation depending on the comparison value and the WWeb version.
6
+ * @param {string} lOperand The left operand for the WWeb version string to compare with
7
+ * @param {string} operator The comparison operator
8
+ * @param {string} rOperand The right operand for the WWeb version string to compare with
9
+ * @returns {boolean} Boolean value that indicates the result of the comparison
10
+ */
11
+ window.compareWwebVersions = (lOperand, operator, rOperand) => {
12
+ if (!['>', '>=', '<', '<=', '='].includes(operator)) {
13
+ throw new class _ extends Error {
14
+ constructor(m) { super(m); this.name = 'CompareWwebVersionsError'; }
15
+ }('Invalid comparison operator is provided');
16
+
17
+ }
18
+ if (typeof lOperand !== 'string' || typeof rOperand !== 'string') {
19
+ throw new class _ extends Error {
20
+ constructor(m) { super(m); this.name = 'CompareWwebVersionsError'; }
21
+ }('A non-string WWeb version type is provided');
22
+ }
23
+
24
+ lOperand = lOperand.replace(/-beta$/, '');
25
+ rOperand = rOperand.replace(/-beta$/, '');
26
+
27
+ while (lOperand.length !== rOperand.length) {
28
+ lOperand.length > rOperand.length
29
+ ? rOperand = rOperand.concat('0')
30
+ : lOperand = lOperand.concat('0');
31
+ }
32
+
33
+ lOperand = Number(lOperand.replace(/\./g, ''));
34
+ rOperand = Number(rOperand.replace(/\./g, ''));
35
+
36
+ return (
37
+ operator === '>' ? lOperand > rOperand :
38
+ operator === '>=' ? lOperand >= rOperand :
39
+ operator === '<' ? lOperand < rOperand :
40
+ operator === '<=' ? lOperand <= rOperand :
41
+ operator === '=' ? lOperand === rOperand :
42
+ false
43
+ );
44
+ };
45
+
46
+ window.Store = Object.assign({}, window.require('WAWebCollections'));
47
+ window.Store.AppState = window.require('WAWebSocketModel').Socket;
48
+ window.Store.BlockContact = window.require('WAWebBlockContactAction');
49
+ window.Store.Conn = window.require('WAWebConnModel').Conn;
50
+ window.Store.Cmd = window.require('WAWebCmd').Cmd;
51
+ window.Store.DownloadManager = window.require('WAWebDownloadManager').downloadManager;
52
+ window.Store.GroupQueryAndUpdate = window.require('WAWebGroupQueryJob').queryAndUpdateGroupMetadataById;
53
+ window.Store.MediaPrep = window.require('WAWebPrepRawMedia');
54
+ window.Store.MediaObject = window.require('WAWebMediaStorage');
55
+ window.Store.MediaTypes = window.require('WAWebMmsMediaTypes');
56
+ window.Store.MediaUpload = window.require('WAWebMediaMmsV4Upload');
57
+ window.Store.MediaUpdate = window.require('WAWebMediaUpdateMsg');
58
+ window.Store.MsgKey = window.require('WAWebMsgKey');
59
+ window.Store.OpaqueData = window.require('WAWebMediaOpaqueData');
60
+ window.Store.QueryProduct = window.require('WAWebBizProductCatalogBridge');
61
+ window.Store.QueryOrder = window.require('WAWebBizOrderBridge');
62
+ window.Store.SendClear = window.require('WAWebChatClearBridge');
63
+ window.Store.SendDelete = window.require('WAWebDeleteChatAction');
64
+ window.Store.SendMessage = window.require('WAWebSendMsgChatAction');
65
+ window.Store.EditMessage = window.require('WAWebSendMessageEditAction');
66
+ window.Store.MediaDataUtils = window.require('WAWebMediaDataUtils');
67
+ window.Store.BlobCache = window.require('WAWebMediaInMemoryBlobCache');
68
+ window.Store.SendSeen = window.require('WAWebUpdateUnreadChatAction');
69
+ window.Store.User = window.require('WAWebUserPrefsMeUser');
70
+ window.Store.ContactMethods = {
71
+ ...window.require('WAWebContactGetters'),
72
+ ...window.require('WAWebFrontendContactGetters')
73
+ };
74
+ window.Store.UserConstructor = window.require('WAWebWid');
75
+ window.Store.Validators = window.require('WALinkify');
76
+ window.Store.WidFactory = window.require('WAWebWidFactory');
77
+ window.Store.ProfilePic = window.require('WAWebContactProfilePicThumbBridge');
78
+ window.Store.PresenceUtils = window.require('WAWebPresenceChatAction');
79
+ window.Store.ChatState = window.require('WAWebChatStateBridge');
80
+ window.Store.findCommonGroups = window.require('WAWebFindCommonGroupsContactAction').findCommonGroups;
81
+ window.Store.ConversationMsgs = window.require('WAWebChatLoadMessages');
82
+ window.Store.sendReactionToMsg = window.require('WAWebSendReactionMsgAction').sendReactionToMsg;
83
+ window.Store.createOrUpdateReactionsModule = window.require('WAWebDBCreateOrUpdateReactions');
84
+ window.Store.EphemeralFields = window.require('WAWebGetEphemeralFieldsMsgActionsUtils');
85
+ window.Store.MsgActionChecks = window.require('WAWebMsgActionCapability');
86
+ window.Store.QuotedMsg = window.require('WAWebQuotedMsgModelUtils');
87
+ window.Store.LinkPreview = window.require('WAWebLinkPreviewChatAction');
88
+ window.Store.Socket = window.require('WADeprecatedSendIq');
89
+ window.Store.SocketWap = window.require('WAWap');
90
+ window.Store.SearchContext = window.require('WAWebChatMessageSearch');
91
+ window.Store.DrawerManager = window.require('WAWebDrawerManager').DrawerManager;
92
+ window.Store.LidUtils = window.require('WAWebApiContact');
93
+ window.Store.WidToJid = window.require('WAWebWidToJid');
94
+ window.Store.JidToWid = window.require('WAWebJidToWid');
95
+ window.Store.getMsgInfo = window.require('WAWebApiMessageInfoStore').queryMsgInfo;
96
+ window.Store.QueryExist = window.require('WAWebQueryExistsJob').queryWidExists;
97
+ window.Store.ReplyUtils = window.require('WAWebMsgReply');
98
+ window.Store.BotSecret = window.require('WAWebBotMessageSecret');
99
+ window.Store.BotProfiles = window.require('WAWebBotProfileCollection');
100
+ window.Store.ContactCollection = window.require('WAWebContactCollection').ContactCollection;
101
+ window.Store.DeviceList = window.require('WAWebApiDeviceList');
102
+ window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest');
103
+ window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode;
104
+ window.Store.AddonPollVoteTable = window.require('WAWebAddonPollVoteTableMode').pollVoteTableMode;
105
+ window.Store.ChatGetters = window.require('WAWebChatGetters');
106
+ window.Store.UploadUtils = window.require('WAWebUploadManager');
107
+ window.Store.WAWebStreamModel = window.require('WAWebStreamModel');
108
+ window.Store.FindOrCreateChat = window.require('WAWebFindChatAction');
109
+ window.Store.CustomerNoteUtils = window.require('WAWebNoteAction');
110
+ window.Store.BusinessGatingUtils = window.require('WAWebBizGatingUtils');
111
+ window.Store.PollsVotesSchema = window.require('WAWebPollsVotesSchema');
112
+ window.Store.PollsSendVote = window.require('WAWebPollsSendVoteMsgAction');
113
+
114
+ window.Store.Settings = {
115
+ ...window.require('WAWebUserPrefsGeneral'),
116
+ ...window.require('WAWebUserPrefsNotifications'),
117
+ setPushname: window.require('WAWebSetPushnameConnAction').setPushname
118
+ };
119
+ window.Store.NumberInfo = {
120
+ ...window.require('WAPhoneUtils'),
121
+ ...window.require('WAPhoneFindCC')
122
+ };
123
+ window.Store.ForwardUtils = {
124
+ ...window.require('WAWebChatForwardMessage')
125
+ };
126
+ window.Store.PinnedMsgUtils = {
127
+ ...window.require('WAWebPinInChatSchema'),
128
+ ...window.require('WAWebSendPinMessageAction')
129
+ };
130
+ window.Store.ScheduledEventMsgUtils = {
131
+ ...window.require('WAWebGenerateEventCallLink'),
132
+ ...window.require('WAWebSendEventEditMsgAction'),
133
+ ...window.require('WAWebSendEventResponseMsgAction')
134
+ };
135
+ window.Store.VCard = {
136
+ ...window.require('WAWebFrontendVcardUtils'),
137
+ ...window.require('WAWebVcardParsingUtils'),
138
+ ...window.require('WAWebVcardGetNameFromParsed')
139
+ };
140
+ window.Store.StickerTools = {
141
+ ...window.require('WAWebImageUtils'),
142
+ ...window.require('WAWebAddWebpMetadata')
143
+ };
144
+ window.Store.GroupUtils = {
145
+ ...window.require('WAWebGroupCreateJob'),
146
+ ...window.require('WAWebGroupModifyInfoJob'),
147
+ ...window.require('WAWebExitGroupAction'),
148
+ ...window.require('WAWebContactProfilePicThumbBridge'),
149
+ ...window.require('WAWebSetPropertyGroupAction')
150
+ };
151
+ window.Store.GroupParticipants = {
152
+ ...window.require('WAWebModifyParticipantsGroupAction'),
153
+ ...window.require('WASmaxGroupsAddParticipantsRPC')
154
+ };
155
+ window.Store.GroupInvite = {
156
+ ...window.require('WAWebGroupInviteJob'),
157
+ ...window.require('WAWebGroupQueryJob'),
158
+ ...window.require('WAWebMexFetchGroupInviteCodeJob')
159
+ };
160
+ window.Store.GroupInviteV4 = {
161
+ ...window.require('WAWebGroupInviteV4Job'),
162
+ ...window.require('WAWebChatSendMessages')
163
+ };
164
+ window.Store.MembershipRequestUtils = {
165
+ ...window.require('WAWebApiMembershipApprovalRequestStore'),
166
+ ...window.require('WASmaxGroupsMembershipRequestsActionRPC')
167
+ };
168
+ window.Store.ChannelUtils = {
169
+ ...window.require('WAWebLoadNewsletterPreviewChatAction'),
170
+ ...window.require('WAWebNewsletterMetadataQueryJob'),
171
+ ...window.require('WAWebNewsletterCreateQueryJob'),
172
+ ...window.require('WAWebEditNewsletterMetadataAction'),
173
+ ...window.require('WAWebNewsletterDeleteAction'),
174
+ ...window.require('WAWebNewsletterSubscribeAction'),
175
+ ...window.require('WAWebNewsletterUnsubscribeAction'),
176
+ ...window.require('WAWebNewsletterDirectorySearchAction'),
177
+ ...window.require('WAWebNewsletterToggleMuteStateJob'),
178
+ ...window.require('WAWebNewsletterGatingUtils'),
179
+ ...window.require('WAWebNewsletterModelUtils'),
180
+ ...window.require('WAWebMexAcceptNewsletterAdminInviteJob'),
181
+ ...window.require('WAWebMexRevokeNewsletterAdminInviteJob'),
182
+ ...window.require('WAWebChangeNewsletterOwnerAction'),
183
+ ...window.require('WAWebDemoteNewsletterAdminAction'),
184
+ ...window.require('WAWebNewsletterDemoteAdminJob'),
185
+ countryCodesIso: window.require('WAWebCountriesNativeCountryNames'),
186
+ currentRegion: window.require('WAWebL10N').getRegion(),
187
+ };
188
+ window.Store.SendChannelMessage = {
189
+ ...window.require('WAWebNewsletterUpdateMsgsRecordsJob'),
190
+ ...window.require('WAWebMsgDataFromModel'),
191
+ ...window.require('WAWebNewsletterSendMessageJob'),
192
+ ...window.require('WAWebNewsletterSendMsgAction'),
193
+ ...window.require('WAMediaCalculateFilehash')
194
+ };
195
+ window.Store.ChannelSubscribers = {
196
+ ...window.require('WAWebMexFetchNewsletterSubscribersJob'),
197
+ ...window.require('WAWebNewsletterSubscriberListAction')
198
+ };
199
+ window.Store.AddressbookContactUtils = {
200
+ ...window.require('WAWebSaveContactAction'),
201
+ ...window.require('WAWebDeleteContactAction')
202
+ };
203
+ window.Store.StatusUtils = {
204
+ ...window.require('WAWebContactStatusBridge'),
205
+ ...window.require('WAWebSendStatusMsgAction'),
206
+ ...window.require('WAWebRevokeStatusAction'),
207
+ ...window.require('WAWebStatusGatingUtils')
208
+ };
209
+
210
+ if (!window.Store.Chat._find || !window.Store.Chat.findImpl) {
211
+ window.Store.Chat._find = e => {
212
+ const target = window.Store.Chat.get(e);
213
+ return target ? Promise.resolve(target) : Promise.resolve({
214
+ id: e
215
+ });
216
+ };
217
+ window.Store.Chat.findImpl = window.Store.Chat._find;
218
+ }
219
+
220
+ /**
221
+ * Target options object description
222
+ * @typedef {Object} TargetOptions
223
+ * @property {string|number} module The target module
224
+ * @property {string} function The function name to get from a module
225
+ */
226
+ /**
227
+ * Function to modify functions
228
+ * @param {TargetOptions} target Options specifying the target function to search for modifying
229
+ * @param {Function} callback Modified function
230
+ */
231
+ window.injectToFunction = (target, callback) => {
232
+ try {
233
+ let module = window.require(target.module);
234
+ if (!module) return;
235
+
236
+ const path = target.function.split('.');
237
+ const funcName = path.pop();
238
+
239
+ for (const key of path) {
240
+ if (!module[key]) return;
241
+ module = module[key];
242
+ }
243
+
244
+ const originalFunction = module[funcName];
245
+ if (typeof originalFunction !== 'function') return;
246
+
247
+ module[funcName] = (...args) => {
248
+ try {
249
+ return callback(originalFunction, ...args);
250
+ } catch {
251
+ return originalFunction(...args);
252
+ }
253
+ };
254
+
255
+ } catch {
256
+ return;
257
+ }
258
+ };
259
+
260
+ window.injectToFunction({ module: 'WAWebBackendJobsCommon', function: 'mediaTypeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage ? null : func(...args); });
261
+
262
+ window.injectToFunction({ module: 'WAWebE2EProtoUtils', function: 'typeAttributeFromProtobuf' }, (func, ...args) => { const [proto] = args; return proto.locationMessage || proto.groupInviteMessage ? 'text' : func(...args); });
263
+ };