@vanzxy/baileys 1.4.3 → 1.4.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.
@@ -1754,7 +1754,7 @@ class AIRich extends BaseBuilder {
1754
1754
  this._sections.push(AIRich.newLayout('Single', primitive));
1755
1755
  return this;
1756
1756
  }
1757
- addThinkingStatus(title, { icon = 'THINKING', is_in_progress = true, target_secondary_screen_id, target_secondary_screen_tab_id } = {}) {
1757
+ addThinkingStatus(title, { icon = 'THINKING', is_in_progress = true, target_secondary_screen_id, target_secondary_screen_tab_id, textFallback = true } = {}) {
1758
1758
  if (typeof title !== 'string' || !title) {
1759
1759
  throw new TypeError('addThinkingStatus(title) requires a non-empty string');
1760
1760
  }
@@ -1767,6 +1767,10 @@ class AIRich extends BaseBuilder {
1767
1767
  if (target_secondary_screen_id != null) primitive.target_secondary_screen_id = target_secondary_screen_id;
1768
1768
  if (target_secondary_screen_tab_id != null) primitive.target_secondary_screen_tab_id = target_secondary_screen_tab_id;
1769
1769
  this._sections.push(AIRich.newLayout('Single', primitive));
1770
+ // Safety net: stock WA client renders this as blank (native UI is a transient spinner).
1771
+ if (textFallback) {
1772
+ this._sections.push(AIRich.newLayout('Single', { text: title, __typename: 'FOATextPrimitive' }));
1773
+ }
1770
1774
  return this;
1771
1775
  }
1772
1776
  addQuotaUpsell(data = {}) {
@@ -1802,6 +1806,10 @@ class AIRich extends BaseBuilder {
1802
1806
  };
1803
1807
  if (data.initial_response != null) primitive.initial_response = data.initial_response;
1804
1808
  this._sections.push(AIRich.newLayout('Single', primitive));
1809
+ // Safety net: FOABloksPrimitive needs a real registered Bloks screen to render anything.
1810
+ if (data.textFallback !== false) {
1811
+ this._sections.push(AIRich.newLayout('Single', { text: `Bloks: ${data.type}`, __typename: 'FOATextPrimitive' }));
1812
+ }
1805
1813
  return this;
1806
1814
  }
1807
1815
  addSuggest(suggestion, { scroll = true, layout } = {}) {
@@ -174,11 +174,11 @@ export class AIRich extends BaseBuilder {
174
174
  /** GenAIBotProgressStatusPrimitive — one-shot "searching/working" status chip. */
175
175
  addProgressStatus(title: string, options?: { icon?: string; is_in_progress?: boolean; target_secondary_screen_id?: string; target_secondary_screen_tab_id?: string }): this;
176
176
  /** GenAIBotThinkingStatusPrimitive — one-shot "thinking" status chip. */
177
- addThinkingStatus(title: string, options?: { icon?: string; is_in_progress?: boolean; target_secondary_screen_id?: string; target_secondary_screen_tab_id?: string }): this;
177
+ addThinkingStatus(title: string, options?: { icon?: string; is_in_progress?: boolean; target_secondary_screen_id?: string; target_secondary_screen_tab_id?: string; textFallback?: boolean }): this;
178
178
  /** GenAIMetaSubsQuotaUpsellPrimitive — subscription-quota-limit upsell card. */
179
179
  addQuotaUpsell(data: { title: string; body?: string; body_line1?: string; body_line2?: string; buttons?: { label: string; action?: string; deeplink?: string }[] }): this;
180
180
  /** FOABloksPrimitive — raw Bloks payload; most experimental primitive, fields passed through as-is. */
181
- addBloks(data: { type: string; data?: string; uuid?: string; initial_response?: any; versioning_id?: string }): this;
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
  build(): Record<string, any>;
184
184
  send(jid: string, options?: Record<string, any>): Promise<any>;
@@ -2340,7 +2340,7 @@ class AIRich extends BaseBuilder {
2340
2340
  }
2341
2341
 
2342
2342
  /** Add a "thinking" status banner (`GenAIBotThinkingStatusPrimitive`). See `addProgressStatus()`. */
2343
- addThinkingStatus(title, { icon = 'THINKING', is_in_progress = true, target_secondary_screen_id, target_secondary_screen_tab_id } = {}) {
2343
+ addThinkingStatus(title, { icon = 'THINKING', is_in_progress = true, target_secondary_screen_id, target_secondary_screen_tab_id, textFallback = true } = {}) {
2344
2344
  if (typeof title !== 'string' || !title) {
2345
2345
  throw new TypeError('addThinkingStatus(title) requires a non-empty string');
2346
2346
  }
@@ -2356,6 +2356,12 @@ class AIRich extends BaseBuilder {
2356
2356
  if (target_secondary_screen_id != null) primitive.target_secondary_screen_id = target_secondary_screen_id;
2357
2357
  if (target_secondary_screen_tab_id != null) primitive.target_secondary_screen_tab_id = target_secondary_screen_tab_id;
2358
2358
  this._sections.push(AIRich.newLayout('Single', primitive));
2359
+ // Safety net: stock WA client doesn't render this primitive's own view (it's meant
2360
+ // as a transient spinner in the official app), so the card shows blank when forwarded.
2361
+ // Append a plain text section so the title is still visible. Set { textFallback: false } to skip.
2362
+ if (textFallback) {
2363
+ this._sections.push(AIRich.newLayout('Single', { text: title, __typename: 'FOATextPrimitive' }));
2364
+ }
2359
2365
  return this;
2360
2366
  }
2361
2367
 
@@ -2406,6 +2412,12 @@ class AIRich extends BaseBuilder {
2406
2412
  // Omit initial_response entirely when unset — same null-field crash as addProgressStatus/addThinkingStatus.
2407
2413
  if (data.initial_response != null) primitive.initial_response = data.initial_response;
2408
2414
  this._sections.push(AIRich.newLayout('Single', primitive));
2415
+ // Safety net: FOABloksPrimitive needs a real, client-registered Bloks screen to render
2416
+ // anything — arbitrary/placeholder payloads show up blank. Append a plain text section
2417
+ // so the card isn't empty. Set data.textFallback = false to skip.
2418
+ if (data.textFallback !== false) {
2419
+ this._sections.push(AIRich.newLayout('Single', { text: `Bloks: ${data.type}`, __typename: 'FOATextPrimitive' }));
2420
+ }
2409
2421
  return this;
2410
2422
  }
2411
2423
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanzxy/baileys",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
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",