@adyen/kyc-components
Version:
This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.
28 lines (27 loc) • 1.26 kB
TypeScript
import type { Dispatch, StateUpdater } from 'preact/hooks';
import type { TopLevelDataSchema } from '../context/StateContext/types';
import type { AdditionalEventProperties } from '../core/user-events';
import type { EntityProblems } from '../types/errors/entity-problems';
import type { FormModelWithValidity } from '../types/form';
import type { Form } from './useMultiForm/types';
export interface FormComposer {
handleNextClick(updatedForms?: FormModelWithValidity[]): void;
handleBackClick?(): void;
gotoFormByFormIndex(index: number): void;
gotoFormByFormId(formId: string): void;
activeForm: FormModelWithValidity;
shouldValidate: boolean;
setShouldValidate: Dispatch<StateUpdater<boolean>>;
steps: {
current: number;
total: number;
};
}
export declare const useFormComposer: <Schema extends TopLevelDataSchema = TopLevelDataSchema>({ problems, navigationTrackingParams, forms, externalBackClick, onSubmit, triggerValidation, }: {
problems?: EntityProblems;
navigationTrackingParams?: Partial<AdditionalEventProperties>;
forms: FormModelWithValidity[];
externalBackClick?(): void;
onSubmit(): void;
triggerValidation?: Form<Schema>["triggerValidation"];
}) => FormComposer;