jagproject 26.3.22 → 26.3.25
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/WAProto/GenerateStatics.sh +3 -4
- package/WAProto/WAProto.proto +1215 -511
- package/WAProto/fix-imports.js +73 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +64857 -145167
- package/engine-requirements.js +4 -7
- package/lib/Defaults/index.d.ts +74 -0
- package/lib/Defaults/index.js +51 -33
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Defaults/wileys-version.json +2 -2
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.js +5 -3
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +35 -46
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.js +21 -21
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.js +2 -2
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +5 -10
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +7 -7
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +8 -8
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.js +7 -16
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.js +25 -37
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +2 -2
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.js +358 -54
- package/lib/Signal/lid-mapping.d.ts +19 -0
- package/lib/Signal/lid-mapping.js +274 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +2 -2
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.js +1 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.js +18 -30
- package/lib/Socket/business.d.ts +202 -0
- package/lib/Socket/business.js +160 -38
- package/lib/Socket/chats.d.ts +111 -0
- package/lib/Socket/chats.js +497 -314
- package/lib/Socket/communities.d.ts +258 -0
- package/lib/Socket/communities.js +438 -0
- package/lib/Socket/community.js +333 -0
- package/lib/Socket/groups.d.ts +150 -0
- package/lib/Socket/groups.js +229 -91
- package/lib/Socket/index.d.ts +245 -0
- package/lib/Socket/index.js +9 -6
- package/lib/Socket/messages-recv.d.ts +187 -0
- package/lib/Socket/messages-recv.js +1105 -501
- package/lib/Socket/messages-send.d.ts +183 -0
- package/lib/Socket/messages-send.js +1184 -501
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.js +45 -0
- package/lib/Socket/newsletter.d.ts +160 -0
- package/lib/Socket/newsletter.js +227 -200
- package/lib/Socket/socket.d.ts +55 -0
- package/lib/Socket/socket.js +507 -206
- package/lib/Socket/usync.js +6 -6
- package/lib/Store/index.js +17 -5
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.js +48 -89
- package/lib/Store/make-ordered-dictionary.js +1 -1
- package/lib/Types/Auth.d.ts +116 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Chat.d.ts +123 -0
- package/lib/Types/Chat.js +7 -1
- package/lib/Types/Contact.d.ts +24 -0
- package/lib/Types/Events.d.ts +237 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +67 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.js +1 -3
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.js +1 -3
- package/lib/Types/Message.d.ts +305 -0
- package/lib/Types/Message.js +9 -5
- package/lib/Types/MexUpdates.js +11 -0
- package/lib/Types/Newsletter.d.ts +135 -0
- package/lib/Types/Newsletter.js +36 -11
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Signal.d.ts +76 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +133 -0
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +39 -0
- package/lib/Types/State.js +12 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +65 -0
- package/lib/Types/index.js +14 -14
- package/lib/Utils/audioToBuffer.js +31 -0
- package/lib/Utils/auth-utils.d.ts +19 -0
- package/lib/Utils/auth-utils.js +222 -123
- package/lib/Utils/baileys-event-stream.js +60 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +38 -29
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.js +54 -48
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/lib/Utils/chat-utils.js +284 -189
- package/lib/Utils/crypto.d.ts +37 -0
- package/lib/Utils/crypto.js +16 -41
- package/lib/Utils/decode-wa-message.d.ts +48 -0
- package/lib/Utils/decode-wa-message.js +128 -48
- package/lib/Utils/event-buffer.d.ts +34 -0
- package/lib/Utils/event-buffer.js +124 -62
- package/lib/Utils/generics.d.ts +91 -0
- package/lib/Utils/generics.js +154 -138
- package/lib/Utils/history.d.ts +22 -0
- package/lib/Utils/history.js +77 -34
- package/lib/Utils/identity-change-handler.d.ts +37 -0
- package/lib/Utils/identity-change-handler.js +54 -0
- package/lib/Utils/index.d.ts +22 -0
- package/lib/Utils/index.js +32 -19
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +12 -17
- package/lib/Utils/logger.d.ts +13 -0
- package/lib/Utils/lt-hash.d.ts +8 -0
- package/lib/Utils/lt-hash.js +2 -43
- package/lib/Utils/make-mutex.d.ts +9 -0
- package/lib/Utils/make-mutex.js +21 -27
- package/lib/Utils/message-retry-manager.d.ts +110 -0
- package/lib/Utils/message-retry-manager.js +143 -45
- package/lib/Utils/messages-media.d.ts +130 -0
- package/lib/Utils/messages-media.js +429 -502
- package/lib/Utils/messages-newsletter.d.ts +84 -0
- package/lib/Utils/messages-newsletter.js +295 -0
- package/lib/Utils/messages.d.ts +92 -0
- package/lib/Utils/messages.js +1099 -400
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +145 -91
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.js +112 -0
- package/lib/Utils/process-message.d.ts +60 -0
- package/lib/Utils/process-message.js +316 -184
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.js +262 -0
- package/lib/Utils/resolve-jid.d.ts +43 -0
- package/lib/Utils/resolve-jid.js +95 -0
- package/lib/Utils/serial-task-queue.js +29 -0
- package/lib/Utils/signal.d.ts +34 -0
- package/lib/Utils/signal.js +56 -39
- package/lib/Utils/streamToBuffer.js +17 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.js +52 -0
- package/lib/Utils/tc-token-utils.d.ts +12 -0
- package/lib/Utils/tc-token-utils.js +20 -0
- package/lib/Utils/use-mongo-file-auth-state.js +71 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +11 -12
- package/lib/Utils/use-single-file-auth-state.js +73 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +59 -82
- package/lib/Utils/wileys-event-stream.js +1 -61
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +39 -4
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +17 -11
- package/lib/WABinary/generic-utils.d.ts +15 -0
- package/lib/WABinary/generic-utils.js +46 -18
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.js +9 -5
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.js +67 -37
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.js +34 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.js +19183 -11678
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +15 -17
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.js +3 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +6 -6
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +9 -9
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +6 -6
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +7 -8
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +18 -17
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +11 -3
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.js +6 -4
- package/lib/WAUSync/USyncQuery.d.ts +29 -0
- package/lib/WAUSync/USyncQuery.js +38 -30
- package/lib/WAUSync/USyncUser.d.ts +13 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +3 -3
- package/lib/index.d.ts +12 -0
- package/lib/index.js +3 -5
- package/package.json +10 -6
- package/readme.md +97 -0
- package/LICENSE +0 -21
package/lib/Socket/business.js
CHANGED
|
@@ -1,17 +1,137 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeBusinessSocket = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const index_js_1 = require("../Utils/index.js");
|
|
5
|
+
const business_js_1 = require("../Utils/business.js");
|
|
6
|
+
const index_js_2 = require("../WABinary/index.js");
|
|
7
|
+
const generic_utils_js_1 = require("../WABinary/generic-utils.js");
|
|
8
|
+
const messages_recv_js_1 = require("./messages-recv.js");
|
|
8
9
|
const makeBusinessSocket = (config) => {
|
|
9
|
-
const sock = (0,
|
|
10
|
+
const sock = (0, messages_recv_js_1.makeMessagesRecvSocket)(config);
|
|
10
11
|
const { authState, query, waUploadToServer } = sock;
|
|
12
|
+
const updateBussinesProfile = async (args) => {
|
|
13
|
+
const node = [];
|
|
14
|
+
const simpleFields = ['address', 'email', 'description'];
|
|
15
|
+
node.push(...simpleFields
|
|
16
|
+
.filter(key => args[key] !== undefined && args[key] !== null)
|
|
17
|
+
.map(key => ({
|
|
18
|
+
tag: key,
|
|
19
|
+
attrs: {},
|
|
20
|
+
content: args[key]
|
|
21
|
+
})));
|
|
22
|
+
if (args.websites !== undefined) {
|
|
23
|
+
node.push(...args.websites.map(website => ({
|
|
24
|
+
tag: 'website',
|
|
25
|
+
attrs: {},
|
|
26
|
+
content: website
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
if (args.hours !== undefined) {
|
|
30
|
+
node.push({
|
|
31
|
+
tag: 'business_hours',
|
|
32
|
+
attrs: { timezone: args.hours.timezone },
|
|
33
|
+
content: args.hours.days.map(dayConfig => {
|
|
34
|
+
const base = {
|
|
35
|
+
tag: 'business_hours_config',
|
|
36
|
+
attrs: {
|
|
37
|
+
day_of_week: dayConfig.day,
|
|
38
|
+
mode: dayConfig.mode
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (dayConfig.mode === 'specific_hours') {
|
|
42
|
+
return {
|
|
43
|
+
...base,
|
|
44
|
+
attrs: {
|
|
45
|
+
...base.attrs,
|
|
46
|
+
open_time: dayConfig.openTimeInMinutes,
|
|
47
|
+
close_time: dayConfig.closeTimeInMinutes
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return base;
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const result = await query({
|
|
56
|
+
tag: 'iq',
|
|
57
|
+
attrs: {
|
|
58
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
59
|
+
type: 'set',
|
|
60
|
+
xmlns: 'w:biz'
|
|
61
|
+
},
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
tag: 'business_profile',
|
|
65
|
+
attrs: {
|
|
66
|
+
v: '3',
|
|
67
|
+
mutation_type: 'delta'
|
|
68
|
+
},
|
|
69
|
+
content: node
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
return result;
|
|
74
|
+
};
|
|
75
|
+
const updateCoverPhoto = async (photo) => {
|
|
76
|
+
const { fileSha256, filePath } = await (0, index_js_1.getRawMediaUploadData)(photo, 'biz-cover-photo');
|
|
77
|
+
const fileSha256B64 = fileSha256.toString('base64');
|
|
78
|
+
const { meta_hmac, fbid, ts } = await waUploadToServer(filePath, {
|
|
79
|
+
fileEncSha256B64: fileSha256B64,
|
|
80
|
+
mediaType: 'biz-cover-photo'
|
|
81
|
+
});
|
|
82
|
+
await query({
|
|
83
|
+
tag: 'iq',
|
|
84
|
+
attrs: {
|
|
85
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
86
|
+
type: 'set',
|
|
87
|
+
xmlns: 'w:biz'
|
|
88
|
+
},
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
tag: 'business_profile',
|
|
92
|
+
attrs: {
|
|
93
|
+
v: '3',
|
|
94
|
+
mutation_type: 'delta'
|
|
95
|
+
},
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
tag: 'cover_photo',
|
|
99
|
+
attrs: { id: String(fbid), op: 'update', token: meta_hmac, ts: String(ts) }
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
return fbid;
|
|
106
|
+
};
|
|
107
|
+
const removeCoverPhoto = async (id) => {
|
|
108
|
+
return await query({
|
|
109
|
+
tag: 'iq',
|
|
110
|
+
attrs: {
|
|
111
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
112
|
+
type: 'set',
|
|
113
|
+
xmlns: 'w:biz'
|
|
114
|
+
},
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
tag: 'business_profile',
|
|
118
|
+
attrs: {
|
|
119
|
+
v: '3',
|
|
120
|
+
mutation_type: 'delta'
|
|
121
|
+
},
|
|
122
|
+
content: [
|
|
123
|
+
{
|
|
124
|
+
tag: 'cover_photo',
|
|
125
|
+
attrs: { op: 'delete', id }
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
11
132
|
const getCatalog = async ({ jid, limit, cursor }) => {
|
|
12
|
-
|
|
13
|
-
jid =
|
|
14
|
-
jid = (0, WABinary_1.jidNormalizedUser)(jid);
|
|
133
|
+
jid = jid || authState.creds.me?.id;
|
|
134
|
+
jid = (0, index_js_2.jidNormalizedUser)(jid);
|
|
15
135
|
const queryParamNodes = [
|
|
16
136
|
{
|
|
17
137
|
tag: 'limit',
|
|
@@ -27,7 +147,7 @@ const makeBusinessSocket = (config) => {
|
|
|
27
147
|
tag: 'height',
|
|
28
148
|
attrs: {},
|
|
29
149
|
content: Buffer.from('100')
|
|
30
|
-
}
|
|
150
|
+
}
|
|
31
151
|
];
|
|
32
152
|
if (cursor) {
|
|
33
153
|
queryParamNodes.push({
|
|
@@ -39,7 +159,7 @@ const makeBusinessSocket = (config) => {
|
|
|
39
159
|
const result = await query({
|
|
40
160
|
tag: 'iq',
|
|
41
161
|
attrs: {
|
|
42
|
-
to:
|
|
162
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
43
163
|
type: 'get',
|
|
44
164
|
xmlns: 'w:biz:catalog'
|
|
45
165
|
},
|
|
@@ -48,31 +168,30 @@ const makeBusinessSocket = (config) => {
|
|
|
48
168
|
tag: 'product_catalog',
|
|
49
169
|
attrs: {
|
|
50
170
|
jid,
|
|
51
|
-
|
|
171
|
+
allow_shop_source: 'true'
|
|
52
172
|
},
|
|
53
173
|
content: queryParamNodes
|
|
54
174
|
}
|
|
55
175
|
]
|
|
56
176
|
});
|
|
57
|
-
return (0,
|
|
177
|
+
return (0, business_js_1.parseCatalogNode)(result);
|
|
58
178
|
};
|
|
59
179
|
const getCollections = async (jid, limit = 51) => {
|
|
60
|
-
|
|
61
|
-
jid =
|
|
62
|
-
jid = (0, WABinary_1.jidNormalizedUser)(jid);
|
|
180
|
+
jid = jid || authState.creds.me?.id;
|
|
181
|
+
jid = (0, index_js_2.jidNormalizedUser)(jid);
|
|
63
182
|
const result = await query({
|
|
64
183
|
tag: 'iq',
|
|
65
184
|
attrs: {
|
|
66
|
-
to:
|
|
185
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
67
186
|
type: 'get',
|
|
68
187
|
xmlns: 'w:biz:catalog',
|
|
69
|
-
|
|
188
|
+
smax_id: '35'
|
|
70
189
|
},
|
|
71
190
|
content: [
|
|
72
191
|
{
|
|
73
192
|
tag: 'collections',
|
|
74
193
|
attrs: {
|
|
75
|
-
|
|
194
|
+
biz_jid: jid
|
|
76
195
|
},
|
|
77
196
|
content: [
|
|
78
197
|
{
|
|
@@ -99,16 +218,16 @@ const makeBusinessSocket = (config) => {
|
|
|
99
218
|
}
|
|
100
219
|
]
|
|
101
220
|
});
|
|
102
|
-
return (0,
|
|
221
|
+
return (0, business_js_1.parseCollectionsNode)(result);
|
|
103
222
|
};
|
|
104
223
|
const getOrderDetails = async (orderId, tokenBase64) => {
|
|
105
224
|
const result = await query({
|
|
106
225
|
tag: 'iq',
|
|
107
226
|
attrs: {
|
|
108
|
-
to:
|
|
227
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
109
228
|
type: 'get',
|
|
110
229
|
xmlns: 'fb:thrift_iq',
|
|
111
|
-
|
|
230
|
+
smax_id: '5'
|
|
112
231
|
},
|
|
113
232
|
content: [
|
|
114
233
|
{
|
|
@@ -143,15 +262,15 @@ const makeBusinessSocket = (config) => {
|
|
|
143
262
|
}
|
|
144
263
|
]
|
|
145
264
|
});
|
|
146
|
-
return (0,
|
|
265
|
+
return (0, business_js_1.parseOrderDetailsNode)(result);
|
|
147
266
|
};
|
|
148
267
|
const productUpdate = async (productId, update) => {
|
|
149
|
-
update = await (0,
|
|
150
|
-
const editNode = (0,
|
|
268
|
+
update = await (0, business_js_1.uploadingNecessaryImagesOfProduct)(update, waUploadToServer);
|
|
269
|
+
const editNode = (0, business_js_1.toProductNode)(productId, update);
|
|
151
270
|
const result = await query({
|
|
152
271
|
tag: 'iq',
|
|
153
272
|
attrs: {
|
|
154
|
-
to:
|
|
273
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
155
274
|
type: 'set',
|
|
156
275
|
xmlns: 'w:biz:catalog'
|
|
157
276
|
},
|
|
@@ -175,19 +294,19 @@ const makeBusinessSocket = (config) => {
|
|
|
175
294
|
}
|
|
176
295
|
]
|
|
177
296
|
});
|
|
178
|
-
const productCatalogEditNode = (0,
|
|
179
|
-
const productNode = (0,
|
|
180
|
-
return (0,
|
|
297
|
+
const productCatalogEditNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_edit');
|
|
298
|
+
const productNode = (0, generic_utils_js_1.getBinaryNodeChild)(productCatalogEditNode, 'product');
|
|
299
|
+
return (0, business_js_1.parseProductNode)(productNode);
|
|
181
300
|
};
|
|
182
301
|
const productCreate = async (create) => {
|
|
183
302
|
// ensure isHidden is defined
|
|
184
303
|
create.isHidden = !!create.isHidden;
|
|
185
|
-
create = await (0,
|
|
186
|
-
const createNode = (0,
|
|
304
|
+
create = await (0, business_js_1.uploadingNecessaryImagesOfProduct)(create, waUploadToServer);
|
|
305
|
+
const createNode = (0, business_js_1.toProductNode)(undefined, create);
|
|
187
306
|
const result = await query({
|
|
188
307
|
tag: 'iq',
|
|
189
308
|
attrs: {
|
|
190
|
-
to:
|
|
309
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
191
310
|
type: 'set',
|
|
192
311
|
xmlns: 'w:biz:catalog'
|
|
193
312
|
},
|
|
@@ -211,15 +330,15 @@ const makeBusinessSocket = (config) => {
|
|
|
211
330
|
}
|
|
212
331
|
]
|
|
213
332
|
});
|
|
214
|
-
const productCatalogAddNode = (0,
|
|
215
|
-
const productNode = (0,
|
|
216
|
-
return (0,
|
|
333
|
+
const productCatalogAddNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_add');
|
|
334
|
+
const productNode = (0, generic_utils_js_1.getBinaryNodeChild)(productCatalogAddNode, 'product');
|
|
335
|
+
return (0, business_js_1.parseProductNode)(productNode);
|
|
217
336
|
};
|
|
218
337
|
const productDelete = async (productIds) => {
|
|
219
338
|
const result = await query({
|
|
220
339
|
tag: 'iq',
|
|
221
340
|
attrs: {
|
|
222
|
-
to:
|
|
341
|
+
to: index_js_2.S_WHATSAPP_NET,
|
|
223
342
|
type: 'set',
|
|
224
343
|
xmlns: 'w:biz:catalog'
|
|
225
344
|
},
|
|
@@ -241,9 +360,9 @@ const makeBusinessSocket = (config) => {
|
|
|
241
360
|
}
|
|
242
361
|
]
|
|
243
362
|
});
|
|
244
|
-
const productCatalogDelNode = (0,
|
|
363
|
+
const productCatalogDelNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_delete');
|
|
245
364
|
return {
|
|
246
|
-
deleted: +(
|
|
365
|
+
deleted: +(productCatalogDelNode?.attrs.deleted_count || 0)
|
|
247
366
|
};
|
|
248
367
|
};
|
|
249
368
|
return {
|
|
@@ -254,7 +373,10 @@ const makeBusinessSocket = (config) => {
|
|
|
254
373
|
getCollections,
|
|
255
374
|
productCreate,
|
|
256
375
|
productDelete,
|
|
257
|
-
productUpdate
|
|
376
|
+
productUpdate,
|
|
377
|
+
updateBussinesProfile,
|
|
378
|
+
updateCoverPhoto,
|
|
379
|
+
removeCoverPhoto
|
|
258
380
|
};
|
|
259
381
|
};
|
|
260
382
|
exports.makeBusinessSocket = makeBusinessSocket;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import type { BotListInfo, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types/index.js';
|
|
4
|
+
import type { QuickReplyAction } from '../Types/Bussines.js';
|
|
5
|
+
import type { LabelActionBody } from '../Types/Label.js';
|
|
6
|
+
import { type BinaryNode } from '../WABinary/index.js';
|
|
7
|
+
import { USyncQuery } from '../WAUSync/index.js';
|
|
8
|
+
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
9
|
+
createCallLink: (type: "audio" | "video", event?: {
|
|
10
|
+
startTime: number;
|
|
11
|
+
}, timeoutMs?: number) => Promise<string | undefined>;
|
|
12
|
+
getBotListV2: () => Promise<BotListInfo[]>;
|
|
13
|
+
messageMutex: {
|
|
14
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
15
|
+
};
|
|
16
|
+
receiptMutex: {
|
|
17
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
18
|
+
};
|
|
19
|
+
appStatePatchMutex: {
|
|
20
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
21
|
+
};
|
|
22
|
+
notificationMutex: {
|
|
23
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
24
|
+
};
|
|
25
|
+
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
26
|
+
[_: string]: string;
|
|
27
|
+
}>;
|
|
28
|
+
upsertMessage: (msg: WAMessage, type: MessageUpsertType) => Promise<void>;
|
|
29
|
+
appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
|
|
30
|
+
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
|
|
31
|
+
presenceSubscribe: (toJid: string) => Promise<void>;
|
|
32
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
33
|
+
fetchBlocklist: () => Promise<(string | undefined)[]>;
|
|
34
|
+
fetchStatus: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
|
|
35
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
|
|
36
|
+
updateProfilePicture: (jid: string, content: WAMediaUpload, dimensions?: {
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
removeProfilePicture: (jid: string) => Promise<void>;
|
|
41
|
+
updateProfileStatus: (status: string) => Promise<void>;
|
|
42
|
+
updateProfileName: (name: string) => Promise<void>;
|
|
43
|
+
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
44
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
45
|
+
updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>;
|
|
46
|
+
updateMessagesPrivacy: (value: WAPrivacyMessagesValue) => Promise<void>;
|
|
47
|
+
updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>;
|
|
48
|
+
updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>;
|
|
49
|
+
updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>;
|
|
50
|
+
updateStatusPrivacy: (value: WAPrivacyValue) => Promise<void>;
|
|
51
|
+
updateReadReceiptsPrivacy: (value: WAReadReceiptsValue) => Promise<void>;
|
|
52
|
+
updateGroupsAddPrivacy: (value: WAPrivacyGroupAddValue) => Promise<void>;
|
|
53
|
+
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
54
|
+
getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
|
|
55
|
+
resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
56
|
+
chatModify: (mod: ChatModification, jid: string) => Promise<void>;
|
|
57
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
58
|
+
addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
|
|
59
|
+
removeContact: (jid: string) => Promise<void>;
|
|
60
|
+
addLabel: (jid: string, labels: LabelActionBody) => Promise<void>;
|
|
61
|
+
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
62
|
+
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
63
|
+
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
64
|
+
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
65
|
+
star: (jid: string, messages: {
|
|
66
|
+
id: string;
|
|
67
|
+
fromMe?: boolean;
|
|
68
|
+
}[], star: boolean) => Promise<void>;
|
|
69
|
+
addOrEditQuickReply: (quickReply: QuickReplyAction) => Promise<void>;
|
|
70
|
+
removeQuickReply: (timestamp: string) => Promise<void>;
|
|
71
|
+
type: "md";
|
|
72
|
+
ws: import("./Client/websocket.js").WebSocketClient;
|
|
73
|
+
ev: import("../Types/index.js").BaileysEventEmitter & {
|
|
74
|
+
process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
75
|
+
buffer(): void;
|
|
76
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
77
|
+
flush(): boolean;
|
|
78
|
+
isBuffering(): boolean;
|
|
79
|
+
};
|
|
80
|
+
authState: {
|
|
81
|
+
creds: import("../Types/index.js").AuthenticationCreds;
|
|
82
|
+
keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
|
|
83
|
+
};
|
|
84
|
+
signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
|
|
85
|
+
user: import("../Types/index.js").Contact | undefined;
|
|
86
|
+
generateMessageTag: () => string;
|
|
87
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
88
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
|
|
89
|
+
waitForSocketOpen: () => Promise<void>;
|
|
90
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
91
|
+
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
92
|
+
logout: (msg?: string) => Promise<void>;
|
|
93
|
+
end: (error: Error | undefined) => Promise<void>;
|
|
94
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
95
|
+
uploadPreKeys: (count?: number, retryCount?: number) => Promise<void>;
|
|
96
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
97
|
+
digestKeyBundle: () => Promise<void>;
|
|
98
|
+
rotateSignedPreKey: () => Promise<void>;
|
|
99
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
|
100
|
+
updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
|
|
101
|
+
sendUnifiedSession: () => Promise<void>;
|
|
102
|
+
wamBuffer: import("../index.js").BinaryInfo;
|
|
103
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
104
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
105
|
+
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync/index.js").USyncQueryResult | undefined>;
|
|
106
|
+
onWhatsApp: (...phoneNumber: string[]) => Promise<{
|
|
107
|
+
jid: string;
|
|
108
|
+
exists: boolean;
|
|
109
|
+
}[] | undefined>;
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=chats.d.ts.map
|