@useparagon/connect 2.3.2-experimental.1 → 2.4.0-experimental-19855.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.
@@ -11,6 +11,7 @@ export type ConnectSdkEnvironments = {
11
11
  PASSPORT_PUBLIC_URL: string;
12
12
  PLATFORM_ENV: string;
13
13
  WORKER_PROXY_PUBLIC_URL: string;
14
+ API_TRIGGER_KIT_PUBLIC_URL: string;
14
15
  VERSION: string;
15
16
  ZEUS_PUBLIC_URL: string;
16
17
  };
@@ -1,7 +1,7 @@
1
- import type { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { AuthenticationScheme } from '../entities/credential.interface';
3
3
  import { CustomDropdownField, DynamicMappingField, DynamicMappingOptions, InstructionStage, SidebarInput } from './connect';
4
- import { DataType, KeyedSource, Source } from './resolvers';
4
+ import { DataType, KeyedSource, Operator, Source } from './resolvers';
5
5
  export declare enum SidebarInputType {
6
6
  Auth = "AUTH",
7
7
  Enum = "ENUM",
@@ -174,7 +174,7 @@ export interface IntegrationConnectInput extends BaseInput {
174
174
  fallbackText?: string;
175
175
  hiddenInConnect?: boolean;
176
176
  }
177
- type EnumSection<T = any> = {
177
+ export type EnumSection<T = any> = {
178
178
  title: string;
179
179
  items: EnumInputValue<T>[];
180
180
  };
@@ -400,4 +400,43 @@ export type AccountType = {
400
400
  skipPostOAuthInputs?: boolean;
401
401
  };
402
402
  export type InstructionMetadata = Pick<InstructionStage, 'content' | 'ctas' | 'finish' | 'packageInstallUrl'>;
403
+ export interface DynamicInputSource {
404
+ sourceType: string;
405
+ dependencies: string[];
406
+ }
407
+ export declare enum DelayUnit {
408
+ SECONDS = "SECONDS",
409
+ MINUTES = "MINUTES",
410
+ HOURS = "HOURS",
411
+ DAYS = "DAYS"
412
+ }
413
+ export type GraphiteEnumInput = {
414
+ value: string | number;
415
+ dependentInputs?: IntentInputKeyConfig[];
416
+ label?: string;
417
+ } | string | number;
418
+ export type IntentInputKeyConfig = {
419
+ id: string;
420
+ title: string;
421
+ subtitle?: string;
422
+ placeholder?: string;
423
+ required?: boolean;
424
+ dependentInputs?: IntentInputKeyConfig[];
425
+ defaultValue?: unknown;
426
+ valuesSource?: DynamicInputSource;
427
+ } & ({
428
+ type: `${SidebarInputType.TextArea}` | `${SidebarInputType.Switch}` | `${SidebarInputType.BooleanInput}` | `${SidebarInputType.Code}` | `${SidebarInputType.ValueText}` | `${SidebarInputType.Text}` | `${SidebarInputType.Password}` | `${SidebarInputType.Number}`;
429
+ } | {
430
+ type: `${SidebarInputType.Enum}` | `${SidebarInputType.EditableEnum}` | `${SidebarInputType.EnumTextAreaPairInput}`;
431
+ values: GraphiteEnumInput[];
432
+ } | {
433
+ type: `${SidebarInputType.Conditional}`;
434
+ supportedOperators?: `${Operator}`[];
435
+ disableOrCondition?: boolean;
436
+ supportedKeys?: string[];
437
+ supportedKeysSource?: DynamicInputSource;
438
+ } | {
439
+ type: `${SidebarInputType.TimeConstraintInput}`;
440
+ supportedUnits?: `${DelayUnit}`[];
441
+ });
403
442
  export {};
@@ -2,9 +2,9 @@ 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, DynamicDataSource, DynamicEnumInput, EmailInput, FieldMapperInput, FileInput, IntegrationConnectInput, NumberInput, PasswordInput, PermissionInput, SidebarInputType, StaticEnumDataSource, SwitchInput, URLInput, ValueTextInput } from './action';
5
+ import { AccountType, BooleanInput, ComboInput, CopyableButtonInput, CustomDropdownInput, DataSource, DynamicComboInput, DynamicDataSource, DynamicEnumInput, EmailInput, FieldMapperInput, FileInput, IntegrationConnectInput, IntentInputKeyConfig, NumberInput, PasswordInput, PermissionInput, SidebarInputType, StaticEnumDataSource, SwitchInput, URLInput, ValueTextInput } from './action';
6
6
  import { InstallFlowError } from './errors';
7
- import { OrConditions } from './resolvers';
7
+ import { Operator, OrConditions } from './resolvers';
8
8
  import { CredentialConfigOptions, IntegrationInstallEvent, LoadCustomDropdownOptionsResult } from './sdk';
9
9
  export { CredentialStatus } from '../entities/connectCredential.interface';
10
10
  export type { IntegrationMetadata } from '../entities/integration.interface';
@@ -133,6 +133,11 @@ export type SingleSource = {
133
133
  kind: 'single';
134
134
  source: DynamicDataSource<any> | StaticEnumDataSource;
135
135
  };
136
+ export type ConditionalSource = {
137
+ kind: 'conditional';
138
+ source: DynamicDataSource<any>;
139
+ supportedOperators?: `${Operator}`[];
140
+ };
136
141
  export type FieldMapperSources = {
137
142
  kind: 'fieldMapper';
138
143
  recordSource: DynamicDataSource<any>;
@@ -152,7 +157,7 @@ export type DefaultFieldValueSources = {
152
157
  dependentInputSource: DynamicDataSource<any>;
153
158
  variableInputSource?: DynamicDataSource<any>;
154
159
  };
155
- export type InputSources = SingleSource | FieldMapperSources | ComboSources | DefaultFieldValueSources;
160
+ export type InputSources = SingleSource | ConditionalSource | FieldMapperSources | ComboSources | DefaultFieldValueSources;
156
161
  type IntegrationWorkflowMetaMap = {
157
162
  [id: string]: IntegrationWorkflowMeta;
158
163
  };
@@ -272,6 +277,24 @@ export type GetIntegrationAccountOptions = {
272
277
  includeAccountAuth?: boolean;
273
278
  selectedCredentialId?: string;
274
279
  };
280
+ export declare enum TriggerModel {
281
+ POLLING = "POLLING",
282
+ WEBHOOK = "WEBHOOK"
283
+ }
284
+ export interface TriggerDefinition {
285
+ type: string;
286
+ triggerModel: TriggerModel;
287
+ title: string;
288
+ description: string;
289
+ parameters: IntentInputKeyConfig[];
290
+ }
291
+ export interface GetTriggerTypesResponse {
292
+ triggers: Record<string, TriggerDefinition[]>;
293
+ errors?: Array<{
294
+ type: string;
295
+ message: string;
296
+ }>;
297
+ }
275
298
  export type IConnectUser = Omit<AuthenticatedConnectUser, 'token'>;
276
299
  export type IConnectUserWithProject = IConnectUser & {
277
300
  project: IConnectSDKProject;
@@ -231,7 +231,7 @@ type Condition = {
231
231
  variable: Source<DataType.STRING>;
232
232
  argument: Source<DataType.STRING>;
233
233
  };
234
- declare enum Operator {
234
+ export declare enum Operator {
235
235
  'None' = "$none",
236
236
  'StringContains' = "$stringContains",
237
237
  'StringDoesNotContain' = "$stringDoesNotContain",
@@ -7,8 +7,8 @@ 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, InputSources, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, UninstallOptions } from '../types/connect';
11
- import { DataSource, DynamicDataSource, DynamicDefaultInput, EnumInputValue } from './action';
10
+ import { AuthenticatedConnectUser, ConditionalSource, CustomDropdownField, CustomDropdownOptions, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, GetTriggerTypesResponse, InputSources, IntegrationWorkflowMeta, IntegrationWorkflowState, SerializedConnectInput, SingleSource, UninstallOptions } from '../types/connect';
11
+ import { DataSource, DynamicDataSource, DynamicDefaultInput, EnumInputValue, EnumSection, IntentInputKeyConfig } from './action';
12
12
  import { Props as ConnectModalProps } from './connectModal';
13
13
  import { DataType, KeyedSource } from './resolvers';
14
14
  export type ConnectUser = {
@@ -187,7 +187,7 @@ export interface IConnectSDK {
187
187
  * @param path request path
188
188
  * @param init request initialization options {method: httpMethod, body:RequestBody, header}
189
189
  */
190
- request<TResponse>(action: string, path: string, init?: ProxyRequestOptions): Promise<TResponse | undefined>;
190
+ request<TResponse>(action: string, path: string, init: ProxyRequestOptions): Promise<TResponse | undefined>;
191
191
  /**
192
192
  * listen on connect sdk events
193
193
  * @param eventName SDKEVENTS
@@ -219,6 +219,12 @@ export interface IConnectSDK {
219
219
  * @param options
220
220
  */
221
221
  getIntegrationAccount(integrationType: string, options?: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
222
+ /**
223
+ * Get available trigger types grouped by integration.
224
+ * @param action - action name
225
+ * @param credentialOptions - multi-auth credential selection
226
+ */
227
+ getTriggers(action: string, credentialOptions?: Pick<CredentialConfigOptions, 'selectedCredentialId'>): Promise<GetTriggerTypesResponse>;
222
228
  /**
223
229
  * Connects to a resource using the provided credentials payload.
224
230
  * @param resourceSlug
@@ -282,7 +288,7 @@ export interface IConnectSDK {
282
288
  parameters?: KeyedSource<DataType.ANY>[];
283
289
  selectedCredentialId?: string;
284
290
  }): Promise<{
285
- data: EnumInputValue[];
291
+ data: EnumInputValue[] | EnumSection[];
286
292
  nestedData: DynamicDefaultInput[];
287
293
  nextPageCursor: string | null;
288
294
  }>;
@@ -294,12 +300,13 @@ export interface IConnectSDK {
294
300
  parameters?: KeyedSource<DataType.ANY>[];
295
301
  selectedCredentialId?: string;
296
302
  }): Promise<{
297
- data: EnumInputValue[];
303
+ data: EnumInputValue[] | EnumSection[];
298
304
  nestedData: DynamicDefaultInput[];
299
305
  nextPageCursor: string | null;
300
306
  }>;
301
307
  getDataSourceOptions(integrationName: string, action: string): Promise<DataSource | undefined>;
302
308
  getSourcesForInput(integrationName: string, input: SerializedConnectInput): InputSources | null;
309
+ getSourcesForActionInput(input: IntentInputKeyConfig): SingleSource | ConditionalSource | null;
303
310
  installFlow: InstallFlow;
304
311
  getAssetUrl(name: string): string;
305
312
  }
@@ -542,8 +549,8 @@ export type UpdateWorkflowStateResponse = {
542
549
  };
543
550
  export type ProxyRequestOptions = {
544
551
  selectedCredentialId?: string;
545
- method?: RequestInit['method'];
546
- body?: RequestInit['body'] | object;
547
- headers?: RequestInit['headers'];
552
+ method: RequestInit['method'];
553
+ body: RequestInit['body'] | object;
554
+ headers: RequestInit['headers'];
548
555
  };
549
556
  export {};
@@ -21,14 +21,3 @@ export declare function sanitizeExternalConfigId(externalId: string): string;
21
21
  export declare const getHeadersForUserMeta: (userMeta?: PersonaMeta) => {
22
22
  [x: string]: string;
23
23
  };
24
- /**
25
- * Normalizes persona metadata keys to match DB conventions.
26
- * `name` (any casing) -> `Name`, `email` (any casing) -> `Email`,
27
- * all other keys are trimmed.
28
- */
29
- export declare function normalizePersonaMeta(meta: PersonaMeta): PersonaMeta;
30
- /**
31
- * Checks whether incoming metadata (from request header) would produce
32
- * a meaningful change when merged into the existing stored metadata.
33
- */
34
- export declare function hasPersonaMetaChanged(incomingMeta: PersonaMeta, storedMeta: PersonaMeta | undefined | null): boolean;
@@ -28,6 +28,12 @@ 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
+ /**
32
+ * Normalizes a plain object for comparison by sorting keys (key-order independent).
33
+ * Only handles objects; does not accept or recurse into arrays.
34
+ */
35
+ export declare function normalizeForMetaCompare(value: Record<string, unknown>): Record<string, unknown>;
36
+ export declare function areObjectsEqual(a: Record<string, unknown>, b: Record<string, unknown>): boolean;
31
37
  export declare const uuidPattern: RegExp;
32
38
  export declare function isUUID(value: string | unknown): boolean;
33
39
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useparagon/connect",
3
- "version": "2.3.2-experimental.1",
3
+ "version": "2.4.0-experimental-19855.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",
@@ -33,12 +33,9 @@
33
33
  "clone-deep": "^4.0.1",
34
34
  "hash.js": "^1.1.7",
35
35
  "jwt-decode": "^3.1.2",
36
- "lodash": "^4.17.23",
36
+ "react": "^17.0.2",
37
37
  "tslib": "2.3.1"
38
38
  },
39
- "peerDependencies": {
40
- "react": "^17 || ^18 || ^19"
41
- },
42
39
  "devDependencies": {
43
40
  "@babel/core": "^7.12.3",
44
41
  "@babel/preset-env": "^7.12.1",
@@ -49,7 +46,6 @@
49
46
  "@types/gapi": "^0.0.47",
50
47
  "@types/google.picker": "^0.0.42",
51
48
  "@types/jest": "^29.5.1",
52
- "@types/lodash": "^4.17.24",
53
49
  "@types/node": "^18.13.0",
54
50
  "@types/react": "^17.0.11",
55
51
  "@types/react-dom": "^17.0.8",
@@ -81,7 +77,6 @@
81
77
  "pkg": "^5.8.1",
82
78
  "prettier": "^2.2.1",
83
79
  "process": "^0.11.10",
84
- "react": "^17.0.2",
85
80
  "react-dom": "^17.0.2",
86
81
  "rimraf": "^3.0.2",
87
82
  "stream-browserify": "^3.0.0",