react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
186 lines (169 loc) • 5.95 kB
text/typescript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/creditcard/CreditCardScannerIntroScreenConfiguration.yaml
import {
BackgroundStyle,
ButtonConfiguration,
ForegroundStyle,
StyledText,
} from '../../ui_v2/common/Common';
import { DeepPartial, PartiallyConstructible } from '../../utils/utils';
/**
The image for the introduction screen of a credit card scanner screen.
*/
export type CreditCardScannerIntroImage =
| CreditCardIntroOneSideImage
| CreditCardIntroTwoSidesImage
| CreditCardNoImage
| CreditCardIntroCustomImage;
/** @internal */
export namespace CreditCardScannerIntroImage {
/** @internal */
export function From(source: { [key: string]: any }): CreditCardScannerIntroImage {
const _type = source._type;
switch (_type) {
case 'CreditCardIntroOneSideImage':
return new CreditCardIntroOneSideImage(source);
case 'CreditCardIntroTwoSidesImage':
return new CreditCardIntroTwoSidesImage(source);
case 'CreditCardNoImage':
return new CreditCardNoImage(source);
case 'CreditCardIntroCustomImage':
return new CreditCardIntroCustomImage(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
}
/**
The image for the introduction screen with one side of a credit card.
*/
export class CreditCardIntroOneSideImage extends PartiallyConstructible {
public readonly _type: 'CreditCardIntroOneSideImage' = 'CreditCardIntroOneSideImage';
/** @param source {@displayType `DeepPartial<CreditCardIntroOneSideImage>`} */
public constructor(source: DeepPartial<CreditCardIntroOneSideImage> = {}) {
super();
}
}
/**
The image for the introduction screen with two sides of a credit card.
*/
export class CreditCardIntroTwoSidesImage extends PartiallyConstructible {
public readonly _type: 'CreditCardIntroTwoSidesImage' = 'CreditCardIntroTwoSidesImage';
/** @param source {@displayType `DeepPartial<CreditCardIntroTwoSidesImage>`} */
public constructor(source: DeepPartial<CreditCardIntroTwoSidesImage> = {}) {
super();
}
}
/**
No image for the introduction screen.
*/
export class CreditCardNoImage extends PartiallyConstructible {
public readonly _type: 'CreditCardNoImage' = 'CreditCardNoImage';
/** @param source {@displayType `DeepPartial<CreditCardNoImage>`} */
public constructor(source: DeepPartial<CreditCardNoImage> = {}) {
super();
}
}
/**
A custom image for the introduction screen.
*/
export class CreditCardIntroCustomImage extends PartiallyConstructible {
public readonly _type: 'CreditCardIntroCustomImage' = 'CreditCardIntroCustomImage';
/**
The web or file URI to the image.
*/
public uri: string;
/** @param source {@displayType `DeepPartial<CreditCardIntroCustomImage>`} */
public constructor(source: DeepPartial<CreditCardIntroCustomImage> = {}) {
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 credit card scanner.
*/
export class CreditCardScannerIntroScreenConfiguration extends PartiallyConstructible {
/**
The image for the introduction screen.
*/
public image: CreditCardScannerIntroImage = new CreditCardIntroOneSideImage({});
/**
The background color of the introduction screen.
Default is "?sbColorSurface"
*/
public backgroundColor: string = '?sbColorSurface';
/**
The divider color of the introduction screen.
Default is "?sbColorOutline"
*/
public dividerColor: string = '?sbColorOutline';
/**
The handle color of the introduction screen.
Default is "?sbColorOutline"
*/
public handlerColor: string = '?sbColorOutline';
/**
Determines whether the introduction screen should automatically be shown or not when the scanning session starts.
Default is false
*/
public showAutomatically: boolean = false;
/**
The title of the introduction screen, located in the top bar.
*/
public title: StyledText = new StyledText({
text: '?introScreenTitle',
color: '?sbColorOnSurface',
});
/**
The text explanation of the introduction screen.
*/
public explanation: StyledText = new StyledText({
text: '?introScreenText',
color: '?sbColorOnSurface',
});
/**
Configuration of the 'Done' / 'Start scanning' button.
*/
public doneButton: ButtonConfiguration = new ButtonConfiguration({
text: '?introScreenDoneButton',
accessibilityDescription: '?accessibilityDescriptionIntroScreenDoneButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '?sbColorPrimary',
strokeWidth: 0.0,
}),
foreground: new ForegroundStyle({ color: '?sbColorOnPrimary' }),
});
/** @param source {@displayType `DeepPartial<CreditCardScannerIntroScreenConfiguration>`} */
public constructor(source: DeepPartial<CreditCardScannerIntroScreenConfiguration> = {}) {
super();
if (source.image !== undefined) {
this.image = CreditCardScannerIntroImage.From(source.image);
}
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.title !== undefined) {
this.title = new StyledText(source.title);
}
if (source.explanation !== undefined) {
this.explanation = new StyledText(source.explanation);
}
if (source.doneButton !== undefined) {
this.doneButton = new ButtonConfiguration(source.doneButton);
}
}
}