@useparagon/connect 1.0.1-experimental → 1.0.1-experimental.1.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.
- package/README.md +1 -1
- package/dist/src/ConnectSDK.d.ts +54 -10
- package/dist/src/entities/connectCredential.interface.d.ts +4 -0
- package/dist/src/entities/integration.interface.d.ts +12 -0
- package/dist/src/file-picker/integrations/googledrive.d.ts +24 -0
- package/dist/src/file-picker/integrations/index.d.ts +5 -0
- package/dist/src/file-picker/types/baseFilePicker.d.ts +32 -0
- package/dist/src/file-picker/types/externalFilePicker.d.ts +9 -0
- package/dist/src/file-picker/types/index.d.ts +1 -0
- package/dist/src/helpers/index.d.ts +14 -0
- package/dist/src/helpers/oauth.d.ts +11 -21
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.js +2 -4387
- package/dist/src/index.js.LICENSE.txt +14 -0
- package/dist/src/types/action.d.ts +21 -7
- package/dist/src/types/connect.d.ts +34 -9
- package/dist/src/types/connectModal.d.ts +7 -1
- package/dist/src/types/index.d.ts +0 -1
- package/dist/src/types/sdk.d.ts +74 -6
- package/dist/src/utils/http.d.ts +36 -0
- package/package.json +24 -8
- package/changelog.md +0 -4
- package/dist/src/types/oauth.d.ts +0 -3
package/README.md
CHANGED
|
@@ -41,4 +41,4 @@ paragon.connect('salesforce');
|
|
|
41
41
|
|
|
42
42
|
To start using the Paragon SDK, you will need to [sign up and register for an account](https://dashboard.useparagon.com/signup).
|
|
43
43
|
|
|
44
|
-
For details on getting started and a reference on all available SDK functions, please see [our documentation](https://docs.useparagon.com/getting-started/introduction).
|
|
44
|
+
For details on getting started and a reference on all available SDK functions, please see [our documentation](https://docs.useparagon.com/getting-started/introduction).
|
package/dist/src/ConnectSDK.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OauthCallbackResponse } from './entities/credential.interface';
|
|
2
|
-
import { IIntegrationMetadata } from './entities/integration.interface';
|
|
2
|
+
import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from './entities/integration.interface';
|
|
3
3
|
import { PersonaMeta } from './entities/persona.interface';
|
|
4
4
|
import SDKEventEmitter from './SDKEventEmitter';
|
|
5
|
-
import { AuthenticateOptions, AuthenticatedConnectUser, Props as ConnectModalProps, ConnectParams, ConnectUser, EventInfo, IConnectSDK, InstallOptions, TriggerWorkflowRequest } from './types';
|
|
5
|
+
import { AuthenticateOptions, AuthenticatedConnectUser, CallbackMap, Props as ConnectModalProps, ConnectParams, ConnectUser, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallOptions, TriggerWorkflowRequest, UninstallOptions } from './types';
|
|
6
6
|
export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE";
|
|
7
7
|
export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
8
8
|
root: HTMLIFrameElement | undefined;
|
|
@@ -34,7 +34,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
34
34
|
* so that we will be able to know whether style is added in body or not
|
|
35
35
|
*/
|
|
36
36
|
private originalBodyOverflow;
|
|
37
|
-
private configs;
|
|
38
37
|
constructor();
|
|
39
38
|
/**
|
|
40
39
|
* post message handler
|
|
@@ -43,7 +42,24 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
43
42
|
private eventMessageHandler;
|
|
44
43
|
private functionInvocationHandler;
|
|
45
44
|
private createReactRoot;
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* checks
|
|
47
|
+
* - if integartion name is valid
|
|
48
|
+
* - if integration is setup in project
|
|
49
|
+
* - if integration is active in project
|
|
50
|
+
* throws error if any of these is not met
|
|
51
|
+
* @param action
|
|
52
|
+
* @param validateIsEnabled boolean
|
|
53
|
+
*/
|
|
54
|
+
validateAction(action: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* checks if the integration is installed.
|
|
57
|
+
* Assumes that the user is authenticated
|
|
58
|
+
* @param action
|
|
59
|
+
* @param userState
|
|
60
|
+
* @returns boolean value
|
|
61
|
+
*/
|
|
62
|
+
private isAlreadyInstalled;
|
|
47
63
|
private bootstrapSDKState;
|
|
48
64
|
setModalState(statePartial: Partial<ConnectModalProps>): void;
|
|
49
65
|
/**
|
|
@@ -92,8 +108,14 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
92
108
|
* Display the Paragon Connect modal
|
|
93
109
|
*/
|
|
94
110
|
_connect(action: string, params?: ConnectParams & InstallOptions): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves an integration object from the loaded integrations based on the integration ID.
|
|
113
|
+
* @param integrationId The ID of the integration to retrieve.
|
|
114
|
+
* @returns The integration object if found, otherwise undefined.
|
|
115
|
+
*/
|
|
116
|
+
_getIntegration(integrationId: string): IConnectIntegrationWithCredentialInfo | undefined;
|
|
95
117
|
_oauthCallback(oauthResponse: OauthCallbackResponse, credentialId?: string): Promise<void>;
|
|
96
|
-
_oauthErrorCallback(errorMessage: string | object): Promise<void>;
|
|
118
|
+
_oauthErrorCallback(errorMessage: string | object, event?: MessageEvent): Promise<void>;
|
|
97
119
|
/**
|
|
98
120
|
* Send a Connect API request. Automatically handles authorization and errors.
|
|
99
121
|
*
|
|
@@ -114,6 +136,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
114
136
|
* @returns api request response
|
|
115
137
|
*/
|
|
116
138
|
request<TResponse>(action: string, path: string, init: {
|
|
139
|
+
selectedCredentialId?: string;
|
|
117
140
|
method: RequestInit['method'];
|
|
118
141
|
body: RequestInit['body'] | object;
|
|
119
142
|
headers: RequestInit['headers'];
|
|
@@ -147,17 +170,23 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
147
170
|
* @param workflowId
|
|
148
171
|
* @param payload
|
|
149
172
|
*/
|
|
150
|
-
workflow(workflowId: string, { body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>;
|
|
173
|
+
workflow(workflowId: string, { selectedCredentialId, body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>;
|
|
151
174
|
/**
|
|
152
175
|
* for programmatically installing an integration
|
|
153
176
|
*/
|
|
154
|
-
installIntegration(action: string, params?: Partial<Omit<InstallOptions, 'isApiInstallation'>>): Promise<void>;
|
|
177
|
+
installIntegration(action: string, params?: Partial<Omit<InstallOptions, 'isApiInstallation'> & Omit<CallbackMap, 'onOpen' | 'onClose'>>): Promise<void>;
|
|
155
178
|
/**
|
|
156
179
|
* gates headless feature to pro and enterprise users
|
|
157
180
|
*/
|
|
158
181
|
ensureHeadlessIsSupported(): void;
|
|
159
|
-
uninstallIntegration(action: string): Promise<void>;
|
|
160
|
-
disableWorkflow(workflowId: string): Promise<void>;
|
|
182
|
+
uninstallIntegration(action: string, options?: UninstallOptions): Promise<void>;
|
|
183
|
+
disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options.
|
|
186
|
+
* Note that accountAuth is allowed for only some of the integrations.
|
|
187
|
+
*/
|
|
188
|
+
getIntegrationAccount(integrationType: string, options?: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
|
|
189
|
+
private getIntegrationForWorkflow;
|
|
161
190
|
private updateLocalState;
|
|
162
191
|
/**
|
|
163
192
|
* also returns false if unable to find workflow in configured workflow property of any integration
|
|
@@ -178,7 +207,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
178
207
|
*/
|
|
179
208
|
private updateIntegrations;
|
|
180
209
|
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
|
|
181
|
-
getIntegrationConfigs(actionNames: string[]): Promise<void>;
|
|
182
210
|
/**
|
|
183
211
|
* @param {host: string;} domain
|
|
184
212
|
* sets the domain for making http service request
|
|
@@ -187,4 +215,20 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
|
|
|
187
215
|
configureGlobal(param: {
|
|
188
216
|
host: string;
|
|
189
217
|
}): void;
|
|
218
|
+
/**
|
|
219
|
+
* some integration required flow in which user recieve authorization code
|
|
220
|
+
* from marketplace oauth flow , so needed this method see PARA-8385
|
|
221
|
+
*/
|
|
222
|
+
completeInstall(action: string, options: {
|
|
223
|
+
authorizationCode: string;
|
|
224
|
+
showPortalAfterInstall?: boolean;
|
|
225
|
+
redirectUrl?: string;
|
|
226
|
+
integrationOptions?: Record<string, unknown>;
|
|
227
|
+
}): Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* update credential data in integration
|
|
230
|
+
* @param newCredential
|
|
231
|
+
* @param integration
|
|
232
|
+
*/
|
|
233
|
+
private updateCredentialData;
|
|
190
234
|
}
|
|
@@ -33,6 +33,10 @@ export interface IConnectCredential {
|
|
|
33
33
|
project?: IProject;
|
|
34
34
|
integration?: IConnectIntegration;
|
|
35
35
|
persona?: IPersona;
|
|
36
|
+
/**
|
|
37
|
+
* accountAuth contains the decrypted oauth access token. This property will only be available for some of integrations
|
|
38
|
+
*/
|
|
39
|
+
accountAuth?: Record<string, string>;
|
|
36
40
|
}
|
|
37
41
|
export type ConnectCredentialProviderData = Record<string, string | number | boolean>;
|
|
38
42
|
export declare enum CredentialStatus {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SDKIntegrationConfig } from '../types/connect';
|
|
1
2
|
import { ICustomIntegration } from './customIntegration.interface';
|
|
2
3
|
import { IConnectIntegrationConfig } from './integrationConfig.interface';
|
|
3
4
|
import { IWorkflowBase } from './workflow.interface';
|
|
@@ -30,4 +31,15 @@ export interface IConnectIntegrationWithCredentialInfo extends IConnectIntegrati
|
|
|
30
31
|
hasCredential: boolean;
|
|
31
32
|
connectedUserLimitOnDevCred: number;
|
|
32
33
|
connectedUserLimitReached: boolean;
|
|
34
|
+
needPreOauthInputs: boolean;
|
|
35
|
+
name: string;
|
|
36
|
+
brandColor: string;
|
|
37
|
+
/**
|
|
38
|
+
* accountAuth contains the decrypted oauth access token. This property will only be available for some of integrations
|
|
39
|
+
*/
|
|
40
|
+
accountAuth?: Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* sdkIntegrationConfig on a integration is available only for those which are active
|
|
43
|
+
*/
|
|
44
|
+
sdkIntegrationConfig?: SDKIntegrationConfig | null;
|
|
33
45
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="google.picker" />
|
|
2
|
+
import ConnectSDK from '../../ConnectSDK';
|
|
3
|
+
import { FilePickerInitOptions, FilePickerOptions } from '../../types';
|
|
4
|
+
import { BaseFilePicker } from '../types/baseFilePicker';
|
|
5
|
+
export declare class GoogleDriveFilePicker extends BaseFilePicker {
|
|
6
|
+
private dependencyStatus;
|
|
7
|
+
private accessToken;
|
|
8
|
+
protected instance: google.picker.Picker;
|
|
9
|
+
constructor(options: FilePickerOptions, connectSDKInstance: ConnectSDK);
|
|
10
|
+
private get google();
|
|
11
|
+
getInstance(): google.picker.Picker | null;
|
|
12
|
+
open(): boolean;
|
|
13
|
+
init(options: FilePickerInitOptions): Promise<boolean>;
|
|
14
|
+
protected onScriptLoaded(): void;
|
|
15
|
+
protected onScriptError(): void;
|
|
16
|
+
/**
|
|
17
|
+
* triggers when gapi.load('picker') loads picker successfully
|
|
18
|
+
* */
|
|
19
|
+
private onPickerLoaded;
|
|
20
|
+
/**
|
|
21
|
+
* triggers when user interacts with google file picker modal
|
|
22
|
+
* */
|
|
23
|
+
private pickerCallback;
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ConnectSDK from '../../ConnectSDK';
|
|
2
|
+
import { FilePickerInitOptions, FilePickerOptions, IFilePicker } from '../../types';
|
|
3
|
+
import { DeferredPromise } from '../../utils/generic';
|
|
4
|
+
export declare abstract class BaseFilePicker implements IFilePicker {
|
|
5
|
+
protected instance: unknown;
|
|
6
|
+
protected options: FilePickerOptions;
|
|
7
|
+
protected initOptions: FilePickerInitOptions;
|
|
8
|
+
abstract open(): boolean;
|
|
9
|
+
abstract init(options: FilePickerInitOptions): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* to be initialised inside {init} method
|
|
12
|
+
* */
|
|
13
|
+
protected dependenciesPromise: DeferredPromise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* bind to the script tag
|
|
16
|
+
*/
|
|
17
|
+
protected abstract onScriptLoaded(): void;
|
|
18
|
+
/**
|
|
19
|
+
* bind to the script tag
|
|
20
|
+
*/
|
|
21
|
+
protected abstract onScriptError(): void;
|
|
22
|
+
protected connectSDKInstance: ConnectSDK;
|
|
23
|
+
constructor(options: FilePickerOptions, connectSDKInstance: ConnectSDK);
|
|
24
|
+
protected initialiseDependencyPromise(): void;
|
|
25
|
+
getInstance(): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* to append script in body
|
|
28
|
+
*/
|
|
29
|
+
protected injectScript(url: string): void;
|
|
30
|
+
protected checkIfScriptLoaded(id: string): boolean;
|
|
31
|
+
protected validateInitOptions(options: FilePickerInitOptions): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ConnectSDK from '../../ConnectSDK';
|
|
2
|
+
import { ExternalFilePickerConstruct, FilePickerInitOptions, FilePickerOptions, IFilePicker } from '../../types';
|
|
3
|
+
export default class ExternalFilePicker implements IFilePicker {
|
|
4
|
+
constructor(action: string, options: FilePickerOptions, connectSingleton: ConnectSDK);
|
|
5
|
+
open(): boolean;
|
|
6
|
+
init(options: FilePickerInitOptions): Promise<boolean>;
|
|
7
|
+
getInstance(): any;
|
|
8
|
+
}
|
|
9
|
+
export declare const buildExternalFilePickerInstance: (connectSingleton: ConnectSDK) => ExternalFilePickerConstruct;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ExternalFilePicker, buildExternalFilePickerInstance, } from './externalFilePicker';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SDKIntegration } from '../types/connect';
|
|
1
2
|
import { DataType, KeyedSource } from '../types/resolvers';
|
|
2
3
|
import { NonNullUndefinedField } from '../types/sdk';
|
|
3
4
|
/**
|
|
@@ -13,3 +14,16 @@ export declare function parseKeyedSource(param: KeyedSource<DataType.ANY>[]): Re
|
|
|
13
14
|
* @returns
|
|
14
15
|
*/
|
|
15
16
|
export declare function stripUndefinedAndNull<T extends object>(obj: T): NonNullUndefinedField<T>;
|
|
17
|
+
/**
|
|
18
|
+
* provides the action state object after a credential is deleted.
|
|
19
|
+
* @param `deletedCredentialId` (string): The ID of the credential that was deleted.
|
|
20
|
+
* @param `deletedActionState` (`SDKIntegration`): The user state for the action whose credential was deleted
|
|
21
|
+
* @returns an object of type `SDKIntegration`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getActionStateForCredentialDelete: (deletedCredentialId: string, deletedActionState: SDKIntegration) => SDKIntegration;
|
|
24
|
+
/**
|
|
25
|
+
* check if string is empty or not
|
|
26
|
+
* @param value
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare const isStringEmpty: (value: unknown) => boolean;
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
import { AuthenticationScheme } from '../entities/credential.interface';
|
|
2
1
|
import { IConnectIntegrationWithCredentialInfo } from '../entities/integration.interface';
|
|
3
|
-
import { IntegrationConnectInput } from '../types/action';
|
|
4
2
|
import { DataType, KeyedSource } from '../types/resolvers';
|
|
3
|
+
import { InstallOptions } from '../types/sdk';
|
|
5
4
|
import { IConnectUserContext } from './ConnectUserContext';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @param integration
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare const shouldShowPreAuthInputs: ({ integration, authScheme, endUserSuppliedValues, isAccountTypeSupported, }: {
|
|
5
|
+
export type OAuthFlowOptions = {
|
|
6
|
+
context: IConnectUserContext;
|
|
12
7
|
integration: IConnectIntegrationWithCredentialInfo;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
endUserSuppliedValues?: {
|
|
9
|
+
[inputId: string]: string;
|
|
10
|
+
};
|
|
11
|
+
authParams?: KeyedSource<DataType.ANY>[] | undefined;
|
|
12
|
+
isPreviewMode?: boolean;
|
|
13
|
+
installOptions?: InstallOptions;
|
|
14
|
+
};
|
|
18
15
|
/**
|
|
19
16
|
* start oauth flow with new popup
|
|
20
17
|
* @param param0
|
|
21
18
|
* @returns
|
|
22
19
|
*/
|
|
23
|
-
export declare const startOAuthFlow: ({ context, integration, endUserSuppliedValues, authParams, }:
|
|
24
|
-
context: IConnectUserContext;
|
|
25
|
-
integration: IConnectIntegrationWithCredentialInfo;
|
|
26
|
-
endUserSuppliedValues?: {
|
|
27
|
-
[inputId: string]: string;
|
|
28
|
-
} | undefined;
|
|
29
|
-
authParams?: KeyedSource<DataType.ANY>[] | undefined;
|
|
30
|
-
}) => Promise<void>;
|
|
20
|
+
export declare const startOAuthFlow: ({ context, integration, endUserSuppliedValues, authParams, isPreviewMode, installOptions, }: OAuthFlowOptions) => Promise<void>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import ConnectSDK from './ConnectSDK';
|
|
2
|
-
import { IConnectSDK } from './types';
|
|
2
|
+
import { ExternalFilePickerConstruct, IConnectSDK } from './types';
|
|
3
3
|
export * from './types/index';
|
|
4
|
-
export declare const paragon: IConnectSDK
|
|
4
|
+
export declare const paragon: IConnectSDK & {
|
|
5
|
+
ExternalFilePicker: ExternalFilePickerConstruct;
|
|
6
|
+
};
|
|
5
7
|
declare const _default: {
|
|
6
8
|
ConnectSDK: typeof ConnectSDK;
|
|
7
9
|
};
|