@useparagon/connect 2.2.3-experimental.3 → 2.2.4-experimental-15312.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, InstructionStage, SidebarInput } from './connect';
3
+ import { CustomDropdownField, DynamicMappingField, DynamicMappingOptions, SidebarInput } from './connect';
4
4
  import { DataType, KeyedSource, Source } from './resolvers';
5
5
  export declare enum SidebarInputType {
6
6
  Auth = "AUTH",
@@ -399,5 +399,4 @@ export type AccountType = {
399
399
  */
400
400
  skipPostOAuthInputs?: boolean;
401
401
  };
402
- export type InstructionMetadata = Pick<InstructionStage, 'content' | 'ctas' | 'finish' | 'packageInstallUrl'>;
403
402
  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, 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';
@@ -173,6 +173,9 @@ export type CustomDropdownField = {
173
173
  label: string;
174
174
  value: string;
175
175
  };
176
+ export type CustomDropdownOptions = {
177
+ loadOptions: (cursor: string | undefined, search: string | undefined) => LoadCustomDropdownOptionsResult;
178
+ };
176
179
  export type DynamicMappingField = {
177
180
  label: string;
178
181
  value: string;
@@ -184,6 +187,21 @@ export type DynamicMappingOptions = {
184
187
  defaultFields?: string[];
185
188
  useBYOFieldMappingOption?: boolean;
186
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
+ });
187
205
  export type AuthenticatedConnectUser = {
188
206
  authenticated: true;
189
207
  token: string;
@@ -217,9 +235,6 @@ export type SDKIntegrationConfig = {
217
235
  dataSources: {
218
236
  [key: string]: DataSource;
219
237
  };
220
- authSchemeOptions?: {
221
- packageInstallUrl?: string;
222
- };
223
238
  };
224
239
  /**
225
240
  * The contents of the `integrations` field for an authenticated ConnectUser.
@@ -245,35 +260,11 @@ export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
245
260
  export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
246
261
  export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id";
247
262
  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;
264
263
  export type AccountTypeStage = {
265
264
  stage: 'accountType';
266
265
  options: AccountType[];
267
266
  done: false;
268
267
  };
269
- export type InstructionStage = {
270
- stage: 'instruction';
271
- content: string;
272
- ctas: CTA[];
273
- finish: FinishButton;
274
- packageInstallUrl: string;
275
- done: false;
276
- };
277
268
  export type PreOptionsStage = {
278
269
  stage: 'preOptions';
279
270
  options: IntegrationConnectInput[];
@@ -284,15 +275,11 @@ export type PostOptionsStage = {
284
275
  options: IntegrationConnectInput[];
285
276
  done: false;
286
277
  };
287
- export type OAuthStage = {
288
- stage: 'oauth';
289
- done: false;
290
- };
291
278
  export type DoneStage = {
292
279
  stage: 'done';
293
280
  done: true;
294
281
  };
295
- export type InstallFlowStage = AccountTypeStage | InstructionStage | PreOptionsStage | OAuthStage | PostOptionsStage | DoneStage;
282
+ export type InstallFlowStage = AccountTypeStage | PreOptionsStage | PostOptionsStage | DoneStage;
296
283
  export type OnErrorContext = {
297
284
  /**
298
285
  * 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, 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';
@@ -72,6 +72,20 @@ export type LoadCustomDropdownOptionsResult = Promise<{
72
72
  }[];
73
73
  nextPageCursor: string | null;
74
74
  }>;
75
+ export type CustomDropdownOptionResult = {
76
+ fieldKey: string;
77
+ source: 'shared' | 'workflow';
78
+ workflowId?: string;
79
+ } & ({
80
+ type: 'static';
81
+ options: Array<{
82
+ label: string;
83
+ value: string;
84
+ }>;
85
+ } | {
86
+ type: 'dynamic';
87
+ loadOptions: (cursor?: string, search?: string) => LoadCustomDropdownOptionsResult;
88
+ });
75
89
  export type DynamicFieldMappingOptionsResult = {
76
90
  options: {
77
91
  label: string;
@@ -277,8 +291,11 @@ export interface IConnectSDK {
277
291
  nextPageCursor: string | null;
278
292
  }>;
279
293
  getDataSourceOptions(integrationName: string, action: string): Promise<DataSource | undefined>;
294
+ setCustomDropdownOptions(action: string, dropdowns: Record<string, CustomDropdownField[] | CustomDropdownOptions>): void;
295
+ getCustomDropdownOptions(action: string, fieldKey?: string): CustomDropdownOptionResult[];
296
+ setFieldMappingOptions(action: string, fieldMappings: Record<string, FieldMappingConfig>): void;
297
+ getFieldMappingOptions(action: string, mappingKey?: string): FieldMappingOptionResult[];
280
298
  installFlow: InstallFlow;
281
- getAssetUrl(name: string): string;
282
299
  }
283
300
  /**
284
301
  * sdk install options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "2.2.3-experimental.3",
3
+ "version": "2.2.4-experimental-15312.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",
@@ -1 +0,0 @@
1
- export declare function dedent(str: string): string;