@another-trial/whatsapp-web.js 1.34.0 → 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.
- package/.env.example +2 -2
- package/CODE_OF_CONDUCT.md +133 -133
- package/LICENSE +201 -201
- package/README.md +155 -185
- package/example.js +706 -690
- package/index.d.ts +2259 -2202
- package/index.js +35 -35
- package/package.json +59 -59
- package/shell.js +36 -36
- package/src/Client.js +2533 -2361
- package/src/authStrategies/BaseAuthStrategy.js +26 -26
- package/src/authStrategies/LocalAuth.js +58 -58
- package/src/authStrategies/NoAuth.js +11 -11
- package/src/authStrategies/RemoteAuth.js +210 -210
- package/src/factories/ChatFactory.js +21 -21
- package/src/factories/ContactFactory.js +15 -15
- package/src/structures/Base.js +21 -21
- package/src/structures/Broadcast.js +69 -69
- package/src/structures/BusinessContact.js +20 -20
- package/src/structures/Buttons.js +81 -81
- package/src/structures/Call.js +75 -75
- package/src/structures/Channel.js +382 -382
- package/src/structures/Chat.js +329 -299
- package/src/structures/ClientInfo.js +70 -70
- package/src/structures/Contact.js +215 -208
- package/src/structures/GroupChat.js +485 -485
- package/src/structures/GroupNotification.js +104 -104
- package/src/structures/Label.js +49 -49
- package/src/structures/List.js +79 -79
- package/src/structures/Location.js +61 -61
- package/src/structures/Message.js +787 -747
- package/src/structures/MessageMedia.js +111 -111
- package/src/structures/Order.js +51 -51
- package/src/structures/Payment.js +79 -79
- package/src/structures/Poll.js +44 -44
- package/src/structures/PollVote.js +75 -75
- package/src/structures/PrivateChat.js +12 -12
- package/src/structures/PrivateContact.js +12 -12
- package/src/structures/Product.js +67 -67
- package/src/structures/ProductMetadata.js +24 -24
- package/src/structures/Reaction.js +68 -68
- package/src/structures/ScheduledEvent.js +71 -71
- package/src/structures/index.js +27 -27
- package/src/util/Constants.js +186 -183
- package/src/util/Injected/AuthStore/AuthStore.js +16 -16
- package/src/util/Injected/AuthStore/LegacyAuthStore.js +21 -21
- package/src/util/Injected/LegacyStore.js +145 -145
- package/src/util/Injected/Store.js +263 -231
- package/src/util/Injected/Utils.js +1221 -1169
- package/src/util/InterfaceController.js +126 -126
- package/src/util/Puppeteer.js +23 -23
- package/src/util/Util.js +186 -186
- package/src/webCache/LocalWebCache.js +40 -40
- package/src/webCache/RemoteWebCache.js +39 -39
- package/src/webCache/WebCache.js +13 -13
- package/src/webCache/WebCacheFactory.js +19 -19
|
@@ -1,231 +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.
|
|
58
|
-
window.Store.
|
|
59
|
-
window.Store.
|
|
60
|
-
window.Store.
|
|
61
|
-
window.Store.
|
|
62
|
-
window.Store.
|
|
63
|
-
window.Store.
|
|
64
|
-
window.Store.
|
|
65
|
-
window.Store.
|
|
66
|
-
window.Store.
|
|
67
|
-
window.Store.
|
|
68
|
-
window.Store.
|
|
69
|
-
window.Store.
|
|
70
|
-
window.Store.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
window.Store.
|
|
75
|
-
window.Store.
|
|
76
|
-
window.Store.
|
|
77
|
-
window.Store.
|
|
78
|
-
window.Store.
|
|
79
|
-
window.Store.
|
|
80
|
-
window.Store.
|
|
81
|
-
window.Store.
|
|
82
|
-
window.Store.
|
|
83
|
-
window.Store.
|
|
84
|
-
window.Store.
|
|
85
|
-
window.Store.
|
|
86
|
-
window.Store.
|
|
87
|
-
window.Store.
|
|
88
|
-
window.Store.
|
|
89
|
-
window.Store.
|
|
90
|
-
window.Store.
|
|
91
|
-
window.Store.
|
|
92
|
-
window.Store.
|
|
93
|
-
window.Store.
|
|
94
|
-
window.Store.
|
|
95
|
-
window.Store.
|
|
96
|
-
window.Store.
|
|
97
|
-
window.Store.
|
|
98
|
-
window.Store.
|
|
99
|
-
window.Store.
|
|
100
|
-
window.Store.
|
|
101
|
-
window.Store.
|
|
102
|
-
window.Store.
|
|
103
|
-
window.Store.
|
|
104
|
-
window.Store.
|
|
105
|
-
window.Store.
|
|
106
|
-
|
|
107
|
-
window.Store.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
window.Store.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
window.Store.
|
|
120
|
-
...window.require('
|
|
121
|
-
...window.require('
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
...window.require('
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
...window.require('
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
...window.require('
|
|
137
|
-
...window.require('
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...window.require('
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
...window.require('
|
|
146
|
-
...window.require('
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
...window.require('
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
...window.require('
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
...window.require('
|
|
158
|
-
...window.require('
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
...window.require('
|
|
162
|
-
...window.require('
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
...window.require('
|
|
166
|
-
...window.require('
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
...window.require('
|
|
170
|
-
...window.require('
|
|
171
|
-
...window.require('
|
|
172
|
-
...window.require('
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
...window.require('
|
|
178
|
-
...window.require('
|
|
179
|
-
...window.require('
|
|
180
|
-
...window.require('
|
|
181
|
-
...window.require('
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
...window.require('
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
...window.require('
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
window.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
+
};
|