@tern-secure/nextjs 3.1.78 → 3.1.79
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/app-router/client/TernSecureProvider.d.ts +17 -0
- package/dist/app-router/server/TernSecureServerProvider.d.ts +30 -0
- package/dist/app-router/server/auth.d.ts +9 -0
- package/dist/boundary/TernSecureCtx.d.ts +15 -0
- package/dist/boundary/hooks/useAuth.d.ts +7 -0
- package/dist/cjs/app-router/client/TernSecureProvider.d.cts +17 -0
- package/dist/cjs/app-router/server/TernSecureServerProvider.d.cts +30 -0
- package/dist/cjs/app-router/server/auth.d.cts +9 -0
- package/dist/cjs/boundary/TernSecureCtx.d.cts +15 -0
- package/dist/cjs/boundary/hooks/useAuth.d.cts +7 -0
- package/dist/cjs/components/sign-in.d.cts +25 -0
- package/dist/cjs/errors.d.cts +10 -0
- package/dist/cjs/index.d.cts +19 -0
- package/dist/cjs/types.d.cts +49 -0
- package/dist/cjs/utils/client-init.d.cts +9 -0
- package/dist/cjs/utils/config.d.cts +22 -0
- package/dist/cjs/utils/create-styles.d.cts +100 -0
- package/dist/components/sign-in.d.ts +25 -0
- package/dist/errors.d.ts +10 -0
- package/dist/index.d.ts +19 -0
- package/dist/types.d.ts +49 -0
- package/dist/utils/client-init.d.ts +9 -0
- package/dist/utils/config.d.ts +22 -0
- package/dist/utils/create-styles.d.ts +100 -0
- package/package.json +3 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type TernSecureState = {
|
|
5
|
+
userId: string | null;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
isSignedIn: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const AuthStateContext: React__default.Context<TernSecureState | null>;
|
|
11
|
+
interface TernSecureClientProps {
|
|
12
|
+
children: React__default.ReactNode;
|
|
13
|
+
initialState: TernSecureState;
|
|
14
|
+
}
|
|
15
|
+
declare function TernSecureClientProvider({ children, initialState }: TernSecureClientProps): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { AuthStateContext, TernSecureClientProvider, type TernSecureState };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
interface TernSecureServerProviderProps {
|
|
5
|
+
children: React__default.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Root Provider for TernSecure
|
|
9
|
+
* Use this in your Next.js App Router root layout
|
|
10
|
+
* Automatically handles client/server boundary and authentication state
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // app/layout.tsx
|
|
14
|
+
* import { TernSecureProvider } from '@tern/secure'
|
|
15
|
+
*
|
|
16
|
+
* export default function RootLayout({ children }) {
|
|
17
|
+
* return (
|
|
18
|
+
* <html>
|
|
19
|
+
* <body>
|
|
20
|
+
* <TernSecureProvider>
|
|
21
|
+
* {children}
|
|
22
|
+
* </TernSecureProvider>
|
|
23
|
+
* </body>
|
|
24
|
+
* </html>
|
|
25
|
+
* )
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
declare function TernSecureServerProvider({ children }: TernSecureServerProviderProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
29
|
+
|
|
30
|
+
export { TernSecureServerProvider, type TernSecureServerProviderProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UserCredential } from 'firebase/auth';
|
|
2
|
+
|
|
3
|
+
interface SignInCredentials {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
declare function signInWithEmail({ email, password }: SignInCredentials): Promise<UserCredential>;
|
|
8
|
+
|
|
9
|
+
export { type SignInCredentials, signInWithEmail };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TernSecureCtxValue = {
|
|
4
|
+
_contextKey: Symbol;
|
|
5
|
+
};
|
|
6
|
+
declare const useInternalContext: (hookname: string) => TernSecureCtxValue;
|
|
7
|
+
/**
|
|
8
|
+
* Provider component for TernSecure
|
|
9
|
+
* Must be used in client components only
|
|
10
|
+
*/
|
|
11
|
+
declare function TernSecureCtxProvider({ children }: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { TernSecureCtxProvider, type TernSecureCtxValue, useInternalContext };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type TernSecureState = {
|
|
5
|
+
userId: string | null;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
isSignedIn: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const AuthStateContext: React__default.Context<TernSecureState | null>;
|
|
11
|
+
interface TernSecureClientProps {
|
|
12
|
+
children: React__default.ReactNode;
|
|
13
|
+
initialState: TernSecureState;
|
|
14
|
+
}
|
|
15
|
+
declare function TernSecureClientProvider({ children, initialState }: TernSecureClientProps): react_jsx_runtime.JSX.Element;
|
|
16
|
+
|
|
17
|
+
export { AuthStateContext, TernSecureClientProvider, type TernSecureState };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
interface TernSecureServerProviderProps {
|
|
5
|
+
children: React__default.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Root Provider for TernSecure
|
|
9
|
+
* Use this in your Next.js App Router root layout
|
|
10
|
+
* Automatically handles client/server boundary and authentication state
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // app/layout.tsx
|
|
14
|
+
* import { TernSecureProvider } from '@tern/secure'
|
|
15
|
+
*
|
|
16
|
+
* export default function RootLayout({ children }) {
|
|
17
|
+
* return (
|
|
18
|
+
* <html>
|
|
19
|
+
* <body>
|
|
20
|
+
* <TernSecureProvider>
|
|
21
|
+
* {children}
|
|
22
|
+
* </TernSecureProvider>
|
|
23
|
+
* </body>
|
|
24
|
+
* </html>
|
|
25
|
+
* )
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
declare function TernSecureServerProvider({ children }: TernSecureServerProviderProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
29
|
+
|
|
30
|
+
export { TernSecureServerProvider, type TernSecureServerProviderProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UserCredential } from 'firebase/auth';
|
|
2
|
+
|
|
3
|
+
interface SignInCredentials {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
declare function signInWithEmail({ email, password }: SignInCredentials): Promise<UserCredential>;
|
|
8
|
+
|
|
9
|
+
export { type SignInCredentials, signInWithEmail };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TernSecureCtxValue = {
|
|
4
|
+
_contextKey: Symbol;
|
|
5
|
+
};
|
|
6
|
+
declare const useInternalContext: (hookname: string) => TernSecureCtxValue;
|
|
7
|
+
/**
|
|
8
|
+
* Provider component for TernSecure
|
|
9
|
+
* Must be used in client components only
|
|
10
|
+
*/
|
|
11
|
+
declare function TernSecureCtxProvider({ children }: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { TernSecureCtxProvider, type TernSecureCtxValue, useInternalContext };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface SignInProps {
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
redirectUrl?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
customStyles?: {
|
|
11
|
+
container?: string;
|
|
12
|
+
header?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
formWrapper?: string;
|
|
15
|
+
formContainer?: string;
|
|
16
|
+
form?: string;
|
|
17
|
+
input?: string;
|
|
18
|
+
button?: string;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { SignIn, type SignInProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const ERRORS: {
|
|
2
|
+
readonly SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side";
|
|
3
|
+
readonly NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first";
|
|
4
|
+
readonly HOOK_CONTEXT: (hookName: string) => string;
|
|
5
|
+
};
|
|
6
|
+
declare class TernSecureError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { ERRORS, TernSecureError };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TernSecureServerProvider } from './app-router/server/TernSecureServerProvider.cjs';
|
|
2
|
+
export { TernSecureState } from './app-router/client/TernSecureProvider.cjs';
|
|
3
|
+
export { TernSecureAuth, TernSecureFirestore } from './utils/client-init.cjs';
|
|
4
|
+
export { loadFireConfig, validateConfig } from './utils/config.cjs';
|
|
5
|
+
export { signInWithEmail } from './app-router/server/auth.cjs';
|
|
6
|
+
export { useAuth } from './boundary/hooks/useAuth.cjs';
|
|
7
|
+
export { SignIn } from './components/sign-in.cjs';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@firebase/storage';
|
|
11
|
+
import '@firebase/firestore';
|
|
12
|
+
import '@firebase/auth';
|
|
13
|
+
import './types.cjs';
|
|
14
|
+
import 'firebase/app';
|
|
15
|
+
import 'firebase/auth';
|
|
16
|
+
|
|
17
|
+
declare const TernSecureProvider: typeof TernSecureServerProvider;
|
|
18
|
+
|
|
19
|
+
export { TernSecureProvider };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FirebaseOptions } from 'firebase/app';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TernSecure Firebase configuration interface
|
|
5
|
+
* Extends Firebase's base configuration options
|
|
6
|
+
*/
|
|
7
|
+
interface TernSecureConfig extends FirebaseOptions {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
authDomain: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
storageBucket: string;
|
|
12
|
+
messagingSenderId: string;
|
|
13
|
+
appId: string;
|
|
14
|
+
measurementId?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* TernSecure initialization options
|
|
18
|
+
*/
|
|
19
|
+
interface TernSecureOptions {
|
|
20
|
+
/** Environment setting for different configurations */
|
|
21
|
+
environment?: 'development' | 'production';
|
|
22
|
+
/** Geographic region for data storage */
|
|
23
|
+
region?: string;
|
|
24
|
+
/** Custom error handler */
|
|
25
|
+
onError?: (error: Error) => void;
|
|
26
|
+
/** Debug mode flag */
|
|
27
|
+
debug?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Firebase initialization state
|
|
31
|
+
*/
|
|
32
|
+
interface FirebaseState {
|
|
33
|
+
/** Whether Firebase has been initialized */
|
|
34
|
+
initialized: boolean;
|
|
35
|
+
/** Any initialization errors */
|
|
36
|
+
error: Error | null;
|
|
37
|
+
/** Timestamp of last initialization attempt */
|
|
38
|
+
lastInitAttempt?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration validation result
|
|
42
|
+
*/
|
|
43
|
+
interface ConfigValidationResult {
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
errors: string[];
|
|
46
|
+
config: TernSecureConfig;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { ConfigValidationResult, FirebaseState, TernSecureConfig, TernSecureOptions };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _firebase_storage from '@firebase/storage';
|
|
2
|
+
import * as _firebase_firestore from '@firebase/firestore';
|
|
3
|
+
import * as _firebase_auth from '@firebase/auth';
|
|
4
|
+
|
|
5
|
+
declare const TernSecureAuth: () => _firebase_auth.Auth;
|
|
6
|
+
declare const TernSecureFirestore: () => _firebase_firestore.Firestore;
|
|
7
|
+
declare const TernSecureStorage: () => _firebase_storage.FirebaseStorage;
|
|
8
|
+
|
|
9
|
+
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TernSecureConfig, ConfigValidationResult } from '../types.cjs';
|
|
2
|
+
import 'firebase/app';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Loads Firebase configuration from environment variables
|
|
6
|
+
* @returns {TernSecureConfig} Firebase configuration object
|
|
7
|
+
*/
|
|
8
|
+
declare const loadFireConfig: () => TernSecureConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Validates Firebase configuration
|
|
11
|
+
* @param {TernSecureConfig} config - Firebase configuration object
|
|
12
|
+
* @throws {Error} If required configuration values are missing
|
|
13
|
+
* @returns {TernSecureConfig} Validated configuration object
|
|
14
|
+
*/
|
|
15
|
+
declare const validateConfig: (config: TernSecureConfig) => ConfigValidationResult;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes configuration with validation
|
|
18
|
+
* @throws {Error} If configuration is invalid
|
|
19
|
+
*/
|
|
20
|
+
declare const initializeConfig: () => TernSecureConfig;
|
|
21
|
+
|
|
22
|
+
export { initializeConfig, loadFireConfig, validateConfig };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
declare const defaultClassNames: {
|
|
2
|
+
readonly container: "tern-container";
|
|
3
|
+
readonly header: "tern-header";
|
|
4
|
+
readonly title: "tern-title";
|
|
5
|
+
readonly formWrapper: "tern-formWrapper";
|
|
6
|
+
readonly formContainer: "tern-formContainer";
|
|
7
|
+
readonly form: "tern-form";
|
|
8
|
+
readonly label: "tern-label";
|
|
9
|
+
readonly input: "tern-input";
|
|
10
|
+
readonly button: "tern-button";
|
|
11
|
+
readonly error: "tern-error";
|
|
12
|
+
};
|
|
13
|
+
declare const styleConfig: {
|
|
14
|
+
readonly container: {
|
|
15
|
+
readonly display: "flex";
|
|
16
|
+
readonly minHeight: "100%";
|
|
17
|
+
readonly flex: "1";
|
|
18
|
+
readonly flexDirection: "column";
|
|
19
|
+
readonly justifyContent: "center";
|
|
20
|
+
readonly padding: "3rem 1.5rem";
|
|
21
|
+
};
|
|
22
|
+
readonly header: {
|
|
23
|
+
readonly margin: "0 auto";
|
|
24
|
+
readonly width: "100%";
|
|
25
|
+
readonly maxWidth: "28rem";
|
|
26
|
+
};
|
|
27
|
+
readonly title: {
|
|
28
|
+
readonly marginTop: "1.5rem";
|
|
29
|
+
readonly textAlign: "center";
|
|
30
|
+
readonly fontSize: "1.875rem";
|
|
31
|
+
readonly fontWeight: "700";
|
|
32
|
+
readonly lineHeight: "2.25rem";
|
|
33
|
+
readonly letterSpacing: "-0.025em";
|
|
34
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
35
|
+
};
|
|
36
|
+
readonly formWrapper: {
|
|
37
|
+
readonly marginTop: "2.5rem";
|
|
38
|
+
readonly margin: "0 auto";
|
|
39
|
+
readonly width: "100%";
|
|
40
|
+
readonly maxWidth: "30rem";
|
|
41
|
+
};
|
|
42
|
+
readonly formContainer: {
|
|
43
|
+
readonly padding: "3rem 1.5rem";
|
|
44
|
+
readonly boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)";
|
|
45
|
+
readonly borderRadius: "0.5rem";
|
|
46
|
+
readonly backgroundColor: "var(--tern-background, white)";
|
|
47
|
+
};
|
|
48
|
+
readonly form: {
|
|
49
|
+
readonly display: "flex";
|
|
50
|
+
readonly flexDirection: "column";
|
|
51
|
+
readonly gap: "1rem";
|
|
52
|
+
};
|
|
53
|
+
readonly label: {
|
|
54
|
+
readonly display: "block";
|
|
55
|
+
readonly fontSize: "0.875rem";
|
|
56
|
+
readonly fontWeight: "500";
|
|
57
|
+
readonly color: "var(--tern-text-secondary, #374151)";
|
|
58
|
+
};
|
|
59
|
+
readonly input: {
|
|
60
|
+
readonly marginTop: "0.25rem";
|
|
61
|
+
readonly display: "block";
|
|
62
|
+
readonly width: "100%";
|
|
63
|
+
readonly padding: "0.5rem 0.75rem";
|
|
64
|
+
readonly borderRadius: "0.375rem";
|
|
65
|
+
readonly border: "1px solid var(--tern-border, #D1D5DB)";
|
|
66
|
+
readonly backgroundColor: "var(--tern-input-background, white)";
|
|
67
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
68
|
+
};
|
|
69
|
+
readonly button: {
|
|
70
|
+
readonly display: "flex";
|
|
71
|
+
readonly width: "100%";
|
|
72
|
+
readonly justifyContent: "center";
|
|
73
|
+
readonly padding: "0.5rem 1rem";
|
|
74
|
+
readonly fontSize: "0.875rem";
|
|
75
|
+
readonly fontWeight: "500";
|
|
76
|
+
readonly color: "white";
|
|
77
|
+
readonly backgroundColor: "var(--tern-primary, #2563EB)";
|
|
78
|
+
readonly border: "none";
|
|
79
|
+
readonly borderRadius: "0.375rem";
|
|
80
|
+
readonly cursor: "pointer";
|
|
81
|
+
};
|
|
82
|
+
readonly error: {
|
|
83
|
+
readonly color: "var(--tern-error, #DC2626)";
|
|
84
|
+
readonly fontSize: "0.875rem";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
declare const styles: {
|
|
88
|
+
readonly container: "tern-container";
|
|
89
|
+
readonly header: "tern-header";
|
|
90
|
+
readonly title: "tern-title";
|
|
91
|
+
readonly formWrapper: "tern-formWrapper";
|
|
92
|
+
readonly formContainer: "tern-formContainer";
|
|
93
|
+
readonly form: "tern-form";
|
|
94
|
+
readonly label: "tern-label";
|
|
95
|
+
readonly input: "tern-input";
|
|
96
|
+
readonly button: "tern-button";
|
|
97
|
+
readonly error: "tern-error";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { defaultClassNames, styleConfig, styles };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface SignInProps {
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
redirectUrl?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
customStyles?: {
|
|
11
|
+
container?: string;
|
|
12
|
+
header?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
formWrapper?: string;
|
|
15
|
+
formContainer?: string;
|
|
16
|
+
form?: string;
|
|
17
|
+
input?: string;
|
|
18
|
+
button?: string;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { SignIn, type SignInProps };
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const ERRORS: {
|
|
2
|
+
readonly SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side";
|
|
3
|
+
readonly NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first";
|
|
4
|
+
readonly HOOK_CONTEXT: (hookName: string) => string;
|
|
5
|
+
};
|
|
6
|
+
declare class TernSecureError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { ERRORS, TernSecureError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TernSecureServerProvider } from './app-router/server/TernSecureServerProvider.js';
|
|
2
|
+
export { TernSecureState } from './app-router/client/TernSecureProvider.js';
|
|
3
|
+
export { TernSecureAuth, TernSecureFirestore } from './utils/client-init.js';
|
|
4
|
+
export { loadFireConfig, validateConfig } from './utils/config.js';
|
|
5
|
+
export { signInWithEmail } from './app-router/server/auth.js';
|
|
6
|
+
export { useAuth } from './boundary/hooks/useAuth.js';
|
|
7
|
+
export { SignIn } from './components/sign-in.js';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@firebase/storage';
|
|
11
|
+
import '@firebase/firestore';
|
|
12
|
+
import '@firebase/auth';
|
|
13
|
+
import './types.js';
|
|
14
|
+
import 'firebase/app';
|
|
15
|
+
import 'firebase/auth';
|
|
16
|
+
|
|
17
|
+
declare const TernSecureProvider: typeof TernSecureServerProvider;
|
|
18
|
+
|
|
19
|
+
export { TernSecureProvider };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FirebaseOptions } from 'firebase/app';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TernSecure Firebase configuration interface
|
|
5
|
+
* Extends Firebase's base configuration options
|
|
6
|
+
*/
|
|
7
|
+
interface TernSecureConfig extends FirebaseOptions {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
authDomain: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
storageBucket: string;
|
|
12
|
+
messagingSenderId: string;
|
|
13
|
+
appId: string;
|
|
14
|
+
measurementId?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* TernSecure initialization options
|
|
18
|
+
*/
|
|
19
|
+
interface TernSecureOptions {
|
|
20
|
+
/** Environment setting for different configurations */
|
|
21
|
+
environment?: 'development' | 'production';
|
|
22
|
+
/** Geographic region for data storage */
|
|
23
|
+
region?: string;
|
|
24
|
+
/** Custom error handler */
|
|
25
|
+
onError?: (error: Error) => void;
|
|
26
|
+
/** Debug mode flag */
|
|
27
|
+
debug?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Firebase initialization state
|
|
31
|
+
*/
|
|
32
|
+
interface FirebaseState {
|
|
33
|
+
/** Whether Firebase has been initialized */
|
|
34
|
+
initialized: boolean;
|
|
35
|
+
/** Any initialization errors */
|
|
36
|
+
error: Error | null;
|
|
37
|
+
/** Timestamp of last initialization attempt */
|
|
38
|
+
lastInitAttempt?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration validation result
|
|
42
|
+
*/
|
|
43
|
+
interface ConfigValidationResult {
|
|
44
|
+
isValid: boolean;
|
|
45
|
+
errors: string[];
|
|
46
|
+
config: TernSecureConfig;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { ConfigValidationResult, FirebaseState, TernSecureConfig, TernSecureOptions };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _firebase_storage from '@firebase/storage';
|
|
2
|
+
import * as _firebase_firestore from '@firebase/firestore';
|
|
3
|
+
import * as _firebase_auth from '@firebase/auth';
|
|
4
|
+
|
|
5
|
+
declare const TernSecureAuth: () => _firebase_auth.Auth;
|
|
6
|
+
declare const TernSecureFirestore: () => _firebase_firestore.Firestore;
|
|
7
|
+
declare const TernSecureStorage: () => _firebase_storage.FirebaseStorage;
|
|
8
|
+
|
|
9
|
+
export { TernSecureAuth, TernSecureFirestore, TernSecureStorage };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TernSecureConfig, ConfigValidationResult } from '../types.js';
|
|
2
|
+
import 'firebase/app';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Loads Firebase configuration from environment variables
|
|
6
|
+
* @returns {TernSecureConfig} Firebase configuration object
|
|
7
|
+
*/
|
|
8
|
+
declare const loadFireConfig: () => TernSecureConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Validates Firebase configuration
|
|
11
|
+
* @param {TernSecureConfig} config - Firebase configuration object
|
|
12
|
+
* @throws {Error} If required configuration values are missing
|
|
13
|
+
* @returns {TernSecureConfig} Validated configuration object
|
|
14
|
+
*/
|
|
15
|
+
declare const validateConfig: (config: TernSecureConfig) => ConfigValidationResult;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes configuration with validation
|
|
18
|
+
* @throws {Error} If configuration is invalid
|
|
19
|
+
*/
|
|
20
|
+
declare const initializeConfig: () => TernSecureConfig;
|
|
21
|
+
|
|
22
|
+
export { initializeConfig, loadFireConfig, validateConfig };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
declare const defaultClassNames: {
|
|
2
|
+
readonly container: "tern-container";
|
|
3
|
+
readonly header: "tern-header";
|
|
4
|
+
readonly title: "tern-title";
|
|
5
|
+
readonly formWrapper: "tern-formWrapper";
|
|
6
|
+
readonly formContainer: "tern-formContainer";
|
|
7
|
+
readonly form: "tern-form";
|
|
8
|
+
readonly label: "tern-label";
|
|
9
|
+
readonly input: "tern-input";
|
|
10
|
+
readonly button: "tern-button";
|
|
11
|
+
readonly error: "tern-error";
|
|
12
|
+
};
|
|
13
|
+
declare const styleConfig: {
|
|
14
|
+
readonly container: {
|
|
15
|
+
readonly display: "flex";
|
|
16
|
+
readonly minHeight: "100%";
|
|
17
|
+
readonly flex: "1";
|
|
18
|
+
readonly flexDirection: "column";
|
|
19
|
+
readonly justifyContent: "center";
|
|
20
|
+
readonly padding: "3rem 1.5rem";
|
|
21
|
+
};
|
|
22
|
+
readonly header: {
|
|
23
|
+
readonly margin: "0 auto";
|
|
24
|
+
readonly width: "100%";
|
|
25
|
+
readonly maxWidth: "28rem";
|
|
26
|
+
};
|
|
27
|
+
readonly title: {
|
|
28
|
+
readonly marginTop: "1.5rem";
|
|
29
|
+
readonly textAlign: "center";
|
|
30
|
+
readonly fontSize: "1.875rem";
|
|
31
|
+
readonly fontWeight: "700";
|
|
32
|
+
readonly lineHeight: "2.25rem";
|
|
33
|
+
readonly letterSpacing: "-0.025em";
|
|
34
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
35
|
+
};
|
|
36
|
+
readonly formWrapper: {
|
|
37
|
+
readonly marginTop: "2.5rem";
|
|
38
|
+
readonly margin: "0 auto";
|
|
39
|
+
readonly width: "100%";
|
|
40
|
+
readonly maxWidth: "30rem";
|
|
41
|
+
};
|
|
42
|
+
readonly formContainer: {
|
|
43
|
+
readonly padding: "3rem 1.5rem";
|
|
44
|
+
readonly boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)";
|
|
45
|
+
readonly borderRadius: "0.5rem";
|
|
46
|
+
readonly backgroundColor: "var(--tern-background, white)";
|
|
47
|
+
};
|
|
48
|
+
readonly form: {
|
|
49
|
+
readonly display: "flex";
|
|
50
|
+
readonly flexDirection: "column";
|
|
51
|
+
readonly gap: "1rem";
|
|
52
|
+
};
|
|
53
|
+
readonly label: {
|
|
54
|
+
readonly display: "block";
|
|
55
|
+
readonly fontSize: "0.875rem";
|
|
56
|
+
readonly fontWeight: "500";
|
|
57
|
+
readonly color: "var(--tern-text-secondary, #374151)";
|
|
58
|
+
};
|
|
59
|
+
readonly input: {
|
|
60
|
+
readonly marginTop: "0.25rem";
|
|
61
|
+
readonly display: "block";
|
|
62
|
+
readonly width: "100%";
|
|
63
|
+
readonly padding: "0.5rem 0.75rem";
|
|
64
|
+
readonly borderRadius: "0.375rem";
|
|
65
|
+
readonly border: "1px solid var(--tern-border, #D1D5DB)";
|
|
66
|
+
readonly backgroundColor: "var(--tern-input-background, white)";
|
|
67
|
+
readonly color: "var(--tern-text-primary, #111827)";
|
|
68
|
+
};
|
|
69
|
+
readonly button: {
|
|
70
|
+
readonly display: "flex";
|
|
71
|
+
readonly width: "100%";
|
|
72
|
+
readonly justifyContent: "center";
|
|
73
|
+
readonly padding: "0.5rem 1rem";
|
|
74
|
+
readonly fontSize: "0.875rem";
|
|
75
|
+
readonly fontWeight: "500";
|
|
76
|
+
readonly color: "white";
|
|
77
|
+
readonly backgroundColor: "var(--tern-primary, #2563EB)";
|
|
78
|
+
readonly border: "none";
|
|
79
|
+
readonly borderRadius: "0.375rem";
|
|
80
|
+
readonly cursor: "pointer";
|
|
81
|
+
};
|
|
82
|
+
readonly error: {
|
|
83
|
+
readonly color: "var(--tern-error, #DC2626)";
|
|
84
|
+
readonly fontSize: "0.875rem";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
declare const styles: {
|
|
88
|
+
readonly container: "tern-container";
|
|
89
|
+
readonly header: "tern-header";
|
|
90
|
+
readonly title: "tern-title";
|
|
91
|
+
readonly formWrapper: "tern-formWrapper";
|
|
92
|
+
readonly formContainer: "tern-formContainer";
|
|
93
|
+
readonly form: "tern-form";
|
|
94
|
+
readonly label: "tern-label";
|
|
95
|
+
readonly input: "tern-input";
|
|
96
|
+
readonly button: "tern-button";
|
|
97
|
+
readonly error: "tern-error";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { defaultClassNames, styleConfig, styles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.79",
|
|
4
4
|
"packageManager": "npm@10.9.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
},
|
|
59
59
|
"exports": {
|
|
60
60
|
".": {
|
|
61
|
-
"types": "./dist/
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
62
|
"import": "./dist/esm/index.js",
|
|
63
63
|
"require": "./dist/cjs/index.js"
|
|
64
64
|
},
|
|
65
65
|
"./server": {
|
|
66
|
-
"types": "./dist/esm/server/index.
|
|
66
|
+
"types": "./dist/esm/server/index.d.ts",
|
|
67
67
|
"import": "./dist/esm/server/index.js",
|
|
68
68
|
"require": "./dist/cjs/server/index.js"
|
|
69
69
|
}
|