supun-bailey-vip 1.0.3 → 1.0.4
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 +105 -0
- package/lib/Defaults/index.js +1 -0
- package/lib/MessageBuilder/bot-signature.js +1 -1
- package/lib/MessageBuilder/extras.js +1 -1
- package/lib/MessageBuilder/metaai.js +1 -1
- package/lib/Socket/messages-send.js +3 -106
- package/lib/Types/Message.js +3 -0
- package/lib/Utils/auth-store.d.ts +1 -1
- package/lib/Utils/auth-store.js +1 -1
- package/lib/Utils/group-metadata-cache.d.ts +1 -1
- package/lib/Utils/group-metadata-cache.js +1 -1
- package/lib/Utils/html-app.js +1 -1
- package/lib/Utils/html-multiplayer.js +1 -1
- package/lib/Utils/link-preview-metadata.js +1 -1
- package/lib/Utils/messages.js +94 -3
- package/lib/Utils/native-flow.js +1 -1
- package/lib/Utils/offline-node-processor.js +1 -1
- package/lib/Utils/optional-media.js +1 -1
- package/lib/Utils/payment-messages.js +1 -1
- package/lib/Utils/pre-key-manager.d.ts +1 -1
- package/lib/Utils/pre-key-manager.js +1 -1
- package/lib/Utils/scheduled-message.js +1 -1
- package/lib/Utils/sender-key-memory.d.ts +1 -1
- package/lib/Utils/sender-key-memory.js +1 -1
- package/lib/Utils/status-stickers.js +1 -1
- package/lib/Utils/sync-action-utils.d.ts +1 -1
- package/lib/Utils/sync-action-utils.js +1 -1
- package/lib/Utils/ttl-cache.d.ts +1 -1
- package/lib/Utils/ttl-cache.js +2 -2
- package/lib/Utils/use-mongo-auth-state.d.ts +1 -1
- package/lib/Utils/use-mongo-auth-state.js +1 -1
- package/lib/Utils/use-mysql-auth-state.d.ts +1 -1
- package/lib/Utils/use-mysql-auth-state.js +1 -1
- package/lib/Utils/use-postgres-auth-state.d.ts +1 -1
- package/lib/Utils/use-postgres-auth-state.js +1 -1
- package/lib/Utils/use-redis-auth-state.d.ts +1 -1
- package/lib/Utils/use-redis-auth-state.js +1 -1
- package/lib/Utils/use-single-file-auth-state.d.ts +1 -1
- package/lib/Utils/use-single-file-auth-state.js +1 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +1 -1
- package/lib/Utils/use-sqlite-auth-state.js +1 -1
- package/lib/Utils/useNekoDBAuth.js +1 -1
- package/lib/Voip/audio-feeder.d.ts +1 -1
- package/lib/Voip/audio-feeder.js +1 -1
- package/lib/Voip/index.d.ts +1 -1
- package/lib/Voip/index.js +1 -1
- package/lib/Voip/relay-transport.d.ts +1 -1
- package/lib/Voip/relay-transport.js +1 -1
- package/lib/Voip/signaling.d.ts +1 -1
- package/lib/Voip/signaling.js +2 -2
- package/lib/Voip/types.d.ts +1 -1
- package/lib/Voip/types.js +1 -1
- package/lib/Voip/video-feeder.d.ts +1 -1
- package/lib/Voip/video-feeder.js +1 -1
- package/lib/Voip/wasm-engine.d.ts +1 -1
- package/lib/Voip/wasm-engine.js +2 -2
- package/lib/Voip/worker-bootstrap.js +2 -2
- package/lib/WABinary/generic-utils.js +106 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -651,6 +651,111 @@ carousel.addCard({
|
|
|
651
651
|
await sock.sendMessage(jid, carousel.run())
|
|
652
652
|
```
|
|
653
653
|
|
|
654
|
+
### 🔘 Direct Buttons & Native Flow in `sendMessage`
|
|
655
|
+
|
|
656
|
+
You can also send buttons and interactive messages directly without builders:
|
|
657
|
+
|
|
658
|
+
```javascript
|
|
659
|
+
// 1. Buttons with Media & Single Select
|
|
660
|
+
await sock.sendMessage(jid, {
|
|
661
|
+
image: { url: 'https://example.com/banner.jpg' },
|
|
662
|
+
caption: '👆 Buttons with Native Flow!',
|
|
663
|
+
footer: 'Powered by supun-bailey-vip',
|
|
664
|
+
buttons: [
|
|
665
|
+
{ text: '👋 Rating', id: '#rating' },
|
|
666
|
+
{
|
|
667
|
+
text: '📋 Select Option',
|
|
668
|
+
sections: [
|
|
669
|
+
{
|
|
670
|
+
title: 'Section 1',
|
|
671
|
+
rows: [{ title: 'Feature A', id: '#feat_a', description: 'Explore Feature A' }]
|
|
672
|
+
}
|
|
673
|
+
]
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
// 2. Full Native Flow with Offers & Bottom Sheet
|
|
679
|
+
await sock.sendMessage(jid, {
|
|
680
|
+
text: 'Interactive Menu with Options',
|
|
681
|
+
footer: 'supun-bailey-vip',
|
|
682
|
+
optionText: '👉 Select Options', // Bottom sheet dropdown list
|
|
683
|
+
optionTitle: '📄 Options List',
|
|
684
|
+
offerText: '🏷️ Exclusive Promo Code!', // Limited-time offer card
|
|
685
|
+
offerCode: 'SUPUN2026',
|
|
686
|
+
offerUrl: 'https://supunofc.site',
|
|
687
|
+
offerExpiration: Date.now() + 3600000,
|
|
688
|
+
nativeFlow: [
|
|
689
|
+
{ text: '👋 Quick Reply', id: '#reply', icon: 'review' },
|
|
690
|
+
{ text: '📞 Call Us', call: '+94712345678' },
|
|
691
|
+
{ text: '📋 Copy Code', copy: 'SUPUN2026' },
|
|
692
|
+
{ text: '🌐 Website', url: 'https://supunofc.site', useWebview: true },
|
|
693
|
+
{ text: '📍 Send Location', sendLocation: true },
|
|
694
|
+
{
|
|
695
|
+
text: '📋 Menu Options',
|
|
696
|
+
sections: [
|
|
697
|
+
{ title: 'Categories', rows: [{ title: 'Category 1', id: '#cat1' }] }
|
|
698
|
+
]
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
interactiveAsTemplate: false // set true to wrap into template
|
|
702
|
+
})
|
|
703
|
+
|
|
704
|
+
// 3. Carousel Cards directly in sendMessage
|
|
705
|
+
await sock.sendMessage(jid, {
|
|
706
|
+
text: 'Featured Product Cards',
|
|
707
|
+
footer: 'Swipe cards to view',
|
|
708
|
+
cards: [
|
|
709
|
+
{
|
|
710
|
+
image: { url: 'https://example.com/item1.jpg' },
|
|
711
|
+
caption: 'Smart Watch Series 9',
|
|
712
|
+
footer: 'In Stock',
|
|
713
|
+
nativeFlow: [
|
|
714
|
+
{ text: '🛒 Buy Now', id: '#buy_1' },
|
|
715
|
+
{ text: '🌐 Specs', url: 'https://supunofc.site' }
|
|
716
|
+
]
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
image: { url: 'https://example.com/item2.jpg' },
|
|
720
|
+
caption: 'Wireless Earbuds',
|
|
721
|
+
footer: 'Best Seller',
|
|
722
|
+
nativeFlow: [
|
|
723
|
+
{ text: '🛒 Buy Now', id: '#buy_2' }
|
|
724
|
+
]
|
|
725
|
+
}
|
|
726
|
+
]
|
|
727
|
+
})
|
|
728
|
+
|
|
729
|
+
// 4. Hydrated Template Buttons
|
|
730
|
+
await sock.sendMessage(jid, {
|
|
731
|
+
text: 'Template Message with Action Buttons',
|
|
732
|
+
footer: 'supun-bailey-vip',
|
|
733
|
+
templateButtons: [
|
|
734
|
+
{ text: '👉 Quick Action', id: '#action' },
|
|
735
|
+
{ text: '🌐 Visit Website', url: 'https://supunofc.site' },
|
|
736
|
+
{ text: '📞 Call Support', call: '+94712345678' }
|
|
737
|
+
]
|
|
738
|
+
})
|
|
739
|
+
|
|
740
|
+
// 5. Native Flow & Button Responses
|
|
741
|
+
// Responding to a Flow
|
|
742
|
+
await sock.sendMessage(jid, {
|
|
743
|
+
flowReply: {
|
|
744
|
+
name: 'flow_name',
|
|
745
|
+
paramsJson: JSON.stringify({ key: 'value' })
|
|
746
|
+
}
|
|
747
|
+
})
|
|
748
|
+
|
|
749
|
+
// Responding to a Button
|
|
750
|
+
await sock.sendMessage(jid, {
|
|
751
|
+
buttonReply: {
|
|
752
|
+
displayText: 'Selected Option',
|
|
753
|
+
id: '#action'
|
|
754
|
+
},
|
|
755
|
+
type: 'plain' // or 'template'
|
|
756
|
+
})
|
|
757
|
+
```
|
|
758
|
+
|
|
654
759
|
---
|
|
655
760
|
|
|
656
761
|
## ☁️ Dugong Cloud Engine (`sock.cloud`)
|
package/lib/Defaults/index.js
CHANGED
|
@@ -45,6 +45,7 @@ export const DEFAULT_CACHE_TTLS = {
|
|
|
45
45
|
CALL_OFFER: 5 * 60, // 5 minutes
|
|
46
46
|
USER_DEVICES: 5 * 60 // 5 minutes
|
|
47
47
|
};
|
|
48
|
+
export const DEFAULT_CACHE_MAX_KEYS = 1000;
|
|
48
49
|
export const DEFAULT_CONNECTION_CONFIG = {
|
|
49
50
|
version: version,
|
|
50
51
|
browser: Browsers.macOS('Chrome'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { X509Certificate, verify as cryptoVerify } from 'crypto'
|
|
3
3
|
|
|
4
4
|
export const BOT_SIGNATURE_VERSION = '1'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { randomUUID } from 'crypto'
|
|
3
3
|
import { AIRich } from './index.js'
|
|
4
4
|
import { extractMessageContent, generateWAMessageFromContent, prepareWAMessageMedia } from '../Utils/messages.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { AIRich } from './index.js'
|
|
3
3
|
import { AddonActionType } from './extras.js'
|
|
4
4
|
import { generateWAMessageFromContent } from '../Utils/messages.js'
|
|
@@ -8,7 +8,7 @@ import { getUrlInfo } from '../Utils/link-preview.js';
|
|
|
8
8
|
import { makeKeyedMutex, makeMutex } from '../Utils/make-mutex.js';
|
|
9
9
|
import { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils.js';
|
|
10
10
|
import { buildMergedTcTokenIndexWrite, isTcTokenExpired, resolveIssuanceJid, resolveTcTokenJid, shouldSendNewTcToken, storeTcTokensFromIqResult } from '../Utils/tc-token-utils.js';
|
|
11
|
-
import { areJidsSameUser, getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidBot, isJidGroup, isJidNewsletter, isJidMetaAI, isLidUser, isPnUser, jidDecode, jidEncode, jidNormalizedUser, PSA_WID, S_WHATSAPP_NET, getAdditionalNode, getBinaryNodeFilter, getBinaryFilteredBizBot, isInteropUser } from '../WABinary/index.js';
|
|
11
|
+
import { areJidsSameUser, getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidBot, isJidGroup, isJidNewsletter, isJidMetaAI, isLidUser, isPnUser, jidDecode, jidEncode, jidNormalizedUser, PSA_WID, S_WHATSAPP_NET, getAdditionalNode, getBinaryNodeFilter, getBinaryFilteredBizBot, isInteropUser, getBizBinaryNode } from '../WABinary/index.js';
|
|
12
12
|
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
13
13
|
import { makeUsernameSocket } from './username.js';
|
|
14
14
|
import imup from './luxu.js';
|
|
@@ -1029,111 +1029,8 @@ export const makeMessagesSocket = (config) => {
|
|
|
1029
1029
|
};
|
|
1030
1030
|
const getButtonArgs = (message) => {
|
|
1031
1031
|
if (!message) return undefined;
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
const nativeFlowSpecials = [
|
|
1035
|
-
'mpm',
|
|
1036
|
-
'cta_catalog',
|
|
1037
|
-
'send_location',
|
|
1038
|
-
'call_permission_request',
|
|
1039
|
-
'wa_payment_transaction_details',
|
|
1040
|
-
'automated_greeting_message_view_catalog'
|
|
1041
|
-
];
|
|
1042
|
-
|
|
1043
|
-
const qualityContent = {
|
|
1044
|
-
tag: 'quality_control',
|
|
1045
|
-
attrs: {
|
|
1046
|
-
decision_id: randomBytes(20).toString('hex'),
|
|
1047
|
-
source_type: 'third_party'
|
|
1048
|
-
},
|
|
1049
|
-
content: [{ tag: 'decision_source', attrs: { value: 'df' } }]
|
|
1050
|
-
};
|
|
1051
|
-
const bizAttributes = {
|
|
1052
|
-
actual_actors: '2',
|
|
1053
|
-
host_storage: '2',
|
|
1054
|
-
privacy_mode_ts: Utils_1.unixTimestampSeconds().toString()
|
|
1055
|
-
};
|
|
1056
|
-
|
|
1057
|
-
if (nativeFlow && (firstButtonName === 'review_and_pay' || firstButtonName === 'payment_info')) {
|
|
1058
|
-
bizAttributes.native_flow_name = firstButtonName === 'review_and_pay' ? 'order_details' : firstButtonName;
|
|
1059
|
-
return {
|
|
1060
|
-
tag: 'biz',
|
|
1061
|
-
attrs: bizAttributes,
|
|
1062
|
-
content: [qualityContent]
|
|
1063
|
-
};
|
|
1064
|
-
} else if (nativeFlow && nativeFlowSpecials.includes(firstButtonName)) {
|
|
1065
|
-
// Only works for WhatsApp Original, not WhatsApp Business
|
|
1066
|
-
return {
|
|
1067
|
-
tag: 'biz',
|
|
1068
|
-
attrs: bizAttributes,
|
|
1069
|
-
content: [
|
|
1070
|
-
{
|
|
1071
|
-
tag: 'interactive',
|
|
1072
|
-
attrs: {
|
|
1073
|
-
type: 'native_flow',
|
|
1074
|
-
v: '1'
|
|
1075
|
-
},
|
|
1076
|
-
content: [
|
|
1077
|
-
{
|
|
1078
|
-
tag: 'native_flow',
|
|
1079
|
-
attrs: {
|
|
1080
|
-
v: '2',
|
|
1081
|
-
name: firstButtonName
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
]
|
|
1085
|
-
},
|
|
1086
|
-
qualityContent
|
|
1087
|
-
]
|
|
1088
|
-
};
|
|
1089
|
-
} else if (nativeFlow || message.interactiveMessage?.carouselMessage || message.interactiveMessage || message.buttonsMessage || message.templateMessage) {
|
|
1090
|
-
// It works for whatsapp original and whatsapp business
|
|
1091
|
-
return {
|
|
1092
|
-
tag: 'biz',
|
|
1093
|
-
attrs: bizAttributes,
|
|
1094
|
-
content: [
|
|
1095
|
-
{
|
|
1096
|
-
tag: 'interactive',
|
|
1097
|
-
attrs: {
|
|
1098
|
-
type: 'native_flow',
|
|
1099
|
-
v: '1'
|
|
1100
|
-
},
|
|
1101
|
-
content: [
|
|
1102
|
-
{
|
|
1103
|
-
tag: 'native_flow',
|
|
1104
|
-
attrs: {
|
|
1105
|
-
v: '9',
|
|
1106
|
-
name: 'mixed'
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
]
|
|
1110
|
-
},
|
|
1111
|
-
qualityContent
|
|
1112
|
-
]
|
|
1113
|
-
};
|
|
1114
|
-
} else if (message.listMessage) {
|
|
1115
|
-
return {
|
|
1116
|
-
tag: 'biz',
|
|
1117
|
-
attrs: bizAttributes,
|
|
1118
|
-
content: [
|
|
1119
|
-
{
|
|
1120
|
-
tag: 'list',
|
|
1121
|
-
attrs: {
|
|
1122
|
-
v: '2',
|
|
1123
|
-
type: 'product_list'
|
|
1124
|
-
}
|
|
1125
|
-
},
|
|
1126
|
-
qualityContent
|
|
1127
|
-
]
|
|
1128
|
-
};
|
|
1129
|
-
} else {
|
|
1130
|
-
return {
|
|
1131
|
-
tag: 'biz',
|
|
1132
|
-
attrs: bizAttributes,
|
|
1133
|
-
content: [qualityContent]
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1032
|
+
return getBizBinaryNode(message);
|
|
1033
|
+
};
|
|
1137
1034
|
const issuePrivacyTokens = async (jids, timestamp) => {
|
|
1138
1035
|
const t = (timestamp ?? unixTimestampSeconds()).toString();
|
|
1139
1036
|
const result = await query({
|
package/lib/Types/Message.js
CHANGED
|
@@ -3,6 +3,9 @@ import { proto } from '../../WAProto/index.js';
|
|
|
3
3
|
export { proto as WAProto };
|
|
4
4
|
export const WAMessageStubType = proto.WebMessageInfo.StubType;
|
|
5
5
|
export const WAMessageStatus = proto.WebMessageInfo.Status;
|
|
6
|
+
export const ButtonHeaderType = proto.Message.ButtonsMessage?.HeaderType || {};
|
|
7
|
+
export const ButtonType = proto.Message.ButtonsMessage?.Button?.Type || {};
|
|
8
|
+
export const ListType = proto.Message.ListMessage?.ListType || {};
|
|
6
9
|
export var WAMessageAddressingMode;
|
|
7
10
|
(function (WAMessageAddressingMode) {
|
|
8
11
|
WAMessageAddressingMode["PN"] = "pn";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export const CREDS_KEY: string;
|
|
3
3
|
export function encodeAuthValue(value: any): string;
|
|
4
4
|
export function decodeAuthValue(type: string, raw: any): any;
|
package/lib/Utils/auth-store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { proto } from '../../WAProto/index.js';
|
|
3
3
|
import { initAuthCreds } from './auth-utils.js';
|
|
4
4
|
import { BufferJSON } from './generics.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export declare const GROUP_ADDRESSING_MODES: readonly string[]
|
|
4
4
|
export declare function isUsableGroupMetadata(metadata: any): boolean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export const GROUP_ADDRESSING_MODES = Object.freeze(['pn', 'lid'])
|
|
4
4
|
|
package/lib/Utils/html-app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export const HTML_APP_MESSAGE_CEILING = 1024 * 1024;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
const escapeForScript = (value) => JSON.stringify(value).replace(/</g, '\\u003c').replace(/>/g, '\\u003e');
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export const SocialMediaPostType = Object.freeze({
|
|
4
4
|
NONE: 0,
|
package/lib/Utils/messages.js
CHANGED
|
@@ -683,6 +683,58 @@ export const prepareNativeFlowButtons = (message, options) => {
|
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
+
if (button.sendLocation || button.name === 'send_location') {
|
|
687
|
+
return {
|
|
688
|
+
name: 'send_location',
|
|
689
|
+
buttonParamsJson: '{}'
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
if (button.reminder || button.name === 'cta_reminder') {
|
|
694
|
+
return {
|
|
695
|
+
name: 'cta_reminder',
|
|
696
|
+
buttonParamsJson: typeof button.reminder === 'string'
|
|
697
|
+
? button.reminder
|
|
698
|
+
: JSON.stringify(button.reminder || {})
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (button.cancelReminder || button.name === 'cta_cancel_reminder') {
|
|
703
|
+
return {
|
|
704
|
+
name: 'cta_cancel_reminder',
|
|
705
|
+
buttonParamsJson: typeof button.cancelReminder === 'string'
|
|
706
|
+
? button.cancelReminder
|
|
707
|
+
: JSON.stringify(button.cancelReminder || {})
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
if (button.webview || button.name === 'open_webview') {
|
|
712
|
+
return {
|
|
713
|
+
name: 'open_webview',
|
|
714
|
+
buttonParamsJson: typeof button.webview === 'string'
|
|
715
|
+
? button.webview
|
|
716
|
+
: JSON.stringify(button.webview || {})
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (button.address || button.name === 'address_message') {
|
|
721
|
+
return {
|
|
722
|
+
name: 'address_message',
|
|
723
|
+
buttonParamsJson: typeof button.address === 'string'
|
|
724
|
+
? button.address
|
|
725
|
+
: JSON.stringify(button.address || {})
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
if (button.catalog || button.name === 'cta_catalog') {
|
|
730
|
+
return {
|
|
731
|
+
name: 'cta_catalog',
|
|
732
|
+
buttonParamsJson: typeof button.catalog === 'string'
|
|
733
|
+
? button.catalog
|
|
734
|
+
: JSON.stringify(button.catalog || {})
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
686
738
|
if (button.name) {
|
|
687
739
|
return {
|
|
688
740
|
name: button.name,
|
|
@@ -795,7 +847,17 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
795
847
|
interactiveMessage.footer = { text: message.footer };
|
|
796
848
|
}
|
|
797
849
|
applyContextInfoAndMentions(interactiveMessage, message);
|
|
798
|
-
|
|
850
|
+
if (hasOptionalProperty(message, 'interactiveAsTemplate') && !!message.interactiveAsTemplate) {
|
|
851
|
+
m = {
|
|
852
|
+
templateMessage: {
|
|
853
|
+
interactiveMessageTemplate: interactiveMessage,
|
|
854
|
+
templateId: message.id || 'template-' + Date.now()
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
delete message.interactiveAsTemplate;
|
|
858
|
+
} else {
|
|
859
|
+
m = { interactiveMessage };
|
|
860
|
+
}
|
|
799
861
|
}
|
|
800
862
|
else if (hasNonNullishProperty(message, 'nativeFlow') || hasNonNullishProperty(message, 'interactiveButtons') || (hasNonNullishProperty(message, 'buttons') && !message.legacyButtons)) {
|
|
801
863
|
const interactiveMessage = {
|
|
@@ -876,7 +938,17 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
876
938
|
}
|
|
877
939
|
|
|
878
940
|
applyContextInfoAndMentions(interactiveMessage, message);
|
|
879
|
-
|
|
941
|
+
if (hasOptionalProperty(message, 'interactiveAsTemplate') && !!message.interactiveAsTemplate) {
|
|
942
|
+
m = {
|
|
943
|
+
templateMessage: {
|
|
944
|
+
interactiveMessageTemplate: interactiveMessage,
|
|
945
|
+
templateId: message.id || 'template-' + Date.now()
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
delete message.interactiveAsTemplate;
|
|
949
|
+
} else {
|
|
950
|
+
m = { interactiveMessage };
|
|
951
|
+
}
|
|
880
952
|
}
|
|
881
953
|
else if (hasNonNullishProperty(message, 'templateButtons')) {
|
|
882
954
|
const hydratedTemplate = {
|
|
@@ -1291,6 +1363,17 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1291
1363
|
break;
|
|
1292
1364
|
}
|
|
1293
1365
|
}
|
|
1366
|
+
else if (hasNonNullishProperty(message, 'flowReply')) {
|
|
1367
|
+
m = {
|
|
1368
|
+
nativeFlowResponseMessage: {
|
|
1369
|
+
name: message.flowReply.name,
|
|
1370
|
+
paramsJson: typeof message.flowReply.paramsJson === 'string'
|
|
1371
|
+
? message.flowReply.paramsJson
|
|
1372
|
+
: JSON.stringify(message.flowReply.paramsJson || {}),
|
|
1373
|
+
version: message.flowReply.version || 1
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1294
1377
|
else if (hasOptionalProperty(message, 'ptv') && message.ptv) {
|
|
1295
1378
|
const { videoMessage } = await prepareWAMessageMedia({ video: message.ptv }, options);
|
|
1296
1379
|
m.ptvMessage = videoMessage;
|
|
@@ -1299,7 +1382,15 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1299
1382
|
m.productMessage = await prepareProductMessage(message, options);
|
|
1300
1383
|
}
|
|
1301
1384
|
else if (hasNonNullishProperty(message, 'listReply')) {
|
|
1302
|
-
m.listResponseMessage = {
|
|
1385
|
+
m.listResponseMessage = {
|
|
1386
|
+
description: message.listReply.description,
|
|
1387
|
+
title: message.listReply.title,
|
|
1388
|
+
listType: proto.Message.ListResponseMessage?.ListType?.SINGLE_SELECT ?? 1,
|
|
1389
|
+
singleSelectReply: {
|
|
1390
|
+
selectedRowId: message.listReply.id || message.listReply.selectedRowId
|
|
1391
|
+
},
|
|
1392
|
+
...message.listReply
|
|
1393
|
+
};
|
|
1303
1394
|
}
|
|
1304
1395
|
else if (hasNonNullishProperty(message, 'event')) {
|
|
1305
1396
|
m.eventMessage = {};
|
package/lib/Utils/native-flow.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export const NATIVE_FLOW_NAMES = Object.freeze([
|
|
3
3
|
'booking_confirmation',
|
|
4
4
|
'order_details',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export function makeOfflineNodeProcessor(nodeProcessorMap, deps, batchSize = 10) {
|
|
4
4
|
const nodes = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
const cache = new Map()
|
|
3
3
|
|
|
4
4
|
const MESSAGES = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export const SplitPaymentStatus = Object.freeze({ PENDING: 0, PAID: 1 })
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
/**
|
|
3
3
|
* Manages pre-key operations with proper concurrency control
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
3
|
|
|
4
4
|
export class PreKeyManager {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { createCipheriv, createDecipheriv, randomBytes, randomUUID } from 'crypto'
|
|
3
3
|
import { proto } from '../../WAProto/index.js'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export declare function pickSenderKeyRecipients(
|
|
4
4
|
devices: { jid?: string, device?: number }[],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
export const pickSenderKeyRecipients = (devices, senderKeyMap, { force = false, skip } = {}) => {
|
|
4
4
|
const recipients = []
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { proto } from '../../WAProto/index.js'
|
|
3
3
|
|
|
4
4
|
export const StatusLinkType = Object.freeze({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export function processContactAction(action: any, id: any, logger: any): any[];
|
|
3
3
|
export function emitSyncActionResults(ev: any, results: any): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { isLidUser, isPnUser } from '../WABinary/index.js';
|
|
3
3
|
|
|
4
4
|
export const processContactAction = (action, id, logger) => {
|
package/lib/Utils/ttl-cache.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare class TTLCache<T = any> {
|
|
3
3
|
constructor(options?: {
|
|
4
4
|
/** lifetime in seconds, the same unit node-cache used; 0 or omitted means no expiry */
|
package/lib/Utils/ttl-cache.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. */
|
|
2
2
|
import { LRUCache } from 'lru-cache';
|
|
3
3
|
import { DEFAULT_CACHE_MAX_KEYS } from '../Defaults/index.js';
|
|
4
4
|
|
|
@@ -22,7 +22,7 @@ export class TTLCache {
|
|
|
22
22
|
this.#ttl = ttl !== undefined ? Number(ttl) || 0 : toMilliseconds(stdTTL);
|
|
23
23
|
const limit = Number(max ?? maxKeys);
|
|
24
24
|
this.#store = new LRUCache({
|
|
25
|
-
max: Number.isFinite(limit) && limit > 0 ? limit : DEFAULT_CACHE_MAX_KEYS,
|
|
25
|
+
max: Number.isFinite(limit) && limit > 0 ? limit : (DEFAULT_CACHE_MAX_KEYS || 1000),
|
|
26
26
|
...(this.#ttl ? { ttl: this.#ttl } : {})
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export interface MongoAuthStateOptions {
|
|
3
3
|
collection?: any;
|
|
4
4
|
db?: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { loadOptionalModule, makeAuthStateFromStore } from './auth-store.js';
|
|
3
3
|
export async function useMongoAuthState(opts = {}) {
|
|
4
4
|
const session = opts.session ?? 'default';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export interface MySQLAuthStateOptions {
|
|
3
3
|
pool?: any;
|
|
4
4
|
uri?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { loadOptionalModule, makeAuthStateFromStore } from './auth-store.js';
|
|
3
3
|
const quoteIdentifier = (name) => {
|
|
4
4
|
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export interface PostgresAuthStateOptions {
|
|
3
3
|
pool?: any;
|
|
4
4
|
connectionString?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { loadOptionalModule, makeAuthStateFromStore } from './auth-store.js';
|
|
3
3
|
const quoteIdentifier = (name) => {
|
|
4
4
|
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export interface RedisAuthStateOptions {
|
|
3
3
|
client?: any;
|
|
4
4
|
uri?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { loadOptionalModule, makeAuthStateFromStore } from './auth-store.js';
|
|
3
3
|
const resolveCommand = (client, names) => {
|
|
4
4
|
for (const name of names) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export function useSingleFileAuthState(fileName: any): Promise<{
|
|
3
3
|
state: {
|
|
4
4
|
creds: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { readFile, rename, stat, writeFile } from 'fs/promises';
|
|
3
3
|
import { DEFAULT_CACHE_TTLS } from '../Defaults/index.js';
|
|
4
4
|
import { proto } from '../../WAProto/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export function useSqliteAuthState(opts: any): Promise<{
|
|
3
3
|
state: {
|
|
4
4
|
creds: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { proto } from '../../WAProto/index.js';
|
|
3
3
|
import { initAuthCreds } from './auth-utils.js';
|
|
4
4
|
import { BufferJSON } from './generics.js';
|
|
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js'
|
|
|
2
2
|
import { initAuthCreds } from './auth-utils.js'
|
|
3
3
|
import { BufferJSON } from './generics.js'
|
|
4
4
|
|
|
5
|
-
export async function useNekoDBAuth(db, collectionName = '
|
|
5
|
+
export async function useNekoDBAuth(db, collectionName = 'baileys_supun_auth') {
|
|
6
6
|
if (!db || typeof db.collection !== 'function') {
|
|
7
7
|
throw new Error(
|
|
8
8
|
'useNekoDBAuth: argumen pertama harus instance NekoDB yang terkoneksi'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare class AudioFeeder {
|
|
3
3
|
constructor(sampleRate: number, channels: number, framesPerChunk: number, onChunk: (chunk: Float32Array) => void, source?: string, hooks?: {
|
|
4
4
|
onTrackStart?: (track: string) => void;
|
package/lib/Voip/audio-feeder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
3
|
const PREBUFFER_CHUNKS = 12;
|
|
4
4
|
const REBUFFER_CHUNKS = 6;
|
package/lib/Voip/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
export declare const CallState: Readonly<{
|
|
4
4
|
Idle: 0;
|
package/lib/Voip/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import { createHmac, randomBytes } from 'node:crypto';
|
|
4
4
|
import { WasmEngine } from './wasm-engine.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare class RelayRtcTransport {
|
|
3
3
|
send(data: Uint8Array, ip: string, port: number): void;
|
|
4
4
|
closeAll(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { appendFileSync } from 'node:fs';
|
|
3
3
|
|
|
4
4
|
const RELAY_PROTO_UDP = 0;
|
package/lib/Voip/signaling.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare class SignalingBridge {
|
|
3
3
|
constructor(config: { sock: any; logger?: (...args: any[]) => void; debug?: boolean });
|
|
4
4
|
setSocket(socket: any): void;
|
package/lib/Voip/signaling.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
|
|
3
3
|
const S_WHATSAPP_NET = "@s.whatsapp.net";
|
|
4
4
|
const TC_TOKEN_REQUEST_TIMEOUT_MS = 15000;
|
|
@@ -13,7 +13,7 @@ const loadBaileys = async () => {
|
|
|
13
13
|
_baileysModule = await import("../index.js");
|
|
14
14
|
return _baileysModule;
|
|
15
15
|
} catch {
|
|
16
|
-
throw new Error("Could not import internal
|
|
16
|
+
throw new Error("Could not import internal supun-bailey-vip module.");
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
package/lib/Voip/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare const CallState: Readonly<Record<string, number>>;
|
|
3
3
|
export default CallState;
|
package/lib/Voip/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export const CallState = Object.freeze({
|
|
3
3
|
Idle: 0,
|
|
4
4
|
Calling: 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare const VIDEO_FORMAT_I420: number;
|
|
3
3
|
export declare class VideoFeeder {
|
|
4
4
|
constructor(width: number, height: number, fps: number, onFrame: (frame: Buffer, width: number, height: number, fps: number) => void, source?: string | null, hooks?: {
|
package/lib/Voip/video-feeder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
3
|
const PREBUFFER_FRAMES = 3;
|
|
4
4
|
const MAX_QUEUED_FRAMES = 90;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
export declare class WasmEngine {
|
|
3
3
|
constructor(config?: {
|
|
4
4
|
wasmPath?: string;
|
package/lib/Voip/wasm-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import * as vm from 'node:vm';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
@@ -244,7 +244,7 @@ export class WasmEngine {
|
|
|
244
244
|
...config,
|
|
245
245
|
storageDir: config.storageDir
|
|
246
246
|
? (path.isAbsolute(config.storageDir) ? config.storageDir : path.resolve(process.cwd(), config.storageDir))
|
|
247
|
-
: path.join(tmpdir(), "
|
|
247
|
+
: path.join(tmpdir(), "supun-voip"),
|
|
248
248
|
wasmPath,
|
|
249
249
|
resourcesPath: basePath,
|
|
250
250
|
enableLogs: config.enableLogs ?? true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* supun-bailey-vip maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
2
|
import * as worker_threads_1 from 'node:worker_threads';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import * as os from 'node:os';
|
|
@@ -519,7 +519,7 @@ class Sha256HMacBuilder {
|
|
|
519
519
|
}
|
|
520
520
|
const WAWebVoipPersistentFS = {
|
|
521
521
|
getVoipPersistentDirectoryPath: function () {
|
|
522
|
-
return typedWorkerData?.storageDir || path.join(os.tmpdir(), "
|
|
522
|
+
return typedWorkerData?.storageDir || path.join(os.tmpdir(), "supun-voip");
|
|
523
523
|
},
|
|
524
524
|
initPersistentFS: async function (_module) {
|
|
525
525
|
return Promise.resolve();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom'
|
|
2
|
+
import { randomBytes } from 'crypto'
|
|
2
3
|
import { proto } from '../../WAProto/index.js'
|
|
3
4
|
import { unixTimestampSeconds } from '../Utils/generics.js'
|
|
4
5
|
|
|
@@ -201,4 +202,108 @@ export const getAdditionalNode = (name) => {
|
|
|
201
202
|
export const getBinaryFilteredBizBot = nodeContent => {
|
|
202
203
|
if (!Array.isArray(nodeContent)) return false
|
|
203
204
|
return nodeContent.some(b => ['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1')
|
|
204
|
-
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const FLOWS_MAP = {
|
|
208
|
+
mpm: true,
|
|
209
|
+
cta_catalog: true,
|
|
210
|
+
send_location: true,
|
|
211
|
+
call_permission_request: true,
|
|
212
|
+
wa_payment_transaction_details: true,
|
|
213
|
+
automated_greeting_message_view_catalog: true,
|
|
214
|
+
form_message: true,
|
|
215
|
+
payment_key_info: true
|
|
216
|
+
};
|
|
217
|
+
const DECISION_SOURCE_CONTENT = [
|
|
218
|
+
{
|
|
219
|
+
tag: 'decision_source',
|
|
220
|
+
attrs: { value: 'df' }
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
const LIST_TYPE_CONTENT = {
|
|
224
|
+
tag: 'list',
|
|
225
|
+
attrs: { v: '2', type: 'product_list' }
|
|
226
|
+
};
|
|
227
|
+
const NATIVE_FLOW_ATTRIBUTE = { type: 'native_flow', v: '1' };
|
|
228
|
+
const MIXED_NATIVE_FLOW = {
|
|
229
|
+
tag: 'interactive',
|
|
230
|
+
attrs: NATIVE_FLOW_ATTRIBUTE,
|
|
231
|
+
content: [
|
|
232
|
+
{
|
|
233
|
+
tag: 'native_flow',
|
|
234
|
+
attrs: { v: '9', name: 'mixed' }
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const getBizBinaryNode = (message) => {
|
|
240
|
+
const flowMsg = message?.interactiveMessage?.nativeFlowMessage;
|
|
241
|
+
const firstButtonName = flowMsg?.buttons?.[0]?.name;
|
|
242
|
+
const qualityContent = {
|
|
243
|
+
tag: 'quality_control',
|
|
244
|
+
attrs: {
|
|
245
|
+
decision_id: randomBytes(20).toString('hex'),
|
|
246
|
+
source_type: 'third_party'
|
|
247
|
+
},
|
|
248
|
+
content: DECISION_SOURCE_CONTENT
|
|
249
|
+
};
|
|
250
|
+
const bizAttributes = {
|
|
251
|
+
actual_actors: '2',
|
|
252
|
+
host_storage: '2',
|
|
253
|
+
privacy_mode_ts: `${(Date.now() / 1000) | 0}`
|
|
254
|
+
};
|
|
255
|
+
if (firstButtonName === 'review_and_pay' || firstButtonName === 'payment_info') {
|
|
256
|
+
bizAttributes.native_flow_name = firstButtonName === 'review_and_pay' ? 'order_details' : firstButtonName;
|
|
257
|
+
return {
|
|
258
|
+
tag: 'biz',
|
|
259
|
+
attrs: bizAttributes,
|
|
260
|
+
content: [qualityContent]
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
if (firstButtonName && FLOWS_MAP[firstButtonName]) {
|
|
264
|
+
return {
|
|
265
|
+
tag: 'biz',
|
|
266
|
+
attrs: bizAttributes,
|
|
267
|
+
content: [
|
|
268
|
+
{
|
|
269
|
+
tag: 'interactive',
|
|
270
|
+
attrs: NATIVE_FLOW_ATTRIBUTE,
|
|
271
|
+
content: [
|
|
272
|
+
{
|
|
273
|
+
tag: 'native_flow',
|
|
274
|
+
attrs: firstButtonName === 'form_message' || firstButtonName === 'payment_key_info'
|
|
275
|
+
? { name: firstButtonName }
|
|
276
|
+
: { v: '2', name: firstButtonName }
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
qualityContent
|
|
281
|
+
]
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (flowMsg || message?.buttonsMessage || message?.templateMessage) {
|
|
285
|
+
return {
|
|
286
|
+
tag: 'biz',
|
|
287
|
+
attrs: bizAttributes,
|
|
288
|
+
content: [
|
|
289
|
+
MIXED_NATIVE_FLOW,
|
|
290
|
+
qualityContent
|
|
291
|
+
]
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (message?.listMessage) {
|
|
295
|
+
return {
|
|
296
|
+
tag: 'biz',
|
|
297
|
+
attrs: bizAttributes,
|
|
298
|
+
content: [
|
|
299
|
+
LIST_TYPE_CONTENT,
|
|
300
|
+
qualityContent
|
|
301
|
+
]
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
tag: 'biz',
|
|
306
|
+
attrs: bizAttributes,
|
|
307
|
+
content: [qualityContent]
|
|
308
|
+
};
|
|
309
|
+
};
|