UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

100 lines (99 loc) 2.94 kB
import { AuthPluginBase, AuthPluginLocalizationContext } from '../../lib/auth-plugin'; import { UsernameLocalization } from './username-localization'; export type UsernamePluginOptions = { /** * Whether to use displayUsername for the visible username field in the profile. */ displayUsername?: boolean; /** * Whether to check username availability on sign-up and user profile. */ isUsernameAvailable?: boolean; /** * Minimum allowed username length. * @default 3 */ minUsernameLength?: number; /** * Maximum allowed username length. * @default 30 */ maxUsernameLength?: number; /** * Override the plugin's default localization strings. * @remarks `UsernameLocalization` */ localization?: Partial<UsernameLocalization>; /** * Prefix prepended to usernames. * @default "" */ usernamePrefix?: string; }; export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefined) => { minUsernameLength: number; maxUsernameLength: number; usernamePrefix: string; localization: { username: string; usernamePlaceholder: string; usernameOrEmailPlaceholder: string; usernameAvailable: string; usernameTaken: string; displayUsername: string; displayUsernamePlaceholder: string; }; additionalFields: ({ name: string; type: "string"; label: string; placeholder: string; inputType: "input"; signUp: "above"; required: boolean; } | { name: string; type: "string"; label: string; placeholder: string; inputType: "input"; signUp: "above"; required?: undefined; })[]; _localizationResolver: (plugin: AuthPluginBase, context: AuthPluginLocalizationContext) => { additionalFields: ({ name: string; type: "string"; label: string; placeholder: string; inputType: "input"; signUp: "above"; required: boolean; } | { name: string; type: "string"; label: string; placeholder: string; inputType: "input"; signUp: "above"; required?: undefined; })[]; id: string; localization?: Record<string, unknown>; _localizationOverrides?: Record<string, unknown>; _localizationResolver?: import('../..').AuthPluginLocalizationResolver; viewPaths?: import('../..').AuthPluginViewPaths; }; /** * Whether to use displayUsername for the visible username field in the profile. */ displayUsername?: boolean; /** * Whether to check username availability on sign-up and user profile. */ isUsernameAvailable?: boolean; } & { id: "username"; }) & { id: "username"; };