import type { JSX } from "./tools/JSX"; import type { PasswordPolicies, Attribute, Validators } from "./core/KcContext/KcContext"; export { getButtonToDisplayForMultivaluedAttributeField } from "./core/userProfileApi/index"; import type { MessageKey_defaultSet } from "./i18n"; import type { GenericI18n } from "./i18n/GenericI18n"; import * as coreApi from "./core/userProfileApi/index"; type I18n = GenericI18n; export type FormFieldError = { errorMessage: JSX.Element; errorMessageStr: string; source: FormFieldError.Source; fieldIndex: number | undefined; }; export declare namespace FormFieldError { type Source = Source.Validator | Source.PasswordPolicy | Source.Server | Source.Other; namespace Source { type Validator = { type: "validator"; name: keyof Validators; }; type PasswordPolicy = { type: "passwordPolicy"; name: keyof PasswordPolicies; }; type Server = { type: "server"; }; type Other = { type: "other"; rule: "passwordConfirmMatchesPassword" | "requiredField"; }; } } export type FormFieldState = { attribute: Attribute; displayableErrors: FormFieldError[]; valueOrValues: string | string[]; }; export type FormState = { isFormSubmittable: boolean; formFieldStates: FormFieldState[]; }; export type FormAction = { action: "update"; name: string; valueOrValues: string | string[]; /** Default false */ displayErrorsImmediately?: boolean; } | { action: "focus lost"; name: string; fieldIndex: number | undefined; }; export type KcContextLike = coreApi.KcContextLike; export type I18nLike = Pick; export type ParamsOfUseUserProfileForm = { kcContext: KcContextLike; doMakeUserConfirmPassword: boolean; i18n: I18nLike; }; export type ReturnTypeOfUseUserProfileForm = { formState: FormState; dispatchFormAction: (action: FormAction) => void; }; export declare function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTypeOfUseUserProfileForm;