@seamless-auth/react 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @seamless-auth/react
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 28623e2: Offer a way past passkey registration when another login method is enabled.
8
+
9
+ Registration used to end on a screen with one control on it. A user who did not want a passkey, or
10
+ whose device could not make one, had no way forward: the unsupported branch rendered a message and
11
+ nothing else, on a screen with no exit. The session already exists by then, since the OTP step that
12
+ leads here establishes it, so leaving without a passkey was always a legitimate way to finish.
13
+
14
+ `useLoginMethods` reads the instance configuration from the auth server, and the skip only appears
15
+ when a method other than `passkey` is enabled. With passkey as the only method a skip would leave a
16
+ user unable to sign back into the account they just created, so the control is not rendered at all.
17
+ Unknown counts as unsafe: a failed or in-flight read shows no skip rather than guessing.
18
+
19
+ The unsupported-device branch now says which case it is, and offers the same way forward when one
20
+ exists.
21
+
22
+ `Login` no longer starts from a hardcoded `['passkey', 'magic_link', 'phone_otp']`. It uses the
23
+ methods the instance reports, falling back to the narrower `['passkey', 'magic_link']` that matches
24
+ the auth server's own defaults. The login response stays authoritative when it carries methods of
25
+ its own.
26
+
27
+ Requires an auth server serving `GET /system-config/public`, and an adapter that proxies it.
28
+
29
+ ## 0.7.0
30
+
31
+ ### Minor Changes
32
+
33
+ - b4b7ca1: Stop discarding the underlying WebAuthn error. The passkey login, passkey registration, and step-up verification methods now attach the thrown ceremony error to the returned `SeamlessAuthError` as `cause`, and a new `getWebAuthnErrorDetail()` export reads its `name`, `code`, and `message`. Callers can tell a dismissed prompt or missing credential (`NotAllowedError`) apart from an origin or RP ID mismatch (`SecurityError`) instead of seeing one generic string. The friendly result messages are unchanged, and only the error name is logged.
34
+ - 41dfea7: Adopt `@seamless-auth/types` for the API request and response shapes. The SDK's types were hand-written and maintained in parallel with the auth API's schemas; they are now aliases of the published contract, so they cannot drift from what the API actually sends. The dependency is types-only, imported with `import type`, so no schema validation library reaches your bundle and the export names you import are unchanged.
35
+
36
+ Some types are now more accurate, which is a breaking change at the type level for adopters:
37
+ - `Credential.lastUsedAt` is `string | null | undefined`, not `Date | null`. The API serializes it as an ISO 8601 string, so code calling a `Date` method on it was relying on a type that never matched the wire value and threw at runtime. Wrap it yourself: `new Date(credential.lastUsedAt)`.
38
+ - `Credential.deviceType`, `friendlyName`, `platform`, `browser`, and `deviceInfo` are optional, matching the API. `Credential.createdAt` is now present.
39
+ - `User.phone` is `string | null`, and `User.roles` is required rather than optional. `User` also carries `lastLogin`.
40
+ - `Organization.createdAt` and `updatedAt` are `string` rather than `string | Date`.
41
+
42
+ No runtime behavior changes.
43
+
44
+ - 3922389: Surface OAuth callback error codes. A new `getOAuthErrorCode()` export reads the auth API's machine-readable `code` off a `SeamlessAuthError` and narrows it to `oauth_missing_email`, `oauth_email_not_verified`, or `oauth_missing_subject`, returning `undefined` for anything unrecognized. The bundled OAuth callback screen now maps those three codes to actionable text instead of one generic failure message.
45
+
46
+ ### Patch Changes
47
+
48
+ - a82768d: Read the OAuth failure code from a nested `details` object when the error body does not carry it at the top level. `getOAuthErrorCode` only looked at a top-level `code`, which is where the auth API puts it, so a proxy that normalized the error body and moved the siblings of `error` under `details` silently downgraded OAuth messaging to a generic failure. Both locations are accepted now, the top level still wins, and the allowlist is unchanged: an unrecognized code in either place still returns `undefined`.
49
+ - e27dcca: Stop calling the logout endpoint when the session check fails. A failed `/users/me` means the server already considers the session unusable, so the SDK now clears it locally instead of sending a `DELETE /logout` for a session that does not exist. Previously every anonymous page load fired that second request.
50
+
51
+ Session state now lives in a framework-agnostic store behind `AuthProvider`, which reads it through `useSyncExternalStore`. The provider's public API is unchanged. Reading a previous sign-in goes through a storage port that falls back to memory when there is no `localStorage`, so the store is safe to create during server-side rendering.
52
+
53
+ The store survives a remount. React can run mount, cleanup, mount against the same provider, which StrictMode does on every mount and Activity does whenever a hidden tree is shown again, so the provider no longer destroys the store from its effect cleanup. `destroy()` is terminal, and tearing it down there left the remounted provider holding a store that refused every update and stayed on `loading: true`.
54
+
55
+ - 83bf7b8: Take the last five response envelopes from `@seamless-auth/types` instead of declaring them here. `OAuthProvidersResult`, `CredentialUpdateResult`, `OrganizationResult`, `OrganizationMembersResult`, and `OrganizationMembershipResult` were hand-written because the package had no exported alias for their schemas; types 0.4.0 exports one for every schema, so they are aliases now like the rest. The shapes are identical, so this is a no-op for adopters, and the dependency stays types-only.
56
+
3
57
  ## 0.6.0
4
58
 
5
59
  ### Minor Changes
package/README.md CHANGED
@@ -18,6 +18,8 @@
18
18
  - `usePasskeySupport()`
19
19
  - `hasScopedRole()` and `roleGrantsAccess()`
20
20
  - `SeamlessAuthError`, the error type carried on a failed result
21
+ - `getOAuthErrorCode()`, which reads the known OAuth callback failure codes off that error
22
+ - `getWebAuthnErrorDetail()`, which reads the underlying failure of a passkey or step-up ceremony
21
23
  - types including `AuthContextType`, `Credential`, `User`, `OAuthProvider`, `StepUpStatus`, the `SeamlessAuthResult` wrapper, and the headless client input/result types
22
24
 
23
25
  ## Installation
@@ -384,6 +386,33 @@ function OAuthCallback() {
384
386
  }
385
387
  ```
386
388
 
389
+ Some callback failures are the user's to fix, so the API returns a stable `code` alongside the error
390
+ message. `getOAuthErrorCode()` narrows it to the codes this SDK knows about and returns `undefined`
391
+ for everything else, so unexpected failures keep your generic message:
392
+
393
+ ```tsx
394
+ import { getOAuthErrorCode, useAuth } from '@seamless-auth/react';
395
+
396
+ const { error } = await finishOAuthLogin({ providerId, code, state });
397
+
398
+ switch (getOAuthErrorCode(error)) {
399
+ case 'oauth_missing_email':
400
+ // The provider account shared no email address.
401
+ break;
402
+ case 'oauth_email_not_verified':
403
+ // The provider account's email is unverified.
404
+ break;
405
+ case 'oauth_missing_subject':
406
+ // The provider returned no usable account identifier.
407
+ break;
408
+ default:
409
+ // No error, or one without a recognized code.
410
+ break;
411
+ }
412
+ ```
413
+
414
+ The bundled `AuthRoutes` callback screen already maps these three codes to actionable text.
415
+
387
416
  For fully custom UI without `useAuth()`, call the headless client directly:
388
417
 
389
418
  ```ts
@@ -446,6 +475,21 @@ The headless client exposes helpers for:
446
475
  - logout and delete-user
447
476
  - credential update and deletion
448
477
 
478
+ ### Where the response types come from
479
+
480
+ The request and response types are aliases of
481
+ [`@seamless-auth/types`](https://www.npmjs.com/package/@seamless-auth/types), which is generated from
482
+ the auth API's schemas. `User`, `Credential`, `Organization`, `StepUpStatus`, `MessageResult`, and the
483
+ other wire shapes describe what the API actually sends, rather than a second copy maintained here that
484
+ could drift from it.
485
+
486
+ The dependency is types-only. Nothing from it is imported at runtime, so no schema validation library
487
+ reaches your bundle. Names exported from this package stay the SDK's own, so you keep importing
488
+ `Credential` from `@seamless-auth/react`.
489
+
490
+ Two SDK concerns are deliberately not shared, because they are not wire contracts: the PRF helper
491
+ types and the `SeamlessAuthResult` wrapper.
492
+
449
493
  ### Result convention
450
494
 
451
495
  Every request method resolves to a `SeamlessAuthResult<T>`:
@@ -477,6 +521,38 @@ a disabled provider is a value you can map straight to UI state rather than an e
477
521
  `SeamlessAuthError` carries the server's `message`, the HTTP `status`, and the parsed response
478
522
  `body`, so you can branch on a specific failure.
479
523
 
524
+ ### WebAuthn ceremony failures
525
+
526
+ A passkey or step-up ceremony can fail in the browser before any request is sent, so those results
527
+ carry the thrown error as `cause` with `status` `0`. Use `getWebAuthnErrorDetail()` to read it: the
528
+ `name` is the `DOMException` name that separates the cases a user can act on, and `code` is
529
+ SimpleWebAuthn's narrower reason when it identified one.
530
+
531
+ ```ts
532
+ import { getWebAuthnErrorDetail } from '@seamless-auth/react';
533
+
534
+ const { error } = await authClient.verifyStepUpWithPasskey();
535
+ const detail = getWebAuthnErrorDetail(error);
536
+
537
+ switch (detail?.name) {
538
+ case 'NotAllowedError':
539
+ // The prompt was dismissed, or the account has no passkey to assert.
540
+ break;
541
+ case 'SecurityError':
542
+ // The origin or RP ID does not match what the API is configured for.
543
+ break;
544
+ case 'InvalidStateError':
545
+ // This authenticator already holds a passkey for the account.
546
+ break;
547
+ default:
548
+ // Not a ceremony failure. Fall back to error?.message.
549
+ break;
550
+ }
551
+ ```
552
+
553
+ `getWebAuthnErrorDetail()` returns `undefined` for any error that did not come from a ceremony, so an
554
+ HTTP failure keeps flowing through `error.message` and `error.body` as usual.
555
+
480
556
  The single exception is `isPasskeySupported`-style capability checks:
481
557
  `isPasskeyPrfSupported(): Promise<boolean>` is a local check rather than a request, so it returns a
482
558
  plain boolean.
@@ -727,6 +803,13 @@ function PasskeyList() {
727
803
  }
728
804
  ```
729
805
 
806
+ `Credential.lastUsedAt` and `Credential.createdAt` are ISO 8601 strings, which is what the API sends.
807
+ Wrap them yourself to format:
808
+
809
+ ```tsx
810
+ const lastUsed = credential.lastUsedAt ? new Date(credential.lastUsedAt) : null;
811
+ ```
812
+
730
813
  Removing a passkey is a sensitive change. Gate it behind a fresh step-up when the account has other
731
814
  factors, using `refreshStepUpStatus()` and `verifyStepUpWithPasskey()` from the step-up section.
732
815
 
@@ -1,4 +1,4 @@
1
- import { Credential, Organization, OrganizationMembership, User } from '../types';
1
+ import type { AddOrganizationMemberRequest, CreateOrganizationRequest, CredentialUpdateResponse, LoginMethod as LoginMethodShape, LoginSuccessResponse, LogoutScope as LogoutScopeShape, MeResponse, MessageResponse, OAuthProvidersResponse, OrganizationEnvelopeResponse, OrganizationListResponse, OrganizationMembersResponse, OrganizationMembershipEnvelopeResponse, OrganizationSwitchResponse, PublicOAuthProvider, PublicSystemConfigResponse, RegistrationRequest, StartOAuthLoginResponse, StepUpMethod as StepUpMethodShape, StepUpStatus as StepUpStatusShape, TotpEnrollmentStartResponse, TotpStatus as TotpStatusShape, UpdateOrganizationMemberRequest, UpdateOrganizationRequest } from '@seamless-auth/types';
2
2
  import { type SeamlessAuthResult } from './result';
3
3
  import { PasskeyPrfInput, PasskeyPrfResult } from './webauthnPrf';
4
4
  export interface SeamlessAuthClientOptions {
@@ -8,100 +8,56 @@ export interface LoginInput {
8
8
  identifier: string;
9
9
  passkeyAvailable: boolean;
10
10
  }
11
- export type LoginMethod = 'passkey' | 'magic_link' | 'email_otp' | 'phone_otp' | 'oauth';
12
- export interface LoginStartResult {
13
- message?: string;
14
- identifierType?: 'email' | 'phone';
15
- loginMethods?: LoginMethod[];
16
- }
17
- export interface RegisterInput {
18
- email: string;
19
- phone?: string | null;
20
- }
11
+ export type LoginMethod = LoginMethodShape;
12
+ /**
13
+ * The login response minus its session material. The API returns a token and
14
+ * subject here, which this SDK deliberately does not surface: sessions are
15
+ * carried by cookies, so adopters have no reason to handle raw tokens.
16
+ */
17
+ export type LoginStartResult = Omit<LoginSuccessResponse, 'token' | 'sub'>;
18
+ export type RegisterInput = RegistrationRequest;
21
19
  export interface PasskeyMetadata {
22
20
  friendlyName: string;
23
21
  platform: string;
24
22
  browser: string;
25
23
  deviceInfo: string;
26
24
  }
27
- export interface CurrentUserResult {
28
- user: User;
29
- credentials: Credential[];
30
- organizations?: Organization[];
31
- activeOrganization?: Organization | null;
32
- }
33
- export interface CreateOrganizationInput {
34
- name: string;
35
- slug?: string;
36
- metadata?: Record<string, unknown> | null;
37
- }
38
- export interface UpdateOrganizationInput {
39
- name?: string;
40
- slug?: string;
41
- metadata?: Record<string, unknown> | null;
42
- }
43
- export interface OrganizationMemberInput {
44
- userId?: string;
45
- email?: string;
46
- roles?: string[];
47
- scopes?: string[];
48
- }
49
- export interface OrganizationMemberUpdateInput {
50
- roles?: string[];
51
- scopes?: string[];
52
- }
53
- export interface OrganizationsResult {
54
- organizations: Organization[];
55
- activeOrganizationId?: string | null;
56
- }
57
- export interface OrganizationResult {
58
- organization: Organization;
59
- }
60
- export interface OrganizationMembersResult {
61
- members: OrganizationMembership[];
62
- total: number;
63
- }
25
+ export type CurrentUserResult = MeResponse;
26
+ export type CreateOrganizationInput = CreateOrganizationRequest;
27
+ export type UpdateOrganizationInput = UpdateOrganizationRequest;
28
+ export type OrganizationMemberInput = AddOrganizationMemberRequest;
29
+ export type OrganizationMemberUpdateInput = UpdateOrganizationMemberRequest;
30
+ export type OrganizationsResult = OrganizationListResponse;
31
+ export type OrganizationResult = OrganizationEnvelopeResponse;
32
+ export type OrganizationMembersResult = OrganizationMembersResponse;
64
33
  /** Response body for a single membership mutation. */
65
- export interface OrganizationMembershipResult {
66
- membership: OrganizationMembership;
67
- }
34
+ export type OrganizationMembershipResult = OrganizationMembershipEnvelopeResponse;
68
35
  /**
69
- * Response body when the active organization changes. The server also returns
70
- * session material here, which this SDK deliberately does not surface: sessions
71
- * are carried by cookies, so adopters have no reason to handle raw tokens.
36
+ * Response body when the active organization changes, minus its session
37
+ * material. See `LoginStartResult` for why the token and subject are dropped.
72
38
  */
73
- export interface OrganizationSwitchResult {
74
- message: string;
75
- organizationId: string;
76
- organization: Organization;
77
- }
78
- export interface OAuthProvider {
79
- id: string;
80
- name: string;
81
- scopes: string[];
82
- }
83
- export interface OAuthProvidersResult {
84
- providers: OAuthProvider[];
85
- }
39
+ export type OrganizationSwitchResult = Omit<OrganizationSwitchResponse, 'token' | 'sub' | 'sessionId'>;
40
+ export type OAuthProvider = PublicOAuthProvider;
41
+ export type OAuthProvidersResult = OAuthProvidersResponse;
42
+ /**
43
+ * The configuration a signed-out client may read. Fetched before there is a
44
+ * session, so the sign-in screens can match how this instance is configured
45
+ * instead of assuming a default set of methods.
46
+ */
47
+ export type PublicSystemConfigResult = PublicSystemConfigResponse;
86
48
  export interface StartOAuthLoginInput {
87
49
  providerId: string;
88
50
  redirectUri?: string;
89
51
  returnTo?: string;
90
52
  }
91
- export interface StartOAuthLoginResult {
92
- provider: OAuthProvider;
93
- state: string;
94
- authorizationUrl: string;
95
- }
53
+ export type StartOAuthLoginResult = StartOAuthLoginResponse;
96
54
  export interface FinishOAuthLoginInput {
97
55
  providerId: string;
98
56
  code: string;
99
57
  state: string;
100
58
  }
101
59
  /** Response body for endpoints that only acknowledge the request. */
102
- export interface MessageResult {
103
- message: string;
104
- }
60
+ export type MessageResult = MessageResponse;
105
61
  /** Payload returned by a completed passkey login. */
106
62
  export interface PasskeyLoginData {
107
63
  prf?: PasskeyPrfResult;
@@ -112,38 +68,16 @@ export interface PasskeyRegistrationData {
112
68
  prfCapable: boolean;
113
69
  }
114
70
  /** Response body returned when credential metadata is updated. */
115
- export interface CredentialUpdateResult {
116
- message: string;
117
- credential: Credential;
118
- }
71
+ export type CredentialUpdateResult = CredentialUpdateResponse;
119
72
  export interface RegisterPasskeyOptions {
120
73
  metadata: PasskeyMetadata;
121
74
  requestPrf?: boolean;
122
75
  requirePrf?: boolean;
123
76
  }
124
- export type StepUpMethod = 'webauthn' | 'totp';
125
- export interface TotpStatus {
126
- enabled: boolean;
127
- verifiedAt: string | null;
128
- lastUsedAt: string | null;
129
- }
130
- export interface TotpEnrollmentStartResult {
131
- message: string;
132
- secret: string;
133
- otpauthUrl: string;
134
- issuer: string;
135
- accountName: string;
136
- algorithm: string;
137
- digits: number;
138
- period: number;
139
- }
140
- export interface StepUpStatus {
141
- fresh: boolean;
142
- method: StepUpMethod | null;
143
- verifiedAt: string | null;
144
- expiresAt: string | null;
145
- maxAgeSeconds: number;
146
- }
77
+ export type StepUpMethod = StepUpMethodShape;
78
+ export type TotpStatus = TotpStatusShape;
79
+ export type TotpEnrollmentStartResult = TotpEnrollmentStartResponse;
80
+ export type StepUpStatus = StepUpStatusShape;
147
81
  export interface PasskeyLoginOptions {
148
82
  prf?: PasskeyPrfInput;
149
83
  }
@@ -152,7 +86,7 @@ export interface StepUpPrfData extends StepUpStatus {
152
86
  credentialId: string;
153
87
  prf: PasskeyPrfResult;
154
88
  }
155
- export type LogoutScope = 'current_session' | 'all_sessions';
89
+ export type LogoutScope = LogoutScopeShape;
156
90
  export interface LogoutOptions {
157
91
  scope?: LogoutScope;
158
92
  }
@@ -184,6 +118,7 @@ export interface SeamlessAuthClient {
184
118
  checkMagicLink: () => Promise<SeamlessAuthResult<MessageResult>>;
185
119
  verifyMagicLink: (token: string) => Promise<SeamlessAuthResult<MessageResult>>;
186
120
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
121
+ getPublicSystemConfig: () => Promise<SeamlessAuthResult<PublicSystemConfigResult>>;
187
122
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
188
123
  finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
189
124
  registerPasskey: (input: PasskeyMetadata | RegisterPasskeyOptions) => Promise<SeamlessAuthResult<PasskeyRegistrationData>>;
@@ -1,3 +1,4 @@
1
+ import type { OAuthErrorCode as OAuthErrorCodeShape } from '@seamless-auth/types';
1
2
  /**
2
3
  * Error carrying the auth server's response detail, so callers can map known
3
4
  * failures to their own messaging instead of only seeing a generic string.
@@ -5,8 +6,50 @@
5
6
  export declare class SeamlessAuthError extends Error {
6
7
  readonly status: number;
7
8
  readonly body: unknown;
8
- constructor(message: string, status: number, body?: unknown);
9
+ /**
10
+ * The underlying failure when the error was raised locally rather than by a
11
+ * response, for example the `DOMException` a WebAuthn ceremony throws.
12
+ */
13
+ readonly cause: unknown;
14
+ constructor(message: string, status: number, body?: unknown, cause?: unknown);
9
15
  }
16
+ /**
17
+ * Machine-readable codes the auth API returns alongside `error` on an OAuth
18
+ * callback failure the user can act on.
19
+ */
20
+ export type OAuthErrorCode = OAuthErrorCodeShape;
21
+ /**
22
+ * Read the OAuth failure code off a result error. Returns `undefined` for
23
+ * anything unrecognized, including codes added by a newer API, so callers keep
24
+ * their generic messaging instead of showing a raw code.
25
+ *
26
+ * The auth API puts `code` at the top level of the error body, but a proxy in
27
+ * front of it may normalize that body and nest the siblings of `error` under
28
+ * `details`. Both locations are accepted so such a proxy does not silently
29
+ * downgrade OAuth messaging to a generic failure.
30
+ */
31
+ export declare function getOAuthErrorCode(error: unknown): OAuthErrorCode | undefined;
32
+ /**
33
+ * Detail recovered from a failed WebAuthn ceremony.
34
+ *
35
+ * `name` is the `DOMException` name, which is what distinguishes the cases a
36
+ * user can act on: `NotAllowedError` for a dismissed prompt or no usable
37
+ * credential, `SecurityError` for an origin or RP ID mismatch,
38
+ * `InvalidStateError` for an already registered passkey. `code` is
39
+ * SimpleWebAuthn's narrower reason when it identified one, for example
40
+ * `ERROR_CEREMONY_ABORTED`.
41
+ */
42
+ export type WebAuthnErrorDetail = {
43
+ name: string;
44
+ code?: string;
45
+ message: string;
46
+ };
47
+ /**
48
+ * Read the WebAuthn failure behind a result error. Returns `undefined` for
49
+ * errors that did not come from a ceremony, so callers can branch on the
50
+ * specific failure and otherwise fall back to `error.message`.
51
+ */
52
+ export declare function getWebAuthnErrorDetail(error: unknown): WebAuthnErrorDetail | undefined;
10
53
  /**
11
54
  * Build a `SeamlessAuthError` from a failed response, preserving the status and
12
55
  * the parsed body. The body may be empty or non-JSON, which is not treated as a
@@ -33,4 +33,4 @@ export declare function requestResult<T>(request: Promise<Response>, fallbackMes
33
33
  /** Wrap an already-derived value as a successful result. */
34
34
  export declare function resultOf<T>(data: T): SeamlessAuthResult<T>;
35
35
  /** Wrap a failure as a result. */
36
- export declare function resultError<T>(message: string, status?: number, body?: unknown): SeamlessAuthResult<T>;
36
+ export declare function resultError<T>(message: string, status?: number, body?: unknown, cause?: unknown): SeamlessAuthResult<T>;
@@ -6,7 +6,7 @@ interface AuthFallbackOptionsProps {
6
6
  onEmailOtp?: () => void;
7
7
  onPhoneOtp: () => void;
8
8
  onPasskeyRetry?: () => void;
9
- loginMethods?: LoginMethod[];
9
+ loginMethods?: LoginMethod[] | null;
10
10
  }
11
11
  declare const AuthFallbackOptions: React.FC<AuthFallbackOptionsProps>;
12
12
  export default AuthFallbackOptions;
@@ -0,0 +1,30 @@
1
+ import type { LoginMethod } from '../client/createSeamlessAuthClient';
2
+ /**
3
+ * Used only until the instance answers, and if it never does.
4
+ *
5
+ * Deliberately the narrowest useful set, and matching the auth server's own
6
+ * defaults. Offering a method that turns out to be disabled sends a user down a
7
+ * path that fails, which is worse than showing one option too few.
8
+ */
9
+ export declare const FALLBACK_LOGIN_METHODS: LoginMethod[];
10
+ /**
11
+ * Which sign-in methods this instance has enabled, read from the auth server
12
+ * rather than assumed.
13
+ *
14
+ * `loginMethods` stays null until the answer arrives, and stays null if the
15
+ * request fails. A caller must treat that as "unknown" and not as "none": the
16
+ * screens use it to decide what is safe to offer, and guessing in either
17
+ * direction is worse than waiting. `loading` is what a caller renders against.
18
+ */
19
+ export declare const useLoginMethods: () => {
20
+ loginMethods: ("passkey" | "magic_link" | "email_otp" | "phone_otp" | "oauth")[] | null;
21
+ loading: boolean;
22
+ };
23
+ /**
24
+ * Whether a user who declines a passkey would still have a way to sign in.
25
+ *
26
+ * Returns false while the methods are unknown, so a failed or in-flight request
27
+ * never produces a skip control that could strand someone in an account they
28
+ * cannot get back into.
29
+ */
30
+ export declare const hasNonPasskeyLoginMethod: (loginMethods: LoginMethod[] | null) => boolean;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { AuthContextType, AuthProvider, useAuth } from './AuthProvider';
2
2
  import { AuthRoutes } from './AuthRoutes';
3
- import { createSeamlessAuthClient, CredentialUpdateResult, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthProvider, OAuthProvidersResult, OrganizationMemberInput, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from './client/createSeamlessAuthClient';
4
- import { SeamlessAuthError } from './client/errors';
3
+ import { createSeamlessAuthClient, CredentialUpdateResult, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthProvider, OAuthProvidersResult, PublicSystemConfigResult, OrganizationMemberInput, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from './client/createSeamlessAuthClient';
4
+ import { getOAuthErrorCode, getWebAuthnErrorDetail, OAuthErrorCode, SeamlessAuthError, WebAuthnErrorDetail } from './client/errors';
5
5
  import type { SeamlessAuthResult } from './client/result';
6
6
  import { encodePrfSalt, extractPasskeyPrfResult, isPasskeyPrfSupported, PasskeyPrfInput, PasskeyPrfResult } from './client/webauthnPrf';
7
7
  import { useAuthClient } from './hooks/useAuthClient';
8
+ import { hasNonPasskeyLoginMethod, useLoginMethods } from './hooks/useLoginMethods';
8
9
  import { usePasskeySupport } from './hooks/usePasskeySupport';
9
10
  import { hasScopedRole, roleGrantsAccess } from './scopedRoles';
10
11
  import { Credential, Organization, OrganizationMembership, User } from './types';
11
- export { AuthProvider, AuthRoutes, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, hasScopedRole, isPasskeyPrfSupported, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, usePasskeySupport, };
12
- export type { CredentialUpdateResult, AuthContextType, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthProvider, OAuthProvidersResult, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyMetadata, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput, User, };
12
+ export { AuthProvider, AuthRoutes, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, useLoginMethods, usePasskeySupport, };
13
+ export type { CredentialUpdateResult, AuthContextType, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthErrorCode, OAuthProvider, OAuthProvidersResult, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyMetadata, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, PublicSystemConfigResult, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput, User, WebAuthnErrorDetail, };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{browserSupportsWebAuthn as o,bufferToBase64URLString as r,base64URLStringToBuffer as n,startAuthentication as a,startRegistration as s,WebAuthnError as l}from"@simplewebauthn/browser";import{useState as d,useEffect as c,createContext as u,useMemo as _,useCallback as m,useContext as g,useRef as p}from"react";import{useHref as f,useNavigate as h,useLocation as y,useSearchParams as b,Routes as v,Route as k,Navigate as w}from"react-router-dom";import x from"libphonenumber-js";class P extends Error{constructor(e,t,i){super(e),this.name="SeamlessAuthError",this.status=t,this.body=i}}async function S(e,t){let i;try{i=await e.json()}catch{i=void 0}return new P(function(e){if("object"!=typeof e||null===e)return;const{error:t,message:i}=e;return"string"==typeof t&&t?t:"string"==typeof i&&i?i:void 0}(i)??t,e.status,i)}async function N(e){try{return await e.json()}catch{return}}async function O(e,t){let i;try{i=await e}catch{return{data:null,error:new P(t,0)}}return i.ok?{data:await N(i),error:null}:{data:null,error:await S(i,t)}}function T(e){return{data:e,error:null}}function C(e,t=0,i){return{data:null,error:new P(e,t,i)}}function I(e){if(e instanceof ArrayBuffer)return e;const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=new Uint8Array(t.byteLength);return i.set(t),i.buffer}function M(e){return"string"==typeof e?e:r(I(e))}function A(e){return"string"==typeof e?n(e):e}function z(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:M(e.salt),...e.secondSalt?{secondSalt:M(e.secondSalt)}:{}}}}async function E(){return!!o()&&("undefined"==typeof window||!1!==window.isSecureContext)&&void 0!==globalThis.PublicKeyCredential&&"undefined"!=typeof navigator&&"function"==typeof navigator.credentials?.get}function F(e){const t=e,i=t.extensions?.prf?.eval;return i?{...t,extensions:{...t.extensions,prf:{...t.extensions?.prf,eval:{...i,...i.first?{first:A(i.first)}:{},...i.second?{second:A(i.second)}:{}}}}}:e}function L(e){const t=e.clientExtensionResults,i=t?.prf?.results?.first;if(!i)return null;const o=(n=i)instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);var n;return{credentialId:e.id,output:o,outputBase64url:r(I(o))}}function U(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function R(e,t){const i=e.method===t?e.method:null;return"Success"===e.message&&!0===e.fresh&&null!==i?T({fresh:!0,method:i,verifiedAt:e.verifiedAt??null,expiresAt:e.expiresAt??null,maxAgeSeconds:e.maxAgeSeconds??0}):C(e.message??"Step-up authentication failed.")}function B(e){return e?{method:"POST",body:JSON.stringify(z(e))}:{method:"POST"}}const q=e=>{const t=(e=>{const{authHost:t}=e;return async function(e,i){const o=`${t?.replace(/\/+$/,"")??""}/auth${e.startsWith("/")?e:`/${e}`}`,r=null!=i?.body,n={...i,credentials:"include",headers:{...r?{"Content-Type":"application/json"}:{},...i?.headers}};return fetch(o,n)}})({authHost:e.apiHost});return{getCurrentUser:()=>O(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>O(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const i=await O(t("/webAuthn/login/start",{...B(e?.prf)}),"Failed to start passkey login.");if(i.error)return i;let o,r;try{const e=await a({optionsJSON:F(i.data)});o=L(e),r=U(e)}catch{return console.error("Passkey login error."),C("Passkey login failed.")}const n=await O(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify passkey.");return n.error?n:"Success"!==n.data?.message?C(n.data?.message??"Passkey login failed."):T(o?{prf:o}:{})},logout:(e={})=>O(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>O(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>O(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>O(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>O(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>O(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>O(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>O(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>O(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>O(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>O(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>O(t("/otp/verify-login-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestMagicLink:()=>O(t("/magic-link",{method:"POST",body:JSON.stringify({})}),"Failed to send the magic link."),checkMagicLink:()=>O(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>O(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>O(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),startOAuthLogin:e=>O(t(`/oauth/${encodeURIComponent(e.providerId)}/start`,{method:"POST",body:JSON.stringify({...e.redirectUri?{redirectUri:e.redirectUri}:{},...e.returnTo?{returnTo:e.returnTo}:{}})}),"Failed to start OAuth login."),finishOAuthLogin:e=>O(t(`/oauth/${encodeURIComponent(e.providerId)}/callback`,{method:"POST",body:JSON.stringify({code:e.code,state:e.state})}),"Failed to finish OAuth login."),registerPasskey:async e=>{const i=function(e){return"metadata"in e?e:{metadata:e}}(e),o=await O(t(function(e){const t=new URLSearchParams;e.requirePrf?t.set("requirePrf","true"):e.requestPrf&&t.set("requestPrf","true");const i=t.toString();return"/webAuthn/register/start"+(i?`?${i}`:"")}(i),{method:"GET"}),"Failed to fetch passkey registration challenge.");if(o.error)return o;let r;try{r=await s({optionsJSON:o.data})}catch(e){return e instanceof l?C(e.name):(console.error("Passkey registration error."),C("Passkey registration failed."))}const n=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(r),a=await O(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:r,metadata:{...i.metadata,prfCapable:n}})}),"Verification failed.");return a.error?a:T({credentialId:r.id,prfCapable:n})},isPasskeyPrfSupported:E,getStepUpStatus:()=>O(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await O(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let i;try{i=U(await a({optionsJSON:F(e.data)}))}catch{return console.error("Step-up authentication error."),C("Step-up authentication failed.")}const o=await O(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:i})}),"Failed to verify step-up authentication.");return o.error?o:R(o.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const i=await O(t("/step-up/webauthn/start",{...B(e)}),"Failed to start step-up authentication.");if(i.error)return i;let o,r;try{const e=await a({optionsJSON:F(i.data)});o=L(e),r=U(e)}catch{return console.error("Step-up authentication error."),C("Step-up authentication failed.")}if(!o)return C("Passkey did not return PRF output.");const n=await O(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify step-up authentication.");if(n.error)return n;const s=R(n.data??{},"webauthn");return s.error?s:T({...s.data,credentialId:o.credentialId,prf:o})},getTotpStatus:()=>O(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>O(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>O(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>O(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const i=await O(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return i.error?i:R(i.data??{},"totp")},updateCredential:e=>O(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>O(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>O(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>O(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>O(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,i)=>O(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(i)}),"Failed to update organization."),switchOrganization:e=>O(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>O(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,i)=>O(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(i)}),"Failed to add organization member."),updateOrganizationMember:(e,i,o)=>O(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify(o)}),"Failed to update organization member."),removeOrganizationMember:(e,i)=>O(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(i)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function J(e,t){const i=e.trim(),o=t.trim();if(!i||!o)return!1;if(i===o)return!0;if(i.endsWith(":*")){const e=i.slice(0,-2);return o===e||o.startsWith(`${e}:`)}if(!o.includes(":"))return!1;if(!i.includes(":"))return o.startsWith(`${i}:`);const r=i.split(":"),n=o.split(":"),a=r[r.length-1],s=n[n.length-1],l=r.slice(0,-1),d=n.slice(0,-1);return"write"===a&&"read"===s&&l.length===d.length&&l.every((e,t)=>e===d[t])}function G(e,t){if(!Array.isArray(e))return!1;const i=e.filter(e=>"string"==typeof e);return(Array.isArray(t)?t:[t]).some(e=>i.some(t=>J(t,e)))}const j=u(void 0),W=()=>{const e=g(j);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},D=({children:t,apiHost:i,autoDetectPreviousSignin:o=!0})=>{const[r,n]=d(null),[a,s]=d([]),[l,u]=d([]),[g,p]=d(null),[f,h]=d(null),[y,b]=d(!1),[v,k]=d(!0),{hasSignedInBefore:w,markSignedIn:x}=function(e="seamlessauth_seen"){const[t,i]=d(!1);return c(()=>{try{"true"===localStorage.getItem(e)&&i(!0)}catch{}},[e]),{hasSignedInBefore:t,markSignedIn:()=>{try{localStorage.setItem(e,"true"),i(!0)}catch{}}}}(),P=_(()=>q({apiHost:i}),[i]),S=m(()=>{b(!1),n(null),s([]),u([]),p(null),h(null)},[]),N=m(async()=>{try{return await P.logout()}finally{S()}},[P,S]),O=m(async()=>{try{return await P.logoutAllSessions()}finally{S()}},[P,S]),T=m(async()=>{k(!0);const e=await P.getCurrentUser();return e.error?(await N(),k(!1),e):(n(e.data.user),s(e.data.credentials??[]),u(e.data.organizations??[]),p(e.data.activeOrganization??null),b(!0),k(!1),e)},[P,N]),C=m(async()=>{const e=await P.getStepUpStatus();return h(e.error?null:e.data),e},[P]),I=m(async()=>{const e=await P.verifyStepUpWithPasskey();return e.error||h(e.data),e},[P]),M=m(async e=>{const t=await P.verifyStepUpWithPasskeyPrf(e);return t.error||h({fresh:t.data.fresh,method:t.data.method,verifiedAt:t.data.verifiedAt,expiresAt:t.data.expiresAt,maxAgeSeconds:t.data.maxAgeSeconds}),t},[P]),A=m(async e=>{const t=await P.verifyStepUpWithTotp(e);return t.error||h(t.data),t},[P]);return c(()=>{T()},[T]),c(()=>{r&&y&&x()},[r,y,x]),e(j.Provider,{value:{user:r,logout:N,logoutAllSessions:O,refreshSession:T,loading:v,deleteUser:async()=>{const e=await P.deleteUser();return e.error||S(),e},isAuthenticated:y,hasRole:e=>r?.roles?.includes(e),hasScopedRole:e=>r?G(r.roles,e):void 0,apiHost:i,markSignedIn:x,hasSignedInBefore:!!o&&w,credentials:a,organizations:l,activeOrganization:g,switchOrganization:async e=>{const t=await P.switchOrganization(e);return t.error||await T(),t},listOAuthProviders:()=>P.listOAuthProviders(),startOAuthLogin:e=>P.startOAuthLogin(e),finishOAuthLogin:async e=>{const t=await P.finishOAuthLogin(e);return t.error||await T(),t},stepUpStatus:f,updateCredential:async e=>{const{data:t,error:i}=await P.updateCredential({friendlyName:e.friendlyName,id:e.id});if(i)return{data:null,error:i};const o=t.credential;return s(e=>e.map(e=>e.id===o.id?{...e,...o}:e)),{data:o,error:null}},deleteCredential:async e=>{const t=await P.deleteCredential(e);return t.error||s(t=>t.filter(t=>t.id!==e)),t},login:(e,t)=>P.login({identifier:e,passkeyAvailable:t}),handlePasskeyLogin:async()=>{const e=await P.loginWithPasskey();return e.error||await T(),e},refreshStepUpStatus:C,verifyStepUpWithPasskey:I,verifyStepUpWithPasskeyPrf:M,verifyStepUpWithTotp:A},children:t})},$=()=>{const{apiHost:e}=W();return _(()=>q({apiHost:e}),[e])},V=e=>{if("string"!=typeof e)return!1;const t=e.trim();if(t.length<3||t.length>320)return!1;const i=t.split("@");if(2!==i.length)return!1;const[o,r]=i;return!(!/^[A-Za-z0-9._%+-]+$/.test(o)||o.startsWith(".")||o.endsWith(".")||o.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(r)||r.startsWith("-")||r.endsWith("-")||r.startsWith(".")||r.endsWith(".")||r.includes(".."))},K=e=>{const t=x(e);return t?.isValid()||!1};async function H(){return async function(){if("undefined"==typeof window)return!1;if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return console.error("Error checking passkey support."),!1}return!1}()}const Y=()=>{const[e,t]=d(!1),[i,o]=d(!0);return c(()=>{let e=!0;return(async()=>{try{const i=await H();e&&t(i)}catch{e&&t(!1)}finally{e&&o(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:i}},Q="/login",Z="/passkey-login",X="/verify-phone-otp",ee="/verify-email-otp",te="/verify-magiclink",ie="/oauth/callback",oe="/register-passkey",re="/magic-link-sent";function ne(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}var ae="login-module__container___YggDx",se="login-module__card___Ub-Py",le="login-module__heading___neEqb",de="login-module__inputGroup___P6qgS",ce="login-module__label___mx5vu",ue="login-module__input___U07lW",_e="login-module__helperText___kDQ4-",me="login-module__error___40zxh",ge="login-module__button___0kFBs",pe="login-module__toggle___1JiG1",fe="login-module__fallbackCard___HdIk-",he="login-module__fallbackHeader___-il2v",ye="login-module__fallbackDescription___ea5EB",be="login-module__fallbackActions___AD3ni",ve="login-module__fallbackActionButton___lFgWf",ke="login-module__actionTitle___ycrMp",we="login-module__actionSubtext___opaIV",xe="login-module__linkButton___5lsoe";ne(".login-module__container___YggDx{align-items:center;color:#fff;display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:#1f2937;border-radius:.5rem;box-shadow:0 4px 6px rgba(0,0,0,.1);max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:#68d391;text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:#d1d5db;display:block}.login-module__input___U07lW{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px #3b82f6;outline:none}.login-module__helperText___kDQ4-{color:#9ca3af;font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:#f87171;font-size:.875rem}.login-module__button___0kFBs{background-color:#2563eb;border-radius:.375rem;color:#fff;cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:#1d4ed8}.login-module__button___0kFBs:disabled{background-color:#9ca3af;cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:hsla(0,0%,100%,.04);border:1px solid hsla(0,0%,100%,.08);border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:#f3f4f6;font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:#9ca3af;font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:rgba(0,0,0,.25);border:1px solid hsla(0,0%,100%,.08);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:hsla(0,0%,100%,.06);border-color:hsla(0,0%,100%,.15)}.login-module__actionTitle___ycrMp{color:#f9fafb;font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:#9ca3af;font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const Pe=({identifier:i,onMagicLink:o,onEmailOtp:r,onPhoneOtp:n,onPasskeyRetry:a,loginMethods:s})=>{const l=new Set(s??["passkey","magic_link","phone_otp"]),d=l.has("magic_link")&&V(i),c=l.has("email_otp")&&Boolean(r)&&V(i),u=l.has("phone_otp")&&K(i),_=l.has("passkey")&&Boolean(a);return d||c||u||_?t("div",{className:fe,children:[e("div",{className:he,children:"Choose a sign-in method"}),e("p",{className:ye,children:"Choose another secure sign-in method."}),t("div",{className:be,children:[d&&t("button",{type:"button",className:ve,onClick:o,children:[e("span",{className:ke,children:"Email Magic Link"}),e("span",{className:we,children:"Send a secure sign-in link to your email"})]}),c&&t("button",{type:"button",className:ve,onClick:r,children:[e("span",{className:ke,children:"Email Code"}),e("span",{className:we,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:ve,onClick:n,children:[e("span",{className:ke,children:"Text Message Code"}),e("span",{className:we,children:"Receive a one-time code via SMS"})]})]}),_&&e("button",{type:"button",className:xe,onClick:a,children:"Try passkey anyway"})]}):null},Se="seamless:oauth:provider",Ne=()=>{const{listOAuthProviders:i,startOAuthLogin:o}=W(),r=f("/oauth/callback"),[n,a]=d([]),[s,l]=d("");if(c(()=>{let e=!0;return i().then(({data:t})=>{e&&a(t?.providers??[])}),()=>{e=!1}},[i]),0===n.length)return null;return t("div",{className:be,children:[n.map(i=>e("button",{type:"button",className:ve,onClick:()=>(async e=>{l(""),sessionStorage.setItem(Se,e);const{data:t,error:i}=await o({providerId:e,redirectUri:new URL(r,window.location.origin).toString()});i?l("Could not start sign-in with this provider."):window.location.assign(t.authorizationUrl)})(i.id),children:t("span",{className:ke,children:["Continue with ",i.name]})},i.id)),s&&e("p",{className:me,children:s})]})},Oe=["passkey","magic_link","phone_otp"],Te=()=>{const o=h(),{hasSignedInBefore:r,login:n,handlePasskeyLogin:a}=W(),s=$(),{passkeySupported:l}=Y(),[u,_]=d(""),[m,g]=d(""),[p,f]=d("register"),[y,b]=d(""),[v,k]=d(""),[w,x]=d(""),[P,S]=d(!1),[N,O]=d(Oe);c(()=>{r&&f("login")},[r]);return e("div",{className:ae,children:t("div",{className:se,children:[e("h2",{className:le,children:"login"===p?"Sign In":"Create Account"}),t(i,{children:[t("form",{onSubmit:async e=>{e.preventDefault(),b(""),S(!1);try{if("login"===p){const{data:e,error:t}=await n(u,l);if(t)return void b("Failed to start sign-in. Please try again.");const i=e?.loginMethods?.length?e.loginMethods:Oe;if(O(i),l&&i.includes("passkey")){const{error:e}=await a();return e?(S(!0),void b("Passkey sign-in could not be completed. Choose another sign-in method.")):void o("/")}return void S(!0)}"register"===p&&await(async()=>{b("");const{data:e,error:t}=await s.register({email:m});t?b("Failed to register. Please try again."):"Success"===e.message?o(ee):b("An unexpected error occurred. Try again. If the problem persists, contact support.")})()}catch{console.error("Failed to continue sign-in."),b("Failed to continue sign-in. Please try again.")}},children:["login"===p&&t("div",{className:de,children:[e("label",{htmlFor:"identifier",className:ce,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:u,onChange:e=>{const t=e.target.value;_(t)},autoComplete:"off",placeholder:"Email or Phone Number",className:ue,onBlur:()=>{if(u){const e=V(u)||K(u);x(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:_e,children:"Phone numbers must include a country code e.g. +1"}),P&&e(Pe,{identifier:u,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?b("Failed to send magic link."):o(re,{state:{identifier:u}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?b("Failed to send email code."):o(ee,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?b("Failed to send OTP."):o(X,{state:{flow:"login"}})},onPasskeyRetry:l?a:void 0,loginMethods:N}),w&&e("p",{className:me,children:w})]}),"register"===p&&t("div",{className:de,children:[e("label",{htmlFor:"email",className:ce,children:"Email Address"}),e("input",{id:"email",type:"email",value:m,onChange:e=>{const t=e.target.value;g(t)},autoComplete:"off",className:ue,onBlur:()=>{if(m){const e=V(m);k(e?"":"Please enter a valid email")}},required:!0}),v&&e("p",{className:me,children:v})]}),e("button",{type:"submit",className:ge,disabled:!("login"===p&&u?V(u)||K(u):V(m)),children:"login"===p?"Login":"Register"}),y&&e("p",{className:me,children:y}),e("button",{type:"button",onClick:()=>f("login"===p?"register":"login"),className:pe,children:"login"===p?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(Ne,{})]})]})})};var Ce={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};ne(".passKeyLogin-module__container___IUKxF{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:#1d4ed8}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const Ie=()=>{const i=h(),{handlePasskeyLogin:o}=W(),[r,n]=d("");return e("div",{className:Ce.container,children:t("div",{className:Ce.card,children:[e("h2",{className:Ce.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{n("");const{error:e}=await o();e?n("Passkey sign-in could not be completed. Try another sign-in method."):i("/")},className:Ce.button,children:"Use Passkey"}),r&&e("p",{className:Ce.error,children:r})]})})};var Me="registerPasskey-module__container___jqEh8",Ae="registerPasskey-module__card___MJAyC",ze="registerPasskey-module__loading___Q4i1x",Ee="registerPasskey-module__spinner___V1nhd",Fe="registerPasskey-module__supported___ihTih",Le="registerPasskey-module__title___vn2Qu",Ue="registerPasskey-module__description___AWmO-",Re="registerPasskey-module__button___D3b4B",Be="registerPasskey-module__message___RiOw-",qe="registerPasskey-module__success___HP5aX",Je="registerPasskey-module__error___hGiqE";ne(".registerPasskey-module__container___jqEh8{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:#f9fafb;border-radius:.75rem;box-shadow:0 2px 8px rgba(0,0,0,.1);color:#374151;display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-color:#3b82f6 transparent;border-radius:9999px;border-style:solid;border-width:2px;height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:#ecfdf5;border-radius:.75rem;box-shadow:0 2px 12px rgba(0,0,0,.1);color:#065f46;padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:#059669;border:none;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:#047857}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:#6ee7b7}.registerPasskey-module__error___hGiqE{color:#f87171}");var Ge="deviceNameModal-module__overlay___fmdPd",je="deviceNameModal-module__modal___uoEda",We="deviceNameModal-module__description___-HMTA",De="deviceNameModal-module__input___4vQMI",$e="deviceNameModal-module__actions___KXw7b",Ve="deviceNameModal-module__primary___9Ozlk",Ke="deviceNameModal-module__secondary___HILhc";ne(".deviceNameModal-module__overlay___fmdPd{align-items:center;background:rgba(0,0,0,.45);display:flex;inset:0;justify-content:center;position:fixed;z-index:1000}.deviceNameModal-module__modal___uoEda{background:#1f2937;border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,.15);color:#fff;max-width:420px;padding:24px;width:100%}.deviceNameModal-module__description___-HMTA{color:#fff;font-size:14px;margin-bottom:16px}.deviceNameModal-module__input___4vQMI{border:1px solid #ddd;border-radius:8px;font-size:14px;margin-bottom:20px;padding:10px 12px;width:100%}.deviceNameModal-module__actions___KXw7b{display:flex;gap:10px;justify-content:flex-end}.deviceNameModal-module__primary___9Ozlk{background:#2563eb;border:none;border-radius:8px;color:#fff;cursor:pointer;padding:8px 14px}.deviceNameModal-module__secondary___HILhc{background:transparent;border:1px solid #ccc;border-radius:8px;cursor:pointer;padding:8px 14px}");const He=({isOpen:i,onCancel:o,onConfirm:r})=>{const[n,a]=d("");return i?e("div",{className:Ge,children:t("div",{className:je,children:[e("h3",{children:"Name This Device"}),e("p",{className:We,children:"Give this passkey a friendly name so you can recognize it later."}),e("input",{type:"text",placeholder:"e.g., MacBook Pro, iPhone, YubiKey",value:n,onChange:e=>a(e.target.value),className:De,autoFocus:!0}),t("div",{className:$e,children:[e("button",{onClick:o,className:Ke,children:"Cancel"}),e("button",{onClick:()=>r(n.trim()),disabled:!n.trim(),className:Ve,children:"Continue"})]})]})}):null},Ye=()=>{const{refreshSession:o}=W(),r=$(),{passkeySupported:n,loading:a}=Y(),s=h(),[l,c]=d("idle"),[u,_]=d(""),[m,g]=d(!1),[p,f]=d(null);return t(i,{children:[e("div",{className:Me,children:e("div",{className:Ae,children:t("div",a||!n?{className:ze,children:[e("div",{className:Ee}),e("span",{children:a?"Checking for Passkey Support...":"Passkeys are not supported on this device."})]}:{className:Fe,children:[e("h2",{className:Le,children:"Secure Your Account with a Passkey"}),e("p",{className:Ue,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>{const{platform:e,browser:t,deviceInfo:i}=function(){const e=navigator.userAgent.toLowerCase();let t="unknown",i="unknown";return/iphone|ipad|ipod/.test(e)?t="ios":/android/.test(e)?t="android":/mac os/.test(e)?t="mac":/windows/.test(e)?t="windows":/linux/.test(e)&&(t="linux"),navigator.brave?i="brave":/edg\/|edgios/.test(e)?i="edge":/opr\/|opt\/|opera/.test(e)?i="opera":/vivaldi/.test(e)?i="vivaldi":/samsungbrowser/.test(e)?i="samsung":/firefox|fxios/.test(e)?i="firefox":/chrome|crios/.test(e)?i="chrome":/safari/.test(e)&&(i="safari"),{platform:t,browser:i,deviceInfo:`${t} • ${i}`}}();f({platform:e,browser:t,deviceInfo:i}),g(!0)},disabled:"loading"===l,className:Re,children:"loading"===l?"Registering...":"Register Passkey"}),u&&e("p",{className:`${Be} ${"success"===l?qe:Je}`,children:u})]})})}),e(He,{isOpen:m,onCancel:()=>{g(!1),f(null)},onConfirm:async e=>{if(!p)return;const t={friendlyName:e,...p};c("loading");try{const{error:e}=await r.registerPasskey(t);if(e)throw e;await o(),c("success"),_("Passkey registered successfully."),s("/")}catch{console.error("Passkey registration failed."),c("error"),_("Error registering passkey.")}finally{g(!1),f(null)}}})]})};var Qe="verifyOTP-module__container___wgoDE",Ze="verifyOTP-module__card___3cs2p",Xe="verifyOTP-module__title___fZ-1d",et="verifyOTP-module__subtitle___dGSu3",tt="verifyOTP-module__error___GEtlG",it="verifyOTP-module__success___46TjG",ot="verifyOTP-module__form___jiGG-",rt="verifyOTP-module__label___Zq5Mi",nt="verifyOTP-module__timer___smq-a",at="verifyOTP-module__resend___PlmkG",st="verifyOTP-module__button___8pIuO",lt="verifyOTP-module__toggle___wbzVa";ne(".verifyOTP-module__container___wgoDE{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:#9ca3af;font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:#f87171;margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:#34d399;margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:#d1d5db;display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:#facc15;font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:#374151;border:1px solid #4b5563;border-radius:.375rem;color:#fff;outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px #3b82f6}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:#3b82f6}.verifyOTP-module__button___8pIuO{background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:#1d4ed8}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var dt="otpInput-module__otpContainer___MUjby",ct="otpInput-module__otpInput___3YMVm";ne(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:#374151;border:1px solid #4b5563;border-radius:8px;color:#fff;font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:#60a5fa;box-shadow:0 0 0 2px rgba(96,165,250,.25);outline:none}");const ut=({length:t=6,value:i,inputMode:o="numeric",onChange:r,name:n="otp"})=>{const a=p([]),s=i.split("").concat(Array(t).fill("")).slice(0,t),l=(e,t)=>{var i;if(t.length>1)d(e,t);else if(!t||(i=t,"numeric"===o?/^\d$/.test(i):/^[a-zA-Z]$/.test(i))){const i=[...s];i[e]=t;const o=i.join("");r(o),t&&a.current[e+1]&&a.current[e+1]?.focus()}},d=(e,i)=>{let n=i;n="numeric"===o?i.replace(/\D/g,""):i.replace(/[^a-zA-Z]/g,"");const l=n.slice(0,t).split(""),d=[...s];l.forEach((i,o)=>{e+o<t&&(d[e+o]=i)}),r(d.join("")),a.current[Math.min(e+l.length,t-1)]?.focus()};return e("div",{className:dt,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),d(0,e.clipboardData.getData("text"))},children:s.map((i,d)=>e("input",{ref:e=>a.current[d]=e,type:"text",inputMode:"numeric"===o?"numeric":"text",autoComplete:"one-time-code",name:`${n}-${d}`,maxLength:1,value:i,className:ct,onChange:e=>l(d,e.target.value),onKeyDown:e=>((e,i)=>{if("Backspace"===i.key){i.preventDefault();const t=[...s];s[e]?(t[e]="",r(t.join(""))):e>0&&(t[e-1]="",r(t.join("")),a.current[e-1]?.focus())}"ArrowLeft"===i.key&&e>0&&a.current[e-1]?.focus(),"ArrowRight"===i.key&&e<t-1&&a.current[e+1]?.focus()})(d,e),"aria-label":`Digit ${d+1}`},d))})},_t=()=>{const i=h(),o=y(),{refreshSession:r}=W(),n="login"===o.state?.flow,[a,s]=d(""),[l,u]=d(null),[_,m]=d(""),[g,p]=d(!1),[f,b]=d(""),[v,k]=d(300),w=$(),x=async()=>{if(p(!0),!l){const{error:e}=n?await w.verifyLoginPhoneOtp(a):await w.verifyPhoneOtp(a);if(e)m("Verification failed.");else{if(n)return await r(),void i("/");u(!0)}}p(!1)},P=async()=>{b(""),await(async()=>{m("");const{error:e}=n?await w.requestLoginPhoneOtp():await w.requestPhoneOtp();e?m("Failed to send SMS code. If this persists, refresh the page and try again."):b("Verification SMS has been resent.")})(),b("Verification SMS has been resent.")};return c(()=>{const e=setInterval(()=>{k(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),c(()=>{l&&!n&&(async()=>{const{error:e}=await w.requestEmailOtp();e?m("Failed to send Email code. If this persists, refresh the page and try registering again."):i(ee)})()},[l,n,i,w]),e("div",{className:Qe,children:t("div",{className:Ze,children:[e("h2",{className:Xe,children:"Verify Your Phone Number"}),e("p",{className:et,children:"Enter the code sent to your phone number."}),_&&e("p",{className:tt,children:_}),f&&e("p",{className:it,children:f}),t("form",{onSubmit:async e=>{if(e.preventDefault(),m(""),6===a.length){p(!0);try{await x()}catch{m("Unexpected error occurred.")}finally{p(!1)}}else m("Please enter a valid code.")},className:ot,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:rt,children:["Phone Verification Code ",(N=l,!0===N?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===N?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",t("span",{className:nt,children:["Code expires in: ",(S=v,`${Math.floor(S/60).toString().padStart(2,"0")}:${(S%60).toString().padStart(2,"0")}`)]})]}),e(ut,{length:6,value:a,onChange:s}),e("button",{type:"button",onClick:()=>P(),className:at,children:"Resend code to phone"})]}),e("button",{type:"submit",className:st,children:g?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>i("/login"),className:lt,children:"Back to login"})]})]})});var S,N},mt=()=>{const i=h(),o=y(),{refreshSession:r}=W(),n=$(),{passkeySupported:a}=Y(),s="login"===o.state?.flow,[l,u]=d(!1),[_,m]=d(""),[g,p]=d(300),[f,b]=d(""),[v,k]=d("");return c(()=>{const e=setInterval(()=>{p(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:Qe,children:t("div",{className:Ze,children:[e("h2",{className:Xe,children:"Verify Your Email"}),e("p",{className:et,children:"We sent you a verification email. Enter the code below."}),f&&e("p",{className:tt,children:f}),v&&e("p",{className:it,children:v}),t("form",{onSubmit:async e=>{if(e.preventDefault(),b(""),6===_.length){u(!0);try{const{error:e}=s?await n.verifyLoginEmailOtp(_):await n.verifyEmailOtp(_);if(e)return void b("Verification failed.");if(s)return await r(),void i("/");a?i(oe):(await r(),i("/"))}catch{console.error("Email OTP verification failed."),b("Verification failed.")}finally{u(!1)}}else b("Please enter a valid code.")},className:ot,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:rt,children:["Email Verification Code",t("span",{className:nt,children:[" ","— Code expires in ",(w=g,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(ut,{length:6,value:_,onChange:m,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{b(""),k("");const{error:e}=s?await n.requestLoginEmailOtp():await n.requestEmailOtp();e?b("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:at,children:"Resend code to email"})]}),e("button",{type:"submit",className:st,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>i("/login"),className:lt,children:"Back to login"})]})]})});var w};var gt={container:"verifyMagiclink-module__container___qrSXf",card:"verifyMagiclink-module__card___niKgr",title:"verifyMagiclink-module__title___SumxD",verificationContent:"verifyMagiclink-module__verificationContent___NdsS0",spinner:"verifyMagiclink-module__spinner___lnW1k",successIcon:"verifyMagiclink-module__successIcon___XjFEM",checkIcon:"verifyMagiclink-module__checkIcon___I0JOP",successText:"verifyMagiclink-module__successText___lO5Qq"};ne(".verifyMagiclink-module__container___qrSXf{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid hsla(0,0%,100%,.15);border-radius:50%;border-top-color:#60a5fa;height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:#34d399;height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:#34d399;font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const pt=()=>{const[i]=b(),o=h(),r=i.get("token"),[n,a]=d(""),[s,l]=d(""),u=$(),{refreshSession:_}=W();return c(()=>{let e=!0,t=null,i=null;return(async()=>{if(!r)return e&&a("Missing token for verification."),void console.error("No magic-link token found.");const{error:n}=await u.verifyMagicLink(r);if(n)return console.error("Failed to verify token"),void(e&&a("Failed to verify token"));await _(),e&&(t=new BroadcastChannel("seamless-auth"),t.postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),l("You have been verified on the device and browser that initiated this request"),i=setTimeout(()=>{e&&o("/")},900))})(),()=>{e=!1,t?.close(),i&&clearTimeout(i)}},[r,u,o,_]),e("div",{className:gt.container,children:t("div",{className:gt.card,children:[e("h1",{className:gt.title,children:"Verifying your login"}),t("div",{className:gt.verificationContent,children:[!s&&!n&&e("div",{className:gt.spinner}),s&&e("div",{className:gt.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:gt.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!s&&!n&&e("p",{className:gt.helperText,children:"Please wait while we securely verify your sign-in link."}),s&&e("p",{className:gt.successText,children:"Login verified. Redirecting…"}),n&&e("p",{className:gt.error,children:n})]})]})})},ft=()=>{const{finishOAuthLogin:o}=W(),r=h(),[n]=b(),[a,s]=d(""),l=p(!1);return c(()=>{if(l.current)return;l.current=!0;const e=n.get("code"),t=n.get("state"),i=sessionStorage.getItem(Se);e&&t&&i?o({providerId:i,code:e,state:t}).then(({error:e})=>{e?s("We could not complete sign-in. Please try again."):(sessionStorage.removeItem(Se),r("/"))}):s("This sign-in link is missing required information.")},[o,r,n]),t("div",{className:gt.container,children:[e("h2",{className:gt.title,children:a?"Sign-in failed":"Completing sign-in..."}),a&&t(i,{children:[e("p",{children:a}),e("button",{type:"button",onClick:()=>r("/login"),children:"Back to login"})]})]})};var ht="magiclink-module__container___45zcA",yt="magiclink-module__card___Au9oN",bt="magiclink-module__iconWrapper___k5ndr",vt="magiclink-module__mailIcon___Pwb7q",kt="magiclink-module__iconRing___bdLvf",wt="magiclink-module__heading___b9cre",xt="magiclink-module__message___kiVFj",Pt="magiclink-module__identifier___JtcFM",St="magiclink-module__helperText___7Mlfh",Nt="magiclink-module__actions___64I-3",Ot="magiclink-module__secondaryButton___BntAI",Tt="magiclink-module__cooldown___Ib4rm",Ct="magiclink-module__linkButton___maJiv";ne(".magiclink-module__container___45zcA{align-items:center;color:#fff;display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:#1f2937;border-radius:.75rem;box-shadow:0 10px 25px rgba(0,0,0,.25);max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:#a5b4fc;height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:#d1d5db;font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:hsla(0,0%,100%,.05);border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:#9ca3af;font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:#111827;border:1px solid #374151;border-radius:8px;color:#fff;cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:#1f2937}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:#9ca3af;font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:#a5b4fc;cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const It=()=>{const{refreshSession:i}=W(),o=h(),r=y(),n=$(),a=r.state?.identifier,[s,l]=d(30);c(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const u=m(async()=>{const{data:e,error:t}=await n.checkMagicLink();return!t&&"Success"===e?.message},[n]);return c(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await u()&&(await i(),o("/"))},()=>{e.close()}},[u,o,i]),c(()=>{const e=setInterval(async()=>{try{await u()&&(await i(),o("/"))}catch{}},5e3);return()=>clearInterval(e)},[u,i,o]),e("div",{className:ht,children:t("div",{className:yt,children:[t("div",{className:bt,children:[e("div",{className:kt}),t("svg",{className:vt,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e("path",{d:"M4 6h16v12H4z"}),e("path",{d:"m4 6 8 6 8-6"})]})]}),e("h2",{className:wt,children:"Check your email"}),e("p",{className:xt,children:"If an account exists for this address, we sent a secure sign-in link."}),a&&e("div",{className:Pt,children:a}),e("p",{className:St,children:"Open the email and click the link to finish signing in."}),e("p",{className:St,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Nt,children:[e("button",{className:Ot,disabled:s>0,onClick:async()=>{s>0||(await n.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:Tt,children:["Available in ",s,"s"]}),e("button",{className:Ct,onClick:()=>o("/login"),children:"Change email or phone"})]})]})})},Mt=()=>t(v,{children:[e(k,{path:Q,element:e(Te,{})}),e(k,{path:Z,element:e(Ie,{})}),e(k,{path:X,element:e(_t,{})}),e(k,{path:ee,element:e(mt,{})}),e(k,{path:te,element:e(pt,{})}),e(k,{path:ie,element:e(ft,{})}),e(k,{path:oe,element:e(Ye,{})}),e(k,{path:re,element:e(It,{})}),e(k,{path:"*",element:e(w,{to:Q,replace:!0})})]});export{D as AuthProvider,Mt as AuthRoutes,P as SeamlessAuthError,q as createSeamlessAuthClient,M as encodePrfSalt,L as extractPasskeyPrfResult,G as hasScopedRole,E as isPasskeyPrfSupported,J as roleGrantsAccess,W as useAuth,$ as useAuthClient,Y as usePasskeySupport};
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{browserSupportsWebAuthn as o,bufferToBase64URLString as n,base64URLStringToBuffer as r,startAuthentication as a,startRegistration as s,WebAuthnError as l}from"@simplewebauthn/browser";import{createContext as d,useMemo as c,useSyncExternalStore as u,useEffect as _,useContext as m,useState as g,useRef as p,useCallback as f}from"react";import{useHref as h,useNavigate as y,useLocation as b,useSearchParams as v,Routes as k,Route as w,Navigate as x}from"react-router-dom";import P from"libphonenumber-js";class S extends Error{constructor(e,t,i,o){super(e),this.name="SeamlessAuthError",this.status=t,this.body=i,this.cause=o}}const N={oauth_missing_email:!0,oauth_email_not_verified:!0,oauth_missing_subject:!0};function O(e){if("object"==typeof e&&null!==e)return e.code}function T(e){if(!(e instanceof S))return;if("object"!=typeof e.body||null===e.body)return;const t=O(e.body)??O(e.body.details);return"string"==typeof t&&Object.prototype.hasOwnProperty.call(N,t)?t:void 0}function C(e){if(!(e instanceof S)||("object"!=typeof(t=e.cause)||null===t||"string"!=typeof t.name))return;var t;const{name:i,code:o,message:n}=e.cause;return{name:i,code:"string"==typeof o?o:void 0,message:"string"==typeof n?n:""}}async function M(e,t){let i;try{i=await e.json()}catch{i=void 0}return new S(function(e){if("object"!=typeof e||null===e)return;const{error:t,message:i}=e;return"string"==typeof t&&t?t:"string"==typeof i&&i?i:void 0}(i)??t,e.status,i)}async function I(e){try{return await e.json()}catch{return}}async function A(e,t){let i;try{i=await e}catch{return{data:null,error:new S(t,0)}}return i.ok?{data:await I(i),error:null}:{data:null,error:await M(i,t)}}function z(e){return{data:e,error:null}}function E(e,t=0,i,o){return{data:null,error:new S(e,t,i,o)}}function F(e){if(e instanceof ArrayBuffer)return e;const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=new Uint8Array(t.byteLength);return i.set(t),i.buffer}function U(e){return"string"==typeof e?e:n(F(e))}function L(e){return"string"==typeof e?r(e):e}function R(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:U(e.salt),...e.secondSalt?{secondSalt:U(e.secondSalt)}:{}}}}async function B(){return!!o()&&("undefined"==typeof window||!1!==window.isSecureContext)&&void 0!==globalThis.PublicKeyCredential&&"undefined"!=typeof navigator&&"function"==typeof navigator.credentials?.get}function q(e){const t=e,i=t.extensions?.prf?.eval;return i?{...t,extensions:{...t.extensions,prf:{...t.extensions?.prf,eval:{...i,...i.first?{first:L(i.first)}:{},...i.second?{second:L(i.second)}:{}}}}}:e}function j(e){const t=e.clientExtensionResults,i=t?.prf?.results?.first;if(!i)return null;const o=(r=i)instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength);var r;return{credentialId:e.id,output:o,outputBase64url:n(F(o))}}function J(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function G(e,t){const i=e.method===t?e.method:null;return"Success"===e.message&&!0===e.fresh&&null!==i?z({fresh:!0,method:i,verifiedAt:e.verifiedAt??null,expiresAt:e.expiresAt??null,maxAgeSeconds:e.maxAgeSeconds??0}):E(e.message??"Step-up authentication failed.")}function D(e){return e?{method:"POST",body:JSON.stringify(R(e))}:{method:"POST"}}function W(e,t,i){const o=E(t,0,void 0,i),n=C(o.error);return console.error(e,n?.name??"Unknown error."),o}const $=e=>{const t=(e=>{const{authHost:t}=e;return async function(e,i){const o=`${t?.replace(/\/+$/,"")??""}/auth${e.startsWith("/")?e:`/${e}`}`,n=null!=i?.body,r={...i,credentials:"include",headers:{...n?{"Content-Type":"application/json"}:{},...i?.headers}};return fetch(o,r)}})({authHost:e.apiHost});return{getCurrentUser:()=>A(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>A(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const i=await A(t("/webAuthn/login/start",{...D(e?.prf)}),"Failed to start passkey login.");if(i.error)return i;let o,n;try{const e=await a({optionsJSON:q(i.data)});o=j(e),n=J(e)}catch(e){return W("Passkey login error.","Passkey login failed.",e)}const r=await A(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:n})}),"Failed to verify passkey.");return r.error?r:"Success"!==r.data?.message?E(r.data?.message??"Passkey login failed."):z(o?{prf:o}:{})},logout:(e={})=>A(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>A(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>A(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>A(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>A(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>A(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>A(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>A(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>A(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>A(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>A(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>A(t("/otp/verify-login-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestMagicLink:()=>A(t("/magic-link",{method:"POST",body:JSON.stringify({})}),"Failed to send the magic link."),checkMagicLink:()=>A(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>A(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>A(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),getPublicSystemConfig:()=>A(t("/system-config/public",{method:"GET"}),"Failed to read the public system configuration."),startOAuthLogin:e=>A(t(`/oauth/${encodeURIComponent(e.providerId)}/start`,{method:"POST",body:JSON.stringify({...e.redirectUri?{redirectUri:e.redirectUri}:{},...e.returnTo?{returnTo:e.returnTo}:{}})}),"Failed to start OAuth login."),finishOAuthLogin:e=>A(t(`/oauth/${encodeURIComponent(e.providerId)}/callback`,{method:"POST",body:JSON.stringify({code:e.code,state:e.state})}),"Failed to finish OAuth login."),registerPasskey:async e=>{const i=function(e){return"metadata"in e?e:{metadata:e}}(e),o=await A(t(function(e){const t=new URLSearchParams;e.requirePrf?t.set("requirePrf","true"):e.requestPrf&&t.set("requestPrf","true");const i=t.toString();return"/webAuthn/register/start"+(i?`?${i}`:"")}(i),{method:"GET"}),"Failed to fetch passkey registration challenge.");if(o.error)return o;let n;try{n=await s({optionsJSON:o.data})}catch(e){return e instanceof l?E(e.name,0,void 0,e):W("Passkey registration error.","Passkey registration failed.",e)}const r=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(n),a=await A(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:n,metadata:{...i.metadata,prfCapable:r}})}),"Verification failed.");return a.error?a:z({credentialId:n.id,prfCapable:r})},isPasskeyPrfSupported:B,getStepUpStatus:()=>A(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await A(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let i;try{i=J(await a({optionsJSON:q(e.data)}))}catch(e){return W("Step-up authentication error.","Step-up authentication failed.",e)}const o=await A(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:i})}),"Failed to verify step-up authentication.");return o.error?o:G(o.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const i=await A(t("/step-up/webauthn/start",{...D(e)}),"Failed to start step-up authentication.");if(i.error)return i;let o,n;try{const e=await a({optionsJSON:q(i.data)});o=j(e),n=J(e)}catch(e){return W("Step-up authentication error.","Step-up authentication failed.",e)}if(!o)return E("Passkey did not return PRF output.");const r=await A(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:n})}),"Failed to verify step-up authentication.");if(r.error)return r;const s=G(r.data??{},"webauthn");return s.error?s:z({...s.data,credentialId:o.credentialId,prf:o})},getTotpStatus:()=>A(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>A(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>A(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>A(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const i=await A(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return i.error?i:G(i.data??{},"totp")},updateCredential:e=>A(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>A(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>A(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>A(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>A(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,i)=>A(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(i)}),"Failed to update organization."),switchOrganization:e=>A(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>A(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,i)=>A(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(i)}),"Failed to add organization member."),updateOrganizationMember:(e,i,o)=>A(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify(o)}),"Failed to update organization member."),removeOrganizationMember:(e,i)=>A(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(i)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function V(e,t){const i=e.trim(),o=t.trim();if(!i||!o)return!1;if(i===o)return!0;if(i.endsWith(":*")){const e=i.slice(0,-2);return o===e||o.startsWith(`${e}:`)}if(!o.includes(":"))return!1;if(!i.includes(":"))return o.startsWith(`${i}:`);const n=i.split(":"),r=o.split(":"),a=n[n.length-1],s=r[r.length-1],l=n.slice(0,-1),d=r.slice(0,-1);return"write"===a&&"read"===s&&l.length===d.length&&l.every((e,t)=>e===d[t])}function K(e,t){if(!Array.isArray(e))return!1;const i=e.filter(e=>"string"==typeof e);return(Array.isArray(t)?t:[t]).some(e=>i.some(t=>V(t,e)))}function H(){return"undefined"==typeof localStorage?function(){const e=new Map;return{get:t=>e.get(t)??null,set:(t,i)=>{e.set(t,i)}}}():{get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}}}const Y="seamlessauth_seen",Q={user:null,credentials:[],organizations:[],activeOrganization:null,stepUpStatus:null,isAuthenticated:!1};const Z=d(void 0),X=()=>{const e=m(Z);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},ee=({children:t,apiHost:i,autoDetectPreviousSignin:o=!0})=>{const n=c(()=>function(e){const{apiHost:t,detectPreviousSignIn:i=!0}=e,o=$({apiHost:t}),n=e.storage??H(),r=new Set;let a=!1,s=0,l={...Q,loading:!0,hasSignedInBefore:i&&"true"===n.get(Y)};function d(e){const t={...l,...e};Object.keys(e).some(e=>l[e]!==t[e])&&(l=t,r.forEach(e=>e()))}function c(){n.set(Y,"true"),i&&d({hasSignedInBefore:!0})}function u(){d(Q)}async function _(){const e=++s;d({loading:!0});const t=await o.getCurrentUser();return a||e!==s?t:t.error?(u(),d({loading:!1}),t):(d({user:t.data.user,credentials:t.data.credentials??[],organizations:t.data.organizations??[],activeOrganization:t.data.activeOrganization??null,isAuthenticated:!0,loading:!1}),l.hasSignedInBefore||c(),t)}async function m(e){const t=await e();return t.error||await _(),t}return{getState:()=>l,subscribe:e=>(r.add(e),()=>{r.delete(e)}),actions:{login:(e,t)=>o.login({identifier:e,passkeyAvailable:t}),handlePasskeyLogin:()=>m(()=>o.loginWithPasskey()),refreshSession:_,logout:async function(){try{return await o.logout()}finally{u()}},logoutAllSessions:async function(){try{return await o.logoutAllSessions()}finally{u()}},deleteUser:async()=>{const e=await o.deleteUser();return e.error||u(),e},updateCredential:async e=>{const{data:t,error:i}=await o.updateCredential({friendlyName:e.friendlyName??null,id:e.id});if(i)return{data:null,error:i};const n=t.credential;return d({credentials:l.credentials.map(e=>e.id===n.id?{...e,...n}:e)}),{data:n,error:null}},deleteCredential:async e=>{const t=await o.deleteCredential(e);return t.error||d({credentials:l.credentials.filter(t=>t.id!==e)}),t},switchOrganization:e=>m(()=>o.switchOrganization(e)),listOAuthProviders:()=>o.listOAuthProviders(),startOAuthLogin:e=>o.startOAuthLogin(e),finishOAuthLogin:e=>m(()=>o.finishOAuthLogin(e)),refreshStepUpStatus:async()=>{const e=await o.getStepUpStatus();return d({stepUpStatus:e.error?null:e.data}),e},verifyStepUpWithPasskey:async()=>{const e=await o.verifyStepUpWithPasskey();return e.error||d({stepUpStatus:e.data}),e},verifyStepUpWithPasskeyPrf:async e=>{const t=await o.verifyStepUpWithPasskeyPrf(e);return t.error||d({stepUpStatus:{fresh:t.data.fresh,method:t.data.method,verifiedAt:t.data.verifiedAt,expiresAt:t.data.expiresAt,maxAgeSeconds:t.data.maxAgeSeconds}}),t},verifyStepUpWithTotp:async e=>{const t=await o.verifyStepUpWithTotp(e);return t.error||d({stepUpStatus:t.data}),t},hasRole:e=>l.user?.roles?.includes(e),hasScopedRole:e=>l.user?K(l.user.roles,e):void 0,markSignedIn:c},destroy:()=>{a=!0,r.clear()}}}({apiHost:i,detectPreviousSignIn:o}),[i,o]),r=u(n.subscribe,n.getState,n.getState);_(()=>{n.actions.refreshSession()},[n]);const a=c(()=>({...r,...n.actions,apiHost:i}),[r,n,i]);return e(Z.Provider,{value:a,children:t})},te=()=>{const{apiHost:e}=X();return c(()=>$({apiHost:e}),[e])},ie=["passkey","magic_link"],oe=()=>{const e=te(),[t,i]=g(null),[o,n]=g(!0);return _(()=>{let t=!0;return(async()=>{try{const{data:o,error:n}=await e.getPublicSystemConfig();t&&!n&&o?.loginMethods?.length&&i(o.loginMethods)}catch{}finally{t&&n(!1)}})(),()=>{t=!1}},[e]),{loginMethods:t,loading:o}},ne=e=>Boolean(e?.some(e=>"passkey"!==e)),re=e=>{if("string"!=typeof e)return!1;const t=e.trim();if(t.length<3||t.length>320)return!1;const i=t.split("@");if(2!==i.length)return!1;const[o,n]=i;return!(!/^[A-Za-z0-9._%+-]+$/.test(o)||o.startsWith(".")||o.endsWith(".")||o.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(n)||n.startsWith("-")||n.endsWith("-")||n.startsWith(".")||n.endsWith(".")||n.includes(".."))},ae=e=>{const t=P(e);return t?.isValid()||!1};async function se(){return async function(){if("undefined"==typeof window)return!1;if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return console.error("Error checking passkey support."),!1}return!1}()}const le=()=>{const[e,t]=g(!1),[i,o]=g(!0);return _(()=>{let e=!0;return(async()=>{try{const i=await se();e&&t(i)}catch{e&&t(!1)}finally{e&&o(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:i}},de="/login",ce="/passkey-login",ue="/verify-phone-otp",_e="/verify-email-otp",me="/verify-magiclink",ge="/oauth/callback",pe="/register-passkey",fe="/magic-link-sent";function he(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var ye="login-module__container___YggDx",be="login-module__card___Ub-Py",ve="login-module__heading___neEqb",ke="login-module__inputGroup___P6qgS",we="login-module__label___mx5vu",xe="login-module__input___U07lW",Pe="login-module__helperText___kDQ4-",Se="login-module__error___40zxh",Ne="login-module__button___0kFBs",Oe="login-module__toggle___1JiG1",Te="login-module__fallbackCard___HdIk-",Ce="login-module__fallbackHeader___-il2v",Me="login-module__fallbackDescription___ea5EB",Ie="login-module__fallbackActions___AD3ni",Ae="login-module__fallbackActionButton___lFgWf",ze="login-module__actionTitle___ycrMp",Ee="login-module__actionSubtext___opaIV",Fe="login-module__linkButton___5lsoe";he(".login-module__container___YggDx{align-items:center;color:#fff;display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:#1f2937;border-radius:.5rem;box-shadow:0 4px 6px rgba(0,0,0,.1);max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:#68d391;text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:#d1d5db;display:block}.login-module__input___U07lW{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px #3b82f6;outline:none}.login-module__helperText___kDQ4-{color:#9ca3af;font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:#f87171;font-size:.875rem}.login-module__button___0kFBs{background-color:#2563eb;border-radius:.375rem;color:#fff;cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:#1d4ed8}.login-module__button___0kFBs:disabled{background-color:#9ca3af;cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:hsla(0,0%,100%,.04);border:1px solid hsla(0,0%,100%,.08);border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:#f3f4f6;font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:#9ca3af;font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:rgba(0,0,0,.25);border:1px solid hsla(0,0%,100%,.08);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:hsla(0,0%,100%,.06);border-color:hsla(0,0%,100%,.15)}.login-module__actionTitle___ycrMp{color:#f9fafb;font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:#9ca3af;font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const Ue=({identifier:i,onMagicLink:o,onEmailOtp:n,onPhoneOtp:r,onPasskeyRetry:a,loginMethods:s})=>{const l=new Set(s??["passkey","magic_link","phone_otp"]),d=l.has("magic_link")&&re(i),c=l.has("email_otp")&&Boolean(n)&&re(i),u=l.has("phone_otp")&&ae(i),_=l.has("passkey")&&Boolean(a);return d||c||u||_?t("div",{className:Te,children:[e("div",{className:Ce,children:"Choose a sign-in method"}),e("p",{className:Me,children:"Choose another secure sign-in method."}),t("div",{className:Ie,children:[d&&t("button",{type:"button",className:Ae,onClick:o,children:[e("span",{className:ze,children:"Email Magic Link"}),e("span",{className:Ee,children:"Send a secure sign-in link to your email"})]}),c&&t("button",{type:"button",className:Ae,onClick:n,children:[e("span",{className:ze,children:"Email Code"}),e("span",{className:Ee,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:Ae,onClick:r,children:[e("span",{className:ze,children:"Text Message Code"}),e("span",{className:Ee,children:"Receive a one-time code via SMS"})]})]}),_&&e("button",{type:"button",className:Fe,onClick:a,children:"Try passkey anyway"})]}):null},Le="seamless:oauth:provider",Re=()=>{const{listOAuthProviders:i,startOAuthLogin:o}=X(),n=h("/oauth/callback"),[r,a]=g([]),[s,l]=g("");if(_(()=>{let e=!0;return i().then(({data:t})=>{e&&a(t?.providers??[])}),()=>{e=!1}},[i]),0===r.length)return null;return t("div",{className:Ie,children:[r.map(i=>e("button",{type:"button",className:Ae,onClick:()=>(async e=>{l(""),sessionStorage.setItem(Le,e);const{data:t,error:i}=await o({providerId:e,redirectUri:new URL(n,window.location.origin).toString()});i?l("Could not start sign-in with this provider."):window.location.assign(t.authorizationUrl)})(i.id),children:t("span",{className:ze,children:["Continue with ",i.name]})},i.id)),s&&e("p",{className:Se,children:s})]})},Be=()=>{const o=y(),{hasSignedInBefore:n,login:r,handlePasskeyLogin:a}=X(),s=te(),{passkeySupported:l}=le(),{loginMethods:d}=oe(),[c,u]=g(""),[m,p]=g(""),[f,h]=g("register"),[b,v]=g(""),[k,w]=g(""),[x,P]=g(""),[S,N]=g(!1),[O,T]=g(null);_(()=>{n&&h("login")},[n]);return e("div",{className:ye,children:t("div",{className:be,children:[e("h2",{className:ve,children:"login"===f?"Sign In":"Create Account"}),t(i,{children:[t("form",{onSubmit:async e=>{e.preventDefault(),v(""),N(!1);try{if("login"===f){const{data:e,error:t}=await r(c,l);if(t)return void v("Failed to start sign-in. Please try again.");const i=e?.loginMethods?.length?e.loginMethods:d??ie;if(T(i),l&&i.includes("passkey")){const{error:e}=await a();return e?(N(!0),void v("Passkey sign-in could not be completed. Choose another sign-in method.")):void o("/")}return void N(!0)}"register"===f&&await(async()=>{v("");const{data:e,error:t}=await s.register({email:m});t?v("Failed to register. Please try again."):"Success"===e.message?o(_e):v("An unexpected error occurred. Try again. If the problem persists, contact support.")})()}catch{console.error("Failed to continue sign-in."),v("Failed to continue sign-in. Please try again.")}},children:["login"===f&&t("div",{className:ke,children:[e("label",{htmlFor:"identifier",className:we,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:c,onChange:e=>{const t=e.target.value;u(t)},autoComplete:"off",placeholder:"Email or Phone Number",className:xe,onBlur:()=>{if(c){const e=re(c)||ae(c);P(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:Pe,children:"Phone numbers must include a country code e.g. +1"}),S&&e(Ue,{identifier:c,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?v("Failed to send magic link."):o(fe,{state:{identifier:c}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?v("Failed to send email code."):o(_e,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?v("Failed to send OTP."):o(ue,{state:{flow:"login"}})},onPasskeyRetry:l?a:void 0,loginMethods:O}),x&&e("p",{className:Se,children:x})]}),"register"===f&&t("div",{className:ke,children:[e("label",{htmlFor:"email",className:we,children:"Email Address"}),e("input",{id:"email",type:"email",value:m,onChange:e=>{const t=e.target.value;p(t)},autoComplete:"off",className:xe,onBlur:()=>{if(m){const e=re(m);w(e?"":"Please enter a valid email")}},required:!0}),k&&e("p",{className:Se,children:k})]}),e("button",{type:"submit",className:Ne,disabled:!("login"===f&&c?re(c)||ae(c):re(m)),children:"login"===f?"Login":"Register"}),b&&e("p",{className:Se,children:b}),e("button",{type:"button",onClick:()=>h("login"===f?"register":"login"),className:Oe,children:"login"===f?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(Re,{})]})]})})};var qe={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};he(".passKeyLogin-module__container___IUKxF{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:#1d4ed8}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const je=()=>{const i=y(),{handlePasskeyLogin:o}=X(),[n,r]=g("");return e("div",{className:qe.container,children:t("div",{className:qe.card,children:[e("h2",{className:qe.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{r("");const{error:e}=await o();e?r("Passkey sign-in could not be completed. Try another sign-in method."):i("/")},className:qe.button,children:"Use Passkey"}),n&&e("p",{className:qe.error,children:n})]})})};var Je="registerPasskey-module__container___jqEh8",Ge="registerPasskey-module__card___MJAyC",De="registerPasskey-module__loading___Q4i1x",We="registerPasskey-module__spinner___V1nhd",$e="registerPasskey-module__supported___ihTih",Ve="registerPasskey-module__title___vn2Qu",Ke="registerPasskey-module__description___AWmO-",He="registerPasskey-module__button___D3b4B",Ye="registerPasskey-module__message___RiOw-",Qe="registerPasskey-module__success___HP5aX",Ze="registerPasskey-module__error___hGiqE",Xe="registerPasskey-module__skip___1hDyU";he(".registerPasskey-module__container___jqEh8{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:#f9fafb;border-radius:.75rem;box-shadow:0 2px 8px rgba(0,0,0,.1);color:#374151;display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-color:#3b82f6 transparent;border-radius:9999px;border-style:solid;border-width:2px;height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:#ecfdf5;border-radius:.75rem;box-shadow:0 2px 12px rgba(0,0,0,.1);color:#065f46;padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:#059669;border:none;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:#047857}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:#6ee7b7}.registerPasskey-module__error___hGiqE{color:#f87171}.registerPasskey-module__skip___1hDyU{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.registerPasskey-module__skip___1hDyU:disabled{cursor:default;opacity:.6}");var et="deviceNameModal-module__overlay___fmdPd",tt="deviceNameModal-module__modal___uoEda",it="deviceNameModal-module__description___-HMTA",ot="deviceNameModal-module__input___4vQMI",nt="deviceNameModal-module__actions___KXw7b",rt="deviceNameModal-module__primary___9Ozlk",at="deviceNameModal-module__secondary___HILhc";he(".deviceNameModal-module__overlay___fmdPd{align-items:center;background:rgba(0,0,0,.45);display:flex;inset:0;justify-content:center;position:fixed;z-index:1000}.deviceNameModal-module__modal___uoEda{background:#1f2937;border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,.15);color:#fff;max-width:420px;padding:24px;width:100%}.deviceNameModal-module__description___-HMTA{color:#fff;font-size:14px;margin-bottom:16px}.deviceNameModal-module__input___4vQMI{border:1px solid #ddd;border-radius:8px;font-size:14px;margin-bottom:20px;padding:10px 12px;width:100%}.deviceNameModal-module__actions___KXw7b{display:flex;gap:10px;justify-content:flex-end}.deviceNameModal-module__primary___9Ozlk{background:#2563eb;border:none;border-radius:8px;color:#fff;cursor:pointer;padding:8px 14px}.deviceNameModal-module__secondary___HILhc{background:transparent;border:1px solid #ccc;border-radius:8px;cursor:pointer;padding:8px 14px}");const st=({isOpen:i,onCancel:o,onConfirm:n})=>{const[r,a]=g("");return i?e("div",{className:et,children:t("div",{className:tt,children:[e("h3",{children:"Name This Device"}),e("p",{className:it,children:"Give this passkey a friendly name so you can recognize it later."}),e("input",{type:"text",placeholder:"e.g., MacBook Pro, iPhone, YubiKey",value:r,onChange:e=>a(e.target.value),className:ot,autoFocus:!0}),t("div",{className:nt,children:[e("button",{onClick:o,className:at,children:"Cancel"}),e("button",{onClick:()=>n(r.trim()),disabled:!r.trim(),className:rt,children:"Continue"})]})]})}):null},lt=()=>{const{refreshSession:o}=X(),n=te(),{passkeySupported:r,loading:a}=le(),{loginMethods:s,loading:l}=oe(),d=y(),[c,u]=g("idle"),[_,m]=g(""),[p,f]=g(!1),[h,b]=g(null),v=ne(s),k=async()=>{await o(),d("/")};return t(i,{children:[e("div",{className:Je,children:e("div",{className:Ge,children:t("div",a||l?{className:De,children:[e("div",{className:We}),e("span",{children:"Checking for Passkey Support..."})]}:r?{className:$e,children:[e("h2",{className:Ve,children:"Secure Your Account with a Passkey"}),e("p",{className:Ke,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>{const{platform:e,browser:t,deviceInfo:i}=function(){const e=navigator.userAgent.toLowerCase();let t="unknown",i="unknown";return/iphone|ipad|ipod/.test(e)?t="ios":/android/.test(e)?t="android":/mac os/.test(e)?t="mac":/windows/.test(e)?t="windows":/linux/.test(e)&&(t="linux"),navigator.brave?i="brave":/edg\/|edgios/.test(e)?i="edge":/opr\/|opt\/|opera/.test(e)?i="opera":/vivaldi/.test(e)?i="vivaldi":/samsungbrowser/.test(e)?i="samsung":/firefox|fxios/.test(e)?i="firefox":/chrome|crios/.test(e)?i="chrome":/safari/.test(e)&&(i="safari"),{platform:t,browser:i,deviceInfo:`${t} • ${i}`}}();b({platform:e,browser:t,deviceInfo:i}),f(!0)},disabled:"loading"===c,className:He,children:"loading"===c?"Registering...":"Register Passkey"}),_&&e("p",{className:`${Ye} ${"success"===c?Qe:Ze}`,children:_}),v&&e("button",{type:"button",onClick:k,disabled:"loading"===c,className:Xe,children:"Skip for now"})]}:{className:$e,children:[e("h2",{className:Ve,children:"Passkeys are not available here"}),e("p",{className:Ke,children:v?"This device does not support passkeys. You can continue without one and add a passkey later from a device that does.":"This device does not support passkeys, and this application requires one to sign in. Try again from a device or browser that supports them."}),v&&e("button",{type:"button",onClick:k,className:He,children:"Continue"})]})})}),e(st,{isOpen:p,onCancel:()=>{f(!1),b(null)},onConfirm:async e=>{if(!h)return;const t={friendlyName:e,...h};u("loading");try{const{error:e}=await n.registerPasskey(t);if(e)throw e;await o(),u("success"),m("Passkey registered successfully."),d("/")}catch{console.error("Passkey registration failed."),u("error"),m("Error registering passkey.")}finally{f(!1),b(null)}}})]})};var dt="verifyOTP-module__container___wgoDE",ct="verifyOTP-module__card___3cs2p",ut="verifyOTP-module__title___fZ-1d",_t="verifyOTP-module__subtitle___dGSu3",mt="verifyOTP-module__error___GEtlG",gt="verifyOTP-module__success___46TjG",pt="verifyOTP-module__form___jiGG-",ft="verifyOTP-module__label___Zq5Mi",ht="verifyOTP-module__timer___smq-a",yt="verifyOTP-module__resend___PlmkG",bt="verifyOTP-module__button___8pIuO",vt="verifyOTP-module__toggle___wbzVa";he(".verifyOTP-module__container___wgoDE{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:#9ca3af;font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:#f87171;margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:#34d399;margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:#d1d5db;display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:#facc15;font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:#374151;border:1px solid #4b5563;border-radius:.375rem;color:#fff;outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px #3b82f6}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:#3b82f6}.verifyOTP-module__button___8pIuO{background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:#1d4ed8}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var kt="otpInput-module__otpContainer___MUjby",wt="otpInput-module__otpInput___3YMVm";he(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:#374151;border:1px solid #4b5563;border-radius:8px;color:#fff;font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:#60a5fa;box-shadow:0 0 0 2px rgba(96,165,250,.25);outline:none}");const xt=({length:t=6,value:i,inputMode:o="numeric",onChange:n,name:r="otp"})=>{const a=p([]),s=i.split("").concat(Array(t).fill("")).slice(0,t),l=(e,t)=>{var i;if(t.length>1)d(e,t);else if(!t||(i=t,"numeric"===o?/^\d$/.test(i):/^[a-zA-Z]$/.test(i))){const i=[...s];i[e]=t;const o=i.join("");n(o),t&&a.current[e+1]&&a.current[e+1]?.focus()}},d=(e,i)=>{let r=i;r="numeric"===o?i.replace(/\D/g,""):i.replace(/[^a-zA-Z]/g,"");const l=r.slice(0,t).split(""),d=[...s];l.forEach((i,o)=>{e+o<t&&(d[e+o]=i)}),n(d.join("")),a.current[Math.min(e+l.length,t-1)]?.focus()};return e("div",{className:kt,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),d(0,e.clipboardData.getData("text"))},children:s.map((i,d)=>e("input",{ref:e=>a.current[d]=e,type:"text",inputMode:"numeric"===o?"numeric":"text",autoComplete:"one-time-code",name:`${r}-${d}`,maxLength:1,value:i,className:wt,onChange:e=>l(d,e.target.value),onKeyDown:e=>((e,i)=>{if("Backspace"===i.key){i.preventDefault();const t=[...s];s[e]?(t[e]="",n(t.join(""))):e>0&&(t[e-1]="",n(t.join("")),a.current[e-1]?.focus())}"ArrowLeft"===i.key&&e>0&&a.current[e-1]?.focus(),"ArrowRight"===i.key&&e<t-1&&a.current[e+1]?.focus()})(d,e),"aria-label":`Digit ${d+1}`},d))})},Pt=()=>{const i=y(),o=b(),{refreshSession:n}=X(),r="login"===o.state?.flow,[a,s]=g(""),[l,d]=g(null),[c,u]=g(""),[m,p]=g(!1),[f,h]=g(""),[v,k]=g(300),w=te(),x=async()=>{if(p(!0),!l){const{error:e}=r?await w.verifyLoginPhoneOtp(a):await w.verifyPhoneOtp(a);if(e)u("Verification failed.");else{if(r)return await n(),void i("/");d(!0)}}p(!1)},P=async()=>{h(""),await(async()=>{u("");const{error:e}=r?await w.requestLoginPhoneOtp():await w.requestPhoneOtp();e?u("Failed to send SMS code. If this persists, refresh the page and try again."):h("Verification SMS has been resent.")})(),h("Verification SMS has been resent.")};return _(()=>{const e=setInterval(()=>{k(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),_(()=>{l&&!r&&(async()=>{const{error:e}=await w.requestEmailOtp();e?u("Failed to send Email code. If this persists, refresh the page and try registering again."):i(_e)})()},[l,r,i,w]),e("div",{className:dt,children:t("div",{className:ct,children:[e("h2",{className:ut,children:"Verify Your Phone Number"}),e("p",{className:_t,children:"Enter the code sent to your phone number."}),c&&e("p",{className:mt,children:c}),f&&e("p",{className:gt,children:f}),t("form",{onSubmit:async e=>{if(e.preventDefault(),u(""),6===a.length){p(!0);try{await x()}catch{u("Unexpected error occurred.")}finally{p(!1)}}else u("Please enter a valid code.")},className:pt,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:ft,children:["Phone Verification Code ",(N=l,!0===N?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===N?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",t("span",{className:ht,children:["Code expires in: ",(S=v,`${Math.floor(S/60).toString().padStart(2,"0")}:${(S%60).toString().padStart(2,"0")}`)]})]}),e(xt,{length:6,value:a,onChange:s}),e("button",{type:"button",onClick:()=>P(),className:yt,children:"Resend code to phone"})]}),e("button",{type:"submit",className:bt,children:m?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>i("/login"),className:vt,children:"Back to login"})]})]})});var S,N},St=()=>{const i=y(),o=b(),{refreshSession:n}=X(),r=te(),{passkeySupported:a}=le(),s="login"===o.state?.flow,[l,d]=g(!1),[c,u]=g(""),[m,p]=g(300),[f,h]=g(""),[v,k]=g("");return _(()=>{const e=setInterval(()=>{p(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:dt,children:t("div",{className:ct,children:[e("h2",{className:ut,children:"Verify Your Email"}),e("p",{className:_t,children:"We sent you a verification email. Enter the code below."}),f&&e("p",{className:mt,children:f}),v&&e("p",{className:gt,children:v}),t("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===c.length){d(!0);try{const{error:e}=s?await r.verifyLoginEmailOtp(c):await r.verifyEmailOtp(c);if(e)return void h("Verification failed.");if(s)return await n(),void i("/");a?i(pe):(await n(),i("/"))}catch{console.error("Email OTP verification failed."),h("Verification failed.")}finally{d(!1)}}else h("Please enter a valid code.")},className:pt,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:ft,children:["Email Verification Code",t("span",{className:ht,children:[" ","— Code expires in ",(w=m,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(xt,{length:6,value:c,onChange:u,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),k("");const{error:e}=s?await r.requestLoginEmailOtp():await r.requestEmailOtp();e?h("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:yt,children:"Resend code to email"})]}),e("button",{type:"submit",className:bt,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>i("/login"),className:vt,children:"Back to login"})]})]})});var w};var Nt={container:"verifyMagiclink-module__container___qrSXf",card:"verifyMagiclink-module__card___niKgr",title:"verifyMagiclink-module__title___SumxD",verificationContent:"verifyMagiclink-module__verificationContent___NdsS0",spinner:"verifyMagiclink-module__spinner___lnW1k",successIcon:"verifyMagiclink-module__successIcon___XjFEM",checkIcon:"verifyMagiclink-module__checkIcon___I0JOP",successText:"verifyMagiclink-module__successText___lO5Qq"};he(".verifyMagiclink-module__container___qrSXf{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid hsla(0,0%,100%,.15);border-radius:50%;border-top-color:#60a5fa;height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:#34d399;height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:#34d399;font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const Ot=()=>{const[i]=v(),o=y(),n=i.get("token"),[r,a]=g(""),[s,l]=g(""),d=te(),{refreshSession:c}=X();return _(()=>{let e=!0,t=null,i=null;return(async()=>{if(!n)return e&&a("Missing token for verification."),void console.error("No magic-link token found.");const{error:r}=await d.verifyMagicLink(n);if(r)return console.error("Failed to verify token"),void(e&&a("Failed to verify token"));await c(),e&&(t=new BroadcastChannel("seamless-auth"),t.postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),l("You have been verified on the device and browser that initiated this request"),i=setTimeout(()=>{e&&o("/")},900))})(),()=>{e=!1,t?.close(),i&&clearTimeout(i)}},[n,d,o,c]),e("div",{className:Nt.container,children:t("div",{className:Nt.card,children:[e("h1",{className:Nt.title,children:"Verifying your login"}),t("div",{className:Nt.verificationContent,children:[!s&&!r&&e("div",{className:Nt.spinner}),s&&e("div",{className:Nt.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:Nt.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!s&&!r&&e("p",{className:Nt.helperText,children:"Please wait while we securely verify your sign-in link."}),s&&e("p",{className:Nt.successText,children:"Login verified. Redirecting…"}),r&&e("p",{className:Nt.error,children:r})]})]})})},Tt={oauth_missing_email:"Your provider account did not share an email address. Add an email to that account and make it visible, then try again.",oauth_email_not_verified:"The email address on your provider account is not verified. Verify it with your provider, then try again.",oauth_missing_subject:"Your provider did not return a usable account identifier. Try again, or sign in with a different method."},Ct=()=>{const{finishOAuthLogin:o}=X(),n=y(),[r]=v(),[a,s]=g(""),l=p(!1);return _(()=>{if(l.current)return;l.current=!0;const e=r.get("code"),t=r.get("state"),i=sessionStorage.getItem(Le);e&&t&&i?o({providerId:i,code:e,state:t}).then(({error:e})=>{if(e){const t=T(e);return void s(t?Tt[t]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(Le),n("/")}):s("This sign-in link is missing required information.")},[o,n,r]),t("div",{className:Nt.container,children:[e("h2",{className:Nt.title,children:a?"Sign-in failed":"Completing sign-in..."}),a&&t(i,{children:[e("p",{children:a}),e("button",{type:"button",onClick:()=>n("/login"),children:"Back to login"})]})]})};var Mt="magiclink-module__container___45zcA",It="magiclink-module__card___Au9oN",At="magiclink-module__iconWrapper___k5ndr",zt="magiclink-module__mailIcon___Pwb7q",Et="magiclink-module__iconRing___bdLvf",Ft="magiclink-module__heading___b9cre",Ut="magiclink-module__message___kiVFj",Lt="magiclink-module__identifier___JtcFM",Rt="magiclink-module__helperText___7Mlfh",Bt="magiclink-module__actions___64I-3",qt="magiclink-module__secondaryButton___BntAI",jt="magiclink-module__cooldown___Ib4rm",Jt="magiclink-module__linkButton___maJiv";he(".magiclink-module__container___45zcA{align-items:center;color:#fff;display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:#1f2937;border-radius:.75rem;box-shadow:0 10px 25px rgba(0,0,0,.25);max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:#a5b4fc;height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:#d1d5db;font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:hsla(0,0%,100%,.05);border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:#9ca3af;font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:#111827;border:1px solid #374151;border-radius:8px;color:#fff;cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:#1f2937}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:#9ca3af;font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:#a5b4fc;cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const Gt=()=>{const{refreshSession:i}=X(),o=y(),n=b(),r=te(),a=n.state?.identifier,[s,l]=g(30);_(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const d=f(async()=>{const{data:e,error:t}=await r.checkMagicLink();return!t&&"Success"===e?.message},[r]);return _(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await d()&&(await i(),o("/"))},()=>{e.close()}},[d,o,i]),_(()=>{const e=setInterval(async()=>{try{await d()&&(await i(),o("/"))}catch{}},5e3);return()=>clearInterval(e)},[d,i,o]),e("div",{className:Mt,children:t("div",{className:It,children:[t("div",{className:At,children:[e("div",{className:Et}),t("svg",{className:zt,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e("path",{d:"M4 6h16v12H4z"}),e("path",{d:"m4 6 8 6 8-6"})]})]}),e("h2",{className:Ft,children:"Check your email"}),e("p",{className:Ut,children:"If an account exists for this address, we sent a secure sign-in link."}),a&&e("div",{className:Lt,children:a}),e("p",{className:Rt,children:"Open the email and click the link to finish signing in."}),e("p",{className:Rt,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Bt,children:[e("button",{className:qt,disabled:s>0,onClick:async()=>{s>0||(await r.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:jt,children:["Available in ",s,"s"]}),e("button",{className:Jt,onClick:()=>o("/login"),children:"Change email or phone"})]})]})})},Dt=()=>t(k,{children:[e(w,{path:de,element:e(Be,{})}),e(w,{path:ce,element:e(je,{})}),e(w,{path:ue,element:e(Pt,{})}),e(w,{path:_e,element:e(St,{})}),e(w,{path:me,element:e(Ot,{})}),e(w,{path:ge,element:e(Ct,{})}),e(w,{path:pe,element:e(lt,{})}),e(w,{path:fe,element:e(Gt,{})}),e(w,{path:"*",element:e(x,{to:de,replace:!0})})]});export{ee as AuthProvider,Dt as AuthRoutes,S as SeamlessAuthError,$ as createSeamlessAuthClient,U as encodePrfSalt,j as extractPasskeyPrfResult,T as getOAuthErrorCode,C as getWebAuthnErrorDetail,ne as hasNonPasskeyLoginMethod,K as hasScopedRole,B as isPasskeyPrfSupported,V as roleGrantsAccess,X as useAuth,te as useAuthClient,oe as useLoginMethods,le as usePasskeySupport};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/client/errors.ts","../src/client/result.ts","../src/client/webauthnPrf.ts","../src/client/webauthnSupport.ts","../src/client/createSeamlessAuthClient.ts","../src/fetchWithAuth.ts","../src/scopedRoles.ts","../src/AuthProvider.tsx","../src/hooks/usePreviousSignIn.ts","../src/hooks/useAuthClient.ts","../src/utils.ts","../src/hooks/usePasskeySupport.ts","../src/routes.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/components/AuthFallbackOptions.tsx","../src/components/OAuthProviderButtons.tsx","../src/views/Login.tsx","../src/views/PassKeyLogin.tsx","../src/components/DeviceNameModal.tsx","../src/views/PassKeyRegistration.tsx","../src/components/OtpInput.tsx","../src/views/PhoneRegistration.tsx","../src/views/EmailRegistration.tsx","../src/views/VerifyMagicLink.tsx","../src/views/OAuthCallback.tsx","../src/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,"function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["SeamlessAuthError","Error","constructor","message","status","body","super","this","name","async","toSeamlessAuthError","response","fallbackMessage","json","undefined","error","extractMessage","readBody","requestResult","request","data","ok","resultOf","resultError","toArrayBuffer","value","ArrayBuffer","source","Uint8Array","buffer","byteOffset","byteLength","copy","set","encodePrfSalt","salt","bufferToBase64URLString","saltToBufferSource","base64URLStringToBuffer","createPrfRequestBody","input","credentialId","prf","secondSalt","isPasskeyPrfSupported","browserSupportsWebAuthn","window","isSecureContext","globalThis","PublicKeyCredential","navigator","credentials","get","preparePrfRequestOptions","optionsJSON","options","prfEval","extensions","eval","first","second","extractPasskeyPrfResult","credential","extensionResults","clientExtensionResults","results","output","id","outputBase64url","stripPrfResultsFromAssertion","toStepUpStatus","payload","expectedMethod","method","fresh","verifiedAt","expiresAt","maxAgeSeconds","buildAssertionStartInit","JSON","stringify","createSeamlessAuthClient","opts","fetchWithAuth","authHost","init","url","replace","startsWith","hasBody","requestInit","headers","fetch","createFetchWithAuth","apiHost","getCurrentUser","login","loginWithPasskey","optionsInput","started","assertionResponse","startAuthentication","console","verified","logout","scope","logoutAllSessions","deleteUser","register","email","phone","requestPhoneOtp","verifyPhoneOtp","verificationToken","requestLoginPhoneOtp","verifyLoginPhoneOtp","requestEmailOtp","verifyEmailOtp","requestLoginEmailOtp","verifyLoginEmailOtp","requestMagicLink","checkMagicLink","verifyMagicLink","token","encodeURIComponent","listOAuthProviders","startOAuthLogin","providerId","redirectUri","returnTo","finishOAuthLogin","code","state","registerPasskey","registerInput","metadata","normalizeRegisterPasskeyInput","challenge","query","URLSearchParams","requirePrf","requestPrf","queryString","toString","buildRegisterStartPath","attestationResponse","startRegistration","WebAuthnError","prfCapable","enabled","getRegistrationPrfCapable","getStepUpStatus","verifyStepUpWithPasskey","verifyStepUpWithPasskeyPrf","getTotpStatus","startTotpEnrollment","verifyTotpEnrollment","disableTotp","verifyStepUpWithTotp","updateCredential","deleteCredential","listOrganizations","createOrganization","getOrganization","organizationId","updateOrganization","switchOrganization","listOrganizationMembers","addOrganizationMember","updateOrganizationMember","userId","removeOrganizationMember","roleGrantsAccess","grantedRole","requiredRole","granted","trim","required","endsWith","prefix","slice","includes","grantedParts","split","requiredParts","grantedAction","length","requiredAction","grantedPrefix","requiredPrefix","every","part","index","hasScopedRole","grantedRoles","requiredRoles","Array","isArray","filter","role","some","AuthContext","createContext","useAuth","context","useContext","AuthProvider","children","autoDetectPreviousSignin","user","setUser","useState","setCredentials","organizations","setOrganizations","activeOrganization","setActiveOrganization","stepUpStatus","setStepUpStatus","isAuthenticated","setIsAuthenticated","loading","setLoading","hasSignedInBefore","markSignedIn","storageKey","setHasSignedInBefore","useEffect","localStorage","getItem","setItem","usePreviousSignIn","authClient","useMemo","resetAuthState","useCallback","validateToken","result","refreshStepUpStatus","_jsx","Provider","refreshSession","hasRole","roles","rolesGrantScopedAccess","friendlyName","updatedCredential","currentCredentials","map","currentCredential","identifier","passkeyAvailable","handlePasskeyLogin","useAuthClient","isValidEmail","normalized","parts","localPart","domainPart","test","isValidPhoneNumber","phoneNumber","parsePhoneNumberFromString","isValid","isPasskeySupported","isUserVerifyingPlatformAuthenticatorAvailable","isPlatformAuthenticatorAvailable","usePasskeySupport","passkeySupported","setPasskeySupported","active","supported","checkSupport","authRoutePaths","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","AuthFallbackOptions","onMagicLink","onEmailOtp","onPhoneOtp","onPasskeyRetry","loginMethods","allowedMethods","Set","showMagicLink","has","showEmailOtp","Boolean","showPhoneOtp","showPasskeyRetry","_jsxs","className","styles","onClick","OAUTH_PROVIDER_STORAGE_KEY","OAuthProviderButtons","callbackHref","useHref","providers","setProviders","setError","then","provider","sessionStorage","URL","location","origin","assign","authorizationUrl","handleSelect","DEFAULT_LOGIN_METHODS","Login","navigate","useNavigate","setIdentifier","setEmail","mode","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","setLoginMethods","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","passkeyError","htmlFor","onChange","target","autoComplete","placeholder","onBlur","flow","disabled","PassKeyLogin","runPasskeyLogin","container","card","title","button","DeviceNameModal","isOpen","onCancel","onConfirm","setValue","autoFocus","PasskeyRegistration","passkeySupportLoading","setStatus","setMessage","showDeviceModal","setShowDeviceModal","pendingMetadata","setPendingMetadata","platform","browser","deviceInfo","ua","userAgent","toLowerCase","brave","parseUserAgent","OtpInput","inputMode","inputs","useRef","values","concat","fill","handleChange","char","handleBulkInput","newValueArr","newValue","join","current","focus","cleaned","chars","forEach","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","key","handleKeyDown","PhoneRegistration","useLocation","isLoginFlow","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","handleResend","onResendPhone","interval","setInterval","prev","clearInterval","nextStep","seconds","floor","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","VerifyMagicLink","searchParams","useSearchParams","successMsg","setSuccessMsg","mounted","channel","redirectTimeout","BroadcastChannel","postMessage","setTimeout","verify","close","clearTimeout","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","OAuthCallback","startedRef","finishError","removeItem","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"oiBAUM,MAAOA,UAA0BC,MAIrC,WAAAC,CAAYC,EAAiBC,EAAgBC,GAC3CC,MAAMH,GACNI,KAAKC,KAAO,oBACZD,KAAKH,OAASA,EACdG,KAAKF,KAAOA,CACd,EAwBKI,eAAeC,EACpBC,EACAC,GAEA,IAAIP,EAEJ,IACEA,QAAaM,EAASE,MACxB,CAAE,MACAR,OAAOS,CACT,CAEA,OAAO,IAAId,EAjCb,SAAwBK,GACtB,GAAoB,iBAATA,GAA8B,OAATA,EAC9B,OAKF,MAAMU,MAAEA,EAAKZ,QAAEA,GAAYE,EAE3B,MAAqB,iBAAVU,GAAsBA,EACxBA,EAGiB,iBAAZZ,GAAwBA,EAAUA,OAAUW,CAC5D,CAoBIE,CAAeX,IAASO,EACxBD,EAASP,OACTC,EAEJ,CC5BAI,eAAeQ,EAASN,GACtB,IACE,aAAaA,EAASE,MACxB,CAAE,MAEA,MACF,CACF,CAMOJ,eAAeS,EACpBC,EACAP,GAEA,IAAID,EAEJ,IACEA,QAAiBQ,CACnB,CAAE,MACA,MAAO,CACLC,KAAM,KACNL,MAAO,IAAIf,EAAkBY,EA1BC,GA4BlC,CAEA,OAAKD,EAASU,GAIP,CAAED,WAAaH,EAASN,GAAiBI,MAAO,MAH9C,CAAEK,KAAM,KAAML,YAAaL,EAAoBC,EAAUC,GAIpE,CAGM,SAAUU,EAAYF,GAC1B,MAAO,CAAEA,OAAML,MAAO,KACxB,CAGM,SAAUQ,EACdpB,EACAC,EA7CkC,EA8ClCC,GAEA,MAAO,CAAEe,KAAM,KAAML,MAAO,IAAIf,EAAkBG,EAASC,EAAQC,GACrE,CC3BA,SAASmB,EAAcC,GACrB,GAAIA,aAAiBC,YACnB,OAAO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pM,EAAC+O,EAAK,CAACC,KAAM9M,GAAgC+M,QAASjP,EAACyM,SACvDzM,EAAC+O,GAAMC,KAAM9M,GAA8B+M,QAASjP,EAACiO,GAAa,CAAA,KAClEjO,EAAC+O,EAAK,CAACC,KAAM9M,GAAgC+M,QAASjP,EAACiI,GAAmB,CAAA,KAC1EjI,EAAC+O,EAAK,CAACC,KAAM9M,GAA8B+M,QAASjP,EAACqO,GAAa,CAAA,KAClErO,EAAC+O,EAAK,CAACC,KAAK,IAAIC,QAASjP,EAACkP,GAASC,GAAIjN,EAAsB1L","x_google_ignoreList":[13]}
1
+ {"version":3,"file":"index.js","sources":["../src/client/errors.ts","../src/client/result.ts","../src/client/webauthnPrf.ts","../src/client/webauthnSupport.ts","../src/client/createSeamlessAuthClient.ts","../src/fetchWithAuth.ts","../src/scopedRoles.ts","../src/session/storage.ts","../src/session/createAuthSession.ts","../src/AuthProvider.tsx","../src/hooks/useAuthClient.ts","../src/hooks/useLoginMethods.ts","../src/utils.ts","../src/hooks/usePasskeySupport.ts","../src/routes.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/components/AuthFallbackOptions.tsx","../src/components/OAuthProviderButtons.tsx","../src/views/Login.tsx","../src/views/PassKeyLogin.tsx","../src/components/DeviceNameModal.tsx","../src/views/PassKeyRegistration.tsx","../src/components/OtpInput.tsx","../src/views/PhoneRegistration.tsx","../src/views/EmailRegistration.tsx","../src/views/VerifyMagicLink.tsx","../src/views/OAuthCallback.tsx","../src/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["SeamlessAuthError","Error","constructor","message","status","body","cause","super","this","name","OAUTH_ERROR_CODES","oauth_missing_email","oauth_email_not_verified","oauth_missing_subject","readCode","code","getOAuthErrorCode","error","details","Object","prototype","hasOwnProperty","call","undefined","getWebAuthnErrorDetail","value","async","toSeamlessAuthError","response","fallbackMessage","json","extractMessage","readBody","requestResult","request","data","ok","resultOf","resultError","toArrayBuffer","ArrayBuffer","source","Uint8Array","buffer","byteOffset","byteLength","copy","set","encodePrfSalt","salt","bufferToBase64URLString","saltToBufferSource","base64URLStringToBuffer","createPrfRequestBody","input","credentialId","prf","secondSalt","isPasskeyPrfSupported","browserSupportsWebAuthn","window","isSecureContext","globalThis","PublicKeyCredential","navigator","credentials","get","preparePrfRequestOptions","optionsJSON","options","prfEval","extensions","eval","first","second","extractPasskeyPrfResult","credential","extensionResults","clientExtensionResults","results","output","id","outputBase64url","stripPrfResultsFromAssertion","toStepUpStatus","payload","expectedMethod","method","fresh","verifiedAt","expiresAt","maxAgeSeconds","buildAssertionStartInit","JSON","stringify","webAuthnFailure","logContext","thrown","failure","detail","console","createSeamlessAuthClient","opts","fetchWithAuth","authHost","init","url","replace","startsWith","hasBody","requestInit","headers","fetch","createFetchWithAuth","apiHost","getCurrentUser","login","loginWithPasskey","optionsInput","started","assertionResponse","startAuthentication","verified","logout","scope","logoutAllSessions","deleteUser","register","email","phone","requestPhoneOtp","verifyPhoneOtp","verificationToken","requestLoginPhoneOtp","verifyLoginPhoneOtp","requestEmailOtp","verifyEmailOtp","requestLoginEmailOtp","verifyLoginEmailOtp","requestMagicLink","checkMagicLink","verifyMagicLink","token","encodeURIComponent","listOAuthProviders","getPublicSystemConfig","startOAuthLogin","providerId","redirectUri","returnTo","finishOAuthLogin","state","registerPasskey","registerInput","metadata","normalizeRegisterPasskeyInput","challenge","query","URLSearchParams","requirePrf","requestPrf","queryString","toString","buildRegisterStartPath","attestationResponse","startRegistration","WebAuthnError","prfCapable","enabled","getRegistrationPrfCapable","getStepUpStatus","verifyStepUpWithPasskey","verifyStepUpWithPasskeyPrf","getTotpStatus","startTotpEnrollment","verifyTotpEnrollment","disableTotp","verifyStepUpWithTotp","updateCredential","deleteCredential","listOrganizations","createOrganization","getOrganization","organizationId","updateOrganization","switchOrganization","listOrganizationMembers","addOrganizationMember","updateOrganizationMember","userId","removeOrganizationMember","roleGrantsAccess","grantedRole","requiredRole","granted","trim","required","endsWith","prefix","slice","includes","grantedParts","split","requiredParts","grantedAction","length","requiredAction","grantedPrefix","requiredPrefix","every","part","index","hasScopedRole","grantedRoles","requiredRoles","Array","isArray","filter","role","some","createDefaultStorage","localStorage","values","Map","key","createMemoryStorage","getItem","setItem","PREVIOUS_SIGN_IN_KEY","SIGNED_OUT","user","organizations","activeOrganization","stepUpStatus","isAuthenticated","AuthContext","createContext","useAuth","context","useContext","AuthProvider","children","autoDetectPreviousSignin","session","useMemo","detectPreviousSignIn","client","storage","listeners","Set","destroyed","refreshGeneration","loading","hasSignedInBefore","setState","patch","next","keys","forEach","listener","markSignedIn","clearSession","refreshSession","generation","result","refreshAfter","run","getState","subscribe","add","delete","actions","identifier","passkeyAvailable","handlePasskeyLogin","friendlyName","updated","map","current","refreshStepUpStatus","hasRole","roles","rolesGrantScopedAccess","destroy","clear","createAuthSession","useSyncExternalStore","useEffect","_jsx","Provider","useAuthClient","FALLBACK_LOGIN_METHODS","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","setLoading","active","read","hasNonPasskeyLoginMethod","Boolean","isValidEmail","normalized","parts","localPart","domainPart","test","isValidPhoneNumber","phoneNumber","parsePhoneNumberFromString","isValid","isPasskeySupported","isUserVerifyingPlatformAuthenticatorAvailable","isPlatformAuthenticatorAvailable","usePasskeySupport","passkeySupported","setPasskeySupported","supported","checkSupport","authRoutePaths","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","AuthFallbackOptions","onMagicLink","onEmailOtp","onPhoneOtp","onPasskeyRetry","allowedMethods","showMagicLink","has","showEmailOtp","showPhoneOtp","showPasskeyRetry","_jsxs","className","styles","onClick","OAUTH_PROVIDER_STORAGE_KEY","OAuthProviderButtons","callbackHref","useHref","providers","setProviders","setError","then","provider","sessionStorage","URL","location","origin","assign","authorizationUrl","handleSelect","Login","navigate","useNavigate","configuredMethods","setIdentifier","setEmail","mode","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","passkeyError","htmlFor","onChange","target","autoComplete","placeholder","onBlur","flow","disabled","PassKeyLogin","runPasskeyLogin","container","card","title","button","DeviceNameModal","isOpen","onCancel","onConfirm","setValue","autoFocus","PasskeyRegistration","passkeySupportLoading","loginMethodsLoading","setStatus","setMessage","showDeviceModal","setShowDeviceModal","pendingMetadata","setPendingMetadata","canSkip","finishWithoutPasskey","platform","browser","deviceInfo","ua","userAgent","toLowerCase","brave","parseUserAgent","OtpInput","inputMode","inputs","useRef","concat","fill","handleChange","char","handleBulkInput","newValueArr","newValue","join","focus","cleaned","chars","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","handleKeyDown","PhoneRegistration","useLocation","isLoginFlow","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","handleResend","onResendPhone","interval","setInterval","prev","clearInterval","nextStep","seconds","floor","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","VerifyMagicLink","searchParams","useSearchParams","successMsg","setSuccessMsg","mounted","channel","redirectTimeout","BroadcastChannel","postMessage","setTimeout","verify","close","clearTimeout","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","CODE_ERRORS","OAuthCallback","startedRef","finishError","removeItem","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","useCallback","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"8jBAYM,MAAOA,UAA0BC,MASrC,WAAAC,CAAYC,EAAiBC,EAAgBC,EAAgBC,GAC3DC,MAAMJ,GACNK,KAAKC,KAAO,oBACZD,KAAKJ,OAASA,EACdI,KAAKH,KAAOA,EACZG,KAAKF,MAAQA,CACf,EAeF,MAAMI,EAAkD,CACtDC,qBAAqB,EACrBC,0BAA0B,EAC1BC,uBAAuB,GAGzB,SAASC,EAAST,GAChB,GAAoB,iBAATA,GAA8B,OAATA,EAIhC,OAAQA,EAA4BU,IACtC,CAYM,SAAUC,EAAkBC,GAChC,KAAMA,aAAiBjB,GACrB,OAGF,GAA0B,iBAAfiB,EAAMZ,MAAoC,OAAfY,EAAMZ,KAC1C,OAGF,MAAMU,EACJD,EAASG,EAAMZ,OAASS,EAAUG,EAAMZ,KAA+Ba,SAEzE,MAAuB,iBAATH,GACZI,OAAOC,UAAUC,eAAeC,KAAKZ,EAAmBK,GACrDA,OACDQ,CACN,CAiCM,SAAUC,EAAuBP,GACrC,KAAMA,aAAiBjB,KAZJ,iBAHnByB,EAe0DR,EAAMX,QAXpD,OAAVmB,GAC8C,iBAAtCA,EAA6BhB,MAWrC,OAjBJ,IACEgB,EAmBA,MAAMhB,KAAEA,EAAIM,KAAEA,EAAIZ,QAAEA,GAAYc,EAAMX,MAEtC,MAAO,CACLG,OACAM,KAAsB,iBAATA,EAAoBA,OAAOQ,EACxCpB,QAA4B,iBAAZA,EAAuBA,EAAU,GAErD,CAuBOuB,eAAeC,EACpBC,EACAC,GAEA,IAAIxB,EAEJ,IACEA,QAAauB,EAASE,MACxB,CAAE,MACAzB,OAAOkB,CACT,CAEA,OAAO,IAAIvB,EAjCb,SAAwBK,GACtB,GAAoB,iBAATA,GAA8B,OA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AAQ6D,UAAWC,GAAmBC,QAAS,IAAMkB,EAAS,UAAShI,SAAA,mCC9GpEuR,GAAa,IACxB5K,EAAC6K,aACCzO,EAAC0O,EAAK,CAACC,KAAM3M,GAAsB4M,QAAS5O,EAACgF,GAAK,CAAA,KAClDhF,EAAC0O,EAAK,CAACC,KAAM3M,GAA6B4M,QAAS5O,EAAC+G,GAAY,CAAA,KAChE/G,EAAC0O,EAAK,CAACC,KAAM3M,GAA+B4M,QAAS5O,EAACuK,GAAiB,CAAA,KACvEvK,EAAC0O,EAAK,CAACC,KAAM3M,GAA+B4M,QAAS5O,EAAC6L,SACtD7L,EAAC0O,EAAK,CAACC,KAAM3M,GAAgC4M,QAAS5O,EAACkM,SACvDlM,EAAC0O,GAAMC,KAAM3M,GAA8B4M,QAAS5O,EAAC2N,GAAa,CAAA,KAClE3N,EAAC0O,EAAK,CAACC,KAAM3M,GAAgC4M,QAAS5O,EAAC2H,GAAmB,CAAA,KAC1E3H,EAAC0O,EAAK,CAACC,KAAM3M,GAA8B4M,QAAS5O,EAAC+N,GAAa,CAAA,KAClE/N,EAAC0O,EAAK,CAACC,KAAK,IAAIC,QAAS5O,EAAC6O,GAASC,GAAI9M,GAAsBrN","x_google_ignoreList":[15]}
@@ -0,0 +1,60 @@
1
+ import { CurrentUserResult, FinishOAuthLoginInput, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from '../client/createSeamlessAuthClient';
2
+ import type { SeamlessAuthResult } from '../client/result';
3
+ import { PasskeyPrfInput } from '../client/webauthnPrf';
4
+ import { Credential, Organization, User } from '../types';
5
+ import { SessionStoragePort } from './storage';
6
+ /** Everything a UI binding renders from. Replaced wholesale on every change. */
7
+ export interface AuthSessionState {
8
+ user: User | null;
9
+ credentials: Credential[];
10
+ organizations: Organization[];
11
+ activeOrganization: Organization | null;
12
+ stepUpStatus: StepUpStatus | null;
13
+ isAuthenticated: boolean;
14
+ loading: boolean;
15
+ hasSignedInBefore: boolean;
16
+ }
17
+ export interface AuthSessionActions {
18
+ login: (identifier: string, passkeyAvailable: boolean) => Promise<SeamlessAuthResult<LoginStartResult>>;
19
+ handlePasskeyLogin: () => Promise<SeamlessAuthResult<PasskeyLoginData>>;
20
+ refreshSession: () => Promise<SeamlessAuthResult<CurrentUserResult>>;
21
+ logout: () => Promise<SeamlessAuthResult<MessageResult>>;
22
+ logoutAllSessions: () => Promise<SeamlessAuthResult<MessageResult>>;
23
+ deleteUser: () => Promise<SeamlessAuthResult<MessageResult>>;
24
+ updateCredential: (credential: Credential) => Promise<SeamlessAuthResult<Credential>>;
25
+ deleteCredential: (credentialId: string) => Promise<SeamlessAuthResult<MessageResult>>;
26
+ switchOrganization: (organizationId: string) => Promise<SeamlessAuthResult<OrganizationSwitchResult>>;
27
+ listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
28
+ startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
29
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
30
+ refreshStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
31
+ verifyStepUpWithPasskey: () => Promise<SeamlessAuthResult<StepUpStatus>>;
32
+ verifyStepUpWithPasskeyPrf: (input: PasskeyPrfInput) => Promise<SeamlessAuthResult<StepUpPrfData>>;
33
+ verifyStepUpWithTotp: (code: string) => Promise<SeamlessAuthResult<StepUpStatus>>;
34
+ hasRole: (role: string) => boolean | undefined;
35
+ hasScopedRole: (role: string | string[]) => boolean | undefined;
36
+ markSignedIn: () => void;
37
+ }
38
+ /**
39
+ * Framework-agnostic session store.
40
+ *
41
+ * `getState` and `subscribe` are the shape React's `useSyncExternalStore` wants,
42
+ * and they adapt directly to a Vue ref or an Angular observable, so bindings stay
43
+ * thin instead of each reimplementing this state machine.
44
+ */
45
+ export interface AuthSession {
46
+ getState: () => AuthSessionState;
47
+ subscribe: (listener: () => void) => () => void;
48
+ actions: AuthSessionActions;
49
+ destroy: () => void;
50
+ }
51
+ export interface AuthSessionOptions {
52
+ apiHost: string;
53
+ storage?: SessionStoragePort;
54
+ /**
55
+ * When false, a previous sign-in is still recorded but never surfaced, so a UI
56
+ * cannot branch on it.
57
+ */
58
+ detectPreviousSignIn?: boolean;
59
+ }
60
+ export declare function createAuthSession(options: AuthSessionOptions): AuthSession;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The session store's only browser dependency, expressed as a port so the store
3
+ * itself stays framework and environment agnostic. Implementations never throw:
4
+ * private browsing and disabled storage are normal, and neither is a reason to
5
+ * fail an auth flow.
6
+ */
7
+ export interface SessionStoragePort {
8
+ get(key: string): string | null;
9
+ set(key: string, value: string): void;
10
+ }
11
+ export declare function createMemoryStorage(): SessionStoragePort;
12
+ export declare function createBrowserStorage(): SessionStoragePort;
13
+ /**
14
+ * Browser storage where there is a `localStorage`, memory otherwise. The memory
15
+ * fallback is what keeps the store usable during server-side rendering.
16
+ */
17
+ export declare function createDefaultStorage(): SessionStoragePort;
package/dist/types.d.ts CHANGED
@@ -1,43 +1,5 @@
1
- import { AuthenticatorTransportFuture, CredentialDeviceType } from '@simplewebauthn/browser';
2
- export interface User {
3
- id: string;
4
- email: string;
5
- phone: string;
6
- roles?: string[];
7
- activeOrganizationId?: string | null;
8
- }
9
- export interface OrganizationMembership {
10
- id: string;
11
- organizationId: string;
12
- userId: string;
13
- roles: string[];
14
- scopes: string[];
15
- createdAt: string | Date;
16
- updatedAt: string | Date;
17
- user?: User;
18
- }
19
- export interface Organization {
20
- id: string;
21
- name: string;
22
- slug: string;
23
- createdByUserId: string | null;
24
- metadata: Record<string, unknown> | null;
25
- createdAt: string | Date;
26
- updatedAt: string | Date;
27
- membership?: OrganizationMembership;
28
- memberCount?: number;
29
- }
30
- export interface Credential {
31
- id: string;
32
- counter: number;
33
- transports?: AuthenticatorTransportFuture[];
34
- deviceType: CredentialDeviceType;
35
- backedup: boolean;
36
- backedUp?: boolean;
37
- prfCapable?: boolean;
38
- friendlyName: string | null;
39
- lastUsedAt: Date | null;
40
- platform: string | null;
41
- browser: string | null;
42
- deviceInfo: string | null;
43
- }
1
+ import type { CredentialResponse, MeUser, Organization as OrganizationShape, OrganizationMembership as OrganizationMembershipShape } from '@seamless-auth/types';
2
+ export type User = MeUser;
3
+ export type OrganizationMembership = OrganizationMembershipShape;
4
+ export type Organization = OrganizationShape;
5
+ export type Credential = CredentialResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamless-auth/react",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "A drop-in authentication solution for modern React applications.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -102,6 +102,7 @@
102
102
  "typescript-eslint": "^8.46.1"
103
103
  },
104
104
  "dependencies": {
105
+ "@seamless-auth/types": "^0.5.0",
105
106
  "@simplewebauthn/browser": "^13.1.0",
106
107
  "eslint-plugin-license-header": "^0.9.0",
107
108
  "libphonenumber-js": "^1.12.7",
@@ -1,4 +0,0 @@
1
- export declare function usePreviousSignIn(storageKey?: string): {
2
- hasSignedInBefore: boolean;
3
- markSignedIn: () => void;
4
- };