@seamless-auth/react 0.10.0 → 0.12.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,112 @@
1
1
  # @seamless-auth/react
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f59be34: Add a passkey while signed in, and say what a 401 at enrollment means.
8
+
9
+ `registerPasskey` is now on `useAuth()` and on the framework-agnostic session actions,
10
+ not only on the client. The bundled UI already told users they could "add a passkey later
11
+ from a device that does", and nothing in the package implemented that: `credentials` could
12
+ be listed and deleted but never added. The context version refreshes the session
13
+ afterwards, so a settings screen renders the new passkey without a reload.
14
+
15
+ Enrollment now requires a signed-in session, which is a coordinated change with
16
+ `seamless-auth-api` and the server adapters. Upgrade all three together: the auth API and
17
+ the adapter have no safe release order between them, and enrollment answers `401` until
18
+ both land. The signup flow already satisfies it, because
19
+ verifying the email OTP issues a session before the passkey screen is reached, so nothing
20
+ in the bundled views moves. An application that called `registerPasskey()` before
21
+ verifying an address has to move that call after it.
22
+
23
+ A 401 from enrollment now reads "Your session expired before the passkey was saved" rather
24
+ than the generic "Error registering passkey." It is the session rather than anything about
25
+ the authenticator, and the generic wording invited the user to retry with the same expired
26
+ one. `isUnauthenticated(error)` is exported for callers rendering their own screens.
27
+
28
+ Corrects a stale README example that still passed a `token` to `registerPasskey`, a field
29
+ removed when the wire contract moved to `@seamless-auth/types`.
30
+
31
+ ## 0.11.0
32
+
33
+ ### Minor Changes
34
+
35
+ - bd26c22: Read the `returnTo` an OAuth sign-in asked for, and land on it.
36
+
37
+ `startOAuthLogin` has taken a `returnTo` since OAuth landed here, and nothing ever read one
38
+ back. The auth server validated it against the configured origins and signed it into the
39
+ state, but `finishOAuthLogin` was typed as a bare `MessageResult`, so the whole callback body
40
+ was discarded and an adopter had no way to learn where the flow had been asked to end up.
41
+
42
+ `finishOAuthLogin` now resolves to `FinishOAuthLoginResult`, the completed OAuth response
43
+ minus its session material, for the same reason `LoginStartResult` drops it: sessions are
44
+ carried by cookies, so there is no reason to hand an adopter raw tokens. The new field on it
45
+ is `returnTo`, absent when the caller asked for nothing.
46
+
47
+ The bundled `OAuthCallback` view lands there instead of always going to `/`. This is the same
48
+ gap the magic link redirect closed in 0.10.0: the headless client could reach the feature and
49
+ an application using `AuthRoutes` could not, which is the audience least likely to be wiring
50
+ up its own client.
51
+
52
+ The view only follows a destination on its own origin. That is not the guard against an open
53
+ redirect, which the auth server already applied before signing the state; it is that these
54
+ views route with react-router, which cannot leave the application. An adopter that wants to
55
+ send someone to another origin reads `returnTo` off the result and navigates itself.
56
+
57
+ Requires `@seamless-auth/types` 0.20.0, which carries the response field and holds both
58
+ `returnTo` fields to a scheme that can be a link destination.
59
+
60
+ - 74f17d2: Let the bundled screens choose where a magic link lands.
61
+
62
+ `requestMagicLink(redirectUri)` arrived in 0.10.0, but only the headless client
63
+ path could reach it. An application using `AuthRoutes` had no way to set one, so
64
+ the deployment-wide destination was the only option for the audience least likely
65
+ to be wiring up its own client.
66
+
67
+ `AuthProvider` now takes `magicLinkRedirectUri`, and `useAuthClient()` hands it to
68
+ the client as the default for every send. `SeamlessAuthClientOptions` carries the
69
+ same field, so a directly constructed client can do this too.
70
+
71
+ The destination lives on the client rather than at each call site on purpose. The
72
+ sign-in screen and the resend on the "check your email" screen both send with no
73
+ argument, so they cannot disagree about where the link goes. A resend that landed
74
+ somewhere other than the link it repeats would be a confusing failure and an easy
75
+ one to miss in review.
76
+
77
+ Nothing changes if you omit it: the same empty body is sent and the deployment's
78
+ own destination still applies. An explicit `requestMagicLink(uri)` still wins over
79
+ the configured default.
80
+
81
+ - eb10397: Stop painting the disabled submit button as a filled grey primary.
82
+
83
+ On the sign-in and MFA screens the submit button was disabled until its field
84
+ validated, and while disabled it was filled with `--seamless-disabled` while the
85
+ label kept `--seamless-accent-contrast`. Those two colours were chosen in
86
+ different places, so no value a themed app could supply worked in both a light
87
+ and a dark theme: lighten the fill and the label washed out, darken it and the
88
+ label went near-black on dark. The result read as a primary button that had
89
+ broken rather than a control waiting on input.
90
+
91
+ The disabled state is now the enabled button at reduced opacity. Label and
92
+ background stay on the accent pair the app already tuned, so their contrast
93
+ cannot invert with the theme, and the control reads as inactive instead of
94
+ broken. This matches how the magic-link and passkey screens already draw their
95
+ disabled buttons.
96
+
97
+ `--seamless-disabled` is no longer read anywhere and has been dropped from the
98
+ token table. If you set it, remove it; every other token behaves as before.
99
+
100
+ The sign-in screen now also says why the button is refusing, in a live region
101
+ below it that reports whether the field is empty, incomplete, or ready. A
102
+ disabled button is not focusable and is passed over by screen readers, so the
103
+ refusal was previously silent for the people least able to guess the reason.
104
+
105
+ Fixing that surfaced a related bug: a valid email typed in registration left the
106
+ Login button enabled after switching to sign-in, even with the identifier field
107
+ empty, because the submit check fell through to the registration field. Each
108
+ mode now checks only its own field.
109
+
3
110
  ## 0.10.0
4
111
 
5
112
  ### Minor Changes
package/README.md CHANGED
@@ -178,6 +178,25 @@ async function completeLogin() {
178
178
 
179
179
  To disable this auto-detection entirely, pass `autoDetectPreviousSignin={false}` to `AuthProvider`.
180
180
 
181
+ ### Magic link destination
182
+
183
+ By default a magic link lands wherever the deployment is configured to send it. A deployment serving
184
+ more than one front end can override that per application with `magicLinkRedirectUri`:
185
+
186
+ ```tsx
187
+ <AuthProvider apiHost={apiHost} magicLinkRedirectUri="https://app.example.com/auth/magic">
188
+ <AuthRoutes />
189
+ </AuthProvider>
190
+ ```
191
+
192
+ Every magic link the bundled screens send uses it, including the resend on the "check your email"
193
+ screen, so a resent link always lands where the first one did. The deployment validates the value
194
+ against its configured origins and refuses anything else, which comes back as an ordinary error
195
+ result.
196
+
197
+ Custom UIs get the same default through `useAuthClient()`, and can still override a single send with
198
+ `requestMagicLink(uri)`.
199
+
181
200
  ### Scoped roles
182
201
 
183
202
  `hasRole(role)` remains an exact role check. Use `hasScopedRole(role)` for colon-separated scoped
@@ -593,7 +612,7 @@ on it:
593
612
  ```ts
594
613
  import { getPasskeyPolicyErrorCode } from '@seamless-auth/react';
595
614
 
596
- const { error } = await authClient.registerPasskey({ token, metadata });
615
+ const { error } = await authClient.registerPasskey({ metadata });
597
616
 
598
617
  switch (getPasskeyPolicyErrorCode(error)) {
599
618
  case 'attachment_not_allowed':
@@ -625,11 +644,11 @@ switch (getPasskeyPolicyErrorCode(error)) {
625
644
  `attachment_not_allowed` is refused before any ceremony runs, so the browser never prompts. The rest
626
645
  are refused after a credential exists and can be inspected.
627
646
 
628
- `syncedPasskeys` defaults to `block` on the Seamless Auth API. Passkeys created by iCloud Keychain
629
- and Google Password Manager are backup eligible, so on a default deployment the most common consumer
630
- passkey is refused at registration. If that is not what you want, set
631
- `authenticator_policy.syncedPasskeys` to `allow` in the API's system config; the SDK cannot relax it
632
- from the client.
647
+ `syncedPasskeys` defaults to `allow` on the Seamless Auth API, so a default deployment enrols the
648
+ passkeys iCloud Keychain and Google Password Manager create. A deployment that issues its own
649
+ authenticators can set `authenticator_policy.syncedPasskeys` to `block` in the API's system config,
650
+ and every backup-eligible passkey is then refused at registration. Handle the code: the SDK cannot
651
+ tell from the client which way the API is configured.
633
652
 
634
653
  Like `getOAuthErrorCode()`, this returns `undefined` for anything it does not recognize, including
635
654
  codes added by a newer API, so an unexpected refusal keeps your generic messaging.
@@ -741,6 +760,10 @@ function CustomRegistration() {
741
760
  }
742
761
  ```
743
762
 
763
+ Enrolment takes the signed-in session, so it comes after the step that establishes one.
764
+ Verifying the email OTP signs the user in, which is why the bundled flow offers a passkey
765
+ on the screen after it rather than before.
766
+
744
767
  To offer a passkey right after registering, call `registerPasskey()` before `refreshSession()`:
745
768
 
746
769
  ```ts
@@ -756,6 +779,40 @@ if (!error) {
756
779
  }
757
780
  ```
758
781
 
782
+ ### Adding a passkey from a settings screen
783
+
784
+ The same call adds a passkey to an account that already has one, or gives one to a user
785
+ who declined at signup. Use it from `useAuth()` rather than the client directly: that
786
+ version refreshes the session afterwards, so `credentials` includes the new passkey
787
+ without a reload.
788
+
789
+ ```tsx
790
+ function AddPasskey() {
791
+ const { registerPasskey, credentials } = useAuth();
792
+
793
+ const add = async () => {
794
+ const { error } = await registerPasskey({
795
+ friendlyName: 'My laptop',
796
+ platform: 'macOS',
797
+ browser: 'Chrome',
798
+ deviceInfo: navigator.userAgent,
799
+ });
800
+
801
+ if (error) {
802
+ // A 401 means the session expired rather than anything about the
803
+ // authenticator. `isUnauthenticated(error)` tells the two apart.
804
+ }
805
+ };
806
+
807
+ return (
808
+ <>
809
+ <p>{credentials.length} passkeys</p>
810
+ <button onClick={add}>Add a passkey</button>
811
+ </>
812
+ );
813
+ }
814
+ ```
815
+
759
816
  ### OTP and magic-link continuation
760
817
 
761
818
  > **The request helpers take no identifier.** `requestMagicLink()`, `requestLoginEmailOtp()`, and
@@ -971,7 +1028,6 @@ There is no provider prop or JavaScript API for this. Setting the variables is t
971
1028
  | `--seamless-border` | Input, button, and panel borders | `#4b5563`, `#d1d5db` |
972
1029
  | `--seamless-text` | Headings and body text | `white` |
973
1030
  | `--seamless-text-muted` | Labels, helper text, secondary copy | `#9ca3af`, `#d1d5db` |
974
- | `--seamless-disabled` | Background of disabled submit buttons | `#9ca3af` |
975
1031
  | `--seamless-danger` | Error messages | `#f87171` |
976
1032
  | `--seamless-success` | Success messages and the verified check icon | `#34d399` |
977
1033
  | `--seamless-warning` | OTP countdown and resend timers | `#facc15` |
@@ -990,6 +1046,10 @@ There is no provider prop or JavaScript API for this. Setting the variables is t
990
1046
  - Two decorative tints are deliberately not tokenised: the pulse ring behind the magic-link mail icon
991
1047
  and the disc behind the success check. Both are translucent and sit directly under an icon, so an
992
1048
  opaque override would hide the icon it is meant to frame.
1049
+ - Disabled buttons are not a separate colour. They are the enabled button at reduced opacity, so the
1050
+ label and its background always come from the same accent pair you set and the contrast between
1051
+ them cannot invert when the theme changes. `--seamless-disabled` used to set a standalone grey fill
1052
+ and no longer does anything; remove it from your overrides.
993
1053
  - The package ships one palette and no `prefers-color-scheme` rules. If you want the auth UI to follow
994
1054
  the system theme, wrap your own overrides in a media query.
995
1055
 
@@ -1049,8 +1109,8 @@ email sends to a signed-in user. Using `@seamless-auth/react` with an older adap
1049
1109
  `GET` forms returns a 404 for those requests. See the changelog for the minimum adapter version.
1050
1110
 
1051
1111
  `/webAuthn/register/finish` can refuse a verified credential on policy grounds with a `403` whose
1052
- body is a stable code. `syncedPasskeys` defaults to `block`, which refuses every backup-eligible
1053
- passkey, so this is reachable on a default deployment. See
1112
+ body is a stable code. `syncedPasskeys` defaults to `allow`, but a deployment that sets `block`
1113
+ refuses every backup-eligible passkey, so handle the code rather than assuming the default. See
1054
1114
  [Passkey policy refusals](#passkey-policy-refusals).
1055
1115
 
1056
1116
  ## Notes
@@ -1,4 +1,4 @@
1
- import { CurrentUserResult, FinishOAuthLoginInput, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from './client/createSeamlessAuthClient';
1
+ import { CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, PasskeyMetadata, PasskeyRegistrationData, RegisterPasskeyOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from './client/createSeamlessAuthClient';
2
2
  import type { SeamlessAuthResult } from './client/result';
3
3
  import { PasskeyPrfInput } from './client/webauthnPrf';
4
4
  import { Credential, Organization, User } from './types';
@@ -13,6 +13,7 @@ export interface AuthContextType {
13
13
  hasRole: (role: string) => boolean | undefined;
14
14
  hasScopedRole: (role: string | string[]) => boolean | undefined;
15
15
  apiHost: string;
16
+ magicLinkRedirectUri?: string;
16
17
  markSignedIn: () => void;
17
18
  hasSignedInBefore: boolean;
18
19
  credentials: Credential[];
@@ -21,12 +22,13 @@ export interface AuthContextType {
21
22
  switchOrganization: (organizationId: string) => Promise<SeamlessAuthResult<OrganizationSwitchResult>>;
22
23
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
23
24
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
24
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
25
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
25
26
  stepUpStatus: StepUpStatus | null;
26
27
  updateCredential: (credential: Credential) => Promise<SeamlessAuthResult<Credential>>;
27
28
  deleteCredential: (credentialId: string) => Promise<SeamlessAuthResult<MessageResult>>;
28
29
  login: (identifier: string, passkeyAvailable: boolean) => Promise<SeamlessAuthResult<LoginStartResult>>;
29
30
  handlePasskeyLogin: () => Promise<SeamlessAuthResult<PasskeyLoginData>>;
31
+ registerPasskey: (input: PasskeyMetadata | RegisterPasskeyOptions) => Promise<SeamlessAuthResult<PasskeyRegistrationData>>;
30
32
  refreshStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
31
33
  verifyStepUpWithPasskey: () => Promise<SeamlessAuthResult<StepUpStatus>>;
32
34
  verifyStepUpWithPasskeyPrf: (input: PasskeyPrfInput) => Promise<SeamlessAuthResult<StepUpPrfData>>;
@@ -42,6 +44,11 @@ interface AuthProviderProps {
42
44
  children: ReactNode;
43
45
  apiHost: string;
44
46
  autoDetectPreviousSignin?: boolean;
47
+ /**
48
+ * Where a magic link sent by the bundled screens should land. Both the first
49
+ * send and a resend read it from here, so the two cannot drift apart.
50
+ */
51
+ magicLinkRedirectUri?: string;
45
52
  }
46
53
  export declare const AuthProvider: React.FC<AuthProviderProps>;
47
54
  export {};
@@ -1,8 +1,14 @@
1
- import type { AddOrganizationMemberRequest, AuthenticatorAttachmentPolicy, 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';
1
+ import type { AddOrganizationMemberRequest, AuthenticatorAttachmentPolicy, CreateOrganizationRequest, CredentialUpdateResponse, LoginMethod as LoginMethodShape, LoginSuccessResponse, LogoutScope as LogoutScopeShape, MeResponse, MessageResponse, OAuthLoginSuccessResponse, 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 {
5
5
  apiHost: string;
6
+ /**
7
+ * Default destination for `requestMagicLink()`. Every send from this client
8
+ * uses it unless a call passes its own, which keeps a resend on the same
9
+ * destination as the send it repeats. Omit it to keep the deployment's.
10
+ */
11
+ magicLinkRedirectUri?: string;
6
12
  }
7
13
  export interface LoginInput {
8
14
  identifier: string;
@@ -56,6 +62,17 @@ export interface FinishOAuthLoginInput {
56
62
  code: string;
57
63
  state: string;
58
64
  }
65
+ /**
66
+ * The completed OAuth response minus its session material, for the same reason
67
+ * `LoginStartResult` drops it: sessions are carried by cookies.
68
+ *
69
+ * What this does surface is `returnTo`, the destination the caller asked for when it
70
+ * started the flow. It comes back out of the state the auth server signed, so it is
71
+ * the value that was validated against the configured origins at the start and not
72
+ * one introduced at the callback. Absent when the caller asked for nothing, so treat
73
+ * that as "use my own default" rather than as a failure.
74
+ */
75
+ export type FinishOAuthLoginResult = Omit<OAuthLoginSuccessResponse, 'token' | 'refreshToken' | 'sub'>;
59
76
  /** Response body for endpoints that only acknowledge the request. */
60
77
  export type MessageResult = MessageResponse;
61
78
  /** Payload returned by a completed passkey login. */
@@ -134,8 +151,8 @@ export interface SeamlessAuthClient {
134
151
  /**
135
152
  * @param redirectUri Where the emailed link should land. The deployment validates
136
153
  * it against its configured origins and refuses anything else, so a tenant serving
137
- * a web app and a mobile app can send each to its own destination. Omit it to keep
138
- * the deployment's single destination.
154
+ * a web app and a mobile app can send each to its own destination. Omit it to fall
155
+ * back to the client's `magicLinkRedirectUri`, then to the deployment's own.
139
156
  */
140
157
  requestMagicLink: (redirectUri?: string) => Promise<SeamlessAuthResult<MessageResult>>;
141
158
  checkMagicLink: () => Promise<SeamlessAuthResult<MessageResult>>;
@@ -143,7 +160,7 @@ export interface SeamlessAuthClient {
143
160
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
144
161
  getPublicSystemConfig: () => Promise<SeamlessAuthResult<PublicSystemConfigResult>>;
145
162
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
146
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
163
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
147
164
  registerPasskey: (input: PasskeyMetadata | RegisterPasskeyOptions) => Promise<SeamlessAuthResult<PasskeyRegistrationData>>;
148
165
  isPasskeyPrfSupported: () => Promise<boolean>;
149
166
  getStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
@@ -37,7 +37,7 @@ export declare function getOAuthErrorCode(error: unknown): OAuthErrorCode | unde
37
37
  * ceremony runs. The rest come from register/finish with a `403`, once the
38
38
  * credential exists and can be inspected.
39
39
  */
40
- export type PasskeyPolicyErrorCode = Extract<WebAuthnErrorCodeShape, 'attachment_not_allowed' | 'synced_passkey_not_allowed' | 'authenticator_not_allowed' | 'prf_required'>;
40
+ export type PasskeyPolicyErrorCode = Exclude<WebAuthnErrorCodeShape, 'prf_output_not_allowed'>;
41
41
  /**
42
42
  * Read the passkey policy refusal off a registration error, from either stage of
43
43
  * the ceremony. Returns `undefined` for anything unrecognized, including codes
@@ -51,6 +51,16 @@ export type PasskeyPolicyErrorCode = Extract<WebAuthnErrorCodeShape, 'attachment
51
51
  * ending the lookup.
52
52
  */
53
53
  export declare function getPasskeyPolicyErrorCode(error: unknown): PasskeyPolicyErrorCode | undefined;
54
+ /**
55
+ * Whether a failure means nobody is signed in.
56
+ *
57
+ * Enrollment takes the signed-in session, so a `401` there is an expired or missing
58
+ * one rather than anything about the authenticator, and the two need different
59
+ * messages: one asks the user to sign in again, the other to reach for a different
60
+ * key. Raised locally, a ceremony failure carries `NETWORK_ERROR_STATUS`, so this
61
+ * matches on the response status alone.
62
+ */
63
+ export declare function isUnauthenticated(error: unknown): boolean;
54
64
  /**
55
65
  * Detail recovered from a failed WebAuthn ceremony.
56
66
  *
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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, PublicSystemConfigResult, OrganizationMemberInput, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from './client/createSeamlessAuthClient';
4
- import { getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, OAuthErrorCode, PasskeyPolicyErrorCode, SeamlessAuthError, WebAuthnErrorDetail } from './client/errors';
3
+ import { createSeamlessAuthClient, CredentialUpdateResult, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthProvider, OAuthProvidersResult, PublicSystemConfigResult, OrganizationMemberInput, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from './client/createSeamlessAuthClient';
4
+ import { getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, isUnauthenticated, OAuthErrorCode, PasskeyPolicyErrorCode, 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';
@@ -9,5 +9,5 @@ import { hasNonPasskeyLoginMethod, useLoginMethods } from './hooks/useLoginMetho
9
9
  import { usePasskeySupport } from './hooks/usePasskeySupport';
10
10
  import { hasScopedRole, roleGrantsAccess } from './scopedRoles';
11
11
  import { Credential, Organization, OrganizationMembership, User } from './types';
12
- export { AuthProvider, AuthRoutes, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getPasskeyPolicyErrorCode, 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, PasskeyAttachment, PasskeyMetadata, PasskeyPolicyErrorCode, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, PublicSystemConfigResult, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput, User, WebAuthnErrorDetail, };
12
+ export { AuthProvider, AuthRoutes, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, isUnauthenticated, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, useLoginMethods, usePasskeySupport, };
13
+ export type { CredentialUpdateResult, AuthContextType, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthErrorCode, OAuthProvider, OAuthProvidersResult, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyPolicyErrorCode, 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 r}from"react/jsx-runtime";import{browserSupportsWebAuthn as o,bufferToBase64URLString as n,base64URLStringToBuffer as a,startAuthentication as i,startRegistration as s,WebAuthnError as l}from"@simplewebauthn/browser";import{createContext as c,useMemo as d,useSyncExternalStore as u,useEffect as m,useContext as _,useState as g,useRef as f,useCallback as p}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,r,o){super(e),this.name="SeamlessAuthError",this.status=t,this.body=r,this.cause=o}}const O={oauth_missing_email:!0,oauth_email_not_verified:!0,oauth_missing_subject:!0};function N(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=N(e.body)??N(e.body.details);return"string"==typeof t&&Object.prototype.hasOwnProperty.call(O,t)?t:void 0}const C={attachment_not_allowed:!0,synced_passkey_not_allowed:!0,authenticator_not_allowed:!0,prf_required:!0};function I(e){if("object"!=typeof e||null===e)return;const t=e.error;return"string"==typeof t&&Object.prototype.hasOwnProperty.call(C,t)?t:void 0}function A(e){if(e instanceof S&&"object"==typeof e.body&&null!==e.body)return I(e.body)??I(e.body.details)}function M(e){if(!(e instanceof S)||("object"!=typeof(t=e.cause)||null===t||"string"!=typeof t.name))return;var t;const{name:r,code:o,message:n}=e.cause;return{name:r,code:"string"==typeof o?o:void 0,message:"string"==typeof n?n:""}}async function E(e,t){let r;try{r=await e.json()}catch{r=void 0}return new S(function(e){if("object"!=typeof e||null===e)return;const{error:t,message:r}=e;return"string"==typeof t&&t?t:"string"==typeof r&&r?r:void 0}(r)??t,e.status,r)}async function F(e){try{return await e.json()}catch{return}}async function z(e,t){let r;try{r=await e}catch{return{data:null,error:new S(t,0)}}return r.ok?{data:await F(r),error:null}:{data:null,error:await E(r,t)}}function U(e){return{data:e,error:null}}function L(e,t=0,r,o){return{data:null,error:new S(e,t,r,o)}}function q(e){if(e instanceof ArrayBuffer)return e;const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.byteLength);return r.set(t),r.buffer}function B(e){return"string"==typeof e?e:n(q(e))}function R(e){return"string"==typeof e?a(e):e}function j(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:B(e.salt),...e.secondSalt?{secondSalt:B(e.secondSalt)}:{}}}}async function J(){return!!o()&&("undefined"==typeof window||!1!==window.isSecureContext)&&void 0!==globalThis.PublicKeyCredential&&"undefined"!=typeof navigator&&"function"==typeof navigator.credentials?.get}function G(e){const t=e,r=t.extensions?.prf?.eval;return r?{...t,extensions:{...t.extensions,prf:{...t.extensions?.prf,eval:{...r,...r.first?{first:R(r.first)}:{},...r.second?{second:R(r.second)}:{}}}}}:e}function W(e){const t=e.clientExtensionResults,r=t?.prf?.results?.first;if(!r)return null;const o=(a=r)instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength);var a;return{credentialId:e.id,output:o,outputBase64url:n(q(o))}}function D(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function $(e,t){const r=e.method===t?e.method:null;return"Success"===e.message&&!0===e.fresh&&null!==r?U({fresh:!0,method:r,verifiedAt:e.verifiedAt??null,expiresAt:e.expiresAt??null,maxAgeSeconds:e.maxAgeSeconds??0}):L(e.message??"Step-up authentication failed.")}function V(e){return e?{method:"POST",body:JSON.stringify(j(e))}:{method:"POST"}}function K(e,t,r){const o=L(t,0,void 0,r),n=M(o.error);return console.error(e,n?.name??"Unknown error."),o}const H=e=>{const t=(e=>{const{authHost:t}=e;return async function(e,r){const o=`${t?.replace(/\/+$/,"")??""}/auth${e.startsWith("/")?e:`/${e}`}`,n=null!=r?.body,a={...r,credentials:"include",headers:{...n?{"Content-Type":"application/json"}:{},...r?.headers}};return fetch(o,a)}})({authHost:e.apiHost});return{getCurrentUser:()=>z(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>z(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const r=await z(t("/webAuthn/login/start",{...V(e?.prf)}),"Failed to start passkey login.");if(r.error)return r;let o,n;try{const e=await i({optionsJSON:G(r.data)});o=W(e),n=D(e)}catch(e){return K("Passkey login error.","Passkey login failed.",e)}const a=await z(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:n})}),"Failed to verify passkey.");return a.error?a:"Success"!==a.data?.message?L(a.data?.message??"Passkey login failed."):U(o?{prf:o}:{})},logout:(e={})=>z(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>z(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>z(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>z(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>z(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>z(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>z(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>z(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>z(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>z(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>z(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>z(t("/otp/verify-login-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestMagicLink:e=>z(t("/magic-link",{method:"POST",body:JSON.stringify(e?{redirectUri:e}:{})}),"Failed to send the magic link."),checkMagicLink:()=>z(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>z(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>z(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),getPublicSystemConfig:()=>z(t("/system-config/public",{method:"GET"}),"Failed to read the public system configuration."),startOAuthLogin:e=>z(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=>z(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 r=function(e){return"metadata"in e?e:{metadata:e}}(e),o=await z(t(function(e){const t=new URLSearchParams;e.requirePrf?t.set("requirePrf","true"):e.requestPrf&&t.set("requestPrf","true"),e.attachment&&t.set("attachment",e.attachment);const r=t.toString();return"/webAuthn/register/start"+(r?`?${r}`:"")}(r),{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?L(e.name,0,void 0,e):K("Passkey registration error.","Passkey registration failed.",e)}const a=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(n),i=await z(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:n,metadata:{...r.metadata,prfCapable:a}})}),"Verification failed.");return i.error?i:U({credentialId:n.id,prfCapable:a})},isPasskeyPrfSupported:J,getStepUpStatus:()=>z(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await z(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let r;try{r=D(await i({optionsJSON:G(e.data)}))}catch(e){return K("Step-up authentication error.","Step-up authentication failed.",e)}const o=await z(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify step-up authentication.");return o.error?o:$(o.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const r=await z(t("/step-up/webauthn/start",{...V(e)}),"Failed to start step-up authentication.");if(r.error)return r;let o,n;try{const e=await i({optionsJSON:G(r.data)});o=W(e),n=D(e)}catch(e){return K("Step-up authentication error.","Step-up authentication failed.",e)}if(!o)return L("Passkey did not return PRF output.");const a=await z(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:n})}),"Failed to verify step-up authentication.");if(a.error)return a;const s=$(a.data??{},"webauthn");return s.error?s:U({...s.data,credentialId:o.credentialId,prf:o})},getTotpStatus:()=>z(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>z(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>z(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>z(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const r=await z(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return r.error?r:$(r.data??{},"totp")},updateCredential:e=>z(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>z(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>z(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>z(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>z(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,r)=>z(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(r)}),"Failed to update organization."),switchOrganization:e=>z(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>z(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,r)=>z(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(r)}),"Failed to add organization member."),updateOrganizationMember:(e,r,o)=>z(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify(o)}),"Failed to update organization member."),removeOrganizationMember:(e,r)=>z(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function Y(e,t){const r=e.trim(),o=t.trim();if(!r||!o)return!1;if(r===o)return!0;if(r.endsWith(":*")){const e=r.slice(0,-2);return o===e||o.startsWith(`${e}:`)}if(!o.includes(":"))return!1;if(!r.includes(":"))return o.startsWith(`${r}:`);const n=r.split(":"),a=o.split(":"),i=n[n.length-1],s=a[a.length-1],l=n.slice(0,-1),c=a.slice(0,-1);return"write"===i&&"read"===s&&l.length===c.length&&l.every((e,t)=>e===c[t])}function Z(e,t){if(!Array.isArray(e))return!1;const r=e.filter(e=>"string"==typeof e);return(Array.isArray(t)?t:[t]).some(e=>r.some(t=>Y(t,e)))}function Q(){return"undefined"==typeof localStorage?function(){const e=new Map;return{get:t=>e.get(t)??null,set:(t,r)=>{e.set(t,r)}}}():{get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}}}const X="seamlessauth_seen",ee={user:null,credentials:[],organizations:[],activeOrganization:null,stepUpStatus:null,isAuthenticated:!1};const te=c(void 0),re=()=>{const e=_(te);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},oe=({children:t,apiHost:r,autoDetectPreviousSignin:o=!0})=>{const n=d(()=>function(e){const{apiHost:t,detectPreviousSignIn:r=!0}=e,o=H({apiHost:t}),n=e.storage??Q(),a=new Set;let i=!1,s=0,l={...ee,loading:!0,hasSignedInBefore:r&&"true"===n.get(X)};function c(e){const t={...l,...e};Object.keys(e).some(e=>l[e]!==t[e])&&(l=t,a.forEach(e=>e()))}function d(){n.set(X,"true"),r&&c({hasSignedInBefore:!0})}function u(){c(ee)}async function m(){const e=++s;c({loading:!0});const t=await o.getCurrentUser();return i||e!==s?t:t.error?(u(),c({loading:!1}),t):(c({user:t.data.user,credentials:t.data.credentials??[],organizations:t.data.organizations??[],activeOrganization:t.data.activeOrganization??null,isAuthenticated:!0,loading:!1}),l.hasSignedInBefore||d(),t)}async function _(e){const t=await e();return t.error||await m(),t}return{getState:()=>l,subscribe:e=>(a.add(e),()=>{a.delete(e)}),actions:{login:(e,t)=>o.login({identifier:e,passkeyAvailable:t}),handlePasskeyLogin:()=>_(()=>o.loginWithPasskey()),refreshSession:m,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:r}=await o.updateCredential({friendlyName:e.friendlyName??null,id:e.id});if(r)return{data:null,error:r};const n=t.credential;return c({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||c({credentials:l.credentials.filter(t=>t.id!==e)}),t},switchOrganization:e=>_(()=>o.switchOrganization(e)),listOAuthProviders:()=>o.listOAuthProviders(),startOAuthLogin:e=>o.startOAuthLogin(e),finishOAuthLogin:e=>_(()=>o.finishOAuthLogin(e)),refreshStepUpStatus:async()=>{const e=await o.getStepUpStatus();return c({stepUpStatus:e.error?null:e.data}),e},verifyStepUpWithPasskey:async()=>{const e=await o.verifyStepUpWithPasskey();return e.error||c({stepUpStatus:e.data}),e},verifyStepUpWithPasskeyPrf:async e=>{const t=await o.verifyStepUpWithPasskeyPrf(e);return t.error||c({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||c({stepUpStatus:t.data}),t},hasRole:e=>l.user?.roles?.includes(e),hasScopedRole:e=>l.user?Z(l.user.roles,e):void 0,markSignedIn:d},destroy:()=>{i=!0,a.clear()}}}({apiHost:r,detectPreviousSignIn:o}),[r,o]),a=u(n.subscribe,n.getState,n.getState);m(()=>{n.actions.refreshSession()},[n]);const i=d(()=>({...a,...n.actions,apiHost:r}),[a,n,r]);return e(te.Provider,{value:i,children:t})},ne=()=>{const{apiHost:e}=re();return d(()=>H({apiHost:e}),[e])},ae=["passkey","magic_link"],ie=()=>{const e=ne(),[t,r]=g(null),[o,n]=g(!0);return m(()=>{let t=!0;return(async()=>{try{const{data:o,error:n}=await e.getPublicSystemConfig();t&&!n&&o?.loginMethods?.length&&r(o.loginMethods)}catch{}finally{t&&n(!1)}})(),()=>{t=!1}},[e]),{loginMethods:t,loading:o}},se=e=>Boolean(e?.some(e=>"passkey"!==e)),le=e=>{if("string"!=typeof e)return!1;const t=e.trim();if(t.length<3||t.length>320)return!1;const r=t.split("@");if(2!==r.length)return!1;const[o,n]=r;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(".."))},ce=e=>{const t=P(e);return t?.isValid()||!1};async function de(){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 ue=()=>{const[e,t]=g(!1),[r,o]=g(!0);return m(()=>{let e=!0;return(async()=>{try{const r=await de();e&&t(r)}catch{e&&t(!1)}finally{e&&o(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:r}},me="/login",_e="/passkey-login",ge="/verify-phone-otp",fe="/verify-email-otp",pe="/verify-magiclink",he="/oauth/callback",ye="/register-passkey",be="/magic-link-sent";function ve(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var ke="login-module__container___YggDx",we="login-module__card___Ub-Py",xe="login-module__heading___neEqb",Pe="login-module__inputGroup___P6qgS",Se="login-module__label___mx5vu",Oe="login-module__input___U07lW",Ne="login-module__helperText___kDQ4-",Te="login-module__error___40zxh",Ce="login-module__button___0kFBs",Ie="login-module__toggle___1JiG1",Ae="login-module__fallbackCard___HdIk-",Me="login-module__fallbackHeader___-il2v",Ee="login-module__fallbackDescription___ea5EB",Fe="login-module__fallbackActions___AD3ni",ze="login-module__fallbackActionButton___lFgWf",Ue="login-module__actionTitle___ycrMp",Le="login-module__actionSubtext___opaIV",qe="login-module__linkButton___5lsoe";ve(".login-module__container___YggDx{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 4px 6px var(--seamless-shadow,rgba(0,0,0,.1));max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:var(--seamless-success,#68d391);text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:var(--seamless-text-muted,#d1d5db);display:block}.login-module__input___U07lW{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6);outline:none}.login-module__helperText___kDQ4-{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:var(--seamless-danger,#f87171);font-size:.875rem}.login-module__button___0kFBs{background-color:var(--seamless-accent,#2563eb);border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}.login-module__button___0kFBs:disabled{background-color:var(--seamless-disabled,#9ca3af);cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:var(--seamless-accent-soft,#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:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#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:var(--seamless-surface-raised,hsla(0,0%,100%,.04));border:1px solid var(--seamless-border,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:var(--seamless-text,#f3f4f6);font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:var(--seamless-surface,rgba(0,0,0,.25));border:1px solid var(--seamless-border,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:var(--seamless-surface-hover,hsla(0,0%,100%,.06));border-color:var(--seamless-border,hsla(0,0%,100%,.15))}.login-module__actionTitle___ycrMp{color:var(--seamless-text,#f9fafb);font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const Be=({identifier:r,onMagicLink:o,onEmailOtp:n,onPhoneOtp:a,onPasskeyRetry:i,loginMethods:s})=>{const l=new Set(s??["passkey","magic_link","phone_otp"]),c=l.has("magic_link")&&le(r),d=l.has("email_otp")&&Boolean(n)&&le(r),u=l.has("phone_otp")&&ce(r),m=l.has("passkey")&&Boolean(i);return c||d||u||m?t("div",{className:Ae,children:[e("div",{className:Me,children:"Choose a sign-in method"}),e("p",{className:Ee,children:"Choose another secure sign-in method."}),t("div",{className:Fe,children:[c&&t("button",{type:"button",className:ze,onClick:o,children:[e("span",{className:Ue,children:"Email Magic Link"}),e("span",{className:Le,children:"Send a secure sign-in link to your email"})]}),d&&t("button",{type:"button",className:ze,onClick:n,children:[e("span",{className:Ue,children:"Email Code"}),e("span",{className:Le,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:ze,onClick:a,children:[e("span",{className:Ue,children:"Text Message Code"}),e("span",{className:Le,children:"Receive a one-time code via SMS"})]})]}),m&&e("button",{type:"button",className:qe,onClick:i,children:"Try passkey anyway"})]}):null},Re="seamless:oauth:provider",je=()=>{const{listOAuthProviders:r,startOAuthLogin:o}=re(),n=h("/oauth/callback"),[a,i]=g([]),[s,l]=g("");if(m(()=>{let e=!0;return r().then(({data:t})=>{e&&i(t?.providers??[])}),()=>{e=!1}},[r]),0===a.length)return null;return t("div",{className:Fe,children:[a.map(r=>e("button",{type:"button",className:ze,onClick:()=>(async e=>{l(""),sessionStorage.setItem(Re,e);const{data:t,error:r}=await o({providerId:e,redirectUri:new URL(n,window.location.origin).toString()});r?l("Could not start sign-in with this provider."):window.location.assign(t.authorizationUrl)})(r.id),children:t("span",{className:Ue,children:["Continue with ",r.name]})},r.id)),s&&e("p",{className:Te,children:s})]})},Je=()=>{const o=y(),{hasSignedInBefore:n,login:a,handlePasskeyLogin:i}=re(),s=ne(),{passkeySupported:l}=ue(),{loginMethods:c}=ie(),[d,u]=g(""),[_,f]=g(""),[p,h]=g("register"),[b,v]=g(""),[k,w]=g(""),[x,P]=g(""),[S,O]=g(!1),[N,T]=g(null);m(()=>{n&&h("login")},[n]);return e("div",{className:ke,children:t("div",{className:we,children:[e("h2",{className:xe,children:"login"===p?"Sign In":"Create Account"}),t(r,{children:[t("form",{onSubmit:async e=>{e.preventDefault(),v(""),O(!1);try{if("login"===p){const{data:e,error:t}=await a(d,l);if(t)return void v("Failed to start sign-in. Please try again.");const r=e?.loginMethods?.length?e.loginMethods:c??ae;if(T(r),l&&r.includes("passkey")){const{error:e}=await i();return e?(O(!0),void v("Passkey sign-in could not be completed. Choose another sign-in method.")):void o("/")}return void O(!0)}"register"===p&&await(async()=>{v("");const{data:e,error:t}=await s.register({email:_});t?v("Failed to register. Please try again."):"Success"===e.message?o(fe):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"===p&&t("div",{className:Pe,children:[e("label",{htmlFor:"identifier",className:Se,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:d,onChange:e=>{const t=e.target.value;u(t)},autoComplete:"off",placeholder:"Email or Phone Number",className:Oe,onBlur:()=>{if(d){const e=le(d)||ce(d);P(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:Ne,children:"Phone numbers must include a country code e.g. +1"}),S&&e(Be,{identifier:d,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?v("Failed to send magic link."):o(be,{state:{identifier:d}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?v("Failed to send email code."):o(fe,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?v("Failed to send OTP."):o(ge,{state:{flow:"login"}})},onPasskeyRetry:l?i:void 0,loginMethods:N}),x&&e("p",{className:Te,children:x})]}),"register"===p&&t("div",{className:Pe,children:[e("label",{htmlFor:"email",className:Se,children:"Email Address"}),e("input",{id:"email",type:"email",value:_,onChange:e=>{const t=e.target.value;f(t)},autoComplete:"off",className:Oe,onBlur:()=>{if(_){const e=le(_);w(e?"":"Please enter a valid email")}},required:!0}),k&&e("p",{className:Te,children:k})]}),e("button",{type:"submit",className:Ce,disabled:!("login"===p&&d?le(d)||ce(d):le(_)),children:"login"===p?"Login":"Register"}),b&&e("p",{className:Te,children:b}),e("button",{type:"button",onClick:()=>h("login"===p?"register":"login"),className:Ie,children:"login"===p?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(je,{})]})]})})};var Ge={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};ve(".passKeyLogin-module__container___IUKxF{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,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:var(--seamless-text,#fff);font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:var(--seamless-accent,#2563eb);border:1px solid var(--seamless-accent,#3b82f6);border-radius:.5rem;color:var(--seamless-accent-contrast,#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:var(--seamless-accent-hover,#1d4ed8)}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const We=()=>{const r=y(),{handlePasskeyLogin:o}=re(),[n,a]=g("");return e("div",{className:Ge.container,children:t("div",{className:Ge.card,children:[e("h2",{className:Ge.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{a("");const{error:e}=await o();e?a("Passkey sign-in could not be completed. Try another sign-in method."):r("/")},className:Ge.button,children:"Use Passkey"}),n&&e("p",{className:Ge.error,children:n})]})})};var De="registerPasskey-module__container___jqEh8",$e="registerPasskey-module__card___MJAyC",Ve="registerPasskey-module__loading___Q4i1x",Ke="registerPasskey-module__spinner___V1nhd",He="registerPasskey-module__supported___ihTih",Ye="registerPasskey-module__title___vn2Qu",Ze="registerPasskey-module__description___AWmO-",Qe="registerPasskey-module__button___D3b4B",Xe="registerPasskey-module__message___RiOw-",et="registerPasskey-module__success___HP5aX",tt="registerPasskey-module__error___hGiqE",rt="registerPasskey-module__skip___1hDyU",ot="registerPasskey-module__secondary___bnOB4";ve(".registerPasskey-module__container___jqEh8{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:var(--seamless-surface,#f9fafb);border-radius:.75rem;box-shadow:0 2px 8px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#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-bottom:2px solid var(--seamless-accent,#3b82f6);border-left:2px solid transparent;border-radius:9999px;border-right:2px solid transparent;border-top:2px solid var(--seamless-accent,#3b82f6);height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:var(--seamless-surface,#ecfdf5);border-radius:.75rem;box-shadow:0 2px 12px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#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:var(--seamless-accent,#059669);border:none;border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:var(--seamless-accent-hover,#047857)}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:var(--seamless-success,#6ee7b7)}.registerPasskey-module__error___hGiqE{color:var(--seamless-danger,#f87171)}.registerPasskey-module__skip___1hDyU{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.registerPasskey-module__skip___1hDyU:disabled{cursor:default;opacity:.6}.registerPasskey-module__secondary___bnOB4{background:none;border:1px solid var(--seamless-accent,#059669);border-radius:.5rem;color:var(--seamless-accent,#059669);cursor:pointer;font-weight:500;margin-top:.75rem;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__secondary___bnOB4:hover:not(:disabled){background-color:var(--seamless-accent-muted,rgba(5,150,105,.1))}.registerPasskey-module__secondary___bnOB4:disabled{cursor:default;opacity:.6}");const nt={attachment_not_allowed:"This application does not accept that kind of authenticator. Try the other option.",synced_passkey_not_allowed:"This passkey syncs to a password manager, and this application requires one that stays on a single device, such as a security key.",authenticator_not_allowed:"This application does not accept this authenticator.",prf_required:"This authenticator does not support a feature this application requires."};const at=()=>{const{refreshSession:r}=re(),o=ne(),{passkeySupported:n,loading:a}=ue(),{loginMethods:i,loading:s}=ie(),l=y(),[c,d]=g("idle"),[u,m]=g(""),_=se(i),f=async()=>{await r(),l("/")},p=async e=>{const{platform:t,browser:n,deviceInfo:a}=function(){const e=navigator.userAgent.toLowerCase();let t="unknown",r="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?r="brave":/edg\/|edgios/.test(e)?r="edge":/opr\/|opt\/|opera/.test(e)?r="opera":/vivaldi/.test(e)?r="vivaldi":/samsungbrowser/.test(e)?r="samsung":/firefox|fxios/.test(e)?r="firefox":/chrome|crios/.test(e)?r="chrome":/safari/.test(e)&&(r="safari"),{platform:t,browser:r,deviceInfo:`${t} • ${r}`}}(),i={friendlyName:a,platform:t,browser:n,deviceInfo:a};d("loading");try{const{error:t}=await o.registerPasskey({metadata:i,attachment:e});if(t)throw t;await r(),d("success"),m("Passkey registered successfully."),l("/")}catch(e){console.error("Passkey registration failed."),d("error"),m(function(e){const t=A(e);return t?nt[t]:void 0}(e)??"Error registering passkey.")}};return e("div",{className:De,children:e("div",{className:$e,children:t("div",a||s?{className:Ve,children:[e("div",{className:Ke}),e("span",{children:"Checking for Passkey Support..."})]}:n?{className:He,children:[e("h2",{className:Ye,children:"Secure Your Account with a Passkey"}),e("p",{className:Ze,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>p(),disabled:"loading"===c,className:Qe,children:"loading"===c?"Registering...":"Register Passkey"}),e("button",{type:"button",onClick:()=>p("cross-platform"),disabled:"loading"===c,className:ot,children:"Use a security key instead"}),u&&e("p",{className:`${Xe} ${"success"===c?et:tt}`,children:u}),_&&e("button",{type:"button",onClick:f,disabled:"loading"===c,className:rt,children:"Skip for now"})]}:{className:He,children:[e("h2",{className:Ye,children:"Passkeys are not available here"}),e("p",{className:Ze,children:_?"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."}),_&&e("button",{type:"button",onClick:f,className:Qe,children:"Continue"})]})})})};var it="verifyOTP-module__container___wgoDE",st="verifyOTP-module__card___3cs2p",lt="verifyOTP-module__title___fZ-1d",ct="verifyOTP-module__subtitle___dGSu3",dt="verifyOTP-module__error___GEtlG",ut="verifyOTP-module__success___46TjG",mt="verifyOTP-module__form___jiGG-",_t="verifyOTP-module__label___Zq5Mi",gt="verifyOTP-module__timer___smq-a",ft="verifyOTP-module__resend___PlmkG",pt="verifyOTP-module__button___8pIuO",ht="verifyOTP-module__toggle___wbzVa";ve(".verifyOTP-module__container___wgoDE{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:var(--seamless-text-muted,#9ca3af);font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:var(--seamless-danger,#f87171);margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:var(--seamless-success,#34d399);margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:var(--seamless-text-muted,#d1d5db);display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:var(--seamless-warning,#facc15);font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:.375rem;color:var(--seamless-text,#fff);outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6)}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:var(--seamless-accent,#3b82f6)}.verifyOTP-module__button___8pIuO{background-color:var(--seamless-accent,#2563eb);border:none;border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var yt="otpInput-module__otpContainer___MUjby",bt="otpInput-module__otpInput___3YMVm";ve(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:8px;color:var(--seamless-text,#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:var(--seamless-accent,#60a5fa);box-shadow:0 0 0 2px var(--seamless-accent,rgba(96,165,250,.25));outline:none}");const vt=({length:t=6,value:r,inputMode:o="numeric",onChange:n,name:a="otp"})=>{const i=f([]),s=r.split("").concat(Array(t).fill("")).slice(0,t),l=(e,t)=>{var r;if(t.length>1)c(e,t);else if(!t||(r=t,"numeric"===o?/^\d$/.test(r):/^[a-zA-Z]$/.test(r))){const r=[...s];r[e]=t;const o=r.join("");n(o),t&&i.current[e+1]&&i.current[e+1]?.focus()}},c=(e,r)=>{let a=r;a="numeric"===o?r.replace(/\D/g,""):r.replace(/[^a-zA-Z]/g,"");const l=a.slice(0,t).split(""),c=[...s];l.forEach((r,o)=>{e+o<t&&(c[e+o]=r)}),n(c.join("")),i.current[Math.min(e+l.length,t-1)]?.focus()};return e("div",{className:yt,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),c(0,e.clipboardData.getData("text"))},children:s.map((r,c)=>e("input",{ref:e=>i.current[c]=e,type:"text",inputMode:"numeric"===o?"numeric":"text",autoComplete:"one-time-code",name:`${a}-${c}`,maxLength:1,value:r,className:bt,onChange:e=>l(c,e.target.value),onKeyDown:e=>((e,r)=>{if("Backspace"===r.key){r.preventDefault();const t=[...s];s[e]?(t[e]="",n(t.join(""))):e>0&&(t[e-1]="",n(t.join("")),i.current[e-1]?.focus())}"ArrowLeft"===r.key&&e>0&&i.current[e-1]?.focus(),"ArrowRight"===r.key&&e<t-1&&i.current[e+1]?.focus()})(c,e),"aria-label":`Digit ${c+1}`},c))})},kt=()=>{const r=y(),o=b(),{refreshSession:n}=re(),a="login"===o.state?.flow,[i,s]=g(""),[l,c]=g(null),[d,u]=g(""),[_,f]=g(!1),[p,h]=g(""),[v,k]=g(300),w=ne(),x=async()=>{if(f(!0),!l){const{error:e}=a?await w.verifyLoginPhoneOtp(i):await w.verifyPhoneOtp(i);if(e)u("Verification failed.");else{if(a)return await n(),void r("/");c(!0)}}f(!1)},P=async()=>{h(""),await(async()=>{u("");const{error:e}=a?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 m(()=>{const e=setInterval(()=>{k(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),m(()=>{l&&!a&&(async()=>{const{error:e}=await w.requestEmailOtp();e?u("Failed to send Email code. If this persists, refresh the page and try registering again."):r(fe)})()},[l,a,r,w]),e("div",{className:it,children:t("div",{className:st,children:[e("h2",{className:lt,children:"Verify Your Phone Number"}),e("p",{className:ct,children:"Enter the code sent to your phone number."}),d&&e("p",{className:dt,children:d}),p&&e("p",{className:ut,children:p}),t("form",{onSubmit:async e=>{if(e.preventDefault(),u(""),6===i.length){f(!0);try{await x()}catch{u("Unexpected error occurred.")}finally{f(!1)}}else u("Please enter a valid code.")},className:mt,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:_t,children:["Phone Verification Code ",(O=l,!0===O?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===O?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",t("span",{className:gt,children:["Code expires in: ",(S=v,`${Math.floor(S/60).toString().padStart(2,"0")}:${(S%60).toString().padStart(2,"0")}`)]})]}),e(vt,{length:6,value:i,onChange:s}),e("button",{type:"button",onClick:()=>P(),className:ft,children:"Resend code to phone"})]}),e("button",{type:"submit",className:pt,children:_?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:ht,children:"Back to login"})]})]})});var S,O},wt=()=>{const r=y(),o=b(),{refreshSession:n}=re(),a=ne(),{passkeySupported:i}=ue(),s="login"===o.state?.flow,[l,c]=g(!1),[d,u]=g(""),[_,f]=g(300),[p,h]=g(""),[v,k]=g("");return m(()=>{const e=setInterval(()=>{f(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:it,children:t("div",{className:st,children:[e("h2",{className:lt,children:"Verify Your Email"}),e("p",{className:ct,children:"We sent you a verification email. Enter the code below."}),p&&e("p",{className:dt,children:p}),v&&e("p",{className:ut,children:v}),t("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===d.length){c(!0);try{const{error:e}=s?await a.verifyLoginEmailOtp(d):await a.verifyEmailOtp(d);if(e)return void h("Verification failed.");if(s)return await n(),void r("/");i?r(ye):(await n(),r("/"))}catch{console.error("Email OTP verification failed."),h("Verification failed.")}finally{c(!1)}}else h("Please enter a valid code.")},className:mt,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:_t,children:["Email Verification Code",t("span",{className:gt,children:[" ","— Code expires in ",(w=_,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(vt,{length:6,value:d,onChange:u,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),k("");const{error:e}=s?await a.requestLoginEmailOtp():await a.requestEmailOtp();e?h("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:ft,children:"Resend code to email"})]}),e("button",{type:"submit",className:pt,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:ht,children:"Back to login"})]})]})});var w};var xt={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"};ve(".verifyMagiclink-module__container___qrSXf{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:var(--seamless-text,#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 var(--seamless-border,hsla(0,0%,100%,.15));border-radius:50%;border-top-color:var(--seamless-accent,#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:var(--seamless-success,#34d399);height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:var(--seamless-success,#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[r]=v(),o=y(),n=r.get("token"),[a,i]=g(""),[s,l]=g(""),c=ne(),{refreshSession:d}=re();return m(()=>{let e=!0,t=null,r=null;return(async()=>{if(!n)return e&&i("Missing token for verification."),void console.error("No magic-link token found.");const{error:a}=await c.verifyMagicLink(n);if(a)return console.error("Failed to verify token"),void(e&&i("Failed to verify token"));await d(),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"),r=setTimeout(()=>{e&&o("/")},900))})(),()=>{e=!1,t?.close(),r&&clearTimeout(r)}},[n,c,o,d]),e("div",{className:xt.container,children:t("div",{className:xt.card,children:[e("h1",{className:xt.title,children:"Verifying your login"}),t("div",{className:xt.verificationContent,children:[!s&&!a&&e("div",{className:xt.spinner}),s&&e("div",{className:xt.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:xt.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!s&&!a&&e("p",{className:xt.helperText,children:"Please wait while we securely verify your sign-in link."}),s&&e("p",{className:xt.successText,children:"Login verified. Redirecting…"}),a&&e("p",{className:xt.error,children:a})]})]})})},St={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."},Ot=()=>{const{finishOAuthLogin:o}=re(),n=y(),[a]=v(),[i,s]=g(""),l=f(!1);return m(()=>{if(l.current)return;l.current=!0;const e=a.get("code"),t=a.get("state"),r=sessionStorage.getItem(Re);e&&t&&r?o({providerId:r,code:e,state:t}).then(({error:e})=>{if(e){const t=T(e);return void s(t?St[t]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(Re),n("/")}):s("This sign-in link is missing required information.")},[o,n,a]),t("div",{className:xt.container,children:[e("h2",{className:xt.title,children:i?"Sign-in failed":"Completing sign-in..."}),i&&t(r,{children:[e("p",{children:i}),e("button",{type:"button",onClick:()=>n("/login"),children:"Back to login"})]})]})};var Nt="magiclink-module__container___45zcA",Tt="magiclink-module__card___Au9oN",Ct="magiclink-module__iconWrapper___k5ndr",It="magiclink-module__mailIcon___Pwb7q",At="magiclink-module__iconRing___bdLvf",Mt="magiclink-module__heading___b9cre",Et="magiclink-module__message___kiVFj",Ft="magiclink-module__identifier___JtcFM",zt="magiclink-module__helperText___7Mlfh",Ut="magiclink-module__actions___64I-3",Lt="magiclink-module__secondaryButton___BntAI",qt="magiclink-module__cooldown___Ib4rm",Bt="magiclink-module__linkButton___maJiv";ve(".magiclink-module__container___45zcA{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:var(--seamless-surface,#1f2937);border-radius:.75rem;box-shadow:0 10px 25px var(--seamless-shadow,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:var(--seamless-accent-soft,#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:var(--seamless-text-muted,#d1d5db);font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:var(--seamless-surface-raised,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:var(--seamless-text-muted,#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:var(--seamless-surface,#111827);border:1px solid var(--seamless-border,#374151);border-radius:8px;color:var(--seamless-text,#fff);cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:var(--seamless-surface-hover,#1f2937)}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:var(--seamless-text-muted,#9ca3af);font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:var(--seamless-accent-soft,#a5b4fc);cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const Rt=()=>{const{refreshSession:r}=re(),o=y(),n=b(),a=ne(),i=n.state?.identifier,[s,l]=g(30);m(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const c=p(async()=>{const{data:e,error:t}=await a.checkMagicLink();return!t&&"Success"===e?.message},[a]);return m(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await c()&&(await r(),o("/"))},()=>{e.close()}},[c,o,r]),m(()=>{const e=setInterval(async()=>{try{await c()&&(await r(),o("/"))}catch{}},5e3);return()=>clearInterval(e)},[c,r,o]),e("div",{className:Nt,children:t("div",{className:Tt,children:[t("div",{className:Ct,children:[e("div",{className:At}),t("svg",{className:It,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:Mt,children:"Check your email"}),e("p",{className:Et,children:"If an account exists for this address, we sent a secure sign-in link."}),i&&e("div",{className:Ft,children:i}),e("p",{className:zt,children:"Open the email and click the link to finish signing in."}),e("p",{className:zt,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Ut,children:[e("button",{className:Lt,disabled:s>0,onClick:async()=>{s>0||(await a.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:qt,children:["Available in ",s,"s"]}),e("button",{className:Bt,onClick:()=>o("/login"),children:"Change email or phone"})]})]})})},jt=()=>t(k,{children:[e(w,{path:me,element:e(Je,{})}),e(w,{path:_e,element:e(We,{})}),e(w,{path:ge,element:e(kt,{})}),e(w,{path:fe,element:e(wt,{})}),e(w,{path:pe,element:e(Pt,{})}),e(w,{path:he,element:e(Ot,{})}),e(w,{path:ye,element:e(at,{})}),e(w,{path:be,element:e(Rt,{})}),e(w,{path:"*",element:e(x,{to:me,replace:!0})})]});export{oe as AuthProvider,jt as AuthRoutes,S as SeamlessAuthError,H as createSeamlessAuthClient,B as encodePrfSalt,W as extractPasskeyPrfResult,T as getOAuthErrorCode,A as getPasskeyPolicyErrorCode,M as getWebAuthnErrorDetail,se as hasNonPasskeyLoginMethod,Z as hasScopedRole,J as isPasskeyPrfSupported,Y as roleGrantsAccess,re as useAuth,ne as useAuthClient,ie as useLoginMethods,ue as usePasskeySupport};
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{browserSupportsWebAuthn as n,bufferToBase64URLString as o,base64URLStringToBuffer as i,startAuthentication as a,startRegistration as s,WebAuthnError as l}from"@simplewebauthn/browser";import{createContext as c,useMemo as d,useSyncExternalStore as u,useEffect as m,useContext as _,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,r,n){super(e),this.name="SeamlessAuthError",this.status=t,this.body=r,this.cause=n}}const O={oauth_missing_email:!0,oauth_email_not_verified:!0,oauth_missing_subject:!0};function N(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=N(e.body)??N(e.body.details);return"string"==typeof t&&Object.prototype.hasOwnProperty.call(O,t)?t:void 0}const C={attachment_not_allowed:!0,synced_passkey_not_allowed:!0,authenticator_not_allowed:!0,prf_required:!0};function I(e){if("object"!=typeof e||null===e)return;const t=e.error;return"string"==typeof t&&Object.prototype.hasOwnProperty.call(C,t)?t:void 0}function A(e){if(e instanceof S&&"object"==typeof e.body&&null!==e.body)return I(e.body)??I(e.body.details)}function M(e){return e instanceof S&&401===e.status}function E(e){if(!(e instanceof S)||("object"!=typeof(t=e.cause)||null===t||"string"!=typeof t.name))return;var t;const{name:r,code:n,message:o}=e.cause;return{name:r,code:"string"==typeof n?n:void 0,message:"string"==typeof o?o:""}}async function z(e,t){let r;try{r=await e.json()}catch{r=void 0}return new S(function(e){if("object"!=typeof e||null===e)return;const{error:t,message:r}=e;return"string"==typeof t&&t?t:"string"==typeof r&&r?r:void 0}(r)??t,e.status,r)}async function F(e){try{return await e.json()}catch{return}}async function U(e,t){let r;try{r=await e}catch{return{data:null,error:new S(t,0)}}return r.ok?{data:await F(r),error:null}:{data:null,error:await z(r,t)}}function L(e){return{data:e,error:null}}function R(e,t=0,r,n){return{data:null,error:new S(e,t,r,n)}}function q(e){if(e instanceof ArrayBuffer)return e;const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=new Uint8Array(t.byteLength);return r.set(t),r.buffer}function B(e){return"string"==typeof e?e:o(q(e))}function j(e){return"string"==typeof e?i(e):e}function J(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:B(e.salt),...e.secondSalt?{secondSalt:B(e.secondSalt)}:{}}}}async function G(){return!!n()&&("undefined"==typeof window||!1!==window.isSecureContext)&&void 0!==globalThis.PublicKeyCredential&&"undefined"!=typeof navigator&&"function"==typeof navigator.credentials?.get}function W(e){const t=e,r=t.extensions?.prf?.eval;return r?{...t,extensions:{...t.extensions,prf:{...t.extensions?.prf,eval:{...r,...r.first?{first:j(r.first)}:{},...r.second?{second:j(r.second)}:{}}}}}:e}function $(e){const t=e.clientExtensionResults,r=t?.prf?.results?.first;if(!r)return null;const n=(i=r)instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength);var i;return{credentialId:e.id,output:n,outputBase64url:o(q(n))}}function D(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function V(e,t){const r=e.method===t?e.method:null;return"Success"===e.message&&!0===e.fresh&&null!==r?L({fresh:!0,method:r,verifiedAt:e.verifiedAt??null,expiresAt:e.expiresAt??null,maxAgeSeconds:e.maxAgeSeconds??0}):R(e.message??"Step-up authentication failed.")}function H(e){return e?{method:"POST",body:JSON.stringify(J(e))}:{method:"POST"}}function K(e,t,r){const n=R(t,0,void 0,r),o=E(n.error);return console.error(e,o?.name??"Unknown error."),n}const Y=e=>{const t=(e=>{const{authHost:t}=e;return async function(e,r){const n=`${t?.replace(/\/+$/,"")??""}/auth${e.startsWith("/")?e:`/${e}`}`,o=null!=r?.body,i={...r,credentials:"include",headers:{...o?{"Content-Type":"application/json"}:{},...r?.headers}};return fetch(n,i)}})({authHost:e.apiHost});return{getCurrentUser:()=>U(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>U(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const r=await U(t("/webAuthn/login/start",{...H(e?.prf)}),"Failed to start passkey login.");if(r.error)return r;let n,o;try{const e=await a({optionsJSON:W(r.data)});n=$(e),o=D(e)}catch(e){return K("Passkey login error.","Passkey login failed.",e)}const i=await U(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:o})}),"Failed to verify passkey.");return i.error?i:"Success"!==i.data?.message?R(i.data?.message??"Passkey login failed."):L(n?{prf:n}:{})},logout:(e={})=>U(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>U(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>U(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>U(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>U(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>U(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>U(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>U(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>U(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>U(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>U(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>U(t("/otp/verify-login-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestMagicLink:r=>{const n=r??e.magicLinkRedirectUri;return U(t("/magic-link",{method:"POST",body:JSON.stringify(n?{redirectUri:n}:{})}),"Failed to send the magic link.")},checkMagicLink:()=>U(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>U(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>U(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),getPublicSystemConfig:()=>U(t("/system-config/public",{method:"GET"}),"Failed to read the public system configuration."),startOAuthLogin:e=>U(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=>U(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 r=function(e){return"metadata"in e?e:{metadata:e}}(e),n=await U(t(function(e){const t=new URLSearchParams;e.requirePrf?t.set("requirePrf","true"):e.requestPrf&&t.set("requestPrf","true"),e.attachment&&t.set("attachment",e.attachment);const r=t.toString();return"/webAuthn/register/start"+(r?`?${r}`:"")}(r),{method:"GET"}),"Failed to fetch passkey registration challenge.");if(n.error)return n;let o;try{o=await s({optionsJSON:n.data})}catch(e){return e instanceof l?R(e.name,0,void 0,e):K("Passkey registration error.","Passkey registration failed.",e)}const i=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(o),a=await U(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:o,metadata:{...r.metadata,prfCapable:i}})}),"Verification failed.");return a.error?a:L({credentialId:o.id,prfCapable:i})},isPasskeyPrfSupported:G,getStepUpStatus:()=>U(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await U(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let r;try{r=D(await a({optionsJSON:W(e.data)}))}catch(e){return K("Step-up authentication error.","Step-up authentication failed.",e)}const n=await U(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify step-up authentication.");return n.error?n:V(n.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const r=await U(t("/step-up/webauthn/start",{...H(e)}),"Failed to start step-up authentication.");if(r.error)return r;let n,o;try{const e=await a({optionsJSON:W(r.data)});n=$(e),o=D(e)}catch(e){return K("Step-up authentication error.","Step-up authentication failed.",e)}if(!n)return R("Passkey did not return PRF output.");const i=await U(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:o})}),"Failed to verify step-up authentication.");if(i.error)return i;const s=V(i.data??{},"webauthn");return s.error?s:L({...s.data,credentialId:n.credentialId,prf:n})},getTotpStatus:()=>U(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>U(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>U(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>U(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const r=await U(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return r.error?r:V(r.data??{},"totp")},updateCredential:e=>U(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>U(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>U(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>U(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>U(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,r)=>U(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(r)}),"Failed to update organization."),switchOrganization:e=>U(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>U(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,r)=>U(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(r)}),"Failed to add organization member."),updateOrganizationMember:(e,r,n)=>U(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify(n)}),"Failed to update organization member."),removeOrganizationMember:(e,r)=>U(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function Z(e,t){const r=e.trim(),n=t.trim();if(!r||!n)return!1;if(r===n)return!0;if(r.endsWith(":*")){const e=r.slice(0,-2);return n===e||n.startsWith(`${e}:`)}if(!n.includes(":"))return!1;if(!r.includes(":"))return n.startsWith(`${r}:`);const o=r.split(":"),i=n.split(":"),a=o[o.length-1],s=i[i.length-1],l=o.slice(0,-1),c=i.slice(0,-1);return"write"===a&&"read"===s&&l.length===c.length&&l.every((e,t)=>e===c[t])}function Q(e,t){if(!Array.isArray(e))return!1;const r=e.filter(e=>"string"==typeof e);return(Array.isArray(t)?t:[t]).some(e=>r.some(t=>Z(t,e)))}function X(){return"undefined"==typeof localStorage?function(){const e=new Map;return{get:t=>e.get(t)??null,set:(t,r)=>{e.set(t,r)}}}():{get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}}}const ee="seamlessauth_seen",te={user:null,credentials:[],organizations:[],activeOrganization:null,stepUpStatus:null,isAuthenticated:!1};const re=c(void 0),ne=()=>{const e=_(re);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},oe=({children:t,apiHost:r,autoDetectPreviousSignin:n=!0,magicLinkRedirectUri:o})=>{const i=d(()=>function(e){const{apiHost:t,detectPreviousSignIn:r=!0}=e,n=Y({apiHost:t}),o=e.storage??X(),i=new Set;let a=!1,s=0,l={...te,loading:!0,hasSignedInBefore:r&&"true"===o.get(ee)};function c(e){const t={...l,...e};Object.keys(e).some(e=>l[e]!==t[e])&&(l=t,i.forEach(e=>e()))}function d(){o.set(ee,"true"),r&&c({hasSignedInBefore:!0})}function u(){c(te)}async function m(){const e=++s;c({loading:!0});const t=await n.getCurrentUser();return a||e!==s?t:t.error?(u(),c({loading:!1}),t):(c({user:t.data.user,credentials:t.data.credentials??[],organizations:t.data.organizations??[],activeOrganization:t.data.activeOrganization??null,isAuthenticated:!0,loading:!1}),l.hasSignedInBefore||d(),t)}async function _(e){const t=await e();return t.error||await m(),t}return{getState:()=>l,subscribe:e=>(i.add(e),()=>{i.delete(e)}),actions:{login:(e,t)=>n.login({identifier:e,passkeyAvailable:t}),handlePasskeyLogin:()=>_(()=>n.loginWithPasskey()),registerPasskey:e=>_(()=>n.registerPasskey(e)),refreshSession:m,logout:async function(){try{return await n.logout()}finally{u()}},logoutAllSessions:async function(){try{return await n.logoutAllSessions()}finally{u()}},deleteUser:async()=>{const e=await n.deleteUser();return e.error||u(),e},updateCredential:async e=>{const{data:t,error:r}=await n.updateCredential({friendlyName:e.friendlyName??null,id:e.id});if(r)return{data:null,error:r};const o=t.credential;return c({credentials:l.credentials.map(e=>e.id===o.id?{...e,...o}:e)}),{data:o,error:null}},deleteCredential:async e=>{const t=await n.deleteCredential(e);return t.error||c({credentials:l.credentials.filter(t=>t.id!==e)}),t},switchOrganization:e=>_(()=>n.switchOrganization(e)),listOAuthProviders:()=>n.listOAuthProviders(),startOAuthLogin:e=>n.startOAuthLogin(e),finishOAuthLogin:e=>_(()=>n.finishOAuthLogin(e)),refreshStepUpStatus:async()=>{const e=await n.getStepUpStatus();return c({stepUpStatus:e.error?null:e.data}),e},verifyStepUpWithPasskey:async()=>{const e=await n.verifyStepUpWithPasskey();return e.error||c({stepUpStatus:e.data}),e},verifyStepUpWithPasskeyPrf:async e=>{const t=await n.verifyStepUpWithPasskeyPrf(e);return t.error||c({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 n.verifyStepUpWithTotp(e);return t.error||c({stepUpStatus:t.data}),t},hasRole:e=>l.user?.roles?.includes(e),hasScopedRole:e=>l.user?Q(l.user.roles,e):void 0,markSignedIn:d},destroy:()=>{a=!0,i.clear()}}}({apiHost:r,detectPreviousSignIn:n}),[r,n]),a=u(i.subscribe,i.getState,i.getState);m(()=>{i.actions.refreshSession()},[i]);const s=d(()=>({...a,...i.actions,apiHost:r,magicLinkRedirectUri:o}),[a,i,r,o]);return e(re.Provider,{value:s,children:t})},ie=()=>{const{apiHost:e,magicLinkRedirectUri:t}=ne();return d(()=>Y({apiHost:e,magicLinkRedirectUri:t}),[e,t])},ae=["passkey","magic_link"],se=()=>{const e=ie(),[t,r]=g(null),[n,o]=g(!0);return m(()=>{let t=!0;return(async()=>{try{const{data:n,error:o}=await e.getPublicSystemConfig();t&&!o&&n?.loginMethods?.length&&r(n.loginMethods)}catch{}finally{t&&o(!1)}})(),()=>{t=!1}},[e]),{loginMethods:t,loading:n}},le=e=>Boolean(e?.some(e=>"passkey"!==e)),ce=e=>{if("string"!=typeof e)return!1;const t=e.trim();if(t.length<3||t.length>320)return!1;const r=t.split("@");if(2!==r.length)return!1;const[n,o]=r;return!(!/^[A-Za-z0-9._%+-]+$/.test(n)||n.startsWith(".")||n.endsWith(".")||n.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(o)||o.startsWith("-")||o.endsWith("-")||o.startsWith(".")||o.endsWith(".")||o.includes(".."))},de=e=>{const t=P(e);return t?.isValid()||!1};async function ue(){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 me=()=>{const[e,t]=g(!1),[r,n]=g(!0);return m(()=>{let e=!0;return(async()=>{try{const r=await ue();e&&t(r)}catch{e&&t(!1)}finally{e&&n(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:r}},_e="/login",ge="/passkey-login",pe="/verify-phone-otp",fe="/verify-email-otp",he="/verify-magiclink",ye="/oauth/callback",be="/register-passkey",ve="/magic-link-sent";function ke(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var we="login-module__container___YggDx",xe="login-module__card___Ub-Py",Pe="login-module__heading___neEqb",Se="login-module__inputGroup___P6qgS",Oe="login-module__label___mx5vu",Ne="login-module__input___U07lW",Te="login-module__helperText___kDQ4-",Ce="login-module__error___40zxh",Ie="login-module__button___0kFBs",Ae="login-module__submitHint___qOS5Z",Me="login-module__toggle___1JiG1",Ee="login-module__fallbackCard___HdIk-",ze="login-module__fallbackHeader___-il2v",Fe="login-module__fallbackDescription___ea5EB",Ue="login-module__fallbackActions___AD3ni",Le="login-module__fallbackActionButton___lFgWf",Re="login-module__actionTitle___ycrMp",qe="login-module__actionSubtext___opaIV",Be="login-module__linkButton___5lsoe";ke(".login-module__container___YggDx{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 4px 6px var(--seamless-shadow,rgba(0,0,0,.1));max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:var(--seamless-success,#68d391);text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:var(--seamless-text-muted,#d1d5db);display:block}.login-module__input___U07lW{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6);outline:none}.login-module__helperText___kDQ4-{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:var(--seamless-danger,#f87171);font-size:.875rem}.login-module__button___0kFBs{background-color:var(--seamless-accent,#2563eb);border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s,opacity .3s;width:100%}.login-module__button___0kFBs:hover:not(:disabled){background-color:var(--seamless-accent-hover,#1d4ed8)}.login-module__button___0kFBs:disabled{cursor:not-allowed;opacity:.6}.login-module__submitHint___qOS5Z{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem;text-align:center}.login-module__toggle___1JiG1{background:none;border:none;color:var(--seamless-accent-soft,#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:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#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:var(--seamless-surface-raised,hsla(0,0%,100%,.04));border:1px solid var(--seamless-border,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:var(--seamless-text,#f3f4f6);font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:var(--seamless-surface,rgba(0,0,0,.25));border:1px solid var(--seamless-border,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:var(--seamless-surface-hover,hsla(0,0%,100%,.06));border-color:var(--seamless-border,hsla(0,0%,100%,.15))}.login-module__actionTitle___ycrMp{color:var(--seamless-text,#f9fafb);font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const je=({identifier:r,onMagicLink:n,onEmailOtp:o,onPhoneOtp:i,onPasskeyRetry:a,loginMethods:s})=>{const l=new Set(s??["passkey","magic_link","phone_otp"]),c=l.has("magic_link")&&ce(r),d=l.has("email_otp")&&Boolean(o)&&ce(r),u=l.has("phone_otp")&&de(r),m=l.has("passkey")&&Boolean(a);return c||d||u||m?t("div",{className:Ee,children:[e("div",{className:ze,children:"Choose a sign-in method"}),e("p",{className:Fe,children:"Choose another secure sign-in method."}),t("div",{className:Ue,children:[c&&t("button",{type:"button",className:Le,onClick:n,children:[e("span",{className:Re,children:"Email Magic Link"}),e("span",{className:qe,children:"Send a secure sign-in link to your email"})]}),d&&t("button",{type:"button",className:Le,onClick:o,children:[e("span",{className:Re,children:"Email Code"}),e("span",{className:qe,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:Le,onClick:i,children:[e("span",{className:Re,children:"Text Message Code"}),e("span",{className:qe,children:"Receive a one-time code via SMS"})]})]}),m&&e("button",{type:"button",className:Be,onClick:a,children:"Try passkey anyway"})]}):null},Je="seamless:oauth:provider",Ge=()=>{const{listOAuthProviders:r,startOAuthLogin:n}=ne(),o=h("/oauth/callback"),[i,a]=g([]),[s,l]=g("");if(m(()=>{let e=!0;return r().then(({data:t})=>{e&&a(t?.providers??[])}),()=>{e=!1}},[r]),0===i.length)return null;return t("div",{className:Ue,children:[i.map(r=>e("button",{type:"button",className:Le,onClick:()=>(async e=>{l(""),sessionStorage.setItem(Je,e);const{data:t,error:r}=await n({providerId:e,redirectUri:new URL(o,window.location.origin).toString()});r?l("Could not start sign-in with this provider."):window.location.assign(t.authorizationUrl)})(r.id),children:t("span",{className:Re,children:["Continue with ",r.name]})},r.id)),s&&e("p",{className:Ce,children:s})]})},We=()=>{const n=y(),{hasSignedInBefore:o,login:i,handlePasskeyLogin:a}=ne(),s=ie(),{passkeySupported:l}=me(),{loginMethods:c}=se(),[d,u]=g(""),[_,p]=g(""),[f,h]=g("register"),[b,v]=g(""),[k,w]=g(""),[x,P]=g(""),[S,O]=g(!1),[N,T]=g(null);m(()=>{o&&h("login")},[o]);const C=()=>"login"===f?ce(d)||de(d):ce(_);return e("div",{className:we,children:t("div",{className:xe,children:[e("h2",{className:Pe,children:"login"===f?"Sign In":"Create Account"}),t(r,{children:[t("form",{onSubmit:async e=>{e.preventDefault(),v(""),O(!1);try{if("login"===f){const{data:e,error:t}=await i(d,l);if(t)return void v("Failed to start sign-in. Please try again.");const r=e?.loginMethods?.length?e.loginMethods:c??ae;if(T(r),l&&r.includes("passkey")){const{error:e}=await a();return e?(O(!0),void v("Passkey sign-in could not be completed. Choose another sign-in method.")):void n("/")}return void O(!0)}"register"===f&&await(async()=>{v("");const{data:e,error:t}=await s.register({email:_});t?v("Failed to register. Please try again."):"Success"===e.message?n(fe):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:Se,children:[e("label",{htmlFor:"identifier",className:Oe,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:d,onChange:e=>{const t=e.target.value;u(t)},autoComplete:"off",placeholder:"Email or Phone Number",className:Ne,onBlur:()=>{if(d){const e=ce(d)||de(d);P(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:Te,children:"Phone numbers must include a country code e.g. +1"}),S&&e(je,{identifier:d,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?v("Failed to send magic link."):n(ve,{state:{identifier:d}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?v("Failed to send email code."):n(fe,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?v("Failed to send OTP."):n(pe,{state:{flow:"login"}})},onPasskeyRetry:l?a:void 0,loginMethods:N}),x&&e("p",{className:Ce,children:x})]}),"register"===f&&t("div",{className:Se,children:[e("label",{htmlFor:"email",className:Oe,children:"Email Address"}),e("input",{id:"email",type:"email",value:_,onChange:e=>{const t=e.target.value;p(t)},autoComplete:"off",className:Ne,onBlur:()=>{if(_){const e=ce(_);w(e?"":"Please enter a valid email")}},required:!0}),k&&e("p",{className:Ce,children:k})]}),e("button",{type:"submit",className:Ie,disabled:!C(),"aria-describedby":"seamless-submit-hint",children:"login"===f?"Login":"Register"}),e("p",{id:"seamless-submit-hint",role:"status",className:Ae,children:"login"===f?d?C()?"Ready to continue.":"This does not look like a complete email or phone number yet.":"Enter your email or phone number to continue.":_?C()?"Ready to continue.":"This does not look like a complete email address yet.":"Enter your email address to continue."}),b&&e("p",{className:Ce,children:b}),e("button",{type:"button",onClick:()=>h("login"===f?"register":"login"),className:Me,children:"login"===f?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(Ge,{})]})]})})};var $e={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};ke(".passKeyLogin-module__container___IUKxF{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,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:var(--seamless-text,#fff);font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:var(--seamless-accent,#2563eb);border:1px solid var(--seamless-accent,#3b82f6);border-radius:.5rem;color:var(--seamless-accent-contrast,#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:var(--seamless-accent-hover,#1d4ed8)}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const De=()=>{const r=y(),{handlePasskeyLogin:n}=ne(),[o,i]=g("");return e("div",{className:$e.container,children:t("div",{className:$e.card,children:[e("h2",{className:$e.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{i("");const{error:e}=await n();e?i("Passkey sign-in could not be completed. Try another sign-in method."):r("/")},className:$e.button,children:"Use Passkey"}),o&&e("p",{className:$e.error,children:o})]})})};var Ve="registerPasskey-module__container___jqEh8",He="registerPasskey-module__card___MJAyC",Ke="registerPasskey-module__loading___Q4i1x",Ye="registerPasskey-module__spinner___V1nhd",Ze="registerPasskey-module__supported___ihTih",Qe="registerPasskey-module__title___vn2Qu",Xe="registerPasskey-module__description___AWmO-",et="registerPasskey-module__button___D3b4B",tt="registerPasskey-module__message___RiOw-",rt="registerPasskey-module__success___HP5aX",nt="registerPasskey-module__error___hGiqE",ot="registerPasskey-module__skip___1hDyU",it="registerPasskey-module__secondary___bnOB4";ke(".registerPasskey-module__container___jqEh8{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:var(--seamless-surface,#f9fafb);border-radius:.75rem;box-shadow:0 2px 8px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#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-bottom:2px solid var(--seamless-accent,#3b82f6);border-left:2px solid transparent;border-radius:9999px;border-right:2px solid transparent;border-top:2px solid var(--seamless-accent,#3b82f6);height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:var(--seamless-surface,#ecfdf5);border-radius:.75rem;box-shadow:0 2px 12px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#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:var(--seamless-accent,#059669);border:none;border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:var(--seamless-accent-hover,#047857)}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:var(--seamless-success,#6ee7b7)}.registerPasskey-module__error___hGiqE{color:var(--seamless-danger,#f87171)}.registerPasskey-module__skip___1hDyU{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.registerPasskey-module__skip___1hDyU:disabled{cursor:default;opacity:.6}.registerPasskey-module__secondary___bnOB4{background:none;border:1px solid var(--seamless-accent,#059669);border-radius:.5rem;color:var(--seamless-accent,#059669);cursor:pointer;font-weight:500;margin-top:.75rem;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__secondary___bnOB4:hover:not(:disabled){background-color:var(--seamless-accent-muted,rgba(5,150,105,.1))}.registerPasskey-module__secondary___bnOB4:disabled{cursor:default;opacity:.6}");const at={attachment_not_allowed:"This application does not accept that kind of authenticator. Try the other option.",synced_passkey_not_allowed:"This passkey syncs to a password manager, and this application requires one that stays on a single device, such as a security key.",authenticator_not_allowed:"This application does not accept this authenticator.",prf_required:"This authenticator does not support a feature this application requires."};const st=()=>{const{refreshSession:r}=ne(),n=ie(),{passkeySupported:o,loading:i}=me(),{loginMethods:a,loading:s}=se(),l=y(),[c,d]=g("idle"),[u,m]=g(""),_=le(a),p=async()=>{await r(),l("/")},f=async e=>{const{platform:t,browser:o,deviceInfo:i}=function(){const e=navigator.userAgent.toLowerCase();let t="unknown",r="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?r="brave":/edg\/|edgios/.test(e)?r="edge":/opr\/|opt\/|opera/.test(e)?r="opera":/vivaldi/.test(e)?r="vivaldi":/samsungbrowser/.test(e)?r="samsung":/firefox|fxios/.test(e)?r="firefox":/chrome|crios/.test(e)?r="chrome":/safari/.test(e)&&(r="safari"),{platform:t,browser:r,deviceInfo:`${t} • ${r}`}}(),a={friendlyName:i,platform:t,browser:o,deviceInfo:i};d("loading");try{const{error:t}=await n.registerPasskey({metadata:a,attachment:e});if(t)throw t;await r(),d("success"),m("Passkey registered successfully."),l("/")}catch(e){console.error("Passkey registration failed."),d("error"),m(function(e){const t=A(e);return t?at[t]:void 0}(e)??(M(e)?"Your session expired before the passkey was saved. Sign in again to add one.":"Error registering passkey."))}};return e("div",{className:Ve,children:e("div",{className:He,children:t("div",i||s?{className:Ke,children:[e("div",{className:Ye}),e("span",{children:"Checking for Passkey Support..."})]}:o?{className:Ze,children:[e("h2",{className:Qe,children:"Secure Your Account with a Passkey"}),e("p",{className:Xe,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>f(),disabled:"loading"===c,className:et,children:"loading"===c?"Registering...":"Register Passkey"}),e("button",{type:"button",onClick:()=>f("cross-platform"),disabled:"loading"===c,className:it,children:"Use a security key instead"}),u&&e("p",{className:`${tt} ${"success"===c?rt:nt}`,children:u}),_&&e("button",{type:"button",onClick:p,disabled:"loading"===c,className:ot,children:"Skip for now"})]}:{className:Ze,children:[e("h2",{className:Qe,children:"Passkeys are not available here"}),e("p",{className:Xe,children:_?"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."}),_&&e("button",{type:"button",onClick:p,className:et,children:"Continue"})]})})})};var lt="verifyOTP-module__container___wgoDE",ct="verifyOTP-module__card___3cs2p",dt="verifyOTP-module__title___fZ-1d",ut="verifyOTP-module__subtitle___dGSu3",mt="verifyOTP-module__error___GEtlG",_t="verifyOTP-module__success___46TjG",gt="verifyOTP-module__form___jiGG-",pt="verifyOTP-module__label___Zq5Mi",ft="verifyOTP-module__timer___smq-a",ht="verifyOTP-module__resend___PlmkG",yt="verifyOTP-module__button___8pIuO",bt="verifyOTP-module__toggle___wbzVa";ke(".verifyOTP-module__container___wgoDE{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:var(--seamless-text-muted,#9ca3af);font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:var(--seamless-danger,#f87171);margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:var(--seamless-success,#34d399);margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:var(--seamless-text-muted,#d1d5db);display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:var(--seamless-warning,#facc15);font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:.375rem;color:var(--seamless-text,#fff);outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6)}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:var(--seamless-accent,#3b82f6)}.verifyOTP-module__button___8pIuO{background-color:var(--seamless-accent,#2563eb);border:none;border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var vt="otpInput-module__otpContainer___MUjby",kt="otpInput-module__otpInput___3YMVm";ke(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:8px;color:var(--seamless-text,#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:var(--seamless-accent,#60a5fa);box-shadow:0 0 0 2px var(--seamless-accent,rgba(96,165,250,.25));outline:none}");const wt=({length:t=6,value:r,inputMode:n="numeric",onChange:o,name:i="otp"})=>{const a=p([]),s=r.split("").concat(Array(t).fill("")).slice(0,t),l=(e,t)=>{var r;if(t.length>1)c(e,t);else if(!t||(r=t,"numeric"===n?/^\d$/.test(r):/^[a-zA-Z]$/.test(r))){const r=[...s];r[e]=t;const n=r.join("");o(n),t&&a.current[e+1]&&a.current[e+1]?.focus()}},c=(e,r)=>{let i=r;i="numeric"===n?r.replace(/\D/g,""):r.replace(/[^a-zA-Z]/g,"");const l=i.slice(0,t).split(""),c=[...s];l.forEach((r,n)=>{e+n<t&&(c[e+n]=r)}),o(c.join("")),a.current[Math.min(e+l.length,t-1)]?.focus()};return e("div",{className:vt,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),c(0,e.clipboardData.getData("text"))},children:s.map((r,c)=>e("input",{ref:e=>a.current[c]=e,type:"text",inputMode:"numeric"===n?"numeric":"text",autoComplete:"one-time-code",name:`${i}-${c}`,maxLength:1,value:r,className:kt,onChange:e=>l(c,e.target.value),onKeyDown:e=>((e,r)=>{if("Backspace"===r.key){r.preventDefault();const t=[...s];s[e]?(t[e]="",o(t.join(""))):e>0&&(t[e-1]="",o(t.join("")),a.current[e-1]?.focus())}"ArrowLeft"===r.key&&e>0&&a.current[e-1]?.focus(),"ArrowRight"===r.key&&e<t-1&&a.current[e+1]?.focus()})(c,e),"aria-label":`Digit ${c+1}`},c))})},xt=()=>{const r=y(),n=b(),{refreshSession:o}=ne(),i="login"===n.state?.flow,[a,s]=g(""),[l,c]=g(null),[d,u]=g(""),[_,p]=g(!1),[f,h]=g(""),[v,k]=g(300),w=ie(),x=async()=>{if(p(!0),!l){const{error:e}=i?await w.verifyLoginPhoneOtp(a):await w.verifyPhoneOtp(a);if(e)u("Verification failed.");else{if(i)return await o(),void r("/");c(!0)}}p(!1)},P=async()=>{h(""),await(async()=>{u("");const{error:e}=i?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 m(()=>{const e=setInterval(()=>{k(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),m(()=>{l&&!i&&(async()=>{const{error:e}=await w.requestEmailOtp();e?u("Failed to send Email code. If this persists, refresh the page and try registering again."):r(fe)})()},[l,i,r,w]),e("div",{className:lt,children:t("div",{className:ct,children:[e("h2",{className:dt,children:"Verify Your Phone Number"}),e("p",{className:ut,children:"Enter the code sent to your phone number."}),d&&e("p",{className:mt,children:d}),f&&e("p",{className:_t,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:gt,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:pt,children:["Phone Verification Code ",(O=l,!0===O?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===O?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",t("span",{className:ft,children:["Code expires in: ",(S=v,`${Math.floor(S/60).toString().padStart(2,"0")}:${(S%60).toString().padStart(2,"0")}`)]})]}),e(wt,{length:6,value:a,onChange:s}),e("button",{type:"button",onClick:()=>P(),className:ht,children:"Resend code to phone"})]}),e("button",{type:"submit",className:yt,children:_?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:bt,children:"Back to login"})]})]})});var S,O},Pt=()=>{const r=y(),n=b(),{refreshSession:o}=ne(),i=ie(),{passkeySupported:a}=me(),s="login"===n.state?.flow,[l,c]=g(!1),[d,u]=g(""),[_,p]=g(300),[f,h]=g(""),[v,k]=g("");return m(()=>{const e=setInterval(()=>{p(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:lt,children:t("div",{className:ct,children:[e("h2",{className:dt,children:"Verify Your Email"}),e("p",{className:ut,children:"We sent you a verification email. Enter the code below."}),f&&e("p",{className:mt,children:f}),v&&e("p",{className:_t,children:v}),t("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===d.length){c(!0);try{const{error:e}=s?await i.verifyLoginEmailOtp(d):await i.verifyEmailOtp(d);if(e)return void h("Verification failed.");if(s)return await o(),void r("/");a?r(be):(await o(),r("/"))}catch{console.error("Email OTP verification failed."),h("Verification failed.")}finally{c(!1)}}else h("Please enter a valid code.")},className:gt,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:pt,children:["Email Verification Code",t("span",{className:ft,children:[" ","— Code expires in ",(w=_,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(wt,{length:6,value:d,onChange:u,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),k("");const{error:e}=s?await i.requestLoginEmailOtp():await i.requestEmailOtp();e?h("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:ht,children:"Resend code to email"})]}),e("button",{type:"submit",className:yt,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:bt,children:"Back to login"})]})]})});var w};var St={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"};ke(".verifyMagiclink-module__container___qrSXf{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:var(--seamless-text,#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 var(--seamless-border,hsla(0,0%,100%,.15));border-radius:50%;border-top-color:var(--seamless-accent,#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:var(--seamless-success,#34d399);height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:var(--seamless-success,#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[r]=v(),n=y(),o=r.get("token"),[i,a]=g(""),[s,l]=g(""),c=ie(),{refreshSession:d}=ne();return m(()=>{let e=!0,t=null,r=null;return(async()=>{if(!o)return e&&a("Missing token for verification."),void console.error("No magic-link token found.");const{error:i}=await c.verifyMagicLink(o);if(i)return console.error("Failed to verify token"),void(e&&a("Failed to verify token"));await d(),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"),r=setTimeout(()=>{e&&n("/")},900))})(),()=>{e=!1,t?.close(),r&&clearTimeout(r)}},[o,c,n,d]),e("div",{className:St.container,children:t("div",{className:St.card,children:[e("h1",{className:St.title,children:"Verifying your login"}),t("div",{className:St.verificationContent,children:[!s&&!i&&e("div",{className:St.spinner}),s&&e("div",{className:St.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:St.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!s&&!i&&e("p",{className:St.helperText,children:"Please wait while we securely verify your sign-in link."}),s&&e("p",{className:St.successText,children:"Login verified. Redirecting…"}),i&&e("p",{className:St.error,children:i})]})]})})};const Nt={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."},Tt=()=>{const{finishOAuthLogin:n}=ne(),o=y(),[i]=v(),[a,s]=g(""),l=p(!1);return m(()=>{if(l.current)return;l.current=!0;const e=i.get("code"),t=i.get("state"),r=sessionStorage.getItem(Je);e&&t&&r?n({providerId:r,code:e,state:t}).then(({data:e,error:t})=>{if(t){const e=T(t);return void s(e?Nt[e]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(Je),o(function(e){if(!e)return null;try{const t=new URL(e,window.location.origin);return t.origin!==window.location.origin?null:`${t.pathname}${t.search}${t.hash}`}catch{return null}}(e?.returnTo)??"/")}):s("This sign-in link is missing required information.")},[n,o,i]),t("div",{className:St.container,children:[e("h2",{className:St.title,children:a?"Sign-in failed":"Completing sign-in..."}),a&&t(r,{children:[e("p",{children:a}),e("button",{type:"button",onClick:()=>o("/login"),children:"Back to login"})]})]})};var Ct="magiclink-module__container___45zcA",It="magiclink-module__card___Au9oN",At="magiclink-module__iconWrapper___k5ndr",Mt="magiclink-module__mailIcon___Pwb7q",Et="magiclink-module__iconRing___bdLvf",zt="magiclink-module__heading___b9cre",Ft="magiclink-module__message___kiVFj",Ut="magiclink-module__identifier___JtcFM",Lt="magiclink-module__helperText___7Mlfh",Rt="magiclink-module__actions___64I-3",qt="magiclink-module__secondaryButton___BntAI",Bt="magiclink-module__cooldown___Ib4rm",jt="magiclink-module__linkButton___maJiv";ke(".magiclink-module__container___45zcA{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:var(--seamless-surface,#1f2937);border-radius:.75rem;box-shadow:0 10px 25px var(--seamless-shadow,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:var(--seamless-accent-soft,#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:var(--seamless-text-muted,#d1d5db);font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:var(--seamless-surface-raised,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:var(--seamless-text-muted,#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:var(--seamless-surface,#111827);border:1px solid var(--seamless-border,#374151);border-radius:8px;color:var(--seamless-text,#fff);cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:var(--seamless-surface-hover,#1f2937)}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:var(--seamless-text-muted,#9ca3af);font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:var(--seamless-accent-soft,#a5b4fc);cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const Jt=()=>{const{refreshSession:r}=ne(),n=y(),o=b(),i=ie(),a=o.state?.identifier,[s,l]=g(30);m(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const c=f(async()=>{const{data:e,error:t}=await i.checkMagicLink();return!t&&"Success"===e?.message},[i]);return m(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await c()&&(await r(),n("/"))},()=>{e.close()}},[c,n,r]),m(()=>{const e=setInterval(async()=>{try{await c()&&(await r(),n("/"))}catch{}},5e3);return()=>clearInterval(e)},[c,r,n]),e("div",{className:Ct,children:t("div",{className:It,children:[t("div",{className:At,children:[e("div",{className:Et}),t("svg",{className:Mt,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:zt,children:"Check your email"}),e("p",{className:Ft,children:"If an account exists for this address, we sent a secure sign-in link."}),a&&e("div",{className:Ut,children:a}),e("p",{className:Lt,children:"Open the email and click the link to finish signing in."}),e("p",{className:Lt,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Rt,children:[e("button",{className:qt,disabled:s>0,onClick:async()=>{s>0||(await i.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:Bt,children:["Available in ",s,"s"]}),e("button",{className:jt,onClick:()=>n("/login"),children:"Change email or phone"})]})]})})},Gt=()=>t(k,{children:[e(w,{path:_e,element:e(We,{})}),e(w,{path:ge,element:e(De,{})}),e(w,{path:pe,element:e(xt,{})}),e(w,{path:fe,element:e(Pt,{})}),e(w,{path:he,element:e(Ot,{})}),e(w,{path:ye,element:e(Tt,{})}),e(w,{path:be,element:e(st,{})}),e(w,{path:ve,element:e(Jt,{})}),e(w,{path:"*",element:e(x,{to:_e,replace:!0})})]});export{oe as AuthProvider,Gt as AuthRoutes,S as SeamlessAuthError,Y as createSeamlessAuthClient,B as encodePrfSalt,$ as extractPasskeyPrfResult,T as getOAuthErrorCode,A as getPasskeyPolicyErrorCode,E as getWebAuthnErrorDetail,le as hasNonPasskeyLoginMethod,Q as hasScopedRole,G as isPasskeyPrfSupported,M as isUnauthenticated,Z as roleGrantsAccess,ne as useAuth,ie as useAuthClient,se as useLoginMethods,me 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/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/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],"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","PASSKEY_POLICY_ERROR_CODES","attachment_not_allowed","synced_passkey_not_allowed","authenticator_not_allowed","prf_required","readPolicyCode","getPasskeyPolicyErrorCode","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","redirectUri","checkMagicLink","verifyMagicLink","token","encodeURIComponent","listOAuthProviders","getPublicSystemConfig","startOAuthLogin","providerId","returnTo","finishOAuthLogin","state","registerPasskey","registerInput","metadata","normalizeRegisterPasskeyInput","challenge","query","URLSearchParams","requirePrf","requestPrf","attachment","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","POLICY_REFUSAL_MESSAGES","PasskeyRegistration","passkeySupportLoading","loginMethodsLoading","setStatus","setMessage","canSkip","finishWithoutPasskey","platform","browser","deviceInfo","ua","userAgent","toLowerCase","brave","parseUserAgent","policyRefusalMessage","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":"8jBAeM,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,CA+BA,MAAMC,EAAmE,CACvEC,wBAAwB,EACxBC,4BAA4B,EAC5BC,2BAA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AAWC,GAAiB7G,SAAA,mFAI/B2G,EAAA,MAAA,CAAKC,UAAWC,GAAc7G,SAAA,CAC5B+C,EAAA,SAAA,CACE6D,UAAWC,GACXgD,SAAU0G,EAAW,EACrBzJ,QAxFKtU,UACT+d,EAAW,UAETnN,EAAW3J,mBAEjB+W,EAAY,MAmFWxQ,SAAA,gBAKhBuQ,EAAW,GACV5J,EAAA,MAAA,CAAKC,UAAWC,GAAe7G,SAAA,CAAA,gBAAgBuQ,SAGjDxN,EAAA,SAAA,CAAQ6D,UAAWC,GAAmBC,QAAS,IAAMkB,EAAS,UAAShI,SAAA,mCC9GpE+Q,GAAa,IACxBpK,EAACqK,aACCjO,EAACkO,EAAK,CAACC,KAAMnM,GAAsBoM,QAASpO,EAACgF,GAAK,CAAA,KAClDhF,EAACkO,EAAK,CAACC,KAAMnM,GAA6BoM,QAASpO,EAAC+G,GAAY,CAAA,KAChE/G,EAACkO,EAAK,CAACC,KAAMnM,GAA+BoM,QAASpO,EAAC+J,GAAiB,CAAA,KACvE/J,EAACkO,EAAK,CAACC,KAAMnM,GAA+BoM,QAASpO,EAACqL,SACtDrL,EAACkO,EAAK,CAACC,KAAMnM,GAAgCoM,QAASpO,EAAC0L,SACvD1L,EAACkO,GAAMC,KAAMnM,GAA8BoM,QAASpO,EAACmN,GAAa,CAAA,KAClEnN,EAACkO,EAAK,CAACC,KAAMnM,GAAgCoM,QAASpO,EAACsH,GAAmB,CAAA,KAC1EtH,EAACkO,EAAK,CAACC,KAAMnM,GAA8BoM,QAASpO,EAACuN,GAAa,CAAA,KAClEvN,EAACkO,EAAK,CAACC,KAAK,IAAIC,QAASpO,EAACqO,GAASC,GAAItM,GAAsBtN","x_google_ignoreList":[15]}
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/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],"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","PASSKEY_POLICY_ERROR_CODES","attachment_not_allowed","synced_passkey_not_allowed","authenticator_not_allowed","prf_required","readPolicyCode","getPasskeyPolicyErrorCode","isUnauthenticated","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","redirectUri","destination","magicLinkRedirectUri","checkMagicLink","verifyMagicLink","token","encodeURIComponent","listOAuthProviders","getPublicSystemConfig","startOAuthLogin","providerId","returnTo","finishOAuthLogin","state","registerPasskey","registerInput","metadata","normalizeRegisterPasskeyInput","challenge","query","URLSearchParams","requirePrf","requestPrf","attachment","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","canSubmit","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","passkeyError","htmlFor","onChange","target","autoComplete","placeholder","onBlur","flow","disabled","PassKeyLogin","runPasskeyLogin","container","card","title","button","POLICY_REFUSAL_MESSAGES","PasskeyRegistration","passkeySupportLoading","loginMethodsLoading","setStatus","setMessage","canSkip","finishWithoutPasskey","platform","browser","deviceInfo","ua","userAgent","toLowerCase","brave","parseUserAgent","policyRefusalMessage","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","pathname","search","hash","inAppPath","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","useCallback","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"8jBAeM,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,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,SAAA,CACE6D,UAAWC,GACXiD,SAAU8G,EAAW,EACrB9J,QAxFKxU,UACTse,EAAW,UAETxN,EAAW7J,mBAEjBsX,EAAY,MAmFW7Q,SAAA,gBAKhB4Q,EAAW,GACVjK,EAAA,MAAA,CAAKC,UAAWC,GAAe7G,SAAA,CAAA,gBAAgB4Q,SAGjD7N,EAAA,SAAA,CAAQ6D,UAAWC,GAAmBC,QAAS,IAAMkB,EAAS,UAAShI,SAAA,mCC9GpEoR,GAAa,IACxBzK,EAAC0K,aACCtO,EAACuO,EAAK,CAACC,KAAMxM,GAAsByM,QAASzO,EAACgF,GAAK,CAAA,KAClDhF,EAACuO,EAAK,CAACC,KAAMxM,GAA6ByM,QAASzO,EAACgH,GAAY,CAAA,KAChEhH,EAACuO,EAAK,CAACC,KAAMxM,GAA+ByM,QAASzO,EAACgK,GAAiB,CAAA,KACvEhK,EAACuO,EAAK,CAACC,KAAMxM,GAA+ByM,QAASzO,EAACsL,SACtDtL,EAACuO,EAAK,CAACC,KAAMxM,GAAgCyM,QAASzO,EAAC2L,SACvD3L,EAACuO,GAAMC,KAAMxM,GAA8ByM,QAASzO,EAACoN,GAAa,CAAA,KAClEpN,EAACuO,EAAK,CAACC,KAAMxM,GAAgCyM,QAASzO,EAACuH,GAAmB,CAAA,KAC1EvH,EAACuO,EAAK,CAACC,KAAMxM,GAA8ByM,QAASzO,EAAC4N,GAAa,CAAA,KAClE5N,EAACuO,EAAK,CAACC,KAAK,IAAIC,QAASzO,EAAC0O,GAASC,GAAI3M,GAAsBxN","x_google_ignoreList":[15]}
@@ -1,4 +1,4 @@
1
- import { CurrentUserResult, FinishOAuthLoginInput, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from '../client/createSeamlessAuthClient';
1
+ import { CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, PasskeyMetadata, PasskeyRegistrationData, RegisterPasskeyOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from '../client/createSeamlessAuthClient';
2
2
  import type { SeamlessAuthResult } from '../client/result';
3
3
  import { PasskeyPrfInput } from '../client/webauthnPrf';
4
4
  import { Credential, Organization, User } from '../types';
@@ -17,6 +17,7 @@ export interface AuthSessionState {
17
17
  export interface AuthSessionActions {
18
18
  login: (identifier: string, passkeyAvailable: boolean) => Promise<SeamlessAuthResult<LoginStartResult>>;
19
19
  handlePasskeyLogin: () => Promise<SeamlessAuthResult<PasskeyLoginData>>;
20
+ registerPasskey: (input: PasskeyMetadata | RegisterPasskeyOptions) => Promise<SeamlessAuthResult<PasskeyRegistrationData>>;
20
21
  refreshSession: () => Promise<SeamlessAuthResult<CurrentUserResult>>;
21
22
  logout: () => Promise<SeamlessAuthResult<MessageResult>>;
22
23
  logoutAllSessions: () => Promise<SeamlessAuthResult<MessageResult>>;
@@ -26,7 +27,7 @@ export interface AuthSessionActions {
26
27
  switchOrganization: (organizationId: string) => Promise<SeamlessAuthResult<OrganizationSwitchResult>>;
27
28
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
28
29
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
29
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
30
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
30
31
  refreshStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
31
32
  verifyStepUpWithPasskey: () => Promise<SeamlessAuthResult<StepUpStatus>>;
32
33
  verifyStepUpWithPasskeyPrf: (input: PasskeyPrfInput) => Promise<SeamlessAuthResult<StepUpPrfData>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamless-auth/react",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "A drop-in authentication solution for modern React applications.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -102,7 +102,7 @@
102
102
  "typescript-eslint": "^8.46.1"
103
103
  },
104
104
  "dependencies": {
105
- "@seamless-auth/types": "^0.16.0",
105
+ "@seamless-auth/types": "^0.20.0",
106
106
  "@simplewebauthn/browser": "^13.1.0",
107
107
  "eslint-plugin-license-header": "^0.9.0",
108
108
  "libphonenumber-js": "^1.12.7",