scandit-react-native-datacapture-id 7.0.2 → 7.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,7 +75,7 @@ if (file( "${rootProject.projectDir}/build-test.gradle").exists()) {
75
75
  }
76
76
 
77
77
  dependencies {
78
- def sdk_version = "7.0.2"
78
+ def sdk_version = "7.1.0-beta.1"
79
79
 
80
80
  println("Version of the native sdk used in this build: ${safeExtGet("global_sdk_version", sdk_version)}")
81
81
  api project(path: ":scandit-react-native-datacapture-core")
@@ -1,8 +1,9 @@
1
+ import { NativeCallResult } from 'scandit-datacapture-frameworks-core';
1
2
  import { IdCaptureProxy } from 'scandit-datacapture-frameworks-id';
2
3
  export declare class NativeIdCaptureProxy implements IdCaptureProxy {
3
4
  resetMode(): Promise<void>;
4
5
  createContextForBarcodeVerification(contextJSON: string): Promise<void>;
5
- verifyCapturedIdAsync(capturedId: string): Promise<string | null>;
6
+ verifyCapturedIdAsync(capturedId: string): Promise<NativeCallResult | null>;
6
7
  setModeEnabledState(enabled: boolean): void;
7
8
  updateIdCaptureMode(modeJson: string): Promise<void>;
8
9
  applyIdCaptureModeSettings(newSettingsJson: string): Promise<void>;
package/dist/id.js CHANGED
@@ -1,4 +1,4 @@
1
- import { nameForSerialization, FactoryMaker, Feedback, CameraSettings, Color, BaseController, DefaultSerializeable, ignoreFromSerialization, Brush } from 'scandit-react-native-datacapture-core/dist/core';
1
+ import { nameForSerialization, FactoryMaker, Feedback, CameraSettings, Color, BaseController, DefaultSerializeable, EventDataParser, ignoreFromSerialization, Brush } from 'scandit-react-native-datacapture-core/dist/core';
2
2
 
3
3
  class DateResult {
4
4
  get day() { return this.json.day; }
@@ -54,6 +54,12 @@ var RejectionReason;
54
54
  RejectionReason["DocumentVoided"] = "documentVoided";
55
55
  RejectionReason["Timeout"] = "timeout";
56
56
  RejectionReason["SingleImageNotRecognized"] = "singleImageNotRecognized";
57
+ RejectionReason["DocumentExpired"] = "documentExpired";
58
+ RejectionReason["DocumentExpiresSoon"] = "documentExpiresSoon";
59
+ RejectionReason["NotRealIdCompliant"] = "notRealIdCompliant";
60
+ RejectionReason["HolderUnderage"] = "holderUnderage";
61
+ RejectionReason["ForgedAamvaBarcode"] = "forgedAamvaBarcode";
62
+ RejectionReason["InconsistentData"] = "inconsistentData";
57
63
  })(RejectionReason || (RejectionReason = {}));
58
64
 
59
65
  var IdCaptureRegion;
@@ -526,6 +532,16 @@ function __decorate(decorators, target, key, desc) {
526
532
  return c > 3 && r && Object.defineProperty(target, key, r), r;
527
533
  }
528
534
 
535
+ function __awaiter(thisArg, _arguments, P, generator) {
536
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
537
+ return new (P || (P = Promise))(function (resolve, reject) {
538
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
539
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
540
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
541
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
542
+ });
543
+ }
544
+
529
545
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
530
546
  var e = new Error(message);
531
547
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -547,7 +563,13 @@ class IdCaptureController extends BaseController {
547
563
  return this._proxy.createContextForBarcodeVerification(JSON.stringify(context.toJSON()));
548
564
  }
549
565
  verifyCapturedIdAsync(capturedId) {
550
- return this._proxy.verifyCapturedIdAsync(capturedId);
566
+ return __awaiter(this, void 0, void 0, function* () {
567
+ const result = yield this._proxy.verifyCapturedIdAsync(capturedId);
568
+ if (result == null) {
569
+ return null;
570
+ }
571
+ return result.data;
572
+ });
551
573
  }
552
574
  setModeEnabledState(enabled) {
553
575
  this._proxy.setModeEnabledState(enabled);
@@ -1444,19 +1466,27 @@ class IdCaptureListenerController {
1444
1466
  this.eventEmitter.on(IdCaptureListenerEvents.inCallback, (value) => {
1445
1467
  this.idCapture.isInListenerCallback = value;
1446
1468
  });
1447
- this.eventEmitter.on(IdCaptureListenerEvents.didCapture, (body) => {
1448
- const payload = JSON.parse(body);
1449
- const captureId = CapturedId.fromJSON(JSON.parse(payload.id));
1469
+ this.eventEmitter.on(IdCaptureListenerEvents.didCapture, (data) => {
1470
+ const event = EventDataParser.parse(data);
1471
+ if (event === null) {
1472
+ console.error('IdCaptureListenerController didCapture payload is null');
1473
+ return;
1474
+ }
1475
+ const captureId = CapturedId.fromJSON(JSON.parse(event.id));
1450
1476
  this.notifyListenersOfDidCapture(captureId);
1451
1477
  this._proxy.finishDidCaptureCallback(this.idCapture.isEnabled);
1452
1478
  });
1453
- this.eventEmitter.on(IdCaptureListenerEvents.didReject, (body) => {
1454
- const payload = JSON.parse(body);
1479
+ this.eventEmitter.on(IdCaptureListenerEvents.didReject, (data) => {
1480
+ const event = EventDataParser.parse(data);
1481
+ if (event === null) {
1482
+ console.error('IdCaptureListenerController didReject payload is null');
1483
+ return;
1484
+ }
1455
1485
  let rejectedId = null;
1456
- if (payload.id != null) {
1457
- rejectedId = CapturedId.fromJSON(JSON.parse(payload.id));
1486
+ if (event.id != null) {
1487
+ rejectedId = CapturedId.fromJSON(JSON.parse(event.id));
1458
1488
  }
1459
- this.notifyListenersOfDidReject(rejectedId, payload.rejectionReason);
1489
+ this.notifyListenersOfDidReject(rejectedId, event.rejectionReason);
1460
1490
  this._proxy.finishDidRejectCallback(this.idCapture.isEnabled);
1461
1491
  });
1462
1492
  }