UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

681 lines (661 loc) 28.9 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/document/CameraScreenConfiguration.yaml import { DocumentScannerParameters } from '../../document_scanner/DocumentScannerTypes'; import { CameraPermissionScreen } from '../../ui_v2/common/CameraPermission'; import { BackgroundStyle, BadgeStyle, BarButtonConfiguration, ButtonConfiguration, ForegroundStyle, IconButton, IconStyle, PolygonStyle, StyledText, Timeouts, Vibration, } from '../../ui_v2/common/Common'; import { ScanbotAlertDialog } from '../../ui_v2/common/ScanbotAlertDialog'; import { UserGuidanceConfiguration } from '../../ui_v2/common/UserGuidanceConfiguration'; import { ViewFinderConfiguration } from '../../ui_v2/common/ViewFinderConfiguration'; import { AcknowledgementScreenConfiguration } from '../../ui_v2/document/AcknowledgementScreenConfiguration'; import { DocumentScannerCameraConfiguration } from '../../ui_v2/document/DocumentScannerCameraConfiguration'; import { DocumentScannerUserGuidance } from '../../ui_v2/document/DocumentScannerUserGuidance'; import { IntroductionScreenConfiguration } from '../../ui_v2/document/IntroductionScreenConfiguration'; import { AspectRatio } from '../../utils/geometry/Geometry'; import { PartiallyConstructible } from '../../utils/utils'; /** Configuration of the 'shutter' button. */ export class ShutterButton extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ShutterButton>`} */ constructor(source = {}) { super(); /** Determines if the 'shutter' button can be tapped to manually snap a document when 'auto snapping mode' is active. Default is true */ this.enabledInAutoSnappingMode = true; /** The text to be read when the 'shutter' button is selected via the accessibility mode. Default is "?accessibilityDescriptionCameraShutterButton" */ this.accessibilityDescription = '?accessibilityDescriptionCameraShutterButton'; /** The outer color of the 'shutter' button. Default is "?sbColorOnPrimary" */ this.outerColor = '?sbColorOnPrimary'; /** The inner color of the 'shutter' button. Default is "?sbColorOnPrimary" */ this.innerColor = '?sbColorOnPrimary'; if (source.enabledInAutoSnappingMode !== undefined) { this.enabledInAutoSnappingMode = source.enabledInAutoSnappingMode; } if (source.accessibilityDescription !== undefined) { this.accessibilityDescription = source.accessibilityDescription; } if (source.outerColor !== undefined) { this.outerColor = source.outerColor; } if (source.innerColor !== undefined) { this.innerColor = source.innerColor; } } } /** @internal */ export var PreviewButton; (function (PreviewButton) { /** @internal */ function From(source) { const _type = source['_type']; switch (_type) { case 'PagePreviewMode': return new PagePreviewMode(source); case 'TextButtonMode': return new TextButtonMode(source); case 'NoButtonMode': return new NoButtonMode(source); default: throw `Unknown child class name: ${_type}`; } } PreviewButton.From = From; })(PreviewButton || (PreviewButton = {})); /** Configuration of the scan assistance overlay. */ export class ScanAssistanceOverlay extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ScanAssistanceOverlay>`} */ constructor(source = {}) { super(); /** Determines whether the scan assistance overlay is visible or not. If the viewfinder is enabled, this flag is ignored and the scan assistance overlay is not displayed. Default is true */ this.visible = true; /** The background color of the scan assistance overlay. Default is "?sbColorModalOverlay" */ this.backgroundColor = '?sbColorModalOverlay'; /** The foreground color of the scan assistance overlay image. Default is "?sbColorSurface" */ this.foregroundColor = '?sbColorSurface'; if (source.visible !== undefined) { this.visible = source.visible; } if (source.backgroundColor !== undefined) { this.backgroundColor = source.backgroundColor; } if (source.foregroundColor !== undefined) { this.foregroundColor = source.foregroundColor; } } } /** Configuration of the 'preview' button in 'page preview mode'. */ export class PagePreviewMode extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<PagePreviewMode>`} */ constructor(source = {}) { super(); this._type = 'PagePreviewMode'; /** The text to be read when the 'preview' button is selected via the accessibility mode. Default is "?accessibilityDescriptionCameraPreviewButton" */ this.accessibilityDescription = '?accessibilityDescriptionCameraPreviewButton'; /** The color of the image placeholder. Default is "?sbColorOnSurfaceVariant" */ this.imagePlaceholderColor = '?sbColorOnSurfaceVariant'; /** Configuration of the page counter icon. */ this.pageCounter = new BadgeStyle({ visible: true, background: new BackgroundStyle({ strokeColor: '?sbColorSurface', fillColor: '?sbColorSurface' }), foregroundColor: '?sbColorPrimary', }); if (source.accessibilityDescription !== undefined) { this.accessibilityDescription = source.accessibilityDescription; } if (source.imagePlaceholderColor !== undefined) { this.imagePlaceholderColor = source.imagePlaceholderColor; } if (source.pageCounter !== undefined) { this.pageCounter = new BadgeStyle(source.pageCounter); } } } /** Configuration of the 'preview' button in 'text button mode'. */ export class TextButtonMode extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<TextButtonMode>`} */ constructor(source = {}) { super(); this._type = 'TextButtonMode'; /** The text to be read when the 'preview' button is selected via the accessibility mode. Default is "?accessibilityDescriptionCameraPreviewButton" */ this.accessibilityDescription = '?accessibilityDescriptionCameraPreviewButton'; /** Configuration of the text style for the 'preview' button. */ this.style = new StyledText({ text: '?cameraPreviewButtonTitle', color: '?sbColorOnPrimary' }); if (source.accessibilityDescription !== undefined) { this.accessibilityDescription = source.accessibilityDescription; } if (source.style !== undefined) { this.style = new StyledText(source.style); } } } /** Configuration of the 'preview' button in 'no button mode'. */ export class NoButtonMode extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<NoButtonMode>`} */ constructor(source = {}) { super(); this._type = 'NoButtonMode'; /** Whether the button is visible. Default is false */ this.visible = false; if (source.visible !== undefined) { this.visible = source.visible; } } } /** Configuration of the bottom bar for the camera screen. */ export class CameraBottomBar extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<CameraBottomBar>`} */ constructor(source = {}) { super(); /** Configuration of the 'import' button. */ this.importButton = new BarButtonConfiguration({ title: new StyledText({ visible: false, text: '?cameraImportButtonTitle', color: '?sbColorOnPrimary' }), accessibilityDescription: '?accessibilityDescriptionCameraImportButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), icon: new IconStyle({ color: '?sbColorOnPrimary' }), }); /** Configuration of the 'auto snapping mode' button. */ this.autoSnappingModeButton = new BarButtonConfiguration({ title: new StyledText({ visible: false, text: '?cameraAutoSnapButtonTitle', color: '?sbColorOnPrimary' }), accessibilityDescription: '?accessibilityDescriptionCameraAutoSnapButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), icon: new IconStyle({ color: '?sbColorOnPrimary' }), }); /** Configuration of the 'manual snapping mode' button. */ this.manualSnappingModeButton = new BarButtonConfiguration({ title: new StyledText({ visible: false, text: '?cameraManualSnapButtonTitle', color: '?sbColorOnPrimary' }), accessibilityDescription: '?accessibilityDescriptionCameraManualSnapButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), icon: new IconStyle({ color: '?sbColorOnPrimary' }), }); /** Configuration of the 'shutter' button. */ this.shutterButton = new ShutterButton({ accessibilityDescription: '?accessibilityDescriptionCameraShutterButton', }); /** Configuration of the 'flashlight' button when in the 'on' state. */ this.torchOnButton = new BarButtonConfiguration({ title: new StyledText({ visible: false, text: '?cameraTorchOnButtonTitle', color: '?sbColorOnPrimary' }), accessibilityDescription: '?accessibilityDescriptionCameraTorchOnButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), icon: new IconStyle({ color: '?sbColorOnPrimary' }), }); /** Configuration of the 'flashlight' button when in the 'off' state. */ this.torchOffButton = new BarButtonConfiguration({ title: new StyledText({ visible: false, text: '?cameraTorchOffButtonTitle', color: '?sbColorOnPrimary' }), accessibilityDescription: '?accessibilityDescriptionCameraTorchOffButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), icon: new IconStyle({ color: '?sbColorOnPrimary' }), }); /** Configuration of the 'preview' button. */ this.previewButton = new PagePreviewMode({}); if (source.importButton !== undefined) { this.importButton = new BarButtonConfiguration(source.importButton); } if (source.autoSnappingModeButton !== undefined) { this.autoSnappingModeButton = new BarButtonConfiguration(source.autoSnappingModeButton); } if (source.manualSnappingModeButton !== undefined) { this.manualSnappingModeButton = new BarButtonConfiguration(source.manualSnappingModeButton); } if (source.shutterButton !== undefined) { this.shutterButton = new ShutterButton(source.shutterButton); } if (source.torchOnButton !== undefined) { this.torchOnButton = new BarButtonConfiguration(source.torchOnButton); } if (source.torchOffButton !== undefined) { this.torchOffButton = new BarButtonConfiguration(source.torchOffButton); } if (source.previewButton !== undefined) { this.previewButton = PreviewButton.From(source.previewButton); } } } /** @internal */ export var PageSnapFeedbackMode; (function (PageSnapFeedbackMode) { /** @internal */ function From(source) { const _type = source['_type']; switch (_type) { case 'PageSnapFunnelAnimation': return new PageSnapFunnelAnimation(source); case 'PageSnapCheckMarkAnimation': return new PageSnapCheckMarkAnimation(source); case 'PageSnapFeedbackNone': return new PageSnapFeedbackNone(source); default: throw `Unknown child class name: ${_type}`; } } PageSnapFeedbackMode.From = From; })(PageSnapFeedbackMode || (PageSnapFeedbackMode = {})); /** Configuration of the funnel animation. */ export class PageSnapFunnelAnimation extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<PageSnapFunnelAnimation>`} */ constructor(source = {}) { super(); this._type = 'PageSnapFunnelAnimation'; /** The overlay color for the funnel animation. Default is "?sbColorModalOverlay" */ this.overlayColor = '?sbColorModalOverlay'; if (source.overlayColor !== undefined) { this.overlayColor = source.overlayColor; } } } /** Configuration of the check mark animation. */ export class PageSnapCheckMarkAnimation extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<PageSnapCheckMarkAnimation>`} */ constructor(source = {}) { super(); this._type = 'PageSnapCheckMarkAnimation'; /** The overlay color for the check mark animation. Default is "?sbColorModalOverlay" */ this.overlayColor = '?sbColorModalOverlay'; /** The background color for the check mark animation. Default is "?sbColorOutline" */ this.checkMarkBackgroundColor = '?sbColorOutline'; /** The check mark color for the check mark animation. Default is "#00000000" */ this.checkMarkColor = '#00000000'; if (source.overlayColor !== undefined) { this.overlayColor = source.overlayColor; } if (source.checkMarkBackgroundColor !== undefined) { this.checkMarkBackgroundColor = source.checkMarkBackgroundColor; } if (source.checkMarkColor !== undefined) { this.checkMarkColor = source.checkMarkColor; } } } /** To not use a snap animation. */ export class PageSnapFeedbackNone extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<PageSnapFeedbackNone>`} */ constructor(source = {}) { super(); this._type = 'PageSnapFeedbackNone'; } } /** Configuration of the feedback shown after snapping a page. */ export class CaptureFeedback extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<CaptureFeedback>`} */ constructor(source = {}) { super(); /** Whether the camera preview should blink or not after snapping a page. Default is true */ this.cameraBlinkEnabled = true; /** The type of animation to display after snapping a page. */ this.snapFeedbackMode = new PageSnapFunnelAnimation({}); if (source.cameraBlinkEnabled !== undefined) { this.cameraBlinkEnabled = source.cameraBlinkEnabled; } if (source.snapFeedbackMode !== undefined) { this.snapFeedbackMode = PageSnapFeedbackMode.From(source.snapFeedbackMode); } } } /** Configuration of the document contour detection polygon. */ export class DocumentPolygonConfiguration extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<DocumentPolygonConfiguration>`} */ constructor(source = {}) { super(); /** Determines the visibility mode for the polygon. Default is ENABLED */ this.visibility = 'ENABLED'; /** Configuration of the polygon when the detected document status is 'OK'. */ this.documentOk = new PolygonStyle({ strokeColor: '?sbColorPositive', fillColor: '#00000000', strokeWidth: 2.0, }); /** Configuration of the polygon when the detected document status is 'not OK'. */ this.documentNotOk = new PolygonStyle({ strokeColor: '?sbColorNegative', fillColor: '#00000000', strokeWidth: 2.0, }); /** Configuration of the animated polygon when the document is being scanned for capturing in 'auto snapping mode'. */ this.autoSnapProgress = new PolygonStyle({ strokeColor: '#40A9FF', fillColor: '#00000000', strokeWidth: 2.0, }); if (source.visibility !== undefined) { this.visibility = source.visibility; } if (source.documentOk !== undefined) { this.documentOk = new PolygonStyle(source.documentOk); } if (source.documentNotOk !== undefined) { this.documentNotOk = new PolygonStyle(source.documentNotOk); } if (source.autoSnapProgress !== undefined) { this.autoSnapProgress = new PolygonStyle(source.autoSnapProgress); } } } /** Configuration of the screen for scanning the pages with the camera. */ export class CameraScreenConfiguration extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<CameraScreenConfiguration>`} */ constructor(source = {}) { super(); /** Configuration of the acknowledgement screen. */ this.acknowledgement = new AcknowledgementScreenConfiguration({}); /** Configuration of the document scanner introduction screen. */ this.introduction = new IntroductionScreenConfiguration({}); /** Configuration of the scan assistance overlay. */ this.scanAssistanceOverlay = new ScanAssistanceOverlay({}); /** Configuration of the camera permission screen. */ this.cameraPermission = new CameraPermissionScreen({ statusBarMode: 'DARK', background: '?sbColorSurface', iconBackground: '?sbColorOutline', icon: new IconStyle({ visible: true, color: '?sbColorOnSurface' }), enableCameraButton: new ButtonConfiguration({ visible: true, text: '?cameraPermissionEnableCameraButton', accessibilityDescription: '?accessibilityDescriptionCameraPermissionEnableCameraButton', background: new BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 0.0, }), foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false }), }), closeButton: new ButtonConfiguration({ visible: true, text: '?cameraPermissionCloseButton', accessibilityDescription: '?accessibilityDescriptionCameraPermissionCloseButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false }), }), enableCameraTitle: new StyledText({ text: '?cameraPermissionEnableCameraTitle', color: '?sbColorOnSurface' }), enableCameraExplanation: new StyledText({ text: '?cameraPermissionEnableCameraExplanation', color: '?sbColorOnSurfaceVariant', }), }); /** Configuration of the title, located in the top bar. */ this.topBarTitle = new StyledText({ text: '?cameraTopBarTitle', color: '?sbColorOnPrimary' }); /** Configuration of the 'introduction' button, located in the top bar. */ this.topBarIntroButton = new IconButton({ color: '?sbColorOnPrimary', accessibilityDescription: '?accessibilityDescriptionCameraTopBarIntroButton', }); /** Configuration of the 'cancel' button, located in the top bar. */ this.topBarBackButton = new ButtonConfiguration({ visible: true, text: '?cameraTopBarCancelButtonTitle', accessibilityDescription: '?accessibilityDescriptionCameraTopBarCancelButton', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0 }), foreground: new ForegroundStyle({ iconVisible: true, color: '?sbColorOnPrimary', useShadow: false }), }); /** Configuration of the static user guidance, located just below the top bar. */ this.topUserGuidance = new UserGuidanceConfiguration({ title: new StyledText({ text: '?cameraTopGuidance', color: '?sbColorOnPrimary' }), }); /** Configuration of the hints guiding users through the scanning process. */ this.userGuidance = new DocumentScannerUserGuidance({}); /** The background color of the camera screen. Default is "#000000FF" */ this.backgroundColor = '#000000FF'; /** If set to true, images imported from the gallery/photo library will be analyzed and eventually rotated to correct their orientation. Default is true */ this.autoRotateImages = true; /** If set to true, the review screen will be shown after each added page. Default is false */ this.openReviewAfterEachScan = false; /** Configuration of the camera behavior. */ this.cameraConfiguration = new DocumentScannerCameraConfiguration({}); /** The parameters of the document scanner. */ this.scannerParameters = new DocumentScannerParameters({}); /** Configuration of the document contour detection polygon. */ this.polygon = new DocumentPolygonConfiguration({}); /** Configuration of the bottom bar for the camera screen. */ this.bottomBar = new CameraBottomBar({}); /** Configuration of the viewfinder. */ this.viewFinder = new ViewFinderConfiguration({ aspectRatio: new AspectRatio({ width: 21.0, height: 29.0 }), visible: false, }); /** Configuration of the feedback shown after snapping a page. */ this.captureFeedback = new CaptureFeedback({}); /** Configuration of the scan confirmation vibration. */ this.vibration = new Vibration({ enabled: true }); /** Configuration of timeouts. */ this.timeouts = new Timeouts({ autoCancelTimeout: 0, initialScanDelay: 0 }); /** Configuration of the alert dialog displayed when the scan limit is reached. */ this.limitReachedAlertDialog = new ScanbotAlertDialog({ title: new StyledText({ text: '?cameraLimitReachedAlertTitle', color: '?sbColorOnSurface' }), subtitle: new StyledText({ text: '?cameraLimitReachedAlertSubtitle', color: '?sbColorOnSurfaceVariant' }), okButton: new ButtonConfiguration({ text: '?cameraLimitReachedOkButtonTitle', accessibilityDescription: '?accessibilityDescriptionCameraLimitReachedOkButton', background: new BackgroundStyle({ fillColor: '?sbColorPrimary', strokeWidth: 0.0 }), foreground: new ForegroundStyle({ color: '?sbColorOnPrimary' }), }), cancelButton: new ButtonConfiguration({ visible: false }), }); /** Configuration of the alert dialog displayed when the 'cancel' button is pressed. */ this.cancelAlertDialog = new ScanbotAlertDialog({ title: new StyledText({ text: '?cameraCancelAlertTitle', color: '?sbColorOnSurface' }), subtitle: new StyledText({ text: '?cameraCancelAlertSubtitle', color: '?sbColorOnSurfaceVariant' }), okButton: new ButtonConfiguration({ text: '?cameraCancelYesButtonTitle', accessibilityDescription: '?accessibilityDescriptionCameraCancelYesButton', background: new BackgroundStyle({ fillColor: '?sbColorPrimary', strokeWidth: 0.0 }), foreground: new ForegroundStyle({ color: '?sbColorOnPrimary' }), }), cancelButton: new ButtonConfiguration({ text: '?cameraCancelNoButtonTitle', accessibilityDescription: '?accessibilityDescriptionCameraCancelNoButton', background: new BackgroundStyle({ fillColor: '#00000000', strokeWidth: 0.0 }), foreground: new ForegroundStyle({ color: '?sbColorPrimary' }), }), }); if (source.acknowledgement !== undefined) { this.acknowledgement = new AcknowledgementScreenConfiguration(source.acknowledgement); } if (source.introduction !== undefined) { this.introduction = new IntroductionScreenConfiguration(source.introduction); } if (source.scanAssistanceOverlay !== undefined) { this.scanAssistanceOverlay = new ScanAssistanceOverlay(source.scanAssistanceOverlay); } if (source.cameraPermission !== undefined) { this.cameraPermission = new CameraPermissionScreen(source.cameraPermission); } if (source.topBarTitle !== undefined) { this.topBarTitle = new StyledText(source.topBarTitle); } if (source.topBarIntroButton !== undefined) { this.topBarIntroButton = new IconButton(source.topBarIntroButton); } if (source.topBarBackButton !== undefined) { this.topBarBackButton = new ButtonConfiguration(source.topBarBackButton); } if (source.topUserGuidance !== undefined) { this.topUserGuidance = new UserGuidanceConfiguration(source.topUserGuidance); } if (source.userGuidance !== undefined) { this.userGuidance = new DocumentScannerUserGuidance(source.userGuidance); } if (source.backgroundColor !== undefined) { this.backgroundColor = source.backgroundColor; } if (source.autoRotateImages !== undefined) { this.autoRotateImages = source.autoRotateImages; } if (source.openReviewAfterEachScan !== undefined) { this.openReviewAfterEachScan = source.openReviewAfterEachScan; } if (source.cameraConfiguration !== undefined) { this.cameraConfiguration = new DocumentScannerCameraConfiguration(source.cameraConfiguration); } if (source.scannerParameters !== undefined) { this.scannerParameters = new DocumentScannerParameters(source.scannerParameters); } if (source.polygon !== undefined) { this.polygon = new DocumentPolygonConfiguration(source.polygon); } if (source.bottomBar !== undefined) { this.bottomBar = new CameraBottomBar(source.bottomBar); } if (source.viewFinder !== undefined) { this.viewFinder = new ViewFinderConfiguration(source.viewFinder); } if (source.captureFeedback !== undefined) { this.captureFeedback = new CaptureFeedback(source.captureFeedback); } if (source.vibration !== undefined) { this.vibration = new Vibration(source.vibration); } if (source.timeouts !== undefined) { this.timeouts = new Timeouts(source.timeouts); } if (source.limitReachedAlertDialog !== undefined) { this.limitReachedAlertDialog = new ScanbotAlertDialog(source.limitReachedAlertDialog); } if (source.cancelAlertDialog !== undefined) { this.cancelAlertDialog = new ScanbotAlertDialog(source.cancelAlertDialog); } } } //# sourceMappingURL=CameraScreenConfiguration.js.map