@cleardu/types 1.0.542 → 1.0.544

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.
@@ -0,0 +1,69 @@
1
+ export interface IMetaWhatsappTenantPayload {
2
+ clientUId?: string;
3
+ clientId?: number;
4
+ xApiKey?: string;
5
+ }
6
+
7
+ export interface IMetaWhatsappRequestPayload
8
+ extends IMetaWhatsappTenantPayload {
9
+ body?: any;
10
+ query?: Record<string, any>;
11
+ headers?: Record<string, string>;
12
+ wabaId?: string;
13
+ name?: string;
14
+ /** Meta WhatsApp template id (`rawResponse.data.id` from CRM). */
15
+ id?: string;
16
+ phoneNumberId?: string;
17
+ mediaId?: string;
18
+ }
19
+
20
+ export interface IFacebookOnboardingResponse {
21
+ data?: {
22
+ user?: Record<string, any>;
23
+ isNewUser?: boolean;
24
+ metaClientInfo?: {
25
+ wabaId?: string;
26
+ phoneNumberId?: string;
27
+ phoneNumber?: string;
28
+ wabaName?: string;
29
+ verifiedPhoneName?: string;
30
+ businessId?: string;
31
+ tokenExpiresAt?: string;
32
+ isWebhookSubscribed?: boolean;
33
+ };
34
+ };
35
+ }
36
+
37
+ export interface IMetaFacebookOnboardingPersistPayload {
38
+ clientUId: string;
39
+ onboardingResponse: IFacebookOnboardingResponse;
40
+ }
41
+
42
+ /** `picture.data` from Facebook JS SDK login payload. */
43
+ export interface IFacebookPictureData {
44
+ height: number;
45
+ width: number;
46
+ url: string;
47
+ is_silhouette: boolean;
48
+ }
49
+
50
+ export interface IFacebookPicture {
51
+ data: IFacebookPictureData;
52
+ }
53
+
54
+ export interface IFacebookOnboardingBody {
55
+ name: string;
56
+ picture: IFacebookPicture;
57
+ id: string;
58
+ userID: string;
59
+ expiresIn: number;
60
+ accessToken: string;
61
+ signedRequest: string;
62
+ graphDomain: string;
63
+ data_access_expiration_time: number;
64
+ }
65
+
66
+ export interface IMetaWhatsappResponse<T = any> {
67
+ status: number;
68
+ data: T;
69
+ }
@@ -1,12 +1,96 @@
1
- import { languageCodes, templateTypes } from '../../constants';
1
+ import { languageCodes, metaTemplateStatus, templateTypes } from '../../constants';
2
2
  import { DatabaseObject } from '../baseObject';
3
3
  import { IListPayload } from '../payload';
4
4
  export interface ITemplate extends DatabaseObject {
5
5
  type: templateTypes;
6
6
  name: string;
7
7
  message: string;
8
- languageCode: languageCodes;
8
+ languageCode: string;
9
9
  isActive: boolean;
10
+ category?: string | null;
11
+ component?: Record<string, unknown> | unknown[] | null;
12
+ rawResponse?: Record<string, unknown> | null;
13
+ metaApprovalStatus?: metaTemplateStatus | null;
14
+ wabaId?: string | null;
15
+ clientId?: number | null;
16
+ }
17
+ export interface IMetaWhatsappTemplateListParams {
18
+ clientUId?: string;
19
+ wabaId?: string;
20
+ page?: number;
21
+ size?: number;
22
+ q?: string;
23
+ }
24
+ export type IMetaWhatsappTemplateButtonType = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
25
+ export interface IMetaWhatsappTemplateButton {
26
+ type: IMetaWhatsappTemplateButtonType;
27
+ text: string;
28
+ url?: string;
29
+ phone_number?: string;
30
+ }
31
+ /**
32
+ * Cleardu Meta WhatsApp integration POST body for template create
33
+ * (`BrokerMessages.INTEGRATION.MESSAGES.WHATSAPP.META.WHATSAPP.CREATE_TEMPLATE` → `payload.body`).
34
+ * Built in CRM; forwarded unchanged by integration-ms to the Meta adapter.
35
+ */
36
+ export interface IMetaWhatsappTemplateIntegrationBody {
37
+ wabaId: string;
38
+ template: {
39
+ name: string;
40
+ language: string;
41
+ category: string;
42
+ components: Record<string, unknown>[];
43
+ };
44
+ }
45
+ /**
46
+ * Body of `BrokerMessages.CRM.WHATSAPP_META.TEMPLATE.CREATE` (`@Payload('body')`).
47
+ * Matches `CreateMetaWhatsappTemplateDto`; `user` is supplied separately on the message payload.
48
+ */
49
+ export interface IMetaWhatsappTemplateCreatePayload {
50
+ clientUId: string;
51
+ wabaId: string;
52
+ phoneNumberId?: string;
53
+ name: string;
54
+ message: string;
55
+ languageCode: languageCodes;
56
+ /** Required for Meta create unless `metaCreateBody` is supplied. */
57
+ category?: string;
58
+ headerText?: string;
59
+ footerText?: string;
60
+ buttons?: IMetaWhatsappTemplateButton[];
61
+ /** Meta `components` array when not sending a full `metaCreateBody`. */
62
+ component?: Record<string, unknown>[];
63
+ isActive?: boolean;
64
+ /** When set, forwarded as-is to integration instead of a derived Meta create shape. */
65
+ metaCreateBody?: Record<string, unknown>;
66
+ }
67
+ export interface IMetaWhatsappTemplateUpdatePayload {
68
+ clientUId: string;
69
+ userId: number;
70
+ id: number;
71
+ name?: string;
72
+ message?: string;
73
+ languageCode?: languageCodes;
74
+ category?: string;
75
+ component?: Record<string, unknown> | unknown[];
76
+ isActive?: boolean;
77
+ metaApprovalStatus?: metaTemplateStatus;
78
+ }
79
+ export interface IMetaWhatsappTemplateSyncPayload {
80
+ clientUId: string;
81
+ wabaId: string;
82
+ }
83
+ /** CRM broker payload: delete Meta WhatsApp template by CRM `templates.id` only. */
84
+ export interface IMetaWhatsappTemplateDeletePayload {
85
+ id: number;
86
+ }
87
+ /** Dropdown option for Meta WhatsApp template `{{parameter}}` placeholders. */
88
+ export interface IMetaWhatsappTemplateParameterField {
89
+ key: string;
90
+ source: 'borrower' | 'loan' | 'loan_participant' | 'loan_contact' | 'client';
91
+ }
92
+ export interface IMetaWhatsappTemplateParameterFieldsResult {
93
+ fields: IMetaWhatsappTemplateParameterField[];
10
94
  }
11
95
  export interface ISmartPingTemplate extends DatabaseObject {
12
96
  templateId: string;
@@ -1,4 +1,8 @@
1
- import { languageCodes, templateTypes } from '../../constants';
1
+ import {
2
+ languageCodes,
3
+ metaTemplateStatus,
4
+ templateTypes,
5
+ } from '../../constants';
2
6
  import { DatabaseObject } from '../baseObject';
3
7
  import { IListPayload } from '../payload';
4
8
 
@@ -6,8 +10,105 @@ export interface ITemplate extends DatabaseObject {
6
10
  type: templateTypes;
7
11
  name: string;
8
12
  message: string;
9
- languageCode: languageCodes;
13
+ languageCode: string;
10
14
  isActive: boolean;
15
+ category?: string | null;
16
+ component?: Record<string, unknown> | unknown[] | null;
17
+ rawResponse?: Record<string, unknown> | null;
18
+ metaApprovalStatus?: metaTemplateStatus | null;
19
+ wabaId?: string | null;
20
+ clientId?: number | null;
21
+ }
22
+
23
+ export interface IMetaWhatsappTemplateListParams {
24
+ clientUId?: string;
25
+ wabaId?: string;
26
+ page?: number;
27
+ size?: number;
28
+ q?: string;
29
+ }
30
+
31
+ export type IMetaWhatsappTemplateButtonType =
32
+ | 'QUICK_REPLY'
33
+ | 'URL'
34
+ | 'PHONE_NUMBER';
35
+
36
+ export interface IMetaWhatsappTemplateButton {
37
+ type: IMetaWhatsappTemplateButtonType;
38
+ text: string;
39
+ url?: string;
40
+ phone_number?: string;
41
+ }
42
+
43
+ /**
44
+ * Cleardu Meta WhatsApp integration POST body for template create
45
+ * (`BrokerMessages.INTEGRATION.MESSAGES.WHATSAPP.META.WHATSAPP.CREATE_TEMPLATE` → `payload.body`).
46
+ * Built in CRM; forwarded unchanged by integration-ms to the Meta adapter.
47
+ */
48
+ export interface IMetaWhatsappTemplateIntegrationBody {
49
+ wabaId: string;
50
+ template: {
51
+ name: string;
52
+ language: string;
53
+ category: string;
54
+ components: Record<string, unknown>[];
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Body of `BrokerMessages.CRM.WHATSAPP_META.TEMPLATE.CREATE` (`@Payload('body')`).
60
+ * Matches `CreateMetaWhatsappTemplateDto`; `user` is supplied separately on the message payload.
61
+ */
62
+ export interface IMetaWhatsappTemplateCreatePayload {
63
+ clientUId: string;
64
+ wabaId: string;
65
+ phoneNumberId?: string;
66
+ name: string;
67
+ message: string;
68
+ languageCode: languageCodes;
69
+ /** Required for Meta create unless `metaCreateBody` is supplied. */
70
+ category?: string;
71
+ headerText?: string;
72
+ footerText?: string;
73
+ buttons?: IMetaWhatsappTemplateButton[];
74
+ /** Meta `components` array when not sending a full `metaCreateBody`. */
75
+ component?: Record<string, unknown>[];
76
+ isActive?: boolean;
77
+ /** When set, forwarded as-is to integration instead of a derived Meta create shape. */
78
+ metaCreateBody?: Record<string, unknown>;
79
+ }
80
+
81
+ export interface IMetaWhatsappTemplateUpdatePayload {
82
+ clientUId: string;
83
+ userId: number;
84
+ id: number;
85
+ name?: string;
86
+ message?: string;
87
+ languageCode?: languageCodes;
88
+ category?: string;
89
+ component?: Record<string, unknown> | unknown[];
90
+ isActive?: boolean;
91
+ metaApprovalStatus?: metaTemplateStatus;
92
+ }
93
+
94
+ export interface IMetaWhatsappTemplateSyncPayload {
95
+ clientUId: string;
96
+ wabaId: string;
97
+ }
98
+
99
+ /** CRM broker payload: delete Meta WhatsApp template by CRM `templates.id` only. */
100
+ export interface IMetaWhatsappTemplateDeletePayload {
101
+ id: number;
102
+ }
103
+
104
+ /** Dropdown option for Meta WhatsApp template `{{parameter}}` placeholders. */
105
+ export interface IMetaWhatsappTemplateParameterField {
106
+ key: string;
107
+ source: 'borrower' | 'loan' | 'loan_participant' | 'loan_contact' | 'client';
108
+ }
109
+
110
+ export interface IMetaWhatsappTemplateParameterFieldsResult {
111
+ fields: IMetaWhatsappTemplateParameterField[];
11
112
  }
12
113
 
13
114
  export interface ISmartPingTemplate extends DatabaseObject {
@@ -19,4 +120,4 @@ export interface ISmartPingTemplate extends DatabaseObject {
19
120
  }
20
121
  export interface ITemplateFilterParams extends IListPayload {
21
122
  provider: string;
22
- }
123
+ }
@@ -2,6 +2,10 @@ import { WhereOptions } from 'sequelize';
2
2
  import { communicationType, whatsAppStatus } from '../../constants';
3
3
  import { DatabaseObject } from '../baseObject';
4
4
  import { IListPayload } from '../payload';
5
+ export interface IMetaWhatsAppWebhookResult {
6
+ status: boolean;
7
+ message?: string;
8
+ }
5
9
  export interface IWhatsAppMessages extends DatabaseObject {
6
10
  loanId: number;
7
11
  messageId?: string;
@@ -3,6 +3,11 @@ import { communicationType, whatsAppStatus } from '../../constants';
3
3
  import { DatabaseObject } from '../baseObject';
4
4
  import { IListPayload } from '../payload';
5
5
 
6
+ export interface IMetaWhatsAppWebhookResult {
7
+ status: boolean;
8
+ message?: string;
9
+ }
10
+
6
11
  export interface IWhatsAppMessages extends DatabaseObject {
7
12
  loanId: number;
8
13
  messageId?: string;
@@ -158,10 +163,10 @@ export interface CommunicationHistoryLoanWise extends IListPayload {
158
163
  }
159
164
 
160
165
  export interface CommunicationReport {
161
- title: string;
162
- ftd: string;
163
- mtd: string;
164
- paid?: string;
165
- unpaid?: string;
166
- partialyPaid?: string;
167
- }
166
+ title: string;
167
+ ftd: string;
168
+ mtd: string;
169
+ paid?: string;
170
+ unpaid?: string;
171
+ partialyPaid?: string;
172
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleardu/types",
3
- "version": "1.0.542",
3
+ "version": "1.0.544",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@aws)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",