@in.pulse-crm/sdk 2.2.2 → 2.2.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SocketServerAdminRoom, SocketServerChatRoom, SocketServerReportsRoom, SocketServerRoom } from "./socket-rooms.types";
|
|
2
2
|
import { MessageResponse } from "./response.types";
|
|
3
|
-
import {
|
|
3
|
+
import { WppMessageStatus } from "./whatsapp.types";
|
|
4
4
|
export declare enum SocketEventType {
|
|
5
5
|
WppChatStarted = "wpp_chat_started",
|
|
6
6
|
WppChatFinished = "wpp_chat_finished",
|
|
@@ -44,15 +44,21 @@ export interface WWEBJSAuthEventData {
|
|
|
44
44
|
message?: string;
|
|
45
45
|
}
|
|
46
46
|
export interface WppChatStartedEventData {
|
|
47
|
+
chatId: number;
|
|
47
48
|
}
|
|
48
49
|
export interface WppChatFinishedEventData {
|
|
50
|
+
chatId: number;
|
|
49
51
|
}
|
|
50
52
|
export interface WppMessageEventData {
|
|
51
|
-
|
|
53
|
+
messageId: string;
|
|
52
54
|
}
|
|
53
55
|
export interface WppMessageStatusEventData {
|
|
56
|
+
messageId: number;
|
|
57
|
+
status: WppMessageStatus;
|
|
54
58
|
}
|
|
55
59
|
export interface WppMessageReactionEventData {
|
|
60
|
+
messageId: number;
|
|
61
|
+
reaction: string;
|
|
56
62
|
}
|
|
57
63
|
export type ReportStatusEventData = {
|
|
58
64
|
id: number;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
type ReportType = "chats";
|
|
2
2
|
type PhoneNumber = string;
|
|
3
|
+
type WalletId = number;
|
|
4
|
+
type UserId = number;
|
|
5
|
+
type SectorId = number;
|
|
6
|
+
type InstanceName = string;
|
|
3
7
|
export type SocketClientChatRoom = `chat:${PhoneNumber}`;
|
|
4
8
|
export type SocketClientAdminRoom = "admin";
|
|
5
9
|
export type SocketClientMonitorRoom = `monitor`;
|
|
6
10
|
export type SocketClientReportsRoom = `reports:${ReportType}`;
|
|
7
|
-
export type
|
|
8
|
-
type
|
|
9
|
-
type
|
|
11
|
+
export type SocketClientWalletRoom = `wallet:${WalletId}`;
|
|
12
|
+
export type SocketClientUserRoom = `user:${UserId}`;
|
|
13
|
+
export type SocketClientRoom = SocketClientChatRoom | SocketClientAdminRoom | SocketClientReportsRoom | SocketClientMonitorRoom | SocketClientWalletRoom | SocketClientUserRoom;
|
|
14
|
+
type SocketRoomWithInstance<T extends string> = `${InstanceName}:${T}`;
|
|
15
|
+
type SocketRoomWithSector<T extends string> = SocketRoomWithInstance<`${SectorId}:${T}`>;
|
|
10
16
|
export type SocketServerAdminRoom = SocketRoomWithSector<SocketClientAdminRoom>;
|
|
11
17
|
export type SocketServerMonitorRoom = SocketRoomWithSector<SocketClientMonitorRoom>;
|
|
12
18
|
export type SocketServerReportsRoom = SocketRoomWithSector<SocketClientReportsRoom>;
|
|
13
19
|
export type SocketServerChatRoom = SocketRoomWithInstance<SocketClientChatRoom>;
|
|
14
|
-
export type
|
|
20
|
+
export type SocketServerWalletRoom = SocketRoomWithInstance<SocketClientWalletRoom>;
|
|
21
|
+
export type SocketServerUserRoom = SocketRoomWithInstance<SocketClientUserRoom>;
|
|
22
|
+
export type SocketServerRoom = SocketServerChatRoom | SocketServerAdminRoom | SocketServerMonitorRoom | SocketServerReportsRoom | SocketServerWalletRoom | SocketServerUserRoom;
|
|
15
23
|
export interface JoinRoomFn {
|
|
16
24
|
(room: SocketClientRoom): void;
|
|
17
25
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
SocketServerRoom,
|
|
6
6
|
} from "./socket-rooms.types";
|
|
7
7
|
import { MessageResponse } from "./response.types";
|
|
8
|
-
import {
|
|
8
|
+
import { WppMessageStatus } from "./whatsapp.types";
|
|
9
9
|
|
|
10
10
|
export enum SocketEventType {
|
|
11
11
|
WppChatStarted = "wpp_chat_started",
|
|
@@ -112,13 +112,23 @@ export interface WWEBJSAuthEventData {
|
|
|
112
112
|
message?: string;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
export interface WppChatStartedEventData {
|
|
116
|
-
|
|
115
|
+
export interface WppChatStartedEventData {
|
|
116
|
+
chatId: number;
|
|
117
|
+
}
|
|
118
|
+
export interface WppChatFinishedEventData {
|
|
119
|
+
chatId: number;
|
|
120
|
+
}
|
|
117
121
|
export interface WppMessageEventData {
|
|
118
|
-
|
|
122
|
+
messageId: string;
|
|
123
|
+
}
|
|
124
|
+
export interface WppMessageStatusEventData {
|
|
125
|
+
messageId: number;
|
|
126
|
+
status: WppMessageStatus;
|
|
127
|
+
}
|
|
128
|
+
export interface WppMessageReactionEventData {
|
|
129
|
+
messageId: number;
|
|
130
|
+
reaction: string;
|
|
119
131
|
}
|
|
120
|
-
export interface WppMessageStatusEventData {}
|
|
121
|
-
export interface WppMessageReactionEventData {}
|
|
122
132
|
|
|
123
133
|
export type ReportStatusEventData = {
|
|
124
134
|
id: number;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
type ReportType = "chats";
|
|
2
2
|
type PhoneNumber = string;
|
|
3
|
+
type WalletId = number;
|
|
4
|
+
type UserId = number;
|
|
5
|
+
type SectorId = number;
|
|
6
|
+
type InstanceName = string;
|
|
3
7
|
|
|
4
8
|
/*
|
|
5
9
|
Salas de Socket do lado do cliente;
|
|
@@ -10,18 +14,22 @@ export type SocketClientChatRoom = `chat:${PhoneNumber}`;
|
|
|
10
14
|
export type SocketClientAdminRoom = "admin";
|
|
11
15
|
export type SocketClientMonitorRoom = `monitor`;
|
|
12
16
|
export type SocketClientReportsRoom = `reports:${ReportType}`;
|
|
17
|
+
export type SocketClientWalletRoom = `wallet:${WalletId}`;
|
|
18
|
+
export type SocketClientUserRoom = `user:${UserId}`;
|
|
13
19
|
export type SocketClientRoom =
|
|
14
20
|
| SocketClientChatRoom
|
|
15
21
|
| SocketClientAdminRoom
|
|
16
22
|
| SocketClientReportsRoom
|
|
17
|
-
| SocketClientMonitorRoom
|
|
23
|
+
| SocketClientMonitorRoom
|
|
24
|
+
| SocketClientWalletRoom
|
|
25
|
+
| SocketClientUserRoom;
|
|
18
26
|
|
|
19
27
|
// Interface que incluí o nome da instancia na sala de socket;
|
|
20
|
-
type SocketRoomWithInstance<T extends string> = `${
|
|
28
|
+
type SocketRoomWithInstance<T extends string> = `${InstanceName}:${T}`;
|
|
21
29
|
|
|
22
30
|
// Interface que incluí o nome da instancia e o id do setor na sala de socket;
|
|
23
31
|
type SocketRoomWithSector<T extends string> =
|
|
24
|
-
SocketRoomWithInstance<`${
|
|
32
|
+
SocketRoomWithInstance<`${SectorId}:${T}`>;
|
|
25
33
|
|
|
26
34
|
/*
|
|
27
35
|
Salas de Socket do lado do servidor;
|
|
@@ -35,11 +43,15 @@ export type SocketServerMonitorRoom =
|
|
|
35
43
|
export type SocketServerReportsRoom =
|
|
36
44
|
SocketRoomWithSector<SocketClientReportsRoom>;
|
|
37
45
|
export type SocketServerChatRoom = SocketRoomWithInstance<SocketClientChatRoom>;
|
|
46
|
+
export type SocketServerWalletRoom = SocketRoomWithInstance<SocketClientWalletRoom>;
|
|
47
|
+
export type SocketServerUserRoom = SocketRoomWithInstance<SocketClientUserRoom>;
|
|
38
48
|
export type SocketServerRoom =
|
|
39
49
|
| SocketServerChatRoom
|
|
40
50
|
| SocketServerAdminRoom
|
|
41
51
|
| SocketServerMonitorRoom
|
|
42
|
-
| SocketServerReportsRoom
|
|
52
|
+
| SocketServerReportsRoom
|
|
53
|
+
| SocketServerWalletRoom
|
|
54
|
+
| SocketServerUserRoom;
|
|
43
55
|
|
|
44
56
|
export interface JoinRoomFn {
|
|
45
57
|
(room: SocketClientRoom): void;
|