@ekyc_qoobiss/qbs-ect-cmp 2.1.14 → 2.1.16

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.
@@ -5171,122 +5171,6 @@ const Camera = class {
5171
5171
  };
5172
5172
  Camera.style = cameraCss;
5173
5173
 
5174
- class Cameras {
5175
- async GetCameras(deviceInfo) {
5176
- var allDevices = [];
5177
- const devices = await navigator.mediaDevices.enumerateDevices();
5178
- const videoDevices = devices.filter(device => device.kind === 'videoinput');
5179
- for (const device of videoDevices) {
5180
- const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5181
- const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5182
- stream.getVideoTracks().forEach(track => {
5183
- if (deviceInfo.isFirefox) {
5184
- const settings = track.getSettings();
5185
- let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5186
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5187
- allDevices.push({
5188
- deviceId: device.deviceId,
5189
- name: device.label,
5190
- height: settings.height,
5191
- width: settings.width,
5192
- frameRate: Number(settings.frameRate.max),
5193
- torch: false,
5194
- recommended: false,
5195
- facingMode: facingMode,
5196
- });
5197
- }
5198
- else {
5199
- const capabilities = track.getCapabilities();
5200
- let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5201
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5202
- allDevices.push({
5203
- deviceId: device.deviceId,
5204
- name: device.label,
5205
- height: capabilities.height.max,
5206
- width: capabilities.width.max,
5207
- frameRate: Number(capabilities.frameRate.max),
5208
- torch: capabilities.torch,
5209
- recommended: false,
5210
- facingMode: facingMode,
5211
- });
5212
- }
5213
- });
5214
- stream.getTracks().forEach(track => {
5215
- track.stop();
5216
- });
5217
- }
5218
- if (allDevices.length > 0) {
5219
- allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5220
- var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5221
- if (firstOption) {
5222
- allDevices[allDevices.indexOf(firstOption)].recommended = true;
5223
- }
5224
- else {
5225
- var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5226
- if (firstEnv) {
5227
- allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5228
- }
5229
- }
5230
- }
5231
- return allDevices;
5232
- }
5233
- GetConstraints(selectedDeviceId, device, portrait = false) {
5234
- let constraints = {
5235
- audio: false,
5236
- video: {
5237
- frameRate: 30,
5238
- },
5239
- };
5240
- if (selectedDeviceId) {
5241
- constraints.video.deviceId = {
5242
- exact: selectedDeviceId,
5243
- };
5244
- }
5245
- if (device.isWin) {
5246
- constraints.video.width = { ideal: 1280 };
5247
- }
5248
- else {
5249
- if (portrait) {
5250
- constraints.video.facingMode = 'user';
5251
- constraints.video.width = { ideal: 1280 };
5252
- constraints.video.height = { ideal: 720 };
5253
- }
5254
- else {
5255
- constraints.video.facingMode = 'environment';
5256
- constraints.video.width = { ideal: 1280 };
5257
- constraints.video.aspectRatio = 1;
5258
- }
5259
- }
5260
- return constraints;
5261
- }
5262
- GetRecommendedCamera(cameras) {
5263
- if (cameras && cameras.length > 0) {
5264
- var recommDevice = cameras.find(c => c.recommended);
5265
- if (recommDevice) {
5266
- return recommDevice;
5267
- }
5268
- }
5269
- return null;
5270
- }
5271
- static async InitCameras(device) {
5272
- try {
5273
- let cam = new Cameras();
5274
- let cameras = await cam.GetCameras(device);
5275
- var recommCamera = cam.GetRecommendedCamera(cameras);
5276
- state.cameraIds = cameras.map(camera => camera.deviceId);
5277
- state.cameraId = recommCamera.deviceId;
5278
- return true;
5279
- }
5280
- catch (e) {
5281
- console.log(e);
5282
- if (e.message.includes('Permission denied') || e.name.includes('NotAllowedError')) {
5283
- return false;
5284
- }
5285
- throw e;
5286
- }
5287
- }
5288
- }
5289
-
5290
5174
  const cameraErrorCss = "";
5291
5175
 
5292
5176
  const CameraError = class {
@@ -5307,35 +5191,24 @@ const CameraError = class {
5307
5191
  this.buttonText = CameraErrorValues.Button;
5308
5192
  }
5309
5193
  async componentDidLoad() {
5194
+ if (!this.device.isIos) {
5195
+ this.demoVideo.src = CameraErrorValues.HowToLink;
5196
+ this.demoVideo.loop = true;
5197
+ this.demoVideo.play();
5198
+ }
5310
5199
  try {
5311
5200
  await this.apiCall.AddStep(FlowSteps.CameraError);
5312
5201
  }
5313
5202
  catch (e) {
5314
5203
  this.apiErrorEvent.emit(e);
5315
5204
  }
5316
- if (!this.device.isIos) {
5317
- this.demoVideo.src = CameraErrorValues.HowToLink;
5318
- this.demoVideo.loop = true;
5319
- this.demoVideo.play();
5320
- }
5321
5205
  }
5322
5206
  async buttonClick() {
5323
5207
  this.buttonDisabled = true;
5324
5208
  if (this.device.isIos) {
5325
5209
  window.location.reload();
5326
5210
  }
5327
- if (!(await Cameras.InitCameras(this.device))) {
5328
- this.buttonDisabled = false;
5329
- }
5330
- else if (state.agreementsValidation) {
5331
- state.flowStatus = FlowStatus.AGREEMENT;
5332
- }
5333
- else if (state.phoneValidation) {
5334
- state.flowStatus = FlowStatus.PHONE;
5335
- }
5336
- else {
5337
- state.flowStatus = FlowStatus.ID;
5338
- }
5211
+ state.flowStatus = FlowStatus.LANDING;
5339
5212
  }
5340
5213
  render() {
5341
5214
  return (index.h("div", { class: "container" }, index.h("div", { class: "row" }, index.h("h1", { class: "color-red" }, this.title), index.h("div", null, index.h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.description)), index.h("div", { hidden: this.device.isIos }, index.h("video", { id: "howtoPermissions", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { class: "main-button", type: "button", disabled: this.buttonDisabled, onClick: () => this.buttonClick() }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, CameraErrorValues.FooterText))))));
@@ -5525,6 +5398,122 @@ const HowToInfo = class {
5525
5398
  };
5526
5399
  HowToInfo.style = howToInfoCss;
5527
5400
 
5401
+ class Cameras {
5402
+ async GetCameras(deviceInfo) {
5403
+ var allDevices = [];
5404
+ const devices = await navigator.mediaDevices.enumerateDevices();
5405
+ const videoDevices = devices.filter(device => device.kind === 'videoinput');
5406
+ for (const device of videoDevices) {
5407
+ const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5408
+ const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5409
+ stream.getVideoTracks().forEach(track => {
5410
+ if (deviceInfo.isFirefox) {
5411
+ const settings = track.getSettings();
5412
+ let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5413
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5414
+ allDevices.push({
5415
+ deviceId: device.deviceId,
5416
+ name: device.label,
5417
+ height: settings.height,
5418
+ width: settings.width,
5419
+ frameRate: Number(settings.frameRate.max),
5420
+ torch: false,
5421
+ recommended: false,
5422
+ facingMode: facingMode,
5423
+ });
5424
+ }
5425
+ else {
5426
+ const capabilities = track.getCapabilities();
5427
+ let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5428
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5429
+ allDevices.push({
5430
+ deviceId: device.deviceId,
5431
+ name: device.label,
5432
+ height: capabilities.height.max,
5433
+ width: capabilities.width.max,
5434
+ frameRate: Number(capabilities.frameRate.max),
5435
+ torch: capabilities.torch,
5436
+ recommended: false,
5437
+ facingMode: facingMode,
5438
+ });
5439
+ }
5440
+ });
5441
+ stream.getTracks().forEach(track => {
5442
+ track.stop();
5443
+ });
5444
+ }
5445
+ if (allDevices.length > 0) {
5446
+ allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5447
+ var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5448
+ if (firstOption) {
5449
+ allDevices[allDevices.indexOf(firstOption)].recommended = true;
5450
+ }
5451
+ else {
5452
+ var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5453
+ if (firstEnv) {
5454
+ allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5455
+ }
5456
+ }
5457
+ }
5458
+ return allDevices;
5459
+ }
5460
+ GetConstraints(selectedDeviceId, device, portrait = false) {
5461
+ let constraints = {
5462
+ audio: false,
5463
+ video: {
5464
+ frameRate: 30,
5465
+ },
5466
+ };
5467
+ if (selectedDeviceId) {
5468
+ constraints.video.deviceId = {
5469
+ exact: selectedDeviceId,
5470
+ };
5471
+ }
5472
+ if (device.isWin) {
5473
+ constraints.video.width = { ideal: 1280 };
5474
+ }
5475
+ else {
5476
+ if (portrait) {
5477
+ constraints.video.facingMode = 'user';
5478
+ constraints.video.width = { ideal: 1280 };
5479
+ constraints.video.height = { ideal: 720 };
5480
+ }
5481
+ else {
5482
+ constraints.video.facingMode = 'environment';
5483
+ constraints.video.width = { ideal: 1280 };
5484
+ constraints.video.aspectRatio = 1;
5485
+ }
5486
+ }
5487
+ return constraints;
5488
+ }
5489
+ GetRecommendedCamera(cameras) {
5490
+ if (cameras && cameras.length > 0) {
5491
+ var recommDevice = cameras.find(c => c.recommended);
5492
+ if (recommDevice) {
5493
+ return recommDevice;
5494
+ }
5495
+ }
5496
+ return null;
5497
+ }
5498
+ static async InitCameras(device) {
5499
+ try {
5500
+ let cam = new Cameras();
5501
+ let cameras = await cam.GetCameras(device);
5502
+ var recommCamera = cam.GetRecommendedCamera(cameras);
5503
+ state.cameraIds = cameras.map(camera => camera.deviceId);
5504
+ state.cameraId = recommCamera.deviceId;
5505
+ return true;
5506
+ }
5507
+ catch (e) {
5508
+ console.log(e);
5509
+ if (e.message.includes('Permission denied') || e.name.includes('NotAllowedError')) {
5510
+ return false;
5511
+ }
5512
+ throw e;
5513
+ }
5514
+ }
5515
+ }
5516
+
5528
5517
  const idBackCaptureCss = ".logo{max-height:450px;max-width:450px}.canvas-on-video{max-width:100%;max-height:100%;position:absolute;z-index:2;transform:scale(-1, 1)}";
5529
5518
 
5530
5519
  const IdBackCapture = class {
@@ -6175,7 +6164,7 @@ function v4(options, buf, offset) {
6175
6164
  }
6176
6165
 
6177
6166
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
6178
- const version$1 = "2.1.14";
6167
+ const version$1 = "2.1.16";
6179
6168
  const description = "Person Identification Component";
6180
6169
  const main = "./dist/index.cjs.js";
6181
6170
  const module$1 = "./dist/index.js";
@@ -2,7 +2,6 @@ import { h } from '@stencil/core';
2
2
  import { CameraErrorValues } from '../../../helpers/textValues';
3
3
  import store from '../../../helpers/store';
4
4
  import { FlowStatus } from '../../../models/FlowStatus';
5
- import { Cameras } from '../../../helpers/Cameras';
6
5
  import { ApiCall } from '../../../helpers/ApiCall';
7
6
  import { FlowSteps } from '../../../models/FlowSteps';
8
7
  export class CameraError {
@@ -21,35 +20,24 @@ export class CameraError {
21
20
  this.buttonText = CameraErrorValues.Button;
22
21
  }
23
22
  async componentDidLoad() {
23
+ if (!this.device.isIos) {
24
+ this.demoVideo.src = CameraErrorValues.HowToLink;
25
+ this.demoVideo.loop = true;
26
+ this.demoVideo.play();
27
+ }
24
28
  try {
25
29
  await this.apiCall.AddStep(FlowSteps.CameraError);
26
30
  }
27
31
  catch (e) {
28
32
  this.apiErrorEvent.emit(e);
29
33
  }
30
- if (!this.device.isIos) {
31
- this.demoVideo.src = CameraErrorValues.HowToLink;
32
- this.demoVideo.loop = true;
33
- this.demoVideo.play();
34
- }
35
34
  }
36
35
  async buttonClick() {
37
36
  this.buttonDisabled = true;
38
37
  if (this.device.isIos) {
39
38
  window.location.reload();
40
39
  }
41
- if (!(await Cameras.InitCameras(this.device))) {
42
- this.buttonDisabled = false;
43
- }
44
- else if (store.agreementsValidation) {
45
- store.flowStatus = FlowStatus.AGREEMENT;
46
- }
47
- else if (store.phoneValidation) {
48
- store.flowStatus = FlowStatus.PHONE;
49
- }
50
- else {
51
- store.flowStatus = FlowStatus.ID;
52
- }
40
+ store.flowStatus = FlowStatus.LANDING;
53
41
  }
54
42
  render() {
55
43
  return (h("div", { class: "container" }, h("div", { class: "row" }, h("h1", { class: "color-red" }, this.title), h("div", null, h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.description)), h("div", { hidden: this.device.isIos }, h("video", { id: "howtoPermissions", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: this.buttonDisabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, CameraErrorValues.FooterText))))));
@@ -5167,122 +5167,6 @@ const Camera = class {
5167
5167
  };
5168
5168
  Camera.style = cameraCss;
5169
5169
 
5170
- class Cameras {
5171
- async GetCameras(deviceInfo) {
5172
- var allDevices = [];
5173
- const devices = await navigator.mediaDevices.enumerateDevices();
5174
- const videoDevices = devices.filter(device => device.kind === 'videoinput');
5175
- for (const device of videoDevices) {
5176
- const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5177
- const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5178
- stream.getVideoTracks().forEach(track => {
5179
- if (deviceInfo.isFirefox) {
5180
- const settings = track.getSettings();
5181
- let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5182
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5183
- allDevices.push({
5184
- deviceId: device.deviceId,
5185
- name: device.label,
5186
- height: settings.height,
5187
- width: settings.width,
5188
- frameRate: Number(settings.frameRate.max),
5189
- torch: false,
5190
- recommended: false,
5191
- facingMode: facingMode,
5192
- });
5193
- }
5194
- else {
5195
- const capabilities = track.getCapabilities();
5196
- let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5197
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5198
- allDevices.push({
5199
- deviceId: device.deviceId,
5200
- name: device.label,
5201
- height: capabilities.height.max,
5202
- width: capabilities.width.max,
5203
- frameRate: Number(capabilities.frameRate.max),
5204
- torch: capabilities.torch,
5205
- recommended: false,
5206
- facingMode: facingMode,
5207
- });
5208
- }
5209
- });
5210
- stream.getTracks().forEach(track => {
5211
- track.stop();
5212
- });
5213
- }
5214
- if (allDevices.length > 0) {
5215
- allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5216
- var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5217
- if (firstOption) {
5218
- allDevices[allDevices.indexOf(firstOption)].recommended = true;
5219
- }
5220
- else {
5221
- var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5222
- if (firstEnv) {
5223
- allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5224
- }
5225
- }
5226
- }
5227
- return allDevices;
5228
- }
5229
- GetConstraints(selectedDeviceId, device, portrait = false) {
5230
- let constraints = {
5231
- audio: false,
5232
- video: {
5233
- frameRate: 30,
5234
- },
5235
- };
5236
- if (selectedDeviceId) {
5237
- constraints.video.deviceId = {
5238
- exact: selectedDeviceId,
5239
- };
5240
- }
5241
- if (device.isWin) {
5242
- constraints.video.width = { ideal: 1280 };
5243
- }
5244
- else {
5245
- if (portrait) {
5246
- constraints.video.facingMode = 'user';
5247
- constraints.video.width = { ideal: 1280 };
5248
- constraints.video.height = { ideal: 720 };
5249
- }
5250
- else {
5251
- constraints.video.facingMode = 'environment';
5252
- constraints.video.width = { ideal: 1280 };
5253
- constraints.video.aspectRatio = 1;
5254
- }
5255
- }
5256
- return constraints;
5257
- }
5258
- GetRecommendedCamera(cameras) {
5259
- if (cameras && cameras.length > 0) {
5260
- var recommDevice = cameras.find(c => c.recommended);
5261
- if (recommDevice) {
5262
- return recommDevice;
5263
- }
5264
- }
5265
- return null;
5266
- }
5267
- static async InitCameras(device) {
5268
- try {
5269
- let cam = new Cameras();
5270
- let cameras = await cam.GetCameras(device);
5271
- var recommCamera = cam.GetRecommendedCamera(cameras);
5272
- state.cameraIds = cameras.map(camera => camera.deviceId);
5273
- state.cameraId = recommCamera.deviceId;
5274
- return true;
5275
- }
5276
- catch (e) {
5277
- console.log(e);
5278
- if (e.message.includes('Permission denied') || e.name.includes('NotAllowedError')) {
5279
- return false;
5280
- }
5281
- throw e;
5282
- }
5283
- }
5284
- }
5285
-
5286
5170
  const cameraErrorCss = "";
5287
5171
 
5288
5172
  const CameraError = class {
@@ -5303,35 +5187,24 @@ const CameraError = class {
5303
5187
  this.buttonText = CameraErrorValues.Button;
5304
5188
  }
5305
5189
  async componentDidLoad() {
5190
+ if (!this.device.isIos) {
5191
+ this.demoVideo.src = CameraErrorValues.HowToLink;
5192
+ this.demoVideo.loop = true;
5193
+ this.demoVideo.play();
5194
+ }
5306
5195
  try {
5307
5196
  await this.apiCall.AddStep(FlowSteps.CameraError);
5308
5197
  }
5309
5198
  catch (e) {
5310
5199
  this.apiErrorEvent.emit(e);
5311
5200
  }
5312
- if (!this.device.isIos) {
5313
- this.demoVideo.src = CameraErrorValues.HowToLink;
5314
- this.demoVideo.loop = true;
5315
- this.demoVideo.play();
5316
- }
5317
5201
  }
5318
5202
  async buttonClick() {
5319
5203
  this.buttonDisabled = true;
5320
5204
  if (this.device.isIos) {
5321
5205
  window.location.reload();
5322
5206
  }
5323
- if (!(await Cameras.InitCameras(this.device))) {
5324
- this.buttonDisabled = false;
5325
- }
5326
- else if (state.agreementsValidation) {
5327
- state.flowStatus = FlowStatus.AGREEMENT;
5328
- }
5329
- else if (state.phoneValidation) {
5330
- state.flowStatus = FlowStatus.PHONE;
5331
- }
5332
- else {
5333
- state.flowStatus = FlowStatus.ID;
5334
- }
5207
+ state.flowStatus = FlowStatus.LANDING;
5335
5208
  }
5336
5209
  render() {
5337
5210
  return (h("div", { class: "container" }, h("div", { class: "row" }, h("h1", { class: "color-red" }, this.title), h("div", null, h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.description)), h("div", { hidden: this.device.isIos }, h("video", { id: "howtoPermissions", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: this.buttonDisabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, CameraErrorValues.FooterText))))));
@@ -5521,6 +5394,122 @@ const HowToInfo = class {
5521
5394
  };
5522
5395
  HowToInfo.style = howToInfoCss;
5523
5396
 
5397
+ class Cameras {
5398
+ async GetCameras(deviceInfo) {
5399
+ var allDevices = [];
5400
+ const devices = await navigator.mediaDevices.enumerateDevices();
5401
+ const videoDevices = devices.filter(device => device.kind === 'videoinput');
5402
+ for (const device of videoDevices) {
5403
+ const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5404
+ const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5405
+ stream.getVideoTracks().forEach(track => {
5406
+ if (deviceInfo.isFirefox) {
5407
+ const settings = track.getSettings();
5408
+ let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5409
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5410
+ allDevices.push({
5411
+ deviceId: device.deviceId,
5412
+ name: device.label,
5413
+ height: settings.height,
5414
+ width: settings.width,
5415
+ frameRate: Number(settings.frameRate.max),
5416
+ torch: false,
5417
+ recommended: false,
5418
+ facingMode: facingMode,
5419
+ });
5420
+ }
5421
+ else {
5422
+ const capabilities = track.getCapabilities();
5423
+ let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5424
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5425
+ allDevices.push({
5426
+ deviceId: device.deviceId,
5427
+ name: device.label,
5428
+ height: capabilities.height.max,
5429
+ width: capabilities.width.max,
5430
+ frameRate: Number(capabilities.frameRate.max),
5431
+ torch: capabilities.torch,
5432
+ recommended: false,
5433
+ facingMode: facingMode,
5434
+ });
5435
+ }
5436
+ });
5437
+ stream.getTracks().forEach(track => {
5438
+ track.stop();
5439
+ });
5440
+ }
5441
+ if (allDevices.length > 0) {
5442
+ allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5443
+ var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5444
+ if (firstOption) {
5445
+ allDevices[allDevices.indexOf(firstOption)].recommended = true;
5446
+ }
5447
+ else {
5448
+ var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5449
+ if (firstEnv) {
5450
+ allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5451
+ }
5452
+ }
5453
+ }
5454
+ return allDevices;
5455
+ }
5456
+ GetConstraints(selectedDeviceId, device, portrait = false) {
5457
+ let constraints = {
5458
+ audio: false,
5459
+ video: {
5460
+ frameRate: 30,
5461
+ },
5462
+ };
5463
+ if (selectedDeviceId) {
5464
+ constraints.video.deviceId = {
5465
+ exact: selectedDeviceId,
5466
+ };
5467
+ }
5468
+ if (device.isWin) {
5469
+ constraints.video.width = { ideal: 1280 };
5470
+ }
5471
+ else {
5472
+ if (portrait) {
5473
+ constraints.video.facingMode = 'user';
5474
+ constraints.video.width = { ideal: 1280 };
5475
+ constraints.video.height = { ideal: 720 };
5476
+ }
5477
+ else {
5478
+ constraints.video.facingMode = 'environment';
5479
+ constraints.video.width = { ideal: 1280 };
5480
+ constraints.video.aspectRatio = 1;
5481
+ }
5482
+ }
5483
+ return constraints;
5484
+ }
5485
+ GetRecommendedCamera(cameras) {
5486
+ if (cameras && cameras.length > 0) {
5487
+ var recommDevice = cameras.find(c => c.recommended);
5488
+ if (recommDevice) {
5489
+ return recommDevice;
5490
+ }
5491
+ }
5492
+ return null;
5493
+ }
5494
+ static async InitCameras(device) {
5495
+ try {
5496
+ let cam = new Cameras();
5497
+ let cameras = await cam.GetCameras(device);
5498
+ var recommCamera = cam.GetRecommendedCamera(cameras);
5499
+ state.cameraIds = cameras.map(camera => camera.deviceId);
5500
+ state.cameraId = recommCamera.deviceId;
5501
+ return true;
5502
+ }
5503
+ catch (e) {
5504
+ console.log(e);
5505
+ if (e.message.includes('Permission denied') || e.name.includes('NotAllowedError')) {
5506
+ return false;
5507
+ }
5508
+ throw e;
5509
+ }
5510
+ }
5511
+ }
5512
+
5524
5513
  const idBackCaptureCss = ".logo{max-height:450px;max-width:450px}.canvas-on-video{max-width:100%;max-height:100%;position:absolute;z-index:2;transform:scale(-1, 1)}";
5525
5514
 
5526
5515
  const IdBackCapture = class {
@@ -6171,7 +6160,7 @@ function v4(options, buf, offset) {
6171
6160
  }
6172
6161
 
6173
6162
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
6174
- const version$1 = "2.1.14";
6163
+ const version$1 = "2.1.16";
6175
6164
  const description = "Person Identification Component";
6176
6165
  const main = "./dist/index.cjs.js";
6177
6166
  const module = "./dist/index.js";