@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.
@@ -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);
@@ -4751,6 +4817,10 @@ const CaptureError = class {
4751
4817
  var nextState = await ApiCall.instance.GetNextStateForCaptureError();
4752
4818
  state.flowStatus = nextState;
4753
4819
  }
4820
+ else if (this.reason == 'Invalid' && state.flowStatus == FlowStatus.IDBACK) {
4821
+ var nextState = await ApiCall.instance.GetNextStateForCaptureError();
4822
+ state.flowStatus = nextState;
4823
+ }
4754
4824
  else {
4755
4825
  this.eventCaptureErrorDone.emit();
4756
4826
  }
@@ -4813,10 +4883,12 @@ const HowToInfo = class {
4813
4883
  registerInstance(this, hostRef);
4814
4884
  this.apiErrorEvent = createEvent(this, "apiError", 7);
4815
4885
  this.loadImage = src => new Promise((resolve, reject) => {
4816
- this.image.onload = () => resolve(this.image);
4886
+ this.image.onload = () => {
4887
+ this.imageLoaded = true;
4888
+ resolve(this.image);
4889
+ };
4817
4890
  this.image.onerror = reject;
4818
4891
  this.image.src = src;
4819
- this.imageLoaded = true;
4820
4892
  });
4821
4893
  this.showVideo = undefined;
4822
4894
  this.topTitle = undefined;
@@ -4872,7 +4944,13 @@ const HowToInfo = class {
4872
4944
  this.buttonText = this.translations.HowToValues.IdButton;
4873
4945
  }
4874
4946
  render() {
4875
- return (h("div", { class: "container" }, 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", 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))))));
4947
+ let titleClass = 'color-black-2';
4948
+ let bgDemo = 'container';
4949
+ if (state.flowStatus == FlowStatus.IDBACKHOWTO) {
4950
+ titleClass = 'color-white';
4951
+ bgDemo = 'container bg-black';
4952
+ }
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))))));
4876
4954
  }
4877
4955
  };
4878
4956
  HowToInfo.style = howToInfoCss;
@@ -5027,6 +5105,7 @@ const IdCapture = class {
5027
5105
  this.eventPhotoCapture = createEvent(this, "photoIdCapture", 7);
5028
5106
  this.apiErrorEvent = createEvent(this, "apiError", 7);
5029
5107
  this.eventTimeElapsed = createEvent(this, "timeElapsed", 7);
5108
+ this.guid = v4();
5030
5109
  this.videoStarted = undefined;
5031
5110
  this.cameraSize = undefined;
5032
5111
  this.captureTaken = undefined;
@@ -5044,7 +5123,7 @@ const IdCapture = class {
5044
5123
  }
5045
5124
  async componentWillLoad() {
5046
5125
  if (state.debug)
5047
- console.log('id-capture | componentWillLoad');
5126
+ console.log(`id-capture ${this.guid} | componentWillLoad`);
5048
5127
  this.translations = await Translations.getValues();
5049
5128
  if (!navigator.mediaDevices) {
5050
5129
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
@@ -5052,7 +5131,7 @@ const IdCapture = class {
5052
5131
  }
5053
5132
  initVariables() {
5054
5133
  if (state.debug)
5055
- console.log('id-capture | initVariables');
5134
+ console.log(`id-capture ${this.guid} | initVariables`);
5056
5135
  if (state.flowStatus == FlowStatus.IDFRONT) {
5057
5136
  this.pose = IDPose.Straight;
5058
5137
  this.flowStep = FlowSteps.CiFrontCapture;
@@ -5074,7 +5153,7 @@ const IdCapture = class {
5074
5153
  }
5075
5154
  async componentDidLoad() {
5076
5155
  if (state.debug)
5077
- console.log('id-capture | componentDidLoad');
5156
+ console.log(`id-capture ${this.guid} | componentDidLoad`);
5078
5157
  this.initVariables();
5079
5158
  await BaseComponent.logStep(this.flowStep, FlowMoments.Initialized);
5080
5159
  this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[this.pose];
@@ -5085,7 +5164,7 @@ const IdCapture = class {
5085
5164
  }
5086
5165
  async openCamera() {
5087
5166
  if (state.debug)
5088
- console.log('id-capture | openCamera');
5167
+ console.log(`id-capture ${this.guid} | openCamera`);
5089
5168
  if (!state.cameraId) {
5090
5169
  await Cameras.InitCameras(state.device);
5091
5170
  }
@@ -5095,7 +5174,7 @@ const IdCapture = class {
5095
5174
  .getUserMedia(constraints)
5096
5175
  .then(stream => {
5097
5176
  if (state.debug)
5098
- console.log('id-capture | openCamera | streamObtained');
5177
+ console.log(`id-capture ${this.guid} | openCamera | streamObtained`);
5099
5178
  const superStream = Stream.getNewInstance(this.verificationMode);
5100
5179
  superStream.initStream(stream);
5101
5180
  })
@@ -5107,34 +5186,34 @@ const IdCapture = class {
5107
5186
  }
5108
5187
  closeCamera() {
5109
5188
  if (state.debug)
5110
- console.log('id-capture | closeCamera');
5189
+ console.log(`id-capture ${this.guid} | closeCamera`);
5111
5190
  if (Stream.instance) {
5112
5191
  Stream.instance.dropStream();
5113
5192
  }
5114
5193
  }
5115
5194
  disconnectedCallback() {
5116
- if (state.debug)
5117
- console.log('id-capture | disconnectedCallback');
5118
5195
  this.closeCamera();
5119
5196
  Stream.instance = null;
5120
5197
  IDML5Detector.instance = null;
5121
5198
  FaceML5Detector.instance = null;
5199
+ if (state.debug)
5200
+ console.log(`id-capture ${this.guid} | disconnectedCallback`);
5122
5201
  }
5123
5202
  async takePhoto() {
5124
5203
  if (state.debug)
5125
- console.log('id-capture | takePhoto');
5204
+ console.log(`id-capture ${this.guid} | takePhoto`);
5126
5205
  if (this.captureTaken)
5127
5206
  return;
5128
5207
  this.captureTaken = true;
5129
5208
  if (state.debug)
5130
- console.log('id-capture | takePhoto | sendingPhoto');
5209
+ console.log(`id-capture ${this.guid} | takePhoto | sendingPhoto`);
5131
5210
  let res = await Stream.instance.takePhoto();
5132
5211
  this.eventPhotoCapture.emit(res);
5133
5212
  await BaseComponent.logStep(this.flowStep, FlowMoments.Finalized);
5134
5213
  }
5135
5214
  async verificationFinished() {
5136
5215
  if (state.debug)
5137
- console.log('id-capture | verificationFinished');
5216
+ console.log(`id-capture ${this.guid} | verificationFinished`);
5138
5217
  if (this.verified)
5139
5218
  return;
5140
5219
  this.verified = true;
@@ -5165,73 +5244,8 @@ const IdCapture = class {
5165
5244
  };
5166
5245
  IdCapture.style = idCaptureCss;
5167
5246
 
5168
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
5169
- // require the crypto API and do not support built-in fallback to lower quality random number
5170
- // generators (like Math.random()).
5171
- let getRandomValues;
5172
- const rnds8 = new Uint8Array(16);
5173
- function rng() {
5174
- // lazy load so that environments that need to polyfill have a chance to do so
5175
- if (!getRandomValues) {
5176
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
5177
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
5178
-
5179
- if (!getRandomValues) {
5180
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
5181
- }
5182
- }
5183
-
5184
- return getRandomValues(rnds8);
5185
- }
5186
-
5187
- /**
5188
- * Convert array of 16 byte values to UUID string format of the form:
5189
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
5190
- */
5191
-
5192
- const byteToHex = [];
5193
-
5194
- for (let i = 0; i < 256; ++i) {
5195
- byteToHex.push((i + 0x100).toString(16).slice(1));
5196
- }
5197
-
5198
- function unsafeStringify(arr, offset = 0) {
5199
- // Note: Be careful editing this code! It's been tuned for performance
5200
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
5201
- 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();
5202
- }
5203
-
5204
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
5205
- const native = {
5206
- randomUUID
5207
- };
5208
-
5209
- function v4(options, buf, offset) {
5210
- if (native.randomUUID && !buf && !options) {
5211
- return native.randomUUID();
5212
- }
5213
-
5214
- options = options || {};
5215
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5216
-
5217
- rnds[6] = rnds[6] & 0x0f | 0x40;
5218
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
5219
-
5220
- if (buf) {
5221
- offset = offset || 0;
5222
-
5223
- for (let i = 0; i < 16; ++i) {
5224
- buf[offset + i] = rnds[i];
5225
- }
5226
-
5227
- return buf;
5228
- }
5229
-
5230
- return unsafeStringify(rnds);
5231
- }
5232
-
5233
5247
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5234
- const version$1 = "3.6.73";
5248
+ const version$1 = "3.6.75";
5235
5249
  const description = "Person Identification Component";
5236
5250
  const main = "./dist/index.cjs.js";
5237
5251
  const module = "./dist/index.js";