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

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,370 +1,370 @@
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
- }) => 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
- /**
273
- *
274
- * @param key Key to sign hash
275
- * @param message Message to hash
276
- * @returns {string}
277
- */
278
- declare function HMAC(message: string, key: string): Promise<string>;
279
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
- type EventSet = Record<string, (...args: any[]) => void>;
281
- interface EventEmitterType<ESet extends EventSet> {
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
- }
288
- declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
289
- private events;
290
- on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
291
- once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
292
- off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
293
- offAll(): void;
294
- emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
295
- private addEventListener;
296
- }
297
- declare const Helpers: {
298
- getAuthHash: typeof HMAC;
299
- };
300
- /**
301
- * Integry JS SDK
302
- */
303
- declare class IntegryJS {
304
- static SDK_VERSION: string;
305
- private config;
306
- private apiHandler;
307
- eventEmitter: EventEmitter<IntegrySDKEvents>;
308
- static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
309
- static RenderModes: typeof TemplateFormRenderModes;
310
- static Helpers: {
311
- getAuthHash: (key: string, message: string) => Promise<string>;
312
- };
313
- private authModalId;
314
- private forceRerender;
315
- constructor(config: ConfigWithObject | ConfigWithUrlParams);
316
- /**
317
- *
318
- * @param length Length of string to randomly generate
319
- * @returns {string} Returns a random string
320
- */
321
- private getRandomFlowId;
322
- private getAuthParamsFromUrl;
323
- /**
324
- * Prints version number of this SDK version
325
- */
326
- printVersion: () => void;
327
- /**
328
- *
329
- * @param renderMode
330
- * @param templateContainerId
331
- * @returns {HTMLElement | null}
332
- */
333
- private setupFlowFormDestination;
334
- /**
335
- * Render the template form we ship
336
- * @param data
337
- */
338
- renderFlowSetupForm: (data: {
339
- flowId?: string;
340
- integrationId?: number;
341
- flowContainerId: string;
342
- }) => void;
343
- /**
344
- * Render the template form we ship
345
- * @param data
346
- */
347
- renderAccountConnectionModal: (data?: {
348
- deploymentId?: string | undefined;
349
- appId?: number | undefined;
350
- authTypeId?: number | undefined;
351
- } | undefined) => void;
352
- /**
353
- * Render the template form we ship
354
- * @param templateId
355
- */
356
- renderPreview: (params: PreviewPayload) => void;
357
- /**
358
- *
359
- * @param initConfig
360
- */
361
- init: (initConfig: InitConfig) => void;
362
- verifyAuthConfig: () => Promise<{
363
- config_verified: boolean;
364
- } | null>;
365
- /**
366
- * Destroy SDK instance and cleanup store
367
- */
368
- destroy: () => void;
369
- }
370
- 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
+ }) => 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
+ /**
273
+ *
274
+ * @param key Key to sign hash
275
+ * @param message Message to hash
276
+ * @returns {string}
277
+ */
278
+ declare function HMAC(message: string, key: string): Promise<string>;
279
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
+ type EventSet = Record<string, (...args: any[]) => void>;
281
+ interface EventEmitterType<ESet extends EventSet> {
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
+ }
288
+ declare class EventEmitter<ESet extends EventSet> implements EventEmitterType<EventSet> {
289
+ private events;
290
+ on<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
291
+ once<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
292
+ off<EventName extends keyof ESet>(eventName: EventName, handler: ESet[EventName]): void;
293
+ offAll(): void;
294
+ emit<EventName extends keyof ESet>(eventName: EventName, ...args: Parameters<ESet[EventName]>): void;
295
+ private addEventListener;
296
+ }
297
+ declare const Helpers: {
298
+ getAuthHash: typeof HMAC;
299
+ };
300
+ /**
301
+ * Integry JS SDK
302
+ */
303
+ declare class IntegryJS {
304
+ static SDK_VERSION: string;
305
+ private config;
306
+ private apiHandler;
307
+ eventEmitter: EventEmitter<IntegrySDKEvents>;
308
+ static html: (strings: TemplateStringsArray, ...values: any[]) => import("preact").VNode<{}>;
309
+ static RenderModes: typeof TemplateFormRenderModes;
310
+ static Helpers: {
311
+ getAuthHash: (key: string, message: string) => Promise<string>;
312
+ };
313
+ private authModalId;
314
+ private forceRerender;
315
+ constructor(config: ConfigWithObject | ConfigWithUrlParams);
316
+ /**
317
+ *
318
+ * @param length Length of string to randomly generate
319
+ * @returns {string} Returns a random string
320
+ */
321
+ private getRandomFlowId;
322
+ private getAuthParamsFromUrl;
323
+ /**
324
+ * Prints version number of this SDK version
325
+ */
326
+ printVersion: () => void;
327
+ /**
328
+ *
329
+ * @param renderMode
330
+ * @param templateContainerId
331
+ * @returns {HTMLElement | null}
332
+ */
333
+ private setupFlowFormDestination;
334
+ /**
335
+ * Render the template form we ship
336
+ * @param data
337
+ */
338
+ renderFlowSetupForm: (data: {
339
+ flowId?: string;
340
+ integrationId?: number;
341
+ flowContainerId: string;
342
+ }) => void;
343
+ /**
344
+ * Render the template form we ship
345
+ * @param data
346
+ */
347
+ renderAccountConnectionModal: (data?: {
348
+ deploymentId?: string | undefined;
349
+ appId?: number | undefined;
350
+ authTypeId?: number | undefined;
351
+ } | undefined) => void;
352
+ /**
353
+ * Render the template form we ship
354
+ * @param templateId
355
+ */
356
+ renderPreview: (params: PreviewPayload) => void;
357
+ /**
358
+ *
359
+ * @param initConfig
360
+ */
361
+ init: (initConfig: InitConfig) => void;
362
+ verifyAuthConfig: () => Promise<{
363
+ config_verified: boolean;
364
+ } | null>;
365
+ /**
366
+ * Destroy SDK instance and cleanup store
367
+ */
368
+ destroy: () => void;
369
+ }
370
+ export { IntegryJS, Helpers, html };