@vanzxy/baileys 2.0.1 → 2.0.3

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.
package/NOTICE.md CHANGED
@@ -34,9 +34,8 @@ below was MIT-licensed at its source at the time it was ported.
34
34
  entry. Let me know which and I'll finalize it.
35
35
 
36
36
  ### MessageBuilder v4.7 additions (setResponseId/setBotResponseId/hasId/getIds/peek/delete)
37
- - **Source:** credited in-code only as "temen's MessageBuilderV4.7" (`temen` = Indonesian for "friend/buddy") not a resolvable handle or repo.
37
+ - **Source:** Nixel same author/watermark as the main MessageBuilder/AIRich base above ("temen's MessageBuilderV4.7" in the in-code credit refers to Nixel, confirmed by the person who introduced this codebase).
38
38
  - **Location in this package:** `lib/Utils/MessageBuilder.js` (`~line 2120, 2885, 2916`).
39
- - **⚠ Needs your input:** I can't attribute this properly without the actual author/repo name. Let me know who this refers to.
40
39
 
41
40
  ### Button/list addon-kind resolution logic
42
41
  - **Source:** vinikjkkj, [zapo](https://github.com/vinikjkkj/zapo) (MIT).
package/README.md CHANGED
@@ -74,7 +74,7 @@
74
74
  - [💖 Support](#-support)
75
75
  - [👑 Maintainer](#-maintainer)
76
76
  - [⚠️ Disclaimer](#-disclaimer)
77
- - [📝 Patch Notes](#-v6-patch-notes)
77
+ - [📝 Patch Notes](#-v8-patch-notes)
78
78
 
79
79
  </details>
80
80
 
@@ -246,6 +246,8 @@ Audio status uses a more compatible implementation to avoid unsupported-version
246
246
  ### AIRich — the rich-response message builder
247
247
  A chainable builder (`AIRich`, also exported as `AIVanzxy` / `LeafRich` / `VanzxyAI` / `VanzxyRich`) with 40+ `add*()`/`set*()` methods covering headings, formatted text (hyperlinks/citations/LaTeX), code blocks, tables, image/video/product/post cards, task & progress cards, tip banners, and quick-reply suggestions — the kind of rich card layout you'd normally only see from an official AI/assistant-style bot. See [Usage Examples](#airich--rich-response-cards) below.
248
248
 
249
+ > **Experimental (V8):** `build()` now also populates the proto's `originalRecipientMetadata` field (previously left unset) with the same section payload as `unifiedResponse`. This is a fix for AI-response bubbles collapsing into WhatsApp's "Baca selengkapnya"/"Read more" fold earlier than expected while being built up live via `sendEdit()`. Pending live-traffic confirmation — report back if you still see early truncation.
250
+
249
251
  ### Native Flow Expansion
250
252
 
251
253
  <table>
@@ -524,10 +526,32 @@ Every message builder lives in its own file under `lib/Builders/`, so you can tr
524
526
  | `ButtonV3.js` | `ButtonV3` | Built around `loadFrom(msg)` — loads an existing `templateMessage` (e.g. one you fetched or that was quoted) so you can edit it in place instead of building one from scratch. |
525
527
  | `Carousel.js` | `Carousel` | Chains `Button(...).toCard()` results into a swipeable card carousel. Capped at `Carousel.MAX_CARDS` (10) since WhatsApp silently truncates anything beyond that. |
526
528
  | `Poll.js` | `Poll` | Poll/vote message builder — question, options, single/multi-select, hidden-voter mode, correct-answer marking, expiry. |
529
+ | `NativeFlow.js` | `NativeFlow` | Modern `interactiveMessage`/`nativeFlowMessage` builder — `cta_url`, `cta_copy`, `cta_call`, `quick_reply`, `single_select`, offer banners, and the "..." options bottom-sheet. The recommended replacement for `ButtonV3`'s legacy hydrated-template buttons. |
530
+ | `Location.js` | `Location` | Static location pins via the existing `location` shorthand, plus live/moving locations (built directly against `WAProto.Message.LiveLocationMessage` since there's no shorthand for that yet — call `send()` again with a higher `setSequence()` to push updates). |
531
+ | `Contact.js` | `Contact` | vCard contact-card builder — one contact sends as `contactMessage`, two or more as `contactsArrayMessage`. `addContact()` generates a minimal VCARD 3.0 block from plain fields; `addRawVcard()` accepts a pre-built vCard string. |
532
+ | `Album.js` | `Album` | Media-group/album builder — bundles 2+ images/videos. Thin wrapper: the actual cover + delayed-follow-up sending is already handled by the `content.album` shorthand in `Socket/messages-send.js`. |
527
533
  | `AIRich.js` | `AIRich` (+ aliases `ORich`, `AIVanzxy`, `LeafRich`, `VanzxyAI`, `VanzxyRich`, `RichVanzxy`) | The rich AI-assistant-style response builder described above — headings, formatted text, tables, media/product/post cards, task/progress cards, tip banners, quick-reply suggestions. |
528
534
  | `A2UI.js` | `A2UI`, `sendA2UIWidget` | Lower-level A2UI/Bloks widget builder. Builds the flat `components` tree (Column/Row → `children`, Card/Button → `child`, Modal → `trigger`/`content`) that Bloks widgets expect and sends it through the same `getBizBinaryNode()` path as `Button`/`ButtonV2`, so the wire-level node always matches the button names actually sent. |
529
- | `VanzxyBaileys.js` | `VanzxyBaileys` | A unified builder **hub**one object that wraps all the builders above behind short method names (`.button()`, `.buttonV2()`, `.buttonV3()`, `.carousel()`, `.poll()`, `.airich()`, `.a2ui()`), plus PascalCase aliases (`.Button()`, `.Carousel()`, `.Poll()`, `.AIRich()`, `.A2UI()`) for developers who prefer that naming style. Nothing new is implemented here it's purely a single entry point over the individual classes. |
530
- | `index.js` | everything above, plus `MESSAGE_BUILDER_VERSION` | The barrel filere-exports every builder and its aliases so `import { Button, Poll, AIRich, VanzxyBaileys } from '@vanzxy/baileys'` works without reaching into individual files. `MESSAGE_BUILDER_VERSION` tracks the builder API surface's own version, independent of the package version. |
535
+ | `LinkPreview.js` | `bindLinkPreview` | Not a builder classa function that binds a `sendLinkPreview(jid, text, link, title, description, thumbnail, options)` method directly onto a Baileys socket instance. Builds the `linkPreview` context (matched text, title, description, optional thumbnail via `prepareWAMessageMedia`) and sends it through the socket's own `sendMessage`. Called automatically when you construct `VanzxyBaileys(sock)`; call it yourself (`bindLinkPreview(sock)`) if you're not using the hub. |
536
+ | `VanzxyBaileys.js` | `VanzxyBaileys` | A unified builder **hub** one object that wraps all the builders above behind short method names (`.button()`, `.buttonV2()`, `.buttonV3()`, `.carousel()`, `.poll()`, `.nativeFlow()`, `.location()`, `.contact()`, `.album()`, `.airich()`, `.a2ui()`), plus PascalCase aliases (`.Button()`, `.Carousel()`, `.Poll()`, `.NativeFlow()`, `.Location()`, `.Contact()`, `.Album()`, `.AIRich()`, `.A2UI()`) for developers who prefer that naming style. The constructor also runs `bindLinkPreview()` on the socket you pass in, so `vx.client.sendLinkPreview(...)` is available immediately. Nothing new is implemented here — it's purely a single entry point over the individual classes. |
537
+ | `index.js` | everything above, plus `MESSAGE_BUILDER_VERSION` | The barrel file — re-exports every builder and its aliases so `import { Button, Poll, AIRich, VanzxyBaileys, bindLinkPreview } from '@vanzxy/baileys'` works without reaching into individual files. `MESSAGE_BUILDER_VERSION` tracks the builder API surface's own version, independent of the package version (currently `5.0`). |
538
+
539
+ **Link preview example** — works on any socket, with or without the `VanzxyBaileys` hub:
540
+
541
+ ```js
542
+ import { bindLinkPreview } from '@vanzxy/baileys'
543
+
544
+ const sock = bindLinkPreview(makeWASocket({ /* ... */ }))
545
+
546
+ await sock.sendLinkPreview(
547
+ jid,
548
+ 'Cek repo ini deh',
549
+ 'https://github.com/vanzxysenpai/vanzxybaileys',
550
+ 'vanzxybaileys',
551
+ 'Extended interactive messages & native flow, built on WhiskeySockets/Baileys.',
552
+ { url: 'https://files.catbox.moe/l72xji.svg' } // optional thumbnail
553
+ )
554
+ ```
531
555
 
532
556
  **Unified hub example** — useful if you'd rather carry one object around than import each builder individually:
533
557
 
@@ -826,6 +850,25 @@ Use responsibly and follow WhatsApp Terms of Service.
826
850
 
827
851
  ---
828
852
 
853
+ ## 📝 V8 Patch Notes
854
+
855
+ - Added `LinkPreview.js` to `lib/Builders/`: `bindLinkPreview(sock)` attaches a `sendLinkPreview(jid, text, link, title, description, thumbnail, options)` method directly to a socket instance (matched-text/title/description + optional thumbnail via `prepareWAMessageMedia`). Wired into `index.js`'s exports and auto-applied inside the `VanzxyBaileys` constructor, so `new VanzxyBaileys(sock)` gives you `sendLinkPreview` for free. See the [Builders Folder Map](#-builders-folder-map-libbuilders) for the usage example.
856
+ - **Experimental AIRich fix:** `AIRich.build()` now populates the previously-unset `richResponseMessage.originalRecipientMetadata` proto field with the same section payload as `unifiedResponse`. Working hypothesis is that WhatsApp's client uses this field to decide full/expanded rendering for an AI-response bubble's original recipient, and its absence was causing live-built AIRich bubbles to collapse into "Baca selengkapnya" earlier than they should while still mid-`sendEdit()` build. Not yet confirmed against live traffic — flag it if the early collapse persists or if this introduces a regression.
857
+ - Corrected `package.json`'s `version` field from `2.0.6` back to `2.0.3`. `2.0.6` was never reached through this fork's own release process — it got bumped out of sequence, so the version number is reset to the correct next step.
858
+
859
+ ---
860
+
861
+ ## 📝 V7 Patch Notes
862
+
863
+ - Added four new builders to `lib/Builders/` (see the [📁 Builders Folder Map](#-builders-folder-map-libbuilders) for details), wired into both `index.js` and the `VanzxyBaileys` hub:
864
+ - `NativeFlow.js` — modern `interactiveMessage`/`nativeFlowMessage` builder (`cta_url`, `cta_copy`, `cta_call`, `quick_reply`, `single_select`), the recommended replacement for `ButtonV3`'s legacy hydrated-template buttons.
865
+ - `Location.js` — static + live location builder.
866
+ - `Contact.js` — single/multi vCard contact-card builder.
867
+ - `Album.js` — media-group/album builder (thin wrapper over the existing `content.album` shorthand).
868
+ - Fixed a version mismatch: `AIRich.js`'s internal `VERSION` constant was still `4.7` while `index.js`'s `MESSAGE_BUILDER_VERSION` had already moved to `4.8`. Both now read `5.0`.
869
+
870
+ ---
871
+
829
872
  ## 📝 V6 Patch Notes
830
873
 
831
874
  - Fixed a `package.json` typo: the version field was mistakenly left at `1.0.1` instead of `2.0.1` after the V5 release — corrected to `2.0.1` so the published package version matches the intended release.