UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

163 lines (145 loc) 5.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MrzScanningModeValues = exports.MrzScannerResult = exports.MrzScannerConfiguration = exports.MrzIncompleteResultHandlingValues = exports.MrzDocumentTypeValues = void 0; var _GenericDocument = require("../documents/GenericDocument"); var _FrameAccumulationTypes = require("../frame_accumulation/FrameAccumulationTypes"); var _JsonSerializationTypes = require("../utils/json/JsonSerializationTypes"); var _utils = require("../utils/utils"); /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/MRZTypes.yaml /** Type of document containing the MRZ. - `UNKNOWN`: Undefined. - `CREW_MEMBER_CERTIFICATE`: Crew member certificate. - `ID_CARD`: ID card. - `PASSPORT`: Passport. - `VISA`: Visa card. - `CH_DRIVING_LICENSE`: Swiss driver license. */ const MrzDocumentTypeValues = exports.MrzDocumentTypeValues = ['UNKNOWN', 'CREW_MEMBER_CERTIFICATE', 'ID_CARD', 'PASSPORT', 'VISA', 'CH_DRIVING_LICENSE']; /** Container for result of MRZ scanning attempt. */ class MrzScannerResult extends _utils.PartiallyConstructible { /** Scanning successful. Default is false */ success = false; /** Raw string value of MRZ. */ /** Generic document containing MRZ data. */ /** @param source {@displayType `DeepPartial<MrzScannerResult>`} */ constructor(source = {}) { super(); if (source.success !== undefined) { this.success = source.success; } if (source.rawMRZ !== undefined) { this.rawMRZ = source.rawMRZ; } else { throw new Error('rawMRZ must be present in constructor argument'); } if (source.document !== undefined) { this.document = source.document != null ? new _GenericDocument.GenericDocument(source.document) : null; } else { throw new Error('document must be present in constructor argument'); } } async serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) { return { success: this.success, rawMRZ: this.rawMRZ, document: this.document != null ? await this.document.serialize(config) : null }; } _released = false; release() { if (this._released) { return; } { if (this.document != null) { this.document.release(); } } this._released = true; } async encodeImages() { if (this.document != null) { await this.document.encodeImages(); } } } /** Defines how to handle incomplete MRZ results (e.g. caused by failed validation). - `ACCEPT`: Accept incomplete results. Fields failing validation will have a validation status of INVALID. Typically used for single-shot scanning. - `REJECT`: Reject incomplete results. If any fields are missing or fail validation, the result document will be empty. Typically used for live scanning. */ exports.MrzScannerResult = MrzScannerResult; const MrzIncompleteResultHandlingValues = exports.MrzIncompleteResultHandlingValues = ['ACCEPT', 'REJECT']; /** The scanning mode. - `LIVE`: The scanner will merge all information from multiple frames to provide the best possible result. Use this mode when the input is a video or camera stream. - `SINGLE_SHOT`: The scanner will only use the current frame and will spend additional time to ensure the best possible result. Use this mode when scanning single images, e.g. imported from the gallery. */ const MrzScanningModeValues = exports.MrzScanningModeValues = ['LIVE', 'SINGLE_SHOT']; /** Configuration for MRZ scanner. */ class MrzScannerConfiguration extends _utils.PartiallyConstructible { /** Configure the frame accumulation process. */ frameAccumulationConfiguration = new _FrameAccumulationTypes.AccumulatedResultsVerifierConfiguration({}); /** Enable MRZ detection. If disabled, the scanner skips the detection step and assumes that the input image is a crop of the MRZ area. Default is true */ enableDetection = true; /** Defines how to handle incomplete MRZ results (e.g. caused by failed validation). Default is REJECT */ incompleteResultHandling = 'REJECT'; /** If true, crops of the detected MRZ and its fields will be returned in the result. Default is false */ returnCrops = false; /** @param source {@displayType `DeepPartial<MrzScannerConfiguration>`} */ constructor(source = {}) { super(); if (source.frameAccumulationConfiguration !== undefined) { this.frameAccumulationConfiguration = new _FrameAccumulationTypes.AccumulatedResultsVerifierConfiguration(source.frameAccumulationConfiguration); } if (source.enableDetection !== undefined) { this.enableDetection = source.enableDetection; } if (source.incompleteResultHandling !== undefined) { this.incompleteResultHandling = source.incompleteResultHandling; } if (source.returnCrops !== undefined) { this.returnCrops = source.returnCrops; } } } exports.MrzScannerConfiguration = MrzScannerConfiguration; //# sourceMappingURL=MrzTypes.js.map