@integry/sdk 3.3.2-beta.5 → 3.3.2-beta.7

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,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
- appId?: number;
315
- showApps?: boolean;
316
- showTemplates?: boolean;
317
- }
318
- interface MarketplaceConfig {
319
- containerId: string;
320
- renderMode: MarketplaceRenderModes;
321
- }
322
- interface TemplatePreviewData {
323
- id: number;
324
- name: string;
325
- description: string;
326
- app: App;
327
- branding_app: App;
328
- button_text: string | null;
329
- is_wizard: boolean;
330
- publishing_status: string;
331
- level?: number;
332
- parent_id?: number;
333
- steps: TemplateStep[];
334
- }
335
- interface PreviewMetadata {
336
- stepId: number | null;
337
- type: "AUTH" | "CONFIGURATION" | "CONFIRMATION" | "SECTION";
338
- }
339
- interface PreviewPayload {
340
- templateData: TemplatePreviewData;
341
- metadata: PreviewMetadata;
342
- previewContainerId: string;
343
- }
344
- // interface for app flows
345
- interface Instance {
346
- status: string;
347
- last_run_status: string;
348
- id: number;
349
- last_run_start_time: string;
350
- name: string;
351
- error_app_name: string;
352
- error_code: number;
353
- first_error_received_at: string;
354
- usage_limit_reached_at: string;
355
- }
356
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
357
- type EventSet = Record<string, (...args: any[]) => void>;
358
- interface EventEmitterType<ESet extends EventSet> {
359
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
360
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
361
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
362
- offAll(): void;
363
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
364
- }
365
- declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
366
- private events;
367
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
368
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
369
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
370
- offAll(): void;
371
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
372
- private addEventListener;
373
- }
374
- /**
375
- * Integry JS SDK
376
- */
377
- declare class IntegryJS {
378
- static SDK_VERSION: string;
379
- private config;
380
- private apiHandler;
381
- eventEmitter: EventEmitter<IntegrySDKEvents>;
382
- // allow customers to use template tagging
383
- static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
384
- static RenderModes: typeof TemplateFormRenderModes;
385
- static MarketplaceRenderModes: typeof MarketplaceRenderModes;
386
- static Helpers: {
387
- getAuthHash: (key: string, message: string) => Promise<string>;
388
- };
389
- private authModalId;
390
- private forceRerender;
391
- constructor(config: ConfigWithObject | ConfigWithUrlParams);
392
- /**
393
- *
394
- * @param length Length of string to randomly generate
395
- * @returns {string} Returns a random string
396
- */
397
- private getRandomFlowId;
398
- private getAuthParamsFromUrl;
399
- /**
400
- * Prints version number of this SDK version
401
- */
402
- printVersion: () => void;
403
- /**
404
- *
405
- * @param renderMode
406
- * @param templateContainerId
407
- * @returns {HTMLElement | null}
408
- */
409
- private setupFlowFormDestination;
410
- /**
411
- * Render the template form we ship
412
- * @param data
413
- */
414
- renderFlowSetupForm: (data: {
415
- flowId?: string;
416
- integrationId?: number;
417
- flowContainerId: string;
418
- versionId?: number;
419
- }) => void;
420
- /**
421
- * Render the template form we ship
422
- * @param data
423
- */
424
- renderAccountConnectionModal: (data?: {
425
- deploymentId?: string | undefined;
426
- appId?: number | undefined;
427
- authTypeId?: number | undefined;
428
- } | undefined) => void;
429
- /**
430
- * Render the template form we ship
431
- * @param params
432
- */
433
- renderPreview: (params: PreviewPayload) => void;
434
- /**
435
- *
436
- * @param initConfig
437
- */
438
- init: (initConfig: InitConfig) => void;
439
- initializeMarketplace: (initConfig: InitConfig) => void;
440
- /**
441
- *
442
- * @param marketplaceConfig
443
- */
444
- renderMarketplace: (marketplaceConfig: MarketplaceConfig) => void;
445
- renderAppFlows: (appFlowConfig: InitConfig) => void;
446
- verifyAuthConfig: () => Promise<{
447
- config_verified: boolean;
448
- } | null>;
449
- /**
450
- * Destroy SDK instance and cleanup store
451
- */
452
- destroy: () => void;
453
- }
454
- export { IntegryJS as default };
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 };