@integry/sdk 3.3.1-beta.15 → 3.3.1-beta.16

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