@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.
@@ -4384,6 +4384,71 @@ var Browser;
4384
4384
  Browser["Unknown"] = "unknown";
4385
4385
  })(Browser || (Browser = {}));
4386
4386
 
4387
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
4388
+ // require the crypto API and do not support built-in fallback to lower quality random number
4389
+ // generators (like Math.random()).
4390
+ let getRandomValues;
4391
+ const rnds8 = new Uint8Array(16);
4392
+ function rng() {
4393
+ // lazy load so that environments that need to polyfill have a chance to do so
4394
+ if (!getRandomValues) {
4395
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
4396
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
4397
+
4398
+ if (!getRandomValues) {
4399
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
4400
+ }
4401
+ }
4402
+
4403
+ return getRandomValues(rnds8);
4404
+ }
4405
+
4406
+ /**
4407
+ * Convert array of 16 byte values to UUID string format of the form:
4408
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4409
+ */
4410
+
4411
+ const byteToHex = [];
4412
+
4413
+ for (let i = 0; i < 256; ++i) {
4414
+ byteToHex.push((i + 0x100).toString(16).slice(1));
4415
+ }
4416
+
4417
+ function unsafeStringify(arr, offset = 0) {
4418
+ // Note: Be careful editing this code! It's been tuned for performance
4419
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4420
+ 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();
4421
+ }
4422
+
4423
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4424
+ const native = {
4425
+ randomUUID
4426
+ };
4427
+
4428
+ function v4(options, buf, offset) {
4429
+ if (native.randomUUID && !buf && !options) {
4430
+ return native.randomUUID();
4431
+ }
4432
+
4433
+ options = options || {};
4434
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4435
+
4436
+ rnds[6] = rnds[6] & 0x0f | 0x40;
4437
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
4438
+
4439
+ if (buf) {
4440
+ offset = offset || 0;
4441
+
4442
+ for (let i = 0; i < 16; ++i) {
4443
+ buf[offset + i] = rnds[i];
4444
+ }
4445
+
4446
+ return buf;
4447
+ }
4448
+
4449
+ return unsafeStringify(rnds);
4450
+ }
4451
+
4387
4452
  var ImageFormat;
4388
4453
  (function (ImageFormat) {
4389
4454
  ImageFormat["JPEG"] = "image/jpeg";
@@ -4415,10 +4480,11 @@ class Stream {
4415
4480
  }
4416
4481
  constructor(mode) {
4417
4482
  this.streamPaused = false;
4483
+ this.guid = v4();
4418
4484
  this.recordedChunks = [];
4419
4485
  this.videoSize = { width: 0, height: 0 };
4420
4486
  if (state.debug)
4421
- console.log('stream | constructor');
4487
+ console.log(`stream ${this.guid} | constructor`);
4422
4488
  this.initFacePose();
4423
4489
  this.idML5Detector = IDML5Detector.getInstance(this, state.device.isMobile);
4424
4490
  this.faceML5Detector = FaceML5Detector.getInstance(this, state.device.isMobile);
@@ -4428,25 +4494,25 @@ class Stream {
4428
4494
  if (state.debug)
4429
4495
  console.log('stream | getNewInstance');
4430
4496
  if (!Stream.instance) {
4431
- if (state.debug)
4432
- console.log('stream | getNewInstance | new instance');
4433
4497
  Stream.instance = new Stream(mode);
4498
+ if (state.debug)
4499
+ console.log(`stream ${Stream.instance.guid} | getNewInstance | new instance`);
4434
4500
  }
4435
4501
  return Stream.instance;
4436
4502
  }
4437
4503
  autoCapturing() {
4438
4504
  if (state.debug)
4439
- console.log('stream | autoCapturing');
4505
+ console.log(`stream ${this.guid} | autoCapturing`);
4440
4506
  this.callbackAutoCapturing();
4441
4507
  }
4442
4508
  timeElapsed() {
4443
4509
  if (state.debug)
4444
- console.log('stream | timeElapsed');
4510
+ console.log(`stream ${this.guid} | timeElapsed`);
4445
4511
  this.callbackTimeElapsed();
4446
4512
  }
4447
4513
  verificationReady() {
4448
4514
  if (state.debug)
4449
- console.log('stream | verificationReady');
4515
+ console.log(`stream ${this.guid} | verificationReady`);
4450
4516
  this.verificationFinished();
4451
4517
  }
4452
4518
  updateHtmlElements(videoElement, canvasElement, component) {
@@ -4457,7 +4523,7 @@ class Stream {
4457
4523
  }
4458
4524
  startStream(stream) {
4459
4525
  if (state.debug)
4460
- console.log('stream | startStream');
4526
+ console.log(`stream ${this.guid} | startStream`);
4461
4527
  if (this.stream)
4462
4528
  this.stream.getTracks().forEach((track) => track.stop());
4463
4529
  this.stream = stream;
@@ -4490,7 +4556,7 @@ class Stream {
4490
4556
  }
4491
4557
  recordStream() {
4492
4558
  if (state.debug)
4493
- console.log('stream | recordStream');
4559
+ console.log(`stream ${this.guid} | recordStream`);
4494
4560
  if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
4495
4561
  return;
4496
4562
  var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
@@ -4502,12 +4568,12 @@ class Stream {
4502
4568
  this.mediaRecorder = new MediaRecorder(this.stream, options);
4503
4569
  this.mediaRecorder.ondataavailable = event => {
4504
4570
  if (state.debug)
4505
- console.log('stream | recordStream | ondataavailable');
4571
+ console.log(`stream ${this.guid} | recordStream | ondataavailable`);
4506
4572
  this.recordedChunks.push(event.data);
4507
4573
  };
4508
4574
  this.mediaRecorder.onstop = _e => {
4509
4575
  if (state.debug)
4510
- console.log('stream | recordStream | onstop');
4576
+ console.log(`stream ${this.guid} | recordStream | onstop`);
4511
4577
  var rec = new Blob(this.recordedChunks, {
4512
4578
  type: options.mimeType.split(';')[0],
4513
4579
  });
@@ -4539,7 +4605,7 @@ class Stream {
4539
4605
  }
4540
4606
  async takePhoto() {
4541
4607
  if (state.debug)
4542
- console.log('stream | takePhoto');
4608
+ console.log(`stream ${this.guid} | takePhoto`);
4543
4609
  const canvas = document.createElement('canvas');
4544
4610
  canvas.style.visibility = 'hidden';
4545
4611
  canvas.width = this.videoElement.videoWidth;
@@ -4548,7 +4614,7 @@ class Stream {
4548
4614
  }
4549
4615
  getFrame(canvas) {
4550
4616
  if (state.debug)
4551
- console.log('stream | getFrame');
4617
+ console.log(`stream ${this.guid} | getFrame`);
4552
4618
  return new Promise(resolve => {
4553
4619
  const context = canvas.getContext('2d');
4554
4620
  context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
@@ -4556,7 +4622,7 @@ class Stream {
4556
4622
  if (frame.type === ImageFormat.JPEG && !state.device.isAppleDevice) {
4557
4623
  try {
4558
4624
  if (state.debug)
4559
- console.log('stream | getFrame | addExifInImg');
4625
+ console.log(`stream ${this.guid} | getFrame | addExifInImg`);
4560
4626
  addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
4561
4627
  }
4562
4628
  catch (e) {
@@ -4566,7 +4632,7 @@ class Stream {
4566
4632
  }
4567
4633
  else {
4568
4634
  if (state.debug)
4569
- console.log('stream | getFrame | resolve');
4635
+ console.log(`stream ${this.guid} | getFrame | resolve`);
4570
4636
  resolve(frame);
4571
4637
  }
4572
4638
  }, ImageFormat.PNG, 1);
@@ -4817,10 +4883,12 @@ const HowToInfo = class {
4817
4883
  registerInstance(this, hostRef);
4818
4884
  this.apiErrorEvent = createEvent(this, "apiError", 7);
4819
4885
  this.loadImage = src => new Promise((resolve, reject) => {
4820
- this.image.onload = () => resolve(this.image);
4886
+ this.image.onload = () => {
4887
+ this.imageLoaded = true;
4888
+ resolve(this.image);
4889
+ };
4821
4890
  this.image.onerror = reject;
4822
4891
  this.image.src = src;
4823
- this.imageLoaded = true;
4824
4892
  });
4825
4893
  this.showVideo = undefined;
4826
4894
  this.topTitle = undefined;
@@ -4876,13 +4944,13 @@ const HowToInfo = class {
4876
4944
  this.buttonText = this.translations.HowToValues.IdButton;
4877
4945
  }
4878
4946
  render() {
4879
- let titleClass = 'color-white text-center';
4947
+ let titleClass = 'color-black-2';
4880
4948
  let bgDemo = 'container';
4881
4949
  if (state.flowStatus == FlowStatus.IDBACKHOWTO) {
4882
- titleClass = 'color-black-2 text-center';
4950
+ titleClass = 'color-white';
4883
4951
  bgDemo = 'container bg-black';
4884
4952
  }
4885
- return (h("div", { class: bgDemo }, h("div", { class: "row", hidden: state.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))))));
4953
+ 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))))));
4886
4954
  }
4887
4955
  };
4888
4956
  HowToInfo.style = howToInfoCss;
@@ -5037,6 +5105,7 @@ const IdCapture = class {
5037
5105
  this.eventPhotoCapture = createEvent(this, "photoIdCapture", 7);
5038
5106
  this.apiErrorEvent = createEvent(this, "apiError", 7);
5039
5107
  this.eventTimeElapsed = createEvent(this, "timeElapsed", 7);
5108
+ this.guid = v4();
5040
5109
  this.videoStarted = undefined;
5041
5110
  this.cameraSize = undefined;
5042
5111
  this.captureTaken = undefined;
@@ -5054,7 +5123,7 @@ const IdCapture = class {
5054
5123
  }
5055
5124
  async componentWillLoad() {
5056
5125
  if (state.debug)
5057
- console.log('id-capture | componentWillLoad');
5126
+ console.log(`id-capture ${this.guid} | componentWillLoad`);
5058
5127
  this.translations = await Translations.getValues();
5059
5128
  if (!navigator.mediaDevices) {
5060
5129
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
@@ -5062,7 +5131,7 @@ const IdCapture = class {
5062
5131
  }
5063
5132
  initVariables() {
5064
5133
  if (state.debug)
5065
- console.log('id-capture | initVariables');
5134
+ console.log(`id-capture ${this.guid} | initVariables`);
5066
5135
  if (state.flowStatus == FlowStatus.IDFRONT) {
5067
5136
  this.pose = IDPose.Straight;
5068
5137
  this.flowStep = FlowSteps.CiFrontCapture;
@@ -5084,7 +5153,7 @@ const IdCapture = class {
5084
5153
  }
5085
5154
  async componentDidLoad() {
5086
5155
  if (state.debug)
5087
- console.log('id-capture | componentDidLoad');
5156
+ console.log(`id-capture ${this.guid} | componentDidLoad`);
5088
5157
  this.initVariables();
5089
5158
  await BaseComponent.logStep(this.flowStep, FlowMoments.Initialized);
5090
5159
  this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[this.pose];
@@ -5095,7 +5164,7 @@ const IdCapture = class {
5095
5164
  }
5096
5165
  async openCamera() {
5097
5166
  if (state.debug)
5098
- console.log('id-capture | openCamera');
5167
+ console.log(`id-capture ${this.guid} | openCamera`);
5099
5168
  if (!state.cameraId) {
5100
5169
  await Cameras.InitCameras(state.device);
5101
5170
  }
@@ -5105,7 +5174,7 @@ const IdCapture = class {
5105
5174
  .getUserMedia(constraints)
5106
5175
  .then(stream => {
5107
5176
  if (state.debug)
5108
- console.log('id-capture | openCamera | streamObtained');
5177
+ console.log(`id-capture ${this.guid} | openCamera | streamObtained`);
5109
5178
  const superStream = Stream.getNewInstance(this.verificationMode);
5110
5179
  superStream.initStream(stream);
5111
5180
  })
@@ -5117,34 +5186,34 @@ const IdCapture = class {
5117
5186
  }
5118
5187
  closeCamera() {
5119
5188
  if (state.debug)
5120
- console.log('id-capture | closeCamera');
5189
+ console.log(`id-capture ${this.guid} | closeCamera`);
5121
5190
  if (Stream.instance) {
5122
5191
  Stream.instance.dropStream();
5123
5192
  }
5124
5193
  }
5125
5194
  disconnectedCallback() {
5126
- if (state.debug)
5127
- console.log('id-capture | disconnectedCallback');
5128
5195
  this.closeCamera();
5129
5196
  Stream.instance = null;
5130
5197
  IDML5Detector.instance = null;
5131
5198
  FaceML5Detector.instance = null;
5199
+ if (state.debug)
5200
+ console.log(`id-capture ${this.guid} | disconnectedCallback`);
5132
5201
  }
5133
5202
  async takePhoto() {
5134
5203
  if (state.debug)
5135
- console.log('id-capture | takePhoto');
5204
+ console.log(`id-capture ${this.guid} | takePhoto`);
5136
5205
  if (this.captureTaken)
5137
5206
  return;
5138
5207
  this.captureTaken = true;
5139
5208
  if (state.debug)
5140
- console.log('id-capture | takePhoto | sendingPhoto');
5209
+ console.log(`id-capture ${this.guid} | takePhoto | sendingPhoto`);
5141
5210
  let res = await Stream.instance.takePhoto();
5142
5211
  this.eventPhotoCapture.emit(res);
5143
5212
  await BaseComponent.logStep(this.flowStep, FlowMoments.Finalized);
5144
5213
  }
5145
5214
  async verificationFinished() {
5146
5215
  if (state.debug)
5147
- console.log('id-capture | verificationFinished');
5216
+ console.log(`id-capture ${this.guid} | verificationFinished`);
5148
5217
  if (this.verified)
5149
5218
  return;
5150
5219
  this.verified = true;
@@ -5175,73 +5244,8 @@ const IdCapture = class {
5175
5244
  };
5176
5245
  IdCapture.style = idCaptureCss;
5177
5246
 
5178
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
5179
- // require the crypto API and do not support built-in fallback to lower quality random number
5180
- // generators (like Math.random()).
5181
- let getRandomValues;
5182
- const rnds8 = new Uint8Array(16);
5183
- function rng() {
5184
- // lazy load so that environments that need to polyfill have a chance to do so
5185
- if (!getRandomValues) {
5186
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
5187
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
5188
-
5189
- if (!getRandomValues) {
5190
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
5191
- }
5192
- }
5193
-
5194
- return getRandomValues(rnds8);
5195
- }
5196
-
5197
- /**
5198
- * Convert array of 16 byte values to UUID string format of the form:
5199
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
5200
- */
5201
-
5202
- const byteToHex = [];
5203
-
5204
- for (let i = 0; i < 256; ++i) {
5205
- byteToHex.push((i + 0x100).toString(16).slice(1));
5206
- }
5207
-
5208
- function unsafeStringify(arr, offset = 0) {
5209
- // Note: Be careful editing this code! It's been tuned for performance
5210
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
5211
- 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();
5212
- }
5213
-
5214
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
5215
- const native = {
5216
- randomUUID
5217
- };
5218
-
5219
- function v4(options, buf, offset) {
5220
- if (native.randomUUID && !buf && !options) {
5221
- return native.randomUUID();
5222
- }
5223
-
5224
- options = options || {};
5225
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5226
-
5227
- rnds[6] = rnds[6] & 0x0f | 0x40;
5228
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
5229
-
5230
- if (buf) {
5231
- offset = offset || 0;
5232
-
5233
- for (let i = 0; i < 16; ++i) {
5234
- buf[offset + i] = rnds[i];
5235
- }
5236
-
5237
- return buf;
5238
- }
5239
-
5240
- return unsafeStringify(rnds);
5241
- }
5242
-
5243
5247
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5244
- const version$1 = "3.6.74";
5248
+ const version$1 = "3.6.75";
5245
5249
  const description = "Person Identification Component";
5246
5250
  const main = "./dist/index.cjs.js";
5247
5251
  const module = "./dist/index.js";