@in.pulse-crm/sdk 2.11.6 → 2.12.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.
- package/CHANGELOG_READY_MESSAGES.md +417 -0
- package/MIGRATION_CAMELCASE.md +292 -0
- package/dist/files.client.js +11 -36
- package/dist/ready-message.client.d.ts +91 -4
- package/dist/ready-message.client.js +109 -13
- package/dist/types/ready-messages.types.d.ts +56 -0
- package/dist/users.client.js +1 -2
- package/package.json +1 -1
- package/src/files.client.ts +11 -36
- package/src/ready-message.client.ts +139 -38
- package/src/types/ready-messages.types.ts +62 -1
- package/src/users.client.ts +10 -10
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Mensagem Pronta (Ready Message)
|
|
3
|
+
* Representa templates de mensagens que podem ser usadas rapidamente no atendimento
|
|
4
|
+
*/
|
|
5
|
+
export interface ReadyMessage {
|
|
6
|
+
id: number;
|
|
7
|
+
instance: string;
|
|
8
|
+
sectorId: number;
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
fileId: number | null;
|
|
12
|
+
fileName: string | null;
|
|
13
|
+
onlyAdmin: boolean;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* DTO para criação de mensagem pronta
|
|
20
|
+
*/
|
|
21
|
+
export interface CreateReadyMessageDto {
|
|
22
|
+
title: string;
|
|
23
|
+
message: string;
|
|
24
|
+
sectorId?: number; // Opcional - se não fornecido, usa o setor do usuário
|
|
25
|
+
onlyAdmin?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* DTO para atualização de mensagem pronta
|
|
30
|
+
*/
|
|
31
|
+
export interface UpdateReadyMessageDto {
|
|
32
|
+
title?: string;
|
|
33
|
+
message?: string;
|
|
34
|
+
onlyAdmin?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use CreateReadyMessageDto ao invés deste tipo legado
|
|
39
|
+
* Mantido apenas para compatibilidade com código antigo que usa UPPERCASE
|
|
40
|
+
*/
|
|
41
|
+
export interface CreateReadyMessageDtoLegacy {
|
|
42
|
+
TITULO: string;
|
|
43
|
+
TEXTO_MENSAGEM: string;
|
|
44
|
+
SETOR?: number;
|
|
45
|
+
APENAS_ADMIN?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Use UpdateReadyMessageDto ao invés deste tipo legado
|
|
50
|
+
* Mantido apenas para compatibilidade com código antigo que usa UPPERCASE
|
|
51
|
+
*/
|
|
52
|
+
export interface UpdateReadyMessageDtoLegacy {
|
|
53
|
+
TITULO?: string;
|
|
54
|
+
TEXTO_MENSAGEM?: string;
|
|
55
|
+
APENAS_ADMIN?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use ReadyMessage ao invés deste tipo legado
|
|
60
|
+
* Mantido apenas para compatibilidade com código antigo
|
|
61
|
+
*/
|
|
62
|
+
export interface ReadyMessageLegacy {
|
|
2
63
|
CODIGO: number;
|
|
3
64
|
TITULO: string;
|
|
4
65
|
SETOR: number;
|
package/src/users.client.ts
CHANGED
|
@@ -20,8 +20,7 @@ export default class UsersClient extends ApiClient {
|
|
|
20
20
|
baseUrl += `?${params.toString()}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const response =
|
|
24
|
-
await this.ax.get<PaginatedResponse<User>>(baseUrl);
|
|
23
|
+
const response = await this.ax.get<PaginatedResponse<User>>(baseUrl);
|
|
25
24
|
|
|
26
25
|
return response.data;
|
|
27
26
|
}
|
|
@@ -47,9 +46,10 @@ export default class UsersClient extends ApiClient {
|
|
|
47
46
|
*/
|
|
48
47
|
public async createUser(data: CreateUserDTO) {
|
|
49
48
|
try {
|
|
50
|
-
const { data: res } = await this.ax.post<
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const { data: res } = await this.ax.post<DataResponse<User>>(
|
|
50
|
+
`/api/users`,
|
|
51
|
+
data,
|
|
52
|
+
);
|
|
53
53
|
|
|
54
54
|
return res.data;
|
|
55
55
|
} catch (error) {
|
|
@@ -66,9 +66,10 @@ export default class UsersClient extends ApiClient {
|
|
|
66
66
|
*/
|
|
67
67
|
public async updateUser(userId: string, data: UpdateUserDTO) {
|
|
68
68
|
try {
|
|
69
|
-
const { data: res } = await this.ax.patch<
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const { data: res } = await this.ax.patch<DataResponse<User>>(
|
|
70
|
+
`/api/users/${userId}`,
|
|
71
|
+
data,
|
|
72
|
+
);
|
|
72
73
|
|
|
73
74
|
return res.data;
|
|
74
75
|
} catch (error) {
|
|
@@ -82,7 +83,6 @@ export default class UsersClient extends ApiClient {
|
|
|
82
83
|
* @param token - The authentication token to be used in the `Authorization` header.
|
|
83
84
|
*/
|
|
84
85
|
public setAuth(token: string) {
|
|
85
|
-
this.ax.defaults.headers.common["Authorization"] =
|
|
86
|
-
`Bearer ${token}`;
|
|
86
|
+
this.ax.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
87
87
|
}
|
|
88
88
|
}
|