UNPKG

react-native-scanbot-sdk

Version:

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

171 lines (156 loc) 5.53 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/documentdataextractor/DocumentDataExtractorIntroScreenConfiguration.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 document data extractor screen. */ export type DocumentDataExtractorIntroImage = | DocumentDataIntroDefaultImage | DocumentDataIntroNoImage | DocumentDataIntroCustomImage; /** @internal */ export namespace DocumentDataExtractorIntroImage { /** @internal */ export function From(source: { [key: string]: any }): DocumentDataExtractorIntroImage { const _type = source._type; switch (_type) { case 'DocumentDataIntroDefaultImage': return new DocumentDataIntroDefaultImage(source); case 'DocumentDataIntroNoImage': return new DocumentDataIntroNoImage(source); case 'DocumentDataIntroCustomImage': return new DocumentDataIntroCustomImage(source); default: throw `Unknown child class name: ${_type}`; } } } /** The image for the introduction screen featuring a document. */ export class DocumentDataIntroDefaultImage extends PartiallyConstructible { public readonly _type: 'DocumentDataIntroDefaultImage' = 'DocumentDataIntroDefaultImage'; /** @param source {@displayType `DeepPartial<DocumentDataIntroDefaultImage>`} */ public constructor(source: DeepPartial<DocumentDataIntroDefaultImage> = {}) { super(); } } /** No image for the introduction screen. */ export class DocumentDataIntroNoImage extends PartiallyConstructible { public readonly _type: 'DocumentDataIntroNoImage' = 'DocumentDataIntroNoImage'; /** @param source {@displayType `DeepPartial<DocumentDataIntroNoImage>`} */ public constructor(source: DeepPartial<DocumentDataIntroNoImage> = {}) { super(); } } /** A custom image for the introduction screen. */ export class DocumentDataIntroCustomImage extends PartiallyConstructible { public readonly _type: 'DocumentDataIntroCustomImage' = 'DocumentDataIntroCustomImage'; /** The web or file URI to the image. */ public uri: string; /** @param source {@displayType `DeepPartial<DocumentDataIntroCustomImage>`} */ public constructor(source: DeepPartial<DocumentDataIntroCustomImage> = {}) { 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 data extractor. */ export class DocumentDataExtractorIntroScreenConfiguration extends PartiallyConstructible { /** The image for the introduction screen. */ public image: DocumentDataExtractorIntroImage = new DocumentDataIntroDefaultImage({}); /** 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<DocumentDataExtractorIntroScreenConfiguration>`} */ public constructor(source: DeepPartial<DocumentDataExtractorIntroScreenConfiguration> = {}) { super(); if (source.image !== undefined) { this.image = DocumentDataExtractorIntroImage.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); } } }