@in.pulse-crm/sdk 2.5.0 → 2.5.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/files.client.d.ts +0 -2
- package/dist/internal.client.d.ts +4 -1
- package/dist/internal.client.js +2 -2
- package/dist/types/files.types.d.ts +0 -2
- package/dist/whatsapp.client.d.ts +2 -0
- package/dist/whatsapp.client.js +15 -0
- package/package.json +1 -1
- package/src/internal.client.ts +2 -3
- package/src/whatsapp.client.ts +22 -0
- 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/files.client.d.ts
CHANGED
|
@@ -9,7 +9,10 @@ export default class InternalChatClient extends ApiClient {
|
|
|
9
9
|
messages: InternalMessage[];
|
|
10
10
|
}>;
|
|
11
11
|
sendMessageToChat(data: InternalSendMessageData): Promise<void>;
|
|
12
|
-
updateGroupMembers(groupId: number,
|
|
12
|
+
updateGroupMembers(groupId: number, { name, participants }: {
|
|
13
|
+
name: string;
|
|
14
|
+
participants: number[];
|
|
15
|
+
}): Promise<any>;
|
|
13
16
|
startChatByContactId(contactId: number): Promise<{
|
|
14
17
|
chat: InternalChat & {
|
|
15
18
|
messages: InternalMessage[];
|
package/dist/internal.client.js
CHANGED
|
@@ -37,8 +37,8 @@ class InternalChatClient extends api_client_1.default {
|
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
async updateGroupMembers(groupId,
|
|
41
|
-
const { data: res } = await this.httpClient.put(`/api/internal/chats/group/${groupId}/members`, {
|
|
40
|
+
async updateGroupMembers(groupId, { name, participants }) {
|
|
41
|
+
const { data: res } = await this.httpClient.put(`/api/internal/chats/group/${groupId}/members`, { name, participants });
|
|
42
42
|
return res.data;
|
|
43
43
|
}
|
|
44
44
|
async startChatByContactId(contactId) {
|
|
@@ -23,4 +23,6 @@ export default class WhatsappClient extends ApiClient {
|
|
|
23
23
|
name: string;
|
|
24
24
|
}[]>;
|
|
25
25
|
setAuth(token: string): void;
|
|
26
|
+
getChatsMonitor(messages?: boolean, contact?: boolean, token?: string | null): Promise<WppChatsAndMessages>;
|
|
27
|
+
tranferAttendance(id: number, userId: number): Promise<void>;
|
|
26
28
|
}
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -105,5 +105,20 @@ class WhatsappClient extends api_client_1.default {
|
|
|
105
105
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
106
106
|
`Bearer ${token}`;
|
|
107
107
|
}
|
|
108
|
+
async getChatsMonitor(messages = false, contact = false, token = null) {
|
|
109
|
+
const headers = token
|
|
110
|
+
? { Authorization: `Bearer ${token}` }
|
|
111
|
+
: undefined;
|
|
112
|
+
const url = `/api/whatsapp/session/monitor?messages=${messages}&contact=${contact}`;
|
|
113
|
+
const { data: res } = await this.httpClient.get(url, {
|
|
114
|
+
headers,
|
|
115
|
+
});
|
|
116
|
+
return res.data;
|
|
117
|
+
}
|
|
118
|
+
async tranferAttendance(id, userId) {
|
|
119
|
+
const url = `/api/whatsapp/chats/${id}/transfer`;
|
|
120
|
+
const body = { userId };
|
|
121
|
+
await this.httpClient.post(url, body);
|
|
122
|
+
}
|
|
108
123
|
}
|
|
109
124
|
exports.default = WhatsappClient;
|
package/package.json
CHANGED
package/src/internal.client.ts
CHANGED
|
@@ -68,12 +68,11 @@ export default class InternalChatClient extends ApiClient {
|
|
|
68
68
|
|
|
69
69
|
public async updateGroupMembers(
|
|
70
70
|
groupId: number,
|
|
71
|
-
|
|
72
|
-
remove: number[],
|
|
71
|
+
{ name, participants }: { name: string; participants: number[] },
|
|
73
72
|
) {
|
|
74
73
|
const { data: res } = await this.httpClient.put<DataResponse<any>>(
|
|
75
74
|
`/api/internal/chats/group/${groupId}/members`,
|
|
76
|
-
{
|
|
75
|
+
{ name, participants },
|
|
77
76
|
);
|
|
78
77
|
return res.data;
|
|
79
78
|
}
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -185,4 +185,26 @@ export default class WhatsappClient extends ApiClient {
|
|
|
185
185
|
this.httpClient.defaults.headers.common["Authorization"] =
|
|
186
186
|
`Bearer ${token}`;
|
|
187
187
|
}
|
|
188
|
+
public async getChatsMonitor(
|
|
189
|
+
messages = false,
|
|
190
|
+
contact = false,
|
|
191
|
+
token: string | null = null,
|
|
192
|
+
) {
|
|
193
|
+
const headers = token
|
|
194
|
+
? { Authorization: `Bearer ${token}` }
|
|
195
|
+
: undefined;
|
|
196
|
+
const url = `/api/whatsapp/session/monitor?messages=${messages}&contact=${contact}`;
|
|
197
|
+
|
|
198
|
+
const { data: res } = await this.httpClient.get<GetChatsResponse>(url, {
|
|
199
|
+
headers,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return res.data;
|
|
203
|
+
}
|
|
204
|
+
public async tranferAttendance(id: number, userId: number) {
|
|
205
|
+
const url = `/api/whatsapp/chats/${id}/transfer`;
|
|
206
|
+
const body = { userId };
|
|
207
|
+
|
|
208
|
+
await this.httpClient.post<MessageResponse>(url, body);
|
|
209
|
+
}
|
|
188
210
|
}
|
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
|
}
|