react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
495 lines (486 loc) • 19 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DocumentDataExtractorScreenConfiguration = void 0;
var _DocumentDataExtractorTypes = require("../../document_data_extractor/DocumentDataExtractorTypes");
var _ActionBarConfiguration = require("../../ui_v2/common/ActionBarConfiguration");
var _CameraConfiguration = require("../../ui_v2/common/CameraConfiguration");
var _CameraPermission = require("../../ui_v2/common/CameraPermission");
var _Common = require("../../ui_v2/common/Common");
var _ScanCompletionOverlay = require("../../ui_v2/common/ScanCompletionOverlay");
var _ScanbotAlertDialog = require("../../ui_v2/common/ScanbotAlertDialog");
var _TopBarConfiguration = require("../../ui_v2/common/TopBarConfiguration");
var _UserGuidanceConfiguration = require("../../ui_v2/common/UserGuidanceConfiguration");
var _ViewFinderConfiguration = require("../../ui_v2/common/ViewFinderConfiguration");
var _DocumentDataExtractionProgressConfiguration = require("../../ui_v2/dde/DocumentDataExtractionProgressConfiguration");
var _DocumentDataExtractorIntroScreenConfiguration = require("../../ui_v2/dde/DocumentDataExtractorIntroScreenConfiguration");
var _DocumentDataExtractorScreenTextLocalization = require("../../ui_v2/dde/DocumentDataExtractorScreenTextLocalization");
var _DocumentDataExtractorUserGuidance = require("../../ui_v2/dde/DocumentDataExtractorUserGuidance");
var _Geometry = require("../../utils/geometry/Geometry");
var _utils = require("../../utils/utils");
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/documentdataextractor/DocumentDataExtractorScreenConfiguration.yaml
/**
Configuration of the screen for extracting data from ID documents.
*/
class DocumentDataExtractorScreenConfiguration 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 "DocumentDataExtractor"
*/
screen = 'DocumentDataExtractor';
/**
Configuration of the all strings for document data extractor screen.
*/
localization = new _DocumentDataExtractorScreenTextLocalization.DocumentDataExtractorScreenTextLocalization({});
/**
Define the screen's base color values from which other colors are derived.
*/
palette = new _Common.Palette({});
/**
The background color of the document data extractor screen.
Default is "?sbColorSurfaceLow"
*/
backgroundColor = '?sbColorSurfaceLow';
/**
Configuration of the camera behavior.
*/
cameraConfiguration = new _CameraConfiguration.CameraConfiguration({
orientationLockMode: 'PORTRAIT'
});
/**
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',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionEnableCameraButton',
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',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionCloseButton',
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 top user guidance.
*/
topUserGuidance = new _UserGuidanceConfiguration.UserGuidanceConfiguration({
title: new _Common.StyledText({
text: '?topUserGuidance'
})
});
/**
Configuration of the extracting status.
*/
scanStatusUserGuidance = new _DocumentDataExtractorUserGuidance.DocumentDataExtractorGuidanceConfiguration({});
/**
Configuration of the top bar on the document data extractor screen.
*/
topBar = new _TopBarConfiguration.TopBarConfiguration({
title: new _Common.StyledText({
visible: true,
text: '?topBarTitle'
}),
cancelButton: new _Common.ButtonConfiguration({
text: '?topBarCancelButton',
accessibilityDescription: '?accessibilityDescriptionCancelButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0
}),
foreground: new _Common.ForegroundStyle({
color: '?sbColorOnPrimary'
})
})
});
/**
Configuration of the button in the top bar that opens the introduction screen.
*/
topBarOpenIntroScreenButton = new _Common.IconButton({
color: '?sbColorOnPrimary',
accessibilityDescription: '?accessibilityDescriptionOpenIntroScreenButton'
});
/**
Configuration of the introduction screen for the document data extractor screen.
*/
introScreen = new _DocumentDataExtractorIntroScreenConfiguration.DocumentDataExtractorIntroScreenConfiguration({});
/**
Configuration of the action bar.
*/
actionBar = new _ActionBarConfiguration.ActionBarConfiguration({
flipCameraButton: new _Common.RoundButton({
visible: false,
accessibilityDescription: '?accessibilityDescriptionFlipCameraButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorWarning',
activeForegroundColor: '#1C1B1F'
})
});
/**
Configuration of the view finder.
*/
viewFinder = new _ViewFinderConfiguration.PermanentViewFinderConfiguration({
style: new _ViewFinderConfiguration.FinderCorneredStyle({
strokeColor: '?sbColorSurface',
strokeWidth: 2.0
}),
aspectRatio: new _Geometry.AspectRatio({
width: 3.0,
height: 2.0
}),
minimumInsets: new _Common.EdgeInsets({
top: 24.0,
left: 24.0,
bottom: 24.0,
right: 24.0
})
});
/**
Configuration of the scanner.
*/
scannerConfiguration = new _DocumentDataExtractorTypes.DocumentDataExtractorConfiguration({});
/**
Configuration of visualization of the scanning progress.
*/
extractionProgress = new _DocumentDataExtractionProgressConfiguration.DocumentDataExtractionProgressConfiguration({});
/**
Timeout for the no document found state. If the no document found state is active longer than this value, the alert will be presented.
Default is 5000
*/
noDocumentFoundTimeout = 5000;
/**
Timeout for the accumulation state. If the accumulation state is active longer than this value, the alert will be presented.
Default is 3000
*/
accumulationTimeout = 3000;
/**
Configuration of the result overlay.
*/
successOverlay = new _ScanCompletionOverlay.ScanCompletionOverlay({});
/**
Configuration of the alert dialog that will be presented when no document is detected.
*/
noDocumentDetectedAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog({
title: new _Common.StyledText({
text: '?documentDataExtractorNoDocumentDetectedAlertTitle',
color: '?sbColorOnSurface'
}),
subtitle: new _Common.StyledText({
text: '?documentDataExtractorNoDocumentDetectedAlertSubtitle',
color: '?sbColorOnSurfaceVariant'
}),
sheetColor: '?sbColorSurface',
modalOverlayColor: '?sbColorModalOverlay',
dividerColor: '?sbColorOutline',
okButton: new _Common.ButtonConfiguration({
visible: true,
text: '?documentDataExtractorAlertRetryButton',
accessibilityDescription: '?accessibilityDescriptionRetryButton',
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: '?documentDataExtractorAlertCloseScannerButton',
accessibilityDescription: '?accessibilityDescriptionCloseScannerButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false
})
})
});
/**
Configuration of the alert dialog that will be presented when the document is recognised but not presented in the list of enabled for scanning.
*/
cantProcessDocumentAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog({
title: new _Common.StyledText({
text: '?documentDataExtractorCantProcessDocumentAlertTitle',
color: '?sbColorOnSurface'
}),
subtitle: new _Common.StyledText({
text: '?documentDataExtractorCantProcessDocumentAlertSubtitle',
color: '?sbColorOnSurfaceVariant'
}),
sheetColor: '?sbColorSurface',
modalOverlayColor: '?sbColorModalOverlay',
dividerColor: '?sbColorOutline',
okButton: new _Common.ButtonConfiguration({
visible: true,
text: '?documentDataExtractorAlertRetryButton',
accessibilityDescription: '?accessibilityDescriptionRetryButton',
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: '?documentDataExtractorAlertCloseScannerButton',
accessibilityDescription: '?accessibilityDescriptionCloseScannerButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false
})
})
});
/**
Configuration of the alert dialog that will be presented when document is not detected as one that is supported by the SDK.
*/
unsupportedDocumentAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog({
title: new _Common.StyledText({
text: '?documentDataExtractorUnsupportedDocumentAlertTitle',
color: '?sbColorOnSurface'
}),
subtitle: new _Common.StyledText({
text: '?documentDataExtractorUnsupportedDocumentAlertSubtitle',
color: '?sbColorOnSurfaceVariant'
}),
sheetColor: '?sbColorSurface',
modalOverlayColor: '?sbColorModalOverlay',
dividerColor: '?sbColorOutline',
okButton: new _Common.ButtonConfiguration({
visible: true,
text: '?documentDataExtractorAlertRetryButton',
accessibilityDescription: '?accessibilityDescriptionRetryButton',
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: '?documentDataExtractorAlertCloseScannerButton',
accessibilityDescription: '?accessibilityDescriptionCloseScannerButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false
})
})
});
/**
Configuration of the alert dialog that will be presented when initial timeout for scanning document is overreached.
*/
scanningTooLongAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog({
title: new _Common.StyledText({
text: '?documentDataExtractorScanningTooLongAlertTitle',
color: '?sbColorOnSurface'
}),
subtitle: new _Common.StyledText({
text: '?documentDataExtractorScanningTooLongAlertSubtitle',
color: '?sbColorOnSurfaceVariant'
}),
sheetColor: '?sbColorSurface',
modalOverlayColor: '?sbColorModalOverlay',
dividerColor: '?sbColorOutline',
okButton: new _Common.ButtonConfiguration({
visible: true,
text: '?documentDataExtractorAlertRetryButton',
accessibilityDescription: '?accessibilityDescriptionRetButton',
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: '?documentDataExtractorAlertCloseScannerButton',
accessibilityDescription: '?accessibilityDescriptionCloseScannerButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false
})
})
});
/**
Configuration of the scan confirmation sound.
*/
sound = new _Common.Sound({});
/**
Configuration of the vibration feedback.
*/
vibration = new _Common.Vibration({});
/**
If enabled, the screen will not turn off while the document data extractor is active. (Android only).
Default is true
*/
keepScreenOn = true;
/** @param source {@displayType `DeepPartial<DocumentDataExtractorScreenConfiguration>`} */
constructor(source = {}) {
super();
if (source.version !== undefined) {
this.version = source.version;
}
if (source.screen !== undefined) {
this.screen = source.screen;
}
if (source.localization !== undefined) {
this.localization = new _DocumentDataExtractorScreenTextLocalization.DocumentDataExtractorScreenTextLocalization(source.localization);
}
if (source.palette !== undefined) {
this.palette = new _Common.Palette(source.palette);
}
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.cameraConfiguration !== undefined) {
this.cameraConfiguration = new _CameraConfiguration.CameraConfiguration(source.cameraConfiguration);
}
if (source.cameraPermission !== undefined) {
this.cameraPermission = new _CameraPermission.CameraPermissionScreen(source.cameraPermission);
}
if (source.topUserGuidance !== undefined) {
this.topUserGuidance = new _UserGuidanceConfiguration.UserGuidanceConfiguration(source.topUserGuidance);
}
if (source.scanStatusUserGuidance !== undefined) {
this.scanStatusUserGuidance = new _DocumentDataExtractorUserGuidance.DocumentDataExtractorGuidanceConfiguration(source.scanStatusUserGuidance);
}
if (source.topBar !== undefined) {
this.topBar = new _TopBarConfiguration.TopBarConfiguration(source.topBar);
}
if (source.topBarOpenIntroScreenButton !== undefined) {
this.topBarOpenIntroScreenButton = new _Common.IconButton(source.topBarOpenIntroScreenButton);
}
if (source.introScreen !== undefined) {
this.introScreen = new _DocumentDataExtractorIntroScreenConfiguration.DocumentDataExtractorIntroScreenConfiguration(source.introScreen);
}
if (source.actionBar !== undefined) {
this.actionBar = new _ActionBarConfiguration.ActionBarConfiguration(source.actionBar);
}
if (source.viewFinder !== undefined) {
this.viewFinder = new _ViewFinderConfiguration.PermanentViewFinderConfiguration(source.viewFinder);
}
if (source.scannerConfiguration !== undefined) {
this.scannerConfiguration = new _DocumentDataExtractorTypes.DocumentDataExtractorConfiguration(source.scannerConfiguration);
}
if (source.extractionProgress !== undefined) {
this.extractionProgress = new _DocumentDataExtractionProgressConfiguration.DocumentDataExtractionProgressConfiguration(source.extractionProgress);
}
if (source.noDocumentFoundTimeout !== undefined) {
this.noDocumentFoundTimeout = source.noDocumentFoundTimeout;
}
if (source.accumulationTimeout !== undefined) {
this.accumulationTimeout = source.accumulationTimeout;
}
if (source.successOverlay !== undefined) {
this.successOverlay = new _ScanCompletionOverlay.ScanCompletionOverlay(source.successOverlay);
}
if (source.noDocumentDetectedAlertDialog !== undefined) {
this.noDocumentDetectedAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog(source.noDocumentDetectedAlertDialog);
}
if (source.cantProcessDocumentAlertDialog !== undefined) {
this.cantProcessDocumentAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog(source.cantProcessDocumentAlertDialog);
}
if (source.unsupportedDocumentAlertDialog !== undefined) {
this.unsupportedDocumentAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog(source.unsupportedDocumentAlertDialog);
}
if (source.scanningTooLongAlertDialog !== undefined) {
this.scanningTooLongAlertDialog = new _ScanbotAlertDialog.ScanbotAlertDialog(source.scanningTooLongAlertDialog);
}
if (source.sound !== undefined) {
this.sound = new _Common.Sound(source.sound);
}
if (source.vibration !== undefined) {
this.vibration = new _Common.Vibration(source.vibration);
}
if (source.keepScreenOn !== undefined) {
this.keepScreenOn = source.keepScreenOn;
}
}
}
exports.DocumentDataExtractorScreenConfiguration = DocumentDataExtractorScreenConfiguration;
//# sourceMappingURL=DocumentDataExtractorScreenConfiguration.js.map