react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
619 lines (502 loc) • 22.2 kB
text/typescript
import { DocumentDetectionStatus, PageImageSource } from '../document_scanner';
import { ParametricFilter } from '../image_filters/ParametricFilters';
/** Configuration that helps to override default hint values. */
export interface CheckUserGuidanceStrings {
/** Text that is shown on camera open. */
startScanning: string;
/** Text text that is shown when the camera is seeking for the document on the visible area, shown after the first result from the detector. */
scanning: string;
/** Text text that is shown when energy saving is active. */
energySaving: string;
/** Text that is shown when the camera snaps the image. */
capturing: string;
/** Text that is shown when the detector tries to detect the document from the snapped image. */
processing: string;
}
/** Supported check standards. */
export type CheckStandard =
/** A check compatible with the ASC X9 standard used in the USA */
| 'USA'
/** A check format commonly used in France */
| 'FRA'
/** A check format commonly used in Kuwait */
| 'KWT'
/** A check compatible with the Australian Paper Clearing System cheque standard */
| 'AUS'
/** A check compatible with the CTS-2010 standard issued by the Reserve Bank of India in 2012 */
| 'IND'
/** A check format commonly used in Israel */
| 'ISR'
/** A check format commonly used in the United Arab Emirates. */
| 'UAE'
/** A check format commonly used in Canada. */
| 'CAN';
/** Camera module to use */
export type CameraModule =
/** Front camera */
| 'FRONT'
/** Back camera */
| 'BACK'
/** The back camera with the widest available lens. iOS only. */
| 'BACK_WIDEST';
/** Applied interface orientation */
export type OrientationLockMode =
/** Do not restrict interface orientation */
| 'NONE'
/** Portrait screen orientations only */
| 'PORTRAIT'
/** Landscape screen orientations only */
| 'LANDSCAPE';
/** Standard size object */
export interface Size {
/** Width parameter */
width: number;
/** Height parameter */
height: number;
}
/** Represents camera preview modes */
export type CameraPreviewMode =
/** In this mode camera preview frames will be downscaled to the layout view size - full preview frame content will be visible, but unused edges could be appeared in the preview layout. */
| 'FIT_IN'
/** In this mode camera preview frames fill the layout view - the preview frames may contain additional content on the edges that was not visible in the preview layout. */
| 'FILL_IN';
/** Barcode scanner engine mode */
export type BarcodeOverlayTextFormat =
/** Show only barcode overlay frame. */
| 'NONE'
/** Show barcode value with extention. */
| 'CODE'
/** Show barcode value with barcode format. */
| 'CODE_AND_TYPE';
/** The font name and size. iOS only. */
export interface Font {
/** The font name. defaults to SYSTEM. */
fontName: string;
/** The font size. defaults 17.0 . */
fontSize: number;
}
/** The blur effect style. iOS only. */
export type BlurEffect =
/** The area of the view is lighter than the underlying view. */
| 'EXTRA_LIGHT'
/** The area of the view is the same approximate lightness of the underlying view. */
| 'LIGHT'
/** The area of the view is darker than the underlying view. */
| 'DARK'
/** A regular blur style that adapts to the user interface style. */
| 'REGULAR'
/** A blur style for making content more prominent that adapts to the user interface style. */
| 'PROMINENT'
/** An adaptable blur effect that creates the appearance of an ultra-thin material. iOS13+. */
| 'SYSTEM_ULTRA_THIN_MATERIAL'
/** An adaptable blur effect that creates the appearance of a thin material. iOS13+. */
| 'SYSTEM_THIN_MATERIAL'
/** An adaptable blur effect that create the appearance of a material with normal thickness. Defaults on iOS13 and more. iOS13+. */
| 'SYSTEM_MATERIAL'
/** An adaptable blur effect that creates the appearance of a material that's thicker than normal. iOS13+. */
| 'SYSTEM_THICK_MATERIAL'
/** An adaptable blur effect that creates the appearance of the system chrome. iOS13+. */
| 'SYSTEM_CHROME_MATERIAL'
/** A blur effect that creates the appearance of an ultra-thin material and is always light. iOS13+. */
| 'SYSTEM_ULTRA_THIN_MATERIAL_LIGHT'
/** A blur effect that creates the appearance of a thin material and is always light. iOS13+. */
| 'SYSTEM_THIN_MATERIAL_LIGHT'
/** A blur effect that creates the appearance of a material with normal thickness and is always light. iOS13+. */
| 'SYSTEM_MATERIAL_LIGHT'
/** A blur effect that creates the appearance of a material that’s thicker than normal and is always light. iOS13+. */
| 'SYSTEM_THICK_MATERIAL_LIGHT'
/** A blur effect that creates the appearance of the system chrome and is always light. iOS13+ */
| 'SYSTEM_CHROME_MATERIAL_LIGHT'
/** A blur effect that creates the appearance of an ultra-thin material and is always dark. iOS13+ */
| 'SYSTEM_ULTRA_THIN_MATERIAL_DARK'
/** A blur effect that creates the appearance of a thin material and is always dark. iOS13+ */
| 'SYSTEM_THIN_MATERIAL_DARK'
/** A blur effect that creates the appearance of a material with normal thickness and is always dark. iOS13+. */
| 'SYSTEM_MATERIAL_DARK'
/** A blur effect that creates the appearance of a material that’s thicker than normal and is always dark. iOS13+. */
| 'SYSTEM_THICK_MATERIAL_DARK'
/** A blur effect that creates the appearance of the system chrome and is always dark. iOS13+ */
| 'SYSTEM_CHROME_MATERIAL_DARK';
/** Defines a range for zooming */
export interface ZoomRange {
/** The minimum zoom scale. Defaults to 1.0. */
minZoom: number;
/** The maximum zoom scale. Defaults to 12.0. */
maxZoom: number;
}
/** Configuration for the dialog/alert style */
export interface DialogStyle {
/** The Color of the screen-covering backdrop view. */
screenBackgroundColor: string;
/** The general background color of the actual dialog view. */
dialogBackgroundColor: string;
/** The visual effect of the dialogs background. */
dialogBackgroundEffect: BlurEffect;
/** The corner radius of the dialog. */
cornerRadius: number;
/** The color of the dialogs title. */
titleColor: string;
/** The font of the dialogs title */
titleFont: Font;
/** The color of the dialogs message. */
messageColor: string;
/** The font of the dialogs message. */
messageFont: Font;
/** The color of the separators around the dialogs button area. */
separatorColor: string;
/** The width of the separators in points. */
separatorWidth: number;
}
/** Configuration for the dialogs/alerts OK button style. */
export interface DialogButtonStyle {
/** The font of the button title. */
font: Font;
/** The color of the buttons title while not pressed. */
textColor: string;
/** The color of the buttons title while pressed. */
highlightedTextColor: string;
/** The background color of the button while not pressed. */
backgroundColor: string;
/** The background color of the button while pressed. */
highlightedBackgroundColor: string;
}
/** The image filter types. */
export type ImageFilterType =
/** Passthrough filter. Does not alter the image. */
| 'NONE'
/** Optimizes colors, contrast and brightness. Usecase: photos. */
| 'COLOR'
/** Standard grayscale filter. Creates a grayscaled 8-bit image and optimizes contrast and dynamic range. */
| 'GRAYSCALE'
/** Standard binarization filter with contrast optimization. Creates a grayscaled 8-bit image with mostly black or white pixels. Usecase: Preparation for optical character recognition. */
| 'BINARIZED'
/** Fixes white-balance and cleans up the background. Usecase: images of paper documents. */
| 'COLOR_DOCUMENT'
/** A filter for binarizing an image. Creates an 8-bit image with pixel values set to eiter 0 or 255. Usecase: Preparation for optical character recognition. */
| 'PURE_BINARIZED'
/** Cleans up the background and tries to preserve photos within the image. Usecase: magazine pages, flyers. */
| 'BACKGROUND_CLEAN'
/** Black and white filter with background cleaning. Creates a grayscaled 8-bit image with mostly black or white pixels. Usecase: Textual documents or documents with black and white illustrations. */
| 'BLACK_AND_WHITE'
/** A filter for black and white conversion using OTSU binarization. */
| 'OTSU_BINARIZATION'
/** A filter for black and white conversion primary used for low-contrast documents. */
| 'DEEP_BINARIZATION'
/** A filter that enhances edges in low-contrast documents. */
| 'EDGE_HIGHLIGHT'
/** Binarization filter primary inteded to use on low-contrast documents with heavy shadows. */
| 'LOW_LIGHT_BINARIZATION'
/** Binarization filter primary intended to use on low-contrast documents with heavy shadows. */
| 'LOW_LIGHT_BINARIZATION_2'
/** Standard grayscale filter. Creates a grayscaled 8-bit image. */
| 'PURE_GRAY';
/** The prioritization of still image quality and capturing speed. Has no effect on devices prior to iOS 13.0. iOS only. */
export type CapturePhotoQualityPrioritization =
/** Captures a still image at the highest possible speed. The quality of the image may be degraded. iOS only. */
| 'SPEED'
/** Balances capturing speed and image quality equally. This is the default value. */
| 'BALANCED'
/** Captures a still image with the best possible quality in terms of noise, frozen motion and detail in low light. The speed of the capturing might be significantly reduced. */
| 'QUALITY';
/** SDK Page */
export interface Page {
/** A string identifying the page in the internal page file storage */
pageId: string;
/** The page's cropping polygon as calculated by a document detection operation or as set by the cropping UI. Modifying the polygon will change the polygon as shown in the cropping UI but will not automatically re-crop the original image */
polygon: PolygonPoint[];
/** The document detection result status for the operation that produced the page */
detectionResult: DocumentDetectionStatus;
/** The image source */
pageImageSource: PageImageSource;
/** The Image Filter that was applied on the page image. @deprecated Use **parametricFilters** instead. */
filter: ImageFilterType;
/** The Image Filters that are applied on the page image */
parametricFilters?: ParametricFilter[];
/** The value that was set for `documentImageSizeLimit`, which limits the maximum size of the document image. */
documentImageSizeLimit?: Size;
/** File URI of the original image */
originalImageFileUri: string;
/** File URI of the cropped document image (if document detection was successful) */
documentImageFileUri?: string;
/** File URI of a screen-sized preview of the original image */
originalPreviewImageFileUri: string;
/** File URI of a screen-sized preview of the document image (if document detection was successful) */
documentPreviewImageFileUri?: string;
}
/** The SDK license status */
export type LicenseStatus =
/** License is valid and accepted. */
| 'Okay'
/** No license set yet. The SDK is in trial mode. */
| 'Trial'
/** No license set yet. The SDKs trial mode is over. */
| 'Expired'
/** No license active. The set license does not cover the current operating system. */
| 'WrongOS'
/** No license active. The set license was unreadable or has an invalid format. */
| 'Corrupted'
/** No license active. The set licenses does not cover the current apps bundle identifier. */
| 'AppIDMismatch'
/** No license set yet. The SDKs trial mode is over. */
| 'NotSet';
/** Polygon Point */
export interface PolygonPoint {
/** Polygon point X */
x: number;
/** Polygon point Y */
y: number;
}
/** Result of applyImageFiltersOnPage */
export interface ApplyImageFiltersOnPageResult extends Page {}
/** Result of createPage */
export interface CreatePageResult extends Page {}
/** Result of detectDocumentOnPage */
export interface DetectDocumentOnPageResult extends Page {}
/** Result of rotatePage */
export interface RotatePageResult extends Page {}
/** Result of setDocumentImage */
export interface SetDocumentImageResult extends Page {}
/** Cropping screen accessibility configuration */
export interface CroppingAccessibilityConfiguration {
/** Text, that is used as an accessibility label for the cancel button */
cancelButtonAccessibilityLabel: string;
/** Text used as an accessibility hint for the cancel button. */
cancelButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the done button */
doneButtonAccessibilityLabel: string;
/** Text used as an accessibility hint for the done button. */
doneButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the detect button */
detectButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the detect button */
detectButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the reset button */
resetButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the reset button */
resetButtonAccessibilityHint: string;
/** Text, that is used as an accessibility hint for the rotate button */
rotateButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the rotate button */
rotateButtonAccessibilityHint: string;
}
/** Field display configuration object */
export interface FieldsDisplayConfiguration {
/** Complete list of available normalized field names is available in the documentation */
normalizedFieldName: string;
/** The display text of the field in the list */
defaultDisplayText: string;
/** The default display state of a field in the RTU UI, could be hidden by default or visible by default. */
defaultDisplayState: FieldDisplayState;
}
/** Field display configuration object */
export interface DocumentsDisplayConfiguration {
/** Complete list of available normalized document names is available in the documentation */
normalizedDocumentName: string;
/** The display text of the document in the list */
defaultDisplayText: string;
}
/** Field display state in the RTU UI */
export type FieldDisplayState =
/** Field will not be shown in the RTU UI */
| 'HIDDEN'
/** Field will be shown in the RTU UI if its text value isn't an empty string */
| 'VISIBLE_IF_NOT_EMPTY'
/** Field will be shown in the RTU UI */
| 'ALWAYS_VISIBLE';
/** Supported document types */
export type DocumentDataType =
/** German ID card, front side */
| 'DE_ID_CARD_FRONT'
/** German ID card, back side */
| 'DE_ID_CARD_BACK'
/** German travel passport (Reisepass) */
| 'DE_PASSPORT'
/** German driver license (Führerschein), front side */
| 'DE_DRIVER_LICENSE_FRONT'
/** German driver license (Führerschein), back side */
| 'DE_DRIVER_LICENSE_BACK'
/** German Residence Permit (Aufenthaltstitel), front side */
| 'DE_RESIDENCE_PERMIT_FRONT'
/** German Residence Permit (Aufenthaltstitel), back side */
| 'DE_RESIDENCE_PERMIT_BACK'
/** German health insurance card, front side */
| 'DE_HEALTH_INSURANCE_CARD_FRONT'
/** European health insurance card */
| 'EU_HEALTH_INSURANCE_CARD';
/** Document scanner accessibility configuration */
export interface DocumentScannerAccessibilityConfiguration {
/** Text, that is used as an accessibility label for the flash button. */
flashButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the flash button. */
flashButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the multi-page button. */
multiPageButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the multi-page button. */
multiPageButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the auto-snapping button. */
autoSnappingButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the auto-snapping button. */
autoSnappingButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the cancel button. */
cancelButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the cancel button. */
cancelButtonAccessibilityHint: string;
/** Text, that is used as an accessibility label for the page-amount button. */
pageCounterButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the page-amount button. */
pageCounterAccessibilityHint: string;
/** Text used as an accessibility label for the shutter button. */
shutterButtonAccessibilityLabel: string;
/** Text, that is used as an accessibility hint for the shutter button. */
shutterButtonAccessibilityHint: string;
}
/** The live detection configuration parameters. */
export interface HealthInsuranceCardRecognizerParameters {
/** List of allowed countries for the health insurance card recognizer. */
acceptedCountries: HealthInsuranceCardCountryType[];
/** Minimum of birth-year. */
minBirthYear: number;
/** Maximum of birth-year. */
maxBirthYear: number;
/** Minimum of card-expiration-year. */
minExpirationYear: number;
/** Maximum ranges of card-expiration-year. */
maxExpirationYear: number;
/** Maximum number of attempts before giving up on country detection. */
maxCountryDetectionAttempts: number;
/** Maximum number of partial frame results to keep in cache while waiting to gather `minEqualFrameCount` equal results. */
maxAccumulatedFrameCount: number;
/** Minimum number of accumulated frames that should have equal result for a field. */
minEqualFrameCount: number;
}
/** The country types to be used in the acceptedCountries. */
export type HealthInsuranceCardCountryType =
/** The country named Austria. */
| 'AUSTRIA'
/** The country named Belgium. */
| 'BELGIUM'
/** The country named Bulgaria. */
| 'BULGARIA'
/** The country named Croatia. */
| 'CROATIA'
/** The country named Cyprus. */
| 'CYPRUS'
/** The country named Czech Republic. */
| 'CZECH_REPUBLIC'
/** The country named Denmark. */
| 'DENMARK'
/** The country named Estonia. */
| 'ESTONIA'
/** The country named Finland. */
| 'FINLAND'
/** The country named France. */
| 'FRANCE'
/** The country named Germany. */
| 'GERMANY'
/** The country named Greece. */
| 'GREECE'
/** The country named Hungary. */
| 'HUNGARY'
/** The country named Ireland. */
| 'IRELAND'
/** The country named Italy. */
| 'ITALY'
/** The country named Latvia. */
| 'LATVIA'
/** The country named Lithuania. */
| 'LITHUANIA'
/** The country named Luxembourg. */
| 'LUXEMBOURG'
/** The country named Malta. */
| 'MALTA'
/** The country named Netherlands. */
| 'NETHERLANDS'
/** The country named Poland. */
| 'POLAND'
/** The country named Portugal. */
| 'PORTUGAL'
/** The country named Romania. */
| 'ROMANIA'
/** The country named Slovakia. */
| 'SLOVAKIA'
/** The country named Slovenia. */
| 'SLOVENIA'
/** The country named Spain. */
| 'SPAIN'
/** The country named Sweden. */
| 'SWEDEN'
/** The country named Switzerland. */
| 'SWITZERLAND';
/** Finder Document scanner accessibility configuration */
export interface FinderDocumentScannerAccessibilityConfiguration {
/** Text used as an accessibility label for the flash button. */
flashButtonAccessibilityLabel: string;
/** Text used as an accessibility hint for the flash button. */
flashButtonAccessibilityHint: string;
/** Text used as an accessibility label for the cancel button. */
cancelButtonAccessibilityLabel: string;
/** Text used as an accessibility hint for the cancel button. */
cancelButtonAccessibilityHint: string;
/** Text used as an accessibility label for the shutter button. */
shutterButtonAccessibilityLabel: string;
/** Text used as an accessibility hint for the shutter button. */
shutterButtonAccessibilityHint: string;
}
/** Configuration for the hint values */
export interface MedicalCertificateUserGuidanceStrings {
/** Text that is shown on camera open. */
startScanning: string;
/** Text text that is shown when the camera is seeking for the document on the visible area, shown after the first result from the detector. */
scanning: string;
/** Text text that is shown when energy saving is active. */
energySaving: string;
/** Text that is shown when the camera snaps the image. */
capturing: string;
/** Text that is shown when the detector tries to detect the document from the snapped image. */
processing: string;
/** Text that is shown when the detector is paused. iOS only. */
paused: string;
}
/** The bounding box of the receiver in absolute image coordinate system */
export interface OCRBoundingBox {
/** x */
x: number;
/** y */
y: number;
/** width */
width: number;
/** height */
height: number;
}
/** Represents the results of an optical character recognition (OCR) operation */
export interface OCRResultBlock {
/** The recognized text within the receivers bounding box */
text: string;
/** Ranges from 0.0 (not confident) to 100.0 (very confident). */
confidence: number;
/** The bounding box of the receiver in absolute image coordinate system */
boundingBox: OCRBoundingBox;
}
/** Represents the results of an optical character recognition (OCR) operation */
export interface OCRPage {
/** The recognized text of the page */
text: string;
/** The paragraph blocks of the page */
paragraphs: OCRResultBlock[];
/** The line blocks of the page */
lines: OCRResultBlock[];
/** The word blocks of the page */
words: OCRResultBlock[];
}
/** Image format */
export type StorageImageFormat =
/** JPG image format */
| 'JPG'
/** PNG image format */
| 'PNG';
/** File encryption mode, 'AES128' or 'AES256'. */
export type FileEncryptionMode =
/** AES128 encryption mode */
| 'AES128'
/** AES256 encryption mode */
| 'AES256';