react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
292 lines (273 loc) • 8.54 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ReceiptsIntroImage = exports.NoIntroImage = exports.MedicalCertificateIntroImage = exports.IntroductionScreenConfiguration = exports.IntroListEntry = exports.IntroImage = exports.IdCardIntroImage = exports.DocumentIntroImage = exports.CustomImage = exports.CreditCardIntroImage = exports.CheckIntroImage = void 0;
var _Common = require("../common/Common");
var _utils = require("../../utils");
/**
An entry in the list of scanning steps of the introduction screen.
*/
class IntroListEntry extends _utils.PartiallyConstructible {
/**
The image of the entry.
*/
image = new NoIntroImage({});
/**
The text of the entry.
*/
text = new _Common.StyledText({
text: '?cameraIntroDescription',
color: '?sbColorOnSurface'
});
/** @param source {@displayType `DeepPartial<IntroListEntry>`} */
constructor(source = {}) {
super();
if (source.image !== undefined) {
this.image = IntroImage.From(source.image);
}
if (source.text !== undefined) {
this.text = new _Common.StyledText(source.text);
}
}
}
exports.IntroListEntry = IntroListEntry;
/** @internal */
let IntroImage = exports.IntroImage = void 0;
(function (_IntroImage) {
function From(source) {
const _type = source._type;
switch (_type) {
case 'NoIntroImage':
return new NoIntroImage(source);
case 'ReceiptsIntroImage':
return new ReceiptsIntroImage(source);
case 'MedicalCertificateIntroImage':
return new MedicalCertificateIntroImage(source);
case 'DocumentIntroImage':
return new DocumentIntroImage(source);
case 'CheckIntroImage':
return new CheckIntroImage(source);
case 'IdCardIntroImage':
return new IdCardIntroImage(source);
case 'CreditCardIntroImage':
return new CreditCardIntroImage(source);
case 'CustomImage':
return new CustomImage(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
_IntroImage.From = From;
})(IntroImage || (exports.IntroImage = IntroImage = {}));
/**
No image for the introduction screen.
*/
class NoIntroImage extends _utils.PartiallyConstructible {
_type = 'NoIntroImage';
/** @param source {@displayType `DeepPartial<NoIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with a receipt template.
*/
exports.NoIntroImage = NoIntroImage;
class ReceiptsIntroImage extends _utils.PartiallyConstructible {
_type = 'ReceiptsIntroImage';
/** @param source {@displayType `DeepPartial<ReceiptsIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with a medical certificate template.
*/
exports.ReceiptsIntroImage = ReceiptsIntroImage;
class MedicalCertificateIntroImage extends _utils.PartiallyConstructible {
_type = 'MedicalCertificateIntroImage';
/** @param source {@displayType `DeepPartial<MedicalCertificateIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with a document template.
*/
exports.MedicalCertificateIntroImage = MedicalCertificateIntroImage;
class DocumentIntroImage extends _utils.PartiallyConstructible {
_type = 'DocumentIntroImage';
/** @param source {@displayType `DeepPartial<DocumentIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with a check template.
*/
exports.DocumentIntroImage = DocumentIntroImage;
class CheckIntroImage extends _utils.PartiallyConstructible {
_type = 'CheckIntroImage';
/** @param source {@displayType `DeepPartial<CheckIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with an ID card template.
*/
exports.CheckIntroImage = CheckIntroImage;
class IdCardIntroImage extends _utils.PartiallyConstructible {
_type = 'IdCardIntroImage';
/** @param source {@displayType `DeepPartial<IdCardIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
The image for the introduction screen with a credit card template.
*/
exports.IdCardIntroImage = IdCardIntroImage;
class CreditCardIntroImage extends _utils.PartiallyConstructible {
_type = 'CreditCardIntroImage';
/** @param source {@displayType `DeepPartial<CreditCardIntroImage>`} */
constructor(source = {}) {
super();
}
}
/**
A custom image for the introduction screen.
*/
exports.CreditCardIntroImage = CreditCardIntroImage;
class CustomImage extends _utils.PartiallyConstructible {
_type = 'CustomImage';
/**
The web or file URI to the image.
*/
/** @param source {@displayType `DeepPartial<CustomImage>`} */
constructor(source = {}) {
super();
if (source.uri !== undefined) {
this.uri = source.uri;
} else {
throw new Error('uri must be present in constructor argument');
}
}
}
/**
Configuration of the introduction screen for the document scanner.
*/
exports.CustomImage = CustomImage;
class IntroductionScreenConfiguration extends _utils.PartiallyConstructible {
/**
The background color of the introduction screen.
Default is "?sbColorSurface"
*/
backgroundColor = '?sbColorSurface';
/**
The divider color of the introduction screen.
Default is "?sbColorOutline"
*/
dividerColor = '?sbColorOutline';
/**
The handle color of the introduction screen.
Default is "?sbColorOutline"
*/
handlerColor = '?sbColorOutline';
/**
Determines whether the introduction screen should automatically be shown or not when the scanning session starts.
Default is false
*/
showAutomatically = false;
/**
Configuration of the 'done' button, located in the top bar.
*/
topBarDoneButton = new _Common.ButtonConfiguration({
visible: true,
text: '?cameraIntroDoneButton',
accessibilityDescription: '?accessibilityDescriptionCameraIntroDoneButton',
background: new _Common.BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0
}),
foreground: new _Common.ForegroundStyle({
iconVisible: true,
color: '?sbColorPrimary',
useShadow: false
})
});
/**
The title of the introduction screen, located in the top bar.
*/
title = new _Common.StyledText({
text: '?cameraIntroTitle',
color: '?sbColorOnSurface'
});
/**
The subtitle of the introduction screen.
*/
subtitle = new _Common.StyledText({
text: '?cameraIntroSubtitle',
color: '?sbColorOnSurface'
});
/**
Configure the scanning steps of the introduction screen.
*/
items = [new IntroListEntry({
image: new DocumentIntroImage({}),
text: new _Common.StyledText({
text: '?cameraIntroItem1',
color: '?sbColorOnSurface'
})
}), new IntroListEntry({
image: new NoIntroImage({}),
text: new _Common.StyledText({
text: '?cameraIntroItem2',
color: '?sbColorOnSurface'
})
}), new IntroListEntry({
image: new NoIntroImage({}),
text: new _Common.StyledText({
text: '?cameraIntroItem3',
color: '?sbColorOnSurface'
})
}), new IntroListEntry({
image: new NoIntroImage({}),
text: new _Common.StyledText({
text: '?cameraIntroItem4',
color: '?sbColorOnSurface'
})
})];
/** @param source {@displayType `DeepPartial<IntroductionScreenConfiguration>`} */
constructor(source = {}) {
super();
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.dividerColor !== undefined) {
this.dividerColor = source.dividerColor;
}
if (source.handlerColor !== undefined) {
this.handlerColor = source.handlerColor;
}
if (source.showAutomatically !== undefined) {
this.showAutomatically = source.showAutomatically;
}
if (source.topBarDoneButton !== undefined) {
this.topBarDoneButton = new _Common.ButtonConfiguration(source.topBarDoneButton);
}
if (source.title !== undefined) {
this.title = new _Common.StyledText(source.title);
}
if (source.subtitle !== undefined) {
this.subtitle = new _Common.StyledText(source.subtitle);
}
if (source.items !== undefined) {
this.items = source.items.map(it => new IntroListEntry(it));
}
}
}
exports.IntroductionScreenConfiguration = IntroductionScreenConfiguration;
//# sourceMappingURL=IntroductionScreenConfiguration.js.map
;