@in.pulse-crm/sdk 1.6.2 → 2.0.1
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/api-client.d.ts +9 -0
- package/dist/api-client.js +29 -0
- package/dist/{auth.d.ts → auth.client.d.ts} +4 -38
- package/dist/{auth.js → auth.client.js} +6 -10
- package/dist/customers.client.d.ts +37 -0
- package/dist/{customer.js → customers.client.js} +6 -10
- package/dist/files.client.d.ts +31 -0
- package/dist/{file.js → files.client.js} +6 -26
- package/dist/index.d.ts +9 -12
- package/dist/index.js +21 -41
- package/dist/{instance.d.ts → instance.client.d.ts} +3 -9
- package/dist/{instance.js → instance.client.js} +6 -10
- package/dist/reports.client.d.ts +9 -0
- package/dist/{report.js → reports.client.js} +6 -6
- package/dist/socket-server.client.d.ts +24 -0
- package/dist/socket-server.client.js +34 -0
- package/dist/socket.client.d.ts +49 -0
- package/dist/socket.client.js +74 -0
- package/dist/types/auth.types.d.ts +29 -0
- package/dist/{customer.d.ts → types/customers.types.d.ts} +0 -42
- package/dist/{file.d.ts → types/files.types.d.ts} +7 -38
- package/dist/types/files.types.js +15 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +23 -0
- package/dist/{report.d.ts → types/reports.types.d.ts} +0 -10
- package/dist/types/socket-events.types.d.ts +72 -0
- package/dist/types/socket-events.types.js +19 -0
- package/dist/types/socket-rooms.types.d.ts +15 -0
- package/dist/{user.d.ts → types/user.types.d.ts} +0 -41
- package/dist/types/user.types.js +19 -0
- package/dist/users.client.d.ts +40 -0
- package/dist/{user.js → users.client.js} +11 -27
- package/package.json +1 -1
- package/src/api-client.ts +33 -0
- package/src/{auth.ts → auth.client.ts} +4 -43
- package/src/customers.client.ts +66 -0
- package/src/files.client.ts +57 -0
- package/src/index.ts +9 -87
- package/src/{instance.ts → instance.client.ts} +4 -8
- package/src/reports.client.ts +34 -0
- package/src/socket-server.client.ts +32 -0
- package/src/socket.client.ts +78 -0
- package/src/types/auth.types.ts +31 -0
- package/src/types/customers.types.ts +68 -0
- package/src/types/files.types.ts +83 -0
- package/src/types/index.ts +7 -0
- package/src/types/reports.types.ts +24 -0
- package/src/types/socket-events.types.ts +76 -0
- package/src/types/socket-rooms.types.ts +31 -0
- package/src/{user.ts → types/user.types.ts} +1 -78
- package/src/users.client.ts +74 -0
- package/dist/auth.sdk.d.ts +0 -15
- package/dist/auth.sdk.js +0 -62
- package/dist/instance.sdk.d.ts +0 -10
- package/dist/instance.sdk.js +0 -27
- package/dist/socket-client.d.ts +0 -57
- package/dist/socket-client.js +0 -74
- package/dist/socket-server.d.ts +0 -17
- package/dist/socket-server.js +0 -22
- package/dist/src/sdks/auth.sdk.js +0 -52
- package/dist/src/sdks/index.js +0 -14
- package/dist/src/sdks/instance.sdk.js +0 -31
- package/dist/src/sdks/user.sdk.js +0 -42
- package/dist/src/types/user.types.js +0 -2
- package/dist/types/socket-client.types.d.ts +0 -97
- package/dist/types/socket-client.types.js +0 -2
- package/dist/types/socket-server.types.d.ts +0 -121
- package/dist/types/socket-server.types.js +0 -2
- package/dist/user.sdk.d.ts +0 -14
- package/dist/user.sdk.js +0 -39
- package/src/customer.ts +0 -140
- package/src/file.ts +0 -145
- package/src/report.ts +0 -60
- package/src/socket-client.ts +0 -78
- package/src/socket-server.ts +0 -20
- package/src/types/socket-client.types.ts +0 -114
- package/src/types/socket-server.types.ts +0 -174
- /package/dist/{src/types → types}/auth.types.js +0 -0
- /package/dist/{response.js → types/customers.types.js} +0 -0
- /package/dist/{src/types/index.js → types/reports.types.js} +0 -0
- /package/dist/{response.d.ts → types/response.types.d.ts} +0 -0
- /package/dist/{src/types → types}/response.types.js +0 -0
- /package/dist/{src/types/instance.types.js → types/socket-rooms.types.js} +0 -0
- /package/src/{response.ts → types/response.types.ts} +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { PhoneNumber } from "@in.pulse-crm/utils";
|
|
2
|
-
import { ReportType } from "../report";
|
|
3
|
-
import type { ChatsReportStatusData, QRCode } from "./socket-server.types";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Representa uma sala de chat identificada por um número de telefone.
|
|
7
|
-
*/
|
|
8
|
-
export type SocketClientChatRoom = `chat:${PhoneNumber}`;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Representa a sala de administração.
|
|
12
|
-
*/
|
|
13
|
-
export type SocketClientAdminRoom = "admin";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Representa a sala de monitoramento.
|
|
17
|
-
*/
|
|
18
|
-
export type SocketClientMonitorRoom = `monitor`;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Representa uma sala de relatórios identificada por um tipo de relatório.
|
|
22
|
-
*/
|
|
23
|
-
export type SocketClientReportsRoom = `reports:${ReportType}`;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Representa as salas disponíveis para clientes, incluindo chat, administração, relatórios e monitoramento.
|
|
27
|
-
*/
|
|
28
|
-
export type SocketClientRoom = SocketClientChatRoom | SocketClientAdminRoom | SocketClientReportsRoom | SocketClientMonitorRoom;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Função para entrar em uma sala de socket.
|
|
32
|
-
*/
|
|
33
|
-
export type JoinRoomFunction = {
|
|
34
|
-
(room: SocketClientRoom): void;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Função para entrar em um chat de socket.
|
|
39
|
-
*/
|
|
40
|
-
export type JoinChatFunction = {
|
|
41
|
-
(phone: PhoneNumber): void;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Função para sair de uma sala de socket.
|
|
46
|
-
*/
|
|
47
|
-
export type LeaveRoomFunction = {
|
|
48
|
-
(room: SocketClientRoom): void;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Função para sair de um chat de socket.
|
|
53
|
-
*/
|
|
54
|
-
export type LeaveChatFunction = {
|
|
55
|
-
(phone: PhoneNumber): void;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Função para escutar eventos de socket.
|
|
60
|
-
*/
|
|
61
|
-
export type ListenEventFunction = {
|
|
62
|
-
/**
|
|
63
|
-
* Escuta evento de mensagem
|
|
64
|
-
* Ainda não implementado.
|
|
65
|
-
*/
|
|
66
|
-
(event: "message", listener: (data: unknown) => void): void;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Escuta evento de edição de mensagem
|
|
70
|
-
* Ainda não implementado.
|
|
71
|
-
*/
|
|
72
|
-
(event: "message_edit", listener: (data: unknown) => void): void;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Escuta evento de status de mensagem
|
|
76
|
-
* Ainda não implementado.
|
|
77
|
-
*/
|
|
78
|
-
(event: "message_status", listener: (data: unknown) => void): void;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Escuta evento de novo chat
|
|
82
|
-
* Ainda não implementado.
|
|
83
|
-
*/
|
|
84
|
-
(event: "new_chat", listener: (data: unknown) => void): void;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Escuta evento de chat finalizado
|
|
88
|
-
* @trigger Quando um chat é finalizado
|
|
89
|
-
* @target Sala de monitoria e ao atendente do chat
|
|
90
|
-
* @data Um número contendo o ID do chat finalizado
|
|
91
|
-
*/
|
|
92
|
-
(event: "chat_finished", listener: (chatId: number) => void): void;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Escuta evento de notificação
|
|
96
|
-
* @trigger Quando uma notificação é enviada
|
|
97
|
-
* @target Sala de administração do setor
|
|
98
|
-
*/
|
|
99
|
-
(event: "notification", listener: (notification: unknown) => void): void;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Escuta evento de QR Code
|
|
103
|
-
* @trigger Quando um QR Code é gerado
|
|
104
|
-
* @target Sala de administração do setor
|
|
105
|
-
*/
|
|
106
|
-
(event: "qr_code", listener: (qr: QRCode) => void): void;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Escuta evento de status de relatório
|
|
110
|
-
* @trigger Quando o status de um relatório é atualizado
|
|
111
|
-
* @target Sala de relatórios
|
|
112
|
-
*/
|
|
113
|
-
(event: "report_status", listener: (data: ChatsReportStatusData) => void): void;
|
|
114
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { SocketClientAdminRoom, SocketClientChatRoom, SocketClientMonitorRoom, SocketClientReportsRoom } from "./socket-client.types";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tipos de eventos que podem ser emitidos ou recebidos via socket.
|
|
5
|
-
*/
|
|
6
|
-
export type SocketEventType =
|
|
7
|
-
"message" |
|
|
8
|
-
"message_edit" |
|
|
9
|
-
"message_status" |
|
|
10
|
-
"new_chat" |
|
|
11
|
-
"chat_finished" |
|
|
12
|
-
"notification" |
|
|
13
|
-
"qr_code" |
|
|
14
|
-
"report_status";
|
|
15
|
-
|
|
16
|
-
type SocketRoomWithInstance<T extends string> = `${string}:${T}`;
|
|
17
|
-
type SocketRoomWithSector<T extends string> = SocketRoomWithInstance<`${number}:${T}`>;
|
|
18
|
-
export type SocketServerAdminRoom = SocketRoomWithSector<SocketClientAdminRoom>;
|
|
19
|
-
export type SocketServerMonitorRoom = SocketRoomWithSector<SocketClientMonitorRoom>;
|
|
20
|
-
export type SocketServerReportsRoom = SocketRoomWithSector<SocketClientReportsRoom>;
|
|
21
|
-
export type SocketServerChatRoom = SocketRoomWithInstance<SocketClientChatRoom>;
|
|
22
|
-
export type SocketServerRoom = SocketClientChatRoom | SocketServerAdminRoom | SocketServerMonitorRoom | SocketServerReportsRoom;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Estrutura de dados para o status de relatórios de chats.
|
|
26
|
-
*/
|
|
27
|
-
export type ChatsReportStatusData = {
|
|
28
|
-
id: number;
|
|
29
|
-
type: "chats";
|
|
30
|
-
isCompleted: false;
|
|
31
|
-
isFailed: false;
|
|
32
|
-
progress: number;
|
|
33
|
-
} | {
|
|
34
|
-
id: number;
|
|
35
|
-
type: "chats";
|
|
36
|
-
isCompleted: true;
|
|
37
|
-
isFailed: false;
|
|
38
|
-
fileId: number;
|
|
39
|
-
chats: number;
|
|
40
|
-
messages: number;
|
|
41
|
-
} | {
|
|
42
|
-
id: number;
|
|
43
|
-
type: "chats";
|
|
44
|
-
isCompleted: false;
|
|
45
|
-
isFailed: true;
|
|
46
|
-
error: string;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Representa um código QR como uma string.
|
|
51
|
-
*/
|
|
52
|
-
export type QRCode = {
|
|
53
|
-
qr: string;
|
|
54
|
-
number: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Representa o identificador de um chat.
|
|
59
|
-
*/
|
|
60
|
-
export type ChatId = number;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Represents a function type for emitting events to specific rooms in a socket server.
|
|
64
|
-
* This function type supports multiple overloads, each corresponding to a specific
|
|
65
|
-
* combination of room type, event type, and value type.
|
|
66
|
-
*
|
|
67
|
-
* @typedef EmitFunction
|
|
68
|
-
*
|
|
69
|
-
* @overload
|
|
70
|
-
* Emits a `NEW_CHAT` event to a chat or monitor room.
|
|
71
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
72
|
-
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
73
|
-
* @param event - The event type, `SocketEventType.NEW_CHAT`.
|
|
74
|
-
* @param value - The value associated with the event (type not yet implemented).
|
|
75
|
-
*
|
|
76
|
-
* @overload
|
|
77
|
-
* Emits a `CHAT_FINISHED` event to a chat or monitor room.
|
|
78
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
79
|
-
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
80
|
-
* @param event - The event type, `SocketEventType.CHAT_FINISHED`.
|
|
81
|
-
* @param value - The ID of the finished chat.
|
|
82
|
-
*
|
|
83
|
-
* @overload
|
|
84
|
-
* Emits a `QR_CODE` event to an admin room.
|
|
85
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
86
|
-
* @param room - The target room, a `SocketAdminRoom`.
|
|
87
|
-
* @param event - The event type, `SocketEventType.QR_CODE`.
|
|
88
|
-
* @param value - The QR code data.
|
|
89
|
-
*
|
|
90
|
-
* @overload
|
|
91
|
-
* Emits a `MESSAGE` event to a chat room.
|
|
92
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
93
|
-
* @param room - The target room, a `SocketChatRoom`.
|
|
94
|
-
* @param event - The event type, `SocketEventType.MESSAGE`.
|
|
95
|
-
* @param value - The value associated with the event (type not yet implemented).
|
|
96
|
-
*
|
|
97
|
-
* @overload
|
|
98
|
-
* Emits a `NOTIFICATION` event to an admin room.
|
|
99
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
100
|
-
* @param room - The target room, a `SocketAdminRoom`.
|
|
101
|
-
* @param event - The event type, `SocketEventType.NOTIFICATION`.
|
|
102
|
-
* @param value - The value associated with the event (type not yet implemented).
|
|
103
|
-
*
|
|
104
|
-
* @overload
|
|
105
|
-
* Emits a `MESSAGE_EDIT` event to a chat room.
|
|
106
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
107
|
-
* @param room - The target room, a `SocketChatRoom`.
|
|
108
|
-
* @param event - The event type, `SocketEventType.MESSAGE_EDIT`.
|
|
109
|
-
* @param value - The value associated with the event (type not yet implemented).
|
|
110
|
-
*
|
|
111
|
-
* @overload
|
|
112
|
-
* Emits a `MESSAGE_STATUS` event to a chat room.
|
|
113
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
114
|
-
* @param room - The target room, a `SocketChatRoom`.
|
|
115
|
-
* @param event - The event type, `SocketEventType.MESSAGE_STATUS`.
|
|
116
|
-
* @param value - The value associated with the event (type not yet implemented).
|
|
117
|
-
*
|
|
118
|
-
* @overload
|
|
119
|
-
* Emits a `REPORT_STATUS` event to an admin room.
|
|
120
|
-
* @param instanceName - The name of the instance emitting the event.
|
|
121
|
-
* @param room - The target room, a `SocketAdminRoom`.
|
|
122
|
-
* @param event - The event type, `SocketEventType.REPORT_STATUS`.
|
|
123
|
-
* @param value - The report status data.
|
|
124
|
-
*/
|
|
125
|
-
export type EmitFunction = {
|
|
126
|
-
(
|
|
127
|
-
instanceName: string,
|
|
128
|
-
room: SocketServerAdminRoom,
|
|
129
|
-
event: "qr_code",
|
|
130
|
-
value: QRCode
|
|
131
|
-
): void;
|
|
132
|
-
(
|
|
133
|
-
instanceName: string,
|
|
134
|
-
room: SocketServerAdminRoom,
|
|
135
|
-
event: "notification",
|
|
136
|
-
value: unknown
|
|
137
|
-
): void;
|
|
138
|
-
(
|
|
139
|
-
instanceName: string,
|
|
140
|
-
room: SocketClientChatRoom | SocketServerMonitorRoom,
|
|
141
|
-
event: "new_chat",
|
|
142
|
-
value: unknown
|
|
143
|
-
): void;
|
|
144
|
-
(
|
|
145
|
-
instanceName: string,
|
|
146
|
-
room: SocketClientChatRoom | SocketServerMonitorRoom,
|
|
147
|
-
event: "chat_finished",
|
|
148
|
-
value: ChatId
|
|
149
|
-
): void;
|
|
150
|
-
(
|
|
151
|
-
instanceName: string,
|
|
152
|
-
room: SocketClientChatRoom,
|
|
153
|
-
event: "message",
|
|
154
|
-
value: unknown
|
|
155
|
-
): void;
|
|
156
|
-
(
|
|
157
|
-
instanceName: string,
|
|
158
|
-
room: SocketClientChatRoom,
|
|
159
|
-
event: "message_edit",
|
|
160
|
-
value: unknown
|
|
161
|
-
): void;
|
|
162
|
-
(
|
|
163
|
-
instanceName: string,
|
|
164
|
-
room: SocketClientChatRoom,
|
|
165
|
-
event: "message_status",
|
|
166
|
-
value: unknown
|
|
167
|
-
): void;
|
|
168
|
-
(
|
|
169
|
-
instanceName: string,
|
|
170
|
-
room: SocketServerReportsRoom,
|
|
171
|
-
event: "report_status",
|
|
172
|
-
value: ChatsReportStatusData
|
|
173
|
-
): void;
|
|
174
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|