UNPKG

react-native-idscan-sdk

Version:
53 lines (50 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IDSCANNER_CONSTANTS = void 0; exports.scan = scan; var _reactNative = require("react-native"); const LINKING_ERROR = `The package 'react-native-idscan-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.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 = _reactNative.NativeModules.IdscanSdk ? _reactNative.NativeModules.IdscanSdk : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); // SDK Constants const SDKConstants = IdscanSdk.getConstants(); 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 */ exports.IDSCANNER_CONSTANTS = IDSCANNER_CONSTANTS; 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