UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

114 lines (110 loc) 3.96 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/MRZTypes.yaml import { GenericDocument } from '../documents/GenericDocument'; import { AccumulatedResultsVerifierConfiguration } from '../frame_accumulation/FrameAccumulationTypes'; import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes'; import { PartiallyConstructible } from '../utils/utils'; export const MrzDocumentTypeValues = [ 'UNKNOWN', 'CREW_MEMBER_CERTIFICATE', 'ID_CARD', 'PASSPORT', 'VISA', 'CH_DRIVING_LICENSE', ]; /** Container for result of MRZ scanning attempt. */ export class MrzScannerResult extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<MrzScannerResult>`} */ constructor(source = {}) { super(); /** Scanning successful. Default is false */ this.success = false; this._released = false; 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(source.document) : null; } else { throw new Error('document must be present in constructor argument'); } } async serialize(config = new ToJsonConfiguration()) { return { success: this.success, rawMRZ: this.rawMRZ, document: this.document != null ? await this.document.serialize(config) : null, }; } 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(); } } } export const MrzIncompleteResultHandlingValues = ['ACCEPT', 'REJECT']; export const MrzScanningModeValues = ['LIVE', 'SINGLE_SHOT']; /** Configuration for MRZ scanner. */ export class MrzScannerConfiguration extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<MrzScannerConfiguration>`} */ constructor(source = {}) { super(); /** Configure the frame accumulation process. */ this.frameAccumulationConfiguration = new 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 */ this.enableDetection = true; /** Defines how to handle incomplete MRZ results (e.g. caused by failed validation). Default is REJECT */ this.incompleteResultHandling = 'REJECT'; /** If true, crops of the detected MRZ and its fields will be returned in the result. Default is false */ this.returnCrops = false; if (source.frameAccumulationConfiguration !== undefined) { this.frameAccumulationConfiguration = new 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; } } } //# sourceMappingURL=MrzTypes.js.map