capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
243 lines (239 loc) • 11.1 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/barcode/BarcodeScannerScreenConfiguration.yaml
import { CommonBarcodeScannerConfiguration } from '../../ui_v2/barcode/BarcodeScannerConfiguration';
import { BarcodeTextLocalization } from '../../ui_v2/barcode/BarcodeTextLocalization';
import { BarcodeUseCase } from '../../ui_v2/barcode/BarcodeUseCase';
import { SingleScanningMode } from '../../ui_v2/barcode/SingleScanningModeUseCase';
import { ActionBarConfiguration } from '../../ui_v2/common/ActionBarConfiguration';
import { CameraConfiguration } from '../../ui_v2/common/CameraConfiguration';
import { CameraPermissionScreen } from '../../ui_v2/common/CameraPermission';
import { BackgroundStyle, ButtonConfiguration, ForegroundStyle, IconStyle, Palette, RoundButton, Sound, StyledText, Timeouts, Vibration, } from '../../ui_v2/common/Common';
import { TopBarConfiguration } from '../../ui_v2/common/TopBarConfiguration';
import { UserGuidanceConfiguration } from '../../ui_v2/common/UserGuidanceConfiguration';
import { FinderCorneredStyle, ViewFinderConfiguration } from '../../ui_v2/common/ViewFinderConfiguration';
import { AspectRatio } from '../../utils/geometry/Geometry';
import { PartiallyConstructible } from '../../utils/utils';
/**
Configuration of the barcode scanner screen.
*/
export class BarcodeScannerScreenConfiguration extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<BarcodeScannerScreenConfiguration>`} */
constructor(source = {}) {
super();
/**
Version number of the configuration object.
Default is "1.0"
*/
this.version = '1.0';
/**
The configuration object should be applied for this screen.
Default is "BarcodeScanner"
*/
this.screen = 'BarcodeScanner';
/**
Define the screen's base color values from which other colors are derived.
*/
this.palette = new 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.
*/
this.localization = new BarcodeTextLocalization({});
/**
Color of the screen's background.
Default is "?sbColorSurfaceLow"
*/
this.backgroundColor = '?sbColorSurfaceLow';
/**
Configuration of the top bar.
*/
this.topBar = new TopBarConfiguration({
title: new StyledText({ text: '?topBarTitle', color: '?sbColorOnPrimary' }),
mode: 'SOLID',
statusBarMode: 'LIGHT',
backgroundColor: '?sbColorPrimary',
cancelButton: new ButtonConfiguration({
visible: true,
text: '?topBarCancelButton',
accessibilityDescription: '?accessibilityDescriptionCancelButton',
background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }),
foreground: new ForegroundStyle({ iconVisible: true, color: '?sbColorOnPrimary', useShadow: false }),
}),
});
/**
Configuration of the action bar.
*/
this.actionBar = new ActionBarConfiguration({
flashButton: new RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionFlashButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorWarning',
activeForegroundColor: '#1C1B1F',
}),
zoomButton: new RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionZoomButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorSurfaceHigh',
activeForegroundColor: '?sbColorOnPrimary',
}),
flipCameraButton: new RoundButton({
visible: true,
accessibilityDescription: '?accessibilityDescriptionFlipCameraButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorWarning',
activeForegroundColor: '#1C1B1F',
}),
});
/**
Configuration of the view finder.
*/
this.viewFinder = new ViewFinderConfiguration({
style: new FinderCorneredStyle({ strokeColor: '?sbColorSurface', strokeWidth: 2.0, cornerRadius: 10.0 }),
overlayColor: '?sbColorSurfaceLow',
aspectRatio: new AspectRatio({ width: 1.0, height: 1.0 }),
visible: true,
});
/**
Configuration of the text hint guiding users to move the view finder over a barcode.
*/
this.userGuidance = new UserGuidanceConfiguration({
visible: true,
title: new StyledText({ text: '?userGuidance', color: '?sbColorOnPrimary' }),
background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '?sbColorSurfaceLow', strokeWidth: 0.0 }),
});
/**
Configuration of the dialog for requesting camera permissions.
*/
this.cameraPermission = new CameraPermissionScreen({
statusBarMode: 'DARK',
background: '?sbColorSurface',
iconBackground: '?sbColorOutline',
icon: new IconStyle({ visible: true, color: '?sbColorOnSurface' }),
enableCameraButton: new ButtonConfiguration({
visible: true,
text: '?cameraPermissionEnableCameraButton',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionEnableCameraButton',
background: new BackgroundStyle({
strokeColor: '?sbColorPrimary',
fillColor: '?sbColorPrimary',
strokeWidth: 0.0,
}),
foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false }),
}),
closeButton: new ButtonConfiguration({
visible: true,
text: '?cameraPermissionCloseButton',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionCloseButton',
background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }),
foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false }),
}),
enableCameraTitle: new StyledText({ text: '?cameraPermissionEnableCameraTitle', color: '?sbColorOnSurface' }),
enableCameraExplanation: new StyledText({
text: '?cameraPermissionEnableCameraExplanation',
color: '?sbColorOnSurfaceVariant',
}),
});
/**
Configuration of the camera behavior.
*/
this.cameraConfiguration = new CameraConfiguration({});
/**
Configuration of the scanning behavior.
*/
this.scannerConfiguration = new CommonBarcodeScannerConfiguration({});
/**
Configuration of the barcode scanner screen's behavior.
*/
this.useCase = new SingleScanningMode({});
/**
Configuration of the scan confirmation sound.
*/
this.sound = new Sound({ successBeepEnabled: true, soundType: 'MODERN_BEEP' });
/**
Configuration of the scan scan confirmation vibration.
*/
this.vibration = new Vibration({ enabled: true });
/**
Configuration of timeouts.
*/
this.timeouts = new Timeouts({ autoCancelTimeout: 0, initialScanDelay: 0 });
/**
If enabled, the screen will not turn off while the barcode scanner is active. (Android only).
Default is true
*/
this.keepScreenOn = true;
if (source.version !== undefined) {
this.version = source.version;
}
if (source.screen !== undefined) {
this.screen = source.screen;
}
if (source.palette !== undefined) {
this.palette = new Palette(source.palette);
}
if (source.localization !== undefined) {
this.localization = new BarcodeTextLocalization(source.localization);
}
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.topBar !== undefined) {
this.topBar = new TopBarConfiguration(source.topBar);
}
if (source.actionBar !== undefined) {
this.actionBar = new ActionBarConfiguration(source.actionBar);
}
if (source.viewFinder !== undefined) {
this.viewFinder = new ViewFinderConfiguration(source.viewFinder);
}
if (source.userGuidance !== undefined) {
this.userGuidance = new UserGuidanceConfiguration(source.userGuidance);
}
if (source.cameraPermission !== undefined) {
this.cameraPermission = new CameraPermissionScreen(source.cameraPermission);
}
if (source.cameraConfiguration !== undefined) {
this.cameraConfiguration = new CameraConfiguration(source.cameraConfiguration);
}
if (source.scannerConfiguration !== undefined) {
this.scannerConfiguration = new CommonBarcodeScannerConfiguration(source.scannerConfiguration);
}
if (source.useCase !== undefined) {
this.useCase = BarcodeUseCase.From(source.useCase);
}
if (source.sound !== undefined) {
this.sound = new Sound(source.sound);
}
if (source.vibration !== undefined) {
this.vibration = new Vibration(source.vibration);
}
if (source.timeouts !== undefined) {
this.timeouts = new Timeouts(source.timeouts);
}
if (source.keepScreenOn !== undefined) {
this.keepScreenOn = source.keepScreenOn;
}
}
}
//# sourceMappingURL=BarcodeScannerScreenConfiguration.js.map