@useparagon/connect 2.2.4-experimental-15311.1 → 2.2.4-experimental-15312.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.
@@ -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, IntegrationInstallEvent, LoadCustomDropdownOptionsResult } from './sdk';
8
+ import { CredentialConfigOptions, DynamicFieldMappingConfig, IntegrationInstallEvent, LoadCustomDropdownOptionsResult } from './sdk';
9
9
  export { CredentialStatus } from '../entities/connectCredential.interface';
10
10
  export type { IntegrationMetadata } from '../entities/integration.interface';
11
11
  export * from './errors';
@@ -187,6 +187,21 @@ export type DynamicMappingOptions = {
187
187
  defaultFields?: string[];
188
188
  useBYOFieldMappingOption?: boolean;
189
189
  };
190
+ export type FieldMappingConfig = DynamicMappingField[] | DynamicMappingOptions | DynamicFieldMappingConfig;
191
+ export type FieldMappingOptionResult = {
192
+ mappingKey: string;
193
+ source: 'shared' | 'workflow';
194
+ workflowId?: string;
195
+ } & ({
196
+ type: 'static-fields';
197
+ fields: DynamicMappingField[];
198
+ } | {
199
+ type: 'static-options';
200
+ config: DynamicMappingOptions;
201
+ } | {
202
+ type: 'dynamic';
203
+ config: DynamicFieldMappingConfig;
204
+ });
190
205
  export type AuthenticatedConnectUser = {
191
206
  authenticated: true;
192
207
  token: string;
@@ -220,6 +235,9 @@ export type SDKIntegrationConfig = {
220
235
  dataSources: {
221
236
  [key: string]: DataSource;
222
237
  };
238
+ authSchemeOptions?: {
239
+ packageInstallUrl?: string;
240
+ };
223
241
  };
224
242
  /**
225
243
  * The contents of the `integrations` field for an authenticated ConnectUser.
@@ -245,11 +263,35 @@ export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
245
263
  export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
246
264
  export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id";
247
265
  export declare const SDK_VERSION_HEADER = "X-Paragon-SDK-Version";
266
+ export type Link = {
267
+ label: string;
268
+ type: 'link';
269
+ href: string;
270
+ };
271
+ export type FinishButton = {
272
+ type: 'finishButton';
273
+ label: string;
274
+ onClick: () => void;
275
+ };
276
+ export type CopyButton = {
277
+ label: string;
278
+ type: 'copyButton';
279
+ copyText: string;
280
+ };
281
+ export type CTA = Link | CopyButton;
248
282
  export type AccountTypeStage = {
249
283
  stage: 'accountType';
250
284
  options: AccountType[];
251
285
  done: false;
252
286
  };
287
+ export type InstructionStage = {
288
+ stage: 'instruction';
289
+ content: string;
290
+ ctas: CTA[];
291
+ finish: FinishButton;
292
+ packageInstallUrl: string;
293
+ done: false;
294
+ };
253
295
  export type PreOptionsStage = {
254
296
  stage: 'preOptions';
255
297
  options: IntegrationConnectInput[];
@@ -260,11 +302,15 @@ export type PostOptionsStage = {
260
302
  options: IntegrationConnectInput[];
261
303
  done: false;
262
304
  };
305
+ export type OAuthStage = {
306
+ stage: 'oauth';
307
+ done: false;
308
+ };
263
309
  export type DoneStage = {
264
310
  stage: 'done';
265
311
  done: true;
266
312
  };
267
- export type InstallFlowStage = AccountTypeStage | PreOptionsStage | PostOptionsStage | DoneStage;
313
+ export type InstallFlowStage = AccountTypeStage | InstructionStage | PreOptionsStage | OAuthStage | PostOptionsStage | DoneStage;
268
314
  export type OnErrorContext = {
269
315
  /**
270
316
  * The stage of the install flow that failed.
@@ -7,7 +7,7 @@ import { IConnectIntegrationWithCredentialInfo, IntegrationMetadata } from '../e
7
7
  import { PersonaMeta } from '../entities/persona.interface';
8
8
  import { IConnectUserContext } from '../helpers/ConnectUserContext';
9
9
  import { ConnectSdkEnvironments } from '../server.types';
10
- import { AuthenticatedConnectUser, CustomDropdownField, CustomDropdownOptions, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, UninstallOptions } from '../types/connect';
10
+ import { AuthenticatedConnectUser, CustomDropdownField, CustomDropdownOptions, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, FieldMappingConfig, FieldMappingOptionResult, GetIntegrationAccountOptions, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, UninstallOptions } from '../types/connect';
11
11
  import { DataSource, DynamicDefaultInput, EnumInputValue } from './action';
12
12
  import { Props as ConnectModalProps } from './connectModal';
13
13
  import { DataType, KeyedSource } from './resolvers';
@@ -293,7 +293,10 @@ export interface IConnectSDK {
293
293
  getDataSourceOptions(integrationName: string, action: string): Promise<DataSource | undefined>;
294
294
  setCustomDropdownOptions(action: string, dropdowns: Record<string, CustomDropdownField[] | CustomDropdownOptions>): void;
295
295
  getCustomDropdownOptions(action: string, fieldKey?: string): CustomDropdownOptionResult[];
296
+ setFieldMappingOptions(action: string, fieldMappings: Record<string, FieldMappingConfig>): void;
297
+ getFieldMappingOptions(action: string, mappingKey?: string): FieldMappingOptionResult[];
296
298
  installFlow: InstallFlow;
299
+ getAssetUrl(name: string): string;
297
300
  }
298
301
  /**
299
302
  * sdk install options
@@ -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.4-experimental-15311.1",
3
+ "version": "2.2.4-experimental-15312.2",
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",