@integry/sdk 3.1.4-beta.7 → 3.1.4

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