@useparagon/connect 1.0.35-experimental.1 → 1.0.35-experimental.11

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 { SidebarInput } from './connect';
3
+ import { CustomDropdownField, SidebarInput } from './connect';
4
4
  import { DataType, KeyedSource, Source } from './resolvers';
5
5
  export declare enum SidebarInputType {
6
6
  Auth = "AUTH",
@@ -14,6 +14,7 @@ export declare enum SidebarInputType {
14
14
  Code = "CODE",
15
15
  ActionButton = "ACTION_BUTTON",
16
16
  Conditional = "CONDITIONAL",
17
+ CustomDropdown = "CUSTOM_DROPDOWN",
17
18
  DynamicConditional = "DYNAMIC_CONDITIONAL",
18
19
  NestedList = "NESTED_LIST",
19
20
  File = "FILE",
@@ -55,6 +56,49 @@ interface BaseInput {
55
56
  */
56
57
  readOnly?: boolean;
57
58
  }
59
+ export interface BooleanInput extends BaseInput {
60
+ type: SidebarInputType.BooleanInput;
61
+ }
62
+ export interface ValueTextInput extends BaseInput {
63
+ type: SidebarInputType.ValueText;
64
+ inputType?: string;
65
+ }
66
+ export interface NumberInput extends BaseInput {
67
+ type: SidebarInputType.Number;
68
+ }
69
+ export interface EmailInput extends BaseInput {
70
+ type: SidebarInputType.Email;
71
+ }
72
+ export interface PasswordInput extends BaseInput {
73
+ type: SidebarInputType.Password;
74
+ }
75
+ export interface URLInput extends BaseInput {
76
+ type: SidebarInputType.URL;
77
+ }
78
+ export interface CustomDropdownInput extends BaseInput {
79
+ type: SidebarInputType.CustomDropdown;
80
+ key: string;
81
+ keyIsDefault: boolean;
82
+ customDropdownOptions?: CustomDropdownField[];
83
+ }
84
+ export interface EnumInput extends BaseInput {
85
+ type: SidebarInputType.Enum;
86
+ getValues: (options: ActionStepParameters, inputs: SidebarInput[], activeInput: SidebarInput) => EnumInputValue[];
87
+ }
88
+ export type DynamicInput<TValues = EnumInputValue[]> = BaseInput & {
89
+ source: DynamicDataSource<TValues>;
90
+ };
91
+ export interface DynamicEnumInput<TValues = EnumInputValue[]> extends Omit<EnumInput, 'type'>, DynamicInput<TValues> {
92
+ type: SidebarInputType.DynamicEnum;
93
+ source: DynamicDataSource<TValues>;
94
+ }
95
+ export interface ComboInput extends BaseInput {
96
+ type: SidebarInputType.ComboInput;
97
+ source: ComboInputDataSource;
98
+ savedFieldMappings?: {
99
+ label: string;
100
+ }[];
101
+ }
58
102
  export interface IntegrationConnectInput extends BaseInput {
59
103
  type: SidebarInputType.ValueText | SidebarInputType.Password | SidebarInputType.DynamicEnum | SidebarInputType.ComboInput | SidebarInputType.Enum | SidebarInputType.Switch | SidebarInputType.ValueTextArea;
60
104
  inputType?: string;
@@ -214,7 +258,7 @@ type FieldMapperDataSource = BasicDataSource & {
214
258
  * A ComboInputDataSource refers to a source that is able to drive an input that is responsible
215
259
  * for combining the remote/integration fields to local/project fields.
216
260
  */
217
- type ComboInputDataSource = BasicDataSource & {
261
+ export type ComboInputDataSource = BasicDataSource & {
218
262
  id: string;
219
263
  type: DataSourceType.COMBO_INPUT;
220
264
  mainInputSource: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
@@ -1,7 +1,7 @@
1
1
  import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface';
2
2
  import { ConnectCredentialConfigMeta, IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
3
3
  import { PersonaMeta } from '../entities/persona.interface';
4
- import { AccountType, DataSource, IntegrationConnectInput, SidebarInputType } from './action';
4
+ import { AccountType, BooleanInput, ComboInput, CustomDropdownInput, DataSource, DynamicEnumInput, EmailInput, IntegrationConnectInput, NumberInput, PasswordInput, SidebarInputType, URLInput, ValueTextInput } from './action';
5
5
  import { OrConditions } from './resolvers';
6
6
  import { CredentialConfigOptions } from './sdk';
7
7
  export interface SDKConnectCredentialConfig {
@@ -17,7 +17,7 @@ export interface SDKConnectCredentialConfig {
17
17
  */
18
18
  configuredWorkflows?: IntegrationWorkflowStateMap;
19
19
  }
20
- type ConnectInputValue = string | number | boolean | FieldMappingValue | ComboInputValue | undefined;
20
+ export type ConnectInputValue = string | number | boolean | FieldMappingValue | ComboInputValue | undefined;
21
21
  type FieldMappingValue = {
22
22
  objectMapping?: string;
23
23
  fieldMappings?: {
@@ -88,9 +88,9 @@ type IntegrationSharedMeta = {
88
88
  */
89
89
  inputs?: SerializedConnectInput[];
90
90
  };
91
- declare const SupportedConnectInputTypes: readonly [SidebarInputType.ValueText, SidebarInputType.DynamicEnum, SidebarInputType.Enum, SidebarInputType.Number, SidebarInputType.Email, SidebarInputType.URL, SidebarInputType.FieldMapper, SidebarInputType.BooleanInput, SidebarInputType.ComboInput, SidebarInputType.Password, SidebarInputType.Switch, SidebarInputType.ValueTextArea];
92
- type SupportedConnectInputType = (typeof SupportedConnectInputTypes)[number];
93
- export type SidebarInput = IntegrationConnectInput;
91
+ declare const SupportedConnectInputTypes: readonly [SidebarInputType.ValueText, SidebarInputType.DynamicEnum, SidebarInputType.Enum, SidebarInputType.Number, SidebarInputType.Email, SidebarInputType.URL, SidebarInputType.FieldMapper, SidebarInputType.BooleanInput, SidebarInputType.ComboInput, SidebarInputType.Password, SidebarInputType.Switch, SidebarInputType.ValueTextArea, SidebarInputType.CustomDropdown];
92
+ export type SupportedConnectInputType = (typeof SupportedConnectInputTypes)[number];
93
+ export type SidebarInput = BooleanInput | ValueTextInput | NumberInput | EmailInput | URLInput | PasswordInput | CustomDropdownInput | DynamicEnumInput | ComboInput;
94
94
  type SupportedConnectInput<T extends SidebarInput = SidebarInput> = Extract<T, {
95
95
  type: SupportedConnectInputType;
96
96
  }>;
@@ -130,6 +130,10 @@ export type IntegrationWorkflowMeta = {
130
130
  * The ID of the WorkflowEntity.
131
131
  */
132
132
  id: string;
133
+ /**
134
+ * The description of the WorkflowEntity.
135
+ */
136
+ description?: string;
133
137
  /**
134
138
  * A longer-form description for the Workflow's functionality. Acts as a "subtitle" to the
135
139
  * WorkflowEntity's `description` property.
@@ -160,6 +164,10 @@ export type IntegrationWorkflowMeta = {
160
164
  */
161
165
  permissions?: OrConditions;
162
166
  };
167
+ export type CustomDropdownField = {
168
+ label: string;
169
+ value: string;
170
+ };
163
171
  export type DynamicMappingField = {
164
172
  label: string;
165
173
  value: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.picker" />
2
- import ConnectSDK from '../ConnectSDK';
2
+ import ConnectSDK, { InstallFlow } 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';
@@ -8,7 +8,9 @@ import { PersonaMeta } from '../entities/persona.interface';
8
8
  import { IConnectUserContext } from '../helpers/ConnectUserContext';
9
9
  import { ConnectSdkEnvironments } from '../server.types';
10
10
  import { AuthenticatedConnectUser, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, UninstallOptions } from '../types/connect';
11
+ import { ComboInputDataSource } from './action';
11
12
  import { Props as ConnectModalProps } from './connectModal';
13
+ import { DataType, KeyedSource } from './resolvers';
12
14
  export type ConnectUser = {
13
15
  authenticated: false;
14
16
  } | AuthenticatedConnectUser;
@@ -202,7 +204,39 @@ export interface IConnectSDK {
202
204
  destroyConfiguration(params: DeleteConfigurationOptions): Promise<void>;
203
205
  updateConfiguration(dto: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
204
206
  getIntegrationConfig(integration: string): IntegrationConfig;
207
+ updateIntegrationUserSettings(integration: string, userSettingsUpdate: Record<string, any>, settings?: CredentialConfigOptions): Promise<{
208
+ userState: AuthenticatedConnectUser;
209
+ errors: string[];
210
+ }>;
211
+ updateWorkflowUserSettings(integration: string, workflowId: string, userSettingsUpdate: Record<string, any>, settings?: CredentialConfigOptions): Promise<{
212
+ userState: AuthenticatedConnectUser;
213
+ errors: string[];
214
+ }>;
205
215
  updateWorkflowState(workflowStateUpdate: Record<string, boolean>, options?: CredentialConfigOptions): Promise<UpdateWorkflowStateResponse>;
216
+ setHeadless(headless: boolean): void;
217
+ getIntegrationId(action: string): string;
218
+ getAccountTypeOptions(params: string): any;
219
+ getPreOptions(params: string): any;
220
+ getPostOptions(params: string): any;
221
+ startOAuthFlow(action: string, apiInstallationOptions: InstallOptions & CredentialConfigOptions, options?: {
222
+ onSuccess?: (connectCredentialId: string) => void;
223
+ onError?: (error: unknown) => void;
224
+ }): void;
225
+ getFieldOptions(options: {
226
+ integration: string;
227
+ action: string;
228
+ search?: string;
229
+ cursor?: string | number | false;
230
+ parameters: KeyedSource<DataType.ANY>[];
231
+ }): Promise<{
232
+ data: {
233
+ value: string;
234
+ label: string;
235
+ }[];
236
+ nextPageCursor: string | null;
237
+ }>;
238
+ getDataSourceOptions(integrationName: string, action: string): Promise<ComboInputDataSource>;
239
+ installFlow: InstallFlow;
206
240
  }
207
241
  /**
208
242
  * sdk install options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "1.0.35-experimental.1",
3
+ "version": "1.0.35-experimental.11",
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",