pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
62 lines (61 loc) • 2.12 kB
TypeScript
import type { AuthResponse, CustomAuthConfig } from '../types';
import type { BaseAuthPageProps } from './AuthFormUtils';
/**
* Base login credentials interface that can be extended for specific implementations
*/
interface PagamioLoginCredentials {
username: string;
password: string;
rememberMe?: boolean;
}
/**
* Props for the PagamioLoginPage component
* @template T - Authentication configuration type
*/
interface PagamioLoginPageProps<T extends CustomAuthConfig> extends BaseAuthPageProps {
/** Customizable text content */
text?: {
welcomeTitle: string;
welcomeSubtitle: string;
usernameLabel: string;
passwordLabel: string;
rememberMeLabel: string;
loginButtonLabel: string;
loadingButtonLabel: string;
forgotPasswordLabel: string;
createAccountLabel: string;
};
/** Callback handlers */
onForgotPassword?: () => void;
onLoginSuccess?: (authResponse?: AuthResponse<T>) => void;
onLoginError?: (error: Error) => void;
/** Account creation options */
hasCreateAccount?: boolean;
createAccountRoute?: string;
onCreateAccount?: () => void;
/** Styling options */
className?: string;
cardClassName?: string;
}
export interface LoginErrorProps {
code: string;
message: string;
}
export declare const loginPageDefaultText: {
welcomeTitle: string;
welcomeSubtitle: string;
usernameLabel: string;
passwordLabel: string;
rememberMeLabel: string;
loginButtonLabel: string;
loadingButtonLabel: string;
forgotPasswordLabel: string;
createAccountLabel: string;
};
/**
* Generic Login Page component
* @template T - Authentication configuration type
*/
export declare function PagamioLoginPage<T extends CustomAuthConfig>({ logo, text, appLabel, onForgotPassword, onLoginSuccess, onLoginError, hasCreateAccount, createAccountRoute, onCreateAccount, className, }: Readonly<PagamioLoginPageProps<T>>): import("react/jsx-runtime").JSX.Element;
export default PagamioLoginPage;
export type { PagamioLoginCredentials, PagamioLoginPageProps };