scandit-datacapture-frameworks-id 7.5.1 → 7.6.0
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.
- package/dist/dts/common/Duration.d.ts +19 -0
- package/dist/dts/common/RegionSpecificSubtype.d.ts +3 -1
- package/dist/dts/common/index.d.ts +1 -0
- package/dist/dts/defaults/IdDefaults.d.ts +7 -0
- package/dist/dts/defaults/SerializedTypes.d.ts +2 -0
- package/dist/dts/id/AamvaBarcodeVerifier.d.ts +3 -0
- package/dist/dts/id/MRZResult.d.ts +8 -0
- package/dist/dts/idcapture/IdCapture.d.ts +16 -3
- package/dist/dts/idcapture/IdCaptureOverlay.d.ts +18 -3
- package/dist/dts/idcapture/IdCaptureSettings.d.ts +7 -0
- package/dist/dts/idcapture/controller/IdCaptureController.d.ts +1 -5
- package/dist/dts/idcapture/controller/IdCaptureListenerController.d.ts +4 -2
- package/dist/dts/idcapture/controller/IdCaptureListenerProxy.d.ts +0 -1
- package/dist/dts/idcapture/controller/IdCaptureOverlayController.d.ts +15 -0
- package/dist/dts/idcapture/index.d.ts +1 -0
- package/dist/index.js +232 -91
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FactoryMaker, Color, CameraSettings, Feedback, BaseController,
|
|
1
|
+
import { nameForSerialization, DefaultSerializeable, FactoryMaker, Color, CameraSettings, Feedback, BaseController, EventDataParser, BaseNewController, ignoreFromSerialization, Brush } from 'scandit-datacapture-frameworks-core';
|
|
2
2
|
|
|
3
3
|
class DateResult {
|
|
4
4
|
get day() { return this.json.day; }
|
|
@@ -393,6 +393,8 @@ var RegionSpecificSubtype;
|
|
|
393
393
|
RegionSpecificSubtype["UsMunicipalId"] = "usMunicipalId";
|
|
394
394
|
RegionSpecificSubtype["AustraliaAsicCard"] = "australiaAsicCard";
|
|
395
395
|
RegionSpecificSubtype["UaeVehicleRegistrationCard"] = "uaeVehicleRegistrationCard";
|
|
396
|
+
RegionSpecificSubtype["UaeEsaadCard"] = "uaeEsaadCard";
|
|
397
|
+
RegionSpecificSubtype["UkMilitaryId"] = "ukMilitaryId";
|
|
396
398
|
})(RegionSpecificSubtype || (RegionSpecificSubtype = {}));
|
|
397
399
|
|
|
398
400
|
var IdSide;
|
|
@@ -434,6 +436,75 @@ class IdImages {
|
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
438
|
|
|
439
|
+
/******************************************************************************
|
|
440
|
+
Copyright (c) Microsoft Corporation.
|
|
441
|
+
|
|
442
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
443
|
+
purpose with or without fee is hereby granted.
|
|
444
|
+
|
|
445
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
446
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
447
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
448
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
449
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
450
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
451
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
452
|
+
***************************************************************************** */
|
|
453
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
function __decorate(decorators, target, key, desc) {
|
|
457
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
458
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
459
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
460
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
464
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
465
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
466
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
467
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
468
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
469
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
474
|
+
var e = new Error(message);
|
|
475
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
class Duration extends DefaultSerializeable {
|
|
479
|
+
get days() {
|
|
480
|
+
return this._days;
|
|
481
|
+
}
|
|
482
|
+
get months() {
|
|
483
|
+
return this._months;
|
|
484
|
+
}
|
|
485
|
+
get years() {
|
|
486
|
+
return this._years;
|
|
487
|
+
}
|
|
488
|
+
constructor(days, months, years) {
|
|
489
|
+
super();
|
|
490
|
+
this._days = days;
|
|
491
|
+
this._months = months;
|
|
492
|
+
this._years = years;
|
|
493
|
+
}
|
|
494
|
+
static fromJSON(json) {
|
|
495
|
+
return new Duration(json.days, json.months, json.years);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
__decorate([
|
|
499
|
+
nameForSerialization('days')
|
|
500
|
+
], Duration.prototype, "_days", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
nameForSerialization('months')
|
|
503
|
+
], Duration.prototype, "_months", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
nameForSerialization('years')
|
|
506
|
+
], Duration.prototype, "_years", void 0);
|
|
507
|
+
|
|
437
508
|
function getIdDefaults() {
|
|
438
509
|
return FactoryMaker.getInstance('IdDefaults');
|
|
439
510
|
}
|
|
@@ -473,6 +544,13 @@ function parseIdDefaults(jsonDefaults) {
|
|
|
473
544
|
anonymizationMode: jsonDefaults.IdCaptureSettings.anonymizationMode,
|
|
474
545
|
rejectVoidedIds: jsonDefaults.IdCaptureSettings.rejectVoidedIds,
|
|
475
546
|
decodeBackOfEuropeanDrivingLicense: jsonDefaults.IdCaptureSettings.decodeBackOfEuropeanDrivingLicense,
|
|
547
|
+
rejectExpiredIds: jsonDefaults.IdCaptureSettings.rejectExpiredIds,
|
|
548
|
+
rejectIdsExpiringIn: jsonDefaults.IdCaptureSettings.rejectIdsExpiringIn ? Duration
|
|
549
|
+
.fromJSON(jsonDefaults.IdCaptureSettings.rejectIdsExpiringIn) : null,
|
|
550
|
+
rejectNotRealIdCompliant: jsonDefaults.IdCaptureSettings.rejectNotRealIdCompliant,
|
|
551
|
+
rejectForgedAamvaBarcodes: jsonDefaults.IdCaptureSettings.rejectForgedAamvaBarcodes,
|
|
552
|
+
rejectInconsistentData: jsonDefaults.IdCaptureSettings.rejectInconsistentData,
|
|
553
|
+
rejectHolderBelowAge: jsonDefaults.IdCaptureSettings.rejectHolderBelowAge,
|
|
476
554
|
},
|
|
477
555
|
},
|
|
478
556
|
};
|
|
@@ -517,53 +595,13 @@ class AamvaBarcodeVerificationResult {
|
|
|
517
595
|
}
|
|
518
596
|
}
|
|
519
597
|
|
|
520
|
-
/******************************************************************************
|
|
521
|
-
Copyright (c) Microsoft Corporation.
|
|
522
|
-
|
|
523
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
524
|
-
purpose with or without fee is hereby granted.
|
|
525
|
-
|
|
526
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
527
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
528
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
529
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
530
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
531
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
532
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
533
|
-
***************************************************************************** */
|
|
534
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
function __decorate(decorators, target, key, desc) {
|
|
538
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
539
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
540
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
541
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
545
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
546
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
547
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
548
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
549
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
550
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
555
|
-
var e = new Error(message);
|
|
556
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
557
|
-
};
|
|
558
|
-
|
|
559
598
|
class IdCaptureController extends BaseController {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return controller;
|
|
564
|
-
}
|
|
565
|
-
constructor() {
|
|
599
|
+
// This is also accpeting null here because the AamvaBarcodeVerifier is using this controller.
|
|
600
|
+
// Once we remove the AamvaBarcodeVerifier, we can remove the null here.
|
|
601
|
+
constructor(idCapture = null) {
|
|
566
602
|
super('IdCaptureProxy');
|
|
603
|
+
this.idCapture = null;
|
|
604
|
+
this.idCapture = idCapture;
|
|
567
605
|
}
|
|
568
606
|
reset() {
|
|
569
607
|
return this._proxy.resetMode();
|
|
@@ -584,14 +622,14 @@ class IdCaptureController extends BaseController {
|
|
|
584
622
|
this._proxy.setModeEnabledState(enabled);
|
|
585
623
|
}
|
|
586
624
|
updateIdCaptureMode() {
|
|
625
|
+
if (this.idCapture == null) {
|
|
626
|
+
throw new Error('IdCaptureController is not initialized with an IdCapture instance');
|
|
627
|
+
}
|
|
587
628
|
return this._proxy.updateIdCaptureMode(JSON.stringify(this.idCapture.toJSON()));
|
|
588
629
|
}
|
|
589
630
|
applyIdCaptureModeSettings(newSettings) {
|
|
590
631
|
return this._proxy.applyIdCaptureModeSettings(JSON.stringify(newSettings.toJSON()));
|
|
591
632
|
}
|
|
592
|
-
updateIdCaptureOverlay(overlay) {
|
|
593
|
-
return this._proxy.updateIdCaptureOverlay(JSON.stringify(overlay.toJSON()));
|
|
594
|
-
}
|
|
595
633
|
updateFeedback(feedback) {
|
|
596
634
|
return this._proxy.updateFeedback(JSON.stringify(feedback.toJSON()));
|
|
597
635
|
}
|
|
@@ -599,7 +637,6 @@ class IdCaptureController extends BaseController {
|
|
|
599
637
|
|
|
600
638
|
var IdCaptureListenerEvents;
|
|
601
639
|
(function (IdCaptureListenerEvents) {
|
|
602
|
-
IdCaptureListenerEvents["inCallback"] = "IdCaptureListener.inCallback";
|
|
603
640
|
IdCaptureListenerEvents["didCapture"] = "IdCaptureListener.didCaptureId";
|
|
604
641
|
IdCaptureListenerEvents["didReject"] = "IdCaptureListener.didRejectId";
|
|
605
642
|
})(IdCaptureListenerEvents || (IdCaptureListenerEvents = {}));
|
|
@@ -607,8 +644,16 @@ var IdCaptureListenerEvents;
|
|
|
607
644
|
class MRZResult {
|
|
608
645
|
get documentCode() { return this.json.documentCode; }
|
|
609
646
|
get namesAreTruncated() { return this.json.namesAreTruncated; }
|
|
647
|
+
/**
|
|
648
|
+
* @deprecated Use optionalDataInLine1 and optionalDataInLine2 instead. This property will be removed in SDK version 8.0.
|
|
649
|
+
*/
|
|
610
650
|
get optional() { return this.json.optional; }
|
|
651
|
+
/**
|
|
652
|
+
* @deprecated Use optionalDataInLine1 and optionalDataInLine2 instead. This property will be removed in SDK version 8.0.
|
|
653
|
+
*/
|
|
611
654
|
get optional1() { return this.json.optional1; }
|
|
655
|
+
get optionalDataInLine1() { return this.json.optionalDataInLine1; }
|
|
656
|
+
get optionalDataInLine2() { return this.json.optionalDataInLine2; }
|
|
612
657
|
get capturedMrz() { return this.json.capturedMrz; }
|
|
613
658
|
get personalIdNumber() { return this.json.personalIdNumber; }
|
|
614
659
|
get renewalTimes() { return this.json.renewalTimes; }
|
|
@@ -1555,21 +1600,26 @@ class IdCaptureListenerController {
|
|
|
1555
1600
|
get _proxy() {
|
|
1556
1601
|
return FactoryMaker.getInstance('IdCaptureListenerProxy');
|
|
1557
1602
|
}
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
controller.idCapture = idCapture;
|
|
1561
|
-
controller._proxy.isModeEnabled = () => idCapture.isEnabled;
|
|
1562
|
-
return controller;
|
|
1563
|
-
}
|
|
1564
|
-
constructor() {
|
|
1603
|
+
constructor(idCapture) {
|
|
1604
|
+
this.hasListeners = false;
|
|
1565
1605
|
this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
|
|
1606
|
+
this.idCapture = idCapture;
|
|
1607
|
+
this._proxy.isModeEnabled = () => idCapture.isEnabled;
|
|
1608
|
+
this.initialize();
|
|
1609
|
+
}
|
|
1610
|
+
initialize() {
|
|
1611
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1612
|
+
if (this.idCapture.listeners.length > 0) {
|
|
1613
|
+
this.subscribeListener();
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1566
1616
|
}
|
|
1567
1617
|
subscribeListener() {
|
|
1618
|
+
if (this.hasListeners) {
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1568
1621
|
this._proxy.subscribeDidCaptureListener();
|
|
1569
1622
|
this._proxy.subscribeDidRejectListener();
|
|
1570
|
-
this.eventEmitter.on(IdCaptureListenerEvents.inCallback, (value) => {
|
|
1571
|
-
this.idCapture.isInListenerCallback = value;
|
|
1572
|
-
});
|
|
1573
1623
|
this.eventEmitter.on(IdCaptureListenerEvents.didCapture, (data) => {
|
|
1574
1624
|
const event = EventDataParser.parse(data);
|
|
1575
1625
|
if (event === null) {
|
|
@@ -1597,32 +1647,48 @@ class IdCaptureListenerController {
|
|
|
1597
1647
|
this.notifyListenersOfDidReject(rejectedId, event.rejectionReason);
|
|
1598
1648
|
this._proxy.finishDidRejectCallback(this.idCapture.isEnabled);
|
|
1599
1649
|
});
|
|
1650
|
+
this.hasListeners = true;
|
|
1600
1651
|
}
|
|
1601
1652
|
unsubscribeListener() {
|
|
1653
|
+
if (!this.hasListeners) {
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1602
1656
|
this._proxy.unregisterListenerForEvents();
|
|
1603
|
-
this.eventEmitter.removeAllListeners(IdCaptureListenerEvents.inCallback);
|
|
1604
1657
|
this.eventEmitter.removeAllListeners(IdCaptureListenerEvents.didCapture);
|
|
1605
1658
|
this.eventEmitter.removeAllListeners(IdCaptureListenerEvents.didReject);
|
|
1659
|
+
this.hasListeners = false;
|
|
1606
1660
|
}
|
|
1607
1661
|
notifyListenersOfDidCapture(captureId) {
|
|
1608
1662
|
const mode = this.idCapture;
|
|
1609
|
-
mode.isInListenerCallback = true;
|
|
1610
1663
|
mode.listeners.forEach(listener => {
|
|
1611
1664
|
if (listener.didCaptureId) {
|
|
1612
1665
|
listener.didCaptureId(this.idCapture, captureId);
|
|
1613
1666
|
}
|
|
1614
1667
|
});
|
|
1615
|
-
mode.isInListenerCallback = false;
|
|
1616
1668
|
}
|
|
1617
1669
|
notifyListenersOfDidReject(captureId, rejectionReason) {
|
|
1618
1670
|
const mode = this.idCapture;
|
|
1619
|
-
mode.isInListenerCallback = true;
|
|
1620
1671
|
mode.listeners.forEach(listener => {
|
|
1621
1672
|
if (listener.didRejectId) {
|
|
1622
1673
|
listener.didRejectId(this.idCapture, captureId, rejectionReason);
|
|
1623
1674
|
}
|
|
1624
1675
|
});
|
|
1625
|
-
|
|
1676
|
+
}
|
|
1677
|
+
dispose() {
|
|
1678
|
+
this.unsubscribeListener();
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
class IdCaptureOverlayController extends BaseNewController {
|
|
1683
|
+
constructor(overlay) {
|
|
1684
|
+
super('IdCaptureOverlayProxy');
|
|
1685
|
+
this.overlay = overlay;
|
|
1686
|
+
}
|
|
1687
|
+
updateIdCaptureOverlay(overlay) {
|
|
1688
|
+
return this._proxy.$updateIdCaptureOverlay({ overlayJson: JSON.stringify(overlay.toJSON()) });
|
|
1689
|
+
}
|
|
1690
|
+
dispose() {
|
|
1691
|
+
this._proxy.dispose();
|
|
1626
1692
|
}
|
|
1627
1693
|
}
|
|
1628
1694
|
|
|
@@ -1697,42 +1763,62 @@ class IdCapture extends DefaultSerializeable {
|
|
|
1697
1763
|
this._feedback.controller = this.controller;
|
|
1698
1764
|
this.controller.updateFeedback(feedback);
|
|
1699
1765
|
}
|
|
1700
|
-
static
|
|
1766
|
+
static createRecommendedCameraSettings() {
|
|
1701
1767
|
return new CameraSettings(IdCapture.idCaptureDefaults.IdCapture.RecommendedCameraSettings);
|
|
1702
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* @deprecated Use createRecommendedCameraSettings() instead to get a new instance that can be safely modified.
|
|
1771
|
+
*/
|
|
1772
|
+
static get recommendedCameraSettings() {
|
|
1773
|
+
if (IdCapture._recommendedCameraSettings === null) {
|
|
1774
|
+
IdCapture._recommendedCameraSettings = IdCapture.createRecommendedCameraSettings();
|
|
1775
|
+
}
|
|
1776
|
+
return IdCapture._recommendedCameraSettings;
|
|
1777
|
+
}
|
|
1703
1778
|
get _context() {
|
|
1704
1779
|
return this.privateContext;
|
|
1705
1780
|
}
|
|
1706
1781
|
set _context(newContext) {
|
|
1782
|
+
var _a, _b;
|
|
1707
1783
|
if (newContext == null) {
|
|
1708
|
-
this.listenerController.
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1784
|
+
(_a = this.listenerController) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1785
|
+
this.listenerController = null;
|
|
1786
|
+
this.privateContext = null;
|
|
1787
|
+
return;
|
|
1712
1788
|
}
|
|
1713
1789
|
this.privateContext = newContext;
|
|
1790
|
+
(_b = this.listenerController) !== null && _b !== void 0 ? _b : (this.listenerController = new IdCaptureListenerController(this));
|
|
1714
1791
|
}
|
|
1715
1792
|
static get idCaptureDefaults() {
|
|
1716
1793
|
return FactoryMaker.getInstance('IdDefaults');
|
|
1717
1794
|
}
|
|
1795
|
+
/**
|
|
1796
|
+
* @deprecated Since 7.6. This factory will be removed in 8.0.
|
|
1797
|
+
* Use the public constructor instead and configure the instance manually:
|
|
1798
|
+
* ```ts
|
|
1799
|
+
* const idCapture = new IdCapture(settings);
|
|
1800
|
+
* context.addMode(idCapture);
|
|
1801
|
+
* ```
|
|
1802
|
+
*/
|
|
1718
1803
|
static forContext(context, settings) {
|
|
1719
|
-
const idCapture = new IdCapture();
|
|
1720
|
-
idCapture.settings = settings;
|
|
1804
|
+
const idCapture = new IdCapture(settings);
|
|
1721
1805
|
if (context) {
|
|
1722
1806
|
context.addMode(idCapture);
|
|
1723
1807
|
}
|
|
1724
1808
|
return idCapture;
|
|
1725
1809
|
}
|
|
1726
|
-
constructor() {
|
|
1810
|
+
constructor(settings) {
|
|
1727
1811
|
super();
|
|
1728
1812
|
this.type = 'idCapture';
|
|
1813
|
+
this.modeId = Math.floor(Math.random() * 100000000);
|
|
1729
1814
|
this._isEnabled = true;
|
|
1730
1815
|
this._feedback = IdCaptureFeedback.defaultFeedback;
|
|
1731
1816
|
this.privateContext = null;
|
|
1732
1817
|
this.listeners = [];
|
|
1818
|
+
this.listenerController = null;
|
|
1733
1819
|
this.isInListenerCallback = false;
|
|
1734
|
-
this.
|
|
1735
|
-
this.
|
|
1820
|
+
this.settings = settings;
|
|
1821
|
+
this.controller = new IdCaptureController(this);
|
|
1736
1822
|
this.feedback.controller = this.controller;
|
|
1737
1823
|
}
|
|
1738
1824
|
applySettings(settings) {
|
|
@@ -1740,21 +1826,30 @@ class IdCapture extends DefaultSerializeable {
|
|
|
1740
1826
|
return this.controller.applyIdCaptureModeSettings(settings);
|
|
1741
1827
|
}
|
|
1742
1828
|
addListener(listener) {
|
|
1829
|
+
var _a;
|
|
1743
1830
|
if (this.listeners.includes(listener)) {
|
|
1744
1831
|
return;
|
|
1745
1832
|
}
|
|
1833
|
+
if (this.listeners.length === 0) {
|
|
1834
|
+
(_a = this.listenerController) === null || _a === void 0 ? void 0 : _a.subscribeListener();
|
|
1835
|
+
}
|
|
1746
1836
|
this.listeners.push(listener);
|
|
1747
1837
|
}
|
|
1748
1838
|
removeListener(listener) {
|
|
1839
|
+
var _a;
|
|
1749
1840
|
if (!this.listeners.includes(listener)) {
|
|
1750
1841
|
return;
|
|
1751
1842
|
}
|
|
1752
1843
|
this.listeners.splice(this.listeners.indexOf(listener), 1);
|
|
1844
|
+
if (this.listeners.length === 0) {
|
|
1845
|
+
(_a = this.listenerController) === null || _a === void 0 ? void 0 : _a.unsubscribeListener();
|
|
1846
|
+
}
|
|
1753
1847
|
}
|
|
1754
1848
|
reset() {
|
|
1755
1849
|
return this.controller.reset();
|
|
1756
1850
|
}
|
|
1757
1851
|
}
|
|
1852
|
+
IdCapture._recommendedCameraSettings = null;
|
|
1758
1853
|
__decorate([
|
|
1759
1854
|
ignoreFromSerialization
|
|
1760
1855
|
], IdCapture.prototype, "_isEnabled", void 0);
|
|
@@ -1793,23 +1888,50 @@ var IdLayoutStyle;
|
|
|
1793
1888
|
})(IdLayoutStyle || (IdLayoutStyle = {}));
|
|
1794
1889
|
|
|
1795
1890
|
class IdCaptureOverlay extends DefaultSerializeable {
|
|
1891
|
+
get view() {
|
|
1892
|
+
return this._view;
|
|
1893
|
+
}
|
|
1894
|
+
set view(newView) {
|
|
1895
|
+
var _a, _b;
|
|
1896
|
+
if (newView === null) {
|
|
1897
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1898
|
+
this.controller = null;
|
|
1899
|
+
this._view = null;
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
this._view = newView;
|
|
1903
|
+
(_b = this.controller) !== null && _b !== void 0 ? _b : (this.controller = new IdCaptureOverlayController(this));
|
|
1904
|
+
}
|
|
1796
1905
|
static get idCaptureDefaults() {
|
|
1797
1906
|
return FactoryMaker.getInstance('IdDefaults');
|
|
1798
1907
|
}
|
|
1908
|
+
/**
|
|
1909
|
+
* @deprecated Since 7.6. These factories will be removed in 8.0.
|
|
1910
|
+
* Use the public constructor instead and add the overlay to the view manually:
|
|
1911
|
+
* const overlay = new IdCaptureOverlay(idCapture);
|
|
1912
|
+
* view.addOverlay(overlay);
|
|
1913
|
+
*/
|
|
1799
1914
|
static withIdCapture(idCapture) {
|
|
1800
1915
|
return IdCaptureOverlay.withIdCaptureForView(idCapture, null);
|
|
1801
1916
|
}
|
|
1917
|
+
/**
|
|
1918
|
+
* @deprecated Since 7.6. These factories will be removed in 8.0.
|
|
1919
|
+
* Use the public constructor instead and add the overlay to the view manually:
|
|
1920
|
+
* const overlay = new IdCaptureOverlay(idCapture);
|
|
1921
|
+
* view.addOverlay(overlay);
|
|
1922
|
+
*/
|
|
1802
1923
|
static withIdCaptureForView(idCapture, view) {
|
|
1803
|
-
const overlay = new IdCaptureOverlay();
|
|
1804
|
-
overlay.idCapture = idCapture;
|
|
1924
|
+
const overlay = new IdCaptureOverlay(idCapture);
|
|
1805
1925
|
if (view) {
|
|
1806
1926
|
view.addOverlay(overlay);
|
|
1807
1927
|
}
|
|
1808
1928
|
return overlay;
|
|
1809
1929
|
}
|
|
1810
|
-
constructor() {
|
|
1930
|
+
constructor(mode) {
|
|
1811
1931
|
super();
|
|
1812
1932
|
this.type = 'idCapture';
|
|
1933
|
+
this.controller = null;
|
|
1934
|
+
this._view = null;
|
|
1813
1935
|
this._idLayoutStyle = IdLayoutStyle.Rounded;
|
|
1814
1936
|
this._idLayoutLineStyle = IdLayoutLineStyle.Light;
|
|
1815
1937
|
this._textHintPosition = TextHintPosition.AboveViewfinder;
|
|
@@ -1822,49 +1944,57 @@ class IdCaptureOverlay extends DefaultSerializeable {
|
|
|
1822
1944
|
this._rejectedBrush = this._defaultRejectedBrush;
|
|
1823
1945
|
this._frontSideTextHint = null;
|
|
1824
1946
|
this._backSideTextHint = null;
|
|
1947
|
+
this.modeId = mode.modeId;
|
|
1825
1948
|
}
|
|
1826
1949
|
setFrontSideTextHint(text) {
|
|
1950
|
+
var _a;
|
|
1827
1951
|
this._frontSideTextHint = text;
|
|
1828
|
-
this.
|
|
1952
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1829
1953
|
}
|
|
1830
1954
|
setBackSideTextHint(text) {
|
|
1955
|
+
var _a;
|
|
1831
1956
|
this._backSideTextHint = text;
|
|
1832
|
-
this.
|
|
1957
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1833
1958
|
}
|
|
1834
1959
|
get idLayoutStyle() {
|
|
1835
1960
|
return this._idLayoutStyle;
|
|
1836
1961
|
}
|
|
1837
1962
|
set idLayoutStyle(style) {
|
|
1963
|
+
var _a;
|
|
1838
1964
|
this._idLayoutStyle = style;
|
|
1839
|
-
this.
|
|
1965
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1840
1966
|
}
|
|
1841
1967
|
get idLayoutLineStyle() {
|
|
1842
1968
|
return this._idLayoutLineStyle;
|
|
1843
1969
|
}
|
|
1844
1970
|
set idLayoutLineStyle(lineStyle) {
|
|
1971
|
+
var _a;
|
|
1845
1972
|
this._idLayoutLineStyle = lineStyle;
|
|
1846
|
-
this.
|
|
1973
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1847
1974
|
}
|
|
1848
1975
|
get capturedBrush() {
|
|
1849
1976
|
return this._capturedBrush;
|
|
1850
1977
|
}
|
|
1851
1978
|
set capturedBrush(brush) {
|
|
1979
|
+
var _a;
|
|
1852
1980
|
this._capturedBrush = brush;
|
|
1853
|
-
this.
|
|
1981
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1854
1982
|
}
|
|
1855
1983
|
get localizedBrush() {
|
|
1856
1984
|
return this._localizedBrush;
|
|
1857
1985
|
}
|
|
1858
1986
|
set localizedBrush(brush) {
|
|
1987
|
+
var _a;
|
|
1859
1988
|
this._localizedBrush = brush;
|
|
1860
|
-
this.
|
|
1989
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1861
1990
|
}
|
|
1862
1991
|
get rejectedBrush() {
|
|
1863
1992
|
return this._rejectedBrush;
|
|
1864
1993
|
}
|
|
1865
1994
|
set rejectedBrush(brush) {
|
|
1995
|
+
var _a;
|
|
1866
1996
|
this._rejectedBrush = brush;
|
|
1867
|
-
this.
|
|
1997
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1868
1998
|
}
|
|
1869
1999
|
get defaultCapturedBrush() {
|
|
1870
2000
|
return this._defaultCapturedBrush;
|
|
@@ -1879,23 +2009,25 @@ class IdCaptureOverlay extends DefaultSerializeable {
|
|
|
1879
2009
|
return this._textHintPosition;
|
|
1880
2010
|
}
|
|
1881
2011
|
set textHintPosition(position) {
|
|
2012
|
+
var _a;
|
|
1882
2013
|
this._textHintPosition = position;
|
|
1883
|
-
this.
|
|
2014
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1884
2015
|
}
|
|
1885
2016
|
get showTextHints() {
|
|
1886
2017
|
return this._showTextHints;
|
|
1887
2018
|
}
|
|
1888
2019
|
set showTextHints(enabled) {
|
|
2020
|
+
var _a;
|
|
1889
2021
|
this._showTextHints = enabled;
|
|
1890
|
-
this.
|
|
2022
|
+
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateIdCaptureOverlay(this);
|
|
1891
2023
|
}
|
|
1892
2024
|
}
|
|
1893
2025
|
__decorate([
|
|
1894
2026
|
ignoreFromSerialization
|
|
1895
|
-
], IdCaptureOverlay.prototype, "
|
|
2027
|
+
], IdCaptureOverlay.prototype, "controller", void 0);
|
|
1896
2028
|
__decorate([
|
|
1897
2029
|
ignoreFromSerialization
|
|
1898
|
-
], IdCaptureOverlay.prototype, "
|
|
2030
|
+
], IdCaptureOverlay.prototype, "_view", void 0);
|
|
1899
2031
|
__decorate([
|
|
1900
2032
|
nameForSerialization('idLayoutStyle')
|
|
1901
2033
|
], IdCaptureOverlay.prototype, "_idLayoutStyle", void 0);
|
|
@@ -2001,6 +2133,12 @@ class IdCaptureSettings extends DefaultSerializeable {
|
|
|
2001
2133
|
this.acceptedDocuments = [];
|
|
2002
2134
|
this.rejectedDocuments = [];
|
|
2003
2135
|
this.scannerType = new SingleSideScanner(false, false, false);
|
|
2136
|
+
this.rejectExpiredIds = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectExpiredIds;
|
|
2137
|
+
this.rejectIdsExpiringIn = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectIdsExpiringIn;
|
|
2138
|
+
this.rejectNotRealIdCompliant = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectNotRealIdCompliant;
|
|
2139
|
+
this.rejectForgedAamvaBarcodes = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectForgedAamvaBarcodes;
|
|
2140
|
+
this.rejectInconsistentData = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectInconsistentData;
|
|
2141
|
+
this.rejectHolderBelowAge = IdCaptureSettings.idCaptureDefaults.IdCapture.IdCaptureSettings.rejectHolderBelowAge;
|
|
2004
2142
|
}
|
|
2005
2143
|
static get idCaptureDefaults() {
|
|
2006
2144
|
return FactoryMaker.getInstance('IdDefaults');
|
|
@@ -2022,9 +2160,12 @@ __decorate([
|
|
|
2022
2160
|
ignoreFromSerialization
|
|
2023
2161
|
], IdCaptureSettings, "idCaptureDefaults", null);
|
|
2024
2162
|
|
|
2163
|
+
/**
|
|
2164
|
+
* @deprecated Replaced by IdCaptureSettings.rejectForgedAamvaBarcodes
|
|
2165
|
+
*/
|
|
2025
2166
|
class AamvaBarcodeVerifier {
|
|
2026
2167
|
constructor() {
|
|
2027
|
-
this.controller = new IdCaptureController();
|
|
2168
|
+
this.controller = new IdCaptureController(null);
|
|
2028
2169
|
}
|
|
2029
2170
|
static create(context) {
|
|
2030
2171
|
const verifier = new AamvaBarcodeVerifier();
|
|
@@ -2063,5 +2204,5 @@ __decorate([
|
|
|
2063
2204
|
ignoreFromSerialization
|
|
2064
2205
|
], AamvaBarcodeVerifier.prototype, "controller", void 0);
|
|
2065
2206
|
|
|
2066
|
-
export { AamvaBarcodeVerificationResult, AamvaBarcodeVerificationStatus, AamvaBarcodeVerifier, BarcodeResult, CapturedId, CapturedSides, CommonCapturedIdFields, DateResult, DriverLicense, FullDocumentScanner, HealthInsuranceCard, IdAnonymizationMode, IdCapture, IdCaptureController, IdCaptureDocumentType, IdCaptureFeedback, IdCaptureListenerController, IdCaptureListenerEvents, IdCaptureOverlay, IdCaptureRegion, IdCaptureSettings, IdCard, IdImageType, IdImages, IdLayoutLineStyle, IdLayoutStyle, IdSide, MRZResult, Passport, ProfessionalDrivingPermit, RegionSpecific, RegionSpecificSubtype, RejectionReason, ResidencePermit, SingleSideScanner, TextHintPosition, UsRealIdStatus, VIZResult, VehicleRestriction, VisaIcao, getIdDefaults, loadIdDefaults, parseIdDefaults };
|
|
2207
|
+
export { AamvaBarcodeVerificationResult, AamvaBarcodeVerificationStatus, AamvaBarcodeVerifier, BarcodeResult, CapturedId, CapturedSides, CommonCapturedIdFields, DateResult, DriverLicense, Duration, FullDocumentScanner, HealthInsuranceCard, IdAnonymizationMode, IdCapture, IdCaptureController, IdCaptureDocumentType, IdCaptureFeedback, IdCaptureListenerController, IdCaptureListenerEvents, IdCaptureOverlay, IdCaptureOverlayController, IdCaptureRegion, IdCaptureSettings, IdCard, IdImageType, IdImages, IdLayoutLineStyle, IdLayoutStyle, IdSide, MRZResult, Passport, ProfessionalDrivingPermit, RegionSpecific, RegionSpecificSubtype, RejectionReason, ResidencePermit, SingleSideScanner, TextHintPosition, UsRealIdStatus, VIZResult, VehicleRestriction, VisaIcao, getIdDefaults, loadIdDefaults, parseIdDefaults };
|
|
2067
2208
|
//# sourceMappingURL=index.js.map
|