@in.pulse-crm/sdk 2.3.93 → 2.4.2
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/.prettierrc +4 -4
- package/dist/customers.client.js +2 -2
- package/dist/files.client.d.ts +2 -0
- package/dist/types/files.types.d.ts +2 -0
- package/dist/types/whatsapp.types.d.ts +1 -1
- package/dist/users.client.js +2 -2
- package/dist/whatsapp.client.js +7 -2
- package/package.json +2 -1
- package/src/customers.client.ts +2 -2
- package/src/types/whatsapp.types.ts +3 -2
- package/src/users.client.ts +3 -3
- package/src/whatsapp.client.ts +6 -1
- package/tsconfig.json +16 -16
package/.prettierrc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tabWidth": 4,
|
|
3
|
-
"useTabs": true
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"tabWidth": 4,
|
|
3
|
+
"useTabs": true
|
|
4
|
+
}
|
package/dist/customers.client.js
CHANGED
|
@@ -42,8 +42,8 @@ class CustomersClient extends api_client_1.default {
|
|
|
42
42
|
*/
|
|
43
43
|
async getCustomers(filters) {
|
|
44
44
|
let baseUrl = `/api/customers`;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (filters) {
|
|
46
|
+
const params = new URLSearchParams(filters);
|
|
47
47
|
baseUrl += `?${params.toString()}`;
|
|
48
48
|
}
|
|
49
49
|
const response = await this.httpClient.get(baseUrl);
|
package/dist/files.client.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface WppWallet {
|
|
|
54
54
|
id: number;
|
|
55
55
|
name: string;
|
|
56
56
|
}
|
|
57
|
-
export type WppMessageStatus = "PENDING" | "SENT" | "RECEIVED" | "READ" | "DOWNLOADED" | "ERROR";
|
|
57
|
+
export type WppMessageStatus = "PENDING" | "SENT" | "RECEIVED" | "READ" | "DOWNLOADED" | "ERROR" | "REVOKED";
|
|
58
58
|
export declare enum WppChatType {
|
|
59
59
|
RECEPTIVE = "RECEPTIVE",
|
|
60
60
|
ACTIVE = "ACTIVE"
|
package/dist/users.client.js
CHANGED
|
@@ -15,8 +15,8 @@ class UsersClient extends api_client_1.default {
|
|
|
15
15
|
*/
|
|
16
16
|
async getUsers(filters) {
|
|
17
17
|
let baseUrl = `/api/users`;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (filters) {
|
|
19
|
+
const params = new URLSearchParams(filters);
|
|
20
20
|
baseUrl += `?${params.toString()}`;
|
|
21
21
|
}
|
|
22
22
|
const response = await this.httpClient.get(baseUrl);
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const api_client_1 = __importDefault(require("./api-client"));
|
|
7
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
7
8
|
class WhatsappClient extends api_client_1.default {
|
|
8
9
|
async getChatsBySession(token, messages = false, contact = false) {
|
|
9
10
|
const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
|
|
@@ -34,7 +35,7 @@ class WhatsappClient extends api_client_1.default {
|
|
|
34
35
|
}
|
|
35
36
|
async sendMessage(to, data) {
|
|
36
37
|
const url = "/api/whatsapp/messages";
|
|
37
|
-
const formData = new
|
|
38
|
+
const formData = new form_data_1.default();
|
|
38
39
|
formData.append("to", to);
|
|
39
40
|
data.text && formData.append("text", data.text);
|
|
40
41
|
data.file && formData.append("file", data.file);
|
|
@@ -45,7 +46,11 @@ class WhatsappClient extends api_client_1.default {
|
|
|
45
46
|
data.sendAsDocument && formData.append("sendAsDocument", "true");
|
|
46
47
|
data.sendAsChatOwner &&
|
|
47
48
|
formData.append("sendAsChatOwner", String(data.sendAsChatOwner));
|
|
48
|
-
const { data: res } = await this.httpClient.post(url, formData
|
|
49
|
+
const { data: res } = await this.httpClient.post(url, formData, {
|
|
50
|
+
headers: {
|
|
51
|
+
"Content-Type": "multipart/form-data",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
49
54
|
return res.data;
|
|
50
55
|
}
|
|
51
56
|
setAuth(token) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@in.pulse-crm/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "SDKs for abstraction of api consumption of in.pulse-crm application",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@in.pulse-crm/utils": "^1.3.0",
|
|
27
27
|
"axios": "^1.8.3",
|
|
28
|
+
"form-data": "^4.0.2",
|
|
28
29
|
"socket.io-client": "^4.8.1",
|
|
29
30
|
"tsc": "^2.0.4"
|
|
30
31
|
},
|
package/src/customers.client.ts
CHANGED
|
@@ -53,9 +53,9 @@ class CustomersClient extends ApiClient {
|
|
|
53
53
|
*/
|
|
54
54
|
public async getCustomers(filters?: RequestFilters<Customer>) {
|
|
55
55
|
let baseUrl = `/api/customers`;
|
|
56
|
-
const params = new URLSearchParams(filters);
|
|
57
56
|
|
|
58
|
-
if (
|
|
57
|
+
if (filters) {
|
|
58
|
+
const params = new URLSearchParams(filters);
|
|
59
59
|
baseUrl += `?${params.toString()}`;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -67,7 +67,8 @@ export type WppMessageStatus =
|
|
|
67
67
|
| "RECEIVED"
|
|
68
68
|
| "READ"
|
|
69
69
|
| "DOWNLOADED"
|
|
70
|
-
| "ERROR"
|
|
70
|
+
| "ERROR"
|
|
71
|
+
| "REVOKED";
|
|
71
72
|
|
|
72
73
|
export enum WppChatType {
|
|
73
74
|
RECEPTIVE = "RECEPTIVE",
|
|
@@ -104,4 +105,4 @@ export interface SendMessageData {
|
|
|
104
105
|
text?: string | null;
|
|
105
106
|
file?: File;
|
|
106
107
|
fileId?: number;
|
|
107
|
-
}
|
|
108
|
+
}
|
package/src/users.client.ts
CHANGED
|
@@ -14,9 +14,9 @@ export default class UsersClient extends ApiClient {
|
|
|
14
14
|
*/
|
|
15
15
|
public async getUsers(filters?: RequestFilters<User>) {
|
|
16
16
|
let baseUrl = `/api/users`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
|
|
18
|
+
if (filters) {
|
|
19
|
+
const params = new URLSearchParams(filters);
|
|
20
20
|
baseUrl += `?${params.toString()}`;
|
|
21
21
|
}
|
|
22
22
|
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
WppMessage,
|
|
8
8
|
WppWallet,
|
|
9
9
|
} from "./types/whatsapp.types";
|
|
10
|
+
import FormData from "form-data";
|
|
10
11
|
|
|
11
12
|
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
12
13
|
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
@@ -80,7 +81,11 @@ export default class WhatsappClient extends ApiClient {
|
|
|
80
81
|
|
|
81
82
|
const { data: res } = await this.httpClient.post<
|
|
82
83
|
DataResponse<WppMessage>
|
|
83
|
-
>(url, formData
|
|
84
|
+
>(url, formData, {
|
|
85
|
+
headers: {
|
|
86
|
+
"Content-Type": "multipart/form-data",
|
|
87
|
+
},
|
|
88
|
+
});
|
|
84
89
|
|
|
85
90
|
return res.data;
|
|
86
91
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
-
"noUnusedLocals": false,
|
|
10
|
-
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
-
"declaration": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src/index.ts",
|
|
15
|
-
"src/**/*.{ts}"
|
|
16
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
+
"noUnusedLocals": false,
|
|
10
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"src/index.ts",
|
|
15
|
+
"src/**/*.{ts}"
|
|
16
|
+
]
|
|
17
17
|
}
|