@in.pulse-crm/sdk 2.1.1 → 2.2.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/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/socket-events.types.d.ts +2 -0
- package/dist/types/socket-events.types.js +0 -5
- package/dist/types/whatsapp.types.d.ts +17 -0
- package/dist/types/whatsapp.types.js +2 -0
- package/package.json +1 -1
- package/src/types/index.ts +1 -0
- package/src/types/socket-events.types.ts +121 -53
- package/src/types/whatsapp.types.ts +24 -0
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -23,3 +23,4 @@ __exportStar(require("./response.types"), exports);
|
|
|
23
23
|
__exportStar(require("./socket-events.types"), exports);
|
|
24
24
|
__exportStar(require("./socket-rooms.types"), exports);
|
|
25
25
|
__exportStar(require("./user.types"), exports);
|
|
26
|
+
__exportStar(require("./whatsapp.types"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SocketServerAdminRoom, SocketServerChatRoom, SocketServerReportsRoom, SocketServerRoom } from "./socket-rooms.types";
|
|
2
2
|
import { MessageResponse } from "./response.types";
|
|
3
|
+
import { WppMessage } from "./whatsapp.types";
|
|
3
4
|
export declare enum SocketEventType {
|
|
4
5
|
WppChatStarted = "wpp_chat_started",
|
|
5
6
|
WppChatFinished = "wpp_chat_finished",
|
|
@@ -47,6 +48,7 @@ export interface WppChatStartedEventData {
|
|
|
47
48
|
export interface WppChatFinishedEventData {
|
|
48
49
|
}
|
|
49
50
|
export interface WppMessageEventData {
|
|
51
|
+
message: WppMessage;
|
|
50
52
|
}
|
|
51
53
|
export interface WppMessageStatusEventData {
|
|
52
54
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type WppMessageStatus = "PENDING" | "SENT" | "RECEIVED" | "READ" | "DOWNLOADED" | "ERROR";
|
|
2
|
+
export interface WppMessage {
|
|
3
|
+
instanceName: string;
|
|
4
|
+
id: string;
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
type: string;
|
|
8
|
+
quotedId: string | null;
|
|
9
|
+
chatId: number | null;
|
|
10
|
+
body: string;
|
|
11
|
+
timestamp: bigint;
|
|
12
|
+
status: WppMessageStatus;
|
|
13
|
+
fileId: number | null;
|
|
14
|
+
fileName: string | null;
|
|
15
|
+
fileType: string | null;
|
|
16
|
+
fileSize: bigint | null;
|
|
17
|
+
}
|
package/package.json
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -1,76 +1,144 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SocketServerAdminRoom,
|
|
3
|
+
SocketServerChatRoom,
|
|
4
|
+
SocketServerReportsRoom,
|
|
5
|
+
SocketServerRoom,
|
|
6
|
+
} from "./socket-rooms.types";
|
|
2
7
|
import { MessageResponse } from "./response.types";
|
|
8
|
+
import { WppMessage } from "./whatsapp.types";
|
|
3
9
|
|
|
4
10
|
export enum SocketEventType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
WppChatStarted = "wpp_chat_started",
|
|
12
|
+
WppChatFinished = "wpp_chat_finished",
|
|
13
|
+
WppMessage = "wpp_message",
|
|
14
|
+
WppMessageStatus = "wpp_message_status",
|
|
15
|
+
WppMessageReaction = "wpp_message_reaction",
|
|
16
|
+
WwebjsQr = "wwebjs_qr",
|
|
17
|
+
WwebjsAuth = "wwebjs_auth",
|
|
18
|
+
ReportStatus = "report_status",
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export interface EmitSocketEventFn {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
(
|
|
23
|
+
type: SocketEventType.WwebjsQr,
|
|
24
|
+
room: SocketServerAdminRoom,
|
|
25
|
+
data: WWEBJSQrEventData,
|
|
26
|
+
): Promise<MessageResponse>;
|
|
27
|
+
(
|
|
28
|
+
type: SocketEventType.WwebjsAuth,
|
|
29
|
+
room: SocketServerAdminRoom,
|
|
30
|
+
data: WWEBJSAuthEventData,
|
|
31
|
+
): Promise<MessageResponse>;
|
|
32
|
+
(
|
|
33
|
+
type: SocketEventType.WppChatStarted,
|
|
34
|
+
room: SocketServerRoom,
|
|
35
|
+
data: WppChatStartedEventData,
|
|
36
|
+
): Promise<MessageResponse>;
|
|
37
|
+
(
|
|
38
|
+
type: SocketEventType.WppChatFinished,
|
|
39
|
+
room: SocketServerRoom,
|
|
40
|
+
data: WppChatFinishedEventData,
|
|
41
|
+
): Promise<MessageResponse>;
|
|
42
|
+
(
|
|
43
|
+
type: SocketEventType.WppMessage,
|
|
44
|
+
room: SocketServerChatRoom,
|
|
45
|
+
data: WppMessageEventData,
|
|
46
|
+
): Promise<MessageResponse>;
|
|
47
|
+
(
|
|
48
|
+
type: SocketEventType.WppMessageStatus,
|
|
49
|
+
room: SocketServerChatRoom,
|
|
50
|
+
data: WppMessageStatusEventData,
|
|
51
|
+
): Promise<MessageResponse>;
|
|
52
|
+
(
|
|
53
|
+
type: SocketEventType.WppMessageReaction,
|
|
54
|
+
room: SocketServerChatRoom,
|
|
55
|
+
data: WppMessageReactionEventData,
|
|
56
|
+
): Promise<MessageResponse>;
|
|
57
|
+
(
|
|
58
|
+
type: SocketEventType.ReportStatus,
|
|
59
|
+
room: SocketServerReportsRoom,
|
|
60
|
+
data: ReportStatusEventData,
|
|
61
|
+
): Promise<MessageResponse>;
|
|
24
62
|
}
|
|
25
63
|
|
|
26
64
|
export interface ListenSocketEventFn {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
65
|
+
(
|
|
66
|
+
type: SocketEventType.WwebjsQr,
|
|
67
|
+
callback: (data: WWEBJSQrEventData) => void,
|
|
68
|
+
): void;
|
|
69
|
+
(
|
|
70
|
+
type: SocketEventType.WwebjsAuth,
|
|
71
|
+
callback: (data: WWEBJSAuthEventData) => void,
|
|
72
|
+
): void;
|
|
73
|
+
(
|
|
74
|
+
type: SocketEventType.WppChatStarted,
|
|
75
|
+
callback: (data: WppChatStartedEventData) => void,
|
|
76
|
+
): void;
|
|
77
|
+
(
|
|
78
|
+
type: SocketEventType.WppChatFinished,
|
|
79
|
+
callback: (data: WppChatFinishedEventData) => void,
|
|
80
|
+
): void;
|
|
81
|
+
(
|
|
82
|
+
type: SocketEventType.WppMessage,
|
|
83
|
+
callback: (data: WppMessageEventData) => void,
|
|
84
|
+
): void;
|
|
85
|
+
(
|
|
86
|
+
type: SocketEventType.WppMessageStatus,
|
|
87
|
+
callback: (data: WppMessageStatusEventData) => void,
|
|
88
|
+
): void;
|
|
89
|
+
(
|
|
90
|
+
type: SocketEventType.WppMessageReaction,
|
|
91
|
+
callback: (data: WppMessageReactionEventData) => void,
|
|
92
|
+
): void;
|
|
93
|
+
(
|
|
94
|
+
type: SocketEventType.ReportStatus,
|
|
95
|
+
callback: (data: ReportStatusEventData) => void,
|
|
96
|
+
): void;
|
|
35
97
|
}
|
|
36
98
|
|
|
37
99
|
export interface UnlistenSocketEventFn {
|
|
38
|
-
|
|
100
|
+
(type: SocketEventType): void;
|
|
39
101
|
}
|
|
40
102
|
|
|
41
103
|
// EventData
|
|
42
104
|
export interface WWEBJSQrEventData {
|
|
43
|
-
|
|
44
|
-
|
|
105
|
+
qr: string;
|
|
106
|
+
phone: string;
|
|
45
107
|
}
|
|
46
108
|
|
|
47
109
|
export interface WWEBJSAuthEventData {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
110
|
+
phone: string;
|
|
111
|
+
success: boolean;
|
|
112
|
+
message?: string;
|
|
51
113
|
}
|
|
52
114
|
|
|
53
|
-
export interface WppChatStartedEventData {
|
|
54
|
-
export interface WppChatFinishedEventData {
|
|
55
|
-
export interface WppMessageEventData {
|
|
56
|
-
|
|
57
|
-
|
|
115
|
+
export interface WppChatStartedEventData {}
|
|
116
|
+
export interface WppChatFinishedEventData {}
|
|
117
|
+
export interface WppMessageEventData {
|
|
118
|
+
message: WppMessage;
|
|
119
|
+
}
|
|
120
|
+
export interface WppMessageStatusEventData {}
|
|
121
|
+
export interface WppMessageReactionEventData {}
|
|
58
122
|
|
|
59
123
|
export type ReportStatusEventData = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} & (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
124
|
+
id: number;
|
|
125
|
+
type: string;
|
|
126
|
+
} & (
|
|
127
|
+
| {
|
|
128
|
+
isCompleted: true;
|
|
129
|
+
isFailed: false;
|
|
130
|
+
fileId: number;
|
|
131
|
+
chats: number;
|
|
132
|
+
messages: number;
|
|
133
|
+
}
|
|
134
|
+
| {
|
|
135
|
+
isCompleted: false;
|
|
136
|
+
isFailed: true;
|
|
137
|
+
error: string;
|
|
138
|
+
}
|
|
139
|
+
| {
|
|
140
|
+
isCompleted: false;
|
|
141
|
+
isFailed: false;
|
|
142
|
+
progress: number;
|
|
143
|
+
}
|
|
144
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type WppMessageStatus =
|
|
2
|
+
| "PENDING"
|
|
3
|
+
| "SENT"
|
|
4
|
+
| "RECEIVED"
|
|
5
|
+
| "READ"
|
|
6
|
+
| "DOWNLOADED"
|
|
7
|
+
| "ERROR";
|
|
8
|
+
|
|
9
|
+
export interface WppMessage {
|
|
10
|
+
instanceName: string;
|
|
11
|
+
id: string;
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
type: string;
|
|
15
|
+
quotedId: string | null;
|
|
16
|
+
chatId: number | null;
|
|
17
|
+
body: string;
|
|
18
|
+
timestamp: bigint;
|
|
19
|
+
status: WppMessageStatus;
|
|
20
|
+
fileId: number | null;
|
|
21
|
+
fileName: string | null;
|
|
22
|
+
fileType: string | null;
|
|
23
|
+
fileSize: bigint | null;
|
|
24
|
+
}
|