UNPKG

@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.

31 lines (30 loc) 1.99 kB
import type { TopLevelDataSchema } from '../context/StateContext/types'; import type { VerificationError } from '../core/models/api/verification-error'; import type { FormConfiguration } from '../types/form-configuration'; import type { FormRules } from '../types/form-rules'; interface CalculateLinkedRequiredFieldsOptions<OuterFormSchema extends TopLevelDataSchema> { field: Extract<keyof OuterFormSchema[keyof OuterFormSchema], string>; formId: Extract<keyof OuterFormSchema, string>; customRules: FormRules<string>; scenarioConfiguration: FormConfiguration<OuterFormSchema, string>; dataMissingErrors: VerificationError[]; formFieldsWithExistingData: string[]; } /** * This function is used to process fields linked to other fields that have custom rules that can return either REQUIRED or OPTIONAL * depending on the value of their links. An example of this is the Vat number, this will be REQUIRED when exemption is false but OPTIONAL when exemption is true. * This needs to be done due to functions like isFieldRequiredToRemediateDataMissingError, which do not take into account the custom rules and instead mark * these fields as required regardless of the rule. * * @param field - Field being processed * @param formId - Form this field is associated to * @param customRules - The rules associated to the form flow * @param scenarioConfiguration - The static configuration returned from the scenario, i.e. L1, L, etc * @param dataMissingErrors - Missing data problems on the LE response * @param formFieldsWithExistingData - The current fields that have existing data within the LE response */ export declare function calculateLinkedRequiredFields<OuterFormSchema extends TopLevelDataSchema>({ field, formId, customRules, scenarioConfiguration, dataMissingErrors, formFieldsWithExistingData, }: CalculateLinkedRequiredFieldsOptions<OuterFormSchema>): { isRequiredFromLinkedField: boolean; isOptionalFromLinkedField: boolean; }; export {};