UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

298 lines (271 loc) 8.9 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/document/IntroductionScreenConfiguration.yaml import { BackgroundStyle, ButtonConfiguration, ForegroundStyle, StyledText, } from '../../ui_v2/common/Common'; import { DeepPartial, PartiallyConstructible } from '../../utils/utils'; /** An entry in the list of scanning steps of the introduction screen. */ export class IntroListEntry extends PartiallyConstructible { /** The image of the entry. */ public image: IntroImage = new NoIntroImage({}); /** The text of the entry. */ public text: StyledText = new StyledText({ text: '?cameraIntroDescription', color: '?sbColorOnSurface', }); /** @param source {@displayType `DeepPartial<IntroListEntry>`} */ public constructor(source: DeepPartial<IntroListEntry> = {}) { super(); if (source.image !== undefined) { this.image = IntroImage.From(source.image); } if (source.text !== undefined) { this.text = new StyledText(source.text); } } } /** Determines the image for the introduction screen. */ export type IntroImage = | NoIntroImage | CustomImage | ReceiptsIntroImage | MedicalCertificateIntroImage | DocumentIntroImage | CheckIntroImage | IdCardIntroImage | CreditCardIntroImage; /** @internal */ export namespace IntroImage { /** @internal */ export function From(source: { [key: string]: any }): IntroImage { const _type = source._type; switch (_type) { case 'NoIntroImage': return new NoIntroImage(source); case 'CustomImage': return new CustomImage(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); default: throw `Unknown child class name: ${_type}`; } } } /** No image for the introduction screen. */ export class NoIntroImage extends PartiallyConstructible { public readonly _type: 'NoIntroImage' = 'NoIntroImage'; /** @param source {@displayType `DeepPartial<NoIntroImage>`} */ public constructor(source: DeepPartial<NoIntroImage> = {}) { super(); } } /** A custom image for the introduction screen. */ export class CustomImage extends PartiallyConstructible { public readonly _type: 'CustomImage' = 'CustomImage'; /** The web or file URI to the image. */ public uri: string; /** @param source {@displayType `DeepPartial<CustomImage>`} */ public constructor(source: DeepPartial<CustomImage> = {}) { super(); if (source.uri !== undefined) { this.uri = source.uri; } else { throw new Error('uri must be present in constructor argument'); } } } /** The image for the introduction screen with a receipt template. */ export class ReceiptsIntroImage extends PartiallyConstructible { public readonly _type: 'ReceiptsIntroImage' = 'ReceiptsIntroImage'; /** @param source {@displayType `DeepPartial<ReceiptsIntroImage>`} */ public constructor(source: DeepPartial<ReceiptsIntroImage> = {}) { super(); } } /** The image for the introduction screen with a medical certificate template. */ export class MedicalCertificateIntroImage extends PartiallyConstructible { public readonly _type: 'MedicalCertificateIntroImage' = 'MedicalCertificateIntroImage'; /** @param source {@displayType `DeepPartial<MedicalCertificateIntroImage>`} */ public constructor(source: DeepPartial<MedicalCertificateIntroImage> = {}) { super(); } } /** The image for the introduction screen with a document template. */ export class DocumentIntroImage extends PartiallyConstructible { public readonly _type: 'DocumentIntroImage' = 'DocumentIntroImage'; /** @param source {@displayType `DeepPartial<DocumentIntroImage>`} */ public constructor(source: DeepPartial<DocumentIntroImage> = {}) { super(); } } /** The image for the introduction screen with a check template. */ export class CheckIntroImage extends PartiallyConstructible { public readonly _type: 'CheckIntroImage' = 'CheckIntroImage'; /** @param source {@displayType `DeepPartial<CheckIntroImage>`} */ public constructor(source: DeepPartial<CheckIntroImage> = {}) { super(); } } /** The image for the introduction screen with an ID card template. */ export class IdCardIntroImage extends PartiallyConstructible { public readonly _type: 'IdCardIntroImage' = 'IdCardIntroImage'; /** @param source {@displayType `DeepPartial<IdCardIntroImage>`} */ public constructor(source: DeepPartial<IdCardIntroImage> = {}) { super(); } } /** The image for the introduction screen with a credit card template. */ export class CreditCardIntroImage extends PartiallyConstructible { public readonly _type: 'CreditCardIntroImage' = 'CreditCardIntroImage'; /** @param source {@displayType `DeepPartial<CreditCardIntroImage>`} */ public constructor(source: DeepPartial<CreditCardIntroImage> = {}) { super(); } } /** Configuration of the introduction screen for the document scanner. */ export class IntroductionScreenConfiguration extends PartiallyConstructible { /** 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; /** Configuration of the 'done' button, located in the top bar. */ public topBarDoneButton: ButtonConfiguration = new ButtonConfiguration({ visible: true, text: '?cameraIntroDoneButton', accessibilityDescription: '?accessibilityDescriptionCameraIntroDoneButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0, }), foreground: new ForegroundStyle({ iconVisible: true, color: '?sbColorPrimary', useShadow: false, }), }); /** The title of the introduction screen, located in the top bar. */ public title: StyledText = new StyledText({ text: '?cameraIntroTitle', color: '?sbColorOnSurface', }); /** The subtitle of the introduction screen. */ public subtitle: StyledText = new StyledText({ text: '?cameraIntroSubtitle', color: '?sbColorOnSurface', }); /** Configure the scanning steps of the introduction screen. */ public items: IntroListEntry[] = [ new IntroListEntry({ image: new DocumentIntroImage({}), text: new StyledText({ text: '?cameraIntroItem1', color: '?sbColorOnSurface' }), }), new IntroListEntry({ image: new NoIntroImage({}), text: new StyledText({ text: '?cameraIntroItem2', color: '?sbColorOnSurface' }), }), new IntroListEntry({ image: new NoIntroImage({}), text: new StyledText({ text: '?cameraIntroItem3', color: '?sbColorOnSurface' }), }), new IntroListEntry({ image: new NoIntroImage({}), text: new StyledText({ text: '?cameraIntroItem4', color: '?sbColorOnSurface' }), }), ]; /** @param source {@displayType `DeepPartial<IntroductionScreenConfiguration>`} */ public constructor(source: DeepPartial<IntroductionScreenConfiguration> = {}) { 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 ButtonConfiguration(source.topBarDoneButton); } if (source.title !== undefined) { this.title = new StyledText(source.title); } if (source.subtitle !== undefined) { this.subtitle = new StyledText(source.subtitle); } if (source.items !== undefined) { this.items = source.items.map((it: any) => { return new IntroListEntry(it); }); } } }