@in.pulse-crm/sdk 2.10.4 → 2.10.6

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.
@@ -84,10 +84,12 @@ export interface WppMessageEventData {
84
84
  message: WppMessage;
85
85
  }
86
86
  export interface WppMessageEditEventData {
87
+ contactId: number;
87
88
  messageId: number;
88
89
  newText: string;
89
90
  }
90
91
  export interface WppMessageDeleteEventData {
92
+ contactId: number;
91
93
  messageId: number;
92
94
  }
93
95
  export interface WppMessageStatusEventData {
@@ -26,25 +26,26 @@ export interface WppContactWithCustomer {
26
26
  export interface WppMessage {
27
27
  id: number;
28
28
  instance: string;
29
- wwebjsId?: string | null;
30
- wabaId?: string | null;
31
- gupshupId?: string | null;
32
- gupshupRequestId?: string | null;
29
+ wwebjsId: string | null;
30
+ wabaId: string | null;
31
+ gupshupId: string | null;
32
+ gupshupRequestId: string | null;
33
33
  from: string;
34
34
  to: string;
35
35
  type: string;
36
- quotedId?: number | null;
37
- chatId?: number | null;
38
- userName?: string;
39
- contactId?: number | null;
36
+ quotedId: number | null;
37
+ chatId: number | null;
38
+ userName: string;
39
+ contactId: number | null;
40
40
  body: string;
41
41
  timestamp: string;
42
42
  status: WppMessageStatus;
43
43
  isForwarded?: boolean;
44
- fileId?: number | null;
45
- fileName?: string | null;
46
- fileType?: string | null;
47
- fileSize?: string | null;
44
+ isEdited: boolean;
45
+ fileId: number | null;
46
+ fileName: string | null;
47
+ fileType: string | null;
48
+ fileSize: string | null;
48
49
  wwebjsIdStanza: string | null;
49
50
  sentAt: Date;
50
51
  userId: number | null;
@@ -14,8 +14,9 @@ export default class WhatsappClient extends ApiClient {
14
14
  getUserWallets(instance: string, userId: number): Promise<WppWallet[]>;
15
15
  markContactMessagesAsRead(contactId: number): Promise<WppMessage[]>;
16
16
  sendMessage(to: string, data: SendMessageData): Promise<WppMessage>;
17
+ editMessage(messageId: string, newText: string): Promise<void>;
17
18
  finishChatById(id: number, resultId: number): Promise<void>;
18
- startChatByContactId(contactId: number, template?: any): Promise<WppChatWithDetailsAndMessages>;
19
+ startChatByContactId(contactId: number, template?: any): Promise<void>;
19
20
  getResults(): Promise<{
20
21
  id: number;
21
22
  name: string;
@@ -54,6 +54,11 @@ class WhatsappClient extends api_client_1.default {
54
54
  });
55
55
  return res.data;
56
56
  }
57
+ async editMessage(messageId, newText) {
58
+ const url = `/api/whatsapp/messages/${messageId}`;
59
+ const body = { newText };
60
+ const { data: res } = await this.ax.put(url, body);
61
+ }
57
62
  async finishChatById(id, resultId) {
58
63
  const url = `/api/whatsapp/chats/${id}/finish`;
59
64
  const body = { resultId };
@@ -62,8 +67,7 @@ class WhatsappClient extends api_client_1.default {
62
67
  async startChatByContactId(contactId, template) {
63
68
  const url = `/api/whatsapp/chats`;
64
69
  const body = { contactId, template };
65
- const { data: res } = await this.ax.post(url, body);
66
- return res.data;
70
+ await this.ax.post(url, body);
67
71
  }
68
72
  async getResults() {
69
73
  const url = `/api/whatsapp/results`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.10.4",
3
+ "version": "2.10.6",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -213,11 +213,13 @@ export interface WppMessageEventData {
213
213
  }
214
214
 
215
215
  export interface WppMessageEditEventData {
216
+ contactId: number;
216
217
  messageId: number;
217
218
  newText: string;
218
219
  }
219
220
 
220
221
  export interface WppMessageDeleteEventData {
222
+ contactId: number;
221
223
  messageId: number;
222
224
  }
223
225
  export interface WppMessageStatusEventData {
@@ -257,21 +259,21 @@ export type ReportStatusEventData = {
257
259
  id: number;
258
260
  type: string;
259
261
  } & (
260
- | {
262
+ | {
261
263
  isCompleted: true;
262
264
  isFailed: false;
263
265
  fileId: number;
264
266
  chats: number;
265
267
  messages: number;
266
- }
267
- | {
268
+ }
269
+ | {
268
270
  isCompleted: false;
269
271
  isFailed: true;
270
272
  error: string;
271
- }
272
- | {
273
+ }
274
+ | {
273
275
  isCompleted: false;
274
276
  isFailed: false;
275
277
  progress: number;
276
- }
277
- );
278
+ }
279
+ );
@@ -29,25 +29,26 @@ export interface WppContactWithCustomer {
29
29
  export interface WppMessage {
30
30
  id: number;
31
31
  instance: string;
32
- wwebjsId?: string | null;
33
- wabaId?: string | null;
34
- gupshupId?: string | null;
35
- gupshupRequestId?: string | null;
32
+ wwebjsId: string | null;
33
+ wabaId: string | null;
34
+ gupshupId: string | null;
35
+ gupshupRequestId: string | null;
36
36
  from: string;
37
37
  to: string;
38
38
  type: string;
39
- quotedId?: number | null;
40
- chatId?: number | null;
41
- userName?: string;
42
- contactId?: number | null;
39
+ quotedId: number | null;
40
+ chatId: number | null;
41
+ userName: string;
42
+ contactId: number | null;
43
43
  body: string;
44
44
  timestamp: string;
45
45
  status: WppMessageStatus;
46
46
  isForwarded?: boolean;
47
- fileId?: number | null;
48
- fileName?: string | null;
49
- fileType?: string | null;
50
- fileSize?: string | null;
47
+ isEdited: boolean;
48
+ fileId: number | null;
49
+ fileName: string | null;
50
+ fileType: string | null;
51
+ fileSize: string | null;
51
52
  wwebjsIdStanza: string | null;
52
53
  sentAt: Date;
53
54
  userId: number | null;
@@ -2,7 +2,7 @@ import ApiClient from "./api-client";
2
2
  import { RequestFilters } from "./types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
4
  import {
5
- AppNotification,
5
+ AppNotification,
6
6
  AutomaticResponseRule,
7
7
  AutomaticResponseRuleDTO,
8
8
  CreateScheduleDTO,
@@ -103,6 +103,15 @@ export default class WhatsappClient extends ApiClient {
103
103
  return res.data;
104
104
  }
105
105
 
106
+ public async editMessage(messageId: string, newText: string) {
107
+ const url = `/api/whatsapp/messages/${messageId}`;
108
+ const body = { newText };
109
+ const { data: res } = await this.ax.put<DataResponse<WppMessage>>(
110
+ url,
111
+ body,
112
+ );
113
+ }
114
+
106
115
  public async finishChatById(id: number, resultId: number) {
107
116
  const url = `/api/whatsapp/chats/${id}/finish`;
108
117
  const body = { resultId };
@@ -112,10 +121,10 @@ export default class WhatsappClient extends ApiClient {
112
121
  public async startChatByContactId(contactId: number, template?: any) {
113
122
  const url = `/api/whatsapp/chats`;
114
123
  const body = { contactId, template };
115
- const { data: res } = await this.ax.post<
124
+
125
+ await this.ax.post<
116
126
  DataResponse<WppChatWithDetailsAndMessages>
117
127
  >(url, body);
118
- return res.data;
119
128
  }
120
129
 
121
130
  public async getResults() {
@@ -242,9 +251,9 @@ export default class WhatsappClient extends ApiClient {
242
251
  * @param notificationId - O ID (numérico) da notificação a ser marcada.
243
252
  */
244
253
  public async markOneAsReadNotification(notificationId: number) {
245
- const url = `/api/whatsapp/notifications/${notificationId}/read`;
246
- const { data: res } = await this.ax.patch<DataResponse<AppNotification>>(url);
247
- return res;
254
+ const url = `/api/whatsapp/notifications/${notificationId}/read`;
255
+ const { data: res } = await this.ax.patch<DataResponse<AppNotification>>(url);
256
+ return res;
248
257
  }
249
258
 
250
259
  /**