@ekyc_qoobiss/qbs-ect-cmp 2.1.8 → 2.1.10

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.
Files changed (28) hide show
  1. package/dist/cjs/{agreement-check_17.cjs.entry.js → agreement-check_18.cjs.entry.js} +182 -108
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +1 -0
  5. package/dist/collection/components/common/camera-error/camera-error.css +0 -0
  6. package/dist/collection/components/common/camera-error/camera-error.js +109 -0
  7. package/dist/collection/components/common/id-back-capture/id-back-capture.js +2 -3
  8. package/dist/collection/components/common/id-capture/id-capture.js +2 -3
  9. package/dist/collection/components/flow/landing-validation/landing-validation.js +5 -0
  10. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +1 -1
  11. package/dist/collection/components/identification-component/identification-component.js +3 -0
  12. package/dist/collection/helpers/Cameras.js +17 -0
  13. package/dist/collection/helpers/textValues.js +5 -0
  14. package/dist/collection/models/FlowStatus.js +1 -0
  15. package/dist/collection/models/FlowSteps.js +1 -0
  16. package/dist/esm/{agreement-check_17.entry.js → agreement-check_18.entry.js} +182 -109
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/qbs-ect-cmp.js +1 -1
  19. package/dist/qbs-ect-cmp/{p-550b976f.entry.js → p-b6054117.entry.js} +2 -2
  20. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  21. package/dist/types/components/common/camera-error/camera-error.d.ts +16 -0
  22. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +1 -1
  23. package/dist/types/components.d.ts +20 -0
  24. package/dist/types/helpers/Cameras.d.ts +1 -0
  25. package/dist/types/helpers/textValues.d.ts +5 -0
  26. package/dist/types/models/FlowStatus.d.ts +2 -1
  27. package/dist/types/models/FlowSteps.d.ts +2 -1
  28. package/package.json +1 -1
@@ -215,6 +215,7 @@ var FlowStatus;
215
215
  FlowStatus[FlowStatus["LIVENESS"] = 6] = "LIVENESS";
216
216
  FlowStatus[FlowStatus["COMPLETE"] = 7] = "COMPLETE";
217
217
  FlowStatus[FlowStatus["ERROREND"] = 8] = "ERROREND";
218
+ FlowStatus[FlowStatus["CAMERAERROR"] = 9] = "CAMERAERROR";
218
219
  })(FlowStatus || (FlowStatus = {}));
219
220
 
220
221
  class GlobalValues {
@@ -353,7 +354,12 @@ MobileRedirectValues.InfoTop = 'Pentru a continua scanați codul de mai jos cu u
353
354
  MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru a primi link-ul pe smartphone.';
354
355
  MobileRedirectValues.Validation = 'Număr de telefon invalid!';
355
356
  MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
356
- MobileRedirectValues.InfoAborted = 'Procesului de pe smartphone a fost amanat.';
357
+ MobileRedirectValues.InfoAborted = 'Procesului de pe smartphone a fost amanat.';
358
+ class CameraErrorValues extends GlobalValues {
359
+ }
360
+ CameraErrorValues.Title = 'Procesul de indetificare nu poate continua.';
361
+ CameraErrorValues.Description = 'Nu am putut detecta nicio camera. Cel mai probabil nu ai acordat drept de acces acestui site, Te rugam sa dai acces si sa apesi butonul de mai jos dupa aceea.';
362
+ CameraErrorValues.Button = 'Reincep procesul';
357
363
 
358
364
  const { state, onChange } = createStore({
359
365
  flowStatus: FlowStatus.LANDING,
@@ -410,6 +416,7 @@ var FlowSteps;
410
416
  FlowSteps[FlowSteps["SelfieHowTo"] = 9] = "SelfieHowTo";
411
417
  FlowSteps[FlowSteps["Selfie"] = 10] = "Selfie";
412
418
  FlowSteps[FlowSteps["End"] = 11] = "End";
419
+ FlowSteps[FlowSteps["CameraError"] = 12] = "CameraError";
413
420
  })(FlowSteps || (FlowSteps = {}));
414
421
 
415
422
  class ApiCall {
@@ -5163,6 +5170,168 @@ const Camera = class {
5163
5170
  };
5164
5171
  Camera.style = cameraCss;
5165
5172
 
5173
+ class Cameras {
5174
+ async GetCameras(deviceInfo) {
5175
+ var allDevices = [];
5176
+ const devices = await navigator.mediaDevices.enumerateDevices();
5177
+ const videoDevices = devices.filter(device => device.kind === 'videoinput');
5178
+ for (const device of videoDevices) {
5179
+ const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5180
+ const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5181
+ stream.getVideoTracks().forEach(track => {
5182
+ if (deviceInfo.isFirefox) {
5183
+ const settings = track.getSettings();
5184
+ let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5185
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5186
+ allDevices.push({
5187
+ deviceId: device.deviceId,
5188
+ name: device.label,
5189
+ height: settings.height,
5190
+ width: settings.width,
5191
+ frameRate: Number(settings.frameRate.max),
5192
+ torch: false,
5193
+ recommended: false,
5194
+ facingMode: facingMode,
5195
+ });
5196
+ }
5197
+ else {
5198
+ const capabilities = track.getCapabilities();
5199
+ let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5200
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
5201
+ allDevices.push({
5202
+ deviceId: device.deviceId,
5203
+ name: device.label,
5204
+ height: capabilities.height.max,
5205
+ width: capabilities.width.max,
5206
+ frameRate: Number(capabilities.frameRate.max),
5207
+ torch: capabilities.torch,
5208
+ recommended: false,
5209
+ facingMode: facingMode,
5210
+ });
5211
+ }
5212
+ });
5213
+ stream.getTracks().forEach(track => {
5214
+ track.stop();
5215
+ });
5216
+ }
5217
+ if (allDevices.length > 0) {
5218
+ allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5219
+ var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5220
+ if (firstOption) {
5221
+ allDevices[allDevices.indexOf(firstOption)].recommended = true;
5222
+ }
5223
+ else {
5224
+ var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5225
+ if (firstEnv) {
5226
+ allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5227
+ }
5228
+ }
5229
+ }
5230
+ return allDevices;
5231
+ }
5232
+ GetConstraints(selectedDeviceId, device, portrait = false) {
5233
+ let constraints = {
5234
+ audio: false,
5235
+ video: {
5236
+ frameRate: 30,
5237
+ },
5238
+ };
5239
+ if (selectedDeviceId) {
5240
+ constraints.video.deviceId = {
5241
+ exact: selectedDeviceId,
5242
+ };
5243
+ }
5244
+ if (device.isWin) {
5245
+ constraints.video.width = { ideal: 1280 };
5246
+ }
5247
+ else {
5248
+ if (portrait) {
5249
+ constraints.video.facingMode = 'user';
5250
+ constraints.video.width = { ideal: 1280 };
5251
+ constraints.video.height = { ideal: 720 };
5252
+ }
5253
+ else {
5254
+ constraints.video.facingMode = 'environment';
5255
+ constraints.video.width = { ideal: 1280 };
5256
+ constraints.video.aspectRatio = 1;
5257
+ }
5258
+ }
5259
+ return constraints;
5260
+ }
5261
+ GetRecommendedCamera(cameras) {
5262
+ if (cameras && cameras.length > 0) {
5263
+ var recommDevice = cameras.find(c => c.recommended);
5264
+ if (recommDevice) {
5265
+ return recommDevice;
5266
+ }
5267
+ }
5268
+ return null;
5269
+ }
5270
+ static async InitCameras(device) {
5271
+ try {
5272
+ let cam = new Cameras();
5273
+ let cameras = await cam.GetCameras(device);
5274
+ var recommCamera = cam.GetRecommendedCamera(cameras);
5275
+ state.cameraIds = cameras.map(camera => camera.deviceId);
5276
+ state.cameraId = recommCamera;
5277
+ return true;
5278
+ }
5279
+ catch (e) {
5280
+ console.log(e);
5281
+ if (e.message.includes('NotAllowedError: Permission denied')) ;
5282
+ }
5283
+ return false;
5284
+ }
5285
+ }
5286
+
5287
+ const cameraErrorCss = "";
5288
+
5289
+ const CameraError = class {
5290
+ constructor(hostRef) {
5291
+ index.registerInstance(this, hostRef);
5292
+ this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5293
+ this.device = undefined;
5294
+ this.title = undefined;
5295
+ this.description = undefined;
5296
+ this.buttonDisabled = undefined;
5297
+ this.apiCall = new ApiCall();
5298
+ }
5299
+ async componentWillLoad() {
5300
+ this.buttonDisabled = false;
5301
+ this.title = CameraErrorValues.Title;
5302
+ this.description = CameraErrorValues.Description;
5303
+ this.buttonText = CameraErrorValues.Button;
5304
+ }
5305
+ async componentDidLoad() {
5306
+ try {
5307
+ await this.apiCall.AddStep(FlowSteps.CameraError);
5308
+ }
5309
+ catch (e) {
5310
+ this.apiErrorEvent.emit(e);
5311
+ }
5312
+ }
5313
+ async buttonClick() {
5314
+ this.buttonDisabled = true;
5315
+ if (!(await Cameras.InitCameras(this.device))) {
5316
+ this.buttonDisabled = false;
5317
+ return;
5318
+ }
5319
+ if (state.agreementsValidation) {
5320
+ state.flowStatus = FlowStatus.AGREEMENT;
5321
+ }
5322
+ else if (state.phoneValidation) {
5323
+ state.flowStatus = FlowStatus.PHONE;
5324
+ }
5325
+ else {
5326
+ state.flowStatus = FlowStatus.ID;
5327
+ }
5328
+ }
5329
+ render() {
5330
+ 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", { 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))))));
5331
+ }
5332
+ };
5333
+ CameraError.style = cameraErrorCss;
5334
+
5166
5335
  const captureErrorCss = "";
5167
5336
 
5168
5337
  const CaptureError = class {
@@ -5345,105 +5514,6 @@ const HowToInfo = class {
5345
5514
  };
5346
5515
  HowToInfo.style = howToInfoCss;
5347
5516
 
5348
- class Cameras {
5349
- async GetCameras(deviceInfo) {
5350
- var allDevices = [];
5351
- const devices = await navigator.mediaDevices.enumerateDevices();
5352
- const videoDevices = devices.filter(device => device.kind === 'videoinput');
5353
- for (const device of videoDevices) {
5354
- const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
5355
- const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
5356
- stream.getVideoTracks().forEach(track => {
5357
- if (deviceInfo.isFirefox) {
5358
- const settings = track.getSettings();
5359
- let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
5360
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5361
- allDevices.push({
5362
- deviceId: device.deviceId,
5363
- name: device.label,
5364
- height: settings.height,
5365
- width: settings.width,
5366
- frameRate: Number(settings.frameRate.max),
5367
- torch: false,
5368
- recommended: false,
5369
- facingMode: facingMode,
5370
- });
5371
- }
5372
- else {
5373
- const capabilities = track.getCapabilities();
5374
- let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
5375
- facingMode = facingMode === 'e' ? 'environment' : facingMode;
5376
- allDevices.push({
5377
- deviceId: device.deviceId,
5378
- name: device.label,
5379
- height: capabilities.height.max,
5380
- width: capabilities.width.max,
5381
- frameRate: Number(capabilities.frameRate.max),
5382
- torch: capabilities.torch,
5383
- recommended: false,
5384
- facingMode: facingMode,
5385
- });
5386
- }
5387
- });
5388
- stream.getTracks().forEach(track => {
5389
- track.stop();
5390
- });
5391
- }
5392
- if (allDevices.length > 0) {
5393
- allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
5394
- var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
5395
- if (firstOption) {
5396
- allDevices[allDevices.indexOf(firstOption)].recommended = true;
5397
- }
5398
- else {
5399
- var firstEnv = allDevices.find(i => i.facingMode === 'environment');
5400
- if (firstEnv) {
5401
- allDevices[allDevices.indexOf(firstEnv)].recommended = true;
5402
- }
5403
- }
5404
- }
5405
- return allDevices;
5406
- }
5407
- GetConstraints(selectedDeviceId, device, portrait = false) {
5408
- let constraints = {
5409
- audio: false,
5410
- video: {
5411
- frameRate: 30,
5412
- },
5413
- };
5414
- if (selectedDeviceId) {
5415
- constraints.video.deviceId = {
5416
- exact: selectedDeviceId,
5417
- };
5418
- }
5419
- if (device.isWin) {
5420
- constraints.video.width = { ideal: 1280 };
5421
- }
5422
- else {
5423
- if (portrait) {
5424
- constraints.video.facingMode = 'user';
5425
- constraints.video.width = { ideal: 1280 };
5426
- constraints.video.height = { ideal: 720 };
5427
- }
5428
- else {
5429
- constraints.video.facingMode = 'environment';
5430
- constraints.video.width = { ideal: 1280 };
5431
- constraints.video.aspectRatio = 1;
5432
- }
5433
- }
5434
- return constraints;
5435
- }
5436
- GetRecommendedCamera(cameras) {
5437
- if (cameras && cameras.length > 0) {
5438
- var recommDevice = cameras.find(c => c.recommended);
5439
- if (recommDevice) {
5440
- return recommDevice;
5441
- }
5442
- }
5443
- return null;
5444
- }
5445
- }
5446
-
5447
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)}";
5448
5518
 
5449
5519
  const IdBackCapture = class {
@@ -5500,9 +5570,7 @@ const IdBackCapture = class {
5500
5570
  this.openCamera();
5501
5571
  }
5502
5572
  async openCamera() {
5503
- let _cameras = await this.cameras.GetCameras(this.device);
5504
- var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
5505
- var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
5573
+ var constraints = this.cameras.GetConstraints(state.cameraId, this.device);
5506
5574
  setTimeout(() => {
5507
5575
  navigator.mediaDevices
5508
5576
  .getUserMedia(constraints)
@@ -5613,9 +5681,7 @@ const IdCapture = class {
5613
5681
  this.openCamera();
5614
5682
  }
5615
5683
  async openCamera() {
5616
- let _cameras = await this.cameras.GetCameras(this.device);
5617
- var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
5618
- var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
5684
+ var constraints = this.cameras.GetConstraints(state.cameraId, this.device);
5619
5685
  setTimeout(() => {
5620
5686
  navigator.mediaDevices
5621
5687
  .getUserMedia(constraints)
@@ -6098,7 +6164,7 @@ function v4(options, buf, offset) {
6098
6164
  }
6099
6165
 
6100
6166
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
6101
- const version$1 = "2.1.8";
6167
+ const version$1 = "2.1.10";
6102
6168
  const description = "Person Identification Component";
6103
6169
  const main = "./dist/index.cjs.js";
6104
6170
  const module$1 = "./dist/index.js";
@@ -6415,6 +6481,9 @@ const IdentificationComponent = class {
6415
6481
  if (state.flowStatus == FlowStatus.ERROREND) {
6416
6482
  currentBlock = index.h("error-end", { errorTitle: this.errorTitle, message: this.errorMessage });
6417
6483
  }
6484
+ if (state.flowStatus == FlowStatus.CAMERAERROR) {
6485
+ currentBlock = index.h("camera-error", { device: this.device });
6486
+ }
6418
6487
  return index.h("div", null, currentBlock);
6419
6488
  }
6420
6489
  static get watchers() { return {
@@ -6469,6 +6538,10 @@ const LandingValidation = class {
6469
6538
  }
6470
6539
  async startFlow() {
6471
6540
  if (state.initialised) {
6541
+ if (!(await Cameras.InitCameras(this.device))) {
6542
+ state.flowStatus = FlowStatus.CAMERAERROR;
6543
+ return;
6544
+ }
6472
6545
  if (state.agreementsValidation) {
6473
6546
  state.flowStatus = FlowStatus.AGREEMENT;
6474
6547
  }
@@ -9634,7 +9707,7 @@ const SmsCodeValidation = class {
9634
9707
  this.apiErrorEvent.emit(e);
9635
9708
  }
9636
9709
  }
9637
- componentWillLoad() {
9710
+ componentWillRender() {
9638
9711
  if (state.flowStatus == FlowStatus.PHONE) {
9639
9712
  this.title = PhoneValidationValues.Title;
9640
9713
  this.details = PhoneValidationValues.Description;
@@ -9824,6 +9897,7 @@ UserLiveness.style = userLivenessCss;
9824
9897
  exports.agreement_check = AgreementCheck;
9825
9898
  exports.agreement_info = AgreementInfo;
9826
9899
  exports.camera_comp = Camera;
9900
+ exports.camera_error = CameraError;
9827
9901
  exports.capture_error = CaptureError;
9828
9902
  exports.end_redirect = EndRedirect;
9829
9903
  exports.error_end = ErrorEnd;
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_17.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"idSide":[32],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
17
+ return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_18.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"idSide":[32],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"device":[16],"title":[32],"description":[32],"buttonDisabled":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_17.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"idSide":[32],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
20
+ return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_18.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"idSide":[32],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"device":[16],"title":[32],"description":[32],"buttonDisabled":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "entries": [
3
3
  "./components/common/agreement-check/agreement-check.js",
4
+ "./components/common/camera-error/camera-error.js",
4
5
  "./components/common/capture-error/capture-error.js",
5
6
  "./components/common/how-to-info/how-to-info.js",
6
7
  "./components/common/id-back-capture/id-back-capture.js",
@@ -0,0 +1,109 @@
1
+ import { h } from '@stencil/core';
2
+ import { CameraErrorValues } from '../../../helpers/textValues';
3
+ import store from '../../../helpers/store';
4
+ import { FlowStatus } from '../../../models/FlowStatus';
5
+ import { Cameras } from '../../../helpers/Cameras';
6
+ import { ApiCall } from '../../../helpers/ApiCall';
7
+ import { FlowSteps } from '../../../models/FlowSteps';
8
+ export class CameraError {
9
+ constructor() {
10
+ this.device = undefined;
11
+ this.title = undefined;
12
+ this.description = undefined;
13
+ this.buttonDisabled = undefined;
14
+ this.apiCall = new ApiCall();
15
+ }
16
+ async componentWillLoad() {
17
+ this.buttonDisabled = false;
18
+ this.title = CameraErrorValues.Title;
19
+ this.description = CameraErrorValues.Description;
20
+ this.buttonText = CameraErrorValues.Button;
21
+ }
22
+ async componentDidLoad() {
23
+ try {
24
+ await this.apiCall.AddStep(FlowSteps.CameraError);
25
+ }
26
+ catch (e) {
27
+ this.apiErrorEvent.emit(e);
28
+ }
29
+ }
30
+ async buttonClick() {
31
+ this.buttonDisabled = true;
32
+ if (!(await Cameras.InitCameras(this.device))) {
33
+ this.buttonDisabled = false;
34
+ return;
35
+ }
36
+ if (store.agreementsValidation) {
37
+ store.flowStatus = FlowStatus.AGREEMENT;
38
+ }
39
+ else if (store.phoneValidation) {
40
+ store.flowStatus = FlowStatus.PHONE;
41
+ }
42
+ else {
43
+ store.flowStatus = FlowStatus.ID;
44
+ }
45
+ }
46
+ render() {
47
+ 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", { 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))))));
48
+ }
49
+ static get is() { return "camera-error"; }
50
+ static get originalStyleUrls() {
51
+ return {
52
+ "$": ["camera-error.css"]
53
+ };
54
+ }
55
+ static get styleUrls() {
56
+ return {
57
+ "$": ["camera-error.css"]
58
+ };
59
+ }
60
+ static get properties() {
61
+ return {
62
+ "device": {
63
+ "type": "unknown",
64
+ "mutable": false,
65
+ "complexType": {
66
+ "original": "Device",
67
+ "resolved": "Device",
68
+ "references": {
69
+ "Device": {
70
+ "location": "import",
71
+ "path": "../../../models/IDevice"
72
+ }
73
+ }
74
+ },
75
+ "required": false,
76
+ "optional": false,
77
+ "docs": {
78
+ "tags": [],
79
+ "text": ""
80
+ }
81
+ }
82
+ };
83
+ }
84
+ static get states() {
85
+ return {
86
+ "title": {},
87
+ "description": {},
88
+ "buttonDisabled": {}
89
+ };
90
+ }
91
+ static get events() {
92
+ return [{
93
+ "method": "apiErrorEvent",
94
+ "name": "apiError",
95
+ "bubbles": true,
96
+ "cancelable": true,
97
+ "composed": true,
98
+ "docs": {
99
+ "tags": [],
100
+ "text": ""
101
+ },
102
+ "complexType": {
103
+ "original": "any",
104
+ "resolved": "any",
105
+ "references": {}
106
+ }
107
+ }];
108
+ }
109
+ }
@@ -7,6 +7,7 @@ import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
7
7
  import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
8
8
  import { IDPose } from '../../../libs/IDML5Detector/IDPose';
9
9
  import { delay } from '../../../utils/utils';
10
+ import store from '../../../helpers/store';
10
11
  // import { IDPose } from '../../libs/IDML5Detector/IDPose';
11
12
  export class IdBackCapture {
12
13
  // @State() private animationPath: string;
@@ -60,9 +61,7 @@ export class IdBackCapture {
60
61
  this.openCamera();
61
62
  }
62
63
  async openCamera() {
63
- let _cameras = await this.cameras.GetCameras(this.device);
64
- var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
65
- var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
64
+ var constraints = this.cameras.GetConstraints(store.cameraId, this.device);
66
65
  setTimeout(() => {
67
66
  navigator.mediaDevices
68
67
  .getUserMedia(constraints)
@@ -7,6 +7,7 @@ import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
7
7
  import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
8
8
  import { IDPose } from '../../../libs/IDML5Detector/IDPose';
9
9
  import { delay } from '../../../utils/utils';
10
+ import store from '../../../helpers/store';
10
11
  // import { IDPose } from '../../libs/IDML5Detector/IDPose';
11
12
  export class IdCapture {
12
13
  // @State() private animationPath: string;
@@ -56,9 +57,7 @@ export class IdCapture {
56
57
  this.openCamera();
57
58
  }
58
59
  async openCamera() {
59
- let _cameras = await this.cameras.GetCameras(this.device);
60
- var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
61
- var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
60
+ var constraints = this.cameras.GetConstraints(store.cameraId, this.device);
62
61
  setTimeout(() => {
63
62
  navigator.mediaDevices
64
63
  .getUserMedia(constraints)
@@ -10,6 +10,7 @@ import Events from '../../../helpers/Events';
10
10
  import { FlowStatus } from '../../../models/FlowStatus';
11
11
  import { ApiCall } from '../../../helpers/ApiCall';
12
12
  import { FlowSteps } from '../../../models/FlowSteps';
13
+ import { Cameras } from '../../../helpers/Cameras';
13
14
  export class LandingValidation {
14
15
  constructor() {
15
16
  this.device = undefined;
@@ -39,6 +40,10 @@ export class LandingValidation {
39
40
  }
40
41
  async startFlow() {
41
42
  if (store.initialised) {
43
+ if (!(await Cameras.InitCameras(this.device))) {
44
+ store.flowStatus = FlowStatus.CAMERAERROR;
45
+ return;
46
+ }
42
47
  if (store.agreementsValidation) {
43
48
  store.flowStatus = FlowStatus.AGREEMENT;
44
49
  }
@@ -38,7 +38,7 @@ export class SmsCodeValidation {
38
38
  this.apiErrorEvent.emit(e);
39
39
  }
40
40
  }
41
- componentWillLoad() {
41
+ componentWillRender() {
42
42
  if (store.flowStatus == FlowStatus.PHONE) {
43
43
  this.title = PhoneValidationValues.Title;
44
44
  this.details = PhoneValidationValues.Description;
@@ -254,6 +254,9 @@ export class IdentificationComponent {
254
254
  if (store.flowStatus == FlowStatus.ERROREND) {
255
255
  currentBlock = h("error-end", { errorTitle: this.errorTitle, message: this.errorMessage });
256
256
  }
257
+ if (store.flowStatus == FlowStatus.CAMERAERROR) {
258
+ currentBlock = h("camera-error", { device: this.device });
259
+ }
257
260
  return h("div", null, currentBlock);
258
261
  }
259
262
  static get is() { return "identification-component"; }
@@ -1,3 +1,4 @@
1
+ import store from './store';
1
2
  export class Cameras {
2
3
  async GetCameras(deviceInfo) {
3
4
  var allDevices = [];
@@ -95,4 +96,20 @@ export class Cameras {
95
96
  }
96
97
  return null;
97
98
  }
99
+ static async InitCameras(device) {
100
+ try {
101
+ let cam = new Cameras();
102
+ let cameras = await cam.GetCameras(device);
103
+ var recommCamera = cam.GetRecommendedCamera(cameras);
104
+ store.cameraIds = cameras.map(camera => camera.deviceId);
105
+ store.cameraId = recommCamera;
106
+ return true;
107
+ }
108
+ catch (e) {
109
+ console.log(e);
110
+ if (e.message.includes('NotAllowedError: Permission denied')) {
111
+ }
112
+ }
113
+ return false;
114
+ }
98
115
  }
@@ -136,3 +136,8 @@ MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru
136
136
  MobileRedirectValues.Validation = 'Număr de telefon invalid!';
137
137
  MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
138
138
  MobileRedirectValues.InfoAborted = 'Procesului de pe smartphone a fost amanat.';
139
+ export class CameraErrorValues extends GlobalValues {
140
+ }
141
+ CameraErrorValues.Title = 'Procesul de indetificare nu poate continua.';
142
+ CameraErrorValues.Description = 'Nu am putut detecta nicio camera. Cel mai probabil nu ai acordat drept de acces acestui site, Te rugam sa dai acces si sa apesi butonul de mai jos dupa aceea.';
143
+ CameraErrorValues.Button = 'Reincep procesul';