@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.63 kB
TypeScript
import type { Address } from '../core/models/api/address';
import type { DatasetUtil } from '../utils/datasetUtil';
export type RuleResult<T> = {
hasConflict: boolean;
resolvedValue?: T;
};
export type ConflictRule<T> = (provided?: T, detected?: T) => RuleResult<T>;
export declare const defaultConflictRule: <T>(provided?: T, detected?: T) => RuleResult<T>;
/**
* A factory function that returns a conflict rule for the `Address` model.
* The rule handles enrichment (auto-resolution) and deep equality checks.
*/
export declare const createAddressConflictRule: (datasetUtils: DatasetUtil) => ConflictRule<Address | undefined>;
type UseDataConflictsReturn<T extends object> = {
hasConflicts: boolean;
conflictingProperties: (keyof T)[];
wasAutoResolved: boolean;
resolvedData: T | undefined;
};
/**
* A hook to compare two data objects and identify conflicting properties.
* It supports custom rules for complex comparisons and can auto-resolve certain conflicts.
*
* @template T The shape of the data objects being compared.
* @param providedData The primary data source (e.g., user input).
* @param detectedData The secondary data source (e.g., OCR extraction).
* @param rules A map of custom conflict rules for specific properties.
* @param onAutoResolve
* @returns An object containing the conflict status and any resolved data.
*/
export declare const useDataConflicts: <T extends object>(providedData: T | undefined, detectedData: T | undefined, rules?: Partial<Record<keyof T, ConflictRule<any>>>, onAutoResolve?: (resolvedData: T) => void) => UseDataConflictsReturn<T>;
export {};