@integry/sdk 3.2.24 → 3.2.25-beta.2

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,431 +1,435 @@
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
- };
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
- imgUrl: string;
134
- name: string;
135
- description: string;
136
- tags: string;
137
- layout: TemplateListingRenderModes;
138
- handleClick: () => void;
139
- };
140
- interface UserConfig {
141
- availableFlowsLabel?: string;
142
- myFlowsLabel?: string;
143
- hideWebhookUrlScreen?: boolean;
144
- hideAppConnectionModal?: boolean;
145
- customComponents?: {
146
- flowCard?: (props: FlowCardProps) => VNode;
147
- };
148
- autoRedirectToMyFlows?: boolean;
149
- isReadOnly?: boolean;
150
- marketplaceModalTitle?: string;
151
- buttonLabelToSaveIntegration?: string;
152
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
- [other: string]: any;
154
- }
155
- interface SDKConfig {
156
- env?: "staging" | "production";
157
- baseUrl?: string;
158
- debug?: boolean;
159
- integrationId?: number;
160
- xIntegryConfig?: {
161
- isAnonymous?: boolean;
162
- appAuth?: {
163
- apiKey?: string;
164
- authId?: string;
165
- extras?: Record<string, string | number>;
166
- };
167
- };
168
- userConfig?: UserConfig;
169
- }
170
- interface ConfigWithObject extends SDKConfig {
171
- appKey: string;
172
- hash: string;
173
- userId: string;
174
- deploymentId: string;
175
- marketplaceId?: string;
176
- }
177
- interface ConfigWithUrlParams extends SDKConfig {
178
- useUrlParams?: boolean;
179
- }
180
- type App = {
181
- id: number;
182
- name: string;
183
- description: string;
184
- icon_url: string;
185
- color: string;
186
- publishing_status: string;
187
- category: string[];
188
- app_type?: string;
189
- action_url?: string | null;
190
- created_at?: Date;
191
- tags: string;
192
- };
193
- type Activity = {
194
- id: number;
195
- name: string;
196
- type: string;
197
- endpoint: string;
198
- auth_required: boolean;
199
- total_fields: number;
200
- app: App;
201
- activity_output: string | null;
202
- activity_output_url: string | null;
203
- dynamic_field_data_endpoint: string | null;
204
- };
205
- type AuthorizationType = {
206
- id: number;
207
- type: string;
208
- authorizations: Authorization[];
209
- provider: string;
210
- is_sandbox_enabled: boolean;
211
- is_userinfo_required?: boolean;
212
- authorization_url_sandbox: string;
213
- app: {
214
- icon_url: string;
215
- id: number;
216
- name: string;
217
- };
218
- };
219
- interface TemplateField {
220
- id: number;
221
- is_required: boolean;
222
- is_hidden: boolean;
223
- default_value: string | null;
224
- weight: number;
225
- description: string;
226
- summary: string | null;
227
- activity_field: {
228
- id: number;
229
- machine_name: string;
230
- type: string;
231
- title: string;
232
- description: string;
233
- weight: number;
234
- is_required: boolean;
235
- child_fields: string | null;
236
- placeholder: string | null;
237
- is_dynamic: boolean;
238
- data_src: string | null;
239
- data_src_endpoint: number | null;
240
- parent_fields: string | null;
241
- dynamic_field_src: string | null;
242
- default_value: string | null;
243
- auto_machine_name: string;
244
- dynamic_field_src_endpoint: number | null;
245
- regex: string | null;
246
- regex_error_message?: string | null;
247
- is_searchable: boolean;
248
- conditional_fields?: string | null;
249
- } | null;
250
- title: string | null;
251
- type: string;
252
- placeholder: string | null;
253
- // manual_template: unknown | null;
254
- child_field: string | null;
255
- child_field_value: string | null;
256
- // template_fields: unknown[];
257
- button_text: string | null;
258
- // field_actions: unknown[];
259
- icon_url: string | null;
260
- long_description: string | null;
261
- regex: string | null;
262
- regex_msg: string | null;
263
- is_visible: boolean;
264
- app_user_data?: {
265
- app_user: number;
266
- id: number;
267
- value: string | number;
268
- is_changed: boolean;
269
- changed_dynamic_fields: string;
270
- }[];
271
- added_in_mapping?: boolean;
272
- field_mapping_source?: string;
273
- }
274
- interface TemplateStep {
275
- id: number;
276
- weight: number;
277
- title: string;
278
- is_visible: boolean;
279
- activity: Activity;
280
- authorization_type: AuthorizationType;
281
- template_fields: TemplateField[];
282
- step_instance?: number | null;
283
- allow_multiple_authorizations: boolean;
284
- step_authorization: number | null;
285
- button_text: string | null;
286
- is_self_step: boolean;
287
- summary: string | null;
288
- is_workspace_app_step: boolean;
289
- auth_description: string | null;
290
- hide_authorization: boolean;
291
- // step_condition: unknown | null;
292
- machine_name: string | null;
293
- is_custom_machine_name: boolean;
294
- }
295
- interface InitConfig {
296
- containerId: string;
297
- templateContainerId?: string;
298
- renderMode: TemplateFormRenderModes;
299
- }
300
- interface MarketplaceConfig {
301
- containerId: string;
302
- renderMode: MarketplaceRenderModes;
303
- }
304
- interface TemplatePreviewData {
305
- id: number;
306
- name: string;
307
- description: string;
308
- app: App;
309
- branding_app: App;
310
- button_text: string | null;
311
- is_wizard: boolean;
312
- publishing_status: string;
313
- level?: number;
314
- parent_id?: number;
315
- steps: TemplateStep[];
316
- }
317
- interface PreviewMetadata {
318
- stepId: number | null;
319
- type: "AUTH" | "CONFIGURATION" | "CONFIRMATION" | "SECTION";
320
- }
321
- interface PreviewPayload {
322
- templateData: TemplatePreviewData;
323
- metadata: PreviewMetadata;
324
- previewContainerId: string;
325
- }
326
- /**
327
- *
328
- * @param key Key to sign hash
329
- * @param message Message to hash
330
- * @returns {string}
331
- */
332
- declare function HMAC(message: string, key: string): Promise<string>;
333
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
334
- type EventSet = Record<string, (...args: any[]) => void>;
335
- interface EventEmitterType<ESet extends EventSet> {
336
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
337
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
338
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
339
- offAll(): void;
340
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
341
- }
342
- declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
343
- private events;
344
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
345
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
346
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
347
- offAll(): void;
348
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
349
- private addEventListener;
350
- }
351
- declare const Helpers: {
352
- getAuthHash: typeof HMAC;
353
- };
354
- /**
355
- * Integry JS SDK
356
- */
357
- declare class IntegryJS {
358
- static SDK_VERSION: string;
359
- private config;
360
- private apiHandler;
361
- eventEmitter: EventEmitter<IntegrySDKEvents>;
362
- static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
363
- static RenderModes: typeof TemplateFormRenderModes;
364
- static MarketplaceRenderModes: typeof MarketplaceRenderModes;
365
- static Helpers: {
366
- getAuthHash: (key: string, message: string) => Promise<string>;
367
- };
368
- private authModalId;
369
- private forceRerender;
370
- constructor(config: ConfigWithObject | ConfigWithUrlParams);
371
- /**
372
- *
373
- * @param length Length of string to randomly generate
374
- * @returns {string} Returns a random string
375
- */
376
- private getRandomFlowId;
377
- private getAuthParamsFromUrl;
378
- /**
379
- * Prints version number of this SDK version
380
- */
381
- printVersion: () => void;
382
- /**
383
- *
384
- * @param renderMode
385
- * @param templateContainerId
386
- * @returns {HTMLElement | null}
387
- */
388
- private setupFlowFormDestination;
389
- /**
390
- * Render the template form we ship
391
- * @param data
392
- */
393
- renderFlowSetupForm: (data: {
394
- flowId?: string;
395
- integrationId?: number;
396
- flowContainerId: string;
397
- versionId?: number;
398
- }) => void;
399
- /**
400
- * Render the template form we ship
401
- * @param data
402
- */
403
- renderAccountConnectionModal: (data?: {
404
- deploymentId?: string | undefined;
405
- appId?: number | undefined;
406
- authTypeId?: number | undefined;
407
- } | undefined) => void;
408
- /**
409
- * Render the template form we ship
410
- * @param params
411
- */
412
- renderPreview: (params: PreviewPayload) => void;
413
- /**
414
- *
415
- * @param initConfig
416
- */
417
- init: (initConfig: InitConfig) => void;
418
- /**
419
- *
420
- * @param marketplaceConfig
421
- */
422
- renderMarketplace: (marketplaceConfig: MarketplaceConfig) => void;
423
- verifyAuthConfig: () => Promise<{
424
- config_verified: boolean;
425
- } | null>;
426
- /**
427
- * Destroy SDK instance and cleanup store
428
- */
429
- destroy: () => void;
430
- }
431
- 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
+ };
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
+ imgUrl: string;
134
+ name: string;
135
+ description: string;
136
+ tags: string;
137
+ layout: TemplateListingRenderModes;
138
+ handleClick: () => void;
139
+ };
140
+ interface UserConfig {
141
+ availableFlowsLabel?: string;
142
+ myFlowsLabel?: string;
143
+ hideWebhookUrlScreen?: boolean;
144
+ hideAppConnectionModal?: boolean;
145
+ customComponents?: {
146
+ flowCard?: (props: FlowCardProps) => VNode;
147
+ };
148
+ autoRedirectToMyFlows?: boolean;
149
+ isReadOnly?: boolean;
150
+ marketplaceModalTitle?: string;
151
+ buttonLabelToSaveIntegration?: string;
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ [other: string]: any;
154
+ }
155
+ interface SDKConfig {
156
+ env?: "staging" | "production";
157
+ baseUrl?: string;
158
+ debug?: boolean;
159
+ integrationId?: number;
160
+ xIntegryConfig?: {
161
+ isAnonymous?: boolean;
162
+ appAuth?: {
163
+ apiKey?: string;
164
+ authId?: string;
165
+ extras?: Record<string, string | number>;
166
+ };
167
+ };
168
+ userConfig?: UserConfig;
169
+ }
170
+ interface ConfigWithObject extends SDKConfig {
171
+ appKey: string;
172
+ hash: string;
173
+ userId: string;
174
+ deploymentId: string;
175
+ marketplaceId?: string;
176
+ appId?: number;
177
+ }
178
+ interface ConfigWithUrlParams extends SDKConfig {
179
+ useUrlParams?: boolean;
180
+ }
181
+ type App = {
182
+ id: number;
183
+ name: string;
184
+ description: string;
185
+ icon_url: string;
186
+ color: string;
187
+ publishing_status: string;
188
+ category: string[];
189
+ app_type?: string;
190
+ action_url?: string | null;
191
+ created_at?: Date;
192
+ tags: string;
193
+ };
194
+ type Activity = {
195
+ id: number;
196
+ name: string;
197
+ type: string;
198
+ endpoint: string;
199
+ auth_required: boolean;
200
+ total_fields: number;
201
+ app: App;
202
+ activity_output: string | null;
203
+ activity_output_url: string | null;
204
+ dynamic_field_data_endpoint: string | null;
205
+ };
206
+ type AuthorizationType = {
207
+ id: number;
208
+ type: string;
209
+ authorizations: Authorization[];
210
+ provider: string;
211
+ is_sandbox_enabled: boolean;
212
+ is_userinfo_required?: boolean;
213
+ authorization_url_sandbox: string;
214
+ app: {
215
+ icon_url: string;
216
+ id: number;
217
+ name: string;
218
+ };
219
+ };
220
+ interface TemplateField {
221
+ id: number;
222
+ is_required: boolean;
223
+ is_hidden: boolean;
224
+ default_value: string | null;
225
+ weight: number;
226
+ description: string;
227
+ summary: string | null;
228
+ activity_field: {
229
+ id: number;
230
+ machine_name: string;
231
+ type: string;
232
+ title: string;
233
+ description: string;
234
+ weight: number;
235
+ is_required: boolean;
236
+ child_fields: string | null;
237
+ placeholder: string | null;
238
+ is_dynamic: boolean;
239
+ data_src: string | null;
240
+ data_src_endpoint: number | null;
241
+ parent_fields: string | null;
242
+ dynamic_field_src: string | null;
243
+ default_value: string | null;
244
+ auto_machine_name: string;
245
+ dynamic_field_src_endpoint: number | null;
246
+ regex: string | null;
247
+ regex_error_message?: string | null;
248
+ is_searchable: boolean;
249
+ conditional_fields?: string | null;
250
+ } | null;
251
+ title: string | null;
252
+ type: string;
253
+ placeholder: string | null;
254
+ // manual_template: unknown | null;
255
+ child_field: string | null;
256
+ child_field_value: string | null;
257
+ // template_fields: unknown[];
258
+ button_text: string | null;
259
+ // field_actions: unknown[];
260
+ icon_url: string | null;
261
+ long_description: string | null;
262
+ regex: string | null;
263
+ regex_msg: string | null;
264
+ is_visible: boolean;
265
+ app_user_data?: {
266
+ app_user: number;
267
+ id: number;
268
+ value: string | number;
269
+ is_changed: boolean;
270
+ changed_dynamic_fields: string;
271
+ }[];
272
+ added_in_mapping?: boolean;
273
+ field_mapping_source?: string;
274
+ }
275
+ interface TemplateStep {
276
+ id: number;
277
+ weight: number;
278
+ title: string;
279
+ is_visible: boolean;
280
+ activity: Activity;
281
+ authorization_type: AuthorizationType;
282
+ template_fields: TemplateField[];
283
+ step_instance?: number | null;
284
+ allow_multiple_authorizations: boolean;
285
+ step_authorization: number | null;
286
+ button_text: string | null;
287
+ is_self_step: boolean;
288
+ summary: string | null;
289
+ is_workspace_app_step: boolean;
290
+ auth_description: string | null;
291
+ hide_authorization: boolean;
292
+ // step_condition: unknown | null;
293
+ machine_name: string | null;
294
+ is_custom_machine_name: boolean;
295
+ }
296
+ interface InitConfig {
297
+ containerId: string;
298
+ templateContainerId?: string;
299
+ renderMode: TemplateFormRenderModes;
300
+ appId?: number;
301
+ }
302
+ interface MarketplaceConfig {
303
+ containerId: string;
304
+ renderMode: MarketplaceRenderModes;
305
+ }
306
+ interface TemplatePreviewData {
307
+ id: number;
308
+ name: string;
309
+ description: string;
310
+ app: App;
311
+ branding_app: App;
312
+ button_text: string | null;
313
+ is_wizard: boolean;
314
+ publishing_status: string;
315
+ level?: number;
316
+ parent_id?: number;
317
+ steps: TemplateStep[];
318
+ }
319
+ interface PreviewMetadata {
320
+ stepId: number | null;
321
+ type: "AUTH" | "CONFIGURATION" | "CONFIRMATION" | "SECTION";
322
+ }
323
+ interface PreviewPayload {
324
+ templateData: TemplatePreviewData;
325
+ metadata: PreviewMetadata;
326
+ previewContainerId: string;
327
+ }
328
+ /**
329
+ *
330
+ * @param key Key to sign hash
331
+ * @param message Message to hash
332
+ * @returns {string}
333
+ */
334
+ declare function HMAC(message: string, key: string): Promise<string>;
335
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
336
+ type EventSet = Record<string, (...args: any[]) => void>;
337
+ interface EventEmitterType<ESet extends EventSet> {
338
+ on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
339
+ once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
340
+ off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
341
+ offAll(): void;
342
+ emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
343
+ }
344
+ declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
345
+ private events;
346
+ on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
347
+ once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
348
+ off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
349
+ offAll(): void;
350
+ emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
351
+ private addEventListener;
352
+ }
353
+ declare const Helpers: {
354
+ getAuthHash: typeof HMAC;
355
+ };
356
+ /**
357
+ * Integry JS SDK
358
+ */
359
+ declare class IntegryJS {
360
+ static SDK_VERSION: string;
361
+ private config;
362
+ private apiHandler;
363
+ eventEmitter: EventEmitter<IntegrySDKEvents>;
364
+ static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
365
+ static RenderModes: typeof TemplateFormRenderModes;
366
+ static MarketplaceRenderModes: typeof MarketplaceRenderModes;
367
+ static Helpers: {
368
+ getAuthHash: (key: string, message: string) => Promise<string>;
369
+ };
370
+ private authModalId;
371
+ private forceRerender;
372
+ constructor(config: ConfigWithObject | ConfigWithUrlParams);
373
+ /**
374
+ *
375
+ * @param length Length of string to randomly generate
376
+ * @returns {string} Returns a random string
377
+ */
378
+ private getRandomFlowId;
379
+ private getAuthParamsFromUrl;
380
+ /**
381
+ * Prints version number of this SDK version
382
+ */
383
+ printVersion: () => void;
384
+ /**
385
+ *
386
+ * @param renderMode
387
+ * @param templateContainerId
388
+ * @returns {HTMLElement | null}
389
+ */
390
+ private setupFlowFormDestination;
391
+ /**
392
+ * Render the template form we ship
393
+ * @param data
394
+ */
395
+ renderFlowSetupForm: (data: {
396
+ flowId?: string;
397
+ integrationId?: number;
398
+ flowContainerId: string;
399
+ versionId?: number;
400
+ }) => void;
401
+ /**
402
+ * Render the template form we ship
403
+ * @param data
404
+ */
405
+ renderAccountConnectionModal: (data?: {
406
+ deploymentId?: string | undefined;
407
+ appId?: number | undefined;
408
+ authTypeId?: number | undefined;
409
+ } | undefined) => void;
410
+ /**
411
+ * Render the template form we ship
412
+ * @param params
413
+ */
414
+ renderPreview: (params: PreviewPayload) => void;
415
+ /**
416
+ *
417
+ * @param initConfig
418
+ */
419
+ init: (initConfig: InitConfig) => void;
420
+ initializeMarketplace: (initConfig: InitConfig) => void;
421
+ /**
422
+ *
423
+ * @param marketplaceConfig
424
+ */
425
+ renderMarketplace: (marketplaceConfig: MarketplaceConfig) => void;
426
+ renderAppFlows: (appFlowConfig: InitConfig) => void;
427
+ verifyAuthConfig: () => Promise<{
428
+ config_verified: boolean;
429
+ } | null>;
430
+ /**
431
+ * Destroy SDK instance and cleanup store
432
+ */
433
+ destroy: () => void;
434
+ }
435
+ export { IntegryJS, Helpers, html };