@ekyc_qoobiss/qbs-ect-cmp 3.6.73 → 3.6.75

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.
@@ -4388,6 +4388,71 @@ var Browser;
4388
4388
  Browser["Unknown"] = "unknown";
4389
4389
  })(Browser || (Browser = {}));
4390
4390
 
4391
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
4392
+ // require the crypto API and do not support built-in fallback to lower quality random number
4393
+ // generators (like Math.random()).
4394
+ let getRandomValues;
4395
+ const rnds8 = new Uint8Array(16);
4396
+ function rng() {
4397
+ // lazy load so that environments that need to polyfill have a chance to do so
4398
+ if (!getRandomValues) {
4399
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
4400
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
4401
+
4402
+ if (!getRandomValues) {
4403
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
4404
+ }
4405
+ }
4406
+
4407
+ return getRandomValues(rnds8);
4408
+ }
4409
+
4410
+ /**
4411
+ * Convert array of 16 byte values to UUID string format of the form:
4412
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4413
+ */
4414
+
4415
+ const byteToHex = [];
4416
+
4417
+ for (let i = 0; i < 256; ++i) {
4418
+ byteToHex.push((i + 0x100).toString(16).slice(1));
4419
+ }
4420
+
4421
+ function unsafeStringify(arr, offset = 0) {
4422
+ // Note: Be careful editing this code! It's been tuned for performance
4423
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4424
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
4425
+ }
4426
+
4427
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4428
+ const native = {
4429
+ randomUUID
4430
+ };
4431
+
4432
+ function v4(options, buf, offset) {
4433
+ if (native.randomUUID && !buf && !options) {
4434
+ return native.randomUUID();
4435
+ }
4436
+
4437
+ options = options || {};
4438
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4439
+
4440
+ rnds[6] = rnds[6] & 0x0f | 0x40;
4441
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
4442
+
4443
+ if (buf) {
4444
+ offset = offset || 0;
4445
+
4446
+ for (let i = 0; i < 16; ++i) {
4447
+ buf[offset + i] = rnds[i];
4448
+ }
4449
+
4450
+ return buf;
4451
+ }
4452
+
4453
+ return unsafeStringify(rnds);
4454
+ }
4455
+
4391
4456
  var ImageFormat;
4392
4457
  (function (ImageFormat) {
4393
4458
  ImageFormat["JPEG"] = "image/jpeg";
@@ -4419,10 +4484,11 @@ class Stream {
4419
4484
  }
4420
4485
  constructor(mode) {
4421
4486
  this.streamPaused = false;
4487
+ this.guid = v4();
4422
4488
  this.recordedChunks = [];
4423
4489
  this.videoSize = { width: 0, height: 0 };
4424
4490
  if (TranslationUtils.state.debug)
4425
- console.log('stream | constructor');
4491
+ console.log(`stream ${this.guid} | constructor`);
4426
4492
  this.initFacePose();
4427
4493
  this.idML5Detector = IDML5Detector.getInstance(this, TranslationUtils.state.device.isMobile);
4428
4494
  this.faceML5Detector = FaceML5Detector.getInstance(this, TranslationUtils.state.device.isMobile);
@@ -4432,25 +4498,25 @@ class Stream {
4432
4498
  if (TranslationUtils.state.debug)
4433
4499
  console.log('stream | getNewInstance');
4434
4500
  if (!Stream.instance) {
4435
- if (TranslationUtils.state.debug)
4436
- console.log('stream | getNewInstance | new instance');
4437
4501
  Stream.instance = new Stream(mode);
4502
+ if (TranslationUtils.state.debug)
4503
+ console.log(`stream ${Stream.instance.guid} | getNewInstance | new instance`);
4438
4504
  }
4439
4505
  return Stream.instance;
4440
4506
  }
4441
4507
  autoCapturing() {
4442
4508
  if (TranslationUtils.state.debug)
4443
- console.log('stream | autoCapturing');
4509
+ console.log(`stream ${this.guid} | autoCapturing`);
4444
4510
  this.callbackAutoCapturing();
4445
4511
  }
4446
4512
  timeElapsed() {
4447
4513
  if (TranslationUtils.state.debug)
4448
- console.log('stream | timeElapsed');
4514
+ console.log(`stream ${this.guid} | timeElapsed`);
4449
4515
  this.callbackTimeElapsed();
4450
4516
  }
4451
4517
  verificationReady() {
4452
4518
  if (TranslationUtils.state.debug)
4453
- console.log('stream | verificationReady');
4519
+ console.log(`stream ${this.guid} | verificationReady`);
4454
4520
  this.verificationFinished();
4455
4521
  }
4456
4522
  updateHtmlElements(videoElement, canvasElement, component) {
@@ -4461,7 +4527,7 @@ class Stream {
4461
4527
  }
4462
4528
  startStream(stream) {
4463
4529
  if (TranslationUtils.state.debug)
4464
- console.log('stream | startStream');
4530
+ console.log(`stream ${this.guid} | startStream`);
4465
4531
  if (this.stream)
4466
4532
  this.stream.getTracks().forEach((track) => track.stop());
4467
4533
  this.stream = stream;
@@ -4494,7 +4560,7 @@ class Stream {
4494
4560
  }
4495
4561
  recordStream() {
4496
4562
  if (TranslationUtils.state.debug)
4497
- console.log('stream | recordStream');
4563
+ console.log(`stream ${this.guid} | recordStream`);
4498
4564
  if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
4499
4565
  return;
4500
4566
  var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
@@ -4506,12 +4572,12 @@ class Stream {
4506
4572
  this.mediaRecorder = new MediaRecorder(this.stream, options);
4507
4573
  this.mediaRecorder.ondataavailable = event => {
4508
4574
  if (TranslationUtils.state.debug)
4509
- console.log('stream | recordStream | ondataavailable');
4575
+ console.log(`stream ${this.guid} | recordStream | ondataavailable`);
4510
4576
  this.recordedChunks.push(event.data);
4511
4577
  };
4512
4578
  this.mediaRecorder.onstop = _e => {
4513
4579
  if (TranslationUtils.state.debug)
4514
- console.log('stream | recordStream | onstop');
4580
+ console.log(`stream ${this.guid} | recordStream | onstop`);
4515
4581
  var rec = new Blob(this.recordedChunks, {
4516
4582
  type: options.mimeType.split(';')[0],
4517
4583
  });
@@ -4543,7 +4609,7 @@ class Stream {
4543
4609
  }
4544
4610
  async takePhoto() {
4545
4611
  if (TranslationUtils.state.debug)
4546
- console.log('stream | takePhoto');
4612
+ console.log(`stream ${this.guid} | takePhoto`);
4547
4613
  const canvas = document.createElement('canvas');
4548
4614
  canvas.style.visibility = 'hidden';
4549
4615
  canvas.width = this.videoElement.videoWidth;
@@ -4552,7 +4618,7 @@ class Stream {
4552
4618
  }
4553
4619
  getFrame(canvas) {
4554
4620
  if (TranslationUtils.state.debug)
4555
- console.log('stream | getFrame');
4621
+ console.log(`stream ${this.guid} | getFrame`);
4556
4622
  return new Promise(resolve => {
4557
4623
  const context = canvas.getContext('2d');
4558
4624
  context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
@@ -4560,7 +4626,7 @@ class Stream {
4560
4626
  if (frame.type === ImageFormat.JPEG && !TranslationUtils.state.device.isAppleDevice) {
4561
4627
  try {
4562
4628
  if (TranslationUtils.state.debug)
4563
- console.log('stream | getFrame | addExifInImg');
4629
+ console.log(`stream ${this.guid} | getFrame | addExifInImg`);
4564
4630
  addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
4565
4631
  }
4566
4632
  catch (e) {
@@ -4570,7 +4636,7 @@ class Stream {
4570
4636
  }
4571
4637
  else {
4572
4638
  if (TranslationUtils.state.debug)
4573
- console.log('stream | getFrame | resolve');
4639
+ console.log(`stream ${this.guid} | getFrame | resolve`);
4574
4640
  resolve(frame);
4575
4641
  }
4576
4642
  }, ImageFormat.PNG, 1);
@@ -4755,6 +4821,10 @@ const CaptureError = class {
4755
4821
  var nextState = await TranslationUtils.ApiCall.instance.GetNextStateForCaptureError();
4756
4822
  TranslationUtils.state.flowStatus = nextState;
4757
4823
  }
4824
+ else if (this.reason == 'Invalid' && TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
4825
+ var nextState = await TranslationUtils.ApiCall.instance.GetNextStateForCaptureError();
4826
+ TranslationUtils.state.flowStatus = nextState;
4827
+ }
4758
4828
  else {
4759
4829
  this.eventCaptureErrorDone.emit();
4760
4830
  }
@@ -4817,10 +4887,12 @@ const HowToInfo = class {
4817
4887
  index.registerInstance(this, hostRef);
4818
4888
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
4819
4889
  this.loadImage = src => new Promise((resolve, reject) => {
4820
- this.image.onload = () => resolve(this.image);
4890
+ this.image.onload = () => {
4891
+ this.imageLoaded = true;
4892
+ resolve(this.image);
4893
+ };
4821
4894
  this.image.onerror = reject;
4822
4895
  this.image.src = src;
4823
- this.imageLoaded = true;
4824
4896
  });
4825
4897
  this.showVideo = undefined;
4826
4898
  this.topTitle = undefined;
@@ -4876,7 +4948,13 @@ const HowToInfo = class {
4876
4948
  this.buttonText = this.translations.HowToValues.IdButton;
4877
4949
  }
4878
4950
  render() {
4879
- return (index.h("div", { class: "container" }, index.h("div", { class: "row", hidden: TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESSGESTUREHOWTO || this.imageLoaded == false }, index.h("div", { class: "div-ci align-center", hidden: this.showVideo }, index.h("img", { ref: el => (this.image = el) })), index.h("div", { hidden: this.showVideo == false }, index.h("video", { id: "howTo", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { class: "text-center" }, index.h("h1", null, this.topTitle), index.h("p", { class: "font-size-2", hidden: this.subTitle == '' }, this.subTitle)), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { class: "main-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(), hidden: this.showVideo == true }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
4951
+ let titleClass = 'color-black-2';
4952
+ let bgDemo = 'container';
4953
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACKHOWTO) {
4954
+ titleClass = 'color-white';
4955
+ bgDemo = 'container bg-black';
4956
+ }
4957
+ return (index.h("div", { class: bgDemo }, index.h("div", { class: "row", hidden: this.imageLoaded == false }, index.h("div", { class: "div-ci align-center", hidden: this.showVideo }, index.h("img", { ref: el => (this.image = el) })), index.h("div", { hidden: this.showVideo == false }, index.h("video", { id: "howTo", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { class: "text-center" }, index.h("h1", { class: titleClass }, this.topTitle), index.h("p", { class: "font-size-2", hidden: this.subTitle == '' }, this.subTitle)), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { class: "main-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(), hidden: this.showVideo == true }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
4880
4958
  }
4881
4959
  };
4882
4960
  HowToInfo.style = howToInfoCss;
@@ -5031,6 +5109,7 @@ const IdCapture = class {
5031
5109
  this.eventPhotoCapture = index.createEvent(this, "photoIdCapture", 7);
5032
5110
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5033
5111
  this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
5112
+ this.guid = v4();
5034
5113
  this.videoStarted = undefined;
5035
5114
  this.cameraSize = undefined;
5036
5115
  this.captureTaken = undefined;
@@ -5048,7 +5127,7 @@ const IdCapture = class {
5048
5127
  }
5049
5128
  async componentWillLoad() {
5050
5129
  if (TranslationUtils.state.debug)
5051
- console.log('id-capture | componentWillLoad');
5130
+ console.log(`id-capture ${this.guid} | componentWillLoad`);
5052
5131
  this.translations = await TranslationUtils.Translations.getValues();
5053
5132
  if (!navigator.mediaDevices) {
5054
5133
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
@@ -5056,7 +5135,7 @@ const IdCapture = class {
5056
5135
  }
5057
5136
  initVariables() {
5058
5137
  if (TranslationUtils.state.debug)
5059
- console.log('id-capture | initVariables');
5138
+ console.log(`id-capture ${this.guid} | initVariables`);
5060
5139
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
5061
5140
  this.pose = IDPose.Straight;
5062
5141
  this.flowStep = TranslationUtils.FlowSteps.CiFrontCapture;
@@ -5078,7 +5157,7 @@ const IdCapture = class {
5078
5157
  }
5079
5158
  async componentDidLoad() {
5080
5159
  if (TranslationUtils.state.debug)
5081
- console.log('id-capture | componentDidLoad');
5160
+ console.log(`id-capture ${this.guid} | componentDidLoad`);
5082
5161
  this.initVariables();
5083
5162
  await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Initialized);
5084
5163
  this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[this.pose];
@@ -5089,7 +5168,7 @@ const IdCapture = class {
5089
5168
  }
5090
5169
  async openCamera() {
5091
5170
  if (TranslationUtils.state.debug)
5092
- console.log('id-capture | openCamera');
5171
+ console.log(`id-capture ${this.guid} | openCamera`);
5093
5172
  if (!TranslationUtils.state.cameraId) {
5094
5173
  await Cameras.InitCameras(TranslationUtils.state.device);
5095
5174
  }
@@ -5099,7 +5178,7 @@ const IdCapture = class {
5099
5178
  .getUserMedia(constraints)
5100
5179
  .then(stream => {
5101
5180
  if (TranslationUtils.state.debug)
5102
- console.log('id-capture | openCamera | streamObtained');
5181
+ console.log(`id-capture ${this.guid} | openCamera | streamObtained`);
5103
5182
  const superStream = Stream.getNewInstance(this.verificationMode);
5104
5183
  superStream.initStream(stream);
5105
5184
  })
@@ -5111,34 +5190,34 @@ const IdCapture = class {
5111
5190
  }
5112
5191
  closeCamera() {
5113
5192
  if (TranslationUtils.state.debug)
5114
- console.log('id-capture | closeCamera');
5193
+ console.log(`id-capture ${this.guid} | closeCamera`);
5115
5194
  if (Stream.instance) {
5116
5195
  Stream.instance.dropStream();
5117
5196
  }
5118
5197
  }
5119
5198
  disconnectedCallback() {
5120
- if (TranslationUtils.state.debug)
5121
- console.log('id-capture | disconnectedCallback');
5122
5199
  this.closeCamera();
5123
5200
  Stream.instance = null;
5124
5201
  IDML5Detector.instance = null;
5125
5202
  FaceML5Detector.instance = null;
5203
+ if (TranslationUtils.state.debug)
5204
+ console.log(`id-capture ${this.guid} | disconnectedCallback`);
5126
5205
  }
5127
5206
  async takePhoto() {
5128
5207
  if (TranslationUtils.state.debug)
5129
- console.log('id-capture | takePhoto');
5208
+ console.log(`id-capture ${this.guid} | takePhoto`);
5130
5209
  if (this.captureTaken)
5131
5210
  return;
5132
5211
  this.captureTaken = true;
5133
5212
  if (TranslationUtils.state.debug)
5134
- console.log('id-capture | takePhoto | sendingPhoto');
5213
+ console.log(`id-capture ${this.guid} | takePhoto | sendingPhoto`);
5135
5214
  let res = await Stream.instance.takePhoto();
5136
5215
  this.eventPhotoCapture.emit(res);
5137
5216
  await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Finalized);
5138
5217
  }
5139
5218
  async verificationFinished() {
5140
5219
  if (TranslationUtils.state.debug)
5141
- console.log('id-capture | verificationFinished');
5220
+ console.log(`id-capture ${this.guid} | verificationFinished`);
5142
5221
  if (this.verified)
5143
5222
  return;
5144
5223
  this.verified = true;
@@ -5169,73 +5248,8 @@ const IdCapture = class {
5169
5248
  };
5170
5249
  IdCapture.style = idCaptureCss;
5171
5250
 
5172
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
5173
- // require the crypto API and do not support built-in fallback to lower quality random number
5174
- // generators (like Math.random()).
5175
- let getRandomValues;
5176
- const rnds8 = new Uint8Array(16);
5177
- function rng() {
5178
- // lazy load so that environments that need to polyfill have a chance to do so
5179
- if (!getRandomValues) {
5180
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
5181
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
5182
-
5183
- if (!getRandomValues) {
5184
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
5185
- }
5186
- }
5187
-
5188
- return getRandomValues(rnds8);
5189
- }
5190
-
5191
- /**
5192
- * Convert array of 16 byte values to UUID string format of the form:
5193
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
5194
- */
5195
-
5196
- const byteToHex = [];
5197
-
5198
- for (let i = 0; i < 256; ++i) {
5199
- byteToHex.push((i + 0x100).toString(16).slice(1));
5200
- }
5201
-
5202
- function unsafeStringify(arr, offset = 0) {
5203
- // Note: Be careful editing this code! It's been tuned for performance
5204
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
5205
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
5206
- }
5207
-
5208
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
5209
- const native = {
5210
- randomUUID
5211
- };
5212
-
5213
- function v4(options, buf, offset) {
5214
- if (native.randomUUID && !buf && !options) {
5215
- return native.randomUUID();
5216
- }
5217
-
5218
- options = options || {};
5219
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5220
-
5221
- rnds[6] = rnds[6] & 0x0f | 0x40;
5222
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
5223
-
5224
- if (buf) {
5225
- offset = offset || 0;
5226
-
5227
- for (let i = 0; i < 16; ++i) {
5228
- buf[offset + i] = rnds[i];
5229
- }
5230
-
5231
- return buf;
5232
- }
5233
-
5234
- return unsafeStringify(rnds);
5235
- }
5236
-
5237
5251
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5238
- const version$1 = "3.6.73";
5252
+ const version$1 = "3.6.75";
5239
5253
  const description = "Person Identification Component";
5240
5254
  const main = "./dist/index.cjs.js";
5241
5255
  const module$1 = "./dist/index.js";
@@ -5,6 +5,7 @@ import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
5
5
  import { Translations } from '../../../helpers/TranslationUtils';
6
6
  import store from '../../../helpers/store';
7
7
  import { ApiCall } from '../../../helpers/ApiCall';
8
+ import { FlowStatus } from '../../../models/FlowStatus';
8
9
  export class CaptureError {
9
10
  constructor() { this.type = undefined; this.reason = undefined; this.buttonEnabled = undefined; this.buttonText = undefined; }
10
11
  async componentWillLoad() {
@@ -39,6 +40,10 @@ export class CaptureError {
39
40
  var nextState = await ApiCall.instance.GetNextStateForCaptureError();
40
41
  store.flowStatus = nextState;
41
42
  }
43
+ else if (this.reason == 'Invalid' && store.flowStatus == FlowStatus.IDBACK) {
44
+ var nextState = await ApiCall.instance.GetNextStateForCaptureError();
45
+ store.flowStatus = nextState;
46
+ }
42
47
  else {
43
48
  this.eventCaptureErrorDone.emit();
44
49
  }
@@ -11,10 +11,12 @@ import { IDPose } from '../../../libs/IDML5Detector/IDPose';
11
11
  export class HowToInfo {
12
12
  constructor() {
13
13
  this.loadImage = src => new Promise((resolve, reject) => {
14
- this.image.onload = () => resolve(this.image);
14
+ this.image.onload = () => {
15
+ this.imageLoaded = true;
16
+ resolve(this.image);
17
+ };
15
18
  this.image.onerror = reject;
16
19
  this.image.src = src;
17
- this.imageLoaded = true;
18
20
  });
19
21
  this.showVideo = undefined;
20
22
  this.topTitle = undefined;
@@ -70,7 +72,13 @@ export class HowToInfo {
70
72
  this.buttonText = this.translations.HowToValues.IdButton;
71
73
  }
72
74
  render() {
73
- return (h("div", { class: "container" }, h("div", { class: "row", hidden: store.flowStatus == FlowStatus.LIVENESSGESTUREHOWTO || this.imageLoaded == false }, h("div", { class: "div-ci align-center", hidden: this.showVideo }, h("img", { ref: el => (this.image = el) })), h("div", { hidden: this.showVideo == false }, h("video", { id: "howTo", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { class: "text-center" }, h("h1", null, this.topTitle), h("p", { class: "font-size-2", hidden: this.subTitle == '' }, this.subTitle)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(), hidden: this.showVideo == true }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
75
+ let titleClass = 'color-black-2';
76
+ let bgDemo = 'container';
77
+ if (store.flowStatus == FlowStatus.IDBACKHOWTO) {
78
+ titleClass = 'color-white';
79
+ bgDemo = 'container bg-black';
80
+ }
81
+ return (h("div", { class: bgDemo }, h("div", { class: "row", hidden: this.imageLoaded == false }, h("div", { class: "div-ci align-center", hidden: this.showVideo }, h("img", { ref: el => (this.image = el) })), h("div", { hidden: this.showVideo == false }, h("video", { id: "howTo", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { class: "text-center" }, h("h1", { class: titleClass }, this.topTitle), h("p", { class: "font-size-2", hidden: this.subTitle == '' }, this.subTitle)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(), hidden: this.showVideo == true }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
74
82
  }
75
83
  static get is() { return "how-to-info"; }
76
84
  static get originalStyleUrls() {
@@ -12,9 +12,11 @@ import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
12
12
  import { VerificationMode } from '../../../models/IVerificationMode';
13
13
  import { Translations } from '../../../helpers/TranslationUtils';
14
14
  import { FlowStatus } from '../../../models/FlowStatus';
15
+ import * as uuid from 'uuid';
15
16
  // import { IDPose } from '../../libs/IDML5Detector/IDPose';
16
17
  export class IdCapture {
17
18
  constructor() {
19
+ this.guid = uuid.v4();
18
20
  this.videoStarted = undefined;
19
21
  this.cameraSize = undefined;
20
22
  this.captureTaken = undefined;
@@ -32,7 +34,7 @@ export class IdCapture {
32
34
  }
33
35
  async componentWillLoad() {
34
36
  if (store.debug)
35
- console.log('id-capture | componentWillLoad');
37
+ console.log(`id-capture ${this.guid} | componentWillLoad`);
36
38
  this.translations = await Translations.getValues();
37
39
  if (!navigator.mediaDevices) {
38
40
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
@@ -40,7 +42,7 @@ export class IdCapture {
40
42
  }
41
43
  initVariables() {
42
44
  if (store.debug)
43
- console.log('id-capture | initVariables');
45
+ console.log(`id-capture ${this.guid} | initVariables`);
44
46
  if (store.flowStatus == FlowStatus.IDFRONT) {
45
47
  this.pose = IDPose.Straight;
46
48
  this.flowStep = FlowSteps.CiFrontCapture;
@@ -62,7 +64,7 @@ export class IdCapture {
62
64
  }
63
65
  async componentDidLoad() {
64
66
  if (store.debug)
65
- console.log('id-capture | componentDidLoad');
67
+ console.log(`id-capture ${this.guid} | componentDidLoad`);
66
68
  this.initVariables();
67
69
  await BaseComponent.logStep(this.flowStep, FlowMoments.Initialized);
68
70
  this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[this.pose];
@@ -73,7 +75,7 @@ export class IdCapture {
73
75
  }
74
76
  async openCamera() {
75
77
  if (store.debug)
76
- console.log('id-capture | openCamera');
78
+ console.log(`id-capture ${this.guid} | openCamera`);
77
79
  if (!store.cameraId) {
78
80
  await Cameras.InitCameras(store.device);
79
81
  }
@@ -83,7 +85,7 @@ export class IdCapture {
83
85
  .getUserMedia(constraints)
84
86
  .then(stream => {
85
87
  if (store.debug)
86
- console.log('id-capture | openCamera | streamObtained');
88
+ console.log(`id-capture ${this.guid} | openCamera | streamObtained`);
87
89
  const superStream = Stream.getNewInstance(this.verificationMode);
88
90
  superStream.initStream(stream);
89
91
  })
@@ -95,34 +97,34 @@ export class IdCapture {
95
97
  }
96
98
  closeCamera() {
97
99
  if (store.debug)
98
- console.log('id-capture | closeCamera');
100
+ console.log(`id-capture ${this.guid} | closeCamera`);
99
101
  if (Stream.instance) {
100
102
  Stream.instance.dropStream();
101
103
  }
102
104
  }
103
105
  disconnectedCallback() {
104
- if (store.debug)
105
- console.log('id-capture | disconnectedCallback');
106
106
  this.closeCamera();
107
107
  Stream.instance = null;
108
108
  IDML5Detector.instance = null;
109
109
  FaceML5Detector.instance = null;
110
+ if (store.debug)
111
+ console.log(`id-capture ${this.guid} | disconnectedCallback`);
110
112
  }
111
113
  async takePhoto() {
112
114
  if (store.debug)
113
- console.log('id-capture | takePhoto');
115
+ console.log(`id-capture ${this.guid} | takePhoto`);
114
116
  if (this.captureTaken)
115
117
  return;
116
118
  this.captureTaken = true;
117
119
  if (store.debug)
118
- console.log('id-capture | takePhoto | sendingPhoto');
120
+ console.log(`id-capture ${this.guid} | takePhoto | sendingPhoto`);
119
121
  let res = await Stream.instance.takePhoto();
120
122
  this.eventPhotoCapture.emit(res);
121
123
  await BaseComponent.logStep(this.flowStep, FlowMoments.Finalized);
122
124
  }
123
125
  async verificationFinished() {
124
126
  if (store.debug)
125
- console.log('id-capture | verificationFinished');
127
+ console.log(`id-capture ${this.guid} | verificationFinished`);
126
128
  if (this.verified)
127
129
  return;
128
130
  this.verified = true;
@@ -5,6 +5,7 @@ import { FacePosePick } from '../libs/FaceML5Detector/FacePose';
5
5
  import { addExifInImg } from './security';
6
6
  import store from './store';
7
7
  import { Browser, MobileOS } from '../models/IDevice';
8
+ import * as uuid from 'uuid';
8
9
  var ImageFormat;
9
10
  (function (ImageFormat) {
10
11
  ImageFormat["JPEG"] = "image/jpeg";
@@ -36,10 +37,11 @@ export class Stream {
36
37
  }
37
38
  constructor(mode) {
38
39
  this.streamPaused = false;
40
+ this.guid = uuid.v4();
39
41
  this.recordedChunks = [];
40
42
  this.videoSize = { width: 0, height: 0 };
41
43
  if (store.debug)
42
- console.log('stream | constructor');
44
+ console.log(`stream ${this.guid} | constructor`);
43
45
  this.initFacePose();
44
46
  this.idML5Detector = IDML5Detector.getInstance(this, store.device.isMobile);
45
47
  this.faceML5Detector = FaceML5Detector.getInstance(this, store.device.isMobile);
@@ -49,25 +51,25 @@ export class Stream {
49
51
  if (store.debug)
50
52
  console.log('stream | getNewInstance');
51
53
  if (!Stream.instance) {
52
- if (store.debug)
53
- console.log('stream | getNewInstance | new instance');
54
54
  Stream.instance = new Stream(mode);
55
+ if (store.debug)
56
+ console.log(`stream ${Stream.instance.guid} | getNewInstance | new instance`);
55
57
  }
56
58
  return Stream.instance;
57
59
  }
58
60
  autoCapturing() {
59
61
  if (store.debug)
60
- console.log('stream | autoCapturing');
62
+ console.log(`stream ${this.guid} | autoCapturing`);
61
63
  this.callbackAutoCapturing();
62
64
  }
63
65
  timeElapsed() {
64
66
  if (store.debug)
65
- console.log('stream | timeElapsed');
67
+ console.log(`stream ${this.guid} | timeElapsed`);
66
68
  this.callbackTimeElapsed();
67
69
  }
68
70
  verificationReady() {
69
71
  if (store.debug)
70
- console.log('stream | verificationReady');
72
+ console.log(`stream ${this.guid} | verificationReady`);
71
73
  this.verificationFinished();
72
74
  }
73
75
  updateHtmlElements(videoElement, canvasElement, component) {
@@ -78,7 +80,7 @@ export class Stream {
78
80
  }
79
81
  startStream(stream) {
80
82
  if (store.debug)
81
- console.log('stream | startStream');
83
+ console.log(`stream ${this.guid} | startStream`);
82
84
  if (this.stream)
83
85
  this.stream.getTracks().forEach((track) => track.stop());
84
86
  this.stream = stream;
@@ -111,7 +113,7 @@ export class Stream {
111
113
  }
112
114
  recordStream() {
113
115
  if (store.debug)
114
- console.log('stream | recordStream');
116
+ console.log(`stream ${this.guid} | recordStream`);
115
117
  if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
116
118
  return;
117
119
  var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
@@ -123,12 +125,12 @@ export class Stream {
123
125
  this.mediaRecorder = new MediaRecorder(this.stream, options);
124
126
  this.mediaRecorder.ondataavailable = event => {
125
127
  if (store.debug)
126
- console.log('stream | recordStream | ondataavailable');
128
+ console.log(`stream ${this.guid} | recordStream | ondataavailable`);
127
129
  this.recordedChunks.push(event.data);
128
130
  };
129
131
  this.mediaRecorder.onstop = _e => {
130
132
  if (store.debug)
131
- console.log('stream | recordStream | onstop');
133
+ console.log(`stream ${this.guid} | recordStream | onstop`);
132
134
  var rec = new Blob(this.recordedChunks, {
133
135
  type: options.mimeType.split(';')[0],
134
136
  });
@@ -160,7 +162,7 @@ export class Stream {
160
162
  }
161
163
  async takePhoto() {
162
164
  if (store.debug)
163
- console.log('stream | takePhoto');
165
+ console.log(`stream ${this.guid} | takePhoto`);
164
166
  const canvas = document.createElement('canvas');
165
167
  canvas.style.visibility = 'hidden';
166
168
  canvas.width = this.videoElement.videoWidth;
@@ -169,7 +171,7 @@ export class Stream {
169
171
  }
170
172
  getFrame(canvas) {
171
173
  if (store.debug)
172
- console.log('stream | getFrame');
174
+ console.log(`stream ${this.guid} | getFrame`);
173
175
  return new Promise(resolve => {
174
176
  const context = canvas.getContext('2d');
175
177
  context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
@@ -177,7 +179,7 @@ export class Stream {
177
179
  if (frame.type === ImageFormat.JPEG && !store.device.isAppleDevice) {
178
180
  try {
179
181
  if (store.debug)
180
- console.log('stream | getFrame | addExifInImg');
182
+ console.log(`stream ${this.guid} | getFrame | addExifInImg`);
181
183
  addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
182
184
  }
183
185
  catch (e) {
@@ -187,7 +189,7 @@ export class Stream {
187
189
  }
188
190
  else {
189
191
  if (store.debug)
190
- console.log('stream | getFrame | resolve');
192
+ console.log(`stream ${this.guid} | getFrame | resolve`);
191
193
  resolve(frame);
192
194
  }
193
195
  }, ImageFormat.PNG, 1);