@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.
33 lines (32 loc) • 1.16 kB
TypeScript
import type { Mask, MaskToken } from './maskTypes';
interface CorrectResult {
outcome: 'partialCorrect' | 'correct' | 'obscureCorrect';
displayValue: string;
potentialForMoreOptionalInput?: boolean;
}
export interface MismatchResult {
outcome: 'mismatch';
badChar: string;
mismatchAtChar: number;
mismatchedToken: MaskToken | 'inputTooLong';
partialDisplayValue: string;
}
export type MaskResult = CorrectResult | MismatchResult;
export type MatchedToken = MaskToken & {
char: string;
};
/**
* Takes some pure value e.g. `NL123456` and a {@link Mask}, and returns a `partialCorrect`,
* `correct` or `mismatch` {@link MaskResult} accordingly.
*
* This is the inverse of {@link displayValueToPureValue}.
*
* @returns the result of matching the given value against the mask
* @param pureValue the pure, unformatted input value
* @param mask the mask to match against
* @param acceptObscuredValue whether to accept
*
* @see displayValueToPureValue
*/
export declare const matchAgainstMask: (pureValue: string, mask: Mask, acceptObscuredValue?: boolean, stripNonAllowedInputs?: boolean) => MaskResult;
export {};