@leancodepl/kratos
Version:
Headless React components library for building Ory Kratos authentication flows
13 lines • 1.53 kB
TypeScript
import { DeepKeys, DeepRecord, FormApi, FormAsyncValidateOrFn, FormValidateOrFn } from '@tanstack/react-form';
import { LoginFlow, RegistrationFlow, VerificationFlow } from '../kratos';
import { AuthError } from './errors';
export type OnFlowError<TFlowErrors extends string = string> = (props: {
target: "root" | TFlowErrors;
errors: AuthError[];
}) => Promise<void> | void;
export type FlattenObjectKeys<T extends Record<string, unknown>, Key = keyof T> = Key extends string ? T[Key] extends Record<string, unknown> ? `${Key}.${FlattenObjectKeys<T[Key]>}` : `${Key}` : never;
export type TraitValue<TTrait extends string> = `traits.${TTrait}` extends "traits" | `traits.${string}` ? DeepRecord<{
traits: Record<string, boolean | string>;
}>[`traits.${TTrait}`] : never;
export declare const handleOnSubmitErrors: <TFields extends Record<string, unknown>, TResponse extends LoginFlow | RegistrationFlow | VerificationFlow>(response: TResponse, formApi: FormApi<TFields, FormValidateOrFn<TFields> | undefined, FormValidateOrFn<TFields> | undefined, FormAsyncValidateOrFn<TFields> | undefined, FormValidateOrFn<TFields> | undefined, FormAsyncValidateOrFn<TFields> | undefined, FormValidateOrFn<TFields> | undefined, FormAsyncValidateOrFn<TFields> | undefined, FormValidateOrFn<TFields> | undefined, FormAsyncValidateOrFn<TFields> | undefined, FormAsyncValidateOrFn<TFields> | undefined, unknown>, onError?: OnFlowError<Extract<DeepKeys<TFields>, FlattenObjectKeys<TFields>>>) => void;
//# sourceMappingURL=form.d.ts.map