@pontalabs/baileys 1.2.0 → 1.2.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.
@@ -155,7 +155,8 @@ export const makeMessagesSocket = (config) => {
155
155
  return null;
156
156
  }
157
157
  jid = jidNormalizedUser(jid);
158
- return { jid, user };
158
+ let sendMessage;
159
+ return { jid, user };
159
160
  })
160
161
  .filter(jid => jid !== null);
161
162
  let mgetDevices;
@@ -1126,7 +1127,7 @@ export const makeMessagesSocket = (config) => {
1126
1127
  }
1127
1128
  return album;
1128
1129
  },
1129
- sendMessage: async (jid, content, options = {}) => {
1130
+ sendMessage: (sendMessage = async (jid, content, options = {}) => {
1130
1131
  const userJid = authState.creds.me.id;
1131
1132
 
1132
1133
  // `buildDelay` sends each item in `content.items` as its own Rich AI
@@ -1140,7 +1141,7 @@ export const makeMessagesSocket = (config) => {
1140
1141
  const results = [];
1141
1142
  for (let index = 0; index < content.items.length; index++) {
1142
1143
  if (index > 0) await delay(buildDelay);
1143
- results.push(await sock.sendMessage(jid, content.items[index], sendOptions));
1144
+ results.push(await sendMessage(jid, content.items[index], sendOptions));
1144
1145
  }
1145
1146
  return results;
1146
1147
  }
@@ -1417,7 +1418,7 @@ export const makeMessagesSocket = (config) => {
1417
1418
  }
1418
1419
  return fullMsg;
1419
1420
  }
1420
- },
1421
+ }),
1421
1422
  sendTable: async (jid, title, headers, rows, quoted, options = {}) => {
1422
1423
  const { message, messageId } = generateTableContent(title, headers, rows, quoted, options);
1423
1424
  await relayMessage(jid, message, { messageId });
@@ -3220,8 +3220,7 @@ const build = {
3220
3220
 
3221
3221
  // Expose the namespace globally so applications can use build.* without
3222
3222
  // importing another symbol. The named export remains available as well.
3223
- if (!globalThis.build) {
3224
- globalThis.build = build;
3225
- }
3223
+ // Always refresh the global namespace so newly added builder methods are available.
3224
+ globalThis.build = build;
3226
3225
 
3227
3226
  export { VERSION, Button, ButtonV2, Carousel, AIRich, Toolkit, build };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pontalabs/baileys",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "PontaLabs Baileys is a lightweight, modern, and customizable WhatsApp Web API library built on Baileys.",
6
6
  "keywords": [
7
7
  "whatsapp",