react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
397 lines (384 loc) • 12.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FindAndPickBadgeConfiguration = exports.FindAndPickArOverlayPolygonConfiguration = exports.BarcodeItemConfiguration = exports.ArOverlayPolygonConfiguration = exports.ArOverlayGeneralConfiguration = exports.ArOverlayFindAndPickConfiguration = void 0;
var _Common = require("../common/Common");
var _utils = require("../../utils");
/**
Configuration of the overlay polygon displayed on top of a barcode in the camera preview.
*/
class ArOverlayPolygonConfiguration extends _utils.PartiallyConstructible {
/**
Control the visibility of the overlay polygon.
Default is true
*/
visible = true;
/**
Appearance of the overlay polygon when a barcode is not selected.
*/
deselected = new _Common.PolygonStyle({
strokeColor: '?sbColorSurface',
fillColor: '#00000000',
strokeWidth: 2.0,
cornerRadius: 2.0
});
/**
Appearance of the overlay polygon after a barcode has been selected.
*/
selected = new _Common.PolygonStyle({
strokeColor: '?sbColorPositive',
fillColor: '#00000000',
strokeWidth: 2.0,
cornerRadius: 2.0
});
/** @param source {@displayType `DeepPartial<ArOverlayPolygonConfiguration>`} */
constructor(source = {}) {
super();
if (source.visible !== undefined) {
this.visible = source.visible;
}
if (source.deselected !== undefined) {
this.deselected = new _Common.PolygonStyle(source.deselected);
}
if (source.selected !== undefined) {
this.selected = new _Common.PolygonStyle(source.selected);
}
}
}
/**
Where to display the barcode info box in the camera preview.
- `DISABLED`:
Don't display any barcode info.
- `STACKED`:
Display the barcode info box in the center of the overlay polygon.
- `BELOW`:
Display the barcode info box below the overlay polygon.
- `ABOVE`:
Display the barcode info box above the overlay polygon.
*/
exports.ArOverlayPolygonConfiguration = ArOverlayPolygonConfiguration;
/**
Configuration of the barcode info box displayed in the camera preview.
*/
class BarcodeItemConfiguration extends _utils.PartiallyConstructible {
/**
Control the visibility of the barcode image in the info box.
Default is true
*/
imageVisible = true;
/**
Configuration of the text displaying a barcode's value in the info box when the barcode has been selected.
*/
titleSelected = new _Common.StyledText({
text: 'BARCODE_TITLE',
color: '?sbColorOnSurface'
});
/**
Configuration of the text displaying a barcode's symbology in the info box when the barcode has been selected.
*/
subtitleSelected = new _Common.StyledText({
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant'
});
/**
Configuration of the text displaying a barcode's value in the info box when the barcode is yet to be selected.
*/
titleDeselected = new _Common.StyledText({
text: 'BARCODE_TITLE',
color: '?sbColorOnSurface'
});
/**
Configuration of the text displaying a barcode's symbology in the info box when the barcode is yet to be selected.
*/
subtitleDeselected = new _Common.StyledText({
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant'
});
/**
Appearance of the barcode info box's background when a barcode has been selected.
*/
backgroundSelected = new _Common.PolygonStyle({
strokeColor: '?sbColorPositive',
fillColor: '?sbColorPositive',
strokeWidth: 0.0,
cornerRadius: 10.0
});
/**
Appearance of the barcode info box's background when a barcode is yet to be selected.
*/
backgroundDeselected = new _Common.PolygonStyle({
strokeColor: '?sbColorSurface',
fillColor: '?sbColorSurface',
strokeWidth: 0.0,
cornerRadius: 10.0
});
/** @param source {@displayType `DeepPartial<BarcodeItemConfiguration>`} */
constructor(source = {}) {
super();
if (source.imageVisible !== undefined) {
this.imageVisible = source.imageVisible;
}
if (source.titleSelected !== undefined) {
this.titleSelected = new _Common.StyledText(source.titleSelected);
}
if (source.subtitleSelected !== undefined) {
this.subtitleSelected = new _Common.StyledText(source.subtitleSelected);
}
if (source.titleDeselected !== undefined) {
this.titleDeselected = new _Common.StyledText(source.titleDeselected);
}
if (source.subtitleDeselected !== undefined) {
this.subtitleDeselected = new _Common.StyledText(source.subtitleDeselected);
}
if (source.backgroundSelected !== undefined) {
this.backgroundSelected = new _Common.PolygonStyle(source.backgroundSelected);
}
if (source.backgroundDeselected !== undefined) {
this.backgroundDeselected = new _Common.PolygonStyle(source.backgroundDeselected);
}
}
}
/**
Configuration of the AR overlay displayed on top of barcodes in the camera preview.
*/
exports.BarcodeItemConfiguration = BarcodeItemConfiguration;
class ArOverlayGeneralConfiguration extends _utils.PartiallyConstructible {
/**
Control the visibility of the user guidance.
Default is false
*/
visible = false;
/**
Parameters of the counter badge appearance e.g. color of background its stroke and text/icon color.
*/
counterBadge = new _Common.BadgeStyle({
background: new _Common.BackgroundStyle({}),
foregroundColor: '?sbColorOnSurface'
});
/**
If enabled, the scanner will always immediately scan a barcode in the viewfinder or the camera view. The overlay will mark the scanned barcodes and stays above them.
Default is false
*/
automaticSelectionEnabled = false;
/**
Where to display the barcode info box in the camera preview.
Default is BELOW
*/
barcodeItemInfoPosition = 'BELOW';
/**
Configuration of the overlay polygon displayed on top of a barcode in the camera preview.
*/
polygon = new ArOverlayPolygonConfiguration({
visible: true,
deselected: new _Common.PolygonStyle({}),
selected: new _Common.PolygonStyle({})
});
/**
Configuration of the barcode info box displayed in the camera preview.
*/
barcodeItemConfiguration = new 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({
text: 'BARCODE_SUBTITLE',
color: '?sbColorOnSurfaceVariant'
}),
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<ArOverlayGeneralConfiguration>`} */
constructor(source = {}) {
super();
if (source.visible !== undefined) {
this.visible = source.visible;
}
if (source.counterBadge !== undefined) {
this.counterBadge = new _Common.BadgeStyle(source.counterBadge);
}
if (source.automaticSelectionEnabled !== undefined) {
this.automaticSelectionEnabled = source.automaticSelectionEnabled;
}
if (source.barcodeItemInfoPosition !== undefined) {
this.barcodeItemInfoPosition = source.barcodeItemInfoPosition;
}
if (source.polygon !== undefined) {
this.polygon = new ArOverlayPolygonConfiguration(source.polygon);
}
if (source.barcodeItemConfiguration !== undefined) {
this.barcodeItemConfiguration = new BarcodeItemConfiguration(source.barcodeItemConfiguration);
}
}
}
/**
Configuration of the overlay polygon displayed on top of a barcode in the camera preview.
*/
exports.ArOverlayGeneralConfiguration = ArOverlayGeneralConfiguration;
class FindAndPickArOverlayPolygonConfiguration extends _utils.PartiallyConstructible {
/**
Control the visibility of the overlay polygon.
Default is true
*/
visible = true;
/**
Appearance of the overlay polygon when a barcode is partially scanned.
*/
partiallyScanned = new _Common.PolygonStyle({
strokeColor: '?sbColorWarning',
fillColor: '#00000000',
strokeWidth: 3.0,
cornerRadius: 5.0
});
/**
Appearance of the overlay polygon when a barcode is rejected.
*/
rejected = new _Common.PolygonStyle({
strokeColor: '?sbColorSurface',
fillColor: '#00000000',
strokeWidth: 3.0,
cornerRadius: 5.0
});
/**
Appearance of the overlay polygon when a barcode is completed.
*/
completed = new _Common.PolygonStyle({
strokeColor: '?sbColorPositive',
fillColor: '#00000000',
strokeWidth: 3.0,
cornerRadius: 5.0
});
/** @param source {@displayType `DeepPartial<FindAndPickArOverlayPolygonConfiguration>`} */
constructor(source = {}) {
super();
if (source.visible !== undefined) {
this.visible = source.visible;
}
if (source.partiallyScanned !== undefined) {
this.partiallyScanned = new _Common.PolygonStyle(source.partiallyScanned);
}
if (source.rejected !== undefined) {
this.rejected = new _Common.PolygonStyle(source.rejected);
}
if (source.completed !== undefined) {
this.completed = new _Common.PolygonStyle(source.completed);
}
}
}
/**
Configuration of the round badge on find and pick ar layer.
*/
exports.FindAndPickArOverlayPolygonConfiguration = FindAndPickArOverlayPolygonConfiguration;
class FindAndPickBadgeConfiguration extends _utils.PartiallyConstructible {
/**
Appearance of the badge when a barcode is partially scanned.
*/
partiallyScanned = new _Common.BadgeStyle({
visible: true,
background: new _Common.BackgroundStyle({
strokeColor: '#FFFFFF30',
fillColor: '?sbColorWarning',
strokeWidth: 0.0
}),
foregroundColor: '?sbColorOnSurface'
});
/**
Appearance of the badge when a barcode is rejected.
*/
rejected = new _Common.BadgeStyle({
visible: true,
background: new _Common.BackgroundStyle({
strokeColor: '#FFFFFF30',
fillColor: '?sbColorNegative',
strokeWidth: 0.0
}),
foregroundColor: '?sbColorOnSurface'
});
/**
Appearance of the badge when a barcode is completed.
*/
completed = new _Common.BadgeStyle({
visible: true,
background: new _Common.BackgroundStyle({
strokeColor: '#FFFFFF30',
fillColor: '?sbColorPositive',
strokeWidth: 0.0
}),
foregroundColor: '?sbColorOnSurface'
});
/** @param source {@displayType `DeepPartial<FindAndPickBadgeConfiguration>`} */
constructor(source = {}) {
super();
if (source.partiallyScanned !== undefined) {
this.partiallyScanned = new _Common.BadgeStyle(source.partiallyScanned);
}
if (source.rejected !== undefined) {
this.rejected = new _Common.BadgeStyle(source.rejected);
}
if (source.completed !== undefined) {
this.completed = new _Common.BadgeStyle(source.completed);
}
}
}
/**
Configuration of the AR overlay.
*/
exports.FindAndPickBadgeConfiguration = FindAndPickBadgeConfiguration;
class ArOverlayFindAndPickConfiguration extends _utils.PartiallyConstructible {
/**
Control the visibility of the user guidance.
Default is false
*/
visible = false;
/**
If enabled, the scanner will always immediately scan a barcode in the viewfinder or the camera view. The overlay will mark the scanned barcodes and stays above them.
Default is true
*/
automaticSelectionEnabled = true;
/**
Configuration of the overlay polygon displayed on top of a barcode in the camera preview.
*/
polygon = new FindAndPickArOverlayPolygonConfiguration({});
/**
Configuration of the round badge on find and pick ar layer.
*/
badge = new FindAndPickBadgeConfiguration({});
/** @param source {@displayType `DeepPartial<ArOverlayFindAndPickConfiguration>`} */
constructor(source = {}) {
super();
if (source.visible !== undefined) {
this.visible = source.visible;
}
if (source.automaticSelectionEnabled !== undefined) {
this.automaticSelectionEnabled = source.automaticSelectionEnabled;
}
if (source.polygon !== undefined) {
this.polygon = new FindAndPickArOverlayPolygonConfiguration(source.polygon);
}
if (source.badge !== undefined) {
this.badge = new FindAndPickBadgeConfiguration(source.badge);
}
}
}
exports.ArOverlayFindAndPickConfiguration = ArOverlayFindAndPickConfiguration;
//# sourceMappingURL=ArTrackingOverlayConfiguration.js.map