@in.pulse-crm/sdk 2.2.11 → 2.2.13
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/files.client.js +1 -1
- package/dist/types/whatsapp.types.d.ts +1 -8
- package/dist/types/whatsapp.types.js +1 -11
- package/dist/whatsapp.client.d.ts +2 -1
- package/dist/whatsapp.client.js +4 -0
- package/package.json +1 -1
- package/src/files.client.ts +1 -1
- package/src/types/whatsapp.types.ts +7 -8
- package/src/whatsapp.client.ts +9 -0
package/dist/files.client.js
CHANGED
|
@@ -34,7 +34,7 @@ class FilesClient extends api_client_1.default {
|
|
|
34
34
|
const form = new FormData();
|
|
35
35
|
form.append("instance", props.instance);
|
|
36
36
|
form.append("dirType", props.dirType);
|
|
37
|
-
form.append("file", new Blob([props.buffer]), props.fileName);
|
|
37
|
+
form.append("file", new Blob([props.buffer], { type: props.mimeType }), props.fileName);
|
|
38
38
|
const response = await this.httpClient.post("/api/files", form, {
|
|
39
39
|
headers: { "Content-Type": "multipart/form-data" },
|
|
40
40
|
});
|
|
@@ -54,14 +54,7 @@ export interface WppWallet {
|
|
|
54
54
|
id: number;
|
|
55
55
|
name: string;
|
|
56
56
|
}
|
|
57
|
-
export
|
|
58
|
-
PENDING = "PENDING",
|
|
59
|
-
SENT = "SENT",
|
|
60
|
-
RECEIVED = "RECEIVED",
|
|
61
|
-
READ = "READ",
|
|
62
|
-
DOWNLOADED = "DOWNLOADED",
|
|
63
|
-
ERROR = "ERROR"
|
|
64
|
-
}
|
|
57
|
+
export type WppMessageStatus = "PENDING" | "SENT" | "RECEIVED" | "READ" | "DOWNLOADED" | "ERROR";
|
|
65
58
|
export declare enum WppChatType {
|
|
66
59
|
RECEPTIVE = "RECEPTIVE",
|
|
67
60
|
ACTIVE = "ACTIVE"
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WppChatPriority = exports.WppChatType =
|
|
4
|
-
// Enums
|
|
5
|
-
var WppMessageStatus;
|
|
6
|
-
(function (WppMessageStatus) {
|
|
7
|
-
WppMessageStatus["PENDING"] = "PENDING";
|
|
8
|
-
WppMessageStatus["SENT"] = "SENT";
|
|
9
|
-
WppMessageStatus["RECEIVED"] = "RECEIVED";
|
|
10
|
-
WppMessageStatus["READ"] = "READ";
|
|
11
|
-
WppMessageStatus["DOWNLOADED"] = "DOWNLOADED";
|
|
12
|
-
WppMessageStatus["ERROR"] = "ERROR";
|
|
13
|
-
})(WppMessageStatus || (exports.WppMessageStatus = WppMessageStatus = {}));
|
|
3
|
+
exports.WppChatPriority = exports.WppChatType = void 0;
|
|
14
4
|
var WppChatType;
|
|
15
5
|
(function (WppChatType) {
|
|
16
6
|
WppChatType["RECEPTIVE"] = "RECEPTIVE";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
|
-
import { WppChatsAndMessages, WppChatWithDetailsAndMessages, WppMessage } from "./types/whatsapp.types";
|
|
3
|
+
import { WppChatsAndMessages, WppChatWithDetailsAndMessages, WppMessage, WppWallet } from "./types/whatsapp.types";
|
|
4
4
|
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
5
5
|
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
6
6
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
@@ -8,6 +8,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
8
8
|
getChatsBySession(token: string, messages?: boolean, contact?: boolean): Promise<GetChatsResponse>;
|
|
9
9
|
getChatById(id: number): Promise<GetChatResponse>;
|
|
10
10
|
getMessageById(id: string): Promise<GetMessageResponse>;
|
|
11
|
+
getUserWallets(instance: string, userId: number): Promise<DataResponse<WppWallet[]>>;
|
|
11
12
|
setAuth(token: string): void;
|
|
12
13
|
}
|
|
13
14
|
export {};
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -22,6 +22,10 @@ class WhatsappClient extends api_client_1.default {
|
|
|
22
22
|
const { data } = await this.httpClient.get(`/api/whatsapp/messages/${id}`);
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
+
async getUserWallets(instance, userId) {
|
|
26
|
+
const { data } = await this.httpClient.get(`/api/wallets?instance=${instance}&userId=${userId}`);
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
25
29
|
setAuth(token) {
|
|
26
30
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
27
31
|
`Bearer ${token}`;
|
package/package.json
CHANGED
package/src/files.client.ts
CHANGED
|
@@ -35,7 +35,7 @@ class FilesClient extends ApiClient {
|
|
|
35
35
|
const form = new FormData();
|
|
36
36
|
form.append("instance", props.instance);
|
|
37
37
|
form.append("dirType", props.dirType);
|
|
38
|
-
form.append("file", new Blob([props.buffer]), props.fileName);
|
|
38
|
+
form.append("file", new Blob([props.buffer], { type: props.mimeType }), props.fileName);
|
|
39
39
|
|
|
40
40
|
const response = await this.httpClient.post<DataResponse<File>>(
|
|
41
41
|
"/api/files",
|
|
@@ -61,14 +61,13 @@ export interface WppWallet {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// Enums
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
64
|
+
export type WppMessageStatus =
|
|
65
|
+
| "PENDING"
|
|
66
|
+
| "SENT"
|
|
67
|
+
| "RECEIVED"
|
|
68
|
+
| "READ"
|
|
69
|
+
| "DOWNLOADED"
|
|
70
|
+
| "ERROR";
|
|
72
71
|
|
|
73
72
|
export enum WppChatType {
|
|
74
73
|
RECEPTIVE = "RECEPTIVE",
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
WppChatsAndMessages,
|
|
5
5
|
WppChatWithDetailsAndMessages,
|
|
6
6
|
WppMessage,
|
|
7
|
+
WppWallet,
|
|
7
8
|
} from "./types/whatsapp.types";
|
|
8
9
|
|
|
9
10
|
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
@@ -43,6 +44,14 @@ export default class WhatsappClient extends ApiClient {
|
|
|
43
44
|
return data;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
public async getUserWallets(instance: string, userId: number) {
|
|
48
|
+
const { data } = await this.httpClient.get<DataResponse<WppWallet[]>>(
|
|
49
|
+
`/api/wallets?instance=${instance}&userId=${userId}`,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
public setAuth(token: string) {
|
|
47
56
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
48
57
|
`Bearer ${token}`;
|