react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
239 lines (237 loc) • 7.84 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SingleScanningMode = void 0;
var _ArTrackingOverlayConfiguration = require("../barcode/ArTrackingOverlayConfiguration");
var _Common = require("../common/Common");
var _BarcodeInfoMapping = require("../barcode/BarcodeInfoMapping");
var _utils = require("../../utils");
/**
Configuration of the single barcode scanning mode.
*/
class SingleScanningMode extends _utils.PartiallyConstructible {
_type = 'SingleScanningMode';
/**
If enabled, the confirmation sheet will be shown after the barcode has been scanned.
Default is false
*/
confirmationSheetEnabled = false;
/**
If enabled, the barcode image will be shown on the confirmation sheet.
Default is true
*/
barcodeImageVisible = true;
/**
Color of the confirmation sheet's background.
Default is "?sbColorSurface"
*/
sheetColor = '?sbColorSurface';
/**
Color of the divider and separator lines in the confirmation sheet.
Default is "?sbColorOutline"
*/
dividerColor = '?sbColorOutline';
/**
Background color of the overlay surrounding the confirmation sheet.
Default is "?sbColorModalOverlay"
*/
modalOverlayColor = '?sbColorModalOverlay';
/**
Appearance of the barcode title (the barcode's value) on the confirmation sheet.
*/
barcodeTitle = new _Common.StyledText({
text: 'BARCODE_TITLE',
color: '?sbColorOnSurface'
});
/**
Appearance of the barcode subtitle (the barcode's symbology) on the confirmation sheet.
*/
barcodeSubtitle = new _Common.StyledText({
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant'
});
/**
Appearance of the confirm button on the confirmation sheet.
*/
submitButton = new _Common.ButtonConfiguration({
visible: true,
text: '?sheetSubmitButton',
background: new _Common.BackgroundStyle({
strokeColor: '?sbColorPrimary',
fillColor: '?sbColorPrimary',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: true,
color: '?sbColorOnPrimary'
})
});
/**
Appearance of the cancel button on the confirmation sheet.
*/
cancelButton = new _Common.ButtonConfiguration({
visible: true,
text: '?singleModeConfirmationCancelButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary'
})
});
/**
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'
})
}),
cancelButton: new _Common.ButtonConfiguration({
text: '?barcodeInfoMappingErrorStateCancelButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary'
})
})
})
});
/**
Configuration of the AR overlay.
*/
arOverlay = new _ArTrackingOverlayConfiguration.ArOverlayGeneralConfiguration({
visible: false,
counterBadge: new _Common.BadgeStyle({
visible: true,
background: new _Common.BackgroundStyle({
strokeColor: '#000000FF',
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({
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant'
}),
titleDeselected: new _Common.StyledText({
text: 'BARCODE_TITLE',
color: '?sbColorOnSurface'
}),
subtitleDeselected: new _Common.StyledText({
visible: true,
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant',
useShadow: false
}),
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<SingleScanningMode>`} */
constructor(source = {}) {
super();
if (source.confirmationSheetEnabled !== undefined) {
this.confirmationSheetEnabled = source.confirmationSheetEnabled;
}
if (source.barcodeImageVisible !== undefined) {
this.barcodeImageVisible = source.barcodeImageVisible;
}
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.barcodeTitle !== undefined) {
this.barcodeTitle = new _Common.StyledText(source.barcodeTitle);
}
if (source.barcodeSubtitle !== undefined) {
this.barcodeSubtitle = new _Common.StyledText(source.barcodeSubtitle);
}
if (source.submitButton !== undefined) {
this.submitButton = new _Common.ButtonConfiguration(source.submitButton);
}
if (source.cancelButton !== undefined) {
this.cancelButton = new _Common.ButtonConfiguration(source.cancelButton);
}
if (source.barcodeInfoMapping !== undefined) {
this.barcodeInfoMapping = new _BarcodeInfoMapping.BarcodeInfoMapping(source.barcodeInfoMapping);
}
if (source.arOverlay !== undefined) {
this.arOverlay = new _ArTrackingOverlayConfiguration.ArOverlayGeneralConfiguration(source.arOverlay);
}
}
}
exports.SingleScanningMode = SingleScanningMode;
//# sourceMappingURL=SingleScanningModeUseCase.js.map