@useparagon/connect 1.0.24-experimental.11 → 1.0.24-experimental.13

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.
Files changed (53) hide show
  1. package/dist/src/index.html +161 -0
  2. package/dist/src/index.js +5924 -2
  3. package/dist/src/sandbox/sandbox.d.ts +10 -0
  4. package/dist/src/sandbox.js +43817 -0
  5. package/dist/src/{ConnectSDK.d.ts → src/ConnectSDK.d.ts} +27 -15
  6. package/dist/src/src/constants.d.ts +2 -0
  7. package/dist/src/{entities → src/entities}/connectCredential.interface.d.ts +2 -2
  8. package/dist/src/{file-picker → src/file-picker}/integrations/index.d.ts +2 -0
  9. package/dist/src/src/file-picker/integrations/onedrive.d.ts +35 -0
  10. package/dist/src/{file-picker → src/file-picker}/types/baseFilePicker.d.ts +20 -1
  11. package/dist/src/{types → src/types}/connect.d.ts +10 -10
  12. package/dist/src/{types → src/types}/sdk.d.ts +91 -13
  13. package/dist/src/{utils → src/utils}/connect.d.ts +6 -0
  14. package/dist/src/{utils → src/utils}/generic.d.ts +2 -0
  15. package/package.json +7 -6
  16. package/sandbox/index.html +161 -0
  17. package/dist/src/ConnectSDK.js +0 -2
  18. package/dist/src/ConnectSDK.js.LICENSE.txt +0 -14
  19. package/dist/src/constants.d.ts +0 -1
  20. package/dist/src/index.js.LICENSE.txt +0 -14
  21. /package/dist/src/{SDKEventEmitter.d.ts → src/SDKEventEmitter.d.ts} +0 -0
  22. /package/dist/src/{entities → src/entities}/base.entity.d.ts +0 -0
  23. /package/dist/src/{entities → src/entities}/connectCredentialConfig.interface.d.ts +0 -0
  24. /package/dist/src/{entities → src/entities}/credential.interface.d.ts +0 -0
  25. /package/dist/src/{entities → src/entities}/customIntegration.interface.d.ts +0 -0
  26. /package/dist/src/{entities → src/entities}/integration.interface.d.ts +0 -0
  27. /package/dist/src/{entities → src/entities}/integrationConfig.interface.d.ts +0 -0
  28. /package/dist/src/{entities → src/entities}/license.interface.d.ts +0 -0
  29. /package/dist/src/{entities → src/entities}/persona.interface.d.ts +0 -0
  30. /package/dist/src/{entities → src/entities}/project.interface.d.ts +0 -0
  31. /package/dist/src/{entities → src/entities}/steps.d.ts +0 -0
  32. /package/dist/src/{entities → src/entities}/team.interface.d.ts +0 -0
  33. /package/dist/src/{entities → src/entities}/user.interface.d.ts +0 -0
  34. /package/dist/src/{entities → src/entities}/workflow.interface.d.ts +0 -0
  35. /package/dist/src/{file-picker → src/file-picker}/integrations/googledrive.d.ts +0 -0
  36. /package/dist/src/{file-picker → src/file-picker}/types/externalFilePicker.d.ts +0 -0
  37. /package/dist/src/{file-picker → src/file-picker}/types/index.d.ts +0 -0
  38. /package/dist/src/{helpers → src/helpers}/ConnectUserContext.d.ts +0 -0
  39. /package/dist/src/{helpers → src/helpers}/index.d.ts +0 -0
  40. /package/dist/src/{helpers → src/helpers}/oauth.d.ts +0 -0
  41. /package/dist/src/{index.d.ts → src/index.d.ts} +0 -0
  42. /package/dist/src/{server.types.d.ts → src/server.types.d.ts} +0 -0
  43. /package/dist/src/{types → src/types}/action.d.ts +0 -0
  44. /package/dist/src/{types → src/types}/billing.d.ts +0 -0
  45. /package/dist/src/{types → src/types}/connectModal.d.ts +0 -0
  46. /package/dist/src/{types → src/types}/environment.d.ts +0 -0
  47. /package/dist/src/{types → src/types}/execution.d.ts +0 -0
  48. /package/dist/src/{types → src/types}/index.d.ts +0 -0
  49. /package/dist/src/{types → src/types}/resolvers.d.ts +0 -0
  50. /package/dist/src/{types → src/types}/stripe.d.ts +0 -0
  51. /package/dist/src/{utils → src/utils}/crypto.d.ts +0 -0
  52. /package/dist/src/{utils → src/utils}/http.d.ts +0 -0
  53. /package/dist/src/{utils → src/utils}/throttle.d.ts +0 -0
@@ -1,13 +1,12 @@
1
1
  import { IConnectCredential } from './entities/connectCredential.interface';
2
+ import { IConnectCredentialConfig } from './entities/connectCredentialConfig.interface';
2
3
  import { OauthCallbackResponse } from './entities/credential.interface';
3
4
  import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from './entities/integration.interface';
4
5
  import { PersonaMeta } from './entities/persona.interface';
5
- import { ExternalFilePicker } from './file-picker/types';
6
6
  import SDKEventEmitter from './SDKEventEmitter';
7
7
  import { ConnectSdkEnvironments } from './server.types';
8
- import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, TriggerWorkflowRequest, UninstallOptions } from './types';
8
+ import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DeleteConfigurationOptions, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, IntegrationInstallEvent, LoadCustomDropdownOptionsResult, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions } from './types';
9
9
  export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE";
10
- export { ExternalFilePicker };
11
10
  export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
12
11
  root: HTMLIFrameElement | undefined;
13
12
  private rootLoaded;
@@ -44,9 +43,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
44
43
  * so that we will be able to know whether style is added in body or not
45
44
  */
46
45
  private originalBodyOverflow;
47
- constructor(environmentsOrHost?: ConnectSdkEnvironments | string, flags?: {
48
- skipBootstrapWithLastKnownState?: boolean;
49
- });
46
+ constructor(environments?: ConnectSdkEnvironments);
50
47
  /**
51
48
  * post message handler
52
49
  * @param event
@@ -56,7 +53,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
56
53
  private createReactRoot;
57
54
  /**
58
55
  * checks
59
- * - if integartion name is valid
56
+ * - if integration name is valid
60
57
  * - if integration is setup in project
61
58
  * - if integration is active in project
62
59
  * throws error if any of these is not met
@@ -118,7 +115,9 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
118
115
  /**
119
116
  * Display the Paragon Connect modal
120
117
  */
121
- connect(action: string, params?: ConnectParams): Promise<void>;
118
+ connect(action: string, params?: ConnectParams): Promise<IntegrationInstallEvent>;
119
+ private setCredentialConfigForUserState;
120
+ private getCredentialAndConfig;
122
121
  /**
123
122
  * Retrieves an integration object from the loaded integrations based on the integration ID.
124
123
  * @param integrationId The ID of the integration to retrieve.
@@ -127,6 +126,11 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
127
126
  _getIntegration(integrationId: string): IConnectIntegrationWithCredentialInfo | undefined;
128
127
  _oauthCallback(oauthResponse: OauthCallbackResponse, credentialId?: string): Promise<void>;
129
128
  _oauthErrorCallback(errorMessage: string | object, event?: MessageEvent): Promise<void>;
129
+ customDropdownOptionsLoaders: Record<string, (cursor?: string | undefined, search?: string | undefined) => LoadCustomDropdownOptionsResult>;
130
+ /**
131
+ * Display the Paragon Connect modal
132
+ */
133
+ _loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult;
130
134
  /**
131
135
  * Send a Connect API request. Automatically handles authorization and errors.
132
136
  *
@@ -153,7 +157,7 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
153
157
  body: RequestInit['body'] | object;
154
158
  headers: RequestInit['headers'];
155
159
  }): Promise<TResponse | undefined>;
156
- event(name: string, payload: Record<string, unknown>): Promise<void>;
160
+ event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>;
157
161
  /**
158
162
  * @summary this will be called to close the modal
159
163
  * @param forceClose is set when modal is closed by cross btn
@@ -186,17 +190,18 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
186
190
  * @param workflowId
187
191
  * @param payload
188
192
  */
189
- workflow(workflowId: string, { selectedCredentialId, body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>;
193
+ workflow(workflowId: string, { selectedCredentialId, selectedConfigurationId, body, query, headers, }?: TriggerWorkflowRequest): Promise<object | undefined>;
190
194
  /**
191
195
  * for programmatically installing an integration
192
196
  */
193
- installIntegration(action: string, params?: InstallIntegrationOptions): Promise<void>;
197
+ installIntegration(action: string, params?: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>;
194
198
  /**
195
199
  * gates headless feature to pro and enterprise users
196
200
  */
197
201
  ensureHeadlessIsSupported(): void;
198
202
  uninstallIntegration(action: string, options?: UninstallOptions): Promise<void>;
199
203
  disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>;
204
+ enableWorkflow(workflowId: string, options?: CredentialConfigOptions): Promise<void>;
200
205
  /**
201
206
  * Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options.
202
207
  * Note that accountAuth is allowed for only some of the integrations.
@@ -204,10 +209,6 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
204
209
  getIntegrationAccount(integrationType: string, options?: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
205
210
  private getIntegrationForWorkflow;
206
211
  private updateLocalState;
207
- /**
208
- * also returns false if unable to find workflow in configured workflow property of any integration
209
- */
210
- private isWorkflowEnabled;
211
212
  /**
212
213
  * gets the user data from api `/sdk/me`
213
214
  */
@@ -250,5 +251,16 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
250
251
  * @returns
251
252
  */
252
253
  connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>;
254
+ /**
255
+ * Creates a new configuration using the provided credentials.
256
+ * @param {CreateConfigurationOptions} param0
257
+ * @returns {Promise<IConnectCredentialConfig> }
258
+ */
259
+ createConfiguration({ credentialId, externalId, }: CreateConfigurationOptions): Promise<IConnectCredentialConfig>;
260
+ /**
261
+ * Destroys an existing configuration using the provided instance ID.
262
+ */
263
+ destroyConfiguration({ id, credentialId }: DeleteConfigurationOptions): Promise<void>;
264
+ updateConfiguration({ id, credentialId, meta, }: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
253
265
  private pollForCredential;
254
266
  }
@@ -0,0 +1,2 @@
1
+ export declare const ACTION_CUSTOM = "custom";
2
+ export declare const INSUFFICIENT_PERMISSION: string;
@@ -7,8 +7,8 @@ export interface IConnectCredential {
7
7
  /**
8
8
  * @deprecated
9
9
  */
10
- config: SDKConnectCredentialConfig;
11
- configurations?: IConnectCredentialConfig[];
10
+ config?: SDKConnectCredentialConfig;
11
+ configurations: IConnectCredentialConfig[];
12
12
  personaId: string;
13
13
  isPreviewCredential: boolean;
14
14
  /**
@@ -1,5 +1,7 @@
1
1
  import { GoogleDriveFilePicker } from './googledrive';
2
+ import { OneDriveFilePicker } from './onedrive';
2
3
  declare const _default: {
3
4
  GoogleDriveFilePicker: typeof GoogleDriveFilePicker;
5
+ OneDriveFilePicker: typeof OneDriveFilePicker;
4
6
  };
5
7
  export default _default;
@@ -0,0 +1,35 @@
1
+ import ConnectSDK from '../../ConnectSDK';
2
+ import { FilePickerInitOptions, FilePickerOptions } from '../../types';
3
+ import { BaseFilePicker } from '../types/baseFilePicker';
4
+ export declare class OneDriveFilePicker extends BaseFilePicker {
5
+ readonly options: FilePickerOptions;
6
+ readonly connectSDKInstance: ConnectSDK;
7
+ private dependencyStatus;
8
+ private accessToken;
9
+ private domain;
10
+ constructor(options: FilePickerOptions, connectSDKInstance: ConnectSDK);
11
+ getInstance(): null;
12
+ open(): boolean;
13
+ init(options: FilePickerInitOptions): Promise<boolean>;
14
+ protected onScriptLoaded(): void;
15
+ protected onScriptError(): void;
16
+ /**
17
+ * Combines multiple path segments into a single normalized path.
18
+ *
19
+ * - Removes any leading or trailing slashes from each segment.
20
+ * - Ensures the resulting path uses forward slashes (`/`) as the separator.
21
+ * - Does not add a leading or trailing slash to the final combined path.
22
+ *
23
+ * @param paths - An array of path segments to combine.
24
+ * @returns The combined and normalized path as a string.
25
+ *
26
+ * @example
27
+ * const combinedPath = combinePaths('folder1/', '/folder2/', '/file.txt');
28
+ * // Result: 'folder1/folder2/file.txt'
29
+ */
30
+ private combinePaths;
31
+ private launchPicker;
32
+ private setupMessageListener;
33
+ private initializePort;
34
+ private handlePickerCommand;
35
+ }
@@ -28,5 +28,24 @@ export declare abstract class BaseFilePicker implements IFilePicker {
28
28
  */
29
29
  protected injectScript(url: string): void;
30
30
  protected checkIfScriptLoaded(id: string): boolean;
31
- protected validateInitOptions(options: FilePickerInitOptions): Promise<boolean>;
31
+ /**
32
+ * Validates that the required fields in the options object are present and non-empty.
33
+ *
34
+ * - Checks for missing or empty fields and throws corresponding error messages.
35
+ *
36
+ * @param options - The options object to validate.
37
+ * @param requiredFields - An array of tuples where each tuple contains:
38
+ * - The key to check in the options object.
39
+ * - The error message to throw if the key is missing or empty.
40
+ *
41
+ * @returns A promise that resolves to `true` if all validations pass.
42
+ * @throws An error with the specified message if any validation fails.
43
+ *
44
+ * @example
45
+ * await this.validateInitOptions(options, [
46
+ * ['developerKey', 'Please provide a valid developer key'],
47
+ * ['clientId', 'Please provide a valid client ID'],
48
+ * ]);
49
+ */
50
+ protected validateInitOptions(options: Record<string, any>, requiredFields: [key: string, fieldName: string][]): Promise<boolean>;
32
51
  }
@@ -3,6 +3,7 @@ import { ConnectCredentialConfigMeta, IConnectCredentialConfig } from '../entiti
3
3
  import { PersonaMeta } from '../entities/persona.interface';
4
4
  import { AccountType, DataSource, IntegrationConnectInput, SidebarInputType } from './action';
5
5
  import { OrConditions } from './resolvers';
6
+ import { CredentialConfigOptions } from './sdk';
6
7
  export interface SDKConnectCredentialConfig {
7
8
  sharedSettings?: IntegrationSharedInputStateMap;
8
9
  workflowSettings?: IntegrationWorkflowStateMap;
@@ -45,15 +46,15 @@ type ComboInputValue = {
45
46
  export type IntegrationWorkflowStateMap = {
46
47
  [workflowId: string]: IntegrationWorkflowState | undefined;
47
48
  };
49
+ export type IntegrationSharedInputStateMap = {
50
+ [inputId: string]: ConnectInputValue | undefined;
51
+ };
48
52
  export type IntegrationWorkflowState = {
49
53
  enabled: boolean;
50
54
  settings: {
51
55
  [inputId: string]: ConnectInputValue | undefined;
52
56
  };
53
57
  };
54
- export type IntegrationSharedInputStateMap = {
55
- [inputId: string]: ConnectInputValue | undefined;
56
- };
57
58
  export type ModalConfig = {
58
59
  /**
59
60
  * A primary color for the background color of the Connect modal.
@@ -180,6 +181,8 @@ export type AuthenticatedConnectUser = {
180
181
  export type SDKResourceState = {
181
182
  id: string;
182
183
  slug: string;
184
+ credentialId?: string;
185
+ credentialStatus?: CredentialStatus;
183
186
  };
184
187
  export type SDKIntegration = {
185
188
  enabled: boolean;
@@ -189,7 +192,7 @@ export type SDKIntegration = {
189
192
  providerId?: string;
190
193
  providerData?: ConnectCredentialProviderData;
191
194
  allCredentials: IConnectCredential[];
192
- allConfigurations?: IConnectCredentialConfig[];
195
+ allConfigurations: IConnectCredentialConfig[];
193
196
  } & SDKConnectCredentialConfig;
194
197
  export type SDKIntegrationConfig = {
195
198
  oauthInputs: IntegrationConnectInput[];
@@ -207,12 +210,8 @@ export type SDKIntegrationConfig = {
207
210
  * available entities.
208
211
  */
209
212
  export type SDKIntegrationState = Partial<Record<string, SDKIntegration>>;
210
- export type UninstallOptions = {
211
- selectedCredentialId?: string;
212
- };
213
- export type DisableWorkflowOptions = {
214
- selectedCredentialId?: string;
215
- };
213
+ export type UninstallOptions = Pick<CredentialConfigOptions, 'selectedCredentialId'>;
214
+ export type DisableWorkflowOptions = CredentialConfigOptions;
216
215
  /**
217
216
  * method options for getIntegrationAccount in sdk
218
217
  */
@@ -223,4 +222,5 @@ export type GetIntegrationAccountOptions = {
223
222
  export type IConnectUser = Omit<AuthenticatedConnectUser, 'token'>;
224
223
  export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
225
224
  export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
225
+ export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id";
226
226
  export {};
@@ -1,6 +1,6 @@
1
- /// <reference types="google.picker" />
2
1
  import ConnectSDK from '../ConnectSDK';
3
2
  import { IConnectCredential } from '../entities/connectCredential.interface';
3
+ import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
4
4
  import { OauthCallbackResponse } from '../entities/credential.interface';
5
5
  import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from '../entities/integration.interface';
6
6
  import { PersonaMeta } from '../entities/persona.interface';
@@ -57,6 +57,13 @@ export type CompleteInstallOptions = {
57
57
  };
58
58
  };
59
59
  };
60
+ export type LoadCustomDropdownOptionsResult = Promise<{
61
+ options: {
62
+ label: string;
63
+ value: string;
64
+ }[];
65
+ nextPageCursor: string | null;
66
+ }>;
60
67
  export interface IConnectSDK {
61
68
  authenticate(projectId: string, token: string, options?: AuthenticateOptions): Promise<void>;
62
69
  connect(action: string, options: ConnectParams): void;
@@ -75,12 +82,21 @@ export interface IConnectSDK {
75
82
  * @private
76
83
  */
77
84
  _oauthErrorCallback(errorMessage: string, event?: MessageEvent): Promise<void>;
85
+ /**
86
+ * TODO(UI/UX): Document this
87
+ * TODO(UI/UX): Create type
88
+ * Destroys an existing configuration using the provided instance ID.
89
+ *
90
+ * @param {string} cursor - An object containing the necessary parameters.
91
+ * @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed.
92
+ */
93
+ _loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult;
78
94
  /**
79
95
  * installs an integration without the need to click on enable button from portal
80
96
  * Install Options:
81
97
  * `{showPortalAfterInstall: boolean}` decides wether to show portal with configuration view after the installation is completed
82
98
  */
83
- installIntegration(name: string, options: InstallIntegrationOptions): Promise<void>;
99
+ installIntegration(name: string, options: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>;
84
100
  /**
85
101
  * uninstalls an integration for connected user.
86
102
  */
@@ -89,6 +105,10 @@ export interface IConnectSDK {
89
105
  * disables a workflow for the connected user and unsubscribes all the workflows in hermes
90
106
  */
91
107
  disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>;
108
+ /**
109
+ * enables a workflow for the connected user and subscribe the workflows in hermes
110
+ */
111
+ enableWorkflow(workflowId: string, options: CredentialConfigOptions): Promise<void>;
92
112
  setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
93
113
  /**
94
114
  * sets the base url for different services used in connect sdk
@@ -108,7 +128,7 @@ export interface IConnectSDK {
108
128
  * @param name eventName
109
129
  * @param payload event payload object
110
130
  */
111
- event(name: string, payload: Record<string, unknown>): Promise<void>;
131
+ event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>;
112
132
  /**
113
133
  * makes an connect proxy action request
114
134
  * @param action actionName
@@ -161,6 +181,26 @@ export interface IConnectSDK {
161
181
  * Closing the portal by invoking this method
162
182
  */
163
183
  closePortal(): void;
184
+ /**
185
+ * Creates a new configuration using the provided credentials.
186
+ *
187
+ * @param {CreateConfigurationOptions} params - An object containing the necessary parameters.
188
+ * @param {string} params.credentialId - The ID of the credential to create the configuration for.
189
+ * @param {string} params.externalId - (Optional) An external identifier associated with the configuration.
190
+ * @returns {Promise<ICreateConfiguration>} - A promise that resolves to the created configuration object.
191
+ */
192
+ createConfiguration(params: CreateConfigurationOptions): Promise<IConnectCredentialConfig>;
193
+ /**
194
+ * Destroys an existing configuration using the provided instance ID.
195
+ *
196
+ * @param {DestroyConfigurationParams} params - An object containing the necessary parameters.
197
+ * @param {string} params.id - The ID of the configuration to be destroyed.
198
+ * @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed.
199
+ */
200
+ destroyConfiguration(params: {
201
+ id: string;
202
+ }): Promise<void>;
203
+ updateConfiguration(dto: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
164
204
  }
165
205
  /**
166
206
  * sdk install options
@@ -183,12 +223,28 @@ export type InstallOptions = {
183
223
  */
184
224
  accountType?: string;
185
225
  allowMultipleCredentials?: boolean;
186
- selectedCredentialId?: string;
187
226
  /**
188
227
  * used to override redirect url passed in getAuthUrl instead of our passport url
189
228
  */
190
229
  overrideRedirectUrl?: string;
191
230
  };
231
+ export type CredentialConfigOptions = {
232
+ selectedCredentialId?: string;
233
+ selectedConfigurationId?: string;
234
+ };
235
+ export type CreateConfigurationOptions = {
236
+ credentialId: string;
237
+ externalId?: string;
238
+ };
239
+ export type DeleteConfigurationOptions = {
240
+ id: string;
241
+ credentialId: string;
242
+ };
243
+ export type UpdateConfigurationOptions = {
244
+ id: string;
245
+ credentialId: string;
246
+ meta: Record<string, unknown>;
247
+ };
192
248
  export type AuthenticateOptions = {
193
249
  metadata?: PersonaMeta;
194
250
  };
@@ -202,6 +258,8 @@ export declare enum ModalView {
202
258
  export type IntegrationInstallEvent = {
203
259
  integrationId: string;
204
260
  integrationType: string;
261
+ credentialId?: string;
262
+ credential?: IConnectCredential | undefined;
205
263
  };
206
264
  export type IntegrationUninstallEvent = IntegrationInstallEvent;
207
265
  export type WorkflowStateChangeEvent = {
@@ -235,7 +293,7 @@ export type UserProvidedIntegrationConfig = {
235
293
  [objectName: string]: DynamicMappingField[] | DynamicMappingOptions;
236
294
  };
237
295
  };
238
- export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions;
296
+ export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions;
239
297
  export type EventInfo = {
240
298
  type: SDK_EVENT;
241
299
  integrationId: string;
@@ -263,11 +321,10 @@ export declare enum DocumentLoadingState {
263
321
  INTERACTIVE = "interactive",
264
322
  COMPLETE = "complete"
265
323
  }
266
- export type TriggerWorkflowRequest = {
324
+ export type TriggerWorkflowRequest = CredentialConfigOptions & {
267
325
  body?: RequestInit['body'] | object;
268
326
  headers?: RequestInit['headers'];
269
327
  query?: Record<string, string>;
270
- selectedCredentialId?: string;
271
328
  };
272
329
  export interface IFilePicker {
273
330
  /**
@@ -291,15 +348,12 @@ export type FilePickerOptions = {
291
348
  onClose?: () => void;
292
349
  onFileSelect?: (files: unknown) => void;
293
350
  onCancel?: () => void;
294
- integrationOptions?: {
295
- googledrive?: {
296
- viewMode: google.picker.DocsViewMode;
297
- };
298
- };
299
351
  };
300
352
  export type FilePickerInitOptions = {
301
- developerKey: string;
353
+ developerKey?: string;
354
+ DocsViewMode?: string;
302
355
  appId?: string;
356
+ clientId?: string;
303
357
  };
304
358
  export declare enum FilePickerStatus {
305
359
  LOADING = "loading",
@@ -310,4 +364,28 @@ export interface ExternalFilePickerConstruct {
310
364
  new (action: string, options: FilePickerOptions): IFilePicker;
311
365
  (action: string, options: FilePickerOptions): IFilePicker;
312
366
  }
367
+ export declare enum DocsViewMode {
368
+ GRID = "grid",
369
+ LIST = "list"
370
+ }
371
+ export declare const supportedModesForDocsViewMode: string[];
372
+ export interface OpenOptions {
373
+ clientId: string;
374
+ action: 'share' | 'download' | 'upload' | string;
375
+ advanced?: {
376
+ queryParameters?: string;
377
+ accessToken?: string;
378
+ };
379
+ multiSelect?: boolean;
380
+ openInNewWindow: boolean;
381
+ success?: (files: File[]) => void;
382
+ cancel?: () => void;
383
+ error?: (error: Error) => void;
384
+ }
385
+ export interface File {
386
+ id: string;
387
+ name: string;
388
+ size: number;
389
+ link: string;
390
+ }
313
391
  export {};
@@ -11,3 +11,9 @@ export declare const getAssetUrl: ({ CDN_PUBLIC_URL: cdnHost, DASHBOARD_PUBLIC_U
11
11
  PLATFORM_ENV: string;
12
12
  VERSION: string;
13
13
  }) => string;
14
+ /**
15
+ *
16
+ * @param externalId
17
+ * @returns
18
+ */
19
+ export declare function sanitizeExternalConfigId(externalId: string): string;
@@ -28,6 +28,8 @@ export declare function generateMatrix<T extends Record<string, any>>(input: {
28
28
  [k in keyof T]: T[k][];
29
29
  }, limit?: number): T[];
30
30
  export declare function sleep(milliseconds: number): Promise<void>;
31
+ export declare const uuidPattern: RegExp;
32
+ export declare function isUUID(value: string | unknown): boolean;
31
33
  /**
32
34
  * keeps attempting to execute a method until a desired result is achieved
33
35
  *
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "1.0.24-experimental.11",
3
+ "version": "1.0.24-experimental.13",
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",
7
- "exports": {
8
- ".": "./dist/src/index.js",
9
- "./ConnectSDK": "./dist/src/ConnectSDK.js"
10
- },
7
+ "exports": "./dist/src/index.js",
11
8
  "scripts": {
9
+ "start:dev": "NODE_ENV=development webpack serve",
12
10
  "build:prod": "yarn typecheck && yarn clean && webpack --config webpack.config.js",
13
11
  "build:watch": "yarn build --watch",
14
12
  "build": "yarn typecheck && yarn clean && webpack --config webpack.config.js",
@@ -63,10 +61,12 @@
63
61
  "eslint-plugin-react-hooks": "^4.4.0",
64
62
  "eslint-plugin-unicorn": "^41.0.0",
65
63
  "glob": "^10.3.10",
64
+ "html-webpack-plugin": "^5.6.3",
66
65
  "jest": "^27.0.6",
67
66
  "jest-fetch-mock": "useparagon/jest-fetch-mock.git#3.0.4",
68
67
  "jest-json": "^1.0.4",
69
68
  "jest-json-reporter2": "^1.1.0",
69
+ "jsonwebtoken": "^9.0.2",
70
70
  "node-notifier": "^10.0.0",
71
71
  "nyc": "^15.1.0",
72
72
  "pkg": "^5.8.1",
@@ -87,7 +87,8 @@
87
87
  "uuid": "^9.0.0",
88
88
  "webpack": "^5.75.0",
89
89
  "webpack-bundle-analyzer": "^4.3.0",
90
- "webpack-cli": "^5.0.2"
90
+ "webpack-cli": "^5.0.2",
91
+ "webpack-dev-server": "^5.1.0"
91
92
  },
92
93
  "license": "MIT",
93
94
  "pkg": {