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