@vanzxy/baileys 1.4.5 → 1.4.6

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.
@@ -61,7 +61,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
61
61
  var _a, _Button_client, _Button_validateAgainstSchema, _ButtonV2_client, _Carousel_client, _Poll_client, _AIRich_client;
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.Toolkit = exports.VanzxyRich = exports.VanzxyAI = exports.LeafRich = exports.AIVanzxy = exports.AIRich = exports.Poll = exports.Carousel = exports.ButtonV2 = exports.Button = exports.MESSAGE_BUILDER_VERSION = void 0;
64
- const MESSAGE_BUILDER_VERSION = '4.7';
64
+ const MESSAGE_BUILDER_VERSION = '4.8';
65
65
  exports.MESSAGE_BUILDER_VERSION = MESSAGE_BUILDER_VERSION;
66
66
  const messages_js_1 = require("./messages.js");
67
67
  const rich_message_utils_js_1 = require("./rich-message-utils.js");
@@ -2599,7 +2599,7 @@ class AIRich extends BaseBuilder {
2599
2599
  unified_rows,
2600
2600
  };
2601
2601
  }
2602
- addGenerating({ imagine_type = 'IMAGE', estimated_completion_time } = {}) {
2602
+ addGenerating({ imagine_type = 'IMAGE', estimated_completion_time, textFallback = true } = {}) {
2603
2603
  this._submessages.push({ messageType: 2, messageText: '[ Sedang diproses... ]' });
2604
2604
  this._sections.push(AIRich.newLayout('Single', {
2605
2605
  media: { url: '', mime_type: imagine_type === 'ANIMATE' ? 'video/mp4' : 'image/png' },
@@ -2610,6 +2610,11 @@ class AIRich extends BaseBuilder {
2610
2610
  },
2611
2611
  __typename: 'GenAIImaginePrimitive',
2612
2612
  }));
2613
+ // Vanz@Fix 23-08-26 (v4.8) --- instant FOATextPrimitive fallback instead of
2614
+ // relying on WA's own generation-timeout text. Set { textFallback: false } to skip.
2615
+ if (textFallback) {
2616
+ this._sections.push(AIRich.newLayout('Single', { text: '[ Sedang diproses... ]', __typename: 'FOATextPrimitive' }));
2617
+ }
2613
2618
  return this;
2614
2619
  }
2615
2620
  static async sendSupportPayload(client, jid, text, { ticketId = crypto_1.default.randomUUID(), isAiMessage = true, shouldShowSystemMessage = true, version = 1 } = {}) {
@@ -181,7 +181,7 @@ export class AIRich extends BaseBuilder {
181
181
  addBloks(data: { type: string; data?: string; uuid?: string; initial_response?: any; versioning_id?: string; textFallback?: boolean }): this;
182
182
  addSuggest(suggestion: Record<string, any>, options?: { scroll?: boolean; layout?: string }): this;
183
183
  /** GenAIImaginePrimitive with status GENERATING — pending-generation placeholder, distinct from addImage()/addVideo()'s READY status. */
184
- addGenerating(options?: { imagine_type?: 'IMAGE' | 'ANIMATE'; estimated_completion_time?: number }): this;
184
+ addGenerating(options?: { imagine_type?: 'IMAGE' | 'ANIMATE'; estimated_completion_time?: number; textFallback?: boolean }): this;
185
185
  build(): Record<string, any>;
186
186
  send(jid: string, options?: Record<string, any>): Promise<any>;
187
187
 
@@ -10,6 +10,12 @@
10
10
  * and message-authenticity fields backported from arslan-baileys 1.1.0 and
11
11
  * this project's own rich-message-utils.js. See changes tagged "Vanz@" below.
12
12
  *
13
+ * Vanz@Fix 23-08-26 --- v4.7 -> v4.8. addGenerating() now defaults to appending a
14
+ * FOATextPrimitive text fallback ('[ Sedang diproses... ]'), same pattern as
15
+ * addTask/addThinkingStatus/addBloks. Previously the card had no client-visible
16
+ * content until WA's own timeout swapped it for its built-in failed-generation
17
+ * text; this makes the fallback instant. Opt out with { textFallback: false }.
18
+ *
13
19
  * Vanz@Merge 22-08-26 --- v4.6 -> v4.7. Button class hardened + extended:
14
20
  * - Bug fix: addCall() wrote its second arg into buttonParamsJson.id, but
15
21
  * the cta_call native-flow schema keys on `phone_number` (id is ignored
@@ -38,7 +44,7 @@
38
44
 
39
45
  'use strict';
40
46
 
41
- const MESSAGE_BUILDER_VERSION = '4.7';
47
+ const MESSAGE_BUILDER_VERSION = '4.8';
42
48
 
43
49
  import { generateWAMessageFromContent, prepareWAMessageMedia } from './messages.js';
44
50
  import { botMetadataSignature, botMetadataCertificate } from './rich-message-utils.js';
@@ -3288,7 +3294,7 @@ class AIRich extends BaseBuilder {
3288
3294
  * Use this to show a pending-generation state before the real media is ready.
3289
3295
  * @param {{ imagine_type?: 'IMAGE'|'ANIMATE', estimated_completion_time?: number }} [options]
3290
3296
  */
3291
- addGenerating({ imagine_type = 'IMAGE', estimated_completion_time } = {}) {
3297
+ addGenerating({ imagine_type = 'IMAGE', estimated_completion_time, textFallback = true } = {}) {
3292
3298
  this._submessages.push({ messageType: 2, messageText: '[ Sedang diproses... ]' });
3293
3299
  this._sections.push(
3294
3300
  AIRich.newLayout('Single', {
@@ -3301,6 +3307,14 @@ class AIRich extends BaseBuilder {
3301
3307
  __typename: 'GenAIImaginePrimitive',
3302
3308
  })
3303
3309
  );
3310
+ // Vanz@Fix 23-08-26 (v4.8) --- media.url kosong + status GENERATING gak punya renderer
3311
+ // visual instan di stock WA client; sebelumnya cuma diem sampe WA nge-timeout sendiri
3312
+ // dan nampilin fallback bawaannya ("Saat ini, saya tidak bisa membuat gambar itu...").
3313
+ // Same fix class kayak addTask/addBloks: append FOATextPrimitive biar ada fallback
3314
+ // instan, gak perlu nunggu timeout WA. Set { textFallback: false } buat skip.
3315
+ if (textFallback) {
3316
+ this._sections.push(AIRich.newLayout('Single', { text: '[ Sedang diproses... ]', __typename: 'FOATextPrimitive' }));
3317
+ }
3304
3318
  return this;
3305
3319
  }
3306
3320
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanzxy/baileys",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
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
  "main": "./cjs/lib/index.js",