@nuiisweety/baileys 0.1.14 → 0.1.15

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.
@@ -545,37 +545,6 @@ const prepareNativeFlowButtons = (message) => {
545
545
  else if (hasOptionalProperty(button, 'sections') && !!button.sections) {
546
546
  return { name: 'single_select', buttonParamsJson: JSON.stringify({ title: buttonText || '📋 Select', sections: button.sections, icon: buttonIcon }) };
547
547
  }
548
- else if (hasOptionalProperty(button, 'catalog') && !!button.catalog) {
549
- return { name: 'cta_catalog', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛍️ Catalog', business_phone_number: button.catalog, icon: buttonIcon }) };
550
- }
551
- else if (hasOptionalProperty(button, 'reminder') && button.reminder === true) {
552
- return { name: 'cta_reminder', buttonParamsJson: JSON.stringify({ display_text: buttonText || '⏰ Remind Me', icon: buttonIcon }) };
553
- }
554
- else if (hasOptionalProperty(button, 'cancelReminder') && button.cancelReminder === true) {
555
- return { name: 'cta_cancel_reminder', buttonParamsJson: JSON.stringify({ display_text: buttonText || '❌ Cancel Reminder', icon: buttonIcon }) };
556
- }
557
- else if (hasOptionalProperty(button, 'address') && button.address === true) {
558
- return { name: 'address_message', buttonParamsJson: JSON.stringify({ display_text: buttonText || '📍 Share Address', icon: buttonIcon }) };
559
- }
560
- else if (hasOptionalProperty(button, 'location') && button.location === true) {
561
- return { name: 'send_location', buttonParamsJson: JSON.stringify({ display_text: buttonText || '📍 Send Location', icon: buttonIcon }) };
562
- }
563
- else if (hasOptionalProperty(button, 'webview') && !!button.webview) {
564
- return { name: 'open_webview', buttonParamsJson: JSON.stringify({ title: buttonText || '🌐 Open', link: { in_app_webview: button.inAppWebview !== false, url: button.webview }, icon: buttonIcon }) };
565
- }
566
- else if (hasOptionalProperty(button, 'productId') && !!button.productId) {
567
- return { name: 'mpm', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛒 View Product', product_id: button.productId, icon: buttonIcon }) };
568
- }
569
- else if (hasOptionalProperty(button, 'transactionId') && !!button.transactionId) {
570
- return { name: 'wa_payment_transaction_details', buttonParamsJson: JSON.stringify({ display_text: buttonText || '💳 Payment Details', transaction_id: button.transactionId, icon: buttonIcon }) };
571
- }
572
- else if (hasOptionalProperty(button, 'catalogProduct') && !!button.catalogProduct) {
573
- return { name: 'automated_greeting_message_view_catalog', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛍️ View Catalog', business_phone_number: button.catalogProduct.bizPhone, catalog_product_id: button.catalogProduct.productId, icon: buttonIcon }) };
574
- }
575
- else if (hasOptionalProperty(button, 'flow') && !!button.flow) {
576
- const f = button.flow;
577
- return { name: 'galaxy_message', buttonParamsJson: JSON.stringify({ mode: f.mode || 'published', flow_message_version: f.flowMessageVersion || '3', flow_token: f.flowToken, flow_id: f.flowId, flow_cta: buttonText || f.flowCta || '▶️ Open Flow', flow_action: f.flowAction || 'navigate', flow_action_payload: f.flowActionPayload, flow_metadata: f.flowMetadata, icon: buttonIcon }) };
578
- }
579
548
  return button;
580
549
  }),
581
550
  messageParamsJson: JSON.stringify(messageParamsJson),
@@ -950,80 +919,6 @@ export const generateWAMessageContent = async (message, options) => {
950
919
  }
951
920
  };
952
921
  }
953
- else if (hasNonNullishProperty(message, 'orderStatus')) {
954
- const os = message.orderStatus;
955
- if (!os.image) {
956
- throw new Boom('"image" wajib diisi untuk orderStatus', { statusCode: 400 });
957
- }
958
- let imageInput = os.image;
959
- if (typeof imageInput === 'string' && !imageInput.startsWith('http://') && !imageInput.startsWith('https://')) {
960
- imageInput = await fs.readFile(imageInput);
961
- }
962
- const media = await prepareWAMessageMedia({ image: imageInput }, options);
963
- m = {
964
- viewOnceMessage: {
965
- message: {
966
- messageContextInfo: {
967
- deviceListMetadata: {},
968
- deviceListMetadataVersion: 2
969
- },
970
- interactiveMessage: proto.Message.InteractiveMessage.create({
971
- header: {
972
- title: os.title || 'Status Pesanan',
973
- hasMediaAttachment: true,
974
- ...media
975
- },
976
- body: { text: os.text || 'Silakan cek status pesanan Anda.' },
977
- footer: { text: os.footer || '' },
978
- nativeFlowMessage: {
979
- buttons: [{
980
- name: 'order_status',
981
- buttonParamsJson: JSON.stringify({
982
- reference_id: os.referenceId || 'ORDER-001',
983
- order: {
984
- status: os.status || 'PROCESSING',
985
- subtotal: {
986
- value: os.subtotalValue || 0,
987
- offset: os.subtotalOffset || 100
988
- },
989
- tax: {
990
- value: os.taxValue || 0,
991
- offset: os.taxOffset || 100
992
- },
993
- currency: os.currency || 'IDR'
994
- }
995
- })
996
- }]
997
- }
998
- })
999
- }
1000
- }
1001
- };
1002
- }
1003
- else if (hasNonNullishProperty(message, 'productList')) {
1004
- let thumbnail = null;
1005
- if (message.thumbnail) {
1006
- const { imageMessage } = await prepareWAMessageMedia({ image: message.thumbnail }, options);
1007
- thumbnail = imageMessage;
1008
- }
1009
- m = {
1010
- listMessage: {
1011
- title: message.title,
1012
- buttonText: message.buttonText || 'Lihat Produk',
1013
- footerText: message.footer,
1014
- description: message.text,
1015
- productListInfo: {
1016
- productSections: message.productList,
1017
- headerImage: {
1018
- productId: message.productList?.[0]?.products?.[0]?.productId,
1019
- jpegThumbnail: thumbnail?.jpegThumbnail || null
1020
- },
1021
- businessOwnerJid: message.businessOwnerJid
1022
- },
1023
- listType: proto.Message.ListMessage.ListType.PRODUCT_LIST
1024
- }
1025
- };
1026
- }
1027
922
  else if (hasNonNullishProperty(message, 'buttonsMessage')) {
1028
923
  // Direct buttonsMessage passthrough — supports headerType 6 (locationMessage), etc.
1029
924
  const btnMsg = { ...message.buttonsMessage };
@@ -1276,74 +1171,6 @@ export const generateWAMessageContent = async (message, options) => {
1276
1171
  }
1277
1172
  m = { interactiveMessage };
1278
1173
  }
1279
- else if (hasNonNullishProperty(message, 'shop')) {
1280
- const interactiveMessage = {
1281
- shopStorefrontMessage: {
1282
- surface: message.shop.surface || 1,
1283
- id: message.shop.id,
1284
- messageVersion: 1
1285
- }
1286
- };
1287
- if (hasOptionalProperty(message, 'caption')) {
1288
- // Media header mode — m already contains mediaMessage from chain 1 else block
1289
- const mediaKey = Object.keys(m)[0]; // e.g. 'videoMessage', 'imageMessage'
1290
- interactiveMessage.header = {
1291
- title: message.title || '',
1292
- subtitle: message.subtitle || '',
1293
- hasMediaAttachment: true,
1294
- [mediaKey]: m[mediaKey]
1295
- };
1296
- interactiveMessage.body = { text: message.caption };
1297
- }
1298
- else if (hasOptionalProperty(message, 'text')) {
1299
- interactiveMessage.body = { text: message.text };
1300
- if (hasOptionalProperty(message, 'title')) {
1301
- interactiveMessage.header = {
1302
- title: message.title,
1303
- subtitle: message.subtitle || null,
1304
- hasMediaAttachment: false
1305
- };
1306
- }
1307
- }
1308
- if (hasOptionalProperty(message, 'footer')) {
1309
- interactiveMessage.footer = { text: message.footer };
1310
- }
1311
- m = { interactiveMessage };
1312
- }
1313
- else if (hasNonNullishProperty(message, 'collection')) {
1314
- const interactiveMessage = {
1315
- collectionMessage: {
1316
- bizJid: message.collection.bizJid,
1317
- id: message.collection.id,
1318
- messageVersion: message.collection.version || 1
1319
- }
1320
- };
1321
- if (hasOptionalProperty(message, 'caption')) {
1322
- // Media header mode
1323
- const mediaKey = Object.keys(m)[0];
1324
- interactiveMessage.header = {
1325
- title: message.title || '',
1326
- subtitle: message.subtitle || '',
1327
- hasMediaAttachment: true,
1328
- [mediaKey]: m[mediaKey]
1329
- };
1330
- interactiveMessage.body = { text: message.caption };
1331
- }
1332
- else if (hasOptionalProperty(message, 'text')) {
1333
- interactiveMessage.body = { text: message.text };
1334
- if (hasOptionalProperty(message, 'title')) {
1335
- interactiveMessage.header = {
1336
- title: message.title,
1337
- subtitle: message.subtitle || null,
1338
- hasMediaAttachment: false
1339
- };
1340
- }
1341
- }
1342
- if (hasOptionalProperty(message, 'footer')) {
1343
- interactiveMessage.footer = { text: message.footer };
1344
- }
1345
- m = { interactiveMessage };
1346
- }
1347
1174
  else if (hasNonNullishProperty(message, 'requestPaymentFrom')) {
1348
1175
  const requestPaymentMessage = {
1349
1176
  amount: {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nuiisweety/baileys",
3
3
  "type": "module",
4
- "version": "0.1.14",
5
- "description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiSweety.",
4
+ "version": "0.1.15",
5
+ "description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiS4TORU.",
6
6
  "keywords": [
7
7
  "whatsapp",
8
8
  "automation"
@@ -12,7 +12,7 @@
12
12
  "url": "git@github.com:WhiskeySockets/Baileys.git"
13
13
  },
14
14
  "license": "MIT",
15
- "author": "NuiiSweety (based on WhiskeySockets/Baileys)",
15
+ "author": "NuiiS4TORU (based on WhiskeySockets/Baileys)",
16
16
  "main": "lib/index.js",
17
17
  "types": "lib/index.d.ts",
18
18
  "files": [