@useparagon/connect
Advanced tools
Comparing version 1.0.24-experimental.9 to 1.0.24-experimental.11
import { IConnectCredential } from './entities/connectCredential.interface'; | ||
import { IConnectCredentialConfig } from './entities/connectCredentialConfig.interface'; | ||
import { OauthCallbackResponse } from './entities/credential.interface'; | ||
@@ -9,3 +8,3 @@ import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from './entities/integration.interface'; | ||
import { ConnectSdkEnvironments } from './server.types'; | ||
import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DeleteConfigurationOptions, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, IntegrationInstallEvent, LoadCustomDropdownOptionsResult, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions } from './types'; | ||
import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, TriggerWorkflowRequest, UninstallOptions } from './types'; | ||
export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE"; | ||
@@ -61,3 +60,3 @@ export { ExternalFilePicker }; | ||
* checks | ||
* - if integration name is valid | ||
* - if integartion name is valid | ||
* - if integration is setup in project | ||
@@ -124,5 +123,3 @@ * - if integration is active in project | ||
*/ | ||
connect(action: string, params?: ConnectParams): Promise<IntegrationInstallEvent>; | ||
private setCredentialConfigForUserState; | ||
private getCredentialAndConfig; | ||
connect(action: string, params?: ConnectParams): Promise<void>; | ||
/** | ||
@@ -136,8 +133,3 @@ * Retrieves an integration object from the loaded integrations based on the integration ID. | ||
_oauthErrorCallback(errorMessage: string | object, event?: MessageEvent): Promise<void>; | ||
customDropdownOptionsLoaders: Record<string, (cursor?: string | undefined, search?: string | undefined) => LoadCustomDropdownOptionsResult>; | ||
/** | ||
* Display the Paragon Connect modal | ||
*/ | ||
_loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult; | ||
/** | ||
* Send a Connect API request. Automatically handles authorization and errors. | ||
@@ -168,3 +160,3 @@ * | ||
}): Promise<TResponse | undefined>; | ||
event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>; | ||
event(name: string, payload: Record<string, unknown>): Promise<void>; | ||
/** | ||
@@ -202,7 +194,7 @@ * @summary this will be called to close the modal | ||
*/ | ||
workflow(workflowId: string, { selectedCredentialId, selectedConfigurationId, body, query, headers, }?: TriggerWorkflowRequest): Promise<object | undefined>; | ||
workflow(workflowId: string, { selectedCredentialId, body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>; | ||
/** | ||
* for programmatically installing an integration | ||
*/ | ||
installIntegration(action: string, params?: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>; | ||
installIntegration(action: string, params?: InstallIntegrationOptions): Promise<void>; | ||
/** | ||
@@ -214,3 +206,2 @@ * gates headless feature to pro and enterprise users | ||
disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>; | ||
enableWorkflow(workflowId: string, options?: CredentialConfigOptions): Promise<void>; | ||
/** | ||
@@ -224,2 +215,6 @@ * Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options. | ||
/** | ||
* also returns false if unable to find workflow in configured workflow property of any integration | ||
*/ | ||
private isWorkflowEnabled; | ||
/** | ||
* gets the user data from api `/sdk/me` | ||
@@ -266,14 +261,3 @@ */ | ||
connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>; | ||
/** | ||
* Creates a new configuration using the provided credentials. | ||
* @param {CreateConfigurationOptions} param0 | ||
* @returns {Promise<IConnectCredentialConfig> } | ||
*/ | ||
createConfiguration({ credentialId, externalId, }: CreateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
/** | ||
* Destroys an existing configuration using the provided instance ID. | ||
*/ | ||
destroyConfiguration({ id, credentialId }: DeleteConfigurationOptions): Promise<void>; | ||
updateConfiguration({ id, credentialId, meta, }: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
private pollForCredential; | ||
} |
export declare const ACTION_CUSTOM = "custom"; | ||
export declare const INSUFFICIENT_PERMISSION: string; |
@@ -10,4 +10,4 @@ import { SDKConnectCredentialConfig } from '../types/connect'; | ||
*/ | ||
config?: SDKConnectCredentialConfig; | ||
configurations: IConnectCredentialConfig[]; | ||
config: SDKConnectCredentialConfig; | ||
configurations?: IConnectCredentialConfig[]; | ||
personaId: string; | ||
@@ -14,0 +14,0 @@ isPreviewCredential: boolean; |
@@ -6,3 +6,2 @@ import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface'; | ||
import { OrConditions } from './resolvers'; | ||
import { CredentialConfigOptions } from './sdk'; | ||
export interface SDKConnectCredentialConfig { | ||
@@ -50,5 +49,2 @@ sharedSettings?: IntegrationSharedInputStateMap; | ||
}; | ||
export type IntegrationSharedInputStateMap = { | ||
[inputId: string]: ConnectInputValue | undefined; | ||
}; | ||
export type IntegrationWorkflowState = { | ||
@@ -60,2 +56,5 @@ enabled: boolean; | ||
}; | ||
export type IntegrationSharedInputStateMap = { | ||
[inputId: string]: ConnectInputValue | undefined; | ||
}; | ||
export type ModalConfig = { | ||
@@ -187,4 +186,2 @@ /** | ||
slug: string; | ||
credentialId?: string; | ||
credentialStatus?: CredentialStatus; | ||
}; | ||
@@ -199,3 +196,3 @@ export type SDKIntegration = { | ||
allCredentials: IConnectCredential[]; | ||
allConfigurations: IConnectCredentialConfig[]; | ||
allConfigurations?: IConnectCredentialConfig[]; | ||
} & SDKConnectCredentialConfig; | ||
@@ -218,4 +215,8 @@ export type SDKIntegrationConfig = { | ||
export type SDKIntegrationState = Partial<Record<string, SDKIntegration>>; | ||
export type UninstallOptions = Pick<CredentialConfigOptions, 'selectedCredentialId'>; | ||
export type DisableWorkflowOptions = CredentialConfigOptions; | ||
export type UninstallOptions = { | ||
selectedCredentialId?: string; | ||
}; | ||
export type DisableWorkflowOptions = { | ||
selectedCredentialId?: string; | ||
}; | ||
/** | ||
@@ -231,3 +232,2 @@ * method options for getIntegrationAccount in sdk | ||
export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential"; | ||
export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id"; | ||
export {}; |
/// <reference types="google.picker" /> | ||
import ConnectSDK from '../ConnectSDK'; | ||
import { IConnectCredential } from '../entities/connectCredential.interface'; | ||
import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface'; | ||
import { OauthCallbackResponse } from '../entities/credential.interface'; | ||
@@ -61,9 +60,2 @@ import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from '../entities/integration.interface'; | ||
}; | ||
export type LoadCustomDropdownOptionsResult = Promise<{ | ||
options: { | ||
label: string; | ||
value: string; | ||
}[]; | ||
nextPageCursor: string | null; | ||
}>; | ||
export interface IConnectSDK { | ||
@@ -88,11 +80,2 @@ authenticate(projectId: string, token: string, options?: AuthenticateOptions): Promise<void>; | ||
/** | ||
* TODO(UI/UX): Document this | ||
* TODO(UI/UX): Create type | ||
* Destroys an existing configuration using the provided instance ID. | ||
* | ||
* @param {string} cursor - An object containing the necessary parameters. | ||
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed. | ||
*/ | ||
_loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult; | ||
/** | ||
* installs an integration without the need to click on enable button from portal | ||
@@ -102,3 +85,3 @@ * Install Options: | ||
*/ | ||
installIntegration(name: string, options: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>; | ||
installIntegration(name: string, options: InstallIntegrationOptions): Promise<void>; | ||
/** | ||
@@ -112,6 +95,2 @@ * uninstalls an integration for connected user. | ||
disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>; | ||
/** | ||
* enables a workflow for the connected user and subscribe the workflows in hermes | ||
*/ | ||
enableWorkflow(workflowId: string, options: CredentialConfigOptions): Promise<void>; | ||
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>; | ||
@@ -136,3 +115,3 @@ /** | ||
*/ | ||
event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>; | ||
event(name: string, payload: Record<string, unknown>): Promise<void>; | ||
/** | ||
@@ -190,22 +169,2 @@ * makes an connect proxy action request | ||
closePortal(): void; | ||
/** | ||
* Creates a new configuration using the provided credentials. | ||
* | ||
* @param {CreateConfigurationOptions} params - An object containing the necessary parameters. | ||
* @param {string} params.credentialId - The ID of the credential to create the configuration for. | ||
* @param {string} params.externalId - (Optional) An external identifier associated with the configuration. | ||
* @returns {Promise<ICreateConfiguration>} - A promise that resolves to the created configuration object. | ||
*/ | ||
createConfiguration(params: CreateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
/** | ||
* Destroys an existing configuration using the provided instance ID. | ||
* | ||
* @param {DestroyConfigurationParams} params - An object containing the necessary parameters. | ||
* @param {string} params.id - The ID of the configuration to be destroyed. | ||
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed. | ||
*/ | ||
destroyConfiguration(params: { | ||
id: string; | ||
}): Promise<void>; | ||
updateConfiguration(dto: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
} | ||
@@ -233,2 +192,3 @@ /** | ||
allowMultipleCredentials?: boolean; | ||
selectedCredentialId?: string; | ||
/** | ||
@@ -239,19 +199,2 @@ * used to override redirect url passed in getAuthUrl instead of our passport url | ||
}; | ||
export type CredentialConfigOptions = { | ||
selectedCredentialId?: string; | ||
selectedConfigurationId?: string; | ||
}; | ||
export type CreateConfigurationOptions = { | ||
credentialId: string; | ||
externalId?: string; | ||
}; | ||
export type DeleteConfigurationOptions = { | ||
id: string; | ||
credentialId: string; | ||
}; | ||
export type UpdateConfigurationOptions = { | ||
id: string; | ||
credentialId: string; | ||
meta: Record<string, unknown>; | ||
}; | ||
export type AuthenticateOptions = { | ||
@@ -270,4 +213,2 @@ metadata?: PersonaMeta; | ||
integrationType: string; | ||
credentialId?: string; | ||
credential?: IConnectCredential | undefined; | ||
}; | ||
@@ -306,3 +247,3 @@ export type IntegrationUninstallEvent = IntegrationInstallEvent; | ||
}; | ||
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions; | ||
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions; | ||
export type EventInfo = { | ||
@@ -335,6 +276,7 @@ type: SDK_EVENT; | ||
} | ||
export type TriggerWorkflowRequest = CredentialConfigOptions & { | ||
export type TriggerWorkflowRequest = { | ||
body?: RequestInit['body'] | object; | ||
headers?: RequestInit['headers']; | ||
query?: Record<string, string>; | ||
selectedCredentialId?: string; | ||
}; | ||
@@ -341,0 +283,0 @@ export interface IFilePicker { |
@@ -14,7 +14,1 @@ import { NODE_ENV, PLATFORM_ENV } from '../types/environment'; | ||
}) => string; | ||
/** | ||
* | ||
* @param externalId | ||
* @returns | ||
*/ | ||
export declare function sanitizeExternalConfigId(externalId: string): string; |
@@ -31,4 +31,2 @@ /** | ||
export declare function sleep(milliseconds: number): Promise<void>; | ||
export declare const uuidPattern: RegExp; | ||
export declare function isUUID(value: string | unknown): boolean; | ||
/** | ||
@@ -35,0 +33,0 @@ * keeps attempting to execute a method until a desired result is achieved |
{ | ||
"name": "@useparagon/connect", | ||
"version": "1.0.24-experimental.9", | ||
"version": "1.0.24-experimental.11", | ||
"description": "Embed integrations into your app with the Paragon SDK", | ||
@@ -12,3 +12,2 @@ "main": "dist/src/index.js", | ||
"scripts": { | ||
"start:dev": "NODE_ENV=development webpack serve", | ||
"build:prod": "yarn typecheck && yarn clean && webpack --config webpack.config.js", | ||
@@ -68,3 +67,2 @@ "build:watch": "yarn build --watch", | ||
"glob": "^10.3.10", | ||
"html-webpack-plugin": "^5.6.3", | ||
"jest": "^27.0.6", | ||
@@ -74,3 +72,2 @@ "jest-fetch-mock": "useparagon/jest-fetch-mock.git#3.0.4", | ||
"jest-json-reporter2": "^1.1.0", | ||
"jsonwebtoken": "^9.0.2", | ||
"node-notifier": "^10.0.0", | ||
@@ -96,4 +93,3 @@ "nyc": "^15.1.0", | ||
"webpack-bundle-analyzer": "^4.3.0", | ||
"webpack-cli": "^5.0.2", | ||
"webpack-dev-server": "^5.1.0" | ||
"webpack-cli": "^5.0.2" | ||
}, | ||
@@ -100,0 +96,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
53
252086
49
2264