@tern-secure/react 1.1.5 → 1.1.6
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/ctx/AuthProvider.d.mts +13 -3
- package/dist/ctx/AuthProvider.d.ts +13 -3
- package/dist/ctx/AuthProvider.js +1 -1
- package/dist/ctx/AuthProvider.js.map +1 -1
- package/dist/ctx/AuthProvider.mjs +1 -1
- package/dist/ctx/AuthProvider.mjs.map +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.d.mts +5 -5
- package/dist/ctx/IsomorphicTernSecureCtx.d.ts +5 -5
- package/dist/ctx/IsomorphicTernSecureCtx.js +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.js.map +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.mjs +1 -1
- package/dist/ctx/IsomorphicTernSecureCtx.mjs.map +1 -1
- package/dist/ctx/TernSecureAuthResourcesCtx.d.mts +6 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.d.ts +6 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.js +2 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.js.map +1 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.mjs +2 -0
- package/dist/ctx/TernSecureAuthResourcesCtx.mjs.map +1 -0
- package/dist/ctx/TernSecureCtxProvider.d.mts +6 -8
- package/dist/ctx/TernSecureCtxProvider.d.ts +6 -8
- package/dist/ctx/TernSecureCtxProvider.js +1 -1
- package/dist/ctx/TernSecureCtxProvider.js.map +1 -1
- package/dist/ctx/TernSecureCtxProvider.mjs +1 -1
- package/dist/ctx/TernSecureCtxProvider.mjs.map +1 -1
- package/dist/ctx/TernSecureProvider.js +1 -1
- package/dist/ctx/TernSecureProvider.js.map +1 -1
- package/dist/ctx/TernSecureProvider.mjs +1 -1
- package/dist/ctx/TernSecureProvider.mjs.map +1 -1
- package/dist/hooks/useAssertWrappedTernSecureProvider.d.mts +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.d.ts +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.js +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.js.map +1 -1
- package/dist/hooks/useAssertWrappedTernSecureProvider.mjs +2 -2
- package/dist/hooks/useAssertWrappedTernSecureProvider.mjs.map +1 -1
- package/dist/hooks/useAuth.d.mts +2 -2
- package/dist/hooks/useAuth.d.ts +2 -2
- package/dist/hooks/useAuth.js +1 -1
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useAuth.mjs +1 -1
- package/dist/hooks/useAuth.mjs.map +1 -1
- package/dist/hooks/useIdToken.js +1 -1
- package/dist/hooks/useIdToken.js.map +1 -1
- package/dist/hooks/useIdToken.mjs +1 -1
- package/dist/hooks/useIdToken.mjs.map +1 -1
- package/dist/hooks/useSession.js +1 -1
- package/dist/hooks/useSession.js.map +1 -1
- package/dist/hooks/useSession.mjs +1 -1
- package/dist/hooks/useSession.mjs.map +1 -1
- package/dist/hooks/useSignIn.d.mts +17 -0
- package/dist/hooks/useSignIn.d.ts +17 -0
- package/dist/hooks/useSignIn.js +2 -0
- package/dist/hooks/useSignIn.js.map +1 -0
- package/dist/hooks/useSignIn.mjs +2 -0
- package/dist/hooks/useSignIn.mjs.map +1 -0
- package/dist/index.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/lib/isoTernSecureAuth.d.mts +46 -0
- package/dist/lib/isoTernSecureAuth.d.ts +46 -0
- package/dist/lib/isoTernSecureAuth.js +2 -0
- package/dist/lib/isoTernSecureAuth.js.map +1 -0
- package/dist/lib/isoTernSecureAuth.mjs +2 -0
- package/dist/lib/isoTernSecureAuth.mjs.map +1 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/types.d.mts +16 -6
- package/dist/types.d.ts +16 -6
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/config.js +2 -2
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/config.mjs +3 -3
- package/dist/utils/config.mjs.map +1 -1
- package/dist/utils/construct.js.map +1 -1
- package/dist/utils/construct.mjs +1 -1
- package/dist/utils/construct.mjs.map +1 -1
- package/dist/utils/debug.js +1 -1
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/debug.mjs +1 -1
- package/dist/utils/debug.mjs.map +1 -1
- package/package.json +6 -5
- package/dist/client/actions.d.mts +0 -2
- package/dist/client/actions.d.ts +0 -2
- package/dist/client/actions.js +0 -2
- package/dist/client/actions.js.map +0 -1
- package/dist/client/actions.mjs +0 -1
- package/dist/client/actions.mjs.map +0 -1
- package/dist/client/session.d.mts +0 -9
- package/dist/client/session.d.ts +0 -9
- package/dist/client/session.js +0 -2
- package/dist/client/session.js.map +0 -1
- package/dist/client/session.mjs +0 -2
- package/dist/client/session.mjs.map +0 -1
- package/dist/components/TernSecureHostRenderer.d.mts +0 -32
- package/dist/components/TernSecureHostRenderer.d.ts +0 -32
- package/dist/components/TernSecureHostRenderer.js +0 -2
- package/dist/components/TernSecureHostRenderer.js.map +0 -1
- package/dist/components/TernSecureHostRenderer.mjs +0 -2
- package/dist/components/TernSecureHostRenderer.mjs.map +0 -1
- package/dist/components/background.d.mts +0 -5
- package/dist/components/background.d.ts +0 -5
- package/dist/components/background.js +0 -2
- package/dist/components/background.js.map +0 -1
- package/dist/components/background.mjs +0 -2
- package/dist/components/background.mjs.map +0 -1
- package/dist/components/old.d.mts +0 -2
- package/dist/components/old.d.ts +0 -2
- package/dist/components/old.js +0 -2
- package/dist/components/old.js.map +0 -1
- package/dist/components/old.mjs +0 -1
- package/dist/components/old.mjs.map +0 -1
- package/dist/components/uiComponent.d.mts +0 -30
- package/dist/components/uiComponent.d.ts +0 -30
- package/dist/components/uiComponent.js +0 -2
- package/dist/components/uiComponent.js.map +0 -1
- package/dist/components/uiComponent.mjs +0 -2
- package/dist/components/uiComponent.mjs.map +0 -1
- package/dist/components/withTernSecure.d.mts +0 -19
- package/dist/components/withTernSecure.d.ts +0 -19
- package/dist/components/withTernSecure.js +0 -2
- package/dist/components/withTernSecure.js.map +0 -1
- package/dist/components/withTernSecure.mjs +0 -2
- package/dist/components/withTernSecure.mjs.map +0 -1
- package/dist/hooks/useAuthState.d.mts +0 -17
- package/dist/hooks/useAuthState.d.ts +0 -17
- package/dist/hooks/useAuthState.js +0 -2
- package/dist/hooks/useAuthState.js.map +0 -1
- package/dist/hooks/useAuthState.mjs +0 -2
- package/dist/hooks/useAuthState.mjs.map +0 -1
- package/dist/hooks/useMaxAllowedInstances.d.mts +0 -6
- package/dist/hooks/useMaxAllowedInstances.d.ts +0 -6
- package/dist/hooks/useMaxAllowedInstances.js +0 -2
- package/dist/hooks/useMaxAllowedInstances.js.map +0 -1
- package/dist/hooks/useMaxAllowedInstances.mjs +0 -2
- package/dist/hooks/useMaxAllowedInstances.mjs.map +0 -1
- package/dist/hooks/useSignUp.d.mts +0 -13
- package/dist/hooks/useSignUp.d.ts +0 -13
- package/dist/hooks/useSignUp.js +0 -2
- package/dist/hooks/useSignUp.js.map +0 -1
- package/dist/hooks/useSignUp.mjs +0 -2
- package/dist/hooks/useSignUp.mjs.map +0 -1
- package/dist/hooks/useWaitForComponentMount.d.mts +0 -8
- package/dist/hooks/useWaitForComponentMount.d.ts +0 -8
- package/dist/hooks/useWaitForComponentMount.js +0 -2
- package/dist/hooks/useWaitForComponentMount.js.map +0 -1
- package/dist/hooks/useWaitForComponentMount.mjs +0 -2
- package/dist/hooks/useWaitForComponentMount.mjs.map +0 -1
- package/dist/lib/isomorphicTernSecure.d.mts +0 -73
- package/dist/lib/isomorphicTernSecure.d.ts +0 -73
- package/dist/lib/isomorphicTernSecure.js +0 -2
- package/dist/lib/isomorphicTernSecure.js.map +0 -1
- package/dist/lib/isomorphicTernSecure.mjs +0 -2
- package/dist/lib/isomorphicTernSecure.mjs.map +0 -1
- package/dist/types/auth.d.mts +0 -2
- package/dist/types/auth.d.ts +0 -2
- package/dist/types/auth.js +0 -2
- package/dist/types/auth.js.map +0 -1
- package/dist/types/auth.mjs +0 -1
- package/dist/types/auth.mjs.map +0 -1
- package/dist/types/client/actions.d.ts +0 -2
- package/dist/types/client/actions.d.ts.map +0 -1
- package/dist/types/client/session.d.ts +0 -7
- package/dist/types/client/session.d.ts.map +0 -1
- package/dist/types/components/TernSecureHostRenderer.d.ts +0 -30
- package/dist/types/components/TernSecureHostRenderer.d.ts.map +0 -1
- package/dist/types/components/background.d.ts +0 -2
- package/dist/types/components/background.d.ts.map +0 -1
- package/dist/types/components/old.d.ts +0 -2
- package/dist/types/components/old.d.ts.map +0 -1
- package/dist/types/components/uiComponent.d.ts +0 -27
- package/dist/types/components/uiComponent.d.ts.map +0 -1
- package/dist/types/components/withTernSecure.d.ts +0 -16
- package/dist/types/components/withTernSecure.d.ts.map +0 -1
- package/dist/types/ctx/AuthProvider.d.ts +0 -3
- package/dist/types/ctx/AuthProvider.d.ts.map +0 -1
- package/dist/types/ctx/IsomorphicTernSecureCtx.d.ts +0 -6
- package/dist/types/ctx/IsomorphicTernSecureCtx.d.ts.map +0 -1
- package/dist/types/ctx/SessionCtx.d.ts +0 -2
- package/dist/types/ctx/SessionCtx.d.ts.map +0 -1
- package/dist/types/ctx/TernSecureCtxProvider.d.ts +0 -14
- package/dist/types/ctx/TernSecureCtxProvider.d.ts.map +0 -1
- package/dist/types/ctx/TernSecureProvider.d.ts +0 -6
- package/dist/types/ctx/TernSecureProvider.d.ts.map +0 -1
- package/dist/types/ctx/UserCtx.d.ts +0 -2
- package/dist/types/ctx/UserCtx.d.ts.map +0 -1
- package/dist/types/hooks/useAssertWrappedTernSecureProvider.d.ts +0 -2
- package/dist/types/hooks/useAssertWrappedTernSecureProvider.d.ts.map +0 -1
- package/dist/types/hooks/useAuth.d.ts +0 -3
- package/dist/types/hooks/useAuth.d.ts.map +0 -1
- package/dist/types/hooks/useAuthState.d.ts +0 -14
- package/dist/types/hooks/useAuthState.d.ts.map +0 -1
- package/dist/types/hooks/useIdToken.d.ts +0 -19
- package/dist/types/hooks/useIdToken.d.ts.map +0 -1
- package/dist/types/hooks/useMaxAllowedInstances.d.ts +0 -4
- package/dist/types/hooks/useMaxAllowedInstances.d.ts.map +0 -1
- package/dist/types/hooks/useSession.d.ts +0 -12
- package/dist/types/hooks/useSession.d.ts.map +0 -1
- package/dist/types/hooks/useSignUp.d.ts +0 -11
- package/dist/types/hooks/useSignUp.d.ts.map +0 -1
- package/dist/types/hooks/useWaitForComponentMount.d.ts +0 -8
- package/dist/types/hooks/useWaitForComponentMount.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -14
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/isomorphicTernSecure.d.ts +0 -70
- package/dist/types/lib/isomorphicTernSecure.d.ts.map +0 -1
- package/dist/types/lib/utils.d.ts +0 -3
- package/dist/types/lib/utils.d.ts.map +0 -1
- package/dist/types/route-handler/internal-route.d.ts +0 -13
- package/dist/types/route-handler/internal-route.d.ts.map +0 -1
- package/dist/types/types/auth.d.ts +0 -2
- package/dist/types/types/auth.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -94
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/client-init.d.ts +0 -2
- package/dist/types/utils/client-init.d.ts.map +0 -1
- package/dist/types/utils/config.d.ts +0 -35
- package/dist/types/utils/config.d.ts.map +0 -1
- package/dist/types/utils/construct.d.ts +0 -38
- package/dist/types/utils/construct.d.ts.map +0 -1
- package/dist/types/utils/create-styles.d.ts +0 -99
- package/dist/types/utils/create-styles.d.ts.map +0 -1
- package/dist/types/utils/debug.d.ts +0 -13
- package/dist/types/utils/debug.d.ts.map +0 -1
- package/dist/types/utils/redirect.d.ts +0 -9
- package/dist/types/utils/redirect.d.ts.map +0 -1
- package/dist/utils/client-init.d.mts +0 -2
- package/dist/utils/client-init.d.ts +0 -2
- package/dist/utils/client-init.js +0 -2
- package/dist/utils/client-init.js.map +0 -1
- package/dist/utils/client-init.mjs +0 -1
- package/dist/utils/client-init.mjs.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { TernSecureInstanceTree,
|
|
1
|
+
import { TernSecureInstanceTree, TernSecureAuthOptions, TernSecureAuth, TernSecureState, TernSecureInstanceTreeOptions, TernSecureConfig } from '@tern-secure/types';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
apiKey?: string;
|
|
6
|
-
customDomain?: TernSecureInstanceTree[
|
|
7
|
-
proxyUrl?: TernSecureInstanceTree[
|
|
8
|
-
projectId?: TernSecureInstanceTree[
|
|
6
|
+
customDomain?: TernSecureInstanceTree["customDomain"];
|
|
7
|
+
proxyUrl?: TernSecureInstanceTree["proxyUrl"];
|
|
8
|
+
projectId?: TernSecureInstanceTree["projectId"];
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
@@ -68,7 +68,7 @@ interface HeadlessUIBrowserConstructor {
|
|
|
68
68
|
* TernSecureProviderProps
|
|
69
69
|
* @param interface
|
|
70
70
|
*/
|
|
71
|
-
type
|
|
71
|
+
type TernSecureProviderPropsOld = IsomorphicTernSecureOptions & {
|
|
72
72
|
children: React.ReactNode;
|
|
73
73
|
initialState?: TernSecureState;
|
|
74
74
|
loadingComponent?: React.ReactNode;
|
|
@@ -92,5 +92,15 @@ type IsomorphicTernSecureOptions = TernSecureInstanceTreeOptions & {
|
|
|
92
92
|
projectId?: string;
|
|
93
93
|
ternSecureConfig?: TernSecureConfig;
|
|
94
94
|
};
|
|
95
|
+
type TernSecureProviderProps = IsoTernSecureAuthOptions & {
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
initialState?: TernSecureState;
|
|
98
|
+
loadingComponent?: React.ReactNode;
|
|
99
|
+
bypassApiKey?: boolean;
|
|
100
|
+
};
|
|
101
|
+
type TernSecureAuthProps = TernSecureAuth | undefined | null;
|
|
102
|
+
type IsoTernSecureAuthOptions = TernSecureAuthOptions & {
|
|
103
|
+
TernSecureAuth?: TernSecureAuthProps;
|
|
104
|
+
};
|
|
95
105
|
|
|
96
|
-
export { type AuthError, type Browser, type BrowserConstructor, type ConfigValidationResult, type HeadlessUIBrowser, type HeadlessUIBrowserConstructor, type IsomorphicTernSecureOptions, type SignInResponse, type TernSecureAuthState, type TernSecureProps, type TernSecureProviderProps, type TernSecureUserData, type initialState, isSignInResponse };
|
|
106
|
+
export { type AuthError, type Browser, type BrowserConstructor, type ConfigValidationResult, type HeadlessUIBrowser, type HeadlessUIBrowserConstructor, type IsoTernSecureAuthOptions, type IsomorphicTernSecureOptions, type SignInResponse, type TernSecureAuthProps, type TernSecureAuthState, type TernSecureProps, type TernSecureProviderProps, type TernSecureProviderPropsOld, type TernSecureUserData, type initialState, isSignInResponse };
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var t in r)o(e,t,{get:r[t],enumerable:!0})},p=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of a(r))!c.call(e,n)&&n!==t&&o(e,n,{get:()=>r[n],enumerable:!(s=i(r,n))||s.enumerable});return e};var l=e=>p(o({},"__esModule",{value:!0}),e);var S={};u(S,{isSignInResponse:()=>d});module.exports=l(S);function d(e){return typeof e=="object"&&"success"in e&&typeof e.success=="boolean"}0&&(module.exports={isSignInResponse});
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n TernSecureAuth,\n TernSecureAuthOptions,\n TernSecureConfig,\n TernSecureInstanceTree,\n TernSecureInstanceTreeOptions,\n TernSecureState,\n} from \"@tern-secure/types\";\n\ndeclare global {\n interface Window {\n apiKey?: string;\n customDomain?: TernSecureInstanceTree[\"customDomain\"];\n proxyUrl?: TernSecureInstanceTree[\"proxyUrl\"];\n projectId?: TernSecureInstanceTree[\"projectId\"];\n }\n}\n\n/**\n * TernSecure User\n */\n//export type TernSecureUser = FirebaseUser\n\nexport type TernSecureUserData = {\n uid: string;\n email: string | null;\n emailVerified?: boolean;\n displayName?: string | null;\n};\n\n/**\n * TernSecure Firebase configuration interface\n * Extends Firebase's base configuration options\n */\n{\n /*export interface TernSecureConfig {\n apiKey: string\n authDomain: string\n projectId: string\n storageBucket: string\n messagingSenderId: string\n appId: string\n measurementId?: string\n}*/\n}\n\nexport interface SignInResponse {\n success: boolean;\n message?: string;\n error?: any | undefined;\n user?: any; // Consider a more specific user type if possible, e.g., TernSecureUserData | null\n}\n\nexport interface AuthError extends Error {\n code?: any | string; // Allow string for other potential errors, or be stricter with just AuthErrorCode\n message: string;\n response?: SignInResponse;\n}\n\nexport function isSignInResponse(value: any): value is SignInResponse {\n return (\n typeof value === \"object\" &&\n \"success\" in value &&\n typeof value.success === \"boolean\"\n );\n}\n\n/**\n * Configuration validation result\n */\nexport interface ConfigValidationResult {\n isValid: boolean;\n errors: string[];\n //config: TernSecureConfig\n}\n\n/**\n * TernSecureAuthState\n */\n\nexport type TernSecureAuthState = {\n userId: string | null;\n isLoaded: boolean;\n error: Error | null;\n isValid: boolean;\n isVerified: boolean;\n isAuthenticated: boolean;\n token: any | null;\n email: string | null;\n status: \"loading\" | \"authenticated\" | \"unauthenticated\" | \"unverified\";\n requiresVerification: boolean;\n};\n\n/**\n * TernSecureInitialState\n */\n\nexport type initialState = {\n userId: string | null;\n sessionId: string | undefined;\n};\n\nexport interface BrowserConstructor {\n new (customDomain?: string): Browser;\n}\n\nexport interface HeadlessUIBrowserConstructor {\n new (customDomain?: string): HeadlessUIBrowser;\n}\n/**\n * TernSecureProviderProps\n * @param interface\n */\n\nexport type TernSecureProviderPropsOld = IsomorphicTernSecureOptions & {\n children: React.ReactNode;\n initialState?: TernSecureState;\n loadingComponent?: React.ReactNode;\n bypassApiKey?: boolean;\n};\n\nexport interface HeadlessUIBrowser extends TernSecureInstanceTree {\n load: (options?: TernSecureInstanceTreeOptions) => Promise<void>;\n setTernAuth: (provider: any) => void;\n}\n\nexport interface Browser extends HeadlessUIBrowser {\n onComponentsReady: Promise<void>;\n components: any;\n}\n\nexport type TernSecureProps =\n | HeadlessUIBrowserConstructor\n | HeadlessUIBrowser\n | Browser\n | BrowserConstructor\n | null\n | undefined;\n\nexport type IsomorphicTernSecureOptions = TernSecureInstanceTreeOptions & {\n TernSecure?: TernSecureProps;\n ternUIVersion?: string;\n apiKey?: string;\n customDomain?: string;\n proxyUrl?: string;\n projectId?: string;\n ternSecureConfig?: TernSecureConfig;\n};\n\nexport type TernSecureProviderProps = IsoTernSecureAuthOptions & {\n children: React.ReactNode;\n initialState?: TernSecureState;\n loadingComponent?: React.ReactNode;\n bypassApiKey?: boolean;\n};\n\nexport type TernSecureAuthProps = TernSecureAuth | undefined | null;\n\nexport type IsoTernSecureAuthOptions = TernSecureAuthOptions & {\n TernSecureAuth?: TernSecureAuthProps;\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GA2DO,SAASE,EAAiBE,EAAqC,CACpE,OACE,OAAOA,GAAU,UACjB,YAAaA,GACb,OAAOA,EAAM,SAAY,SAE7B","names":["types_exports","__export","isSignInResponse","__toCommonJS","value"]}
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n TernSecureAuth,\n TernSecureAuthOptions,\n TernSecureConfig,\n TernSecureInstanceTree,\n TernSecureInstanceTreeOptions,\n TernSecureState,\n} from \"@tern-secure/types\";\n\ndeclare global {\n interface Window {\n apiKey?: string;\n customDomain?: TernSecureInstanceTree[\"customDomain\"];\n proxyUrl?: TernSecureInstanceTree[\"proxyUrl\"];\n projectId?: TernSecureInstanceTree[\"projectId\"];\n }\n}\n\n/**\n * TernSecure User\n */\n//export type TernSecureUser = FirebaseUser\n\nexport type TernSecureUserData = {\n uid: string;\n email: string | null;\n emailVerified?: boolean;\n displayName?: string | null;\n};\n\n/**\n * TernSecure Firebase configuration interface\n * Extends Firebase's base configuration options\n */\n{\n /*export interface TernSecureConfig {\n apiKey: string\n authDomain: string\n projectId: string\n storageBucket: string\n messagingSenderId: string\n appId: string\n measurementId?: string\n}*/\n}\n\nexport interface SignInResponse {\n success: boolean;\n message?: string;\n error?: any | undefined;\n user?: any; // Consider a more specific user type if possible, e.g., TernSecureUserData | null\n}\n\nexport interface AuthError extends Error {\n code?: any | string; // Allow string for other potential errors, or be stricter with just AuthErrorCode\n message: string;\n response?: SignInResponse;\n}\n\nexport function isSignInResponse(value: any): value is SignInResponse {\n return (\n typeof value === \"object\" &&\n \"success\" in value &&\n typeof value.success === \"boolean\"\n );\n}\n\n/**\n * Configuration validation result\n */\nexport interface ConfigValidationResult {\n isValid: boolean;\n errors: string[];\n //config: TernSecureConfig\n}\n\n/**\n * TernSecureAuthState\n */\n\nexport type TernSecureAuthState = {\n userId: string | null;\n isLoaded: boolean;\n error: Error | null;\n isValid: boolean;\n isVerified: boolean;\n isAuthenticated: boolean;\n token: any | null;\n email: string | null;\n status: \"loading\" | \"authenticated\" | \"unauthenticated\" | \"unverified\";\n requiresVerification: boolean;\n};\n\n/**\n * TernSecureInitialState\n */\n\nexport type initialState = {\n userId: string | null;\n sessionId: string | undefined;\n};\n\nexport interface BrowserConstructor {\n new (customDomain?: string): Browser;\n}\n\nexport interface HeadlessUIBrowserConstructor {\n new (customDomain?: string): HeadlessUIBrowser;\n}\n/**\n * TernSecureProviderProps\n * @param interface\n */\n\nexport type TernSecureProviderPropsOld = IsomorphicTernSecureOptions & {\n children: React.ReactNode;\n initialState?: TernSecureState;\n loadingComponent?: React.ReactNode;\n bypassApiKey?: boolean;\n};\n\nexport interface HeadlessUIBrowser extends TernSecureInstanceTree {\n load: (options?: TernSecureInstanceTreeOptions) => Promise<void>;\n setTernAuth: (provider: any) => void;\n}\n\nexport interface Browser extends HeadlessUIBrowser {\n onComponentsReady: Promise<void>;\n components: any;\n}\n\nexport type TernSecureProps =\n | HeadlessUIBrowserConstructor\n | HeadlessUIBrowser\n | Browser\n | BrowserConstructor\n | null\n | undefined;\n\nexport type IsomorphicTernSecureOptions = TernSecureInstanceTreeOptions & {\n TernSecure?: TernSecureProps;\n ternUIVersion?: string;\n apiKey?: string;\n customDomain?: string;\n proxyUrl?: string;\n projectId?: string;\n ternSecureConfig?: TernSecureConfig;\n};\n\nexport type TernSecureProviderProps = IsoTernSecureAuthOptions & {\n children: React.ReactNode;\n initialState?: TernSecureState;\n loadingComponent?: React.ReactNode;\n bypassApiKey?: boolean;\n};\n\nexport type TernSecureAuthProps = TernSecureAuth | undefined | null;\n\nexport type IsoTernSecureAuthOptions = TernSecureAuthOptions & {\n TernSecureAuth?: TernSecureAuthProps;\n};\n"],"mappings":"AA2DO,SAASA,EAAiBC,EAAqC,CACpE,OACE,OAAOA,GAAU,UACjB,YAAaA,GACb,OAAOA,EAAM,SAAY,SAE7B","names":["isSignInResponse","value"]}
|
package/dist/utils/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var
|
|
1
|
+
"use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var p=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},g=(e,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of I(n))!_.call(e,o)&&o!==i&&t(e,o,{get:()=>n[o],enumerable:!(r=c(n,o))||r.enumerable});return e};var u=e=>g(t({},"__esModule",{value:!0}),e);var C={};p(C,{initializeAdminConfig:()=>l,initializeConfig:()=>f,loadAdminConfig:()=>E,loadFireConfig:()=>s,validateAdminConfig:()=>d,validateConfig:()=>a});module.exports=u(C);const s=()=>({apiKey:process.env.NEXT_PUBLIC_FIREBASE_API_KEY||"",authDomain:process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN||"",projectId:process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID||"",storageBucket:process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET||"",messagingSenderId:process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID||"",appId:process.env.NEXT_PUBLIC_FIREBASE_APP_ID||"",measurementId:process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID||void 0}),a=e=>{const n=["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},f=()=>{const e=s(),n=a(e);if(!n.isValid)throw new Error(`Firebase configuration validation failed:
|
|
2
2
|
${n.errors.join(`
|
|
3
|
-
`)}`);return e},E=()=>({projectId:process.env.FIREBASE_PROJECT_ID||"",clientEmail:process.env.FIREBASE_CLIENT_EMAIL||"",privateKey:process.env.FIREBASE_PRIVATE_KEY||""}),d=e=>{const n=["projectId","clientEmail","privateKey"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},
|
|
3
|
+
`)}`);return e},E=()=>({projectId:process.env.FIREBASE_PROJECT_ID||"",clientEmail:process.env.FIREBASE_CLIENT_EMAIL||"",privateKey:process.env.FIREBASE_PRIVATE_KEY||""}),d=e=>{const n=["projectId","clientEmail","privateKey"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},l=()=>{const e=E(),n=d(e);if(!n.isValid)throw new Error(`Firebase Admin configuration validation failed:
|
|
4
4
|
${n.errors.join(`
|
|
5
5
|
`)}`);return e};0&&(module.exports={initializeAdminConfig,initializeConfig,loadAdminConfig,loadFireConfig,validateAdminConfig,validateConfig});
|
|
6
6
|
//# sourceMappingURL=config.js.map
|
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import { \r\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import type { \r\n AdminConfigValidationResult, \r\n ConfigValidationResult, \r\n TernSecureAdminConfig, \r\n TernSecureConfig} from '@tern-secure/types'\r\n\r\n/**\r\n * Loads Firebase configuration from environment variables\r\n * @returns {TernSecureConfig} Firebase configuration object\r\n */\r\nexport const loadFireConfig = (): TernSecureConfig => ({\r\n apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY || '',\r\n authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN || '',\r\n projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID || '',\r\n storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET || '',\r\n messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID || '',\r\n appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID || '',\r\n measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID || undefined,\r\n})\r\n\r\n/**\r\n * Validates Firebase configuration\r\n * @param {TernSecureConfig} config - Firebase configuration object\r\n * @throws {Error} If required configuration values are missing\r\n * @returns {TernSecureConfig} Validated configuration object\r\n */\r\nexport const validateConfig = (config: TernSecureConfig): ConfigValidationResult => {\r\n const requiredFields: (keyof TernSecureConfig)[] = [\r\n 'apiKey',\r\n 'authDomain',\r\n 'projectId',\r\n 'storageBucket',\r\n 'messagingSenderId',\r\n 'appId'\r\n ]\r\n\r\n const errors: string[] = []\r\n \r\n requiredFields.forEach(field => {\r\n if (!config[field]) {\r\n errors.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(field).toUpperCase()}`)\r\n }\r\n })\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n config\r\n }\r\n}\r\n\r\n/**\r\n * Initializes configuration with validation\r\n * @throws {Error} If configuration is invalid\r\n */\r\nexport const initializeConfig = (): TernSecureConfig => {\r\n const config = loadFireConfig()\r\n const validationResult = validateConfig(config)\r\n\r\n if (!validationResult.isValid) {\r\n throw new Error(\r\n `Firebase configuration validation failed:\\n${validationResult.errors.join('\\n')}`\r\n )\r\n }\r\n\r\n return config\r\n}\r\n\r\n/**\r\n * Loads Firebase Admin configuration from environment variables\r\n * @returns {AdminConfig} Firebase Admin configuration object\r\n */\r\nexport const loadAdminConfig = (): TernSecureAdminConfig => ({\r\n projectId: process.env.FIREBASE_PROJECT_ID || '',\r\n clientEmail: process.env.FIREBASE_CLIENT_EMAIL || '',\r\n privateKey: process.env.FIREBASE_PRIVATE_KEY || '',\r\n})\r\n\r\n/**\r\n * Validates Firebase Admin configuration\r\n * @param {AdminConfig} config - Firebase Admin configuration object\r\n * @returns {ConfigValidationResult} Validation result\r\n */\r\nexport const validateAdminConfig = (config: TernSecureAdminConfig): AdminConfigValidationResult => {\r\n const requiredFields: (keyof TernSecureAdminConfig)[] = [\r\n 'projectId',\r\n 'clientEmail',\r\n 'privateKey'\r\n ]\r\n\r\n const errors: string[] = []\r\n \r\n requiredFields.forEach(field => {\r\n if (!config[field]) {\r\n errors.push(`Missing required field: FIREBASE_${String(field).toUpperCase()}`)\r\n }\r\n })\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n config\r\n }\r\n}\r\n\r\n/**\r\n * Initializes admin configuration with validation\r\n * @throws {Error} If configuration is invalid\r\n */\r\nexport const initializeAdminConfig = (): TernSecureAdminConfig => {\r\n const config = loadAdminConfig()\r\n const validationResult = validateAdminConfig(config)\r\n\r\n if (!validationResult.isValid) {\r\n throw new Error(\r\n `Firebase Admin configuration validation failed:\\n${validationResult.errors.join('\\n')}`\r\n )\r\n }\r\n\r\n return config\r\n}"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,EAAA,qBAAAC,EAAA,oBAAAC,EAAA,mBAAAC,EAAA,wBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAR,GAUO,MAAMK,EAAiB,KAAyB,CACrD,OAAQ,QAAQ,IAAI,8BAAgC,GACpD,WAAY,QAAQ,IAAI,kCAAoC,GAC5D,UAAW,QAAQ,IAAI,iCAAmC,GAC1D,cAAe,QAAQ,IAAI,qCAAuC,GAClE,kBAAmB,QAAQ,IAAI,0CAA4C,GAC3E,MAAO,QAAQ,IAAI,6BAA+B,GAClD,cAAe,QAAQ,IAAI,qCAAuC,MACpE,GAQaE,EAAkBE,GAAqD,CAClF,MAAMC,EAA6C,CACjD,SACA,aACA,YACA,gBACA,oBACA,OACF,EAEMC,EAAmB,CAAC,EAE1B,OAAAD,EAAe,QAAQE,GAAS,CACzBH,EAAOG,CAAK,GACfD,EAAO,KAAK,gDAAgD,OAAOC,CAAK,EAAE,YAAY,CAAC,EAAE,CAE7F,CAAC,EAEM,CACL,QAASD,EAAO,SAAW,EAC3B,OAAAA,EACA,OAAAF,CACF,CACF,EAMaN,EAAmB,IAAwB,CACtD,MAAMM,EAASJ,EAAe,EACxBQ,EAAmBN,EAAeE,CAAM,EAE9C,GAAI,CAACI,EAAiB,QACpB,MAAM,IAAI,MACR;AAAA,EAA8CA,EAAiB,OAAO,KAAK;AAAA,CAAI,CAAC,EAClF,EAGF,OAAOJ,CACT,EAMaL,EAAkB,KAA8B,CAC3D,UAAW,QAAQ,IAAI,qBAAuB,GAC9C,YAAa,QAAQ,IAAI,uBAAyB,GAClD,WAAY,QAAQ,IAAI,sBAAwB,EAClD,GAOaE,EAAuBG,GAA+D,CACjG,MAAMC,EAAkD,CACtD,YACA,cACA,YACF,EAEMC,EAAmB,CAAC,EAE1B,OAAAD,EAAe,QAAQE,GAAS,CACzBH,EAAOG,CAAK,GACfD,EAAO,KAAK,oCAAoC,OAAOC,CAAK,EAAE,YAAY,CAAC,EAAE,CAEjF,CAAC,EAEM,CACL,QAASD,EAAO,SAAW,EAC3B,OAAAA,EACA,OAAAF,CACF,CACF,EAMaP,EAAwB,IAA6B,CAChE,MAAMO,EAASL,EAAgB,EACzBS,EAAmBP,EAAoBG,CAAM,EAEnD,GAAI,CAACI,EAAiB,QACpB,MAAM,IAAI,MACR;AAAA,EAAoDA,EAAiB,OAAO,KAAK;AAAA,CAAI,CAAC,EACxF,EAGF,OAAOJ,CACT","names":["config_exports","__export","initializeAdminConfig","initializeConfig","loadAdminConfig","loadFireConfig","validateAdminConfig","validateConfig","__toCommonJS","config","requiredFields","errors","field","validationResult"]}
|
package/dist/utils/config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const o=()=>({apiKey:process.env.NEXT_PUBLIC_FIREBASE_API_KEY||"",authDomain:process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN||"",projectId:process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID||"",storageBucket:process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET||"",messagingSenderId:process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID||"",appId:process.env.NEXT_PUBLIC_FIREBASE_APP_ID||"",measurementId:process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID||void 0}),t=e=>{const n=["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},
|
|
1
|
+
const o=()=>({apiKey:process.env.NEXT_PUBLIC_FIREBASE_API_KEY||"",authDomain:process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN||"",projectId:process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID||"",storageBucket:process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET||"",messagingSenderId:process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID||"",appId:process.env.NEXT_PUBLIC_FIREBASE_APP_ID||"",measurementId:process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID||void 0}),t=e=>{const n=["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},E=()=>{const e=o(),n=t(e);if(!n.isValid)throw new Error(`Firebase configuration validation failed:
|
|
2
2
|
${n.errors.join(`
|
|
3
|
-
`)}`);return e},s=()=>({projectId:process.env.FIREBASE_PROJECT_ID||"",clientEmail:process.env.FIREBASE_CLIENT_EMAIL||"",privateKey:process.env.FIREBASE_PRIVATE_KEY||""}),a=e=>{const n=["projectId","clientEmail","privateKey"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},
|
|
3
|
+
`)}`);return e},s=()=>({projectId:process.env.FIREBASE_PROJECT_ID||"",clientEmail:process.env.FIREBASE_CLIENT_EMAIL||"",privateKey:process.env.FIREBASE_PRIVATE_KEY||""}),a=e=>{const n=["projectId","clientEmail","privateKey"],i=[];return n.forEach(r=>{e[r]||i.push(`Missing required field: FIREBASE_${String(r).toUpperCase()}`)}),{isValid:i.length===0,errors:i,config:e}},d=()=>{const e=s(),n=a(e);if(!n.isValid)throw new Error(`Firebase Admin configuration validation failed:
|
|
4
4
|
${n.errors.join(`
|
|
5
|
-
`)}`);return e};export{
|
|
5
|
+
`)}`);return e};export{d as initializeAdminConfig,E as initializeConfig,s as loadAdminConfig,o as loadFireConfig,a as validateAdminConfig,t as validateConfig};
|
|
6
6
|
//# sourceMappingURL=config.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import { \r\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import type { \r\n AdminConfigValidationResult, \r\n ConfigValidationResult, \r\n TernSecureAdminConfig, \r\n TernSecureConfig} from '@tern-secure/types'\r\n\r\n/**\r\n * Loads Firebase configuration from environment variables\r\n * @returns {TernSecureConfig} Firebase configuration object\r\n */\r\nexport const loadFireConfig = (): TernSecureConfig => ({\r\n apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY || '',\r\n authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN || '',\r\n projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID || '',\r\n storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET || '',\r\n messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID || '',\r\n appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID || '',\r\n measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID || undefined,\r\n})\r\n\r\n/**\r\n * Validates Firebase configuration\r\n * @param {TernSecureConfig} config - Firebase configuration object\r\n * @throws {Error} If required configuration values are missing\r\n * @returns {TernSecureConfig} Validated configuration object\r\n */\r\nexport const validateConfig = (config: TernSecureConfig): ConfigValidationResult => {\r\n const requiredFields: (keyof TernSecureConfig)[] = [\r\n 'apiKey',\r\n 'authDomain',\r\n 'projectId',\r\n 'storageBucket',\r\n 'messagingSenderId',\r\n 'appId'\r\n ]\r\n\r\n const errors: string[] = []\r\n \r\n requiredFields.forEach(field => {\r\n if (!config[field]) {\r\n errors.push(`Missing required field: NEXT_PUBLIC_FIREBASE_${String(field).toUpperCase()}`)\r\n }\r\n })\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n config\r\n }\r\n}\r\n\r\n/**\r\n * Initializes configuration with validation\r\n * @throws {Error} If configuration is invalid\r\n */\r\nexport const initializeConfig = (): TernSecureConfig => {\r\n const config = loadFireConfig()\r\n const validationResult = validateConfig(config)\r\n\r\n if (!validationResult.isValid) {\r\n throw new Error(\r\n `Firebase configuration validation failed:\\n${validationResult.errors.join('\\n')}`\r\n )\r\n }\r\n\r\n return config\r\n}\r\n\r\n/**\r\n * Loads Firebase Admin configuration from environment variables\r\n * @returns {AdminConfig} Firebase Admin configuration object\r\n */\r\nexport const loadAdminConfig = (): TernSecureAdminConfig => ({\r\n projectId: process.env.FIREBASE_PROJECT_ID || '',\r\n clientEmail: process.env.FIREBASE_CLIENT_EMAIL || '',\r\n privateKey: process.env.FIREBASE_PRIVATE_KEY || '',\r\n})\r\n\r\n/**\r\n * Validates Firebase Admin configuration\r\n * @param {AdminConfig} config - Firebase Admin configuration object\r\n * @returns {ConfigValidationResult} Validation result\r\n */\r\nexport const validateAdminConfig = (config: TernSecureAdminConfig): AdminConfigValidationResult => {\r\n const requiredFields: (keyof TernSecureAdminConfig)[] = [\r\n 'projectId',\r\n 'clientEmail',\r\n 'privateKey'\r\n ]\r\n\r\n const errors: string[] = []\r\n \r\n requiredFields.forEach(field => {\r\n if (!config[field]) {\r\n errors.push(`Missing required field: FIREBASE_${String(field).toUpperCase()}`)\r\n }\r\n })\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n config\r\n }\r\n}\r\n\r\n/**\r\n * Initializes admin configuration with validation\r\n * @throws {Error} If configuration is invalid\r\n */\r\nexport const initializeAdminConfig = (): TernSecureAdminConfig => {\r\n const config = loadAdminConfig()\r\n const validationResult = validateAdminConfig(config)\r\n\r\n if (!validationResult.isValid) {\r\n throw new Error(\r\n `Firebase Admin configuration validation failed:\\n${validationResult.errors.join('\\n')}`\r\n )\r\n }\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A6B,CAChE,MAAMR,EAASM,EAAgB,EACzBD,EAAmBE,EAAoBP,CAAM,EAEnD,GAAI,CAACK,EAAiB,QACpB,MAAM,IAAI,MACR;AAAA,EAAoDA,EAAiB,OAAO,KAAK;AAAA,CAAI,CAAC,EACxF,EAGF,OAAOL,CACT","names":["loadFireConfig","validateConfig","config","requiredFields","errors","field","initializeConfig","validationResult","loadAdminConfig","validateAdminConfig","initializeAdminConfig"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/construct.ts"],"sourcesContent":["//v2: redict with taking priority from the sign-in page\r\n\r\nimport { isInternalRoute
|
|
1
|
+
{"version":3,"sources":["../../src/utils/construct.ts"],"sourcesContent":["//v2: redict with taking priority from the sign-in page\r\n\r\nimport { isAuthRoute,isInternalRoute } from \"../route-handler/internal-route\"\r\n\r\n/**\r\n * Constructs a full URL with the current origin\r\n * @param path - The path to construct the URL for\r\n * @returns The full URL with origin\r\n */\r\nexport const constructFullUrl = (path: string) => {\r\n if (typeof window === \"undefined\") return path\r\n const baseUrl = window.location.origin\r\n if (path.startsWith('http')) {\r\n return path\r\n }\r\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\r\n }\r\n\r\n\r\n/**\r\n * Checks if the current URL has a redirect loop\r\n * @param currentPath - The current pathname\r\n * @param redirectPath - The path we're trying to redirect to\r\n * @returns boolean indicating if there's a redirect loop\r\n */\r\nexport const hasRedirectLoop = (currentPath: string, redirectPath: string): boolean => {\r\n if (!currentPath || !redirectPath) return false\r\n\r\n // Remove any query parameters for comparison\r\n const cleanCurrentPath = currentPath.split(\"?\")[0]\r\n const cleanRedirectPath = redirectPath.split(\"?\")[0]\r\n\r\n return cleanCurrentPath === cleanRedirectPath\r\n}\r\n \r\n/**\r\n * Constructs a URL with redirect parameters while preventing loops\r\n * @param path - The base path (usually login path)\r\n * @param redirectUrl - The URL to redirect to after action completes\r\n * @param loginPath - The login path to check against\r\n * @param signUpPath - The sign up path to check against\r\n * @returns The full URL with redirect parameters\r\n */\r\nexport const constructUrlWithRedirect = (\r\n path: string,\r\n redirectUrl: string | undefined,\r\n): string => {\r\n const url = new URL(path, typeof window !== \"undefined\" ? window.location.origin : undefined)\r\n \r\n if (redirectUrl && !isAuthRoute(redirectUrl) && !isInternalRoute(redirectUrl)) {\r\n url.searchParams.set(\"redirect\", redirectUrl)\r\n }\r\n \r\n return url.toString()\r\n}\r\n\r\n/**\r\n * Stores the current path before signing out\r\n */\r\nexport const storePreviousPath = (path: string): void => {\r\n if (typeof window !== \"undefined\" && !isAuthRoute(path)) {\r\n sessionStorage.setItem(\"previousPath\", path)\r\n }\r\n}\r\n\r\n/**\r\n * Gets the stored previous path\r\n */\r\nexport const getPreviousPath = (): string | null => {\r\n if (typeof window !== \"undefined\") {\r\n return sessionStorage.getItem(\"previousPath\")\r\n }\r\n return null\r\n}\r\n\r\n\r\n \r\n/**\r\n * Gets a validated redirect URL ensuring it's from the same origin\r\n * @param redirectUrl - The URL to validate\r\n * @param searchParams - The search parameters to check for redirect\r\n * @returns A validated redirect URL\r\n */\r\nexport const getValidRedirectUrl = (\r\n searchParams: URLSearchParams,\r\n configuredRedirect?: string,\r\n): string => {\r\n // Check URL search param first (highest priority)\r\n const urlRedirect = searchParams.get(\"redirect\")\r\n if (urlRedirect) {\r\n return validateUrl(urlRedirect)\r\n }\r\n\r\n // Then check configured redirect (for first visits)\r\n if (configuredRedirect) {\r\n return validateUrl(configuredRedirect)\r\n }\r\n\r\n // Default fallback\r\n return \"/\"\r\n}\r\n\r\n/**\r\n * Validates and sanitizes URLs\r\n */\r\nconst validateUrl = (url: string): string => {\r\n try {\r\n // For absolute URLs\r\n if (url.startsWith(\"http\")) {\r\n const urlObj = new URL(url)\r\n if (typeof window !== \"undefined\" && urlObj.origin !== window.location.origin) {\r\n return \"/\"\r\n }\r\n return !isAuthRoute(urlObj.pathname) && !isInternalRoute(urlObj.pathname) \r\n ? urlObj.pathname \r\n : \"/\"\r\n }\r\n \r\n //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KC,EAAYD,CAAW,EAI5BD,EACKE,EAAYF,CAAkB,EAIhC,GACT,EAKME,EAAeJ,GAAwB,CAC3C,GAAI,CAEF,GAAIA,EAAI,WAAW,MAAM,EAAG,CAC1B,MAAMK,EAAS,IAAI,IAAIL,CAAG,EAC1B,OAAI,OAAO,OAAW,KAAeK,EAAO,SAAW,OAAO,SAAS,OAC9D,IAEF,IAAC,eAAYA,EAAO,QAAQ,GAAK,IAAC,mBAAgBA,EAAO,QAAQ,EACpEA,EAAO,SACP,GACN,CAGA,MAAO,IAAC,eAAYL,CAAG,GAAK,IAAC,mBAAgBA,CAAG,EAAIA,EAAM,GAC5D,MAAQ,CACN,MAAO,GACT,CACF","names":["construct_exports","__export","constructFullUrl","constructUrlWithRedirect","getPreviousPath","getValidRedirectUrl","hasRedirectLoop","storePreviousPath","__toCommonJS","import_internal_route","path","baseUrl","currentPath","redirectPath","cleanCurrentPath","cleanRedirectPath","redirectUrl","url","searchParams","configuredRedirect","urlRedirect","validateUrl","urlObj"]}
|
package/dist/utils/construct.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isAuthRoute as r,isInternalRoute as i}from"../route-handler/internal-route";const a=t=>{if(typeof window>"u")return t;const n=window.location.origin;return t.startsWith("http")?t:`${n}${t.startsWith("/")?t:`/${t}`}`},c=(t,n)=>{if(!t||!n)return!1;const e=t.split("?")[0],s=n.split("?")[0];return e===s},d=(t,n)=>{const e=new URL(t,typeof window<"u"?window.location.origin:void 0);return n&&!r(n)&&!i(n)&&e.searchParams.set("redirect",n),e.toString()},f=t=>{typeof window<"u"&&!r(t)&&sessionStorage.setItem("previousPath",t)},g=()=>typeof window<"u"?sessionStorage.getItem("previousPath"):null,l=(t,n)=>{const e=t.get("redirect");return e?o(e):n?o(n):"/"},o=t=>{try{if(t.startsWith("http")){const n=new URL(t);return typeof window<"u"&&n.origin!==window.location.origin?"/":!r(n.pathname)&&!i(n.pathname)?n.pathname:"/"}return!r(t)&&!i(t)?t:"/"}catch{return"/"}};export{a as constructFullUrl,d as constructUrlWithRedirect,g as getPreviousPath,l as getValidRedirectUrl,c as hasRedirectLoop,f as storePreviousPath};
|
|
2
2
|
//# sourceMappingURL=construct.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/construct.ts"],"sourcesContent":["//v2: redict with taking priority from the sign-in page\r\n\r\nimport { isInternalRoute
|
|
1
|
+
{"version":3,"sources":["../../src/utils/construct.ts"],"sourcesContent":["//v2: redict with taking priority from the sign-in page\r\n\r\nimport { isAuthRoute,isInternalRoute } from \"../route-handler/internal-route\"\r\n\r\n/**\r\n * Constructs a full URL with the current origin\r\n * @param path - The path to construct the URL for\r\n * @returns The full URL with origin\r\n */\r\nexport const constructFullUrl = (path: string) => {\r\n if (typeof window === \"undefined\") return path\r\n const baseUrl = window.location.origin\r\n if (path.startsWith('http')) {\r\n return path\r\n }\r\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\r\n }\r\n\r\n\r\n/**\r\n * Checks if the current URL has a redirect loop\r\n * @param currentPath - The current pathname\r\n * @param redirectPath - The path we're trying to redirect to\r\n * @returns boolean indicating if there's a redirect loop\r\n */\r\nexport const hasRedirectLoop = (currentPath: string, redirectPath: string): boolean => {\r\n if (!currentPath || !redirectPath) return false\r\n\r\n // Remove any query parameters for comparison\r\n const cleanCurrentPath = currentPath.split(\"?\")[0]\r\n const cleanRedirectPath = redirectPath.split(\"?\")[0]\r\n\r\n return cleanCurrentPath === cleanRedirectPath\r\n}\r\n \r\n/**\r\n * Constructs a URL with redirect parameters while preventing loops\r\n * @param path - The base path (usually login path)\r\n * @param redirectUrl - The URL to redirect to after action completes\r\n * @param loginPath - The login path to check against\r\n * @param signUpPath - The sign up path to check against\r\n * @returns The full URL with redirect parameters\r\n */\r\nexport const constructUrlWithRedirect = (\r\n path: string,\r\n redirectUrl: string | undefined,\r\n): string => {\r\n const url = new URL(path, typeof window !== \"undefined\" ? window.location.origin : undefined)\r\n \r\n if (redirectUrl && !isAuthRoute(redirectUrl) && !isInternalRoute(redirectUrl)) {\r\n url.searchParams.set(\"redirect\", redirectUrl)\r\n }\r\n \r\n return url.toString()\r\n}\r\n\r\n/**\r\n * Stores the current path before signing out\r\n */\r\nexport const storePreviousPath = (path: string): void => {\r\n if (typeof window !== \"undefined\" && !isAuthRoute(path)) {\r\n sessionStorage.setItem(\"previousPath\", path)\r\n }\r\n}\r\n\r\n/**\r\n * Gets the stored previous path\r\n */\r\nexport const getPreviousPath = (): string | null => {\r\n if (typeof window !== \"undefined\") {\r\n return sessionStorage.getItem(\"previousPath\")\r\n }\r\n return null\r\n}\r\n\r\n\r\n \r\n/**\r\n * Gets a validated redirect URL ensuring it's from the same origin\r\n * @param redirectUrl - The URL to validate\r\n * @param searchParams - The search parameters to check for redirect\r\n * @returns A validated redirect URL\r\n */\r\nexport const getValidRedirectUrl = (\r\n searchParams: URLSearchParams,\r\n configuredRedirect?: string,\r\n): string => {\r\n // Check URL search param first (highest priority)\r\n const urlRedirect = searchParams.get(\"redirect\")\r\n if (urlRedirect) {\r\n return validateUrl(urlRedirect)\r\n }\r\n\r\n // Then check configured redirect (for first visits)\r\n if (configuredRedirect) {\r\n return validateUrl(configuredRedirect)\r\n }\r\n\r\n // Default fallback\r\n return \"/\"\r\n}\r\n\r\n/**\r\n * Validates and sanitizes URLs\r\n */\r\nconst validateUrl = (url: string): string => {\r\n try {\r\n // For absolute URLs\r\n if (url.startsWith(\"http\")) {\r\n const urlObj = new URL(url)\r\n if (typeof window !== \"undefined\" && urlObj.origin !== window.location.origin) {\r\n return \"/\"\r\n }\r\n return !isAuthRoute(urlObj.pathname) && !isInternalRoute(urlObj.pathname) \r\n ? urlObj.pathname \r\n : \"/\"\r\n }\r\n \r\n // For relative URLs\r\n return !isAuthRoute(url) && !isInternalRoute(url) ? url : \"/\"\r\n } catch {\r\n return \"/\"\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n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ACpB,EAAYoB,EAAO,QAAQ,GAAK,CAACnB,EAAgBmB,EAAO,QAAQ,EACpEA,EAAO,SACP,GACN,CAGA,MAAO,CAACpB,EAAYY,CAAG,GAAK,CAACX,EAAgBW,CAAG,EAAIA,EAAM,GAC5D,MAAQ,CACN,MAAO,GACT,CACF","names":["isAuthRoute","isInternalRoute","constructFullUrl","path","baseUrl","hasRedirectLoop","currentPath","redirectPath","cleanCurrentPath","cleanRedirectPath","constructUrlWithRedirect","redirectUrl","url","storePreviousPath","getPreviousPath","getValidRedirectUrl","searchParams","configuredRedirect","urlRedirect","validateUrl","urlObj"]}
|
package/dist/utils/debug.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var g=(n,t)=>{for(var e in t)i(n,e,{get:t[e],enumerable:!0})},u=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of c(t))!l.call(n,o)&&o!==e&&i(n,o,{get:()=>t[o],enumerable:!(s=r(t,o))||s.enumerable});return n};var d=n=>u(i({},"__esModule",{value:!0}),n);var y={};g(y,{debugLog:()=>a,logAuthState:()=>p,logError:()=>E,logLifecycle:()=>f,logSessionState:()=>S});module.exports=d(y);const m=process.env.NODE_ENV!=="production",a=n=>{if(!m)return;const t=new Date().toISOString(),e=`[TernSecure][${n.component}][${n.action}]`;console.log(`${e} - ${t}`,n.data||"")},p=(n,t,e,s)=>{a({component:n,action:"AuthState",data:{user:t?{uid:t.uid,email:t.email,emailVerified:t.emailVerified}:null,isValid:e,isVerified:s}})},S=(n,t,e)=>{a({component:n,action:"SessionState",data:{hasToken:!!t,expirationTime:e?new Date(e).toISOString():null,isExpired:e?Date.now()>e:null}})},f=(n,t,e)=>{a({component:n,action:`Lifecycle.${t}`,data:e})},E=(n,t)=>{a({component:n,action:"Error",data:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t})};0&&(module.exports={debugLog,logAuthState,logError,logLifecycle,logSessionState});
|
|
2
2
|
//# sourceMappingURL=debug.js.map
|
package/dist/utils/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/debug.ts"],"sourcesContent":["import { TernSecureUser } from '@tern-secure/types'\n\nconst DEBUG = process.env.NODE_ENV !== 'production'\n\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/debug.ts"],"sourcesContent":["import type { TernSecureUser } from '@tern-secure/types'\n\nconst DEBUG = process.env.NODE_ENV !== 'production'\n\n//type LogLevel = 'info' | 'warn' | 'error' | 'debug'\n\ninterface LogContext {\n component: string\n action: string\n data?: any\n}\n\nexport const debugLog = (context: LogContext) => {\n if (!DEBUG) return\n\n const timestamp = new Date().toISOString()\n const prefix = `[TernSecure][${context.component}][${context.action}]`\n\n console.log(`${prefix} - ${timestamp}`, context.data || '')\n}\n\nexport const logAuthState = (component: string, user: TernSecureUser | null, isValid: boolean, isVerified: boolean) => {\n debugLog({\n component,\n action: 'AuthState',\n data: {\n user: user ? {\n uid: user.uid,\n email: user.email,\n emailVerified: user.emailVerified,\n } : null,\n isValid,\n isVerified,\n },\n })\n}\n\nexport const logSessionState = (component: string, token: string | null, expirationTime: number | null) => {\n debugLog({\n component,\n action: 'SessionState',\n data: {\n hasToken: !!token,\n expirationTime: expirationTime ? new Date(expirationTime).toISOString() : null,\n isExpired: expirationTime ? Date.now() > expirationTime : null,\n },\n })\n}\n\nexport const logLifecycle = (component: string, lifecycle: string, props?: any) => {\n debugLog({\n component,\n action: `Lifecycle.${lifecycle}`,\n data: props,\n })\n}\n\nexport const logError = (component: string, error: Error | unknown) => {\n debugLog({\n component,\n action: 'Error',\n data: error instanceof Error ? {\n name: error.name,\n message: error.message,\n stack: error.stack,\n } : error,\n })\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,iBAAAC,EAAA,aAAAC,EAAA,iBAAAC,EAAA,oBAAAC,IAAA,eAAAC,EAAAP,GAEA,MAAMQ,EAAQ,QAAQ,IAAI,WAAa,aAU1BN,EAAYO,GAAwB,CAC/C,GAAI,CAACD,EAAO,OAEZ,MAAME,EAAY,IAAI,KAAK,EAAE,YAAY,EACnCC,EAAS,gBAAgBF,EAAQ,SAAS,KAAKA,EAAQ,MAAM,IAEnE,QAAQ,IAAI,GAAGE,CAAM,MAAMD,CAAS,GAAID,EAAQ,MAAQ,EAAE,CAC5D,EAEaN,EAAe,CAACS,EAAmBC,EAA6BC,EAAkBC,IAAwB,CACrHb,EAAS,CACP,UAAAU,EACA,OAAQ,YACR,KAAM,CACJ,KAAMC,EAAO,CACX,IAAKA,EAAK,IACV,MAAOA,EAAK,MACZ,cAAeA,EAAK,aACtB,EAAI,KACJ,QAAAC,EACA,WAAAC,CACF,CACF,CAAC,CACH,EAEaT,EAAkB,CAACM,EAAmBI,EAAsBC,IAAkC,CACzGf,EAAS,CACP,UAAAU,EACA,OAAQ,eACR,KAAM,CACJ,SAAU,CAAC,CAACI,EACZ,eAAgBC,EAAiB,IAAI,KAAKA,CAAc,EAAE,YAAY,EAAI,KAC1E,UAAWA,EAAiB,KAAK,IAAI,EAAIA,EAAiB,IAC5D,CACF,CAAC,CACH,EAEaZ,EAAe,CAACO,EAAmBM,EAAmBC,IAAgB,CACjFjB,EAAS,CACP,UAAAU,EACA,OAAQ,aAAaM,CAAS,GAC9B,KAAMC,CACR,CAAC,CACH,EAEaf,EAAW,CAACQ,EAAmBQ,IAA2B,CACrElB,EAAS,CACP,UAAAU,EACA,OAAQ,QACR,KAAMQ,aAAiB,MAAQ,CAC7B,KAAMA,EAAM,KACZ,QAASA,EAAM,QACf,MAAOA,EAAM,KACf,EAAIA,CACN,CAAC,CACH","names":["debug_exports","__export","debugLog","logAuthState","logError","logLifecycle","logSessionState","__toCommonJS","DEBUG","context","timestamp","prefix","component","user","isValid","isVerified","token","expirationTime","lifecycle","props","error"]}
|
package/dist/utils/debug.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const s=process.env.NODE_ENV!=="production",o=n=>{if(!s)return;const t=new Date().toISOString(),e=`[TernSecure][${n.component}][${n.action}]`;console.log(`${e} - ${t}`,n.data||"")},i=(n,t,e,a)=>{o({component:n,action:"AuthState",data:{user:t?{uid:t.uid,email:t.email,emailVerified:t.emailVerified}:null,isValid:e,isVerified:a}})},r=(n,t,e)=>{o({component:n,action:"SessionState",data:{hasToken:!!t,expirationTime:e?new Date(e).toISOString():null,isExpired:e?Date.now()>e:null}})},c=(n,t,e)=>{o({component:n,action:`Lifecycle.${t}`,data:e})},l=(n,t)=>{o({component:n,action:"Error",data:t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t})};export{o as debugLog,i as logAuthState,l as logError,c as logLifecycle,r as logSessionState};
|
|
2
2
|
//# sourceMappingURL=debug.mjs.map
|
package/dist/utils/debug.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/debug.ts"],"sourcesContent":["import { TernSecureUser } from '@tern-secure/types'\n\nconst DEBUG = process.env.NODE_ENV !== 'production'\n\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/debug.ts"],"sourcesContent":["import type { TernSecureUser } from '@tern-secure/types'\n\nconst DEBUG = process.env.NODE_ENV !== 'production'\n\n//type LogLevel = 'info' | 'warn' | 'error' | 'debug'\n\ninterface LogContext {\n component: string\n action: string\n data?: any\n}\n\nexport const debugLog = (context: LogContext) => {\n if (!DEBUG) return\n\n const timestamp = new Date().toISOString()\n const prefix = `[TernSecure][${context.component}][${context.action}]`\n\n console.log(`${prefix} - ${timestamp}`, context.data || '')\n}\n\nexport const logAuthState = (component: string, user: TernSecureUser | null, isValid: boolean, isVerified: boolean) => {\n debugLog({\n component,\n action: 'AuthState',\n data: {\n user: user ? {\n uid: user.uid,\n email: user.email,\n emailVerified: user.emailVerified,\n } : null,\n isValid,\n isVerified,\n },\n })\n}\n\nexport const logSessionState = (component: string, token: string | null, expirationTime: number | null) => {\n debugLog({\n component,\n action: 'SessionState',\n data: {\n hasToken: !!token,\n expirationTime: expirationTime ? new Date(expirationTime).toISOString() : null,\n isExpired: expirationTime ? Date.now() > expirationTime : null,\n },\n })\n}\n\nexport const logLifecycle = (component: string, lifecycle: string, props?: any) => {\n debugLog({\n component,\n action: `Lifecycle.${lifecycle}`,\n data: props,\n })\n}\n\nexport const logError = (component: string, error: Error | unknown) => {\n debugLog({\n component,\n action: 'Error',\n data: error instanceof Error ? {\n name: error.name,\n message: error.message,\n stack: error.stack,\n } : error,\n })\n}\n"],"mappings":"AAEA,MAAMA,EAAQ,QAAQ,IAAI,WAAa,aAU1BC,EAAYC,GAAwB,CAC/C,GAAI,CAACF,EAAO,OAEZ,MAAMG,EAAY,IAAI,KAAK,EAAE,YAAY,EACnCC,EAAS,gBAAgBF,EAAQ,SAAS,KAAKA,EAAQ,MAAM,IAEnE,QAAQ,IAAI,GAAGE,CAAM,MAAMD,CAAS,GAAID,EAAQ,MAAQ,EAAE,CAC5D,EAEaG,EAAe,CAACC,EAAmBC,EAA6BC,EAAkBC,IAAwB,CACrHR,EAAS,CACP,UAAAK,EACA,OAAQ,YACR,KAAM,CACJ,KAAMC,EAAO,CACX,IAAKA,EAAK,IACV,MAAOA,EAAK,MACZ,cAAeA,EAAK,aACtB,EAAI,KACJ,QAAAC,EACA,WAAAC,CACF,CACF,CAAC,CACH,EAEaC,EAAkB,CAACJ,EAAmBK,EAAsBC,IAAkC,CACzGX,EAAS,CACP,UAAAK,EACA,OAAQ,eACR,KAAM,CACJ,SAAU,CAAC,CAACK,EACZ,eAAgBC,EAAiB,IAAI,KAAKA,CAAc,EAAE,YAAY,EAAI,KAC1E,UAAWA,EAAiB,KAAK,IAAI,EAAIA,EAAiB,IAC5D,CACF,CAAC,CACH,EAEaC,EAAe,CAACP,EAAmBQ,EAAmBC,IAAgB,CACjFd,EAAS,CACP,UAAAK,EACA,OAAQ,aAAaQ,CAAS,GAC9B,KAAMC,CACR,CAAC,CACH,EAEaC,EAAW,CAACV,EAAmBW,IAA2B,CACrEhB,EAAS,CACP,UAAAK,EACA,OAAQ,QACR,KAAMW,aAAiB,MAAQ,CAC7B,KAAMA,EAAM,KACZ,QAASA,EAAM,QACf,MAAOA,EAAM,KACf,EAAIA,CACN,CAAC,CACH","names":["DEBUG","debugLog","context","timestamp","prefix","logAuthState","component","user","isValid","isVerified","logSessionState","token","expirationTime","logLifecycle","lifecycle","props","logError","error"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tern-secure/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/TernSecure/typescript.git",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"tailwind-merge": "^2.5.5",
|
|
37
37
|
"tailwindcss-animate": "^1.0.7",
|
|
38
38
|
"tslib": "2.4.1",
|
|
39
|
-
"@tern-secure/
|
|
40
|
-
"@tern-secure/
|
|
41
|
-
"@tern-secure/
|
|
39
|
+
"@tern-secure/shared": "1.2.1",
|
|
40
|
+
"@tern-secure/types": "1.0.5",
|
|
41
|
+
"@tern-secure/auth": "1.0.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@tailwindcss/cli": "^4.1.6",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"clean": "rimraf dist",
|
|
59
|
-
"build": "pnpm clean && tsup
|
|
59
|
+
"build": "pnpm clean && tsup",
|
|
60
|
+
"build:add": "tsc -p tsconfig.add.json",
|
|
60
61
|
"build:styles": "tailwindcss -i ./src/styles/globals.css -o ./dist/styles/globals.css --minify",
|
|
61
62
|
"dev": "tsup --watch",
|
|
62
63
|
"dev:styles": "tailwindcss -i ./src/styles/globals.css -o ./dist/index.css --watch",
|
package/dist/client/actions.d.ts
DELETED
package/dist/client/actions.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/client/actions.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=actions.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SessionResult } from '@tern-secure/types';
|
|
2
|
-
|
|
3
|
-
declare function createSessionCookie(idToken: string): Promise<SessionResult>;
|
|
4
|
-
declare function clearSessionCookie(): Promise<{
|
|
5
|
-
success: boolean;
|
|
6
|
-
message: string;
|
|
7
|
-
}>;
|
|
8
|
-
|
|
9
|
-
export { clearSessionCookie, createSessionCookie };
|
package/dist/client/session.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SessionResult } from '@tern-secure/types';
|
|
2
|
-
|
|
3
|
-
declare function createSessionCookie(idToken: string): Promise<SessionResult>;
|
|
4
|
-
declare function clearSessionCookie(): Promise<{
|
|
5
|
-
success: boolean;
|
|
6
|
-
message: string;
|
|
7
|
-
}>;
|
|
8
|
-
|
|
9
|
-
export { clearSessionCookie, createSessionCookie };
|
package/dist/client/session.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";"use server";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var u=(e,s)=>{for(var r in s)n(e,r,{get:s[r],enumerable:!0})},l=(e,s,r,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of c(s))!S.call(e,o)&&o!==r&&n(e,o,{get:()=>s[o],enumerable:!(t=a(s,o))||t.enumerable});return e};var m=e=>l(n({},"__esModule",{value:!0}),e);var p={};u(p,{clearSessionCookie:()=>k,createSessionCookie:()=>f});module.exports=m(p);var i=require("@tern-secure/backend");async function f(e){return(0,i.createSessionCookie)(e)}async function k(){return(0,i.clearSessionCookie)()}0&&(module.exports={clearSessionCookie,createSessionCookie});
|
|
2
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/session.ts"],"sourcesContent":["'use server'\n\nimport { createSessionCookie as createSession, clearSessionCookie as clearSession } from '@tern-secure/backend'\nimport { SessionResult } from '@tern-secure/types'\n\nexport async function createSessionCookie(idToken: string): Promise<SessionResult> {\n return createSession(idToken)\n}\n\nexport async function clearSessionCookie() {\n return clearSession()\n}\n"],"mappings":"sbAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,EAAA,wBAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAAyF,gCAGzF,eAAsBF,EAAoBG,EAAyC,CACjF,SAAO,EAAAC,qBAAcD,CAAO,CAC9B,CAEA,eAAsBJ,GAAqB,CACzC,SAAO,EAAAM,oBAAa,CACtB","names":["session_exports","__export","clearSessionCookie","createSessionCookie","__toCommonJS","import_backend","idToken","createSession","clearSession"]}
|
package/dist/client/session.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/session.ts"],"sourcesContent":["'use server'\n\nimport { createSessionCookie as createSession, clearSessionCookie as clearSession } from '@tern-secure/backend'\nimport { SessionResult } from '@tern-secure/types'\n\nexport async function createSessionCookie(idToken: string): Promise<SessionResult> {\n return createSession(idToken)\n}\n\nexport async function clearSessionCookie() {\n return clearSession()\n}\n"],"mappings":"aAEA,OAAS,uBAAuBA,EAAe,sBAAsBC,MAAoB,uBAGzF,eAAsBC,EAAoBC,EAAyC,CACjF,OAAOH,EAAcG,CAAO,CAC9B,CAEA,eAAsBC,GAAqB,CACzC,OAAOH,EAAa,CACtB","names":["createSession","clearSession","createSessionCookie","idToken","clearSessionCookie"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
interface MountProps {
|
|
5
|
-
mount: (node: HTMLDivElement, props: any) => void;
|
|
6
|
-
unmount: (node: HTMLDivElement) => void;
|
|
7
|
-
updateProps?: (params: {
|
|
8
|
-
node: HTMLDivElement;
|
|
9
|
-
props: any;
|
|
10
|
-
}) => void;
|
|
11
|
-
props: any;
|
|
12
|
-
}
|
|
13
|
-
type HostRendererProps = PropsWithChildren<MountProps & {
|
|
14
|
-
component?: string;
|
|
15
|
-
hideRootHtmlElement?: boolean;
|
|
16
|
-
rootProps?: React__default.JSX.IntrinsicElements['div'];
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components
|
|
20
|
-
* from the @tern-secure/ui package. It handles the lifecycle of the mounted component
|
|
21
|
-
* and ensures proper cleanup.
|
|
22
|
-
*/
|
|
23
|
-
declare class TernSecureHostRenderer extends React__default.PureComponent<HostRendererProps> {
|
|
24
|
-
private rootRef;
|
|
25
|
-
componentDidUpdate(prevProps: Readonly<HostRendererProps>): void;
|
|
26
|
-
componentDidMount(): void;
|
|
27
|
-
componentWillUnmount(): void;
|
|
28
|
-
render(): react_jsx_runtime.JSX.Element;
|
|
29
|
-
}
|
|
30
|
-
declare const isMountProps: (props: any) => props is MountProps;
|
|
31
|
-
|
|
32
|
-
export { TernSecureHostRenderer, isMountProps };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
interface MountProps {
|
|
5
|
-
mount: (node: HTMLDivElement, props: any) => void;
|
|
6
|
-
unmount: (node: HTMLDivElement) => void;
|
|
7
|
-
updateProps?: (params: {
|
|
8
|
-
node: HTMLDivElement;
|
|
9
|
-
props: any;
|
|
10
|
-
}) => void;
|
|
11
|
-
props: any;
|
|
12
|
-
}
|
|
13
|
-
type HostRendererProps = PropsWithChildren<MountProps & {
|
|
14
|
-
component?: string;
|
|
15
|
-
hideRootHtmlElement?: boolean;
|
|
16
|
-
rootProps?: React__default.JSX.IntrinsicElements['div'];
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components
|
|
20
|
-
* from the @tern-secure/ui package. It handles the lifecycle of the mounted component
|
|
21
|
-
* and ensures proper cleanup.
|
|
22
|
-
*/
|
|
23
|
-
declare class TernSecureHostRenderer extends React__default.PureComponent<HostRendererProps> {
|
|
24
|
-
private rootRef;
|
|
25
|
-
componentDidUpdate(prevProps: Readonly<HostRendererProps>): void;
|
|
26
|
-
componentDidMount(): void;
|
|
27
|
-
componentWillUnmount(): void;
|
|
28
|
-
render(): react_jsx_runtime.JSX.Element;
|
|
29
|
-
}
|
|
30
|
-
declare const isMountProps: (props: any) => props is MountProps;
|
|
31
|
-
|
|
32
|
-
export { TernSecureHostRenderer, isMountProps };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";"use client";var h=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var l=(o,t)=>{for(var n in t)i(o,n,{get:t[n],enumerable:!0})},d=(o,t,n,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of a(t))!g.call(o,e)&&e!==n&&i(o,e,{get:()=>t[e],enumerable:!(p=m(t,e))||p.enumerable});return o};var P=(o,t,n)=>(n=o!=null?h(f(o)):{},d(t||!o||!o.__esModule?i(n,"default",{value:o,enumerable:!0}):n,o)),R=o=>d(i({},"__esModule",{value:!0}),o);var C={};l(C,{TernSecureHostRenderer:()=>y,isMountProps:()=>U});module.exports=R(C);var r=require("react/jsx-runtime"),u=P(require("react"));const s=(o,t,n)=>{console.log(`[TernSecureHostRenderer:${o}] ${t}`,n||"")};class y extends u.default.PureComponent{rootRef=u.default.createRef();componentDidUpdate(t){if(this.rootRef.current&&this.props.updateProps){const n=JSON.stringify(t.props)!==JSON.stringify(this.props.props);s(this.props.component,"Props Update Check",{hasChanged:n,prevProps:t.props,newProps:this.props.props}),n&&(s(this.props.component,"Updating Props"),this.props.updateProps({node:this.rootRef.current,props:this.props.props}))}}componentDidMount(){s(this.props.component,"Mounting"),this.rootRef.current&&this.props.mount(this.rootRef.current,this.props.props)}componentWillUnmount(){s(this.props.component,"Unmounting"),this.rootRef.current&&this.props.unmount(this.rootRef.current)}render(){const{hideRootHtmlElement:t=!1,rootProps:n={},children:p,component:e}=this.props,c={ref:this.rootRef,...n,...e&&{"data-ternsecure-component":e}};return s(e,"Rendering",{hideRootHtmlElement:t,hasChildren:!!p,rootAttributes:c}),(0,r.jsxs)(r.Fragment,{children:[!t&&(0,r.jsx)("div",{...c}),p]})}}const U=o=>typeof o.mount=="function"&&typeof o.unmount=="function";0&&(module.exports={TernSecureHostRenderer,isMountProps});
|
|
2
|
-
//# sourceMappingURL=TernSecureHostRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TernSecureHostRenderer.tsx"],"sourcesContent":["'use client'\n\nimport React, { PropsWithChildren } from 'react';\nimport type { SignInUIConfig, SignUpUIConfig } from '@tern-secure/types';\n\n// Debug logging utility\nconst debugLog = (component?: string, action?: string, data?: any) => {\n console.log(`[TernSecureHostRenderer:${component}] ${action}`, data || '');\n};\n\ntype TernUIProps = SignInUIConfig | SignUpUIConfig;\n\ninterface MountProps {\n mount: (node: HTMLDivElement, props: any) => void;\n unmount: (node: HTMLDivElement) => void;\n updateProps?: (params: { node: HTMLDivElement; props: any }) => void;\n props: any;\n}\n\ntype HostRendererProps = PropsWithChildren<\n MountProps & {\n component?: string;\n hideRootHtmlElement?: boolean;\n rootProps?: React.JSX.IntrinsicElements['div'];\n }\n>;\n\n/**\n * TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components\n * from the @tern-secure/ui package. It handles the lifecycle of the mounted component\n * and ensures proper cleanup.\n */\nexport class TernSecureHostRenderer extends React.PureComponent<HostRendererProps> {\n private rootRef = React.createRef<HTMLDivElement>();\n\n componentDidUpdate(prevProps: Readonly<HostRendererProps>) {\n if (this.rootRef.current && this.props.updateProps) {\n const hasPropsChanged = JSON.stringify(prevProps.props) !== JSON.stringify(this.props.props);\n\n debugLog(this.props.component, 'Props Update Check', {\n hasChanged: hasPropsChanged,\n prevProps: prevProps.props,\n newProps: this.props.props,\n });\n\n if (hasPropsChanged) {\n debugLog(this.props.component, 'Updating Props');\n this.props.updateProps({\n node: this.rootRef.current,\n props: this.props.props,\n });\n }\n }\n }\n\n componentDidMount() {\n debugLog(this.props.component, 'Mounting');\n if (this.rootRef.current) {\n this.props.mount(this.rootRef.current, this.props.props);\n }\n }\n\n componentWillUnmount() {\n debugLog(this.props.component, 'Unmounting');\n if (this.rootRef.current) {\n this.props.unmount(this.rootRef.current);\n }\n }\n\n render() {\n const { hideRootHtmlElement = false, rootProps = {}, children, component } = this.props;\n const rootAttributes = {\n ref: this.rootRef,\n ...rootProps,\n ...(component && { 'data-ternsecure-component': component }),\n };\n\n debugLog(component, 'Rendering', {\n hideRootHtmlElement,\n hasChildren: !!children,\n rootAttributes,\n });\n\n return (\n <>\n {!hideRootHtmlElement && <div {...rootAttributes} />}\n {children}\n </>\n );\n }\n}\n\nexport const isMountProps = (props: any): props is MountProps => {\n return typeof props.mount === 'function' && typeof props.unmount === 'function';\n};\n"],"mappings":"ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,iBAAAC,IAAA,eAAAC,EAAAJ,GAoFM,IAAAK,EAAA,6BAlFNC,EAAyC,oBAIzC,MAAMC,EAAW,CAACC,EAAoBC,EAAiBC,IAAe,CACpE,QAAQ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c,OAAOA,EAAM,SAAY","names":["TernSecureHostRenderer_exports","__export","TernSecureHostRenderer","isMountProps","__toCommonJS","import_jsx_runtime","import_react","debugLog","component","action","data","React","prevProps","hasPropsChanged","hideRootHtmlElement","rootProps","children","rootAttributes","props"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{Fragment as c,jsx as u,jsxs as d}from"react/jsx-runtime";import i from"react";const e=(n,o,t)=>{console.log(`[TernSecureHostRenderer:${n}] ${o}`,t||"")};class a extends i.PureComponent{rootRef=i.createRef();componentDidUpdate(o){if(this.rootRef.current&&this.props.updateProps){const t=JSON.stringify(o.props)!==JSON.stringify(this.props.props);e(this.props.component,"Props Update Check",{hasChanged:t,prevProps:o.props,newProps:this.props.props}),t&&(e(this.props.component,"Updating Props"),this.props.updateProps({node:this.rootRef.current,props:this.props.props}))}}componentDidMount(){e(this.props.component,"Mounting"),this.rootRef.current&&this.props.mount(this.rootRef.current,this.props.props)}componentWillUnmount(){e(this.props.component,"Unmounting"),this.rootRef.current&&this.props.unmount(this.rootRef.current)}render(){const{hideRootHtmlElement:o=!1,rootProps:t={},children:p,component:r}=this.props,s={ref:this.rootRef,...t,...r&&{"data-ternsecure-component":r}};return e(r,"Rendering",{hideRootHtmlElement:o,hasChildren:!!p,rootAttributes:s}),d(c,{children:[!o&&u("div",{...s}),p]})}}const f=n=>typeof n.mount=="function"&&typeof n.unmount=="function";export{a as TernSecureHostRenderer,f as isMountProps};
|
|
2
|
-
//# sourceMappingURL=TernSecureHostRenderer.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TernSecureHostRenderer.tsx"],"sourcesContent":["'use client'\n\nimport React, { PropsWithChildren } from 'react';\nimport type { SignInUIConfig, SignUpUIConfig } from '@tern-secure/types';\n\n// Debug logging utility\nconst debugLog = (component?: string, action?: string, data?: any) => {\n console.log(`[TernSecureHostRenderer:${component}] ${action}`, data || '');\n};\n\ntype TernUIProps = SignInUIConfig | SignUpUIConfig;\n\ninterface MountProps {\n mount: (node: HTMLDivElement, props: any) => void;\n unmount: (node: HTMLDivElement) => void;\n updateProps?: (params: { node: HTMLDivElement; props: any }) => void;\n props: any;\n}\n\ntype HostRendererProps = PropsWithChildren<\n MountProps & {\n component?: string;\n hideRootHtmlElement?: boolean;\n rootProps?: React.JSX.IntrinsicElements['div'];\n }\n>;\n\n/**\n * TernSecureHostRenderer is responsible for the actual mounting/unmounting of UI components\n * from the @tern-secure/ui package. It handles the lifecycle of the mounted component\n * and ensures proper cleanup.\n */\nexport class TernSecureHostRenderer extends React.PureComponent<HostRendererProps> {\n private rootRef = React.createRef<HTMLDivElement>();\n\n componentDidUpdate(prevProps: Readonly<HostRendererProps>) {\n if (this.rootRef.current && this.props.updateProps) {\n const hasPropsChanged = JSON.stringify(prevProps.props) !== JSON.stringify(this.props.props);\n\n debugLog(this.props.component, 'Props Update Check', {\n hasChanged: hasPropsChanged,\n prevProps: prevProps.props,\n newProps: this.props.props,\n });\n\n if (hasPropsChanged) {\n debugLog(this.props.component, 'Updating Props');\n this.props.updateProps({\n node: this.rootRef.current,\n props: this.props.props,\n });\n }\n }\n }\n\n componentDidMount() {\n debugLog(this.props.component, 'Mounting');\n if (this.rootRef.current) {\n this.props.mount(this.rootRef.current, this.props.props);\n }\n }\n\n componentWillUnmount() {\n debugLog(this.props.component, 'Unmounting');\n if (this.rootRef.current) {\n this.props.unmount(this.rootRef.current);\n }\n }\n\n render() {\n const { hideRootHtmlElement = false, rootProps = {}, children, component } = this.props;\n const rootAttributes = {\n ref: this.rootRef,\n ...rootProps,\n ...(component && { 'data-ternsecure-component': component }),\n };\n\n debugLog(component, 'Rendering', {\n hideRootHtmlElement,\n hasChildren: !!children,\n rootAttributes,\n });\n\n return (\n <>\n {!hideRootHtmlElement && <div {...rootAttributes} />}\n {children}\n </>\n );\n }\n}\n\nexport const isMountProps = (props: any): props is MountProps => {\n return typeof props.mount === 'function' && typeof props.unmount === 'function';\n};\n"],"mapp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AGCZ,EAAAF,EAAA,CACG,WAACW,GAAuBV,EAAC,OAAK,GAAGa,EAAgB,EACjDD,GACH,CAEJ,CACF,CAEO,MAAME,EAAgBC,GACpB,OAAOA,EAAM,OAAU,YAAc,OAAOA,EAAM,SAAY","names":["Fragment","jsx","jsxs","React","debugLog","component","action","data","TernSecureHostRenderer","prevProps","hasPropsChanged","hideRootHtmlElement","rootProps","children","rootAttributes","isMountProps","props"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var n=(t,a)=>{for(var r in a)o(t,r,{get:a[r],enumerable:!0})},d=(t,a,r,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of i(a))!m.call(t,l)&&l!==r&&o(t,l,{get:()=>a[l],enumerable:!(s=c(a,l))||s.enumerable});return t};var p=t=>d(o({},"__esModule",{value:!0}),t);var v={};n(v,{AuthBackground:()=>f});module.exports=p(v);var e=require("react/jsx-runtime");function f(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80","aria-hidden":"true",children:(0,e.jsx)("div",{className:"relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),(0,e.jsx)("div",{className:"absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]","aria-hidden":"true",children:(0,e.jsx)("div",{className:"relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}0&&(module.exports={AuthBackground});
|
|
2
|
-
//# sourceMappingURL=background.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/background.tsx"],"sourcesContent":["export function AuthBackground() {\r\n return (\r\n <>\r\n {/* Primary gradient blob */}\r\n <div\r\n className=\"absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80\"\r\n aria-hidden=\"true\"\r\n >\r\n <div\r\n className=\"relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75\"\r\n style={{\r\n clipPath:\r\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\r\n }}\r\n />\r\n </div>\r\n \r\n {/* Secondary gradient blob */}\r\n <div\r\n className=\"absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]\"\r\n aria-hidden=\"true\"\r\n >\r\n <div\r\n className=\"relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75\"\r\n style={{\r\n clipPath:\r\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\r\n }}\r\n />\r\n </div>\r\n </>\r\n )\r\n }\r\n \r\n "],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GAEM,IAAAI,EAAA,6BAFC,SAASF,GAAiB,CAC7B,SACE,oBAEE,oBAAC,OACG,UAAU,qFACV,cAAY,OAEZ,mBAAC,OACC,UAAU,kLACV,MAAO,CACL,SACE,kNACJ,EACF,EACF,KAGF,OAAC,OACC,UAAU,mHACV,cAAY,OAEZ,mBAAC,OACC,UAAU,yMACV,MAAO,CACL,SACE,kNACJ,EACF,EACF,GACF,CAEJ","names":["background_exports","__export","AuthBackground","__toCommonJS","import_jsx_runtime"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Fragment as e,jsx as a,jsxs as t}from"react/jsx-runtime";function l(){return t(e,{children:[a("div",{className:"absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80","aria-hidden":"true",children:a("div",{className:"relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a("div",{className:"absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]","aria-hidden":"true",children:a("div",{className:"relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}export{l as AuthBackground};
|
|
2
|
-
//# sourceMappingURL=background.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/background.tsx"],"sourcesContent":["export function AuthBackground() {\r\n return (\r\n <>\r\n {/* Primary gradient blob */}\r\n <div\r\n className=\"absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80\"\r\n aria-hidden=\"true\"\r\n >\r\n <div\r\n className=\"relative left-[calc(50%-11rem)] aspect-1155/678 w-144.5 -translate-x-1/2 rotate-30 bg-linear-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-288.75\"\r\n style={{\r\n clipPath:\r\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\r\n }}\r\n />\r\n </div>\r\n \r\n {/* Secondary gradient blob */}\r\n <div\r\n className=\"absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]\"\r\n aria-hidden=\"true\"\r\n >\r\n <div\r\n className=\"relative left-[calc(50%+3rem)] aspect-1155/678 w-144.5 -translate-x-1/2 bg-linear-to-tr from-[hsl(var(--secondary)/0.3)] to-[hsl(var(--primary)/0.3)] opacity-30 sm:left-[calc(50%+36rem)] sm:w-288.75\"\r\n style={{\r\n clipPath:\r\n 'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',\r\n }}\r\n />\r\n </div>\r\n </>\r\n )\r\n }\r\n \r\n "],"mappings":"AAEM,mBAAAA,EAMM,OAAAC,EANN,QAAAC,MAAA,oBAFC,SAASC,GAAiB,CAC7B,OACED,EAAAF,EAAA,CAEE,UAAAC,EAAC,OACG,UAAU,qFACV,cAAY,OAEZ,SAAAA,EAAC,OACC,UAAU,kLACV,MAAO,CACL,SACE,kNACJ,EACF,EACF,EAGFA,EAAC,OACC,UAAU,mHACV,cAAY,OAEZ,SAAAA,EAAC,OACC,UAAU,yMACV,MAAO,CACL,SACE,kNACJ,EACF,EACF,GACF,CAEJ","names":["Fragment","jsx","jsxs","AuthBackground"]}
|