n8n-nodes-sendzen 1.0.0

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.
Files changed (44) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +359 -0
  3. package/dist/credentials/SendZenApi.credentials.d.ts +8 -0
  4. package/dist/credentials/SendZenApi.credentials.js +36 -0
  5. package/dist/credentials/SendZenApi.credentials.js.map +1 -0
  6. package/dist/nodes/SendZen/SendZen.node.d.ts +14 -0
  7. package/dist/nodes/SendZen/SendZen.node.js +610 -0
  8. package/dist/nodes/SendZen/SendZen.node.js.map +1 -0
  9. package/dist/nodes/SendZen/SendZen.node.json +20 -0
  10. package/dist/nodes/SendZen/SendZenTrigger.node.d.ts +5 -0
  11. package/dist/nodes/SendZen/SendZenTrigger.node.js +49 -0
  12. package/dist/nodes/SendZen/SendZenTrigger.node.js.map +1 -0
  13. package/dist/nodes/SendZen/sendzen.svg +1 -0
  14. package/dist/package.json +76 -0
  15. package/dist/shared/constants.d.ts +1 -0
  16. package/dist/shared/constants.js +5 -0
  17. package/dist/shared/constants.js.map +1 -0
  18. package/dist/shared/nodeProperties.d.ts +10 -0
  19. package/dist/shared/nodeProperties.js +187 -0
  20. package/dist/shared/nodeProperties.js.map +1 -0
  21. package/dist/shared/template/template.api.types.d.ts +328 -0
  22. package/dist/shared/template/template.api.types.js +3 -0
  23. package/dist/shared/template/template.api.types.js.map +1 -0
  24. package/dist/shared/template/template.builder.d.ts +17 -0
  25. package/dist/shared/template/template.builder.js +200 -0
  26. package/dist/shared/template/template.builder.js.map +1 -0
  27. package/dist/shared/type.d.ts +38 -0
  28. package/dist/shared/type.js +3 -0
  29. package/dist/shared/type.js.map +1 -0
  30. package/dist/shared/utils.d.ts +2 -0
  31. package/dist/shared/utils.js +15 -0
  32. package/dist/shared/utils.js.map +1 -0
  33. package/index.js +10 -0
  34. package/jest.config.js +22 -0
  35. package/n8n-nodes-sendzen-1.0.0.tgz +0 -0
  36. package/nodes/SendZen/SendZen.node.json +20 -0
  37. package/nodes/SendZen/sendzen.svg +1 -0
  38. package/package.json +76 -0
  39. package/shared/constants.ts +1 -0
  40. package/shared/nodeProperties.ts +197 -0
  41. package/shared/template/template.api.types.ts +435 -0
  42. package/shared/template/template.builder.ts +223 -0
  43. package/shared/type.ts +40 -0
  44. package/shared/utils.ts +16 -0
@@ -0,0 +1,328 @@
1
+ export interface UrlButton {
2
+ type: 'URL';
3
+ text: string;
4
+ url: string;
5
+ example?: string[];
6
+ }
7
+ export interface PhoneNumberButton {
8
+ type: 'PHONE_NUMBER';
9
+ text: string;
10
+ phone_number: string;
11
+ }
12
+ export interface QuickReplyButton {
13
+ type: 'QUICK_REPLY';
14
+ text: string;
15
+ }
16
+ export interface CopyCodeButton {
17
+ type: 'COPY_CODE';
18
+ example: string;
19
+ }
20
+ export type TemplateButton = UrlButton | PhoneNumberButton | QuickReplyButton | CopyCodeButton;
21
+ export interface HeaderTextComponent {
22
+ type: 'HEADER';
23
+ format: 'TEXT';
24
+ text: string;
25
+ example?: {
26
+ header_text: string[];
27
+ };
28
+ }
29
+ export interface HeaderMediaComponent {
30
+ type: 'HEADER';
31
+ format: 'IMAGE' | 'VIDEO' | 'DOCUMENT';
32
+ example: {
33
+ header_handle: [string];
34
+ };
35
+ }
36
+ export interface HeaderLocationComponent {
37
+ type: 'HEADER';
38
+ format: 'LOCATION';
39
+ }
40
+ export interface HeaderProductComponent {
41
+ type: 'HEADER';
42
+ format: 'PRODUCT';
43
+ }
44
+ export type HeaderComponent = HeaderTextComponent | HeaderMediaComponent | HeaderLocationComponent | HeaderProductComponent;
45
+ export interface BodyComponent {
46
+ type: 'BODY';
47
+ text: string;
48
+ example?: {
49
+ body_text?: string[][];
50
+ body_text_named_params?: {
51
+ param_name: string;
52
+ example: string;
53
+ }[];
54
+ };
55
+ }
56
+ export interface FooterComponent {
57
+ type: 'FOOTER';
58
+ text: string;
59
+ }
60
+ export interface ButtonsComponent {
61
+ type: 'BUTTONS';
62
+ buttons: TemplateButton[];
63
+ }
64
+ export interface LimitedTimeOfferComponent {
65
+ type: 'LIMITED_TIME_OFFER';
66
+ limited_time_offer: {
67
+ text: string;
68
+ has_expiration?: boolean;
69
+ };
70
+ }
71
+ export type MediaCarouselButton = UrlButton | PhoneNumberButton | QuickReplyButton;
72
+ export interface MediaCarouselCard {
73
+ components: ({
74
+ type: 'HEADER';
75
+ format: 'IMAGE' | 'VIDEO';
76
+ example: {
77
+ header_handle: [string];
78
+ };
79
+ } | {
80
+ type: 'BUTTONS';
81
+ buttons: MediaCarouselButton[];
82
+ })[];
83
+ }
84
+ export interface SPMButton {
85
+ type: 'SPM';
86
+ text: string;
87
+ }
88
+ export type ProductCarouselButton = SPMButton | UrlButton;
89
+ export interface ProductCarouselCard {
90
+ components: (HeaderProductComponent | {
91
+ type: 'BUTTONS';
92
+ buttons: ProductCarouselButton[];
93
+ })[];
94
+ }
95
+ export interface CarouselComponent {
96
+ type: 'CAROUSEL';
97
+ cards: (MediaCarouselCard | ProductCarouselCard)[];
98
+ }
99
+ export type TemplateComponent = HeaderComponent | BodyComponent | FooterComponent | ButtonsComponent | LimitedTimeOfferComponent | CarouselComponent;
100
+ export interface CustomMarketingTemplate {
101
+ name: string;
102
+ language: string;
103
+ category: 'MARKETING';
104
+ parameter_format?: string;
105
+ components: TemplateComponent[];
106
+ }
107
+ export interface CatalogButton {
108
+ type: 'CATALOG';
109
+ text: string;
110
+ }
111
+ export type CatalogTemplateComponent = BodyComponent | FooterComponent | {
112
+ type: 'BUTTONS';
113
+ buttons: CatalogButton[];
114
+ };
115
+ export interface CatalogTemplate {
116
+ name: string;
117
+ language: string;
118
+ category: 'MARKETING';
119
+ components: CatalogTemplateComponent[];
120
+ }
121
+ export interface AuthBodyComponent {
122
+ type: 'BODY';
123
+ add_security_recommendation?: boolean;
124
+ }
125
+ export interface AuthFooterComponent {
126
+ type: 'FOOTER';
127
+ code_expiration_minutes?: number;
128
+ }
129
+ export interface AuthOneTapButton {
130
+ type: 'OTP';
131
+ otp_type: 'one_tap';
132
+ text?: string;
133
+ autofill_text?: string;
134
+ supported_apps: {
135
+ package_name: string;
136
+ signature_hash: string;
137
+ }[];
138
+ }
139
+ export interface AuthZeroTapButton {
140
+ type: 'OTP';
141
+ otp_type: 'zero_tap';
142
+ text?: string;
143
+ autofill_text?: string;
144
+ zero_tap_terms_accepted: boolean;
145
+ supported_apps: {
146
+ package_name: string;
147
+ signature_hash: string;
148
+ }[];
149
+ }
150
+ export interface AuthCopyCodeButton {
151
+ type: 'OTP';
152
+ otp_type: 'copy_code';
153
+ text?: string;
154
+ }
155
+ export type AuthOtpButton = AuthOneTapButton | AuthZeroTapButton | AuthCopyCodeButton;
156
+ export interface AuthButtonsComponent {
157
+ type: 'BUTTONS';
158
+ buttons: AuthOtpButton[];
159
+ }
160
+ export type AuthTemplateComponent = AuthBodyComponent | AuthFooterComponent | AuthButtonsComponent;
161
+ export interface AuthenticationTemplate {
162
+ name: string;
163
+ language: string;
164
+ category: 'AUTHENTICATION';
165
+ message_send_ttl_seconds?: number;
166
+ components: AuthTemplateComponent[];
167
+ }
168
+ export interface CallPermissionRequestComponent {
169
+ type: 'CALL_PERMISSION_REQUEST';
170
+ }
171
+ export type CallPermissionRequestTemplateComponent = BodyComponent | CallPermissionRequestComponent;
172
+ export interface CallPermissionRequestTemplate {
173
+ name: string;
174
+ language: string;
175
+ category: 'MARKETING' | 'UTILITY';
176
+ components: CallPermissionRequestTemplateComponent[];
177
+ }
178
+ export interface MPMButton {
179
+ type: 'MPM';
180
+ text: string;
181
+ }
182
+ export type MPMTemplateComponent = HeaderTextComponent | BodyComponent | FooterComponent | {
183
+ type: 'BUTTONS';
184
+ buttons: MPMButton[];
185
+ };
186
+ export interface MPMTemplate {
187
+ name: string;
188
+ language: string;
189
+ category: 'MARKETING';
190
+ components: MPMTemplateComponent[];
191
+ }
192
+ export type SPMTemplateComponent = HeaderProductComponent | BodyComponent | FooterComponent | {
193
+ type: 'BUTTONS';
194
+ buttons: SPMButton[];
195
+ };
196
+ export interface SPMTemplate {
197
+ name: string;
198
+ language: string;
199
+ category: 'MARKETING';
200
+ components: SPMTemplateComponent[];
201
+ }
202
+ export interface UtilityTemplate {
203
+ name: string;
204
+ language: string;
205
+ category: 'UTILITY';
206
+ parameter_format?: string;
207
+ components: TemplateComponent[];
208
+ }
209
+ export type CreateTemplatePayload = CustomMarketingTemplate | CatalogTemplate | AuthenticationTemplate | CallPermissionRequestTemplate | MPMTemplate | SPMTemplate | UtilityTemplate;
210
+ export interface CreateTemplateResponse {
211
+ id: string;
212
+ status: string;
213
+ category: string;
214
+ }
215
+ export interface Paging {
216
+ cursors: {
217
+ before: string;
218
+ after: string;
219
+ };
220
+ next?: string;
221
+ }
222
+ export interface ResponseUrlButton {
223
+ type: 'URL';
224
+ text: string;
225
+ url: string;
226
+ }
227
+ export interface ResponsePhoneNumberButton {
228
+ type: 'PHONE_NUMBER';
229
+ text: string;
230
+ phone_number: string;
231
+ }
232
+ export interface ResponseQuickReplyButton {
233
+ type: 'QUICK_REPLY';
234
+ text: string;
235
+ }
236
+ export interface ResponseFlowButton {
237
+ type: 'FLOW';
238
+ text: string;
239
+ flow_id: number;
240
+ flow_action: string;
241
+ navigate_screen: string;
242
+ }
243
+ export interface ResponseSPMButton {
244
+ type: 'SPM';
245
+ text: string;
246
+ }
247
+ export type ResponseButton = ResponseUrlButton | ResponsePhoneNumberButton | ResponseQuickReplyButton | ResponseFlowButton | ResponseSPMButton;
248
+ export interface ResponseHeaderTextComponent {
249
+ type: 'HEADER';
250
+ format: 'TEXT';
251
+ text: string;
252
+ example?: {
253
+ header_text: string[];
254
+ };
255
+ }
256
+ export interface ResponseHeaderMediaComponent {
257
+ type: 'HEADER';
258
+ format: 'IMAGE' | 'VIDEO' | 'DOCUMENT';
259
+ example: {
260
+ header_handle: string[];
261
+ };
262
+ }
263
+ export interface ResponseHeaderLocationComponent {
264
+ type: 'HEADER';
265
+ format: 'LOCATION';
266
+ }
267
+ export interface ResponseHeaderProductComponent {
268
+ type: 'HEADER';
269
+ format: 'PRODUCT';
270
+ }
271
+ export type ResponseHeaderComponent = ResponseHeaderTextComponent | ResponseHeaderMediaComponent | ResponseHeaderLocationComponent | ResponseHeaderProductComponent;
272
+ export interface ResponseBodyComponent {
273
+ type: 'BODY';
274
+ text: string;
275
+ add_security_recommendation?: boolean;
276
+ example?: {
277
+ body_text?: string[][];
278
+ body_text_named_params?: {
279
+ param_name: string;
280
+ example: string;
281
+ }[];
282
+ };
283
+ }
284
+ export interface ResponseFooterComponent {
285
+ type: 'FOOTER';
286
+ text: string;
287
+ code_expiration_minutes?: number;
288
+ }
289
+ export interface ResponseButtonsComponent {
290
+ type: 'BUTTONS';
291
+ buttons: ResponseButton[];
292
+ }
293
+ export interface ResponseCarouselCard {
294
+ components: (ResponseHeaderComponent | ResponseButtonsComponent)[];
295
+ }
296
+ export interface ResponseCarouselComponent {
297
+ type: 'CAROUSEL';
298
+ cards: ResponseCarouselCard[];
299
+ }
300
+ export type ResponseComponent = ResponseHeaderComponent | ResponseBodyComponent | ResponseFooterComponent | ResponseButtonsComponent | ResponseCarouselComponent;
301
+ export interface MessageTemplate {
302
+ id: string;
303
+ name: string;
304
+ components?: ResponseComponent[];
305
+ language: string;
306
+ status: "APPROVED" | "PENDING" | "REJECTED";
307
+ category: "UTILITY" | "MARKETING" | "AUTHENTICATION";
308
+ message_send_ttl_seconds?: number;
309
+ parameter_format?: "named" | "positional";
310
+ sub_category?: string;
311
+ }
312
+ export interface GetAllTemplatesResponse {
313
+ data: MessageTemplate[];
314
+ paging?: Paging;
315
+ }
316
+ export interface TemplatesResponse {
317
+ data?: {
318
+ data: MessageTemplate[];
319
+ };
320
+ paging?: {
321
+ cursors: {
322
+ before: string;
323
+ after: string;
324
+ };
325
+ next?: string;
326
+ };
327
+ message?: string;
328
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=template.api.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.api.types.js","sourceRoot":"","sources":["../../../shared/template/template.api.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { MessageTemplate } from './template.api.types';
2
+ export interface TemplatePayloadParams {
3
+ from: string;
4
+ to: string;
5
+ template: MessageTemplate;
6
+ variables: Record<string, string>;
7
+ }
8
+ export declare function buildTemplatePayload(params: TemplatePayloadParams): {
9
+ from: string;
10
+ to: string;
11
+ type: string;
12
+ template: {
13
+ name: string;
14
+ lang_code: string;
15
+ components: any[];
16
+ };
17
+ };
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTemplatePayload = buildTemplatePayload;
4
+ function buildTemplatePayload(params) {
5
+ const { template, variables, from, to } = params;
6
+ const templateComponents = [];
7
+ if (!template.components) {
8
+ return {
9
+ from,
10
+ to,
11
+ type: 'template',
12
+ template: {
13
+ name: template.name,
14
+ lang_code: template.language,
15
+ components: [],
16
+ },
17
+ };
18
+ }
19
+ const processComponent = (component, prefix = '') => {
20
+ switch (component.type) {
21
+ case 'HEADER': {
22
+ const header = component;
23
+ if (header.format === 'TEXT' && header.text) {
24
+ const tokens = header.text.match(/\{\{([^}]+)\}\}/g);
25
+ if (tokens && tokens.length > 0) {
26
+ const parameters = tokens.map((match) => {
27
+ const inner = match.replace(/[{}]/g, '');
28
+ const isNumber = /^\d+$/.test(inner);
29
+ const fieldId = `header_param_${inner}`;
30
+ const value = variables[fieldId] || match;
31
+ return {
32
+ type: 'text',
33
+ text: value,
34
+ ...(isNumber ? {} : { parameter_name: inner }),
35
+ };
36
+ });
37
+ templateComponents.push({
38
+ type: 'header',
39
+ parameters: parameters,
40
+ });
41
+ }
42
+ }
43
+ else if (header.format && ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(header.format)) {
44
+ const mediaType = header.format.toLowerCase();
45
+ const mediaUrl = variables['header_media_url'] || '';
46
+ if (mediaUrl) {
47
+ templateComponents.push({
48
+ type: 'header',
49
+ parameters: [
50
+ {
51
+ type: mediaType,
52
+ [mediaType]: {
53
+ link: mediaUrl,
54
+ },
55
+ },
56
+ ],
57
+ });
58
+ }
59
+ }
60
+ break;
61
+ }
62
+ case 'BODY': {
63
+ const body = component;
64
+ if (body.text) {
65
+ const tokens = body.text.match(/\{\{([^}]+)\}\}/g);
66
+ if (tokens && tokens.length > 0) {
67
+ const parameters = tokens.map((match) => {
68
+ const inner = match.replace(/[{}]/g, '');
69
+ const isNumber = /^\d+$/.test(inner);
70
+ const fieldId = `body_param_${inner}`;
71
+ const value = variables[fieldId] || match;
72
+ return {
73
+ type: 'text',
74
+ text: value,
75
+ ...(isNumber ? {} : { parameter_name: inner }),
76
+ };
77
+ });
78
+ templateComponents.push({
79
+ type: 'body',
80
+ parameters: parameters,
81
+ });
82
+ }
83
+ }
84
+ break;
85
+ }
86
+ case 'BUTTONS': {
87
+ const buttonsComp = component;
88
+ if (buttonsComp.buttons && buttonsComp.buttons.length > 0) {
89
+ buttonsComp.buttons.forEach((button, buttonIndex) => {
90
+ if (button.type === 'URL' && button.url) {
91
+ const urlToken = button.url.match(/\{\{([^}]+)\}\}/);
92
+ if (urlToken && urlToken[1]) {
93
+ const inner = urlToken[1];
94
+ const isNumber = /^\d+$/.test(inner);
95
+ const fieldId = `button_${buttonIndex}_param_${inner}`;
96
+ const value = variables[fieldId] || '123456';
97
+ templateComponents.push({
98
+ type: 'button',
99
+ sub_type: 'url',
100
+ index: buttonIndex,
101
+ parameters: [
102
+ {
103
+ type: 'text',
104
+ text: value,
105
+ ...(isNumber ? {} : { parameter_name: inner }),
106
+ },
107
+ ],
108
+ });
109
+ }
110
+ }
111
+ else if (button.type === 'COPY_CODE') {
112
+ const searchableText = button.text || button.url || '';
113
+ const codeToken = searchableText.match(/\{\{([^}]+)\}\}/);
114
+ if (codeToken && codeToken[1]) {
115
+ const inner = codeToken[1];
116
+ const isNumber = /^\d+$/.test(inner);
117
+ const fieldId = `button_${buttonIndex}_param_${inner}`;
118
+ const value = variables[fieldId] || '123456';
119
+ templateComponents.push({
120
+ type: 'button',
121
+ sub_type: 'copy_code',
122
+ index: buttonIndex,
123
+ parameters: [
124
+ {
125
+ type: 'text',
126
+ text: value,
127
+ ...(isNumber ? {} : { parameter_name: inner }),
128
+ },
129
+ ],
130
+ });
131
+ }
132
+ }
133
+ else if (button.type === 'FLOW') {
134
+ const flowButton = button;
135
+ const flowAction = {};
136
+ const flowToken = variables[`button_${buttonIndex}_flow_token`];
137
+ flowAction.flow_token = flowToken || 'unused';
138
+ const customFlowActionData = variables[`button_${buttonIndex}_flow_action_data`];
139
+ if (customFlowActionData) {
140
+ try {
141
+ flowAction.flow_action_data =
142
+ typeof customFlowActionData === 'string'
143
+ ? JSON.parse(customFlowActionData)
144
+ : customFlowActionData;
145
+ }
146
+ catch (e) {
147
+ flowAction.flow_action_data = {};
148
+ }
149
+ }
150
+ else if (flowButton.flow_id || flowButton.flow_action || flowButton.navigate_screen) {
151
+ flowAction.flow_action_data = {};
152
+ if (flowButton.flow_id)
153
+ flowAction.flow_action_data.flow_id = flowButton.flow_id;
154
+ if (flowButton.flow_action)
155
+ flowAction.flow_action_data.flow_action = flowButton.flow_action;
156
+ if (flowButton.navigate_screen)
157
+ flowAction.flow_action_data.navigate_screen = flowButton.navigate_screen;
158
+ }
159
+ templateComponents.push({
160
+ type: 'button',
161
+ sub_type: 'flow',
162
+ index: buttonIndex,
163
+ parameters: [
164
+ {
165
+ type: 'action',
166
+ action: flowAction,
167
+ },
168
+ ],
169
+ });
170
+ }
171
+ });
172
+ }
173
+ break;
174
+ }
175
+ case 'CAROUSEL': {
176
+ const carousel = component;
177
+ if (carousel.cards) {
178
+ carousel.cards.forEach((card, i) => {
179
+ card.components.forEach((cardComp) => {
180
+ processComponent(cardComp, `card_${i + 1}_`);
181
+ });
182
+ });
183
+ }
184
+ break;
185
+ }
186
+ }
187
+ };
188
+ template.components.forEach((comp) => processComponent(comp));
189
+ return {
190
+ from,
191
+ to,
192
+ type: 'template',
193
+ template: {
194
+ name: template.name,
195
+ lang_code: template.language,
196
+ components: templateComponents,
197
+ },
198
+ };
199
+ }
200
+ //# sourceMappingURL=template.builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.builder.js","sourceRoot":"","sources":["../../../shared/template/template.builder.ts"],"names":[],"mappings":";;AAaA,oDAiNC;AAjND,SAAgB,oBAAoB,CAAC,MAA6B;IACjE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACjD,MAAM,kBAAkB,GAAU,EAAE,CAAC;IAErC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC1B,OAAO;YACN,IAAI;YACJ,EAAE;YACF,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACT,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,SAAS,EAAE,QAAQ,CAAC,QAAQ;gBAC5B,UAAU,EAAE,EAAE;aACd;SACD,CAAC;IACH,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,SAAc,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE;QACxD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACf,MAAM,MAAM,GAAG,SAAoC,CAAC;gBACpD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;oBACrD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;4BACvC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE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9B;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ export interface WABAResponseList {
2
+ message: string;
3
+ data: {
4
+ projects: {
5
+ id: number;
6
+ project_name: string;
7
+ client_identifier: string;
8
+ wabas: {
9
+ id: number;
10
+ waba_id: string;
11
+ waba_business_name: string;
12
+ phone_number_id: string;
13
+ phone_number: string;
14
+ number_status: string;
15
+ setup_mode: string;
16
+ mm_lite_api_status: string;
17
+ phone_number_type: string;
18
+ waba_onboard_stage: string;
19
+ }[];
20
+ }[];
21
+ };
22
+ }
23
+ export interface SendTextMessageRequest {
24
+ from: string;
25
+ to: string;
26
+ type: 'text';
27
+ text: {
28
+ body: string;
29
+ preview_url?: boolean;
30
+ };
31
+ }
32
+ export type SendzenAPIErroResponse = {
33
+ message: string;
34
+ error: {
35
+ code: string;
36
+ details: string;
37
+ };
38
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../shared/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { SendzenAPIErroResponse } from "./type";
2
+ export declare function isSendzenAPIErroResponse(value: unknown): value is SendzenAPIErroResponse;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSendzenAPIErroResponse = isSendzenAPIErroResponse;
4
+ function isSendzenAPIErroResponse(value) {
5
+ var _a, _b;
6
+ return (typeof value === 'object' &&
7
+ value !== null &&
8
+ 'message' in value &&
9
+ typeof value.message === 'string' &&
10
+ 'error' in value &&
11
+ typeof value.error === 'object' &&
12
+ typeof ((_a = value.error) === null || _a === void 0 ? void 0 : _a.code) === 'string' &&
13
+ typeof ((_b = value.error) === null || _b === void 0 ? void 0 : _b.details) === 'string');
14
+ }
15
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../shared/utils.ts"],"names":[],"mappings":";;AAEA,4DAaG;AAbH,SAAgB,wBAAwB,CACpC,KAAc;;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QAClB,OAAQ,KAAa,CAAC,OAAO,KAAK,QAAQ;QAC1C,OAAO,IAAI,KAAK;QAChB,OAAQ,KAAa,CAAC,KAAK,KAAK,QAAQ;QACxC,OAAO,CAAA,MAAC,KAAa,CAAC,KAAK,0CAAE,IAAI,CAAA,KAAK,QAAQ;QAC9C,OAAO,CAAA,MAAC,KAAa,CAAC,KAAK,0CAAE,OAAO,CAAA,KAAK,QAAQ,CAClD,CAAC;AACJ,CAAC"}
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ const { SendZen } = require('./dist/nodes/SendZen/SendZen.node');
2
+ const { SendZenTrigger } = require('./dist/nodes/SendZen/SendZenTrigger.node');
3
+
4
+ module.exports = {
5
+ nodes: [
6
+ SendZen,
7
+ SendZenTrigger,
8
+ ],
9
+ };
10
+
package/jest.config.js ADDED
@@ -0,0 +1,22 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ testMatch: ['**/tests/**/*.test.ts'],
5
+ collectCoverage: false,
6
+ transform: {
7
+ '^.+\\.tsx?$': ['ts-jest', {
8
+ tsconfig: 'tsconfig.json',
9
+ }],
10
+ },
11
+ moduleFileExtensions: ['ts', 'js', 'json'],
12
+ setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
13
+ testPathIgnorePatterns: [
14
+ '/node_modules/',
15
+ '/dist/',
16
+ ],
17
+ globals: {
18
+ 'ts-jest': {
19
+ isolatedModules: true,
20
+ },
21
+ },
22
+ };
Binary file