@seamless-auth/react 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @seamless-auth/react
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 419025e: Support the Next.js App Router.
8
+ - Every module in `@seamless-auth/react` now ships with a `'use client'` directive, so `AuthProvider` renders straight from a server layout. The build fails if the directive goes missing from any emitted file.
9
+ - **Breaking:** `AuthRoutes` moved to `@seamless-auth/react/routes`, and `react-router-dom` is now an optional peer. Change `import { AuthRoutes } from '@seamless-auth/react'` to `import { AuthRoutes } from '@seamless-auth/react/routes'`. Applications that do not render the bundled screens no longer need react-router installed.
10
+ - Fixed a hydration mismatch for returning users. `hasSignedInBefore` was read from `localStorage` on the client's first render, which the server could not match. The store now exposes `getServerState()`, and the provider hydrates from it.
11
+ - `AuthProvider` and `createAuthSession` accept `initialSession`, a session the server already resolved (or `null`). The first paint renders it settled instead of loading, and the session then revalidates in the background.
12
+ - `refreshSession({ background: true })` revalidates without reporting `loading`.
13
+
14
+ - 0dfe622: Support signing in through a legacy identity provider during a migration cutover (fells-code/seamless-auth-api#337).
15
+ - `getOAuthErrorCode` recognises `oauth_provider_retired` (the user's organization no longer signs in with that provider) and `oauth_invalid_id_token`.
16
+ - The bundled OAuth callback sends the user to passkey enrollment when the sign-in response carries `nextStep: 'enroll_passkey'`, and the passkey screen then continues to the `returnTo` the flow asked for instead of always going home.
17
+ - The callback shows a specific message for both new codes.
18
+
19
+ Requires `@seamless-auth/types` 0.25.0.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [419025e]
24
+ - Updated dependencies [0dfe622]
25
+ - @seamless-auth/client@0.2.0
26
+
3
27
  ## 0.13.0
4
28
 
5
29
  ### Minor Changes
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  ## What It Exports
12
12
 
13
13
  - `AuthProvider`
14
- - `AuthRoutes`
14
+ - `AuthRoutes`, from `@seamless-auth/react/routes`
15
15
  - `useAuth()`
16
16
  - `createSeamlessAuthClient()`
17
17
  - `useAuthClient()`
@@ -29,6 +29,9 @@
29
29
  npm install @seamless-auth/react
30
30
  ```
31
31
 
32
+ `react-router-dom` is an optional peer. Install it only if you render the bundled screens from
33
+ `@seamless-auth/react/routes`; `AuthProvider`, the hooks, and the headless client do not need it.
34
+
32
35
  ## Releases
33
36
 
34
37
  Published versions are listed in [CHANGELOG.md](./CHANGELOG.md) and GitHub Releases. Releases are
@@ -42,7 +45,7 @@ You can use this package in three ways:
42
45
 
43
46
  1. `AuthProvider` + `useAuth()` for auth state and core auth actions
44
47
  2. `createSeamlessAuthClient()` or `useAuthClient()` to build fully custom login and registration screens
45
- 3. `AuthRoutes` when you want the built-in login, OTP, magic-link, and passkey screens
48
+ 3. `AuthRoutes` (from `@seamless-auth/react/routes`) when you want the built-in login, OTP, magic-link, and passkey screens
46
49
 
47
50
  Most apps will use `AuthProvider` either way.
48
51
 
@@ -82,7 +85,8 @@ function Dashboard() {
82
85
  ### Use built-in auth routes with `AuthRoutes`
83
86
 
84
87
  ```tsx
85
- import { AuthRoutes, useAuth } from '@seamless-auth/react';
88
+ import { useAuth } from '@seamless-auth/react';
89
+ import { AuthRoutes } from '@seamless-auth/react/routes';
86
90
  import { Route, Routes } from 'react-router-dom';
87
91
 
88
92
  function AppRoutes() {
@@ -102,6 +106,74 @@ function AppRoutes() {
102
106
 
103
107
  You are still responsible for your app’s route protection and redirects.
104
108
 
109
+ `AuthRoutes` moved to its own entry in 0.14.0. Earlier versions exported it from
110
+ `@seamless-auth/react`; update the import to `@seamless-auth/react/routes`.
111
+
112
+ ## Next.js
113
+
114
+ The package works in the Next.js App Router. Every module ships with a `'use client'` directive, so
115
+ `AuthProvider` can be rendered straight from a server layout, and nothing touches `window` or
116
+ storage while rendering on the server.
117
+
118
+ ```tsx
119
+ // app/layout.tsx
120
+ import { AuthProvider } from '@seamless-auth/react';
121
+
122
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
123
+ return (
124
+ <html lang="en">
125
+ <body>
126
+ <AuthProvider apiHost={process.env.NEXT_PUBLIC_API_HOST!}>
127
+ {children}
128
+ </AuthProvider>
129
+ </body>
130
+ </html>
131
+ );
132
+ }
133
+ ```
134
+
135
+ Things to know:
136
+
137
+ - **Use custom UI, not `AuthRoutes`.** The bundled screens route with react-router, which a Next.js
138
+ app does not have. Build the screens with `useAuth()`, `useAuthClient()`, and the recipes under
139
+ [Custom UI Recipes](#custom-ui-recipes). `react-router-dom` does not need to be installed.
140
+ - **Props from a server component must be serialisable.** `apiHost`, `magicLinkRedirectUri`, and
141
+ `initialSession` are. `transport` and `ports` take functions, so set those from a client component
142
+ that wraps the provider.
143
+ - **Server code imports from `@seamless-auth/client`.** Everything exported here is a client
144
+ reference inside a server component, including the pure helpers. Read `hasScopedRole`,
145
+ `roleGrantsAccess`, and the types from `@seamless-auth/client` on the server.
146
+ - **Hydration is safe.** The first client render matches the server's: `hasSignedInBefore` is
147
+ `false` on both and turns `true` straight after hydration when the browser remembers a sign-in.
148
+
149
+ ### Rendering a known session on the first paint
150
+
151
+ Without help the provider starts in `loading` and learns the session from `/users/me` after
152
+ hydration. A server that has already resolved the session can pass it as `initialSession`, and the
153
+ first paint renders it settled:
154
+
155
+ ```tsx
156
+ <AuthProvider apiHost={apiHost} initialSession={user ? { user } : null}>
157
+ {children}
158
+ </AuthProvider>
159
+ ```
160
+
161
+ Only `user` is required. The provider still revalidates in the background, without reporting
162
+ `loading`, so credentials and organizations fill in, a revoked session signs out, and a session the
163
+ server could not see (for example an expired access cookie with a live refresh cookie) still signs
164
+ in. `initialSession` is read once, when the provider creates its session.
165
+
166
+ Resolve the user on the server with `getSeamlessUser()` from `@seamless-auth/core`, which verifies
167
+ the access cookie locally and asks the auth API directly. It needs your adapter's cookie secret, and
168
+ the session cookies have to reach the Next.js server, so serve the adapter from the same site. Do not forward the browser's cookies to
169
+ your adapter's `/auth/users/me` from the server: when the access cookie has expired the adapter
170
+ rotates the refresh token in a response the browser never receives, and the browser's next refresh
171
+ is then treated as a replay and revokes the session. A dedicated server package for Next.js is tracked in
172
+ [seamless-auth-server#170](https://github.com/fells-code/seamless-auth-server/issues/170).
173
+
174
+ `refreshSession({ background: true })` is public, for revalidating a session your UI already shows
175
+ (on window focus, for example) without flashing a loading state.
176
+
105
177
  ## `useAuth()` API
106
178
 
107
179
  `useAuth()` returns the current auth state plus the provider-backed helpers:
@@ -121,7 +193,7 @@ You are still responsible for your app’s route protection and redirects.
121
193
  listOAuthProviders(): Promise<SeamlessAuthResult<OAuthProvidersResult>>;
122
194
  startOAuthLogin(input: StartOAuthLoginInput): Promise<SeamlessAuthResult<StartOAuthLoginResult>>;
123
195
  finishOAuthLogin(input: FinishOAuthLoginInput): Promise<SeamlessAuthResult<MessageResult>>;
124
- refreshSession(): Promise<SeamlessAuthResult<CurrentUserResult>>;
196
+ refreshSession(options?: { background?: boolean }): Promise<SeamlessAuthResult<CurrentUserResult>>;
125
197
  refreshStepUpStatus(): Promise<SeamlessAuthResult<StepUpStatus>>;
126
198
  verifyStepUpWithPasskey(): Promise<SeamlessAuthResult<StepUpStatus>>;
127
199
  verifyStepUpWithPasskeyPrf(input: PasskeyPrfInput): Promise<SeamlessAuthResult<StepUpPrfData>>;
@@ -1158,7 +1230,8 @@ refuses every backup-eligible passkey, so handle the code rather than assuming t
1158
1230
 
1159
1231
  ## Notes
1160
1232
 
1161
- - This package does not create its own `<BrowserRouter>`.
1233
+ - This package does not create its own `<BrowserRouter>`, and only `@seamless-auth/react/routes`
1234
+ needs one.
1162
1235
  - It is designed to fit into your app’s existing routing tree.
1163
1236
  - The quickest path is `AuthProvider` + `AuthRoutes`.
1164
1237
  - The most flexible path is `AuthProvider` + custom UI using `useAuth()`, `useAuthClient()`, and `usePasskeySupport()`.
@@ -1,7 +1,7 @@
1
1
  import { CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginStartResult, MessageResult, OAuthProvidersResult, OrganizationSwitchResult, PasskeyLoginData, PasskeyMetadata, PasskeyRegistrationData, RegisterPasskeyOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpPrfData, StepUpStatus } from '@seamless-auth/client';
2
2
  import type { SeamlessAuthResult } from '@seamless-auth/client';
3
3
  import { PasskeyPrfInput } from '@seamless-auth/client';
4
- import { type OAuthRedirectPort, type PasskeyPort, type SeamlessAuthClient, type TransportOptions } from '@seamless-auth/client';
4
+ import { type InitialSession, type RefreshSessionOptions, type OAuthRedirectPort, type PasskeyPort, type SeamlessAuthClient, type TransportOptions } from '@seamless-auth/client';
5
5
  import { Credential, Organization, User } from '@seamless-auth/client';
6
6
  import React, { ReactNode } from 'react';
7
7
  export interface AuthContextType {
@@ -9,7 +9,7 @@ export interface AuthContextType {
9
9
  logout: () => Promise<SeamlessAuthResult<MessageResult>>;
10
10
  logoutAllSessions: () => Promise<SeamlessAuthResult<MessageResult>>;
11
11
  deleteUser: () => Promise<SeamlessAuthResult<MessageResult>>;
12
- refreshSession: () => Promise<SeamlessAuthResult<CurrentUserResult>>;
12
+ refreshSession: (options?: RefreshSessionOptions) => Promise<SeamlessAuthResult<CurrentUserResult>>;
13
13
  isAuthenticated: boolean;
14
14
  hasRole: (role: string) => boolean | undefined;
15
15
  hasScopedRole: (role: string | string[]) => boolean | undefined;
@@ -69,6 +69,14 @@ interface AuthProviderProps {
69
69
  transport?: Omit<TransportOptions, 'apiHost'>;
70
70
  /** Platform ports. Each one left out falls back to the browser's. */
71
71
  ports?: Partial<AuthPorts>;
72
+ /**
73
+ * The session a server already resolved for this request, or `null` when it
74
+ * found none. The first paint renders it settled instead of loading, and the
75
+ * provider then revalidates in the background, which fills in credentials and
76
+ * organizations and catches a session the server could not see. Read once,
77
+ * when the session is created.
78
+ */
79
+ initialSession?: InitialSession | null;
72
80
  }
73
81
  export declare const AuthProvider: React.FC<AuthProviderProps>;
74
82
  export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Paths for the bundled auth screens.
3
+ *
4
+ * Kebab-case throughout, except for two paths that are dictated by contracts
5
+ * outside this package rather than by the naming convention:
6
+ *
7
+ * - `verifyMagicLink` is the URL the auth API builds when it emails a magic
8
+ * link, so it has to match that value exactly.
9
+ * - `oauthCallback` is registered with OAuth providers as an allowed redirect
10
+ * URI, so renaming it would break configured integrations.
11
+ */
12
+ export declare const authRoutePaths: {
13
+ readonly login: "/login";
14
+ readonly passkeyLogin: "/passkey-login";
15
+ readonly verifyPhoneOtp: "/verify-phone-otp";
16
+ readonly verifyEmailOtp: "/verify-email-otp";
17
+ readonly verifyMagicLink: "/verify-magiclink";
18
+ readonly oauthCallback: "/oauth/callback";
19
+ readonly registerPasskey: "/register-passkey";
20
+ readonly magicLinkSent: "/magic-link-sent";
21
+ };
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ import{createContext as t,useContext as e,useMemo as s,useRef as a,useSyncExternalStore as r,useEffect as i,useState as o}from"react";import{jsx as n}from"react/jsx-runtime";import{createBrowserOAuthRedirect as c,createBrowserPasskeyPort as l,createAuthSession as u}from"@seamless-auth/client";const p=t(void 0),d=()=>{const t=e(p);if(!t)throw new Error("useAuth must be used within an AuthProvider");return t},h=({children:t,apiHost:e,autoDetectPreviousSignin:o=!0,magicLinkRedirectUri:d,transport:h,ports:g,initialSession:k})=>{const y=s(()=>({passkeys:g?.passkeys??l(),oauthRedirect:g?.oauthRedirect??c()}),[g?.passkeys,g?.oauthRedirect]),{mode:m,basePath:S,tokenStorage:f,fetch:v}=h??{},b=s(()=>h?{mode:m,basePath:S,tokenStorage:f,fetch:v}:void 0,[m,S,f,v]),P=a(k),R=s(()=>u({apiHost:e,magicLinkRedirectUri:d,transport:b,passkeys:y.passkeys,detectPreviousSignIn:o,initialSession:P.current}),[e,d,b,y.passkeys,o]),w=r(R.subscribe,R.getState,R.getServerState);i(()=>{R.actions.refreshSession({background:void 0!==P.current})},[R]);const A=s(()=>({...w,...R.actions,apiHost:e,magicLinkRedirectUri:d,client:R.client,ports:y}),[w,R,e,d,y]);return n(p.Provider,{value:A,children:t})},g=()=>d().client,k=["passkey","magic_link"],y=()=>{const t=g(),[e,s]=o(null),[a,r]=o(!0);return i(()=>{let e=!0;return(async()=>{try{const{data:a,error:r}=await t.getPublicSystemConfig();e&&!r&&a?.loginMethods?.length&&s(a.loginMethods)}catch{}finally{e&&r(!1)}})(),()=>{e=!1}},[t]),{loginMethods:e,loading:a}},m=t=>Boolean(t?.some(t=>"passkey"!==t)),S=()=>{const{ports:t}=d(),[e,s]=o(!1),[a,r]=o(!0);return i(()=>{let e=!0;return(async()=>{try{const a=t.passkeys.isSupported()&&await t.passkeys.isPlatformAuthenticatorAvailable();e&&s(a)}catch{e&&s(!1)}finally{e&&r(!1)}})(),()=>{e=!1}},[t.passkeys]),{passkeySupported:e,loading:a}};export{h as A,k as F,g as a,y as b,S as c,m as h,d as u};
3
+ //# sourceMappingURL=shared-BzrBuR0z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-BzrBuR0z.js","sources":["../../src/AuthProvider.tsx","../../src/hooks/useAuthClient.ts","../../src/hooks/useLoginMethods.ts","../../src/hooks/usePasskeySupport.ts"],"sourcesContent":[null,null,null,null],"names":["AuthContext","createContext","undefined","useAuth","context","useContext","Error","AuthProvider","children","apiHost","autoDetectPreviousSignin","magicLinkRedirectUri","transport","ports","providedPorts","initialSession","useMemo","passkeys","createBrowserPasskeyPort","oauthRedirect","createBrowserOAuthRedirect","mode","basePath","tokenStorage","fetch","fetchImpl","stableTransport","initialSessionRef","useRef","session","createAuthSession","detectPreviousSignIn","current","state","useSyncExternalStore","subscribe","getState","getServerState","useEffect","actions","refreshSession","background","value","client","_jsx","Provider","useAuthClient","FALLBACK_LOGIN_METHODS","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","loading","setLoading","active","async","data","error","getPublicSystemConfig","length","read","hasNonPasskeyLoginMethod","Boolean","some","method","usePasskeySupport","passkeySupported","setPasskeySupported","supported","isSupported","isPlatformAuthenticatorAvailable","checkSupport"],"mappings":";sSA4GA,MAAMA,EAAcC,OAA2CC,GAMlDC,EAAU,KACrB,MAAMC,EAAUC,EAAWL,GAC3B,IAAKI,EACH,MAAM,IAAIE,MAAM,+CAElB,OAAOF,GA6BIG,EAA4C,EACvDC,WACAC,UACAC,4BAA2B,EAC3BC,uBACAC,YACAC,MAAOC,EACPC,qBAKA,MAAMF,EAAQG,EACZ,KAAA,CACEC,SAAUH,GAAeG,UAAYC,IACrCC,cAAeL,GAAeK,eAAiBC,MAEjD,CAACN,GAAeG,SAAUH,GAAeK,iBAGrCE,KAAEA,EAAIC,SAAEA,EAAQC,aAAEA,EAAcC,MAAOC,GAAcb,GAAa,CAAA,EAClEc,EAAkBV,EACtB,IAAOJ,EAAY,CAAES,OAAMC,WAAUC,eAAcC,MAAOC,QAAcvB,EAExE,CAACmB,EAAMC,EAAUC,EAAcE,IAM3BE,EAAoBC,EAAOb,GAE3Bc,EAAUb,EACd,IACEc,EAAkB,CAChBrB,UACAE,uBACAC,UAAWc,EACXT,SAAUJ,EAAMI,SAChBc,qBAAsBrB,EACtBK,eAAgBY,EAAkBK,UAEtC,CACEvB,EACAE,EACAe,EACAb,EAAMI,SACNP,IAOEuB,EAAQC,EACZL,EAAQM,UACRN,EAAQO,SACRP,EAAQQ,gBAcVC,EAAU,KACHT,EAAQU,QAAQC,eAAe,CAClCC,gBAA0CvC,IAA9ByB,EAAkBK,WAE/B,CAACH,IAEJ,MAAMa,EAAQ1B,EACZ,KAAA,IACKiB,KACAJ,EAAQU,QACX9B,UACAE,uBACAgC,OAAQd,EAAQc,OAChB9B,UAEF,CAACoB,EAAOJ,EAASpB,EAASE,EAAsBE,IAGlD,OAAO+B,EAAC5C,EAAY6C,SAAQ,CAACH,MAAOA,EAAKlC,SAAGA,KChOjCsC,EAAgB,IACpB3C,IAAUwC,OCINI,EAAwC,CAAC,UAAW,cAWpDC,EAAkB,KAC7B,MAAMC,EAAaH,KACZI,EAAcC,GAAmBC,EAA+B,OAChEC,EAASC,GAAcF,GAAS,GA8BvC,OA5BAd,EAAU,KACR,IAAIiB,GAAS,EAsBb,MApBaC,WACX,IACE,MAAMC,KAAEA,EAAIC,MAAEA,SAAgBT,EAAWU,wBAErCJ,IAAWG,GAASD,GAAMP,cAAcU,QAC1CT,EAAgBM,EAAKP,aAEzB,CAAE,MAIF,SACMK,GACFD,GAAW,EAEf,GAGGO,GAEE,KACLN,GAAS,IAEV,CAACN,IAEG,CAAEC,eAAcG,YAUZS,EAA4BZ,GACvCa,QAAQb,GAAcc,KAAKC,GAAqB,YAAXA,IC/D1BC,EAAoB,KAC/B,MAAMrD,MAAEA,GAAUV,KACXgE,EAAkBC,GAAuBhB,GAAS,IAClDC,EAASC,GAAcF,GAAS,GA+BvC,OA7BAd,EAAU,KACR,IAAIiB,GAAS,EAuBb,MArBqBC,WACnB,IACE,MAAMa,EACJxD,EAAMI,SAASqD,qBACRzD,EAAMI,SAASsD,mCACpBhB,GACFa,EAAoBC,EAExB,CAAE,MACId,GACFa,GAAoB,EAExB,SACMb,GACFD,GAAW,EAEf,GAGGkB,GAEE,KACLjB,GAAS,IAEV,CAAC1C,EAAMI,WAEH,CAAEkD,mBAAkBd"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { AuthContextType, AuthPorts, AuthProvider, useAuth } from './AuthProvider';
2
- import { AuthRoutes } from './AuthRoutes';
3
2
  import { createSeamlessAuthClient, CredentialUpdateResult, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthProvider, OAuthProvidersResult, PublicSystemConfigResult, OrganizationMemberInput, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyRegistrationData, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, TotpEnrollmentStartResult, TotpStatus, UpdateOrganizationInput } from '@seamless-auth/client';
4
3
  import { getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, isUnauthenticated, OAuthErrorCode, PasskeyPolicyErrorCode, SeamlessAuthError, WebAuthnErrorDetail } from '@seamless-auth/client';
5
4
  import type { SeamlessAuthResult } from '@seamless-auth/client';
@@ -10,6 +9,6 @@ import { hasNonPasskeyLoginMethod, useLoginMethods } from './hooks/useLoginMetho
10
9
  import { usePasskeySupport } from './hooks/usePasskeySupport';
11
10
  import { hasScopedRole, roleGrantsAccess } from '@seamless-auth/client';
12
11
  import { Credential, Organization, OrganizationMembership, User } from '@seamless-auth/client';
13
- import type { OAuthRedirectOutcome, OAuthRedirectPort, PasskeyPort, StoredTokens, TokenStoragePort, TransportOptions } from '@seamless-auth/client';
14
- export { AuthProvider, AuthRoutes, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, isUnauthenticated, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, useAuthorizedFetch, useLoginMethods, usePasskeySupport, };
15
- export type { CredentialUpdateResult, AuthContextType, AuthPorts, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthErrorCode, OAuthProvider, OAuthProvidersResult, OAuthRedirectOutcome, OAuthRedirectPort, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyPolicyErrorCode, PasskeyPort, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, PublicSystemConfigResult, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, StoredTokens, TokenStoragePort, TotpEnrollmentStartResult, TotpStatus, TransportOptions, UpdateOrganizationInput, User, WebAuthnErrorDetail, };
12
+ import type { InitialSession, OAuthRedirectOutcome, OAuthRedirectPort, PasskeyPort, StoredTokens, TokenStoragePort, RefreshSessionOptions, TransportOptions } from '@seamless-auth/client';
13
+ export { AuthProvider, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, isUnauthenticated, roleGrantsAccess, SeamlessAuthError, useAuth, useAuthClient, useAuthorizedFetch, useLoginMethods, usePasskeySupport, };
14
+ export type { CredentialUpdateResult, AuthContextType, AuthPorts, Credential, CreateOrganizationInput, CurrentUserResult, FinishOAuthLoginInput, FinishOAuthLoginResult, InitialSession, LoginInput, LoginMethod, LoginStartResult, MessageResult, OAuthErrorCode, OAuthProvider, OAuthProvidersResult, OAuthRedirectOutcome, OAuthRedirectPort, Organization, OrganizationMemberInput, OrganizationMembership, OrganizationMemberUpdateInput, OrganizationMembersResult, OrganizationMembershipResult, OrganizationResult, OrganizationSwitchResult, OrganizationsResult, PasskeyLoginData, PasskeyAttachment, PasskeyMetadata, PasskeyPolicyErrorCode, PasskeyPort, PasskeyPrfInput, PasskeyPrfResult, PasskeyRegistrationData, PublicSystemConfigResult, RefreshSessionOptions, RegisterInput, RegisterPasskeyOptions, SeamlessAuthClient, SeamlessAuthClientOptions, SeamlessAuthResult, StartOAuthLoginInput, StartOAuthLoginResult, StepUpMethod, StepUpStatus, StepUpPrfData, StoredTokens, TokenStoragePort, TotpEnrollmentStartResult, TotpStatus, TransportOptions, UpdateOrganizationInput, User, WebAuthnErrorDetail, };
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";import{createBrowserOAuthRedirect as o,createBrowserPasskeyPort as t,createAuthSession as i,isUnauthenticated as s,getPasskeyPolicyErrorCode as n,getOAuthErrorCode as l}from"@seamless-auth/client";export{SeamlessAuthError,createSeamlessAuthClient,encodePrfSalt,extractPasskeyPrfResult,getOAuthErrorCode,getPasskeyPolicyErrorCode,getWebAuthnErrorDetail,hasScopedRole,isPasskeyPrfSupported,isUnauthenticated,roleGrantsAccess}from"@seamless-auth/client";import{createContext as c,useContext as d,useMemo as _,useSyncExternalStore as m,useEffect as u,useState as g,useRef as p,useCallback as h}from"react";import{useHref as f,useNavigate as v,useLocation as y,useSearchParams as b,Routes as k,Route as x,Navigate as w}from"react-router-dom";import P from"libphonenumber-js";const N=c(void 0),C=()=>{const e=d(N);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},S=({children:r,apiHost:a,autoDetectPreviousSignin:s=!0,magicLinkRedirectUri:n,transport:l,ports:c})=>{const d=_(()=>({passkeys:c?.passkeys??t(),oauthRedirect:c?.oauthRedirect??o()}),[c?.passkeys,c?.oauthRedirect]),{mode:g,basePath:p,tokenStorage:h,fetch:f}=l??{},v=_(()=>l?{mode:g,basePath:p,tokenStorage:h,fetch:f}:void 0,[g,p,h,f]),y=_(()=>i({apiHost:a,magicLinkRedirectUri:n,transport:v,passkeys:d.passkeys,detectPreviousSignIn:s}),[a,n,v,d.passkeys,s]),b=m(y.subscribe,y.getState,y.getState);u(()=>{y.actions.refreshSession()},[y]);const k=_(()=>({...b,...y.actions,apiHost:a,magicLinkRedirectUri:n,client:y.client,ports:d}),[b,y,a,n,d]);return e(N.Provider,{value:k,children:r})},M=()=>C().client,I=["passkey","magic_link"],T=()=>{const e=M(),[r,a]=g(null),[o,t]=g(!0);return u(()=>{let r=!0;return(async()=>{try{const{data:o,error:t}=await e.getPublicSystemConfig();r&&!t&&o?.loginMethods?.length&&a(o.loginMethods)}catch{}finally{r&&t(!1)}})(),()=>{r=!1}},[e]),{loginMethods:r,loading:o}},O=e=>Boolean(e?.some(e=>"passkey"!==e)),A=()=>{const{ports:e}=C(),[r,a]=g(!1),[o,t]=g(!0);return u(()=>{let r=!0;return(async()=>{try{const o=e.passkeys.isSupported()&&await e.passkeys.isPlatformAuthenticatorAvailable();r&&a(o)}catch{r&&a(!1)}finally{r&&t(!1)}})(),()=>{r=!1}},[e.passkeys]),{passkeySupported:r,loading:o}},z="/login",E="/passkey-login",B="/verify-phone-otp",L="/verify-email-otp",q="/verify-magiclink",R="/oauth/callback",F="/register-passkey",j="/magic-link-sent";function D(e,r){void 0===r&&(r={});var a=r.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===a&&o.firstChild?o.insertBefore(t,o.firstChild):o.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}}var V="login-module__container___YggDx",G="login-module__card___Ub-Py",U="login-module__heading___neEqb",W="login-module__inputGroup___P6qgS",K="login-module__label___mx5vu",Y="login-module__input___U07lW",$="login-module__helperText___kDQ4-",H="login-module__error___40zxh",J="login-module__button___0kFBs",Z="login-module__submitHint___qOS5Z",Q="login-module__toggle___1JiG1",X="login-module__fallbackCard___HdIk-",ee="login-module__fallbackHeader___-il2v",re="login-module__fallbackDescription___ea5EB",ae="login-module__fallbackActions___AD3ni",oe="login-module__fallbackActionButton___lFgWf",te="login-module__actionTitle___ycrMp",ie="login-module__actionSubtext___opaIV",se="login-module__linkButton___5lsoe";D(".login-module__container___YggDx{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 4px 6px var(--seamless-shadow,rgba(0,0,0,.1));max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:var(--seamless-success,#68d391);text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:var(--seamless-text-muted,#d1d5db);display:block}.login-module__input___U07lW{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6);outline:none}.login-module__helperText___kDQ4-{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:var(--seamless-danger,#f87171);font-size:.875rem}.login-module__button___0kFBs{background-color:var(--seamless-accent,#2563eb);border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s,opacity .3s;width:100%}.login-module__button___0kFBs:hover:not(:disabled){background-color:var(--seamless-accent-hover,#1d4ed8)}.login-module__button___0kFBs:disabled{cursor:not-allowed;opacity:.6}.login-module__submitHint___qOS5Z{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem;text-align:center}.login-module__toggle___1JiG1{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:var(--seamless-surface-raised,hsla(0,0%,100%,.04));border:1px solid var(--seamless-border,hsla(0,0%,100%,.08));border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:var(--seamless-text,#f3f4f6);font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:var(--seamless-surface,rgba(0,0,0,.25));border:1px solid var(--seamless-border,hsla(0,0%,100%,.08));border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:var(--seamless-surface-hover,hsla(0,0%,100%,.06));border-color:var(--seamless-border,hsla(0,0%,100%,.15))}.login-module__actionTitle___ycrMp{color:var(--seamless-text,#f9fafb);font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const ne=e=>{if("string"!=typeof e)return!1;const r=e.trim();if(r.length<3||r.length>320)return!1;const a=r.split("@");if(2!==a.length)return!1;const[o,t]=a;return!(!/^[A-Za-z0-9._%+-]+$/.test(o)||o.startsWith(".")||o.endsWith(".")||o.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(t)||t.startsWith("-")||t.endsWith("-")||t.startsWith(".")||t.endsWith(".")||t.includes(".."))},le=e=>{const r=P(e);return r?.isValid()||!1};const ce=({identifier:a,onMagicLink:o,onEmailOtp:t,onPhoneOtp:i,onPasskeyRetry:s,loginMethods:n})=>{const l=new Set(n??["passkey","magic_link","phone_otp"]),c=l.has("magic_link")&&ne(a),d=l.has("email_otp")&&Boolean(t)&&ne(a),_=l.has("phone_otp")&&le(a),m=l.has("passkey")&&Boolean(s);return c||d||_||m?r("div",{className:X,children:[e("div",{className:ee,children:"Choose a sign-in method"}),e("p",{className:re,children:"Choose another secure sign-in method."}),r("div",{className:ae,children:[c&&r("button",{type:"button",className:oe,onClick:o,children:[e("span",{className:te,children:"Email Magic Link"}),e("span",{className:ie,children:"Send a secure sign-in link to your email"})]}),d&&r("button",{type:"button",className:oe,onClick:t,children:[e("span",{className:te,children:"Email Code"}),e("span",{className:ie,children:"Receive a one-time code by email"})]}),_&&r("button",{type:"button",className:oe,onClick:i,children:[e("span",{className:te,children:"Text Message Code"}),e("span",{className:ie,children:"Receive a one-time code via SMS"})]})]}),m&&e("button",{type:"button",className:se,onClick:s,children:"Try passkey anyway"})]}):null},de="seamless:oauth:provider",_e=()=>{const{listOAuthProviders:a,startOAuthLogin:o,finishOAuthLogin:t,ports:i}=C(),s=f("/oauth/callback"),[n,l]=g([]),[c,d]=g("");if(u(()=>{let e=!0;return a().then(({data:r})=>{e&&l(r?.providers??[])}),()=>{e=!1}},[a]),0===n.length)return null;return r("div",{className:ae,children:[n.map(a=>e("button",{type:"button",className:oe,onClick:()=>(async e=>{d(""),sessionStorage.setItem(de,e);const r=new URL(s,window.location.origin).toString(),{data:a,error:n}=await o({providerId:e,redirectUri:r});if(n)return void d("Could not start sign-in with this provider.");const l=await i.oauthRedirect.open(a.authorizationUrl,r);"callback"===l.type&&(await t({providerId:e,code:l.code,state:l.state})).error&&d("Could not finish sign-in with this provider.")})(a.id),children:r("span",{className:te,children:["Continue with ",a.name]})},a.id)),c&&e("p",{className:H,children:c})]})},me=()=>{const o=v(),{hasSignedInBefore:t,login:i,handlePasskeyLogin:s}=C(),n=M(),{passkeySupported:l}=A(),{loginMethods:c}=T(),[d,_]=g(""),[m,p]=g(""),[h,f]=g("register"),[y,b]=g(""),[k,x]=g(""),[w,P]=g(""),[N,S]=g(!1),[O,z]=g(null);u(()=>{t&&f("login")},[t]);const E=()=>"login"===h?ne(d)||le(d):ne(m);return e("div",{className:V,children:r("div",{className:G,children:[e("h2",{className:U,children:"login"===h?"Sign In":"Create Account"}),r(a,{children:[r("form",{onSubmit:async e=>{e.preventDefault(),b(""),S(!1);try{if("login"===h){const{data:e,error:r}=await i(d,l);if(r)return void b("Failed to start sign-in. Please try again.");const a=e?.loginMethods?.length?e.loginMethods:c??I;if(z(a),l&&a.includes("passkey")){const{error:e}=await s();return e?(S(!0),void b("Passkey sign-in could not be completed. Choose another sign-in method.")):void o("/")}return void S(!0)}"register"===h&&await(async()=>{b("");const{data:e,error:r}=await n.register({email:m});r?b("Failed to register. Please try again."):"Success"===e.message?o(L):b("An unexpected error occurred. Try again. If the problem persists, contact support.")})()}catch{console.error("Failed to continue sign-in."),b("Failed to continue sign-in. Please try again.")}},children:["login"===h&&r("div",{className:W,children:[e("label",{htmlFor:"identifier",className:K,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:d,onChange:e=>{const r=e.target.value;_(r)},autoComplete:"off",placeholder:"Email or Phone Number",className:Y,onBlur:()=>{if(d){const e=ne(d)||le(d);P(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:$,children:"Phone numbers must include a country code e.g. +1"}),N&&e(ce,{identifier:d,onMagicLink:async()=>{const{error:e}=await n.requestMagicLink();e?b("Failed to send magic link."):o(j,{state:{identifier:d}})},onEmailOtp:async()=>{const{error:e}=await n.requestLoginEmailOtp();e?b("Failed to send email code."):o(L,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await n.requestLoginPhoneOtp();e?b("Failed to send OTP."):o(B,{state:{flow:"login"}})},onPasskeyRetry:l?s:void 0,loginMethods:O}),w&&e("p",{className:H,children:w})]}),"register"===h&&r("div",{className:W,children:[e("label",{htmlFor:"email",className:K,children:"Email Address"}),e("input",{id:"email",type:"email",value:m,onChange:e=>{const r=e.target.value;p(r)},autoComplete:"off",className:Y,onBlur:()=>{if(m){const e=ne(m);x(e?"":"Please enter a valid email")}},required:!0}),k&&e("p",{className:H,children:k})]}),e("button",{type:"submit",className:J,disabled:!E(),"aria-describedby":"seamless-submit-hint",children:"login"===h?"Login":"Register"}),e("p",{id:"seamless-submit-hint",role:"status",className:Z,children:"login"===h?d?E()?"Ready to continue.":"This does not look like a complete email or phone number yet.":"Enter your email or phone number to continue.":m?E()?"Ready to continue.":"This does not look like a complete email address yet.":"Enter your email address to continue."}),y&&e("p",{className:H,children:y}),e("button",{type:"button",onClick:()=>f("login"===h?"register":"login"),className:Q,children:"login"===h?"Don't have an account? Create one":"Already have an account? Sign in"})]}),e(_e,{})]})]})})};var ue={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};D(".passKeyLogin-module__container___IUKxF{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:var(--seamless-accent,#2563eb);border:1px solid var(--seamless-accent,#3b82f6);border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const ge=()=>{const a=v(),{handlePasskeyLogin:o}=C(),[t,i]=g("");return e("div",{className:ue.container,children:r("div",{className:ue.card,children:[e("h2",{className:ue.title,children:"Login with Passkey"}),e("button",{onClick:async()=>{i("");const{error:e}=await o();e?i("Passkey sign-in could not be completed. Try another sign-in method."):a("/")},className:ue.button,children:"Use Passkey"}),t&&e("p",{className:ue.error,children:t})]})})};var pe="registerPasskey-module__container___jqEh8",he="registerPasskey-module__card___MJAyC",fe="registerPasskey-module__loading___Q4i1x",ve="registerPasskey-module__spinner___V1nhd",ye="registerPasskey-module__supported___ihTih",be="registerPasskey-module__title___vn2Qu",ke="registerPasskey-module__description___AWmO-",xe="registerPasskey-module__button___D3b4B",we="registerPasskey-module__message___RiOw-",Pe="registerPasskey-module__success___HP5aX",Ne="registerPasskey-module__error___hGiqE",Ce="registerPasskey-module__skip___1hDyU",Se="registerPasskey-module__secondary___bnOB4";D(".registerPasskey-module__container___jqEh8{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:var(--seamless-surface,#f9fafb);border-radius:.75rem;box-shadow:0 2px 8px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#374151);display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-bottom:2px solid var(--seamless-accent,#3b82f6);border-left:2px solid transparent;border-radius:9999px;border-right:2px solid transparent;border-top:2px solid var(--seamless-accent,#3b82f6);height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:var(--seamless-surface,#ecfdf5);border-radius:.75rem;box-shadow:0 2px 12px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#065f46);padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:var(--seamless-accent,#059669);border:none;border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:var(--seamless-accent-hover,#047857)}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:var(--seamless-success,#6ee7b7)}.registerPasskey-module__error___hGiqE{color:var(--seamless-danger,#f87171)}.registerPasskey-module__skip___1hDyU{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.registerPasskey-module__skip___1hDyU:disabled{cursor:default;opacity:.6}.registerPasskey-module__secondary___bnOB4{background:none;border:1px solid var(--seamless-accent,#059669);border-radius:.5rem;color:var(--seamless-accent,#059669);cursor:pointer;font-weight:500;margin-top:.75rem;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__secondary___bnOB4:hover:not(:disabled){background-color:var(--seamless-accent-muted,rgba(5,150,105,.1))}.registerPasskey-module__secondary___bnOB4:disabled{cursor:default;opacity:.6}");const Me={attachment_not_allowed:"This application does not accept that kind of authenticator. Try the other option.",synced_passkey_not_allowed:"This passkey syncs to a password manager, and this application requires one that stays on a single device, such as a security key.",authenticator_not_allowed:"This application does not accept this authenticator.",prf_required:"This authenticator does not support a feature this application requires."};const Ie=()=>{const{refreshSession:a}=C(),o=M(),{passkeySupported:t,loading:i}=A(),{loginMethods:l,loading:c}=T(),d=v(),[_,m]=g("idle"),[u,p]=g(""),h=O(l),f=async()=>{await a(),d("/")},y=async e=>{const{platform:r,browser:t,deviceInfo:i}=function(){const e=navigator.userAgent.toLowerCase();let r="unknown",a="unknown";return/iphone|ipad|ipod/.test(e)?r="ios":/android/.test(e)?r="android":/mac os/.test(e)?r="mac":/windows/.test(e)?r="windows":/linux/.test(e)&&(r="linux"),navigator.brave?a="brave":/edg\/|edgios/.test(e)?a="edge":/opr\/|opt\/|opera/.test(e)?a="opera":/vivaldi/.test(e)?a="vivaldi":/samsungbrowser/.test(e)?a="samsung":/firefox|fxios/.test(e)?a="firefox":/chrome|crios/.test(e)?a="chrome":/safari/.test(e)&&(a="safari"),{platform:r,browser:a,deviceInfo:`${r} • ${a}`}}(),l={friendlyName:i,platform:r,browser:t,deviceInfo:i};m("loading");try{const{error:r}=await o.registerPasskey({metadata:l,attachment:e});if(r)throw r;await a(),m("success"),p("Passkey registered successfully."),d("/")}catch(e){console.error("Passkey registration failed."),m("error"),p(function(e){const r=n(e);return r?Me[r]:void 0}(e)??(s(e)?"Your session expired before the passkey was saved. Sign in again to add one.":"Error registering passkey."))}};return e("div",{className:pe,children:e("div",{className:he,children:r("div",i||c?{className:fe,children:[e("div",{className:ve}),e("span",{children:"Checking for Passkey Support..."})]}:t?{className:ye,children:[e("h2",{className:be,children:"Secure Your Account with a Passkey"}),e("p",{className:ke,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:()=>y(),disabled:"loading"===_,className:xe,children:"loading"===_?"Registering...":"Register Passkey"}),e("button",{type:"button",onClick:()=>y("cross-platform"),disabled:"loading"===_,className:Se,children:"Use a security key instead"}),u&&e("p",{className:`${we} ${"success"===_?Pe:Ne}`,children:u}),h&&e("button",{type:"button",onClick:f,disabled:"loading"===_,className:Ce,children:"Skip for now"})]}:{className:ye,children:[e("h2",{className:be,children:"Passkeys are not available here"}),e("p",{className:ke,children:h?"This device does not support passkeys. You can continue without one and add a passkey later from a device that does.":"This device does not support passkeys, and this application requires one to sign in. Try again from a device or browser that supports them."}),h&&e("button",{type:"button",onClick:f,className:xe,children:"Continue"})]})})})};var Te="verifyOTP-module__container___wgoDE",Oe="verifyOTP-module__card___3cs2p",Ae="verifyOTP-module__title___fZ-1d",ze="verifyOTP-module__subtitle___dGSu3",Ee="verifyOTP-module__error___GEtlG",Be="verifyOTP-module__success___46TjG",Le="verifyOTP-module__form___jiGG-",qe="verifyOTP-module__label___Zq5Mi",Re="verifyOTP-module__timer___smq-a",Fe="verifyOTP-module__resend___PlmkG",je="verifyOTP-module__button___8pIuO",De="verifyOTP-module__toggle___wbzVa";D(".verifyOTP-module__container___wgoDE{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:var(--seamless-text-muted,#9ca3af);font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:var(--seamless-danger,#f87171);margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:var(--seamless-success,#34d399);margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:var(--seamless-text-muted,#d1d5db);display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:var(--seamless-warning,#facc15);font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:.375rem;color:var(--seamless-text,#fff);outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6)}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:var(--seamless-accent,#3b82f6)}.verifyOTP-module__button___8pIuO{background-color:var(--seamless-accent,#2563eb);border:none;border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var Ve="otpInput-module__otpContainer___MUjby",Ge="otpInput-module__otpInput___3YMVm";D(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:8px;color:var(--seamless-text,#fff);font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:var(--seamless-accent,#60a5fa);box-shadow:0 0 0 2px var(--seamless-accent,rgba(96,165,250,.25));outline:none}");const Ue=({length:r=6,value:a,inputMode:o="numeric",onChange:t,name:i="otp"})=>{const s=p([]),n=a.split("").concat(Array(r).fill("")).slice(0,r),l=(e,r)=>{var a;if(r.length>1)c(e,r);else if(!r||(a=r,"numeric"===o?/^\d$/.test(a):/^[a-zA-Z]$/.test(a))){const a=[...n];a[e]=r;const o=a.join("");t(o),r&&s.current[e+1]&&s.current[e+1]?.focus()}},c=(e,a)=>{let i=a;i="numeric"===o?a.replace(/\D/g,""):a.replace(/[^a-zA-Z]/g,"");const l=i.slice(0,r).split(""),c=[...n];l.forEach((a,o)=>{e+o<r&&(c[e+o]=a)}),t(c.join("")),s.current[Math.min(e+l.length,r-1)]?.focus()};return e("div",{className:Ve,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),c(0,e.clipboardData.getData("text"))},children:n.map((a,c)=>e("input",{ref:e=>s.current[c]=e,type:"text",inputMode:"numeric"===o?"numeric":"text",autoComplete:"one-time-code",name:`${i}-${c}`,maxLength:1,value:a,className:Ge,onChange:e=>l(c,e.target.value),onKeyDown:e=>((e,a)=>{if("Backspace"===a.key){a.preventDefault();const r=[...n];n[e]?(r[e]="",t(r.join(""))):e>0&&(r[e-1]="",t(r.join("")),s.current[e-1]?.focus())}"ArrowLeft"===a.key&&e>0&&s.current[e-1]?.focus(),"ArrowRight"===a.key&&e<r-1&&s.current[e+1]?.focus()})(c,e),"aria-label":`Digit ${c+1}`},c))})},We=()=>{const a=v(),o=y(),{refreshSession:t}=C(),i="login"===o.state?.flow,[s,n]=g(""),[l,c]=g(null),[d,_]=g(""),[m,p]=g(!1),[h,f]=g(""),[b,k]=g(300),x=M(),w=async()=>{if(p(!0),!l){const{error:e}=i?await x.verifyLoginPhoneOtp(s):await x.verifyPhoneOtp(s);if(e)_("Verification failed.");else{if(i)return await t(),void a("/");c(!0)}}p(!1)},P=async()=>{f(""),await(async()=>{_("");const{error:e}=i?await x.requestLoginPhoneOtp():await x.requestPhoneOtp();e?_("Failed to send SMS code. If this persists, refresh the page and try again."):f("Verification SMS has been resent.")})(),f("Verification SMS has been resent.")};return u(()=>{const e=setInterval(()=>{k(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),u(()=>{l&&!i&&(async()=>{const{error:e}=await x.requestEmailOtp();e?_("Failed to send Email code. If this persists, refresh the page and try registering again."):a(L)})()},[l,i,a,x]),e("div",{className:Te,children:r("div",{className:Oe,children:[e("h2",{className:Ae,children:"Verify Your Phone Number"}),e("p",{className:ze,children:"Enter the code sent to your phone number."}),d&&e("p",{className:Ee,children:d}),h&&e("p",{className:Be,children:h}),r("form",{onSubmit:async e=>{if(e.preventDefault(),_(""),6===s.length){p(!0);try{await w()}catch{_("Unexpected error occurred.")}finally{p(!1)}}else _("Please enter a valid code.")},className:Le,children:[r("div",{children:[r("label",{htmlFor:"phoneCode",className:qe,children:["Phone Verification Code ",(S=l,!0===S?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===S?e("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",r("span",{className:Re,children:["Code expires in: ",(N=b,`${Math.floor(N/60).toString().padStart(2,"0")}:${(N%60).toString().padStart(2,"0")}`)]})]}),e(Ue,{length:6,value:s,onChange:n}),e("button",{type:"button",onClick:()=>P(),className:Fe,children:"Resend code to phone"})]}),e("button",{type:"submit",className:je,children:m?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>a("/login"),className:De,children:"Back to login"})]})]})});var N,S},Ke=()=>{const a=v(),o=y(),{refreshSession:t}=C(),i=M(),{passkeySupported:s}=A(),n="login"===o.state?.flow,[l,c]=g(!1),[d,_]=g(""),[m,p]=g(300),[h,f]=g(""),[b,k]=g("");return u(()=>{const e=setInterval(()=>{p(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:Te,children:r("div",{className:Oe,children:[e("h2",{className:Ae,children:"Verify Your Email"}),e("p",{className:ze,children:"We sent you a verification email. Enter the code below."}),h&&e("p",{className:Ee,children:h}),b&&e("p",{className:Be,children:b}),r("form",{onSubmit:async e=>{if(e.preventDefault(),f(""),6===d.length){c(!0);try{const{error:e}=n?await i.verifyLoginEmailOtp(d):await i.verifyEmailOtp(d);if(e)return void f("Verification failed.");if(n)return await t(),void a("/");s?a(F):(await t(),a("/"))}catch{console.error("Email OTP verification failed."),f("Verification failed.")}finally{c(!1)}}else f("Please enter a valid code.")},className:Le,children:[r("div",{children:[r("label",{htmlFor:"emailCode",className:qe,children:["Email Verification Code",r("span",{className:Re,children:[" ","— Code expires in ",(x=m,`${Math.floor(x/60).toString().padStart(2,"0")}:${(x%60).toString().padStart(2,"0")}`)]})]}),e(Ue,{length:6,value:d,onChange:_,inputMode:"text"}),e("button",{type:"button",onClick:async()=>{f(""),k("");const{error:e}=n?await i.requestLoginEmailOtp():await i.requestEmailOtp();e?f("Failed to send Email code. If this persists, refresh the page and try again."):k("Verification email has been resent.")},className:Fe,children:"Resend code to email"})]}),e("button",{type:"submit",className:je,disabled:l,children:l?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>a("/login"),className:De,children:"Back to login"})]})]})});var x};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"};D(".verifyMagiclink-module__container___qrSXf{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid var(--seamless-border,hsla(0,0%,100%,.15));border-radius:50%;border-top-color:var(--seamless-accent,#60a5fa);height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:var(--seamless-success,#34d399);height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:var(--seamless-success,#34d399);font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const $e=()=>{const[a]=b(),o=v(),t=a.get("token"),[i,s]=g(""),[n,l]=g(""),c=M(),{refreshSession:d}=C();return u(()=>{let e=!0,r=null,a=null;return(async()=>{if(!t)return e&&s("Missing token for verification."),void console.error("No magic-link token found.");const{error:i}=await c.verifyMagicLink(t);if(i)return console.error("Failed to verify token"),void(e&&s("Failed to verify token"));await d(),e&&(r=new BroadcastChannel("seamless-auth"),r.postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),l("You have been verified on the device and browser that initiated this request"),a=setTimeout(()=>{e&&o("/")},900))})(),()=>{e=!1,r?.close(),a&&clearTimeout(a)}},[t,c,o,d]),e("div",{className:Ye.container,children:r("div",{className:Ye.card,children:[e("h1",{className:Ye.title,children:"Verifying your login"}),r("div",{className:Ye.verificationContent,children:[!n&&!i&&e("div",{className:Ye.spinner}),n&&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"})})}),!n&&!i&&e("p",{className:Ye.helperText,children:"Please wait while we securely verify your sign-in link."}),n&&e("p",{className:Ye.successText,children:"Login verified. Redirecting…"}),i&&e("p",{className:Ye.error,children:i})]})]})})};const He={oauth_missing_email:"Your provider account did not share an email address. Add an email to that account and make it visible, then try again.",oauth_email_not_verified:"The email address on your provider account is not verified. Verify it with your provider, then try again.",oauth_missing_subject:"Your provider did not return a usable account identifier. Try again, or sign in with a different method."},Je=()=>{const{finishOAuthLogin:o}=C(),t=v(),[i]=b(),[s,n]=g(""),c=p(!1);return u(()=>{if(c.current)return;c.current=!0;const e=i.get("code"),r=i.get("state"),a=sessionStorage.getItem(de);e&&r&&a?o({providerId:a,code:e,state:r}).then(({data:e,error:r})=>{if(r){const e=l(r);return void n(e?He[e]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(de),t(function(e){if(!e)return null;try{const r=new URL(e,window.location.origin);return r.origin!==window.location.origin?null:`${r.pathname}${r.search}${r.hash}`}catch{return null}}(e?.returnTo)??"/")}):n("This sign-in link is missing required information.")},[o,t,i]),r("div",{className:Ye.container,children:[e("h2",{className:Ye.title,children:s?"Sign-in failed":"Completing sign-in..."}),s&&r(a,{children:[e("p",{children:s}),e("button",{type:"button",onClick:()=>t("/login"),children:"Back to login"})]})]})};var Ze="magiclink-module__container___45zcA",Qe="magiclink-module__card___Au9oN",Xe="magiclink-module__iconWrapper___k5ndr",er="magiclink-module__mailIcon___Pwb7q",rr="magiclink-module__iconRing___bdLvf",ar="magiclink-module__heading___b9cre",or="magiclink-module__message___kiVFj",tr="magiclink-module__identifier___JtcFM",ir="magiclink-module__helperText___7Mlfh",sr="magiclink-module__actions___64I-3",nr="magiclink-module__secondaryButton___BntAI",lr="magiclink-module__cooldown___Ib4rm",cr="magiclink-module__linkButton___maJiv";D(".magiclink-module__container___45zcA{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:var(--seamless-surface,#1f2937);border-radius:.75rem;box-shadow:0 10px 25px var(--seamless-shadow,rgba(0,0,0,.25));max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:var(--seamless-accent-soft,#a5b4fc);height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:var(--seamless-text-muted,#d1d5db);font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:var(--seamless-surface-raised,hsla(0,0%,100%,.05));border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:var(--seamless-surface,#111827);border:1px solid var(--seamless-border,#374151);border-radius:8px;color:var(--seamless-text,#fff);cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:var(--seamless-surface-hover,#1f2937)}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:var(--seamless-text-muted,#9ca3af);font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:var(--seamless-accent-soft,#a5b4fc);cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const dr=()=>{const{refreshSession:a}=C(),o=v(),t=y(),i=M(),s=t.state?.identifier,[n,l]=g(30);u(()=>{const e=setInterval(()=>{l(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const c=h(async()=>{const{data:e,error:r}=await i.checkMagicLink();return!r&&"Success"===e?.message},[i]);return u(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await c()&&(await a(),o("/"))},()=>{e.close()}},[c,o,a]),u(()=>{const e=setInterval(async()=>{try{await c()&&(await a(),o("/"))}catch{}},5e3);return()=>clearInterval(e)},[c,a,o]),e("div",{className:Ze,children:r("div",{className:Qe,children:[r("div",{className:Xe,children:[e("div",{className:rr}),r("svg",{className:er,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:ar,children:"Check your email"}),e("p",{className:or,children:"If an account exists for this address, we sent a secure sign-in link."}),s&&e("div",{className:tr,children:s}),e("p",{className:ir,children:"Open the email and click the link to finish signing in."}),e("p",{className:ir,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),r("div",{className:sr,children:[e("button",{className:nr,disabled:n>0,onClick:async()=>{n>0||(await i.requestMagicLink(),l(30))},children:"Resend link"}),n>0&&r("div",{className:lr,children:["Available in ",n,"s"]}),e("button",{className:cr,onClick:()=>o("/login"),children:"Change email or phone"})]})]})})},_r=()=>r(k,{children:[e(x,{path:z,element:e(me,{})}),e(x,{path:E,element:e(ge,{})}),e(x,{path:B,element:e(We,{})}),e(x,{path:L,element:e(Ke,{})}),e(x,{path:q,element:e($e,{})}),e(x,{path:R,element:e(Je,{})}),e(x,{path:F,element:e(Ie,{})}),e(x,{path:j,element:e(dr,{})}),e(x,{path:"*",element:e(w,{to:z,replace:!0})})]}),mr=()=>C().client.authorizedFetch;export{S as AuthProvider,_r as AuthRoutes,O as hasNonPasskeyLoginMethod,C as useAuth,M as useAuthClient,mr as useAuthorizedFetch,T as useLoginMethods,A as usePasskeySupport};
1
+ 'use client';
2
+ import{u as e}from"./chunks/shared-BzrBuR0z.js";export{A as AuthProvider,h as hasNonPasskeyLoginMethod,a as useAuthClient,b as useLoginMethods,c as usePasskeySupport}from"./chunks/shared-BzrBuR0z.js";export{SeamlessAuthError,createSeamlessAuthClient,encodePrfSalt,extractPasskeyPrfResult,getOAuthErrorCode,getPasskeyPolicyErrorCode,getWebAuthnErrorDetail,hasScopedRole,isPasskeyPrfSupported,isUnauthenticated,roleGrantsAccess}from"@seamless-auth/client";import"react";import"react/jsx-runtime";const s=()=>e().client.authorizedFetch;export{e as useAuth,s as useAuthorizedFetch};
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/AuthProvider.tsx","../src/hooks/useAuthClient.ts","../src/hooks/useLoginMethods.ts","../src/hooks/usePasskeySupport.ts","../src/routes.ts","../../../node_modules/style-inject/dist/style-inject.es.js","../src/utils.ts","../src/components/AuthFallbackOptions.tsx","../src/components/OAuthProviderButtons.tsx","../src/views/Login.tsx","../src/views/PassKeyLogin.tsx","../src/views/PassKeyRegistration.tsx","../src/components/OtpInput.tsx","../src/views/PhoneRegistration.tsx","../src/views/EmailRegistration.tsx","../src/views/VerifyMagicLink.tsx","../src/views/OAuthCallback.tsx","../src/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx","../src/hooks/useAuthorizedFetch.ts"],"sourcesContent":[null,null,null,null,null,"function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["AuthContext","createContext","undefined","useAuth","context","useContext","Error","AuthProvider","children","apiHost","autoDetectPreviousSignin","magicLinkRedirectUri","transport","ports","providedPorts","useMemo","passkeys","createBrowserPasskeyPort","oauthRedirect","createBrowserOAuthRedirect","mode","basePath","tokenStorage","fetch","fetchImpl","stableTransport","session","createAuthSession","detectPreviousSignIn","state","useSyncExternalStore","subscribe","getState","useEffect","actions","refreshSession","value","client","_jsx","Provider","useAuthClient","FALLBACK_LOGIN_METHODS","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","loading","setLoading","active","async","data","error","getPublicSystemConfig","length","read","hasNonPasskeyLoginMethod","Boolean","some","method","usePasskeySupport","passkeySupported","setPasskeySupported","supported","isSupported","isPlatformAuthenticatorAvailable","checkSupport","authRoutePaths","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","isValidEmail","email","normalized","trim","parts","split","localPart","domainPart","test","startsWith","endsWith","includes","isValidPhoneNumber","phone","phoneNumber","parsePhoneNumberFromString","isValid","AuthFallbackOptions","identifier","onMagicLink","onEmailOtp","onPhoneOtp","onPasskeyRetry","allowedMethods","Set","showMagicLink","has","showEmailOtp","showPhoneOtp","showPasskeyRetry","_jsxs","className","styles","onClick","OAUTH_PROVIDER_STORAGE_KEY","OAuthProviderButtons","listOAuthProviders","startOAuthLogin","finishOAuthLogin","callbackHref","useHref","providers","setProviders","setError","then","map","provider","providerId","sessionStorage","setItem","redirectUri","URL","window","location","origin","toString","outcome","open","authorizationUrl","code","handleSelect","id","name","Login","navigate","useNavigate","hasSignedInBefore","login","handlePasskeyLogin","configuredMethods","setIdentifier","setEmail","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","canSubmit","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","passkeyError","register","message","console","htmlFor","onChange","target","autoComplete","placeholder","onBlur","required","requestMagicLink","requestLoginEmailOtp","flow","requestLoginPhoneOtp","disabled","role","PassKeyLogin","runPasskeyLogin","container","card","title","button","POLICY_REFUSAL_MESSAGES","attachment_not_allowed","synced_passkey_not_allowed","authenticator_not_allowed","prf_required","PasskeyRegistration","passkeySupportLoading","loginMethodsLoading","status","setStatus","setMessage","canSkip","finishWithoutPasskey","registerPasskey","attachment","platform","browser","deviceInfo","ua","navigator","userAgent","toLowerCase","brave","parseUserAgent","metadata","friendlyName","getPasskeyPolicyErrorCode","policyRefusalMessage","isUnauthenticated","OtpInput","inputMode","inputs","useRef","values","concat","Array","fill","slice","handleChange","index","input","char","handleBulkInput","newValueArr","newValue","join","current","focus","cleaned","replace","chars","forEach","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","key","handleKeyDown","PhoneRegistration","useLocation","isLoginFlow","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","verifyLoginPhoneOtp","verifyPhoneOtp","handleResend","requestPhoneOtp","onResendPhone","interval","setInterval","prev","clearInterval","requestEmailOtp","nextStep","verified","seconds","floor","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","verifyLoginEmailOtp","verifyEmailOtp","VerifyMagicLink","searchParams","useSearchParams","token","get","successMsg","setSuccessMsg","mounted","channel","redirectTimeout","verifyMagicLink","BroadcastChannel","postMessage","setTimeout","verify","close","clearTimeout","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","CODE_ERRORS","oauth_missing_email","oauth_email_not_verified","oauth_missing_subject","OAuthCallback","startedRef","getItem","finishError","getOAuthErrorCode","removeItem","returnTo","pathname","search","hash","inAppPath","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","useCallback","checkMagicLink","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to","useAuthorizedFetch","authorizedFetch"],"mappings":"k0BAuGA,MAAMA,EAAcC,OAA2CC,GAMlDC,EAAU,KACrB,MAAMC,EAAUC,EAAWL,GAC3B,IAAKI,EACH,MAAM,IAAIE,MAAM,+CAElB,OAAOF,GAqBIG,EAA4C,EACvDC,WACAC,UACAC,4BAA2B,EAC3BC,uBACAC,YACAC,MAAOC,MAKP,MAAMD,EAAQE,EACZ,KAAA,CACEC,SAAUF,GAAeE,UAAYC,IACrCC,cAAeJ,GAAeI,eAAiBC,MAEjD,CAACL,GAAeE,SAAUF,GAAeI,iBAGrCE,KAAEA,EAAIC,SAAEA,EAAQC,aAAEA,EAAcC,MAAOC,GAAcZ,GAAa,CAAA,EAClEa,EAAkBV,EACtB,IAAOH,EAAY,CAAEQ,OAAMC,WAAUC,eAAcC,MAAOC,QAActB,EAExE,CAACkB,EAAMC,EAAUC,EAAcE,IAG3BE,EAAUX,EACd,IACEY,EAAkB,CAChBlB,UACAE,uBACAC,UAAWa,EACXT,SAAUH,EAAMG,SAChBY,qBAAsBlB,IAE1B,CACED,EACAE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K,IAAIC,QAAStT,EAACuT,GAASC,GAAI3R,EAAsBiL,kBCfpD2G,GAAqB,IAAM5V,IAAUkC,OAAO2T","x_google_ignoreList":[5]}
1
+ {"version":3,"file":"index.js","sources":["../src/hooks/useAuthorizedFetch.ts"],"sourcesContent":[null],"names":["useAuthorizedFetch","useAuth","client","authorizedFetch"],"mappings":";8eAaO,MAAMA,EAAqB,IAAMC,IAAUC,OAAOC"}
package/dist/routes.d.ts CHANGED
@@ -1,21 +1 @@
1
- /**
2
- * Paths for the bundled auth screens.
3
- *
4
- * Kebab-case throughout, except for two paths that are dictated by contracts
5
- * outside this package rather than by the naming convention:
6
- *
7
- * - `verifyMagicLink` is the URL the auth API builds when it emails a magic
8
- * link, so it has to match that value exactly.
9
- * - `oauthCallback` is registered with OAuth providers as an allowed redirect
10
- * URI, so renaming it would break configured integrations.
11
- */
12
- export declare const authRoutePaths: {
13
- readonly login: "/login";
14
- readonly passkeyLogin: "/passkey-login";
15
- readonly verifyPhoneOtp: "/verify-phone-otp";
16
- readonly verifyEmailOtp: "/verify-email-otp";
17
- readonly verifyMagicLink: "/verify-magiclink";
18
- readonly oauthCallback: "/oauth/callback";
19
- readonly registerPasskey: "/register-passkey";
20
- readonly magicLinkSent: "/magic-link-sent";
21
- };
1
+ export { AuthRoutes } from './AuthRoutes';
package/dist/routes.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ import{jsxs as e,jsx as r,Fragment as a}from"react/jsx-runtime";import{useHref as o,useNavigate as i,useLocation as t,useSearchParams as s,Routes as n,Route as l,Navigate as c}from"react-router-dom";import{u as d,a as _,c as m,b as u,F as g,h as p}from"./chunks/shared-BzrBuR0z.js";import{useState as h,useEffect as f,useRef as v,useCallback as b}from"react";import y from"libphonenumber-js";import{isUnauthenticated as k,getPasskeyPolicyErrorCode as x,getOAuthErrorCode as w}from"@seamless-auth/client";const N="/login",P="/passkey-login",C="/verify-phone-otp",I="/verify-email-otp",T="/verify-magiclink",M="/oauth/callback",O="/register-passkey",S="/magic-link-sent";function z(e,r){void 0===r&&(r={});var a=r.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===a&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var A="login-module__container___YggDx",B="login-module__card___Ub-Py",q="login-module__heading___neEqb",E="login-module__inputGroup___P6qgS",L="login-module__label___mx5vu",F="login-module__input___U07lW",j="login-module__helperText___kDQ4-",D="login-module__error___40zxh",R="login-module__button___0kFBs",V="login-module__submitHint___qOS5Z",G="login-module__toggle___1JiG1",W="login-module__fallbackCard___HdIk-",U="login-module__fallbackHeader___-il2v",K="login-module__fallbackDescription___ea5EB",Y="login-module__fallbackActions___AD3ni",$="login-module__fallbackActionButton___lFgWf",H="login-module__actionTitle___ycrMp",J="login-module__actionSubtext___opaIV",Z="login-module__linkButton___5lsoe";z(".login-module__container___YggDx{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 4px 6px var(--seamless-shadow,rgba(0,0,0,.1));max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:var(--seamless-success,#68d391);text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:var(--seamless-text-muted,#d1d5db);display:block}.login-module__input___U07lW{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6);outline:none}.login-module__helperText___kDQ4-{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:var(--seamless-danger,#f87171);font-size:.875rem}.login-module__button___0kFBs{background-color:var(--seamless-accent,#2563eb);border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s,opacity .3s;width:100%}.login-module__button___0kFBs:hover:not(:disabled){background-color:var(--seamless-accent-hover,#1d4ed8)}.login-module__button___0kFBs:disabled{cursor:not-allowed;opacity:.6}.login-module__submitHint___qOS5Z{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:.5rem;text-align:center}.login-module__toggle___1JiG1{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:var(--seamless-surface-raised,#4b5563);border:1px solid var(--seamless-border,#d1d5db);border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}.login-module__fallbackCard___HdIk-{background:var(--seamless-surface-raised,hsla(0,0%,100%,.04));border:1px solid var(--seamless-border,hsla(0,0%,100%,.08));border-radius:12px;display:flex;flex-direction:column;gap:14px;margin-top:18px;padding:18px}.login-module__fallbackHeader___-il2v{color:var(--seamless-text,#f3f4f6);font-size:.95rem;font-weight:600}.login-module__fallbackDescription___ea5EB{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4}.login-module__fallbackActions___AD3ni{display:flex;flex-direction:column;gap:10px}.login-module__fallbackActionButton___lFgWf{background:var(--seamless-surface,rgba(0,0,0,.25));border:1px solid var(--seamless-border,hsla(0,0%,100%,.08));border-radius:8px;cursor:pointer;display:flex;flex-direction:column;padding:12px 14px;text-align:left;transition:all .15s ease}.login-module__fallbackActionButton___lFgWf:hover{background:var(--seamless-surface-hover,hsla(0,0%,100%,.06));border-color:var(--seamless-border,hsla(0,0%,100%,.15))}.login-module__actionTitle___ycrMp{color:var(--seamless-text,#f9fafb);font-size:.9rem;font-weight:500}.login-module__actionSubtext___opaIV{color:var(--seamless-text-muted,#9ca3af);font-size:.75rem;margin-top:2px}.login-module__linkButton___5lsoe{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.8rem;margin-top:6px}.login-module__linkButton___5lsoe:hover{text-decoration:underline}");const Q=e=>{if("string"!=typeof e)return!1;const r=e.trim();if(r.length<3||r.length>320)return!1;const a=r.split("@");if(2!==a.length)return!1;const[o,i]=a;return!(!/^[A-Za-z0-9._%+-]+$/.test(o)||o.startsWith(".")||o.endsWith(".")||o.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(i)||i.startsWith("-")||i.endsWith("-")||i.startsWith(".")||i.endsWith(".")||i.includes(".."))},X=e=>{const r=y(e);return r?.isValid()||!1};const ee=({identifier:a,onMagicLink:o,onEmailOtp:i,onPhoneOtp:t,onPasskeyRetry:s,loginMethods:n})=>{const l=new Set(n??["passkey","magic_link","phone_otp"]),c=l.has("magic_link")&&Q(a),d=l.has("email_otp")&&Boolean(i)&&Q(a),_=l.has("phone_otp")&&X(a),m=l.has("passkey")&&Boolean(s);return c||d||_||m?e("div",{className:W,children:[r("div",{className:U,children:"Choose a sign-in method"}),r("p",{className:K,children:"Choose another secure sign-in method."}),e("div",{className:Y,children:[c&&e("button",{type:"button",className:$,onClick:o,children:[r("span",{className:H,children:"Email Magic Link"}),r("span",{className:J,children:"Send a secure sign-in link to your email"})]}),d&&e("button",{type:"button",className:$,onClick:i,children:[r("span",{className:H,children:"Email Code"}),r("span",{className:J,children:"Receive a one-time code by email"})]}),_&&e("button",{type:"button",className:$,onClick:t,children:[r("span",{className:H,children:"Text Message Code"}),r("span",{className:J,children:"Receive a one-time code via SMS"})]})]}),m&&r("button",{type:"button",className:Z,onClick:s,children:"Try passkey anyway"})]}):null},re="seamless:oauth:provider",ae=()=>{const{listOAuthProviders:a,startOAuthLogin:i,finishOAuthLogin:t,ports:s}=d(),n=o("/oauth/callback"),[l,c]=h([]),[_,m]=h("");if(f(()=>{let e=!0;return a().then(({data:r})=>{e&&c(r?.providers??[])}),()=>{e=!1}},[a]),0===l.length)return null;return e("div",{className:Y,children:[l.map(a=>r("button",{type:"button",className:$,onClick:()=>(async e=>{m(""),sessionStorage.setItem(re,e);const r=new URL(n,window.location.origin).toString(),{data:a,error:o}=await i({providerId:e,redirectUri:r});if(o)return void m("Could not start sign-in with this provider.");const l=await s.oauthRedirect.open(a.authorizationUrl,r);"callback"===l.type&&(await t({providerId:e,code:l.code,state:l.state})).error&&m("Could not finish sign-in with this provider.")})(a.id),children:e("span",{className:H,children:["Continue with ",a.name]})},a.id)),_&&r("p",{className:D,children:_})]})},oe=()=>{const o=i(),{hasSignedInBefore:t,login:s,handlePasskeyLogin:n}=d(),l=_(),{passkeySupported:c}=m(),{loginMethods:p}=u(),[v,b]=h(""),[y,k]=h(""),[x,w]=h("register"),[N,P]=h(""),[T,M]=h(""),[O,z]=h(""),[W,U]=h(!1),[K,Y]=h(null);f(()=>{t&&w("login")},[t]);const $=()=>"login"===x?Q(v)||X(v):Q(y);return r("div",{className:A,children:e("div",{className:B,children:[r("h2",{className:q,children:"login"===x?"Sign In":"Create Account"}),e(a,{children:[e("form",{onSubmit:async e=>{e.preventDefault(),P(""),U(!1);try{if("login"===x){const{data:e,error:r}=await s(v,c);if(r)return void P("Failed to start sign-in. Please try again.");const a=e?.loginMethods?.length?e.loginMethods:p??g;if(Y(a),c&&a.includes("passkey")){const{error:e}=await n();return e?(U(!0),void P("Passkey sign-in could not be completed. Choose another sign-in method.")):void o("/")}return void U(!0)}"register"===x&&await(async()=>{P("");const{data:e,error:r}=await l.register({email:y});r?P("Failed to register. Please try again."):"Success"===e.message?o(I):P("An unexpected error occurred. Try again. If the problem persists, contact support.")})()}catch{console.error("Failed to continue sign-in."),P("Failed to continue sign-in. Please try again.")}},children:["login"===x&&e("div",{className:E,children:[r("label",{htmlFor:"identifier",className:L,children:"Email Address / Phone Number"}),r("input",{id:"identifier",type:"text",value:v,onChange:e=>{const r=e.target.value;b(r)},autoComplete:"off",placeholder:"Email or Phone Number",className:F,onBlur:()=>{if(v){const e=Q(v)||X(v);z(e?"":"Please enter a valid email or phone number")}},required:!0}),r("p",{className:j,children:"Phone numbers must include a country code e.g. +1"}),W&&r(ee,{identifier:v,onMagicLink:async()=>{const{error:e}=await l.requestMagicLink();e?P("Failed to send magic link."):o(S,{state:{identifier:v}})},onEmailOtp:async()=>{const{error:e}=await l.requestLoginEmailOtp();e?P("Failed to send email code."):o(I,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await l.requestLoginPhoneOtp();e?P("Failed to send OTP."):o(C,{state:{flow:"login"}})},onPasskeyRetry:c?n:void 0,loginMethods:K}),O&&r("p",{className:D,children:O})]}),"register"===x&&e("div",{className:E,children:[r("label",{htmlFor:"email",className:L,children:"Email Address"}),r("input",{id:"email",type:"email",value:y,onChange:e=>{const r=e.target.value;k(r)},autoComplete:"off",className:F,onBlur:()=>{if(y){const e=Q(y);M(e?"":"Please enter a valid email")}},required:!0}),T&&r("p",{className:D,children:T})]}),r("button",{type:"submit",className:R,disabled:!$(),"aria-describedby":"seamless-submit-hint",children:"login"===x?"Login":"Register"}),r("p",{id:"seamless-submit-hint",role:"status",className:V,children:"login"===x?v?$()?"Ready to continue.":"This does not look like a complete email or phone number yet.":"Enter your email or phone number to continue.":y?$()?"Ready to continue.":"This does not look like a complete email address yet.":"Enter your email address to continue."}),N&&r("p",{className:D,children:N}),r("button",{type:"button",onClick:()=>w("login"===x?"register":"login"),className:G,children:"login"===x?"Don't have an account? Create one":"Already have an account? Sign in"})]}),r(ae,{})]})]})})};var ie={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};z(".passKeyLogin-module__container___IUKxF{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:var(--seamless-accent,#2563eb);border:1px solid var(--seamless-accent,#3b82f6);border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const te=()=>{const a=i(),{handlePasskeyLogin:o}=d(),[t,s]=h("");return r("div",{className:ie.container,children:e("div",{className:ie.card,children:[r("h2",{className:ie.title,children:"Login with Passkey"}),r("button",{onClick:async()=>{s("");const{error:e}=await o();e?s("Passkey sign-in could not be completed. Try another sign-in method."):a("/")},className:ie.button,children:"Use Passkey"}),t&&r("p",{className:ie.error,children:t})]})})};var se="registerPasskey-module__container___jqEh8",ne="registerPasskey-module__card___MJAyC",le="registerPasskey-module__loading___Q4i1x",ce="registerPasskey-module__spinner___V1nhd",de="registerPasskey-module__supported___ihTih",_e="registerPasskey-module__title___vn2Qu",me="registerPasskey-module__description___AWmO-",ue="registerPasskey-module__button___D3b4B",ge="registerPasskey-module__message___RiOw-",pe="registerPasskey-module__success___HP5aX",he="registerPasskey-module__error___hGiqE",fe="registerPasskey-module__skip___1hDyU",ve="registerPasskey-module__secondary___bnOB4";z(".registerPasskey-module__container___jqEh8{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:var(--seamless-surface,#1f2937);border-radius:1rem;box-shadow:0 4px 20px var(--seamless-shadow,rgba(0,0,0,.4));max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:var(--seamless-surface,#f9fafb);border-radius:.75rem;box-shadow:0 2px 8px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#374151);display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-bottom:2px solid var(--seamless-accent,#3b82f6);border-left:2px solid transparent;border-radius:9999px;border-right:2px solid transparent;border-top:2px solid var(--seamless-accent,#3b82f6);height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:var(--seamless-surface,#ecfdf5);border-radius:.75rem;box-shadow:0 2px 12px var(--seamless-shadow,rgba(0,0,0,.1));color:var(--seamless-text,#065f46);padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:var(--seamless-accent,#059669);border:none;border-radius:.5rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:var(--seamless-accent-hover,#047857)}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:var(--seamless-success,#6ee7b7)}.registerPasskey-module__error___hGiqE{color:var(--seamless-danger,#f87171)}.registerPasskey-module__skip___1hDyU{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.registerPasskey-module__skip___1hDyU:disabled{cursor:default;opacity:.6}.registerPasskey-module__secondary___bnOB4{background:none;border:1px solid var(--seamless-accent,#059669);border-radius:.5rem;color:var(--seamless-accent,#059669);cursor:pointer;font-weight:500;margin-top:.75rem;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__secondary___bnOB4:hover:not(:disabled){background-color:var(--seamless-accent-muted,rgba(5,150,105,.1))}.registerPasskey-module__secondary___bnOB4:disabled{cursor:default;opacity:.6}");const be={attachment_not_allowed:"This application does not accept that kind of authenticator. Try the other option.",synced_passkey_not_allowed:"This passkey syncs to a password manager, and this application requires one that stays on a single device, such as a security key.",authenticator_not_allowed:"This application does not accept this authenticator.",prf_required:"This authenticator does not support a feature this application requires."};const ye=()=>{const{refreshSession:a}=d(),o=_(),{passkeySupported:s,loading:n}=m(),{loginMethods:l,loading:c}=u(),g=i(),f=function(e){const r=e?.returnTo;return"string"!=typeof r||!r.startsWith("/")||r.startsWith("//")||r.startsWith("/\\")?"/":r}(t().state),[v,b]=h("idle"),[y,w]=h(""),N=p(l),P=async()=>{await a(),g(f)},C=async e=>{const{platform:r,browser:i,deviceInfo:t}=function(){const e=navigator.userAgent.toLowerCase();let r="unknown",a="unknown";return/iphone|ipad|ipod/.test(e)?r="ios":/android/.test(e)?r="android":/mac os/.test(e)?r="mac":/windows/.test(e)?r="windows":/linux/.test(e)&&(r="linux"),navigator.brave?a="brave":/edg\/|edgios/.test(e)?a="edge":/opr\/|opt\/|opera/.test(e)?a="opera":/vivaldi/.test(e)?a="vivaldi":/samsungbrowser/.test(e)?a="samsung":/firefox|fxios/.test(e)?a="firefox":/chrome|crios/.test(e)?a="chrome":/safari/.test(e)&&(a="safari"),{platform:r,browser:a,deviceInfo:`${r} • ${a}`}}(),s={friendlyName:t,platform:r,browser:i,deviceInfo:t};b("loading");try{const{error:r}=await o.registerPasskey({metadata:s,attachment:e});if(r)throw r;await a(),b("success"),w("Passkey registered successfully."),g(f)}catch(e){console.error("Passkey registration failed."),b("error"),w(function(e){const r=x(e);return r?be[r]:void 0}(e)??(k(e)?"Your session expired before the passkey was saved. Sign in again to add one.":"Error registering passkey."))}};return r("div",{className:se,children:r("div",{className:ne,children:e("div",n||c?{className:le,children:[r("div",{className:ce}),r("span",{children:"Checking for Passkey Support..."})]}:s?{className:de,children:[r("h2",{className:_e,children:"Secure Your Account with a Passkey"}),r("p",{className:me,children:"Your device supports passkeys! Register one to skip passwords forever."}),r("button",{onClick:()=>C(),disabled:"loading"===v,className:ue,children:"loading"===v?"Registering...":"Register Passkey"}),r("button",{type:"button",onClick:()=>C("cross-platform"),disabled:"loading"===v,className:ve,children:"Use a security key instead"}),y&&r("p",{className:`${ge} ${"success"===v?pe:he}`,children:y}),N&&r("button",{type:"button",onClick:P,disabled:"loading"===v,className:fe,children:"Skip for now"})]}:{className:de,children:[r("h2",{className:_e,children:"Passkeys are not available here"}),r("p",{className:me,children:N?"This device does not support passkeys. You can continue without one and add a passkey later from a device that does.":"This device does not support passkeys, and this application requires one to sign in. Try again from a device or browser that supports them."}),N&&r("button",{type:"button",onClick:P,className:ue,children:"Continue"})]})})})};var ke="verifyOTP-module__container___wgoDE",xe="verifyOTP-module__card___3cs2p",we="verifyOTP-module__title___fZ-1d",Ne="verifyOTP-module__subtitle___dGSu3",Pe="verifyOTP-module__error___GEtlG",Ce="verifyOTP-module__success___46TjG",Ie="verifyOTP-module__form___jiGG-",Te="verifyOTP-module__label___Zq5Mi",Me="verifyOTP-module__timer___smq-a",Oe="verifyOTP-module__resend___PlmkG",Se="verifyOTP-module__button___8pIuO",ze="verifyOTP-module__toggle___wbzVa";z(".verifyOTP-module__container___wgoDE{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:var(--seamless-text-muted,#9ca3af);font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:var(--seamless-danger,#f87171);margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:var(--seamless-success,#34d399);margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:var(--seamless-text-muted,#d1d5db);display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:var(--seamless-warning,#facc15);font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:.375rem;color:var(--seamless-text,#fff);outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px var(--seamless-accent,#3b82f6)}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:var(--seamless-accent,#3b82f6)}.verifyOTP-module__button___8pIuO{background-color:var(--seamless-accent,#2563eb);border:none;border-radius:.375rem;color:var(--seamless-accent-contrast,#fff);cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:var(--seamless-accent-hover,#1d4ed8)}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:var(--seamless-accent-soft,#60a5fa);cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");var Ae="otpInput-module__otpContainer___MUjby",Be="otpInput-module__otpInput___3YMVm";z(".otpInput-module__otpContainer___MUjby{display:flex;gap:8px;justify-content:center;margin-top:8px}.otpInput-module__otpInput___3YMVm{background:var(--seamless-surface-raised,#374151);border:1px solid var(--seamless-border,#4b5563);border-radius:8px;color:var(--seamless-text,#fff);font-size:1.2rem;height:48px;text-align:center;transition:border-color .15s ease,box-shadow .15s ease;width:42px}.otpInput-module__otpInput___3YMVm:focus{border-color:var(--seamless-accent,#60a5fa);box-shadow:0 0 0 2px var(--seamless-accent,rgba(96,165,250,.25));outline:none}");const qe=({length:e=6,value:a,inputMode:o="numeric",onChange:i,name:t="otp"})=>{const s=v([]),n=a.split("").concat(Array(e).fill("")).slice(0,e),l=(e,r)=>{var a;if(r.length>1)c(e,r);else if(!r||(a=r,"numeric"===o?/^\d$/.test(a):/^[a-zA-Z]$/.test(a))){const a=[...n];a[e]=r;const o=a.join("");i(o),r&&s.current[e+1]&&s.current[e+1]?.focus()}},c=(r,a)=>{let t=a;t="numeric"===o?a.replace(/\D/g,""):a.replace(/[^a-zA-Z]/g,"");const l=t.slice(0,e).split(""),c=[...n];l.forEach((a,o)=>{r+o<e&&(c[r+o]=a)}),i(c.join("")),s.current[Math.min(r+l.length,e-1)]?.focus()};return r("div",{className:Ae,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),c(0,e.clipboardData.getData("text"))},children:n.map((a,c)=>r("input",{ref:e=>s.current[c]=e,type:"text",inputMode:"numeric"===o?"numeric":"text",autoComplete:"one-time-code",name:`${t}-${c}`,maxLength:1,value:a,className:Be,onChange:e=>l(c,e.target.value),onKeyDown:r=>((r,a)=>{if("Backspace"===a.key){a.preventDefault();const e=[...n];n[r]?(e[r]="",i(e.join(""))):r>0&&(e[r-1]="",i(e.join("")),s.current[r-1]?.focus())}"ArrowLeft"===a.key&&r>0&&s.current[r-1]?.focus(),"ArrowRight"===a.key&&r<e-1&&s.current[r+1]?.focus()})(c,r),"aria-label":`Digit ${c+1}`},c))})},Ee=()=>{const a=i(),o=t(),{refreshSession:s}=d(),n="login"===o.state?.flow,[l,c]=h(""),[m,u]=h(null),[g,p]=h(""),[v,b]=h(!1),[y,k]=h(""),[x,w]=h(300),N=_(),P=async()=>{if(b(!0),!m){const{error:e}=n?await N.verifyLoginPhoneOtp(l):await N.verifyPhoneOtp(l);if(e)p("Verification failed.");else{if(n)return await s(),void a("/");u(!0)}}b(!1)},C=async()=>{k(""),await(async()=>{p("");const{error:e}=n?await N.requestLoginPhoneOtp():await N.requestPhoneOtp();e?p("Failed to send SMS code. If this persists, refresh the page and try again."):k("Verification SMS has been resent.")})(),k("Verification SMS has been resent.")};return f(()=>{const e=setInterval(()=>{w(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),f(()=>{m&&!n&&(async()=>{const{error:e}=await N.requestEmailOtp();e?p("Failed to send Email code. If this persists, refresh the page and try registering again."):a(I)})()},[m,n,a,N]),r("div",{className:ke,children:e("div",{className:xe,children:[r("h2",{className:we,children:"Verify Your Phone Number"}),r("p",{className:Ne,children:"Enter the code sent to your phone number."}),g&&r("p",{className:Pe,children:g}),y&&r("p",{className:Ce,children:y}),e("form",{onSubmit:async e=>{if(e.preventDefault(),p(""),6===l.length){b(!0);try{await P()}catch{p("Unexpected error occurred.")}finally{b(!1)}}else p("Please enter a valid code.")},className:Ie,children:[e("div",{children:[e("label",{htmlFor:"phoneCode",className:Te,children:["Phone Verification Code ",(M=m,!0===M?r("span",{className:"text-green-400 ml-2",children:"✅"}):!1===M?r("span",{className:"text-red-400 ml-2",children:"❌"}):null)," -"," ",e("span",{className:Me,children:["Code expires in: ",(T=x,`${Math.floor(T/60).toString().padStart(2,"0")}:${(T%60).toString().padStart(2,"0")}`)]})]}),r(qe,{length:6,value:l,onChange:c}),r("button",{type:"button",onClick:()=>C(),className:Oe,children:"Resend code to phone"})]}),r("button",{type:"submit",className:Se,children:v?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>a("/login"),className:ze,children:"Back to login"})]})]})});var T,M},Le=()=>{const a=i(),o=t(),{refreshSession:s}=d(),n=_(),{passkeySupported:l}=m(),c="login"===o.state?.flow,[u,g]=h(!1),[p,v]=h(""),[b,y]=h(300),[k,x]=h(""),[w,N]=h("");return f(()=>{const e=setInterval(()=>{y(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),r("div",{className:ke,children:e("div",{className:xe,children:[r("h2",{className:we,children:"Verify Your Email"}),r("p",{className:Ne,children:"We sent you a verification email. Enter the code below."}),k&&r("p",{className:Pe,children:k}),w&&r("p",{className:Ce,children:w}),e("form",{onSubmit:async e=>{if(e.preventDefault(),x(""),6===p.length){g(!0);try{const{error:e}=c?await n.verifyLoginEmailOtp(p):await n.verifyEmailOtp(p);if(e)return void x("Verification failed.");if(c)return await s(),void a("/");l?a(O):(await s(),a("/"))}catch{console.error("Email OTP verification failed."),x("Verification failed.")}finally{g(!1)}}else x("Please enter a valid code.")},className:Ie,children:[e("div",{children:[e("label",{htmlFor:"emailCode",className:Te,children:["Email Verification Code",e("span",{className:Me,children:[" ","— Code expires in ",(P=b,`${Math.floor(P/60).toString().padStart(2,"0")}:${(P%60).toString().padStart(2,"0")}`)]})]}),r(qe,{length:6,value:p,onChange:v,inputMode:"text"}),r("button",{type:"button",onClick:async()=>{x(""),N("");const{error:e}=c?await n.requestLoginEmailOtp():await n.requestEmailOtp();e?x("Failed to send Email code. If this persists, refresh the page and try again."):N("Verification email has been resent.")},className:Oe,children:"Resend code to email"})]}),r("button",{type:"submit",className:Se,disabled:u,children:u?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>a("/login"),className:ze,children:"Back to login"})]})]})});var P};var Fe={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"};z(".verifyMagiclink-module__container___qrSXf{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center;padding:1rem}.verifyMagiclink-module__card___niKgr{background-color:var(--seamless-surface,#1f2937);border-radius:.5rem;box-shadow:0 0 10px var(--seamless-shadow,rgba(0,0,0,.3));max-width:28rem;padding:1.5rem;width:100%}.verifyMagiclink-module__title___SumxD{color:var(--seamless-text,#fff);font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyMagiclink-module__verificationContent___NdsS0{align-items:center;display:flex;flex-direction:column;gap:14px;margin:20px 0}.verifyMagiclink-module__spinner___lnW1k{animation:verifyMagiclink-module__spin___2lGzj .9s linear infinite;border:3px solid var(--seamless-border,hsla(0,0%,100%,.15));border-radius:50%;border-top-color:var(--seamless-accent,#60a5fa);height:28px;width:28px}.verifyMagiclink-module__successIcon___XjFEM{align-items:center;background:rgba(16,185,129,.15);border-radius:50%;display:flex;height:36px;justify-content:center;width:36px}.verifyMagiclink-module__checkIcon___I0JOP{animation:verifyMagiclink-module__checkPop___-3qJu .25s ease-out;color:var(--seamless-success,#34d399);height:22px;width:22px}.verifyMagiclink-module__successText___lO5Qq{color:var(--seamless-success,#34d399);font-size:.9rem}@keyframes verifyMagiclink-module__checkPop___-3qJu{0%{opacity:0;transform:scale(.6)}80%{transform:scale(1.15)}to{opacity:1;transform:scale(1)}}@keyframes verifyMagiclink-module__spin___2lGzj{to{transform:rotate(1turn)}}");const je=()=>{const[a]=s(),o=i(),t=a.get("token"),[n,l]=h(""),[c,m]=h(""),u=_(),{refreshSession:g}=d();return f(()=>{let e=!0,r=null,a=null;return(async()=>{if(!t)return e&&l("Missing token for verification."),void console.error("No magic-link token found.");const{error:i}=await u.verifyMagicLink(t);if(i)return console.error("Failed to verify token"),void(e&&l("Failed to verify token"));await g(),e&&(r=new BroadcastChannel("seamless-auth"),r.postMessage({type:"MAGIC_LINK_AUTH_SUCCESS"}),m("You have been verified on the device and browser that initiated this request"),a=setTimeout(()=>{e&&o("/")},900))})(),()=>{e=!1,r?.close(),a&&clearTimeout(a)}},[t,u,o,g]),r("div",{className:Fe.container,children:e("div",{className:Fe.card,children:[r("h1",{className:Fe.title,children:"Verifying your login"}),e("div",{className:Fe.verificationContent,children:[!c&&!n&&r("div",{className:Fe.spinner}),c&&r("div",{className:Fe.successIcon,children:r("svg",{viewBox:"0 0 24 24",className:Fe.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:r("path",{d:"M5 13l4 4L19 7"})})}),!c&&!n&&r("p",{className:Fe.helperText,children:"Please wait while we securely verify your sign-in link."}),c&&r("p",{className:Fe.successText,children:"Login verified. Redirecting…"}),n&&r("p",{className:Fe.error,children:n})]})]})})};const De={oauth_missing_email:"Your provider account did not share an email address. Add an email to that account and make it visible, then try again.",oauth_email_not_verified:"The email address on your provider account is not verified. Verify it with your provider, then try again.",oauth_missing_subject:"Your provider did not return a usable account identifier. Try again, or sign in with a different method.",oauth_invalid_id_token:"Your provider sent a sign-in response that could not be verified. Try again, or sign in with a different method.",oauth_provider_retired:"Your organization no longer signs in with this provider. Sign in with your passkey or another method instead."},Re=()=>{const{finishOAuthLogin:o}=d(),t=i(),[n]=s(),[l,c]=h(""),_=v(!1);return f(()=>{if(_.current)return;_.current=!0;const e=n.get("code"),r=n.get("state"),a=sessionStorage.getItem(re);e&&r&&a?o({providerId:a,code:e,state:r}).then(({data:e,error:r})=>{if(r){const e=w(r);return void c(e?De[e]:"We could not complete sign-in. Please try again.")}sessionStorage.removeItem(re);const a=function(e){if(!e)return null;try{const r=new URL(e,window.location.origin);return r.origin!==window.location.origin?null:`${r.pathname}${r.search}${r.hash}`}catch{return null}}(e?.returnTo)??"/";"enroll_passkey"!==e?.nextStep?t(a):t(O,{state:{returnTo:a}})}):c("This sign-in link is missing required information.")},[o,t,n]),e("div",{className:Fe.container,children:[r("h2",{className:Fe.title,children:l?"Sign-in failed":"Completing sign-in..."}),l&&e(a,{children:[r("p",{children:l}),r("button",{type:"button",onClick:()=>t("/login"),children:"Back to login"})]})]})};var Ve="magiclink-module__container___45zcA",Ge="magiclink-module__card___Au9oN",We="magiclink-module__iconWrapper___k5ndr",Ue="magiclink-module__mailIcon___Pwb7q",Ke="magiclink-module__iconRing___bdLvf",Ye="magiclink-module__heading___b9cre",$e="magiclink-module__message___kiVFj",He="magiclink-module__identifier___JtcFM",Je="magiclink-module__helperText___7Mlfh",Ze="magiclink-module__actions___64I-3",Qe="magiclink-module__secondaryButton___BntAI",Xe="magiclink-module__cooldown___Ib4rm",er="magiclink-module__linkButton___maJiv";z(".magiclink-module__container___45zcA{align-items:center;color:var(--seamless-text,#fff);display:flex;justify-content:center}.magiclink-module__card___Au9oN{background-color:var(--seamless-surface,#1f2937);border-radius:.75rem;box-shadow:0 10px 25px var(--seamless-shadow,rgba(0,0,0,.25));max-width:420px;padding:2.5rem 2rem;text-align:center;width:100%}.magiclink-module__iconWrapper___k5ndr{display:flex;justify-content:center;margin-bottom:1.25rem;position:relative}.magiclink-module__mailIcon___Pwb7q{color:var(--seamless-accent-soft,#a5b4fc);height:38px;width:38px;z-index:2}.magiclink-module__iconRing___bdLvf{animation:magiclink-module__pulse___YGm-I 2s infinite;background:rgba(99,102,241,.15);border-radius:50%;height:72px;position:absolute;width:72px}@keyframes magiclink-module__pulse___YGm-I{0%{opacity:.8;transform:scale(.6)}70%{opacity:0;transform:scale(1.4)}to{opacity:0}}.magiclink-module__heading___b9cre{font-size:1.55rem;font-weight:600;margin-bottom:.75rem}.magiclink-module__message___kiVFj{color:var(--seamless-text-muted,#d1d5db);font-size:.95rem;line-height:1.4;margin-bottom:1rem}.magiclink-module__identifier___JtcFM{background:var(--seamless-surface-raised,hsla(0,0%,100%,.05));border-radius:6px;display:inline-block;font-size:1rem;font-weight:600;margin-bottom:1rem;padding:.45rem .6rem}.magiclink-module__helperText___7Mlfh{color:var(--seamless-text-muted,#9ca3af);font-size:.85rem;line-height:1.4;margin-bottom:.6rem}.magiclink-module__actions___64I-3{display:flex;flex-direction:column;gap:.6rem;margin-top:1.6rem}.magiclink-module__secondaryButton___BntAI{background:var(--seamless-surface,#111827);border:1px solid var(--seamless-border,#374151);border-radius:8px;color:var(--seamless-text,#fff);cursor:pointer;font-weight:500;padding:.65rem}.magiclink-module__secondaryButton___BntAI:hover:not(:disabled){background:var(--seamless-surface-hover,#1f2937)}.magiclink-module__secondaryButton___BntAI:disabled{cursor:not-allowed;opacity:.5}.magiclink-module__cooldown___Ib4rm{color:var(--seamless-text-muted,#9ca3af);font-size:.8rem}.magiclink-module__linkButton___maJiv{background:none;border:none;color:var(--seamless-accent-soft,#a5b4fc);cursor:pointer;font-size:.85rem;margin-top:.4rem}.magiclink-module__linkButton___maJiv:hover{text-decoration:underline}");const rr=()=>{const{refreshSession:a}=d(),o=i(),s=t(),n=_(),l=s.state?.identifier,[c,m]=h(30);f(()=>{const e=setInterval(()=>{m(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);const u=b(async()=>{const{data:e,error:r}=await n.checkMagicLink();return!r&&"Success"===e?.message},[n]);return f(()=>{const e=new BroadcastChannel("seamless-auth");return e.onmessage=async e=>{"MAGIC_LINK_AUTH_SUCCESS"===e.data?.type&&await u()&&(await a(),o("/"))},()=>{e.close()}},[u,o,a]),f(()=>{const e=setInterval(async()=>{try{await u()&&(await a(),o("/"))}catch{}},5e3);return()=>clearInterval(e)},[u,a,o]),r("div",{className:Ve,children:e("div",{className:Ge,children:[e("div",{className:We,children:[r("div",{className:Ke}),e("svg",{className:Ue,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r("path",{d:"M4 6h16v12H4z"}),r("path",{d:"m4 6 8 6 8-6"})]})]}),r("h2",{className:Ye,children:"Check your email"}),r("p",{className:$e,children:"If an account exists for this address, we sent a secure sign-in link."}),l&&r("div",{className:He,children:l}),r("p",{className:Je,children:"Open the email and click the link to finish signing in."}),r("p",{className:Je,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),e("div",{className:Ze,children:[r("button",{className:Qe,disabled:c>0,onClick:async()=>{c>0||(await n.requestMagicLink(),m(30))},children:"Resend link"}),c>0&&e("div",{className:Xe,children:["Available in ",c,"s"]}),r("button",{className:er,onClick:()=>o("/login"),children:"Change email or phone"})]})]})})},ar=()=>e(n,{children:[r(l,{path:N,element:r(oe,{})}),r(l,{path:P,element:r(te,{})}),r(l,{path:C,element:r(Ee,{})}),r(l,{path:I,element:r(Le,{})}),r(l,{path:T,element:r(je,{})}),r(l,{path:M,element:r(Re,{})}),r(l,{path:O,element:r(ye,{})}),r(l,{path:S,element:r(rr,{})}),r(l,{path:"*",element:r(c,{to:N,replace:!0})})]});export{ar as AuthRoutes};
3
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sources":["../src/authRoutePaths.ts","../../../node_modules/style-inject/dist/style-inject.es.js","../src/utils.ts","../src/components/AuthFallbackOptions.tsx","../src/components/OAuthProviderButtons.tsx","../src/views/Login.tsx","../src/views/PassKeyLogin.tsx","../src/views/PassKeyRegistration.tsx","../src/components/OtpInput.tsx","../src/views/PhoneRegistration.tsx","../src/views/EmailRegistration.tsx","../src/views/VerifyMagicLink.tsx","../src/views/OAuthCallback.tsx","../src/components/MagicLinkSent.tsx","../src/AuthRoutes.tsx"],"sourcesContent":[null,"function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["authRoutePaths","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","isValidEmail","email","normalized","trim","length","parts","split","localPart","domainPart","test","startsWith","endsWith","includes","isValidPhoneNumber","phone","phoneNumber","parsePhoneNumberFromString","isValid","AuthFallbackOptions","identifier","onMagicLink","onEmailOtp","onPhoneOtp","onPasskeyRetry","loginMethods","allowedMethods","Set","showMagicLink","has","showEmailOtp","Boolean","showPhoneOtp","showPasskeyRetry","_jsxs","className","styles","children","_jsx","onClick","OAUTH_PROVIDER_STORAGE_KEY","OAuthProviderButtons","listOAuthProviders","startOAuthLogin","finishOAuthLogin","ports","useAuth","callbackHref","useHref","providers","setProviders","useState","error","setError","useEffect","active","then","data","map","provider","async","providerId","sessionStorage","setItem","redirectUri","URL","window","location","origin","toString","outcome","oauthRedirect","open","authorizationUrl","code","state","handleSelect","id","name","Login","navigate","useNavigate","hasSignedInBefore","login","handlePasskeyLogin","authClient","useAuthClient","passkeySupported","usePasskeySupport","configuredMethods","useLoginMethods","setIdentifier","setEmail","mode","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","showFallbackOptions","setShowFallbackOptions","setLoginMethods","canSubmit","_Fragment","onSubmit","e","preventDefault","loginStart","availableMethods","FALLBACK_LOGIN_METHODS","passkeyError","register","message","console","htmlFor","value","onChange","target","autoComplete","placeholder","onBlur","required","requestMagicLink","requestLoginEmailOtp","flow","requestLoginPhoneOtp","undefined","disabled","role","PassKeyLogin","runPasskeyLogin","container","card","title","button","POLICY_REFUSAL_MESSAGES","attachment_not_allowed","synced_passkey_not_allowed","authenticator_not_allowed","prf_required","PasskeyRegistration","refreshSession","loading","passkeySupportLoading","loginMethodsLoading","destination","returnTo","destinationFrom","useLocation","status","setStatus","setMessage","canSkip","hasNonPasskeyLoginMethod","finishWithoutPasskey","registerPasskey","attachment","platform","browser","deviceInfo","ua","navigator","userAgent","toLowerCase","brave","parseUserAgent","metadata","friendlyName","getPasskeyPolicyErrorCode","policyRefusalMessage","isUnauthenticated","OtpInput","inputMode","inputs","useRef","values","concat","Array","fill","slice","handleChange","index","input","char","handleBulkInput","newValueArr","newValue","join","current","focus","cleaned","replace","chars","forEach","i","Math","min","onPaste","clipboardData","getData","el","maxLength","onKeyDown","key","handleKeyDown","PhoneRegistration","isLoginFlow","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","setLoading","resendMsg","setResendMsg","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","verifyLoginPhoneOtp","verifyPhoneOtp","handleResend","requestPhoneOtp","onResendPhone","interval","setInterval","prev","clearInterval","requestEmailOtp","nextStep","verified","seconds","floor","padStart","EmailRegistration","emailOtp","setEmailOtp","emailTimeLeft","setEmailTimeLeft","verifyLoginEmailOtp","verifyEmailOtp","VerifyMagicLink","searchParams","useSearchParams","token","get","successMsg","setSuccessMsg","mounted","channel","redirectTimeout","verifyMagicLink","BroadcastChannel","postMessage","setTimeout","verify","close","clearTimeout","verificationContent","spinner","successIcon","viewBox","checkIcon","stroke","strokeWidth","d","helperText","successText","CODE_ERRORS","oauth_missing_email","oauth_email_not_verified","oauth_missing_subject","oauth_invalid_id_token","oauth_provider_retired","OAuthCallback","startedRef","getItem","finishError","getOAuthErrorCode","removeItem","pathname","search","hash","inAppPath","MagicLinkSent","cooldown","setCooldown","timer","c","magicLinkCompleted","useCallback","checkMagicLink","onmessage","event","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":";wfAiBO,MAAMA,EACJ,SADIA,EAEG,iBAFHA,EAGK,oBAHLA,EAIK,oBAJLA,EAKM,oBALNA,EAMI,kBANJA,EAOM,oBAPNA,EAQI,mBCzBjB,SAASC,EAAYC,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,S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,EAAA,MAAA,CAAKC,UAAWC,GAAeC,SAAA,CAAA,gBAAgBwP,SAGjDvP,EAAA,SAAA,CAAQH,UAAWC,GAAmBG,QAAS,IAAMyC,EAAS,UAAS3C,SAAA,mCC9GpEiQ,GAAa,IACxBpQ,EAACqQ,aACCjQ,EAACkQ,EAAK,CAACC,KAAMzT,EAAsB0T,QAASpQ,EAACyC,GAAK,CAAA,KAClDzC,EAACkQ,EAAK,CAACC,KAAMzT,EAA6B0T,QAASpQ,EAAC6F,GAAY,CAAA,KAChE7F,EAACkQ,EAAK,CAACC,KAAMzT,EAA+B0T,QAASpQ,EAACyK,GAAiB,CAAA,KACvEzK,EAACkQ,EAAK,CAACC,KAAMzT,EAA+B0T,QAASpQ,EAACoM,SACtDpM,EAACkQ,EAAK,CAACC,KAAMzT,EAAgC0T,QAASpQ,EAAC2M,SACvD3M,EAACkQ,GAAMC,KAAMzT,EAA8B0T,QAASpQ,EAAC4O,GAAa,CAAA,KAClE5O,EAACkQ,EAAK,CAACC,KAAMzT,EAAgC0T,QAASpQ,EAACwG,GAAmB,CAAA,KAC1ExG,EAACkQ,EAAK,CAACC,KAAMzT,EAA8B0T,QAASpQ,EAACsP,GAAa,CAAA,KAClEtP,EAACkQ,EAAK,CAACC,KAAK,IAAIC,QAASpQ,EAACqQ,GAASC,GAAI5T,EAAsBiN","x_google_ignoreList":[1]}
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@seamless-auth/react",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "A drop-in authentication solution for modern React applications.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./dist/index.js",
9
- "types": "./dist/index.d.ts"
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./routes": {
12
+ "types": "./dist/routes.d.ts",
13
+ "import": "./dist/routes.js"
10
14
  }
11
15
  },
12
16
  "types": "./dist/index.d.ts",
@@ -21,7 +25,7 @@
21
25
  "npm": ">=9.0.0 <13.0.0"
22
26
  },
23
27
  "scripts": {
24
- "build": "node ../../scripts/clean-dist.mjs && rollup -c && tsc-alias -p tsconfig.build.json",
28
+ "build": "node ../../scripts/clean-dist.mjs && rollup -c && tsc-alias -p tsconfig.build.json && node ../../scripts/check-react-dist.mjs",
25
29
  "typecheck": "tsc --noEmit -p tsconfig.dev.json",
26
30
  "check-npm-build": "npm pack --dry-run"
27
31
  },
@@ -46,9 +50,14 @@
46
50
  "react-dom": "^18.0.0 || ^19.0.0",
47
51
  "react-router-dom": "^6.4.0 || ^7.15.1"
48
52
  },
53
+ "peerDependenciesMeta": {
54
+ "react-router-dom": {
55
+ "optional": true
56
+ }
57
+ },
49
58
  "dependencies": {
50
- "@seamless-auth/client": "^0.1.0",
51
- "@seamless-auth/types": "^0.20.0",
59
+ "@seamless-auth/client": "^0.2.0",
60
+ "@seamless-auth/types": "^0.25.0",
52
61
  "@simplewebauthn/browser": "^13.1.0",
53
62
  "libphonenumber-js": "^1.12.7"
54
63
  },