@gamastudio/sendwave-provider 0.0.21-dev2 → 0.0.21-dev4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamastudio/sendwave-provider",
3
- "version": "0.0.21-dev2",
3
+ "version": "0.0.21-dev4",
4
4
  "description": "Librería para interactuar con Sendwave usando configuración dinámica.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -30,14 +30,15 @@ class SendWaveCore extends node_events_1.EventEmitter {
30
30
  var _a;
31
31
  try {
32
32
  const { body } = req;
33
+ console.log("EVENTS:", body);
33
34
  if (!["messages.upsert", "send.message"].includes(body.event)) {
34
35
  return res.end("Message queued");
35
36
  }
36
- console.log(body);
37
+ console.log("INCOMING MSG:", body);
37
38
  const data = (0, parserMsg_1.parseIncomingMsg)(body);
38
39
  if (!data)
39
40
  return res.end("Message queued");
40
- console.log(data);
41
+ console.log("DATA PARSER", data);
41
42
  this.flowMessage(data);
42
43
  if (!(data === null || data === void 0 ? void 0 : data.fromMe)) {
43
44
  // Emit message event for queue flow system integration
@@ -48,8 +49,8 @@ class SendWaveCore extends node_events_1.EventEmitter {
48
49
  from: data.from,
49
50
  messageId: data.messageId,
50
51
  })
51
- .catch((err) => {
52
- console.error("[AutoRead Error]", (err === null || err === void 0 ? void 0 : err.message) || err);
52
+ .catch((_) => {
53
+ return res.end("Message queued");
53
54
  });
54
55
  if ((_a = this.globalVendorArgs.message) === null || _a === void 0 ? void 0 : _a.mergeMessage) {
55
56
  this.bufferMessage(data);
@@ -71,15 +71,17 @@ class SenderMessage {
71
71
  async sendText(data) {
72
72
  var _a, _b, _c;
73
73
  try {
74
- await this.sendPresence({
75
- from: data.from,
76
- presence: "composing",
77
- delay: data.delay || 2000,
78
- });
74
+ // try {
75
+ // await this.sendPresence({
76
+ // from: data.from,
77
+ // presence: "composing",
78
+ // });
79
+ // } catch (_) {}
79
80
  return await ((_a = this.sendwaveApi) === null || _a === void 0 ? void 0 : _a.post(`/message/sendText/${(_b = this.globalVendorArgs) === null || _b === void 0 ? void 0 : _b.name}`, {
81
+ delay: data.delay || 2000,
82
+ ...this.globalVendorArgs,
80
83
  number: data.from,
81
84
  text: data.text,
82
- ...this.globalVendorArgs,
83
85
  }));
84
86
  }
85
87
  catch (e) {
@@ -278,14 +280,16 @@ class SenderMessage {
278
280
  detectorMedia_1.detectorMedia.updateLimits(this.globalVendorArgs.payloadLimits.media);
279
281
  }
280
282
  const { media } = await detectorMedia_1.detectorMedia.processMedia(data.url);
281
- await this.sendPresence({
282
- from: data.from,
283
- presence: "recording",
284
- delay: data.delay || 2000,
285
- });
283
+ // try {
284
+ // await this.sendPresence({
285
+ // from: data.from,
286
+ // presence: "recording",
287
+ // });
288
+ // } catch (error) {}
286
289
  return await ((_c = this.sendwaveApi) === null || _c === void 0 ? void 0 : _c.post(`/message/sendWhatsAppAudio/${(_d = this.globalVendorArgs) === null || _d === void 0 ? void 0 : _d.name}`, {
287
290
  number: data.from,
288
291
  audio: media,
292
+ delay: data.delay || 2000,
289
293
  ...this.globalVendorArgs,
290
294
  }));
291
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamastudio/sendwave-provider",
3
- "version": "0.0.21-dev2",
3
+ "version": "0.0.21-dev4",
4
4
  "description": "Librería para interactuar con Sendwave usando configuración dinámica.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/queue.class.log DELETED
File without changes