@edge-markets/connect 1.2.0 → 1.3.0

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.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,139 @@
1
+ type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2
+ interface EdgeEnvironmentConfig {
3
+ /**
4
+ * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
5
+ */
6
+ cognitoDomain: string;
7
+ apiBaseUrl: string;
8
+ oauthBaseUrl: string;
9
+ userClientUrl: string;
10
+ displayName: string;
11
+ isProduction: boolean;
12
+ }
13
+ declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
14
+ declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
15
+ declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
16
+ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
17
+
18
+ /**
19
+ * EDGE Connect OAuth Scopes
20
+ *
21
+ * OAuth scopes define what permissions your application requests from users.
22
+ * Each scope grants access to specific API endpoints.
23
+ *
24
+ * @module @edge-markets/connect/config
25
+ */
26
+ /**
27
+ * Available OAuth scopes for EDGE Connect.
28
+ *
29
+ * Request the minimum scopes your application needs.
30
+ * Users see these permissions during the consent flow.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Request only what you need
35
+ * link.open({
36
+ * scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
37
+ * })
38
+ *
39
+ * // Or request all scopes
40
+ * link.open({
41
+ * scopes: ALL_EDGE_SCOPES,
42
+ * })
43
+ * ```
44
+ */
45
+ declare const EDGE_SCOPES: {
46
+ /**
47
+ * Read user profile information (name, email).
48
+ * Required for: `GET /v1/user`
49
+ */
50
+ readonly USER_READ: "user.read";
51
+ /**
52
+ * Read account balance.
53
+ * Required for: `GET /v1/balance`
54
+ */
55
+ readonly BALANCE_READ: "balance.read";
56
+ /**
57
+ * Initiate and verify fund transfers.
58
+ * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
59
+ */
60
+ readonly TRANSFER_WRITE: "transfer.write";
61
+ };
62
+ /**
63
+ * Type representing a valid EDGE Connect scope.
64
+ */
65
+ type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
66
+ /**
67
+ * All available scopes as an array.
68
+ * Use when you need full access to all API features.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const link = new EdgeLink({
73
+ * clientId: 'your-client-id',
74
+ * environment: 'staging',
75
+ * scopes: ALL_EDGE_SCOPES, // Request all permissions
76
+ * onSuccess: handleSuccess,
77
+ * })
78
+ * ```
79
+ */
80
+ declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
81
+ /**
82
+ * Human-readable descriptions for each scope.
83
+ * Useful for building custom consent UIs or explaining permissions.
84
+ */
85
+ declare const SCOPE_DESCRIPTIONS: Readonly<Record<EdgeScope, string>>;
86
+ /**
87
+ * Icons for each scope (for UI display).
88
+ * Using common icon library names (e.g., Lucide, Heroicons).
89
+ */
90
+ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
91
+ /**
92
+ * Builds the full scope string for a given environment.
93
+ *
94
+ * Different environments may use different scope prefixes in the API Gateway.
95
+ * This function handles the prefix automatically.
96
+ *
97
+ * Note: 'development' environment uses 'staging' scope prefix because it
98
+ * connects to the staging API Gateway for local testing.
99
+ *
100
+ * @param scope - The scope to format
101
+ * @param environment - The target environment
102
+ * @returns The full scope string for API Gateway authorization
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * formatScopeForEnvironment('user.read', 'staging')
107
+ * // Returns: 'edge-connect-staging/user.read'
108
+ *
109
+ * formatScopeForEnvironment('user.read', 'production')
110
+ * // Returns: 'edge-connect/user.read'
111
+ *
112
+ * formatScopeForEnvironment('user.read', 'development')
113
+ * // Returns: 'edge-connect-staging/user.read' (maps to staging)
114
+ * ```
115
+ */
116
+ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
117
+ /**
118
+ * Formats multiple scopes for an environment.
119
+ *
120
+ * @param scopes - Array of scopes to format
121
+ * @param environment - The target environment
122
+ * @returns Array of full scope strings
123
+ */
124
+ declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
125
+ /**
126
+ * Parses a full scope string to extract the base scope.
127
+ *
128
+ * @param fullScope - The full scope string (e.g., 'edge-connect-staging/user.read')
129
+ * @returns The base scope (e.g., 'user.read') or null if invalid
130
+ */
131
+ declare function parseScope(fullScope: string): EdgeScope | null;
132
+ /**
133
+ * Checks if a scope string is valid.
134
+ */
135
+ declare function isValidScope(scope: string): scope is EdgeScope;
136
+
1
137
  /**
2
138
  * This file was auto-generated by openapi-typescript.
3
139
  * Do not make direct changes to the file.
@@ -2308,6 +2444,67 @@ type OtpMethod = 'sms' | 'totp';
2308
2444
  * Parameters for listing transfers.
2309
2445
  */
2310
2446
  type ListTransfersParams = NonNullable<operations['listTransfers']['parameters']['query']>;
2447
+ /**
2448
+ * Address block for identity verification.
2449
+ * The block itself is required; all sub-fields are optional — supply as many
2450
+ * as the partner holds for a higher-confidence match.
2451
+ */
2452
+ interface VerifyIdentityAddress {
2453
+ /** Street address line (e.g. "123 Main St") */
2454
+ street?: string;
2455
+ city?: string;
2456
+ /** US state code (e.g. "TX") */
2457
+ state?: string;
2458
+ zip?: string;
2459
+ }
2460
+ /**
2461
+ * Options for `EdgeConnectServer.verifyIdentity()`.
2462
+ *
2463
+ * @example
2464
+ * ```typescript
2465
+ * const options: VerifyIdentityOptions = {
2466
+ * firstName: 'John',
2467
+ * lastName: 'Doe',
2468
+ * address: { street: '123 Main St', city: 'Austin', state: 'TX', zip: '78701' },
2469
+ * }
2470
+ * ```
2471
+ */
2472
+ interface VerifyIdentityOptions {
2473
+ firstName: string;
2474
+ lastName: string;
2475
+ /**
2476
+ * Address details are required per the verification contract.
2477
+ * All sub-fields within the block are individually optional — supply as many
2478
+ * as the partner holds for a higher-confidence match.
2479
+ * Address threshold enforcement is skipped if the EdgeBoost user has no address on file.
2480
+ */
2481
+ address: VerifyIdentityAddress;
2482
+ }
2483
+ /**
2484
+ * Similarity scores returned when identity verification passes.
2485
+ * Partners should log these for their own audit trail.
2486
+ */
2487
+ interface VerifyIdentityScores {
2488
+ /** Levenshtein-based full-name similarity score (0–100). Threshold: 70. */
2489
+ name: number;
2490
+ /** Levenshtein-based combined address similarity score (0–100). Threshold: 65. */
2491
+ address: number;
2492
+ /** Whether the ZIP code is an exact digit match. */
2493
+ zipMatch: boolean;
2494
+ }
2495
+ /**
2496
+ * Response from a successful `verifyIdentity()` call.
2497
+ *
2498
+ * @example
2499
+ * ```typescript
2500
+ * const result: VerifyIdentityResult = await edge.verifyIdentity(accessToken, options)
2501
+ * console.log(`Name score: ${result.scores.name}`) // e.g. 95
2502
+ * ```
2503
+ */
2504
+ interface VerifyIdentityResult {
2505
+ verified: true;
2506
+ scores: VerifyIdentityScores;
2507
+ }
2311
2508
  /**
2312
2509
  * All possible transfer types.
2313
2510
  * Use for validation or building UI select options.
@@ -2429,142 +2626,29 @@ interface EdgeLinkExit {
2429
2626
  message: string;
2430
2627
  };
2431
2628
  }
2432
-
2433
- type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2434
- interface EdgeEnvironmentConfig {
2435
- /**
2436
- * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
2437
- */
2438
- cognitoDomain: string;
2439
- apiBaseUrl: string;
2440
- oauthBaseUrl: string;
2441
- userClientUrl: string;
2442
- displayName: string;
2443
- isProduction: boolean;
2629
+ /** PKCE code verifier and challenge pair */
2630
+ interface PKCEPair {
2631
+ verifier: string;
2632
+ challenge: string;
2633
+ }
2634
+ /** Event emitted during the Link flow */
2635
+ interface EdgeLinkEvent {
2636
+ eventName: EdgeLinkEventName;
2637
+ timestamp: number;
2638
+ metadata?: Record<string, unknown>;
2639
+ }
2640
+ /** All possible Link event names (superset of browser + mobile events) */
2641
+ type EdgeLinkEventName = 'OPEN' | 'CLOSE' | 'HANDOFF' | 'TRANSITION' | 'REDIRECT' | 'ERROR' | 'SUCCESS';
2642
+ /** Base configuration shared by all EdgeLink implementations */
2643
+ interface EdgeLinkConfigBase {
2644
+ clientId: string;
2645
+ environment: EdgeEnvironment;
2646
+ onSuccess: (result: EdgeLinkSuccess) => void;
2647
+ onExit?: (metadata: EdgeLinkExit) => void;
2648
+ onEvent?: (event: EdgeLinkEvent) => void;
2649
+ scopes?: EdgeScope[];
2650
+ linkUrl?: string;
2444
2651
  }
2445
- declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
2446
- declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
2447
- declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
2448
- declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
2449
-
2450
- /**
2451
- * EDGE Connect OAuth Scopes
2452
- *
2453
- * OAuth scopes define what permissions your application requests from users.
2454
- * Each scope grants access to specific API endpoints.
2455
- *
2456
- * @module @edge-markets/connect/config
2457
- */
2458
- /**
2459
- * Available OAuth scopes for EDGE Connect.
2460
- *
2461
- * Request the minimum scopes your application needs.
2462
- * Users see these permissions during the consent flow.
2463
- *
2464
- * @example
2465
- * ```typescript
2466
- * // Request only what you need
2467
- * link.open({
2468
- * scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
2469
- * })
2470
- *
2471
- * // Or request all scopes
2472
- * link.open({
2473
- * scopes: ALL_EDGE_SCOPES,
2474
- * })
2475
- * ```
2476
- */
2477
- declare const EDGE_SCOPES: {
2478
- /**
2479
- * Read user profile information (name, email).
2480
- * Required for: `GET /v1/user`
2481
- */
2482
- readonly USER_READ: "user.read";
2483
- /**
2484
- * Read account balance.
2485
- * Required for: `GET /v1/balance`
2486
- */
2487
- readonly BALANCE_READ: "balance.read";
2488
- /**
2489
- * Initiate and verify fund transfers.
2490
- * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
2491
- */
2492
- readonly TRANSFER_WRITE: "transfer.write";
2493
- };
2494
- /**
2495
- * Type representing a valid EDGE Connect scope.
2496
- */
2497
- type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
2498
- /**
2499
- * All available scopes as an array.
2500
- * Use when you need full access to all API features.
2501
- *
2502
- * @example
2503
- * ```typescript
2504
- * const link = new EdgeLink({
2505
- * clientId: 'your-client-id',
2506
- * environment: 'staging',
2507
- * scopes: ALL_EDGE_SCOPES, // Request all permissions
2508
- * onSuccess: handleSuccess,
2509
- * })
2510
- * ```
2511
- */
2512
- declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
2513
- /**
2514
- * Human-readable descriptions for each scope.
2515
- * Useful for building custom consent UIs or explaining permissions.
2516
- */
2517
- declare const SCOPE_DESCRIPTIONS: Readonly<Record<EdgeScope, string>>;
2518
- /**
2519
- * Icons for each scope (for UI display).
2520
- * Using common icon library names (e.g., Lucide, Heroicons).
2521
- */
2522
- declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2523
- /**
2524
- * Builds the full scope string for a given environment.
2525
- *
2526
- * Different environments may use different scope prefixes in the API Gateway.
2527
- * This function handles the prefix automatically.
2528
- *
2529
- * Note: 'development' environment uses 'staging' scope prefix because it
2530
- * connects to the staging API Gateway for local testing.
2531
- *
2532
- * @param scope - The scope to format
2533
- * @param environment - The target environment
2534
- * @returns The full scope string for API Gateway authorization
2535
- *
2536
- * @example
2537
- * ```typescript
2538
- * formatScopeForEnvironment('user.read', 'staging')
2539
- * // Returns: 'edge-connect-staging/user.read'
2540
- *
2541
- * formatScopeForEnvironment('user.read', 'production')
2542
- * // Returns: 'edge-connect/user.read'
2543
- *
2544
- * formatScopeForEnvironment('user.read', 'development')
2545
- * // Returns: 'edge-connect-staging/user.read' (maps to staging)
2546
- * ```
2547
- */
2548
- declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
2549
- /**
2550
- * Formats multiple scopes for an environment.
2551
- *
2552
- * @param scopes - Array of scopes to format
2553
- * @param environment - The target environment
2554
- * @returns Array of full scope strings
2555
- */
2556
- declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
2557
- /**
2558
- * Parses a full scope string to extract the base scope.
2559
- *
2560
- * @param fullScope - The full scope string (e.g., 'edge-connect-staging/user.read')
2561
- * @returns The base scope (e.g., 'user.read') or null if invalid
2562
- */
2563
- declare function parseScope(fullScope: string): EdgeScope | null;
2564
- /**
2565
- * Checks if a scope string is valid.
2566
- */
2567
- declare function isValidScope(scope: string): scope is EdgeScope;
2568
2652
 
2569
2653
  /**
2570
2654
  * EDGE Connect SDK Error Classes
@@ -2779,6 +2863,32 @@ declare class EdgeValidationError extends EdgeError {
2779
2863
  readonly validationErrors: Record<string, string[]>;
2780
2864
  constructor(message: string, validationErrors: Record<string, string[]>);
2781
2865
  }
2866
+ /**
2867
+ * Thrown when identity verification fails because one or more fields do not meet
2868
+ * the similarity threshold when compared against the user's stored EdgeBoost profile.
2869
+ *
2870
+ * The `fieldErrors` map contains only the fields that failed verification.
2871
+ * Each value is a human-readable message safe to display directly to the user.
2872
+ *
2873
+ * @example
2874
+ * ```typescript
2875
+ * try {
2876
+ * await edge.verifyIdentity(accessToken, { firstName: 'John', lastName: 'Doe', address: {} })
2877
+ * } catch (error) {
2878
+ * if (error instanceof EdgeIdentityVerificationError) {
2879
+ * if (error.fieldErrors.name) {
2880
+ * showMessage(error.fieldErrors.name)
2881
+ * // "Name doesn't match what is on file, please contact support"
2882
+ * }
2883
+ * }
2884
+ * }
2885
+ * ```
2886
+ */
2887
+ declare class EdgeIdentityVerificationError extends EdgeError {
2888
+ /** Field-level messages for each failing field. Keys match the request fields (e.g. `name`, `address`). */
2889
+ readonly fieldErrors: Record<string, string>;
2890
+ constructor(fieldErrors: Record<string, string>, message?: string);
2891
+ }
2782
2892
  /**
2783
2893
  * Thrown when a popup is blocked by the browser.
2784
2894
  *
@@ -2857,6 +2967,10 @@ declare function isConsentRequiredError(error: unknown): error is EdgeConsentReq
2857
2967
  * Type guard for API errors.
2858
2968
  */
2859
2969
  declare function isApiError(error: unknown): error is EdgeApiError;
2970
+ /**
2971
+ * Type guard for identity verification errors.
2972
+ */
2973
+ declare function isIdentityVerificationError(error: unknown): error is EdgeIdentityVerificationError;
2860
2974
  /**
2861
2975
  * Type guard for network errors.
2862
2976
  */
@@ -2909,4 +3023,4 @@ declare const SDK_VERSION = "1.0.0";
2909
3023
  */
2910
3024
  declare const SDK_NAME = "@edge-markets/connect";
2911
3025
 
2912
- export { ALL_EDGE_SCOPES, type ApiError, type Balance, type ConsentRequiredError, EDGE_ENVIRONMENTS, EDGE_SCOPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeInsufficientScopeError, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferList, type TransferListItem, type TransferStatus, type TransferType, type User, type VerifyTransferRequest, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isNetworkError, isProductionEnvironment, isValidScope, type operations, parseScope, type paths };
3026
+ export { ALL_EDGE_SCOPES, type ApiError, type Balance, type ConsentRequiredError, EDGE_ENVIRONMENTS, EDGE_SCOPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferList, type TransferListItem, type TransferStatus, type TransferType, type User, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type VerifyTransferRequest, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isValidScope, type operations, parseScope, type paths };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,139 @@
1
+ type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2
+ interface EdgeEnvironmentConfig {
3
+ /**
4
+ * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
5
+ */
6
+ cognitoDomain: string;
7
+ apiBaseUrl: string;
8
+ oauthBaseUrl: string;
9
+ userClientUrl: string;
10
+ displayName: string;
11
+ isProduction: boolean;
12
+ }
13
+ declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
14
+ declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
15
+ declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
16
+ declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
17
+
18
+ /**
19
+ * EDGE Connect OAuth Scopes
20
+ *
21
+ * OAuth scopes define what permissions your application requests from users.
22
+ * Each scope grants access to specific API endpoints.
23
+ *
24
+ * @module @edge-markets/connect/config
25
+ */
26
+ /**
27
+ * Available OAuth scopes for EDGE Connect.
28
+ *
29
+ * Request the minimum scopes your application needs.
30
+ * Users see these permissions during the consent flow.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Request only what you need
35
+ * link.open({
36
+ * scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
37
+ * })
38
+ *
39
+ * // Or request all scopes
40
+ * link.open({
41
+ * scopes: ALL_EDGE_SCOPES,
42
+ * })
43
+ * ```
44
+ */
45
+ declare const EDGE_SCOPES: {
46
+ /**
47
+ * Read user profile information (name, email).
48
+ * Required for: `GET /v1/user`
49
+ */
50
+ readonly USER_READ: "user.read";
51
+ /**
52
+ * Read account balance.
53
+ * Required for: `GET /v1/balance`
54
+ */
55
+ readonly BALANCE_READ: "balance.read";
56
+ /**
57
+ * Initiate and verify fund transfers.
58
+ * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
59
+ */
60
+ readonly TRANSFER_WRITE: "transfer.write";
61
+ };
62
+ /**
63
+ * Type representing a valid EDGE Connect scope.
64
+ */
65
+ type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
66
+ /**
67
+ * All available scopes as an array.
68
+ * Use when you need full access to all API features.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const link = new EdgeLink({
73
+ * clientId: 'your-client-id',
74
+ * environment: 'staging',
75
+ * scopes: ALL_EDGE_SCOPES, // Request all permissions
76
+ * onSuccess: handleSuccess,
77
+ * })
78
+ * ```
79
+ */
80
+ declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
81
+ /**
82
+ * Human-readable descriptions for each scope.
83
+ * Useful for building custom consent UIs or explaining permissions.
84
+ */
85
+ declare const SCOPE_DESCRIPTIONS: Readonly<Record<EdgeScope, string>>;
86
+ /**
87
+ * Icons for each scope (for UI display).
88
+ * Using common icon library names (e.g., Lucide, Heroicons).
89
+ */
90
+ declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
91
+ /**
92
+ * Builds the full scope string for a given environment.
93
+ *
94
+ * Different environments may use different scope prefixes in the API Gateway.
95
+ * This function handles the prefix automatically.
96
+ *
97
+ * Note: 'development' environment uses 'staging' scope prefix because it
98
+ * connects to the staging API Gateway for local testing.
99
+ *
100
+ * @param scope - The scope to format
101
+ * @param environment - The target environment
102
+ * @returns The full scope string for API Gateway authorization
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * formatScopeForEnvironment('user.read', 'staging')
107
+ * // Returns: 'edge-connect-staging/user.read'
108
+ *
109
+ * formatScopeForEnvironment('user.read', 'production')
110
+ * // Returns: 'edge-connect/user.read'
111
+ *
112
+ * formatScopeForEnvironment('user.read', 'development')
113
+ * // Returns: 'edge-connect-staging/user.read' (maps to staging)
114
+ * ```
115
+ */
116
+ declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
117
+ /**
118
+ * Formats multiple scopes for an environment.
119
+ *
120
+ * @param scopes - Array of scopes to format
121
+ * @param environment - The target environment
122
+ * @returns Array of full scope strings
123
+ */
124
+ declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
125
+ /**
126
+ * Parses a full scope string to extract the base scope.
127
+ *
128
+ * @param fullScope - The full scope string (e.g., 'edge-connect-staging/user.read')
129
+ * @returns The base scope (e.g., 'user.read') or null if invalid
130
+ */
131
+ declare function parseScope(fullScope: string): EdgeScope | null;
132
+ /**
133
+ * Checks if a scope string is valid.
134
+ */
135
+ declare function isValidScope(scope: string): scope is EdgeScope;
136
+
1
137
  /**
2
138
  * This file was auto-generated by openapi-typescript.
3
139
  * Do not make direct changes to the file.
@@ -2308,6 +2444,67 @@ type OtpMethod = 'sms' | 'totp';
2308
2444
  * Parameters for listing transfers.
2309
2445
  */
2310
2446
  type ListTransfersParams = NonNullable<operations['listTransfers']['parameters']['query']>;
2447
+ /**
2448
+ * Address block for identity verification.
2449
+ * The block itself is required; all sub-fields are optional — supply as many
2450
+ * as the partner holds for a higher-confidence match.
2451
+ */
2452
+ interface VerifyIdentityAddress {
2453
+ /** Street address line (e.g. "123 Main St") */
2454
+ street?: string;
2455
+ city?: string;
2456
+ /** US state code (e.g. "TX") */
2457
+ state?: string;
2458
+ zip?: string;
2459
+ }
2460
+ /**
2461
+ * Options for `EdgeConnectServer.verifyIdentity()`.
2462
+ *
2463
+ * @example
2464
+ * ```typescript
2465
+ * const options: VerifyIdentityOptions = {
2466
+ * firstName: 'John',
2467
+ * lastName: 'Doe',
2468
+ * address: { street: '123 Main St', city: 'Austin', state: 'TX', zip: '78701' },
2469
+ * }
2470
+ * ```
2471
+ */
2472
+ interface VerifyIdentityOptions {
2473
+ firstName: string;
2474
+ lastName: string;
2475
+ /**
2476
+ * Address details are required per the verification contract.
2477
+ * All sub-fields within the block are individually optional — supply as many
2478
+ * as the partner holds for a higher-confidence match.
2479
+ * Address threshold enforcement is skipped if the EdgeBoost user has no address on file.
2480
+ */
2481
+ address: VerifyIdentityAddress;
2482
+ }
2483
+ /**
2484
+ * Similarity scores returned when identity verification passes.
2485
+ * Partners should log these for their own audit trail.
2486
+ */
2487
+ interface VerifyIdentityScores {
2488
+ /** Levenshtein-based full-name similarity score (0–100). Threshold: 70. */
2489
+ name: number;
2490
+ /** Levenshtein-based combined address similarity score (0–100). Threshold: 65. */
2491
+ address: number;
2492
+ /** Whether the ZIP code is an exact digit match. */
2493
+ zipMatch: boolean;
2494
+ }
2495
+ /**
2496
+ * Response from a successful `verifyIdentity()` call.
2497
+ *
2498
+ * @example
2499
+ * ```typescript
2500
+ * const result: VerifyIdentityResult = await edge.verifyIdentity(accessToken, options)
2501
+ * console.log(`Name score: ${result.scores.name}`) // e.g. 95
2502
+ * ```
2503
+ */
2504
+ interface VerifyIdentityResult {
2505
+ verified: true;
2506
+ scores: VerifyIdentityScores;
2507
+ }
2311
2508
  /**
2312
2509
  * All possible transfer types.
2313
2510
  * Use for validation or building UI select options.
@@ -2429,142 +2626,29 @@ interface EdgeLinkExit {
2429
2626
  message: string;
2430
2627
  };
2431
2628
  }
2432
-
2433
- type EdgeEnvironment = 'production' | 'staging' | 'sandbox' | 'development';
2434
- interface EdgeEnvironmentConfig {
2435
- /**
2436
- * @deprecated cognitoDomain is no longer used. Token exchange now goes through EdgeBoost API.
2437
- */
2438
- cognitoDomain: string;
2439
- apiBaseUrl: string;
2440
- oauthBaseUrl: string;
2441
- userClientUrl: string;
2442
- displayName: string;
2443
- isProduction: boolean;
2629
+ /** PKCE code verifier and challenge pair */
2630
+ interface PKCEPair {
2631
+ verifier: string;
2632
+ challenge: string;
2633
+ }
2634
+ /** Event emitted during the Link flow */
2635
+ interface EdgeLinkEvent {
2636
+ eventName: EdgeLinkEventName;
2637
+ timestamp: number;
2638
+ metadata?: Record<string, unknown>;
2639
+ }
2640
+ /** All possible Link event names (superset of browser + mobile events) */
2641
+ type EdgeLinkEventName = 'OPEN' | 'CLOSE' | 'HANDOFF' | 'TRANSITION' | 'REDIRECT' | 'ERROR' | 'SUCCESS';
2642
+ /** Base configuration shared by all EdgeLink implementations */
2643
+ interface EdgeLinkConfigBase {
2644
+ clientId: string;
2645
+ environment: EdgeEnvironment;
2646
+ onSuccess: (result: EdgeLinkSuccess) => void;
2647
+ onExit?: (metadata: EdgeLinkExit) => void;
2648
+ onEvent?: (event: EdgeLinkEvent) => void;
2649
+ scopes?: EdgeScope[];
2650
+ linkUrl?: string;
2444
2651
  }
2445
- declare const EDGE_ENVIRONMENTS: Readonly<Record<EdgeEnvironment, EdgeEnvironmentConfig>>;
2446
- declare function getEnvironmentConfig(environment: EdgeEnvironment): EdgeEnvironmentConfig;
2447
- declare function isProductionEnvironment(environment: EdgeEnvironment): boolean;
2448
- declare function getAvailableEnvironments(): readonly EdgeEnvironment[];
2449
-
2450
- /**
2451
- * EDGE Connect OAuth Scopes
2452
- *
2453
- * OAuth scopes define what permissions your application requests from users.
2454
- * Each scope grants access to specific API endpoints.
2455
- *
2456
- * @module @edge-markets/connect/config
2457
- */
2458
- /**
2459
- * Available OAuth scopes for EDGE Connect.
2460
- *
2461
- * Request the minimum scopes your application needs.
2462
- * Users see these permissions during the consent flow.
2463
- *
2464
- * @example
2465
- * ```typescript
2466
- * // Request only what you need
2467
- * link.open({
2468
- * scopes: [EDGE_SCOPES.USER_READ, EDGE_SCOPES.BALANCE_READ],
2469
- * })
2470
- *
2471
- * // Or request all scopes
2472
- * link.open({
2473
- * scopes: ALL_EDGE_SCOPES,
2474
- * })
2475
- * ```
2476
- */
2477
- declare const EDGE_SCOPES: {
2478
- /**
2479
- * Read user profile information (name, email).
2480
- * Required for: `GET /v1/user`
2481
- */
2482
- readonly USER_READ: "user.read";
2483
- /**
2484
- * Read account balance.
2485
- * Required for: `GET /v1/balance`
2486
- */
2487
- readonly BALANCE_READ: "balance.read";
2488
- /**
2489
- * Initiate and verify fund transfers.
2490
- * Required for: `POST /v1/transfer`, `POST /v1/transfer/:id/verify`, `GET /v1/transfers`
2491
- */
2492
- readonly TRANSFER_WRITE: "transfer.write";
2493
- };
2494
- /**
2495
- * Type representing a valid EDGE Connect scope.
2496
- */
2497
- type EdgeScope = (typeof EDGE_SCOPES)[keyof typeof EDGE_SCOPES];
2498
- /**
2499
- * All available scopes as an array.
2500
- * Use when you need full access to all API features.
2501
- *
2502
- * @example
2503
- * ```typescript
2504
- * const link = new EdgeLink({
2505
- * clientId: 'your-client-id',
2506
- * environment: 'staging',
2507
- * scopes: ALL_EDGE_SCOPES, // Request all permissions
2508
- * onSuccess: handleSuccess,
2509
- * })
2510
- * ```
2511
- */
2512
- declare const ALL_EDGE_SCOPES: readonly EdgeScope[];
2513
- /**
2514
- * Human-readable descriptions for each scope.
2515
- * Useful for building custom consent UIs or explaining permissions.
2516
- */
2517
- declare const SCOPE_DESCRIPTIONS: Readonly<Record<EdgeScope, string>>;
2518
- /**
2519
- * Icons for each scope (for UI display).
2520
- * Using common icon library names (e.g., Lucide, Heroicons).
2521
- */
2522
- declare const SCOPE_ICONS: Readonly<Record<EdgeScope, string>>;
2523
- /**
2524
- * Builds the full scope string for a given environment.
2525
- *
2526
- * Different environments may use different scope prefixes in the API Gateway.
2527
- * This function handles the prefix automatically.
2528
- *
2529
- * Note: 'development' environment uses 'staging' scope prefix because it
2530
- * connects to the staging API Gateway for local testing.
2531
- *
2532
- * @param scope - The scope to format
2533
- * @param environment - The target environment
2534
- * @returns The full scope string for API Gateway authorization
2535
- *
2536
- * @example
2537
- * ```typescript
2538
- * formatScopeForEnvironment('user.read', 'staging')
2539
- * // Returns: 'edge-connect-staging/user.read'
2540
- *
2541
- * formatScopeForEnvironment('user.read', 'production')
2542
- * // Returns: 'edge-connect/user.read'
2543
- *
2544
- * formatScopeForEnvironment('user.read', 'development')
2545
- * // Returns: 'edge-connect-staging/user.read' (maps to staging)
2546
- * ```
2547
- */
2548
- declare function formatScopeForEnvironment(scope: EdgeScope, environment: 'production' | 'staging' | 'sandbox' | 'development'): string;
2549
- /**
2550
- * Formats multiple scopes for an environment.
2551
- *
2552
- * @param scopes - Array of scopes to format
2553
- * @param environment - The target environment
2554
- * @returns Array of full scope strings
2555
- */
2556
- declare function formatScopesForEnvironment(scopes: readonly EdgeScope[] | EdgeScope[], environment: 'production' | 'staging' | 'sandbox' | 'development'): string[];
2557
- /**
2558
- * Parses a full scope string to extract the base scope.
2559
- *
2560
- * @param fullScope - The full scope string (e.g., 'edge-connect-staging/user.read')
2561
- * @returns The base scope (e.g., 'user.read') or null if invalid
2562
- */
2563
- declare function parseScope(fullScope: string): EdgeScope | null;
2564
- /**
2565
- * Checks if a scope string is valid.
2566
- */
2567
- declare function isValidScope(scope: string): scope is EdgeScope;
2568
2652
 
2569
2653
  /**
2570
2654
  * EDGE Connect SDK Error Classes
@@ -2779,6 +2863,32 @@ declare class EdgeValidationError extends EdgeError {
2779
2863
  readonly validationErrors: Record<string, string[]>;
2780
2864
  constructor(message: string, validationErrors: Record<string, string[]>);
2781
2865
  }
2866
+ /**
2867
+ * Thrown when identity verification fails because one or more fields do not meet
2868
+ * the similarity threshold when compared against the user's stored EdgeBoost profile.
2869
+ *
2870
+ * The `fieldErrors` map contains only the fields that failed verification.
2871
+ * Each value is a human-readable message safe to display directly to the user.
2872
+ *
2873
+ * @example
2874
+ * ```typescript
2875
+ * try {
2876
+ * await edge.verifyIdentity(accessToken, { firstName: 'John', lastName: 'Doe', address: {} })
2877
+ * } catch (error) {
2878
+ * if (error instanceof EdgeIdentityVerificationError) {
2879
+ * if (error.fieldErrors.name) {
2880
+ * showMessage(error.fieldErrors.name)
2881
+ * // "Name doesn't match what is on file, please contact support"
2882
+ * }
2883
+ * }
2884
+ * }
2885
+ * ```
2886
+ */
2887
+ declare class EdgeIdentityVerificationError extends EdgeError {
2888
+ /** Field-level messages for each failing field. Keys match the request fields (e.g. `name`, `address`). */
2889
+ readonly fieldErrors: Record<string, string>;
2890
+ constructor(fieldErrors: Record<string, string>, message?: string);
2891
+ }
2782
2892
  /**
2783
2893
  * Thrown when a popup is blocked by the browser.
2784
2894
  *
@@ -2857,6 +2967,10 @@ declare function isConsentRequiredError(error: unknown): error is EdgeConsentReq
2857
2967
  * Type guard for API errors.
2858
2968
  */
2859
2969
  declare function isApiError(error: unknown): error is EdgeApiError;
2970
+ /**
2971
+ * Type guard for identity verification errors.
2972
+ */
2973
+ declare function isIdentityVerificationError(error: unknown): error is EdgeIdentityVerificationError;
2860
2974
  /**
2861
2975
  * Type guard for network errors.
2862
2976
  */
@@ -2909,4 +3023,4 @@ declare const SDK_VERSION = "1.0.0";
2909
3023
  */
2910
3024
  declare const SDK_NAME = "@edge-markets/connect";
2911
3025
 
2912
- export { ALL_EDGE_SCOPES, type ApiError, type Balance, type ConsentRequiredError, EDGE_ENVIRONMENTS, EDGE_SCOPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeInsufficientScopeError, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferList, type TransferListItem, type TransferStatus, type TransferType, type User, type VerifyTransferRequest, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isNetworkError, isProductionEnvironment, isValidScope, type operations, parseScope, type paths };
3026
+ export { ALL_EDGE_SCOPES, type ApiError, type Balance, type ConsentRequiredError, EDGE_ENVIRONMENTS, EDGE_SCOPES, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, type EdgeEnvironment, type EdgeEnvironmentConfig, EdgeError, EdgeIdentityVerificationError, EdgeInsufficientScopeError, type EdgeLinkConfigBase, type EdgeLinkEvent, type EdgeLinkEventName, type EdgeLinkExit, type EdgeLinkSuccess, EdgeNetworkError, EdgeNotFoundError, EdgePopupBlockedError, EdgePopupClosedError, type EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, type EdgeTokens, EdgeValidationError, type InitiateTransferRequest, type ListTransfersParams, OTP_METHODS, type OtpMethod, type PKCEPair, type RevokeConsentResponse, SCOPE_DESCRIPTIONS, SCOPE_ICONS, SDK_NAME, SDK_VERSION, TRANSFER_STATUSES, TRANSFER_TYPES, type Transfer, type TransferList, type TransferListItem, type TransferStatus, type TransferType, type User, type VerifyIdentityAddress, type VerifyIdentityOptions, type VerifyIdentityResult, type VerifyIdentityScores, type VerifyTransferRequest, type components, formatScopeForEnvironment, formatScopesForEnvironment, getAvailableEnvironments, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isEdgeError, isIdentityVerificationError, isNetworkError, isProductionEnvironment, isValidScope, type operations, parseScope, type paths };
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  EdgeAuthenticationError: () => EdgeAuthenticationError,
28
28
  EdgeConsentRequiredError: () => EdgeConsentRequiredError,
29
29
  EdgeError: () => EdgeError,
30
+ EdgeIdentityVerificationError: () => EdgeIdentityVerificationError,
30
31
  EdgeInsufficientScopeError: () => EdgeInsufficientScopeError,
31
32
  EdgeNetworkError: () => EdgeNetworkError,
32
33
  EdgeNotFoundError: () => EdgeNotFoundError,
@@ -50,6 +51,7 @@ __export(index_exports, {
50
51
  isAuthenticationError: () => isAuthenticationError,
51
52
  isConsentRequiredError: () => isConsentRequiredError,
52
53
  isEdgeError: () => isEdgeError,
54
+ isIdentityVerificationError: () => isIdentityVerificationError,
53
55
  isNetworkError: () => isNetworkError,
54
56
  isProductionEnvironment: () => isProductionEnvironment,
55
57
  isValidScope: () => isValidScope,
@@ -203,34 +205,19 @@ var EdgeError = class _EdgeError extends Error {
203
205
  };
204
206
  var EdgeAuthenticationError = class extends EdgeError {
205
207
  constructor(message, details) {
206
- super(
207
- "authentication_failed",
208
- message || "Authentication failed or access token is invalid/expired",
209
- 401,
210
- details
211
- );
208
+ super("authentication_failed", message || "Authentication failed or access token is invalid/expired", 401, details);
212
209
  this.name = "EdgeAuthenticationError";
213
210
  }
214
211
  };
215
212
  var EdgeTokenExchangeError = class extends EdgeError {
216
213
  constructor(message, details) {
217
- super(
218
- "token_exchange_failed",
219
- message || "Failed to exchange authorization code for tokens",
220
- 400,
221
- details
222
- );
214
+ super("token_exchange_failed", message || "Failed to exchange authorization code for tokens", 400, details);
223
215
  this.name = "EdgeTokenExchangeError";
224
216
  }
225
217
  };
226
218
  var EdgeConsentRequiredError = class extends EdgeError {
227
219
  constructor(clientId, consentUrl, message) {
228
- super(
229
- "consent_required",
230
- message || "User has not granted consent to this application",
231
- 403,
232
- { clientId, consentUrl }
233
- );
220
+ super("consent_required", message || "User has not granted consent to this application", 403, { clientId, consentUrl });
234
221
  this.name = "EdgeConsentRequiredError";
235
222
  this.clientId = clientId;
236
223
  this.consentUrl = consentUrl;
@@ -238,12 +225,7 @@ var EdgeConsentRequiredError = class extends EdgeError {
238
225
  };
239
226
  var EdgeInsufficientScopeError = class extends EdgeError {
240
227
  constructor(missingScopes, message) {
241
- super(
242
- "insufficient_scope",
243
- message || `Missing required scopes: ${missingScopes.join(", ")}`,
244
- 403,
245
- { missingScopes }
246
- );
228
+ super("insufficient_scope", message || `Missing required scopes: ${missingScopes.join(", ")}`, 403, { missingScopes });
247
229
  this.name = "EdgeInsufficientScopeError";
248
230
  this.missingScopes = missingScopes;
249
231
  }
@@ -269,12 +251,18 @@ var EdgeValidationError = class extends EdgeError {
269
251
  this.validationErrors = validationErrors;
270
252
  }
271
253
  };
254
+ var EdgeIdentityVerificationError = class extends EdgeError {
255
+ constructor(fieldErrors, message) {
256
+ super("identity_verification_failed", message || "Identity verification failed. Please contact support.", 422, {
257
+ fieldErrors
258
+ });
259
+ this.name = "EdgeIdentityVerificationError";
260
+ this.fieldErrors = fieldErrors;
261
+ }
262
+ };
272
263
  var EdgePopupBlockedError = class extends EdgeError {
273
264
  constructor() {
274
- super(
275
- "popup_blocked",
276
- "Popup was blocked by the browser. Please allow popups for this site and try again."
277
- );
265
+ super("popup_blocked", "Popup was blocked by the browser. Please allow popups for this site and try again.");
278
266
  this.name = "EdgePopupBlockedError";
279
267
  }
280
268
  toUserMessage() {
@@ -289,10 +277,7 @@ var EdgePopupClosedError = class extends EdgeError {
289
277
  };
290
278
  var EdgeStateMismatchError = class extends EdgeError {
291
279
  constructor() {
292
- super(
293
- "state_mismatch",
294
- "Security error: state parameter mismatch. Please try again."
295
- );
280
+ super("state_mismatch", "Security error: state parameter mismatch. Please try again.");
296
281
  this.name = "EdgeStateMismatchError";
297
282
  }
298
283
  };
@@ -317,6 +302,9 @@ function isConsentRequiredError(error) {
317
302
  function isApiError(error) {
318
303
  return error instanceof EdgeApiError;
319
304
  }
305
+ function isIdentityVerificationError(error) {
306
+ return error instanceof EdgeIdentityVerificationError;
307
+ }
320
308
  function isNetworkError(error) {
321
309
  return error instanceof EdgeNetworkError;
322
310
  }
@@ -333,6 +321,7 @@ var SDK_NAME = "@edge-markets/connect";
333
321
  EdgeAuthenticationError,
334
322
  EdgeConsentRequiredError,
335
323
  EdgeError,
324
+ EdgeIdentityVerificationError,
336
325
  EdgeInsufficientScopeError,
337
326
  EdgeNetworkError,
338
327
  EdgeNotFoundError,
@@ -356,6 +345,7 @@ var SDK_NAME = "@edge-markets/connect";
356
345
  isAuthenticationError,
357
346
  isConsentRequiredError,
358
347
  isEdgeError,
348
+ isIdentityVerificationError,
359
349
  isNetworkError,
360
350
  isProductionEnvironment,
361
351
  isValidScope,
package/dist/index.mjs CHANGED
@@ -144,34 +144,19 @@ var EdgeError = class _EdgeError extends Error {
144
144
  };
145
145
  var EdgeAuthenticationError = class extends EdgeError {
146
146
  constructor(message, details) {
147
- super(
148
- "authentication_failed",
149
- message || "Authentication failed or access token is invalid/expired",
150
- 401,
151
- details
152
- );
147
+ super("authentication_failed", message || "Authentication failed or access token is invalid/expired", 401, details);
153
148
  this.name = "EdgeAuthenticationError";
154
149
  }
155
150
  };
156
151
  var EdgeTokenExchangeError = class extends EdgeError {
157
152
  constructor(message, details) {
158
- super(
159
- "token_exchange_failed",
160
- message || "Failed to exchange authorization code for tokens",
161
- 400,
162
- details
163
- );
153
+ super("token_exchange_failed", message || "Failed to exchange authorization code for tokens", 400, details);
164
154
  this.name = "EdgeTokenExchangeError";
165
155
  }
166
156
  };
167
157
  var EdgeConsentRequiredError = class extends EdgeError {
168
158
  constructor(clientId, consentUrl, message) {
169
- super(
170
- "consent_required",
171
- message || "User has not granted consent to this application",
172
- 403,
173
- { clientId, consentUrl }
174
- );
159
+ super("consent_required", message || "User has not granted consent to this application", 403, { clientId, consentUrl });
175
160
  this.name = "EdgeConsentRequiredError";
176
161
  this.clientId = clientId;
177
162
  this.consentUrl = consentUrl;
@@ -179,12 +164,7 @@ var EdgeConsentRequiredError = class extends EdgeError {
179
164
  };
180
165
  var EdgeInsufficientScopeError = class extends EdgeError {
181
166
  constructor(missingScopes, message) {
182
- super(
183
- "insufficient_scope",
184
- message || `Missing required scopes: ${missingScopes.join(", ")}`,
185
- 403,
186
- { missingScopes }
187
- );
167
+ super("insufficient_scope", message || `Missing required scopes: ${missingScopes.join(", ")}`, 403, { missingScopes });
188
168
  this.name = "EdgeInsufficientScopeError";
189
169
  this.missingScopes = missingScopes;
190
170
  }
@@ -210,12 +190,18 @@ var EdgeValidationError = class extends EdgeError {
210
190
  this.validationErrors = validationErrors;
211
191
  }
212
192
  };
193
+ var EdgeIdentityVerificationError = class extends EdgeError {
194
+ constructor(fieldErrors, message) {
195
+ super("identity_verification_failed", message || "Identity verification failed. Please contact support.", 422, {
196
+ fieldErrors
197
+ });
198
+ this.name = "EdgeIdentityVerificationError";
199
+ this.fieldErrors = fieldErrors;
200
+ }
201
+ };
213
202
  var EdgePopupBlockedError = class extends EdgeError {
214
203
  constructor() {
215
- super(
216
- "popup_blocked",
217
- "Popup was blocked by the browser. Please allow popups for this site and try again."
218
- );
204
+ super("popup_blocked", "Popup was blocked by the browser. Please allow popups for this site and try again.");
219
205
  this.name = "EdgePopupBlockedError";
220
206
  }
221
207
  toUserMessage() {
@@ -230,10 +216,7 @@ var EdgePopupClosedError = class extends EdgeError {
230
216
  };
231
217
  var EdgeStateMismatchError = class extends EdgeError {
232
218
  constructor() {
233
- super(
234
- "state_mismatch",
235
- "Security error: state parameter mismatch. Please try again."
236
- );
219
+ super("state_mismatch", "Security error: state parameter mismatch. Please try again.");
237
220
  this.name = "EdgeStateMismatchError";
238
221
  }
239
222
  };
@@ -258,6 +241,9 @@ function isConsentRequiredError(error) {
258
241
  function isApiError(error) {
259
242
  return error instanceof EdgeApiError;
260
243
  }
244
+ function isIdentityVerificationError(error) {
245
+ return error instanceof EdgeIdentityVerificationError;
246
+ }
261
247
  function isNetworkError(error) {
262
248
  return error instanceof EdgeNetworkError;
263
249
  }
@@ -273,6 +259,7 @@ export {
273
259
  EdgeAuthenticationError,
274
260
  EdgeConsentRequiredError,
275
261
  EdgeError,
262
+ EdgeIdentityVerificationError,
276
263
  EdgeInsufficientScopeError,
277
264
  EdgeNetworkError,
278
265
  EdgeNotFoundError,
@@ -296,6 +283,7 @@ export {
296
283
  isAuthenticationError,
297
284
  isConsentRequiredError,
298
285
  isEdgeError,
286
+ isIdentityVerificationError,
299
287
  isNetworkError,
300
288
  isProductionEnvironment,
301
289
  isValidScope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edge-markets/connect",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Core types, configuration, and utilities for EDGE Connect SDK",
5
5
  "author": "EdgeBoost",
6
6
  "license": "MIT",