@useparagon/connect 2.2.3-experimental.2 → 2.2.3-experimental.4

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,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { AuthenticationScheme } from '../entities/credential.interface';
3
- import { CustomDropdownField, DynamicMappingField, DynamicMappingOptions, SidebarInput } from './connect';
3
+ import { CustomDropdownField, DynamicMappingField, DynamicMappingOptions, InstructionStage, SidebarInput } from './connect';
4
4
  import { DataType, KeyedSource, Source } from './resolvers';
5
5
  export declare enum SidebarInputType {
6
6
  Auth = "AUTH",
@@ -399,4 +399,5 @@ export type AccountType = {
399
399
  */
400
400
  skipPostOAuthInputs?: boolean;
401
401
  };
402
+ export type InstructionMetadata = Pick<InstructionStage, 'content' | 'ctas' | 'finish' | 'packageInstallUrl'>;
402
403
  export {};
@@ -5,7 +5,7 @@ import { PersonaMeta } from '../entities/persona.interface';
5
5
  import { AccountType, BooleanInput, ComboInput, CopyableButtonInput, CustomDropdownInput, DataSource, DynamicComboInput, DynamicEnumInput, EmailInput, FieldMapperInput, FileInput, IntegrationConnectInput, NumberInput, PasswordInput, PermissionInput, SidebarInputType, SwitchInput, URLInput, ValueTextInput } from './action';
6
6
  import { InstallFlowError } from './errors';
7
7
  import { OrConditions } from './resolvers';
8
- import { CredentialConfigOptions } from './sdk';
8
+ import { CredentialConfigOptions, IntegrationInstallEvent } from './sdk';
9
9
  export { CredentialStatus } from '../entities/connectCredential.interface';
10
10
  export type { IntegrationMetadata } from '../entities/integration.interface';
11
11
  export * from './errors';
@@ -217,6 +217,9 @@ export type SDKIntegrationConfig = {
217
217
  dataSources: {
218
218
  [key: string]: DataSource;
219
219
  };
220
+ authSchemeOptions?: {
221
+ packageInstallUrl?: string;
222
+ };
220
223
  };
221
224
  /**
222
225
  * The contents of the `integrations` field for an authenticated ConnectUser.
@@ -242,11 +245,35 @@ export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
242
245
  export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
243
246
  export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id";
244
247
  export declare const SDK_VERSION_HEADER = "X-Paragon-SDK-Version";
248
+ export type Link = {
249
+ label: string;
250
+ type: 'link';
251
+ href: string;
252
+ };
253
+ export type FinishButton = {
254
+ type: 'finishButton';
255
+ label: string;
256
+ onClick: () => void;
257
+ };
258
+ export type CopyButton = {
259
+ label: string;
260
+ type: 'copyButton';
261
+ copyText: string;
262
+ };
263
+ export type CTA = Link | CopyButton;
245
264
  export type AccountTypeStage = {
246
265
  stage: 'accountType';
247
266
  options: AccountType[];
248
267
  done: false;
249
268
  };
269
+ export type InstructionStage = {
270
+ stage: 'instruction';
271
+ content: string;
272
+ ctas: CTA[];
273
+ finish: FinishButton;
274
+ packageInstallUrl: string;
275
+ done: false;
276
+ };
250
277
  export type PreOptionsStage = {
251
278
  stage: 'preOptions';
252
279
  options: IntegrationConnectInput[];
@@ -257,11 +284,15 @@ export type PostOptionsStage = {
257
284
  options: IntegrationConnectInput[];
258
285
  done: false;
259
286
  };
287
+ export type OAuthStage = {
288
+ stage: 'oauth';
289
+ done: false;
290
+ };
260
291
  export type DoneStage = {
261
292
  stage: 'done';
262
293
  done: true;
263
294
  };
264
- export type InstallFlowStage = AccountTypeStage | PreOptionsStage | PostOptionsStage | DoneStage;
295
+ export type InstallFlowStage = AccountTypeStage | InstructionStage | PreOptionsStage | OAuthStage | PostOptionsStage | DoneStage;
265
296
  export type OnErrorContext = {
266
297
  /**
267
298
  * The stage of the install flow that failed.
@@ -272,7 +303,7 @@ export type StartOptions = {
272
303
  /**
273
304
  * Callback to be called when the installation is complete
274
305
  */
275
- onComplete?: VoidFunction;
306
+ onComplete?: (installationEvent: IntegrationInstallEvent) => void;
276
307
  onNext?: (nextState: InstallFlowStage) => void;
277
308
  /**
278
309
  * Callback to be called when the installation fails.
@@ -294,4 +325,7 @@ export type StartOptions = {
294
325
  * Closes the popup and raises an error if the flow is not completed within the given timeout.
295
326
  */
296
327
  oauthTimeout?: number;
328
+ allowMultipleCredentials?: boolean;
329
+ overrideRedirectUrl?: string;
330
+ selectedCredentialId?: string;
297
331
  };
@@ -118,7 +118,7 @@ export interface IConnectSDK {
118
118
  * Invoked by the OAuth popup after finishing the credential exchange.
119
119
  * @private
120
120
  */
121
- _oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<void>;
121
+ _oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<IntegrationInstallEvent | undefined>;
122
122
  /**
123
123
  * **Do not call this function directly.**
124
124
  *
@@ -262,7 +262,7 @@ export interface IConnectSDK {
262
262
  getPreOptions(params: string): any;
263
263
  getPostOptions(params: string): any;
264
264
  startOAuthFlow(action: string, apiInstallationOptions: InstallOptions & CredentialConfigOptions, options?: {
265
- onSuccess?: (connectCredentialId: string) => void;
265
+ onSuccess?: (installationEvent: IntegrationInstallEvent) => void;
266
266
  onError?: (error: unknown) => void;
267
267
  }): void;
268
268
  getFieldOptions(options: {
@@ -278,6 +278,7 @@ export interface IConnectSDK {
278
278
  }>;
279
279
  getDataSourceOptions(integrationName: string, action: string): Promise<DataSource | undefined>;
280
280
  installFlow: InstallFlow;
281
+ getAssetUrl(name: string): string;
281
282
  }
282
283
  /**
283
284
  * sdk install options
@@ -440,6 +441,7 @@ export type FilePickerOptions = {
440
441
  googledrive?: {
441
442
  viewMode?: google.picker.DocsViewMode;
442
443
  includeFolders?: boolean;
444
+ enableSharedDrives?: boolean;
443
445
  };
444
446
  box?: {
445
447
  container?: string;
@@ -0,0 +1 @@
1
+ export declare function dedent(str: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "2.2.3-experimental.2",
3
+ "version": "2.2.3-experimental.4",
4
4
  "description": "Embed integrations into your app with the Paragon SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",