UNPKG

react-native-scanbot-sdk

Version:

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

216 lines (195 loc) 7.21 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/textpattern/TextPatternScannerIntroScreenConfiguration.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 generic text scanner screen. */ export type TextPatternScannerIntroImage = | TextPatternIntroGeneralField | TextPatternIntroAlphabeticField | TextPatternIntroMeterDevice | TextPatternIntroShippingContainer | TextPatternIntroNoImage | TextPatternIntroCustomImage; /** @internal */ export namespace TextPatternScannerIntroImage { /** @internal */ export function From(source: { [key: string]: any }): TextPatternScannerIntroImage { const _type = source._type; switch (_type) { case 'TextPatternIntroGeneralField': return new TextPatternIntroGeneralField(source); case 'TextPatternIntroAlphabeticField': return new TextPatternIntroAlphabeticField(source); case 'TextPatternIntroMeterDevice': return new TextPatternIntroMeterDevice(source); case 'TextPatternIntroShippingContainer': return new TextPatternIntroShippingContainer(source); case 'TextPatternIntroNoImage': return new TextPatternIntroNoImage(source); case 'TextPatternIntroCustomImage': return new TextPatternIntroCustomImage(source); default: throw `Unknown child class name: ${_type}`; } } } /** The image for the introduction screen featuring a general text field. */ export class TextPatternIntroGeneralField extends PartiallyConstructible { public readonly _type: 'TextPatternIntroGeneralField' = 'TextPatternIntroGeneralField'; /** @param source {@displayType `DeepPartial<TextPatternIntroGeneralField>`} */ public constructor(source: DeepPartial<TextPatternIntroGeneralField> = {}) { super(); } } /** The image for the introduction screen featuring an alphabetic text field. */ export class TextPatternIntroAlphabeticField extends PartiallyConstructible { public readonly _type: 'TextPatternIntroAlphabeticField' = 'TextPatternIntroAlphabeticField'; /** @param source {@displayType `DeepPartial<TextPatternIntroAlphabeticField>`} */ public constructor(source: DeepPartial<TextPatternIntroAlphabeticField> = {}) { super(); } } /** The image for the introduction screen featuring an electricity meter. */ export class TextPatternIntroMeterDevice extends PartiallyConstructible { public readonly _type: 'TextPatternIntroMeterDevice' = 'TextPatternIntroMeterDevice'; /** @param source {@displayType `DeepPartial<TextPatternIntroMeterDevice>`} */ public constructor(source: DeepPartial<TextPatternIntroMeterDevice> = {}) { super(); } } /** The image for the introduction screen showing a text on a shipping container. */ export class TextPatternIntroShippingContainer extends PartiallyConstructible { public readonly _type: 'TextPatternIntroShippingContainer' = 'TextPatternIntroShippingContainer'; /** @param source {@displayType `DeepPartial<TextPatternIntroShippingContainer>`} */ public constructor(source: DeepPartial<TextPatternIntroShippingContainer> = {}) { super(); } } /** No image for the introduction screen. */ export class TextPatternIntroNoImage extends PartiallyConstructible { public readonly _type: 'TextPatternIntroNoImage' = 'TextPatternIntroNoImage'; /** @param source {@displayType `DeepPartial<TextPatternIntroNoImage>`} */ public constructor(source: DeepPartial<TextPatternIntroNoImage> = {}) { super(); } } /** A custom image for the introduction screen. */ export class TextPatternIntroCustomImage extends PartiallyConstructible { public readonly _type: 'TextPatternIntroCustomImage' = 'TextPatternIntroCustomImage'; /** The web or file URI to the image. */ public uri: string; /** @param source {@displayType `DeepPartial<TextPatternIntroCustomImage>`} */ public constructor(source: DeepPartial<TextPatternIntroCustomImage> = {}) { 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 generic text scanner. */ export class TextPatternScannerIntroScreenConfiguration extends PartiallyConstructible { /** The image for the introduction screen. */ public image: TextPatternScannerIntroImage = new TextPatternIntroGeneralField({}); /** 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<TextPatternScannerIntroScreenConfiguration>`} */ public constructor(source: DeepPartial<TextPatternScannerIntroScreenConfiguration> = {}) { super(); if (source.image !== undefined) { this.image = TextPatternScannerIntroImage.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); } } }