@in.pulse-crm/sdk 2.2.5 → 2.2.6
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/whatsapp.types.d.ts +12 -0
- package/dist/whatsapp.client.d.ts +3 -14
- package/package.json +1 -1
- package/src/types/whatsapp.types.ts +72 -58
- package/src/whatsapp.client.ts +8 -15
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Customer } from "./customers.types";
|
|
1
2
|
export interface WppContact {
|
|
2
3
|
id: number;
|
|
3
4
|
name: string;
|
|
@@ -72,3 +73,14 @@ export declare enum WppChatPriority {
|
|
|
72
73
|
VERY_HIGH = "VERY_HIGH",
|
|
73
74
|
URGENCY = "URGENCY"
|
|
74
75
|
}
|
|
76
|
+
export type WppChatWithDetails = WppChat & {
|
|
77
|
+
contact: WppContact | null;
|
|
78
|
+
customer: Customer | null;
|
|
79
|
+
};
|
|
80
|
+
export type WppChatsAndMessages = {
|
|
81
|
+
chats: WppChatWithDetails[];
|
|
82
|
+
messages: WppMessage[];
|
|
83
|
+
};
|
|
84
|
+
export type WppChatWithDetailsAndMessages = WppChatWithDetails & {
|
|
85
|
+
messages: WppMessage[];
|
|
86
|
+
};
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { Customer } from "./types";
|
|
3
2
|
import { DataResponse } from "./types/response.types";
|
|
4
|
-
import {
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
contact: WppContact;
|
|
8
|
-
};
|
|
9
|
-
type ChatsAndMessages = {
|
|
10
|
-
chats: ChatWithContactAndCustomer[];
|
|
11
|
-
messages: WppMessage[];
|
|
12
|
-
};
|
|
13
|
-
type GetChatsResponse = DataResponse<ChatsAndMessages>;
|
|
14
|
-
type GetChatResponse = DataResponse<ChatWithContactAndCustomer & {
|
|
15
|
-
messages: WppMessage[];
|
|
16
|
-
}>;
|
|
3
|
+
import { WppChatsAndMessages, WppChatWithDetailsAndMessages, WppMessage } from "./types/whatsapp.types";
|
|
4
|
+
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
5
|
+
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
17
6
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
18
7
|
export default class WhatsappClient extends ApiClient {
|
|
19
8
|
getChatsWithMessages(): Promise<GetChatsResponse>;
|
package/package.json
CHANGED
|
@@ -1,82 +1,96 @@
|
|
|
1
|
+
import { Customer } from "./customers.types";
|
|
2
|
+
|
|
1
3
|
export interface WppContact {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
customerId?: number;
|
|
8
|
+
instance: string;
|
|
9
|
+
isBlocked: boolean;
|
|
10
|
+
isOnlyAdmin: boolean;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface WppMessage {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
id: number;
|
|
15
|
+
instance: string;
|
|
16
|
+
wwebjsId?: string;
|
|
17
|
+
wabaId?: string;
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
type: string;
|
|
21
|
+
quotedId?: string;
|
|
22
|
+
chatId?: number;
|
|
23
|
+
contactId?: number;
|
|
24
|
+
body: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
status: WppMessageStatus;
|
|
27
|
+
fileId?: number;
|
|
28
|
+
fileName?: string;
|
|
29
|
+
fileType?: string;
|
|
30
|
+
fileSize?: string;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export interface WppChat {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
id: number;
|
|
35
|
+
instance: string;
|
|
36
|
+
contactId?: number;
|
|
37
|
+
userId?: number;
|
|
38
|
+
walletId?: number;
|
|
39
|
+
botId?: number;
|
|
40
|
+
resultId?: number;
|
|
41
|
+
sectorId?: number;
|
|
42
|
+
type: WppChatType;
|
|
43
|
+
priority: WppChatPriority;
|
|
44
|
+
avatarUrl?: string;
|
|
45
|
+
isFinished: boolean;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export interface WppSector {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
id: number;
|
|
50
|
+
name: string;
|
|
51
|
+
instanceName: string;
|
|
52
|
+
wppInstanceId?: number;
|
|
53
|
+
startChats: boolean;
|
|
54
|
+
receiveChats: boolean;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export interface WppWallet {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
instanceName: string;
|
|
59
|
+
id: number;
|
|
60
|
+
name: string;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
// Enums
|
|
62
64
|
export enum WppMessageStatus {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
PENDING = "PENDING",
|
|
66
|
+
SENT = "SENT",
|
|
67
|
+
RECEIVED = "RECEIVED",
|
|
68
|
+
READ = "READ",
|
|
69
|
+
DOWNLOADED = "DOWNLOADED",
|
|
70
|
+
ERROR = "ERROR",
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export enum WppChatType {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
RECEPTIVE = "RECEPTIVE",
|
|
75
|
+
ACTIVE = "ACTIVE",
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export enum WppChatPriority {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
LOW = "LOW",
|
|
80
|
+
NORMAL = "NORMAL",
|
|
81
|
+
HIGH = "HIGH",
|
|
82
|
+
VERY_HIGH = "VERY_HIGH",
|
|
83
|
+
URGENCY = "URGENCY",
|
|
82
84
|
}
|
|
85
|
+
|
|
86
|
+
export type WppChatWithDetails = WppChat & {
|
|
87
|
+
contact: WppContact | null;
|
|
88
|
+
customer: Customer | null;
|
|
89
|
+
};
|
|
90
|
+
export type WppChatsAndMessages = {
|
|
91
|
+
chats: WppChatWithDetails[];
|
|
92
|
+
messages: WppMessage[];
|
|
93
|
+
};
|
|
94
|
+
export type WppChatWithDetailsAndMessages = WppChatWithDetails & {
|
|
95
|
+
messages: WppMessage[];
|
|
96
|
+
};
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { Customer } from "./types";
|
|
3
2
|
import { DataResponse } from "./types/response.types";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
messages: WppMessage[];
|
|
13
|
-
};
|
|
14
|
-
type GetChatsResponse = DataResponse<ChatsAndMessages>;
|
|
15
|
-
type GetChatResponse = DataResponse<
|
|
16
|
-
ChatWithContactAndCustomer & { messages: WppMessage[] }
|
|
17
|
-
>;
|
|
3
|
+
import {
|
|
4
|
+
WppChatsAndMessages,
|
|
5
|
+
WppChatWithDetailsAndMessages,
|
|
6
|
+
WppMessage,
|
|
7
|
+
} from "./types/whatsapp.types";
|
|
8
|
+
|
|
9
|
+
type GetChatsResponse = DataResponse<WppChatsAndMessages>;
|
|
10
|
+
type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
|
|
18
11
|
type GetMessageResponse = DataResponse<WppMessage>;
|
|
19
12
|
|
|
20
13
|
export default class WhatsappClient extends ApiClient {
|