@tern-secure/nextjs 3.1.83 → 3.1.84
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 +48 -79
- package/dist/cjs/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/cjs/app-router/server/TernSecureServerProvider.js +40 -106
- package/dist/cjs/app-router/server/TernSecureServerProvider.js.map +1 -1
- package/dist/cjs/app-router/server/auth.js +28 -62
- package/dist/cjs/app-router/server/auth.js.map +1 -1
- package/dist/cjs/boundary/TernSecureCtx.js +37 -14
- package/dist/cjs/boundary/TernSecureCtx.js.map +1 -1
- package/dist/cjs/boundary/hooks/useAuth.js +30 -80
- package/dist/cjs/boundary/hooks/useAuth.js.map +1 -1
- package/dist/cjs/components/sign-in.js +49 -208
- package/dist/cjs/components/sign-in.js.map +1 -1
- package/dist/cjs/errors.js +32 -10
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +45 -383
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.js +16 -3
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/client-init.js +42 -64
- package/dist/cjs/utils/client-init.js.map +1 -1
- package/dist/cjs/utils/config.js +34 -11
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/create-styles.js +37 -13
- package/dist/cjs/utils/create-styles.js.map +1 -1
- package/dist/esm/app-router/client/TernSecureProvider.js +7 -81
- package/dist/esm/app-router/client/TernSecureProvider.js.map +1 -1
- package/dist/esm/app-router/server/TernSecureServerProvider.js +5 -115
- package/dist/esm/app-router/server/TernSecureServerProvider.js.map +1 -1
- package/dist/esm/app-router/server/auth.js +3 -61
- package/dist/esm/app-router/server/auth.js.map +1 -1
- package/dist/esm/boundary/TernSecureCtx.js +4 -6
- package/dist/esm/boundary/TernSecureCtx.js.map +1 -1
- package/dist/esm/boundary/hooks/useAuth.js +4 -89
- package/dist/esm/boundary/hooks/useAuth.js.map +1 -1
- package/dist/esm/components/sign-in.js +3 -190
- package/dist/esm/components/sign-in.js.map +1 -1
- package/dist/esm/errors.js +3 -4
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +7 -398
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/client-init.js +9 -54
- package/dist/esm/utils/client-init.js.map +1 -1
- package/dist/esm/utils/config.js +3 -4
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/create-styles.js +5 -7
- package/dist/esm/utils/create-styles.js.map +1 -1
- package/dist/types/app-router/client/TernSecureProvider.d.ts +15 -0
- package/dist/types/app-router/client/TernSecureProvider.d.ts.map +1 -0
- package/dist/{cjs → types}/app-router/server/TernSecureServerProvider.d.ts +5 -7
- package/dist/types/app-router/server/TernSecureServerProvider.d.ts.map +1 -0
- package/dist/types/app-router/server/auth.d.ts +7 -0
- package/dist/types/app-router/server/auth.d.ts.map +1 -0
- package/dist/types/boundary/TernSecureCtx.d.ts +12 -0
- package/dist/types/boundary/TernSecureCtx.d.ts.map +1 -0
- package/dist/types/boundary/hooks/useAuth.d.ts +3 -0
- package/dist/types/boundary/hooks/useAuth.d.ts.map +1 -0
- package/dist/{cjs → types}/components/sign-in.d.ts +3 -6
- package/dist/types/components/sign-in.d.ts.map +1 -0
- package/dist/{cjs → types}/errors.d.ts +3 -4
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{cjs → types}/types.d.ts +5 -7
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/client-init.d.ts +4 -0
- package/dist/types/utils/client-init.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/config.d.ts +5 -8
- package/dist/types/utils/config.d.ts.map +1 -0
- package/dist/{cjs → types}/utils/create-styles.d.ts +4 -5
- package/dist/types/utils/create-styles.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/cjs/app-router/client/TernSecureProvider.d.ts +0 -17
- package/dist/cjs/app-router/server/auth.d.ts +0 -9
- package/dist/cjs/boundary/TernSecureCtx.d.ts +0 -15
- package/dist/cjs/boundary/hooks/useAuth.d.ts +0 -7
- package/dist/cjs/index.d.ts +0 -19
- package/dist/cjs/utils/client-init.d.ts +0 -9
- package/dist/esm/app-router/client/TernSecureProvider.d.mts +0 -17
- package/dist/esm/app-router/server/TernSecureServerProvider.d.mts +0 -30
- package/dist/esm/app-router/server/auth.d.mts +0 -9
- package/dist/esm/boundary/TernSecureCtx.d.mts +0 -15
- package/dist/esm/boundary/hooks/useAuth.d.mts +0 -7
- package/dist/esm/components/sign-in.d.mts +0 -25
- package/dist/esm/errors.d.mts +0 -10
- package/dist/esm/index.d.mts +0 -19
- package/dist/esm/types.d.mts +0 -49
- package/dist/esm/utils/client-init.d.mts +0 -9
- package/dist/esm/utils/config.d.mts +0 -22
- package/dist/esm/utils/create-styles.d.mts +0 -100
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/create-styles.ts"],"sourcesContent":["'use client'\r\n\r\nconst PREFIX = 'tern'\r\n\r\n// Singleton to track style injection\r\nconst styleInjection = {\r\n isInjected: false,\r\n styleElement: null as HTMLStyleElement | null\r\n}\r\n\r\nexport const defaultClassNames = {\r\n container: `${PREFIX}-container`,\r\n header: `${PREFIX}-header`,\r\n title: `${PREFIX}-title`,\r\n formWrapper: `${PREFIX}-formWrapper`,\r\n formContainer: `${PREFIX}-formContainer`,\r\n form: `${PREFIX}-form`,\r\n label: `${PREFIX}-label`,\r\n input: `${PREFIX}-input`,\r\n button: `${PREFIX}-button`,\r\n error: `${PREFIX}-error`\r\n} as const\r\n\r\n// Create styles once and cache them\r\nfunction createStyleSheet(styles: Record<string, React.CSSProperties>) {\r\n if (typeof window === 'undefined') return defaultClassNames\r\n\r\n // Return early if styles are already injected\r\n if (styleInjection.isInjected) {\r\n return defaultClassNames\r\n }\r\n\r\n // Find existing style element or create new one\r\n let styleElement = document.querySelector<HTMLStyleElement>('[data-tern-secure]')\r\n \r\n if (!styleElement) {\r\n styleElement = document.createElement('style')\r\n styleElement.setAttribute('data-tern-secure', '')\r\n document.head.appendChild(styleElement)\r\n styleInjection.styleElement = styleElement\r\n }\r\n\r\n // Create CSS rules\r\n const cssRules = Object.entries(styles).map(([key, rules]) => {\r\n const className = defaultClassNames[key as keyof typeof defaultClassNames]\r\n const cssProperties = Object.entries(rules).map(([prop, value]) => {\r\n const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase()\r\n return `${cssProperty}: ${value};`\r\n }).join(' ')\r\n\r\n return `.${className} { ${cssProperties} }`\r\n }).join('\\n')\r\n\r\n // Insert styles only once\r\n styleElement.textContent = cssRules\r\n styleInjection.isInjected = true\r\n\r\n return defaultClassNames\r\n}\r\n\r\n// Style configuration\r\nexport const styleConfig = {\r\n container: {\r\n display: 'flex',\r\n minHeight: '100%',\r\n flex: '1',\r\n flexDirection: 'column',\r\n justifyContent: 'center',\r\n padding: '3rem 1.5rem'\r\n },\r\n header: {\r\n margin: '0 auto',\r\n width: '100%',\r\n maxWidth: '28rem'\r\n },\r\n title: {\r\n marginTop: '1.5rem',\r\n textAlign: 'center',\r\n fontSize: '1.875rem',\r\n fontWeight: '700',\r\n lineHeight: '2.25rem',\r\n letterSpacing: '-0.025em',\r\n color: 'var(--tern-text-primary, #111827)'\r\n },\r\n formWrapper: {\r\n marginTop: '2.5rem',\r\n margin: '0 auto',\r\n width: '100%',\r\n maxWidth: '30rem'\r\n },\r\n formContainer: {\r\n padding: '3rem 1.5rem',\r\n boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',\r\n borderRadius: '0.5rem',\r\n backgroundColor: 'var(--tern-background, white)'\r\n },\r\n form: {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '1rem'\r\n },\r\n label: {\r\n display: 'block',\r\n fontSize: '0.875rem',\r\n fontWeight: '500',\r\n color: 'var(--tern-text-secondary, #374151)'\r\n },\r\n input: {\r\n marginTop: '0.25rem',\r\n display: 'block',\r\n width: '100%',\r\n padding: '0.5rem 0.75rem',\r\n borderRadius: '0.375rem',\r\n border: '1px solid var(--tern-border, #D1D5DB)',\r\n backgroundColor: 'var(--tern-input-background, white)',\r\n color: 'var(--tern-text-primary, #111827)'\r\n },\r\n button: {\r\n display: 'flex',\r\n width: '100%',\r\n justifyContent: 'center',\r\n padding: '0.5rem 1rem',\r\n fontSize: '0.875rem',\r\n fontWeight: '500',\r\n color: 'white',\r\n backgroundColor: 'var(--tern-primary, #2563EB)',\r\n border: 'none',\r\n borderRadius: '0.375rem',\r\n cursor: 'pointer'\r\n },\r\n error: {\r\n color: 'var(--tern-error, #DC2626)',\r\n fontSize: '0.875rem'\r\n }\r\n} as const\r\n\r\n// Export pre-created styles\r\nexport const styles = createStyleSheet(styleConfig)\r\n\r\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/create-styles.ts"],"sourcesContent":["'use client'\r\n\r\nconst PREFIX = 'tern'\r\n\r\n// Singleton to track style injection\r\nconst styleInjection = {\r\n isInjected: false,\r\n styleElement: null as HTMLStyleElement | null\r\n}\r\n\r\nexport const defaultClassNames = {\r\n container: `${PREFIX}-container`,\r\n header: `${PREFIX}-header`,\r\n title: `${PREFIX}-title`,\r\n formWrapper: `${PREFIX}-formWrapper`,\r\n formContainer: `${PREFIX}-formContainer`,\r\n form: `${PREFIX}-form`,\r\n label: `${PREFIX}-label`,\r\n input: `${PREFIX}-input`,\r\n button: `${PREFIX}-button`,\r\n error: `${PREFIX}-error`\r\n} as const\r\n\r\n// Create styles once and cache them\r\nfunction createStyleSheet(styles: Record<string, React.CSSProperties>) {\r\n if (typeof window === 'undefined') return defaultClassNames\r\n\r\n // Return early if styles are already injected\r\n if (styleInjection.isInjected) {\r\n return defaultClassNames\r\n }\r\n\r\n // Find existing style element or create new one\r\n let styleElement = document.querySelector<HTMLStyleElement>('[data-tern-secure]')\r\n \r\n if (!styleElement) {\r\n styleElement = document.createElement('style')\r\n styleElement.setAttribute('data-tern-secure', '')\r\n document.head.appendChild(styleElement)\r\n styleInjection.styleElement = styleElement\r\n }\r\n\r\n // Create CSS rules\r\n const cssRules = Object.entries(styles).map(([key, rules]) => {\r\n const className = defaultClassNames[key as keyof typeof defaultClassNames]\r\n const cssProperties = Object.entries(rules).map(([prop, value]) => {\r\n const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase()\r\n return `${cssProperty}: ${value};`\r\n }).join(' ')\r\n\r\n return `.${className} { ${cssProperties} }`\r\n }).join('\\n')\r\n\r\n // Insert styles only once\r\n styleElement.textContent = cssRules\r\n styleInjection.isInjected = true\r\n\r\n return defaultClassNames\r\n}\r\n\r\n// Style configuration\r\nexport const styleConfig = {\r\n container: {\r\n display: 'flex',\r\n minHeight: '100%',\r\n flex: '1',\r\n flexDirection: 'column',\r\n justifyContent: 'center',\r\n padding: '3rem 1.5rem'\r\n },\r\n header: {\r\n margin: '0 auto',\r\n width: '100%',\r\n maxWidth: '28rem'\r\n },\r\n title: {\r\n marginTop: '1.5rem',\r\n textAlign: 'center',\r\n fontSize: '1.875rem',\r\n fontWeight: '700',\r\n lineHeight: '2.25rem',\r\n letterSpacing: '-0.025em',\r\n color: 'var(--tern-text-primary, #111827)'\r\n },\r\n formWrapper: {\r\n marginTop: '2.5rem',\r\n margin: '0 auto',\r\n width: '100%',\r\n maxWidth: '30rem'\r\n },\r\n formContainer: {\r\n padding: '3rem 1.5rem',\r\n boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',\r\n borderRadius: '0.5rem',\r\n backgroundColor: 'var(--tern-background, white)'\r\n },\r\n form: {\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '1rem'\r\n },\r\n label: {\r\n display: 'block',\r\n fontSize: '0.875rem',\r\n fontWeight: '500',\r\n color: 'var(--tern-text-secondary, #374151)'\r\n },\r\n input: {\r\n marginTop: '0.25rem',\r\n display: 'block',\r\n width: '100%',\r\n padding: '0.5rem 0.75rem',\r\n borderRadius: '0.375rem',\r\n border: '1px solid var(--tern-border, #D1D5DB)',\r\n backgroundColor: 'var(--tern-input-background, white)',\r\n color: 'var(--tern-text-primary, #111827)'\r\n },\r\n button: {\r\n display: 'flex',\r\n width: '100%',\r\n justifyContent: 'center',\r\n padding: '0.5rem 1rem',\r\n fontSize: '0.875rem',\r\n fontWeight: '500',\r\n color: 'white',\r\n backgroundColor: 'var(--tern-primary, #2563EB)',\r\n border: 'none',\r\n borderRadius: '0.375rem',\r\n cursor: 'pointer'\r\n },\r\n error: {\r\n color: 'var(--tern-error, #DC2626)',\r\n fontSize: '0.875rem'\r\n }\r\n} as const\r\n\r\n// Export pre-created styles\r\nexport const styles = createStyleSheet(styleConfig)\r\n\r\n"],"mappings":"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","names":["styles"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TernSecureState = {
|
|
3
|
+
userId: string | null;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
isSignedIn: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const AuthStateContext: React.Context<TernSecureState | null>;
|
|
9
|
+
interface TernSecureClientProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
initialState: TernSecureState;
|
|
12
|
+
}
|
|
13
|
+
export declare function TernSecureClientProvider({ children, initialState }: TernSecureClientProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=TernSecureProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TernSecureProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/client/TernSecureProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAKlD,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,gBAAgB,uCAAoD,CAAA;AAEjF,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,EAAE,eAAe,CAAA;CAC9B;AAID,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,YAAY,EACZ,EAAE,qBAAqB,2CAgCxB"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
4
2
|
interface TernSecureServerProviderProps {
|
|
5
|
-
children:
|
|
3
|
+
children: React.ReactNode;
|
|
6
4
|
}
|
|
7
5
|
/**
|
|
8
6
|
* Root Provider for TernSecure
|
|
@@ -25,6 +23,6 @@ interface TernSecureServerProviderProps {
|
|
|
25
23
|
* )
|
|
26
24
|
* }
|
|
27
25
|
*/
|
|
28
|
-
declare function TernSecureServerProvider({ children }: TernSecureServerProviderProps): Promise<
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export declare function TernSecureServerProvider({ children }: TernSecureServerProviderProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
27
|
+
export type { TernSecureServerProviderProps };
|
|
28
|
+
//# sourceMappingURL=TernSecureServerProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TernSecureServerProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,UAAU,6BAA6B;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,QAAQ,EACT,EAAE,6BAA6B,oDAgB/B;AAGD,YAAY,EAAE,6BAA6B,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type UserCredential } from 'firebase/auth';
|
|
2
|
+
export interface SignInCredentials {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function signInWithEmail({ email, password }: SignInCredentials): Promise<UserCredential>;
|
|
7
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/app-router/server/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAE/E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,QAAQ,EACT,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAG7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type TernSecureCtxValue = {
|
|
2
|
+
_contextKey: Symbol;
|
|
3
|
+
};
|
|
4
|
+
export declare const useInternalContext: (hookname: string) => TernSecureCtxValue;
|
|
5
|
+
/**
|
|
6
|
+
* Provider component for TernSecure
|
|
7
|
+
* Must be used in client components only
|
|
8
|
+
*/
|
|
9
|
+
export declare function TernSecureCtxProvider({ children }: {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=TernSecureCtx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TernSecureCtx.d.ts","sourceRoot":"","sources":["../../../src/boundary/TernSecureCtx.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AASD,eAAO,MAAM,kBAAkB,aAAc,MAAM,uBAWlD,CAAA;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQhF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../../src/boundary/hooks/useAuth.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,4CAA4C,CAAA;AAEnG,wBAAgB,OAAO,IAAI,eAAe,CAiBzC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
interface SignInProps {
|
|
2
|
+
export interface SignInProps {
|
|
5
3
|
onSuccess?: () => void;
|
|
6
4
|
onError?: (error: Error) => void;
|
|
7
5
|
redirectUrl?: string;
|
|
@@ -20,6 +18,5 @@ interface SignInProps {
|
|
|
20
18
|
label?: string;
|
|
21
19
|
};
|
|
22
20
|
}
|
|
23
|
-
declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps):
|
|
24
|
-
|
|
25
|
-
export { SignIn, type SignInProps };
|
|
21
|
+
export declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=sign-in.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in.d.ts","sourceRoot":"","sources":["../../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,YAAY,CAAC,EAAE;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAc,EACd,KAAK,EACL,YAAiB,EAClB,EAAE,WAAW,2CAmGb"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
declare const ERRORS: {
|
|
1
|
+
export declare const ERRORS: {
|
|
2
2
|
readonly SERVER_SIDE_INITIALIZATION: "TernSecure must be initialized on the client side";
|
|
3
3
|
readonly NOT_INITIALIZED: "TernSecure services are not initialized. Call initializeTernSecure() first";
|
|
4
4
|
readonly HOOK_CONTEXT: (hookName: string) => string;
|
|
5
5
|
};
|
|
6
|
-
declare class TernSecureError extends Error {
|
|
6
|
+
export declare class TernSecureError extends Error {
|
|
7
7
|
constructor(message: string);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export { ERRORS, TernSecureError };
|
|
9
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;sCAGU,MAAM;CACvB,CAAC;AAEX,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TernSecureServerProvider } from './app-router/server/TernSecureServerProvider';
|
|
2
|
+
import type { TernSecureState } from './app-router/client/TernSecureProvider';
|
|
3
|
+
export { TernSecureAuth, TernSecureFirestore } from './utils/client-init';
|
|
4
|
+
export { loadFireConfig, validateConfig } from './utils/config';
|
|
5
|
+
export { signInWithEmail } from './app-router/server/auth';
|
|
6
|
+
export { useAuth } from './boundary/hooks/useAuth';
|
|
7
|
+
export { SignIn } from './components/sign-in';
|
|
8
|
+
export declare const TernSecureProvider: typeof TernSecureServerProvider;
|
|
9
|
+
export type { TernSecureState };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAI1D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,eAAO,MAAM,kBAAkB,iCAA2B,CAAA;AAC1D,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { FirebaseOptions } from 'firebase/app';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* TernSecure Firebase configuration interface
|
|
5
4
|
* Extends Firebase's base configuration options
|
|
6
5
|
*/
|
|
7
|
-
interface TernSecureConfig extends FirebaseOptions {
|
|
6
|
+
export interface TernSecureConfig extends FirebaseOptions {
|
|
8
7
|
apiKey: string;
|
|
9
8
|
authDomain: string;
|
|
10
9
|
projectId: string;
|
|
@@ -16,7 +15,7 @@ interface TernSecureConfig extends FirebaseOptions {
|
|
|
16
15
|
/**
|
|
17
16
|
* TernSecure initialization options
|
|
18
17
|
*/
|
|
19
|
-
interface TernSecureOptions {
|
|
18
|
+
export interface TernSecureOptions {
|
|
20
19
|
/** Environment setting for different configurations */
|
|
21
20
|
environment?: 'development' | 'production';
|
|
22
21
|
/** Geographic region for data storage */
|
|
@@ -29,7 +28,7 @@ interface TernSecureOptions {
|
|
|
29
28
|
/**
|
|
30
29
|
* Firebase initialization state
|
|
31
30
|
*/
|
|
32
|
-
interface FirebaseState {
|
|
31
|
+
export interface FirebaseState {
|
|
33
32
|
/** Whether Firebase has been initialized */
|
|
34
33
|
initialized: boolean;
|
|
35
34
|
/** Any initialization errors */
|
|
@@ -40,10 +39,9 @@ interface FirebaseState {
|
|
|
40
39
|
/**
|
|
41
40
|
* Configuration validation result
|
|
42
41
|
*/
|
|
43
|
-
interface ConfigValidationResult {
|
|
42
|
+
export interface ConfigValidationResult {
|
|
44
43
|
isValid: boolean;
|
|
45
44
|
errors: string[];
|
|
46
45
|
config: TernSecureConfig;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
export type { ConfigValidationResult, FirebaseState, TernSecureConfig, TernSecureOptions };
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,WAAW,CAAC,EAAE,aAAa,GAAG,YAAY,CAAA;IAC1C,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,sBAAsB;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,WAAW,EAAE,OAAO,CAAA;IACpB,gCAAgC;IAChC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,gBAAgB,CAAA;CACzB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const TernSecureAuth: () => import("@firebase/auth").Auth;
|
|
2
|
+
export declare const TernSecureFirestore: () => import("@firebase/firestore").Firestore;
|
|
3
|
+
export declare const TernSecureStorage: () => import("@firebase/storage").FirebaseStorage;
|
|
4
|
+
//# sourceMappingURL=client-init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-init.d.ts","sourceRoot":"","sources":["../../../src/utils/client-init.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,qCAAa,CAAC;AACzC,eAAO,MAAM,mBAAmB,+CAAkB,CAAC;AACnD,eAAO,MAAM,iBAAiB,mDAAgB,CAAC"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { TernSecureConfig, ConfigValidationResult } from '../types
|
|
2
|
-
import 'firebase/app';
|
|
3
|
-
|
|
1
|
+
import { TernSecureConfig, ConfigValidationResult } from '../types';
|
|
4
2
|
/**
|
|
5
3
|
* Loads Firebase configuration from environment variables
|
|
6
4
|
* @returns {TernSecureConfig} Firebase configuration object
|
|
7
5
|
*/
|
|
8
|
-
declare const loadFireConfig: () => TernSecureConfig;
|
|
6
|
+
export declare const loadFireConfig: () => TernSecureConfig;
|
|
9
7
|
/**
|
|
10
8
|
* Validates Firebase configuration
|
|
11
9
|
* @param {TernSecureConfig} config - Firebase configuration object
|
|
12
10
|
* @throws {Error} If required configuration values are missing
|
|
13
11
|
* @returns {TernSecureConfig} Validated configuration object
|
|
14
12
|
*/
|
|
15
|
-
declare const validateConfig: (config: TernSecureConfig) => ConfigValidationResult;
|
|
13
|
+
export declare const validateConfig: (config: TernSecureConfig) => ConfigValidationResult;
|
|
16
14
|
/**
|
|
17
15
|
* Initializes configuration with validation
|
|
18
16
|
* @throws {Error} If configuration is invalid
|
|
19
17
|
*/
|
|
20
|
-
declare const initializeConfig: () => TernSecureConfig;
|
|
21
|
-
|
|
22
|
-
export { initializeConfig, loadFireConfig, validateConfig };
|
|
18
|
+
export declare const initializeConfig: () => TernSecureConfig;
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEnE;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,gBAQhC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,WAAY,gBAAgB,KAAG,sBAuBzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,gBAWnC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const defaultClassNames: {
|
|
1
|
+
export declare const defaultClassNames: {
|
|
2
2
|
readonly container: "tern-container";
|
|
3
3
|
readonly header: "tern-header";
|
|
4
4
|
readonly title: "tern-title";
|
|
@@ -10,7 +10,7 @@ declare const defaultClassNames: {
|
|
|
10
10
|
readonly button: "tern-button";
|
|
11
11
|
readonly error: "tern-error";
|
|
12
12
|
};
|
|
13
|
-
declare const styleConfig: {
|
|
13
|
+
export declare const styleConfig: {
|
|
14
14
|
readonly container: {
|
|
15
15
|
readonly display: "flex";
|
|
16
16
|
readonly minHeight: "100%";
|
|
@@ -84,7 +84,7 @@ declare const styleConfig: {
|
|
|
84
84
|
readonly fontSize: "0.875rem";
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
declare const styles: {
|
|
87
|
+
export declare const styles: {
|
|
88
88
|
readonly container: "tern-container";
|
|
89
89
|
readonly header: "tern-header";
|
|
90
90
|
readonly title: "tern-title";
|
|
@@ -96,5 +96,4 @@ declare const styles: {
|
|
|
96
96
|
readonly button: "tern-button";
|
|
97
97
|
readonly error: "tern-error";
|
|
98
98
|
};
|
|
99
|
-
|
|
100
|
-
export { defaultClassNames, styleConfig, styles };
|
|
99
|
+
//# sourceMappingURL=create-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-styles.d.ts","sourceRoot":"","sources":["../../../src/utils/create-styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB;;;;;;;;;;;CAWpB,CAAA;AAwCV,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEd,CAAA;AAGV,eAAO,MAAM,MAAM;;;;;;;;;;;CAAgC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/nextjs",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.84",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"packageManager": "npm@10.9.0",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public",
|
|
@@ -15,9 +16,8 @@
|
|
|
15
16
|
},
|
|
16
17
|
"homepage": "https://github.com/tern-secure/nextjs#readme",
|
|
17
18
|
"scripts": {
|
|
18
|
-
"build": "npm run clean && tsup",
|
|
19
|
-
"build:js": "node build.config.cjs",
|
|
20
19
|
"clean": "rimraf dist",
|
|
20
|
+
"build": "npm run clean && tsup && tsc -p tsconfig.add.json",
|
|
21
21
|
"dev": "tsup --watch",
|
|
22
22
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
23
23
|
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tsup": "^8.3.5",
|
|
43
43
|
"typescript": "^5.7.2"
|
|
44
44
|
},
|
|
45
|
-
"types": "./dist/index.d.ts",
|
|
45
|
+
"types": "./dist/types/index.d.ts",
|
|
46
46
|
"files": [
|
|
47
47
|
"dist"
|
|
48
48
|
],
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"exports": {
|
|
57
57
|
".": {
|
|
58
|
-
"types": "./dist/
|
|
58
|
+
"types": "./dist/types/index.d.ts",
|
|
59
59
|
"import": "./dist/esm/index.js",
|
|
60
60
|
"require": "./dist/cjs/index.js"
|
|
61
61
|
},
|
|
@@ -1,17 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
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 };
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,17 +0,0 @@
|
|
|
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 };
|
|
@@ -1,30 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|
|
@@ -1,15 +0,0 @@
|
|
|
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 };
|
|
@@ -1,25 +0,0 @@
|
|
|
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/esm/errors.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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/esm/index.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TernSecureServerProvider } from './app-router/server/TernSecureServerProvider.mjs';
|
|
2
|
-
export { TernSecureState } from './app-router/client/TernSecureProvider.mjs';
|
|
3
|
-
export { TernSecureAuth, TernSecureFirestore } from './utils/client-init.mjs';
|
|
4
|
-
export { loadFireConfig, validateConfig } from './utils/config.mjs';
|
|
5
|
-
export { signInWithEmail } from './app-router/server/auth.mjs';
|
|
6
|
-
export { useAuth } from './boundary/hooks/useAuth.mjs';
|
|
7
|
-
export { SignIn } from './components/sign-in.mjs';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
import 'react';
|
|
10
|
-
import '@firebase/storage';
|
|
11
|
-
import '@firebase/firestore';
|
|
12
|
-
import '@firebase/auth';
|
|
13
|
-
import './types.mjs';
|
|
14
|
-
import 'firebase/app';
|
|
15
|
-
import 'firebase/auth';
|
|
16
|
-
|
|
17
|
-
declare const TernSecureProvider: typeof TernSecureServerProvider;
|
|
18
|
-
|
|
19
|
-
export { TernSecureProvider };
|
package/dist/esm/types.d.mts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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 };
|
|
@@ -1,9 +0,0 @@
|
|
|
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 };
|