@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.
@@ -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 { WppChat, WppContact, WppMessage } from "./types/whatsapp.types";
5
- type ChatWithContactAndCustomer = WppChat & {
6
- customer: Customer;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
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",
@@ -1,82 +1,96 @@
1
+ import { Customer } from "./customers.types";
2
+
1
3
  export interface WppContact {
2
- id: number;
3
- name: string;
4
- phone: string;
5
- customerId?: number;
6
- instance: string;
7
- isBlocked: boolean;
8
- isOnlyAdmin: boolean;
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
- id: number;
13
- instance: string;
14
- wwebjsId?: string;
15
- wabaId?: string;
16
- from: string;
17
- to: string;
18
- type: string;
19
- quotedId?: string;
20
- chatId?: number;
21
- contactId?: number;
22
- body: string;
23
- timestamp: string;
24
- status: WppMessageStatus;
25
- fileId?: number;
26
- fileName?: string;
27
- fileType?: string;
28
- fileSize?: string;
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
- id: number;
33
- instance: string;
34
- contactId?: number;
35
- userId?: number;
36
- walletId?: number;
37
- botId?: number;
38
- resultId?: number;
39
- sectorId?: number;
40
- type: WppChatType;
41
- priority: WppChatPriority;
42
- avatarUrl?: string;
43
- isFinished: boolean;
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
- id: number;
48
- name: string;
49
- instanceName: string;
50
- wppInstanceId?: number;
51
- startChats: boolean;
52
- receiveChats: boolean;
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
- instanceName: string;
57
- id: number;
58
- name: string;
58
+ instanceName: string;
59
+ id: number;
60
+ name: string;
59
61
  }
60
62
 
61
63
  // Enums
62
64
  export enum WppMessageStatus {
63
- PENDING = "PENDING",
64
- SENT = "SENT",
65
- RECEIVED = "RECEIVED",
66
- READ = "READ",
67
- DOWNLOADED = "DOWNLOADED",
68
- ERROR = "ERROR",
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
- RECEPTIVE = "RECEPTIVE",
73
- ACTIVE = "ACTIVE",
74
+ RECEPTIVE = "RECEPTIVE",
75
+ ACTIVE = "ACTIVE",
74
76
  }
75
77
 
76
78
  export enum WppChatPriority {
77
- LOW = "LOW",
78
- NORMAL = "NORMAL",
79
- HIGH = "HIGH",
80
- VERY_HIGH = "VERY_HIGH",
81
- URGENCY = "URGENCY",
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
+ };
@@ -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 { WppChat, WppContact, WppMessage } from "./types/whatsapp.types";
5
-
6
- type ChatWithContactAndCustomer = WppChat & {
7
- customer: Customer;
8
- contact: WppContact;
9
- };
10
- type ChatsAndMessages = {
11
- chats: ChatWithContactAndCustomer[];
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 {