@useparagon/connect 2.2.2-experimental.2 → 2.2.3-experimental.1

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,9 @@ export type AccountType = {
399
399
  */
400
400
  skipPostOAuthInputs?: boolean;
401
401
  };
402
+ export type InstructionMetadata = Pick<InstructionStage, 'content' | 'ctas' | 'finish' | 'packageInstallUrl'>;
403
+ export declare const INTEGRATION_INSTRUCTION_METADATA: Record<string, InstructionMetadata | {
404
+ default?: InstructionMetadata;
405
+ accountTypes?: Record<string, InstructionMetadata>;
406
+ }>;
402
407
  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, IntegrationInstallEvent } from './sdk';
8
+ import { CredentialConfigOptions } 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,7 @@ export type SDKIntegrationConfig = {
217
217
  dataSources: {
218
218
  [key: string]: DataSource;
219
219
  };
220
+ allowedCredentialValues?: Record<string, any>;
220
221
  };
221
222
  /**
222
223
  * The contents of the `integrations` field for an authenticated ConnectUser.
@@ -242,11 +243,32 @@ export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
242
243
  export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
243
244
  export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id";
244
245
  export declare const SDK_VERSION_HEADER = "X-Paragon-SDK-Version";
246
+ export type Link = {
247
+ label: string;
248
+ type: 'link';
249
+ };
250
+ export type FinishButton = {
251
+ type: 'finishButton';
252
+ label: string;
253
+ };
254
+ export type CopyButton = {
255
+ label: string;
256
+ type: 'copyButton';
257
+ };
258
+ export type CTA = Link | CopyButton;
245
259
  export type AccountTypeStage = {
246
260
  stage: 'accountType';
247
261
  options: AccountType[];
248
262
  done: false;
249
263
  };
264
+ export type InstructionStage = {
265
+ stage: 'instruction';
266
+ content: string;
267
+ ctas: CTA[];
268
+ finish?: FinishButton;
269
+ packageInstallUrl: string;
270
+ done: false;
271
+ };
250
272
  export type PreOptionsStage = {
251
273
  stage: 'preOptions';
252
274
  options: IntegrationConnectInput[];
@@ -257,11 +279,15 @@ export type PostOptionsStage = {
257
279
  options: IntegrationConnectInput[];
258
280
  done: false;
259
281
  };
282
+ export type OAuthStage = {
283
+ stage: 'oauth';
284
+ done: false;
285
+ };
260
286
  export type DoneStage = {
261
287
  stage: 'done';
262
288
  done: true;
263
289
  };
264
- export type InstallFlowStage = AccountTypeStage | PreOptionsStage | PostOptionsStage | DoneStage;
290
+ export type InstallFlowStage = AccountTypeStage | InstructionStage | PreOptionsStage | OAuthStage | PostOptionsStage | DoneStage;
265
291
  export type OnErrorContext = {
266
292
  /**
267
293
  * The stage of the install flow that failed.
@@ -272,7 +298,7 @@ export type StartOptions = {
272
298
  /**
273
299
  * Callback to be called when the installation is complete
274
300
  */
275
- onComplete?: (installationEvent: IntegrationInstallEvent) => void;
301
+ onComplete?: VoidFunction;
276
302
  onNext?: (nextState: InstallFlowStage) => void;
277
303
  /**
278
304
  * Callback to be called when the installation fails.
@@ -294,7 +320,4 @@ export type StartOptions = {
294
320
  * Closes the popup and raises an error if the flow is not completed within the given timeout.
295
321
  */
296
322
  oauthTimeout?: number;
297
- allowMultipleCredentials?: boolean;
298
- overrideRedirectUrl?: string;
299
- selectedCredentialId?: string;
300
323
  };
@@ -1,11 +1,12 @@
1
1
  /// <reference types="google.picker" />
2
- import ConnectSDK, { InstallFlow } from '../ConnectSDK';
2
+ import ConnectSDK from '../ConnectSDK';
3
3
  import { IConnectCredential } from '../entities/connectCredential.interface';
4
4
  import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
5
5
  import { OauthCallbackResponse } from '../entities/credential.interface';
6
6
  import { IConnectIntegrationWithCredentialInfo, IntegrationMetadata } from '../entities/integration.interface';
7
7
  import { PersonaMeta } from '../entities/persona.interface';
8
8
  import { IConnectUserContext } from '../helpers/ConnectUserContext';
9
+ import { InstallFlow } from '../InstallFlow';
9
10
  import { ConnectSdkEnvironments } from '../server.types';
10
11
  import { AuthenticatedConnectUser, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, UninstallOptions } from '../types/connect';
11
12
  import { DataSource, DynamicDefaultInput, EnumInputValue } from './action';
@@ -118,7 +119,7 @@ export interface IConnectSDK {
118
119
  * Invoked by the OAuth popup after finishing the credential exchange.
119
120
  * @private
120
121
  */
121
- _oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<IntegrationInstallEvent | undefined>;
122
+ _oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<void>;
122
123
  /**
123
124
  * **Do not call this function directly.**
124
125
  *
@@ -262,7 +263,7 @@ export interface IConnectSDK {
262
263
  getPreOptions(params: string): any;
263
264
  getPostOptions(params: string): any;
264
265
  startOAuthFlow(action: string, apiInstallationOptions: InstallOptions & CredentialConfigOptions, options?: {
265
- onSuccess?: (installationEvent: IntegrationInstallEvent) => void;
266
+ onSuccess?: (connectCredentialId: string) => void;
266
267
  onError?: (error: unknown) => void;
267
268
  }): void;
268
269
  getFieldOptions(options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "2.2.2-experimental.2",
3
+ "version": "2.2.3-experimental.1",
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",