@integry/sdk 3.1.4 → 3.1.5-beta.1

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,361 +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
- 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 };
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 };