@ekyc_qoobiss/qbs-ect-cmp 3.6.76 → 3.6.78

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.
@@ -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 == 'full' && results[0].confidence > 0.9 && !this.checked) {
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(`stream | constructor`);
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(`stream | getNewInstance | new instance`);
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(`stream | autoCapturing`);
4443
+ console.log('stream | autoCapturing');
4440
4444
  this.callbackAutoCapturing();
4441
4445
  }
4442
4446
  timeElapsed() {
4443
4447
  if (TranslationUtils.state.debug)
4444
- console.log(`stream | timeElapsed`);
4448
+ console.log('stream | timeElapsed');
4445
4449
  this.callbackTimeElapsed();
4446
4450
  }
4447
4451
  verificationReady() {
4448
4452
  if (TranslationUtils.state.debug)
4449
- console.log(`stream | verificationReady`);
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(`stream | startStream`);
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(`stream | recordStream`);
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(`stream | recordStream | ondataavailable`);
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(`stream | recordStream | onstop`);
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(`stream | takePhoto`);
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(`stream | getFrame`);
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(`stream | getFrame | addExifInImg`);
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(`stream | getFrame | resolve`);
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(`id-capture | componentWillLoad`);
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(`id-capture | initVariables`);
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(`id-capture | componentDidLoad`);
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(`id-capture | openCamera`);
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(`id-capture | openCamera | streamObtained`);
5108
- const superStream = Stream.getNewInstance(null);
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(`id-capture | closeCamera`);
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(`id-capture | disconnectedCallback`);
5137
+ console.log('id-capture | disconnectedCallback');
5131
5138
  }
5132
5139
  async takePhoto() {
5133
5140
  if (TranslationUtils.state.debug)
5134
- console.log(`id-capture | takePhoto`);
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(`id-capture | takePhoto | sendingPhoto`);
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(`id-capture | verificationFinished`);
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.76";
5250
+ const version$1 = "3.6.78";
5244
5251
  const description = "Person Identification Component";
5245
5252
  const main = "./dist/index.cjs.js";
5246
5253
  const module$1 = "./dist/index.js";
@@ -8804,23 +8811,12 @@ const ProcessId = class {
8804
8811
  if (TranslationUtils.state.debug)
8805
8812
  console.log('process-id | verificationFinished');
8806
8813
  this.verificationReceived = Date.now();
8807
- let initialStatus = TranslationUtils.state.flowStatus;
8808
- let statusChanged = false;
8809
- while (Date.now() - this.verificationReceived < 30000 && !statusChanged) {
8814
+ while (Date.now() - this.verificationReceived < 30000) {
8810
8815
  await delay(2000);
8811
8816
  if (this.showInvalid || this.showTimeout)
8812
8817
  return;
8813
- statusChanged = initialStatus != TranslationUtils.state.flowStatus;
8814
- }
8815
- if (!statusChanged) {
8816
- let currentStatus = await TranslationUtils.ApiCall.instance.GetFlowState();
8817
- if (currentStatus != TranslationUtils.state.flowStatus) {
8818
- TranslationUtils.state.flowStatus = currentStatus;
8819
- }
8820
- else {
8821
- this.triggerUploadFailedFlow();
8822
- }
8823
8818
  }
8819
+ this.triggerUploadFailedFlow();
8824
8820
  if (TranslationUtils.state.debug)
8825
8821
  console.log('process-id | verificationFinished | waitingFinished ');
8826
8822
  }
@@ -9199,23 +9195,12 @@ const UserLiveness = class {
9199
9195
  if (TranslationUtils.state.debug)
9200
9196
  console.log('user-liveness | verificationFinished');
9201
9197
  this.verificationReceived = Date.now();
9202
- let initialStatus = TranslationUtils.state.flowStatus;
9203
- let statusChanged = false;
9204
- while (Date.now() - this.verificationReceived < 30000 && !statusChanged) {
9198
+ while (Date.now() - this.verificationReceived < 30000) {
9205
9199
  await delay(2000);
9206
9200
  if (this.showError || this.showTimeout)
9207
9201
  return;
9208
- statusChanged = initialStatus != TranslationUtils.state.flowStatus;
9209
- }
9210
- if (!statusChanged) {
9211
- let currentStatus = await TranslationUtils.ApiCall.instance.GetFlowState();
9212
- if (currentStatus != TranslationUtils.state.flowStatus) {
9213
- TranslationUtils.state.flowStatus = currentStatus;
9214
- }
9215
- else {
9216
- this.triggerUploadFailedFlow();
9217
- }
9218
9202
  }
9203
+ this.triggerUploadFailedFlow();
9219
9204
  if (TranslationUtils.state.debug)
9220
9205
  console.log('user-liveness | verificationFinished | waitingFinished ');
9221
9206
  }
@@ -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(`id-capture | componentWillLoad`);
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(`id-capture | initVariables`);
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(`id-capture | componentDidLoad`);
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(`id-capture | openCamera`);
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(`id-capture | openCamera | streamObtained`);
83
- const superStream = Stream.getNewInstance(null);
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(`id-capture | closeCamera`);
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(`id-capture | disconnectedCallback`);
109
+ console.log('id-capture | disconnectedCallback');
106
110
  }
107
111
  async takePhoto() {
108
112
  if (store.debug)
109
- console.log(`id-capture | takePhoto`);
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(`id-capture | takePhoto | sendingPhoto`);
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(`id-capture | verificationFinished`);
125
+ console.log('id-capture | verificationFinished');
122
126
  if (this.verified)
123
127
  return;
124
128
  this.verified = true;
@@ -126,23 +126,12 @@ export class ProcessId {
126
126
  if (store.debug)
127
127
  console.log('process-id | verificationFinished');
128
128
  this.verificationReceived = Date.now();
129
- let initialStatus = store.flowStatus;
130
- let statusChanged = false;
131
- while (Date.now() - this.verificationReceived < 30000 && !statusChanged) {
129
+ while (Date.now() - this.verificationReceived < 30000) {
132
130
  await delay(2000);
133
131
  if (this.showInvalid || this.showTimeout)
134
132
  return;
135
- statusChanged = initialStatus != store.flowStatus;
136
- }
137
- if (!statusChanged) {
138
- let currentStatus = await ApiCall.instance.GetFlowState();
139
- if (currentStatus != store.flowStatus) {
140
- store.flowStatus = currentStatus;
141
- }
142
- else {
143
- this.triggerUploadFailedFlow();
144
- }
145
133
  }
134
+ this.triggerUploadFailedFlow();
146
135
  if (store.debug)
147
136
  console.log('process-id | verificationFinished | waitingFinished ');
148
137
  }
@@ -109,23 +109,12 @@ export class UserLiveness {
109
109
  if (store.debug)
110
110
  console.log('user-liveness | verificationFinished');
111
111
  this.verificationReceived = Date.now();
112
- let initialStatus = store.flowStatus;
113
- let statusChanged = false;
114
- while (Date.now() - this.verificationReceived < 30000 && !statusChanged) {
112
+ while (Date.now() - this.verificationReceived < 30000) {
115
113
  await delay(2000);
116
114
  if (this.showError || this.showTimeout)
117
115
  return;
118
- statusChanged = initialStatus != store.flowStatus;
119
- }
120
- if (!statusChanged) {
121
- let currentStatus = await ApiCall.instance.GetFlowState();
122
- if (currentStatus != store.flowStatus) {
123
- store.flowStatus = currentStatus;
124
- }
125
- else {
126
- this.triggerUploadFailedFlow();
127
- }
128
116
  }
117
+ this.triggerUploadFailedFlow();
129
118
  if (store.debug)
130
119
  console.log('user-liveness | verificationFinished | waitingFinished ');
131
120
  }
@@ -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(`stream | constructor`);
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(`stream | getNewInstance | new instance`);
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(`stream | autoCapturing`);
60
+ console.log('stream | autoCapturing');
61
61
  this.callbackAutoCapturing();
62
62
  }
63
63
  timeElapsed() {
64
64
  if (store.debug)
65
- console.log(`stream | timeElapsed`);
65
+ console.log('stream | timeElapsed');
66
66
  this.callbackTimeElapsed();
67
67
  }
68
68
  verificationReady() {
69
69
  if (store.debug)
70
- console.log(`stream | verificationReady`);
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(`stream | startStream`);
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(`stream | recordStream`);
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(`stream | recordStream | ondataavailable`);
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(`stream | recordStream | onstop`);
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(`stream | takePhoto`);
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(`stream | getFrame`);
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(`stream | getFrame | addExifInImg`);
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(`stream | getFrame | resolve`);
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 == 'full' && results[0].confidence > 0.9 && !this.checked) {
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
  }