@in.pulse-crm/sdk 2.5.4 → 2.5.5
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.
|
@@ -108,3 +108,15 @@ export interface SendMessageData {
|
|
|
108
108
|
file?: File;
|
|
109
109
|
fileId?: number;
|
|
110
110
|
}
|
|
111
|
+
export interface MonitorChat {
|
|
112
|
+
id: string;
|
|
113
|
+
erpCode: string;
|
|
114
|
+
companyName: string;
|
|
115
|
+
contactName: string;
|
|
116
|
+
whatsappNumber: string;
|
|
117
|
+
sectorName: string;
|
|
118
|
+
attendantName: string;
|
|
119
|
+
startDate: string;
|
|
120
|
+
endDate: string;
|
|
121
|
+
result: string;
|
|
122
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppWallet } from "./types/whatsapp.types";
|
|
2
|
+
import { MonitorChat, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppWallet } from "./types/whatsapp.types";
|
|
3
3
|
export default class WhatsappClient extends ApiClient {
|
|
4
4
|
getChatsBySession(messages?: boolean, contact?: boolean, token?: string | null): Promise<WppChatsAndMessages>;
|
|
5
5
|
getChatById(id: number): Promise<WppChatWithDetailsAndMessages>;
|
|
@@ -23,6 +23,6 @@ export default class WhatsappClient extends ApiClient {
|
|
|
23
23
|
name: string;
|
|
24
24
|
}[]>;
|
|
25
25
|
setAuth(token: string): void;
|
|
26
|
-
getChatsMonitor(
|
|
26
|
+
getChatsMonitor(token?: string | null): Promise<MonitorChat[]>;
|
|
27
27
|
transferAttendance(id: number, userId: number): Promise<void>;
|
|
28
28
|
}
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -105,11 +105,11 @@ class WhatsappClient extends api_client_1.default {
|
|
|
105
105
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
106
106
|
`Bearer ${token}`;
|
|
107
107
|
}
|
|
108
|
-
async getChatsMonitor(
|
|
108
|
+
async getChatsMonitor(token = null) {
|
|
109
109
|
const headers = token
|
|
110
110
|
? { Authorization: `Bearer ${token}` }
|
|
111
111
|
: undefined;
|
|
112
|
-
const url = `/api/whatsapp/session/monitor
|
|
112
|
+
const url = `/api/whatsapp/session/monitor`;
|
|
113
113
|
const { data: res } = await this.httpClient.get(url, {
|
|
114
114
|
headers,
|
|
115
115
|
});
|
package/package.json
CHANGED
|
@@ -128,3 +128,15 @@ export interface SendMessageData {
|
|
|
128
128
|
file?: File;
|
|
129
129
|
fileId?: number;
|
|
130
130
|
}
|
|
131
|
+
export interface MonitorChat {
|
|
132
|
+
id: string;
|
|
133
|
+
erpCode: string;
|
|
134
|
+
companyName: string;
|
|
135
|
+
contactName: string;
|
|
136
|
+
whatsappNumber: string;
|
|
137
|
+
sectorName: string;
|
|
138
|
+
attendantName: string;
|
|
139
|
+
startDate: string;
|
|
140
|
+
endDate: string;
|
|
141
|
+
result: string;
|
|
142
|
+
}
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { DataResponse, MessageResponse } from "./types/response.types";
|
|
3
3
|
import {
|
|
4
|
+
MonitorChat,
|
|
4
5
|
SendMessageData,
|
|
5
6
|
WppChatsAndMessages,
|
|
6
7
|
WppChatWithDetailsAndMessages,
|
|
@@ -15,6 +16,7 @@ type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
|
15
16
|
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
16
17
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
17
18
|
type MarkChatAsReadResponse = DataResponse<WppMessage[]>;
|
|
19
|
+
type GetMonitorChatsResponse = DataResponse<MonitorChat[]>;
|
|
18
20
|
|
|
19
21
|
export default class WhatsappClient extends ApiClient {
|
|
20
22
|
public async getChatsBySession(
|
|
@@ -186,16 +188,14 @@ export default class WhatsappClient extends ApiClient {
|
|
|
186
188
|
`Bearer ${token}`;
|
|
187
189
|
}
|
|
188
190
|
public async getChatsMonitor(
|
|
189
|
-
messages = false,
|
|
190
|
-
contact = false,
|
|
191
191
|
token: string | null = null,
|
|
192
192
|
) {
|
|
193
193
|
const headers = token
|
|
194
194
|
? { Authorization: `Bearer ${token}` }
|
|
195
195
|
: undefined;
|
|
196
|
-
const url = `/api/whatsapp/session/monitor
|
|
196
|
+
const url = `/api/whatsapp/session/monitor`;
|
|
197
197
|
|
|
198
|
-
const { data: res } = await this.httpClient.get<
|
|
198
|
+
const { data: res } = await this.httpClient.get<GetMonitorChatsResponse>(url, {
|
|
199
199
|
headers,
|
|
200
200
|
});
|
|
201
201
|
|