@seamless-auth/react 0.0.9 → 0.1.1

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/README.md CHANGED
@@ -1,69 +1,77 @@
1
- # Seamless Auth React
2
-
3
1
  # @seamless-auth/react
4
2
 
5
3
  [![npm version](https://img.shields.io/npm/v/@seamless-auth/react.svg?label=%40seamless-auth%2Freact)](https://www.npmjs.com/package/@seamless-auth/react)
6
4
  [![coverage](https://img.shields.io/codecov/c/github/fells-code/seamless-auth-react)](https://app.codecov.io/gh/fells-code/seamless-auth-react)
7
5
  [![license](https://img.shields.io/github/license/fells-code/seamless-auth-react)](./LICENSE)
8
6
 
9
- A drop-in authentication provider for React applications, designed to handle login, multi-factor authentication, passkeys, and user session validation using your own backend.
10
-
11
- ## Features
7
+ `@seamless-auth/react` is a React SDK for Seamless Auth. It gives you a provider for auth state, a headless client and hooks for custom auth UIs, and optional prebuilt auth routes when you want a faster drop-in flow.
12
8
 
13
- - Provides `AuthProvider` context
14
- - Includes `useAuth()` hook for access to auth state and actions
15
- - Ships with pre-built login, MFA, and passkey routes
16
- - Lets consumer apps handle routing via `react-router-dom`
17
- - Supports automatic session validation on load
9
+ ## What It Exports
18
10
 
19
- ---
11
+ - `AuthProvider`
12
+ - `AuthRoutes`
13
+ - `useAuth()`
14
+ - `createSeamlessAuthClient()`
15
+ - `useAuthClient()`
16
+ - `usePasskeySupport()`
17
+ - types including `AuthMode`, `AuthContextType`, `Credential`, `User`, and the headless client input/result types
20
18
 
21
19
  ## Installation
22
20
 
23
21
  ```bash
24
- npm install seamless-auth-react
22
+ npm install @seamless-auth/react
25
23
  ```
26
24
 
27
- ---
25
+ ## Choose Your Integration Style
26
+
27
+ You can use this package in three ways:
28
+
29
+ 1. `AuthProvider` + `useAuth()` for auth state and core auth actions
30
+ 2. `createSeamlessAuthClient()` or `useAuthClient()` to build fully custom login and registration screens
31
+ 3. `AuthRoutes` when you want the built-in login, OTP, magic-link, and passkey screens
32
+
33
+ Most apps will use `AuthProvider` either way.
28
34
 
29
- ## Usage
35
+ ## Quick Start
30
36
 
31
- ### 1. Wrap your app with `AuthProvider`
37
+ ### Wrap your app with `AuthProvider`
32
38
 
33
39
  ```tsx
34
- import { AuthProvider } from 'seamless-auth-react';
40
+ import { AuthProvider } from '@seamless-auth/react';
35
41
  import { BrowserRouter } from 'react-router-dom';
36
42
 
37
43
  <BrowserRouter>
38
- <AuthProvider apiHost="https://your.api/">
44
+ <AuthProvider apiHost="https://your.api" mode="server">
39
45
  <AppRoutes />
40
46
  </AuthProvider>
41
47
  </BrowserRouter>;
42
48
  ```
43
49
 
44
- ### 2. Use `useAuth()` to access auth state
50
+ ### Read auth state with `useAuth()`
45
51
 
46
52
  ```tsx
47
- import { useAuth } from 'seamless-auth-react';
53
+ import { useAuth } from '@seamless-auth/react';
54
+
55
+ function Dashboard() {
56
+ const { user, logout, refreshSession } = useAuth();
48
57
 
49
- const Dashboard = () => {
50
- const { user, logout } = useAuth();
51
58
  return (
52
59
  <div>
53
- Welcome, {user?.email}
54
- <button onClick={logout}>Logout</button>
60
+ <p>Welcome, {user?.email}</p>
61
+ <button onClick={() => void refreshSession()}>Refresh session</button>
62
+ <button onClick={() => void logout()}>Logout</button>
55
63
  </div>
56
64
  );
57
- };
65
+ }
58
66
  ```
59
67
 
60
- ### 3. Use `<AuthRoutes />` for handling login/mfa/passkey screens
68
+ ### Use built-in auth routes with `AuthRoutes`
61
69
 
62
70
  ```tsx
63
- import { Routes, Route } from 'react-router-dom';
64
- import { useAuth, AuthRoutes } from 'seamless-auth-react';
71
+ import { AuthRoutes, useAuth } from '@seamless-auth/react';
72
+ import { Route, Routes } from 'react-router-dom';
65
73
 
66
- const AppRoutes = () => {
74
+ function AppRoutes() {
67
75
  const { isAuthenticated } = useAuth();
68
76
 
69
77
  return (
@@ -75,59 +83,157 @@ const AppRoutes = () => {
75
83
  )}
76
84
  </Routes>
77
85
  );
78
- };
86
+ }
79
87
  ```
80
88
 
81
- > Note: You are responsible for handling route protection and redirects based on `isAuthenticated`.
89
+ You are still responsible for your app’s route protection and redirects.
82
90
 
83
- ---
91
+ ## `useAuth()` API
84
92
 
85
- ## AuthContext API
86
-
87
- ### `useAuth()` returns:
93
+ `useAuth()` returns the current auth state plus the provider-backed helpers:
88
94
 
89
95
  ```ts
90
96
  {
91
- user: { email: string, roles?: string[] } | null;
97
+ user: User | null;
98
+ credentials: Credential[];
92
99
  isAuthenticated: boolean;
100
+ loading: boolean;
101
+ apiHost: string;
102
+ mode: AuthMode;
103
+ hasSignedInBefore: boolean;
104
+ markSignedIn(): void;
105
+ hasRole(role: string): boolean | undefined;
106
+ refreshSession(): Promise<void>;
93
107
  logout(): Promise<void>;
94
108
  deleteUser(): Promise<void>;
95
- hasRole(role: string): boolean | undefined;
109
+ login(identifier: string, passkeyAvailable: boolean): Promise<Response>;
110
+ handlePasskeyLogin(): Promise<boolean>;
111
+ updateCredential(credential: Credential): Promise<Credential>;
112
+ deleteCredential(credentialId: string): Promise<void>;
96
113
  }
97
114
  ```
98
115
 
99
- ---
116
+ Use `refreshSession()` after completing a custom auth flow that should update provider state.
117
+
118
+ ## Headless Client
119
+
120
+ For custom auth UIs, use the exported client directly:
121
+
122
+ ```ts
123
+ import { createSeamlessAuthClient } from '@seamless-auth/react';
124
+
125
+ const authClient = createSeamlessAuthClient({
126
+ apiHost: 'https://your.api',
127
+ mode: 'server',
128
+ });
129
+
130
+ const response = await authClient.login({
131
+ identifier: 'user@example.com',
132
+ passkeyAvailable: true,
133
+ });
134
+
135
+ if (response.ok) {
136
+ // Continue your custom flow
137
+ }
138
+ ```
100
139
 
101
- ## Auth Routes Included
140
+ The headless client exposes helpers for:
141
+
142
+ - current-user/session lookup
143
+ - login and passkey login
144
+ - registration
145
+ - phone OTP and email OTP
146
+ - magic-link request, verify, and polling
147
+ - passkey registration
148
+ - logout and delete-user
149
+ - credential update and deletion
150
+
151
+ Client methods return raw `Response` objects except for the passkey convenience helpers:
152
+
153
+ - `loginWithPasskey(): Promise<PasskeyLoginResult>`
154
+ - `registerPasskey(metadata): Promise<PasskeyRegistrationResult>`
155
+
156
+ ## React Hooks For Custom UI
157
+
158
+ If you want custom React screens but do not want to manually recreate the client, use the exported hooks:
159
+
160
+ ```tsx
161
+ import { useAuth, useAuthClient, usePasskeySupport } from '@seamless-auth/react';
162
+
163
+ function CustomLogin() {
164
+ const { refreshSession } = useAuth();
165
+ const authClient = useAuthClient();
166
+ const { passkeySupported, loading } = usePasskeySupport();
167
+
168
+ async function handleEmailLogin() {
169
+ const response = await authClient.login({
170
+ identifier: 'user@example.com',
171
+ passkeyAvailable: passkeySupported,
172
+ });
173
+
174
+ if (response.ok) {
175
+ await refreshSession();
176
+ }
177
+ }
178
+
179
+ return (
180
+ <button disabled={loading} onClick={() => void handleEmailLogin()}>
181
+ Sign in
182
+ </button>
183
+ );
184
+ }
185
+ ```
186
+
187
+ ## Built-In Routes
188
+
189
+ `AuthRoutes` currently includes:
102
190
 
103
191
  - `/login`
104
- - `/mfaLogin`
105
192
  - `/passKeyLogin`
193
+ - `/verifyPhoneOTP`
194
+ - `/verifyEmailOTP`
195
+ - `/verify-magiclink`
106
196
  - `/registerPasskey`
107
- - `/verifyOTP`
197
+ - `/magiclinks-sent`
108
198
 
109
- Each route includes a pre-built UI and expects your backend to expose compatible endpoints.
199
+ These are optional UI wrappers over the same SDK primitives the package now exports for custom flows.
110
200
 
111
- ---
201
+ ## Backend Expectations
112
202
 
113
- ## Customization
203
+ This package assumes a Seamless Auth-compatible backend with cookie-based auth flows.
114
204
 
115
- You can override the included UI screens by:
205
+ - In `web` mode, requests target `${apiHost}/...`
206
+ - In `server` mode, requests target `${apiHost}/auth/...`
207
+ - Requests are sent with `credentials: 'include'`
208
+ - `AuthProvider` validates the current session by calling `/users/me` on load
116
209
 
117
- - Copying the component source from the package
118
- - Creating your own version
119
- - Replacing the component in your app
210
+ The built-in flows assume compatible endpoints for:
120
211
 
121
- ---
212
+ - `/login`
213
+ - `/logout`
214
+ - `/registration/register`
215
+ - `/webAuthn/login/start`
216
+ - `/webAuthn/login/finish`
217
+ - `/webAuthn/register/start`
218
+ - `/webAuthn/register/finish`
219
+ - `/otp/generate-phone-otp`
220
+ - `/otp/generate-email-otp`
221
+ - `/otp/verify-phone-otp`
222
+ - `/otp/verify-email-otp`
223
+ - `/magic-link`
224
+ - `/magic-link/check`
225
+ - `/magic-link/verify/:token`
226
+ - `/users/me`
227
+ - `/users/credentials`
228
+ - `/users/delete`
122
229
 
123
230
  ## Notes
124
231
 
125
- - This package **does not** create its own `<BrowserRouter>` or `<Routes>`.
126
- - It is designed to be fully compatible with your existing routing tree.
127
- - The `AuthProvider` automatically calls `/users/me` on load to validate session.
128
-
129
- ---
232
+ - This package does not create its own `<BrowserRouter>`.
233
+ - It is designed to fit into your app’s existing routing tree.
234
+ - The quickest path is `AuthProvider` + `AuthRoutes`.
235
+ - The most flexible path is `AuthProvider` + custom UI using `useAuth()`, `useAuthClient()`, and `usePasskeySupport()`.
130
236
 
131
237
  ## License
132
238
 
133
- MIT
239
+ AGPL-3.0-only
@@ -1,44 +1,24 @@
1
+ import { Credential, User } from '@/types';
1
2
  import React, { ReactNode } from 'react';
2
3
  import { AuthMode } from './fetchWithAuth';
3
- import { AuthenticatorTransportFuture, CredentialDeviceType } from '@simplewebauthn/browser';
4
- export interface User {
5
- id: string;
6
- email: string;
7
- phone: string;
8
- roles?: string[];
9
- }
10
- type AuthToken = {
11
- oneTimeToken: string;
12
- expiresAt: string;
13
- };
14
4
  export interface AuthContextType {
15
5
  user: User | null;
16
- logout: () => void;
17
- deleteUser: () => void;
6
+ logout: () => Promise<void>;
7
+ deleteUser: () => Promise<void>;
8
+ refreshSession: () => Promise<void>;
18
9
  isAuthenticated: boolean;
19
10
  hasRole: (role: string) => boolean | undefined;
20
11
  apiHost: string;
21
- token: AuthToken | null;
22
12
  markSignedIn: () => void;
23
13
  hasSignedInBefore: boolean;
24
14
  mode: AuthMode;
25
15
  credentials: Credential[];
26
16
  updateCredential: (credential: Credential) => Promise<Credential>;
27
17
  deleteCredential: (credentialId: string) => Promise<void>;
18
+ login: (identifier: string, passkeyAvailable: boolean) => Promise<Response | null>;
19
+ handlePasskeyLogin: () => Promise<boolean>;
28
20
  loading: boolean;
29
21
  }
30
- export interface Credential {
31
- id: string;
32
- counter: number;
33
- transports?: AuthenticatorTransportFuture[];
34
- deviceType: CredentialDeviceType;
35
- backedup: boolean;
36
- friendlyName: string | null;
37
- lastUsedAt: Date | null;
38
- platform: string | null;
39
- browser: string | null;
40
- deviceInfo: string | null;
41
- }
42
22
  /**
43
23
  * Returns the current context
44
24
  * @returns {AuthContextType} AuthContext
@@ -0,0 +1,56 @@
1
+ import { AuthMode } from '../fetchWithAuth';
2
+ import { Credential, User } from '../types';
3
+ export interface SeamlessAuthClientOptions {
4
+ apiHost: string;
5
+ mode: AuthMode;
6
+ }
7
+ export interface LoginInput {
8
+ identifier: string;
9
+ passkeyAvailable: boolean;
10
+ }
11
+ export interface RegisterInput {
12
+ email: string;
13
+ phone: string;
14
+ bootstrapToken?: string | null;
15
+ }
16
+ export interface PasskeyMetadata {
17
+ friendlyName: string;
18
+ platform: string;
19
+ browser: string;
20
+ deviceInfo: string;
21
+ }
22
+ export interface CurrentUserResult {
23
+ user: User;
24
+ credentials: Credential[];
25
+ }
26
+ export interface PasskeyLoginResult {
27
+ success: boolean;
28
+ mfaRequired: boolean;
29
+ message: string;
30
+ }
31
+ export interface PasskeyRegistrationResult {
32
+ success: boolean;
33
+ message: string;
34
+ }
35
+ export interface SeamlessAuthClient {
36
+ getCurrentUser: () => Promise<Response>;
37
+ login: (input: LoginInput) => Promise<Response>;
38
+ loginWithPasskey: () => Promise<PasskeyLoginResult>;
39
+ logout: () => Promise<Response>;
40
+ deleteUser: () => Promise<Response>;
41
+ register: (input: RegisterInput) => Promise<Response>;
42
+ requestPhoneOtp: () => Promise<Response>;
43
+ verifyPhoneOtp: (verificationToken: string) => Promise<Response>;
44
+ requestEmailOtp: () => Promise<Response>;
45
+ verifyEmailOtp: (verificationToken: string) => Promise<Response>;
46
+ requestMagicLink: () => Promise<Response>;
47
+ checkMagicLink: () => Promise<Response>;
48
+ verifyMagicLink: (token: string) => Promise<Response>;
49
+ registerPasskey: (metadata: PasskeyMetadata) => Promise<PasskeyRegistrationResult>;
50
+ updateCredential: (input: {
51
+ id: string;
52
+ friendlyName: string | null;
53
+ }) => Promise<Response>;
54
+ deleteCredential: (id: string) => Promise<Response>;
55
+ }
56
+ export declare const createSeamlessAuthClient: (opts: SeamlessAuthClientOptions) => SeamlessAuthClient;
@@ -4,6 +4,7 @@ interface Props {
4
4
  value: string;
5
5
  inputMode?: 'numeric' | 'text';
6
6
  onChange: (value: string) => void;
7
+ name?: string;
7
8
  }
8
9
  declare const OtpInput: React.FC<Props>;
9
10
  export default OtpInput;
@@ -0,0 +1 @@
1
+ export declare const useAuthClient: () => import("@/client/createSeamlessAuthClient").SeamlessAuthClient;
@@ -0,0 +1,4 @@
1
+ export declare const usePasskeySupport: () => {
2
+ passkeySupported: boolean;
3
+ loading: boolean;
4
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
- import { AuthContextType, AuthProvider, useAuth, Credential, User } from '@/AuthProvider';
1
+ import { AuthContextType, AuthProvider, useAuth } from '@/AuthProvider';
2
2
  import { AuthRoutes } from '@/AuthRoutes';
3
- export { AuthProvider, AuthRoutes, useAuth };
4
- export type { AuthContextType, Credential, User };
3
+ import { createSeamlessAuthClient, CurrentUserResult, LoginInput, PasskeyLoginResult, PasskeyMetadata, PasskeyRegistrationResult, RegisterInput, SeamlessAuthClient, SeamlessAuthClientOptions } from '@/client/createSeamlessAuthClient';
4
+ import { AuthMode } from '@/fetchWithAuth';
5
+ import { useAuthClient } from '@/hooks/useAuthClient';
6
+ import { usePasskeySupport } from '@/hooks/usePasskeySupport';
7
+ import { Credential, User } from '@/types';
8
+ export { AuthProvider, AuthRoutes, createSeamlessAuthClient, useAuth, useAuthClient, usePasskeySupport, };
9
+ export type { AuthContextType, AuthMode, Credential, CurrentUserResult, LoginInput, PasskeyLoginResult, PasskeyMetadata, PasskeyRegistrationResult, RegisterInput, SeamlessAuthClient, SeamlessAuthClientOptions, User, };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import{createContext as i,useContext as r,useState as t,useEffect as a,useCallback as l,useRef as s}from"react";import{useNavigate as d,useSearchParams as c,useLocation as _,Routes as m,Route as u,Navigate as g}from"react-router-dom";import{startAuthentication as p,startRegistration as h,WebAuthnError as f}from"@simplewebauthn/browser";import y,{AsYouType as b,parsePhoneNumberFromString as k}from"libphonenumber-js";const v=i(void 0),x=({value:o,children:n})=>e(v.Provider,{value:o,children:n}),w=()=>{const e=r(v);if(!e)throw new Error("useInternalAuth must be used within InternalAuthProvider");return e},N=e=>{const{authMode:o,authHost:n}=e;return async function(e,i){const r=`${n}${"server"===o?"auth":""}${e.startsWith("/")?e:`/${e}`}`,t={...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}},a=await fetch(r,t);if(a.ok)return a;throw console.warn("Auth fetch failed:",a.status,r),new Error(`Failed to make API call to ${r}`)}};const P=i(void 0),C=()=>{const e=r(P);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},T=({children:o,apiHost:n,autoDetectPreviousSignin:i=!0,mode:r="web"})=>{const[s,d]=t(null),[c,_]=t([]),[m,u]=t(!1),[g,p]=t(!0),[h,f]=t(null),{hasSignedInBefore:y,markSignedIn:b}=function(e="seamlessauth_seen"){const[o,n]=t(!1);return a(()=>{try{"true"===localStorage.getItem(e)&&n(!0)}catch{}},[e]),{hasSignedInBefore:o,markSignedIn:()=>{try{localStorage.setItem(e,"true"),n(!0)}catch{}}}}(),[k]=t(r),v=N({authMode:k,authHost:n}),w=l(async()=>{if(s)try{await v("/logout",{method:"GET"})}catch{console.error("Error during logout")}finally{u(!1),d(null),f(null)}},[v,s]),C=async()=>{p(!0);try{const e=await v("users/me",{method:"GET"});if(e.ok){const{user:o,credentials:n}=await e.json();d(o),_(n),u(!0)}else w()}catch{w()}finally{p(!1)}};return a(()=>{C()},[]),a(()=>{s&&m&&b()},[s,m,b]),e(P.Provider,{value:{user:s,logout:w,loading:g,deleteUser:async()=>{try{if((await v("/users/delete",{method:"delete"})).ok)return d(null),u(!1),void f(null);throw new Error("Could not delete user.")}catch(e){throw console.error("Something went wrong deleting user:",e),new Error("Could not delete user.")}},isAuthenticated:m,hasRole:e=>s?.roles?.includes(e),apiHost:n,token:h,markSignedIn:b,hasSignedInBefore:!!i&&y,mode:r,credentials:c,updateCredential:async e=>{const o=await v("users/credentials",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({friendlyName:e.friendlyName,id:e.id})});if(o.ok)return o.json();throw new Error("Failed to update credential")},deleteCredential:async e=>{const o=await v("users/credentials",{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})});if(o.ok)return o.json();throw new Error("Failed to update credential")}},children:e(x,{value:{validateToken:C,setLoading:p},children:o})})};function M(e,o){void 0===o&&(o={});var n=o.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}var S="login-module__container___YggDx",I="login-module__card___Ub-Py",O="login-module__heading___neEqb",E="login-module__inputGroup___P6qgS",A="login-module__label___mx5vu",j="login-module__input___U07lW",B="login-module__helperText___kDQ4-",z="login-module__error___40zxh",F="login-module__button___0kFBs",G="login-module__toggle___1JiG1",L="login-module__underline___gs-RS",V="login-module__phoneRow___oeNtq",H="login-module__select___rRV1O",D="login-module__phoneInput___2MPQC",R="login-module__fallbackCard___HdIk-",U="login-module__fallbackHeader___-il2v",q="login-module__fallbackDescription___ea5EB",K="login-module__fallbackActions___AD3ni",J="login-module__fallbackActionButton___lFgWf",W="login-module__actionTitle___ycrMp",$="login-module__actionSubtext___opaIV",Y="login-module__linkButton___5lsoe";M(".login-module__container___YggDx{align-items:center;color:#fff;display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:#1f2937;border-radius:.5rem;box-shadow:0 4px 6px rgba(0,0,0,.1);max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:#68d391;text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:#d1d5db;display:block}.login-module__input___U07lW{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px #3b82f6;outline:none}.login-module__helperText___kDQ4-{color:#9ca3af;font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:#f87171;font-size:.875rem}.login-module__button___0kFBs{background-color:#2563eb;border-radius:.375rem;color:#fff;cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:#1d4ed8}.login-module__button___0kFBs:disabled{background-color:#9ca3af;cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:hsla(0,0%,100%,.04);border:1px solid hsla(0,0%,100%,.08);border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:#f3f4f6;font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:#9ca3af;font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:rgba(0,0,0,.25);border:1px solid hsla(0,0%,100%,.08);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:hsla(0,0%,100%,.06);border-color:hsla(0,0%,100%,.15)}.login-module__actionTitle___ycrMp{color:#f9fafb;font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:#9ca3af;font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");var Z="termsModal-module__overlay___-j6r5",Q="termsModal-module__modal___4PxZV",X="termsModal-module__header___B7wxb",ee="termsModal-module__title___Sucwt",oe="termsModal-module__closeBtn___evIs5",ne="termsModal-module__content___5BDhN",ie="termsModal-module__link___oPZrU";M(".termsModal-module__overlay___-j6r5{align-items:center;background-color:rgba(0,0,0,.7);display:flex;inset:0;justify-content:center;position:fixed;z-index:999}.termsModal-module__modal___4PxZV{background-color:#1a1a1a;border-radius:8px;box-shadow:0 10px 25px rgba(0,0,0,.4);color:#fff;max-height:80vh;max-width:640px;outline:none;overflow-y:auto;padding:24px;width:100%}.termsModal-module__header___B7wxb{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.termsModal-module__title___Sucwt{color:#60a5fa;font-size:1.25rem;font-weight:700}.termsModal-module__closeBtn___evIs5{background:none;border:none;color:#ccc;cursor:pointer;font-size:1.75rem}.termsModal-module__closeBtn___evIs5:hover{color:#fff}.termsModal-module__content___5BDhN{color:#d1d5db;font-size:.9rem;line-height:1.6}.termsModal-module__link___oPZrU{color:#60a5fa;text-decoration:underline}.termsModal-module__link___oPZrU:hover{text-decoration:none}");const re=({isOpen:n,onClose:i})=>{const r=s(null);return a(()=>{const e=e=>{"Escape"===e.key&&i()};return n&&(document.addEventListener("keydown",e),r.current?.focus()),()=>{document.removeEventListener("keydown",e)}},[n,i]),n?e("div",{className:Z,role:"dialog","aria-modal":"true","aria-labelledby":"terms-title",children:o("div",{className:Q,tabIndex:-1,ref:r,children:[o("div",{className:X,children:[e("h2",{id:"terms-title",className:ee,children:"SMS Terms & Conditions"}),e("button",{onClick:i,className:oe,children:"×"})]}),o("div",{className:ne,children:[o("p",{children:[e("strong",{children:"Effective Date:"})," June 01, 2025"]}),e("p",{children:"By providing your phone number to SeamlessAuth, a Fells Code LLC product, you agree to receive SMS messages for identity verification, authentication, and account security."}),o("p",{children:[e("strong",{children:"1. Purpose:"})," SMS is used only for account security (OTP, MFA). No marketing messages."]}),o("p",{children:[e("strong",{children:"2. Frequency:"})," Based on login and account activity."]}),o("p",{children:[e("strong",{children:"3. Opt-Out:"})," Contact support@seamlessauth.com to opt out."]}),o("p",{children:[e("strong",{children:"4. Fees:"})," Message and data rates may apply."]}),o("p",{children:[e("strong",{children:"5. Supported Carriers:"})," Most major providers supported, delivery not guaranteed."]}),o("p",{children:[e("strong",{children:"6. Privacy:"})," Your phone number is not shared or sold. See our Privacy Policy."]}),o("p",{children:[e("strong",{children:"7. Changes:"})," Terms may be updated with notice on this page."]}),o("p",{children:["Questions? Email us at"," ",e("a",{className:ie,href:"mailto:support@seamlessauth.com",children:"support@seamlessauth.com"}),"."]})]})]})}):null},te=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"}];function ae({phone:n,setPhone:i,phoneError:r,setPhoneError:l}){const[s,d]=t(!1),[c,_]=t(te[0]);a(()=>{const e=function(){try{const e=Intl.DateTimeFormat().resolvedOptions().locale||"en-US",o=e.split("-")[1]?.toUpperCase()||"US";return te.find(e=>e.code===o)||te[0]}catch{return te[0]}}();_(e)},[]);return o("div",{className:E,children:[e("label",{id:"phone",className:A,children:"Phone Number"}),o("div",{className:V,children:[e("select",{value:c.code,onChange:e=>{const o=te.find(o=>o.code===e.target.value);if(o){_(o);const e=n.replace(/^\+\d+/,""),r=(new b).input(o.dialCode+e);i(r)}},className:H,children:te.map(e=>o("option",{value:e.code,children:[e.flag," (",e.dialCode,")"]},e.code))}),e("input",{"aria-labelledby":"phone",type:"tel",value:n,onChange:e=>{const o=e.target.value,n=o.startsWith(c.dialCode)?o:c.dialCode+o,t=(new b).input(n);i(t),r&&l("")},onBlur:()=>{if(n){const e=k(n),o=e?.isValid();l(o?"":"Please enter a valid phone number.")}},autoComplete:"off",placeholder:"(555) 123-4567",className:D})]}),o("p",{className:B,children:["By signing up, you agree to our"," ",e("button",{onClick:()=>d(!0),className:L,children:"SMS Terms & Conditions"}),"."]}),r&&e("p",{className:z,children:r}),e(re,{isOpen:s,onClose:()=>d(!1)})]})}const le=e=>{if("string"!=typeof e)return!1;const o=e.trim();if(o.length<3||o.length>320)return!1;const n=o.split("@");if(2!==n.length)return!1;const[i,r]=n;return!(!/^[A-Za-z0-9._%+-]+$/.test(i)||i.startsWith(".")||i.endsWith(".")||i.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(r)||r.startsWith("-")||r.endsWith("-")||r.startsWith(".")||r.endsWith(".")||r.includes(".."))},se=e=>{const o=y(e);return o?.isValid()||!1};async function de(){if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch(e){return console.error("Error checking passkey support:",e),!1}return!1}const ce=({identifier:n,onMagicLink:i,onPhoneOtp:r,onPasskeyRetry:t})=>{const a=le(n),l=se(n);return o("div",{className:R,children:[e("div",{className:U,children:"Passkeys unavailable on this device"}),e("p",{className:q,children:"Choose another secure sign-in method."}),o("div",{className:K,children:[a&&o("button",{type:"button",className:J,onClick:i,children:[e("span",{className:W,children:"Email Magic Link"}),e("span",{className:$,children:"Send a secure sign-in link to your email"})]}),l&&o("button",{type:"button",className:J,onClick:r,children:[e("span",{className:W,children:"Text Message Code"}),e("span",{className:$,children:"Receive a one-time code via SMS"})]})]}),e("button",{type:"button",className:Y,onClick:t,children:"Try passkey anyway"})]})},_e=()=>{const i=d(),{apiHost:r,hasSignedInBefore:l,mode:s}=C(),{validateToken:c}=w(),[_,m]=t(""),[u,g]=t(""),[h,f]=t("register"),[y,b]=t(""),[k,v]=t(""),[x,P]=t(""),[T,M]=t(""),[L,V]=t(""),[H,D]=t(!1),[R,U]=t(!1),[q,K]=t(null),J=N({authMode:s,authHost:r});a(()=>{!async function(){const e=await de();D(e)}(),l&&f("login");const e=new URLSearchParams(window.location.search).get("bootstrapToken");e&&e.length>10&&(K(e),console.log("Bootstrap token detected in URL"))},[l]);const W=async()=>{try{const e=await J("/webAuthn/login/start",{method:"POST"});if(!e.ok)return void console.error("Something went wrong getting webauthn options");const o=await e.json(),n=await p({optionsJSON:o}),r=await J("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:n})});r.ok||console.error("Failed to verify passkey");const t=await r.json();if("Success"===t.message)return t.mfaLogin?void i("/mfaLogin"):(await c(),void i("/"));console.error("Passkey login failed:",t.message)}catch(e){console.error("Passkey login error:",e)}};return e("div",{className:S,children:o("div",{className:I,children:[e("h2",{className:O,children:"login"===h?"Sign In":"Create Account"}),e(n,{children:o("form",{onSubmit:async e=>{e.preventDefault(),"login"===h&&(async()=>{if(v(""),(await J("/login",{method:"POST",body:JSON.stringify({identifier:_,passkeyAvailable:H})})).ok)if(H)try{await W()}catch(e){console.error("Passkey login failed",e),U(!0)}else U(!0);else v("Failed to send login link. Please try again.")})(),"register"===h&&(async()=>{v("");try{const e=await J("/registration/register",{method:"POST",body:JSON.stringify({email:u,phone:y,...q?{bootstrapToken:q}:{}})});if(!e.ok)return void v("Failed to register. Please try again.");"Success"===(await e.json()).message&&i("/verifyPhoneOTP"),v("An unexpected error occured. Try again. If the problem persists, try resetting your password")}catch(e){console.error("Unexpected login error",e),v("An unexpected error occured. Try again. If the problem persists, try resetting your password")}})()},children:["login"===h&&o("div",{className:E,children:[e("label",{htmlFor:"identifier",className:A,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:_,onChange:e=>{const o=e.target.value;m(o)},autoComplete:"off",placeholder:"Email or Phone Number",className:j,onBlur:()=>{if(_){const e=le(_)||se(_);V(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:B,children:"Phone numbers must include a country code e.g. +1"}),R&&e(ce,{identifier:_,onMagicLink:async()=>{try{if(!(await J("/magic-link",{method:"GET"})).ok)return void v("Failed to send magic link.");i("/magic-link-sent")}catch(e){console.error(e),v("Failed to send magic link.")}},onPhoneOtp:async()=>{try{if(!(await J("/login/phone-otp",{method:"POST",body:JSON.stringify({identifier:_})})).ok)return void v("Failed to send OTP.");i("/verifyPhoneOTP")}catch(e){console.error(e),v("Failed to send OTP.")}},onPasskeyRetry:W}),L&&e("p",{className:z,children:L})]}),"register"===h&&o(n,{children:[o("div",{className:E,children:[e("label",{htmlFor:"email",className:A,children:"Email Address"}),e("input",{id:"email",type:"email",value:u,onChange:e=>{const o=e.target.value;g(o)},autoComplete:"off",className:j,onBlur:()=>{if(u){const e=le(u);M(e?"":"Please enter a valid email")}},required:!0}),T&&e("p",{className:z,children:T})]}),e(ae,{phone:y,setPhone:b,phoneError:x,setPhoneError:P})]}),e("button",{type:"submit",className:F,disabled:!("login"===h&&_?le(_)||se(_):le(u)&&se(y)),children:"login"===h?"Login":"Register"}),k&&e("p",{className:z,children:k}),e("button",{type:"button",onClick:()=>f("login"===h?"register":"login"),className:G,children:"login"===h?"Don't have an account? Create one":"Already have an account? Sign in"})]})})]})})};var me="passKeyLogin-module__container___IUKxF",ue="passKeyLogin-module__card___2sKM1",ge="passKeyLogin-module__title___HZxvc",pe="passKeyLogin-module__button___FvR4I";M(".passKeyLogin-module__container___IUKxF{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:#1d4ed8}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const he=()=>{const n=d(),{apiHost:i,mode:r}=C(),{validateToken:t}=w(),a=N({authMode:r,authHost:i});return e("div",{className:me,children:o("div",{className:ue,children:[e("h2",{className:ge,children:"Login with Passkey"}),e("button",{onClick:async()=>{try{const e=await a("/webAuthn/login/start",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok)return void console.error("Something went wrong getting webauthn options");const o=await e.json(),i=await p({optionsJSON:o}),r=await a("/webAuthn/login/finish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assertionResponse:i}),credentials:"include"});r.ok||console.error("Failed to verify passkey");const l=await r.json();if("Success"===l.message)return l.mfaLogin&&n("/mfaLogin"),await t(),void n("/");console.error("Passkey login failed")}catch{console.error("Passkey login error")}},className:pe,children:"Use Passkey"})]})})};var fe="registerPasskey-module__container___jqEh8",ye="registerPasskey-module__card___MJAyC",be="registerPasskey-module__loading___Q4i1x",ke="registerPasskey-module__spinner___V1nhd",ve="registerPasskey-module__supported___ihTih",xe="registerPasskey-module__title___vn2Qu",we="registerPasskey-module__description___AWmO-",Ne="registerPasskey-module__button___D3b4B",Pe="registerPasskey-module__message___RiOw-",Ce="registerPasskey-module__success___HP5aX",Te="registerPasskey-module__error___hGiqE";M(".registerPasskey-module__container___jqEh8{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:#f9fafb;border-radius:.75rem;box-shadow:0 2px 8px rgba(0,0,0,.1);color:#374151;display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-color:#3b82f6 transparent;border-radius:9999px;border-style:solid;border-width:2px;height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:#ecfdf5;border-radius:.75rem;box-shadow:0 2px 12px rgba(0,0,0,.1);color:#065f46;padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:#059669;border:none;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:#047857}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:#6ee7b7}.registerPasskey-module__error___hGiqE{color:#f87171}");var Me="deviceNameModal-module__overlay___fmdPd",Se="deviceNameModal-module__modal___uoEda",Ie="deviceNameModal-module__description___-HMTA",Oe="deviceNameModal-module__input___4vQMI",Ee="deviceNameModal-module__actions___KXw7b",Ae="deviceNameModal-module__primary___9Ozlk",je="deviceNameModal-module__secondary___HILhc";M(".deviceNameModal-module__overlay___fmdPd{align-items:center;background:rgba(0,0,0,.45);display:flex;inset:0;justify-content:center;position:fixed;z-index:1000}.deviceNameModal-module__modal___uoEda{background:#1f2937;border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,.15);color:#fff;max-width:420px;padding:24px;width:100%}.deviceNameModal-module__description___-HMTA{color:#fff;font-size:14px;margin-bottom:16px}.deviceNameModal-module__input___4vQMI{border:1px solid #ddd;border-radius:8px;font-size:14px;margin-bottom:20px;padding:10px 12px;width:100%}.deviceNameModal-module__actions___KXw7b{display:flex;gap:10px;justify-content:flex-end}.deviceNameModal-module__primary___9Ozlk{background:#2563eb;border:none;border-radius:8px;color:#fff;cursor:pointer;padding:8px 14px}.deviceNameModal-module__secondary___HILhc{background:transparent;border:1px solid #ccc;border-radius:8px;cursor:pointer;padding:8px 14px}");const Be=({isOpen:n,onCancel:i,onConfirm:r})=>{const[a,l]=t("");return n?e("div",{className:Me,children:o("div",{className:Se,children:[e("h3",{children:"Name This Device"}),e("p",{className:Ie,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:a,onChange:e=>l(e.target.value),className:Oe,autoFocus:!0}),o("div",{className:Ee,children:[e("button",{onClick:i,className:je,children:"Cancel"}),e("button",{onClick:()=>r(a.trim()),disabled:!a.trim(),className:Ae,children:"Continue"})]})]})}):null},ze=()=>{const{apiHost:i,mode:r}=C(),{validateToken:l}=w(),s=d(),[c,_]=t("idle"),[m,u]=t(""),[g,p]=t(!1),[y,b]=t(!1),[k,v]=t(null),x=N({authMode:r,authHost:i});a(()=>{!async function(){const e=await de();p(e)}()},[]);const P=async(e,o)=>{if(!(await x("/webAuthn/register/finish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attestationResponse:e,metadata:o}),credentials:"include"})).ok)throw new Error("Verification failed");await l()};return o(n,{children:[e("div",{className:fe,children:e("div",{className:ye,children:o("div",g?{className:ve,children:[e("h2",{className:xe,children:"Secure Your Account with a Passkey"}),e("p",{className:we,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>{const{platform:e,browser:o,deviceInfo:n}=function(){const e=navigator.userAgent.toLowerCase();let o="unknown",n="unknown";return/iphone|ipad|ipod/.test(e)?o="ios":/android/.test(e)?o="android":/mac os/.test(e)?o="mac":/windows/.test(e)?o="windows":/linux/.test(e)&&(o="linux"),/chrome/.test(e)&&(n="chrome"),/safari/.test(e)&&!/chrome/.test(e)&&(n="safari"),/firefox/.test(e)&&(n="firefox"),/edg/.test(e)&&(n="edge"),{platform:o,browser:n,deviceInfo:`${o} • ${n}`}}();v({platform:e,browser:o,deviceInfo:n}),b(!0)},disabled:"loading"===c,className:Ne,children:"loading"===c?"Registering...":"Register Passkey"}),m&&e("p",{className:`${Pe} ${"success"===c?Ce:Te}`,children:m})]}:{className:be,children:[e("div",{className:ke}),e("span",{children:"Checking for Passkey Support..."})]})})}),e(Be,{isOpen:y,onCancel:()=>{b(!1),v(null)},onConfirm:async e=>{if(!k)return;const{platform:o,browser:n,deviceInfo:i}=k;_("loading");try{const r=await x("/webAuthn/register/start",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!r.ok)throw new Error("Failed to fetch challenge");const t=await r.json();let a;try{a=await h({optionsJSON:t})}catch(e){if(e instanceof f)throw new Error(e.name);throw e}await P(a,{friendlyName:e,platform:o,browser:n,deviceInfo:i}),_("success"),u("Passkey registered successfully."),s("/")}catch(e){console.error(e),_("error"),u("Error registering passkey.")}finally{b(!1),v(null)}}})]})};var Fe="verifyOTP-module__container___wgoDE",Ge="verifyOTP-module__card___3cs2p",Le="verifyOTP-module__title___fZ-1d",Ve="verifyOTP-module__subtitle___dGSu3",He="verifyOTP-module__error___GEtlG",De="verifyOTP-module__success___46TjG",Re="verifyOTP-module__form___jiGG-",Ue="verifyOTP-module__label___Zq5Mi",qe="verifyOTP-module__timer___smq-a",Ke="verifyOTP-module__resend___PlmkG",Je="verifyOTP-module__button___8pIuO",We="verifyOTP-module__toggle___wbzVa";M(".verifyOTP-module__container___wgoDE{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:#9ca3af;font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:#f87171;margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:#34d399;margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:#d1d5db;display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:#facc15;font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:#374151;border:1px solid #4b5563;border-radius:.375rem;color:#fff;outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px #3b82f6}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:#3b82f6}.verifyOTP-module__button___8pIuO{background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:#1d4ed8}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var $e="otpInput-module__otpContainer___MUjby",Ye="otpInput-module__otpInput___3YMVm";M(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:#374151;border:1px solid #4b5563;border-radius:8px;color:#fff;font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:#60a5fa;box-shadow:0 0 0 2px rgba(96,165,250,.25);outline:none}");const Ze=({length:o=6,value:n,inputMode:i="numeric",onChange:r})=>{const t=s([]),a=n.split("").concat(Array(o).fill("")).slice(0,o);return e("div",{className:$e,onPaste:e=>{const n=e.clipboardData.getData("text").replace(/\D/g,"");n.length===o&&(r(n),t.current[o-1]?.focus()),e.preventDefault()},children:a.map((o,l)=>e("input",{ref:e=>t.current[l]=e,type:"text",inputMode:i,maxLength:1,value:o||"",className:Ye,onChange:e=>((e,o)=>{if("numeric"===i&&!/^\d?$/.test(o))return;if("text"===i&&!/[a-z]/i.test(o))return;const a=n.substring(0,e)+o+n.substring(e+1);r(a.trim()),o&&t.current[e+1]&&t.current[e+1]?.focus()})(l,e.target.value),onKeyDown:e=>((e,o)=>{"Backspace"===o.key&&!a[e]&&t.current[e-1]&&t.current[e-1]?.focus()})(l,e)},l))})},Qe=()=>{const n=d(),{apiHost:i,mode:r}=C(),[l,s]=t(""),[c,_]=t(null),[m,u]=t(""),[g,p]=t(!1),[h,f]=t(""),[y,b]=t(300),k=N({authMode:r,authHost:i}),v=async()=>{p(!0);try{if(!c){(await k("/otp/verify-phone-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:l}),credentials:"include"})).ok?_(!0):u("Verification failed.")}}catch(e){console.error(e),u("Verification failed.")}p(!1)},x=async()=>{f(""),await(async()=>{u("");const e=await k("/otp/generate-phone-otp",{method:"GET",headers:{"Content-Type":"application/json"}}),o=await e.json();e.ok?(o.token&&localStorage.setItem("token",o.token),f("Verification SMS has been resent.")):u("Failed to send SMS code. If this persists, refresh the page and try again.")})(),f("Verification SMS has been resent.")};return a(()=>{const e=setInterval(()=>{b(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),a(()=>{c&&(async()=>{(await k("/otp/generate-email-otp",{method:"GET",headers:{"Content-Type":"application/json"}})).ok?n("/verifyEmailOTP"):u("Failed to send Email code. If this persists, refresh the page and try registering again.")})()},[c,n,k]),e("div",{className:Fe,children:o("div",{className:Ge,children:[e("h2",{className:Le,children:"Verify Your Phone Number"}),e("p",{className:Ve,children:"Enter the code sent to your phone number."}),m&&e("p",{className:He,children:m}),h&&e("p",{className:De,children:h}),o("form",{onSubmit:async e=>{if(e.preventDefault(),u(""),6===l.length){p(!0);try{v()}catch{u("Unexpected error occurred.")}finally{p(!1)}}else u("Please enter a valid code.")},className:Re,children:[o("div",{children:[o("label",{htmlFor:"phoneCode",className:Ue,children:["Phone Verification Code ",(P=c,!0===P?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===P?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",o("span",{className:qe,children:["Code expires in: ",(w=y,`${Math.floor(w/60).toString().padStart(2,"0")}:${(w%60).toString().padStart(2,"0")}`)]})]}),e(Ze,{length:6,value:l,onChange:s}),e("button",{type:"button",onClick:()=>x(),className:Ke,children:"Resend code to phone"})]}),e("button",{type:"submit",className:Je,children:g?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>n("/login"),className:We,children:"Back to login"})]})]})});var w,P},Xe=()=>{const n=d(),{apiHost:i,mode:r}=C(),{validateToken:l}=w(),[s,c]=t(!1),[_,m]=t(""),[u,g]=t(300),[p,h]=t(""),[f,y]=t(""),[b,k]=t(!1),v=N({authMode:r,authHost:i});return a(()=>{const e=setInterval(()=>{g(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),a(()=>{!async function(){const e=await de();k(e)}()},[]),e("div",{className:Fe,children:o("div",{className:Ge,children:[e("h2",{className:Le,children:"Verify Your Email"}),e("p",{className:Ve,children:"We sent you a verification email. Enter the code below."}),p&&e("p",{className:He,children:p}),f&&e("p",{className:De,children:f}),o("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===_.length){c(!0);try{if(!(await v("/otp/verify-email-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:_}),credentials:"include"})).ok)return void h("Verification failed.");b?n("/registerPasskey"):(await l(),n("/"))}catch(e){console.error(e),h("Verification failed.")}finally{c(!1)}}else h("Please enter a valid code.")},className:Re,children:[o("div",{children:[o("label",{htmlFor:"emailCode",className:Ue,children:["Email Verification Code",o("span",{className:qe,children:[" ","— Code expires in ",(x=u,`${Math.floor(x/60).toString().padStart(2,"0")}:${(x%60).toString().padStart(2,"0")}`)]})]}),e(Ze,{length:6,value:_,onChange:m,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),y("");(await v("/otp/generate-email-otp",{method:"GET",headers:{"Content-Type":"application/json"}})).ok?y("Verification email has been resent."):h("Failed to send Email code. If this persists, refresh the page and try again.")},className:Ke,children:"Resend code to email"})]}),e("button",{type:"submit",className:Je,disabled:s,children:s?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>n("/login"),className:We,children:"Back to login"})]})]})});var x};var eo={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"};M(".verifyMagiclink-module__container___qrSXf{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid hsla(0,0%,100%,.15);border-radius:50%;border-top-color:#60a5fa;height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:#34d399;height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:#34d399;font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const oo=()=>{const[n]=c(),i=d(),r=n.get("token"),{apiHost:l,mode:s}=C(),[_,m]=t(""),[u,g]=t(""),p=N({authMode:s,authHost:l});return a(()=>{r?(async()=>{if(!(await p(`/magic-link/verify/${r}`,{method:"GET",headers:{"Content-Type":"application/json"}})).ok)return console.error("Failed to verify token"),void m("Failed to verify token");new BroadcastChannel("seamless-auth").postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),g("You have been verified on the device and browser that initiated this request"),setTimeout(()=>{i("/")},900)})():(m("Missing token for verification."),console.error("No token found",r))},[r,p,i]),e("div",{className:eo.container,children:o("div",{className:eo.card,children:[e("h1",{className:eo.title,children:"Verifying your login"}),o("div",{className:eo.verificationContent,children:[!u&&!_&&e("div",{className:eo.spinner}),u&&e("div",{className:eo.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:eo.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!u&&!_&&e("p",{className:eo.helperText,children:"Please wait while we securely verify your sign-in link."}),u&&e("p",{className:eo.successText,children:"Login verified. Redirecting…"}),_&&e("p",{className:eo.error,children:_})]})]})})};var no="magiclink-module__container___45zcA",io="magiclink-module__card___Au9oN",ro="magiclink-module__iconWrapper___k5ndr",to="magiclink-module__mailIcon___Pwb7q",ao="magiclink-module__iconRing___bdLvf",lo="magiclink-module__heading___b9cre",so="magiclink-module__message___kiVFj",co="magiclink-module__identifier___JtcFM",_o="magiclink-module__helperText___7Mlfh",mo="magiclink-module__actions___64I-3",uo="magiclink-module__secondaryButton___BntAI",go="magiclink-module__cooldown___Ib4rm",po="magiclink-module__linkButton___maJiv";M(".magiclink-module__container___45zcA{align-items:center;color:#fff;display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:#1f2937;border-radius:.75rem;box-shadow:0 10px 25px rgba(0,0,0,.25);max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:#a5b4fc;height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:#d1d5db;font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:hsla(0,0%,100%,.05);border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:#9ca3af;font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:#111827;border:1px solid #374151;border-radius:8px;color:#fff;cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:#1f2937}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:#9ca3af;font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:#a5b4fc;cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const ho=()=>{const{apiHost:n,mode:i}=C(),{validateToken:r}=w(),l=d(),s=_(),c=N({authMode:i,authHost:n}),m=s.state?.identifier,[u,g]=t(30);a(()=>{const e=setInterval(()=>{g(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);return a(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{if("MAGIC_LINK_AUTH_SUCCESS"===e.data?.type){200===(await c("/magic-link/check",{method:"GET",headers:{"Content-Type":"application/json"}})).status&&(await r(),l("/"))}},()=>{e.close()}},[c,l,r]),a(()=>{const e=setInterval(async()=>{try{200===(await c("/magic-link/check",{method:"GET",headers:{"Content-Type":"application/json"}})).status&&(await r(),l("/"))}catch{}},5e3);return()=>clearInterval(e)},[n,r,l]),e("div",{className:no,children:o("div",{className:io,children:[o("div",{className:ro,children:[e("div",{className:ao}),o("svg",{className:to,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:lo,children:"Check your email"}),e("p",{className:so,children:"If an account exists for this address, we sent a secure sign-in link."}),e("div",{className:co,children:m}),e("p",{className:_o,children:"Open the email and click the link to finish signing in."}),e("p",{className:_o,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),o("div",{className:mo,children:[e("button",{className:uo,disabled:u>0,onClick:async()=>{u>0||(await c("/magic-link",{method:"GET",headers:{"Content-Type":"application/json"}}),g(30))},children:"Resend link"}),u>0&&o("div",{className:go,children:["Available in ",u,"s"]}),e("button",{className:po,onClick:()=>l("/login"),children:"Change email or phone"})]})]})})},fo=()=>o(m,{children:[e(u,{path:"/login",element:e(_e,{})}),e(u,{path:"/passKeyLogin",element:e(he,{})}),e(u,{path:"/verifyPhoneOTP",element:e(Qe,{})}),e(u,{path:"/verifyEmailOTP",element:e(Xe,{})}),e(u,{path:"/verify-magiclink",element:e(oo,{})}),e(u,{path:"/registerPasskey",element:e(ze,{})}),e(u,{path:"/magic-link-sent",element:e(ho,{})}),e(u,{path:"*",element:e(g,{to:"/login",replace:!0})})]});export{T as AuthProvider,fo as AuthRoutes,C as useAuth};
1
+ import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import{startRegistration as r,WebAuthnError as i,startAuthentication as t}from"@simplewebauthn/browser";import{useState as a,useEffect as s,createContext as l,useMemo as d,useCallback as c,useContext as _,useRef as m}from"react";import{useNavigate as u,useSearchParams as g,useLocation as p,Routes as h,Route as f,Navigate as y}from"react-router-dom";import b,{AsYouType as k,parsePhoneNumberFromString as v}from"libphonenumber-js";const x=e=>{const o=(e=>{const{authMode:o,authHost:n}=e;return async function(e,r){const i=`${n}${"server"===o?"auth":""}${e.startsWith("/")?e:`/${e}`}`,t={...r,credentials:"include",headers:{"Content-Type":"application/json",...r?.headers}},a=await fetch(i,t);return a.ok||console.warn("Auth fetch failed:",a.status,i),a}})({authMode:e.mode,authHost:e.apiHost});return{getCurrentUser:()=>o("users/me",{method:"GET"}),login:e=>o("/login",{method:"POST",body:JSON.stringify(e)}),loginWithPasskey:async()=>{const e=await o("/webAuthn/login/start",{method:"POST"});if(!e.ok)return{success:!1,mfaRequired:!1,message:"Failed to start passkey login."};try{const n=await e.json(),r=await t({optionsJSON:n}),i=await o("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})});if(!i.ok)return{success:!1,mfaRequired:!1,message:"Failed to verify passkey."};const a=await i.json();return"Success"===a.message?{success:!a.mfaLogin,mfaRequired:Boolean(a.mfaLogin),message:a.mfaLogin?"Passkey login requires MFA.":"Passkey login succeeded."}:{success:!1,mfaRequired:!1,message:a.message??"Passkey login failed."}}catch(e){return console.error("Passkey login error:",e),{success:!1,mfaRequired:!1,message:"Passkey login failed."}}},logout:()=>o("/logout",{method:"GET"}),deleteUser:()=>o("/users/delete",{method:"DELETE"}),register:e=>o("/registration/register",{method:"POST",body:JSON.stringify({email:e.email,phone:e.phone,...e.bootstrapToken?{bootstrapToken:e.bootstrapToken}:{}})}),requestPhoneOtp:()=>o("/otp/generate-phone-otp",{method:"GET"}),verifyPhoneOtp:e=>o("/otp/verify-phone-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:e}),credentials:"include"}),requestEmailOtp:()=>o("/otp/generate-email-otp",{method:"GET",headers:{"Content-Type":"application/json"}}),verifyEmailOtp:e=>o("/otp/verify-email-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:e}),credentials:"include"}),requestMagicLink:()=>o("/magic-link",{method:"GET"}),checkMagicLink:()=>o("/magic-link/check",{method:"GET",headers:{"Content-Type":"application/json"}}),verifyMagicLink:e=>o(`/magic-link/verify/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}}),registerPasskey:async e=>{const n=await o("/webAuthn/register/start",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!n.ok)return{success:!1,message:"Failed to fetch passkey registration challenge."};const t=await n.json();let a;try{a=await r({optionsJSON:t})}catch(e){return e instanceof i?{success:!1,message:e.name}:(console.error("Passkey registration error:",e),{success:!1,message:"Passkey registration failed."})}return(await o("/webAuthn/register/finish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attestationResponse:a,metadata:e}),credentials:"include"})).ok?{success:!0,message:"Passkey registered successfully."}:{success:!1,message:"Verification failed."}},updateCredential:e=>o("users/credentials",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),deleteCredential:e=>o("users/credentials",{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})}};const w=l(void 0),P=()=>{const e=_(w);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},N=({children:o,apiHost:n,autoDetectPreviousSignin:r=!0,mode:i="web"})=>{const[t,l]=a(null),[_,m]=a([]),[u,g]=a(!1),[p,h]=a(!0),{hasSignedInBefore:f,markSignedIn:y}=function(e="seamlessauth_seen"){const[o,n]=a(!1);return s(()=>{try{"true"===localStorage.getItem(e)&&n(!0)}catch{}},[e]),{hasSignedInBefore:o,markSignedIn:()=>{try{localStorage.setItem(e,"true"),n(!0)}catch{}}}}(),b=i,k=d(()=>x({mode:b,apiHost:n}),[b,n]),v=c(async()=>{try{await k.logout()}catch{console.error("Error during logout")}finally{g(!1),l(null),m([])}},[k]),P=c(async()=>{h(!0);try{const e=await k.getCurrentUser();if(e.ok){const{user:o,credentials:n}=await e.json();l(o),m(n??[]),g(!0)}else await v()}catch{await v()}finally{h(!1)}},[k,v]);return s(()=>{P()},[P]),s(()=>{t&&u&&y()},[t,u,y]),e(w.Provider,{value:{user:t,logout:v,refreshSession:P,loading:p,deleteUser:async()=>{try{if((await k.deleteUser()).ok)return l(null),g(!1),void m([]);throw new Error("Could not delete user.")}catch(e){throw console.error("Something went wrong deleting user:",e),new Error("Could not delete user.")}},isAuthenticated:u,hasRole:e=>t?.roles?.includes(e),apiHost:n,markSignedIn:y,hasSignedInBefore:!!r&&f,mode:b,credentials:_,updateCredential:async e=>{const o=await k.updateCredential({friendlyName:e.friendlyName,id:e.id});if(o.ok)return o.json();throw new Error("Failed to update credential")},deleteCredential:async e=>{const o=await k.deleteCredential(e);if(o.ok)return o.json();throw new Error("Failed to update credential")},login:async(e,o)=>k.login({identifier:e,passkeyAvailable:o}),handlePasskeyLogin:async()=>{const e=await k.loginWithPasskey();return e.mfaRequired?(console.warn("Passkey login requested MFA, but the built-in MFA route is not currently available."),!1):e.success?(await P(),!0):(console.error("Passkey login failed:",e.message),!1)}},children:o})};function C(e,o){void 0===o&&(o={});var n=o.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var M="login-module__container___YggDx",T="login-module__card___Ub-Py",S="login-module__heading___neEqb",I="login-module__inputGroup___P6qgS",O="login-module__label___mx5vu",E="login-module__input___U07lW",A="login-module__helperText___kDQ4-",j="login-module__error___40zxh",B="login-module__button___0kFBs",z="login-module__toggle___1JiG1",L="login-module__underline___gs-RS",F="login-module__phoneRow___oeNtq",q="login-module__select___rRV1O",R="login-module__phoneInput___2MPQC",G="login-module__fallbackCard___HdIk-",V="login-module__fallbackHeader___-il2v",D="login-module__fallbackDescription___ea5EB",U="login-module__fallbackActions___AD3ni",K="login-module__fallbackActionButton___lFgWf",W="login-module__actionTitle___ycrMp",J="login-module__actionSubtext___opaIV",H="login-module__linkButton___5lsoe";C(".login-module__container___YggDx{align-items:center;color:#fff;display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:#1f2937;border-radius:.5rem;box-shadow:0 4px 6px rgba(0,0,0,.1);max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:#68d391;text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:#d1d5db;display:block}.login-module__input___U07lW{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px #3b82f6;outline:none}.login-module__helperText___kDQ4-{color:#9ca3af;font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:#f87171;font-size:.875rem}.login-module__button___0kFBs{background-color:#2563eb;border-radius:.375rem;color:#fff;cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:#1d4ed8}.login-module__button___0kFBs:disabled{background-color:#9ca3af;cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:hsla(0,0%,100%,.04);border:1px solid hsla(0,0%,100%,.08);border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:#f3f4f6;font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:#9ca3af;font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:rgba(0,0,0,.25);border:1px solid hsla(0,0%,100%,.08);border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:hsla(0,0%,100%,.06);border-color:hsla(0,0%,100%,.15)}.login-module__actionTitle___ycrMp{color:#f9fafb;font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:#9ca3af;font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");var $="termsModal-module__overlay___-j6r5",Y="termsModal-module__modal___4PxZV",Z="termsModal-module__header___B7wxb",Q="termsModal-module__title___Sucwt",X="termsModal-module__closeBtn___evIs5",ee="termsModal-module__content___5BDhN",oe="termsModal-module__link___oPZrU";C(".termsModal-module__overlay___-j6r5{align-items:center;background-color:rgba(0,0,0,.7);display:flex;inset:0;justify-content:center;position:fixed;z-index:999}.termsModal-module__modal___4PxZV{background-color:#1a1a1a;border-radius:8px;box-shadow:0 10px 25px rgba(0,0,0,.4);color:#fff;max-height:80vh;max-width:640px;outline:none;overflow-y:auto;padding:24px;width:100%}.termsModal-module__header___B7wxb{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.termsModal-module__title___Sucwt{color:#60a5fa;font-size:1.25rem;font-weight:700}.termsModal-module__closeBtn___evIs5{background:none;border:none;color:#ccc;cursor:pointer;font-size:1.75rem}.termsModal-module__closeBtn___evIs5:hover{color:#fff}.termsModal-module__content___5BDhN{color:#d1d5db;font-size:.9rem;line-height:1.6}.termsModal-module__link___oPZrU{color:#60a5fa;text-decoration:underline}.termsModal-module__link___oPZrU:hover{text-decoration:none}");const ne=({isOpen:n,onClose:r})=>{const i=m(null);return s(()=>{const e=e=>{"Escape"===e.key&&r()};return n&&(document.addEventListener("keydown",e),i.current?.focus()),()=>{document.removeEventListener("keydown",e)}},[n,r]),n?e("div",{className:$,role:"dialog","aria-modal":"true","aria-labelledby":"terms-title",children:o("div",{className:Y,tabIndex:-1,ref:i,children:[o("div",{className:Z,children:[e("h2",{id:"terms-title",className:Q,children:"SMS Terms & Conditions"}),e("button",{onClick:r,className:X,children:"×"})]}),o("div",{className:ee,children:[o("p",{children:[e("strong",{children:"Effective Date:"})," June 01, 2025"]}),e("p",{children:"By providing your phone number to SeamlessAuth, a Fells Code LLC product, you agree to receive SMS messages for identity verification, authentication, and account security."}),o("p",{children:[e("strong",{children:"1. Purpose:"})," SMS is used only for account security (OTP, MFA). No marketing messages."]}),o("p",{children:[e("strong",{children:"2. Frequency:"})," Based on login and account activity."]}),o("p",{children:[e("strong",{children:"3. Opt-Out:"})," Contact support@seamlessauth.com to opt out."]}),o("p",{children:[e("strong",{children:"4. Fees:"})," Message and data rates may apply."]}),o("p",{children:[e("strong",{children:"5. Supported Carriers:"})," Most major providers supported, delivery not guaranteed."]}),o("p",{children:[e("strong",{children:"6. Privacy:"})," Your phone number is not shared or sold. See our Privacy Policy."]}),o("p",{children:[e("strong",{children:"7. Changes:"})," Terms may be updated with notice on this page."]}),o("p",{children:["Questions? Email us at"," ",e("a",{className:oe,href:"mailto:support@seamlessauth.com",children:"support@seamlessauth.com"}),"."]})]})]})}):null},re=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"}];function ie({phone:n,setPhone:r,phoneError:i,setPhoneError:t}){const[l,d]=a(!1),[c,_]=a(re[0]);s(()=>{const e=function(){try{const e=Intl.DateTimeFormat().resolvedOptions().locale||"en-US",o=e.split("-")[1]?.toUpperCase()||"US";return re.find(e=>e.code===o)||re[0]}catch{return re[0]}}();_(e)},[]);return o("div",{className:I,children:[e("label",{id:"phone",className:O,children:"Phone Number"}),o("div",{className:F,children:[e("select",{value:c.code,onChange:e=>{const o=re.find(o=>o.code===e.target.value);if(o){_(o);const e=n.replace(/^\+\d+/,""),i=(new k).input(o.dialCode+e);r(i)}},className:q,children:re.map(e=>o("option",{value:e.code,children:[e.flag," (",e.dialCode,")"]},e.code))}),e("input",{"aria-labelledby":"phone",type:"tel",value:n,onChange:e=>{const o=e.target.value,n=o.startsWith(c.dialCode)?o:c.dialCode+o,a=(new k).input(n);r(a),i&&t("")},onBlur:()=>{if(n){const e=v(n),o=e?.isValid();t(o?"":"Please enter a valid phone number.")}},autoComplete:"off",placeholder:"(555) 123-4567",className:R})]}),o("p",{className:A,children:["By signing up, you agree to our"," ",e("button",{onClick:()=>d(!0),className:L,children:"SMS Terms & Conditions"}),"."]}),i&&e("p",{className:j,children:i}),e(ne,{isOpen:l,onClose:()=>d(!1)})]})}const te=()=>{const{apiHost:e,mode:o}=P();return d(()=>x({apiHost:e,mode:o}),[e,o])},ae=e=>{if("string"!=typeof e)return!1;const o=e.trim();if(o.length<3||o.length>320)return!1;const n=o.split("@");if(2!==n.length)return!1;const[r,i]=n;return!(!/^[A-Za-z0-9._%+-]+$/.test(r)||r.startsWith(".")||r.endsWith(".")||r.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(i)||i.startsWith("-")||i.endsWith("-")||i.startsWith(".")||i.endsWith(".")||i.includes(".."))},se=e=>{const o=b(e);return o?.isValid()||!1};const le=()=>{const[e,o]=a(!1),[n,r]=a(!0);return s(()=>{let e=!0;return(async()=>{try{const n=await async function(){if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch(e){return console.error("Error checking passkey support:",e),!1}return!1}();e&&o(n)}catch{e&&o(!1)}finally{e&&r(!1)}})(),()=>{e=!1}},[]),{passkeySupported:e,loading:n}},de=({identifier:n,onMagicLink:r,onPhoneOtp:i,onPasskeyRetry:t})=>{const a=ae(n),s=se(n);return o("div",{className:G,children:[e("div",{className:V,children:"Trouble with passkey login?"}),e("p",{className:D,children:"Choose another secure sign-in method."}),o("div",{className:U,children:[a&&o("button",{type:"button",className:K,onClick:r,children:[e("span",{className:W,children:"Email Magic Link"}),e("span",{className:J,children:"Send a secure sign-in link to your email"})]}),s&&o("button",{type:"button",className:K,onClick:i,children:[e("span",{className:W,children:"Text Message Code"}),e("span",{className:J,children:"Receive a one-time code via SMS"})]})]}),e("button",{type:"button",className:H,onClick:t,children:"Try passkey anyway"})]})},ce=()=>{const r=u(),{hasSignedInBefore:i,login:t,handlePasskeyLogin:l}=P(),d=te(),{passkeySupported:c}=le(),[_,m]=a(""),[g,p]=a(""),[h,f]=a("register"),[y,b]=a(""),[k,v]=a(""),[x,w]=a(""),[N,C]=a(""),[L,F]=a(""),[q,R]=a(!1),[G,V]=a(null);s(()=>{i&&f("login");const e=new URLSearchParams(window.location.search).get("bootstrapToken");e&&e.length>10&&(V(e),console.log("Bootstrap token detected in URL"))},[i]);return e("div",{className:M,children:o("div",{className:T,children:[e("h2",{className:S,children:"login"===h?"Sign In":"Create Account"}),e(n,{children:o("form",{onSubmit:async e=>{e.preventDefault(),v(""),R(!1);try{if("login"===h){const e=await t(_,c);if(e?.ok&&c){return await l()?void r("/"):(R(!0),void v("Passkey sign-in could not be completed. Choose another sign-in method."))}return e?.ok?void R(!0):void v("Failed to start sign-in. Please try again.")}"register"===h&&await(async()=>{v("");try{const e=await d.register({email:g,phone:y,bootstrapToken:G});if(!e.ok)return void v("Failed to register. Please try again.");if("Success"===(await e.json()).message)return void r("/verifyPhoneOTP");v("An unexpected error occurred. Try again. If the problem persists, try resetting your password.")}catch(e){console.error("Unexpected login error",e),v("An unexpected error occurred. Try again. If the problem persists, try resetting your password.")}})()}catch(e){console.error(e),v("Failed to continue sign-in. Please try again.")}},children:["login"===h&&o("div",{className:I,children:[e("label",{htmlFor:"identifier",className:O,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:_,onChange:e=>{const o=e.target.value;m(o)},autoComplete:"off",placeholder:"Email or Phone Number",className:E,onBlur:()=>{if(_){const e=ae(_)||se(_);F(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:A,children:"Phone numbers must include a country code e.g. +1"}),q&&e(de,{identifier:_,onMagicLink:async()=>{try{if(!(await d.requestMagicLink()).ok)return void v("Failed to send magic link.");r("/magiclinks-sent",{state:{identifier:_}})}catch(e){console.error(e),v("Failed to send magic link.")}},onPhoneOtp:async()=>{try{if(!(await d.requestPhoneOtp()).ok)return void v("Failed to send OTP.");r("/verifyPhoneOTP")}catch(e){console.error(e),v("Failed to send OTP.")}},onPasskeyRetry:l}),L&&e("p",{className:j,children:L})]}),"register"===h&&o(n,{children:[o("div",{className:I,children:[e("label",{htmlFor:"email",className:O,children:"Email Address"}),e("input",{id:"email",type:"email",value:g,onChange:e=>{const o=e.target.value;p(o)},autoComplete:"off",className:E,onBlur:()=>{if(g){const e=ae(g);C(e?"":"Please enter a valid email")}},required:!0}),N&&e("p",{className:j,children:N})]}),e(ie,{phone:y,setPhone:b,phoneError:x,setPhoneError:w})]}),e("button",{type:"submit",className:B,disabled:!("login"===h&&_?ae(_)||se(_):ae(g)&&se(y)),children:"login"===h?"Login":"Register"}),k&&e("p",{className:j,children:k}),e("button",{type:"button",onClick:()=>f("login"===h?"register":"login"),className:z,children:"login"===h?"Don't have an account? Create one":"Already have an account? Sign in"})]})})]})})};var _e={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};C(".passKeyLogin-module__container___IUKxF{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:#1d4ed8}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const me=()=>{const n=u(),{handlePasskeyLogin:r}=P(),[i,t]=a("");return e("div",{className:_e.container,children:o("div",{className:_e.card,children:[e("h2",{className:_e.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{t("");await r()?n("/"):t("Passkey sign-in could not be completed. Try another sign-in method.")},className:_e.button,children:"Use Passkey"}),i&&e("p",{className:_e.error,children:i})]})})};var ue="registerPasskey-module__container___jqEh8",ge="registerPasskey-module__card___MJAyC",pe="registerPasskey-module__loading___Q4i1x",he="registerPasskey-module__spinner___V1nhd",fe="registerPasskey-module__supported___ihTih",ye="registerPasskey-module__title___vn2Qu",be="registerPasskey-module__description___AWmO-",ke="registerPasskey-module__button___D3b4B",ve="registerPasskey-module__message___RiOw-",xe="registerPasskey-module__success___HP5aX",we="registerPasskey-module__error___hGiqE";C(".registerPasskey-module__container___jqEh8{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:#f9fafb;border-radius:.75rem;box-shadow:0 2px 8px rgba(0,0,0,.1);color:#374151;display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-color:#3b82f6 transparent;border-radius:9999px;border-style:solid;border-width:2px;height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:#ecfdf5;border-radius:.75rem;box-shadow:0 2px 12px rgba(0,0,0,.1);color:#065f46;padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:#059669;border:none;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:#047857}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:#6ee7b7}.registerPasskey-module__error___hGiqE{color:#f87171}");var Pe="deviceNameModal-module__overlay___fmdPd",Ne="deviceNameModal-module__modal___uoEda",Ce="deviceNameModal-module__description___-HMTA",Me="deviceNameModal-module__input___4vQMI",Te="deviceNameModal-module__actions___KXw7b",Se="deviceNameModal-module__primary___9Ozlk",Ie="deviceNameModal-module__secondary___HILhc";C(".deviceNameModal-module__overlay___fmdPd{align-items:center;background:rgba(0,0,0,.45);display:flex;inset:0;justify-content:center;position:fixed;z-index:1000}.deviceNameModal-module__modal___uoEda{background:#1f2937;border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,.15);color:#fff;max-width:420px;padding:24px;width:100%}.deviceNameModal-module__description___-HMTA{color:#fff;font-size:14px;margin-bottom:16px}.deviceNameModal-module__input___4vQMI{border:1px solid #ddd;border-radius:8px;font-size:14px;margin-bottom:20px;padding:10px 12px;width:100%}.deviceNameModal-module__actions___KXw7b{display:flex;gap:10px;justify-content:flex-end}.deviceNameModal-module__primary___9Ozlk{background:#2563eb;border:none;border-radius:8px;color:#fff;cursor:pointer;padding:8px 14px}.deviceNameModal-module__secondary___HILhc{background:transparent;border:1px solid #ccc;border-radius:8px;cursor:pointer;padding:8px 14px}");const Oe=({isOpen:n,onCancel:r,onConfirm:i})=>{const[t,s]=a("");return n?e("div",{className:Pe,children:o("div",{className:Ne,children:[e("h3",{children:"Name This Device"}),e("p",{className:Ce,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:t,onChange:e=>s(e.target.value),className:Me,autoFocus:!0}),o("div",{className:Te,children:[e("button",{onClick:r,className:Ie,children:"Cancel"}),e("button",{onClick:()=>i(t.trim()),disabled:!t.trim(),className:Se,children:"Continue"})]})]})}):null},Ee=()=>{const{refreshSession:r}=P(),i=te(),{passkeySupported:t,loading:s}=le(),l=u(),[d,c]=a("idle"),[_,m]=a(""),[g,p]=a(!1),[h,f]=a(null);return o(n,{children:[e("div",{className:ue,children:e("div",{className:ge,children:o("div",s||!t?{className:pe,children:[e("div",{className:he}),e("span",{children:s?"Checking for Passkey Support...":"Passkeys are not supported on this device."})]}:{className:fe,children:[e("h2",{className:ye,children:"Secure Your Account with a Passkey"}),e("p",{className:be,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>{const{platform:e,browser:o,deviceInfo:n}=function(){const e=navigator.userAgent.toLowerCase();let o="unknown",n="unknown";return/iphone|ipad|ipod/.test(e)?o="ios":/android/.test(e)?o="android":/mac os/.test(e)?o="mac":/windows/.test(e)?o="windows":/linux/.test(e)&&(o="linux"),/chrome/.test(e)&&(n="chrome"),/safari/.test(e)&&!/chrome/.test(e)&&(n="safari"),/firefox/.test(e)&&(n="firefox"),/edg/.test(e)&&(n="edge"),{platform:o,browser:n,deviceInfo:`${o} • ${n}`}}();f({platform:e,browser:o,deviceInfo:n}),p(!0)},disabled:"loading"===d,className:ke,children:"loading"===d?"Registering...":"Register Passkey"}),_&&e("p",{className:`${ve} ${"success"===d?xe:we}`,children:_})]})})}),e(Oe,{isOpen:g,onCancel:()=>{p(!1),f(null)},onConfirm:async e=>{if(!h)return;const o={friendlyName:e,...h};c("loading");try{const e=await i.registerPasskey(o);if(!e.success)throw new Error(e.message);await r(),c("success"),m(e.message),l("/")}catch(e){console.error(e),c("error"),m("Error registering passkey.")}finally{p(!1),f(null)}}})]})};var Ae="verifyOTP-module__container___wgoDE",je="verifyOTP-module__card___3cs2p",Be="verifyOTP-module__title___fZ-1d",ze="verifyOTP-module__subtitle___dGSu3",Le="verifyOTP-module__error___GEtlG",Fe="verifyOTP-module__success___46TjG",qe="verifyOTP-module__form___jiGG-",Re="verifyOTP-module__label___Zq5Mi",Ge="verifyOTP-module__timer___smq-a",Ve="verifyOTP-module__resend___PlmkG",De="verifyOTP-module__button___8pIuO",Ue="verifyOTP-module__toggle___wbzVa";C(".verifyOTP-module__container___wgoDE{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:#9ca3af;font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:#f87171;margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:#34d399;margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:#d1d5db;display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:#facc15;font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:#374151;border:1px solid #4b5563;border-radius:.375rem;color:#fff;outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px #3b82f6}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:#3b82f6}.verifyOTP-module__button___8pIuO{background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:#1d4ed8}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var Ke="otpInput-module__otpContainer___MUjby",We="otpInput-module__otpInput___3YMVm";C(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:#374151;border:1px solid #4b5563;border-radius:8px;color:#fff;font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:#60a5fa;box-shadow:0 0 0 2px rgba(96,165,250,.25);outline:none}");const Je=({length:o=6,value:n,inputMode:r="numeric",onChange:i,name:t="otp"})=>{const a=m([]),s=n.split("").concat(Array(o).fill("")).slice(0,o),l=(e,o)=>{var n;if(o.length>1)d(e,o);else if(!o||(n=o,"numeric"===r?/^\d$/.test(n):/^[a-zA-Z]$/.test(n))){const n=[...s];n[e]=o;const r=n.join("");i(r),o&&a.current[e+1]&&a.current[e+1]?.focus()}},d=(e,n)=>{let t=n;t="numeric"===r?n.replace(/\D/g,""):n.replace(/[^a-zA-Z]/g,"");const l=t.slice(0,o).split(""),d=[...s];l.forEach((n,r)=>{e+r<o&&(d[e+r]=n)}),i(d.join("")),a.current[Math.min(e+l.length,o-1)]?.focus()};return e("div",{className:Ke,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),d(0,e.clipboardData.getData("text"))},children:s.map((n,d)=>e("input",{ref:e=>a.current[d]=e,type:"text",inputMode:"numeric"===r?"numeric":"text",autoComplete:"one-time-code",name:`${t}-${d}`,maxLength:1,value:n,className:We,onChange:e=>l(d,e.target.value),onKeyDown:e=>((e,n)=>{if("Backspace"===n.key){n.preventDefault();const o=[...s];s[e]?(o[e]="",i(o.join(""))):e>0&&(o[e-1]="",i(o.join("")),a.current[e-1]?.focus())}"ArrowLeft"===n.key&&e>0&&a.current[e-1]?.focus(),"ArrowRight"===n.key&&e<o-1&&a.current[e+1]?.focus()})(d,e),"aria-label":`Digit ${d+1}`},d))})},He=()=>{const n=u(),[r,i]=a(""),[t,l]=a(null),[d,c]=a(""),[_,m]=a(!1),[g,p]=a(""),[h,f]=a(300),y=te(),b=async()=>{m(!0);try{if(!t){(await y.verifyPhoneOtp(r)).ok?l(!0):c("Verification failed.")}}catch(e){console.error(e),c("Verification failed.")}m(!1)},k=async()=>{p(""),await(async()=>{c("");const e=await y.requestPhoneOtp(),o=await e.json();e.ok?(o.token&&localStorage.setItem("token",o.token),p("Verification SMS has been resent.")):c("Failed to send SMS code. If this persists, refresh the page and try again.")})(),p("Verification SMS has been resent.")};return s(()=>{const e=setInterval(()=>{f(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),s(()=>{t&&(async()=>{(await y.requestEmailOtp()).ok?n("/verifyEmailOTP"):c("Failed to send Email code. If this persists, refresh the page and try registering again.")})()},[t,n,y]),e("div",{className:Ae,children:o("div",{className:je,children:[e("h2",{className:Be,children:"Verify Your Phone Number"}),e("p",{className:ze,children:"Enter the code sent to your phone number."}),d&&e("p",{className:Le,children:d}),g&&e("p",{className:Fe,children:g}),o("form",{onSubmit:async e=>{if(e.preventDefault(),c(""),6===r.length){m(!0);try{await b()}catch{c("Unexpected error occurred.")}finally{m(!1)}}else c("Please enter a valid code.")},className:qe,children:[o("div",{children:[o("label",{htmlFor:"phoneCode",className:Re,children:["Phone Verification Code ",(x=t,!0===x?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===x?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",o("span",{className:Ge,children:["Code expires in: ",(v=h,`${Math.floor(v/60).toString().padStart(2,"0")}:${(v%60).toString().padStart(2,"0")}`)]})]}),e(Je,{length:6,value:r,onChange:i}),e("button",{type:"button",onClick:()=>k(),className:Ve,children:"Resend code to phone"})]}),e("button",{type:"submit",className:De,children:_?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>n("/login"),className:Ue,children:"Back to login"})]})]})});var v,x},$e=()=>{const n=u(),{refreshSession:r}=P(),i=te(),{passkeySupported:t}=le(),[l,d]=a(!1),[c,_]=a(""),[m,g]=a(300),[p,h]=a(""),[f,y]=a("");return s(()=>{const e=setInterval(()=>{g(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:Ae,children:o("div",{className:je,children:[e("h2",{className:Be,children:"Verify Your Email"}),e("p",{className:ze,children:"We sent you a verification email. Enter the code below."}),p&&e("p",{className:Le,children:p}),f&&e("p",{className:Fe,children:f}),o("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),6===c.length){d(!0);try{if(!(await i.verifyEmailOtp(c)).ok)return void h("Verification failed.");t?n("/registerPasskey"):(await r(),n("/"))}catch(e){console.error(e),h("Verification failed.")}finally{d(!1)}}else h("Please enter a valid code.")},className:qe,children:[o("div",{children:[o("label",{htmlFor:"emailCode",className:Re,children:["Email Verification Code",o("span",{className:Ge,children:[" ","— Code expires in ",(b=m,`${Math.floor(b/60).toString().padStart(2,"0")}:${(b%60).toString().padStart(2,"0")}`)]})]}),e(Je,{length:6,value:c,onChange:_,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{h(""),y("");(await i.requestEmailOtp()).ok?y("Verification email has been resent."):h("Failed to send Email code. If this persists, refresh the page and try again.")},className:Ve,children:"Resend code to email"})]}),e("button",{type:"submit",className:De,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>n("/login"),className:Ue,children:"Back to login"})]})]})});var b};var Ye={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"};C(".verifyMagiclink-module__container___qrSXf{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid hsla(0,0%,100%,.15);border-radius:50%;border-top-color:#60a5fa;height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:#34d399;height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:#34d399;font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const Ze=()=>{const[n]=g(),r=u(),i=n.get("token"),[t,l]=a(""),[d,c]=a(""),_=te();return s(()=>{(async()=>{if(!i)return l("Missing token for verification."),void console.error("No token found",i);try{if(!(await _.verifyMagicLink(i)).ok)return console.error("Failed to verify token"),void l("Failed to verify token")}catch(e){console.error(e)}new BroadcastChannel("seamless-auth").postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),c("You have been verified on the device and browser that initiated this request"),setTimeout(()=>{r("/")},900)})()},[i,_,r]),e("div",{className:Ye.container,children:o("div",{className:Ye.card,children:[e("h1",{className:Ye.title,children:"Verifying your login"}),o("div",{className:Ye.verificationContent,children:[!d&&!t&&e("div",{className:Ye.spinner}),d&&e("div",{className:Ye.successIcon,children:e("svg",{viewBox:"0 0 24 24",className:Ye.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("path",{d:"M5 13l4 4L19 7"})})}),!d&&!t&&e("p",{className:Ye.helperText,children:"Please wait while we securely verify your sign-in link."}),d&&e("p",{className:Ye.successText,children:"Login verified. Redirecting…"}),t&&e("p",{className:Ye.error,children:t})]})]})})};var Qe="magiclink-module__container___45zcA",Xe="magiclink-module__card___Au9oN",eo="magiclink-module__iconWrapper___k5ndr",oo="magiclink-module__mailIcon___Pwb7q",no="magiclink-module__iconRing___bdLvf",ro="magiclink-module__heading___b9cre",io="magiclink-module__message___kiVFj",to="magiclink-module__identifier___JtcFM",ao="magiclink-module__helperText___7Mlfh",so="magiclink-module__actions___64I-3",lo="magiclink-module__secondaryButton___BntAI",co="magiclink-module__cooldown___Ib4rm",_o="magiclink-module__linkButton___maJiv";C(".magiclink-module__container___45zcA{align-items:center;color:#fff;display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:#1f2937;border-radius:.75rem;box-shadow:0 10px 25px rgba(0,0,0,.25);max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:#a5b4fc;height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:#d1d5db;font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:hsla(0,0%,100%,.05);border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:#9ca3af;font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:#111827;border:1px solid #374151;border-radius:8px;color:#fff;cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:#1f2937}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:#9ca3af;font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:#a5b4fc;cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const mo=()=>{const{refreshSession:n}=P(),r=u(),i=p(),t=te(),l=i.state?.identifier,[d,c]=a(30);s(()=>{const e=setInterval(()=>{c(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);return s(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{if("MAGIC_LINK_AUTH_SUCCESS"===e.data?.type){200===(await t.checkMagicLink()).status&&(await n(),r("/"))}},()=>{e.close()}},[t,r,n]),s(()=>{const e=setInterval(async()=>{try{200===(await t.checkMagicLink()).status&&(await n(),r("/"))}catch{}},5e3);return()=>clearInterval(e)},[t,n,r]),e("div",{className:Qe,children:o("div",{className:Xe,children:[o("div",{className:eo,children:[e("div",{className:no}),o("svg",{className:oo,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:ro,children:"Check your email"}),e("p",{className:io,children:"If an account exists for this address, we sent a secure sign-in link."}),l&&e("div",{className:to,children:l}),e("p",{className:ao,children:"Open the email and click the link to finish signing in."}),e("p",{className:ao,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),o("div",{className:so,children:[e("button",{className:lo,disabled:d>0,onClick:async()=>{d>0||(await t.requestMagicLink(),c(30))},children:"Resend link"}),d>0&&o("div",{className:co,children:["Available in ",d,"s"]}),e("button",{className:_o,onClick:()=>r("/login"),children:"Change email or phone"})]})]})})},uo=()=>o(h,{children:[e(f,{path:"/login",element:e(ce,{})}),e(f,{path:"/passKeyLogin",element:e(me,{})}),e(f,{path:"/verifyPhoneOTP",element:e(He,{})}),e(f,{path:"/verifyEmailOTP",element:e($e,{})}),e(f,{path:"/verify-magiclink",element:e(Ze,{})}),e(f,{path:"/registerPasskey",element:e(Ee,{})}),e(f,{path:"/magiclinks-sent",element:e(mo,{})}),e(f,{path:"*",element:e(y,{to:"/login",replace:!0})})]});export{N as AuthProvider,uo as AuthRoutes,x as createSeamlessAuthClient,P as useAuth,te as useAuthClient,le as usePasskeySupport};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/context/InternalAuthContext.tsx","../src/fetchWithAuth.ts","../src/AuthProvider.tsx","../src/hooks/usePreviousSignIn.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/components/TermsModal.tsx","../src/components/phoneInput.tsx","../src/utils.ts","../src/components/AuthFallbackOptions.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/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[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,null],"names":["InternalAuthContext","createContext","undefined","InternalAuthProvider","value","children","_jsx","Provider","useInternalAuth","context","useContext","Error","createFetchWithAuth","opts","authMode","authHost","async","input","init","url","startsWith","requestInit","credentials","headers","response","fetch","ok","console","warn","status","AuthContext","useAuth","AuthProvider","apiHost","autoDetectPreviousSignin","mode","user","setUser","useState","setCredentials","isAuthenticated","setIsAuthenticated","loading","setLoading","token","setToken","hasSignedInBefore","markSignedIn","storageKey","setHasSignedInBefore","useEffect","localStorage","getItem","setItem","usePreviousSignIn","fetchWithAuth","logout","useCallback","method","error","validateToken","json","deleteUser","hasRole","role","roles","includes","updateCredential","credential","body","JSON","stringify","friendlyName","id","deleteCredential","credentialId","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TermsModal","isOpen","onClose","modalRef","useRef","handleKeyDown","e","key","addEventListener","current","focus","removeEventListener","className","styles","_jsxs","tabIndex","onClick","href","countries","code","name","dialCode","flag","PhoneInputWithCountryCode","phone","setPhone","phoneError","setPhoneError","showModal","setShowModal","selectedCountry","setSelectedCountry","defaultCountry","locale","Intl","DateTimeFormat","resolvedOptions","countryCode","split","toUpperCase","find","c","getDefaultCountry","onChange","country","target","stripped","replace","newPhone","AsYouType","map","raw","full","formatted","onBlur","parsed","parsePhoneNumberFromString","isValid","autoComplete","placeholder","isValidEmail","email","normalized","trim","length","parts","localPart","domainPart","test","endsWith","isValidPhoneNumber","phoneNumber","isPasskeySupported","window","PublicKeyCredential","isUserVerifyingPlatformAuthenticatorAvailable","AuthFallbackOptions","identifier","onMagicLink","onPhoneOtp","onPasskeyRetry","showMagicLink","showPhoneOtp","Login","navigate","useNavigate","setIdentifier","setEmail","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","passkeyAvailable","setPasskeyAvailable","showFallbackOptions","setShowFallbackOptions","bootstrapToken","setBootstrapToken","supported","checkSupport","URLSearchParams","location","search","get","log","handlePasskeyLogin","options","startAuthentication","optionsJSON","verificationResponse","assertionResponse","verificationResult","message","mfaLogin","_Fragment","onSubmit","preventDefault","err","login","register","htmlFor","required","disabled","PassKeyLogin","DeviceNameModal","onCancel","onConfirm","setValue","autoFocus","PasskeyRegistration","setStatus","setMessage","showDeviceModal","setShowDeviceModal","pendingMetadata","setPendingMetadata","verifyPassKey","attResp","metadata","attestationResponse","platform","browser","deviceInfo","ua","navigator","userAgent","toLowerCase","parseUserAgent","challengeRes","startRegistration","WebAuthnError","OtpInput","inputMode","inputs","values","concat","Array","fill","slice","onPaste","pasted","clipboardData","getData","digit","i","el","maxLength","index","char","newValue","substring","handleChange","onKeyDown","PhoneRegistration","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","setError","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","verificationToken","handleResend","data","onResendPhone","interval","setInterval","prev","clearInterval","nextStep","verified","seconds","Math","floor","toString","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","VerifyMagicLink","searchParams","useSearchParams","successMsg","setSuccessMsg","BroadcastChannel","postMessage","setTimeout","verify","container","card","title","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","MagicLinkSent","useLocation","state","cooldown","setCooldown","timer","channel","onmessage","event","close","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"meAOA,MAAMA,EAAsBC,OAAmDC,GAElEC,EAAuB,EAClCC,QACAC,cAMEC,EAACN,EAAoBO,SAAQ,CAACH,MAAOA,EAAKC,SAAGA,IAKpCG,EAAkB,KAC7B,MAAMC,EAAUC,EAAWV,GAC3B,IAAKS,EACH,MAAM,IAAIE,MAAM,4DAElB,OAAOF,GCpBIG,EAAuBC,IAClC,MAAMC,SAAEA,EAAQC,SAAEA,GAAaF,EAE/B,OAAOG,eACLC,EACAC,GAEA,MAEMC,EAAM,GAAGJ,IAFW,WAAbD,EAAwB,OAAS,KAEbG,EAAMG,WAAW,KAAOH,EAAQ,IAAIA,MAE/DI,EAA2B,IAC5BH,EACHI,YAAa,UACbC,QAAS,CACP,eAAgB,sBACbL,GAAMK,UAIPC,QAAiBC,MAAMN,EAAKE,GAElC,GAAIG,EAASE,GAAI,OAAOF,EAGxB,MADAG,QAAQC,KAAK,qBAAsBJ,EAASK,OAAQV,GAC9C,IAAIR,MAAM,8BAA8BQ,IAChD,GC0BF,MAAMW,EAAc7B,OAA2CC,GAMlD6B,EAAU,KACrB,MAAMtB,EAAUC,EAAWoB,GAC3B,IAAKrB,EACH,MAAM,IAAIE,MAAM,+CAElB,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Aa,IACxBjO,EAACkO,EAAM,CAAAvU,SAAA,CACLC,EAACuU,EAAK,CAACC,KAAK,SAASC,QAASzU,EAACyK,GAAK,MACpCzK,EAACuU,EAAK,CAACC,KAAK,gBAAgBC,QAASzU,EAACoN,GAAY,MAClDpN,EAACuU,EAAK,CAACC,KAAK,kBAAkBC,QAASzU,EAACsQ,GAAiB,CAAA,KACzDtQ,EAACuU,EAAK,CAACC,KAAK,kBAAkBC,QAASzU,EAACgS,GAAiB,CAAA,KACzDhS,EAACuU,EAAK,CAACC,KAAK,oBAAoBC,QAASzU,EAACqS,GAAe,CAAA,KACzDrS,EAACuU,EAAK,CAACC,KAAK,mBAAmBC,QAASzU,EAAC0N,GAAmB,CAAA,KAC5D1N,EAACuU,EAAK,CAACC,KAAK,mBAAmBC,QAASzU,EAAC2T,GAAa,CAAA,KACtD3T,EAACuU,EAAK,CAACC,KAAK,IAAIC,QAASzU,EAAC0U,EAAQ,CAACC,GAAG,SAAStM,SAAO","x_google_ignoreList":[4]}
1
+ {"version":3,"file":"index.js","sources":["../src/fetchWithAuth.ts","../src/client/createSeamlessAuthClient.ts","../src/AuthProvider.tsx","../src/hooks/usePreviousSignIn.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/components/TermsModal.tsx","../src/components/phoneInput.tsx","../src/hooks/useAuthClient.ts","../src/utils.ts","../src/hooks/usePasskeySupport.ts","../src/components/AuthFallbackOptions.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/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[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,null,null,null],"names":["createSeamlessAuthClient","opts","fetchWithAuth","authMode","authHost","async","input","init","url","startsWith","requestInit","credentials","headers","response","fetch","ok","console","warn","status","createFetchWithAuth","mode","apiHost","getCurrentUser","method","login","body","JSON","stringify","loginWithPasskey","success","mfaRequired","message","options","json","credential","startAuthentication","optionsJSON","verificationResponse","assertionResponse","verificationResult","mfaLogin","Boolean","error","logout","deleteUser","register","email","phone","bootstrapToken","requestPhoneOtp","verifyPhoneOtp","verificationToken","requestEmailOtp","verifyEmailOtp","requestMagicLink","checkMagicLink","verifyMagicLink","token","registerPasskey","metadata","challengeRes","attestationResponse","startRegistration","WebAuthnError","name","updateCredential","deleteCredential","id","AuthContext","createContext","undefined","useAuth","context","useContext","Error","AuthProvider","children","autoDetectPreviousSignin","user","setUser","useState","setCredentials","isAuthenticated","setIsAuthenticated","loading","setLoading","hasSignedInBefore","markSignedIn","storageKey","setHasSignedInBefore","useEffect","localStorage","getItem","setItem","usePreviousSignIn","authClient","useMemo","useCallback","validateToken","_jsx","Provider","value","refreshSession","hasRole","role","roles","includes","friendlyName","credentialId","identifier","passkeyAvailable","handlePasskeyLogin","result","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TermsModal","isOpen","onClose","modalRef","useRef","handleKeyDown","e","key","addEventListener","current","focus","removeEventListener","className","styles","_jsxs","tabIndex","onClick","href","countries","code","dialCode","flag","PhoneInputWithCountryCode","setPhone","phoneError","setPhoneError","showModal","setShowModal","selectedCountry","setSelectedCountry","defaultCountry","locale","Intl","DateTimeFormat","resolvedOptions","countryCode","split","toUpperCase","find","c","getDefaultCountry","onChange","country","target","stripped","replace","newPhone","AsYouType","map","raw","full","formatted","onBlur","parsed","parsePhoneNumberFromString","isValid","autoComplete","placeholder","useAuthClient","isValidEmail","normalized","trim","length","parts","localPart","domainPart","test","endsWith","isValidPhoneNumber","phoneNumber","usePasskeySupport","passkeySupported","setPasskeySupported","active","supported","window","PublicKeyCredential","isUserVerifyingPlatformAuthenticatorAvailable","isPasskeySupported","checkSupport","AuthFallbackOptions","onMagicLink","onPhoneOtp","onPasskeyRetry","showMagicLink","showPhoneOtp","Login","navigate","useNavigate","setIdentifier","setEmail","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","setBootstrapToken","URLSearchParams","location","search","get","log","_Fragment","onSubmit","preventDefault","loginRes","err","htmlFor","required","state","disabled","PassKeyLogin","runPasskeyLogin","setError","container","card","title","button","DeviceNameModal","onCancel","onConfirm","setValue","autoFocus","PasskeyRegistration","passkeySupportLoading","setStatus","setMessage","showDeviceModal","setShowDeviceModal","pendingMetadata","setPendingMetadata","platform","browser","deviceInfo","ua","navigator","userAgent","toLowerCase","parseUserAgent","OtpInput","inputMode","inputs","values","concat","Array","fill","slice","handleChange","index","char","handleBulkInput","newValueArr","newValue","join","cleaned","chars","forEach","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","PhoneRegistration","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","handleResend","data","onResendPhone","interval","setInterval","prev","clearInterval","nextStep","verified","seconds","floor","toString","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","VerifyMagicLink","searchParams","useSearchParams","successMsg","setSuccessMsg","BroadcastChannel","postMessage","setTimeout","verify","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","MagicLinkSent","useLocation","cooldown","setCooldown","timer","channel","onmessage","event","close","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"gfAaO,MC6DMA,EACXC,IAEA,MAAMC,EDhE2B,CAACD,IAClC,MAAME,SAAEA,EAAQC,SAAEA,GAAaH,EAE/B,OAAOI,eACLC,EACAC,GAEA,MAEMC,EAAM,GAAGJ,IAFW,WAAbD,EAAwB,OAAS,KAEbG,EAAMG,WAAW,KAAOH,EAAQ,IAAIA,MAE/DI,EAA2B,IAC5BH,EACHI,YAAa,UACbC,QAAS,CACP,eAAgB,sBACbL,GAAMK,UAIPC,QAAiBC,MAAMN,EAAKE,GAMlC,OAJKG,EAASE,IACZC,QAAQC,KAAK,qBAAsBJ,EAASK,OAAQV,GAG/CK,CACT,GCqCsBM,CAAoB,CACxChB,SAAUF,EAAKmB,KACfhB,SAAUH,EAAKoB,UAGjB,MAAO,CACLC,eAAgB,IACdpB,EAAc,WAAY,CACxBqB,OAAQ,QAGZC,MAAOlB,GACLJ,EAAc,SAAU,CACtBqB,OAAQ,OACRE,KAAMC,KAAKC,UAAUrB,KAGzBsB,iBAAkBvB,UAChB,MAAMQ,QAAiBX,EAAc,wBAAyB,CAC5DqB,OAAQ,SAGV,IAAKV,EAASE,GACZ,MAAO,CACLc,SAAS,EACTC,aAAa,EACbC,QAAS,kCAIb,IACE,MAAMC,QAAgBnB,EAASoB,OACzBC,QAAmBC,EAAoB,CAAEC,YAAaJ,IAEtDK,QAA6BnC,EAAc,yBAA0B,CACzEqB,OAAQ,OACRE,KAAMC,KAAKC,UAAU,CAAEW,kBAAmBJ,MAG5C,IAAKG,EAAqBtB,GACxB,MAAO,CACLc,SAAS,EACTC,aAAa,EACbC,QAAS,6BAIb,MAAMQ,QAA2BF,EAAqBJ,OAEtD,MAAmC,YAA/BM,EAAmBR,QACd,CACLF,SAAUU,EAAmBC,SAC7BV,YAAaW,QAAQF,EAAmBC,UACxCT,QAASQ,EAAmBC,SACxB,8BACA,4BAID,CACLX,SAAS,E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C6J,GAAmB,CAAA,KAC5D7J,EAACkQ,EAAK,CAACC,KAAK,mBAAmBC,QAASpQ,EAACuP,GAAa,CAAA,KACtDvP,EAACkQ,EAAK,CAACC,KAAK,IAAIC,QAASpQ,EAACqQ,EAAQ,CAACC,GAAG,SAAS3L,SAAO","x_google_ignoreList":[4]}
@@ -0,0 +1,19 @@
1
+ import { AuthenticatorTransportFuture, CredentialDeviceType } from '@simplewebauthn/browser';
2
+ export interface User {
3
+ id: string;
4
+ email: string;
5
+ phone: string;
6
+ roles?: string[];
7
+ }
8
+ export interface Credential {
9
+ id: string;
10
+ counter: number;
11
+ transports?: AuthenticatorTransportFuture[];
12
+ deviceType: CredentialDeviceType;
13
+ backedup: boolean;
14
+ friendlyName: string | null;
15
+ lastUsedAt: Date | null;
16
+ platform: string | null;
17
+ browser: string | null;
18
+ deviceInfo: string | null;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamless-auth/react",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "A drop-in authentication solution for modern React applications.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,9 +20,10 @@
20
20
  "npm": ">=9.0.0 <13.0.0"
21
21
  },
22
22
  "scripts": {
23
- "build": "rollup -c",
23
+ "build": "node ./scripts/clean-dist.mjs && rollup -c",
24
24
  "test": "jest",
25
- "lint": "eslint ./src",
25
+ "coverage": "npm test -- --coverage",
26
+ "lint": "eslint ./src ./tests",
26
27
  "format": "prettier --write .",
27
28
  "prepare": "husky",
28
29
  "semantic-release": "semantic-release",
@@ -1,11 +0,0 @@
1
- import { Dispatch, ReactNode, SetStateAction } from 'react';
2
- interface InternalAuthContextType {
3
- validateToken: () => Promise<void>;
4
- setLoading: Dispatch<SetStateAction<boolean>>;
5
- }
6
- export declare const InternalAuthProvider: ({ value, children, }: {
7
- value: InternalAuthContextType;
8
- children: ReactNode;
9
- }) => import("react/jsx-runtime").JSX.Element;
10
- export declare const useInternalAuth: () => InternalAuthContextType;
11
- export {};