@integry/sdk 3.3.2-beta.4 → 3.3.2-beta.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.
- package/LICENSE +12 -12
- package/README.md +21 -21
- package/README_INTERNAL.md +176 -176
- package/dist/esm/index.csm.d.ts +465 -464
- package/dist/esm/index.csm.js +4 -4
- package/dist/umd/index.umd.d.ts +455 -454
- package/dist/umd/index.umd.js +4 -4
- package/package.json +104 -104
package/dist/umd/index.umd.d.ts
CHANGED
|
@@ -1,454 +1,455 @@
|
|
|
1
|
-
import { VNode } from "preact";
|
|
2
|
-
type IntegrySDKEventType = "authorizations" | "did-add-authorization" | "did-begin-remove-authorization" | "did-change-step" | "did-fail-authorization-verification" | "did-load-flow" | "did-load-flows" | "did-load-integration" | "did-load-integrations" | "did-load-preview" | "did-remove-authorization" | "did-save-integration" | "did-delete-integration" | "did-select-authorization" | "ready" | "should-load-flow" | "did-click-close-button";
|
|
3
|
-
type IntegrySDKEventPayloads = {
|
|
4
|
-
ready: {
|
|
5
|
-
deploymentId: number;
|
|
6
|
-
};
|
|
7
|
-
"should-load-flow": {
|
|
8
|
-
templateId: number;
|
|
9
|
-
flowId: number;
|
|
10
|
-
};
|
|
11
|
-
"did-load-flows": {
|
|
12
|
-
flows: any[];
|
|
13
|
-
};
|
|
14
|
-
"did-load-integrations": {
|
|
15
|
-
integrations: any[];
|
|
16
|
-
};
|
|
17
|
-
"did-load-flow": {
|
|
18
|
-
flowId: number;
|
|
19
|
-
flowTitle: string;
|
|
20
|
-
flowDescription: string;
|
|
21
|
-
templateId: number;
|
|
22
|
-
templateTitle: string;
|
|
23
|
-
templateDescription: string;
|
|
24
|
-
mode: "EDIT" | "CREATE";
|
|
25
|
-
};
|
|
26
|
-
"did-load-integration": {
|
|
27
|
-
flowId: number;
|
|
28
|
-
integrationId: number;
|
|
29
|
-
};
|
|
30
|
-
"did-delete-integration": {
|
|
31
|
-
flowId: number;
|
|
32
|
-
flowName: string;
|
|
33
|
-
flowDescription: string;
|
|
34
|
-
integrationId: number;
|
|
35
|
-
integrationName: string;
|
|
36
|
-
};
|
|
37
|
-
"did-save-integration": {
|
|
38
|
-
integrationId: number;
|
|
39
|
-
name: string;
|
|
40
|
-
templateId: number;
|
|
41
|
-
flowId: number;
|
|
42
|
-
status: string;
|
|
43
|
-
callbackUrl: string | null;
|
|
44
|
-
callbackUrlArray: {
|
|
45
|
-
templateStepId: number;
|
|
46
|
-
activityId: number;
|
|
47
|
-
callbackUrl: string | null;
|
|
48
|
-
}[];
|
|
49
|
-
authorizations: {
|
|
50
|
-
authorizationId: number;
|
|
51
|
-
userIdentity: string;
|
|
52
|
-
isBrandingAppAuth: boolean;
|
|
53
|
-
}[];
|
|
54
|
-
event: "EDIT" | "CREATE";
|
|
55
|
-
};
|
|
56
|
-
"did-load-preview": {
|
|
57
|
-
flowId: number;
|
|
58
|
-
flowTitle: string;
|
|
59
|
-
flowDescription: string;
|
|
60
|
-
};
|
|
61
|
-
"did-change-step": {
|
|
62
|
-
stepId: number;
|
|
63
|
-
stepType: "AUTH" | "CONFIGURATION" | "SECTION" | "CONFIRMATION";
|
|
64
|
-
};
|
|
65
|
-
"did-add-authorization": {
|
|
66
|
-
identity: string;
|
|
67
|
-
authorizationId: number;
|
|
68
|
-
flowId: number | null;
|
|
69
|
-
appIcon: string;
|
|
70
|
-
alreadyExists: boolean;
|
|
71
|
-
externalId?: string;
|
|
72
|
-
};
|
|
73
|
-
"did-select-authorization": {
|
|
74
|
-
authorizationId: number;
|
|
75
|
-
};
|
|
76
|
-
"did-remove-authorization": {
|
|
77
|
-
authorizationId: number;
|
|
78
|
-
appId?: number | null;
|
|
79
|
-
};
|
|
80
|
-
"did-begin-remove-authorization": {
|
|
81
|
-
authorizationId: number;
|
|
82
|
-
};
|
|
83
|
-
"did-click-close-button": {
|
|
84
|
-
isCloseClicked: boolean;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
type EventCallback<P extends IntegrySDKEventType> = (
|
|
88
|
-
// @ts-expect-error P can index IntegrySDKEventPayloads
|
|
89
|
-
payload: IntegrySDKEventPayloads[P]) => void;
|
|
90
|
-
type IntegrySDKEvents = {
|
|
91
|
-
authorizations: EventCallback<"authorizations">;
|
|
92
|
-
"did-add-authorization": EventCallback<"did-add-authorization">;
|
|
93
|
-
"did-begin-remove-authorization": EventCallback<"did-begin-remove-authorization">;
|
|
94
|
-
"did-change-step": EventCallback<"did-change-step">;
|
|
95
|
-
"did-fail-authorization-verification": EventCallback<"did-fail-authorization-verification">;
|
|
96
|
-
"did-load-flow": EventCallback<"did-load-flow">;
|
|
97
|
-
"did-load-flows": EventCallback<"did-load-flows">;
|
|
98
|
-
"did-load-integration": EventCallback<"did-load-integration">;
|
|
99
|
-
"did-delete-integration": EventCallback<"did-delete-integration">;
|
|
100
|
-
"did-load-integrations": EventCallback<"did-load-integrations">;
|
|
101
|
-
"did-load-preview": EventCallback<"did-load-preview">;
|
|
102
|
-
"did-remove-authorization": EventCallback<"did-remove-authorization">;
|
|
103
|
-
"did-save-integration": EventCallback<"did-save-integration">;
|
|
104
|
-
"did-select-authorization": EventCallback<"did-select-authorization">;
|
|
105
|
-
ready: EventCallback<"ready">;
|
|
106
|
-
"should-load-flow": EventCallback<"should-load-flow">;
|
|
107
|
-
"did-click-close-button": EventCallback<"did-click-close-button">;
|
|
108
|
-
};
|
|
109
|
-
declare enum TemplateFormRenderModes {
|
|
110
|
-
MODAL = "MODAL",
|
|
111
|
-
INLINE = "INLINE",
|
|
112
|
-
DETACHED = "DETACHED",
|
|
113
|
-
CUSTOM = "CUSTOM"
|
|
114
|
-
}
|
|
115
|
-
declare enum MarketplaceRenderModes {
|
|
116
|
-
MODAL = "MODAL",
|
|
117
|
-
INLINE = "INLINE"
|
|
118
|
-
}
|
|
119
|
-
declare enum TemplateListingRenderModes {
|
|
120
|
-
GRID = "GRID",
|
|
121
|
-
LIST = "LIST"
|
|
122
|
-
}
|
|
123
|
-
type Authorization = {
|
|
124
|
-
id: number;
|
|
125
|
-
authorization_type: string;
|
|
126
|
-
app_user?: number;
|
|
127
|
-
app_user_id?: number;
|
|
128
|
-
disable_link?: string;
|
|
129
|
-
integration_count?: number;
|
|
130
|
-
user_identity: string;
|
|
131
|
-
};
|
|
132
|
-
type FlowCardProps = {
|
|
133
|
-
id: number | string;
|
|
134
|
-
imgUrl: string;
|
|
135
|
-
name: string;
|
|
136
|
-
description: string;
|
|
137
|
-
tags: string;
|
|
138
|
-
layout: TemplateListingRenderModes;
|
|
139
|
-
handleClick: () => void;
|
|
140
|
-
apiHandler?: any;
|
|
141
|
-
app?: {
|
|
142
|
-
id: number;
|
|
143
|
-
};
|
|
144
|
-
onEdit?: (instance: Instance) => void;
|
|
145
|
-
onDelete?: (instance: Instance) => void;
|
|
146
|
-
onEditName?: ({ instance, newName }: {
|
|
147
|
-
instance: Instance;
|
|
148
|
-
newName: string;
|
|
149
|
-
}) => void;
|
|
150
|
-
dFlag?: string;
|
|
151
|
-
};
|
|
152
|
-
interface UserConfig {
|
|
153
|
-
availableFlowsLabel?: string;
|
|
154
|
-
myFlowsLabel?: string;
|
|
155
|
-
hideWebhookUrlScreen?: boolean;
|
|
156
|
-
hideAppConnectionModal?: boolean;
|
|
157
|
-
customComponents?: {
|
|
158
|
-
flowCard?: (props: FlowCardProps) => VNode;
|
|
159
|
-
};
|
|
160
|
-
autoRedirectToMyFlows?: boolean;
|
|
161
|
-
isReadOnly?: boolean;
|
|
162
|
-
marketplaceModalTitle?: string;
|
|
163
|
-
buttonLabelToSaveIntegration?: string;
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
165
|
-
[other: string]: any;
|
|
166
|
-
}
|
|
167
|
-
interface SDKConfig {
|
|
168
|
-
env?: "staging" | "production";
|
|
169
|
-
baseUrl?: string;
|
|
170
|
-
debug?: boolean;
|
|
171
|
-
integrationId?: number;
|
|
172
|
-
xIntegryConfig?: {
|
|
173
|
-
isAnonymous?: boolean;
|
|
174
|
-
appAuth?: {
|
|
175
|
-
apiKey?: string;
|
|
176
|
-
authId?: string;
|
|
177
|
-
extras?: Record<string, string | number>;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
userConfig?: UserConfig;
|
|
181
|
-
}
|
|
182
|
-
interface ConfigWithObject extends SDKConfig {
|
|
183
|
-
appKey: string;
|
|
184
|
-
hash: string;
|
|
185
|
-
userId: string;
|
|
186
|
-
deploymentId: string;
|
|
187
|
-
marketplaceId?: string;
|
|
188
|
-
appId?: number;
|
|
189
|
-
showApps?: boolean;
|
|
190
|
-
showTemplates?: boolean;
|
|
191
|
-
}
|
|
192
|
-
interface ConfigWithUrlParams extends SDKConfig {
|
|
193
|
-
useUrlParams?: boolean;
|
|
194
|
-
}
|
|
195
|
-
type App = {
|
|
196
|
-
id: number;
|
|
197
|
-
name: string;
|
|
198
|
-
description: string;
|
|
199
|
-
icon_url: string;
|
|
200
|
-
color: string;
|
|
201
|
-
publishing_status: string;
|
|
202
|
-
category: string[];
|
|
203
|
-
app_type?: string;
|
|
204
|
-
action_url?: string | null;
|
|
205
|
-
created_at?: Date;
|
|
206
|
-
tags: string;
|
|
207
|
-
};
|
|
208
|
-
type Activity = {
|
|
209
|
-
id: number;
|
|
210
|
-
name: string;
|
|
211
|
-
type: string;
|
|
212
|
-
endpoint: string;
|
|
213
|
-
auth_required: boolean;
|
|
214
|
-
total_fields: number;
|
|
215
|
-
app: App;
|
|
216
|
-
activity_output: string | null;
|
|
217
|
-
activity_output_url: string | null;
|
|
218
|
-
dynamic_field_data_endpoint: string | null;
|
|
219
|
-
};
|
|
220
|
-
type AuthorizationType = {
|
|
221
|
-
id: number;
|
|
222
|
-
type: string;
|
|
223
|
-
authorizations: Authorization[];
|
|
224
|
-
provider: string;
|
|
225
|
-
is_sandbox_enabled: boolean;
|
|
226
|
-
is_userinfo_required?: boolean;
|
|
227
|
-
authorization_url_sandbox: string;
|
|
228
|
-
app: {
|
|
229
|
-
icon_url: string;
|
|
230
|
-
id: number;
|
|
231
|
-
name: string;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
interface TemplateField {
|
|
235
|
-
id: number;
|
|
236
|
-
is_required: boolean;
|
|
237
|
-
is_hidden: boolean;
|
|
238
|
-
default_value: string | null;
|
|
239
|
-
weight: number;
|
|
240
|
-
description: string;
|
|
241
|
-
summary: string | null;
|
|
242
|
-
activity_field: {
|
|
243
|
-
id: number;
|
|
244
|
-
machine_name: string;
|
|
245
|
-
type: string;
|
|
246
|
-
title: string;
|
|
247
|
-
description: string;
|
|
248
|
-
weight: number;
|
|
249
|
-
is_required: boolean;
|
|
250
|
-
child_fields: string | null;
|
|
251
|
-
placeholder: string | null;
|
|
252
|
-
is_dynamic: boolean;
|
|
253
|
-
data_src: string | null;
|
|
254
|
-
data_src_endpoint: number | null;
|
|
255
|
-
parent_fields: string | null;
|
|
256
|
-
dynamic_field_src: string | null;
|
|
257
|
-
default_value: string | null;
|
|
258
|
-
auto_machine_name: string;
|
|
259
|
-
dynamic_field_src_endpoint: number | null;
|
|
260
|
-
regex: string | null;
|
|
261
|
-
regex_error_message?: string | null;
|
|
262
|
-
is_searchable: boolean;
|
|
263
|
-
conditional_fields?: string | null;
|
|
264
|
-
} | null;
|
|
265
|
-
title: string | null;
|
|
266
|
-
type: string;
|
|
267
|
-
placeholder: string | null;
|
|
268
|
-
// manual_template: unknown | null;
|
|
269
|
-
child_field: string | null;
|
|
270
|
-
child_field_value: string | null;
|
|
271
|
-
// template_fields: unknown[];
|
|
272
|
-
button_text: string | null;
|
|
273
|
-
// field_actions: unknown[];
|
|
274
|
-
icon_url: string | null;
|
|
275
|
-
long_description: string | null;
|
|
276
|
-
regex: string | null;
|
|
277
|
-
regex_msg: string | null;
|
|
278
|
-
is_visible: boolean;
|
|
279
|
-
app_user_data?: {
|
|
280
|
-
app_user: number;
|
|
281
|
-
id: number;
|
|
282
|
-
value: string | number;
|
|
283
|
-
is_changed: boolean;
|
|
284
|
-
changed_dynamic_fields: string;
|
|
285
|
-
}[];
|
|
286
|
-
added_in_mapping?: boolean;
|
|
287
|
-
field_mapping_source?: string;
|
|
288
|
-
}
|
|
289
|
-
interface TemplateStep {
|
|
290
|
-
id: number;
|
|
291
|
-
weight: number;
|
|
292
|
-
title: string;
|
|
293
|
-
is_visible: boolean;
|
|
294
|
-
activity: Activity;
|
|
295
|
-
authorization_type: AuthorizationType;
|
|
296
|
-
template_fields: TemplateField[];
|
|
297
|
-
step_instance?: number | null;
|
|
298
|
-
allow_multiple_authorizations: boolean;
|
|
299
|
-
step_authorization: number | null;
|
|
300
|
-
button_text: string | null;
|
|
301
|
-
is_self_step: boolean;
|
|
302
|
-
summary: string | null;
|
|
303
|
-
is_workspace_app_step: boolean;
|
|
304
|
-
auth_description: string | null;
|
|
305
|
-
hide_authorization: boolean;
|
|
306
|
-
// step_condition: unknown | null;
|
|
307
|
-
machine_name: string | null;
|
|
308
|
-
is_custom_machine_name: boolean;
|
|
309
|
-
}
|
|
310
|
-
interface InitConfig {
|
|
311
|
-
containerId: string;
|
|
312
|
-
templateContainerId?: string;
|
|
313
|
-
renderMode: TemplateFormRenderModes;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
interface
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
private
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
static
|
|
385
|
-
static
|
|
386
|
-
static
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
private
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
*
|
|
395
|
-
* @
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
private
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
*
|
|
406
|
-
* @param
|
|
407
|
-
* @
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
*
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
*
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
*
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
*
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
1
|
+
import { VNode } from "preact";
|
|
2
|
+
type IntegrySDKEventType = "authorizations" | "did-add-authorization" | "did-begin-remove-authorization" | "did-change-step" | "did-fail-authorization-verification" | "did-load-flow" | "did-load-flows" | "did-load-integration" | "did-load-integrations" | "did-load-preview" | "did-remove-authorization" | "did-save-integration" | "did-delete-integration" | "did-select-authorization" | "ready" | "should-load-flow" | "did-click-close-button";
|
|
3
|
+
type IntegrySDKEventPayloads = {
|
|
4
|
+
ready: {
|
|
5
|
+
deploymentId: number;
|
|
6
|
+
};
|
|
7
|
+
"should-load-flow": {
|
|
8
|
+
templateId: number;
|
|
9
|
+
flowId: number;
|
|
10
|
+
};
|
|
11
|
+
"did-load-flows": {
|
|
12
|
+
flows: any[];
|
|
13
|
+
};
|
|
14
|
+
"did-load-integrations": {
|
|
15
|
+
integrations: any[];
|
|
16
|
+
};
|
|
17
|
+
"did-load-flow": {
|
|
18
|
+
flowId: number;
|
|
19
|
+
flowTitle: string;
|
|
20
|
+
flowDescription: string;
|
|
21
|
+
templateId: number;
|
|
22
|
+
templateTitle: string;
|
|
23
|
+
templateDescription: string;
|
|
24
|
+
mode: "EDIT" | "CREATE";
|
|
25
|
+
};
|
|
26
|
+
"did-load-integration": {
|
|
27
|
+
flowId: number;
|
|
28
|
+
integrationId: number;
|
|
29
|
+
};
|
|
30
|
+
"did-delete-integration": {
|
|
31
|
+
flowId: number;
|
|
32
|
+
flowName: string;
|
|
33
|
+
flowDescription: string;
|
|
34
|
+
integrationId: number;
|
|
35
|
+
integrationName: string;
|
|
36
|
+
};
|
|
37
|
+
"did-save-integration": {
|
|
38
|
+
integrationId: number;
|
|
39
|
+
name: string;
|
|
40
|
+
templateId: number;
|
|
41
|
+
flowId: number;
|
|
42
|
+
status: string;
|
|
43
|
+
callbackUrl: string | null;
|
|
44
|
+
callbackUrlArray: {
|
|
45
|
+
templateStepId: number;
|
|
46
|
+
activityId: number;
|
|
47
|
+
callbackUrl: string | null;
|
|
48
|
+
}[];
|
|
49
|
+
authorizations: {
|
|
50
|
+
authorizationId: number;
|
|
51
|
+
userIdentity: string;
|
|
52
|
+
isBrandingAppAuth: boolean;
|
|
53
|
+
}[];
|
|
54
|
+
event: "EDIT" | "CREATE";
|
|
55
|
+
};
|
|
56
|
+
"did-load-preview": {
|
|
57
|
+
flowId: number;
|
|
58
|
+
flowTitle: string;
|
|
59
|
+
flowDescription: string;
|
|
60
|
+
};
|
|
61
|
+
"did-change-step": {
|
|
62
|
+
stepId: number;
|
|
63
|
+
stepType: "AUTH" | "CONFIGURATION" | "SECTION" | "CONFIRMATION";
|
|
64
|
+
};
|
|
65
|
+
"did-add-authorization": {
|
|
66
|
+
identity: string;
|
|
67
|
+
authorizationId: number;
|
|
68
|
+
flowId: number | null;
|
|
69
|
+
appIcon: string;
|
|
70
|
+
alreadyExists: boolean;
|
|
71
|
+
externalId?: string;
|
|
72
|
+
};
|
|
73
|
+
"did-select-authorization": {
|
|
74
|
+
authorizationId: number;
|
|
75
|
+
};
|
|
76
|
+
"did-remove-authorization": {
|
|
77
|
+
authorizationId: number;
|
|
78
|
+
appId?: number | null;
|
|
79
|
+
};
|
|
80
|
+
"did-begin-remove-authorization": {
|
|
81
|
+
authorizationId: number;
|
|
82
|
+
};
|
|
83
|
+
"did-click-close-button": {
|
|
84
|
+
isCloseClicked: boolean;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
type EventCallback<P extends IntegrySDKEventType> = (
|
|
88
|
+
// @ts-expect-error P can index IntegrySDKEventPayloads
|
|
89
|
+
payload: IntegrySDKEventPayloads[P]) => void;
|
|
90
|
+
type IntegrySDKEvents = {
|
|
91
|
+
authorizations: EventCallback<"authorizations">;
|
|
92
|
+
"did-add-authorization": EventCallback<"did-add-authorization">;
|
|
93
|
+
"did-begin-remove-authorization": EventCallback<"did-begin-remove-authorization">;
|
|
94
|
+
"did-change-step": EventCallback<"did-change-step">;
|
|
95
|
+
"did-fail-authorization-verification": EventCallback<"did-fail-authorization-verification">;
|
|
96
|
+
"did-load-flow": EventCallback<"did-load-flow">;
|
|
97
|
+
"did-load-flows": EventCallback<"did-load-flows">;
|
|
98
|
+
"did-load-integration": EventCallback<"did-load-integration">;
|
|
99
|
+
"did-delete-integration": EventCallback<"did-delete-integration">;
|
|
100
|
+
"did-load-integrations": EventCallback<"did-load-integrations">;
|
|
101
|
+
"did-load-preview": EventCallback<"did-load-preview">;
|
|
102
|
+
"did-remove-authorization": EventCallback<"did-remove-authorization">;
|
|
103
|
+
"did-save-integration": EventCallback<"did-save-integration">;
|
|
104
|
+
"did-select-authorization": EventCallback<"did-select-authorization">;
|
|
105
|
+
ready: EventCallback<"ready">;
|
|
106
|
+
"should-load-flow": EventCallback<"should-load-flow">;
|
|
107
|
+
"did-click-close-button": EventCallback<"did-click-close-button">;
|
|
108
|
+
};
|
|
109
|
+
declare enum TemplateFormRenderModes {
|
|
110
|
+
MODAL = "MODAL",
|
|
111
|
+
INLINE = "INLINE",
|
|
112
|
+
DETACHED = "DETACHED",
|
|
113
|
+
CUSTOM = "CUSTOM"
|
|
114
|
+
}
|
|
115
|
+
declare enum MarketplaceRenderModes {
|
|
116
|
+
MODAL = "MODAL",
|
|
117
|
+
INLINE = "INLINE"
|
|
118
|
+
}
|
|
119
|
+
declare enum TemplateListingRenderModes {
|
|
120
|
+
GRID = "GRID",
|
|
121
|
+
LIST = "LIST"
|
|
122
|
+
}
|
|
123
|
+
type Authorization = {
|
|
124
|
+
id: number;
|
|
125
|
+
authorization_type: string;
|
|
126
|
+
app_user?: number;
|
|
127
|
+
app_user_id?: number;
|
|
128
|
+
disable_link?: string;
|
|
129
|
+
integration_count?: number;
|
|
130
|
+
user_identity: string;
|
|
131
|
+
};
|
|
132
|
+
type FlowCardProps = {
|
|
133
|
+
id: number | string;
|
|
134
|
+
imgUrl: string;
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
tags: string;
|
|
138
|
+
layout: TemplateListingRenderModes;
|
|
139
|
+
handleClick: () => void;
|
|
140
|
+
apiHandler?: any;
|
|
141
|
+
app?: {
|
|
142
|
+
id: number;
|
|
143
|
+
};
|
|
144
|
+
onEdit?: (instance: Instance) => void;
|
|
145
|
+
onDelete?: (instance: Instance) => void;
|
|
146
|
+
onEditName?: ({ instance, newName }: {
|
|
147
|
+
instance: Instance;
|
|
148
|
+
newName: string;
|
|
149
|
+
}) => void;
|
|
150
|
+
dFlag?: string;
|
|
151
|
+
};
|
|
152
|
+
interface UserConfig {
|
|
153
|
+
availableFlowsLabel?: string;
|
|
154
|
+
myFlowsLabel?: string;
|
|
155
|
+
hideWebhookUrlScreen?: boolean;
|
|
156
|
+
hideAppConnectionModal?: boolean;
|
|
157
|
+
customComponents?: {
|
|
158
|
+
flowCard?: (props: FlowCardProps) => VNode;
|
|
159
|
+
};
|
|
160
|
+
autoRedirectToMyFlows?: boolean;
|
|
161
|
+
isReadOnly?: boolean;
|
|
162
|
+
marketplaceModalTitle?: string;
|
|
163
|
+
buttonLabelToSaveIntegration?: string;
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
165
|
+
[other: string]: any;
|
|
166
|
+
}
|
|
167
|
+
interface SDKConfig {
|
|
168
|
+
env?: "staging" | "production";
|
|
169
|
+
baseUrl?: string;
|
|
170
|
+
debug?: boolean;
|
|
171
|
+
integrationId?: number;
|
|
172
|
+
xIntegryConfig?: {
|
|
173
|
+
isAnonymous?: boolean;
|
|
174
|
+
appAuth?: {
|
|
175
|
+
apiKey?: string;
|
|
176
|
+
authId?: string;
|
|
177
|
+
extras?: Record<string, string | number>;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
userConfig?: UserConfig;
|
|
181
|
+
}
|
|
182
|
+
interface ConfigWithObject extends SDKConfig {
|
|
183
|
+
appKey: string;
|
|
184
|
+
hash: string;
|
|
185
|
+
userId: string;
|
|
186
|
+
deploymentId: string;
|
|
187
|
+
marketplaceId?: string;
|
|
188
|
+
appId?: number;
|
|
189
|
+
showApps?: boolean;
|
|
190
|
+
showTemplates?: boolean;
|
|
191
|
+
}
|
|
192
|
+
interface ConfigWithUrlParams extends SDKConfig {
|
|
193
|
+
useUrlParams?: boolean;
|
|
194
|
+
}
|
|
195
|
+
type App = {
|
|
196
|
+
id: number;
|
|
197
|
+
name: string;
|
|
198
|
+
description: string;
|
|
199
|
+
icon_url: string;
|
|
200
|
+
color: string;
|
|
201
|
+
publishing_status: string;
|
|
202
|
+
category: string[];
|
|
203
|
+
app_type?: string;
|
|
204
|
+
action_url?: string | null;
|
|
205
|
+
created_at?: Date;
|
|
206
|
+
tags: string;
|
|
207
|
+
};
|
|
208
|
+
type Activity = {
|
|
209
|
+
id: number;
|
|
210
|
+
name: string;
|
|
211
|
+
type: string;
|
|
212
|
+
endpoint: string;
|
|
213
|
+
auth_required: boolean;
|
|
214
|
+
total_fields: number;
|
|
215
|
+
app: App;
|
|
216
|
+
activity_output: string | null;
|
|
217
|
+
activity_output_url: string | null;
|
|
218
|
+
dynamic_field_data_endpoint: string | null;
|
|
219
|
+
};
|
|
220
|
+
type AuthorizationType = {
|
|
221
|
+
id: number;
|
|
222
|
+
type: string;
|
|
223
|
+
authorizations: Authorization[];
|
|
224
|
+
provider: string;
|
|
225
|
+
is_sandbox_enabled: boolean;
|
|
226
|
+
is_userinfo_required?: boolean;
|
|
227
|
+
authorization_url_sandbox: string;
|
|
228
|
+
app: {
|
|
229
|
+
icon_url: string;
|
|
230
|
+
id: number;
|
|
231
|
+
name: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
interface TemplateField {
|
|
235
|
+
id: number;
|
|
236
|
+
is_required: boolean;
|
|
237
|
+
is_hidden: boolean;
|
|
238
|
+
default_value: string | null;
|
|
239
|
+
weight: number;
|
|
240
|
+
description: string;
|
|
241
|
+
summary: string | null;
|
|
242
|
+
activity_field: {
|
|
243
|
+
id: number;
|
|
244
|
+
machine_name: string;
|
|
245
|
+
type: string;
|
|
246
|
+
title: string;
|
|
247
|
+
description: string;
|
|
248
|
+
weight: number;
|
|
249
|
+
is_required: boolean;
|
|
250
|
+
child_fields: string | null;
|
|
251
|
+
placeholder: string | null;
|
|
252
|
+
is_dynamic: boolean;
|
|
253
|
+
data_src: string | null;
|
|
254
|
+
data_src_endpoint: number | null;
|
|
255
|
+
parent_fields: string | null;
|
|
256
|
+
dynamic_field_src: string | null;
|
|
257
|
+
default_value: string | null;
|
|
258
|
+
auto_machine_name: string;
|
|
259
|
+
dynamic_field_src_endpoint: number | null;
|
|
260
|
+
regex: string | null;
|
|
261
|
+
regex_error_message?: string | null;
|
|
262
|
+
is_searchable: boolean;
|
|
263
|
+
conditional_fields?: string | null;
|
|
264
|
+
} | null;
|
|
265
|
+
title: string | null;
|
|
266
|
+
type: string;
|
|
267
|
+
placeholder: string | null;
|
|
268
|
+
// manual_template: unknown | null;
|
|
269
|
+
child_field: string | null;
|
|
270
|
+
child_field_value: string | null;
|
|
271
|
+
// template_fields: unknown[];
|
|
272
|
+
button_text: string | null;
|
|
273
|
+
// field_actions: unknown[];
|
|
274
|
+
icon_url: string | null;
|
|
275
|
+
long_description: string | null;
|
|
276
|
+
regex: string | null;
|
|
277
|
+
regex_msg: string | null;
|
|
278
|
+
is_visible: boolean;
|
|
279
|
+
app_user_data?: {
|
|
280
|
+
app_user: number;
|
|
281
|
+
id: number;
|
|
282
|
+
value: string | number;
|
|
283
|
+
is_changed: boolean;
|
|
284
|
+
changed_dynamic_fields: string;
|
|
285
|
+
}[];
|
|
286
|
+
added_in_mapping?: boolean;
|
|
287
|
+
field_mapping_source?: string;
|
|
288
|
+
}
|
|
289
|
+
interface TemplateStep {
|
|
290
|
+
id: number;
|
|
291
|
+
weight: number;
|
|
292
|
+
title: string;
|
|
293
|
+
is_visible: boolean;
|
|
294
|
+
activity: Activity;
|
|
295
|
+
authorization_type: AuthorizationType;
|
|
296
|
+
template_fields: TemplateField[];
|
|
297
|
+
step_instance?: number | null;
|
|
298
|
+
allow_multiple_authorizations: boolean;
|
|
299
|
+
step_authorization: number | null;
|
|
300
|
+
button_text: string | null;
|
|
301
|
+
is_self_step: boolean;
|
|
302
|
+
summary: string | null;
|
|
303
|
+
is_workspace_app_step: boolean;
|
|
304
|
+
auth_description: string | null;
|
|
305
|
+
hide_authorization: boolean;
|
|
306
|
+
// step_condition: unknown | null;
|
|
307
|
+
machine_name: string | null;
|
|
308
|
+
is_custom_machine_name: boolean;
|
|
309
|
+
}
|
|
310
|
+
interface InitConfig {
|
|
311
|
+
containerId: string;
|
|
312
|
+
templateContainerId?: string;
|
|
313
|
+
renderMode: TemplateFormRenderModes;
|
|
314
|
+
renderFlowsMode?: TemplateFormRenderModes;
|
|
315
|
+
appId?: number;
|
|
316
|
+
showApps?: boolean;
|
|
317
|
+
showTemplates?: boolean;
|
|
318
|
+
}
|
|
319
|
+
interface MarketplaceConfig {
|
|
320
|
+
containerId: string;
|
|
321
|
+
renderMode: MarketplaceRenderModes;
|
|
322
|
+
}
|
|
323
|
+
interface TemplatePreviewData {
|
|
324
|
+
id: number;
|
|
325
|
+
name: string;
|
|
326
|
+
description: string;
|
|
327
|
+
app: App;
|
|
328
|
+
branding_app: App;
|
|
329
|
+
button_text: string | null;
|
|
330
|
+
is_wizard: boolean;
|
|
331
|
+
publishing_status: string;
|
|
332
|
+
level?: number;
|
|
333
|
+
parent_id?: number;
|
|
334
|
+
steps: TemplateStep[];
|
|
335
|
+
}
|
|
336
|
+
interface PreviewMetadata {
|
|
337
|
+
stepId: number | null;
|
|
338
|
+
type: "AUTH" | "CONFIGURATION" | "CONFIRMATION" | "SECTION";
|
|
339
|
+
}
|
|
340
|
+
interface PreviewPayload {
|
|
341
|
+
templateData: TemplatePreviewData;
|
|
342
|
+
metadata: PreviewMetadata;
|
|
343
|
+
previewContainerId: string;
|
|
344
|
+
}
|
|
345
|
+
// interface for app flows
|
|
346
|
+
interface Instance {
|
|
347
|
+
status: string;
|
|
348
|
+
last_run_status: string;
|
|
349
|
+
id: number;
|
|
350
|
+
last_run_start_time: string;
|
|
351
|
+
name: string;
|
|
352
|
+
error_app_name: string;
|
|
353
|
+
error_code: number;
|
|
354
|
+
first_error_received_at: string;
|
|
355
|
+
usage_limit_reached_at: string;
|
|
356
|
+
}
|
|
357
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
358
|
+
type EventSet = Record<string, (...args: any[]) => void>;
|
|
359
|
+
interface EventEmitterType<ESet extends EventSet> {
|
|
360
|
+
on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
361
|
+
once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
362
|
+
off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
363
|
+
offAll(): void;
|
|
364
|
+
emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
|
|
365
|
+
}
|
|
366
|
+
declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
|
|
367
|
+
private events;
|
|
368
|
+
on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
369
|
+
once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
370
|
+
off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
|
|
371
|
+
offAll(): void;
|
|
372
|
+
emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
|
|
373
|
+
private addEventListener;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Integry JS SDK
|
|
377
|
+
*/
|
|
378
|
+
declare class IntegryJS {
|
|
379
|
+
static SDK_VERSION: string;
|
|
380
|
+
private config;
|
|
381
|
+
private apiHandler;
|
|
382
|
+
eventEmitter: EventEmitter<IntegrySDKEvents>;
|
|
383
|
+
// allow customers to use template tagging
|
|
384
|
+
static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
|
|
385
|
+
static RenderModes: typeof TemplateFormRenderModes;
|
|
386
|
+
static MarketplaceRenderModes: typeof MarketplaceRenderModes;
|
|
387
|
+
static Helpers: {
|
|
388
|
+
getAuthHash: (key: string, message: string) => Promise<string>;
|
|
389
|
+
};
|
|
390
|
+
private authModalId;
|
|
391
|
+
private forceRerender;
|
|
392
|
+
constructor(config: ConfigWithObject | ConfigWithUrlParams);
|
|
393
|
+
/**
|
|
394
|
+
*
|
|
395
|
+
* @param length Length of string to randomly generate
|
|
396
|
+
* @returns {string} Returns a random string
|
|
397
|
+
*/
|
|
398
|
+
private getRandomFlowId;
|
|
399
|
+
private getAuthParamsFromUrl;
|
|
400
|
+
/**
|
|
401
|
+
* Prints version number of this SDK version
|
|
402
|
+
*/
|
|
403
|
+
printVersion: () => void;
|
|
404
|
+
/**
|
|
405
|
+
*
|
|
406
|
+
* @param renderMode
|
|
407
|
+
* @param templateContainerId
|
|
408
|
+
* @returns {HTMLElement | null}
|
|
409
|
+
*/
|
|
410
|
+
private setupFlowFormDestination;
|
|
411
|
+
/**
|
|
412
|
+
* Render the template form we ship
|
|
413
|
+
* @param data
|
|
414
|
+
*/
|
|
415
|
+
renderFlowSetupForm: (data: {
|
|
416
|
+
flowId?: string;
|
|
417
|
+
integrationId?: number;
|
|
418
|
+
flowContainerId: string;
|
|
419
|
+
versionId?: number;
|
|
420
|
+
}) => void;
|
|
421
|
+
/**
|
|
422
|
+
* Render the template form we ship
|
|
423
|
+
* @param data
|
|
424
|
+
*/
|
|
425
|
+
renderAccountConnectionModal: (data?: {
|
|
426
|
+
deploymentId?: string | undefined;
|
|
427
|
+
appId?: number | undefined;
|
|
428
|
+
authTypeId?: number | undefined;
|
|
429
|
+
} | undefined) => void;
|
|
430
|
+
/**
|
|
431
|
+
* Render the template form we ship
|
|
432
|
+
* @param params
|
|
433
|
+
*/
|
|
434
|
+
renderPreview: (params: PreviewPayload) => void;
|
|
435
|
+
/**
|
|
436
|
+
*
|
|
437
|
+
* @param initConfig
|
|
438
|
+
*/
|
|
439
|
+
init: (initConfig: InitConfig) => void;
|
|
440
|
+
initializeMarketplace: (initConfig: InitConfig) => void;
|
|
441
|
+
/**
|
|
442
|
+
*
|
|
443
|
+
* @param marketplaceConfig
|
|
444
|
+
*/
|
|
445
|
+
renderMarketplace: (marketplaceConfig: MarketplaceConfig) => void;
|
|
446
|
+
renderAppFlows: (appFlowConfig: InitConfig) => void;
|
|
447
|
+
verifyAuthConfig: () => Promise<{
|
|
448
|
+
config_verified: boolean;
|
|
449
|
+
} | null>;
|
|
450
|
+
/**
|
|
451
|
+
* Destroy SDK instance and cleanup store
|
|
452
|
+
*/
|
|
453
|
+
destroy: () => void;
|
|
454
|
+
}
|
|
455
|
+
export { IntegryJS as default };
|