@vanzxy/baileys 1.5.5 → 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.
Potentially problematic release.
This version of @vanzxy/baileys might be problematic. Click here for more details.
- package/lib/Utils/MessageBuilder.js +1167 -913
- package/lib/Utils/MessageBuilder_d.ts +18 -0
- package/lib/Utils/rich-message-utils.js +23 -8
- package/package.json +1 -1
|
@@ -74,6 +74,19 @@ export class Button extends BaseBuilder {
|
|
|
74
74
|
addTransactionDetails(payload?: Record<string, any>): this;
|
|
75
75
|
/** mpm — multi-product message. Business-catalog accounts only. */
|
|
76
76
|
addMultiProduct(payload?: Record<string, any>): this;
|
|
77
|
+
addCardMessage(payload?: Record<string, any>): this;
|
|
78
|
+
addOrderDetails(payload?: Record<string, any>): this;
|
|
79
|
+
addOrderStatus(payload?: Record<string, any>): this;
|
|
80
|
+
addPaymentStatus(payload?: Record<string, any>): this;
|
|
81
|
+
addPaymentMethod(payload?: Record<string, any>): this;
|
|
82
|
+
addTrackOrder(id: string, display_text?: string): this;
|
|
83
|
+
addReorder(id: string, display_text?: string): this;
|
|
84
|
+
addCancelOrder(id: string, display_text?: string): this;
|
|
85
|
+
addClearChat(): this;
|
|
86
|
+
addNavigateToScreen(screen: string, data?: Record<string, any>): this;
|
|
87
|
+
addFlow(flow: Record<string, any>, display_text?: string): this;
|
|
88
|
+
addVoiceCall(id: string, display_text?: string): this;
|
|
89
|
+
addVideoCall(id: string, display_text?: string): this;
|
|
77
90
|
setLimitedTimeOffer(params?: LimitedTimeOfferParams): this;
|
|
78
91
|
setBottomSheet(params?: BottomSheetParams): this;
|
|
79
92
|
setTapTargetConfiguration(params?: TapTargetConfigurationParams): this;
|
|
@@ -147,6 +160,11 @@ export class AIRich extends BaseBuilder {
|
|
|
147
160
|
addText(text: string, options?: AddTextOptions): this;
|
|
148
161
|
addCode(language: string, code: string): this;
|
|
149
162
|
addTable(table: string[][], options?: AddTextOptions): this;
|
|
163
|
+
addPaymentKeyInfo(payload?: Record<string, any>): this;
|
|
164
|
+
addBookingConfirmation(payload?: Record<string, any>): this;
|
|
165
|
+
addLinks(links?: Record<string, any>[]): this;
|
|
166
|
+
addContentItems(items?: Record<string, any>[]): this;
|
|
167
|
+
addInlineVideo(): this;
|
|
150
168
|
addSource(sources?: Record<string, any>[], options?: { resolveUrl?: boolean }): this;
|
|
151
169
|
addReels(reelsItems?: Record<string, any>[], options?: { resolveUrl?: boolean }): this;
|
|
152
170
|
addImage(imageUrl: string, options?: { resolveUrl?: boolean }): 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",
|