UNPKG

react-native-scanbot-sdk

Version:

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

157 lines (148 loc) 4.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BarcodeMappedData = exports.BarcodeItemErrorState = exports.BarcodeInfoMapping = void 0; var _Common = require("../common/Common"); var _utils = require("../../utils"); /** Configuration of the the mapper's error dialog. */ class BarcodeItemErrorState extends _utils.PartiallyConstructible { /** Title displayed above the error message. */ title = new _Common.StyledText({ text: 'Connection Error!', color: '?sbColorOnSurface' }); /** Error message. */ subtitle = new _Common.StyledText({ text: 'There was an issue and the data requested was not fetched. You could try again or discard this result to start a new scan.', color: '?sbColorOnSurfaceVariant' }); /** Configuration of the retry button. */ retryButton = new _Common.ButtonConfiguration({}); /** Configuration of the cancel button. */ cancelButton = new _Common.ButtonConfiguration({}); /** @param source {@displayType `DeepPartial<BarcodeItemErrorState>`} */ constructor(source = {}) { super(); if (source.title !== undefined) { this.title = new _Common.StyledText(source.title); } if (source.subtitle !== undefined) { this.subtitle = new _Common.StyledText(source.subtitle); } if (source.retryButton !== undefined) { this.retryButton = new _Common.ButtonConfiguration(source.retryButton); } if (source.cancelButton !== undefined) { this.cancelButton = new _Common.ButtonConfiguration(source.cancelButton); } } } /** Format of the mapped barcode data. */ exports.BarcodeItemErrorState = BarcodeItemErrorState; class BarcodeMappedData extends _utils.PartiallyConstructible { /** Title of the barcode. */ /** Subtitle of the barcode. */ /** Image of the barcode. */ /** Use this key to display the original barcode image */ static barcodeImageKey = 'BARCODE_IMAGE'; /** @param source {@displayType `DeepPartial<BarcodeMappedData>`} */ constructor(source = {}) { super(); if (source.title !== undefined) { this.title = source.title; } else { throw new Error('title must be present in constructor argument'); } if (source.subtitle !== undefined) { this.subtitle = source.subtitle; } else { throw new Error('subtitle must be present in constructor argument'); } if (source.barcodeImage !== undefined) { this.barcodeImage = source.barcodeImage; } else { throw new Error('barcodeImage must be present in constructor argument'); } } } /** Configuration of the barcode data mapping. */ exports.BarcodeMappedData = BarcodeMappedData; class BarcodeInfoMapping extends _utils.PartiallyConstructible { /** Callback to map the barcode data to the data of the corresponding product. */ barcodeItemMapper = null; /** Background color of the barcode info dialog. Default is "?sbColorSurface" */ sheetColor = '?sbColorSurface'; /** Color of the divider and separator lines in the barcode info dialog. Default is "?sbColorOutline" */ dividerColor = '?sbColorOutline'; /** Background color of the overlay surrounding the barcode mapping error dialog. Default is "?sbColorModalOverlay" */ modalOverlayColor = '?sbColorModalOverlay'; /** Text being displayed while a barcode is being mapped. */ loadingMessage = new _Common.StyledText({ text: 'Loading message for barcode info mapping.', color: '?sbColorPrimary' }); /** Configuration of the error state displayed when processing a barcode fails. */ errorState = new BarcodeItemErrorState({}); /** @param source {@displayType `DeepPartial<BarcodeInfoMapping>`} */ constructor(source = {}) { super(); if (source.barcodeItemMapper !== undefined) { this.barcodeItemMapper = source.barcodeItemMapper != null ? source.barcodeItemMapper : null; } if (source.sheetColor !== undefined) { this.sheetColor = source.sheetColor; } if (source.dividerColor !== undefined) { this.dividerColor = source.dividerColor; } if (source.modalOverlayColor !== undefined) { this.modalOverlayColor = source.modalOverlayColor; } if (source.loadingMessage !== undefined) { this.loadingMessage = new _Common.StyledText(source.loadingMessage); } if (source.errorState !== undefined) { this.errorState = new BarcodeItemErrorState(source.errorState); } } } exports.BarcodeInfoMapping = BarcodeInfoMapping; //# sourceMappingURL=BarcodeInfoMapping.js.map