@useparagon/connect 1.0.39 → 1.0.40
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.
- package/dist/src/ConnectSDK.d.ts +158 -3
- package/dist/src/ConnectSDK.js +1 -1
- package/dist/src/entities/integration.interface.d.ts +6 -0
- package/dist/src/file-picker/helpers/microsoftPicker.d.ts +1 -1
- package/dist/src/file-picker/integrations/box.d.ts +1 -1
- package/dist/src/file-picker/integrations/googledrive.d.ts +1 -1
- package/dist/src/helpers/oauth.d.ts +2 -1
- package/dist/src/index.js +1 -1
- package/dist/src/types/action.d.ts +138 -6
- package/dist/src/types/connect.d.ts +18 -8
- package/dist/src/types/connectModal.d.ts +4 -0
- package/dist/src/types/sdk.d.ts +90 -4
- package/package.json +1 -1
package/dist/src/ConnectSDK.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { IConnectCredential } from './entities/connectCredential.interface';
|
|
2
2
|
import { IConnectCredentialConfig } from './entities/connectCredentialConfig.interface';
|
|
3
|
-
import { OauthCallbackResponse } from './entities/credential.interface';
|
|
3
|
+
import { AuthenticationScheme, OauthCallbackResponse } from './entities/credential.interface';
|
|
4
4
|
import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from './entities/integration.interface';
|
|
5
5
|
import { PersonaMeta } from './entities/persona.interface';
|
|
6
6
|
import { ExternalFilePicker } from './file-picker/types';
|
|
7
7
|
import SDKEventEmitter from './SDKEventEmitter';
|
|
8
8
|
import { ConnectSdkEnvironments } from './server.types';
|
|
9
|
-
import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DeleteConfigurationOptions, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, IntegrationInstallEvent, LoadCustomDropdownOptionsResult, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions } from './types';
|
|
9
|
+
import { AccountType, AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, ConnectInputValue, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DataType, DeleteConfigurationOptions, DisableWorkflowOptions, DynamicDefaultInput, DynamicFieldMappingLoaderType, DynamicFieldMappingOptionsResult, EnumInputValue, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, InstallOptions, IntegrationConfig, IntegrationConnectInput, IntegrationInstallEvent, KeyedSource, LoadCustomDropdownOptionsResult, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions, UpdateWorkflowStateResponse } from './types';
|
|
10
10
|
export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE";
|
|
11
11
|
export { ExternalFilePicker };
|
|
12
12
|
export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
13
13
|
root: HTMLIFrameElement | undefined;
|
|
14
14
|
private rootLoaded;
|
|
15
|
+
private isHeadless;
|
|
15
16
|
/**
|
|
16
17
|
* sometime DOMContentLoaded event firing twice
|
|
17
18
|
* so it was creating two iframes see PARA-8749
|
|
@@ -45,9 +46,15 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
45
46
|
* so that we will be able to know whether style is added in body or not
|
|
46
47
|
*/
|
|
47
48
|
private originalBodyOverflow;
|
|
49
|
+
/**
|
|
50
|
+
* Dynamic field mapping loaders for handling dynamic object types and integration fields
|
|
51
|
+
*/
|
|
52
|
+
private dynamicFieldMappingLoaders;
|
|
53
|
+
installFlow: InstallFlow;
|
|
48
54
|
constructor(environmentsOrHost?: ConnectSdkEnvironments | string, flags?: {
|
|
49
55
|
skipBootstrapWithLastKnownState?: boolean;
|
|
50
56
|
});
|
|
57
|
+
setHeadless(headless: boolean): void;
|
|
51
58
|
/**
|
|
52
59
|
* post message handler
|
|
53
60
|
* @param event
|
|
@@ -82,6 +89,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
82
89
|
* unauthenticated contexts, as a fallback.
|
|
83
90
|
*/
|
|
84
91
|
private loadState;
|
|
92
|
+
getIntegrationId(integration: string): string;
|
|
85
93
|
/**
|
|
86
94
|
* Saves the current SDK state into localStorage, if available.
|
|
87
95
|
*/
|
|
@@ -116,6 +124,26 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
116
124
|
* Logout the currently authenticated end user from the Paragon SDK.
|
|
117
125
|
*/
|
|
118
126
|
logout(): void;
|
|
127
|
+
private removeOptionDuplicates;
|
|
128
|
+
startOAuthFlow(action: string, apiInstallationOptions: InstallOptions & CredentialConfigOptions & {
|
|
129
|
+
endUserSuppliedValues?: Record<string, ConnectInputValue>;
|
|
130
|
+
}, options?: {
|
|
131
|
+
onSuccess?: (connectCredentialId: string) => void;
|
|
132
|
+
onError?: (error: unknown) => void;
|
|
133
|
+
}): void;
|
|
134
|
+
private getIntegrationByName;
|
|
135
|
+
private getSelectedMultipleAccountTypes;
|
|
136
|
+
/**
|
|
137
|
+
* in chrome getting issue for asynchronous popup opening
|
|
138
|
+
* see PARA-1505
|
|
139
|
+
*/
|
|
140
|
+
private getAccountName;
|
|
141
|
+
/**
|
|
142
|
+
* Set dynamic field mapping loaders for the given action
|
|
143
|
+
* @param action - The action to set dynamic field mapping loaders for
|
|
144
|
+
* @param mapObjectFields
|
|
145
|
+
*/
|
|
146
|
+
private setDynamicFieldMappingLoaders;
|
|
119
147
|
/**
|
|
120
148
|
* Display the Paragon Connect modal
|
|
121
149
|
*/
|
|
@@ -128,6 +156,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
128
156
|
* @returns The integration object if found, otherwise undefined.
|
|
129
157
|
*/
|
|
130
158
|
_getIntegration(integrationId: string): IConnectIntegrationWithCredentialInfo | undefined;
|
|
159
|
+
getIntegrationBySlug(integrationName: string): IConnectIntegrationWithCredentialInfo;
|
|
131
160
|
_oauthCallback(oauthResponse: OauthCallbackResponse, credentialId?: string): Promise<void>;
|
|
132
161
|
_oauthErrorCallback(errorMessage: string | object, event?: MessageEvent): Promise<void>;
|
|
133
162
|
customDropdownOptionsLoaders: Record<string, (cursor?: string | undefined, search?: string | undefined) => LoadCustomDropdownOptionsResult>;
|
|
@@ -224,6 +253,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
224
253
|
* we also need integration config and other credentials info which is not included in `sdk/me`
|
|
225
254
|
*/
|
|
226
255
|
private fetchIntegrations;
|
|
256
|
+
private getIntegrationIcon;
|
|
227
257
|
/**
|
|
228
258
|
* Updates internal state where integration information may be used.
|
|
229
259
|
*/
|
|
@@ -245,7 +275,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
245
275
|
completeInstall(action: string, options: CompleteInstallOptions): Promise<void>;
|
|
246
276
|
/**
|
|
247
277
|
* update credential data in integration
|
|
248
|
-
* @param
|
|
278
|
+
* @param newCredential
|
|
249
279
|
* @param integration
|
|
250
280
|
*/
|
|
251
281
|
private updateCredentialData;
|
|
@@ -268,4 +298,129 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
268
298
|
destroyConfiguration({ id, credentialId }: DeleteConfigurationOptions): Promise<void>;
|
|
269
299
|
updateConfiguration({ id, credentialId, meta, }: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
|
|
270
300
|
private pollForCredential;
|
|
301
|
+
/**
|
|
302
|
+
* Returns integration config
|
|
303
|
+
* @param integration
|
|
304
|
+
* @returns
|
|
305
|
+
*/
|
|
306
|
+
getIntegrationConfig(integration: string): IntegrationConfig;
|
|
307
|
+
private getIntegrationCredential;
|
|
308
|
+
/**
|
|
309
|
+
* Updates stored User Settings for an integration or workflow.
|
|
310
|
+
*
|
|
311
|
+
* @param integration - An integration name, e.g. "googledrive"
|
|
312
|
+
* @param userSettingsUpdate - A partial map of input IDs <> values to update the user's settings
|
|
313
|
+
* @param settings - Optional object with selectedCredentialId or selectedConfigurationId
|
|
314
|
+
* @returns Promise with the new user state and an array of errors, if any were found
|
|
315
|
+
*/
|
|
316
|
+
updateIntegrationUserSettings(integration: string, userSettingsUpdate: Record<string, any>, settings?: CredentialConfigOptions): Promise<{
|
|
317
|
+
userState: AuthenticatedConnectUser;
|
|
318
|
+
errors: string[];
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* Updates user settings for a specific workflow within an integration.
|
|
322
|
+
*
|
|
323
|
+
* @param integration - An integration name, e.g. "googledrive"
|
|
324
|
+
* @param workflowId - The ID of the workflow to update settings for
|
|
325
|
+
* @param userSettingsUpdate - A partial map of input IDs <> values to update the workflow's settings
|
|
326
|
+
* @param settings - Optional object with selectedCredentialId or selectedConfigurationId
|
|
327
|
+
* @returns Promise with the new user state and an array of errors, if any were found
|
|
328
|
+
* @throws Error if the workflow is not enabled or if the integration is not found
|
|
329
|
+
*/
|
|
330
|
+
updateWorkflowUserSettings(integration: string, workflowId: string, userSettingsUpdate: Record<string, any>, settings?: CredentialConfigOptions): Promise<{
|
|
331
|
+
userState: AuthenticatedConnectUser;
|
|
332
|
+
errors: string[];
|
|
333
|
+
}>;
|
|
334
|
+
/**
|
|
335
|
+
* Updates the enabled/disabled state of multiple workflows for a given integration.
|
|
336
|
+
*
|
|
337
|
+
* @param workflowStateUpdate - An object mapping workflow IDs to their desired enabled state (true/false)
|
|
338
|
+
* @param options - Optional settings for credential and configuration selection
|
|
339
|
+
* @param options.selectedCredentialId - Optional ID of the specific credential to use
|
|
340
|
+
* @param options.selectedConfigurationId - Optional ID of the specific configuration to use
|
|
341
|
+
* @returns Promise that resolves with the updated user state and any errors that occurred during the update
|
|
342
|
+
* @throws Error if no valid credential is found or if the integration is not enabled
|
|
343
|
+
*/
|
|
344
|
+
updateWorkflowState(workflowStateUpdate: Record<string, boolean>, options?: CredentialConfigOptions): Promise<UpdateWorkflowStateResponse>;
|
|
345
|
+
/**
|
|
346
|
+
* Retrieves field options for a specific integration action.
|
|
347
|
+
*
|
|
348
|
+
* @param integration - The integration type to validate and retrieve field options for.
|
|
349
|
+
* @param action - The specific action within the integration to retrieve field options for.
|
|
350
|
+
* @param search - Optional search term to filter field options.
|
|
351
|
+
* @param cursor - Optional cursor for pagination, can be a string, number, or false.
|
|
352
|
+
* @param parameters - Optional array of parameters to be used in the request.
|
|
353
|
+
* @returns A promise that resolves with the field options or logs an error if the request fails.
|
|
354
|
+
*/
|
|
355
|
+
getFieldOptions({ integration, action, search, cursor, parameters, }: {
|
|
356
|
+
integration: string;
|
|
357
|
+
action: string;
|
|
358
|
+
search?: string;
|
|
359
|
+
cursor?: string | number | false;
|
|
360
|
+
parameters?: KeyedSource<DataType.ANY>[];
|
|
361
|
+
}): Promise<{
|
|
362
|
+
data: EnumInputValue<any>[];
|
|
363
|
+
nestedData: DynamicDefaultInput[];
|
|
364
|
+
nextPageCursor: string | null;
|
|
365
|
+
}>;
|
|
366
|
+
getDataSourceOptions(integrationName: string, action: string): Promise<import("./types").DataSource | undefined>;
|
|
367
|
+
getAccountTypeOptions(integrationName: string): AccountType[];
|
|
368
|
+
getPreOptions(integrationName: string, accountTypeId?: string): IntegrationConnectInput[];
|
|
369
|
+
getPostOptions(integrationName: string): IntegrationConnectInput[];
|
|
370
|
+
/**
|
|
371
|
+
* fetch dynamic field mapping options (object types or integration fields)
|
|
372
|
+
*/
|
|
373
|
+
_fetchBYOFieldMappingOptions(action: string, mappingType: DynamicFieldMappingLoaderType, mappingKey: string, params?: {
|
|
374
|
+
objectType?: string;
|
|
375
|
+
cursor?: string;
|
|
376
|
+
search?: string;
|
|
377
|
+
}): Promise<DynamicFieldMappingOptionsResult>;
|
|
378
|
+
}
|
|
379
|
+
export declare class InstallFlow {
|
|
380
|
+
private readonly paragon;
|
|
381
|
+
private integrationName;
|
|
382
|
+
private accountType;
|
|
383
|
+
private preOptions;
|
|
384
|
+
private postOptions;
|
|
385
|
+
private credentialId;
|
|
386
|
+
private onNext;
|
|
387
|
+
private onComplete;
|
|
388
|
+
constructor(paragon: ConnectSDK);
|
|
389
|
+
start(integrationName: string, startOptions?: StartOptions): Promise<void | undefined>;
|
|
390
|
+
getScheme(): null | AuthenticationScheme;
|
|
391
|
+
private getSelectedAccountTypeOption;
|
|
392
|
+
private requiresAccountType;
|
|
393
|
+
private requiresPreOptions;
|
|
394
|
+
private requiresPostOptions;
|
|
395
|
+
setAccountType(accountType: string, onError: (error: unknown) => void): void;
|
|
396
|
+
setPreOptions(options: Record<string, ConnectInputValue>, onError: (error: unknown) => void): void;
|
|
397
|
+
setPostOptions(options: Record<string, ConnectInputValue>, onError: (error: unknown) => void): void;
|
|
398
|
+
getAccountType(): string | null;
|
|
399
|
+
getPreOptions(): Record<string, ConnectInputValue> | null;
|
|
400
|
+
getPostOptions(): Record<string, ConnectInputValue> | null;
|
|
401
|
+
next(): InstallFlowStage;
|
|
271
402
|
}
|
|
403
|
+
type AccountTypeStage = {
|
|
404
|
+
stage: 'accountType';
|
|
405
|
+
options: AccountType[];
|
|
406
|
+
done: false;
|
|
407
|
+
};
|
|
408
|
+
type PreOptionsStage = {
|
|
409
|
+
stage: 'preOptions';
|
|
410
|
+
options: IntegrationConnectInput[];
|
|
411
|
+
done: false;
|
|
412
|
+
};
|
|
413
|
+
type PostOptionsStage = {
|
|
414
|
+
stage: 'postOptions';
|
|
415
|
+
options: IntegrationConnectInput[];
|
|
416
|
+
done: false;
|
|
417
|
+
};
|
|
418
|
+
type DoneStage = {
|
|
419
|
+
stage: 'done';
|
|
420
|
+
done: true;
|
|
421
|
+
};
|
|
422
|
+
type InstallFlowStage = AccountTypeStage | PreOptionsStage | PostOptionsStage | DoneStage;
|
|
423
|
+
type StartOptions = {
|
|
424
|
+
onComplete?: VoidFunction;
|
|
425
|
+
onNext?: (nextState: InstallFlowStage) => void;
|
|
426
|
+
};
|