@in.pulse-crm/sdk 2.12.4 → 2.12.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.
- package/dist/types/whatsapp.types.d.ts +18 -3
- package/dist/whatsapp.client.d.ts +2 -2
- package/dist/whatsapp.client.js +10 -10
- package/package.json +1 -1
- package/src/types/whatsapp.types.ts +19 -3
- package/src/whatsapp.client.ts +20 -12
|
@@ -14,14 +14,29 @@ export interface WppContactWithCustomer {
|
|
|
14
14
|
id: number;
|
|
15
15
|
name: string;
|
|
16
16
|
phone: string;
|
|
17
|
-
customerId
|
|
18
|
-
avatarUrl
|
|
17
|
+
customerId: number | null;
|
|
18
|
+
avatarUrl: string | null;
|
|
19
19
|
instance: string;
|
|
20
20
|
isBlocked: boolean;
|
|
21
21
|
isOnlyAdmin: boolean;
|
|
22
|
+
isDeleted: boolean;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date | null;
|
|
25
|
+
conversationExpiration: string | null;
|
|
22
26
|
customer: Customer | null;
|
|
23
27
|
chatingWith: string | null;
|
|
24
|
-
lastOutOfHoursReplySentAt
|
|
28
|
+
lastOutOfHoursReplySentAt: Date | null;
|
|
29
|
+
}
|
|
30
|
+
export interface PaginatedContactsResponse {
|
|
31
|
+
data: WppContactWithCustomer[];
|
|
32
|
+
pagination: {
|
|
33
|
+
page: number;
|
|
34
|
+
perPage: number;
|
|
35
|
+
total: number;
|
|
36
|
+
totalPages: number;
|
|
37
|
+
hasNext: boolean;
|
|
38
|
+
hasPrev: boolean;
|
|
39
|
+
};
|
|
25
40
|
}
|
|
26
41
|
export interface WppMessage {
|
|
27
42
|
id: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { RequestFilters } from "./types";
|
|
3
3
|
import { DataResponse, MessageResponse } from "./types/response.types";
|
|
4
|
-
import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact,
|
|
4
|
+
import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedContactsResponse, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
|
|
5
5
|
interface FetchMessagesFilters {
|
|
6
6
|
minDate: string;
|
|
7
7
|
maxDate: string;
|
|
@@ -32,7 +32,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
32
32
|
hasCustomer?: boolean;
|
|
33
33
|
page?: number;
|
|
34
34
|
perPage?: number;
|
|
35
|
-
}): Promise<
|
|
35
|
+
}): Promise<PaginatedContactsResponse>;
|
|
36
36
|
getContacts(): Promise<WppContact[]>;
|
|
37
37
|
createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
|
|
38
38
|
forwardMessages(data: ForwardMessagesData): Promise<void>;
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -86,28 +86,28 @@ class WhatsappClient extends api_client_1.default {
|
|
|
86
86
|
if (filters) {
|
|
87
87
|
const params = new URLSearchParams();
|
|
88
88
|
if (filters.name)
|
|
89
|
-
params.append(
|
|
89
|
+
params.append("name", filters.name);
|
|
90
90
|
if (filters.phone)
|
|
91
|
-
params.append(
|
|
91
|
+
params.append("phone", filters.phone);
|
|
92
92
|
if (filters.customerId !== undefined)
|
|
93
|
-
params.append(
|
|
93
|
+
params.append("customerId", String(filters.customerId));
|
|
94
94
|
if (filters.customerErp)
|
|
95
|
-
params.append(
|
|
95
|
+
params.append("customerErp", filters.customerErp);
|
|
96
96
|
if (filters.customerCnpj)
|
|
97
|
-
params.append(
|
|
97
|
+
params.append("customerCnpj", filters.customerCnpj);
|
|
98
98
|
if (filters.customerName)
|
|
99
|
-
params.append(
|
|
99
|
+
params.append("customerName", filters.customerName);
|
|
100
100
|
if (filters.hasCustomer !== undefined)
|
|
101
|
-
params.append(
|
|
101
|
+
params.append("hasCustomer", String(filters.hasCustomer));
|
|
102
102
|
if (filters.page !== undefined)
|
|
103
|
-
params.append(
|
|
103
|
+
params.append("page", String(filters.page));
|
|
104
104
|
if (filters.perPage !== undefined)
|
|
105
|
-
params.append(
|
|
105
|
+
params.append("perPage", String(filters.perPage));
|
|
106
106
|
const queryString = params.toString();
|
|
107
107
|
if (queryString)
|
|
108
108
|
url += `?${queryString}`;
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const res = await this.ax.get(url);
|
|
111
111
|
return res.data;
|
|
112
112
|
}
|
|
113
113
|
async getContacts() {
|
package/package.json
CHANGED
|
@@ -16,14 +16,30 @@ export interface WppContactWithCustomer {
|
|
|
16
16
|
id: number;
|
|
17
17
|
name: string;
|
|
18
18
|
phone: string;
|
|
19
|
-
customerId
|
|
20
|
-
avatarUrl
|
|
19
|
+
customerId: number | null;
|
|
20
|
+
avatarUrl: string | null;
|
|
21
21
|
instance: string;
|
|
22
22
|
isBlocked: boolean;
|
|
23
23
|
isOnlyAdmin: boolean;
|
|
24
|
+
isDeleted: boolean;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date | null;
|
|
27
|
+
conversationExpiration: string | null;
|
|
24
28
|
customer: Customer | null;
|
|
25
29
|
chatingWith: string | null;
|
|
26
|
-
lastOutOfHoursReplySentAt
|
|
30
|
+
lastOutOfHoursReplySentAt: Date | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PaginatedContactsResponse {
|
|
34
|
+
data: WppContactWithCustomer[];
|
|
35
|
+
pagination: {
|
|
36
|
+
page: number;
|
|
37
|
+
perPage: number;
|
|
38
|
+
total: number;
|
|
39
|
+
totalPages: number;
|
|
40
|
+
hasNext: boolean;
|
|
41
|
+
hasPrev: boolean;
|
|
42
|
+
};
|
|
27
43
|
}
|
|
28
44
|
|
|
29
45
|
export interface WppMessage {
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
AutomaticResponseRuleDTO,
|
|
8
8
|
CreateScheduleDTO,
|
|
9
9
|
ForwardMessagesData,
|
|
10
|
+
PaginatedContactsResponse,
|
|
10
11
|
PaginatedNotificationsResponse,
|
|
11
12
|
SendMessageData,
|
|
12
13
|
WppChatsAndMessages,
|
|
13
14
|
WppChatWithDetailsAndMessages,
|
|
14
15
|
WppContact,
|
|
15
|
-
WppContactWithCustomer,
|
|
16
16
|
WppMessage,
|
|
17
17
|
WppSchedule,
|
|
18
18
|
WppWallet,
|
|
@@ -165,20 +165,28 @@ export default class WhatsappClient extends ApiClient {
|
|
|
165
165
|
let url = `/api/whatsapp/contacts/customer`;
|
|
166
166
|
if (filters) {
|
|
167
167
|
const params = new URLSearchParams();
|
|
168
|
-
if (filters.name) params.append(
|
|
169
|
-
if (filters.phone) params.append(
|
|
170
|
-
if (filters.customerId !== undefined)
|
|
171
|
-
|
|
172
|
-
if (filters.
|
|
173
|
-
|
|
174
|
-
if (filters.
|
|
175
|
-
|
|
176
|
-
if (filters.
|
|
168
|
+
if (filters.name) params.append("name", filters.name);
|
|
169
|
+
if (filters.phone) params.append("phone", filters.phone);
|
|
170
|
+
if (filters.customerId !== undefined)
|
|
171
|
+
params.append("customerId", String(filters.customerId));
|
|
172
|
+
if (filters.customerErp)
|
|
173
|
+
params.append("customerErp", filters.customerErp);
|
|
174
|
+
if (filters.customerCnpj)
|
|
175
|
+
params.append("customerCnpj", filters.customerCnpj);
|
|
176
|
+
if (filters.customerName)
|
|
177
|
+
params.append("customerName", filters.customerName);
|
|
178
|
+
if (filters.hasCustomer !== undefined)
|
|
179
|
+
params.append("hasCustomer", String(filters.hasCustomer));
|
|
180
|
+
if (filters.page !== undefined)
|
|
181
|
+
params.append("page", String(filters.page));
|
|
182
|
+
if (filters.perPage !== undefined)
|
|
183
|
+
params.append("perPage", String(filters.perPage));
|
|
177
184
|
const queryString = params.toString();
|
|
178
185
|
if (queryString) url += `?${queryString}`;
|
|
179
186
|
}
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
|
|
188
|
+
const res = await this.ax.get<PaginatedContactsResponse>(url);
|
|
189
|
+
|
|
182
190
|
return res.data;
|
|
183
191
|
}
|
|
184
192
|
|