@seamless-auth/react 0.0.4-beta.9 → 0.0.6-beta.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/README.md CHANGED
@@ -1,7 +1,12 @@
1
- [![npm version](https://img.shields.io/npm/v/@seamless-auth/react.svg?label=%40seamless-auth%2Freact)](https://www.npmjs.com/package/@seamless-auth/react)
2
-
3
1
  # Seamless Auth React
4
2
 
3
+ # @seamless-auth/react
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@seamless-auth/react.svg?label=%40seamless-auth%2Freact)](https://www.npmjs.com/package/@seamless-auth/react)
6
+ [![build](https://github.com/fells-code/seamless-auth-react/actions/workflows/release.yml/badge.svg)](https://github.com/fells-code/seamless-auth-react/actions/workflows/release.yml)
7
+ [![coverage](https://img.shields.io/codecov/c/github/fells-code/seamless-auth-react)](https://app.codecov.io/gh/fells-code/seamless-auth-react)
8
+ [![license](https://img.shields.io/github/license/fells-code/seamless-auth-react)](./LICENSE)
9
+
5
10
  A drop-in authentication provider for React applications, designed to handle login, multi-factor authentication, passkeys, and user session validation using your own backend.
6
11
 
7
12
  ## Features
@@ -27,8 +32,8 @@ npm install seamless-auth-react
27
32
  ### 1. Wrap your app with `AuthProvider`
28
33
 
29
34
  ```tsx
30
- import { AuthProvider } from "seamless-auth-react";
31
- import { BrowserRouter } from "react-router-dom";
35
+ import { AuthProvider } from 'seamless-auth-react';
36
+ import { BrowserRouter } from 'react-router-dom';
32
37
 
33
38
  <BrowserRouter>
34
39
  <AuthProvider apiHost="https://your.api/">
@@ -40,7 +45,7 @@ import { BrowserRouter } from "react-router-dom";
40
45
  ### 2. Use `useAuth()` to access auth state
41
46
 
42
47
  ```tsx
43
- import { useAuth } from "seamless-auth-react";
48
+ import { useAuth } from 'seamless-auth-react';
44
49
 
45
50
  const Dashboard = () => {
46
51
  const { user, logout } = useAuth();
@@ -56,8 +61,8 @@ const Dashboard = () => {
56
61
  ### 3. Use `<AuthRoutes />` for handling login/mfa/passkey screens
57
62
 
58
63
  ```tsx
59
- import { Routes, Route } from "react-router-dom";
60
- import { useAuth, AuthRoutes } from "seamless-auth-react";
64
+ import { Routes, Route } from 'react-router-dom';
65
+ import { useAuth, AuthRoutes } from 'seamless-auth-react';
61
66
 
62
67
  const AppRoutes = () => {
63
68
  const { isAuthenticated } = useAuth();
@@ -1,4 +1,5 @@
1
- import React, { ReactNode } from "react";
1
+ import React, { ReactNode } from 'react';
2
+ import { AuthMode } from './fetchWithAuth';
2
3
  interface User {
3
4
  id: string;
4
5
  email: string;
@@ -17,6 +18,9 @@ export interface AuthContextType {
17
18
  hasRole: (role: string) => boolean | undefined;
18
19
  apiHost: string;
19
20
  token: AuthToken | null;
21
+ markSignedIn: () => void;
22
+ hasSignedInBefore: boolean;
23
+ mode: AuthMode;
20
24
  }
21
25
  /**
22
26
  * Returns the current context
@@ -26,6 +30,8 @@ export declare const useAuth: () => AuthContextType;
26
30
  interface AuthProviderProps {
27
31
  children: ReactNode;
28
32
  apiHost: string;
33
+ autoDetectPreviousSignin?: boolean;
34
+ mode?: AuthMode;
29
35
  }
30
36
  export declare const AuthProvider: React.FC<AuthProviderProps>;
31
37
  export {};
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const LoadingSpinner: React.FC;
3
3
  export default LoadingSpinner;
package/dist/Login.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const Login: React.FC;
3
3
  export default Login;
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const MfaLogin: React.FC;
3
3
  export default MfaLogin;
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const PassKeyLogin: React.FC;
3
3
  export default PassKeyLogin;
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const RegisterPasskey: React.FC;
3
3
  export default RegisterPasskey;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  interface TermsModalProps {
3
3
  isOpen: boolean;
4
4
  onClose: () => void;
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const VerifyOTP: React.FC;
3
3
  export default VerifyOTP;
@@ -1,4 +1,4 @@
1
- import { Dispatch, ReactNode, SetStateAction } from "react";
1
+ import { Dispatch, ReactNode, SetStateAction } from 'react';
2
2
  interface InternalAuthContextType {
3
3
  validateToken: () => Promise<void>;
4
4
  setLoading: Dispatch<SetStateAction<boolean>>;
@@ -1 +1,7 @@
1
- export declare const fetchWithAuth: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
1
+ export type AuthMode = 'web' | 'server';
2
+ interface FetchWithAuthOptions {
3
+ authMode: AuthMode;
4
+ authHost?: string;
5
+ }
6
+ export declare const createFetchWithAuth: (opts: FetchWithAuthOptions) => (input: string, init?: RequestInit) => Promise<Response>;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function usePreviousSignIn(storageKey?: string): {
2
+ hasSignedInBefore: boolean;
3
+ markSignedIn: () => void;
4
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import { AuthRoutes } from "AuthRoutes";
2
- import { AuthProvider, useAuth } from "./AuthProvider";
1
+ import { AuthContextType, AuthProvider, useAuth } from '@/AuthProvider';
2
+ import { AuthRoutes } from '@/AuthRoutes';
3
3
  export { AuthProvider, AuthRoutes, useAuth };
4
+ export type { AuthContextType };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as o,Fragment as r}from"react/jsx-runtime";import{createContext as t,useContext as n,useState as i,useEffect as a,useCallback as s,useRef as l}from"react";import{useNavigate as d,Routes as c,Route as _,Navigate as m}from"react-router-dom";import{startAuthentication as u,startRegistration as g,WebAuthnError as h}from"@simplewebauthn/browser";import p,{AsYouType as f,parsePhoneNumberFromString as y}from"libphonenumber-js";const b=t(void 0),v=({value:o,children:r})=>e(b.Provider,{value:o,children:r}),k=()=>{const e=n(b);if(!e)throw new Error("useInternalAuth must be used within InternalAuthProvider");return e},w=e=>{const{authMode:o,authHost:r}=e;return async function(e,t){const n=`${r}${"server"===o?"auth":""}${e.startsWith("/")?e:`/${e}`}`,i={...t,credentials:"include",headers:{"Content-Type":"application/json",...t?.headers}},a=await fetch(n,i);if(a.ok)return a;throw console.warn("Auth fetch failed:",a.status,n),new Error(`Failed to make API call to ${n}`)}},x=()=>e("div",{className:"flex items-center justify-center min-h-screen bg-gray-900",children:e("div",{"data-testid":"loading",className:"w-12 h-12 border-4 border-gray-600 border-t-blue-500 rounded-full animate-spin"})});const P=t(void 0),N=()=>{const e=n(P);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},S=({children:r,apiHost:t,autoDetectPreviousSignin:n=!0,mode:l="web"})=>{const[d,c]=i(null),[_,m]=i(!1),[u,g]=i(!0),[h,p]=i(null),{hasSignedInBefore:f,markSignedIn:y}=function(e="seamlessauth_seen"){const[o,r]=i(!1);return a(()=>{try{"true"===localStorage.getItem(e)&&r(!0)}catch{}},[e]),{hasSignedInBefore:o,markSignedIn:()=>{try{localStorage.setItem(e,"true"),r(!0)}catch{}}}}(),[b]=i(l),k=w({authMode:b,authHost:t}),N=s(async()=>{if(d)try{await k("/logout",{method:"GET"})}catch{console.error("Error during logout")}finally{m(!1),c(null),p(null)}},[k,d]),S=async()=>{try{const e=await k("users/me",{method:"GET"});if(e.ok){const{user:o}=await e.json();c(o),m(!0)}else N()}catch{N()}finally{g(!1)}};return a(()=>{S()},[]),a(()=>{d&&_&&y()},[d,_,y]),u?o("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:[e(x,{}),";"]}):e(P.Provider,{value:{user:d,logout:N,deleteUser:async()=>{try{if((await k("/users/delete",{method:"delete"})).ok)return c(null),m(!1),void p(null);throw new Error("Could not delete user.")}catch(e){throw console.error("Something went wrong deleting user:",e),new Error("Could not delete user.")}},isAuthenticated:_,hasRole:e=>d?.roles?.includes(e),apiHost:t,token:h,markSignedIn:y,hasSignedInBefore:!!n&&f,mode:l},children:e(v,{value:{validateToken:S,setLoading:g},children:r})})};function T(e,o){void 0===o&&(o={});var r=o.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var C="login-module__container___YggDx",O="login-module__card___Ub-Py",L="login-module__heading___neEqb",M="login-module__message___qSejT",I="login-module__inputGroup___P6qgS",E="login-module__label___mx5vu",A="login-module__input___U07lW",j="login-module__helperText___kDQ4-",F="login-module__error___40zxh",V="login-module__button___0kFBs",z="login-module__toggle___1JiG1",B="login-module__underline___gs-RS",G="login-module__phoneRow___oeNtq",$="login-module__select___rRV1O",q="login-module__phoneInput___2MPQC";T(".login-module__container___YggDx{align-items:center;color:#fff;display:flex;justify-content:center}.login-module__card___Ub-Py{background-color:#1f2937;border-radius:.5rem;box-shadow:0 4px 6px rgba(0,0,0,.1);max-width:28rem;padding:2rem;width:100%}.login-module__heading___neEqb{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;text-align:center}.login-module__message___qSejT{color:#68d391;text-align:center}.login-module__inputGroup___P6qgS{margin-bottom:1rem}.login-module__label___mx5vu{color:#d1d5db;display:block}.login-module__input___U07lW{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;margin-top:.25rem;padding:.5rem;width:100%}.login-module__input___U07lW:focus{box-shadow:0 0 0 2px #3b82f6;outline:none}.login-module__helperText___kDQ4-{color:#9ca3af;font-size:.75rem;margin-top:.5rem}.login-module__error___40zxh{color:#f87171;font-size:.875rem}.login-module__button___0kFBs{background-color:#2563eb;border-radius:.375rem;color:#fff;cursor:pointer;margin-top:1rem;padding:.5rem;transition:background-color .3s;width:100%}.login-module__button___0kFBs:hover{background-color:#1d4ed8}.login-module__button___0kFBs:disabled{background-color:#9ca3af;cursor:not-allowed}.login-module__toggle___1JiG1{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}.login-module__underline___gs-RS{text-decoration:underline}.login-module__phoneRow___oeNtq{display:grid;gap:.5rem;grid-template-columns:1fr 3fr;margin-top:.25rem}.login-module__phoneInput___2MPQC,.login-module__select___rRV1O{background-color:#4b5563;border:1px solid #d1d5db;border-radius:.375rem;padding:.5rem;width:100%}@media (max-width:500px){.login-module__phoneRow___oeNtq{grid-template-columns:1fr}}");var R="termsModal-module__overlay___-j6r5",U="termsModal-module__modal___4PxZV",D="termsModal-module__header___B7wxb",J="termsModal-module__title___Sucwt",K="termsModal-module__closeBtn___evIs5",W="termsModal-module__content___5BDhN",H="termsModal-module__link___oPZrU";T(".termsModal-module__overlay___-j6r5{align-items:center;background-color:rgba(0,0,0,.7);display:flex;inset:0;justify-content:center;position:fixed;z-index:999}.termsModal-module__modal___4PxZV{background-color:#1a1a1a;border-radius:8px;box-shadow:0 10px 25px rgba(0,0,0,.4);color:#fff;max-height:80vh;max-width:640px;outline:none;overflow-y:auto;padding:24px;width:100%}.termsModal-module__header___B7wxb{align-items:center;display:flex;justify-content:space-between;margin-bottom:16px}.termsModal-module__title___Sucwt{color:#60a5fa;font-size:1.25rem;font-weight:700}.termsModal-module__closeBtn___evIs5{background:none;border:none;color:#ccc;cursor:pointer;font-size:1.75rem}.termsModal-module__closeBtn___evIs5:hover{color:#fff}.termsModal-module__content___5BDhN{color:#d1d5db;font-size:.9rem;line-height:1.6}.termsModal-module__link___oPZrU{color:#60a5fa;text-decoration:underline}.termsModal-module__link___oPZrU:hover{text-decoration:none}");const Z=({isOpen:r,onClose:t})=>{const n=l(null);return a(()=>{const e=e=>{"Escape"===e.key&&t()};return r&&(document.addEventListener("keydown",e),n.current?.focus()),()=>{document.removeEventListener("keydown",e)}},[r,t]),r?e("div",{className:R,role:"dialog","aria-modal":"true","aria-labelledby":"terms-title",children:o("div",{className:U,tabIndex:-1,ref:n,children:[o("div",{className:D,children:[e("h2",{id:"terms-title",className:J,children:"SMS Terms & Conditions"}),e("button",{onClick:t,className:K,children:"×"})]}),o("div",{className:W,children:[o("p",{children:[e("strong",{children:"Effective Date:"})," June 01, 2025"]}),e("p",{children:"By providing your phone number to SeamlessAuth, a Fells Code LLC product, you agree to receive SMS messages for identity verification, authentication, and account security."}),o("p",{children:[e("strong",{children:"1. Purpose:"})," SMS is used only for account security (OTP, MFA). No marketing messages."]}),o("p",{children:[e("strong",{children:"2. Frequency:"})," Based on login and account activity."]}),o("p",{children:[e("strong",{children:"3. Opt-Out:"})," Contact support@seamlessauth.com to opt out."]}),o("p",{children:[e("strong",{children:"4. Fees:"})," Standard carrier rates may apply."]}),o("p",{children:[e("strong",{children:"5. Supported Carriers:"})," Most major providers supported, delivery not guaranteed."]}),o("p",{children:[e("strong",{children:"6. Privacy:"})," Your phone number is not shared or sold. See our Privacy Policy."]}),o("p",{children:[e("strong",{children:"7. Changes:"})," Terms may be updated with notice on this page."]}),o("p",{children:["Questions? Email us at"," ",e("a",{className:H,href:"mailto:support@seamlessauth.com",children:"support@seamlessauth.com"}),"."]})]})]})}):null},Q=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"}];function Y({phone:r,setPhone:t,phoneError:n,setPhoneError:s}){const[l,d]=i(!1),[c,_]=i(Q[0]);a(()=>{const e=function(){try{const e=Intl.DateTimeFormat().resolvedOptions().locale||"en-US",o=e.split("-")[1]?.toUpperCase()||"US";return Q.find(e=>e.code===o)||Q[0]}catch{return Q[0]}}();_(e)},[]);return o("div",{className:I,children:[e("label",{id:"phone",className:E,children:"Phone Number"}),o("div",{className:G,children:[e("select",{value:c.code,onChange:e=>{const o=Q.find(o=>o.code===e.target.value);if(o){_(o);const e=r.replace(/^\+\d+/,""),n=(new f).input(o.dialCode+e);t(n)}},className:$,children:Q.map(e=>o("option",{value:e.code,children:[e.flag," (",e.dialCode,")"]},e.code))}),e("input",{"aria-labelledby":"phone",type:"tel",value:r,onChange:e=>{const o=e.target.value,r=o.startsWith(c.dialCode)?o:c.dialCode+o,i=(new f).input(r);t(i),n&&s("")},onBlur:()=>{if(r){const e=y(r),o=e?.isValid();s(o?"":"Please enter a valid phone number.")}},autoComplete:"off",placeholder:"(555) 123-4567",className:q})]}),o("p",{className:j,children:["By signing up, you agree to our"," ",e("button",{onClick:()=>d(!0),className:B,children:"SMS Terms & Conditions"}),"."]}),n&&e("p",{className:F,children:n}),e(Z,{isOpen:l,onClose:()=>d(!1)})]})}const X=e=>{if("string"!=typeof e)return!1;const o=e.trim();if(o.length<3||o.length>320)return!1;const r=o.split("@");if(2!==r.length)return!1;const[t,n]=r;return!(!/^[A-Za-z0-9._%+-]+$/.test(t)||t.startsWith(".")||t.endsWith(".")||t.includes(".."))&&!(!/^[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/.test(n)||n.startsWith("-")||n.endsWith("-")||n.startsWith(".")||n.endsWith(".")||n.includes(".."))},ee=e=>{const o=p(e);return o?.isValid()||!1};async function oe(){if(window.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable)try{return await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch(e){return console.error("Error checking passkey support:",e),!1}return!1}const re=()=>{const t=d(),{apiHost:n,hasSignedInBefore:s,mode:l}=N(),{validateToken:c}=k(),[_,m]=i(""),[g,h]=i(""),[p,f]=i("register"),[y,b]=i(""),[v,x]=i(""),[P,S]=i(""),[T,B]=i(""),[G,$]=i(""),[q,R]=i(!1),U=w({authMode:l,authHost:n});a(()=>{!async function(){const e=await oe();R(e)}(),s&&f("login")},[s]);const D=async()=>{x("");try{if(!(await U("/login",{method:"POST",body:JSON.stringify({identifier:_,passkeyAvailable:q})})).ok)return void x("Failed to send login link. Please try again.");await(async()=>{try{const e=await U("/webAuthn/login/start",{method:"POST"});if(!e.ok)return void console.error("Something went wrong getting webauthn options");const o=await e.json(),r=await u({optionsJSON:o}),n=await U("/webAuthn/login/finish",{method:"POST",body:JSON.stringify({assertionResponse:r})});n.ok||console.error("Failed to verify passkey");const i=await n.json();if("Success"===i.message)return i.mfaLogin?void t("/mfaLogin"):(console.log("Verified...",JSON.stringify(n)),await c(),void t("/"));console.error("Passkey login failed:",i.message)}catch(e){console.error("Passkey login error:",e)}})()}catch(e){console.error("Unexpected login error",e),x("An unexpected error occured. Try again. If the problem persists, try resetting your password")}};return e("div",{className:C,children:o("div",{className:O,children:[e("h2",{className:L,children:"login"===p?"Sign In":"Create Account"}),q?e(r,{children:o("form",{onSubmit:async e=>{e.preventDefault(),"login"===p&&D(),"register"===p&&(async()=>{x("");try{const e=await U("/registration/register",{method:"POST",body:JSON.stringify({email:g,phone:y})});if(!e.ok)return void x("Failed to register. Please try again.");"Success"===(await e.json()).message&&t("/verifyOTP"),x("An unexpected error occured. Try again. If the problem persists, try resetting your password")}catch(e){console.error("Unexpected login error",e),x("An unexpected error occured. Try again. If the problem persists, try resetting your password")}})()},children:["login"===p&&o("div",{className:I,children:[e("label",{htmlFor:"identifier",className:E,children:"Email Address / Phone Number"}),e("input",{id:"identifier",type:"text",value:_,onChange:e=>{const o=e.target.value;m(o)},autoComplete:"off",placeholder:"Email or Phone Number",className:A,onBlur:()=>{if(_){const e=X(_)||ee(_);$(e?"":"Please enter a valid email or phone number")}},required:!0}),e("p",{className:j,children:"Phone numbers must include a country code e.g. +1"}),G&&e("p",{className:F,children:G})]}),"register"===p&&o(r,{children:[o("div",{className:I,children:[e("label",{htmlFor:"email",className:E,children:"Email Address"}),e("input",{id:"email",type:"email",value:g,onChange:e=>{const o=e.target.value;h(o)},autoComplete:"off",className:A,onBlur:()=>{if(g){const e=X(g);B(e?"":"Please enter a valid email")}},required:!0}),T&&e("p",{className:F,children:T})]}),e(Y,{phone:y,setPhone:b,phoneError:P,setPhoneError:S})]}),e("button",{type:"submit",className:V,disabled:!("login"===p&&_?X(_)||ee(_):X(g)&&ee(y)),children:"login"===p?"Login":"Register"}),v&&e("p",{className:F,children:v}),e("button",{type:"button",onClick:()=>f("login"===p?"register":"login"),className:z,children:"login"===p?"Don't have an account? Create one":"Already have an account? Sign in"})]})}):e("p",{className:M,children:"❌ This device doesn't support passkey login. You must provide or register a passkey."})]})})};var te="mfaLogin-module__container___CDMP9",ne="mfaLogin-module__card___kWS58",ie="mfaLogin-module__title___dZABE",ae="mfaLogin-module__msg___2lh2D",se="mfaLogin-module__buttonGroup___3Corm",le="mfaLogin-module__button___4X2WF",de="mfaLogin-module__selected___lkiW-",ce="mfaLogin-module__codeLabel___iC4bk",_e="mfaLogin-module__countdown___rgtkd",me="mfaLogin-module__input___JP-RF",ue="mfaLogin-module__submit___n4-FT",ge="mfaLogin-module__error___SqfpH";T(".mfaLogin-module__container___CDMP9{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.mfaLogin-module__card___kWS58{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:1.5rem;width:100%}.mfaLogin-module__title___dZABE{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.mfaLogin-module__msg___2lh2D{color:#4ade80;text-align:center}.mfaLogin-module__buttonGroup___3Corm{display:flex;flex-direction:column;gap:1rem}.mfaLogin-module__button___4X2WF{background-color:#374151;border:1px solid #4b5563;border-radius:.5rem;color:#fff;font-weight:500;padding:.75rem 1rem;text-align:left;transition:background-color .2s}.mfaLogin-module__button___4X2WF:hover{background-color:#4b5563}.mfaLogin-module__selected___lkiW-{background-color:#2563eb;border-color:#3b82f6}.mfaLogin-module__codeLabel___iC4bk{display:block;font-size:.875rem;font-weight:500;margin-bottom:.25rem}.mfaLogin-module__countdown___rgtkd{color:#facc15;font-size:.875rem}.mfaLogin-module__input___JP-RF{background-color:#374151;border:1px solid #4b5563;border-radius:.5rem;color:#fff;font-family:monospace;font-size:1.25rem;letter-spacing:.2em;padding:.75rem 1rem;width:100%}.mfaLogin-module__input___JP-RF:focus{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f6;outline:none}.mfaLogin-module__submit___n4-FT{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s}.mfaLogin-module__submit___n4-FT:disabled{background-color:#9ca3af;cursor:not-allowed}.mfaLogin-module__error___SqfpH{color:#f87171;margin-bottom:.5rem;text-align:center}@media (max-width:480px){.mfaLogin-module__card___kWS58{padding:1rem}.mfaLogin-module__input___JP-RF,.mfaLogin-module__submit___n4-FT{font-size:1rem}}");const he=()=>{const{apiHost:t,mode:n}=N(),{validateToken:s}=k(),l=d(),[c,_]=i(""),[m,u]=i(""),[g,h]=i(!1),[p,f]=i(""),[y,b]=i(300),[v,x]=i(null),P=w({authMode:n,authHost:t}),S=async()=>{const e="phone"===v?"otp/verify-login-phone-otp":"otp/verify-login-email-otp";try{if(!(await P(`/${e}`,{method:"POST",body:JSON.stringify({verificationToken:c})})).ok)return void u("Verification failed.");await s(),l("/")}catch(e){console.error("Error verifying OTP",e),u("Verification failed.")}},T=async e=>{u("");const o="phone"===e?"otp/generate-login-phone-otp":"otp/generate-login-email-otp";try{(await P(`/${o}`,{method:"GET"})).ok?f(`Verification ${"phone"===e?"SMS":"email"} has been sent.`):u(`Failed to send ${e} code. If this persists, refresh the page and try again.`)}catch{u(`Failed to send ${e} code. If this persists, refresh the page and try again.`)}};return a(()=>{const e=setInterval(()=>{b(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),e("div",{className:te,children:o("div",{className:ne,children:[e("h2",{className:ie,children:"Multi-factor Authentication"}),p&&e("p",{className:ae,children:p}),o("div",{className:se,children:[o("button",{onClick:()=>{x("phone"),T("phone")},className:`${le} ${"phone"===v?de:""}`,children:["Send code to phone: ",e("span",{className:"font-mono",children:"****1234"})]}),o("button",{onClick:()=>{x("email"),T("email")},className:`${le} ${"email"===v?de:""}`,children:["Send code to email: ",e("span",{className:"font-mono",children:"j***@example.com"})]})]}),v&&o(r,{children:[m&&e("p",{className:ge,children:m}),o("label",{htmlFor:"otp",className:ce,children:["Enter the 6-digit code sent to your ",v,". ",e("br",{}),o("span",{className:_e,children:["Code expires in: ",(C=y,`${Math.floor(C/60).toString().padStart(2,"0")}:${(C%60).toString().padStart(2,"0")}`)]})]}),e("input",{id:"otp",type:"text",maxLength:6,className:me,placeholder:"••••••",onChange:e=>_(e.target.value)}),e("button",{onClick:async e=>{e.preventDefault(),u(""),h(!0);try{await S()}catch{u("Unexpected error occurred.")}finally{h(!1)}},className:ue,disabled:!c||c.length<6||g,children:g?"Verifying...":"Verify"})]})]})});var C};var pe="passKeyLogin-module__container___IUKxF",fe="passKeyLogin-module__card___2sKM1",ye="passKeyLogin-module__title___HZxvc",be="passKeyLogin-module__button___FvR4I";T(".passKeyLogin-module__container___IUKxF{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.passKeyLogin-module__card___2sKM1{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);display:flex;flex-direction:column;gap:1.5rem;max-width:400px;padding:2rem;width:100%}.passKeyLogin-module__title___HZxvc{color:#fff;font-size:1.5rem;font-weight:600;text-align:center}.passKeyLogin-module__button___FvR4I{background-color:#2563eb;border:1px solid #3b82f6;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;text-align:center;transition:background-color .2s ease;width:100%}.passKeyLogin-module__button___FvR4I:hover{background-color:#1d4ed8}@media (max-width:480px){.passKeyLogin-module__card___2sKM1{padding:1.25rem}.passKeyLogin-module__button___FvR4I{font-size:1rem}}");const ve=()=>{const r=d(),{apiHost:t,mode:n}=N(),{validateToken:i}=k(),a=w({authMode:n,authHost:t});return e("div",{className:pe,children:o("div",{className:fe,children:[e("h2",{className:ye,children:"Login with Passkey"}),e("button",{onClick:async()=>{try{const e=await a("/webAuthn/login/start",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok)return void console.error("Something went wrong getting webauthn options");const o=await e.json(),t=await u({optionsJSON:o}),n=await a("/webAuthn/login/finish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assertionResponse:t}),credentials:"include"});n.ok||console.error("Failed to verify passkey");const s=await n.json();if("Success"===s.message)return s.mfaLogin&&r("/mfaLogin"),await i(),void r("/");console.error("Passkey login failed")}catch{console.error("Passkey login error")}},className:be,children:"Use Passkey"})]})})};var ke="registerPasskey-module__container___jqEh8",we="registerPasskey-module__card___MJAyC",xe="registerPasskey-module__loading___Q4i1x",Pe="registerPasskey-module__spinner___V1nhd",Ne="registerPasskey-module__supported___ihTih",Se="registerPasskey-module__title___vn2Qu",Te="registerPasskey-module__description___AWmO-",Ce="registerPasskey-module__button___D3b4B",Oe="registerPasskey-module__message___RiOw-",Le="registerPasskey-module__success___HP5aX",Me="registerPasskey-module__error___hGiqE";T(".registerPasskey-module__container___jqEh8{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.registerPasskey-module__card___MJAyC{background-color:#1f2937;border-radius:1rem;box-shadow:0 4px 20px rgba(0,0,0,.4);max-width:400px;padding:1.5rem;width:100%}.registerPasskey-module__loading___Q4i1x{align-items:center;background-color:#f9fafb;border-radius:.75rem;box-shadow:0 2px 8px rgba(0,0,0,.1);color:#374151;display:flex;font-weight:500;gap:.75rem;justify-content:center;padding:1.5rem}.registerPasskey-module__spinner___V1nhd{animation:registerPasskey-module__spin___oYcsC 1s linear infinite;border-color:#3b82f6 transparent;border-radius:9999px;border-style:solid;border-width:2px;height:1.5rem;width:1.5rem}@keyframes registerPasskey-module__spin___oYcsC{to{transform:rotate(1turn)}}.registerPasskey-module__supported___ihTih{background-color:#ecfdf5;border-radius:.75rem;box-shadow:0 2px 12px rgba(0,0,0,.1);color:#065f46;padding:1.25rem}.registerPasskey-module__title___vn2Qu{font-size:1.125rem;font-weight:600;margin-bottom:.5rem}.registerPasskey-module__description___AWmO-{margin-bottom:1rem}.registerPasskey-module__button___D3b4B{background-color:#059669;border:none;border-radius:.5rem;color:#fff;cursor:pointer;font-weight:500;padding:.75rem 1rem;transition:background-color .2s ease;width:100%}.registerPasskey-module__button___D3b4B:hover{background-color:#047857}.registerPasskey-module__message___RiOw-{font-size:.875rem;margin-top:1rem}.registerPasskey-module__success___HP5aX{color:#6ee7b7}.registerPasskey-module__error___hGiqE{color:#f87171}");const Ie=()=>{const{apiHost:r,mode:t}=N(),{validateToken:n}=k(),s=d(),[l,c]=i("idle"),[_,m]=i(""),[u,p]=i(!1),f=w({authMode:t,authHost:r}),y=async e=>{try{const o=await f("/webAuthn/register/finish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attestationResponse:e}),credentials:"include"}),r=await o.json();if(!o.ok)return c("error"),void m("Something went wrong registering passkey.");r?.verified&&await n()}catch(e){console.error(`An error occurred: ${e}`)}};return a(()=>{!async function(){const e=await oe();p(e)}()},[]),e("div",{className:ke,children:e("div",{className:we,children:u?u&&o("div",{className:Ne,children:[e("h2",{className:Se,children:"Secure Your Account with a Passkey"}),e("p",{className:Te,children:"Your device supports passkeys! Register one to skip passwords forever."}),e("button",{onClick:async()=>{c("loading");try{const e=await f("/webAuthn/register/start",{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok)return c("error"),void m("Something went wrong registering passkey.");const o=await e.json();let r;try{r=await g({optionsJSON:o}),await y(r)}catch(e){return void(e instanceof h?(console.error(`Error occurred with webAuthn, ${e.name} - ${e.code}-${e.stack}`),c("error"),m(`Error: ${e.name}`)):(console.error("A problem happened.",e),c("error"),m(`Error: ${e}`)))}c("success"),m("Passkey registered successfully."),s("/")}catch(e){console.error(e),c("error"),m("Something went wrong registering passkey.")}},disabled:"loading"===l,className:Ce,children:"loading"===l?"Registering...":"Register Passkey"}),_&&e("p",{className:`${Oe} ${"success"===l?Le:Me}`,children:_})]}):o("div",{className:xe,children:[e("div",{className:Pe}),e("span",{children:"Checking for Passkey Support..."})]})})})};var Ee="verifyOTP-module__container___wgoDE",Ae="verifyOTP-module__card___3cs2p",je="verifyOTP-module__title___fZ-1d",Fe="verifyOTP-module__subtitle___dGSu3",Ve="verifyOTP-module__error___GEtlG",ze="verifyOTP-module__success___46TjG",Be="verifyOTP-module__form___jiGG-",Ge="verifyOTP-module__label___Zq5Mi",$e="verifyOTP-module__timer___smq-a",qe="verifyOTP-module__input___yqIXM",Re="verifyOTP-module__resend___PlmkG",Ue="verifyOTP-module__button___8pIuO",De="verifyOTP-module__toggle___wbzVa";T(".verifyOTP-module__container___wgoDE{align-items:center;color:#fff;display:flex;justify-content:center;padding:1rem}.verifyOTP-module__card___3cs2p{background-color:#1f2937;border-radius:.5rem;box-shadow:0 0 10px rgba(0,0,0,.3);max-width:28rem;padding:1.5rem;width:100%}.verifyOTP-module__title___fZ-1d{color:#fff;font-size:1.5rem;font-weight:700;margin-bottom:1rem;text-align:center}.verifyOTP-module__subtitle___dGSu3{color:#9ca3af;font-size:.875rem;margin-bottom:1.5rem;text-align:center}.verifyOTP-module__error___GEtlG{color:#f87171;margin-bottom:1rem;text-align:center}.verifyOTP-module__success___46TjG{color:#34d399;margin-bottom:.75rem;text-align:center}.verifyOTP-module__form___jiGG-{display:flex;flex-direction:column;gap:1rem}.verifyOTP-module__label___Zq5Mi{color:#d1d5db;display:block;font-size:.875rem;margin-bottom:.25rem}.verifyOTP-module__timer___smq-a{color:#facc15;font-size:.875rem}.verifyOTP-module__input___yqIXM{background-color:#374151;border:1px solid #4b5563;border-radius:.375rem;color:#fff;outline:none;padding:.5rem;width:100%}.verifyOTP-module__input___yqIXM:focus{box-shadow:0 0 0 2px #3b82f6}.verifyOTP-module__resend___PlmkG{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.75rem;margin-top:.25rem;text-decoration:underline}.verifyOTP-module__resend___PlmkG:hover{color:#3b82f6}.verifyOTP-module__button___8pIuO{background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;padding:.5rem;transition:background-color .2s;width:100%}.verifyOTP-module__button___8pIuO:hover{background-color:#1d4ed8}.verifyOTP-module__toggle___wbzVa{background:none;border:none;color:#60a5fa;cursor:pointer;font-size:.875rem;margin-top:1.5rem;text-align:center;width:100%}");const Je=()=>{const r=d(),{apiHost:t,mode:n}=N(),[s,l]=i(""),[c,_]=i(""),[m,u]=i(null),[g,h]=i(null),[p,f]=i(""),[y,b]=i(!1),[v,k]=i(""),[x,P]=i(300),[S,T]=i(300),C=w({authMode:n,authHost:t}),O=async()=>{b(!0);try{if(!m){(await C("/otp/verify-phone-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:c}),credentials:"include"})).ok?u(!0):f("Verification failed.")}}catch(e){console.error(e),f("Verification failed.")}b(!1)},L=async()=>{b(!0);try{if(!g){(await C("/otp/verify-email-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({verificationToken:s}),credentials:"include"})).ok?h(!0):f("Verification failed.")}}catch(e){console.error(e),f("Verification failed.")}b(!1)},M=e=>{k(""),"email"===e?((async()=>{f("");const e=await C("/otp/generate-email-otp",{method:"GET",headers:{"Content-Type":"application/json"}}),o=await e.json();e.ok?(k("Verification email has been resent."),o.token&&localStorage.setItem("token",o.token)):f("Failed to send Email code. If this persists, refresh the page and try again.")})(),k("Verification email has been resent.")):((async()=>{f("");const e=await C("/otp/generate-phone-otp",{method:"GET",headers:{"Content-Type":"application/json"}}),o=await e.json();e.ok?(o.token&&localStorage.setItem("token",o.token),k("Verification SMS has been resent.")):f("Failed to send SMS code. If this persists, refresh the page and try again.")})(),k("Verification SMS has been resent."))},I=o=>!0===o?e("span",{className:"text-green-400 ml-2",children:"✅"}):!1===o?e("span",{className:"text-red-400 ml-2",children:"❌"}):null,E=e=>`${Math.floor(e/60).toString().padStart(2,"0")}:${(e%60).toString().padStart(2,"0")}`;return a(()=>{const e=setInterval(()=>{P(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),a(()=>{const e=setInterval(()=>{T(e=>e>0?e-1:0)},1e3);return()=>clearInterval(e)},[]),a(()=>{g&&m&&r("/registerPasskey")},[g,m,r]),e("div",{className:Ee,children:o("div",{className:Ae,children:[e("h2",{className:je,children:"Verify Your Contact Info"}),e("p",{className:Fe,children:"Enter the codes sent to your email and phone number."}),p&&e("p",{className:Ve,children:p}),v&&e("p",{className:ze,children:v}),o("form",{onSubmit:async e=>{if(e.preventDefault(),f(""),6===s.length)if(6===c.length){b(!0);try{L(),O()}catch{f("Unexpected error occurred.")}finally{b(!1)}}else f("Please enter a valid code.");else f("Please enter a valid code.")},className:Be,children:[o("div",{children:[o("label",{htmlFor:"emailCode",className:Ge,children:["Email Verification Code ",I(g)," -"," ",o("span",{className:$e,children:["Code expires in: ",E(x)]})]}),e("input",{id:"emailCode",type:"text",maxLength:6,value:s,autoComplete:"off",onChange:e=>{l(e.target.value),h(null)},className:qe,required:!0}),e("button",{type:"button",onClick:()=>M("email"),className:Re,children:"Resend code to email"})]}),o("div",{children:[o("label",{htmlFor:"phoneCode",className:Ge,children:["Phone Verification Code ",I(m)," -"," ",o("span",{className:$e,children:["Code expires in: ",E(S)]})]}),e("input",{id:"phoneCode",type:"text",maxLength:6,pattern:"\\d{6}",inputMode:"numeric",value:c,autoComplete:"off",onChange:e=>{_(e.target.value),u(null)},className:qe,required:!0}),e("button",{type:"button",onClick:()=>M("phone"),className:Re,children:"Resend code to phone"})]}),e("button",{type:"submit",className:Ue,children:y?"Verifying...":"Verify & Continue"}),e("button",{type:"button",onClick:()=>r("/login"),className:De,children:"Back to login"})]})]})})},Ke=()=>o(c,{children:[e(_,{path:"/login",element:e(re,{})}),e(_,{path:"/passKeyLogin",element:e(ve,{})}),e(_,{path:"/mfaLogin",element:e(he,{})}),e(_,{path:"/verifyOTP",element:e(Je,{})}),e(_,{path:"/registerPasskey",element:e(Ie,{})}),e(_,{path:"*",element:e(m,{to:"/login",replace:!0})})]});export{S as AuthProvider,Ke as AuthRoutes,N as useAuth};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/context/InternalAuthContext.tsx","../src/fetchWithAuth.ts","../src/LoadingSpinner.tsx","../src/AuthProvider.tsx","../src/hooks/usePreviousSignIn.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/TermsModal.tsx","../src/components/phoneInput.tsx","../src/utils.ts","../src/Login.tsx","../src/MfaLogin.tsx","../src/PassKeyLogin.tsx","../src/RegisterPassKey.tsx","../src/VerifyOTP.tsx","../src/AuthRoutes.tsx"],"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],"names":["InternalAuthContext","createContext","undefined","InternalAuthProvider","value","children","_jsx","Provider","useInternalAuth","context","useContext","Error","createFetchWithAuth","opts","authMode","authHost","async","input","init","url","startsWith","requestInit","credentials","headers","response","fetch","ok","console","warn","status","LoadingSpinner","className","AuthContext","useAuth","AuthProvider","apiHost","autoDetectPreviousSignin","mode","user","setUser","useState","isAuthenticated","setIsAuthenticated","loading","setLoading","token","setToken","hasSignedInBefore","markSignedIn","storageKey","setHasSignedInBefore","useEffect","localStorage","getItem","setItem","usePreviousSignIn","fetchWithAuth","logout","useCallback","method","error","validateToken","json","_jsxs","deleteUser","hasRole","role","roles","includes","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TermsModal","isOpen","onClose","modalRef","useRef","handleKeyDown","e","key","addEventListener","current","focus","removeEventListener","styles","tabIndex","id","onClick","href","countries","code","name","dialCode","flag","PhoneInputWithCountryCode","phone","setPhone","phoneError","setPhoneError","showModal","setShowModal","selectedCountry","setSelectedCountry","defaultCountry","locale","Intl","DateTimeFormat","resolvedOptions","countryCode","split","toUpperCase","find","c","getDefaultCountry","onChange","country","target","stripped","replace","newPhone","AsYouType","map","raw","full","formatted","onBlur","parsed","parsePhoneNumberFromString","isValid","autoComplete","placeholder","isValidEmail","email","normalized","trim","length","parts","localPart","domainPart","test","endsWith","isValidPhoneNumber","phoneNumber","isPasskeySupported","window","PublicKeyCredential","isUserVerifyingPlatformAuthenticatorAvailable","Login","navigate","useNavigate","identifier","setIdentifier","setEmail","setMode","formErrors","setFormErrors","emailError","setEmailError","identifierError","setIdentifierError","passkeyAvailable","setPasskeyAvailable","supported","checkSupport","login","body","JSON","stringify","options","credential","startAuthentication","optionsJSON","verificationResponse","assertionResponse","verificationResult","message","mfaLogin","log","handlePasskeyLogin","err","_Fragment","onSubmit","preventDefault","register","htmlFor","required","disabled","MfaLogin","OTP","setOTP","setError","resendMsg","setResendMsg","timeLeft","setTimeLeft","selectedMethod","setSelectedMethod","verifyOTP","endpoint","verificationToken","sendOTP","interval","setInterval","prev","clearInterval","seconds","Math","floor","toString","padStart","maxLength","PassKeyLogin","RegisterPasskey","setStatus","setMessage","verifyPassKey","attResp","verificationResp","attestationResponse","verificationJSON","verified","challengeRes","startRegistration","WebAuthnError","stack","VerifyOTP","emailOtp","setEmailOtp","phoneOtp","setPhoneOtp","phoneVerified","setPhoneVerified","emailVerified","setEmailVerified","emailTimeLeft","setEmailTimeLeft","phoneTimeLeft","setPhoneTimeLeft","verifyPhoneOTP","verifyEmailOTP","handleResend","data","onResendEmail","onResendPhone","getStatusIcon","formatTime","pattern","inputMode","AuthRoutes","Routes","Route","path","element","Navigate","to"],"mappings":"6bAOA,MAAMA,EAAsBC,OAAmDC,GAElEC,EAAuB,EAClCC,QACAC,cAMEC,EAACN,EAAoBO,SAAQ,CAACH,MAAOA,EAAKC,SAAGA,IAKpCG,EAAkB,KAC7B,MAAMC,EAAUC,EAAWV,GAC3B,IAAKS,EACH,MAAM,IAAIE,MAAM,4DAElB,OAAOF,GCpBIG,EAAuBC,IAClC,MAAMC,SAAEA,EAAQC,SAAEA,GAAaF,EAE/B,OAAOG,eACLC,EACAC,GAEA,MAEMC,EAAM,GAAGJ,IAFW,WAAbD,EAAwB,OAAS,KAEbG,EAAMG,WAAW,KAAOH,EAAQ,IAAIA,MAE/DI,EAA2B,IAC5BH,EACHI,YAAa,UACbC,QAAS,CACP,eAAgB,sBACbL,GAAMK,UAIPC,QAAiBC,MAAMN,EAAKE,GAElC,GAAIG,EAASE,GAAI,OAAOF,EAGxB,MADAG,QAAQC,KAAK,qBAAsBJ,EAASK,OAAQV,GAC9C,IAAIR,MAAM,8BAA8BQ,IAChD,GC/BIW,EAA2B,IAE7BxB,EAAA,MAAA,CAAKyB,UAAU,4DAA2D1B,SACxEC,EAAA,MAAA,CAAA,cACc,UACZyB,UAAU,qFCgClB,MAAMC,EAAc/B,OAA2CC,GAMlD+B,EAAU,KACrB,MAAMxB,EAAUC,EAAWsB,GAC3B,IAAKvB,EACH,MAAM,IAAIE,MAAM,+CAElB,OAAOF,GAUIyB,EAA4C,EACvD7B,WACA8B,UACAC,4BAA2B,EAC3BC,OAAO,UAEP,MAAOC,EAAMC,GAAWC,EAAsB,OACvCC,EAAiBC,GAAsBF,GAAkB,IACzDG,EAASC,GAAcJ,GAAkB,IACzCK,EAAOC,GAAYN,EAA2B,OAC/CO,kBAAEA,EAAiBC,aAAEA,GCpEvB,SAA4BC,EAAa,qBAC7C,MAAOF,EAAmBG,GAAwBV,GAAS,GAoB3D,OAlBAW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VhM,YACEwE,KAAK,SACLsB,QAAS,IAAMyJ,EAAa,SAC5B9N,UAAWkE,GAAa5F,SAAA,4BAM5BC,EAAA,SAAA,CAAQwE,KAAK,SAAS/C,UAAWkE,GAAa5F,SAC3CsC,EAAU,eAAiB,sBAG9BrC,YACEwE,KAAK,SACLsB,QAAS,IAAM6D,EAAS,UACxBlI,UAAWkE,GAAa5F,SAAA,2BCrRvBgQ,GAAa,IACxBtM,EAACuM,EAAM,CAAAjQ,SAAA,CACLC,EAACiQ,EAAK,CAACC,KAAK,SAASC,QAASnQ,EAAC0J,GAAK,CAAA,KACpC1J,EAACiQ,GAAMC,KAAK,gBAAgBC,QAASnQ,EAAC0N,GAAY,CAAA,KAClD1N,EAACiQ,EAAK,CAACC,KAAK,YAAYC,QAASnQ,EAACkM,GAAQ,CAAA,KAC1ClM,EAACiQ,EAAK,CAACC,KAAK,aAAaC,QAASnQ,EAACwO,SACnCxO,EAACiQ,EAAK,CAACC,KAAK,mBAAmBC,QAASnQ,EAAC2N,GAAe,CAAA,KACxD3N,EAACiQ,GAAMC,KAAK,IAAIC,QAASnQ,EAACoQ,EAAQ,CAACC,GAAG,SAASxI,SAAO","x_google_ignoreList":[5]}
package/dist/utils.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * isValidEmail
3
3
  *
4
- * Determine if the given string is a valid phone number or not
5
- * @param email An email to validate
6
- * @returns boolean - Is the email valid or not
4
+ * Determine if value is a valid email
5
+ *
6
+ * @param email - The email address to validate
7
+ * @returns boolean - Whether the email is syntactically valid
7
8
  */
8
9
  export declare const isValidEmail: (email: string) => boolean;
9
10
  /**
package/package.json CHANGED
@@ -1,36 +1,46 @@
1
1
  {
2
2
  "name": "@seamless-auth/react",
3
- "version": "0.0.4-beta.9",
4
- "description": "A drop in authentication solution for react applications.",
5
- "module": "dist/index.es.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "0.0.6-beta.0",
4
+ "description": "A drop-in authentication solution for modern React applications.",
7
5
  "type": "module",
8
6
  "exports": {
9
7
  ".": {
10
- "import": "./dist/index.es.js",
8
+ "import": "./dist/index.js",
11
9
  "types": "./dist/index.d.ts"
12
10
  }
13
11
  },
12
+ "types": "./dist/index.d.ts",
14
13
  "files": [
15
14
  "dist",
16
15
  "README.md",
17
16
  "LICENSE"
18
17
  ],
19
18
  "engines": {
20
- "npm": ">=9.0.0 <12.0.0",
21
- "node": ">=20.0.0 <23.0.0"
19
+ "node": ">=20.0.0 <25.0.0",
20
+ "npm": ">=9.0.0 <13.0.0"
22
21
  },
23
22
  "scripts": {
23
+ "build": "rollup -c",
24
24
  "test": "jest",
25
- "test-build": "rollup -c",
26
- "build": "rimraf dist && tsc && rollup -c",
27
- "prepare": "npm run build",
25
+ "lint": "eslint ./src",
26
+ "format": "prettier --write .",
27
+ "prepare": "husky",
28
+ "semantic-release": "semantic-release",
28
29
  "check-npm-build": "npm pack --dry-run",
29
- "lint": "eslint ./src/"
30
+ "lint-staged": "lint-staged"
31
+ },
32
+ "lint-staged": {
33
+ "*.{js,jsx,ts,tsx}": [
34
+ "eslint --fix",
35
+ "prettier --write"
36
+ ],
37
+ "*.{json,md,yml,yaml}": [
38
+ "prettier --write"
39
+ ]
30
40
  },
31
41
  "repository": {
32
42
  "type": "git",
33
- "url": "git+https://github.com/fells-code/seamless-auth-react.git"
43
+ "url": "https://github.com/fells-code/seamless-auth-react.git"
34
44
  },
35
45
  "author": "Brandon Corbett <brandon.corbett@fellscode.com>",
36
46
  "license": "ISC",
@@ -44,67 +54,44 @@
44
54
  "react-router-dom": "^6.4.0 || ^7.0.0"
45
55
  },
46
56
  "devDependencies": {
47
- "@babel/cli": "^7.24.8",
48
- "@babel/core": "^7.25.2",
49
- "@babel/plugin-transform-runtime": "^7.27.1",
50
- "@babel/preset-env": "^7.25.4",
51
- "@babel/preset-react": "^7.24.7",
52
- "@babel/preset-typescript": "^7.27.1",
57
+ "@commitlint/cli": "^20.1.0",
58
+ "@commitlint/config-conventional": "^20.0.0",
53
59
  "@eslint/js": "^9.17.0",
54
- "@rollup/plugin-babel": "^6.0.4",
60
+ "@rollup/plugin-alias": "^5.1.1",
55
61
  "@rollup/plugin-commonjs": "^26.0.1",
56
62
  "@rollup/plugin-node-resolve": "^15.2.3",
57
63
  "@rollup/plugin-terser": "^0.4.4",
58
64
  "@rollup/plugin-typescript": "^11.1.6",
59
- "@semantic-release/changelog": "^6.0.3",
60
- "@semantic-release/commit-analyzer": "^13.0.1",
61
- "@semantic-release/github": "^11.0.3",
62
- "@semantic-release/npm": "^12.0.1",
63
- "@semantic-release/release-notes-generator": "^14.0.3",
64
- "@testing-library/jest-dom": "^6.6.3",
65
- "@testing-library/react": "^16.0.1",
66
- "@types/jest": "^29.5.12",
65
+ "@testing-library/jest-dom": "^6.9.1",
66
+ "@testing-library/react": "^16.3.0",
67
+ "@testing-library/user-event": "^14.6.1",
68
+ "@types/jest": "^29.5.14",
67
69
  "@types/react": "^18.3.4",
68
70
  "@types/react-dom": "^18.3.0",
69
- "@types/validator": "^13.15.0",
70
- "eslint": "^9.17.0",
71
- "eslint-plugin-import": "^2.31.0",
72
- "eslint-plugin-jsdoc": "^50.6.3",
73
- "eslint-plugin-react": "^7.37.3",
71
+ "eslint": "^9.38.0",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "eslint-plugin-import": "^2.32.0",
74
+ "eslint-plugin-react": "^7.37.5",
75
+ "eslint-plugin-react-hooks": "^5.2.0",
76
+ "eslint-plugin-react-refresh": "^0.4.24",
74
77
  "eslint-plugin-simple-import-sort": "^12.1.1",
75
- "globals": "^15.14.0",
78
+ "husky": "^9.1.7",
76
79
  "identity-obj-proxy": "^3.0.0",
77
80
  "jest": "^29.7.0",
78
- "jest-environment-jsdom": "^29.7.0",
79
- "postcss": "^8.5.3",
80
- "postcss-import": "^16.1.0",
81
- "postcss-modules": "^6.0.1",
82
- "postcss-url": "^10.1.3",
83
- "react": "^18.3.1",
84
- "react-dom": "^18.3.1",
85
- "rimraf": "^6.0.1",
86
- "rollup": "^4.0.0",
81
+ "jest-environment-jsdom": "^30.2.0",
82
+ "lint-staged": "^16.2.5",
83
+ "prettier": "^3.6.2",
87
84
  "rollup-plugin-peer-deps-external": "^2.2.4",
88
85
  "rollup-plugin-postcss": "^4.0.2",
89
- "semantic-release": "^24.2.5",
90
- "ts-jest": "^29.2.5",
91
- "ts-node": "^10.9.2",
86
+ "ts-jest": "^29.4.5",
92
87
  "tslib": "^2.7.0",
93
- "typescript": "^5.5.4",
94
- "typescript-eslint": "^8.18.2"
88
+ "typescript": "^5.9.3",
89
+ "typescript-eslint": "^8.46.1"
95
90
  },
96
91
  "dependencies": {
97
- "@babel/runtime": "^7.27.1",
98
92
  "@simplewebauthn/browser": "^13.1.0",
99
93
  "libphonenumber-js": "^1.12.7",
100
- "validator": "^13.15.0"
94
+ "ts-node": "^10.9.2"
101
95
  },
102
- "sideEffects": true,
103
- "typesVersions": {
104
- "*": {
105
- "*": [
106
- "dist/index.d.ts"
107
- ]
108
- }
109
- }
96
+ "sideEffects": false
110
97
  }
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- export interface ResetPasswordProps {
3
- apiHost: string;
4
- setLoading(value: boolean): void;
5
- validateToken(): void;
6
- }
7
- declare const VerifyAccount: React.FC<ResetPasswordProps>;
8
- export default VerifyAccount;