@whanext/core 0.19.0 → 0.19.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.2
4
+
5
+ - Corrigido o download real de mídias citadas no provider Zapo: `downloadMedia()` agora entrega o `Proto.IMessage` bruto diretamente ao `downloadBytes()`, como suportado pela API do Zapo.
6
+ - Envelopes `viewOnceMessage`, `viewOnceMessageV2` e `viewOnceMessageV2Extension` são desembrulhados antes do download, evitando falhas ao responder imagens/vídeos de visualização única.
7
+ - A correção cobre replies comuns de imagem, vídeo, áudio e sticker, além de view-once.
8
+
9
+
10
+ ## 0.19.1
11
+
12
+ - Corrige menus de lista no provider Zapo usando `interactiveMessage` Native Flow com `single_select` em vez do `listMessage` legado.
13
+ - Respostas de `single_select` agora são normalizadas explicitamente como `message.interactive.kind = "list"`.
14
+
15
+
3
16
  ## 0.19.0
4
17
 
5
18
  ### Comandos
package/dist/index.js CHANGED
@@ -2596,14 +2596,19 @@ function getInteractiveResponse(content) {
2596
2596
  const nativeId = stringField(native, ["id", "selected_id", "row_id", "button_id"]);
2597
2597
  if (nativeId) {
2598
2598
  const title = stringField(native, ["display_text", "title"]);
2599
+ const nativeName = nativeFlowName(content);
2599
2600
  return {
2600
- kind: native && ("row_id" in native || "selected_id" in native) ? "list" : "button",
2601
+ kind: nativeName === "single_select" || native && ("row_id" in native || "selected_id" in native) ? "list" : "button",
2601
2602
  id: nativeId,
2602
2603
  ...title ? { title } : {}
2603
2604
  };
2604
2605
  }
2605
2606
  return void 0;
2606
2607
  }
2608
+ function nativeFlowName(content) {
2609
+ const response = content.interactiveResponseMessage;
2610
+ return response?.nativeFlowResponseMessage?.name ?? void 0;
2611
+ }
2607
2612
  function getNativeFlowDisplayText(content) {
2608
2613
  return stringField(nativeFlowParams(content), ["display_text", "title"]);
2609
2614
  }
@@ -2854,9 +2859,8 @@ var ZapoProvider = class {
2854
2859
  );
2855
2860
  }
2856
2861
  try {
2857
- const bytes = await this.#requireClient().message.downloadBytes(
2858
- message
2859
- );
2862
+ const mediaMessage = unwrapZapoMessageContent(message.message) ?? message.message;
2863
+ const bytes = await this.#requireClient().message.downloadBytes(mediaMessage);
2860
2864
  return {
2861
2865
  data: Buffer.from(bytes),
2862
2866
  kind: normalized.media.kind,
@@ -3299,21 +3303,36 @@ var ZapoProvider = class {
3299
3303
  this.#validateList(content);
3300
3304
  const mentions = content.mentions ? this.#mentions(content.mentions) : [];
3301
3305
  const raw = {
3302
- listMessage: {
3303
- ...content.title !== void 0 ? { title: content.title } : {},
3304
- description: content.text,
3305
- buttonText: content.buttonText,
3306
- ...content.footer !== void 0 ? { footerText: content.footer } : {},
3307
- listType: proto.Message.ListMessage.ListType.SINGLE_SELECT,
3308
- sections: content.list.map((section) => ({
3309
- ...section.title !== void 0 ? { title: section.title } : {},
3310
- rows: section.rows.map((row) => ({
3311
- rowId: row.id,
3312
- title: row.title,
3313
- ...row.description !== void 0 ? { description: row.description } : {}
3314
- }))
3315
- })),
3316
- ...mentions.length > 0 ? { contextInfo: { mentionedJid: mentions } } : {}
3306
+ interactiveMessage: {
3307
+ ...content.title !== void 0 ? {
3308
+ header: {
3309
+ title: content.title,
3310
+ hasMediaAttachment: false
3311
+ }
3312
+ } : {},
3313
+ body: { text: content.text },
3314
+ ...content.footer !== void 0 ? { footer: { text: content.footer } } : {},
3315
+ ...mentions.length > 0 ? { contextInfo: { mentionedJid: mentions } } : {},
3316
+ nativeFlowMessage: {
3317
+ buttons: [
3318
+ {
3319
+ name: "single_select",
3320
+ buttonParamsJson: JSON.stringify({
3321
+ title: content.buttonText,
3322
+ sections: content.list.map((section) => ({
3323
+ ...section.title !== void 0 ? { title: section.title } : {},
3324
+ rows: section.rows.map((row) => ({
3325
+ id: row.id,
3326
+ title: row.title,
3327
+ ...row.description !== void 0 ? { description: row.description } : {}
3328
+ }))
3329
+ }))
3330
+ })
3331
+ }
3332
+ ],
3333
+ messageParamsJson: "{}",
3334
+ messageVersion: 1
3335
+ }
3317
3336
  }
3318
3337
  };
3319
3338
  const result = await this.#requireClient().message.send(chatId, raw, {