@integry/sdk 3.1.4-beta.4 → 3.1.4-beta.7

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,359 +1,360 @@
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
- } | null;
200
- title: string | null;
201
- type: string;
202
- placeholder: string | null;
203
- // manual_template: unknown | null;
204
- child_field: string | null;
205
- child_field_value: string | null;
206
- // template_fields: unknown[];
207
- button_text: string | null;
208
- // field_actions: unknown[];
209
- icon_url: string | null;
210
- long_description: string | null;
211
- regex: string | null;
212
- regex_msg: string | null;
213
- is_visible: boolean;
214
- app_user_data?: {
215
- app_user: number;
216
- id: number;
217
- value: string | number;
218
- }[];
219
- added_in_mapping?: boolean;
220
- field_mapping_source?: string;
221
- }
222
- interface TemplateStep {
223
- id: number;
224
- weight: number;
225
- title: string;
226
- is_visible: boolean;
227
- activity: Activity;
228
- authorization_type: AuthorizationType;
229
- template_fields: TemplateField[];
230
- step_instance?: number | null;
231
- allow_multiple_authorizations: boolean;
232
- step_authorization: number | null;
233
- button_text: string | null;
234
- is_self_step: boolean;
235
- summary: string | null;
236
- is_workspace_app_step: boolean;
237
- auth_description: string | null;
238
- hide_authorization: boolean;
239
- // step_condition: unknown | null;
240
- machine_name: string | null;
241
- is_custom_machine_name: boolean;
242
- }
243
- interface InitConfig {
244
- containerId: string;
245
- templateContainerId?: string;
246
- renderMode: TemplateFormRenderModes;
247
- }
248
- interface TemplatePreviewData {
249
- id: number;
250
- name: string;
251
- description: string;
252
- app: App;
253
- branding_app: App;
254
- button_text: string | null;
255
- is_wizard: boolean;
256
- publishing_status: string;
257
- level?: number;
258
- parent_id?: number;
259
- steps: TemplateStep[];
260
- }
261
- interface PreviewMetadata {
262
- stepId: number | null;
263
- type: "AUTH" | "CONFIGURATION" | "CONFIRMATION" | "SECTION";
264
- }
265
- interface PreviewPayload {
266
- templateData: TemplatePreviewData;
267
- metadata: PreviewMetadata;
268
- previewContainerId: string;
269
- }
270
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
271
- type EventSet = Record<string, (...args: any[]) => void>;
272
- interface EventEmitterType<ESet extends EventSet> {
273
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
274
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
275
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
276
- offAll(): void;
277
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
278
- }
279
- declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
280
- private events;
281
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
282
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
283
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
284
- offAll(): void;
285
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
286
- private addEventListener;
287
- }
288
- /**
289
- * Integry JS SDK
290
- */
291
- declare class IntegryJS {
292
- static SDK_VERSION: string;
293
- private config;
294
- private apiHandler;
295
- eventEmitter: EventEmitter<IntegrySDKEvents>;
296
- // allow customers to use template tagging
297
- static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
298
- static RenderModes: typeof TemplateFormRenderModes;
299
- static Helpers: {
300
- getAuthHash: (key: string, message: string) => Promise<string>;
301
- };
302
- private authModalId;
303
- private forceRerender;
304
- constructor(config: ConfigWithObject | ConfigWithUrlParams);
305
- /**
306
- *
307
- * @param length Length of string to randomly generate
308
- * @returns {string} Returns a random string
309
- */
310
- private getRandomFlowId;
311
- private getAuthParamsFromUrl;
312
- /**
313
- * Prints version number of this SDK version
314
- */
315
- printVersion: () => void;
316
- /**
317
- *
318
- * @param renderMode
319
- * @param templateContainerId
320
- * @returns {HTMLElement | null}
321
- */
322
- private setupFlowFormDestination;
323
- /**
324
- * Render the template form we ship
325
- * @param data
326
- */
327
- renderFlowSetupForm: (data: {
328
- flowId?: string;
329
- integrationId?: number;
330
- flowContainerId: string;
331
- }) => void;
332
- /**
333
- * Render the template form we ship
334
- * @param data
335
- */
336
- renderAccountConnectionModal: (data?: {
337
- deploymentId?: string | undefined;
338
- appId?: number | undefined;
339
- authTypeId?: number | undefined;
340
- } | undefined) => void;
341
- /**
342
- * Render the template form we ship
343
- * @param templateId
344
- */
345
- renderPreview: (params: PreviewPayload) => void;
346
- /**
347
- *
348
- * @param initConfig
349
- */
350
- init: (initConfig: InitConfig) => void;
351
- verifyAuthConfig: () => Promise<{
352
- config_verified: boolean;
353
- } | null>;
354
- /**
355
- * Destroy SDK instance and cleanup store
356
- */
357
- destroy: () => void;
358
- }
359
- 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
+ }) => 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 };