@integry/sdk 3.1.5-beta.1 → 3.1.5-beta.2

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