@edflex-tech/keycloakify
Version:
Keycloak theme generator for Reacts app
71 lines (70 loc) • 2.53 kB
TypeScript
/// <reference types="react" />
import "./tools/Array.prototype.every";
import type { KcContextBase, Validators, Attribute } from "./getKcContext/KcContextBase";
import type { KcLanguageTag } from "./i18n";
export declare function useGetErrors(params: {
kcContext: {
messagesPerField: Pick<KcContextBase.Common["messagesPerField"], "existsError" | "get">;
profile: {
attributes: {
name: string;
value?: string;
validators: Validators;
}[];
};
locale?: {
currentLanguageTag: KcLanguageTag;
};
};
}): {
getErrors: (params: {
name: string;
fieldValueByAttributeName: Record<string, {
value: string;
}>;
}) => {
errorMessage: JSX.Element;
errorMessageStr: string;
validatorName: keyof Validators | undefined;
}[];
};
export declare function useFormValidationSlice(params: {
kcContext: {
messagesPerField: Pick<KcContextBase.Common["messagesPerField"], "existsError" | "get">;
profile: {
attributes: Attribute[];
};
passwordRequired: boolean;
realm: {
registrationEmailAsUsername: boolean;
};
locale?: {
currentLanguageTag: KcLanguageTag;
};
};
/** NOTE: Try to avoid passing a new ref every render for better performances. */
passwordValidators?: Validators;
}): {
formValidationState: {
fieldStateByAttributeName: {
[k: string]: {
value: string;
displayableErrors: {
errorMessage: JSX.Element;
errorMessageStr: string;
validatorName: "double" | "pattern" | "length" | "email" | "options" | "integer" | "up-immutable-attribute" | "up-attribute-required-by-metadata-value" | "up-username-has-value" | "up-duplicate-username" | "up-username-mutation" | "up-email-exists-as-username" | "up-blank-attribute-value" | "up-duplicate-email" | "local-date" | "person-name-prohibited-characters" | "uri" | "username-prohibited-characters" | "_compareToOther" | undefined;
}[];
};
};
isFormSubmittable: boolean;
};
formValidationReducer: import("react").Dispatch<{
action: "update value";
name: string;
newValue: string;
} | {
action: "focus lost";
name: string;
}>;
attributesWithPassword: Attribute[];
};