@in.pulse-crm/sdk 2.6.2 → 2.6.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,10 +1,10 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
|
-
import { InternalChat, InternalGroup, InternalMessage, InternalSendMessageData } from "./types/internal.types";
|
|
2
|
+
import { InternalChat, InternalChatMember, InternalGroup, InternalMessage, InternalSendMessageData } from "./types/internal.types";
|
|
3
3
|
export default class InternalChatClient extends ApiClient {
|
|
4
4
|
createInternalChat(participants: number[], isGroup?: boolean, groupName?: string): Promise<InternalChat>;
|
|
5
5
|
getInternalChatsBySession(token?: string | null): Promise<{
|
|
6
6
|
chats: (InternalChat & {
|
|
7
|
-
participants:
|
|
7
|
+
participants: InternalChatMember[];
|
|
8
8
|
})[];
|
|
9
9
|
messages: InternalMessage[];
|
|
10
10
|
}>;
|
|
@@ -47,10 +47,11 @@ export interface InternalGroup {
|
|
|
47
47
|
}[];
|
|
48
48
|
}
|
|
49
49
|
export interface InternalChatMember {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
internalChatId: number;
|
|
51
|
+
userId: number;
|
|
52
52
|
joinedAt: string;
|
|
53
53
|
lastReadAt?: string | null;
|
|
54
|
+
lastReadId?: number | null;
|
|
54
55
|
}
|
|
55
56
|
export interface InternalSendMessageData {
|
|
56
57
|
sendAsAudio?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SocketServerAdminRoom, SocketServerChatRoom, SocketServerInternalChatRoom, SocketServerReportsRoom, SocketServerRoom } from "./socket-rooms.types";
|
|
2
2
|
import { MessageResponse } from "./response.types";
|
|
3
3
|
import { WppMessage, WppMessageStatus } from "./whatsapp.types";
|
|
4
|
-
import { InternalChat, InternalMessage } from "./internal.types";
|
|
4
|
+
import { InternalChat, InternalChatMember, InternalMessage } from "./internal.types";
|
|
5
5
|
export declare enum SocketEventType {
|
|
6
6
|
WppChatStarted = "wpp_chat_started",
|
|
7
7
|
WppChatFinished = "wpp_chat_finished",
|
|
@@ -82,7 +82,7 @@ export interface WppMessageReactionEventData {
|
|
|
82
82
|
}
|
|
83
83
|
export interface InternalChatStartedEventData {
|
|
84
84
|
chat: InternalChat & {
|
|
85
|
-
participants:
|
|
85
|
+
participants: InternalChatMember[];
|
|
86
86
|
messages: InternalMessage[];
|
|
87
87
|
};
|
|
88
88
|
}
|
package/package.json
CHANGED
package/src/internal.client.ts
CHANGED
|
@@ -2,6 +2,7 @@ import ApiClient from "./api-client";
|
|
|
2
2
|
import { DataResponse } from "./types/response.types";
|
|
3
3
|
import {
|
|
4
4
|
InternalChat,
|
|
5
|
+
InternalChatMember,
|
|
5
6
|
InternalGroup,
|
|
6
7
|
InternalMessage,
|
|
7
8
|
InternalSendMessageData,
|
|
@@ -9,13 +10,9 @@ import {
|
|
|
9
10
|
import FormData from "form-data";
|
|
10
11
|
|
|
11
12
|
type GetChatsResponse = DataResponse<{
|
|
12
|
-
chats: (InternalChat & { participants:
|
|
13
|
+
chats: (InternalChat & { participants: InternalChatMember[] })[];
|
|
13
14
|
messages: InternalMessage[];
|
|
14
15
|
}>;
|
|
15
|
-
type StartChatResponse = DataResponse<{
|
|
16
|
-
chat: InternalChat & { messages: InternalMessage[] };
|
|
17
|
-
}>;
|
|
18
|
-
|
|
19
16
|
export default class InternalChatClient extends ApiClient {
|
|
20
17
|
public async createInternalChat(
|
|
21
18
|
participants: number[],
|
|
@@ -51,10 +51,11 @@ export interface InternalGroup {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export interface InternalChatMember {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
internalChatId: number;
|
|
55
|
+
userId: number;
|
|
56
56
|
joinedAt: string;
|
|
57
57
|
lastReadAt?: string | null;
|
|
58
|
+
lastReadId?: number | null;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export interface InternalSendMessageData {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./socket-rooms.types";
|
|
8
8
|
import { MessageResponse } from "./response.types";
|
|
9
9
|
import { WppMessage, WppMessageStatus } from "./whatsapp.types";
|
|
10
|
-
import { InternalChat, InternalMessage } from "./internal.types";
|
|
10
|
+
import { InternalChat, InternalChatMember, InternalMessage } from "./internal.types";
|
|
11
11
|
|
|
12
12
|
export enum SocketEventType {
|
|
13
13
|
WppChatStarted = "wpp_chat_started",
|
|
@@ -184,7 +184,7 @@ export interface WppMessageReactionEventData {
|
|
|
184
184
|
reaction: string;
|
|
185
185
|
}
|
|
186
186
|
export interface InternalChatStartedEventData {
|
|
187
|
-
chat: InternalChat & { participants:
|
|
187
|
+
chat: InternalChat & { participants: InternalChatMember[], messages: InternalMessage[] };
|
|
188
188
|
}
|
|
189
189
|
export interface InternalChatFinishedEventData {
|
|
190
190
|
chatId: number;
|