UNPKG

react-native-scanbot-sdk

Version:

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

294 lines (286 loc) 10.2 kB
/// 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 { DeepPartial, PartiallyConstructible } from '../../utils/utils'; /** Configuration of the barcode scanner screen. */ export class BarcodeScannerScreenConfiguration extends PartiallyConstructible { /** Version number of the configuration object. Default is "1.0" */ public readonly version: string = '1.0'; /** The configuration object should be applied for this screen. Default is "BarcodeScanner" */ public readonly screen: string = 'BarcodeScanner'; /** Define the screen's base color values from which other colors are derived. */ public palette: 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. */ public localization: BarcodeTextLocalization = new BarcodeTextLocalization({}); /** Color of the screen's background. Default is "?sbColorSurfaceLow" */ public backgroundColor: string = '?sbColorSurfaceLow'; /** Configuration of the top bar. */ public topBar: TopBarConfiguration = 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. */ public actionBar: ActionBarConfiguration = 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. */ public viewFinder: ViewFinderConfiguration = 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. */ public userGuidance: UserGuidanceConfiguration = 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. */ public cameraPermission: CameraPermissionScreen = 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. */ public cameraConfiguration: CameraConfiguration = new CameraConfiguration({}); /** Configuration of the scanning behavior. */ public scannerConfiguration: CommonBarcodeScannerConfiguration = new CommonBarcodeScannerConfiguration({}); /** Configuration of the barcode scanner screen's behavior. */ public useCase: BarcodeUseCase = new SingleScanningMode({}); /** Configuration of the scan confirmation sound. */ public sound: Sound = new Sound({ successBeepEnabled: true, soundType: 'MODERN_BEEP' }); /** Configuration of the scan scan confirmation vibration. */ public vibration: Vibration = new Vibration({ enabled: true }); /** Configuration of timeouts. */ public timeouts: 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 */ public keepScreenOn: boolean = true; /** @param source {@displayType `DeepPartial<BarcodeScannerScreenConfiguration>`} */ public constructor(source: DeepPartial<BarcodeScannerScreenConfiguration> = {}) { super(); 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; } } }