@adatechnology/meta-whatsapp-module 0.3.1 → 0.4.0

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/dist/index.js CHANGED
@@ -2550,6 +2550,10 @@ function extractContent(message) {
2550
2550
  const items = message.order.product_items.reduce((sum, item) => sum + item.quantity, 0);
2551
2551
  return `Pedido: ${items} item(ns)`;
2552
2552
  }
2553
+ if (message.location) {
2554
+ const label = message.location.name ?? message.location.address;
2555
+ return label ? `\u{1F4CD} Localiza\xE7\xE3o: ${label}` : "\u{1F4CD} Localiza\xE7\xE3o";
2556
+ }
2553
2557
  return message.image?.caption ?? message.document?.caption ?? null;
2554
2558
  }
2555
2559
  __name(extractContent, "extractContent");
@@ -2562,6 +2566,7 @@ function extractPayload(message) {
2562
2566
  if (message.video) payload["video"] = message.video;
2563
2567
  if (message.document) payload["document"] = message.document;
2564
2568
  if (message.sticker) payload["sticker"] = message.sticker;
2569
+ if (message.location) payload["location"] = message.location;
2565
2570
  if (message.context?.referred_product) payload["referredProduct"] = message.context.referred_product;
2566
2571
  return Object.keys(payload).length > 0 ? payload : null;
2567
2572
  }