react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
284 lines (282 loc) • 9.66 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BarcodeScannerConfiguration = void 0;
var _ActionBarConfiguration = require("../common/ActionBarConfiguration");
var _Common = require("../common/Common");
var _BarcodeRecognizerConfiguration = require("../barcode/BarcodeRecognizerConfiguration");
var _BarcodeTextLocalization = require("../barcode/BarcodeTextLocalization");
var _BarcodeUseCase = require("../barcode/BarcodeUseCase");
var _CameraConfiguration = require("../common/CameraConfiguration");
var _CameraPermission = require("../common/CameraPermission");
var _utils = require("../../utils");
var _ViewFinderConfiguration = require("../common/ViewFinderConfiguration");
var _SingleScanningModeUseCase = require("../barcode/SingleScanningModeUseCase");
var _TopBarConfiguration = require("../common/TopBarConfiguration");
var _UserGuidanceConfiguration = require("../common/UserGuidanceConfiguration");
/**
Configuration of the barcode scanner screen.
*/
class BarcodeScannerConfiguration extends _utils.PartiallyConstructible {
/**
Version number of the configuration object.
Default is "1.0"
*/
version = '1.0';
/**
The configuration object should be applied for this screen.
Default is "BarcodeScanner"
*/
screen = 'BarcodeScanner';
/**
Define the screen's base color values from which other colors are derived.
*/
palette = new _Common.Palette({
sbColorPrimary: '#C8193C',
sbColorPrimaryDisabled: '#F5F5F5',
sbColorNegative: '#FF3737',
sbColorPositive: '#4EFFB4',
sbColorWarning: '#FFCE5C',
sbColorSecondary: '#FFEDEE',
sbColorSecondaryDisabled: '#F5F5F5',
sbColorOnPrimary: '#FFFFFF',
sbColorOnSecondary: '#C8193C',
sbColorSurface: '#FFFFFF',
sbColorOutline: '#EFEFEF',
sbColorOnSurfaceVariant: '#707070',
sbColorOnSurface: '#000000',
sbColorSurfaceLow: '#00000026',
sbColorSurfaceHigh: '#0000007A',
sbColorModalOverlay: '#000000A3'
});
/**
Configuration of the all strings for barcode scanner.
*/
localization = new _BarcodeTextLocalization.BarcodeTextLocalization({});
/**
Color of the screen's background.
Default is "?sbColorSurfaceLow"
*/
backgroundColor = '?sbColorSurfaceLow';
/**
Configuration of the top bar.
*/
topBar = new _TopBarConfiguration.TopBarConfiguration({
title: new _Common.StyledText({
text: '?topBarTitle',
color: '?sbColorOnPrimary'
}),
mode: 'SOLID',
statusBarMode: 'LIGHT',
backgroundColor: '?sbColorPrimary',
cancelButton: new _Common.ButtonConfiguration({
visible: true,
text: '?topBarCancelButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: true,
color: '?sbColorOnPrimary',
useShadow: false
})
})
});
/**
Configuration of the action bar.
*/
actionBar = new _ActionBarConfiguration.ActionBarConfiguration({
flashButton: new _Common.RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionFlashButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorWarning',
activeForegroundColor: '#1C1B1F'
}),
zoomButton: new _Common.RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionZoomButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorSurfaceHigh',
activeForegroundColor: '?sbColorOnPrimary'
}),
flipCameraButton: new _Common.RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionFlipCameraButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorSurfaceHigh',
activeForegroundColor: '?sbColorOnPrimary'
})
});
/**
Configuration of the view finder.
*/
viewFinder = new _ViewFinderConfiguration.ViewFinderConfiguration({
visible: true,
style: new _ViewFinderConfiguration.FinderCorneredStyle({
strokeColor: '?sbColorSurface',
strokeWidth: 2.0,
cornerRadius: 10.0
}),
overlayColor: '?sbColorSurfaceLow',
aspectRatio: new _Common.AspectRatio({
width: 1.0,
height: 1.0
})
});
/**
Configuration of the text hint guiding users to move the view finder over a barcode.
*/
userGuidance = new _UserGuidanceConfiguration.UserGuidanceConfiguration({
visible: true,
title: new _Common.StyledText({
text: '?userGuidance',
color: '?sbColorOnPrimary'
}),
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '?sbColorSurfaceLow',
strokeWidth: 0.0
})
});
/**
Configuration of the dialog for requesting camera permissions.
*/
cameraPermission = new _CameraPermission.CameraPermissionScreen({
statusBarMode: 'DARK',
background: '?sbColorSurface',
iconBackground: '?sbColorOutline',
icon: new _Common.IconStyle({
visible: true,
color: '?sbColorOnSurface'
}),
enableCameraButton: new _Common.ButtonConfiguration({
visible: true,
text: '?cameraPermissionEnableCameraButton',
background: new _Common.BackgroundStyle({
strokeColor: '?sbColorPrimary',
fillColor: '?sbColorPrimary',
strokeWidth: 0.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorOnPrimary',
useShadow: false
})
}),
closeButton: new _Common.ButtonConfiguration({
visible: true,
text: '?cameraPermissionCloseButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false
})
}),
enableCameraTitle: new _Common.StyledText({
text: '?cameraPermissionEnableCameraTitle',
color: '?sbColorOnSurface'
}),
enableCameraExplanation: new _Common.StyledText({
text: '?cameraPermissionEnableCameraExplanation',
color: '?sbColorOnSurfaceVariant'
})
});
/**
Configuration of the camera behavior.
*/
cameraConfiguration = new _CameraConfiguration.CameraConfiguration({});
/**
Configuration of the scanning behavior.
*/
recognizerConfiguration = new _BarcodeRecognizerConfiguration.BarcodeRecognizerConfiguration({});
/**
Configuration of the barcode scanner screen's behavior.
*/
useCase = new _SingleScanningModeUseCase.SingleScanningMode({});
/**
Configuration of the scan confirmation sound.
*/
sound = new _Common.Sound({
successBeepEnabled: true,
soundType: 'MODERN_BEEP'
});
/**
Configuration of the scan scan confirmation vibration.
*/
vibration = new _Common.Vibration({
enabled: true
});
/**
Configuration of timeouts.
*/
timeouts = new _Common.Timeouts({
autoCancelTimeout: 0,
initialScanDelay: 0
});
/** @param source {@displayType `DeepPartial<BarcodeScannerConfiguration>`} */
constructor(source = {}) {
super();
if (source.version !== undefined) {
this.version = source.version;
}
if (source.screen !== undefined) {
this.screen = source.screen;
}
if (source.palette !== undefined) {
this.palette = new _Common.Palette(source.palette);
}
if (source.localization !== undefined) {
this.localization = new _BarcodeTextLocalization.BarcodeTextLocalization(source.localization);
}
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.topBar !== undefined) {
this.topBar = new _TopBarConfiguration.TopBarConfiguration(source.topBar);
}
if (source.actionBar !== undefined) {
this.actionBar = new _ActionBarConfiguration.ActionBarConfiguration(source.actionBar);
}
if (source.viewFinder !== undefined) {
this.viewFinder = new _ViewFinderConfiguration.ViewFinderConfiguration(source.viewFinder);
}
if (source.userGuidance !== undefined) {
this.userGuidance = new _UserGuidanceConfiguration.UserGuidanceConfiguration(source.userGuidance);
}
if (source.cameraPermission !== undefined) {
this.cameraPermission = new _CameraPermission.CameraPermissionScreen(source.cameraPermission);
}
if (source.cameraConfiguration !== undefined) {
this.cameraConfiguration = new _CameraConfiguration.CameraConfiguration(source.cameraConfiguration);
}
if (source.recognizerConfiguration !== undefined) {
this.recognizerConfiguration = new _BarcodeRecognizerConfiguration.BarcodeRecognizerConfiguration(source.recognizerConfiguration);
}
if (source.useCase !== undefined) {
this.useCase = _BarcodeUseCase.BarcodeUseCase.From(source.useCase);
}
if (source.sound !== undefined) {
this.sound = new _Common.Sound(source.sound);
}
if (source.vibration !== undefined) {
this.vibration = new _Common.Vibration(source.vibration);
}
if (source.timeouts !== undefined) {
this.timeouts = new _Common.Timeouts(source.timeouts);
}
}
}
exports.BarcodeScannerConfiguration = BarcodeScannerConfiguration;
//# sourceMappingURL=BarcodeScannerConfiguration.js.map