@seamless-auth/react 0.15.3 → 0.16.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 +11 -0
- package/README.md +11 -0
- package/dist/chunks/shared-DbQnDPUA.js +3 -0
- package/dist/chunks/shared-DbQnDPUA.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/routes.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/shared-Bm18KGK2.js +0 -3
- package/dist/chunks/shared-Bm18KGK2.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @seamless-auth/react
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d1e3310: `authorizedFetch` (and `useAuthorizedFetch`) now sends the session only to `apiHost` and to origins you list in the new `trustedOrigins` option. A request to any other origin rejects with `UntrustedOriginError` and is never sent, so the session cookies, or in React Native the access token, cannot reach a third party through it. Paths, and full URLs on `apiHost`, work as before; a relative URL that does not start with `/` is now refused, and each `trustedOrigins` entry must be a bare `https` origin (`http` only on localhost). If your own API is served from a different origin than the auth adapter, add that origin: `transport: { trustedOrigins: ['https://api.example.com'] }` on the React `AuthProvider`, the `trustedOrigins` prop on the React Native `AuthProvider`, or `trustedOrigins` in `provideSeamlessAuth`, which `seamlessAuthInterceptor` also honours.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d1e3310]
|
|
12
|
+
- @seamless-auth/client@0.5.0
|
|
13
|
+
|
|
3
14
|
## 0.15.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -314,6 +314,17 @@ const authorizedFetch = useAuthorizedFetch();
|
|
|
314
314
|
const plan = await authorizedFetch('/api/plan/mine').then(r => r.json());
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
+
It sends the session only to `apiHost` and the origins in `transport.trustedOrigins`. Any other
|
|
318
|
+
origin rejects with `UntrustedOriginError` and nothing is sent. If your API is served from another
|
|
319
|
+
origin of your own, list it:
|
|
320
|
+
|
|
321
|
+
```tsx
|
|
322
|
+
<AuthProvider
|
|
323
|
+
apiHost="https://auth.example.com"
|
|
324
|
+
transport={{ trustedOrigins: ['https://api.example.com'] }}
|
|
325
|
+
>
|
|
326
|
+
```
|
|
327
|
+
|
|
317
328
|
### Scoped roles
|
|
318
329
|
|
|
319
330
|
`hasRole(role)` remains an exact role check. Use `hasScopedRole(role)` for colon-separated scoped
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{createContext as e,useContext as t,useMemo as s,useRef as r,useSyncExternalStore as i,useEffect as o,useState as n}from"react";import{createBrowserOAuthRedirect as a,createBrowserPasskeyPort as c,createAuthSession as u,loadLoginMethods as d,detectPasskeySupport as p}from"@seamless-auth/client";import{jsx as h}from"react/jsx-runtime";const l=e(void 0),g=()=>{const e=t(l);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},k=({children:e,apiHost:t,autoDetectPreviousSignin:n=!0,magicLinkRedirectUri:d,transport:p,ports:g,initialSession:k})=>{const m=s(()=>({passkeys:g?.passkeys??c(),oauthRedirect:g?.oauthRedirect??a()}),[g?.passkeys,g?.oauthRedirect]),{mode:S,basePath:v,tokenStorage:y,fetch:f,trustedOrigins:b}=p??{},P=b?JSON.stringify(b):void 0,R=s(()=>p?{mode:S,basePath:v,tokenStorage:y,fetch:f,trustedOrigins:P?JSON.parse(P):void 0}:void 0,[S,v,y,f,P]),O=r(k),w=s(()=>u({apiHost:t,magicLinkRedirectUri:d,transport:R,passkeys:m.passkeys,detectPreviousSignIn:n,initialSession:O.current}),[t,d,R,m.passkeys,n]),A=i(w.subscribe,w.getState,w.getServerState);o(()=>{w.actions.refreshSession({background:void 0!==O.current})},[w]);const H=s(()=>({...A,...w.actions,apiHost:t,magicLinkRedirectUri:d,client:w.client,ports:m}),[A,w,t,d,m]);return h(l.Provider,{value:H,children:e})},m=()=>g().client,S=()=>{const e=m(),[t,s]=n(null),[r,i]=n(!0);return o(()=>{let t=!0;return d(e).then(e=>{t&&(e&&s(e),i(!1))}),()=>{t=!1}},[e]),{loginMethods:t,loading:r}},v=()=>{const{ports:e}=g(),[t,s]=n(!1),[r,i]=n(!0);return o(()=>{let t=!0;return p(e.passkeys).then(e=>{t&&(s(e),i(!1))}),()=>{t=!1}},[e.passkeys]),{passkeySupported:t,loading:r}};export{k as A,m as a,S as b,v as c,g as u};
|
|
3
|
+
//# sourceMappingURL=shared-DbQnDPUA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-DbQnDPUA.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","trustedOrigins","trustedOriginsKey","JSON","stringify","stableTransport","parse","initialSessionRef","useRef","session","createAuthSession","detectPreviousSignIn","current","state","useSyncExternalStore","subscribe","getState","getServerState","useEffect","actions","refreshSession","background","value","client","_jsx","Provider","useAuthClient","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","loading","setLoading","active","loadLoginMethods","then","methods","usePasskeySupport","passkeySupported","setPasskeySupported","detectPasskeySupport","supported"],"mappings":";sVA4GA,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,KACJA,EAAIC,SACJA,EAAQC,aACRA,EACAC,MAAOC,EAASC,eAChBA,GACEd,GAAa,CAAA,EAEXe,EAAoBD,EAAiBE,KAAKC,UAAUH,QAAkBxB,EACtE4B,EAAkBd,EACtB,IACEJ,EACI,CACES,OACAC,WACAC,eACAC,MAAOC,EACPC,eAAgBC,EACXC,KAAKG,MAAMJ,QACZzB,QAENA,EAEN,CAACmB,EAAMC,EAAUC,EAAcE,EAAWE,IAMtCK,EAAoBC,EAAOlB,GAE3BmB,EAAUlB,EACd,IACEmB,EAAkB,CAChB1B,UACAE,uBACAC,UAAWkB,EACXb,SAAUJ,EAAMI,SAChBmB,qBAAsB1B,EACtBK,eAAgBiB,EAAkBK,UAEtC,CACE5B,EACAE,EACAmB,EACAjB,EAAMI,SACNP,IAOE4B,EAAQC,EACZL,EAAQM,UACRN,EAAQO,SACRP,EAAQQ,gBAcVC,EAAU,KACHT,EAAQU,QAAQC,eAAe,CAClCC,gBAA0C5C,IAA9B8B,EAAkBK,WAE/B,CAACH,IAEJ,MAAMa,EAAQ/B,EACZ,KAAA,IACKsB,KACAJ,EAAQU,QACXnC,UACAE,uBACAqC,OAAQd,EAAQc,OAChBnC,UAEF,CAACyB,EAAOJ,EAASzB,EAASE,EAAsBE,IAGlD,OAAOoC,EAACjD,EAAYkD,SAAQ,CAACH,MAAOA,EAAKvC,SAAGA,KCnPjC2C,EAAgB,IACpBhD,IAAU6C,OCQNI,EAAkB,KAC7B,MAAMC,EAAaF,KACZG,EAAcC,GAAmBC,EAA+B,OAChEC,EAASC,GAAcF,GAAS,GAmBvC,OAjBAb,EAAU,KACR,IAAIgB,GAAS,EAWb,OATKC,EAAiBP,GAAYQ,KAAKC,IAChCH,IAEDG,GACFP,EAAgBO,GAElBJ,GAAW,MAGN,KACLC,GAAS,IAEV,CAACN,IAEG,CAAEC,eAAcG,YCjCZM,EAAoB,KAC/B,MAAMlD,MAAEA,GAAUV,KACX6D,EAAkBC,GAAuBT,GAAS,IAClDC,EAASC,GAAcF,GAAS,GAiBvC,OAfAb,EAAU,KACR,IAAIgB,GAAS,EASb,OAPKO,EAAqBrD,EAAMI,UAAU4C,KAAKM,IACzCR,IACFM,EAAoBE,GACpBT,GAAW,MAIR,KACLC,GAAS,IAEV,CAAC9C,EAAMI,WAEH,CAAE+C,mBAAkBP"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthContextType, AuthPorts, AuthProvider, useAuth } from './AuthProvider';
|
|
2
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';
|
|
3
|
-
import { getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, isUnauthenticated, OAuthErrorCode, PasskeyPolicyErrorCode, SeamlessAuthError, WebAuthnErrorDetail } from '@seamless-auth/client';
|
|
3
|
+
import { getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, isUnauthenticated, OAuthErrorCode, PasskeyPolicyErrorCode, SeamlessAuthError, UntrustedOriginError, WebAuthnErrorDetail } from '@seamless-auth/client';
|
|
4
4
|
import type { SeamlessAuthResult } from '@seamless-auth/client';
|
|
5
5
|
import { encodePrfSalt, extractPasskeyPrfResult, isPasskeyPrfSupported, PasskeyPrfInput, PasskeyPrfResult } from '@seamless-auth/client';
|
|
6
6
|
import { useAuthClient } from './hooks/useAuthClient';
|
|
@@ -10,5 +10,5 @@ import { usePasskeySupport } from './hooks/usePasskeySupport';
|
|
|
10
10
|
import { hasScopedRole, roleGrantsAccess } from '@seamless-auth/client';
|
|
11
11
|
import { Credential, Organization, OrganizationMembership, User } from '@seamless-auth/client';
|
|
12
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, };
|
|
13
|
+
export { AuthProvider, createSeamlessAuthClient, encodePrfSalt, extractPasskeyPrfResult, getOAuthErrorCode, getPasskeyPolicyErrorCode, getWebAuthnErrorDetail, hasNonPasskeyLoginMethod, hasScopedRole, isPasskeyPrfSupported, isUnauthenticated, roleGrantsAccess, SeamlessAuthError, UntrustedOriginError, useAuth, useAuthClient, useAuthorizedFetch, useLoginMethods, usePasskeySupport, };
|
|
14
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,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{u as e}from"./chunks/shared-
|
|
2
|
+
import{u as e}from"./chunks/shared-DbQnDPUA.js";export{A as AuthProvider,a as useAuthClient,b as useLoginMethods,c as usePasskeySupport}from"./chunks/shared-DbQnDPUA.js";export{SeamlessAuthError,UntrustedOriginError,createSeamlessAuthClient,encodePrfSalt,extractPasskeyPrfResult,getOAuthErrorCode,getPasskeyPolicyErrorCode,getWebAuthnErrorDetail,hasNonPasskeyLoginMethod,hasScopedRole,isPasskeyPrfSupported,isUnauthenticated,roleGrantsAccess}from"@seamless-auth/client";import"react";import"react/jsx-runtime";const r=()=>e().client.authorizedFetch;export{e as useAuth,r as useAuthorizedFetch};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/hooks/useAuthorizedFetch.ts"],"sourcesContent":[null],"names":["useAuthorizedFetch","useAuth","client","authorizedFetch"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/hooks/useAuthorizedFetch.ts"],"sourcesContent":[null],"names":["useAuthorizedFetch","useAuth","client","authorizedFetch"],"mappings":";8fAaO,MAAMA,EAAqB,IAAMC,IAAUC,OAAOC"}
|
package/dist/routes.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsxs as e,jsx as r,Fragment as o}from"react/jsx-runtime";import{useHref as a,useNavigate as n,useLocation as i,useSearchParams as s,Routes as t,Route as l,Navigate as c}from"react-router-dom";import{u as d,a as _,c as m,b as u}from"./chunks/shared-Bm18KGK2.js";import{useState as g,useEffect as p,useRef as f}from"react";import{fallbackSignInOptions as h,hasFallbackSignInOption as b,OAUTH_CALLBACK_PATH as v,startOAuthSignIn as y,isValidEmail as k,isValidPhoneNumber as x,beginSignIn as w,PASSKEY_SIGN_IN_FAILED as N,registerWithEmail as P,safeReturnPath as C,hasNonPasskeyLoginMethod as M,enrollPasskey as O,isOtpCharacter as T,otpCharacters as I,OTP_LIFETIME_SECONDS as S,formatCountdown as B,OTP_LENGTH as z,verifyOtp as L,requestOtp as A,otpResendFailedMessage as q,finishMagicLinkSignIn as R,completeOAuthCallback as E,MAGIC_LINK_RESEND_COOLDOWN_SECONDS as j,watchMagicLink as F}from"@seamless-auth/client";const D="/login",G="/passkey-login",V="/verify-phone-otp",K="/verify-email-otp",U="/verify-magiclink",W="/oauth/callback",Y="/register-passkey",J="/magic-link-sent";function H(e,r){void 0===r&&(r={});var o=r.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var Q="login-module__container___YggDx",X="login-module__card___Ub-Py",Z="login-module__heading___neEqb",$="login-module__inputGroup___P6qgS",ee="login-module__label___mx5vu",re="login-module__input___U07lW",oe="login-module__helperText___kDQ4-",ae="login-module__error___40zxh",ne="login-module__button___0kFBs",ie="login-module__submitHint___qOS5Z",se="login-module__toggle___1JiG1",te="login-module__fallbackCard___HdIk-",le="login-module__fallbackHeader___-il2v",ce="login-module__fallbackDescription___ea5EB",de="login-module__fallbackActions___AD3ni",_e="login-module__fallbackActionButton___lFgWf",me="login-module__actionTitle___ycrMp",ue="login-module__actionSubtext___opaIV",ge="login-module__linkButton___5lsoe";H(".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 pe=({identifier:o,onMagicLink:a,onEmailOtp:n,onPhoneOtp:i,onPasskeyRetry:s,loginMethods:t})=>{const l=h(o,t,{emailOtp:Boolean(n),passkeyRetry:Boolean(s)});return b(l)?e("div",{className:te,children:[r("div",{className:le,children:"Choose a sign-in method"}),r("p",{className:ce,children:"Choose another secure sign-in method."}),e("div",{className:de,children:[l.magicLink&&e("button",{type:"button",className:_e,onClick:a,children:[r("span",{className:me,children:"Email Magic Link"}),r("span",{className:ue,children:"Send a secure sign-in link to your email"})]}),l.emailOtp&&e("button",{type:"button",className:_e,onClick:n,children:[r("span",{className:me,children:"Email Code"}),r("span",{className:ue,children:"Receive a one-time code by email"})]}),l.phoneOtp&&e("button",{type:"button",className:_e,onClick:i,children:[r("span",{className:me,children:"Text Message Code"}),r("span",{className:ue,children:"Receive a one-time code via SMS"})]})]}),l.passkeyRetry&&r("button",{type:"button",className:ge,onClick:s,children:"Try passkey anyway"})]}):null},fe=()=>{const{listOAuthProviders:o,startOAuthLogin:n,finishOAuthLogin:i,ports:s}=d(),t=a(v),[l,c]=g([]),[_,m]=g("");if(p(()=>{let e=!0;return o().then(({data:r})=>{e&&c(r?.providers??[])}),()=>{e=!1}},[o]),0===l.length)return null;return e("div",{className:de,children:[l.map(o=>r("button",{type:"button",className:_e,onClick:()=>(async e=>{m("");const r=new URL(t,window.location.origin).toString(),{error:o}=await y({actions:{startOAuthLogin:n,finishOAuthLogin:i},oauthRedirect:s.oauthRedirect},{providerId:e,redirectUri:r});o&&m(o)})(o.id),children:e("span",{className:me,children:["Continue with ",o.name]})},o.id)),_&&r("p",{className:ae,children:_})]})},he=()=>{const a=n(),{hasSignedInBefore:i,login:s,handlePasskeyLogin:t}=d(),l=_(),{passkeySupported:c}=m(),{loginMethods:f}=u(),[h,b]=g(""),[v,y]=g(""),[C,M]=g("register"),[O,T]=g(""),[I,S]=g(""),[B,z]=g(""),[L,A]=g(!1),[q,R]=g(null);p(()=>{i&&M("login")},[i]);const E=()=>"login"===C?k(h)||x(h):k(v);return r("div",{className:Q,children:e("div",{className:X,children:[r("h2",{className:Z,children:"login"===C?"Sign In":"Create Account"}),e(o,{children:[e("form",{onSubmit:async e=>{e.preventDefault(),T(""),A(!1);try{if("login"===C){const e=await w({login:s,handlePasskeyLogin:t},{identifier:h,passkeySupported:c,configuredMethods:f});return"error"===e.kind?void T(e.message):"signed_in"===e.kind?void a("/"):(R(e.loginMethods),A(!0),void(e.passkeyFailed&&T(N)))}"register"===C&&await(async()=>{T("");const{error:e}=await P(l,v);e?T(e):a(K)})()}catch{console.error("Failed to continue sign-in."),T("Failed to continue sign-in. Please try again.")}},children:["login"===C&&e("div",{className:$,children:[r("label",{htmlFor:"identifier",className:ee,children:"Email Address / Phone Number"}),r("input",{id:"identifier",type:"text",value:h,onChange:e=>{const r=e.target.value;b(r)},autoComplete:"off",placeholder:"Email or Phone Number",className:re,onBlur:()=>{if(h){const e=k(h)||x(h);z(e?"":"Please enter a valid email or phone number")}},required:!0}),r("p",{className:oe,children:"Phone numbers must include a country code e.g. +1"}),L&&r(pe,{identifier:h,onMagicLink:async()=>{const{error:e}=await l.requestMagicLink();e?T("Failed to send magic link."):a(J,{state:{identifier:h}})},onEmailOtp:async()=>{const{error:e}=await l.requestLoginEmailOtp();e?T("Failed to send email code."):a(K,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await l.requestLoginPhoneOtp();e?T("Failed to send OTP."):a(V,{state:{flow:"login"}})},onPasskeyRetry:c?t:void 0,loginMethods:q}),B&&r("p",{className:ae,children:B})]}),"register"===C&&e("div",{className:$,children:[r("label",{htmlFor:"email",className:ee,children:"Email Address"}),r("input",{id:"email",type:"email",value:v,onChange:e=>{const r=e.target.value;y(r)},autoComplete:"off",className:re,onBlur:()=>{if(v){const e=k(v);S(e?"":"Please enter a valid email")}},required:!0}),I&&r("p",{className:ae,children:I})]}),r("button",{type:"submit",className:ne,disabled:!E(),"aria-describedby":"seamless-submit-hint",children:"login"===C?"Login":"Register"}),r("p",{id:"seamless-submit-hint",role:"status",className:ie,children:"login"===C?h?E()?"Ready to continue.":"This does not look like a complete email or phone number yet.":"Enter your email or phone number to continue.":v?E()?"Ready to continue.":"This does not look like a complete email address yet.":"Enter your email address to continue."}),O&&r("p",{className:ae,children:O}),r("button",{type:"button",onClick:()=>M("login"===C?"register":"login"),className:se,children:"login"===C?"Don't have an account? Create one":"Already have an account? Sign in"})]}),r(fe,{})]})]})})};var be={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};H(".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 ve=()=>{const o=n(),{handlePasskeyLogin:a}=d(),[i,s]=g("");return r("div",{className:be.container,children:e("div",{className:be.card,children:[r("h2",{className:be.title,children:"Login with Passkey"}),r("button",{onClick:async()=>{s("");const{error:e}=await a();e?s("Passkey sign-in could not be completed. Try another sign-in method."):o("/")},className:be.button,children:"Use Passkey"}),i&&r("p",{className:be.error,children:i})]})})};var ye="registerPasskey-module__container___jqEh8",ke="registerPasskey-module__card___MJAyC",xe="registerPasskey-module__loading___Q4i1x",we="registerPasskey-module__spinner___V1nhd",Ne="registerPasskey-module__supported___ihTih",Pe="registerPasskey-module__title___vn2Qu",Ce="registerPasskey-module__description___AWmO-",Me="registerPasskey-module__button___D3b4B",Oe="registerPasskey-module__message___RiOw-",Te="registerPasskey-module__success___HP5aX",Ie="registerPasskey-module__error___hGiqE",Se="registerPasskey-module__skip___1hDyU",Be="registerPasskey-module__secondary___bnOB4";H(".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 ze=()=>{const{refreshSession:o}=d(),a=_(),{passkeySupported:s,loading:t}=m(),{loginMethods:l,loading:c}=u(),p=n(),f=C(i().state?.returnTo),[h,b]=g("idle"),[v,y]=g(""),k=M(l),x=async()=>{await o(),p(f)},w=async e=>{b("loading");const{error:r}=await O({client:a,refreshSession:o},e);if(r)return b("error"),void y(r);b("success"),y("Passkey registered successfully."),p(f)};return r("div",{className:ye,children:r("div",{className:ke,children:e("div",t||c?{className:xe,children:[r("div",{className:we}),r("span",{children:"Checking for Passkey Support..."})]}:s?{className:Ne,children:[r("h2",{className:Pe,children:"Secure Your Account with a Passkey"}),r("p",{className:Ce,children:"Your device supports passkeys! Register one to skip passwords forever."}),r("button",{onClick:()=>w(),disabled:"loading"===h,className:Me,children:"loading"===h?"Registering...":"Register Passkey"}),r("button",{type:"button",onClick:()=>w("cross-platform"),disabled:"loading"===h,className:Be,children:"Use a security key instead"}),v&&r("p",{className:`${Oe} ${"success"===h?Te:Ie}`,children:v}),k&&r("button",{type:"button",onClick:x,disabled:"loading"===h,className:Se,children:"Skip for now"})]}:{className:Ne,children:[r("h2",{className:Pe,children:"Passkeys are not available here"}),r("p",{className:Ce,children:k?"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."}),k&&r("button",{type:"button",onClick:x,className:Me,children:"Continue"})]})})})};var Le="verifyOTP-module__container___wgoDE",Ae="verifyOTP-module__card___3cs2p",qe="verifyOTP-module__title___fZ-1d",Re="verifyOTP-module__subtitle___dGSu3",Ee="verifyOTP-module__error___GEtlG",je="verifyOTP-module__success___46TjG",Fe="verifyOTP-module__form___jiGG-",De="verifyOTP-module__label___Zq5Mi",Ge="verifyOTP-module__timer___smq-a",Ve="verifyOTP-module__resend___PlmkG",Ke="verifyOTP-module__button___8pIuO",Ue="verifyOTP-module__toggle___wbzVa";H(".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 We="otpInput-module__otpContainer___MUjby",Ye="otpInput-module__otpInput___3YMVm";H(".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 Je=({length:e=6,value:o,inputMode:a="numeric",onChange:n,name:i="otp"})=>{const s=f([]),t=o.split("").concat(Array(e).fill("")).slice(0,e),l=(r,o)=>{const i=I(o,a).slice(0,e),l=[...t];i.forEach((o,a)=>{r+a<e&&(l[r+a]=o)}),n(l.join("")),s.current[Math.min(r+i.length,e-1)]?.focus()};return r("div",{className:We,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),l(0,e.clipboardData.getData("text"))},children:t.map((o,c)=>r("input",{ref:e=>s.current[c]=e,type:"text",inputMode:"numeric"===a?"numeric":"text",autoComplete:"one-time-code",name:`${i}-${c}`,maxLength:1,value:o,className:Ye,onChange:e=>((e,r)=>{if(r.length>1)l(e,r);else if(!r||T(r,a)){const o=[...t];o[e]=r;const a=o.join("");n(a),r&&s.current[e+1]&&s.current[e+1]?.focus()}})(c,e.target.value),onKeyDown:r=>((r,o)=>{if("Backspace"===o.key){o.preventDefault();const e=[...t];t[r]?(e[r]="",n(e.join(""))):r>0&&(e[r-1]="",n(e.join("")),s.current[r-1]?.focus())}"ArrowLeft"===o.key&&r>0&&s.current[r-1]?.focus(),"ArrowRight"===o.key&&r<e-1&&s.current[r+1]?.focus()})(c,r),"aria-label":`Digit ${c+1}`},c))})},He=()=>{const o=n(),a=i(),{refreshSession:s}=d(),t="login"===a.state?.flow,[l,c]=g(""),[m,u]=g(null),[f,h]=g(""),[b,v]=g(!1),[y,k]=g(""),[x,w]=g(S),N=_(),P=async()=>{if(m)return;const{next:e,error:r}=await L({client:N,refreshSession:s},{channel:"phone",flow:t?"login":"register",code:l});if(null===r)return"verify_email"===e?(u(!0),void o(K)):void o("/");h(r)},C=async()=>{k(""),await(async()=>{h("");const{error:e}=await A(N,"phone",t?"login":"register");e?h(q("phone")):k("Verification SMS has been resent.")})(),k("Verification SMS has been resent.")};return p(()=>{const e=setInterval(()=>{w(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),r("div",{className:Le,children:e("div",{className:Ae,children:[r("h2",{className:qe,children:"Verify Your Phone Number"}),r("p",{className:Re,children:"Enter the code sent to your phone number."}),f&&r("p",{className:Ee,children:f}),y&&r("p",{className:je,children:y}),e("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),l.length===z){v(!0);try{await P()}catch{h("Unexpected error occurred.")}finally{v(!1)}}else h("Please enter a valid code.")},className:Fe,children:[e("div",{children:[e("label",{htmlFor:"phoneCode",className:De,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:Ge,children:["Code expires in: ",B(x)]})]}),r(Je,{length:6,value:l,onChange:c}),r("button",{type:"button",onClick:()=>C(),className:Ve,children:"Resend code to phone"})]}),r("button",{type:"submit",className:Ke,children:b?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>o("/login"),className:Ue,children:"Back to login"})]})]})});var M},Qe=()=>{const o=n(),a=i(),{refreshSession:s}=d(),t=_(),{passkeySupported:l}=m(),c="login"===a.state?.flow,[u,f]=g(!1),[h,b]=g(""),[v,y]=g(S),[k,x]=g(""),[w,N]=g("");return p(()=>{const e=setInterval(()=>{y(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),r("div",{className:Le,children:e("div",{className:Ae,children:[r("h2",{className:qe,children:"Verify Your Email"}),r("p",{className:Re,children:"We sent you a verification email. Enter the code below."}),k&&r("p",{className:Ee,children:k}),w&&r("p",{className:je,children:w}),e("form",{onSubmit:async e=>{if(e.preventDefault(),x(""),h.length===z){f(!0);try{const{next:e,error:r}=await L({client:t,refreshSession:s},{channel:"email",flow:c?"login":"register",code:h,passkeySupported:l});if(null!==r)return void x(r);o("register_passkey"===e?Y:"/")}catch{console.error("Email OTP verification failed."),x("Verification failed.")}finally{f(!1)}}else x("Please enter a valid code.")},className:Fe,children:[e("div",{children:[e("label",{htmlFor:"emailCode",className:De,children:["Email Verification Code",e("span",{className:Ge,children:[" ","— Code expires in ",B(v)]})]}),r(Je,{length:6,value:h,onChange:b,inputMode:"text"}),r("button",{type:"button",onClick:async()=>{x(""),N("");const{error:e}=await A(t,"email",c?"login":"register");e?x(q("email")):N("Verification email has been resent.")},className:Ve,children:"Resend code to email"})]}),r("button",{type:"submit",className:Ke,disabled:u,children:u?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>o("/login"),className:Ue,children:"Back to login"})]})]})})};var Xe={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"};H(".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 Ze=()=>{const[o]=s(),a=n(),i=o.get("token"),[t,l]=g(""),[c,m]=g(null),u=_(),{refreshSession:h}=d(),b=f(null);return p(()=>{let e=!0,r=null;return(async()=>{if(!i)return e&&l("Missing token for verification."),void console.error("No magic-link token found.");b.current?.token!==i&&(b.current={token:i,result:u.verifyMagicLink(i)});const{error:o}=await b.current.result;if(!e)return;if(o)return console.error("Failed to verify token"),void l("Failed to verify token");const n=await R({client:u,refreshSession:h});e&&(m(n),"elsewhere"!==n&&(r=setTimeout(()=>{e&&a("/")},900)))})(),()=>{e=!1,r&&clearTimeout(r)}},[i,u,a,h]),r("div",{className:Xe.container,children:e("div",{className:Xe.card,children:[r("h1",{className:Xe.title,children:"Verifying your login"}),e("div",{className:Xe.verificationContent,children:[!c&&!t&&r("div",{className:Xe.spinner}),c&&r("div",{className:Xe.successIcon,children:r("svg",{viewBox:"0 0 24 24",className:Xe.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:r("path",{d:"M5 13l4 4L19 7"})})}),!c&&!t&&r("p",{className:Xe.helperText,children:"Please wait while we securely verify your sign-in link."}),"signed-in"===c&&r("p",{className:Xe.successText,children:"Login verified. Redirecting…"}),"elsewhere"===c&&r("p",{className:Xe.successText,children:"Login verified. Return to the device where you requested this link to continue."}),t&&r("p",{className:Xe.error,children:t})]})]})})},$e=()=>{const{finishOAuthLogin:a}=d(),i=n(),[t]=s(),[l,c]=g(""),_=f(!1);return p(()=>{_.current||(_.current=!0,E({finishOAuthLogin:a},t,window.location.origin).then(e=>{"error"!==e.kind?"enroll_passkey"!==e.kind?i(e.destination):i(Y,{state:{returnTo:e.returnTo}}):c(e.message)}))},[a,i,t]),e("div",{className:Xe.container,children:[r("h2",{className:Xe.title,children:l?"Sign-in failed":"Completing sign-in..."}),l&&e(o,{children:[r("p",{children:l}),r("button",{type:"button",onClick:()=>i("/login"),children:"Back to login"})]})]})};var er="magiclink-module__container___45zcA",rr="magiclink-module__card___Au9oN",or="magiclink-module__iconWrapper___k5ndr",ar="magiclink-module__mailIcon___Pwb7q",nr="magiclink-module__iconRing___bdLvf",ir="magiclink-module__heading___b9cre",sr="magiclink-module__message___kiVFj",tr="magiclink-module__identifier___JtcFM",lr="magiclink-module__helperText___7Mlfh",cr="magiclink-module__actions___64I-3",dr="magiclink-module__secondaryButton___BntAI",_r="magiclink-module__cooldown___Ib4rm",mr="magiclink-module__linkButton___maJiv";H(".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 ur=()=>{const{refreshSession:o}=d(),a=n(),s=i(),t=_(),l=s.state?.identifier,[c,m]=g(j);p(()=>{const e=setInterval(()=>{m(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);return p(()=>F({client:t,refreshSession:o,onSignedIn:()=>a("/")}),[t,a,o]),r("div",{className:er,children:e("div",{className:rr,children:[e("div",{className:or,children:[r("div",{className:nr}),e("svg",{className:ar,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:ir,children:"Check your email"}),r("p",{className:sr,children:"If an account exists for this address, we sent a secure sign-in link."}),l&&r("div",{className:tr,children:l}),r("p",{className:lr,children:"Open the email and click the link to finish signing in."}),r("p",{className:lr,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),e("div",{className:cr,children:[r("button",{className:dr,disabled:c>0,onClick:async()=>{c>0||(await t.requestMagicLink(),m(j))},children:"Resend link"}),c>0&&e("div",{className:_r,children:["Available in ",c,"s"]}),r("button",{className:mr,onClick:()=>a("/login"),children:"Change email or phone"})]})]})})},gr=()=>e(t,{children:[r(l,{path:D,element:r(he,{})}),r(l,{path:G,element:r(ve,{})}),r(l,{path:V,element:r(He,{})}),r(l,{path:K,element:r(Qe,{})}),r(l,{path:U,element:r(Ze,{})}),r(l,{path:W,element:r($e,{})}),r(l,{path:Y,element:r(ze,{})}),r(l,{path:J,element:r(ur,{})}),r(l,{path:"*",element:r(c,{to:D,replace:!0})})]});export{gr as AuthRoutes};
|
|
2
|
+
import{jsxs as e,jsx as r,Fragment as o}from"react/jsx-runtime";import{useHref as a,useNavigate as n,useLocation as i,useSearchParams as s,Routes as t,Route as l,Navigate as c}from"react-router-dom";import{u as d,a as _,c as m,b as u}from"./chunks/shared-DbQnDPUA.js";import{useState as g,useEffect as p,useRef as f}from"react";import{fallbackSignInOptions as h,hasFallbackSignInOption as b,OAUTH_CALLBACK_PATH as v,startOAuthSignIn as y,isValidEmail as k,isValidPhoneNumber as x,beginSignIn as w,PASSKEY_SIGN_IN_FAILED as N,registerWithEmail as P,safeReturnPath as C,hasNonPasskeyLoginMethod as M,enrollPasskey as O,isOtpCharacter as T,otpCharacters as I,OTP_LIFETIME_SECONDS as S,formatCountdown as B,OTP_LENGTH as z,verifyOtp as L,requestOtp as A,otpResendFailedMessage as q,finishMagicLinkSignIn as R,completeOAuthCallback as E,MAGIC_LINK_RESEND_COOLDOWN_SECONDS as j,watchMagicLink as F}from"@seamless-auth/client";const D="/login",G="/passkey-login",V="/verify-phone-otp",K="/verify-email-otp",U="/verify-magiclink",W="/oauth/callback",Y="/register-passkey",J="/magic-link-sent";function H(e,r){void 0===r&&(r={});var o=r.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var Q="login-module__container___YggDx",X="login-module__card___Ub-Py",Z="login-module__heading___neEqb",$="login-module__inputGroup___P6qgS",ee="login-module__label___mx5vu",re="login-module__input___U07lW",oe="login-module__helperText___kDQ4-",ae="login-module__error___40zxh",ne="login-module__button___0kFBs",ie="login-module__submitHint___qOS5Z",se="login-module__toggle___1JiG1",te="login-module__fallbackCard___HdIk-",le="login-module__fallbackHeader___-il2v",ce="login-module__fallbackDescription___ea5EB",de="login-module__fallbackActions___AD3ni",_e="login-module__fallbackActionButton___lFgWf",me="login-module__actionTitle___ycrMp",ue="login-module__actionSubtext___opaIV",ge="login-module__linkButton___5lsoe";H(".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 pe=({identifier:o,onMagicLink:a,onEmailOtp:n,onPhoneOtp:i,onPasskeyRetry:s,loginMethods:t})=>{const l=h(o,t,{emailOtp:Boolean(n),passkeyRetry:Boolean(s)});return b(l)?e("div",{className:te,children:[r("div",{className:le,children:"Choose a sign-in method"}),r("p",{className:ce,children:"Choose another secure sign-in method."}),e("div",{className:de,children:[l.magicLink&&e("button",{type:"button",className:_e,onClick:a,children:[r("span",{className:me,children:"Email Magic Link"}),r("span",{className:ue,children:"Send a secure sign-in link to your email"})]}),l.emailOtp&&e("button",{type:"button",className:_e,onClick:n,children:[r("span",{className:me,children:"Email Code"}),r("span",{className:ue,children:"Receive a one-time code by email"})]}),l.phoneOtp&&e("button",{type:"button",className:_e,onClick:i,children:[r("span",{className:me,children:"Text Message Code"}),r("span",{className:ue,children:"Receive a one-time code via SMS"})]})]}),l.passkeyRetry&&r("button",{type:"button",className:ge,onClick:s,children:"Try passkey anyway"})]}):null},fe=()=>{const{listOAuthProviders:o,startOAuthLogin:n,finishOAuthLogin:i,ports:s}=d(),t=a(v),[l,c]=g([]),[_,m]=g("");if(p(()=>{let e=!0;return o().then(({data:r})=>{e&&c(r?.providers??[])}),()=>{e=!1}},[o]),0===l.length)return null;return e("div",{className:de,children:[l.map(o=>r("button",{type:"button",className:_e,onClick:()=>(async e=>{m("");const r=new URL(t,window.location.origin).toString(),{error:o}=await y({actions:{startOAuthLogin:n,finishOAuthLogin:i},oauthRedirect:s.oauthRedirect},{providerId:e,redirectUri:r});o&&m(o)})(o.id),children:e("span",{className:me,children:["Continue with ",o.name]})},o.id)),_&&r("p",{className:ae,children:_})]})},he=()=>{const a=n(),{hasSignedInBefore:i,login:s,handlePasskeyLogin:t}=d(),l=_(),{passkeySupported:c}=m(),{loginMethods:f}=u(),[h,b]=g(""),[v,y]=g(""),[C,M]=g("register"),[O,T]=g(""),[I,S]=g(""),[B,z]=g(""),[L,A]=g(!1),[q,R]=g(null);p(()=>{i&&M("login")},[i]);const E=()=>"login"===C?k(h)||x(h):k(v);return r("div",{className:Q,children:e("div",{className:X,children:[r("h2",{className:Z,children:"login"===C?"Sign In":"Create Account"}),e(o,{children:[e("form",{onSubmit:async e=>{e.preventDefault(),T(""),A(!1);try{if("login"===C){const e=await w({login:s,handlePasskeyLogin:t},{identifier:h,passkeySupported:c,configuredMethods:f});return"error"===e.kind?void T(e.message):"signed_in"===e.kind?void a("/"):(R(e.loginMethods),A(!0),void(e.passkeyFailed&&T(N)))}"register"===C&&await(async()=>{T("");const{error:e}=await P(l,v);e?T(e):a(K)})()}catch{console.error("Failed to continue sign-in."),T("Failed to continue sign-in. Please try again.")}},children:["login"===C&&e("div",{className:$,children:[r("label",{htmlFor:"identifier",className:ee,children:"Email Address / Phone Number"}),r("input",{id:"identifier",type:"text",value:h,onChange:e=>{const r=e.target.value;b(r)},autoComplete:"off",placeholder:"Email or Phone Number",className:re,onBlur:()=>{if(h){const e=k(h)||x(h);z(e?"":"Please enter a valid email or phone number")}},required:!0}),r("p",{className:oe,children:"Phone numbers must include a country code e.g. +1"}),L&&r(pe,{identifier:h,onMagicLink:async()=>{const{error:e}=await l.requestMagicLink();e?T("Failed to send magic link."):a(J,{state:{identifier:h}})},onEmailOtp:async()=>{const{error:e}=await l.requestLoginEmailOtp();e?T("Failed to send email code."):a(K,{state:{flow:"login"}})},onPhoneOtp:async()=>{const{error:e}=await l.requestLoginPhoneOtp();e?T("Failed to send OTP."):a(V,{state:{flow:"login"}})},onPasskeyRetry:c?t:void 0,loginMethods:q}),B&&r("p",{className:ae,children:B})]}),"register"===C&&e("div",{className:$,children:[r("label",{htmlFor:"email",className:ee,children:"Email Address"}),r("input",{id:"email",type:"email",value:v,onChange:e=>{const r=e.target.value;y(r)},autoComplete:"off",className:re,onBlur:()=>{if(v){const e=k(v);S(e?"":"Please enter a valid email")}},required:!0}),I&&r("p",{className:ae,children:I})]}),r("button",{type:"submit",className:ne,disabled:!E(),"aria-describedby":"seamless-submit-hint",children:"login"===C?"Login":"Register"}),r("p",{id:"seamless-submit-hint",role:"status",className:ie,children:"login"===C?h?E()?"Ready to continue.":"This does not look like a complete email or phone number yet.":"Enter your email or phone number to continue.":v?E()?"Ready to continue.":"This does not look like a complete email address yet.":"Enter your email address to continue."}),O&&r("p",{className:ae,children:O}),r("button",{type:"button",onClick:()=>M("login"===C?"register":"login"),className:se,children:"login"===C?"Don't have an account? Create one":"Already have an account? Sign in"})]}),r(fe,{})]})]})})};var be={container:"passKeyLogin-module__container___IUKxF",card:"passKeyLogin-module__card___2sKM1",title:"passKeyLogin-module__title___HZxvc",button:"passKeyLogin-module__button___FvR4I"};H(".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 ve=()=>{const o=n(),{handlePasskeyLogin:a}=d(),[i,s]=g("");return r("div",{className:be.container,children:e("div",{className:be.card,children:[r("h2",{className:be.title,children:"Login with Passkey"}),r("button",{onClick:async()=>{s("");const{error:e}=await a();e?s("Passkey sign-in could not be completed. Try another sign-in method."):o("/")},className:be.button,children:"Use Passkey"}),i&&r("p",{className:be.error,children:i})]})})};var ye="registerPasskey-module__container___jqEh8",ke="registerPasskey-module__card___MJAyC",xe="registerPasskey-module__loading___Q4i1x",we="registerPasskey-module__spinner___V1nhd",Ne="registerPasskey-module__supported___ihTih",Pe="registerPasskey-module__title___vn2Qu",Ce="registerPasskey-module__description___AWmO-",Me="registerPasskey-module__button___D3b4B",Oe="registerPasskey-module__message___RiOw-",Te="registerPasskey-module__success___HP5aX",Ie="registerPasskey-module__error___hGiqE",Se="registerPasskey-module__skip___1hDyU",Be="registerPasskey-module__secondary___bnOB4";H(".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 ze=()=>{const{refreshSession:o}=d(),a=_(),{passkeySupported:s,loading:t}=m(),{loginMethods:l,loading:c}=u(),p=n(),f=C(i().state?.returnTo),[h,b]=g("idle"),[v,y]=g(""),k=M(l),x=async()=>{await o(),p(f)},w=async e=>{b("loading");const{error:r}=await O({client:a,refreshSession:o},e);if(r)return b("error"),void y(r);b("success"),y("Passkey registered successfully."),p(f)};return r("div",{className:ye,children:r("div",{className:ke,children:e("div",t||c?{className:xe,children:[r("div",{className:we}),r("span",{children:"Checking for Passkey Support..."})]}:s?{className:Ne,children:[r("h2",{className:Pe,children:"Secure Your Account with a Passkey"}),r("p",{className:Ce,children:"Your device supports passkeys! Register one to skip passwords forever."}),r("button",{onClick:()=>w(),disabled:"loading"===h,className:Me,children:"loading"===h?"Registering...":"Register Passkey"}),r("button",{type:"button",onClick:()=>w("cross-platform"),disabled:"loading"===h,className:Be,children:"Use a security key instead"}),v&&r("p",{className:`${Oe} ${"success"===h?Te:Ie}`,children:v}),k&&r("button",{type:"button",onClick:x,disabled:"loading"===h,className:Se,children:"Skip for now"})]}:{className:Ne,children:[r("h2",{className:Pe,children:"Passkeys are not available here"}),r("p",{className:Ce,children:k?"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."}),k&&r("button",{type:"button",onClick:x,className:Me,children:"Continue"})]})})})};var Le="verifyOTP-module__container___wgoDE",Ae="verifyOTP-module__card___3cs2p",qe="verifyOTP-module__title___fZ-1d",Re="verifyOTP-module__subtitle___dGSu3",Ee="verifyOTP-module__error___GEtlG",je="verifyOTP-module__success___46TjG",Fe="verifyOTP-module__form___jiGG-",De="verifyOTP-module__label___Zq5Mi",Ge="verifyOTP-module__timer___smq-a",Ve="verifyOTP-module__resend___PlmkG",Ke="verifyOTP-module__button___8pIuO",Ue="verifyOTP-module__toggle___wbzVa";H(".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 We="otpInput-module__otpContainer___MUjby",Ye="otpInput-module__otpInput___3YMVm";H(".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 Je=({length:e=6,value:o,inputMode:a="numeric",onChange:n,name:i="otp"})=>{const s=f([]),t=o.split("").concat(Array(e).fill("")).slice(0,e),l=(r,o)=>{const i=I(o,a).slice(0,e),l=[...t];i.forEach((o,a)=>{r+a<e&&(l[r+a]=o)}),n(l.join("")),s.current[Math.min(r+i.length,e-1)]?.focus()};return r("div",{className:We,role:"group","aria-label":"One-time password input",onPaste:e=>{e.preventDefault(),l(0,e.clipboardData.getData("text"))},children:t.map((o,c)=>r("input",{ref:e=>s.current[c]=e,type:"text",inputMode:"numeric"===a?"numeric":"text",autoComplete:"one-time-code",name:`${i}-${c}`,maxLength:1,value:o,className:Ye,onChange:e=>((e,r)=>{if(r.length>1)l(e,r);else if(!r||T(r,a)){const o=[...t];o[e]=r;const a=o.join("");n(a),r&&s.current[e+1]&&s.current[e+1]?.focus()}})(c,e.target.value),onKeyDown:r=>((r,o)=>{if("Backspace"===o.key){o.preventDefault();const e=[...t];t[r]?(e[r]="",n(e.join(""))):r>0&&(e[r-1]="",n(e.join("")),s.current[r-1]?.focus())}"ArrowLeft"===o.key&&r>0&&s.current[r-1]?.focus(),"ArrowRight"===o.key&&r<e-1&&s.current[r+1]?.focus()})(c,r),"aria-label":`Digit ${c+1}`},c))})},He=()=>{const o=n(),a=i(),{refreshSession:s}=d(),t="login"===a.state?.flow,[l,c]=g(""),[m,u]=g(null),[f,h]=g(""),[b,v]=g(!1),[y,k]=g(""),[x,w]=g(S),N=_(),P=async()=>{if(m)return;const{next:e,error:r}=await L({client:N,refreshSession:s},{channel:"phone",flow:t?"login":"register",code:l});if(null===r)return"verify_email"===e?(u(!0),void o(K)):void o("/");h(r)},C=async()=>{k(""),await(async()=>{h("");const{error:e}=await A(N,"phone",t?"login":"register");e?h(q("phone")):k("Verification SMS has been resent.")})(),k("Verification SMS has been resent.")};return p(()=>{const e=setInterval(()=>{w(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),r("div",{className:Le,children:e("div",{className:Ae,children:[r("h2",{className:qe,children:"Verify Your Phone Number"}),r("p",{className:Re,children:"Enter the code sent to your phone number."}),f&&r("p",{className:Ee,children:f}),y&&r("p",{className:je,children:y}),e("form",{onSubmit:async e=>{if(e.preventDefault(),h(""),l.length===z){v(!0);try{await P()}catch{h("Unexpected error occurred.")}finally{v(!1)}}else h("Please enter a valid code.")},className:Fe,children:[e("div",{children:[e("label",{htmlFor:"phoneCode",className:De,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:Ge,children:["Code expires in: ",B(x)]})]}),r(Je,{length:6,value:l,onChange:c}),r("button",{type:"button",onClick:()=>C(),className:Ve,children:"Resend code to phone"})]}),r("button",{type:"submit",className:Ke,children:b?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>o("/login"),className:Ue,children:"Back to login"})]})]})});var M},Qe=()=>{const o=n(),a=i(),{refreshSession:s}=d(),t=_(),{passkeySupported:l}=m(),c="login"===a.state?.flow,[u,f]=g(!1),[h,b]=g(""),[v,y]=g(S),[k,x]=g(""),[w,N]=g("");return p(()=>{const e=setInterval(()=>{y(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),r("div",{className:Le,children:e("div",{className:Ae,children:[r("h2",{className:qe,children:"Verify Your Email"}),r("p",{className:Re,children:"We sent you a verification email. Enter the code below."}),k&&r("p",{className:Ee,children:k}),w&&r("p",{className:je,children:w}),e("form",{onSubmit:async e=>{if(e.preventDefault(),x(""),h.length===z){f(!0);try{const{next:e,error:r}=await L({client:t,refreshSession:s},{channel:"email",flow:c?"login":"register",code:h,passkeySupported:l});if(null!==r)return void x(r);o("register_passkey"===e?Y:"/")}catch{console.error("Email OTP verification failed."),x("Verification failed.")}finally{f(!1)}}else x("Please enter a valid code.")},className:Fe,children:[e("div",{children:[e("label",{htmlFor:"emailCode",className:De,children:["Email Verification Code",e("span",{className:Ge,children:[" ","— Code expires in ",B(v)]})]}),r(Je,{length:6,value:h,onChange:b,inputMode:"text"}),r("button",{type:"button",onClick:async()=>{x(""),N("");const{error:e}=await A(t,"email",c?"login":"register");e?x(q("email")):N("Verification email has been resent.")},className:Ve,children:"Resend code to email"})]}),r("button",{type:"submit",className:Ke,disabled:u,children:u?"Verifying...":"Verify & Continue"}),r("button",{type:"button",onClick:()=>o("/login"),className:Ue,children:"Back to login"})]})]})})};var Xe={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"};H(".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 Ze=()=>{const[o]=s(),a=n(),i=o.get("token"),[t,l]=g(""),[c,m]=g(null),u=_(),{refreshSession:h}=d(),b=f(null);return p(()=>{let e=!0,r=null;return(async()=>{if(!i)return e&&l("Missing token for verification."),void console.error("No magic-link token found.");b.current?.token!==i&&(b.current={token:i,result:u.verifyMagicLink(i)});const{error:o}=await b.current.result;if(!e)return;if(o)return console.error("Failed to verify token"),void l("Failed to verify token");const n=await R({client:u,refreshSession:h});e&&(m(n),"elsewhere"!==n&&(r=setTimeout(()=>{e&&a("/")},900)))})(),()=>{e=!1,r&&clearTimeout(r)}},[i,u,a,h]),r("div",{className:Xe.container,children:e("div",{className:Xe.card,children:[r("h1",{className:Xe.title,children:"Verifying your login"}),e("div",{className:Xe.verificationContent,children:[!c&&!t&&r("div",{className:Xe.spinner}),c&&r("div",{className:Xe.successIcon,children:r("svg",{viewBox:"0 0 24 24",className:Xe.checkIcon,fill:"none",stroke:"currentColor",strokeWidth:"2",children:r("path",{d:"M5 13l4 4L19 7"})})}),!c&&!t&&r("p",{className:Xe.helperText,children:"Please wait while we securely verify your sign-in link."}),"signed-in"===c&&r("p",{className:Xe.successText,children:"Login verified. Redirecting…"}),"elsewhere"===c&&r("p",{className:Xe.successText,children:"Login verified. Return to the device where you requested this link to continue."}),t&&r("p",{className:Xe.error,children:t})]})]})})},$e=()=>{const{finishOAuthLogin:a}=d(),i=n(),[t]=s(),[l,c]=g(""),_=f(!1);return p(()=>{_.current||(_.current=!0,E({finishOAuthLogin:a},t,window.location.origin).then(e=>{"error"!==e.kind?"enroll_passkey"!==e.kind?i(e.destination):i(Y,{state:{returnTo:e.returnTo}}):c(e.message)}))},[a,i,t]),e("div",{className:Xe.container,children:[r("h2",{className:Xe.title,children:l?"Sign-in failed":"Completing sign-in..."}),l&&e(o,{children:[r("p",{children:l}),r("button",{type:"button",onClick:()=>i("/login"),children:"Back to login"})]})]})};var er="magiclink-module__container___45zcA",rr="magiclink-module__card___Au9oN",or="magiclink-module__iconWrapper___k5ndr",ar="magiclink-module__mailIcon___Pwb7q",nr="magiclink-module__iconRing___bdLvf",ir="magiclink-module__heading___b9cre",sr="magiclink-module__message___kiVFj",tr="magiclink-module__identifier___JtcFM",lr="magiclink-module__helperText___7Mlfh",cr="magiclink-module__actions___64I-3",dr="magiclink-module__secondaryButton___BntAI",_r="magiclink-module__cooldown___Ib4rm",mr="magiclink-module__linkButton___maJiv";H(".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 ur=()=>{const{refreshSession:o}=d(),a=n(),s=i(),t=_(),l=s.state?.identifier,[c,m]=g(j);p(()=>{const e=setInterval(()=>{m(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]);return p(()=>F({client:t,refreshSession:o,onSignedIn:()=>a("/")}),[t,a,o]),r("div",{className:er,children:e("div",{className:rr,children:[e("div",{className:or,children:[r("div",{className:nr}),e("svg",{className:ar,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:ir,children:"Check your email"}),r("p",{className:sr,children:"If an account exists for this address, we sent a secure sign-in link."}),l&&r("div",{className:tr,children:l}),r("p",{className:lr,children:"Open the email and click the link to finish signing in."}),r("p",{className:lr,children:"Didn’t receive anything? Check your spam folder or try creating a new account."}),e("div",{className:cr,children:[r("button",{className:dr,disabled:c>0,onClick:async()=>{c>0||(await t.requestMagicLink(),m(j))},children:"Resend link"}),c>0&&e("div",{className:_r,children:["Available in ",c,"s"]}),r("button",{className:mr,onClick:()=>a("/login"),children:"Change email or phone"})]})]})})},gr=()=>e(t,{children:[r(l,{path:D,element:r(he,{})}),r(l,{path:G,element:r(ve,{})}),r(l,{path:V,element:r(He,{})}),r(l,{path:K,element:r(Qe,{})}),r(l,{path:U,element:r(Ze,{})}),r(l,{path:W,element:r($e,{})}),r(l,{path:Y,element:r(ze,{})}),r(l,{path:J,element:r(ur,{})}),r(l,{path:"*",element:r(c,{to:D,replace:!0})})]});export{gr as AuthRoutes};
|
|
3
3
|
//# sourceMappingURL=routes.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamless-auth/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A drop-in authentication solution for modern React applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@seamless-auth/client": "^0.
|
|
59
|
+
"@seamless-auth/client": "^0.5.0",
|
|
60
60
|
"@seamless-auth/types": "^0.28.0",
|
|
61
61
|
"@simplewebauthn/browser": "^13.1.0",
|
|
62
62
|
"libphonenumber-js": "^1.12.7"
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import{createContext as e,useContext as t,useMemo as s,useRef as r,useSyncExternalStore as i,useEffect as o,useState as n}from"react";import{createBrowserOAuthRedirect as a,createBrowserPasskeyPort as c,createAuthSession as u,loadLoginMethods as p,detectPasskeySupport as d}from"@seamless-auth/client";import{jsx as h}from"react/jsx-runtime";const l=e(void 0),k=()=>{const e=t(l);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},m=({children:e,apiHost:t,autoDetectPreviousSignin:n=!0,magicLinkRedirectUri:p,transport:d,ports:k,initialSession:m})=>{const g=s(()=>({passkeys:k?.passkeys??c(),oauthRedirect:k?.oauthRedirect??a()}),[k?.passkeys,k?.oauthRedirect]),{mode:S,basePath:v,tokenStorage:y,fetch:b}=d??{},f=s(()=>d?{mode:S,basePath:v,tokenStorage:y,fetch:b}:void 0,[S,v,y,b]),P=r(m),R=s(()=>u({apiHost:t,magicLinkRedirectUri:p,transport:f,passkeys:g.passkeys,detectPreviousSignIn:n,initialSession:P.current}),[t,p,f,g.passkeys,n]),w=i(R.subscribe,R.getState,R.getServerState);o(()=>{R.actions.refreshSession({background:void 0!==P.current})},[R]);const A=s(()=>({...w,...R.actions,apiHost:t,magicLinkRedirectUri:p,client:R.client,ports:g}),[w,R,t,p,g]);return h(l.Provider,{value:A,children:e})},g=()=>k().client,S=()=>{const e=g(),[t,s]=n(null),[r,i]=n(!0);return o(()=>{let t=!0;return p(e).then(e=>{t&&(e&&s(e),i(!1))}),()=>{t=!1}},[e]),{loginMethods:t,loading:r}},v=()=>{const{ports:e}=k(),[t,s]=n(!1),[r,i]=n(!0);return o(()=>{let t=!0;return d(e.passkeys).then(e=>{t&&(s(e),i(!1))}),()=>{t=!1}},[e.passkeys]),{passkeySupported:t,loading:r}};export{m as A,g as a,S as b,v as c,k as u};
|
|
3
|
-
//# sourceMappingURL=shared-Bm18KGK2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared-Bm18KGK2.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","useLoginMethods","authClient","loginMethods","setLoginMethods","useState","loading","setLoading","active","loadLoginMethods","then","methods","usePasskeySupport","passkeySupported","setPasskeySupported","detectPasskeySupport","supported"],"mappings":";sVA4GA,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,OCQNI,EAAkB,KAC7B,MAAMC,EAAaF,KACZG,EAAcC,GAAmBC,EAA+B,OAChEC,EAASC,GAAcF,GAAS,GAmBvC,OAjBAb,EAAU,KACR,IAAIgB,GAAS,EAWb,OATKC,EAAiBP,GAAYQ,KAAKC,IAChCH,IAEDG,GACFP,EAAgBO,GAElBJ,GAAW,MAGN,KACLC,GAAS,IAEV,CAACN,IAEG,CAAEC,eAAcG,YCjCZM,EAAoB,KAC/B,MAAM7C,MAAEA,GAAUV,KACXwD,EAAkBC,GAAuBT,GAAS,IAClDC,EAASC,GAAcF,GAAS,GAiBvC,OAfAb,EAAU,KACR,IAAIgB,GAAS,EASb,OAPKO,EAAqBhD,EAAMI,UAAUuC,KAAKM,IACzCR,IACFM,EAAoBE,GACpBT,GAAW,MAIR,KACLC,GAAS,IAEV,CAACzC,EAAMI,WAEH,CAAE0C,mBAAkBP"}
|