@in.pulse-crm/sdk 2.9.2 → 2.9.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.
package/.prettierrc CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "tabWidth": 4,
3
- "useTabs": true
4
- }
1
+ {
2
+ "tabWidth": 4,
3
+ "useTabs": true
4
+ }
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import ApiClient from "./api-client";
4
2
  import { File, UploadFileOptions } from "./types/files.types";
5
3
  declare class FilesClient extends ApiClient {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export interface UploadFileOptions {
4
2
  /**
5
3
  * Nome da instância onde o arquivo está armazenado.
@@ -38,6 +38,16 @@ export interface WppMessage {
38
38
  fileType?: string | null;
39
39
  fileSize?: string | null;
40
40
  }
41
+ export interface ForwardMessagesData {
42
+ messageIds: number[];
43
+ whatsappTargets?: Array<{
44
+ id: string;
45
+ isGroup: boolean;
46
+ }>;
47
+ internalTargets?: Array<{
48
+ id: number;
49
+ }>;
50
+ }
41
51
  export interface WppChat {
42
52
  id: number;
43
53
  instance: string;
@@ -1,6 +1,6 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { RequestFilters } from "./types";
3
- import { CreateScheduleDTO, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
3
+ import { CreateScheduleDTO, ForwardMessagesData, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
4
4
  export default class WhatsappClient extends ApiClient {
5
5
  getChatsBySession(messages?: boolean, contact?: boolean, token?: string | null): Promise<WppChatsAndMessages>;
6
6
  getChatById(id: number): Promise<WppChatWithDetailsAndMessages>;
@@ -18,7 +18,8 @@ export default class WhatsappClient extends ApiClient {
18
18
  getContactsWithCustomer(): Promise<WppContactWithCustomer[]>;
19
19
  getContacts(): Promise<WppContact[]>;
20
20
  createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
21
- updateContact(contactId: number, name: string, customerId: number | null): Promise<WppContact>;
21
+ forwardMessages(data: ForwardMessagesData): Promise<void>;
22
+ updateContact(contactId: number, name: string, customerId?: number | null): Promise<WppContact>;
22
23
  deleteContact(contactId: number): Promise<void>;
23
24
  getSectors(): Promise<{
24
25
  id: number;
@@ -94,9 +94,15 @@ class WhatsappClient extends api_client_1.default {
94
94
  const { data: res } = await this.ax.post(url, body);
95
95
  return res.data;
96
96
  }
97
+ async forwardMessages(data) {
98
+ const url = "/api/whatsapp/messages/forward";
99
+ const body = data;
100
+ await this.ax.post(url, body);
101
+ }
97
102
  async updateContact(contactId, name, customerId) {
98
103
  const url = `/api/whatsapp/contacts/${contactId}`;
99
- const body = { name, customerId };
104
+ const body = { name };
105
+ customerId !== undefined && (body["customerId"] = customerId);
100
106
  const { data: res } = await this.ax.put(url, body);
101
107
  return res.data;
102
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.9.2",
3
+ "version": "2.9.4",
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",
@@ -41,6 +41,11 @@ export interface WppMessage {
41
41
  fileType?: string | null;
42
42
  fileSize?: string | null;
43
43
  }
44
+ export interface ForwardMessagesData {
45
+ messageIds: number[];
46
+ whatsappTargets?: Array<{ id: string; isGroup: boolean }>;
47
+ internalTargets?: Array<{ id: number }>;
48
+ }
44
49
 
45
50
  export interface WppChat {
46
51
  id: number;
@@ -3,6 +3,7 @@ import { RequestFilters } from "./types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
4
  import {
5
5
  CreateScheduleDTO,
6
+ ForwardMessagesData,
6
7
  SendMessageData,
7
8
  WppChatsAndMessages,
8
9
  WppChatWithDetailsAndMessages,
@@ -169,10 +170,18 @@ export default class WhatsappClient extends ApiClient {
169
170
 
170
171
  return res.data;
171
172
  }
172
-
173
- public async updateContact(contactId: number, name: string, customerId: number | null) {
173
+ public async forwardMessages(data: ForwardMessagesData) {
174
+ const url = "/api/whatsapp/messages/forward";
175
+
176
+ const body = data;
177
+
178
+ await this.ax.post<MessageResponse>(url, body);
179
+ }
180
+ public async updateContact(contactId: number, name: string, customerId?: number | null) {
174
181
  const url = `/api/whatsapp/contacts/${contactId}`;
175
- const body = { name, customerId };
182
+ const body: Record<string, any> = { name };
183
+
184
+ customerId !== undefined && (body["customerId"] = customerId);
176
185
 
177
186
  const { data: res } = await this.ax.put<DataResponse<WppContact>>(
178
187
  url,
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
  }