@useparagon/connect 2.1.0-experimental.2.1 → 2.1.1-experimental-5

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.
@@ -110,6 +110,9 @@ export interface EnumInput extends BaseInput {
110
110
  export type DynamicInput<TValues = EnumInputValue[]> = BaseInput & {
111
111
  source: DynamicDataSource<TValues>;
112
112
  };
113
+ export interface FileInput extends BaseInput {
114
+ type: SidebarInputType.File;
115
+ }
113
116
  export interface DynamicEnumInput<TValues = EnumInputValue[]> extends Omit<EnumInput, 'type'>, DynamicInput<TValues> {
114
117
  type: SidebarInputType.DynamicEnum;
115
118
  source: DynamicDataSource<TValues>;
@@ -2,7 +2,7 @@ import { IConnectSDKProject } from 'src/entities/project.interface';
2
2
  import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface';
3
3
  import { ConnectCredentialConfigMeta, IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
4
4
  import { PersonaMeta } from '../entities/persona.interface';
5
- import { AccountType, BooleanInput, ComboInput, CopyableButtonInput, CustomDropdownInput, DataSource, DynamicComboInput, DynamicEnumInput, EmailInput, FieldMapperInput, IntegrationConnectInput, NumberInput, PasswordInput, PermissionInput, SidebarInputType, SwitchInput, URLInput, ValueTextInput } from './action';
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
8
  import { CredentialConfigOptions } from './sdk';
@@ -93,9 +93,9 @@ type IntegrationSharedMeta = {
93
93
  */
94
94
  inputs?: SerializedConnectInput[];
95
95
  };
96
- 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, SidebarInputType.DynamicComboInput, SidebarInputType.FieldMapper, SidebarInputType.CopyableButtonInput, SidebarInputType.Permission];
96
+ 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, SidebarInputType.DynamicComboInput, SidebarInputType.FieldMapper, SidebarInputType.CopyableButtonInput, SidebarInputType.Permission, SidebarInputType.File];
97
97
  export type SupportedConnectInputType = (typeof SupportedConnectInputTypes)[number];
98
- export type SidebarInput = BooleanInput | SwitchInput | ValueTextInput | NumberInput | EmailInput | URLInput | PasswordInput | CustomDropdownInput | DynamicEnumInput | ComboInput | DynamicComboInput | FieldMapperInput | CopyableButtonInput | PermissionInput;
98
+ export type SidebarInput = BooleanInput | SwitchInput | ValueTextInput | NumberInput | EmailInput | URLInput | PasswordInput | CustomDropdownInput | DynamicEnumInput | ComboInput | DynamicComboInput | FieldMapperInput | CopyableButtonInput | PermissionInput | FileInput;
99
99
  type SupportedConnectInput<T extends SidebarInput = SidebarInput> = Extract<T, {
100
100
  type: SupportedConnectInputType;
101
101
  }>;
@@ -287,4 +287,9 @@ export type StartOptions = {
287
287
  * ```
288
288
  */
289
289
  onError?: (error: InstallFlowError, context: null | OnErrorContext) => void;
290
+ /**
291
+ * The timeout for the OAuth flow in milliseconds.
292
+ * Closes the popup and raises an error if the flow is not completed within the given timeout.
293
+ */
294
+ oauthTimeout?: number;
290
295
  };
@@ -23,11 +23,17 @@ export type ConnectSDKError = {
23
23
  } | {
24
24
  name: 'HeadlessModeNotEnabledError';
25
25
  message: string;
26
+ } | {
27
+ name: 'OAuthBlockedError';
28
+ message: string;
29
+ } | {
30
+ name: 'OAuthTimeoutError';
31
+ message: string;
26
32
  };
27
33
  type ErrorByName<T> = Extract<ConnectSDKError, {
28
34
  name: T;
29
35
  }>;
30
- export type InstallFlowError = ErrorByName<'UserNotAuthenticatedError' | 'NoActiveInstallFlowError' | 'HeadlessModeNotEnabledError' | 'IntegrationNotFoundError' | 'UnknownError'>;
36
+ export type InstallFlowError = ErrorByName<'OAuthBlockedError' | 'OAuthTimeoutError' | 'UserNotAuthenticatedError' | 'NoActiveInstallFlowError' | 'HeadlessModeNotEnabledError' | 'IntegrationNotFoundError' | 'UnknownError'>;
31
37
  export declare class BaseSDKError extends Error {
32
38
  readonly meta: Record<string, unknown> | null;
33
39
  constructor(error: ConnectSDKError);
@@ -48,5 +54,11 @@ export declare class IntegrationNotInstalledError extends BaseSDKError {
48
54
  export declare class HeadlessModeNotEnabledError extends BaseSDKError {
49
55
  constructor();
50
56
  }
57
+ export declare class OAuthBlockedError extends BaseSDKError {
58
+ constructor();
59
+ }
60
+ export declare class OAuthTimeoutError extends BaseSDKError {
61
+ constructor();
62
+ }
51
63
  export declare function getConnectSDKError(error: unknown): ConnectSDKError;
52
64
  export {};
@@ -49,7 +49,12 @@ export type SDKFunctionErrorMessage = {
49
49
  id: string;
50
50
  };
51
51
  export type SDKReceivedMessage = SDKFunctionInvocationMessage;
52
- export type InstallIntegrationOptions = Partial<Omit<InstallOptions, 'isApiInstallation'> & Omit<CallbackMap, 'onOpen' | 'onClose'> & UserProvidedIntegrationConfig>;
52
+ export type InstallIntegrationOptions = Partial<Omit<InstallOptions, 'isApiInstallation'> & Omit<CallbackMap, 'onOpen' | 'onClose'> & UserProvidedIntegrationConfig & CredentialConfigOptions & {
53
+ /**
54
+ * OAuth timeout used only in headless mode
55
+ */
56
+ oauthTimeout?: number;
57
+ }>;
53
58
  export type CompleteInstallOptions = {
54
59
  authorizationCode: string;
55
60
  showPortalAfterInstall?: boolean;
@@ -167,9 +172,7 @@ export interface IConnectSDK {
167
172
  * @param name eventName
168
173
  * @param payload event payload object
169
174
  */
170
- event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<{
171
- executionsTriggered: string[];
172
- } | void>;
175
+ event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>;
173
176
  /**
174
177
  * makes an connect proxy action request
175
178
  * @param action actionName
@@ -371,7 +374,12 @@ export type DropdownOptions = {
371
374
  value: string;
372
375
  }>>;
373
376
  };
374
- export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions & DropdownOptions;
377
+ export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions & DropdownOptions & CredentialConfigOptions & {
378
+ /**
379
+ * OAuth timeout used only in headless mode
380
+ */
381
+ oauthTimeout?: number;
382
+ };
375
383
  export type EventInfo = {
376
384
  type: SDK_EVENT;
377
385
  integrationId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "2.1.0-experimental.2.1",
3
+ "version": "2.1.1-experimental-5",
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",