@ekyc_qoobiss/qbs-ect-cmp 3.3.1 → 3.3.2

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 (32) hide show
  1. package/dist/cjs/agreement-check_18.cjs.entry.js +88 -28
  2. package/dist/collection/components/common/camera-error/camera-error.js +3 -1
  3. package/dist/collection/components/common/id-back-capture/id-back-capture.js +17 -4
  4. package/dist/collection/components/common/id-capture/id-capture.js +17 -4
  5. package/dist/collection/components/common/selfie-capture/selfie-capture.js +17 -4
  6. package/dist/collection/components/flow/agreement-info/agreement-info.js +3 -1
  7. package/dist/collection/components/flow/error-end/error-end.js +1 -5
  8. package/dist/collection/components/flow/id-double-side/id-double-side.js +3 -1
  9. package/dist/collection/components/flow/id-single-side/id-single-side.js +3 -1
  10. package/dist/collection/components/flow/landing-validation/landing-validation.js +3 -2
  11. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +3 -1
  12. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +3 -1
  13. package/dist/collection/components/flow/user-liveness/user-liveness.js +3 -1
  14. package/dist/collection/components/identification-component/identification-component.js +1 -1
  15. package/dist/collection/helpers/ApiCall.js +52 -4
  16. package/dist/esm/agreement-check_18.entry.js +88 -28
  17. package/dist/qbs-ect-cmp/{p-419e65b4.entry.js → p-5c7d0547.entry.js} +2 -2
  18. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  19. package/dist/types/components/common/camera-error/camera-error.d.ts +1 -0
  20. package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +1 -0
  21. package/dist/types/components/common/id-capture/id-capture.d.ts +1 -0
  22. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +1 -0
  23. package/dist/types/components/flow/agreement-info/agreement-info.d.ts +1 -0
  24. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +1 -0
  25. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +1 -0
  26. package/dist/types/components/flow/landing-validation/landing-validation.d.ts +1 -0
  27. package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +1 -0
  28. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +1 -0
  29. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +1 -0
  30. package/dist/types/components.d.ts +3 -0
  31. package/dist/types/helpers/ApiCall.d.ts +1 -0
  32. package/package.json +1 -1
@@ -13,6 +13,30 @@ export class ApiCall {
13
13
  });
14
14
  this.urls = new ApiUrls();
15
15
  }
16
+ async http2(method, url, data) {
17
+ return new Promise((resolve, reject) => {
18
+ var xhr = new XMLHttpRequest();
19
+ xhr.open(method, url);
20
+ xhr.onload = function () {
21
+ if (xhr.status >= 200 && xhr.status < 300) {
22
+ resolve(xhr.response);
23
+ }
24
+ else {
25
+ reject({
26
+ status: xhr.status,
27
+ statusText: xhr.statusText,
28
+ });
29
+ }
30
+ };
31
+ xhr.onerror = function () {
32
+ reject({
33
+ status: xhr.status,
34
+ statusText: xhr.statusText,
35
+ });
36
+ };
37
+ xhr.send(data);
38
+ });
39
+ }
16
40
  async http(request) {
17
41
  const response = await fetch(request);
18
42
  if (!response.ok) {
@@ -27,23 +51,47 @@ export class ApiCall {
27
51
  }
28
52
  }
29
53
  async post(url, data) {
30
- return await this.http(new Request(store.apiBaseUrl + url, {
54
+ var request = new Request(store.apiBaseUrl + url, {
31
55
  method: 'POST',
32
56
  body: data,
33
57
  headers: {
34
58
  'Content-Type': 'application/json',
35
59
  'Authorization': 'IDKYC-TOKEN ' + store.token,
36
60
  },
37
- }));
61
+ });
62
+ try {
63
+ return await this.http(request);
64
+ }
65
+ catch (ex) {
66
+ this.AddLog('Error in post ', ex);
67
+ try {
68
+ return await this.http(request);
69
+ }
70
+ catch (ex2) {
71
+ return await this.http2('POST', store.apiBaseUrl + url, data);
72
+ }
73
+ }
38
74
  }
39
75
  async get(url) {
40
- return await this.http(new Request(store.apiBaseUrl + url, {
76
+ var request = new Request(store.apiBaseUrl + url, {
41
77
  method: 'GET',
42
78
  headers: {
43
79
  'Content-Type': 'application/json',
44
80
  'Authorization': 'IDKYC-TOKEN ' + store.token,
45
81
  },
46
- }));
82
+ });
83
+ try {
84
+ return await this.http(request);
85
+ }
86
+ catch (ex) {
87
+ this.AddLog('Error in get ', ex);
88
+ try {
89
+ return await this.http(request);
90
+ }
91
+ catch (ex2) {
92
+ return await this.http2('GET', store.apiBaseUrl + url, '');
93
+ }
94
+ }
47
95
  }
48
96
  async SendOTPCode(requestId, phoneNumber) {
49
97
  let data = { requestId: requestId, phone: phoneNumber };
@@ -435,6 +435,30 @@ class ApiCall {
435
435
  });
436
436
  this.urls = new ApiUrls();
437
437
  }
438
+ async http2(method, url, data) {
439
+ return new Promise((resolve, reject) => {
440
+ var xhr = new XMLHttpRequest();
441
+ xhr.open(method, url);
442
+ xhr.onload = function () {
443
+ if (xhr.status >= 200 && xhr.status < 300) {
444
+ resolve(xhr.response);
445
+ }
446
+ else {
447
+ reject({
448
+ status: xhr.status,
449
+ statusText: xhr.statusText,
450
+ });
451
+ }
452
+ };
453
+ xhr.onerror = function () {
454
+ reject({
455
+ status: xhr.status,
456
+ statusText: xhr.statusText,
457
+ });
458
+ };
459
+ xhr.send(data);
460
+ });
461
+ }
438
462
  async http(request) {
439
463
  const response = await fetch(request);
440
464
  if (!response.ok) {
@@ -449,23 +473,47 @@ class ApiCall {
449
473
  }
450
474
  }
451
475
  async post(url, data) {
452
- return await this.http(new Request(state.apiBaseUrl + url, {
476
+ var request = new Request(state.apiBaseUrl + url, {
453
477
  method: 'POST',
454
478
  body: data,
455
479
  headers: {
456
480
  'Content-Type': 'application/json',
457
481
  'Authorization': 'IDKYC-TOKEN ' + state.token,
458
482
  },
459
- }));
483
+ });
484
+ try {
485
+ return await this.http(request);
486
+ }
487
+ catch (ex) {
488
+ this.AddLog('Error in post ', ex);
489
+ try {
490
+ return await this.http(request);
491
+ }
492
+ catch (ex2) {
493
+ return await this.http2('POST', state.apiBaseUrl + url, data);
494
+ }
495
+ }
460
496
  }
461
497
  async get(url) {
462
- return await this.http(new Request(state.apiBaseUrl + url, {
498
+ var request = new Request(state.apiBaseUrl + url, {
463
499
  method: 'GET',
464
500
  headers: {
465
501
  'Content-Type': 'application/json',
466
502
  'Authorization': 'IDKYC-TOKEN ' + state.token,
467
503
  },
468
- }));
504
+ });
505
+ try {
506
+ return await this.http(request);
507
+ }
508
+ catch (ex) {
509
+ this.AddLog('Error in get ', ex);
510
+ try {
511
+ return await this.http(request);
512
+ }
513
+ catch (ex2) {
514
+ return await this.http2('GET', state.apiBaseUrl + url, '');
515
+ }
516
+ }
469
517
  }
470
518
  async SendOTPCode(requestId, phoneNumber) {
471
519
  let data = { requestId: requestId, phone: phoneNumber };
@@ -822,9 +870,11 @@ const AgreementInfo = class {
822
870
  this.openAgreements = false;
823
871
  this.openTerms = false;
824
872
  }
873
+ disconnectedCallback() {
874
+ this.baseComponent.finalize();
875
+ }
825
876
  async buttonClick() {
826
877
  if (this.agreementsChecked && this.termsChecked) {
827
- await this.baseComponent.finalize();
828
878
  state.flowStatus = FlowStatus.PHONE;
829
879
  }
830
880
  }
@@ -5428,9 +5478,11 @@ const CameraError = class {
5428
5478
  }
5429
5479
  }
5430
5480
  }
5481
+ disconnectedCallback() {
5482
+ this.baseComponent.finalize();
5483
+ }
5431
5484
  async buttonClick() {
5432
5485
  this.buttonDisabled = true;
5433
- await this.baseComponent.finalize();
5434
5486
  if (state.device.mobileOS == MobileOS.iOS) {
5435
5487
  sessionStorage.setItem(SessionKeys.RefreshDoneKey, 'true');
5436
5488
  window.location.reload();
@@ -5519,10 +5571,7 @@ const ErrorEnd = class {
5519
5571
  this.message = undefined;
5520
5572
  this.errorTitle = undefined;
5521
5573
  }
5522
- componentDidLoad() {
5523
- Events.init(window);
5524
- Events.flowError(this.errorTitle + ' ' + this.message);
5525
- }
5574
+ componentDidLoad() { }
5526
5575
  render() {
5527
5576
  return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "text-center" }, h("h1", null, this.errorTitle)), h("div", { class: "text-center" }, h("p", null, state.requestId)), h("div", null, h("p", { class: "color-red font-weight-bold font-size-2 text-center mt-10" }, this.message)))));
5528
5577
  }
@@ -5702,6 +5751,7 @@ const IdBackCapture = class {
5702
5751
  constructor(hostRef) {
5703
5752
  registerInstance(this, hostRef);
5704
5753
  this.eventPhotoCapture = createEvent(this, "photoIdBackCapture", 7);
5754
+ this.apiErrorEvent = createEvent(this, "apiError", 7);
5705
5755
  this.photoIsReady = photos => {
5706
5756
  //this.closeCamera();
5707
5757
  this.eventPhotoCapture.emit(photos);
@@ -5731,10 +5781,9 @@ const IdBackCapture = class {
5731
5781
  this.cameraSize = event.detail;
5732
5782
  }
5733
5783
  async componentWillLoad() {
5734
- Events.init(this.component);
5735
5784
  //this.videoDemoStyle = this.device.isMobile ? { width: window.screen.width + 'px', height: window.screen.height + 'px', 'object-fit': 'fill' } : {};
5736
5785
  if (!navigator.mediaDevices) {
5737
- Events.flowError('This browser does not support webRTC');
5786
+ this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
5738
5787
  }
5739
5788
  }
5740
5789
  async componentDidLoad() {
@@ -5760,7 +5809,7 @@ const IdBackCapture = class {
5760
5809
  })
5761
5810
  .catch(e => {
5762
5811
  this.closeCamera();
5763
- Events.flowError(e);
5812
+ this.apiErrorEvent.emit(e);
5764
5813
  });
5765
5814
  }, 100);
5766
5815
  }
@@ -5816,6 +5865,7 @@ const IdCapture = class {
5816
5865
  constructor(hostRef) {
5817
5866
  registerInstance(this, hostRef);
5818
5867
  this.eventPhotoCapture = createEvent(this, "photoIdCapture", 7);
5868
+ this.apiErrorEvent = createEvent(this, "apiError", 7);
5819
5869
  this.photoIsReady = photos => {
5820
5870
  //this.closeCamera();
5821
5871
  this.eventPhotoCapture.emit(photos);
@@ -5845,11 +5895,10 @@ const IdCapture = class {
5845
5895
  this.cameraSize = event.detail;
5846
5896
  }
5847
5897
  async componentWillLoad() {
5848
- Events.init(this.component);
5849
5898
  this.titleMesage = IdCaptureValues.Title;
5850
5899
  //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
5851
5900
  if (!navigator.mediaDevices) {
5852
- Events.flowError('This browser does not support webRTC');
5901
+ this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
5853
5902
  }
5854
5903
  }
5855
5904
  async componentDidLoad() {
@@ -5870,7 +5919,7 @@ const IdCapture = class {
5870
5919
  })
5871
5920
  .catch(e => {
5872
5921
  this.closeCamera();
5873
- Events.flowError(e);
5922
+ this.apiErrorEvent.emit(e);
5874
5923
  });
5875
5924
  }, 100);
5876
5925
  }
@@ -6090,9 +6139,11 @@ const IdDoubleSide = class {
6090
6139
  return;
6091
6140
  }
6092
6141
  state.recordingRetryCount = 0;
6093
- await this.baseComponent.finalize();
6094
6142
  state.flowStatus = FlowStatus.LIVENESS;
6095
6143
  }
6144
+ disconnectedCallback() {
6145
+ this.baseComponent.finalize();
6146
+ }
6096
6147
  switchCamera() {
6097
6148
  if (this.captureRetryCount == 1) {
6098
6149
  let camIndex = state.cameraIds.indexOf(state.cameraId);
@@ -6221,9 +6272,11 @@ const IdSingleSide = class {
6221
6272
  if (!this.idFlow.verificationFinished) {
6222
6273
  return;
6223
6274
  }
6224
- await this.baseComponent.finalize();
6225
6275
  state.flowStatus = FlowStatus.LIVENESS;
6226
6276
  }
6277
+ disconnectedCallback() {
6278
+ this.baseComponent.finalize();
6279
+ }
6227
6280
  switchCamera() {
6228
6281
  if (this.captureRetryCount == 1) {
6229
6282
  let camIndex = state.cameraIds.indexOf(state.cameraId);
@@ -6309,7 +6362,7 @@ function v4(options, buf, offset) {
6309
6362
  }
6310
6363
 
6311
6364
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
6312
- const version$1 = "3.3.1";
6365
+ const version$1 = "3.3.2";
6313
6366
  const description = "Person Identification Component";
6314
6367
  const main = "./dist/index.cjs.js";
6315
6368
  const module = "./dist/index.js";
@@ -6471,7 +6524,7 @@ const IdentificationComponent = class {
6471
6524
  await this.baseComponent.apiCall.AddLog(apiLogData, getLogMessage(this.order_id, this.redirect_id, this.token));
6472
6525
  }
6473
6526
  catch (_c) { }
6474
- Events.flowError(data);
6527
+ Events.flowError(this.errorTitle);
6475
6528
  state.flowStatus = FlowStatus.ERROREND;
6476
6529
  }
6477
6530
  constructor(hostRef) {
@@ -6699,7 +6752,6 @@ const LandingValidation = class {
6699
6752
  state.flowStatus = FlowStatus.COMPLETE;
6700
6753
  return;
6701
6754
  }
6702
- await this.baseComponent.finalize();
6703
6755
  if (!(await Cameras.InitCameras(state.device))) {
6704
6756
  if (state.device.mobileOS == MobileOS.iOS)
6705
6757
  sessionStorage.setItem(SessionKeys.RefreshDoneKey, 'false');
@@ -6716,13 +6768,15 @@ const LandingValidation = class {
6716
6768
  }
6717
6769
  }
6718
6770
  }
6771
+ disconnectedCallback() {
6772
+ this.baseComponent.finalize();
6773
+ }
6719
6774
  async leaveFlow() {
6720
6775
  if (this.buttonDisabled)
6721
6776
  return;
6722
6777
  state.initialised = false;
6723
6778
  try {
6724
6779
  await this.baseComponent.apiCall.AbortRequest();
6725
- await this.baseComponent.finalize();
6726
6780
  Events.flowAborted();
6727
6781
  }
6728
6782
  catch (e) {
@@ -9661,7 +9715,6 @@ const MobileRedirect = class {
9661
9715
  this.orderStatus = await this.baseComponent.apiCall.GetStatus(state.requestId);
9662
9716
  if (this.orderStatus == OrderStatuses.FinishedCapturing) {
9663
9717
  this.waitingMobile = false;
9664
- await this.baseComponent.finalize();
9665
9718
  state.flowStatus = FlowStatus.COMPLETE;
9666
9719
  }
9667
9720
  if (this.orderStatus == OrderStatuses.NotFound) {
@@ -9677,6 +9730,9 @@ const MobileRedirect = class {
9677
9730
  Events.flowAborted();
9678
9731
  }
9679
9732
  }
9733
+ disconnectedCallback() {
9734
+ this.baseComponent.finalize();
9735
+ }
9680
9736
  async buttonClick() {
9681
9737
  if (this.contact == '' || this.contact.length != 10) {
9682
9738
  return;
@@ -9712,6 +9768,7 @@ const SelfieCapture = class {
9712
9768
  constructor(hostRef) {
9713
9769
  registerInstance(this, hostRef);
9714
9770
  this.eventPhotoCapture = createEvent(this, "photoSelfieCapture", 7);
9771
+ this.apiErrorEvent = createEvent(this, "apiError", 7);
9715
9772
  this.photoIsReady = photos => {
9716
9773
  //this.closeCamera();
9717
9774
  this.eventPhotoCapture.emit(photos);
@@ -9753,11 +9810,10 @@ const SelfieCapture = class {
9753
9810
  this.captureWidth = Math.round((this.captureHeight * 9) / 16);
9754
9811
  }
9755
9812
  componentWillLoad() {
9756
- Events.init(this.component);
9757
9813
  this.titleMesage = SelfieCaptureValues.Title;
9758
9814
  //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
9759
9815
  if (!navigator.mediaDevices) {
9760
- Events.flowError('This browser does not support webRTC');
9816
+ this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
9761
9817
  }
9762
9818
  }
9763
9819
  async componentDidLoad() {
@@ -9778,7 +9834,7 @@ const SelfieCapture = class {
9778
9834
  })
9779
9835
  .catch(e => {
9780
9836
  this.closeCamera();
9781
- Events.flowError(e);
9837
+ this.apiErrorEvent.emit(e);
9782
9838
  });
9783
9839
  }, 100);
9784
9840
  }
@@ -9855,7 +9911,6 @@ const SmsCodeValidation = class {
9855
9911
  async doAction() {
9856
9912
  try {
9857
9913
  this.canSend = false;
9858
- await this.baseComponent.finalize();
9859
9914
  if (state.flowStatus == FlowStatus.CODE || state.flowStatus == FlowStatus.CODEERROR) {
9860
9915
  var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(state.requestId, this.code);
9861
9916
  if (codeChecked === true) {
@@ -9876,6 +9931,9 @@ const SmsCodeValidation = class {
9876
9931
  this.apiErrorEvent.emit(e);
9877
9932
  }
9878
9933
  }
9934
+ disconnectedCallback() {
9935
+ this.baseComponent.finalize();
9936
+ }
9879
9937
  componentWillRender() {
9880
9938
  if (state.flowStatus == FlowStatus.PHONE) {
9881
9939
  this.title = PhoneValidationValues.Title;
@@ -10005,6 +10063,9 @@ const UserLiveness = class {
10005
10063
  this.selfieFlow.verificationFinished = true;
10006
10064
  await this.endFlow();
10007
10065
  }
10066
+ disconnectedCallback() {
10067
+ this.baseComponent.finalize();
10068
+ }
10008
10069
  async uploadPhoto() {
10009
10070
  if (this.selfieFlow.photoFile == null || this.selfieFlow.photoDone) {
10010
10071
  return;
@@ -10045,7 +10106,6 @@ const UserLiveness = class {
10045
10106
  return;
10046
10107
  }
10047
10108
  state.recordingRetryCount = 0;
10048
- await this.baseComponent.finalize();
10049
10109
  state.flowStatus = FlowStatus.COMPLETE;
10050
10110
  }
10051
10111
  render() {