@badzz88/baileys 8.5.7 → 8.5.8
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/README.md +337 -1055
- package/WAProto/WAProto.proto +284 -264
- package/WAProto/index.js +5 -5
- package/engine-requirements.js +7 -15
- package/lib/Defaults/index.js +130 -187
- package/lib/Signal/Group/ciphertext-message.js +11 -14
- package/lib/Signal/Group/group-session-builder.js +29 -91
- package/lib/Signal/Group/group_cipher.js +81 -88
- package/lib/Signal/Group/index.js +12 -136
- package/lib/Signal/Group/keyhelper.js +15 -70
- package/lib/Signal/Group/sender-chain-key.js +25 -31
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -65
- package/lib/Signal/Group/sender-key-message.js +65 -68
- package/lib/Signal/Group/sender-key-name.js +41 -43
- package/lib/Signal/Group/sender-key-record.js +40 -43
- package/lib/Signal/Group/sender-key-state.js +83 -96
- package/lib/Signal/Group/sender-message-key.js +25 -29
- package/lib/Signal/libsignal.js +425 -453
- package/lib/Signal/lid-mapping.js +276 -259
- package/lib/Socket/Client/index.js +3 -30
- package/lib/Socket/Client/types.js +10 -12
- package/lib/Socket/Client/websocket.js +53 -61
- package/lib/Socket/business.js +379 -422
- package/lib/Socket/chats.js +1193 -1816
- package/lib/Socket/communities.js +431 -549
- package/lib/Socket/graphql.js +672 -612
- package/lib/Socket/groups.js +374 -764
- package/lib/Socket/index.js +17 -38
- package/lib/Socket/interop.js +417 -503
- package/lib/Socket/messages-recv.js +1915 -2441
- package/lib/Socket/messages-send.js +1213 -1630
- package/lib/Socket/mex.js +9 -15
- package/lib/Socket/newsletter.js +747 -808
- package/lib/Socket/privacy.js +310 -441
- package/lib/Socket/socket.js +1025 -1022
- package/lib/Socket/username.js +8 -15
- package/lib/Store/index.js +10 -36
- package/lib/Store/make-cache-manager-store.js +80 -85
- package/lib/Store/make-in-memory-store.js +231 -591
- package/lib/Store/make-ordered-dictionary.js +72 -78
- package/lib/Store/object-repository.js +28 -25
- package/lib/Types/Auth.js +2 -38
- package/lib/Types/Bussines.js +2 -2
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.js +8 -4
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.js +24 -26
- package/lib/Types/LabelAssociation.js +6 -8
- package/lib/Types/Message.js +11 -95
- package/lib/Types/Mex.js +111 -112
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.js +3 -2
- package/lib/Types/State.js +56 -70
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.js +26 -55
- package/lib/Utils/auth-utils.js +288 -292
- package/lib/Utils/browser-utils.js +47 -113
- package/lib/Utils/business.js +224 -240
- package/lib/Utils/chat-utils.js +869 -1205
- package/lib/Utils/companion-reg-client-utils.js +34 -41
- package/lib/Utils/crypto.js +107 -144
- package/lib/Utils/decode-wa-message.js +308 -518
- package/lib/Utils/event-buffer.js +611 -596
- package/lib/Utils/generics.js +355 -515
- package/lib/Utils/history.js +134 -244
- package/lib/Utils/identity-change-handler.js +49 -51
- package/lib/Utils/index.js +23 -57
- package/lib/Utils/link-preview.js +77 -135
- package/lib/Utils/logger.js +3 -9
- package/lib/Utils/lt-hash.js +6 -37
- package/lib/Utils/make-mutex.js +33 -36
- package/lib/Utils/message-composer.js +233 -439
- package/lib/Utils/message-retry-manager.js +260 -265
- package/lib/Utils/messages-media.js +829 -855
- package/lib/Utils/messages.js +961 -2528
- package/lib/Utils/noise-handler.js +200 -195
- package/lib/Utils/offline-node-processor.js +33 -35
- package/lib/Utils/pre-key-manager.js +102 -103
- package/lib/Utils/process-message.js +560 -978
- package/lib/Utils/reporting-utils.js +253 -257
- package/lib/Utils/signal.js +195 -218
- package/lib/Utils/stanza-ack.js +29 -31
- package/lib/Utils/sticker.js +109 -144
- package/lib/Utils/sync-action-utils.js +45 -50
- package/lib/Utils/tc-token-utils.js +139 -137
- package/lib/Utils/use-multi-file-auth-state.js +109 -109
- package/lib/Utils/validate-connection.js +202 -218
- package/lib/WABinary/constants.js +1299 -1302
- package/lib/WABinary/decode.js +262 -343
- package/lib/WABinary/encode.js +4 -12
- package/lib/WABinary/generic-utils.js +187 -223
- package/lib/WABinary/index.js +6 -33
- package/lib/WABinary/jid-utils.js +88 -351
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.js +9 -12
- package/lib/WAM/constants.js +22853 -39486
- package/lib/WAM/encode.js +140 -132
- package/lib/WAM/index.js +4 -31
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +21 -23
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +7 -7
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +10 -10
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +7 -7
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +11 -12
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +4 -5
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +7 -7
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +7 -8
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +7 -7
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +8 -8
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +7 -7
- package/lib/WAUSync/Protocols/index.js +12 -39
- package/lib/WAUSync/USyncQuery.js +67 -49
- package/lib/WAUSync/USyncUser.js +11 -5
- package/lib/WAUSync/index.js +3 -31
- package/lib/index.js +15 -48
- package/package.json +129 -99
- package/LICENSE +0 -21
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/aigroups.js +0 -240
- package/lib/Socket/interactive-handler.js +0 -522
- package/lib/Socket/managed-account.js +0 -183
- package/lib/Socket/registration.js +0 -427
- package/lib/Socket/text-router.js +0 -83
- package/lib/Types/Newsletter.js +0 -121
- package/lib/Utils/command-loader.d.ts +0 -31
- package/lib/Utils/command-loader.js +0 -100
- package/lib/Utils/consumer-application.js +0 -107
- package/lib/Utils/curve25519-js.js +0 -275
- package/lib/Utils/group-history.js +0 -60
- package/lib/Utils/jid-display-normalization.js +0 -218
- package/lib/Utils/meta-ai-msmsg.js +0 -262
- package/lib/Utils/native-bridge.js +0 -82
- package/lib/Utils/session-pool.d.ts +0 -16
- package/lib/Utils/session-pool.js +0 -94
- package/lib/Utils/sticker.d.ts +0 -17
- package/lib/Utils/view-once-cache.d.ts +0 -9
- package/lib/Utils/view-once-cache.js +0 -79
- package/lib/Utils/voip-rekey.js +0 -22
- package/lib/antiban.js +0 -4637
|
@@ -1,240 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.assertNodeErrorFree =
|
|
6
|
-
exports.getBinaryNodeChildUInt =
|
|
7
|
-
exports.getBinaryNodeChildString =
|
|
8
|
-
exports.getBinaryNodeChildBuffer =
|
|
9
|
-
exports.getAllBinaryNodeChildren =
|
|
10
|
-
exports.getBinaryNodeChild =
|
|
11
|
-
exports.getBinaryNodeChildren =
|
|
12
|
-
void 0
|
|
13
|
-
exports.binaryNodeToString = binaryNodeToString
|
|
14
|
-
const boom_1 = require('@hapi/boom')
|
|
15
|
-
const index_js_1 = require('../../WAProto/index.js')
|
|
1
|
+
import { Boom } from '@hapi/boom'
|
|
2
|
+
import { proto } from '../../WAProto/index.js'
|
|
3
|
+
import { unixTimestampSeconds } from '../Utils/generics.js'
|
|
4
|
+
|
|
16
5
|
// some extra useful utilities
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!index) {
|
|
23
|
-
index = new Map()
|
|
24
|
-
for (const child of node.content) {
|
|
25
|
-
let arr = index.get(child.tag)
|
|
26
|
-
if (!arr) index.set(child.tag, (arr = []))
|
|
27
|
-
arr.push(child)
|
|
28
|
-
}
|
|
29
|
-
indexCache.set(node, index)
|
|
30
|
-
}
|
|
31
|
-
// Return first matching child
|
|
32
|
-
return index.get(childTag) || []
|
|
33
|
-
}
|
|
34
|
-
exports.getBinaryNodeChildren = getBinaryNodeChildren
|
|
35
|
-
const getBinaryNodeChild = (node, childTag) => {
|
|
36
|
-
return (0, exports.getBinaryNodeChildren)(node, childTag)[0]
|
|
37
|
-
}
|
|
38
|
-
exports.getBinaryNodeChild = getBinaryNodeChild
|
|
39
|
-
const getAllBinaryNodeChildren = ({ content }) => {
|
|
40
|
-
if (Array.isArray(content)) {
|
|
41
|
-
return content
|
|
42
|
-
}
|
|
43
|
-
return []
|
|
6
|
+
export const getBinaryNodeChildren = (node, childTag) => {
|
|
7
|
+
if (Array.isArray(node?.content)) {
|
|
8
|
+
return node.content.filter(item => item.tag === childTag)
|
|
9
|
+
}
|
|
10
|
+
return []
|
|
44
11
|
}
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
12
|
+
|
|
13
|
+
export const getAllBinaryNodeChildren = ({ content }) => {
|
|
14
|
+
if (Array.isArray(content)) {
|
|
15
|
+
return content
|
|
16
|
+
}
|
|
17
|
+
return []
|
|
51
18
|
}
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} else if (typeof child === 'string') {
|
|
58
|
-
return child
|
|
59
|
-
}
|
|
19
|
+
|
|
20
|
+
export const getBinaryNodeChild = (node, childTag) => {
|
|
21
|
+
if (Array.isArray(node?.content)) {
|
|
22
|
+
return node?.content.find(item => item.tag === childTag)
|
|
23
|
+
}
|
|
60
24
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
25
|
+
|
|
26
|
+
export const getBinaryNodeChildBuffer = (node, childTag) => {
|
|
27
|
+
const child = getBinaryNodeChild(node, childTag)?.content
|
|
28
|
+
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
29
|
+
return child
|
|
30
|
+
}
|
|
67
31
|
}
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
|
|
33
|
+
export const getBinaryNodeChildString = (node, childTag) => {
|
|
34
|
+
const child = getBinaryNodeChild(node, childTag)?.content
|
|
35
|
+
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
36
|
+
return Buffer.from(child).toString('utf-8')
|
|
37
|
+
}
|
|
38
|
+
else if (typeof child === 'string') {
|
|
39
|
+
return child
|
|
40
|
+
}
|
|
74
41
|
}
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
dict[attrs.config_code] = attrs.value || attrs.config_value
|
|
83
|
-
}
|
|
84
|
-
return dict
|
|
85
|
-
}, {})
|
|
86
|
-
return dict
|
|
42
|
+
|
|
43
|
+
export const getBinaryNodeChildUInt = (node, childTag, length) => {
|
|
44
|
+
const buff = getBinaryNodeChildBuffer(node, childTag)
|
|
45
|
+
if (buff) {
|
|
46
|
+
return bufferToUInt(buff, length)
|
|
47
|
+
}
|
|
87
48
|
}
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
msgs.push(index_js_1.proto.WebMessageInfo.decode(item.content).toJSON())
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return msgs
|
|
49
|
+
|
|
50
|
+
export const assertNodeErrorFree = (node) => {
|
|
51
|
+
const errNode = getBinaryNodeChild(node, 'error')
|
|
52
|
+
if (errNode) {
|
|
53
|
+
throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code })
|
|
54
|
+
}
|
|
99
55
|
}
|
|
100
|
-
exports.getBinaryNodeMessages = getBinaryNodeMessages
|
|
101
56
|
|
|
102
|
-
const
|
|
103
|
-
|
|
57
|
+
export const reduceBinaryNodeToDictionary = (node, tag) => {
|
|
58
|
+
const nodes = getBinaryNodeChildren(node, tag)
|
|
59
|
+
const dict = nodes.reduce((dict, { attrs }) => {
|
|
60
|
+
dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value
|
|
61
|
+
return dict
|
|
62
|
+
}, {})
|
|
63
|
+
return dict
|
|
64
|
+
}
|
|
104
65
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
66
|
+
export const getBinaryNodeMessages = ({ content }) => {
|
|
67
|
+
const msgs = []
|
|
68
|
+
if (Array.isArray(content)) {
|
|
69
|
+
for (const item of content) {
|
|
70
|
+
if (item.tag === 'message') {
|
|
71
|
+
msgs.push(proto.WebMessageInfo.decode(item.content))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return msgs
|
|
111
76
|
}
|
|
112
|
-
exports.getBinaryFilteredButtons = getBinaryFilteredButtons
|
|
113
|
-
const getBinaryFilteredBizBot = nodeContent => {
|
|
114
|
-
if (!Array.isArray(nodeContent)) return false
|
|
115
77
|
|
|
116
|
-
|
|
78
|
+
function bufferToUInt(e, t) {
|
|
79
|
+
let a = 0;
|
|
80
|
+
for (let i = 0; i < t; i++) {
|
|
81
|
+
a = 256 * a + e[i];
|
|
82
|
+
}
|
|
83
|
+
return a;
|
|
117
84
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (order_response_name[name]) {
|
|
142
|
-
return [
|
|
143
|
-
{
|
|
144
|
-
tag: 'biz',
|
|
145
|
-
attrs: {
|
|
146
|
-
native_flow_name: order_response_name[name]
|
|
147
|
-
},
|
|
148
|
-
content: []
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
} else if (flow_name[name] || name === 'interactive' || name === 'buttons') {
|
|
152
|
-
return [
|
|
153
|
-
{
|
|
154
|
-
tag: 'biz',
|
|
155
|
-
attrs: {
|
|
156
|
-
actual_actors: '2',
|
|
157
|
-
host_storage: '2',
|
|
158
|
-
privacy_mode_ts: `${ts}`
|
|
159
|
-
},
|
|
160
|
-
content: [
|
|
161
|
-
{
|
|
162
|
-
tag: 'engagement',
|
|
163
|
-
attrs: {
|
|
164
|
-
customer_service_state: 'open',
|
|
165
|
-
conversation_state: 'open'
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
tag: 'interactive',
|
|
170
|
-
attrs: {
|
|
171
|
-
type: 'native_flow',
|
|
172
|
-
v: '1'
|
|
173
|
-
},
|
|
174
|
-
content: [
|
|
175
|
-
{
|
|
176
|
-
tag: 'native_flow',
|
|
177
|
-
attrs: {
|
|
178
|
-
v: '9',
|
|
179
|
-
name: flow_name[name] ?? 'mixed'
|
|
180
|
-
},
|
|
181
|
-
content: []
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
} else {
|
|
189
|
-
return [
|
|
190
|
-
{
|
|
191
|
-
tag: 'biz',
|
|
192
|
-
attrs: {
|
|
193
|
-
actual_actors: '2',
|
|
194
|
-
host_storage: '2',
|
|
195
|
-
privacy_mode_ts: `${ts}`
|
|
196
|
-
},
|
|
197
|
-
content: [
|
|
198
|
-
{
|
|
199
|
-
tag: 'engagement',
|
|
200
|
-
attrs: {
|
|
201
|
-
customer_service_state: 'open',
|
|
202
|
-
conversation_state: 'open'
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
}
|
|
85
|
+
|
|
86
|
+
const tabs = (n) => '\t'.repeat(n)
|
|
87
|
+
|
|
88
|
+
export function binaryNodeToString(node, i = 0) {
|
|
89
|
+
if (!node) {
|
|
90
|
+
return node;
|
|
91
|
+
}
|
|
92
|
+
if (typeof node === 'string') {
|
|
93
|
+
return tabs(i) + node;
|
|
94
|
+
}
|
|
95
|
+
if (node instanceof Uint8Array) {
|
|
96
|
+
return tabs(i) + Buffer.from(node).toString('hex');
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(node)) {
|
|
99
|
+
return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
100
|
+
}
|
|
101
|
+
const children = binaryNodeToString(node.content, i + 1);
|
|
102
|
+
const tag = `<${node.tag} ${Object.entries(node.attrs || {})
|
|
103
|
+
.filter(([, v]) => v!== undefined)
|
|
104
|
+
.map(([k, v]) => `${k}='${v}'`)
|
|
105
|
+
.join(' ')}`;
|
|
106
|
+
const content = children? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
|
|
107
|
+
return tag + content;
|
|
209
108
|
}
|
|
210
|
-
exports.getAdditionalNode = getAdditionalNode
|
|
211
109
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
110
|
+
export const getBinaryNodeFilter = (node) => {
|
|
111
|
+
if (!Array.isArray(node)) return false
|
|
112
|
+
|
|
113
|
+
return node.some(item =>
|
|
114
|
+
['native_flow'].includes(item?.content?.[0]?.content?.[0]?.tag) ||
|
|
115
|
+
['interactive', 'buttons', 'list'].includes(item?.content?.[0]?.tag) ||
|
|
116
|
+
['hsm', 'biz'].includes(item?.tag) ||
|
|
117
|
+
['bot'].includes(item?.tag) && item?.attrs?.biz_bot === '1'
|
|
118
|
+
)
|
|
218
119
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
120
|
+
|
|
121
|
+
export const getAdditionalNode = (name) => {
|
|
122
|
+
if (name) name = name.toLowerCase()
|
|
123
|
+
const ts = unixTimestampSeconds(new Date()) - 77980457
|
|
124
|
+
|
|
125
|
+
const order_response_name = {
|
|
126
|
+
review_and_pay: 'order_details',
|
|
127
|
+
review_order: 'order_status',
|
|
128
|
+
order_status: 'order_status',
|
|
129
|
+
payment_info: 'payment_info',
|
|
130
|
+
payment_status: 'payment_status',
|
|
131
|
+
payment_method: 'payment_method',
|
|
132
|
+
catalog_message: 'catalog_message',
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const flow_name = {
|
|
136
|
+
cta_catalog: 'cta_catalog',
|
|
137
|
+
mpm: 'mpm',
|
|
138
|
+
call_request: 'call_permission_request',
|
|
139
|
+
view_catalog: 'automated_greeting_message_view_catalog',
|
|
140
|
+
wa_pay_detail: 'wa_payment_transaction_details',
|
|
141
|
+
send_location: 'send_location',
|
|
142
|
+
payment_key_info: 'payment_key_info'
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if(order_response_name[name]) {
|
|
146
|
+
return [{
|
|
147
|
+
tag: 'biz',
|
|
148
|
+
attrs: {
|
|
149
|
+
native_flow_name: order_response_name[name]
|
|
150
|
+
},
|
|
151
|
+
content: []
|
|
152
|
+
}]
|
|
153
|
+
} else if (flow_name[name] || name === 'interactive' || name === 'buttons') {
|
|
154
|
+
return [{
|
|
155
|
+
tag: 'biz',
|
|
156
|
+
attrs: {
|
|
157
|
+
actual_actors: '2',
|
|
158
|
+
host_storage: '2',
|
|
159
|
+
privacy_mode_ts: `${ts}`
|
|
160
|
+
},
|
|
161
|
+
content: [{
|
|
162
|
+
tag: 'engagement',
|
|
163
|
+
attrs: {
|
|
164
|
+
customer_service_state: 'open',
|
|
165
|
+
conversation_state: 'open'
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
tag: 'interactive',
|
|
169
|
+
attrs: {
|
|
170
|
+
type: 'native_flow',
|
|
171
|
+
v: '1'
|
|
172
|
+
},
|
|
173
|
+
content: [{
|
|
174
|
+
tag: 'native_flow',
|
|
175
|
+
attrs: {
|
|
176
|
+
v: '9',
|
|
177
|
+
name: flow_name[name]?? 'mixed',
|
|
178
|
+
},
|
|
179
|
+
content: []
|
|
180
|
+
}]
|
|
181
|
+
}]
|
|
182
|
+
}]
|
|
183
|
+
} else {
|
|
184
|
+
return [{
|
|
185
|
+
tag: 'biz',
|
|
186
|
+
attrs: {
|
|
187
|
+
actual_actors: '2',
|
|
188
|
+
host_storage: '2',
|
|
189
|
+
privacy_mode_ts: `${ts}`
|
|
190
|
+
},
|
|
191
|
+
content: [{
|
|
192
|
+
tag: 'engagement',
|
|
193
|
+
attrs: {
|
|
194
|
+
customer_service_state: 'open',
|
|
195
|
+
conversation_state: 'open'
|
|
196
|
+
}
|
|
197
|
+
}]
|
|
198
|
+
}]
|
|
199
|
+
}
|
|
240
200
|
}
|
|
201
|
+
export const getBinaryFilteredBizBot = nodeContent => {
|
|
202
|
+
if (!Array.isArray(nodeContent)) return false
|
|
203
|
+
return nodeContent.some(b => ['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1')
|
|
204
|
+
}
|
package/lib/WABinary/index.js
CHANGED
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
8
|
-
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return m[k]
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc)
|
|
17
|
-
}
|
|
18
|
-
: function (o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k
|
|
20
|
-
o[k2] = m[k]
|
|
21
|
-
})
|
|
22
|
-
var __exportStar =
|
|
23
|
-
(this && this.__exportStar) ||
|
|
24
|
-
function (m, exports) {
|
|
25
|
-
for (var p in m)
|
|
26
|
-
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
|
|
27
|
-
}
|
|
28
|
-
Object.defineProperty(exports, '__esModule', { value: true })
|
|
29
|
-
__exportStar(require('./encode'), exports)
|
|
30
|
-
__exportStar(require('./decode'), exports)
|
|
31
|
-
__exportStar(require('./generic-utils'), exports)
|
|
32
|
-
__exportStar(require('./jid-utils'), exports)
|
|
33
|
-
__exportStar(require('./types'), exports)
|
|
1
|
+
export * from './encode.js';
|
|
2
|
+
export * from './decode.js';
|
|
3
|
+
export * from './generic-utils.js';
|
|
4
|
+
export * from './jid-utils.js';
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|