@in.pulse-crm/sdk 1.3.8 → 1.3.9
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/package.json +1 -1
- package/src/socket-client.ts +27 -3
package/package.json
CHANGED
package/src/socket-client.ts
CHANGED
|
@@ -16,6 +16,14 @@ export type JoinChatFunction = {
|
|
|
16
16
|
(phone: PhoneNumber): void;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
export type LeaveRoomFunction = {
|
|
20
|
+
(room: SocketRoomType): void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type LeaveChatFunction = {
|
|
24
|
+
(phone: PhoneNumber): void;
|
|
25
|
+
};
|
|
26
|
+
|
|
19
27
|
/**
|
|
20
28
|
* Função para escutar eventos de socket.
|
|
21
29
|
*/
|
|
@@ -101,16 +109,32 @@ export default class SocketClientSDK {
|
|
|
101
109
|
* @param room - O tipo de sala a ser ingressada.
|
|
102
110
|
*/
|
|
103
111
|
public joinRoom: JoinRoomFunction = (room) => {
|
|
104
|
-
this.io.emit("join", `${room}`);
|
|
112
|
+
this.io.emit("join-room", `${room}`);
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
/**
|
|
108
|
-
* Entra em um chat
|
|
116
|
+
* Entra em um chat.
|
|
109
117
|
*
|
|
110
118
|
* @param phone - O número de telefone do chat a ser ingressado.
|
|
111
119
|
*/
|
|
112
120
|
public joinChat: JoinChatFunction = (phone) => {
|
|
113
|
-
this.
|
|
121
|
+
this.joinRoom(`chat:${phone}`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Sai de uma sala de socket.
|
|
126
|
+
* @param room - O tipo de sala a ser deixada.
|
|
127
|
+
*/
|
|
128
|
+
public leaveRoom: LeaveRoomFunction = (room) => {
|
|
129
|
+
this.io.emit("leave-room", `${room}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Sai de um chat.
|
|
134
|
+
* @param phone - O número de telefone do chat a ser deixado.
|
|
135
|
+
*/
|
|
136
|
+
public leaveChat: LeaveChatFunction = (phone) => {
|
|
137
|
+
this.leaveRoom(`chat:${phone}`);
|
|
114
138
|
}
|
|
115
139
|
|
|
116
140
|
/**
|