@in.pulse-crm/sdk 2.7.7 → 2.7.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.
@@ -5,6 +5,7 @@ import { InternalChat, InternalChatMember, InternalMessage } from "./internal.ty
5
5
  export declare enum SocketEventType {
6
6
  WppChatStarted = "wpp_chat_started",
7
7
  WppChatFinished = "wpp_chat_finished",
8
+ WppChatTransfer = "wpp_chat_transfer",
8
9
  WppMessage = "wpp_message",
9
10
  WppMessageStatus = "wpp_message_status",
10
11
  WppMessageReaction = "wpp_message_reaction",
@@ -22,6 +23,7 @@ export interface EmitSocketEventFn {
22
23
  (type: SocketEventType.WwebjsAuth, room: SocketServerAdminRoom, data: WWEBJSAuthEventData): Promise<MessageResponse>;
23
24
  (type: SocketEventType.WppChatStarted, room: SocketServerRoom, data: WppChatStartedEventData): Promise<MessageResponse>;
24
25
  (type: SocketEventType.WppChatFinished, room: SocketServerRoom, data: WppChatFinishedEventData): Promise<MessageResponse>;
26
+ (type: SocketEventType.WppChatTransfer, room: SocketServerRoom, data: WppChatTransferEventData): Promise<MessageResponse>;
25
27
  (type: SocketEventType.WppMessage, room: SocketServerChatRoom, data: WppMessageEventData): Promise<MessageResponse>;
26
28
  (type: SocketEventType.WppMessageStatus, room: SocketServerChatRoom, data: WppMessageStatusEventData): Promise<MessageResponse>;
27
29
  (type: SocketEventType.WppContactMessagesRead, room: SocketServerChatRoom, data: WppContactMessagesReadEventData): Promise<MessageResponse>;
@@ -37,6 +39,7 @@ export interface ListenSocketEventFn {
37
39
  (type: SocketEventType.WwebjsAuth, callback: (data: WWEBJSAuthEventData) => void): void;
38
40
  (type: SocketEventType.WppChatStarted, callback: (data: WppChatStartedEventData) => void): void;
39
41
  (type: SocketEventType.WppChatFinished, callback: (data: WppChatFinishedEventData) => void): void;
42
+ (type: SocketEventType.WppChatTransfer, callback: (data: WppChatTransferEventData) => void): void;
40
43
  (type: SocketEventType.WppMessage, callback: (data: WppMessageEventData) => void): void;
41
44
  (type: SocketEventType.WppMessageStatus, callback: (data: WppMessageStatusEventData) => void): void;
42
45
  (type: SocketEventType.WppContactMessagesRead, callback: (data: WppContactMessagesReadEventData) => void): void;
@@ -65,6 +68,9 @@ export interface WppChatStartedEventData {
65
68
  export interface WppChatFinishedEventData {
66
69
  chatId: number;
67
70
  }
71
+ export interface WppChatTransferEventData {
72
+ chatId: number;
73
+ }
68
74
  export interface WppContactMessagesReadEventData {
69
75
  contactId: number;
70
76
  }
@@ -89,6 +95,9 @@ export interface InternalChatStartedEventData {
89
95
  export interface InternalChatFinishedEventData {
90
96
  chatId: number;
91
97
  }
98
+ export interface InternalChatTransferEventData {
99
+ chatId: number;
100
+ }
92
101
  export interface InternalContactMessagesReadEventData {
93
102
  contactId: number;
94
103
  }
@@ -5,6 +5,7 @@ var SocketEventType;
5
5
  (function (SocketEventType) {
6
6
  SocketEventType["WppChatStarted"] = "wpp_chat_started";
7
7
  SocketEventType["WppChatFinished"] = "wpp_chat_finished";
8
+ SocketEventType["WppChatTransfer"] = "wpp_chat_transfer";
8
9
  SocketEventType["WppMessage"] = "wpp_message";
9
10
  SocketEventType["WppMessageStatus"] = "wpp_message_status";
10
11
  SocketEventType["WppMessageReaction"] = "wpp_message_reaction";
@@ -16,6 +16,7 @@ export default class WhatsappClient extends ApiClient {
16
16
  }[]>;
17
17
  getCustomerContacts(customerId: number): Promise<WppContact[]>;
18
18
  getContactsWithCustomer(): Promise<WppContactWithCustomer[]>;
19
+ getContacts(): Promise<WppContact[]>;
19
20
  createContact(name: string, phone: string, customerId: number): Promise<WppContact>;
20
21
  updateContact(contactId: number, name: string): Promise<WppContact>;
21
22
  deleteContact(contactId: number): Promise<void>;
@@ -76,6 +76,11 @@ class WhatsappClient extends api_client_1.default {
76
76
  return res.data;
77
77
  }
78
78
  async getContactsWithCustomer() {
79
+ const url = `/api/whatsapp/contacts/customer`;
80
+ const { data: res } = await this.httpClient.get(url);
81
+ return res.data;
82
+ }
83
+ async getContacts() {
79
84
  const url = `/api/whatsapp/contacts`;
80
85
  const { data: res } = await this.httpClient.get(url);
81
86
  return res.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.7.7",
3
+ "version": "2.7.9",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,6 +12,7 @@ import { InternalChat, InternalChatMember, InternalMessage } from "./internal.ty
12
12
  export enum SocketEventType {
13
13
  WppChatStarted = "wpp_chat_started",
14
14
  WppChatFinished = "wpp_chat_finished",
15
+ WppChatTransfer = "wpp_chat_transfer",
15
16
  WppMessage = "wpp_message",
16
17
  WppMessageStatus = "wpp_message_status",
17
18
  WppMessageReaction = "wpp_message_reaction",
@@ -46,6 +47,11 @@ export interface EmitSocketEventFn {
46
47
  room: SocketServerRoom,
47
48
  data: WppChatFinishedEventData,
48
49
  ): Promise<MessageResponse>;
50
+ (
51
+ type: SocketEventType.WppChatTransfer,
52
+ room: SocketServerRoom,
53
+ data: WppChatTransferEventData,
54
+ ): Promise<MessageResponse>;
49
55
  (
50
56
  type: SocketEventType.WppMessage,
51
57
  room: SocketServerChatRoom,
@@ -109,6 +115,10 @@ export interface ListenSocketEventFn {
109
115
  (
110
116
  type: SocketEventType.WppChatFinished,
111
117
  callback: (data: WppChatFinishedEventData) => void,
118
+ ): void;
119
+ (
120
+ type: SocketEventType.WppChatTransfer,
121
+ callback: (data: WppChatTransferEventData) => void,
112
122
  ): void;
113
123
  (
114
124
  type: SocketEventType.WppMessage,
@@ -168,6 +178,9 @@ export interface WppChatStartedEventData {
168
178
  export interface WppChatFinishedEventData {
169
179
  chatId: number;
170
180
  }
181
+ export interface WppChatTransferEventData {
182
+ chatId: number;
183
+ }
171
184
  export interface WppContactMessagesReadEventData {
172
185
  contactId: number;
173
186
  }
@@ -189,6 +202,9 @@ export interface InternalChatStartedEventData {
189
202
  export interface InternalChatFinishedEventData {
190
203
  chatId: number;
191
204
  }
205
+ export interface InternalChatTransferEventData {
206
+ chatId: number;
207
+ }
192
208
  export interface InternalContactMessagesReadEventData {
193
209
  contactId: number;
194
210
  }
@@ -133,7 +133,7 @@ export default class WhatsappClient extends ApiClient {
133
133
  }
134
134
 
135
135
  public async getContactsWithCustomer() {
136
- const url = `/api/whatsapp/contacts`;
136
+ const url = `/api/whatsapp/contacts/customer`;
137
137
  const { data: res } =
138
138
  await this.httpClient.get<DataResponse<WppContactWithCustomer[]>>(
139
139
  url,
@@ -141,7 +141,15 @@ export default class WhatsappClient extends ApiClient {
141
141
 
142
142
  return res.data;
143
143
  }
144
+ public async getContacts() {
145
+ const url = `/api/whatsapp/contacts`;
146
+ const { data: res } =
147
+ await this.httpClient.get<DataResponse<WppContact[]>>(
148
+ url,
149
+ );
144
150
 
151
+ return res.data;
152
+ }
145
153
  public async createContact(
146
154
  name: string,
147
155
  phone: string,