UNPKG

react-native-scanbot-sdk

Version:

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

739 lines (723 loc) 23.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SwipeToDelete = exports.SheetContent = exports.Sheet = exports.MultipleScanningMode = exports.ManualCountEditDialog = void 0; var _ArTrackingOverlayConfiguration = require("../barcode/ArTrackingOverlayConfiguration"); var _Common = require("../common/Common"); var _BarcodeInfoMapping = require("../barcode/BarcodeInfoMapping"); var _utils = require("../../utils"); /** Configuration of the mode used for scanning multiple barcodes. - `COUNTING`: Scan barcodes even if they have the same value and count the number of repeated barcodes. - `UNIQUE`: Only scan barcodes with unique values. Subsequent barcodes with the same values will be ignored. */ /** Configuration of the barcode result sheet's default visibility state. - `BUTTON`: Result sheet is hidden and can be opened by pressing the button. The button can show the total barcode count. - `COLLAPSED_SHEET`: Result sheet is visible and collapsed and can be expanded by dragging it up. */ /** Configuration of the barcodes result sheet's height while collapsed. - `SMALL`: Result sheet is collapsed as much as possible, showing only the top part. - `LARGE`: Result sheet is not completely collapsed, revealing more information. */ /** Configuration of the preview mode for scanning multiple barcodes. */ class Sheet extends _utils.PartiallyConstructible { /** Mode used for the preview for scanning multiple barcodes. Default is COLLAPSED_SHEET */ mode = 'COLLAPSED_SHEET'; /** Height of the collapsed result sheet. Default is SMALL */ collapsedVisibleHeight = 'SMALL'; /** Configuration of the list button. */ listButton = new _Common.BadgedButton({}); /** @param source {@displayType `DeepPartial<Sheet>`} */ constructor(source = {}) { super(); if (source.mode !== undefined) { this.mode = source.mode; } if (source.collapsedVisibleHeight !== undefined) { this.collapsedVisibleHeight = source.collapsedVisibleHeight; } if (source.listButton !== undefined) { this.listButton = new _Common.BadgedButton(source.listButton); } } } /** Configuration of the swipe-to-delete button. */ exports.Sheet = Sheet; class SwipeToDelete extends _utils.PartiallyConstructible { /** Whether swipe to delete is enabled or not. Default is true */ enabled = true; /** Color of the swipe-to-delete button. Default is "?sbColorNegative" */ backgroundColor = '?sbColorNegative'; /** Color of the icon on the swipe-to-delete button. Default is "?sbColorOnPrimary" */ iconColor = '?sbColorOnPrimary'; /** @param source {@displayType `DeepPartial<SwipeToDelete>`} */ constructor(source = {}) { super(); if (source.enabled !== undefined) { this.enabled = source.enabled; } if (source.backgroundColor !== undefined) { this.backgroundColor = source.backgroundColor; } if (source.iconColor !== undefined) { this.iconColor = source.iconColor; } } } /** Configuration of the dialog to manually edit the barcode count. */ exports.SwipeToDelete = SwipeToDelete; class ManualCountEditDialog extends _utils.PartiallyConstructible { /** Color of the edit dialog's background. Default is "?sbColorSurface" */ sheetColor = '?sbColorSurface'; /** Color of the divider and separator lines in the edit dialog. Default is "?sbColorOutline" */ dividerColor = '?sbColorOutline'; /** Background color of the overlay surrounding the edit dialog. Default is "?sbColorModalOverlay" */ modalOverlayColor = '?sbColorModalOverlay'; /** Configuration of the edit dialog's title. */ title = new _Common.StyledText({ text: 'Update count', color: '?sbColorOnSurface' }); /** Configuration of the edit dialog's info text. */ info = new _Common.StyledText({ text: 'Adjust the number of items you scanned.', color: '?sbColorOnSurfaceVariant' }); /** Configuration of the edit dialog's confirm button. Hiding both the update and cancel buttons simultaneously is an undefined behavior. */ updateButton = new _Common.ButtonConfiguration({ visible: true, text: 'Update', background: new _Common.BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false }) }); /** Configuration of the edit dialog's cancel button. Hiding both the update and cancel buttons simultaneously is an undefined behavior. */ cancelButton = new _Common.ButtonConfiguration({ visible: true, text: 'Cancel', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false }) }); /** Configuration of the edit dialog's button to clear the entered count number. */ clearTextButton = new _Common.IconStyle({ visible: true, color: '?sbColorOnSurfaceVariant' }); /** @param source {@displayType `DeepPartial<ManualCountEditDialog>`} */ constructor(source = {}) { super(); 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.title !== undefined) { this.title = new _Common.StyledText(source.title); } if (source.info !== undefined) { this.info = new _Common.StyledText(source.info); } if (source.updateButton !== undefined) { this.updateButton = new _Common.ButtonConfiguration(source.updateButton); } if (source.cancelButton !== undefined) { this.cancelButton = new _Common.ButtonConfiguration(source.cancelButton); } if (source.clearTextButton !== undefined) { this.clearTextButton = new _Common.IconStyle(source.clearTextButton); } } } /** Configuration of the list containing the barcodes that have already been scanned. */ exports.ManualCountEditDialog = ManualCountEditDialog; class SheetContent extends _utils.PartiallyConstructible { /** Color of the list's background. Default is "?sbColorSurface" */ sheetColor = '?sbColorSurface'; /** The color of the dividers in the list sheet. Default is "?sbColorOutline" */ dividerColor = '?sbColorOutline'; /** Enables the user to change the number of scanned items by pressing +,-, or changing the number using a keyboard. Default is true */ manualCountChangeEnabled = true; /** The color of the outline of the manual counting buttons in the list sheet. Default is "?sbColorOutline" */ manualCountOutlineColor = '?sbColorOutline'; /** Color of the buttons for manually changing the barcode count. Default is "?sbColorPrimary" */ manualCountChangeColor = '?sbColorPrimary'; /** Configuration of the barcode list's title. By default displays the total number of scanned barcodes. */ title = new _Common.StyledText({ text: '%d items', color: '?sbColorOnSurface' }); /** Configuration of the button for clearing the barcode list. */ clearAllButton = new _Common.ButtonConfiguration({ visible: true, text: 'Clear all', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnSurface', useShadow: false }) }); /** Configuration of the title of a barcode list entry (displaying the barcode's value). */ barcodeItemTitle = new _Common.StyledText({ visible: true, text: 'BARCODE_TITLE', color: '?sbColorOnSurface', useShadow: false }); /** Configuration of the subtitle of a barcode list entry (displaying the barcode's symbology). */ barcodeItemSubtitle = new _Common.StyledText({ text: 'BARCODE_SUBTITLE', color: '?sbColorOnSurfaceVariant' }); /** Visibility of the barcode image in a barcode list entry. Default is true */ barcodeItemImageVisible = true; /** Configuration of the barcode list's submit button. */ submitButton = new _Common.ButtonConfiguration({ visible: true, text: 'Submit', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnSurface', useShadow: false }) }); /** Configuration of the button to start scanning displayed in an empty barcode list. */ startScanningButton = new _Common.ButtonConfiguration({ visible: true, text: 'Start scanning', background: new _Common.BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: true, color: '?sbColorOnPrimary', useShadow: false }) }); /** Configuration of the title displayed in an empty barcode list. */ placeholderTitle = new _Common.StyledText({ text: 'No barcodes here!', color: '?sbColorOnSurface' }); /** Configuration of the subtitle displayed in an empty barcode list. */ placeholderSubtitle = new _Common.StyledText({ text: 'The barcode list is currently empty. Close this sheet and scan your items to add them.', color: '?sbColorOnSurfaceVariant' }); /** Background color of the icon displayed in an empty barcode list. Default is "?sbColorOutline" */ placeholderIconBackground = '?sbColorOutline'; /** Configuration of the icon displayed in an empty barcode list. */ placeholderIcon = new _Common.IconStyle({ visible: true, color: '?sbColorOnSurface' }); /** The style of the swipe-to-delete button. */ swipeToDelete = new SwipeToDelete({ enabled: true, backgroundColor: '?sbColorNegative', iconColor: '?sbColorOnPrimary' }); /** @param source {@displayType `DeepPartial<SheetContent>`} */ constructor(source = {}) { super(); if (source.sheetColor !== undefined) { this.sheetColor = source.sheetColor; } if (source.dividerColor !== undefined) { this.dividerColor = source.dividerColor; } if (source.manualCountChangeEnabled !== undefined) { this.manualCountChangeEnabled = source.manualCountChangeEnabled; } if (source.manualCountOutlineColor !== undefined) { this.manualCountOutlineColor = source.manualCountOutlineColor; } if (source.manualCountChangeColor !== undefined) { this.manualCountChangeColor = source.manualCountChangeColor; } if (source.title !== undefined) { this.title = new _Common.StyledText(source.title); } if (source.clearAllButton !== undefined) { this.clearAllButton = new _Common.ButtonConfiguration(source.clearAllButton); } if (source.barcodeItemTitle !== undefined) { this.barcodeItemTitle = new _Common.StyledText(source.barcodeItemTitle); } if (source.barcodeItemSubtitle !== undefined) { this.barcodeItemSubtitle = new _Common.StyledText(source.barcodeItemSubtitle); } if (source.barcodeItemImageVisible !== undefined) { this.barcodeItemImageVisible = source.barcodeItemImageVisible; } if (source.submitButton !== undefined) { this.submitButton = new _Common.ButtonConfiguration(source.submitButton); } if (source.startScanningButton !== undefined) { this.startScanningButton = new _Common.ButtonConfiguration(source.startScanningButton); } if (source.placeholderTitle !== undefined) { this.placeholderTitle = new _Common.StyledText(source.placeholderTitle); } if (source.placeholderSubtitle !== undefined) { this.placeholderSubtitle = new _Common.StyledText(source.placeholderSubtitle); } if (source.placeholderIconBackground !== undefined) { this.placeholderIconBackground = source.placeholderIconBackground; } if (source.placeholderIcon !== undefined) { this.placeholderIcon = new _Common.IconStyle(source.placeholderIcon); } if (source.swipeToDelete !== undefined) { this.swipeToDelete = new SwipeToDelete(source.swipeToDelete); } } } /** Configuration of the mode for scanning multiple barcodes. */ exports.SheetContent = SheetContent; class MultipleScanningMode extends _utils.PartiallyConstructible { _type = 'MultipleScanningMode'; /** Time interval in milliseconds before a barcode is counted again. 0 = no delay. The default value is 1000. Default is 1000 */ countingRepeatDelay = 1000; /** Whether the user can submit an empty barcode list. Default is false */ allowEmptySubmission = false; /** Mode used for scanning multiple barcodes. Default is COUNTING */ mode = 'COUNTING'; /** Configuration of the preview mode for scanning multiple barcodes. */ sheet = new Sheet({ mode: 'COLLAPSED_SHEET', collapsedVisibleHeight: 'SMALL', listButton: new _Common.BadgedButton({ badgeBackgroundColor: '?sbColorSurface', badgeForegroundColor: '?sbColorPrimary', visible: true, backgroundColor: '?sbColorSurfaceHigh', foregroundColor: '?sbColorOnPrimary', activeBackgroundColor: '?sbColorSurfaceHigh', activeForegroundColor: '?sbColorOnPrimary' }) }); /** Configuration of the list containing the barcodes that have already been scanned. */ sheetContent = new SheetContent({ sheetColor: '?sbColorSurface', dividerColor: '?sbColorOutline', manualCountChangeEnabled: true, manualCountOutlineColor: '?sbColorOutline', manualCountChangeColor: '?sbColorPrimary', title: new _Common.StyledText({ text: '?multipleModeSheetTitle', color: '?sbColorOnSurface' }), clearAllButton: new _Common.ButtonConfiguration({ visible: true, text: '?sheetClearAllButton', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnSurface', useShadow: false }) }), barcodeItemTitle: new _Common.StyledText({ visible: true, text: 'BARCODE_TITLE', color: '?sbColorOnSurface', useShadow: false }), barcodeItemSubtitle: new _Common.StyledText({ visible: true, text: 'BARCODE_SUBTITLE', color: '?sbColorOnSurfaceVariant', useShadow: false }), barcodeItemImageVisible: true, submitButton: new _Common.ButtonConfiguration({ visible: true, text: '?sheetSubmitButton', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnSurface', useShadow: false }) }), startScanningButton: new _Common.ButtonConfiguration({ visible: true, text: '?sheetStartScanningButton', background: new _Common.BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false }) }), placeholderTitle: new _Common.StyledText({ visible: true, text: '?sheetPlaceholderTitle', color: '?sbColorOnSurface', useShadow: false }), placeholderSubtitle: new _Common.StyledText({ visible: true, text: '?sheetPlaceholderSubtitle', color: '?sbColorOnSurfaceVariant', useShadow: false }), placeholderIconBackground: '?sbColorOutline', placeholderIcon: new _Common.IconStyle({ visible: true, color: '?sbColorOnSurface' }), swipeToDelete: new SwipeToDelete({ enabled: true, backgroundColor: '?sbColorNegative', iconColor: '?sbColorOnPrimary' }) }); /** Configuration of the dialog to manually edit the barcode count. */ manualCountEditDialog = new ManualCountEditDialog({ sheetColor: '?sbColorSurface', dividerColor: '?sbColorOutline', modalOverlayColor: '?sbColorModalOverlay', title: new _Common.StyledText({ text: '?manualCountEditDialogTitle', color: '?sbColorOnSurface' }), info: new _Common.StyledText({ text: '?manualCountEditDialogInfo', color: '?sbColorOnSurfaceVariant' }), updateButton: new _Common.ButtonConfiguration({ visible: true, text: '?manualCountEditDialogUpdateButton', background: new _Common.BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false }) }), cancelButton: new _Common.ButtonConfiguration({ visible: true, text: '?manualCountEditDialogCancelButton', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false }) }), clearTextButton: new _Common.IconStyle({ visible: true, color: '?sbColorOnSurfaceVariant' }) }); /** Appearance of the barcode info mapping. */ barcodeInfoMapping = new _BarcodeInfoMapping.BarcodeInfoMapping({ sheetColor: '?sbColorSurface', dividerColor: '?sbColorOutline', modalOverlayColor: '?sbColorModalOverlay', loadingMessage: new _Common.StyledText({ text: '?barcodeInfoMappingLoadingMessage', color: '?sbColorPrimary' }), errorState: new _BarcodeInfoMapping.BarcodeItemErrorState({ title: new _Common.StyledText({ text: '?barcodeInfoMappingErrorStateTitle', color: '?sbColorOnSurface' }), subtitle: new _Common.StyledText({ text: '?barcodeInfoMappingErrorStateSubtitle', color: '?sbColorOnSurfaceVariant' }), retryButton: new _Common.ButtonConfiguration({ visible: true, text: '?barcodeInfoMappingErrorStateRetryButton', background: new _Common.BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: true, color: '?sbColorOnPrimary', useShadow: false }) }), cancelButton: new _Common.ButtonConfiguration({ visible: true, text: '?barcodeInfoMappingErrorStateCancelButton', background: new _Common.BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 1.0 }), foreground: new _Common.ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false }) }) }) }); /** Configuration of the AR overlay. */ arOverlay = new _ArTrackingOverlayConfiguration.ArOverlayGeneralConfiguration({ visible: false, counterBadge: new _Common.BadgeStyle({ visible: true, background: new _Common.BackgroundStyle({ strokeColor: '#FF000000', fillColor: '?sbColorPositive', strokeWidth: 0.0 }), foregroundColor: '?sbColorOnSurface' }), automaticSelectionEnabled: false, barcodeItemInfoPosition: 'BELOW', polygon: new _ArTrackingOverlayConfiguration.ArOverlayPolygonConfiguration({ visible: true, deselected: new _Common.PolygonStyle({ strokeColor: '?sbColorSurface', fillColor: '#00000000', strokeWidth: 3.0, cornerRadius: 5.0 }), selected: new _Common.PolygonStyle({ strokeColor: '?sbColorPositive', fillColor: '#00000000', strokeWidth: 3.0, cornerRadius: 5.0 }) }), barcodeItemConfiguration: new _ArTrackingOverlayConfiguration.BarcodeItemConfiguration({ imageVisible: true, titleSelected: new _Common.StyledText({ text: 'BARCODE_TITLE', color: '?sbColorOnSurface' }), subtitleSelected: new _Common.StyledText({ visible: true, text: 'BARCODE_SUBTITLE', color: '?sbColorOnSurfaceVariant', useShadow: false }), titleDeselected: new _Common.StyledText({ visible: true, text: 'BARCODE_TITLE', color: '?sbColorOnSurface', useShadow: false }), subtitleDeselected: new _Common.StyledText({ text: 'BARCODE_SUBTITLE', color: '?sbColorOnSurfaceVariant' }), backgroundSelected: new _Common.PolygonStyle({ strokeColor: '?sbColorPositive', fillColor: '?sbColorPositive', strokeWidth: 1.0, cornerRadius: 5.0 }), backgroundDeselected: new _Common.PolygonStyle({ strokeColor: '?sbColorSurface', fillColor: '?sbColorSurface', strokeWidth: 1.0, cornerRadius: 5.0 }) }) }); /** @param source {@displayType `DeepPartial<MultipleScanningMode>`} */ constructor(source = {}) { super(); if (source.countingRepeatDelay !== undefined) { this.countingRepeatDelay = source.countingRepeatDelay; } if (source.allowEmptySubmission !== undefined) { this.allowEmptySubmission = source.allowEmptySubmission; } if (source.mode !== undefined) { this.mode = source.mode; } if (source.sheet !== undefined) { this.sheet = new Sheet(source.sheet); } if (source.sheetContent !== undefined) { this.sheetContent = new SheetContent(source.sheetContent); } if (source.manualCountEditDialog !== undefined) { this.manualCountEditDialog = new ManualCountEditDialog(source.manualCountEditDialog); } if (source.barcodeInfoMapping !== undefined) { this.barcodeInfoMapping = new _BarcodeInfoMapping.BarcodeInfoMapping(source.barcodeInfoMapping); } if (source.arOverlay !== undefined) { this.arOverlay = new _ArTrackingOverlayConfiguration.ArOverlayGeneralConfiguration(source.arOverlay); } } } exports.MultipleScanningMode = MultipleScanningMode; //# sourceMappingURL=MultipleScanningModeUseCase.js.map