UNPKG

react-native-scanbot-sdk

Version:

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

111 lines (104 loc) 2.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BarcodeScannerUiResult = exports.BarcodeScannerUiItem = void 0; var _BarcodeScannerTypes = require("../../barcode/BarcodeScannerTypes"); var _JsonSerializationTypes = require("../../utils/json/JsonSerializationTypes"); var _utils = require("../../utils/utils"); /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/barcode/BarcodeScannerUIResult.yaml /** Data about the scanned barcode. */ class BarcodeScannerUiItem extends _utils.PartiallyConstructible { /** Scanned barcode. */ /** Number of scanned barcodes of this symbology and value. */ /** @param source {@displayType `DeepPartial<BarcodeScannerUiItem>`} */ constructor(source = {}) { super(); if (source.barcode !== undefined) { this.barcode = new _BarcodeScannerTypes.BarcodeItem(source.barcode); } else { throw new Error('barcode must be present in constructor argument'); } if (source.count !== undefined) { this.count = source.count; } else { throw new Error('count must be present in constructor argument'); } } async serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) { return { barcode: await this.barcode.serialize(config), count: this.count }; } _released = false; release() { if (this._released) { return; } this.barcode.release(); this._released = true; } async encodeImages() { await this.barcode.encodeImages(); } } /** Results of the barcode scan. */ exports.BarcodeScannerUiItem = BarcodeScannerUiItem; class BarcodeScannerUiResult extends _utils.PartiallyConstructible { /** Selected zoom factor for the camera. Default is 1.0 */ selectedZoomFactor = 1.0; /** Scanned barcode items. */ items = []; /** @param source {@displayType `DeepPartial<BarcodeScannerUiResult>`} */ constructor(source = {}) { super(); if (source.selectedZoomFactor !== undefined) { this.selectedZoomFactor = source.selectedZoomFactor; } if (source.items !== undefined) { this.items = source.items.map(it => { return new BarcodeScannerUiItem(it); }); } } async serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) { return { selectedZoomFactor: this.selectedZoomFactor, items: await Promise.all(this.items.map(async it => { return await it.serialize(config); })) }; } _released = false; release() { if (this._released) { return; } this.items.forEach(it => { it.release(); }); this._released = true; } async encodeImages() { await Promise.all(this.items.map(async it => { await it.encodeImages(); })); } } exports.BarcodeScannerUiResult = BarcodeScannerUiResult; //# sourceMappingURL=BarcodeScannerUiResult.js.map