@ekyc_qoobiss/qbs-ect-cmp 3.6.77 → 3.6.79
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/cjs/{TranslationUtils-84b58b58.js → TranslationUtils-6fdf7b55.js} +2 -0
- package/dist/cjs/agreement-check_18.cjs.entry.js +45 -38
- package/dist/cjs/random-actions.cjs.entry.js +1 -1
- package/dist/collection/components/common/id-capture/id-capture.js +15 -11
- package/dist/collection/components/identification-component/identification-component.js +1 -1
- package/dist/collection/helpers/ApiCall.js +1 -0
- package/dist/collection/helpers/ML5.js +1 -1
- package/dist/collection/helpers/Stream.js +14 -14
- package/dist/collection/helpers/store.js +1 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +8 -3
- package/dist/esm/{TranslationUtils-93e9abe8.js → TranslationUtils-57159270.js} +2 -0
- package/dist/esm/agreement-check_18.entry.js +45 -38
- package/dist/esm/random-actions.entry.js +1 -1
- package/dist/qbs-ect-cmp/{p-66a8b394.entry.js → p-0fe5a43f.entry.js} +2 -2
- package/dist/qbs-ect-cmp/p-8552ab44.js +1 -0
- package/dist/qbs-ect-cmp/{p-2ea2cf94.entry.js → p-952ea10c.entry.js} +1 -1
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/common/id-capture/id-capture.d.ts +1 -0
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +3 -1
- package/dist/types/models/IAddRequest.d.ts +1 -0
- package/dist/types/models/IEctStore.d.ts +1 -0
- package/package.json +1 -1
- package/dist/qbs-ect-cmp/p-194504d9.js +0 -1
|
@@ -294,6 +294,7 @@ const { state, onChange } = createStore({
|
|
|
294
294
|
device: null,
|
|
295
295
|
langIso: 'ro',
|
|
296
296
|
logSteps: false,
|
|
297
|
+
modelsPath: '',
|
|
297
298
|
});
|
|
298
299
|
onChange('environment', value => {
|
|
299
300
|
state.debug = value == 'QA';
|
|
@@ -503,6 +504,7 @@ class ApiCall {
|
|
|
503
504
|
state.flowStatus = exports.FlowStatus[jsonResp.state];
|
|
504
505
|
state.logSteps = jsonResp.logSteps;
|
|
505
506
|
state.debug = jsonResp.debug;
|
|
507
|
+
state.modelsPath = jsonResp.modelsPath;
|
|
506
508
|
return true;
|
|
507
509
|
}
|
|
508
510
|
async UploadFileForRequestB64(requestId, type, file) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-41696e0e.js');
|
|
6
|
-
const TranslationUtils = require('./TranslationUtils-
|
|
6
|
+
const TranslationUtils = require('./TranslationUtils-6fdf7b55.js');
|
|
7
7
|
|
|
8
8
|
const agreementCheckCss = "";
|
|
9
9
|
|
|
@@ -1485,7 +1485,7 @@ class ML5 {
|
|
|
1485
1485
|
}
|
|
1486
1486
|
async init() {
|
|
1487
1487
|
return new Promise(async (resolve) => {
|
|
1488
|
-
const modelPath = TranslationUtils.state.
|
|
1488
|
+
const modelPath = TranslationUtils.state.modelsPath;
|
|
1489
1489
|
this.classifier = await ml5.imageClassifier(modelPath, this.loaded);
|
|
1490
1490
|
this.faceapi = await ml5.faceApi({ withLandmarks: true, withDescriptors: false }, this.loaded);
|
|
1491
1491
|
//warmup
|
|
@@ -1528,6 +1528,12 @@ const getLogMessage = (param_req_id = '', param_redirect_id = '', param_token =
|
|
|
1528
1528
|
};
|
|
1529
1529
|
};
|
|
1530
1530
|
|
|
1531
|
+
var VerificationMode;
|
|
1532
|
+
(function (VerificationMode) {
|
|
1533
|
+
VerificationMode[VerificationMode["Full"] = 0] = "Full";
|
|
1534
|
+
VerificationMode[VerificationMode["Tilt"] = 1] = "Tilt";
|
|
1535
|
+
})(VerificationMode || (VerificationMode = {}));
|
|
1536
|
+
|
|
1531
1537
|
class IDML5Detector {
|
|
1532
1538
|
static getInstance(stream, isMobile) {
|
|
1533
1539
|
if (!IDML5Detector.instance) {
|
|
@@ -1548,9 +1554,13 @@ class IDML5Detector {
|
|
|
1548
1554
|
this.canvasElement = canvasElement;
|
|
1549
1555
|
// this.component = component;
|
|
1550
1556
|
}
|
|
1551
|
-
initDetector() {
|
|
1557
|
+
initDetector(mode) {
|
|
1552
1558
|
this.initTime = Date.now();
|
|
1553
1559
|
this.continue = true;
|
|
1560
|
+
if (mode == VerificationMode.Full)
|
|
1561
|
+
this.targetedLabel = 'full';
|
|
1562
|
+
else
|
|
1563
|
+
this.targetedLabel = 'tilted';
|
|
1554
1564
|
// this.width = this.videoElement.videoWidth;
|
|
1555
1565
|
// this.height = this.videoElement.videoHeight;
|
|
1556
1566
|
this.drawFrame('white');
|
|
@@ -1578,14 +1588,14 @@ class IDML5Detector {
|
|
|
1578
1588
|
this.stream.timeElapsed();
|
|
1579
1589
|
return;
|
|
1580
1590
|
}
|
|
1581
|
-
if (results[0].label ==
|
|
1591
|
+
if (results[0].label == this.targetedLabel && results[0].confidence > 0.9 && !this.checked) {
|
|
1582
1592
|
this.checked = true;
|
|
1583
1593
|
if (TranslationUtils.state.debug)
|
|
1584
1594
|
console.log('idml5detector | gotResults | autoCapturing');
|
|
1585
1595
|
this.stream.autoCapturing();
|
|
1586
1596
|
await this.drawFrame('green');
|
|
1587
1597
|
}
|
|
1588
|
-
if (results[0].label == 'tilted' && results[0].confidence > 0.8 && !this.checked) {
|
|
1598
|
+
if (results[0].label == this.targetedLabel && this.targetedLabel == 'tilted' && results[0].confidence > 0.8 && !this.checked) {
|
|
1589
1599
|
this.checked = true;
|
|
1590
1600
|
await this.drawFrame('green');
|
|
1591
1601
|
}
|
|
@@ -1709,12 +1719,6 @@ const faceWhiteSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9
|
|
|
1709
1719
|
|
|
1710
1720
|
const faceGreenSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiM0Y2E1ODUiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K';
|
|
1711
1721
|
|
|
1712
|
-
var VerificationMode;
|
|
1713
|
-
(function (VerificationMode) {
|
|
1714
|
-
VerificationMode[VerificationMode["Full"] = 0] = "Full";
|
|
1715
|
-
VerificationMode[VerificationMode["Tilt"] = 1] = "Tilt";
|
|
1716
|
-
})(VerificationMode || (VerificationMode = {}));
|
|
1717
|
-
|
|
1718
1722
|
class FaceML5Detector {
|
|
1719
1723
|
static getInstance(stream, isMobile) {
|
|
1720
1724
|
if (!FaceML5Detector.instance) {
|
|
@@ -4418,7 +4422,7 @@ class Stream {
|
|
|
4418
4422
|
this.recordedChunks = [];
|
|
4419
4423
|
this.videoSize = { width: 0, height: 0 };
|
|
4420
4424
|
if (TranslationUtils.state.debug)
|
|
4421
|
-
console.log(
|
|
4425
|
+
console.log('stream | constructor');
|
|
4422
4426
|
this.initFacePose();
|
|
4423
4427
|
this.idML5Detector = IDML5Detector.getInstance(this, TranslationUtils.state.device.isMobile);
|
|
4424
4428
|
this.faceML5Detector = FaceML5Detector.getInstance(this, TranslationUtils.state.device.isMobile);
|
|
@@ -4430,23 +4434,23 @@ class Stream {
|
|
|
4430
4434
|
if (!Stream.instance) {
|
|
4431
4435
|
Stream.instance = new Stream(mode);
|
|
4432
4436
|
if (TranslationUtils.state.debug)
|
|
4433
|
-
console.log(
|
|
4437
|
+
console.log('stream | getNewInstance | new instance');
|
|
4434
4438
|
}
|
|
4435
4439
|
return Stream.instance;
|
|
4436
4440
|
}
|
|
4437
4441
|
autoCapturing() {
|
|
4438
4442
|
if (TranslationUtils.state.debug)
|
|
4439
|
-
console.log(
|
|
4443
|
+
console.log('stream | autoCapturing');
|
|
4440
4444
|
this.callbackAutoCapturing();
|
|
4441
4445
|
}
|
|
4442
4446
|
timeElapsed() {
|
|
4443
4447
|
if (TranslationUtils.state.debug)
|
|
4444
|
-
console.log(
|
|
4448
|
+
console.log('stream | timeElapsed');
|
|
4445
4449
|
this.callbackTimeElapsed();
|
|
4446
4450
|
}
|
|
4447
4451
|
verificationReady() {
|
|
4448
4452
|
if (TranslationUtils.state.debug)
|
|
4449
|
-
console.log(
|
|
4453
|
+
console.log('stream | verificationReady');
|
|
4450
4454
|
this.verificationFinished();
|
|
4451
4455
|
}
|
|
4452
4456
|
updateHtmlElements(videoElement, canvasElement, component) {
|
|
@@ -4457,7 +4461,7 @@ class Stream {
|
|
|
4457
4461
|
}
|
|
4458
4462
|
startStream(stream) {
|
|
4459
4463
|
if (TranslationUtils.state.debug)
|
|
4460
|
-
console.log(
|
|
4464
|
+
console.log('stream | startStream');
|
|
4461
4465
|
if (this.stream)
|
|
4462
4466
|
this.stream.getTracks().forEach((track) => track.stop());
|
|
4463
4467
|
this.stream = stream;
|
|
@@ -4490,7 +4494,7 @@ class Stream {
|
|
|
4490
4494
|
}
|
|
4491
4495
|
recordStream() {
|
|
4492
4496
|
if (TranslationUtils.state.debug)
|
|
4493
|
-
console.log(
|
|
4497
|
+
console.log('stream | recordStream');
|
|
4494
4498
|
if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
|
|
4495
4499
|
return;
|
|
4496
4500
|
var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
|
|
@@ -4502,12 +4506,12 @@ class Stream {
|
|
|
4502
4506
|
this.mediaRecorder = new MediaRecorder(this.stream, options);
|
|
4503
4507
|
this.mediaRecorder.ondataavailable = event => {
|
|
4504
4508
|
if (TranslationUtils.state.debug)
|
|
4505
|
-
console.log(
|
|
4509
|
+
console.log('stream | recordStream | ondataavailable');
|
|
4506
4510
|
this.recordedChunks.push(event.data);
|
|
4507
4511
|
};
|
|
4508
4512
|
this.mediaRecorder.onstop = _e => {
|
|
4509
4513
|
if (TranslationUtils.state.debug)
|
|
4510
|
-
console.log(
|
|
4514
|
+
console.log('stream | recordStream | onstop');
|
|
4511
4515
|
var rec = new Blob(this.recordedChunks, {
|
|
4512
4516
|
type: options.mimeType.split(';')[0],
|
|
4513
4517
|
});
|
|
@@ -4539,7 +4543,7 @@ class Stream {
|
|
|
4539
4543
|
}
|
|
4540
4544
|
async takePhoto() {
|
|
4541
4545
|
if (TranslationUtils.state.debug)
|
|
4542
|
-
console.log(
|
|
4546
|
+
console.log('stream | takePhoto');
|
|
4543
4547
|
const canvas = document.createElement('canvas');
|
|
4544
4548
|
canvas.style.visibility = 'hidden';
|
|
4545
4549
|
canvas.width = this.videoElement.videoWidth;
|
|
@@ -4548,7 +4552,7 @@ class Stream {
|
|
|
4548
4552
|
}
|
|
4549
4553
|
getFrame(canvas) {
|
|
4550
4554
|
if (TranslationUtils.state.debug)
|
|
4551
|
-
console.log(
|
|
4555
|
+
console.log('stream | getFrame');
|
|
4552
4556
|
return new Promise(resolve => {
|
|
4553
4557
|
const context = canvas.getContext('2d');
|
|
4554
4558
|
context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
|
|
@@ -4556,7 +4560,7 @@ class Stream {
|
|
|
4556
4560
|
if (frame.type === ImageFormat.JPEG && !TranslationUtils.state.device.isAppleDevice) {
|
|
4557
4561
|
try {
|
|
4558
4562
|
if (TranslationUtils.state.debug)
|
|
4559
|
-
console.log(
|
|
4563
|
+
console.log('stream | getFrame | addExifInImg');
|
|
4560
4564
|
addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
|
|
4561
4565
|
}
|
|
4562
4566
|
catch (e) {
|
|
@@ -4566,7 +4570,7 @@ class Stream {
|
|
|
4566
4570
|
}
|
|
4567
4571
|
else {
|
|
4568
4572
|
if (TranslationUtils.state.debug)
|
|
4569
|
-
console.log(
|
|
4573
|
+
console.log('stream | getFrame | resolve');
|
|
4570
4574
|
resolve(frame);
|
|
4571
4575
|
}
|
|
4572
4576
|
}, ImageFormat.PNG, 1);
|
|
@@ -4575,7 +4579,7 @@ class Stream {
|
|
|
4575
4579
|
async startIdDetection() {
|
|
4576
4580
|
if (this.streamPaused)
|
|
4577
4581
|
return;
|
|
4578
|
-
this.idML5Detector.initDetector();
|
|
4582
|
+
this.idML5Detector.initDetector(this.verificationMode);
|
|
4579
4583
|
}
|
|
4580
4584
|
async startFaceDetection() {
|
|
4581
4585
|
if (this.streamPaused)
|
|
@@ -5056,7 +5060,7 @@ const IdCapture = class {
|
|
|
5056
5060
|
}
|
|
5057
5061
|
async componentWillLoad() {
|
|
5058
5062
|
if (TranslationUtils.state.debug)
|
|
5059
|
-
console.log(
|
|
5063
|
+
console.log('id-capture | componentWillLoad');
|
|
5060
5064
|
this.translations = await TranslationUtils.Translations.getValues();
|
|
5061
5065
|
if (!navigator.mediaDevices) {
|
|
5062
5066
|
this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
|
|
@@ -5064,26 +5068,29 @@ const IdCapture = class {
|
|
|
5064
5068
|
}
|
|
5065
5069
|
initVariables() {
|
|
5066
5070
|
if (TranslationUtils.state.debug)
|
|
5067
|
-
console.log(
|
|
5071
|
+
console.log('id-capture | initVariables');
|
|
5068
5072
|
if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
|
|
5069
5073
|
this.pose = IDPose.Straight;
|
|
5070
5074
|
this.flowStep = TranslationUtils.FlowSteps.CiFrontCapture;
|
|
5071
5075
|
this.titleMesage = this.translations.IdCaptureValues.Title;
|
|
5076
|
+
this.verificationMode = VerificationMode.Full;
|
|
5072
5077
|
}
|
|
5073
5078
|
else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
|
|
5074
5079
|
this.pose = IDPose.BackStraight;
|
|
5075
5080
|
this.flowStep = TranslationUtils.FlowSteps.CiBackCapture;
|
|
5076
5081
|
this.titleMesage = this.translations.IdCaptureValues.TtileRotate;
|
|
5082
|
+
this.verificationMode = VerificationMode.Full;
|
|
5077
5083
|
}
|
|
5078
5084
|
else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDTILT) {
|
|
5079
5085
|
this.titleMesage = this.translations.IdCaptureValues.IDPoseMapping;
|
|
5080
5086
|
this.pose = IDPose.Tilted;
|
|
5081
5087
|
this.flowStep = TranslationUtils.FlowSteps.CiTilt;
|
|
5088
|
+
this.verificationMode = VerificationMode.Tilt;
|
|
5082
5089
|
}
|
|
5083
5090
|
}
|
|
5084
5091
|
async componentDidLoad() {
|
|
5085
5092
|
if (TranslationUtils.state.debug)
|
|
5086
|
-
console.log(
|
|
5093
|
+
console.log('id-capture | componentDidLoad');
|
|
5087
5094
|
this.initVariables();
|
|
5088
5095
|
await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Initialized);
|
|
5089
5096
|
this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[this.pose];
|
|
@@ -5094,7 +5101,7 @@ const IdCapture = class {
|
|
|
5094
5101
|
}
|
|
5095
5102
|
async openCamera() {
|
|
5096
5103
|
if (TranslationUtils.state.debug)
|
|
5097
|
-
console.log(
|
|
5104
|
+
console.log('id-capture | openCamera');
|
|
5098
5105
|
if (!TranslationUtils.state.cameraId) {
|
|
5099
5106
|
await Cameras.InitCameras(TranslationUtils.state.device);
|
|
5100
5107
|
}
|
|
@@ -5104,8 +5111,8 @@ const IdCapture = class {
|
|
|
5104
5111
|
.getUserMedia(constraints)
|
|
5105
5112
|
.then(stream => {
|
|
5106
5113
|
if (TranslationUtils.state.debug)
|
|
5107
|
-
console.log(
|
|
5108
|
-
const superStream = Stream.getNewInstance(
|
|
5114
|
+
console.log('id-capture | openCamera | streamObtained');
|
|
5115
|
+
const superStream = Stream.getNewInstance(this.verificationMode);
|
|
5109
5116
|
superStream.initStream(stream);
|
|
5110
5117
|
})
|
|
5111
5118
|
.catch(e => {
|
|
@@ -5116,7 +5123,7 @@ const IdCapture = class {
|
|
|
5116
5123
|
}
|
|
5117
5124
|
closeCamera() {
|
|
5118
5125
|
if (TranslationUtils.state.debug)
|
|
5119
|
-
console.log(
|
|
5126
|
+
console.log('id-capture | closeCamera');
|
|
5120
5127
|
if (Stream.instance) {
|
|
5121
5128
|
Stream.instance.dropStream();
|
|
5122
5129
|
}
|
|
@@ -5127,23 +5134,23 @@ const IdCapture = class {
|
|
|
5127
5134
|
IDML5Detector.instance = null;
|
|
5128
5135
|
FaceML5Detector.instance = null;
|
|
5129
5136
|
if (TranslationUtils.state.debug)
|
|
5130
|
-
console.log(
|
|
5137
|
+
console.log('id-capture | disconnectedCallback');
|
|
5131
5138
|
}
|
|
5132
5139
|
async takePhoto() {
|
|
5133
5140
|
if (TranslationUtils.state.debug)
|
|
5134
|
-
console.log(
|
|
5141
|
+
console.log('id-capture | takePhoto');
|
|
5135
5142
|
if (this.captureTaken)
|
|
5136
5143
|
return;
|
|
5137
5144
|
this.captureTaken = true;
|
|
5138
5145
|
if (TranslationUtils.state.debug)
|
|
5139
|
-
console.log(
|
|
5146
|
+
console.log('id-capture | takePhoto | sendingPhoto');
|
|
5140
5147
|
let res = await Stream.instance.takePhoto();
|
|
5141
5148
|
this.eventPhotoCapture.emit(res);
|
|
5142
5149
|
await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Finalized);
|
|
5143
5150
|
}
|
|
5144
5151
|
async verificationFinished() {
|
|
5145
5152
|
if (TranslationUtils.state.debug)
|
|
5146
|
-
console.log(
|
|
5153
|
+
console.log('id-capture | verificationFinished');
|
|
5147
5154
|
if (this.verified)
|
|
5148
5155
|
return;
|
|
5149
5156
|
this.verified = true;
|
|
@@ -5240,7 +5247,7 @@ function v4(options, buf, offset) {
|
|
|
5240
5247
|
}
|
|
5241
5248
|
|
|
5242
5249
|
const name = "@ekyc_qoobiss/qbs-ect-cmp";
|
|
5243
|
-
const version$1 = "3.6.
|
|
5250
|
+
const version$1 = "3.6.79";
|
|
5244
5251
|
const description = "Person Identification Component";
|
|
5245
5252
|
const main = "./dist/index.cjs.js";
|
|
5246
5253
|
const module$1 = "./dist/index.js";
|
|
@@ -5540,12 +5547,12 @@ const IdentificationComponent = class {
|
|
|
5540
5547
|
if (!this.order_id || this.order_id == '') {
|
|
5541
5548
|
this.order_id = TranslationUtils.state.requestId;
|
|
5542
5549
|
}
|
|
5550
|
+
ML5.getInstance();
|
|
5543
5551
|
}
|
|
5544
5552
|
}
|
|
5545
5553
|
catch (e) {
|
|
5546
5554
|
this.apiErrorEmitter(e, 'Request Initialisation RequestId:' + TranslationUtils.state.requestId + ' RedirectId:' + TranslationUtils.state.redirectId);
|
|
5547
5555
|
}
|
|
5548
|
-
ML5.getInstance();
|
|
5549
5556
|
}
|
|
5550
5557
|
disconnectedCallback() {
|
|
5551
5558
|
Events.flowEvent(TranslationUtils.FlowSteps.ComponentLoaded, TranslationUtils.FlowMoments.Finalized);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-41696e0e.js');
|
|
6
|
-
const TranslationUtils = require('./TranslationUtils-
|
|
6
|
+
const TranslationUtils = require('./TranslationUtils-6fdf7b55.js');
|
|
7
7
|
|
|
8
8
|
const randomActionsCss = "";
|
|
9
9
|
|
|
@@ -9,6 +9,7 @@ import { delay } from '../../../utils/utils';
|
|
|
9
9
|
import store from '../../../helpers/store';
|
|
10
10
|
import { BaseComponent } from '../../base-component';
|
|
11
11
|
import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
|
|
12
|
+
import { VerificationMode } from '../../../models/IVerificationMode';
|
|
12
13
|
import { Translations } from '../../../helpers/TranslationUtils';
|
|
13
14
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
14
15
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
@@ -31,7 +32,7 @@ export class IdCapture {
|
|
|
31
32
|
}
|
|
32
33
|
async componentWillLoad() {
|
|
33
34
|
if (store.debug)
|
|
34
|
-
console.log(
|
|
35
|
+
console.log('id-capture | componentWillLoad');
|
|
35
36
|
this.translations = await Translations.getValues();
|
|
36
37
|
if (!navigator.mediaDevices) {
|
|
37
38
|
this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
|
|
@@ -39,26 +40,29 @@ export class IdCapture {
|
|
|
39
40
|
}
|
|
40
41
|
initVariables() {
|
|
41
42
|
if (store.debug)
|
|
42
|
-
console.log(
|
|
43
|
+
console.log('id-capture | initVariables');
|
|
43
44
|
if (store.flowStatus == FlowStatus.IDFRONT) {
|
|
44
45
|
this.pose = IDPose.Straight;
|
|
45
46
|
this.flowStep = FlowSteps.CiFrontCapture;
|
|
46
47
|
this.titleMesage = this.translations.IdCaptureValues.Title;
|
|
48
|
+
this.verificationMode = VerificationMode.Full;
|
|
47
49
|
}
|
|
48
50
|
else if (store.flowStatus == FlowStatus.IDBACK) {
|
|
49
51
|
this.pose = IDPose.BackStraight;
|
|
50
52
|
this.flowStep = FlowSteps.CiBackCapture;
|
|
51
53
|
this.titleMesage = this.translations.IdCaptureValues.TtileRotate;
|
|
54
|
+
this.verificationMode = VerificationMode.Full;
|
|
52
55
|
}
|
|
53
56
|
else if (store.flowStatus == FlowStatus.IDTILT) {
|
|
54
57
|
this.titleMesage = this.translations.IdCaptureValues.IDPoseMapping;
|
|
55
58
|
this.pose = IDPose.Tilted;
|
|
56
59
|
this.flowStep = FlowSteps.CiTilt;
|
|
60
|
+
this.verificationMode = VerificationMode.Tilt;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
async componentDidLoad() {
|
|
60
64
|
if (store.debug)
|
|
61
|
-
console.log(
|
|
65
|
+
console.log('id-capture | componentDidLoad');
|
|
62
66
|
this.initVariables();
|
|
63
67
|
await BaseComponent.logStep(this.flowStep, FlowMoments.Initialized);
|
|
64
68
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[this.pose];
|
|
@@ -69,7 +73,7 @@ export class IdCapture {
|
|
|
69
73
|
}
|
|
70
74
|
async openCamera() {
|
|
71
75
|
if (store.debug)
|
|
72
|
-
console.log(
|
|
76
|
+
console.log('id-capture | openCamera');
|
|
73
77
|
if (!store.cameraId) {
|
|
74
78
|
await Cameras.InitCameras(store.device);
|
|
75
79
|
}
|
|
@@ -79,8 +83,8 @@ export class IdCapture {
|
|
|
79
83
|
.getUserMedia(constraints)
|
|
80
84
|
.then(stream => {
|
|
81
85
|
if (store.debug)
|
|
82
|
-
console.log(
|
|
83
|
-
const superStream = Stream.getNewInstance(
|
|
86
|
+
console.log('id-capture | openCamera | streamObtained');
|
|
87
|
+
const superStream = Stream.getNewInstance(this.verificationMode);
|
|
84
88
|
superStream.initStream(stream);
|
|
85
89
|
})
|
|
86
90
|
.catch(e => {
|
|
@@ -91,7 +95,7 @@ export class IdCapture {
|
|
|
91
95
|
}
|
|
92
96
|
closeCamera() {
|
|
93
97
|
if (store.debug)
|
|
94
|
-
console.log(
|
|
98
|
+
console.log('id-capture | closeCamera');
|
|
95
99
|
if (Stream.instance) {
|
|
96
100
|
Stream.instance.dropStream();
|
|
97
101
|
}
|
|
@@ -102,23 +106,23 @@ export class IdCapture {
|
|
|
102
106
|
IDML5Detector.instance = null;
|
|
103
107
|
FaceML5Detector.instance = null;
|
|
104
108
|
if (store.debug)
|
|
105
|
-
console.log(
|
|
109
|
+
console.log('id-capture | disconnectedCallback');
|
|
106
110
|
}
|
|
107
111
|
async takePhoto() {
|
|
108
112
|
if (store.debug)
|
|
109
|
-
console.log(
|
|
113
|
+
console.log('id-capture | takePhoto');
|
|
110
114
|
if (this.captureTaken)
|
|
111
115
|
return;
|
|
112
116
|
this.captureTaken = true;
|
|
113
117
|
if (store.debug)
|
|
114
|
-
console.log(
|
|
118
|
+
console.log('id-capture | takePhoto | sendingPhoto');
|
|
115
119
|
let res = await Stream.instance.takePhoto();
|
|
116
120
|
this.eventPhotoCapture.emit(res);
|
|
117
121
|
await BaseComponent.logStep(this.flowStep, FlowMoments.Finalized);
|
|
118
122
|
}
|
|
119
123
|
async verificationFinished() {
|
|
120
124
|
if (store.debug)
|
|
121
|
-
console.log(
|
|
125
|
+
console.log('id-capture | verificationFinished');
|
|
122
126
|
if (this.verified)
|
|
123
127
|
return;
|
|
124
128
|
this.verified = true;
|
|
@@ -159,12 +159,12 @@ export class IdentificationComponent {
|
|
|
159
159
|
if (!this.order_id || this.order_id == '') {
|
|
160
160
|
this.order_id = store.requestId;
|
|
161
161
|
}
|
|
162
|
+
ML5.getInstance();
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
catch (e) {
|
|
165
166
|
this.apiErrorEmitter(e, 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
|
|
166
167
|
}
|
|
167
|
-
ML5.getInstance();
|
|
168
168
|
}
|
|
169
169
|
disconnectedCallback() {
|
|
170
170
|
Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Finalized);
|
|
@@ -166,6 +166,7 @@ export class ApiCall {
|
|
|
166
166
|
store.flowStatus = FlowStatus[jsonResp.state];
|
|
167
167
|
store.logSteps = jsonResp.logSteps;
|
|
168
168
|
store.debug = jsonResp.debug;
|
|
169
|
+
store.modelsPath = jsonResp.modelsPath;
|
|
169
170
|
return true;
|
|
170
171
|
}
|
|
171
172
|
async UploadFileForRequestB64(requestId, type, file) {
|
|
@@ -14,7 +14,7 @@ export class ML5 {
|
|
|
14
14
|
}
|
|
15
15
|
async init() {
|
|
16
16
|
return new Promise(async (resolve) => {
|
|
17
|
-
const modelPath = store.
|
|
17
|
+
const modelPath = store.modelsPath;
|
|
18
18
|
this.classifier = await ml5.imageClassifier(modelPath, this.loaded);
|
|
19
19
|
this.faceapi = await ml5.faceApi({ withLandmarks: true, withDescriptors: false }, this.loaded);
|
|
20
20
|
//warmup
|
|
@@ -39,7 +39,7 @@ export class Stream {
|
|
|
39
39
|
this.recordedChunks = [];
|
|
40
40
|
this.videoSize = { width: 0, height: 0 };
|
|
41
41
|
if (store.debug)
|
|
42
|
-
console.log(
|
|
42
|
+
console.log('stream | constructor');
|
|
43
43
|
this.initFacePose();
|
|
44
44
|
this.idML5Detector = IDML5Detector.getInstance(this, store.device.isMobile);
|
|
45
45
|
this.faceML5Detector = FaceML5Detector.getInstance(this, store.device.isMobile);
|
|
@@ -51,23 +51,23 @@ export class Stream {
|
|
|
51
51
|
if (!Stream.instance) {
|
|
52
52
|
Stream.instance = new Stream(mode);
|
|
53
53
|
if (store.debug)
|
|
54
|
-
console.log(
|
|
54
|
+
console.log('stream | getNewInstance | new instance');
|
|
55
55
|
}
|
|
56
56
|
return Stream.instance;
|
|
57
57
|
}
|
|
58
58
|
autoCapturing() {
|
|
59
59
|
if (store.debug)
|
|
60
|
-
console.log(
|
|
60
|
+
console.log('stream | autoCapturing');
|
|
61
61
|
this.callbackAutoCapturing();
|
|
62
62
|
}
|
|
63
63
|
timeElapsed() {
|
|
64
64
|
if (store.debug)
|
|
65
|
-
console.log(
|
|
65
|
+
console.log('stream | timeElapsed');
|
|
66
66
|
this.callbackTimeElapsed();
|
|
67
67
|
}
|
|
68
68
|
verificationReady() {
|
|
69
69
|
if (store.debug)
|
|
70
|
-
console.log(
|
|
70
|
+
console.log('stream | verificationReady');
|
|
71
71
|
this.verificationFinished();
|
|
72
72
|
}
|
|
73
73
|
updateHtmlElements(videoElement, canvasElement, component) {
|
|
@@ -78,7 +78,7 @@ export class Stream {
|
|
|
78
78
|
}
|
|
79
79
|
startStream(stream) {
|
|
80
80
|
if (store.debug)
|
|
81
|
-
console.log(
|
|
81
|
+
console.log('stream | startStream');
|
|
82
82
|
if (this.stream)
|
|
83
83
|
this.stream.getTracks().forEach((track) => track.stop());
|
|
84
84
|
this.stream = stream;
|
|
@@ -111,7 +111,7 @@ export class Stream {
|
|
|
111
111
|
}
|
|
112
112
|
recordStream() {
|
|
113
113
|
if (store.debug)
|
|
114
|
-
console.log(
|
|
114
|
+
console.log('stream | recordStream');
|
|
115
115
|
if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
|
|
116
116
|
return;
|
|
117
117
|
var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
|
|
@@ -123,12 +123,12 @@ export class Stream {
|
|
|
123
123
|
this.mediaRecorder = new MediaRecorder(this.stream, options);
|
|
124
124
|
this.mediaRecorder.ondataavailable = event => {
|
|
125
125
|
if (store.debug)
|
|
126
|
-
console.log(
|
|
126
|
+
console.log('stream | recordStream | ondataavailable');
|
|
127
127
|
this.recordedChunks.push(event.data);
|
|
128
128
|
};
|
|
129
129
|
this.mediaRecorder.onstop = _e => {
|
|
130
130
|
if (store.debug)
|
|
131
|
-
console.log(
|
|
131
|
+
console.log('stream | recordStream | onstop');
|
|
132
132
|
var rec = new Blob(this.recordedChunks, {
|
|
133
133
|
type: options.mimeType.split(';')[0],
|
|
134
134
|
});
|
|
@@ -160,7 +160,7 @@ export class Stream {
|
|
|
160
160
|
}
|
|
161
161
|
async takePhoto() {
|
|
162
162
|
if (store.debug)
|
|
163
|
-
console.log(
|
|
163
|
+
console.log('stream | takePhoto');
|
|
164
164
|
const canvas = document.createElement('canvas');
|
|
165
165
|
canvas.style.visibility = 'hidden';
|
|
166
166
|
canvas.width = this.videoElement.videoWidth;
|
|
@@ -169,7 +169,7 @@ export class Stream {
|
|
|
169
169
|
}
|
|
170
170
|
getFrame(canvas) {
|
|
171
171
|
if (store.debug)
|
|
172
|
-
console.log(
|
|
172
|
+
console.log('stream | getFrame');
|
|
173
173
|
return new Promise(resolve => {
|
|
174
174
|
const context = canvas.getContext('2d');
|
|
175
175
|
context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
|
|
@@ -177,7 +177,7 @@ export class Stream {
|
|
|
177
177
|
if (frame.type === ImageFormat.JPEG && !store.device.isAppleDevice) {
|
|
178
178
|
try {
|
|
179
179
|
if (store.debug)
|
|
180
|
-
console.log(
|
|
180
|
+
console.log('stream | getFrame | addExifInImg');
|
|
181
181
|
addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
|
|
182
182
|
}
|
|
183
183
|
catch (e) {
|
|
@@ -187,7 +187,7 @@ export class Stream {
|
|
|
187
187
|
}
|
|
188
188
|
else {
|
|
189
189
|
if (store.debug)
|
|
190
|
-
console.log(
|
|
190
|
+
console.log('stream | getFrame | resolve');
|
|
191
191
|
resolve(frame);
|
|
192
192
|
}
|
|
193
193
|
}, ImageFormat.PNG, 1);
|
|
@@ -196,7 +196,7 @@ export class Stream {
|
|
|
196
196
|
async startIdDetection() {
|
|
197
197
|
if (this.streamPaused)
|
|
198
198
|
return;
|
|
199
|
-
this.idML5Detector.initDetector();
|
|
199
|
+
this.idML5Detector.initDetector(this.verificationMode);
|
|
200
200
|
}
|
|
201
201
|
async startFaceDetection() {
|
|
202
202
|
if (this.streamPaused)
|
|
@@ -4,6 +4,7 @@ import id_white_svg from '../../assets/canvas-masks/id_white.svg';
|
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import id_green_svg from '../../assets/canvas-masks/id_green.svg';
|
|
6
6
|
import { delay } from '../../utils/utils';
|
|
7
|
+
import { VerificationMode } from '../../models/IVerificationMode';
|
|
7
8
|
import store from '../../helpers/store';
|
|
8
9
|
export class IDML5Detector {
|
|
9
10
|
static getInstance(stream, isMobile) {
|
|
@@ -25,9 +26,13 @@ export class IDML5Detector {
|
|
|
25
26
|
this.canvasElement = canvasElement;
|
|
26
27
|
// this.component = component;
|
|
27
28
|
}
|
|
28
|
-
initDetector() {
|
|
29
|
+
initDetector(mode) {
|
|
29
30
|
this.initTime = Date.now();
|
|
30
31
|
this.continue = true;
|
|
32
|
+
if (mode == VerificationMode.Full)
|
|
33
|
+
this.targetedLabel = 'full';
|
|
34
|
+
else
|
|
35
|
+
this.targetedLabel = 'tilted';
|
|
31
36
|
// this.width = this.videoElement.videoWidth;
|
|
32
37
|
// this.height = this.videoElement.videoHeight;
|
|
33
38
|
this.drawFrame('white');
|
|
@@ -55,14 +60,14 @@ export class IDML5Detector {
|
|
|
55
60
|
this.stream.timeElapsed();
|
|
56
61
|
return;
|
|
57
62
|
}
|
|
58
|
-
if (results[0].label ==
|
|
63
|
+
if (results[0].label == this.targetedLabel && results[0].confidence > 0.9 && !this.checked) {
|
|
59
64
|
this.checked = true;
|
|
60
65
|
if (store.debug)
|
|
61
66
|
console.log('idml5detector | gotResults | autoCapturing');
|
|
62
67
|
this.stream.autoCapturing();
|
|
63
68
|
await this.drawFrame('green');
|
|
64
69
|
}
|
|
65
|
-
if (results[0].label == 'tilted' && results[0].confidence > 0.8 && !this.checked) {
|
|
70
|
+
if (results[0].label == this.targetedLabel && this.targetedLabel == 'tilted' && results[0].confidence > 0.8 && !this.checked) {
|
|
66
71
|
this.checked = true;
|
|
67
72
|
await this.drawFrame('green');
|
|
68
73
|
}
|
|
@@ -292,6 +292,7 @@ const { state, onChange } = createStore({
|
|
|
292
292
|
device: null,
|
|
293
293
|
langIso: 'ro',
|
|
294
294
|
logSteps: false,
|
|
295
|
+
modelsPath: '',
|
|
295
296
|
});
|
|
296
297
|
onChange('environment', value => {
|
|
297
298
|
state.debug = value == 'QA';
|
|
@@ -501,6 +502,7 @@ class ApiCall {
|
|
|
501
502
|
state.flowStatus = FlowStatus[jsonResp.state];
|
|
502
503
|
state.logSteps = jsonResp.logSteps;
|
|
503
504
|
state.debug = jsonResp.debug;
|
|
505
|
+
state.modelsPath = jsonResp.modelsPath;
|
|
504
506
|
return true;
|
|
505
507
|
}
|
|
506
508
|
async UploadFileForRequestB64(requestId, type, file) {
|