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

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