UNPKG

react-native-idscan-sdk

Version:
45 lines (43 loc) 1.38 kB
import { NativeModules, Platform } from 'react-native'; const LINKING_ERROR = `The package 'react-native-idscan-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; const IdscanSdk = NativeModules.IdscanSdk ? NativeModules.IdscanSdk : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); // SDK Constants const SDKConstants = IdscanSdk.getConstants(); export const IDSCANNER_CONSTANTS = { /** * Combined PDF and MRZ Scanner */ TYPE_COMBINED: SDKConstants.TYPE_COMBINED, /** * Scan Passports */ TYPE_MRZ: SDKConstants.TYPE_MRZ, /** * Scan Drivers Licenses */ TYPE_PDF: SDKConstants.TYPE_PDF }; /** * Scan a Drivers License or Passport * @param type Supported scanner/parser types * @param apiKeys Object containing android and iOS API keys * @param onScanComplete Handle scan complete function */ export function scan(type, apiKeys, onScanComplete) { IdscanSdk.scan(type, apiKeys, (error, data) => { if (data.success) { data.birthDate = data.birthDate || data.birthdate; data.IIN = data.IIN || data.iin; data.hazmateExpDate = data.HAZMATEExpDate; } onScanComplete(error, data); }); } //# sourceMappingURL=index.js.map