capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
25 lines • 1.33 kB
JavaScript
import { DocumentDataExtractionResult, DocumentDataExtractorUiResult, DocumentVerificationReport, handleImageInput, mapRTUUIResult, ToJsonConfiguration, withSBErrorHandling, } from '../types';
import { ScanbotSDKPlugin } from './Definitions';
/**
* @internal
* @hidden
*/
export const ScanbotDocumentDataExtractorImpl = {
async extractFromImage(params) {
return withSBErrorHandling(async () => new DocumentDataExtractionResult(await ScanbotSDKPlugin.extractDocumentDataFromImage({
configuration: params.configuration,
image: handleImageInput(params.image),
})));
},
async startExtractorScreen(configuration) {
return withSBErrorHandling(async () => mapRTUUIResult(await ScanbotSDKPlugin.startDDEScreen(configuration), DocumentDataExtractorUiResult));
},
async forceCloseExtractorScreen() {
return withSBErrorHandling(ScanbotSDKPlugin.forceCloseDDEScreen);
},
async verifyDocument(documentParts) {
const parts = (await Promise.all(documentParts.map((p) => p.serialize(new ToJsonConfiguration({ serializeImages: false })))));
return withSBErrorHandling(async () => new DocumentVerificationReport(await ScanbotSDKPlugin.verifyDocument({ documentParts: parts })));
},
};
//# sourceMappingURL=DocumentDataExtractorImpl.js.map