@tern-secure/types 1.0.3 → 1.0.5
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/esm/index.js +0 -106
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +356 -41
- package/dist/index.d.ts +1054 -11
- package/dist/index.js +0 -110
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/all.d.ts +0 -105
- package/dist/all.d.ts.map +0 -1
- package/dist/auth.d.ts +0 -37
- package/dist/auth.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -66
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/instanceTree.d.ts +0 -121
- package/dist/instanceTree.d.ts.map +0 -1
- package/dist/redirect.d.ts +0 -8
- package/dist/redirect.d.ts.map +0 -1
- package/dist/session.d.ts +0 -87
- package/dist/session.d.ts.map +0 -1
- package/dist/signIn.d.ts +0 -56
- package/dist/signIn.d.ts.map +0 -1
- package/dist/signUp.d.ts +0 -20
- package/dist/signUp.d.ts.map +0 -1
- package/dist/ternsecure.d.ts +0 -123
- package/dist/ternsecure.d.ts.map +0 -1
- package/dist/theme.d.ts +0 -133
- package/dist/theme.d.ts.map +0 -1
package/dist/session.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
export type SessionStatus = 'active' | 'expired' | 'revoked' | 'pending';
|
|
2
|
-
/**
|
|
3
|
-
* parsed can be replaced with
|
|
4
|
-
*/
|
|
5
|
-
export declare interface ParsedToken {
|
|
6
|
-
/** Expiration time of the token. */
|
|
7
|
-
'exp'?: string;
|
|
8
|
-
/** UID of the user. */
|
|
9
|
-
'sub'?: string;
|
|
10
|
-
/** Time at which authentication was performed. */
|
|
11
|
-
'auth_time'?: string;
|
|
12
|
-
/** Issuance time of the token. */
|
|
13
|
-
'iat'?: string;
|
|
14
|
-
/** Firebase specific claims, containing the provider(s) used to authenticate the user. */
|
|
15
|
-
'firebase'?: {
|
|
16
|
-
'sign_in_provider'?: string;
|
|
17
|
-
'sign_in_second_factor'?: string;
|
|
18
|
-
'identities'?: Record<string, string>;
|
|
19
|
-
};
|
|
20
|
-
/** Map of any additional custom claims. */
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Core properties for any session that is or was authenticated.
|
|
25
|
-
* These properties are guaranteed to exist for active, expired, or revoked sessions.
|
|
26
|
-
*/
|
|
27
|
-
interface AuthenticatedSessionBase {
|
|
28
|
-
/** The Firebase Auth ID token JWT string. */
|
|
29
|
-
token: string;
|
|
30
|
-
/** The ID token expiration time (e.g., UTC string or Unix timestamp). */
|
|
31
|
-
expirationTime: string;
|
|
32
|
-
/** The ID token issuance time. */
|
|
33
|
-
issuedAtTime: string;
|
|
34
|
-
/** Time at which authentication was performed (from token claims). */
|
|
35
|
-
authTime: string;
|
|
36
|
-
/**
|
|
37
|
-
* The entire payload claims of the ID token including the standard reserved claims
|
|
38
|
-
* as well as custom claims.
|
|
39
|
-
*/
|
|
40
|
-
claims: ParsedToken;
|
|
41
|
-
/**
|
|
42
|
-
* Time the user last signed in.
|
|
43
|
-
* This could be from Firebase User metadata or persisted by TernSecure.
|
|
44
|
-
*/
|
|
45
|
-
lastSignedAt?: number;
|
|
46
|
-
/** signInProvider */
|
|
47
|
-
signInProvider: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Represents a session when the user is authenticated and the token is considered active.
|
|
51
|
-
*/
|
|
52
|
-
export interface ActiveSession extends AuthenticatedSessionBase {
|
|
53
|
-
status: 'active';
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Represents a session when the user was authenticated, but the token has expired.
|
|
57
|
-
*/
|
|
58
|
-
export interface ExpiredSession extends AuthenticatedSessionBase {
|
|
59
|
-
status: 'expired';
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Represents a session that is awaiting some action.
|
|
63
|
-
*/
|
|
64
|
-
export interface PendingSession extends AuthenticatedSessionBase {
|
|
65
|
-
status: 'pending';
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Defines the possible states of a user's session within TernSecure.
|
|
69
|
-
* This is a discriminated union based on the `status` property.
|
|
70
|
-
* The actual `TernSecureUser` (Firebase User object) is typically stored separately,
|
|
71
|
-
* for example, in `TernSecureInstanceTree.auth.user`.
|
|
72
|
-
*/
|
|
73
|
-
export type TernSecureSessionTree = ActiveSession | ExpiredSession;
|
|
74
|
-
export type SignedInSession = ActiveSession | PendingSession | ExpiredSession;
|
|
75
|
-
export interface SessionParams {
|
|
76
|
-
idToken: string;
|
|
77
|
-
csrfToken?: string;
|
|
78
|
-
}
|
|
79
|
-
export interface SessionResult {
|
|
80
|
-
success: boolean;
|
|
81
|
-
message: string;
|
|
82
|
-
expiresIn?: number;
|
|
83
|
-
error?: string;
|
|
84
|
-
cookieSet?: boolean;
|
|
85
|
-
}
|
|
86
|
-
export {};
|
|
87
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAGzE;;GAEG;AAGH,MAAM,CAAC,OAAO,WAAW,WAAW;IAChC,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,UAAU,CAAC,EAAE;QACT,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,YAAY,CAAC,EAAE,MAAM,CAAC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-
import type { SignInResponseTree } from './errors';
|
|
2
|
-
export type SignInStatus = 'idle' | 'pending_email_password' | 'pending_social' | 'pending_mfa' | 'redirecting' | 'success' | 'error';
|
|
3
|
-
export type SignInFormValuesTree = {
|
|
4
|
-
email: string;
|
|
5
|
-
password: string;
|
|
6
|
-
phoneNumber?: string;
|
|
7
|
-
};
|
|
8
|
-
export type SignInInitialValueTree = Partial<SignInFormValuesTree>;
|
|
9
|
-
export interface ResendEmailVerification extends SignInResponseTree {
|
|
10
|
-
isVerified?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function isSignInResponseTree(value: any): value is SignInResponseTree;
|
|
13
|
-
export interface SignInResource {
|
|
14
|
-
/**
|
|
15
|
-
* The current status of the sign-in process.
|
|
16
|
-
*/
|
|
17
|
-
status?: SignInStatus;
|
|
18
|
-
/**
|
|
19
|
-
* Signs in a user with their email and password.
|
|
20
|
-
* @param params - The sign-in form values.
|
|
21
|
-
* @returns A promise that resolves with the sign-in response.
|
|
22
|
-
*/
|
|
23
|
-
withEmailAndPassword: (params: SignInFormValuesTree) => Promise<SignInResponseTree>;
|
|
24
|
-
/**
|
|
25
|
-
* @param provider - The identifier of the social provider (e.g., 'google', 'microsoft', 'github').
|
|
26
|
-
* @param options - Optional configuration for the social sign-in flow.
|
|
27
|
-
* @returns A promise that resolves with the sign-in response or void if redirecting.
|
|
28
|
-
*/
|
|
29
|
-
withSocialProvider: (provider: string, options?: {
|
|
30
|
-
mode?: 'popup' | 'redirect';
|
|
31
|
-
}) => Promise<SignInResponseTree | void>;
|
|
32
|
-
/**
|
|
33
|
-
* Completes an MFA (Multi-Factor Authentication) step after a primary authentication attempt.
|
|
34
|
-
* @param mfaToken - The MFA token or code submitted by the user.
|
|
35
|
-
* @param mfaContext - Optional context or session data from the MFA initiation step.
|
|
36
|
-
* @returns A promise that resolves with the sign-in response upon successful MFA verification.
|
|
37
|
-
*/
|
|
38
|
-
completeMfaSignIn: (mfaToken: string, mfaContext?: any) => Promise<SignInResponseTree>;
|
|
39
|
-
/**
|
|
40
|
-
* Sends a password reset email to the given email address.
|
|
41
|
-
* @param email - The user's email address.
|
|
42
|
-
* @returns A promise that resolves when the email is sent.
|
|
43
|
-
*/
|
|
44
|
-
sendPasswordResetEmail: (email: string) => Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Resends the email verification link to the user's email address.
|
|
47
|
-
* @returns A promise that resolves with the sign-in response.
|
|
48
|
-
*/
|
|
49
|
-
resendEmailVerification: () => Promise<ResendEmailVerification>;
|
|
50
|
-
/**
|
|
51
|
-
* Checks the result of a redirect-based sign-in flow, typically used in OAuth or SSO scenarios.
|
|
52
|
-
* @returns A promise that resolves with the sign-in response or null if no result is available.
|
|
53
|
-
*/
|
|
54
|
-
checkRedirectResult: () => Promise<SignInResponseTree | null>;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=signIn.d.ts.map
|
package/dist/signIn.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signIn.d.ts","sourceRoot":"","sources":["../src/signIn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,wBAAwB,GACxB,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,SAAS,GACT,OAAO,CAAC;AAIZ,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAGnE,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAM5E;AAID,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,oBAAoB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpF;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;KAAE,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACxH;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACvF;;;;OAIG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD;;;OAGG;IACH,uBAAuB,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChE;;;OAGG;IACH,mBAAmB,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CAC/D"}
|
package/dist/signUp.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { SignInResponseTree } from './errors';
|
|
2
|
-
export interface SignUpResource {
|
|
3
|
-
status?: SignUpStatus | null;
|
|
4
|
-
username?: string | null;
|
|
5
|
-
firstName?: string | null;
|
|
6
|
-
lastName?: string | null;
|
|
7
|
-
displayName?: string | null;
|
|
8
|
-
email: string | null;
|
|
9
|
-
phoneNumber?: string | null;
|
|
10
|
-
/**
|
|
11
|
-
* @param provider - The identifier of the social provider (e.g., 'google', 'microsoft', 'github').
|
|
12
|
-
* @param options - Optional configuration for the social sign-in flow.
|
|
13
|
-
* @returns A promise that resolves with the sign-in response or void if redirecting.
|
|
14
|
-
*/
|
|
15
|
-
withSocialProvider: (provider: string, options?: {
|
|
16
|
-
mode?: 'popup' | 'redirect';
|
|
17
|
-
}) => Promise<SignInResponseTree | void>;
|
|
18
|
-
}
|
|
19
|
-
export type SignUpStatus = 'missing_requirements' | 'complete' | 'abandoned';
|
|
20
|
-
//# sourceMappingURL=signUp.d.ts.map
|
package/dist/signUp.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signUp.d.ts","sourceRoot":"","sources":["../src/signUp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EACrB,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;KAAE,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CAC1H;AAED,MAAM,MAAM,YAAY,GAAG,sBAAsB,GAAG,UAAU,GAAG,WAAW,CAAC"}
|
package/dist/ternsecure.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { TernSecureUser } from './all';
|
|
2
|
-
import { Appearance } from './theme';
|
|
3
|
-
export interface TernSecureSession {
|
|
4
|
-
token: string | null;
|
|
5
|
-
expiresAt?: number;
|
|
6
|
-
}
|
|
7
|
-
type SignInFormValues = {
|
|
8
|
-
email: string;
|
|
9
|
-
password: string;
|
|
10
|
-
phoneNumber?: string;
|
|
11
|
-
};
|
|
12
|
-
export type SignInInitialValue = Partial<SignInFormValues>;
|
|
13
|
-
type SignUpFormValues = {
|
|
14
|
-
email: string;
|
|
15
|
-
password: string;
|
|
16
|
-
confirmPassword?: string;
|
|
17
|
-
displayName?: string;
|
|
18
|
-
};
|
|
19
|
-
export type SignUpInitialValue = Partial<SignUpFormValues>;
|
|
20
|
-
export interface SignInResponse {
|
|
21
|
-
success: boolean;
|
|
22
|
-
message?: string;
|
|
23
|
-
error?: any | undefined;
|
|
24
|
-
user?: any;
|
|
25
|
-
}
|
|
26
|
-
export interface AuthError extends Error {
|
|
27
|
-
code?: any | string;
|
|
28
|
-
message: string;
|
|
29
|
-
response?: SignInResponse;
|
|
30
|
-
}
|
|
31
|
-
export declare function isSignInResponse(value: any): value is SignInResponse;
|
|
32
|
-
export interface AuthActions {
|
|
33
|
-
signInWithEmail: (email: string, password: string) => Promise<SignInResponse>;
|
|
34
|
-
signInWithGoogle: () => Promise<void>;
|
|
35
|
-
signInWithMicrosoft: () => Promise<void>;
|
|
36
|
-
signOut: () => Promise<void>;
|
|
37
|
-
getRedirectResult: () => Promise<any>;
|
|
38
|
-
getIdToken: () => Promise<string | null>;
|
|
39
|
-
createUserWithEmailAndPassword?: (email: string, password: string) => Promise<SignInResponse>;
|
|
40
|
-
sendEmailVerification?: (user: TernSecureUser) => Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
export interface RedirectConfig {
|
|
43
|
-
redirectUrl?: string;
|
|
44
|
-
isReturn?: boolean;
|
|
45
|
-
priority?: number;
|
|
46
|
-
}
|
|
47
|
-
export interface SignInProps extends RedirectConfig {
|
|
48
|
-
initialValue?: SignInInitialValue;
|
|
49
|
-
logo?: string;
|
|
50
|
-
appName?: string;
|
|
51
|
-
appearance?: Appearance;
|
|
52
|
-
onError?: (error: AuthError) => void;
|
|
53
|
-
onSuccess?: (user: TernSecureUser | null) => void;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* SignUpProps interface defines the properties for the sign-up component.
|
|
57
|
-
* It extends RedirectConfig to include redirect-related properties.
|
|
58
|
-
*/
|
|
59
|
-
export interface SignUpProps extends RedirectConfig {
|
|
60
|
-
initialValue?: SignUpInitialValue;
|
|
61
|
-
logo?: string;
|
|
62
|
-
appName?: string;
|
|
63
|
-
appearance?: Appearance;
|
|
64
|
-
onError?: (error: AuthError) => void;
|
|
65
|
-
onSuccess?: (user: TernSecureUser | null) => void;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Defines the contract for a TernSecure instance.
|
|
69
|
-
* This instance provides authentication state, user information, and methods
|
|
70
|
-
* for managing the authentication lifecycle. It is designed to be used by
|
|
71
|
-
* UI packages like tern-ui, which act as "dumb" renderers.
|
|
72
|
-
*/
|
|
73
|
-
export interface TernSecureInstance {
|
|
74
|
-
/** Indicates if the user is currently signed in. */
|
|
75
|
-
isSignedIn: () => boolean;
|
|
76
|
-
/** The current authenticated user object, or null if not signed in. */
|
|
77
|
-
user: TernSecureUser | null;
|
|
78
|
-
/** The current user session information, or null if not signed in. */
|
|
79
|
-
session: TernSecureSession | null;
|
|
80
|
-
/** Initiates the sign-out process for the current user. */
|
|
81
|
-
signOut: () => Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Prepares or signals to mount the sign-in interface.
|
|
84
|
-
* @param options Optional configuration or initial state for the sign-in UI, conforming to SignInProps.
|
|
85
|
-
*/
|
|
86
|
-
mountSignIn: (options?: SignInProps) => void;
|
|
87
|
-
/** Cleans up or signals to unmount the sign-in interface. */
|
|
88
|
-
unmountSignIn: () => void;
|
|
89
|
-
/**
|
|
90
|
-
* Prepares or signals to mount the sign-up interface.
|
|
91
|
-
* @param options Optional configuration or initial state for the sign-up UI, conforming to SignUpProps.
|
|
92
|
-
*/
|
|
93
|
-
mountSignUp: (options?: SignUpProps) => void;
|
|
94
|
-
/** Cleans up or signals to unmount the sign-up interface. */
|
|
95
|
-
unmountSignUp: () => void;
|
|
96
|
-
/**
|
|
97
|
-
* Determines if a redirect is necessary based on the current authentication
|
|
98
|
-
* state and the given path.
|
|
99
|
-
* @param currentPath The current URL path.
|
|
100
|
-
* @returns True if a redirect is needed, false otherwise, or a string path to redirect to.
|
|
101
|
-
*/
|
|
102
|
-
shouldRedirect: (currentPath: string) => boolean | string;
|
|
103
|
-
/**
|
|
104
|
-
* Constructs a URL, appending necessary redirect parameters.
|
|
105
|
-
* Useful for redirecting back to the original page after authentication.
|
|
106
|
-
* @param baseUrl The base URL to which redirect parameters should be added.
|
|
107
|
-
* @returns The new URL string with redirect parameters.
|
|
108
|
-
*/
|
|
109
|
-
constructUrlWithRedirect: (baseUrl: string) => string;
|
|
110
|
-
/**
|
|
111
|
-
* Redirects the user to the configured login page.
|
|
112
|
-
* @param redirectUrl Optional URL to redirect to after successful login.
|
|
113
|
-
*/
|
|
114
|
-
redirectToLogin: (redirectUrl?: string) => void;
|
|
115
|
-
/** Indicates if an authentication operation is currently in progress. */
|
|
116
|
-
isLoading: boolean;
|
|
117
|
-
/** Holds any error that occurred during an authentication operation, or null otherwise. */
|
|
118
|
-
error: Error | null;
|
|
119
|
-
/** Indicates if the user has verified their email address. */
|
|
120
|
-
sendVerificationEmail: () => Promise<void>;
|
|
121
|
-
}
|
|
122
|
-
export {};
|
|
123
|
-
//# sourceMappingURL=ternsecure.d.ts.map
|
package/dist/ternsecure.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ternsecure.d.ts","sourceRoot":"","sources":["../src/ternsecure.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,M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IAElC,2DAA2D;IAC3D,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAE7C,6DAA6D;IAC7D,aAAa,EAAE,MAAM,IAAI,CAAC;IAE1B;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IAE7C,6DAA6D;IAC7D,aAAa,EAAE,MAAM,IAAI,CAAC;IAE1B;;;;;OAKG;IACH,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC;IAE1D;;;;;OAKG;IACH,wBAAwB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtD;;;OAGG;IACH,eAAe,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,yEAAyE;IACzE,SAAS,EAAE,OAAO,CAAC;IAEnB,2FAA2F;IAC3F,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,8DAA8D;IAC9D,qBAAqB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C"}
|
package/dist/theme.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the basic structure for color theming.
|
|
3
|
-
*/
|
|
4
|
-
export interface ThemeColors {
|
|
5
|
-
primary?: string;
|
|
6
|
-
secondary?: string;
|
|
7
|
-
accent?: string;
|
|
8
|
-
background?: string;
|
|
9
|
-
text?: string;
|
|
10
|
-
error?: string;
|
|
11
|
-
success?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Defines the basic structure for font theming.
|
|
15
|
-
*/
|
|
16
|
-
export interface ThemeFonts {
|
|
17
|
-
primary?: string;
|
|
18
|
-
secondary?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Defines the basic structure for spacing and layout theming.
|
|
22
|
-
*/
|
|
23
|
-
export interface ThemeSpacing {
|
|
24
|
-
small?: string | number;
|
|
25
|
-
medium?: string | number;
|
|
26
|
-
large?: string | number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Defines the basic structure for border radius theming.
|
|
30
|
-
*/
|
|
31
|
-
export interface ThemeBorderRadius {
|
|
32
|
-
small?: string | number;
|
|
33
|
-
medium?: string | number;
|
|
34
|
-
large?: string | number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Allows for overriding styles of specific UI components.
|
|
38
|
-
* Properties can be CSS-in-JS objects or class names, depending on implementation.
|
|
39
|
-
*/
|
|
40
|
-
export interface ThemeComponentStyles {
|
|
41
|
-
button?: Record<string, any> | string;
|
|
42
|
-
input?: Record<string, any> | string;
|
|
43
|
-
card?: Record<string, any> | string;
|
|
44
|
-
label?: Record<string, any> | string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Defines the overall appearance/theme configuration.
|
|
48
|
-
* This allows for broad customization of the UI components.
|
|
49
|
-
*/
|
|
50
|
-
export interface Appearance {
|
|
51
|
-
colors?: ThemeColors;
|
|
52
|
-
fonts?: ThemeFonts;
|
|
53
|
-
spacing?: ThemeSpacing;
|
|
54
|
-
borderRadius?: ThemeBorderRadius;
|
|
55
|
-
componentStyles?: ThemeComponentStyles;
|
|
56
|
-
variables?: Record<string, string | number>;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Base UI configuration shared between SignIn and SignUp
|
|
60
|
-
*/
|
|
61
|
-
export interface BaseAuthUIConfig {
|
|
62
|
-
/** Visual appearance configuration */
|
|
63
|
-
appearance?: Appearance;
|
|
64
|
-
/** Application logo URL or SVG string */
|
|
65
|
-
logo?: string;
|
|
66
|
-
/** Application name for display */
|
|
67
|
-
appName?: string;
|
|
68
|
-
/** Render mode for cross-platform support */
|
|
69
|
-
renderMode?: 'modal' | 'page' | 'embedded';
|
|
70
|
-
/** Layout direction */
|
|
71
|
-
layout?: 'vertical' | 'horizontal';
|
|
72
|
-
/** Custom loading message */
|
|
73
|
-
loadingMessage?: string;
|
|
74
|
-
/** Loading spinner variant */
|
|
75
|
-
loadingSpinnerVariant?: 'circular' | 'linear' | 'dots';
|
|
76
|
-
/** Accessibility configuration */
|
|
77
|
-
a11y?: {
|
|
78
|
-
/** ARIA labels and descriptions */
|
|
79
|
-
labels?: Record<string, string>;
|
|
80
|
-
/** Element to receive initial focus */
|
|
81
|
-
initialFocus?: string;
|
|
82
|
-
/** Whether to trap focus within the auth UI */
|
|
83
|
-
trapFocus?: boolean;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Sign-in specific UI configuration
|
|
88
|
-
*/
|
|
89
|
-
export interface SignInUIConfig extends BaseAuthUIConfig {
|
|
90
|
-
/** Social sign-in buttons configuration */
|
|
91
|
-
socialButtons?: {
|
|
92
|
-
google?: boolean;
|
|
93
|
-
microsoft?: boolean;
|
|
94
|
-
github?: boolean;
|
|
95
|
-
facebook?: boolean;
|
|
96
|
-
twitter?: boolean;
|
|
97
|
-
apple?: boolean;
|
|
98
|
-
linkedin?: boolean;
|
|
99
|
-
layout?: 'vertical' | 'horizontal';
|
|
100
|
-
size?: 'small' | 'medium' | 'large';
|
|
101
|
-
};
|
|
102
|
-
/** "Remember me" checkbox configuration */
|
|
103
|
-
rememberMe?: {
|
|
104
|
-
enabled?: boolean;
|
|
105
|
-
defaultChecked?: boolean;
|
|
106
|
-
};
|
|
107
|
-
/** Sign-up link configuration */
|
|
108
|
-
signUpLink?: {
|
|
109
|
-
enabled?: boolean;
|
|
110
|
-
text?: string;
|
|
111
|
-
href?: string;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Sign-up specific UI configuration
|
|
116
|
-
*/
|
|
117
|
-
export interface SignUpUIConfig extends BaseAuthUIConfig {
|
|
118
|
-
/** Password requirements display configuration */
|
|
119
|
-
passwordRequirements?: {
|
|
120
|
-
show?: boolean;
|
|
121
|
-
rules?: Array<{
|
|
122
|
-
rule: string;
|
|
123
|
-
description: string;
|
|
124
|
-
}>;
|
|
125
|
-
};
|
|
126
|
-
/** Terms and conditions configuration */
|
|
127
|
-
terms?: {
|
|
128
|
-
enabled?: boolean;
|
|
129
|
-
text?: string;
|
|
130
|
-
link?: string;
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=theme.d.ts.map
|
package/dist/theme.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;;GAGG;A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