@trymellon/js 1.7.2 → 1.7.4

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/react.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NWZ51vgt.cjs';
3
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NM6i2RKa.cjs';
4
4
 
5
5
  declare function TryMellonProvider(props: {
6
6
  client: TryMellon;
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NWZ51vgt.js';
3
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NM6i2RKa.js';
4
4
 
5
5
  declare function TryMellonProvider(props: {
6
6
  client: TryMellon;
@@ -72,6 +72,8 @@ interface RegisterOptions {
72
72
  */
73
73
  external_user_id?: string | ExternalUserId;
74
74
  authenticatorType?: 'platform' | 'cross-platform';
75
+ /** Optional URL to redirect to after success; validated against application allowlist. API returns it as redirect_url when allowed. */
76
+ successUrl?: string;
75
77
  signal?: AbortSignal;
76
78
  }
77
79
  interface AuthenticateOptions {
@@ -84,6 +86,8 @@ interface AuthenticateOptions {
84
86
  */
85
87
  external_user_id?: string | ExternalUserId;
86
88
  hint?: string;
89
+ /** Optional URL to redirect to after success; validated against application allowlist. API returns it as redirect_url when allowed. */
90
+ successUrl?: string;
87
91
  signal?: AbortSignal;
88
92
  /** Conditional UI mediation for passkey autofill / conditional UI. */
89
93
  mediation?: 'optional' | 'conditional' | 'required';
@@ -115,9 +119,13 @@ type EmailFallbackStartOptions = {
115
119
  type EmailFallbackVerifyOptions = {
116
120
  userId: string;
117
121
  code: string;
122
+ /** Optional URL to redirect to after success; validated against application allowlist. */
123
+ successUrl?: string;
118
124
  };
119
125
  type EmailFallbackVerifyResult = {
120
126
  sessionToken: string;
127
+ /** Set when successUrl was passed and allowed by application allowlist */
128
+ redirectUrl?: string;
121
129
  };
122
130
  type RecoveryVerifyResponse = {
123
131
  challenge: Record<string, unknown>;
@@ -170,6 +178,8 @@ type CrossDeviceInitResult = {
170
178
  session_id: string;
171
179
  qr_url: string;
172
180
  expires_at: string;
181
+ /** Opaque token; send in X-Polling-Token header when calling GET status. Not included in qr_url. */
182
+ polling_token: string;
173
183
  };
174
184
  type CrossDeviceStatusResult = {
175
185
  status: 'pending' | 'authenticated' | 'completed';
@@ -224,6 +234,7 @@ type RegisterFinishRequest = {
224
234
  };
225
235
  type: 'public-key';
226
236
  };
237
+ success_url?: string;
227
238
  };
228
239
  type AuthFinishRequest = {
229
240
  session_id: string;
@@ -238,6 +249,7 @@ type AuthFinishRequest = {
238
249
  };
239
250
  type: 'public-key';
240
251
  };
252
+ success_url?: string;
241
253
  };
242
254
  type RegisterStartResponse = {
243
255
  challenge: {
@@ -293,6 +305,8 @@ interface RegisterFinishResponse {
293
305
  email?: string;
294
306
  metadata?: Record<string, unknown>;
295
307
  };
308
+ /** Present when success_url was sent and allowed by application allowlist */
309
+ redirect_url?: string;
296
310
  }
297
311
  interface AuthFinishResponse {
298
312
  authenticated: boolean;
@@ -308,6 +322,8 @@ interface AuthFinishResponse {
308
322
  backupStatus?: boolean;
309
323
  };
310
324
  session_token: string;
325
+ /** Present when success_url was sent and allowed by application allowlist */
326
+ redirect_url?: string;
311
327
  }
312
328
  interface RegisterResult {
313
329
  success: true;
@@ -325,6 +341,8 @@ interface RegisterResult {
325
341
  email?: string;
326
342
  metadata?: Record<string, unknown>;
327
343
  };
344
+ /** Set when successUrl was passed and allowed by application allowlist */
345
+ redirectUrl?: string;
328
346
  }
329
347
  interface AuthenticateResult {
330
348
  authenticated: boolean;
@@ -340,6 +358,8 @@ interface AuthenticateResult {
340
358
  backupEligible?: boolean;
341
359
  backupStatus?: boolean;
342
360
  };
361
+ /** Set when successUrl was passed and allowed by application allowlist */
362
+ redirectUrl?: string;
343
363
  }
344
364
  type SessionValidateResponse = {
345
365
  valid: boolean;
@@ -431,8 +451,13 @@ declare class ApiClient {
431
451
  userId: string;
432
452
  email: string;
433
453
  }): Promise<Result<void, TryMellonError>>;
434
- verifyEmailCode(userId: string, code: string): Promise<Result<{
454
+ verifyEmailCode(options: {
455
+ userId: string;
456
+ code: string;
457
+ successUrl?: string;
458
+ }): Promise<Result<{
435
459
  sessionToken: string;
460
+ redirectUrl?: string;
436
461
  }, TryMellonError>>;
437
462
  startOnboarding(request: OnboardingStartRequest): Promise<Result<OnboardingStartResponse, TryMellonError>>;
438
463
  getOnboardingStatus(sessionId: string): Promise<Result<OnboardingStatusResponse, TryMellonError>>;
@@ -443,7 +468,7 @@ declare class ApiClient {
443
468
  initCrossDeviceRegistration(options: {
444
469
  externalUserId: string;
445
470
  }): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
446
- getCrossDeviceStatus(sessionId: string): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
471
+ getCrossDeviceStatus(sessionId: string, pollingToken?: string | null): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
447
472
  /**
448
473
  * Fetches WebAuthn options for the cross-device session.
449
474
  * Contract: response is CrossDeviceContextResult (auth | registration).
@@ -515,7 +540,7 @@ declare class TryMellon {
515
540
  initRegistration: (options: {
516
541
  externalUserId: string;
517
542
  }) => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
518
- waitForSession: (sessionId: string, signal?: AbortSignal) => Promise<Result<{
543
+ waitForSession: (sessionId: string, signal?: AbortSignal, pollingToken?: string | null) => Promise<Result<{
519
544
  session_token: string;
520
545
  user_id: string;
521
546
  }, TryMellonError>>;
@@ -72,6 +72,8 @@ interface RegisterOptions {
72
72
  */
73
73
  external_user_id?: string | ExternalUserId;
74
74
  authenticatorType?: 'platform' | 'cross-platform';
75
+ /** Optional URL to redirect to after success; validated against application allowlist. API returns it as redirect_url when allowed. */
76
+ successUrl?: string;
75
77
  signal?: AbortSignal;
76
78
  }
77
79
  interface AuthenticateOptions {
@@ -84,6 +86,8 @@ interface AuthenticateOptions {
84
86
  */
85
87
  external_user_id?: string | ExternalUserId;
86
88
  hint?: string;
89
+ /** Optional URL to redirect to after success; validated against application allowlist. API returns it as redirect_url when allowed. */
90
+ successUrl?: string;
87
91
  signal?: AbortSignal;
88
92
  /** Conditional UI mediation for passkey autofill / conditional UI. */
89
93
  mediation?: 'optional' | 'conditional' | 'required';
@@ -115,9 +119,13 @@ type EmailFallbackStartOptions = {
115
119
  type EmailFallbackVerifyOptions = {
116
120
  userId: string;
117
121
  code: string;
122
+ /** Optional URL to redirect to after success; validated against application allowlist. */
123
+ successUrl?: string;
118
124
  };
119
125
  type EmailFallbackVerifyResult = {
120
126
  sessionToken: string;
127
+ /** Set when successUrl was passed and allowed by application allowlist */
128
+ redirectUrl?: string;
121
129
  };
122
130
  type RecoveryVerifyResponse = {
123
131
  challenge: Record<string, unknown>;
@@ -170,6 +178,8 @@ type CrossDeviceInitResult = {
170
178
  session_id: string;
171
179
  qr_url: string;
172
180
  expires_at: string;
181
+ /** Opaque token; send in X-Polling-Token header when calling GET status. Not included in qr_url. */
182
+ polling_token: string;
173
183
  };
174
184
  type CrossDeviceStatusResult = {
175
185
  status: 'pending' | 'authenticated' | 'completed';
@@ -224,6 +234,7 @@ type RegisterFinishRequest = {
224
234
  };
225
235
  type: 'public-key';
226
236
  };
237
+ success_url?: string;
227
238
  };
228
239
  type AuthFinishRequest = {
229
240
  session_id: string;
@@ -238,6 +249,7 @@ type AuthFinishRequest = {
238
249
  };
239
250
  type: 'public-key';
240
251
  };
252
+ success_url?: string;
241
253
  };
242
254
  type RegisterStartResponse = {
243
255
  challenge: {
@@ -293,6 +305,8 @@ interface RegisterFinishResponse {
293
305
  email?: string;
294
306
  metadata?: Record<string, unknown>;
295
307
  };
308
+ /** Present when success_url was sent and allowed by application allowlist */
309
+ redirect_url?: string;
296
310
  }
297
311
  interface AuthFinishResponse {
298
312
  authenticated: boolean;
@@ -308,6 +322,8 @@ interface AuthFinishResponse {
308
322
  backupStatus?: boolean;
309
323
  };
310
324
  session_token: string;
325
+ /** Present when success_url was sent and allowed by application allowlist */
326
+ redirect_url?: string;
311
327
  }
312
328
  interface RegisterResult {
313
329
  success: true;
@@ -325,6 +341,8 @@ interface RegisterResult {
325
341
  email?: string;
326
342
  metadata?: Record<string, unknown>;
327
343
  };
344
+ /** Set when successUrl was passed and allowed by application allowlist */
345
+ redirectUrl?: string;
328
346
  }
329
347
  interface AuthenticateResult {
330
348
  authenticated: boolean;
@@ -340,6 +358,8 @@ interface AuthenticateResult {
340
358
  backupEligible?: boolean;
341
359
  backupStatus?: boolean;
342
360
  };
361
+ /** Set when successUrl was passed and allowed by application allowlist */
362
+ redirectUrl?: string;
343
363
  }
344
364
  type SessionValidateResponse = {
345
365
  valid: boolean;
@@ -431,8 +451,13 @@ declare class ApiClient {
431
451
  userId: string;
432
452
  email: string;
433
453
  }): Promise<Result<void, TryMellonError>>;
434
- verifyEmailCode(userId: string, code: string): Promise<Result<{
454
+ verifyEmailCode(options: {
455
+ userId: string;
456
+ code: string;
457
+ successUrl?: string;
458
+ }): Promise<Result<{
435
459
  sessionToken: string;
460
+ redirectUrl?: string;
436
461
  }, TryMellonError>>;
437
462
  startOnboarding(request: OnboardingStartRequest): Promise<Result<OnboardingStartResponse, TryMellonError>>;
438
463
  getOnboardingStatus(sessionId: string): Promise<Result<OnboardingStatusResponse, TryMellonError>>;
@@ -443,7 +468,7 @@ declare class ApiClient {
443
468
  initCrossDeviceRegistration(options: {
444
469
  externalUserId: string;
445
470
  }): Promise<Result<CrossDeviceInitResult, TryMellonError>>;
446
- getCrossDeviceStatus(sessionId: string): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
471
+ getCrossDeviceStatus(sessionId: string, pollingToken?: string | null): Promise<Result<CrossDeviceStatusResult, TryMellonError>>;
447
472
  /**
448
473
  * Fetches WebAuthn options for the cross-device session.
449
474
  * Contract: response is CrossDeviceContextResult (auth | registration).
@@ -515,7 +540,7 @@ declare class TryMellon {
515
540
  initRegistration: (options: {
516
541
  externalUserId: string;
517
542
  }) => Promise<Result<CrossDeviceInitResult, TryMellonError>>;
518
- waitForSession: (sessionId: string, signal?: AbortSignal) => Promise<Result<{
543
+ waitForSession: (sessionId: string, signal?: AbortSignal, pollingToken?: string | null) => Promise<Result<{
519
544
  session_token: string;
520
545
  user_id: string;
521
546
  }, TryMellonError>>;
package/dist/vue.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NWZ51vgt.cjs';
2
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NM6i2RKa.cjs';
3
3
 
4
4
  declare const TryMellonKey: InjectionKey<TryMellon>;
5
5
  declare function provideTryMellon(client: TryMellon): void;
package/dist/vue.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
- import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NWZ51vgt.js';
2
+ import { T as TryMellon, R as Result, a as RegisterResult, b as TryMellonError, c as RegisterOptions, A as AuthenticateResult, d as AuthenticateOptions } from './trymellon-NM6i2RKa.js';
3
3
 
4
4
  declare const TryMellonKey: InjectionKey<TryMellon>;
5
5
  declare function provideTryMellon(client: TryMellon): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trymellon/js",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "SDK oficial de TryMellon para integrar autenticación passwordless con Passkeys / WebAuthn",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",