@in.pulse-crm/sdk 2.10.1 → 2.10.3
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/.prettierrc +4 -4
- package/dist/files.client.d.ts +2 -0
- package/dist/types/files.types.d.ts +2 -0
- package/dist/types/socket-events.types.d.ts +13 -0
- package/dist/types/socket-events.types.js +2 -0
- package/dist/types/whatsapp.types.d.ts +35 -0
- package/dist/whatsapp.client.d.ts +5 -1
- package/dist/whatsapp.client.js +19 -0
- package/package.json +1 -1
- package/src/socket-server.client.ts +20 -20
- package/src/types/socket-events.types.ts +39 -3
- package/src/types/whatsapp.types.ts +37 -1
- package/src/whatsapp.client.ts +24 -0
- package/tsconfig.json +16 -16
package/.prettierrc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tabWidth": 4,
|
|
3
|
-
"useTabs": true
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"tabWidth": 4,
|
|
3
|
+
"useTabs": true
|
|
4
|
+
}
|
package/dist/files.client.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare enum SocketEventType {
|
|
|
7
7
|
WppChatFinished = "wpp_chat_finished",
|
|
8
8
|
WppChatTransfer = "wpp_chat_transfer",
|
|
9
9
|
WppMessage = "wpp_message",
|
|
10
|
+
WppMessageEdit = "wpp_message_edit",
|
|
11
|
+
WppMessageDelete = "wpp_message_delete",
|
|
10
12
|
WppMessageStatus = "wpp_message_status",
|
|
11
13
|
WppMessageReaction = "wpp_message_reaction",
|
|
12
14
|
WppContactMessagesRead = "wpp_contact_messages_read",
|
|
@@ -25,6 +27,8 @@ export interface EmitSocketEventFn {
|
|
|
25
27
|
(type: SocketEventType.WppChatFinished, room: SocketServerRoom, data: WppChatFinishedEventData): Promise<MessageResponse>;
|
|
26
28
|
(type: SocketEventType.WppChatTransfer, room: SocketServerRoom, data: WppChatTransferEventData): Promise<MessageResponse>;
|
|
27
29
|
(type: SocketEventType.WppMessage, room: SocketServerChatRoom, data: WppMessageEventData): Promise<MessageResponse>;
|
|
30
|
+
(type: SocketEventType.WppMessageEdit, room: SocketServerChatRoom, data: WppMessageEditEventData): Promise<MessageResponse>;
|
|
31
|
+
(type: SocketEventType.WppMessageDelete, room: SocketServerChatRoom, data: WppMessageDeleteEventData): Promise<MessageResponse>;
|
|
28
32
|
(type: SocketEventType.WppMessageStatus, room: SocketServerChatRoom, data: WppMessageStatusEventData): Promise<MessageResponse>;
|
|
29
33
|
(type: SocketEventType.WppContactMessagesRead, room: SocketServerChatRoom, data: WppContactMessagesReadEventData): Promise<MessageResponse>;
|
|
30
34
|
(type: SocketEventType.WppMessageReaction, room: SocketServerChatRoom, data: WppMessageReactionEventData): Promise<MessageResponse>;
|
|
@@ -49,6 +53,8 @@ export interface ListenSocketEventFn {
|
|
|
49
53
|
(type: SocketEventType.InternalChatFinished, callback: (data: InternalChatFinishedEventData) => void): void;
|
|
50
54
|
(type: SocketEventType.InternalMessage, callback: (data: InternalMessageEventData) => void): void;
|
|
51
55
|
(type: SocketEventType.InternalMessageStatus, callback: (data: InternalMessageStatusEventData) => void): void;
|
|
56
|
+
(type: SocketEventType.WppMessageEdit, callback: (data: WppMessageEditEventData) => void): void;
|
|
57
|
+
(type: SocketEventType.WppMessageDelete, callback: (data: WppMessageDeleteEventData) => void): void;
|
|
52
58
|
}
|
|
53
59
|
export interface UnlistenSocketEventFn {
|
|
54
60
|
(type: SocketEventType): void;
|
|
@@ -77,6 +83,13 @@ export interface WppContactMessagesReadEventData {
|
|
|
77
83
|
export interface WppMessageEventData {
|
|
78
84
|
message: WppMessage;
|
|
79
85
|
}
|
|
86
|
+
export interface WppMessageEditEventData {
|
|
87
|
+
messageId: number;
|
|
88
|
+
newText: string;
|
|
89
|
+
}
|
|
90
|
+
export interface WppMessageDeleteEventData {
|
|
91
|
+
messageId: number;
|
|
92
|
+
}
|
|
80
93
|
export interface WppMessageStatusEventData {
|
|
81
94
|
messageId: number;
|
|
82
95
|
contactId: number;
|
|
@@ -7,6 +7,8 @@ var SocketEventType;
|
|
|
7
7
|
SocketEventType["WppChatFinished"] = "wpp_chat_finished";
|
|
8
8
|
SocketEventType["WppChatTransfer"] = "wpp_chat_transfer";
|
|
9
9
|
SocketEventType["WppMessage"] = "wpp_message";
|
|
10
|
+
SocketEventType["WppMessageEdit"] = "wpp_message_edit";
|
|
11
|
+
SocketEventType["WppMessageDelete"] = "wpp_message_delete";
|
|
10
12
|
SocketEventType["WppMessageStatus"] = "wpp_message_status";
|
|
11
13
|
SocketEventType["WppMessageReaction"] = "wpp_message_reaction";
|
|
12
14
|
SocketEventType["WppContactMessagesRead"] = "wpp_contact_messages_read";
|
|
@@ -4,20 +4,24 @@ export interface WppContact {
|
|
|
4
4
|
name: string;
|
|
5
5
|
phone: string;
|
|
6
6
|
customerId?: number;
|
|
7
|
+
avatarUrl?: string;
|
|
7
8
|
instance: string;
|
|
8
9
|
isBlocked: boolean;
|
|
9
10
|
isOnlyAdmin: boolean;
|
|
11
|
+
lastOutOfHoursReplySentAt?: Date | null;
|
|
10
12
|
}
|
|
11
13
|
export interface WppContactWithCustomer {
|
|
12
14
|
id: number;
|
|
13
15
|
name: string;
|
|
14
16
|
phone: string;
|
|
15
17
|
customerId?: number;
|
|
18
|
+
avatarUrl?: string;
|
|
16
19
|
instance: string;
|
|
17
20
|
isBlocked: boolean;
|
|
18
21
|
isOnlyAdmin: boolean;
|
|
19
22
|
customer: Customer | null;
|
|
20
23
|
chatingWith: string | null;
|
|
24
|
+
lastOutOfHoursReplySentAt?: Date | null;
|
|
21
25
|
}
|
|
22
26
|
export interface WppMessage {
|
|
23
27
|
id: number;
|
|
@@ -29,6 +33,7 @@ export interface WppMessage {
|
|
|
29
33
|
type: string;
|
|
30
34
|
quotedId?: number | null;
|
|
31
35
|
chatId?: number | null;
|
|
36
|
+
userName?: string;
|
|
32
37
|
contactId?: number | null;
|
|
33
38
|
body: string;
|
|
34
39
|
timestamp: string;
|
|
@@ -55,6 +60,7 @@ export interface WppChat {
|
|
|
55
60
|
instance: string;
|
|
56
61
|
contactId?: number;
|
|
57
62
|
userId?: number;
|
|
63
|
+
userName?: string;
|
|
58
64
|
walletId?: number;
|
|
59
65
|
botId?: number;
|
|
60
66
|
resultId?: number;
|
|
@@ -164,3 +170,32 @@ export interface PaginatedNotificationsResponse {
|
|
|
164
170
|
notifications: AppNotification[];
|
|
165
171
|
totalCount: number;
|
|
166
172
|
}
|
|
173
|
+
export interface AutomaticResponseSchedule {
|
|
174
|
+
id?: number;
|
|
175
|
+
dayOfWeek: number;
|
|
176
|
+
startTime: string;
|
|
177
|
+
endTime: string;
|
|
178
|
+
}
|
|
179
|
+
export interface AutomaticResponseRule {
|
|
180
|
+
id: number;
|
|
181
|
+
name: string;
|
|
182
|
+
message: string;
|
|
183
|
+
isEnabled: boolean;
|
|
184
|
+
isGlobal: boolean;
|
|
185
|
+
cooldownSeconds: number;
|
|
186
|
+
fileId: number | null;
|
|
187
|
+
schedules: AutomaticResponseSchedule[];
|
|
188
|
+
userAssignments: {
|
|
189
|
+
userId: number;
|
|
190
|
+
}[];
|
|
191
|
+
}
|
|
192
|
+
export interface AutomaticResponseRuleDTO {
|
|
193
|
+
name: string;
|
|
194
|
+
message: string;
|
|
195
|
+
isEnabled: boolean;
|
|
196
|
+
isGlobal: boolean;
|
|
197
|
+
cooldownSeconds: number;
|
|
198
|
+
fileId?: number | null;
|
|
199
|
+
userIds: number[];
|
|
200
|
+
schedules: Omit<AutomaticResponseSchedule, 'id'>[];
|
|
201
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { RequestFilters } from "./types";
|
|
3
3
|
import { DataResponse, MessageResponse } from "./types/response.types";
|
|
4
|
-
import { AppNotification, CreateScheduleDTO, ForwardMessagesData, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
|
|
4
|
+
import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
|
|
5
5
|
interface FetchMessagesFilters {
|
|
6
6
|
minDate: string;
|
|
7
7
|
maxDate: string;
|
|
@@ -79,5 +79,9 @@ export default class WhatsappClient extends ApiClient {
|
|
|
79
79
|
getMessages(token: string, filters: FetchMessagesFilters): Promise<(WppMessage & {
|
|
80
80
|
WppContact: WppContact | null;
|
|
81
81
|
})[]>;
|
|
82
|
+
getAutoResponseRules(): Promise<AutomaticResponseRule[]>;
|
|
83
|
+
createAutoResponseRule(ruleData: AutomaticResponseRuleDTO): Promise<AutomaticResponseRule>;
|
|
84
|
+
updateAutoResponseRule(id: number, ruleData: Omit<AutomaticResponseRuleDTO, 'instance'>): Promise<AutomaticResponseRule>;
|
|
85
|
+
deleteAutoResponseRule(id: number): Promise<void>;
|
|
82
86
|
}
|
|
83
87
|
export {};
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -237,5 +237,24 @@ class WhatsappClient extends api_client_1.default {
|
|
|
237
237
|
});
|
|
238
238
|
return res.data;
|
|
239
239
|
}
|
|
240
|
+
async getAutoResponseRules() {
|
|
241
|
+
const url = `/api/auto-response-rules`;
|
|
242
|
+
const { data: res } = await this.ax.get(url);
|
|
243
|
+
return res.data;
|
|
244
|
+
}
|
|
245
|
+
async createAutoResponseRule(ruleData) {
|
|
246
|
+
const url = `/api/auto-response-rules`;
|
|
247
|
+
const { data: res } = await this.ax.post(url, ruleData);
|
|
248
|
+
return res.data;
|
|
249
|
+
}
|
|
250
|
+
async updateAutoResponseRule(id, ruleData) {
|
|
251
|
+
const url = `/api/auto-response-rules/${id}`;
|
|
252
|
+
const { data: res } = await this.ax.put(url, ruleData);
|
|
253
|
+
return res.data;
|
|
254
|
+
}
|
|
255
|
+
async deleteAutoResponseRule(id) {
|
|
256
|
+
const url = `/api/auto-response-rules/${id}`;
|
|
257
|
+
await this.ax.delete(url);
|
|
258
|
+
}
|
|
240
259
|
}
|
|
241
260
|
exports.default = WhatsappClient;
|
package/package.json
CHANGED
|
@@ -8,26 +8,26 @@ import { MessageResponse } from "./types/response.types";
|
|
|
8
8
|
* for emitting events to specific rooms on the server.
|
|
9
9
|
*/
|
|
10
10
|
export default class SocketServerApi extends ApiClient {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the SocketServerApiClient.
|
|
13
|
+
*
|
|
14
|
+
* @param baseUrl - The base URL for the socket server API.
|
|
15
|
+
*/
|
|
16
|
+
constructor(baseUrl: string) {
|
|
17
|
+
super(baseUrl);
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Emits a socket event to a specified room with a given event name and value.
|
|
22
|
+
*
|
|
23
|
+
* @param event - The name of the event to emit.
|
|
24
|
+
* @param room - The name of the room to which the event should be emitted.
|
|
25
|
+
* @param value - The payload or data to send with the event.
|
|
26
|
+
* @returns A promise that resolves with the response from the API call.
|
|
27
|
+
*/
|
|
28
|
+
public emit: EmitSocketEventFn = (event, room, value) => {
|
|
29
|
+
return this.ax
|
|
30
30
|
.post<MessageResponse>(`/api/ws/emit/${room}/${event}`, value)
|
|
31
31
|
.then((res) => res.data);
|
|
32
|
-
|
|
33
|
-
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -7,13 +7,19 @@ import {
|
|
|
7
7
|
} from "./socket-rooms.types";
|
|
8
8
|
import { MessageResponse } from "./response.types";
|
|
9
9
|
import { WppMessage, WppMessageStatus } from "./whatsapp.types";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
InternalChat,
|
|
12
|
+
InternalChatMember,
|
|
13
|
+
InternalMessage,
|
|
14
|
+
} from "./internal.types";
|
|
11
15
|
|
|
12
16
|
export enum SocketEventType {
|
|
13
17
|
WppChatStarted = "wpp_chat_started",
|
|
14
18
|
WppChatFinished = "wpp_chat_finished",
|
|
15
19
|
WppChatTransfer = "wpp_chat_transfer",
|
|
16
20
|
WppMessage = "wpp_message",
|
|
21
|
+
WppMessageEdit = "wpp_message_edit",
|
|
22
|
+
WppMessageDelete = "wpp_message_delete",
|
|
17
23
|
WppMessageStatus = "wpp_message_status",
|
|
18
24
|
WppMessageReaction = "wpp_message_reaction",
|
|
19
25
|
WppContactMessagesRead = "wpp_contact_messages_read",
|
|
@@ -57,6 +63,16 @@ export interface EmitSocketEventFn {
|
|
|
57
63
|
room: SocketServerChatRoom,
|
|
58
64
|
data: WppMessageEventData,
|
|
59
65
|
): Promise<MessageResponse>;
|
|
66
|
+
(
|
|
67
|
+
type: SocketEventType.WppMessageEdit,
|
|
68
|
+
room: SocketServerChatRoom,
|
|
69
|
+
data: WppMessageEditEventData,
|
|
70
|
+
): Promise<MessageResponse>;
|
|
71
|
+
(
|
|
72
|
+
type: SocketEventType.WppMessageDelete,
|
|
73
|
+
room: SocketServerChatRoom,
|
|
74
|
+
data: WppMessageDeleteEventData,
|
|
75
|
+
): Promise<MessageResponse>;
|
|
60
76
|
(
|
|
61
77
|
type: SocketEventType.WppMessageStatus,
|
|
62
78
|
room: SocketServerChatRoom,
|
|
@@ -116,7 +132,7 @@ export interface ListenSocketEventFn {
|
|
|
116
132
|
type: SocketEventType.WppChatFinished,
|
|
117
133
|
callback: (data: WppChatFinishedEventData) => void,
|
|
118
134
|
): void;
|
|
119
|
-
|
|
135
|
+
(
|
|
120
136
|
type: SocketEventType.WppChatTransfer,
|
|
121
137
|
callback: (data: WppChatTransferEventData) => void,
|
|
122
138
|
): void;
|
|
@@ -156,6 +172,14 @@ export interface ListenSocketEventFn {
|
|
|
156
172
|
type: SocketEventType.InternalMessageStatus,
|
|
157
173
|
callback: (data: InternalMessageStatusEventData) => void,
|
|
158
174
|
): void;
|
|
175
|
+
(
|
|
176
|
+
type: SocketEventType.WppMessageEdit,
|
|
177
|
+
callback: (data: WppMessageEditEventData) => void,
|
|
178
|
+
): void;
|
|
179
|
+
(
|
|
180
|
+
type: SocketEventType.WppMessageDelete,
|
|
181
|
+
callback: (data: WppMessageDeleteEventData) => void,
|
|
182
|
+
): void;
|
|
159
183
|
}
|
|
160
184
|
|
|
161
185
|
export interface UnlistenSocketEventFn {
|
|
@@ -187,6 +211,15 @@ export interface WppContactMessagesReadEventData {
|
|
|
187
211
|
export interface WppMessageEventData {
|
|
188
212
|
message: WppMessage;
|
|
189
213
|
}
|
|
214
|
+
|
|
215
|
+
export interface WppMessageEditEventData {
|
|
216
|
+
messageId: number;
|
|
217
|
+
newText: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface WppMessageDeleteEventData {
|
|
221
|
+
messageId: number;
|
|
222
|
+
}
|
|
190
223
|
export interface WppMessageStatusEventData {
|
|
191
224
|
messageId: number;
|
|
192
225
|
contactId: number;
|
|
@@ -197,7 +230,10 @@ export interface WppMessageReactionEventData {
|
|
|
197
230
|
reaction: string;
|
|
198
231
|
}
|
|
199
232
|
export interface InternalChatStartedEventData {
|
|
200
|
-
chat: InternalChat & {
|
|
233
|
+
chat: InternalChat & {
|
|
234
|
+
participants: InternalChatMember[];
|
|
235
|
+
messages: InternalMessage[];
|
|
236
|
+
};
|
|
201
237
|
}
|
|
202
238
|
export interface InternalChatFinishedEventData {
|
|
203
239
|
chatId: number;
|
|
@@ -5,9 +5,11 @@ export interface WppContact {
|
|
|
5
5
|
name: string;
|
|
6
6
|
phone: string;
|
|
7
7
|
customerId?: number;
|
|
8
|
+
avatarUrl?: string;
|
|
8
9
|
instance: string;
|
|
9
10
|
isBlocked: boolean;
|
|
10
11
|
isOnlyAdmin: boolean;
|
|
12
|
+
lastOutOfHoursReplySentAt?: Date | null;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export interface WppContactWithCustomer {
|
|
@@ -15,11 +17,13 @@ export interface WppContactWithCustomer {
|
|
|
15
17
|
name: string;
|
|
16
18
|
phone: string;
|
|
17
19
|
customerId?: number;
|
|
20
|
+
avatarUrl?: string;
|
|
18
21
|
instance: string;
|
|
19
22
|
isBlocked: boolean;
|
|
20
23
|
isOnlyAdmin: boolean;
|
|
21
24
|
customer: Customer | null;
|
|
22
25
|
chatingWith: string | null;
|
|
26
|
+
lastOutOfHoursReplySentAt?: Date | null;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export interface WppMessage {
|
|
@@ -32,6 +36,7 @@ export interface WppMessage {
|
|
|
32
36
|
type: string;
|
|
33
37
|
quotedId?: number | null;
|
|
34
38
|
chatId?: number | null;
|
|
39
|
+
userName?: string;
|
|
35
40
|
contactId?: number | null;
|
|
36
41
|
body: string;
|
|
37
42
|
timestamp: string;
|
|
@@ -54,6 +59,7 @@ export interface WppChat {
|
|
|
54
59
|
instance: string;
|
|
55
60
|
contactId?: number;
|
|
56
61
|
userId?: number;
|
|
62
|
+
userName?: string;
|
|
57
63
|
walletId?: number;
|
|
58
64
|
botId?: number;
|
|
59
65
|
resultId?: number;
|
|
@@ -189,4 +195,34 @@ export interface AppNotification {
|
|
|
189
195
|
export interface PaginatedNotificationsResponse {
|
|
190
196
|
notifications: AppNotification[];
|
|
191
197
|
totalCount: number;
|
|
192
|
-
}
|
|
198
|
+
}
|
|
199
|
+
export interface AutomaticResponseSchedule {
|
|
200
|
+
id?: number;
|
|
201
|
+
dayOfWeek: number;
|
|
202
|
+
startTime: string;
|
|
203
|
+
endTime: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface AutomaticResponseRule {
|
|
207
|
+
id: number;
|
|
208
|
+
name: string;
|
|
209
|
+
message: string;
|
|
210
|
+
isEnabled: boolean;
|
|
211
|
+
isGlobal: boolean;
|
|
212
|
+
cooldownSeconds: number;
|
|
213
|
+
fileId: number | null;
|
|
214
|
+
schedules: AutomaticResponseSchedule[];
|
|
215
|
+
userAssignments: { userId: number }[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface AutomaticResponseRuleDTO {
|
|
219
|
+
name: string;
|
|
220
|
+
message: string;
|
|
221
|
+
isEnabled: boolean;
|
|
222
|
+
isGlobal: boolean;
|
|
223
|
+
cooldownSeconds: number;
|
|
224
|
+
fileId?: number | null;
|
|
225
|
+
userIds: number[];
|
|
226
|
+
schedules: Omit<AutomaticResponseSchedule, 'id'>[];
|
|
227
|
+
}
|
|
228
|
+
|
package/src/whatsapp.client.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { RequestFilters } from "./types";
|
|
|
3
3
|
import { DataResponse, MessageResponse } from "./types/response.types";
|
|
4
4
|
import {
|
|
5
5
|
AppNotification,
|
|
6
|
+
AutomaticResponseRule,
|
|
7
|
+
AutomaticResponseRuleDTO,
|
|
6
8
|
CreateScheduleDTO,
|
|
7
9
|
ForwardMessagesData,
|
|
8
10
|
PaginatedNotificationsResponse,
|
|
@@ -339,4 +341,26 @@ export default class WhatsappClient extends ApiClient {
|
|
|
339
341
|
});
|
|
340
342
|
return res.data;
|
|
341
343
|
}
|
|
344
|
+
public async getAutoResponseRules() {
|
|
345
|
+
const url = `/api/auto-response-rules`;
|
|
346
|
+
const { data: res } = await this.ax.get<DataResponse<AutomaticResponseRule[]>>(url);
|
|
347
|
+
return res.data;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
public async createAutoResponseRule(ruleData: AutomaticResponseRuleDTO) {
|
|
351
|
+
const url = `/api/auto-response-rules`;
|
|
352
|
+
const { data: res } = await this.ax.post<DataResponse<AutomaticResponseRule>>(url, ruleData);
|
|
353
|
+
return res.data;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
public async updateAutoResponseRule(id: number, ruleData: Omit<AutomaticResponseRuleDTO, 'instance'>) {
|
|
357
|
+
const url = `/api/auto-response-rules/${id}`;
|
|
358
|
+
const { data: res } = await this.ax.put<DataResponse<AutomaticResponseRule>>(url, ruleData);
|
|
359
|
+
return res.data;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
public async deleteAutoResponseRule(id: number) {
|
|
363
|
+
const url = `/api/auto-response-rules/${id}`;
|
|
364
|
+
await this.ax.delete<MessageResponse>(url);
|
|
365
|
+
}
|
|
342
366
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
-
"noUnusedLocals": false,
|
|
10
|
-
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
-
"declaration": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src/index.ts",
|
|
15
|
-
"src/**/*.{ts}"
|
|
16
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
4
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
5
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
6
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
7
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
8
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
9
|
+
"noUnusedLocals": false,
|
|
10
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"src/index.ts",
|
|
15
|
+
"src/**/*.{ts}"
|
|
16
|
+
]
|
|
17
17
|
}
|