@whanext/core 0.19.0 → 0.19.1

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.1
4
+
5
+ - Corrige menus de lista no provider Zapo usando `interactiveMessage` Native Flow com `single_select` em vez do `listMessage` legado.
6
+ - Respostas de `single_select` agora são normalizadas explicitamente como `message.interactive.kind = "list"`.
7
+
8
+
3
9
  ## 0.19.0
4
10
 
5
11
  ### 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
  }
@@ -3299,21 +3304,36 @@ var ZapoProvider = class {
3299
3304
  this.#validateList(content);
3300
3305
  const mentions = content.mentions ? this.#mentions(content.mentions) : [];
3301
3306
  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 } } : {}
3307
+ interactiveMessage: {
3308
+ ...content.title !== void 0 ? {
3309
+ header: {
3310
+ title: content.title,
3311
+ hasMediaAttachment: false
3312
+ }
3313
+ } : {},
3314
+ body: { text: content.text },
3315
+ ...content.footer !== void 0 ? { footer: { text: content.footer } } : {},
3316
+ ...mentions.length > 0 ? { contextInfo: { mentionedJid: mentions } } : {},
3317
+ nativeFlowMessage: {
3318
+ buttons: [
3319
+ {
3320
+ name: "single_select",
3321
+ buttonParamsJson: JSON.stringify({
3322
+ title: content.buttonText,
3323
+ sections: content.list.map((section) => ({
3324
+ ...section.title !== void 0 ? { title: section.title } : {},
3325
+ rows: section.rows.map((row) => ({
3326
+ id: row.id,
3327
+ title: row.title,
3328
+ ...row.description !== void 0 ? { description: row.description } : {}
3329
+ }))
3330
+ }))
3331
+ })
3332
+ }
3333
+ ],
3334
+ messageParamsJson: "{}",
3335
+ messageVersion: 1
3336
+ }
3317
3337
  }
3318
3338
  };
3319
3339
  const result = await this.#requireClient().message.send(chatId, raw, {