@vanzxy/baileys 1.5.6 → 1.5.7
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.
|
@@ -1013,6 +1013,20 @@ class Button extends BaseBuilder {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
|
|
1016
|
+
/** Native-flow `payment_key_info` shortcut. Payload is passed through unchanged. */
|
|
1017
|
+
addPaymentKeyInfo(payload = {}) {
|
|
1018
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) throw new TypeError('addPaymentKeyInfo(payload) requires a plain object');
|
|
1019
|
+
this._buttons.push({ name: 'payment_key_info', buttonParamsJson: JSON.stringify(payload) });
|
|
1020
|
+
return this;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/** Native-flow `booking_confirmation` shortcut. Payload is passed through unchanged. */
|
|
1024
|
+
addBookingConfirmation(payload = {}) {
|
|
1025
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) throw new TypeError('addBookingConfirmation(payload) requires a plain object');
|
|
1026
|
+
this._buttons.push({ name: 'booking_confirmation', buttonParamsJson: JSON.stringify(payload) });
|
|
1027
|
+
return this;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1016
1030
|
/** Native-flow `card_message` shortcut, matching this fork's prepareNativeFlowButtons(). */
|
|
1017
1031
|
addCardMessage(payload = {}) {
|
|
1018
1032
|
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) throw new TypeError('addCardMessage(payload) requires a plain object');
|
|
@@ -1191,6 +1205,8 @@ class Button extends BaseBuilder {
|
|
|
1191
1205
|
send_location: { v: '2', name: 'send_location' },
|
|
1192
1206
|
call_permission_request: { v: '2', name: 'call_permission_request' },
|
|
1193
1207
|
wa_payment_transaction_details: { v: '2', name: 'wa_payment_transaction_details' },
|
|
1208
|
+
payment_key_info: { v: '1', name: 'payment_key_info' },
|
|
1209
|
+
booking_confirmation: { v: '1', name: 'booking_confirmation' },
|
|
1194
1210
|
automated_greeting_message_view_catalog: { v: '2', name: 'automated_greeting_message_view_catalog' },
|
|
1195
1211
|
};
|
|
1196
1212
|
|
|
@@ -160,6 +160,8 @@ export class AIRich extends BaseBuilder {
|
|
|
160
160
|
addText(text: string, options?: AddTextOptions): this;
|
|
161
161
|
addCode(language: string, code: string): this;
|
|
162
162
|
addTable(table: string[][], options?: AddTextOptions): this;
|
|
163
|
+
addPaymentKeyInfo(payload?: Record<string, any>): this;
|
|
164
|
+
addBookingConfirmation(payload?: Record<string, any>): this;
|
|
163
165
|
addLinks(links?: Record<string, any>[]): this;
|
|
164
166
|
addContentItems(items?: Record<string, any>[]): this;
|
|
165
167
|
addInlineVideo(): this;
|
|
@@ -128,15 +128,25 @@ export const toUnified = (submessages, uuid) => ({
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
case RichSubMessageType.TABLE:
|
|
131
|
-
const tableMetadata = submessage.tableMetadata;
|
|
131
|
+
const tableMetadata = submessage.tableMetadata || {};
|
|
132
|
+
// Accept both the internal row shape ({ items, isHeading }) and
|
|
133
|
+
// the raw string[][] shape used by some rich-response callers.
|
|
134
|
+
const rawRows = Array.isArray(tableMetadata.rows) ? tableMetadata.rows : [];
|
|
135
|
+
const normalizedRows = rawRows.map((row, index) => {
|
|
136
|
+
if (Array.isArray(row)) {
|
|
137
|
+
return { is_header: index === 0, cells: row.map(String) };
|
|
138
|
+
}
|
|
139
|
+
const cells = Array.isArray(row?.items) ? row.items.map(String) : [];
|
|
140
|
+
return { is_header: !!row?.isHeading, cells };
|
|
141
|
+
});
|
|
132
142
|
return {
|
|
133
143
|
view_model: {
|
|
134
144
|
primitive: {
|
|
135
|
-
title: tableMetadata.title,
|
|
136
|
-
rows:
|
|
137
|
-
is_header: row.
|
|
138
|
-
cells: row.
|
|
139
|
-
markdown_cells: row.
|
|
145
|
+
title: tableMetadata.title || '',
|
|
146
|
+
rows: normalizedRows.map((row) => ({
|
|
147
|
+
is_header: row.is_header,
|
|
148
|
+
cells: row.cells,
|
|
149
|
+
markdown_cells: row.cells.map((item) => ({ text: item }))
|
|
140
150
|
})),
|
|
141
151
|
__typename: 'GenATableUXPrimitive'
|
|
142
152
|
},
|
|
@@ -233,11 +243,16 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
233
243
|
};
|
|
234
244
|
}
|
|
235
245
|
else if (submessage.table) {
|
|
246
|
+
const rows = Array.isArray(submessage.table)
|
|
247
|
+
? submessage.table.map((row, index) => Array.isArray(row)
|
|
248
|
+
? { isHeading: index === 0, items: row.map(String) }
|
|
249
|
+
: row)
|
|
250
|
+
: [];
|
|
236
251
|
return {
|
|
237
252
|
messageType: RichSubMessageType.TABLE,
|
|
238
253
|
tableMetadata: {
|
|
239
|
-
title: submessage.title,
|
|
240
|
-
rows
|
|
254
|
+
title: submessage.title || '',
|
|
255
|
+
rows
|
|
241
256
|
}
|
|
242
257
|
};
|
|
243
258
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanzxy/baileys",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.7",
|
|
4
4
|
"description": "Enhanced Baileys fork by Vanzxy — based on @itsliaaa/baileys + @whiskeysockets/baileys with fixes for audio group status and clean media without newsletter button.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./lib/index.js",
|