@ekyc_qoobiss/qbs-ect-cmp 3.6.74 → 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);
@@ -4821,10 +4887,12 @@ const HowToInfo = class {
4821
4887
  index.registerInstance(this, hostRef);
4822
4888
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
4823
4889
  this.loadImage = src => new Promise((resolve, reject) => {
4824
- this.image.onload = () => resolve(this.image);
4890
+ this.image.onload = () => {
4891
+ this.imageLoaded = true;
4892
+ resolve(this.image);
4893
+ };
4825
4894
  this.image.onerror = reject;
4826
4895
  this.image.src = src;
4827
- this.imageLoaded = true;
4828
4896
  });
4829
4897
  this.showVideo = undefined;
4830
4898
  this.topTitle = undefined;
@@ -4880,13 +4948,13 @@ const HowToInfo = class {
4880
4948
  this.buttonText = this.translations.HowToValues.IdButton;
4881
4949
  }
4882
4950
  render() {
4883
- let titleClass = 'color-white text-center';
4951
+ let titleClass = 'color-black-2';
4884
4952
  let bgDemo = 'container';
4885
4953
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACKHOWTO) {
4886
- titleClass = 'color-black-2 text-center';
4954
+ titleClass = 'color-white';
4887
4955
  bgDemo = 'container bg-black';
4888
4956
  }
4889
- return (index.h("div", { class: bgDemo }, 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", { 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))))));
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))))));
4890
4958
  }
4891
4959
  };
4892
4960
  HowToInfo.style = howToInfoCss;
@@ -5041,6 +5109,7 @@ const IdCapture = class {
5041
5109
  this.eventPhotoCapture = index.createEvent(this, "photoIdCapture", 7);
5042
5110
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5043
5111
  this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
5112
+ this.guid = v4();
5044
5113
  this.videoStarted = undefined;
5045
5114
  this.cameraSize = undefined;
5046
5115
  this.captureTaken = undefined;
@@ -5058,7 +5127,7 @@ const IdCapture = class {
5058
5127
  }
5059
5128
  async componentWillLoad() {
5060
5129
  if (TranslationUtils.state.debug)
5061
- console.log('id-capture | componentWillLoad');
5130
+ console.log(`id-capture ${this.guid} | componentWillLoad`);
5062
5131
  this.translations = await TranslationUtils.Translations.getValues();
5063
5132
  if (!navigator.mediaDevices) {
5064
5133
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
@@ -5066,7 +5135,7 @@ const IdCapture = class {
5066
5135
  }
5067
5136
  initVariables() {
5068
5137
  if (TranslationUtils.state.debug)
5069
- console.log('id-capture | initVariables');
5138
+ console.log(`id-capture ${this.guid} | initVariables`);
5070
5139
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
5071
5140
  this.pose = IDPose.Straight;
5072
5141
  this.flowStep = TranslationUtils.FlowSteps.CiFrontCapture;
@@ -5088,7 +5157,7 @@ const IdCapture = class {
5088
5157
  }
5089
5158
  async componentDidLoad() {
5090
5159
  if (TranslationUtils.state.debug)
5091
- console.log('id-capture | componentDidLoad');
5160
+ console.log(`id-capture ${this.guid} | componentDidLoad`);
5092
5161
  this.initVariables();
5093
5162
  await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Initialized);
5094
5163
  this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[this.pose];
@@ -5099,7 +5168,7 @@ const IdCapture = class {
5099
5168
  }
5100
5169
  async openCamera() {
5101
5170
  if (TranslationUtils.state.debug)
5102
- console.log('id-capture | openCamera');
5171
+ console.log(`id-capture ${this.guid} | openCamera`);
5103
5172
  if (!TranslationUtils.state.cameraId) {
5104
5173
  await Cameras.InitCameras(TranslationUtils.state.device);
5105
5174
  }
@@ -5109,7 +5178,7 @@ const IdCapture = class {
5109
5178
  .getUserMedia(constraints)
5110
5179
  .then(stream => {
5111
5180
  if (TranslationUtils.state.debug)
5112
- console.log('id-capture | openCamera | streamObtained');
5181
+ console.log(`id-capture ${this.guid} | openCamera | streamObtained`);
5113
5182
  const superStream = Stream.getNewInstance(this.verificationMode);
5114
5183
  superStream.initStream(stream);
5115
5184
  })
@@ -5121,34 +5190,34 @@ const IdCapture = class {
5121
5190
  }
5122
5191
  closeCamera() {
5123
5192
  if (TranslationUtils.state.debug)
5124
- console.log('id-capture | closeCamera');
5193
+ console.log(`id-capture ${this.guid} | closeCamera`);
5125
5194
  if (Stream.instance) {
5126
5195
  Stream.instance.dropStream();
5127
5196
  }
5128
5197
  }
5129
5198
  disconnectedCallback() {
5130
- if (TranslationUtils.state.debug)
5131
- console.log('id-capture | disconnectedCallback');
5132
5199
  this.closeCamera();
5133
5200
  Stream.instance = null;
5134
5201
  IDML5Detector.instance = null;
5135
5202
  FaceML5Detector.instance = null;
5203
+ if (TranslationUtils.state.debug)
5204
+ console.log(`id-capture ${this.guid} | disconnectedCallback`);
5136
5205
  }
5137
5206
  async takePhoto() {
5138
5207
  if (TranslationUtils.state.debug)
5139
- console.log('id-capture | takePhoto');
5208
+ console.log(`id-capture ${this.guid} | takePhoto`);
5140
5209
  if (this.captureTaken)
5141
5210
  return;
5142
5211
  this.captureTaken = true;
5143
5212
  if (TranslationUtils.state.debug)
5144
- console.log('id-capture | takePhoto | sendingPhoto');
5213
+ console.log(`id-capture ${this.guid} | takePhoto | sendingPhoto`);
5145
5214
  let res = await Stream.instance.takePhoto();
5146
5215
  this.eventPhotoCapture.emit(res);
5147
5216
  await BaseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Finalized);
5148
5217
  }
5149
5218
  async verificationFinished() {
5150
5219
  if (TranslationUtils.state.debug)
5151
- console.log('id-capture | verificationFinished');
5220
+ console.log(`id-capture ${this.guid} | verificationFinished`);
5152
5221
  if (this.verified)
5153
5222
  return;
5154
5223
  this.verified = true;
@@ -5179,73 +5248,8 @@ const IdCapture = class {
5179
5248
  };
5180
5249
  IdCapture.style = idCaptureCss;
5181
5250
 
5182
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
5183
- // require the crypto API and do not support built-in fallback to lower quality random number
5184
- // generators (like Math.random()).
5185
- let getRandomValues;
5186
- const rnds8 = new Uint8Array(16);
5187
- function rng() {
5188
- // lazy load so that environments that need to polyfill have a chance to do so
5189
- if (!getRandomValues) {
5190
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
5191
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
5192
-
5193
- if (!getRandomValues) {
5194
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
5195
- }
5196
- }
5197
-
5198
- return getRandomValues(rnds8);
5199
- }
5200
-
5201
- /**
5202
- * Convert array of 16 byte values to UUID string format of the form:
5203
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
5204
- */
5205
-
5206
- const byteToHex = [];
5207
-
5208
- for (let i = 0; i < 256; ++i) {
5209
- byteToHex.push((i + 0x100).toString(16).slice(1));
5210
- }
5211
-
5212
- function unsafeStringify(arr, offset = 0) {
5213
- // Note: Be careful editing this code! It's been tuned for performance
5214
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
5215
- 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();
5216
- }
5217
-
5218
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
5219
- const native = {
5220
- randomUUID
5221
- };
5222
-
5223
- function v4(options, buf, offset) {
5224
- if (native.randomUUID && !buf && !options) {
5225
- return native.randomUUID();
5226
- }
5227
-
5228
- options = options || {};
5229
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5230
-
5231
- rnds[6] = rnds[6] & 0x0f | 0x40;
5232
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
5233
-
5234
- if (buf) {
5235
- offset = offset || 0;
5236
-
5237
- for (let i = 0; i < 16; ++i) {
5238
- buf[offset + i] = rnds[i];
5239
- }
5240
-
5241
- return buf;
5242
- }
5243
-
5244
- return unsafeStringify(rnds);
5245
- }
5246
-
5247
5251
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5248
- const version$1 = "3.6.74";
5252
+ const version$1 = "3.6.75";
5249
5253
  const description = "Person Identification Component";
5250
5254
  const main = "./dist/index.cjs.js";
5251
5255
  const module$1 = "./dist/index.js";
@@ -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,13 +72,13 @@ export class HowToInfo {
70
72
  this.buttonText = this.translations.HowToValues.IdButton;
71
73
  }
72
74
  render() {
73
- let titleClass = 'color-white text-center';
75
+ let titleClass = 'color-black-2';
74
76
  let bgDemo = 'container';
75
77
  if (store.flowStatus == FlowStatus.IDBACKHOWTO) {
76
- titleClass = 'color-black-2 text-center';
78
+ titleClass = 'color-white';
77
79
  bgDemo = 'container bg-black';
78
80
  }
79
- return (h("div", { class: bgDemo }, 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", { 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))))));
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))))));
80
82
  }
81
83
  static get is() { return "how-to-info"; }
82
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);