UNPKG

react-native-scanbot-sdk

Version:

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

734 lines (733 loc) 24.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _exportNames = { ScanbotBarcodeCameraView: true, ScanbotDocumentScannerView: true, Point: true }; Object.defineProperty(exports, "Point", { enumerable: true, get: function () { return _utils.Point; } }); Object.defineProperty(exports, "ScanbotBarcodeCameraView", { enumerable: true, get: function () { return _ScanbotBarcodeCameraView.ScanbotBarcodeCameraView; } }); Object.defineProperty(exports, "ScanbotDocumentScannerView", { enumerable: true, get: function () { return _ScanbotDocumentScannerView.ScanbotDocumentScannerView; } }); exports.default = void 0; var _reactNative = require("react-native"); var _ScanbotBarcodeCameraView = require("./components/barcode-camera-view/ScanbotBarcodeCameraView"); var _ScanbotDocumentScannerView = require("./components/document-scanner-view/ScanbotDocumentScannerView"); var _arguments = require("./arguments"); Object.keys(_arguments).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _arguments[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _arguments[key]; } }); }); var _parameters = require("./parameters"); Object.keys(_parameters).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _parameters[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _parameters[key]; } }); }); var _configurations = require("./configurations"); Object.keys(_configurations).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _configurations[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _configurations[key]; } }); }); var _customTypes = require("./customTypes"); Object.keys(_customTypes).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _customTypes[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _customTypes[key]; } }); }); var _results = require("./results"); Object.keys(_results).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _results[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _results[key]; } }); }); var _types = require("./types"); Object.keys(_types).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _types[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _types[key]; } }); }); var _utils = require("./utils"); var _ScanbotBarcodeCameraViewProperties = require("./components/barcode-camera-view/ScanbotBarcodeCameraViewProperties"); Object.keys(_ScanbotBarcodeCameraViewProperties).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _ScanbotBarcodeCameraViewProperties[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ScanbotBarcodeCameraViewProperties[key]; } }); }); var _ScanbotDocumentScannerViewProperties = require("./components/document-scanner-view/ScanbotDocumentScannerViewProperties"); Object.keys(_ScanbotDocumentScannerViewProperties).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _ScanbotDocumentScannerViewProperties[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ScanbotDocumentScannerViewProperties[key]; } }); }); var _BarcodeDocumentModel = require("./documents/BarcodeDocumentModel"); Object.keys(_BarcodeDocumentModel).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _BarcodeDocumentModel[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _BarcodeDocumentModel[key]; } }); }); var _CheckDocumentModel = require("./documents/CheckDocumentModel"); Object.keys(_CheckDocumentModel).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _CheckDocumentModel[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _CheckDocumentModel[key]; } }); }); var _CommonFieldType = require("./documents/CommonFieldType"); Object.keys(_CommonFieldType).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _CommonFieldType[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _CommonFieldType[key]; } }); }); var _DocumentsModel = require("./documents/DocumentsModel"); Object.keys(_DocumentsModel).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _DocumentsModel[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _DocumentsModel[key]; } }); }); var _GenericDocument = require("./documents/GenericDocument"); Object.keys(_GenericDocument).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _GenericDocument[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _GenericDocument[key]; } }); }); var _DocumentData = require("./document/DocumentData"); Object.keys(_DocumentData).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _DocumentData[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _DocumentData[key]; } }); }); var _DocumentDetectionStatus = require("./document/DocumentDetectionStatus"); Object.keys(_DocumentDetectionStatus).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _DocumentDetectionStatus[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _DocumentDetectionStatus[key]; } }); }); var _DocumentQuality = require("./document/DocumentQuality"); Object.keys(_DocumentQuality).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _DocumentQuality[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _DocumentQuality[key]; } }); }); var _PageData = require("./document/PageData"); Object.keys(_PageData).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _PageData[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _PageData[key]; } }); }); var _PageImageSource = require("./document/PageImageSource"); Object.keys(_PageImageSource).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _PageImageSource[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _PageImageSource[key]; } }); }); var _ParametricFilters = require("./document/ParametricFilters"); Object.keys(_ParametricFilters).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _ParametricFilters[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _ParametricFilters[key]; } }); }); const LINKING_ERROR = `The package 'react-native-scanbot-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n'; const ScanbotSDKImpl = _reactNative.NativeModules.RNScanbotSDK ? _reactNative.NativeModules.RNScanbotSDK : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); const ScanbotSDKUIImpl = _reactNative.NativeModules.RNScanbotRTUUI ? _reactNative.NativeModules.RNScanbotRTUUI : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); const ScanbotDocument = { /** * Create a new document. */ createDocument(params) { return ScanbotSDKImpl.createDocument(params); }, /** * Create a new document from legacy pages. */ createDocumentFromLegacyPages(params) { return ScanbotSDKImpl.createDocumentFromLegacyPages(params); }, /** * Create a new document from PDF file. */ createDocumentFromPDF(pdfUri) { return ScanbotSDKImpl.createDocumentFromPDF(pdfUri); }, /** * Check if a document with the given ID exists. */ documentExists(documentID) { return ScanbotSDKImpl.documentExists(documentID); }, /** * Load a document by its ID. */ loadDocument(documentID) { return ScanbotSDKImpl.loadDocument(documentID); }, /** * Gets all stored document IDs. */ storedDocumentIDs() { return ScanbotSDKImpl.storedDocumentIDs(); }, /** * Clone a document by its ID. */ cloneDocument(documentID) { return ScanbotSDKImpl.cloneDocument(documentID); }, /** * Delete a document by its ID. */ deleteDocument(documentID) { return ScanbotSDKImpl.deleteDocument(documentID); }, /** * Delete all documents. */ deleteAllDocuments() { return ScanbotSDKImpl.deleteAllDocuments(); }, /** * Creates a PDF for the given document. * Please check the extra options that are part of the input params to modify the created PDF file per your needs. */ createPDF(params) { return ScanbotSDKImpl.createPDFForDocument(params); }, /** * Creates a TIFF for the given document. * Please check the extra options that are part of the input params to modify the created TIFF file per your needs. */ createTIFF(params) { return ScanbotSDKImpl.createTIFFForDocument(params); }, /** * Add a new page to a document and return the updated document. */ addPage(params) { return ScanbotSDKImpl.addPage(params); }, /** * Move a page in a document and return the updated document. */ movePage(params) { return ScanbotSDKImpl.movePage(params); }, /** * Modify a page in a document and return the updated document. */ modifyPage(params) { return ScanbotSDKImpl.modifyPage(params); }, /** * Remove a page from a document. */ removePage(params) { return ScanbotSDKImpl.removePageFromDocument(params); }, /** * Remove all pages from a document in one batch operation. */ removeAllPages(documentID) { return ScanbotSDKImpl.removeAllPages(documentID); } }; const ScanbotSDKUI = { /** * Opens the Ready-To-Use UI Document Scanner screen with the desired configuration. * * @deprecated Use ***startDocumentScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startDocumentScanner(configuration) { return ScanbotSDKUIImpl.startDocumentScanner(configuration); }, /** * Forces the Ready-To-Use UI Document Scanner screen to close while it is running. * * @deprecated */ closeDocumentScanner() { return ScanbotSDKUIImpl.closeDocumentScanner(); }, /** * Opens the Ready-To-Use UI Finder Document Scanner screen with the desired configuration. * * @deprecated Use ***startDocumentScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startFinderDocumentScanner(configuration) { return ScanbotSDKUIImpl.startFinderDocumentScanner(configuration); }, /** * Forces the Ready-To-Use UI Finder Document Scanner screen to close while it is running. * * @deprecated */ closeFinderDocumentScanner() { return ScanbotSDKUIImpl.closeFinderDocumentScanner(); }, /** * Opens the Ready-To-Use UI Cropping screen with the desired configuration. * * @deprecated Use ***startCroppingScreen*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startCroppingScreen(page, configuration) { return ScanbotSDKUIImpl.startCroppingScreen(page, configuration); }, /** * Forces the Ready-To-Use UI Cropping screen to close while it is running. * * @deprecated */ closeCroppingScreen() { return ScanbotSDKUIImpl.closeCroppingScreen(); }, /** * Opens the Ready-To-Use UI MRZ Scanner screen with the desired configuration. */ startMrzScanner(configuration) { return ScanbotSDKUIImpl.startMrzScanner(configuration); }, /** * Forces the Ready-To-Use UI MRZ Scanner screen to close while it is running. */ closeMrzScanner() { return ScanbotSDKUIImpl.closeMrzScanner(); }, /** * Opens the Ready-To-Use UI Barcode Scanner screen with the desired configuration. * * @deprecated Use ***startBarcodeScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startBarcodeScanner(configuration) { return ScanbotSDKUIImpl.startBarcodeScanner(configuration); }, /** * Forces the Ready-To-Use UI Barcode Scanner screen to close while it is running. * * @deprecated */ closeBarcodeScanner() { return ScanbotSDKUIImpl.closeBarcodeScanner(); }, /** * Opens the Ready-To-Use UI Batch Barcode Scanner screen with the desired configuration. * * @deprecated Use ***startBarcodeScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startBatchBarcodeScanner(configuration) { return ScanbotSDKUIImpl.startBatchBarcodeScanner(configuration); }, /** * Forces the Ready-To-Use UI Batch Barcode Scanner screen to close while it is running. * * @deprecated */ closeBatchBarcodeScanner() { return ScanbotSDKUIImpl.closeBatchBarcodeScanner(); }, /** * Opens the Ready-To-Use UI European Health Insurance Card Scanner screen with the desired configuration. * * @deprecated Use ***startGenericDocumentRecognizer*** instead and enable ***DE_HEALTH_INSURANCE_CARD_FRONT*** and ***EU_HEALTH_INSURANCE_CARD*** document formats. */ startEHICScanner(configuration) { return ScanbotSDKUIImpl.startEHICScanner(configuration); }, /** * Forces the Ready-To-Use UI European Health Insurance Card Scanner screen to close while it is running. * * @deprecated */ closeEHICScanner() { return ScanbotSDKUIImpl.closeEHICScanner(); }, /** * Opens the Ready-To-Use UI Text Data Scanner screen with the desired configuration. */ startTextDataScanner(configuration) { return ScanbotSDKUIImpl.startTextDataScanner(configuration); }, /** * Forces the Ready-To-Use UI Text Data Scanner screen to close while it is running. */ closeTextDataScanner() { return ScanbotSDKUIImpl.closeTextDataScanner(); }, /** * Opens the Ready-To-Use UI License Plate Scanner screen with the desired configuration. */ startLicensePlateScanner(configuration) { return ScanbotSDKUIImpl.startLicensePlateScanner(configuration); }, /** * Forces the Ready-To-Use UI License Plate Scanner screen to close while it is running. */ closeLicensePlateScanner() { return ScanbotSDKUIImpl.closeLicensePlateScanner(); }, /** * Opens the Ready-To-Use UI Medical Certificate Recognizer screen with the desired configuration. */ startMedicalCertificateRecognizer(configuration) { return ScanbotSDKUIImpl.startMedicalCertificateRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Medical Certificate Recognizer screen to close while it is running. */ closeMedicalCertificateRecognizer() { return ScanbotSDKUIImpl.closeMedicalCertificateRecognizer(); }, /** * Opens the Ready-To-Use UI Generic Document Recognizer screen with the desired configuration. */ startGenericDocumentRecognizer(configuration) { return ScanbotSDKUIImpl.startGenericDocumentRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Generic Document Recognizer screen to close while it is running. */ closeGenericDocumentRecognizer() { return ScanbotSDKUIImpl.closeGenericDocumentRecognizer(); }, /** * Opens the Ready-To-Use UI Check Recognizer screen with the desired configuration. */ startCheckRecognizer(configuration) { return ScanbotSDKUIImpl.startCheckRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Check Recognizer screen to close while it is running. */ closeCheckRecognizer() { return ScanbotSDKUIImpl.closeCheckRecognizer(); }, /** * Opens the Ready-To-Use UI VIN Scanner screen with the desired configuration. */ startVinScanner(configuration) { return ScanbotSDKUIImpl.startVinScanner(configuration); }, /** * Forces the Ready-To-Use UI VIN Scanner screen to close while it is running. */ closeVinScanner() { return ScanbotSDKUIImpl.closeVinScanner(); } }; const ScanbotSDK = { UI: ScanbotSDKUI, Document: ScanbotDocument, /** * Initializes the Scanbot SDK with the preferred configuration. */ initializeSDK(config) { return ScanbotSDKImpl.initializeSDK(config); }, /** * Provides complete information about the current license status. */ getLicenseInfo() { return ScanbotSDKImpl.getLicenseInfo(); }, /** * Returns the available OCR configs. */ getOCRConfigs() { return ScanbotSDKImpl.getOCRConfigs(); }, /** * Removes all files generated by this plugin. */ cleanup() { return ScanbotSDKImpl.cleanup(); }, /** * Recreates the given pages to refresh the Image URIs. */ refreshImageUris(args) { return ScanbotSDKImpl.refreshImageUris(args); }, /** * Detects barcodes on the image represented by the file URI. The image file URI is part of the input arguments. */ detectBarcodesOnImage(args) { return ScanbotSDKImpl.detectBarcodesOnImage(args); }, /** * Applies the given filters to the given image, and returns its URI. */ applyImageFilters(imageFileUri, filters) { return ScanbotSDKImpl.applyImageFilters(imageFileUri, filters); }, /** * Applies the given filters to the given page. */ applyImageFiltersOnPage(page, filters) { return ScanbotSDKImpl.applyImageFiltersOnPage(page, filters); }, /** * Creates a page with the image located at the given URI. */ createPage(imageUri) { return ScanbotSDKImpl.createPage(imageUri); }, /** * Removes the given page from the storage. */ removePage(page) { return ScanbotSDKImpl.removePage(page); }, /** * Rotates the given page for the number of 90 degree counterclockwise rotations. Negative values will rotate clockwise. */ rotatePage(page, times) { return ScanbotSDKImpl.rotatePage(page, times); }, /** * Applies the given image to the desired page. */ setDocumentImage(page, imageUri) { return ScanbotSDKImpl.setDocumentImage(page, imageUri); }, /** * Detects document on the given image and returns the result. */ detectDocument(imageFileUri) { return ScanbotSDKImpl.detectDocument(imageFileUri); }, /** * Detects document on the given page and returns the result. */ detectDocumentOnPage(page) { return ScanbotSDKImpl.detectDocumentOnPage(page); }, /** * Extracts images from a PDF represented by the file URL. The PDF file URL is part of the input arguments. */ extractImagesFromPdf(args) { return ScanbotSDKImpl.extractImagesFromPdf(args); }, /** * Extracts images from a PDF represented by the file URL, creates pages from them and returns the created pages. * The PDF file URL is part of the input arguments. */ extractPagesFromPdf(args) { return ScanbotSDKImpl.extractPagesFromPdf(args); }, /** * Returns the BASE64 Image Data for the given image. */ getImageData(imageFileUri) { return ScanbotSDKImpl.getImageData(imageFileUri); }, /** * Rotates the given image by the specified degrees counterclockwise. Negative values will rotate clockwise. */ rotateImage(imageFileUri, degrees) { return ScanbotSDKImpl.rotateImage(imageFileUri, degrees); }, /** * Detects the quality of the document on a still image. */ documentQualityAnalyzer(args) { return ScanbotSDKImpl.documentQualityAnalyzer(args); }, /** * Recognizes a Check on the given image. * Set desired check standards or leave it empty/undefined to recognize all supported checks. */ recognizeCheck(args) { return ScanbotSDKImpl.recognizeCheck(args); }, /** * Recognizes an MRZ on the given image. */ recognizeMrz(imageFileUri) { return ScanbotSDKImpl.recognizeMrz(imageFileUri); }, /** * Recognizes a Medical Certificate on the given image. * Modify the result with extra options that are part of the input arguments. */ recognizeMedicalCertificate(args) { return ScanbotSDKImpl.recognizeMedicalCertificate(args); }, /** * Recognizes a European Health Insurance Card (EHIC) on the given image. * * @deprecated Use ***recognizeGenericDocument*** instead and enable ***DE_HEALTH_INSURANCE_CARD_FRONT*** and ***EU_HEALTH_INSURANCE_CARD*** document formats. */ recognizeEHIC(imageFileUri) { return ScanbotSDKImpl.recognizeEHIC(imageFileUri); }, /** * Recognizes a generic document on the given image. * Set the expected generic document formats or leave it empty/undefined to recognize all supported generic document formats. */ recognizeGenericDocument(args) { return ScanbotSDKImpl.recognizeGenericDocument(args); }, /** * Performs OCR on given images. Set preferred ***ocrConfiguration*** engine, or leave it undefined to use the default one which is ***OCRScanbotEngineConfiguration***. * If ***OCRTesseractConfiguration*** is used, the expected ***languages*** need to be set. */ performOCR(args) { return ScanbotSDKImpl.performOCR(args); }, /** * Creates a PDF using the given list of image file URIs. * Please check the extra options that are part of the input arguments to modify the created PDF file per your needs. */ createPDF(args) { return ScanbotSDKImpl.createPDF(args); }, /** * Creates a TIFF using the given list of image file URIs. * Please check the extra options that are part of the input arguments to modify the created TIFF file per your needs. */ writeTIFF(args) { return ScanbotSDKImpl.writeTIFF(args); } }; var _default = exports.default = ScanbotSDK; //# sourceMappingURL=index.js.map