capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
129 lines • 5.4 kB
JavaScript
import { PartiallyConstructible } from '../../utils';
import { BackgroundStyle, BarButtonConfiguration, IconStyle, StyledText, } from '../common/Common';
import { IconUserGuidanceConfiguration } from '../common/UserGuidanceConfiguration';
/**
Configuration of the bottom bar for the acknowledgement screen.
*/
export class AcknowledgementBottomBar extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<AcknowledgementBottomBar>`} */
constructor(source = {}) {
super();
/**
Configuration of the 'retake' button.
*/
this.retakeButton = new BarButtonConfiguration({
title: new StyledText({
text: '?acknowledgementRetakeButtonTitle',
color: '?sbColorOnPrimary',
}),
accessibilityDescription: '?accessibilityDescriptionAcknowledgementRetakeButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0,
}),
icon: new IconStyle({ color: '?sbColorOnPrimary' }),
});
/**
Configuration of the 'accept' button, when the quality of the scanned page is acceptable.
*/
this.acceptWhenOkButton = new BarButtonConfiguration({
title: new StyledText({
text: '?acknowledgementAcceptButtonTitle',
color: '?sbColorOnPrimary',
}),
accessibilityDescription: '?accessibilityDescriptionAcknowledgementAcceptButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0,
}),
icon: new IconStyle({ color: '?sbColorOnPrimary' }),
});
/**
Configuration of the 'accept' button, when the quality of the scanned page is unacceptable.
*/
this.acceptWhenNotOkButton = new BarButtonConfiguration({
title: new StyledText({
text: '?acknowledgementAcceptButtonTitle',
color: '?sbColorOnPrimary',
}),
accessibilityDescription: '?accessibilityDescriptionAcknowledgementAcceptButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0,
}),
icon: new IconStyle({ color: '?sbColorOnPrimary' }),
});
if (source.retakeButton !== undefined) {
this.retakeButton = new BarButtonConfiguration(source.retakeButton);
}
if (source.acceptWhenOkButton !== undefined) {
this.acceptWhenOkButton = new BarButtonConfiguration(source.acceptWhenOkButton);
}
if (source.acceptWhenNotOkButton !== undefined) {
this.acceptWhenNotOkButton = new BarButtonConfiguration(source.acceptWhenNotOkButton);
}
}
}
/**
Configuration of the acknowledgement screen.
*/
export class AcknowledgementScreenConfiguration extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<AcknowledgementScreenConfiguration>`} */
constructor(source = {}) {
super();
/**
The minimum quality of a scanned page to be deemed acceptable. Used in conjunction with the acknowledgement mode.
Default is POOR
*/
this.minimumQuality = 'POOR';
/**
Determines, after each page is snapped, whether the acknowledgment screen should be displayed or not.
Default is ALWAYS
*/
this.acknowledgementMode = 'ALWAYS';
/**
Configuration of the hint that explains that the quality of the scanned page is unacceptable.
*/
this.badImageHint = new IconUserGuidanceConfiguration({
visible: true,
icon: new IconStyle({ color: '?sbColorOnPrimary' }),
title: new StyledText({
text: '?acknowledgementScreenBadDocumentHint',
color: '?sbColorOnPrimary',
}),
background: new BackgroundStyle({
strokeColor: '?sbColorNegative',
fillColor: '?sbColorNegative',
strokeWidth: 0.0,
}),
});
/**
The background color of the acknowledgement screen.
Default is "?sbColorOutline"
*/
this.backgroundColor = '?sbColorOutline';
/**
Configuration of the bottom bar for the acknowledgement screen.
*/
this.bottomBar = new AcknowledgementBottomBar({});
if (source.minimumQuality !== undefined) {
this.minimumQuality = source.minimumQuality;
}
if (source.acknowledgementMode !== undefined) {
this.acknowledgementMode = source.acknowledgementMode;
}
if (source.badImageHint !== undefined) {
this.badImageHint = new IconUserGuidanceConfiguration(source.badImageHint);
}
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.bottomBar !== undefined) {
this.bottomBar = new AcknowledgementBottomBar(source.bottomBar);
}
}
}
//# sourceMappingURL=AcknowledgementScreenConfiguration.js.map