@tern-secure/nextjs 3.4.3 → 4.1.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/dist/cjs/app-router/client/TernSecureProvider.js +17 -2
- package/dist/cjs/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/cjs/app-router/client/actions.js +55 -55
- package/dist/cjs/app-router/client/actions.js.map +1 -1
- package/dist/cjs/app-router/route-handler/internal-route.js +22 -3
- package/dist/cjs/app-router/route-handler/internal-route.js.map +1 -1
- package/dist/cjs/boundary/TernSecureClientProvider.js +167 -34
- package/dist/cjs/boundary/TernSecureClientProvider.js.map +1 -1
- package/dist/cjs/boundary/TernSecureCtx.js.map +1 -1
- package/dist/cjs/boundary/hooks/useAuth.js +15 -2
- package/dist/cjs/boundary/hooks/useAuth.js.map +1 -1
- package/dist/cjs/components/sign-in.js +158 -35
- package/dist/cjs/components/sign-in.js.map +1 -1
- package/dist/cjs/components/sign-out-button.js +84 -0
- package/dist/cjs/components/sign-out-button.js.map +1 -0
- package/dist/cjs/components/sign-out.js +39 -9
- package/dist/cjs/components/sign-out.js.map +1 -1
- package/dist/cjs/components/sign-up.js +10 -5
- package/dist/cjs/components/sign-up.js.map +1 -1
- package/dist/cjs/errors.js +233 -5
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/construct.js +50 -18
- package/dist/cjs/utils/construct.js.map +1 -1
- package/dist/cjs/utils/redirect.js +57 -0
- package/dist/cjs/utils/redirect.js.map +1 -0
- package/dist/esm/app-router/client/TernSecureProvider.js +17 -2
- package/dist/esm/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/esm/app-router/client/actions.js +64 -56
- package/dist/esm/app-router/client/actions.js.map +1 -1
- package/dist/esm/app-router/route-handler/internal-route.js +18 -2
- package/dist/esm/app-router/route-handler/internal-route.js.map +1 -1
- package/dist/esm/boundary/TernSecureClientProvider.js +168 -35
- package/dist/esm/boundary/TernSecureClientProvider.js.map +1 -1
- package/dist/esm/boundary/TernSecureCtx.js.map +1 -1
- package/dist/esm/boundary/hooks/useAuth.js +15 -2
- package/dist/esm/boundary/hooks/useAuth.js.map +1 -1
- package/dist/esm/components/sign-in.js +160 -37
- package/dist/esm/components/sign-in.js.map +1 -1
- package/dist/esm/components/sign-out-button.js +60 -0
- package/dist/esm/components/sign-out-button.js.map +1 -0
- package/dist/esm/components/sign-out.js +30 -10
- package/dist/esm/components/sign-out.js.map +1 -1
- package/dist/esm/components/sign-up.js +10 -5
- package/dist/esm/components/sign-up.js.map +1 -1
- package/dist/esm/errors.js +229 -4
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.js +6 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/construct.js +46 -17
- package/dist/esm/utils/construct.js.map +1 -1
- package/dist/esm/utils/redirect.js +32 -0
- package/dist/esm/utils/redirect.js.map +1 -0
- package/dist/types/app-router/client/TernSecureProvider.d.ts +14 -3
- package/dist/types/app-router/client/TernSecureProvider.d.ts.map +1 -1
- package/dist/types/app-router/client/actions.d.ts +24 -18
- package/dist/types/app-router/client/actions.d.ts.map +1 -1
- package/dist/types/app-router/route-handler/internal-route.d.ts +8 -1
- package/dist/types/app-router/route-handler/internal-route.d.ts.map +1 -1
- package/dist/types/boundary/TernSecureClientProvider.d.ts +17 -1
- package/dist/types/boundary/TernSecureClientProvider.d.ts.map +1 -1
- package/dist/types/boundary/TernSecureCtx.d.ts +3 -8
- package/dist/types/boundary/TernSecureCtx.d.ts.map +1 -1
- package/dist/types/boundary/hooks/useAuth.d.ts +6 -1
- package/dist/types/boundary/hooks/useAuth.d.ts.map +1 -1
- package/dist/types/components/sign-in.d.ts.map +1 -1
- package/dist/types/components/sign-out-button.d.ts +14 -0
- package/dist/types/components/sign-out-button.d.ts.map +1 -0
- package/dist/types/components/sign-out.d.ts +7 -5
- package/dist/types/components/sign-out.d.ts.map +1 -1
- package/dist/types/components/sign-up.d.ts +4 -0
- package/dist/types/components/sign-up.d.ts.map +1 -1
- package/dist/types/components/ui/alert.d.ts +1 -1
- package/dist/types/components/ui/button.d.ts +1 -1
- package/dist/types/errors.d.ts +37 -2
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +45 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/construct.d.ts +20 -4
- package/dist/types/utils/construct.d.ts.map +1 -1
- package/dist/types/utils/redirect.d.ts +9 -0
- package/dist/types/utils/redirect.d.ts.map +1 -0
- package/package.json +6 -6
- package/dist/cjs/boundary/hooks/useUser.js +0 -44
- package/dist/cjs/boundary/hooks/useUser.js.map +0 -1
- package/dist/esm/boundary/hooks/useUser.js +0 -20
- package/dist/esm/boundary/hooks/useUser.js.map +0 -1
- package/dist/types/boundary/hooks/useUser.d.ts +0 -7
- package/dist/types/boundary/hooks/useUser.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-route.d.ts","sourceRoot":"","sources":["../../../../src/app-router/route-handler/internal-route.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"internal-route.d.ts","sourceRoot":"","sources":["../../../../src/app-router/route-handler/internal-route.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,eAAO,MAAM,cAAc;;;;;;;;;CAS1B,CAAA;AAGD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAGD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD;AAGD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,wBAOnD"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { User } from "firebase/auth";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Internal provider props - not meant for direct usage
|
|
6
|
+
*/
|
|
3
7
|
interface TernSecureClientProviderProps {
|
|
4
8
|
children: React.ReactNode;
|
|
9
|
+
/** Callback when user state changes */
|
|
5
10
|
onUserChanged?: (user: User | null) => Promise<void>;
|
|
11
|
+
/** Login page path */
|
|
6
12
|
loginPath?: string;
|
|
13
|
+
/** Signup page path */
|
|
14
|
+
signUpPath?: string;
|
|
15
|
+
/** Custom loading component */
|
|
7
16
|
loadingComponent?: React.ReactNode;
|
|
17
|
+
/** Whether email verification is required */
|
|
18
|
+
requiresVerification: boolean;
|
|
8
19
|
}
|
|
9
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Internal provider component that handles authentication state
|
|
23
|
+
* This is wrapped by the public TernSecureProvider
|
|
24
|
+
*/
|
|
25
|
+
export declare function TernSecureClientProvider({ children, loginPath, signUpPath, loadingComponent, requiresVerification, }: TernSecureClientProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
26
|
export {};
|
|
11
27
|
//# sourceMappingURL=TernSecureClientProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TernSecureClientProvider.d.ts","sourceRoot":"","sources":["../../../src/boundary/TernSecureClientProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAsB,IAAI,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"TernSecureClientProvider.d.ts","sourceRoot":"","sources":["../../../src/boundary/TernSecureClientProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAsB,IAAI,EAAE,MAAM,eAAe,CAAA;AAUxD;;;GAGG;AACH,UAAU,6BAA6B;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,uCAAuC;IACvC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,6CAA6C;IAC7C,oBAAoB,EAAE,OAAO,CAAA;CAC9B;AAED;;;;GAIG;AAEH,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,SAA8D,EAC9D,UAA+D,EAC/D,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,6BAA6B,2CAqP/B"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { User } from 'firebase/auth';
|
|
2
|
+
import type { TernSecureState, SignInResponse } from '../types';
|
|
2
3
|
export declare const TernSecureUser: () => User | null;
|
|
3
|
-
export interface TernSecureState {
|
|
4
|
-
userId: string | null;
|
|
5
|
-
isLoaded: boolean;
|
|
6
|
-
error: Error | null;
|
|
7
|
-
isValid: boolean;
|
|
8
|
-
token: any | null;
|
|
9
|
-
email: string | null;
|
|
10
|
-
}
|
|
11
4
|
export interface TernSecureCtxValue extends TernSecureState {
|
|
12
5
|
signOut: () => Promise<void>;
|
|
13
6
|
setEmail: (email: string) => void;
|
|
7
|
+
getAuthError: () => SignInResponse;
|
|
8
|
+
redirectToLogin: () => void;
|
|
14
9
|
}
|
|
15
10
|
export declare const TernSecureCtx: import("react").Context<TernSecureCtxValue | null>;
|
|
16
11
|
export declare const useTernSecure: (hookName: string) => TernSecureCtxValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TernSecureCtx.d.ts","sourceRoot":"","sources":["../../../src/boundary/TernSecureCtx.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"TernSecureCtx.d.ts","sourceRoot":"","sources":["../../../src/boundary/TernSecureCtx.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhE,eAAO,MAAM,cAAc,QAAO,IAAI,GAAG,IAExC,CAAA;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IAC1D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,YAAY,EAAE,MAAM,cAAc,CAAA;IAClC,eAAe,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAA;AAI3E,eAAO,MAAM,aAAa,aAAc,MAAM,uBAU7C,CAAA"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { User } from 'firebase/auth';
|
|
2
|
+
import type { SignInResponse } from '../../types';
|
|
2
3
|
export declare function useAuth(): {
|
|
3
4
|
user: User | null;
|
|
4
5
|
userId: string | null;
|
|
5
6
|
isLoaded: boolean;
|
|
6
|
-
error:
|
|
7
|
+
error: SignInResponse | null;
|
|
8
|
+
isValid: boolean;
|
|
9
|
+
isVerified: boolean;
|
|
7
10
|
isAuthenticated: boolean;
|
|
8
11
|
token: any;
|
|
12
|
+
status: "loading" | "authenticated" | "unauthenticated" | "unverified";
|
|
13
|
+
requiresVerification: boolean;
|
|
9
14
|
signOut: () => Promise<void>;
|
|
10
15
|
};
|
|
11
16
|
//# sourceMappingURL=useAuth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../src/boundary/hooks/useAuth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAG,IAAI,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../src/boundary/hooks/useAuth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAG,IAAI,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,wBAAgB,OAAO;;;;;;;;;;;;EAgCtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../../src/components/sign-in.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../../src/components/sign-in.tsx"],"names":[],"mappings":"AA6BA,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;CACF;AAGD,wBAAgB,MAAM,CAAC,EACrB,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAiB,EAClB,EAAE,WAAW,2CAgWb"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ButtonProps } from './ui/button';
|
|
2
|
+
type SignOutCustomProps = {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
onError?: (error: Error) => void;
|
|
5
|
+
onSignOutSuccess?: () => void;
|
|
6
|
+
redirectPath?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: ButtonProps['variant'];
|
|
9
|
+
size?: ButtonProps['size'];
|
|
10
|
+
};
|
|
11
|
+
type SignOutProps = Omit<ButtonProps, 'onClick'> & SignOutCustomProps;
|
|
12
|
+
export declare function SignOutButton({ children, onError, onSignOutSuccess, redirectPath, className, variant, size, ...buttonProps }: SignOutProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=sign-out-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-out-button.d.ts","sourceRoot":"","sources":["../../../src/components/sign-out-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAOtD,KAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC3B,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,kBAAkB,CAAA;AAErE,wBAAgB,aAAa,CAAC,EAC5B,QAAqB,EACrB,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,GAAG,WAAW,EACf,EAAE,YAAY,2CA8Cd"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
type SignOutCustomProps = {
|
|
1
|
+
interface SignOutLinkProps {
|
|
3
2
|
children?: React.ReactNode;
|
|
4
3
|
onError?: (error: Error) => void;
|
|
5
4
|
onSignOutSuccess?: () => void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
className?: string;
|
|
6
|
+
activeClassName?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
redirectPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function SignOut({ children, onError, onSignOutSuccess, className, activeClassName, disabled, redirectPath, }: SignOutLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=sign-out.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-out.d.ts","sourceRoot":"","sources":["../../../src/components/sign-out.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-out.d.ts","sourceRoot":"","sources":["../../../src/components/sign-out.tsx"],"names":[],"mappings":"AAYA,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,OAAO,CAAC,EACtB,QAAqB,EACrB,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAgB,EAChB,YAAY,GACb,EAAE,gBAAgB,2CAsDlB"}
|
|
@@ -3,5 +3,9 @@ export interface SignUpProps {
|
|
|
3
3
|
onError?: (error: Error) => void;
|
|
4
4
|
onSuccess?: () => void;
|
|
5
5
|
}
|
|
6
|
+
export interface PasswordRequirement {
|
|
7
|
+
text: string;
|
|
8
|
+
satisfied: boolean;
|
|
9
|
+
}
|
|
6
10
|
export declare function SignUp({ redirectUrl, onError, onSuccess, }: SignUpProps): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
//# sourceMappingURL=sign-up.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../src/components/sign-up.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../src/components/sign-up.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;CACnB;AAGD,wBAAgB,MAAM,CAAC,EACnB,WAAW,EACX,OAAO,EACP,SAAS,GACX,EAAE,WAAW,2CA8Rd"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "destructive" | "default" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
7
7
|
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "destructive" | "default" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
+
import { SignInResponse } from "./types";
|
|
2
|
+
export type ErrorCode = keyof typeof ERRORS;
|
|
3
|
+
export interface AuthErrorResponse {
|
|
4
|
+
success: false;
|
|
5
|
+
message: string;
|
|
6
|
+
code: ErrorCode;
|
|
7
|
+
}
|
|
1
8
|
export declare const ERRORS: {
|
|
2
9
|
readonly SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side";
|
|
10
|
+
readonly REQUIRES_VERIFICATION: "AUTH_REQUIRES_VERIFICATION";
|
|
11
|
+
readonly AUTHENTICATED: "AUTHENTICATED";
|
|
12
|
+
readonly UNAUTHENTICATED: "UNAUTHENTICATED";
|
|
13
|
+
readonly UNVERIFIED: "UNVERIFIED";
|
|
3
14
|
readonly NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first";
|
|
4
|
-
readonly HOOK_CONTEXT:
|
|
15
|
+
readonly HOOK_CONTEXT: "Hook must be used within TernSecureProvider";
|
|
16
|
+
readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
|
|
17
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
18
|
+
readonly USER_DISABLED: "USER_DISABLED";
|
|
19
|
+
readonly TOO_MANY_ATTEMPTS: "TOO_MANY_ATTEMPTS";
|
|
20
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
21
|
+
readonly INVALID_EMAIL: "INVALID_EMAIL";
|
|
22
|
+
readonly WEAK_PASSWORD: "WEAK_PASSWORD";
|
|
23
|
+
readonly EMAIL_EXISTS: "EMAIL_EXISTS";
|
|
24
|
+
readonly POPUP_BLOCKED: "POPUP_BLOCKED";
|
|
25
|
+
readonly OPERATION_NOT_ALLOWED: "OPERATION_NOT_ALLOWED";
|
|
26
|
+
readonly EXPIRED_TOKEN: "EXPIRED_TOKEN";
|
|
27
|
+
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
|
28
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
29
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
5
30
|
};
|
|
6
31
|
export declare class TernSecureError extends Error {
|
|
7
|
-
|
|
32
|
+
code: ErrorCode;
|
|
33
|
+
constructor(code: ErrorCode, message?: string);
|
|
8
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Handles Firebase authentication errors with multiple fallback mechanisms
|
|
37
|
+
*/
|
|
38
|
+
export declare function handleFirebaseAuthError(error: unknown): AuthErrorResponse;
|
|
39
|
+
/**
|
|
40
|
+
* Type guard to check if a response is an AuthErrorResponse
|
|
41
|
+
*/
|
|
42
|
+
export declare function isAuthErrorResponse(response: unknown): response is AuthErrorResponse;
|
|
43
|
+
export declare function getErrorAlertVariant(error: SignInResponse | undefined): "destructive" | "default";
|
|
9
44
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAA;AAE3C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,KAAK,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,CAAA;CAChB;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;CAsBT,CAAA;AAmBV,qBAAa,eAAgB,SAAQ,KAAK;IACxC,IAAI,EAAE,SAAS,CAAA;gBAEH,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM;CAK9C;AAiJD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAwFzE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,iBAAiB,CASpF;AAID,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,6BAsBrE"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { loadFireConfig, validateConfig } from './utils/config';
|
|
|
3
3
|
export { signInWithEmail } from './app-router/client/actions';
|
|
4
4
|
export { TernSecureProvider } from './app-router/client/TernSecureProvider';
|
|
5
5
|
export { useAuth } from './boundary/hooks/useAuth';
|
|
6
|
-
export { useUser } from './boundary/hooks/useUser';
|
|
7
6
|
export { SignIn } from './components/sign-in';
|
|
7
|
+
export { SignOutButton } from './components/sign-out-button';
|
|
8
8
|
export { SignOut } from './components/sign-out';
|
|
9
9
|
export { SignUp } from './components/sign-up';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FirebaseOptions } from 'firebase/app';
|
|
2
|
+
import { ERRORS } from './errors';
|
|
2
3
|
/**
|
|
3
4
|
* TernSecure Firebase configuration interface
|
|
4
5
|
* Extends Firebase's base configuration options
|
|
@@ -60,4 +61,48 @@ export interface AdminConfigValidationResult {
|
|
|
60
61
|
errors: string[];
|
|
61
62
|
config: TernSecureAdminConfig;
|
|
62
63
|
}
|
|
64
|
+
export interface SignInResponse {
|
|
65
|
+
success: boolean;
|
|
66
|
+
message?: string;
|
|
67
|
+
error?: keyof typeof ERRORS | undefined;
|
|
68
|
+
user?: any;
|
|
69
|
+
}
|
|
70
|
+
export interface AuthError extends Error {
|
|
71
|
+
code?: string;
|
|
72
|
+
message: string;
|
|
73
|
+
response?: SignInResponse;
|
|
74
|
+
}
|
|
75
|
+
export declare function isSignInResponse(value: any): value is SignInResponse;
|
|
76
|
+
export interface TernSecureState {
|
|
77
|
+
userId: string | null;
|
|
78
|
+
isLoaded: boolean;
|
|
79
|
+
error: Error | null;
|
|
80
|
+
isValid: boolean;
|
|
81
|
+
isVerified: boolean;
|
|
82
|
+
isAuthenticated: boolean;
|
|
83
|
+
token: any | null;
|
|
84
|
+
email: string | null;
|
|
85
|
+
status: "loading" | "authenticated" | "unauthenticated" | "unverified";
|
|
86
|
+
requiresVerification: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface RedirectConfig {
|
|
89
|
+
redirectUrl?: string;
|
|
90
|
+
isReturn?: boolean;
|
|
91
|
+
priority?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface SignInProps extends RedirectConfig {
|
|
94
|
+
onError?: (error: Error) => void;
|
|
95
|
+
onSuccess?: () => void;
|
|
96
|
+
className?: string;
|
|
97
|
+
customStyles?: {
|
|
98
|
+
card?: string;
|
|
99
|
+
input?: string;
|
|
100
|
+
button?: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
separator?: string;
|
|
103
|
+
title?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
socialButton?: string;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
63
108
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -5,18 +5,34 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const constructFullUrl: (path: string) => string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Checks if the current URL has a redirect loop
|
|
9
|
+
* @param currentPath - The current pathname
|
|
10
|
+
* @param redirectPath - The path we're trying to redirect to
|
|
11
|
+
* @returns boolean indicating if there's a redirect loop
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasRedirectLoop: (currentPath: string, redirectPath: string) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a URL with redirect parameters while preventing loops
|
|
9
16
|
* @param path - The base path (usually login path)
|
|
10
17
|
* @param redirectUrl - The URL to redirect to after action completes
|
|
11
18
|
* @param loginPath - The login path to check against
|
|
19
|
+
* @param signUpPath - The sign up path to check against
|
|
12
20
|
* @returns The full URL with redirect parameters
|
|
13
21
|
*/
|
|
14
|
-
export declare const constructUrlWithRedirect: (path: string, redirectUrl: string
|
|
22
|
+
export declare const constructUrlWithRedirect: (path: string, redirectUrl: string | undefined) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Stores the current path before signing out
|
|
25
|
+
*/
|
|
26
|
+
export declare const storePreviousPath: (path: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the stored previous path
|
|
29
|
+
*/
|
|
30
|
+
export declare const getPreviousPath: () => string | null;
|
|
15
31
|
/**
|
|
16
32
|
* Gets a validated redirect URL ensuring it's from the same origin
|
|
17
33
|
* @param redirectUrl - The URL to validate
|
|
18
|
-
* @param searchParams - The search parameters to check for
|
|
34
|
+
* @param searchParams - The search parameters to check for redirect
|
|
19
35
|
* @returns A validated redirect URL
|
|
20
36
|
*/
|
|
21
|
-
export declare const getValidRedirectUrl: (
|
|
37
|
+
export declare const getValidRedirectUrl: (searchParams: URLSearchParams, configuredRedirect?: string) => string;
|
|
22
38
|
//# sourceMappingURL=construct.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/utils/construct.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/utils/construct.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,SAAU,MAAM,WAO1C,CAAA;AAGH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,gBAAiB,MAAM,gBAAgB,MAAM,KAAG,OAQ3E,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,SAC7B,MAAM,eACC,MAAM,GAAG,SAAS,KAC9B,MAQF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,KAAG,IAIhD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,IAK3C,CAAA;AAID;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,iBAChB,eAAe,uBACR,MAAM,KAC1B,MAcF,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates and sanitizes redirect URLs
|
|
3
|
+
*/
|
|
4
|
+
export declare function validateRedirectUrl(url: string | null): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Gets the current path for redirect purposes
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentPath(): Promise<string>;
|
|
9
|
+
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/utils/redirect.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB7E;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAQtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"packageManager": "npm@11.0.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@eslint/js": "^9.15.0",
|
|
33
33
|
"@types/node": "^22.9.3",
|
|
34
34
|
"@types/react": "^18.3.12",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
36
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.22.0",
|
|
37
37
|
"eslint": "^9.15.0",
|
|
38
38
|
"eslint-plugin-react": "^7.37.2",
|
|
39
39
|
"prettier": "^3.3.3",
|
|
40
40
|
"rimraf": "^6.0.1",
|
|
41
41
|
"tsup": "^8.3.5",
|
|
42
|
-
"turbo": "^2.
|
|
42
|
+
"turbo": "^2.4.0",
|
|
43
43
|
"typescript": "^5.7.2"
|
|
44
44
|
},
|
|
45
45
|
"types": "./dist/types/index.d.ts",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
],
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"firebase": "^
|
|
52
|
-
"firebase-admin": "^12.
|
|
51
|
+
"firebase": "^11.2.0",
|
|
52
|
+
"firebase-admin": "^12.7.0",
|
|
53
53
|
"next": "^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
54
54
|
"react": "^18 || ^19.0.0-0",
|
|
55
55
|
"react-dom": "^18 || ^19.0.0-0"
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var useUser_exports = {};
|
|
21
|
-
__export(useUser_exports, {
|
|
22
|
-
useUser: () => useUser
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useUser_exports);
|
|
25
|
-
var import_auth = require("firebase/auth");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_client_init = require("../../utils/client-init");
|
|
28
|
-
function useUser() {
|
|
29
|
-
const [user, setUser] = (0, import_react.useState)(null);
|
|
30
|
-
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
31
|
-
(0, import_react.useEffect)(() => {
|
|
32
|
-
const unsubscribe = (0, import_auth.onAuthStateChanged)(import_client_init.ternSecureAuth, (authUser) => {
|
|
33
|
-
setUser(authUser);
|
|
34
|
-
setLoading(false);
|
|
35
|
-
});
|
|
36
|
-
return () => unsubscribe();
|
|
37
|
-
}, []);
|
|
38
|
-
return { user, loading };
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
useUser
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=useUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/boundary/hooks/useUser.ts"],"sourcesContent":["\"use client\";\n\nimport { onAuthStateChanged } from \"firebase/auth\";\nimport { useEffect, useState } from \"react\";\n\nimport { ternSecureAuth} from \"../../utils/client-init\";\n\ninterface UseUserReturn {\n user: any | null;\n loading: boolean;\n }\n\nexport function useUser(): UseUserReturn {\n const [user, setUser] = useState<any| null>(null);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n const unsubscribe = onAuthStateChanged(ternSecureAuth, (authUser) => {\n setUser(authUser);\n setLoading(false);\n });\n\n return () => unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {user, loading};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAmC;AACnC,mBAAoC;AAEpC,yBAA8B;AAOvB,SAAS,UAAyB;AACvC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAoB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,IAAI;AAE3C,8BAAU,MAAM;AACd,UAAM,kBAAc,gCAAmB,mCAAgB,CAAC,aAAa;AACnE,cAAQ,QAAQ;AAChB,iBAAW,KAAK;AAAA,IAClB,CAAC;AAED,WAAO,MAAM,YAAY;AAAA,EAE3B,GAAG,CAAC,CAAC;AAEL,SAAO,EAAC,MAAM,QAAO;AACvB;","names":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { onAuthStateChanged } from "firebase/auth";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { ternSecureAuth } from "../../utils/client-init";
|
|
5
|
-
function useUser() {
|
|
6
|
-
const [user, setUser] = useState(null);
|
|
7
|
-
const [loading, setLoading] = useState(true);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const unsubscribe = onAuthStateChanged(ternSecureAuth, (authUser) => {
|
|
10
|
-
setUser(authUser);
|
|
11
|
-
setLoading(false);
|
|
12
|
-
});
|
|
13
|
-
return () => unsubscribe();
|
|
14
|
-
}, []);
|
|
15
|
-
return { user, loading };
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
useUser
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=useUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/boundary/hooks/useUser.ts"],"sourcesContent":["\"use client\";\n\nimport { onAuthStateChanged } from \"firebase/auth\";\nimport { useEffect, useState } from \"react\";\n\nimport { ternSecureAuth} from \"../../utils/client-init\";\n\ninterface UseUserReturn {\n user: any | null;\n loading: boolean;\n }\n\nexport function useUser(): UseUserReturn {\n const [user, setUser] = useState<any| null>(null);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n const unsubscribe = onAuthStateChanged(ternSecureAuth, (authUser) => {\n setUser(authUser);\n setLoading(false);\n });\n\n return () => unsubscribe();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {user, loading};\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AACnC,SAAS,WAAW,gBAAgB;AAEpC,SAAS,sBAAqB;AAOvB,SAAS,UAAyB;AACvC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAoB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAE3C,YAAU,MAAM;AACd,UAAM,cAAc,mBAAmB,gBAAgB,CAAC,aAAa;AACnE,cAAQ,QAAQ;AAChB,iBAAW,KAAK;AAAA,IAClB,CAAC;AAED,WAAO,MAAM,YAAY;AAAA,EAE3B,GAAG,CAAC,CAAC;AAEL,SAAO,EAAC,MAAM,QAAO;AACvB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUser.d.ts","sourceRoot":"","sources":["../../../../src/boundary/hooks/useUser.ts"],"names":[],"mappings":"AAOA,UAAU,aAAa;IACnB,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAEH,wBAAgB,OAAO,IAAI,aAAa,CAevC"}
|