@in.pulse-crm/sdk 2.7.9 → 2.8.0
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.
|
@@ -17,7 +17,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
17
17
|
getCustomerContacts(customerId: number): Promise<WppContact[]>;
|
|
18
18
|
getContactsWithCustomer(): Promise<WppContactWithCustomer[]>;
|
|
19
19
|
getContacts(): Promise<WppContact[]>;
|
|
20
|
-
createContact(name: string, phone: string, customerId
|
|
20
|
+
createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
|
|
21
21
|
updateContact(contactId: number, name: string): Promise<WppContact>;
|
|
22
22
|
deleteContact(contactId: number): Promise<void>;
|
|
23
23
|
getSectors(): Promise<{
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -86,7 +86,10 @@ class WhatsappClient extends api_client_1.default {
|
|
|
86
86
|
return res.data;
|
|
87
87
|
}
|
|
88
88
|
async createContact(name, phone, customerId) {
|
|
89
|
-
const
|
|
89
|
+
const baseUrl = `/api/whatsapp`;
|
|
90
|
+
const url = customerId
|
|
91
|
+
? `${baseUrl}/customers/${customerId}/contacts`
|
|
92
|
+
: `${baseUrl}/contacts`;
|
|
90
93
|
const body = { name, phone };
|
|
91
94
|
const { data: res } = await this.httpClient.post(url, body);
|
|
92
95
|
return res.data;
|
package/package.json
CHANGED
package/src/whatsapp.client.ts
CHANGED
|
@@ -153,9 +153,13 @@ export default class WhatsappClient extends ApiClient {
|
|
|
153
153
|
public async createContact(
|
|
154
154
|
name: string,
|
|
155
155
|
phone: string,
|
|
156
|
-
customerId
|
|
156
|
+
customerId?: number,
|
|
157
157
|
) {
|
|
158
|
-
const
|
|
158
|
+
const baseUrl = `/api/whatsapp`;
|
|
159
|
+
const url = customerId
|
|
160
|
+
? `${baseUrl}/customers/${customerId}/contacts`
|
|
161
|
+
: `${baseUrl}/contacts`;
|
|
162
|
+
|
|
159
163
|
const body = { name, phone };
|
|
160
164
|
|
|
161
165
|
const { data: res } = await this.httpClient.post<
|