@seamless-auth/react 0.9.0 → 0.11.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,155 @@
1
1
  # @seamless-auth/react
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bd26c22: Read the `returnTo` an OAuth sign-in asked for, and land on it.
8
+
9
+ `startOAuthLogin` has taken a `returnTo` since OAuth landed here, and nothing ever read one
10
+ back. The auth server validated it against the configured origins and signed it into the
11
+ state, but `finishOAuthLogin` was typed as a bare `MessageResult`, so the whole callback body
12
+ was discarded and an adopter had no way to learn where the flow had been asked to end up.
13
+
14
+ `finishOAuthLogin` now resolves to `FinishOAuthLoginResult`, the completed OAuth response
15
+ minus its session material, for the same reason `LoginStartResult` drops it: sessions are
16
+ carried by cookies, so there is no reason to hand an adopter raw tokens. The new field on it
17
+ is `returnTo`, absent when the caller asked for nothing.
18
+
19
+ The bundled `OAuthCallback` view lands there instead of always going to `/`. This is the same
20
+ gap the magic link redirect closed in 0.10.0: the headless client could reach the feature and
21
+ an application using `AuthRoutes` could not, which is the audience least likely to be wiring
22
+ up its own client.
23
+
24
+ The view only follows a destination on its own origin. That is not the guard against an open
25
+ redirect, which the auth server already applied before signing the state; it is that these
26
+ views route with react-router, which cannot leave the application. An adopter that wants to
27
+ send someone to another origin reads `returnTo` off the result and navigates itself.
28
+
29
+ Requires `@seamless-auth/types` 0.20.0, which carries the response field and holds both
30
+ `returnTo` fields to a scheme that can be a link destination.
31
+
32
+ - 74f17d2: Let the bundled screens choose where a magic link lands.
33
+
34
+ `requestMagicLink(redirectUri)` arrived in 0.10.0, but only the headless client
35
+ path could reach it. An application using `AuthRoutes` had no way to set one, so
36
+ the deployment-wide destination was the only option for the audience least likely
37
+ to be wiring up its own client.
38
+
39
+ `AuthProvider` now takes `magicLinkRedirectUri`, and `useAuthClient()` hands it to
40
+ the client as the default for every send. `SeamlessAuthClientOptions` carries the
41
+ same field, so a directly constructed client can do this too.
42
+
43
+ The destination lives on the client rather than at each call site on purpose. The
44
+ sign-in screen and the resend on the "check your email" screen both send with no
45
+ argument, so they cannot disagree about where the link goes. A resend that landed
46
+ somewhere other than the link it repeats would be a confusing failure and an easy
47
+ one to miss in review.
48
+
49
+ Nothing changes if you omit it: the same empty body is sent and the deployment's
50
+ own destination still applies. An explicit `requestMagicLink(uri)` still wins over
51
+ the configured default.
52
+
53
+ - eb10397: Stop painting the disabled submit button as a filled grey primary.
54
+
55
+ On the sign-in and MFA screens the submit button was disabled until its field
56
+ validated, and while disabled it was filled with `--seamless-disabled` while the
57
+ label kept `--seamless-accent-contrast`. Those two colours were chosen in
58
+ different places, so no value a themed app could supply worked in both a light
59
+ and a dark theme: lighten the fill and the label washed out, darken it and the
60
+ label went near-black on dark. The result read as a primary button that had
61
+ broken rather than a control waiting on input.
62
+
63
+ The disabled state is now the enabled button at reduced opacity. Label and
64
+ background stay on the accent pair the app already tuned, so their contrast
65
+ cannot invert with the theme, and the control reads as inactive instead of
66
+ broken. This matches how the magic-link and passkey screens already draw their
67
+ disabled buttons.
68
+
69
+ `--seamless-disabled` is no longer read anywhere and has been dropped from the
70
+ token table. If you set it, remove it; every other token behaves as before.
71
+
72
+ The sign-in screen now also says why the button is refusing, in a live region
73
+ below it that reports whether the field is empty, incomplete, or ready. A
74
+ disabled button is not focusable and is passed over by screen readers, so the
75
+ refusal was previously silent for the people least able to guess the reason.
76
+
77
+ Fixing that surfaced a related bug: a valid email typed in registration left the
78
+ Login button enabled after switching to sign-in, even with the identifier field
79
+ empty, because the submit check fell through to the registration field. Each
80
+ mode now checks only its own field.
81
+
82
+ ## 0.10.0
83
+
84
+ ### Minor Changes
85
+
86
+ - 17a657d: Let a caller choose where a magic link lands.
87
+
88
+ `requestMagicLink` takes an optional `redirectUri`. A deployment serving both a web
89
+ app and a mobile app previously had one destination for every magic link, so a link
90
+ had to arrive in one or the other.
91
+
92
+ The value goes in the request body the client already sends. The deployment validates
93
+ it against its configured origins and refuses anything else, so this cannot be used to
94
+ point a link on the tenant's domain somewhere it should not go, and a refusal comes
95
+ back as an ordinary error result.
96
+
97
+ Omit it and nothing changes: the same empty body is sent, so the destination stays the
98
+ deployment's own and no caller has to do anything.
99
+
100
+ Needs a `@seamless-auth/server` adapter that forwards the field and an auth API that
101
+ understands it. Against older versions the value is dropped and the link keeps the
102
+ deployment's destination, which is the behaviour today.
103
+
104
+ - 4199d52: Add `getPasskeyPolicyErrorCode()`, which reads the code a refused passkey
105
+ registration carries (`attachment_not_allowed`, `synced_passkey_not_allowed`,
106
+ `authenticator_not_allowed`, or `prf_required`) so an app can explain the
107
+ refusal instead of rendering the raw code from `error.message`. Unrecognized
108
+ codes return `undefined`, so a refusal from a newer API keeps your generic
109
+ messaging.
110
+
111
+ The `PasskeyPolicyErrorCode` union is derived from `WebAuthnErrorCode` in
112
+ `@seamless-auth/types`, so the codes this recognizes cannot drift from the ones
113
+ the API sends.
114
+
115
+ This matters on a default deployment: the API's
116
+ `authenticator_policy.syncedPasskeys` defaults to `block`, and passkeys created
117
+ by iCloud Keychain or Google Password Manager are backup eligible, so the most
118
+ common consumer passkey is refused at registration.
119
+
120
+ - 8690cb0: Drop the naming step from the bundled passkey enrolment view.
121
+
122
+ Choosing "Register Passkey" (or "Use a security key instead") opened a modal asking for a
123
+ friendly name, and the browser's own passkey prompt only appeared once that form was
124
+ submitted. A user who came to the screen to press one button was handed a text field
125
+ first, at the point in the flow where they had the least idea what to type.
126
+
127
+ Registration now starts on the click. The credential still carries a `friendlyName`, and
128
+ the view fills it with the device the passkey was enrolled on (`mac • chrome`), which is
129
+ what the naming prompt suggested people write anyway. Renaming stays available through
130
+ `updateCredential`.
131
+
132
+ Nothing in the public API moves: `PasskeyMetadata.friendlyName` is unchanged and callers
133
+ building their own enrolment screen keep setting it themselves. Only the bundled
134
+ `/register-passkey` view changes, so an adopter relying on that screen to collect a name
135
+ needs their own screen for it.
136
+
137
+ - fa27861: `registerPasskey()` accepts an `attachment`, so a caller can ask for a roaming
138
+ authenticator (`cross-platform`, a USB or NFC security key) or the one built
139
+ into the device (`platform`) instead of leaving the choice to the browser's
140
+ picker. The bundled enrolment view offers a "Use a security key instead" control
141
+ that takes this path, and explains a policy refusal rather than showing a
142
+ generic failure.
143
+
144
+ Omitting the option sends no query parameter, so the deployment's
145
+ `authenticator_policy.attachment` stays in charge and current behaviour is
146
+ unchanged. It is a request rather than an override: a deployment that pins the
147
+ other kind refuses the registration with `attachment_not_allowed`, which
148
+ `getPasskeyPolicyErrorCode()` reads.
149
+
150
+ `PasskeyAttachment` is exported, and is derived from the deployment policy type
151
+ in `@seamless-auth/types` rather than restating its members.
152
+
3
153
  ## 0.9.0
4
154
 
5
155
  ### Minor Changes
package/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  - `SeamlessAuthError`, the error type carried on a failed result
21
21
  - `getOAuthErrorCode()`, which reads the known OAuth callback failure codes off that error
22
22
  - `getWebAuthnErrorDetail()`, which reads the underlying failure of a passkey or step-up ceremony
23
+ - `getPasskeyPolicyErrorCode()`, which reads the code the API refused a passkey registration with
23
24
  - types including `AuthContextType`, `Credential`, `User`, `OAuthProvider`, `StepUpStatus`, the `SeamlessAuthResult` wrapper, and the headless client input/result types
24
25
 
25
26
  ## Installation
@@ -177,6 +178,25 @@ async function completeLogin() {
177
178
 
178
179
  To disable this auto-detection entirely, pass `autoDetectPreviousSignin={false}` to `AuthProvider`.
179
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
+
180
200
  ### Scoped roles
181
201
 
182
202
  `hasRole(role)` remains an exact role check. Use `hasScopedRole(role)` for colon-separated scoped
@@ -553,6 +573,86 @@ switch (detail?.name) {
553
573
  `getWebAuthnErrorDetail()` returns `undefined` for any error that did not come from a ceremony, so an
554
574
  HTTP failure keeps flowing through `error.message` and `error.body` as usual.
555
575
 
576
+ ### Choosing the authenticator
577
+
578
+ By default the browser offers every kind of authenticator the deployment enrols, which is what
579
+ `authenticator_policy.attachment: 'any'` means on the API. Pass `attachment` to narrow the picker to
580
+ one kind, for example to send someone straight to an issued security key rather than leaving them to
581
+ find it in a browser dialog:
582
+
583
+ ```ts
584
+ import { getPasskeyPolicyErrorCode } from '@seamless-auth/react';
585
+
586
+ const { error } = await authClient.registerPasskey({
587
+ metadata,
588
+ attachment: 'cross-platform',
589
+ });
590
+
591
+ if (getPasskeyPolicyErrorCode(error) === 'attachment_not_allowed') {
592
+ // This deployment pins the other kind. Fall back to the default path.
593
+ }
594
+ ```
595
+
596
+ `'cross-platform'` is a roaming authenticator such as a USB or NFC security key. `'platform'` is the
597
+ one built into the device, such as Touch ID or Windows Hello. Omit the option to leave the choice to
598
+ the deployment.
599
+
600
+ This is a request, not an override. A deployment that has pinned
601
+ `authenticator_policy.attachment` to the other kind refuses the registration with
602
+ `attachment_not_allowed`, covered below. The bundled enrolment view offers a "Use a security key
603
+ instead" control that takes this path.
604
+
605
+ ### Passkey policy refusals
606
+
607
+ A registration can also be refused by the policy the API is configured with. `registerPasskey()`
608
+ then fails with a body whose `error` is a stable code rather than a sentence, so rendering
609
+ `error.message` would put that code in front of a user. Use `getPasskeyPolicyErrorCode()` to branch
610
+ on it:
611
+
612
+ ```ts
613
+ import { getPasskeyPolicyErrorCode } from '@seamless-auth/react';
614
+
615
+ const { error } = await authClient.registerPasskey({ token, metadata });
616
+
617
+ switch (getPasskeyPolicyErrorCode(error)) {
618
+ case 'attachment_not_allowed':
619
+ // The requested `attachment` is not the kind this deployment enrols.
620
+ break;
621
+ case 'synced_passkey_not_allowed':
622
+ // This passkey syncs to iCloud Keychain or Google Password Manager, and
623
+ // this deployment requires a device-bound one such as a security key.
624
+ break;
625
+ case 'authenticator_not_allowed':
626
+ // This authenticator model is not permitted here.
627
+ break;
628
+ case 'prf_required':
629
+ // Registration asked for PRF and the authenticator does not support it.
630
+ break;
631
+ default:
632
+ // No error, or one without a recognized code. Fall back to error?.message.
633
+ break;
634
+ }
635
+ ```
636
+
637
+ | Code | Stage | Status | When the API sends it |
638
+ | ---------------------------- | --------------- | ------ | -------------------------------------------------------------------------------------------- |
639
+ | `attachment_not_allowed` | register/start | 400 | the requested `attachment` is not the kind `authenticator_policy.attachment` pins |
640
+ | `synced_passkey_not_allowed` | register/finish | 403 | `authenticator_policy.syncedPasskeys` is `block` and the credential is backup eligible |
641
+ | `authenticator_not_allowed` | register/finish | 403 | the credential's AAGUID is on `aaguidDenyList`, or absent from a non-empty `aaguidAllowList` |
642
+ | `prf_required` | register/finish | 403 | registration required PRF and the credential did not report support for it |
643
+
644
+ `attachment_not_allowed` is refused before any ceremony runs, so the browser never prompts. The rest
645
+ are refused after a credential exists and can be inspected.
646
+
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.
652
+
653
+ Like `getOAuthErrorCode()`, this returns `undefined` for anything it does not recognize, including
654
+ codes added by a newer API, so an unexpected refusal keeps your generic messaging.
655
+
556
656
  The single exception is `isPasskeySupported`-style capability checks:
557
657
  `isPasskeyPrfSupported(): Promise<boolean>` is a local check rather than a request, so it returns a
558
658
  plain boolean.
@@ -890,7 +990,6 @@ There is no provider prop or JavaScript API for this. Setting the variables is t
890
990
  | `--seamless-border` | Input, button, and panel borders | `#4b5563`, `#d1d5db` |
891
991
  | `--seamless-text` | Headings and body text | `white` |
892
992
  | `--seamless-text-muted` | Labels, helper text, secondary copy | `#9ca3af`, `#d1d5db` |
893
- | `--seamless-disabled` | Background of disabled submit buttons | `#9ca3af` |
894
993
  | `--seamless-danger` | Error messages | `#f87171` |
895
994
  | `--seamless-success` | Success messages and the verified check icon | `#34d399` |
896
995
  | `--seamless-warning` | OTP countdown and resend timers | `#facc15` |
@@ -909,6 +1008,10 @@ There is no provider prop or JavaScript API for this. Setting the variables is t
909
1008
  - Two decorative tints are deliberately not tokenised: the pulse ring behind the magic-link mail icon
910
1009
  and the disc behind the success check. Both are translucent and sit directly under an icon, so an
911
1010
  opaque override would hide the icon it is meant to frame.
1011
+ - Disabled buttons are not a separate colour. They are the enabled button at reduced opacity, so the
1012
+ label and its background always come from the same accent pair you set and the contrast between
1013
+ them cannot invert when the theme changes. `--seamless-disabled` used to set a standalone grey fill
1014
+ and no longer does anything; remove it from your overrides.
912
1015
  - The package ships one palette and no `prefers-color-scheme` rules. If you want the auth UI to follow
913
1016
  the system theme, wrap your own overrides in a media query.
914
1017
 
@@ -967,6 +1070,11 @@ The state-changing OTP and magic-link request routes are `POST` (marked above).
967
1070
  email sends to a signed-in user. Using `@seamless-auth/react` with an older adapter that only serves the
968
1071
  `GET` forms returns a 404 for those requests. See the changelog for the minimum adapter version.
969
1072
 
1073
+ `/webAuthn/register/finish` can refuse a verified credential on policy grounds with a `403` whose
1074
+ body is a stable code. `syncedPasskeys` defaults to `allow`, but a deployment that sets `block`
1075
+ refuses every backup-eligible passkey, so handle the code rather than assuming the default. See
1076
+ [Passkey policy refusals](#passkey-policy-refusals).
1077
+
970
1078
  ## Notes
971
1079
 
972
1080
  - This package does not create its own `<BrowserRouter>`.
@@ -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, 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,7 +22,7 @@ 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>>;
@@ -42,6 +43,11 @@ interface AuthProviderProps {
42
43
  children: ReactNode;
43
44
  apiHost: string;
44
45
  autoDetectPreviousSignin?: boolean;
46
+ /**
47
+ * Where a magic link sent by the bundled screens should land. Both the first
48
+ * send and a resend read it from here, so the two cannot drift apart.
49
+ */
50
+ magicLinkRedirectUri?: string;
45
51
  }
46
52
  export declare const AuthProvider: React.FC<AuthProviderProps>;
47
53
  export {};
@@ -1,8 +1,14 @@
1
- import type { AddOrganizationMemberRequest, CreateOrganizationRequest, CredentialUpdateResponse, LoginMethod as LoginMethodShape, LoginSuccessResponse, LogoutScope as LogoutScopeShape, MeResponse, MessageResponse, OAuthProvidersResponse, OrganizationEnvelopeResponse, OrganizationListResponse, OrganizationMembersResponse, OrganizationMembershipEnvelopeResponse, OrganizationSwitchResponse, PublicOAuthProvider, PublicSystemConfigResponse, RegistrationRequest, StartOAuthLoginResponse, StepUpMethod as StepUpMethodShape, StepUpStatus as StepUpStatusShape, TotpEnrollmentStartResponse, TotpStatus as TotpStatusShape, UpdateOrganizationMemberRequest, UpdateOrganizationRequest } from '@seamless-auth/types';
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. */
@@ -69,10 +86,27 @@ export interface PasskeyRegistrationData {
69
86
  }
70
87
  /** Response body returned when credential metadata is updated. */
71
88
  export type CredentialUpdateResult = CredentialUpdateResponse;
89
+ /**
90
+ * Which kind of authenticator to offer at registration. Omitting it leaves the
91
+ * choice to the deployment's `authenticator_policy.attachment`, which offers
92
+ * both kinds by default.
93
+ *
94
+ * Derived from the deployment policy type rather than restating its members:
95
+ * `any` is a standing default a deployment sets, not something a single request
96
+ * can ask for, so the request type is that policy minus that one member.
97
+ */
98
+ export type PasskeyAttachment = Exclude<AuthenticatorAttachmentPolicy, 'any'>;
72
99
  export interface RegisterPasskeyOptions {
73
100
  metadata: PasskeyMetadata;
74
101
  requestPrf?: boolean;
75
102
  requirePrf?: boolean;
103
+ /**
104
+ * Narrows the browser picker to one kind of authenticator, for example
105
+ * `cross-platform` to send a user straight to an issued security key. A
106
+ * deployment that has pinned a different kind refuses this, so it is a
107
+ * request rather than an override.
108
+ */
109
+ attachment?: PasskeyAttachment;
76
110
  }
77
111
  export type StepUpMethod = StepUpMethodShape;
78
112
  export type TotpStatus = TotpStatusShape;
@@ -114,13 +148,19 @@ export interface SeamlessAuthClient {
114
148
  verifyEmailOtp: (verificationToken: string) => Promise<SeamlessAuthResult<MessageResult>>;
115
149
  requestLoginEmailOtp: () => Promise<SeamlessAuthResult<MessageResult>>;
116
150
  verifyLoginEmailOtp: (verificationToken: string) => Promise<SeamlessAuthResult<MessageResult>>;
117
- requestMagicLink: () => Promise<SeamlessAuthResult<MessageResult>>;
151
+ /**
152
+ * @param redirectUri Where the emailed link should land. The deployment validates
153
+ * it against its configured origins and refuses anything else, so a tenant serving
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.
156
+ */
157
+ requestMagicLink: (redirectUri?: string) => Promise<SeamlessAuthResult<MessageResult>>;
118
158
  checkMagicLink: () => Promise<SeamlessAuthResult<MessageResult>>;
119
159
  verifyMagicLink: (token: string) => Promise<SeamlessAuthResult<MessageResult>>;
120
160
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
121
161
  getPublicSystemConfig: () => Promise<SeamlessAuthResult<PublicSystemConfigResult>>;
122
162
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
123
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
163
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
124
164
  registerPasskey: (input: PasskeyMetadata | RegisterPasskeyOptions) => Promise<SeamlessAuthResult<PasskeyRegistrationData>>;
125
165
  isPasskeyPrfSupported: () => Promise<boolean>;
126
166
  getStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
@@ -1,4 +1,4 @@
1
- import type { OAuthErrorCode as OAuthErrorCodeShape } from '@seamless-auth/types';
1
+ import type { OAuthErrorCode as OAuthErrorCodeShape, WebAuthnErrorCode as WebAuthnErrorCodeShape } from '@seamless-auth/types';
2
2
  /**
3
3
  * Error carrying the auth server's response detail, so callers can map known
4
4
  * failures to their own messaging instead of only seeing a generic string.
@@ -29,6 +29,28 @@ export type OAuthErrorCode = OAuthErrorCodeShape;
29
29
  * downgrade OAuth messaging to a generic failure.
30
30
  */
31
31
  export declare function getOAuthErrorCode(error: unknown): OAuthErrorCode | undefined;
32
+ /**
33
+ * Machine-readable codes registration is refused with when a deployment will not
34
+ * enrol the authenticator on policy grounds.
35
+ *
36
+ * `attachment_not_allowed` comes from register/start with a `400`, before any
37
+ * ceremony runs. The rest come from register/finish with a `403`, once the
38
+ * credential exists and can be inspected.
39
+ */
40
+ export type PasskeyPolicyErrorCode = Exclude<WebAuthnErrorCodeShape, 'prf_output_not_allowed'>;
41
+ /**
42
+ * Read the passkey policy refusal off a registration error, from either stage of
43
+ * the ceremony. Returns `undefined` for anything unrecognized, including codes
44
+ * added by a newer API, so callers keep their generic messaging instead of
45
+ * showing a raw code.
46
+ *
47
+ * The auth API sends the code as the whole of `error`, which is also what
48
+ * becomes `error.message`. A proxy in front of it may instead derive a
49
+ * human-readable `error` and keep the upstream body under `details`, so an
50
+ * unrecognized top-level value falls through to the nested one rather than
51
+ * ending the lookup.
52
+ */
53
+ export declare function getPasskeyPolicyErrorCode(error: unknown): PasskeyPolicyErrorCode | undefined;
32
54
  /**
33
55
  * Detail recovered from a failed WebAuthn ceremony.
34
56
  *
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, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from './client/createSeamlessAuthClient';
4
- import { getOAuthErrorCode, getWebAuthnErrorDetail, OAuthErrorCode, SeamlessAuthError, WebAuthnErrorDetail } from './client/errors';
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, 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, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, useLoginMethods, usePasskeySupport, };
13
- export type { CredentialUpdateResult, AuthContextType, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthErrorCode, OAuthProvider, OAuthProvidersResult, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyMetadata, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, PublicSystemConfigResult, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput, User, WebAuthnErrorDetail, };
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, 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 a,bufferToBase64URLString as o,base64URLStringToBuffer as n,startAuthentication as i,startRegistration as s,WebAuthnError as l}from"@simplewebauthn/browser";import{createContext as d,useMemo as c,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 v,useSearchParams as b,Routes as k,Route as x,Navigate as w}from"react-router-dom";import P from"libphonenumber-js";class S extends Error{constructor(e,t,r,a){super(e),this.name="SeamlessAuthError",this.status=t,this.body=r,this.cause=a}}const N={oauth_missing_email:!0,oauth_email_not_verified:!0,oauth_missing_subject:!0};function O(e){if("object"==typeof e&&null!==e)return e.code}function T(e){if(!(e instanceof S))return;if("object"!=typeof e.body||null===e.body)return;const t=O(e.body)??O(e.body.details);return"string"==typeof t&&Object.prototype.hasOwnProperty.call(N,t)?t:void 0}function C(e){if(!(e instanceof S)||("object"!=typeof(t=e.cause)||null===t||"string"!=typeof t.name))return;var t;const{name:r,code:a,message:o}=e.cause;return{name:r,code:"string"==typeof a?a:void 0,message:"string"==typeof o?o:""}}async function M(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 I(e){try{return await e.json()}catch{return}}async function A(e,t){let r;try{r=await e}catch{return{data:null,error:new S(t,0)}}return r.ok?{data:await I(r),error:null}:{data:null,error:await M(r,t)}}function z(e){return{data:e,error:null}}function E(e,t=0,r,a){return{data:null,error:new S(e,t,r,a)}}function F(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 U(e){return"string"==typeof e?e:o(F(e))}function L(e){return"string"==typeof e?n(e):e}function R(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:U(e.salt),...e.secondSalt?{secondSalt:U(e.secondSalt)}:{}}}}async function B(){return!!a()&&("undefined"==typeof window||!1!==window.isSecureContext)&&void 0!==globalThis.PublicKeyCredential&&"undefined"!=typeof navigator&&"function"==typeof navigator.credentials?.get}function q(e){const t=e,r=t.extensions?.prf?.eval;return r?{...t,extensions:{...t.extensions,prf:{...t.extensions?.prf,eval:{...r,...r.first?{first:L(r.first)}:{},...r.second?{second:L(r.second)}:{}}}}}:e}function j(e){const t=e.clientExtensionResults,r=t?.prf?.results?.first;if(!r)return null;const a=(n=r)instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);var n;return{credentialId:e.id,output:a,outputBase64url:o(F(a))}}function J(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function G(e,t){const r=e.method===t?e.method:null;return"Success"===e.message&&!0===e.fresh&&null!==r?z({fresh:!0,method:r,verifiedAt:e.verifiedAt??null,expiresAt:e.expiresAt??null,maxAgeSeconds:e.maxAgeSeconds??0}):E(e.message??"Step-up authentication failed.")}function D(e){return e?{method:"POST",body:JSON.stringify(R(e))}:{method:"POST"}}function W(e,t,r){const a=E(t,0,void 0,r),o=C(a.error);return console.error(e,o?.name??"Unknown error."),a}const $=e=>{const t=(e=>{const{authHost:t}=e;return async function(e,r){const a=`${t?.replace(/\/+$/,"")??""}/auth${e.startsWith("/")?e:`/${e}`}`,o=null!=r?.body,n={...r,credentials:"include",headers:{...o?{"Content-Type":"application/json"}:{},...r?.headers}};return fetch(a,n)}})({authHost:e.apiHost});return{getCurrentUser:()=>A(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>A(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const r=await A(t("/webAuthn/login/start",{...D(e?.prf)}),"Failed to start passkey login.");if(r.error)return r;let a,o;try{const e=await i({optionsJSON:q(r.data)});a=j(e),o=J(e)}catch(e){return W("Passkey login error.","Passkey login failed.",e)}const n=await A(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:o})}),"Failed to verify passkey.");return n.error?n:"Success"!==n.data?.message?E(n.data?.message??"Passkey login failed."):z(a?{prf:a}:{})},logout:(e={})=>A(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>A(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>A(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>A(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>A(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>A(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>A(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>A(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>A(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>A(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>A(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>A(t("/otp/verify-login-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestMagicLink:()=>A(t("/magic-link",{method:"POST",body:JSON.stringify({})}),"Failed to send the magic link."),checkMagicLink:()=>A(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>A(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>A(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),getPublicSystemConfig:()=>A(t("/system-config/public",{method:"GET"}),"Failed to read the public system configuration."),startOAuthLogin:e=>A(t(`/oauth/${encodeURIComponent(e.providerId)}/start`,{method:"POST",body:JSON.stringify({...e.redirectUri?{redirectUri:e.redirectUri}:{},...e.returnTo?{returnTo:e.returnTo}:{}})}),"Failed to start OAuth login."),finishOAuthLogin:e=>A(t(`/oauth/${encodeURIComponent(e.providerId)}/callback`,{method:"POST",body:JSON.stringify({code:e.code,state:e.state})}),"Failed to finish OAuth login."),registerPasskey:async e=>{const r=function(e){return"metadata"in e?e:{metadata:e}}(e),a=await A(t(function(e){const t=new URLSearchParams;e.requirePrf?t.set("requirePrf","true"):e.requestPrf&&t.set("requestPrf","true");const r=t.toString();return"/webAuthn/register/start"+(r?`?${r}`:"")}(r),{method:"GET"}),"Failed to fetch passkey registration challenge.");if(a.error)return a;let o;try{o=await s({optionsJSON:a.data})}catch(e){return e instanceof l?E(e.name,0,void 0,e):W("Passkey registration error.","Passkey registration failed.",e)}const n=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(o),i=await A(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:o,metadata:{...r.metadata,prfCapable:n}})}),"Verification failed.");return i.error?i:z({credentialId:o.id,prfCapable:n})},isPasskeyPrfSupported:B,getStepUpStatus:()=>A(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await A(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let r;try{r=J(await i({optionsJSON:q(e.data)}))}catch(e){return W("Step-up authentication error.","Step-up authentication failed.",e)}const a=await A(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify step-up authentication.");return a.error?a:G(a.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const r=await A(t("/step-up/webauthn/start",{...D(e)}),"Failed to start step-up authentication.");if(r.error)return r;let a,o;try{const e=await i({optionsJSON:q(r.data)});a=j(e),o=J(e)}catch(e){return W("Step-up authentication error.","Step-up authentication failed.",e)}if(!a)return E("Passkey did not return PRF output.");const n=await A(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:o})}),"Failed to verify step-up authentication.");if(n.error)return n;const s=G(n.data??{},"webauthn");return s.error?s:z({...s.data,credentialId:a.credentialId,prf:a})},getTotpStatus:()=>A(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>A(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>A(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>A(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const r=await A(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return r.error?r:G(r.data??{},"totp")},updateCredential:e=>A(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>A(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>A(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>A(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>A(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,r)=>A(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(r)}),"Failed to update organization."),switchOrganization:e=>A(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>A(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,r)=>A(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(r)}),"Failed to add organization member."),updateOrganizationMember:(e,r,a)=>A(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify(a)}),"Failed to update organization member."),removeOrganizationMember:(e,r)=>A(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function V(e,t){const r=e.trim(),a=t.trim();if(!r||!a)return!1;if(r===a)return!0;if(r.endsWith(":*")){const e=r.slice(0,-2);return a===e||a.startsWith(`${e}:`)}if(!a.includes(":"))return!1;if(!r.includes(":"))return a.startsWith(`${r}:`);const o=r.split(":"),n=a.split(":"),i=o[o.length-1],s=n[n.length-1],l=o.slice(0,-1),d=n.slice(0,-1);return"write"===i&&"read"===s&&l.length===d.length&&l.every((e,t)=>e===d[t])}function K(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=>V(t,e)))}function H(){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 Y="seamlessauth_seen",Q={user:null,credentials:[],organizations:[],activeOrganization:null,stepUpStatus:null,isAuthenticated:!1};const Z=d(void 0),X=()=>{const e=_(Z);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},ee=({children:t,apiHost:r,autoDetectPreviousSignin:a=!0})=>{const o=c(()=>function(e){const{apiHost:t,detectPreviousSignIn:r=!0}=e,a=$({apiHost:t}),o=e.storage??H(),n=new Set;let i=!1,s=0,l={...Q,loading:!0,hasSignedInBefore:r&&"true"===o.get(Y)};function d(e){const t={...l,...e};Object.keys(e).some(e=>l[e]!==t[e])&&(l=t,n.forEach(e=>e()))}function c(){o.set(Y,"true"),r&&d({hasSignedInBefore:!0})}function u(){d(Q)}async function m(){const e=++s;d({loading:!0});const t=await a.getCurrentUser();return i||e!==s?t:t.error?(u(),d({loading:!1}),t):(d({user:t.data.user,credentials:t.data.credentials??[],organizations:t.data.organizations??[],activeOrganization:t.data.activeOrganization??null,isAuthenticated:!0,loading:!1}),l.hasSignedInBefore||c(),t)}async function _(e){const t=await e();return t.error||await m(),t}return{getState:()=>l,subscribe:e=>(n.add(e),()=>{n.delete(e)}),actions:{login:(e,t)=>a.login({identifier:e,passkeyAvailable:t}),handlePasskeyLogin:()=>_(()=>a.loginWithPasskey()),refreshSession:m,logout:async function(){try{return await a.logout()}finally{u()}},logoutAllSessions:async function(){try{return await a.logoutAllSessions()}finally{u()}},deleteUser:async()=>{const e=await a.deleteUser();return e.error||u(),e},updateCredential:async e=>{const{data:t,error:r}=await a.updateCredential({friendlyName:e.friendlyName??null,id:e.id});if(r)return{data:null,error:r};const o=t.credential;return d({credentials:l.credentials.map(e=>e.id===o.id?{...e,...o}:e)}),{data:o,error:null}},deleteCredential:async e=>{const t=await a.deleteCredential(e);return t.error||d({credentials:l.credentials.filter(t=>t.id!==e)}),t},switchOrganization:e=>_(()=>a.switchOrganization(e)),listOAuthProviders:()=>a.listOAuthProviders(),startOAuthLogin:e=>a.startOAuthLogin(e),finishOAuthLogin:e=>_(()=>a.finishOAuthLogin(e)),refreshStepUpStatus:async()=>{const e=await a.getStepUpStatus();return d({stepUpStatus:e.error?null:e.data}),e},verifyStepUpWithPasskey:async()=>{const e=await a.verifyStepUpWithPasskey();return e.error||d({stepUpStatus:e.data}),e},verifyStepUpWithPasskeyPrf:async e=>{const t=await a.verifyStepUpWithPasskeyPrf(e);return t.error||d({stepUpStatus:{fresh:t.data.fresh,method:t.data.method,verifiedAt:t.data.verifiedAt,expiresAt:t.data.expiresAt,maxAgeSeconds:t.data.maxAgeSeconds}}),t},verifyStepUpWithTotp:async e=>{const t=await a.verifyStepUpWithTotp(e);return t.error||d({stepUpStatus:t.data}),t},hasRole:e=>l.user?.roles?.includes(e),hasScopedRole:e=>l.user?K(l.user.roles,e):void 0,markSignedIn:c},destroy:()=>{i=!0,n.clear()}}}({apiHost:r,detectPreviousSignIn:a}),[r,a]),n=u(o.subscribe,o.getState,o.getState);m(()=>{o.actions.refreshSession()},[o]);const i=c(()=>({...n,...o.actions,apiHost:r}),[n,o,r]);return e(Z.Provider,{value:i,children:t})},te=()=>{const{apiHost:e}=X();return c(()=>$({apiHost:e}),[e])},re=["passkey","magic_link"],ae=()=>{const e=te(),[t,r]=g(null),[a,o]=g(!0);return m(()=>{let t=!0;return(async()=>{try{const{data:a,error:o}=await e.getPublicSystemConfig();t&&!o&&a?.loginMethods?.length&&r(a.loginMethods)}catch{}finally{t&&o(!1)}})(),()=>{t=!1}},[e]),{loginMethods:t,loading:a}},oe=e=>Boolean(e?.some(e=>"passkey"!==e)),ne=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[a,o]=r;return!(!/^[A-Za-z0-9._%+-]+$/.test(a)||a.startsWith(".")||a.endsWith(".")||a.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(o)||o.startsWith("-")||o.endsWith("-")||o.startsWith(".")||o.endsWith(".")||o.includes(".."))},ie=e=>{const t=P(e);return t?.isValid()||!1};async function se(){return async function(){if("undefined"==typeof window)return!1;if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return console.error("Error checking passkey support."),!1}return!1}()}const le=()=>{const[e,t]=g(!1),[r,a]=g(!0);return m(()=>{let e=!0;return(async()=>{try{const r=await se();e&&t(r)}catch{e&&t(!1)}finally{e&&a(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:r}},de="/login",ce="/passkey-login",ue="/verify-phone-otp",me="/verify-email-otp",_e="/verify-magiclink",ge="/oauth/callback",pe="/register-passkey",fe="/magic-link-sent";function he(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var ye="login-module__container___YggDx",ve="login-module__card___Ub-Py",be="login-module__heading___neEqb",ke="login-module__inputGroup___P6qgS",xe="login-module__label___mx5vu",we="login-module__input___U07lW",Pe="login-module__helperText___kDQ4-",Se="login-module__error___40zxh",Ne="login-module__button___0kFBs",Oe="login-module__toggle___1JiG1",Te="login-module__fallbackCard___HdIk-",Ce="login-module__fallbackHeader___-il2v",Me="login-module__fallbackDescription___ea5EB",Ie="login-module__fallbackActions___AD3ni",Ae="login-module__fallbackActionButton___lFgWf",ze="login-module__actionTitle___ycrMp",Ee="login-module__actionSubtext___opaIV",Fe="login-module__linkButton___5lsoe";he(".login-module__container___YggDx{align-items:center;color: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 Ue=({identifier:r,onMagicLink:a,onEmailOtp:o,onPhoneOtp:n,onPasskeyRetry:i,loginMethods:s})=>{const l=new Set(s??["passkey","magic_link","phone_otp"]),d=l.has("magic_link")&&ne(r),c=l.has("email_otp")&&Boolean(o)&&ne(r),u=l.has("phone_otp")&&ie(r),m=l.has("passkey")&&Boolean(i);return d||c||u||m?t("div",{className:Te,children:[e("div",{className:Ce,children:"Choose a sign-in method"}),e("p",{className:Me,children:"Choose another secure sign-in method."}),t("div",{className:Ie,children:[d&&t("button",{type:"button",className:Ae,onClick:a,children:[e("span",{className:ze,children:"Email Magic Link"}),e("span",{className:Ee,children:"Send a secure sign-in link to your email"})]}),c&&t("button",{type:"button",className:Ae,onClick:o,children:[e("span",{className:ze,children:"Email Code"}),e("span",{className:Ee,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:Ae,onClick:n,children:[e("span",{className:ze,children:"Text Message Code"}),e("span",{className:Ee,children:"Receive a one-time code via SMS"})]})]}),m&&e("button",{type:"button",className:Fe,onClick:i,children:"Try passkey anyway"})]}):null},Le="seamless:oauth:provider",Re=()=>{const{listOAuthProviders:r,startOAuthLogin:a}=X(),o=h("/oauth/callback"),[n,i]=g([]),[s,l]=g("");if(m(()=>{let e=!0;return r().then(({data:t})=>{e&&i(t?.providers??[])}),()=>{e=!1}},[r]),0===n.length)return null;return t("div",{className:Ie,children:[n.map(r=>e("button",{type:"button",className:Ae,onClick:()=>(async e=>{l(""),sessionStorage.setItem(Le,e);const{data:t,error:r}=await a({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:ze,children:["Continue with ",r.name]})},r.id)),s&&e("p",{className:Se,children:s})]})},Be=()=>{const a=y(),{hasSignedInBefore:o,login:n,handlePasskeyLogin:i}=X(),s=te(),{passkeySupported:l}=le(),{loginMethods:d}=ae(),[c,u]=g(""),[_,p]=g(""),[f,h]=g("register"),[v,b]=g(""),[k,x]=g(""),[w,P]=g(""),[S,N]=g(!1),[O,T]=g(null);m(()=>{o&&h("login")},[o]);return e("div",{className:ye,children:t("div",{className:ve,children:[e("h2",{className:be,children:"login"===f?"Sign In":"Create Account"}),t(r,{children:[t("form",{onSubmit:async e=>{e.preventDefault(),b(""),N(!1);try{if("login"===f){const{data:e,error:t}=await n(c,l);if(t)return void b("Failed to start sign-in. Please try again.");const r=e?.loginMethods?.length?e.loginMethods:d??re;if(T(r),l&&r.includes("passkey")){const{error:e}=await i();return e?(N(!0),void b("Passkey sign-in could not be completed. Choose another sign-in method.")):void a("/")}return void N(!0)}"register"===f&&await(async()=>{b("");const{data:e,error:t}=await s.register({email:_});t?b("Failed to register. Please try again."):"Success"===e.message?a(me):b("An unexpected error occurred. Try again. If the problem persists, contact support.")})()}catch{console.error("Failed to continue sign-in."),b("Failed to continue sign-in. Please try again.")}},children:["login"===f&&t("div",{className:ke,children:[e("label",{htmlFor:"identifier",className:xe,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:c,onChange:e=>{const t=e.target.value;u(t)},autoComplete:"off",placeholder:"Email or Phone Number",className:we,onBlur:()=>{if(c){const e=ne(c)||ie(c);P(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:Pe,children:"Phone numbers must include a country code e.g. +1"}),S&&e(Ue,{identifier:c,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?b("Failed to send magic link."):a(fe,{state:{identifier:c}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?b("Failed to send email code."):a(me,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?b("Failed to send OTP."):a(ue,{state:{flow:"login"}})},onPasskeyRetry:l?i:void 0,loginMethods:O}),w&&e("p",{className:Se,children:w})]}),"register"===f&&t("div",{className:ke,children:[e("label",{htmlFor:"email",className:xe,children:"Email Address"}),e("input",{id:"email",type:"email",value:_,onChange:e=>{const t=e.target.value;p(t)},autoComplete:"off",className:we,onBlur:()=>{if(_){const e=ne(_);x(e?"":"Please enter a valid email")}},required:!0}),k&&e("p",{className:Se,children:k})]}),e("button",{type:"submit",className:Ne,disabled:!("login"===f&&c?ne(c)||ie(c):ne(_)),children:"login"===f?"Login":"Register"}),v&&e("p",{className:Se,children:v}),e("button",{type:"button",onClick:()=>h("login"===f?"register":"login"),className:Oe,children:"login"===f?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(Re,{})]})]})})};var qe={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};he(".passKeyLogin-module__container___IUKxF{align-items:center;color: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 je=()=>{const r=y(),{handlePasskeyLogin:a}=X(),[o,n]=g("");return e("div",{className:qe.container,children:t("div",{className:qe.card,children:[e("h2",{className:qe.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{n("");const{error:e}=await a();e?n("Passkey sign-in could not be completed. Try another sign-in method."):r("/")},className:qe.button,children:"Use Passkey"}),o&&e("p",{className:qe.error,children:o})]})})};var Je="registerPasskey-module__container___jqEh8",Ge="registerPasskey-module__card___MJAyC",De="registerPasskey-module__loading___Q4i1x",We="registerPasskey-module__spinner___V1nhd",$e="registerPasskey-module__supported___ihTih",Ve="registerPasskey-module__title___vn2Qu",Ke="registerPasskey-module__description___AWmO-",He="registerPasskey-module__button___D3b4B",Ye="registerPasskey-module__message___RiOw-",Qe="registerPasskey-module__success___HP5aX",Ze="registerPasskey-module__error___hGiqE",Xe="registerPasskey-module__skip___1hDyU";he(".registerPasskey-module__container___jqEh8{align-items:center;color: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}");var et="deviceNameModal-module__overlay___fmdPd",tt="deviceNameModal-module__modal___uoEda",rt="deviceNameModal-module__description___-HMTA",at="deviceNameModal-module__input___4vQMI",ot="deviceNameModal-module__actions___KXw7b",nt="deviceNameModal-module__primary___9Ozlk",it="deviceNameModal-module__secondary___HILhc";he(".deviceNameModal-module__overlay___fmdPd{align-items:center;background:var(--seamless-overlay,rgba(0,0,0,.45));display:flex;inset:0;justify-content:center;position:fixed;z-index:1000}.deviceNameModal-module__modal___uoEda{background:var(--seamless-surface,#1f2937);border-radius:12px;box-shadow:0 20px 40px var(--seamless-shadow,rgba(0,0,0,.15));color:var(--seamless-text,#fff);max-width:420px;padding:24px;width:100%}.deviceNameModal-module__description___-HMTA{color:var(--seamless-text,#fff);font-size:14px;margin-bottom:16px}.deviceNameModal-module__input___4vQMI{border:1px solid var(--seamless-border,#ddd);border-radius:8px;font-size:14px;margin-bottom:20px;padding:10px 12px;width:100%}.deviceNameModal-module__actions___KXw7b{display:flex;gap:10px;justify-content:flex-end}.deviceNameModal-module__primary___9Ozlk{background:var(--seamless-accent,#2563eb);border:none;border-radius:8px;color:var(--seamless-accent-contrast,#fff);cursor:pointer;padding:8px 14px}.deviceNameModal-module__secondary___HILhc{background:transparent;border:1px solid var(--seamless-border,#ccc);border-radius:8px;cursor:pointer;padding:8px 14px}");const st=({isOpen:r,onCancel:a,onConfirm:o})=>{const[n,i]=g("");return r?e("div",{className:et,children:t("div",{className:tt,children:[e("h3",{children:"Name This Device"}),e("p",{className:rt,children:"Give this passkey a friendly name so you can recognize it later."}),e("input",{type:"text",placeholder:"e.g., MacBook Pro, iPhone, YubiKey",value:n,onChange:e=>i(e.target.value),className:at,autoFocus:!0}),t("div",{className:ot,children:[e("button",{onClick:a,className:it,children:"Cancel"}),e("button",{onClick:()=>o(n.trim()),disabled:!n.trim(),className:nt,children:"Continue"})]})]})}):null},lt=()=>{const{refreshSession:a}=X(),o=te(),{passkeySupported:n,loading:i}=le(),{loginMethods:s,loading:l}=ae(),d=y(),[c,u]=g("idle"),[m,_]=g(""),[p,f]=g(!1),[h,v]=g(null),b=oe(s),k=async()=>{await a(),d("/")};return t(r,{children:[e("div",{className:Je,children:e("div",{className:Ge,children:t("div",i||l?{className:De,children:[e("div",{className:We}),e("span",{children:"Checking for Passkey Support..."})]}:n?{className:$e,children:[e("h2",{className:Ve,children:"Secure Your Account with a Passkey"}),e("p",{className:Ke,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>{const{platform:e,browser:t,deviceInfo:r}=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}`}}();v({platform:e,browser:t,deviceInfo:r}),f(!0)},disabled:"loading"===c,className:He,children:"loading"===c?"Registering...":"Register Passkey"}),m&&e("p",{className:`${Ye} ${"success"===c?Qe:Ze}`,children:m}),b&&e("button",{type:"button",onClick:k,disabled:"loading"===c,className:Xe,children:"Skip for now"})]}:{className:$e,children:[e("h2",{className:Ve,children:"Passkeys are not available here"}),e("p",{className:Ke,children:b?"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."}),b&&e("button",{type:"button",onClick:k,className:He,children:"Continue"})]})})}),e(st,{isOpen:p,onCancel:()=>{f(!1),v(null)},onConfirm:async e=>{if(!h)return;const t={friendlyName:e,...h};u("loading");try{const{error:e}=await o.registerPasskey(t);if(e)throw e;await a(),u("success"),_("Passkey registered successfully."),d("/")}catch{console.error("Passkey registration failed."),u("error"),_("Error registering passkey.")}finally{f(!1),v(null)}}})]})};var dt="verifyOTP-module__container___wgoDE",ct="verifyOTP-module__card___3cs2p",ut="verifyOTP-module__title___fZ-1d",mt="verifyOTP-module__subtitle___dGSu3",_t="verifyOTP-module__error___GEtlG",gt="verifyOTP-module__success___46TjG",pt="verifyOTP-module__form___jiGG-",ft="verifyOTP-module__label___Zq5Mi",ht="verifyOTP-module__timer___smq-a",yt="verifyOTP-module__resend___PlmkG",vt="verifyOTP-module__button___8pIuO",bt="verifyOTP-module__toggle___wbzVa";he(".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 kt="otpInput-module__otpContainer___MUjby",xt="otpInput-module__otpInput___3YMVm";he(".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:a="numeric",onChange:o,name:n="otp"})=>{const i=p([]),s=r.split("").concat(Array(t).fill("")).slice(0,t),l=(e,t)=>{var r;if(t.length>1)d(e,t);else if(!t||(r=t,"numeric"===a?/^\d$/.test(r):/^[a-zA-Z]$/.test(r))){const r=[...s];r[e]=t;const a=r.join("");o(a),t&&i.current[e+1]&&i.current[e+1]?.focus()}},d=(e,r)=>{let n=r;n="numeric"===a?r.replace(/\D/g,""):r.replace(/[^a-zA-Z]/g,"");const l=n.slice(0,t).split(""),d=[...s];l.forEach((r,a)=>{e+a<t&&(d[e+a]=r)}),o(d.join("")),i.current[Math.min(e+l.length,t-1)]?.focus()};return e("div",{className:kt,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),d(0,e.clipboardData.getData("text"))},children:s.map((r,d)=>e("input",{ref:e=>i.current[d]=e,type:"text",inputMode:"numeric"===a?"numeric":"text",autoComplete:"one-time-code",name:`${n}-${d}`,maxLength:1,value:r,className:xt,onChange:e=>l(d,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("")),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()})(d,e),"aria-label":`Digit ${d+1}`},d))})},Pt=()=>{const r=y(),a=v(),{refreshSession:o}=X(),n="login"===a.state?.flow,[i,s]=g(""),[l,d]=g(null),[c,u]=g(""),[_,p]=g(!1),[f,h]=g(""),[b,k]=g(300),x=te(),w=async()=>{if(p(!0),!l){const{error:e}=n?await x.verifyLoginPhoneOtp(i):await x.verifyPhoneOtp(i);if(e)u("Verification failed.");else{if(n)return await o(),void r("/");d(!0)}}p(!1)},P=async()=>{h(""),await(async()=>{u("");const{error:e}=n?await x.requestLoginPhoneOtp():await x.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&&!n&&(async()=>{const{error:e}=await x.requestEmailOtp();e?u("Failed to send Email code. If this persists, refresh the page and try registering again."):r(me)})()},[l,n,r,x]),e("div",{className:dt,children:t("div",{className:ct,children:[e("h2",{className:ut,children:"Verify Your Phone Number"}),e("p",{className:mt,children:"Enter the code sent to your phone number."}),c&&e("p",{className:_t,children:c}),f&&e("p",{className:gt,children:f}),t("form",{onSubmit:async e=>{if(e.preventDefault(),u(""),6===i.length){p(!0);try{await w()}catch{u("Unexpected error occurred.")}finally{p(!1)}}else u("Please enter a valid code.")},className:pt,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:ft,children:["Phone Verification Code ",(N=l,!0===N?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===N?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",t("span",{className:ht,children:["Code expires in: ",(S=b,`${Math.floor(S/60).toString().padStart(2,"0")}:${(S%60).toString().padStart(2,"0")}`)]})]}),e(wt,{length:6,value:i,onChange:s}),e("button",{type:"button",onClick:()=>P(),className:yt,children:"Resend code to phone"})]}),e("button",{type:"submit",className:vt,children:_?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:bt,children:"Back to login"})]})]})});var S,N},St=()=>{const r=y(),a=v(),{refreshSession:o}=X(),n=te(),{passkeySupported:i}=le(),s="login"===a.state?.flow,[l,d]=g(!1),[c,u]=g(""),[_,p]=g(300),[f,h]=g(""),[b,k]=g("");return m(()=>{const e=setInterval(()=>{p(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:dt,children:t("div",{className:ct,children:[e("h2",{className:ut,children:"Verify Your Email"}),e("p",{className:mt,children:"We sent you a verification email. Enter the code below."}),f&&e("p",{className:_t,children:f}),b&&e("p",{className:gt,children:b}),t("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===c.length){d(!0);try{const{error:e}=s?await n.verifyLoginEmailOtp(c):await n.verifyEmailOtp(c);if(e)return void h("Verification failed.");if(s)return await o(),void r("/");i?r(pe):(await o(),r("/"))}catch{console.error("Email OTP verification failed."),h("Verification failed.")}finally{d(!1)}}else h("Please enter a valid code.")},className:pt,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:ft,children:["Email Verification Code",t("span",{className:ht,children:[" ","— Code expires in ",(x=_,`${Math.floor(x/60).toString().padStart(2,"0")}:${(x%60).toString().padStart(2,"0")}`)]})]}),e(wt,{length:6,value:c,onChange:u,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),k("");const{error:e}=s?await n.requestLoginEmailOtp():await n.requestEmailOtp();e?h("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:yt,children:"Resend code to email"})]}),e("button",{type:"submit",className:vt,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:bt,children:"Back to login"})]})]})});var x};var Nt={container:"verifyMagiclink-module__container___qrSXf",card:"verifyMagiclink-module__card___niKgr",title:"verifyMagiclink-module__title___SumxD",verificationContent:"verifyMagiclink-module__verificationContent___NdsS0",spinner:"verifyMagiclink-module__spinner___lnW1k",successIcon:"verifyMagiclink-module__successIcon___XjFEM",checkIcon:"verifyMagiclink-module__checkIcon___I0JOP",successText:"verifyMagiclink-module__successText___lO5Qq"};he(".verifyMagiclink-module__container___qrSXf{align-items:center;color: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]=b(),a=y(),o=r.get("token"),[n,i]=g(""),[s,l]=g(""),d=te(),{refreshSession:c}=X();return m(()=>{let e=!0,t=null,r=null;return(async()=>{if(!o)return e&&i("Missing token for verification."),void console.error("No magic-link token found.");const{error:n}=await d.verifyMagicLink(o);if(n)return console.error("Failed to verify token"),void(e&&i("Failed to verify token"));await c(),e&&(t=new BroadcastChannel("seamless-auth"),t.postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),l("You have been verified on the device and browser that initiated this request"),r=setTimeout(()=>{e&&a("/")},900))})(),()=>{e=!1,t?.close(),r&&clearTimeout(r)}},[o,d,a,c]),e("div",{className:Nt.container,children:t("div",{className:Nt.card,children:[e("h1",{className:Nt.title,children:"Verifying your login"}),t("div",{className:Nt.verificationContent,children:[!s&&!n&&e("div",{className:Nt.spinner}),s&&e("div",{className:Nt.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:Nt.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!s&&!n&&e("p",{className:Nt.helperText,children:"Please wait while we securely verify your sign-in link."}),s&&e("p",{className:Nt.successText,children:"Login verified. Redirecting…"}),n&&e("p",{className:Nt.error,children:n})]})]})})},Tt={oauth_missing_email:"Your provider account did not share an email address. Add an email to that account and make it visible, then try again.",oauth_email_not_verified:"The email address on your provider account is not verified. Verify it with your provider, then try again.",oauth_missing_subject:"Your provider did not return a usable account identifier. Try again, or sign in with a different method."},Ct=()=>{const{finishOAuthLogin:a}=X(),o=y(),[n]=b(),[i,s]=g(""),l=p(!1);return m(()=>{if(l.current)return;l.current=!0;const e=n.get("code"),t=n.get("state"),r=sessionStorage.getItem(Le);e&&t&&r?a({providerId:r,code:e,state:t}).then(({error:e})=>{if(e){const t=T(e);return void s(t?Tt[t]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(Le),o("/")}):s("This sign-in link is missing required information.")},[a,o,n]),t("div",{className:Nt.container,children:[e("h2",{className:Nt.title,children:i?"Sign-in failed":"Completing sign-in..."}),i&&t(r,{children:[e("p",{children:i}),e("button",{type:"button",onClick:()=>o("/login"),children:"Back to login"})]})]})};var Mt="magiclink-module__container___45zcA",It="magiclink-module__card___Au9oN",At="magiclink-module__iconWrapper___k5ndr",zt="magiclink-module__mailIcon___Pwb7q",Et="magiclink-module__iconRing___bdLvf",Ft="magiclink-module__heading___b9cre",Ut="magiclink-module__message___kiVFj",Lt="magiclink-module__identifier___JtcFM",Rt="magiclink-module__helperText___7Mlfh",Bt="magiclink-module__actions___64I-3",qt="magiclink-module__secondaryButton___BntAI",jt="magiclink-module__cooldown___Ib4rm",Jt="magiclink-module__linkButton___maJiv";he(".magiclink-module__container___45zcA{align-items:center;color: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 Gt=()=>{const{refreshSession:r}=X(),a=y(),o=v(),n=te(),i=o.state?.identifier,[s,l]=g(30);m(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const d=f(async()=>{const{data:e,error:t}=await n.checkMagicLink();return!t&&"Success"===e?.message},[n]);return m(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await d()&&(await r(),a("/"))},()=>{e.close()}},[d,a,r]),m(()=>{const e=setInterval(async()=>{try{await d()&&(await r(),a("/"))}catch{}},5e3);return()=>clearInterval(e)},[d,r,a]),e("div",{className:Mt,children:t("div",{className:It,children:[t("div",{className:At,children:[e("div",{className:Et}),t("svg",{className:zt,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e("path",{d:"M4 6h16v12H4z"}),e("path",{d:"m4 6 8 6 8-6"})]})]}),e("h2",{className:Ft,children:"Check your email"}),e("p",{className:Ut,children:"If an account exists for this address, we sent a secure sign-in link."}),i&&e("div",{className:Lt,children:i}),e("p",{className:Rt,children:"Open the email and click the link to finish signing in."}),e("p",{className:Rt,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Bt,children:[e("button",{className:qt,disabled:s>0,onClick:async()=>{s>0||(await n.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:jt,children:["Available in ",s,"s"]}),e("button",{className:Jt,onClick:()=>a("/login"),children:"Change email or phone"})]})]})})},Dt=()=>t(k,{children:[e(x,{path:de,element:e(Be,{})}),e(x,{path:ce,element:e(je,{})}),e(x,{path:ue,element:e(Pt,{})}),e(x,{path:me,element:e(St,{})}),e(x,{path:_e,element:e(Ot,{})}),e(x,{path:ge,element:e(Ct,{})}),e(x,{path:pe,element:e(lt,{})}),e(x,{path:fe,element:e(Gt,{})}),e(x,{path:"*",element:e(w,{to:de,replace:!0})})]});export{ee as AuthProvider,Dt as AuthRoutes,S as SeamlessAuthError,$ as createSeamlessAuthClient,U as encodePrfSalt,j as extractPasskeyPrfResult,T as getOAuthErrorCode,C as getWebAuthnErrorDetail,oe as hasNonPasskeyLoginMethod,K as hasScopedRole,B as isPasskeyPrfSupported,V as roleGrantsAccess,X as useAuth,te as useAuthClient,ae as useLoginMethods,le 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 S from"libphonenumber-js";class P 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 P))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 P&&"object"==typeof e.body&&null!==e.body)return I(e.body)??I(e.body.details)}function M(e){if(!(e instanceof P)||("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 E(e,t){let r;try{r=await e.json()}catch{r=void 0}return new P(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 z(e){try{return await e.json()}catch{return}}async function F(e,t){let r;try{r=await e}catch{return{data:null,error:new P(t,0)}}return r.ok?{data:await z(r),error:null}:{data:null,error:await E(r,t)}}function U(e){return{data:e,error:null}}function L(e,t=0,r,n){return{data:null,error:new P(e,t,r,n)}}function R(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 q(e){return"string"==typeof e?e:o(R(e))}function B(e){return"string"==typeof e?i(e):e}function j(e){return{...e.credentialId?{credentialId:e.credentialId}:{},prf:{salt:q(e.salt),...e.secondSalt?{secondSalt:q(e.secondSalt)}:{}}}}async function J(){return!!n()&&("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:B(r.first)}:{},...r.second?{second:B(r.second)}:{}}}}}:e}function W(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(R(n))}}function $(e){const t=e.clientExtensionResults;return t?.prf?.results?{...e,clientExtensionResults:{...e.clientExtensionResults,prf:{...t.prf,results:void 0}}}:e}function D(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 H(e,t,r){const n=L(t,0,void 0,r),o=M(n.error);return console.error(e,o?.name??"Unknown error."),n}const K=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:()=>F(t("users/me",{method:"GET"}),"Failed to load the current user."),login:e=>F(t("/login",{method:"POST",body:JSON.stringify(e)}),"Failed to start sign-in."),loginWithPasskey:async e=>{const r=await F(t("/webAuthn/login/start",{...V(e?.prf)}),"Failed to start passkey login.");if(r.error)return r;let n,o;try{const e=await a({optionsJSON:G(r.data)});n=W(e),o=$(e)}catch(e){return H("Passkey login error.","Passkey login failed.",e)}const i=await F(t("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:o})}),"Failed to verify passkey.");return i.error?i:"Success"!==i.data?.message?L(i.data?.message??"Passkey login failed."):U(n?{prf:n}:{})},logout:(e={})=>F(t("all_sessions"===e.scope?"/logout/all":"/logout",{method:"DELETE"}),"Failed to sign out."),logoutAllSessions:()=>F(t("/logout/all",{method:"DELETE"}),"Failed to sign out of all sessions."),deleteUser:()=>F(t("/users/delete",{method:"DELETE"}),"Failed to delete the account."),register:e=>F(t("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,...e.phone?{phone:e.phone}:{}})}),"Failed to register."),requestPhoneOtp:()=>F(t("/otp/generate-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyPhoneOtp:e=>F(t("/otp/verify-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestLoginPhoneOtp:()=>F(t("/otp/generate-login-phone-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the SMS code."),verifyLoginPhoneOtp:e=>F(t("/otp/verify-login-phone-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the SMS code."),requestEmailOtp:()=>F(t("/otp/generate-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyEmailOtp:e=>F(t("/otp/verify-email-otp",{method:"POST",body:JSON.stringify({verificationToken:e})}),"Failed to verify the email code."),requestLoginEmailOtp:()=>F(t("/otp/generate-login-email-otp",{method:"POST",body:JSON.stringify({})}),"Failed to send the email code."),verifyLoginEmailOtp:e=>F(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 F(t("/magic-link",{method:"POST",body:JSON.stringify(n?{redirectUri:n}:{})}),"Failed to send the magic link.")},checkMagicLink:()=>F(t("/magic-link/check",{method:"GET"}),"Failed to check the magic link."),verifyMagicLink:e=>F(t(`/magic-link/verify/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to verify the magic link."),listOAuthProviders:()=>F(t("/oauth/providers",{method:"GET"}),"Failed to list OAuth providers."),getPublicSystemConfig:()=>F(t("/system-config/public",{method:"GET"}),"Failed to read the public system configuration."),startOAuthLogin:e=>F(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=>F(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 F(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?L(e.name,0,void 0,e):H("Passkey registration error.","Passkey registration failed.",e)}const i=function(e){const t=e.clientExtensionResults;return!0===t?.prf?.enabled}(o),a=await F(t("/webAuthn/register/finish",{method:"POST",body:JSON.stringify({attestationResponse:o,metadata:{...r.metadata,prfCapable:i}})}),"Verification failed.");return a.error?a:U({credentialId:o.id,prfCapable:i})},isPasskeyPrfSupported:J,getStepUpStatus:()=>F(t("/step-up/status",{method:"GET"}),"Failed to load step-up status."),verifyStepUpWithPasskey:async()=>{const e=await F(t("/step-up/webauthn/start",{method:"POST"}),"Failed to start step-up authentication.");if(e.error)return e;let r;try{r=$(await a({optionsJSON:G(e.data)}))}catch(e){return H("Step-up authentication error.","Step-up authentication failed.",e)}const n=await F(t("/step-up/webauthn/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})}),"Failed to verify step-up authentication.");return n.error?n:D(n.data??{},"webauthn")},verifyStepUpWithPasskeyPrf:async e=>{const r=await F(t("/step-up/webauthn/start",{...V(e)}),"Failed to start step-up authentication.");if(r.error)return r;let n,o;try{const e=await a({optionsJSON:G(r.data)});n=W(e),o=$(e)}catch(e){return H("Step-up authentication error.","Step-up authentication failed.",e)}if(!n)return L("Passkey did not return PRF output.");const i=await F(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=D(i.data??{},"webauthn");return s.error?s:U({...s.data,credentialId:n.credentialId,prf:n})},getTotpStatus:()=>F(t("/totp/status",{method:"GET"}),"Failed to load authenticator status."),startTotpEnrollment:()=>F(t("/totp/enroll/start",{method:"POST"}),"Failed to start authenticator enrollment."),verifyTotpEnrollment:e=>F(t("/totp/enroll/verify",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify the authenticator code."),disableTotp:e=>F(t("/totp/disable",{method:"POST",body:JSON.stringify({code:e})}),"Failed to disable the authenticator."),verifyStepUpWithTotp:async e=>{const r=await F(t("/totp/verify-mfa",{method:"POST",body:JSON.stringify({code:e})}),"Failed to verify step-up authentication.");return r.error?r:D(r.data??{},"totp")},updateCredential:e=>F(t("users/credentials",{method:"POST",body:JSON.stringify(e)}),"Failed to update credential."),deleteCredential:e=>F(t("users/credentials",{method:"DELETE",body:JSON.stringify({id:e})}),"Failed to delete credential."),listOrganizations:()=>F(t("/organizations",{method:"GET"}),"Failed to list organizations."),createOrganization:e=>F(t("/organizations",{method:"POST",body:JSON.stringify(e)}),"Failed to create organization."),getOrganization:e=>F(t(`/organizations/${encodeURIComponent(e)}`,{method:"GET"}),"Failed to load organization."),updateOrganization:(e,r)=>F(t(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(r)}),"Failed to update organization."),switchOrganization:e=>F(t(`/organizations/${encodeURIComponent(e)}/switch`,{method:"POST"}),"Failed to switch organization."),listOrganizationMembers:e=>F(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"GET"}),"Failed to list organization members."),addOrganizationMember:(e,r)=>F(t(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(r)}),"Failed to add organization member."),updateOrganizationMember:(e,r,n)=>F(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"PATCH",body:JSON.stringify(n)}),"Failed to update organization member."),removeOrganizationMember:(e,r)=>F(t(`/organizations/${encodeURIComponent(e)}/members/${encodeURIComponent(r)}`,{method:"DELETE"}),"Failed to remove organization member.")}};function Y(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 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},ne=({children:t,apiHost:r,autoDetectPreviousSignin:n=!0,magicLinkRedirectUri:o})=>{const i=d(()=>function(e){const{apiHost:t,detectPreviousSignIn:r=!0}=e,n=K({apiHost:t}),o=e.storage??Q(),i=new Set;let a=!1,s=0,l={...ee,loading:!0,hasSignedInBefore:r&&"true"===o.get(X)};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(X,"true"),r&&c({hasSignedInBefore:!0})}function u(){c(ee)}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()),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?Z(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(te.Provider,{value:s,children:t})},oe=()=>{const{apiHost:e,magicLinkRedirectUri:t}=re();return d(()=>K({apiHost:e,magicLinkRedirectUri:t}),[e,t])},ie=["passkey","magic_link"],ae=()=>{const e=oe(),[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}},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[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(".."))},ce=e=>{const t=S(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,n]=g(!0);return m(()=>{let e=!0;return(async()=>{try{const r=await de();e&&t(r)}catch{e&&t(!1)}finally{e&&n(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:r}},me="/login",_e="/passkey-login",ge="/verify-phone-otp",pe="/verify-email-otp",fe="/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 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 ke="login-module__container___YggDx",we="login-module__card___Ub-Py",xe="login-module__heading___neEqb",Se="login-module__inputGroup___P6qgS",Pe="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__submitHint___qOS5Z",Ae="login-module__toggle___1JiG1",Me="login-module__fallbackCard___HdIk-",Ee="login-module__fallbackHeader___-il2v",ze="login-module__fallbackDescription___ea5EB",Fe="login-module__fallbackActions___AD3ni",Ue="login-module__fallbackActionButton___lFgWf",Le="login-module__actionTitle___ycrMp",Re="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,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 Be=({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")&&le(r),d=l.has("email_otp")&&Boolean(o)&&le(r),u=l.has("phone_otp")&&ce(r),m=l.has("passkey")&&Boolean(a);return c||d||u||m?t("div",{className:Me,children:[e("div",{className:Ee,children:"Choose a sign-in method"}),e("p",{className:ze,children:"Choose another secure sign-in method."}),t("div",{className:Fe,children:[c&&t("button",{type:"button",className:Ue,onClick:n,children:[e("span",{className:Le,children:"Email Magic Link"}),e("span",{className:Re,children:"Send a secure sign-in link to your email"})]}),d&&t("button",{type:"button",className:Ue,onClick:o,children:[e("span",{className:Le,children:"Email Code"}),e("span",{className:Re,children:"Receive a one-time code by email"})]}),u&&t("button",{type:"button",className:Ue,onClick:i,children:[e("span",{className:Le,children:"Text Message Code"}),e("span",{className:Re,children:"Receive a one-time code via SMS"})]})]}),m&&e("button",{type:"button",className:qe,onClick:a,children:"Try passkey anyway"})]}):null},je="seamless:oauth:provider",Je=()=>{const{listOAuthProviders:r,startOAuthLogin:n}=re(),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:Fe,children:[i.map(r=>e("button",{type:"button",className:Ue,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:Le,children:["Continue with ",r.name]})},r.id)),s&&e("p",{className:Te,children:s})]})},Ge=()=>{const n=y(),{hasSignedInBefore:o,login:i,handlePasskeyLogin:a}=re(),s=oe(),{passkeySupported:l}=ue(),{loginMethods:c}=ae(),[d,u]=g(""),[_,p]=g(""),[f,h]=g("register"),[b,v]=g(""),[k,w]=g(""),[x,S]=g(""),[P,O]=g(!1),[N,T]=g(null);m(()=>{o&&h("login")},[o]);const C=()=>"login"===f?le(d)||ce(d):le(_);return e("div",{className:ke,children:t("div",{className:we,children:[e("h2",{className:xe,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??ie;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(pe):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:Pe,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);S(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"}),P&&e(Be,{identifier:d,onMagicLink:async()=>{const{error:e}=await s.requestMagicLink();e?v("Failed to send magic link."):n(be,{state:{identifier:d}})},onEmailOtp:async()=>{const{error:e}=await s.requestLoginEmailOtp();e?v("Failed to send email code."):n(pe,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await s.requestLoginPhoneOtp();e?v("Failed to send OTP."):n(ge,{state:{flow:"login"}})},onPasskeyRetry:l?a:void 0,loginMethods:N}),x&&e("p",{className:Te,children:x})]}),"register"===f&&t("div",{className:Se,children:[e("label",{htmlFor:"email",className:Pe,children:"Email Address"}),e("input",{id:"email",type:"email",value:_,onChange:e=>{const t=e.target.value;p(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:!C(),"aria-describedby":"seamless-submit-hint",children:"login"===f?"Login":"Register"}),e("p",{id:"seamless-submit-hint",role:"status",className:Ie,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:Te,children:b}),e("button",{type:"button",onClick:()=>h("login"===f?"register":"login"),className:Ae,children:"login"===f?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(Je,{})]})]})})};var We={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 $e=()=>{const r=y(),{handlePasskeyLogin:n}=re(),[o,i]=g("");return e("div",{className:We.container,children:t("div",{className:We.card,children:[e("h2",{className:We.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:We.button,children:"Use Passkey"}),o&&e("p",{className:We.error,children:o})]})})};var De="registerPasskey-module__container___jqEh8",Ve="registerPasskey-module__card___MJAyC",He="registerPasskey-module__loading___Q4i1x",Ke="registerPasskey-module__spinner___V1nhd",Ye="registerPasskey-module__supported___ihTih",Ze="registerPasskey-module__title___vn2Qu",Qe="registerPasskey-module__description___AWmO-",Xe="registerPasskey-module__button___D3b4B",et="registerPasskey-module__message___RiOw-",tt="registerPasskey-module__success___HP5aX",rt="registerPasskey-module__error___hGiqE",nt="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 it={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(),n=oe(),{passkeySupported:o,loading:i}=ue(),{loginMethods:a,loading:s}=ae(),l=y(),[c,d]=g("idle"),[u,m]=g(""),_=se(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?it[t]:void 0}(e)??"Error registering passkey.")}};return e("div",{className:De,children:e("div",{className:Ve,children:t("div",i||s?{className:He,children:[e("div",{className:Ke}),e("span",{children:"Checking for Passkey Support..."})]}:o?{className:Ye,children:[e("h2",{className:Ze,children:"Secure Your Account with a Passkey"}),e("p",{className:Qe,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>f(),disabled:"loading"===c,className:Xe,children:"loading"===c?"Registering...":"Register Passkey"}),e("button",{type:"button",onClick:()=>f("cross-platform"),disabled:"loading"===c,className:ot,children:"Use a security key instead"}),u&&e("p",{className:`${et} ${"success"===c?tt:rt}`,children:u}),_&&e("button",{type:"button",onClick:p,disabled:"loading"===c,className:nt,children:"Skip for now"})]}:{className:Ye,children:[e("h2",{className:Ze,children:"Passkeys are not available here"}),e("p",{className:Qe,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:Xe,children:"Continue"})]})})})};var st="verifyOTP-module__container___wgoDE",lt="verifyOTP-module__card___3cs2p",ct="verifyOTP-module__title___fZ-1d",dt="verifyOTP-module__subtitle___dGSu3",ut="verifyOTP-module__error___GEtlG",mt="verifyOTP-module__success___46TjG",_t="verifyOTP-module__form___jiGG-",gt="verifyOTP-module__label___Zq5Mi",pt="verifyOTP-module__timer___smq-a",ft="verifyOTP-module__resend___PlmkG",ht="verifyOTP-module__button___8pIuO",yt="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 bt="otpInput-module__otpContainer___MUjby",vt="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 kt=({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:bt,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:vt,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))})},wt=()=>{const r=y(),n=b(),{refreshSession:o}=re(),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=oe(),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)},S=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(pe)})()},[l,i,r,w]),e("div",{className:st,children:t("div",{className:lt,children:[e("h2",{className:ct,children:"Verify Your Phone Number"}),e("p",{className:dt,children:"Enter the code sent to your phone number."}),d&&e("p",{className:ut,children:d}),f&&e("p",{className:mt,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:_t,children:[t("div",{children:[t("label",{htmlFor:"phoneCode",className:gt,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:pt,children:["Code expires in: ",(P=v,`${Math.floor(P/60).toString().padStart(2,"0")}:${(P%60).toString().padStart(2,"0")}`)]})]}),e(kt,{length:6,value:a,onChange:s}),e("button",{type:"button",onClick:()=>S(),className:ft,children:"Resend code to phone"})]}),e("button",{type:"submit",className:ht,children:_?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:yt,children:"Back to login"})]})]})});var P,O},xt=()=>{const r=y(),n=b(),{refreshSession:o}=re(),i=oe(),{passkeySupported:a}=ue(),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:st,children:t("div",{className:lt,children:[e("h2",{className:ct,children:"Verify Your Email"}),e("p",{className:dt,children:"We sent you a verification email. Enter the code below."}),f&&e("p",{className:ut,children:f}),v&&e("p",{className:mt,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(ye):(await o(),r("/"))}catch{console.error("Email OTP verification failed."),h("Verification failed.")}finally{c(!1)}}else h("Please enter a valid code.")},className:_t,children:[t("div",{children:[t("label",{htmlFor:"emailCode",className:gt,children:["Email Verification Code",t("span",{className:pt,children:[" ","— Code expires in ",(w=_,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(kt,{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:ft,children:"Resend code to email"})]}),e("button",{type:"submit",className:ht,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:yt,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"};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(),n=y(),o=r.get("token"),[i,a]=g(""),[s,l]=g(""),c=oe(),{refreshSession:d}=re();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 Ot={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."},Nt=()=>{const{finishOAuthLogin:n}=re(),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?Ot[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 Tt="magiclink-module__container___45zcA",Ct="magiclink-module__card___Au9oN",It="magiclink-module__iconWrapper___k5ndr",At="magiclink-module__mailIcon___Pwb7q",Mt="magiclink-module__iconRing___bdLvf",Et="magiclink-module__heading___b9cre",zt="magiclink-module__message___kiVFj",Ft="magiclink-module__identifier___JtcFM",Ut="magiclink-module__helperText___7Mlfh",Lt="magiclink-module__actions___64I-3",Rt="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 jt=()=>{const{refreshSession:r}=re(),n=y(),o=b(),i=oe(),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:Tt,children:t("div",{className:Ct,children:[t("div",{className:It,children:[e("div",{className:Mt}),t("svg",{className:At,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:Et,children:"Check your email"}),e("p",{className:zt,children:"If an account exists for this address, we sent a secure sign-in link."}),a&&e("div",{className:Ft,children:a}),e("p",{className:Ut,children:"Open the email and click the link to finish signing in."}),e("p",{className:Ut,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),t("div",{className:Lt,children:[e("button",{className:Rt,disabled:s>0,onClick:async()=>{s>0||(await i.requestMagicLink(),l(30))},children:"Resend link"}),s>0&&t("div",{className:qt,children:["Available in ",s,"s"]}),e("button",{className:Bt,onClick:()=>n("/login"),children:"Change email or phone"})]})]})})},Jt=()=>t(k,{children:[e(w,{path:me,element:e(Ge,{})}),e(w,{path:_e,element:e($e,{})}),e(w,{path:ge,element:e(wt,{})}),e(w,{path:pe,element:e(xt,{})}),e(w,{path:fe,element:e(Pt,{})}),e(w,{path:he,element:e(Nt,{})}),e(w,{path:ye,element:e(at,{})}),e(w,{path:be,element:e(jt,{})}),e(w,{path:"*",element:e(x,{to:me,replace:!0})})]});export{ne as AuthProvider,Jt as AuthRoutes,P as SeamlessAuthError,K as createSeamlessAuthClient,q 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,oe as useAuthClient,ae as useLoginMethods,ue 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/components/DeviceNameModal.tsx","../src/views/PassKeyRegistration.tsx","../src/components/OtpInput.tsx","../src/views/PhoneRegistration.tsx","../src/views/EmailRegistration.tsx","../src/views/VerifyMagicLink.tsx","../src/views/OAuthCallback.tsx","../src/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["SeamlessAuthError","Error","constructor","message","status","body","cause","super","this","name","OAUTH_ERROR_CODES","oauth_missing_email","oauth_email_not_verified","oauth_missing_subject","readCode","code","getOAuthErrorCode","error","details","Object","prototype","hasOwnProperty","call","undefined","getWebAuthnErrorDetail","value","async","toSeamlessAuthError","response","fallbackMessage","json","extractMessage","readBody","requestResult","request","data","ok","resultOf","resultError","toArrayBuffer","ArrayBuffer","source","Uint8Array","buffer","byteOffset","byteLength","copy","set","encodePrfSalt","salt","bufferToBase64URLString","saltToBufferSource","base64URLStringToBuffer","createPrfRequestBody","input","credentialId","prf","secondSalt","isPasskeyPrfSupported","browserSupportsWebAuthn","window","isSecureContext","globalThis","PublicKeyCredential","navigator","credentials","get","preparePrfRequestOptions","optionsJSON","options","prfEval","extensions","eval","first","second","extractPasskeyPrfResult","credential","extensionResults","clientExtensionResults","results","output","id","outputBase64url","stripPrfResultsFromAssertion","toStepUpStatus","payload","expectedMethod","method","fresh","verifiedAt","expiresAt","maxAgeSeconds","buildAssertionStartInit","JSON","stringify","webAuthnFailure","logContext","thrown","failure","detail","console","createSeamlessAuthClient","opts","fetchWithAuth","authHost","init","url","replace","startsWith","hasBody","requestInit","headers","fetch","createFetchWithAuth","apiHost","getCurrentUser","login","loginWithPasskey","optionsInput","started","assertionResponse","startAuthentication","verified","logout","scope","logoutAllSessions","deleteUser","register","email","phone","requestPhoneOtp","verifyPhoneOtp","verificationToken","requestLoginPhoneOtp","verifyLoginPhoneOtp","requestEmailOtp","verifyEmailOtp","requestLoginEmailOtp","verifyLoginEmailOtp","requestMagicLink","checkMagicLink","verifyMagicLink","token","encodeURIComponent","listOAuthProviders","getPublicSystemConfig","startOAuthLogin","providerId","redirectUri","returnTo","finishOAuthLogin","state","registerPasskey","registerInput","metadata","normalizeRegisterPasskeyInput","challenge","query","URLSearchParams","requirePrf","requestPrf","queryString","toString","buildRegisterStartPath","attestationResponse","startRegistration","WebAuthnError","prfCapable","enabled","getRegistrationPrfCapable","getStepUpStatus","verifyStepUpWithPasskey","verifyStepUpWithPasskeyPrf","getTotpStatus","startTotpEnrollment","verifyTotpEnrollment","disableTotp","verifyStepUpWithTotp","updateCredential","deleteCredential","listOrganizations","createOrganization","getOrganization","organizationId","updateOrganization","switchOrganization","listOrganizationMembers","addOrganizationMember","updateOrganizationMember","userId","removeOrganizationMember","roleGrantsAccess","grantedRole","requiredRole","granted","trim","required","endsWith","prefix","slice","includes","grantedParts","split","requiredParts","grantedAction","length","requiredAction","grantedPrefix","requiredPrefix","every","part","index","hasScopedRole","grantedRoles","requiredRoles","Array","isArray","filter","role","some","createDefaultStorage","localStorage","values","Map","key","createMemoryStorage","getItem","setItem","PREVIOUS_SIGN_IN_KEY","SIGNED_OUT","user","organizations","activeOrganization","stepUpStatus","isAuthenticated","AuthContext","createContext","useAuth","context","useContext","AuthProvider","children","autoDetectPreviousSignin","session","useMemo","detectPreviousSignIn","client","storage","listeners","Set","destroyed","refreshGeneration","loading","hasSignedInBefore","setState","patch","next","keys","forEach","listener","markSignedIn","clearSession","refreshSession","generation","result","refreshAfter","run","getState","subscribe","add","delete","actions","identifier","passkeyAvailable","handlePasskeyLogin","friendlyName","updated","map","current","refreshStepUpStatus","hasRole","roles","rolesGrantScopedAccess","destroy","clear","createAuthSession","useSyncExternalStore","useEffect","_jsx","Provider","useAuthClient","FALLBACK_LOGIN_METHODS","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","setLoading","active","read","hasNonPasskeyLoginMethod","Boolean","isValidEmail","normalized","parts","localPart","domainPart","test","isValidPhoneNumber","phoneNumber","parsePhoneNumberFromString","isValid","isPasskeySupported","isUserVerifyingPlatformAuthenticatorAvailable","isPlatformAuthenticatorAvailable","usePasskeySupport","passkeySupported","setPasskeySupported","supported","checkSupport","authRoutePaths","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","AuthFallbackOptions","onMagicLink","onEmailOtp","onPhoneOtp","onPasskeyRetry","allowedMethods","showMagicLink","has","showEmailOtp","showPhoneOtp","showPasskeyRetry","_jsxs","className","styles","onClick","OAUTH_PROVIDER_STORAGE_KEY","OAuthProviderButtons","callbackHref","useHref","providers","setProviders","setError","then","provider","sessionStorage","URL","location","origin","assign","authorizationUrl","handleSelect","Login","navigate","useNavigate","configuredMethods","setIdentifier","setEmail","mode","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","passkeyError","htmlFor","onChange","target","autoComplete","placeholder","onBlur","flow","disabled","PassKeyLogin","runPasskeyLogin","container","card","title","button","DeviceNameModal","isOpen","onCancel","onConfirm","setValue","autoFocus","PasskeyRegistration","passkeySupportLoading","loginMethodsLoading","setStatus","setMessage","showDeviceModal","setShowDeviceModal","pendingMetadata","setPendingMetadata","canSkip","finishWithoutPasskey","platform","browser","deviceInfo","ua","userAgent","toLowerCase","brave","parseUserAgent","OtpInput","inputMode","inputs","useRef","concat","fill","handleChange","char","handleBulkInput","newValueArr","newValue","join","focus","cleaned","chars","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","handleKeyDown","PhoneRegistration","useLocation","isLoginFlow","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","handleResend","onResendPhone","interval","setInterval","prev","clearInterval","nextStep","seconds","floor","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","VerifyMagicLink","searchParams","useSearchParams","successMsg","setSuccessMsg","mounted","channel","redirectTimeout","BroadcastChannel","postMessage","setTimeout","verify","close","clearTimeout","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","CODE_ERRORS","OAuthCallback","startedRef","finishError","removeItem","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","useCallback","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"8jBAYM,MAAOA,UAA0BC,MASrC,WAAAC,CAAYC,EAAiBC,EAAgBC,EAAgBC,GAC3DC,MAAMJ,GACNK,KAAKC,KAAO,oBACZD,KAAKJ,OAASA,EACdI,KAAKH,KAAOA,EACZG,KAAKF,MAAQA,CACf,EAeF,MAAMI,EAAkD,CACtDC,qBAAqB,EACrBC,0BAA0B,EAC1BC,uBAAuB,GAGzB,SAASC,EAAST,GAChB,GAAoB,iBAATA,GAA8B,OAATA,EAIhC,OAAQA,EAA4BU,IACtC,CAYM,SAAUC,EAAkBC,GAChC,KAAMA,aAAiBjB,GACrB,OAGF,GAA0B,iBAAfiB,EAAMZ,MAAoC,OAAfY,EAAMZ,KAC1C,OAGF,MAAMU,EACJD,EAAS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M3M,GAA8B4M,QAAS5O,EAAC+N,GAAa,CAAA,KAClE/N,EAAC0O,EAAK,CAACC,KAAK,IAAIC,QAAS5O,EAAC6O,GAASC,GAAI9M,GAAsBrN","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","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","Navig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AAiB7G,SAAA,4DAI/B+C,EAAA,IAAA,CAAG6D,UAAWC,GAAiB7G,SAAA,mFAI/B2G,EAAA,MAAA,CAAKC,UAAWC,GAAc7G,SAAA,CAC5B+C,EAAA,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, 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';
@@ -26,7 +26,7 @@ export interface AuthSessionActions {
26
26
  switchOrganization: (organizationId: string) => Promise<SeamlessAuthResult<OrganizationSwitchResult>>;
27
27
  listOAuthProviders: () => Promise<SeamlessAuthResult<OAuthProvidersResult>>;
28
28
  startOAuthLogin: (input: StartOAuthLoginInput) => Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
29
- finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<MessageResult>>;
29
+ finishOAuthLogin: (input: FinishOAuthLoginInput) => Promise<SeamlessAuthResult<FinishOAuthLoginResult>>;
30
30
  refreshStepUpStatus: () => Promise<SeamlessAuthResult<StepUpStatus>>;
31
31
  verifyStepUpWithPasskey: () => Promise<SeamlessAuthResult<StepUpStatus>>;
32
32
  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.9.0",
3
+ "version": "0.11.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.5.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",
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface DeviceNameModalProps {
3
- isOpen: boolean;
4
- onCancel: () => void;
5
- onConfirm: (name: string) => void;
6
- }
7
- declare const DeviceNameModal: React.FC<DeviceNameModalProps>;
8
- export default DeviceNameModal;