@in.pulse-crm/sdk 2.3.1 → 2.3.3
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.
|
@@ -7,6 +7,7 @@ export declare enum SocketEventType {
|
|
|
7
7
|
WppMessage = "wpp_message",
|
|
8
8
|
WppMessageStatus = "wpp_message_status",
|
|
9
9
|
WppMessageReaction = "wpp_message_reaction",
|
|
10
|
+
WppContactMessagesRead = "wpp_contact_messages_read",
|
|
10
11
|
WwebjsQr = "wwebjs_qr",
|
|
11
12
|
WwebjsAuth = "wwebjs_auth",
|
|
12
13
|
ReportStatus = "report_status"
|
|
@@ -18,6 +19,7 @@ export interface EmitSocketEventFn {
|
|
|
18
19
|
(type: SocketEventType.WppChatFinished, room: SocketServerRoom, data: WppChatFinishedEventData): Promise<MessageResponse>;
|
|
19
20
|
(type: SocketEventType.WppMessage, room: SocketServerChatRoom, data: WppMessageEventData): Promise<MessageResponse>;
|
|
20
21
|
(type: SocketEventType.WppMessageStatus, room: SocketServerChatRoom, data: WppMessageStatusEventData): Promise<MessageResponse>;
|
|
22
|
+
(type: SocketEventType.WppContactMessagesRead, room: SocketServerChatRoom, data: WppContactMessagesReadEventData): Promise<MessageResponse>;
|
|
21
23
|
(type: SocketEventType.WppMessageReaction, room: SocketServerChatRoom, data: WppMessageReactionEventData): Promise<MessageResponse>;
|
|
22
24
|
(type: SocketEventType.ReportStatus, room: SocketServerReportsRoom, data: ReportStatusEventData): Promise<MessageResponse>;
|
|
23
25
|
}
|
|
@@ -28,6 +30,7 @@ export interface ListenSocketEventFn {
|
|
|
28
30
|
(type: SocketEventType.WppChatFinished, callback: (data: WppChatFinishedEventData) => void): void;
|
|
29
31
|
(type: SocketEventType.WppMessage, callback: (data: WppMessageEventData) => void): void;
|
|
30
32
|
(type: SocketEventType.WppMessageStatus, callback: (data: WppMessageStatusEventData) => void): void;
|
|
33
|
+
(type: SocketEventType.WppContactMessagesRead, callback: (data: WppContactMessagesReadEventData) => void): void;
|
|
31
34
|
(type: SocketEventType.WppMessageReaction, callback: (data: WppMessageReactionEventData) => void): void;
|
|
32
35
|
(type: SocketEventType.ReportStatus, callback: (data: ReportStatusEventData) => void): void;
|
|
33
36
|
}
|
|
@@ -49,6 +52,9 @@ export interface WppChatStartedEventData {
|
|
|
49
52
|
export interface WppChatFinishedEventData {
|
|
50
53
|
chatId: number;
|
|
51
54
|
}
|
|
55
|
+
export interface WppContactMessagesReadEventData {
|
|
56
|
+
contactId: number;
|
|
57
|
+
}
|
|
52
58
|
export interface WppMessageEventData {
|
|
53
59
|
message: WppMessage;
|
|
54
60
|
}
|
|
@@ -8,6 +8,7 @@ var SocketEventType;
|
|
|
8
8
|
SocketEventType["WppMessage"] = "wpp_message";
|
|
9
9
|
SocketEventType["WppMessageStatus"] = "wpp_message_status";
|
|
10
10
|
SocketEventType["WppMessageReaction"] = "wpp_message_reaction";
|
|
11
|
+
SocketEventType["WppContactMessagesRead"] = "wpp_contact_messages_read";
|
|
11
12
|
SocketEventType["WwebjsQr"] = "wwebjs_qr";
|
|
12
13
|
SocketEventType["WwebjsAuth"] = "wwebjs_auth";
|
|
13
14
|
SocketEventType["ReportStatus"] = "report_status";
|
|
@@ -5,6 +5,6 @@ export default class WhatsappClient extends ApiClient {
|
|
|
5
5
|
getChatById(id: number): Promise<WppChatWithDetailsAndMessages>;
|
|
6
6
|
getMessageById(id: string): Promise<WppMessage>;
|
|
7
7
|
getUserWallets(instance: string, userId: number): Promise<WppWallet[]>;
|
|
8
|
-
|
|
8
|
+
markContactMessagesAsRead(contactId: number): Promise<WppMessage[]>;
|
|
9
9
|
setAuth(token: string): void;
|
|
10
10
|
}
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -26,9 +26,9 @@ class WhatsappClient extends api_client_1.default {
|
|
|
26
26
|
const { data: res } = await this.httpClient.get(`/api/wallets?instance=${instance}&userId=${userId}`);
|
|
27
27
|
return res.data;
|
|
28
28
|
}
|
|
29
|
-
async
|
|
29
|
+
async markContactMessagesAsRead(contactId) {
|
|
30
30
|
const url = "/api/whatsapp/messages/mark-as-read";
|
|
31
|
-
const body = {
|
|
31
|
+
const body = { contactId };
|
|
32
32
|
const { data: res } = await this.httpClient.post(url, body);
|
|
33
33
|
return res.data;
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ export enum SocketEventType {
|
|
|
13
13
|
WppMessage = "wpp_message",
|
|
14
14
|
WppMessageStatus = "wpp_message_status",
|
|
15
15
|
WppMessageReaction = "wpp_message_reaction",
|
|
16
|
+
WppContactMessagesRead = "wpp_contact_messages_read",
|
|
16
17
|
WwebjsQr = "wwebjs_qr",
|
|
17
18
|
WwebjsAuth = "wwebjs_auth",
|
|
18
19
|
ReportStatus = "report_status",
|
|
@@ -49,6 +50,11 @@ export interface EmitSocketEventFn {
|
|
|
49
50
|
room: SocketServerChatRoom,
|
|
50
51
|
data: WppMessageStatusEventData,
|
|
51
52
|
): Promise<MessageResponse>;
|
|
53
|
+
(
|
|
54
|
+
type: SocketEventType.WppContactMessagesRead,
|
|
55
|
+
room: SocketServerChatRoom,
|
|
56
|
+
data: WppContactMessagesReadEventData,
|
|
57
|
+
): Promise<MessageResponse>;
|
|
52
58
|
(
|
|
53
59
|
type: SocketEventType.WppMessageReaction,
|
|
54
60
|
room: SocketServerChatRoom,
|
|
@@ -86,6 +92,10 @@ export interface ListenSocketEventFn {
|
|
|
86
92
|
type: SocketEventType.WppMessageStatus,
|
|
87
93
|
callback: (data: WppMessageStatusEventData) => void,
|
|
88
94
|
): void;
|
|
95
|
+
(
|
|
96
|
+
type: SocketEventType.WppContactMessagesRead,
|
|
97
|
+
callback: (data: WppContactMessagesReadEventData) => void,
|
|
98
|
+
): void;
|
|
89
99
|
(
|
|
90
100
|
type: SocketEventType.WppMessageReaction,
|
|
91
101
|
callback: (data: WppMessageReactionEventData) => void,
|
|
@@ -118,6 +128,9 @@ export interface WppChatStartedEventData {
|
|
|
118
128
|
export interface WppChatFinishedEventData {
|
|
119
129
|
chatId: number;
|
|
120
130
|
}
|
|
131
|
+
export interface WppContactMessagesReadEventData {
|
|
132
|
+
contactId: number;
|
|
133
|
+
}
|
|
121
134
|
export interface WppMessageEventData {
|
|
122
135
|
message: WppMessage;
|
|
123
136
|
}
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -53,9 +53,9 @@ export default class WhatsappClient extends ApiClient {
|
|
|
53
53
|
return res.data;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
public async
|
|
56
|
+
public async markContactMessagesAsRead(contactId: number) {
|
|
57
57
|
const url = "/api/whatsapp/messages/mark-as-read";
|
|
58
|
-
const body = {
|
|
58
|
+
const body = { contactId };
|
|
59
59
|
const { data: res } =
|
|
60
60
|
await this.httpClient.post<MarkChatAsReadResponse>(url, body);
|
|
61
61
|
|