@ekyc_qoobiss/qbs-ect-cmp 3.6.40 → 3.6.41

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 (64) hide show
  1. package/dist/cjs/{TranslationUtils-bfe4477a.js → TranslationUtils-dd73945b.js} +31 -43
  2. package/dist/cjs/{agreement-check_19.cjs.entry.js → agreement-check_17.cjs.entry.js} +247 -821
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  5. package/dist/cjs/random-actions.cjs.entry.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -3
  7. package/dist/collection/components/common/how-to-info/how-to-info.js +11 -34
  8. package/dist/collection/components/common/id-capture/id-capture.js +39 -19
  9. package/dist/collection/components/common/selfie-capture/selfie-capture.js +26 -27
  10. package/dist/collection/components/controls/camera/camera.js +1 -3
  11. package/dist/collection/components/flow/agreement-info/agreement-info.js +4 -5
  12. package/dist/collection/components/flow/landing-validation/landing-validation.js +11 -19
  13. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +1 -1
  14. package/dist/collection/components/flow/process-id/process-id.js +47 -161
  15. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +7 -56
  16. package/dist/collection/components/flow/sms-send/sms-send.css +0 -0
  17. package/dist/collection/components/flow/sms-send/sms-send.js +91 -0
  18. package/dist/collection/components/flow/user-liveness/user-liveness.js +45 -118
  19. package/dist/collection/components/identification-component/identification-component.js +14 -41
  20. package/dist/collection/helpers/ApiCall.js +14 -15
  21. package/dist/collection/helpers/ML5.js +1 -1
  22. package/dist/collection/helpers/store.js +0 -18
  23. package/dist/collection/helpers/textValues.js +2 -0
  24. package/dist/collection/models/CaptureFlow.js +0 -16
  25. package/dist/collection/models/FlowStatus.js +16 -10
  26. package/dist/esm/{TranslationUtils-7e68bc94.js → TranslationUtils-741a728a.js} +31 -43
  27. package/dist/esm/{agreement-check_19.entry.js → agreement-check_17.entry.js} +247 -819
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/esm/qbs-ect-cmp.js +1 -1
  30. package/dist/esm/random-actions.entry.js +1 -1
  31. package/dist/qbs-ect-cmp/p-87c689d6.js +1 -0
  32. package/dist/qbs-ect-cmp/{p-d1d9feaf.entry.js → p-a130edd5.entry.js} +1 -1
  33. package/dist/qbs-ect-cmp/{p-df2ea91b.entry.js → p-b3fa0a37.entry.js} +2 -2
  34. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  35. package/dist/types/components/common/how-to-info/how-to-info.d.ts +0 -1
  36. package/dist/types/components/common/id-capture/id-capture.d.ts +5 -1
  37. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +3 -2
  38. package/dist/types/components/flow/process-id/process-id.d.ts +0 -3
  39. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +0 -3
  40. package/dist/types/components/flow/sms-send/sms-send.d.ts +17 -0
  41. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +2 -6
  42. package/dist/types/components/identification-component/identification-component.d.ts +1 -2
  43. package/dist/types/components.d.ts +18 -62
  44. package/dist/types/helpers/ApiCall.d.ts +9 -3
  45. package/dist/types/helpers/textValues.d.ts +2 -0
  46. package/dist/types/models/CaptureFlow.d.ts +2 -19
  47. package/dist/types/models/FlowStatus.d.ts +18 -10
  48. package/dist/types/models/IAbortResult.d.ts +1 -0
  49. package/dist/types/models/IAddRequest.d.ts +1 -1
  50. package/dist/types/models/IEctStore.d.ts +0 -6
  51. package/dist/types/models/IOtpCheck.d.ts +1 -0
  52. package/dist/types/models/IOtpSend.d.ts +1 -0
  53. package/dist/types/models/IUploadFile.d.ts +1 -0
  54. package/package.json +1 -1
  55. package/dist/collection/components/common/id-back-capture/id-back-capture.css +0 -35
  56. package/dist/collection/components/common/id-back-capture/id-back-capture.js +0 -219
  57. package/dist/collection/components/common/id-tilt/id-tilt.css +0 -35
  58. package/dist/collection/components/common/id-tilt/id-tilt.js +0 -220
  59. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +0 -7
  60. package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +0 -221
  61. package/dist/qbs-ect-cmp/p-d35256e9.js +0 -1
  62. package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +0 -28
  63. package/dist/types/components/common/id-tilt/id-tilt.d.ts +0 -28
  64. package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +0 -31
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-41696e0e.js');
6
- const TranslationUtils = require('./TranslationUtils-bfe4477a.js');
6
+ const TranslationUtils = require('./TranslationUtils-dd73945b.js');
7
7
 
8
8
  var MobileOS;
9
9
  (function (MobileOS) {
@@ -294,11 +294,11 @@ const AgreementInfo = class {
294
294
  }
295
295
  async buttonClick() {
296
296
  if (this.agreementsChecked && this.termsChecked) {
297
- if (TranslationUtils.state.phoneValidation) {
298
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.PHONE;
297
+ try {
298
+ TranslationUtils.state.flowStatus = await this.baseComponent.apiCall.GetNextFlowState();
299
299
  }
300
- else {
301
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.ID;
300
+ catch (e) {
301
+ this.apiErrorEvent.emit(e);
302
302
  }
303
303
  }
304
304
  }
@@ -1629,7 +1629,7 @@ class ML5 {
1629
1629
  }
1630
1630
  async init() {
1631
1631
  return new Promise(async (resolve) => {
1632
- const modelPath = TranslationUtils.state.hasIdBack ? 'https://ekyc.blob.core.windows.net/$web/md/model.json' : 'https://ekyc.blob.core.windows.net/$web/model.json';
1632
+ const modelPath = TranslationUtils.state.apiBaseUrl.includes("apimd") ? 'https://ekyc.blob.core.windows.net/$web/md/model.json' : 'https://ekyc.blob.core.windows.net/$web/model.json';
1633
1633
  this.classifier = await ml5.imageClassifier(modelPath, this.loaded);
1634
1634
  this.faceapi = await ml5.faceApi({ withLandmarks: true, withDescriptors: false }, this.loaded);
1635
1635
  //warmup
@@ -4736,8 +4736,7 @@ const Camera = class {
4736
4736
  return (index.h("div", { class: "camera" }, index.h("video", { id: "video", loop: true, autoplay: true, playsinline: true, muted: true, class: cameraVideoClass, ref: el => (this.cameraVideo = el) }), index.h("canvas", { id: "output", class: cameraCanvasClass, ref: el => (this.cameraCanvas = el) })));
4737
4737
  }
4738
4738
  startStream() {
4739
- var captureMode = this.captureMode == 'tilt' ? VerificationMode.Tilt : VerificationMode.Full;
4740
- const stream = Stream.getNewInstance(captureMode);
4739
+ const stream = Stream.instance;
4741
4740
  stream.updateHtmlElements(this.cameraVideo, this.cameraCanvas, this.component);
4742
4741
  if (this.captureMode == 'selfie') {
4743
4742
  stream.setFaceDetection(true);
@@ -4900,7 +4899,7 @@ ErrorEnd.style = errorEndCss;
4900
4899
  const howToInfoCss = "";
4901
4900
 
4902
4901
  const HowToInfo = class {
4903
- constructor(hostRef) { index.registerInstance(this, hostRef); this.eventHowToInfoDone = index.createEvent(this, "howToInfoDone", 7); this.apiErrorEvent = index.createEvent(this, "apiError", 7); this.idSide = undefined; this.topTitle = undefined; this.subTitle = undefined; this.imagePath = undefined; this.buttonText = undefined; this.buttonEnabled = undefined; }
4902
+ constructor(hostRef) { index.registerInstance(this, hostRef); this.eventHowToInfoDone = index.createEvent(this, "howToInfoDone", 7); this.apiErrorEvent = index.createEvent(this, "apiError", 7); this.topTitle = undefined; this.subTitle = undefined; this.imagePath = undefined; this.buttonText = undefined; this.buttonEnabled = undefined; }
4904
4903
  async componentDidLoad() {
4905
4904
  await this.baseComponent.initialize();
4906
4905
  }
@@ -4915,18 +4914,16 @@ const HowToInfo = class {
4915
4914
  this.translations = await TranslationUtils.Translations.getValues();
4916
4915
  this.subTitle = '';
4917
4916
  this.buttonEnabled = true;
4918
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.ID) {
4919
- this.topTitle = this.translations.HowToValues.IdTitile;
4920
- this.imagePath = 'https://ekyc.blob.core.windows.net/$web/howto_id.png';
4921
- this.buttonText = this.translations.HowToValues.IdButton;
4922
- if (this.idSide == 'front') {
4923
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiFrontHowTo);
4924
- this.subTitle = this.translations.HowToValues.IdSubTitileFace;
4925
- }
4926
- if (this.idSide == 'back') {
4927
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiBackHowTo);
4928
- this.subTitle = this.translations.HowToValues.IdSubTitileBack;
4929
- }
4917
+ this.topTitle = this.translations.HowToValues.IdTitile;
4918
+ this.imagePath = 'https://ekyc.blob.core.windows.net/$web/howto_id.png';
4919
+ this.buttonText = this.translations.HowToValues.IdButton;
4920
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
4921
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiFrontHowTo);
4922
+ this.subTitle = this.translations.HowToValues.IdSubTitileFace;
4923
+ }
4924
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
4925
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiBackHowTo);
4926
+ this.subTitle = this.translations.HowToValues.IdSubTitileBack;
4930
4927
  }
4931
4928
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESS) {
4932
4929
  this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.SelfieHowTo);
@@ -5081,128 +5078,6 @@ var IDPose;
5081
5078
  IDPose[IDPose["BackTilted"] = 4] = "BackTilted";
5082
5079
  })(IDPose || (IDPose = {}));
5083
5080
 
5084
- 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)}";
5085
-
5086
- const IdBackCapture = class {
5087
- // @State() private animationPath: string;
5088
- constructor(hostRef) {
5089
- index.registerInstance(this, hostRef);
5090
- this.eventPhotoCapture = index.createEvent(this, "photoIdBackCapture", 7);
5091
- this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5092
- this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
5093
- this.photoIsReady = photos => {
5094
- //this.closeCamera();
5095
- this.eventPhotoCapture.emit(photos);
5096
- };
5097
- this.videoStarted = undefined;
5098
- this.cameraSize = undefined;
5099
- this.captureTaken = undefined;
5100
- this.verified = undefined;
5101
- this.titleMesage = undefined;
5102
- this.showDemo = undefined;
5103
- this.demoVideo = undefined;
5104
- this.captureTaken = false;
5105
- this.verified = false;
5106
- this.cameras = new Cameras();
5107
- this.showDemo = true;
5108
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiBackCapture);
5109
- }
5110
- eventVideoStarted(event) {
5111
- this.videoStarted = true;
5112
- this.cameraSize = event.detail;
5113
- }
5114
- async componentWillLoad() {
5115
- this.translations = await TranslationUtils.Translations.getValues();
5116
- //this.videoDemoStyle = this.device.isMobile ? { width: window.screen.width + 'px', height: window.screen.height + 'px', 'object-fit': 'fill' } : {};
5117
- if (!navigator.mediaDevices) {
5118
- this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
5119
- }
5120
- }
5121
- async componentDidLoad() {
5122
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiBackCapture, TranslationUtils.FlowMoments.Initialized);
5123
- this.titleMesage = this.translations.IdCaptureValues.TtileRotate;
5124
- this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[IDPose.Rotate];
5125
- this.demoVideo.play();
5126
- await delay(this.translations.GlobalValues.VideoLenght);
5127
- this.titleMesage = this.translations.IdCaptureValues.TitleBack;
5128
- this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[IDPose.BackStraight];
5129
- this.demoVideo.play();
5130
- await delay(this.translations.GlobalValues.VideoLenght);
5131
- this.showDemo = false;
5132
- this.openCamera();
5133
- }
5134
- async openCamera() {
5135
- const constraints = this.cameras.GetConstraints(TranslationUtils.state.cameraId, TranslationUtils.state.device);
5136
- setTimeout(() => {
5137
- navigator.mediaDevices
5138
- .getUserMedia(constraints)
5139
- .then(stream => {
5140
- const superStream = Stream.getNewInstance(VerificationMode.Full);
5141
- superStream.initStream(stream);
5142
- })
5143
- .catch(e => {
5144
- this.closeCamera();
5145
- this.apiErrorEvent.emit(e);
5146
- });
5147
- }, 100);
5148
- }
5149
- closeCamera() {
5150
- if (Stream.instance) {
5151
- Stream.instance.dropStream();
5152
- }
5153
- }
5154
- disconnectedCallback() {
5155
- this.closeCamera();
5156
- Stream.instance = null;
5157
- IDML5Detector.instance = null;
5158
- FaceML5Detector.instance = null;
5159
- }
5160
- async verificationFinished() {
5161
- if (this.verified)
5162
- return;
5163
- this.verified = true;
5164
- this.titleMesage = this.translations.IdCaptureValues.Loading;
5165
- this.closeCamera();
5166
- this.showDemo = true;
5167
- var loops = 0;
5168
- this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
5169
- this.demoVideo.loop = false;
5170
- while (loops < 7) {
5171
- loops++;
5172
- this.demoVideo.play();
5173
- await delay(this.translations.GlobalValues.VideoLenght);
5174
- }
5175
- this.eventTimeElapsed.emit();
5176
- }
5177
- async takePhoto() {
5178
- if (this.captureTaken)
5179
- return;
5180
- this.captureTaken = true;
5181
- if (Stream.instance) {
5182
- let res = await Stream.instance.takePhoto();
5183
- this.photoIsReady(res);
5184
- }
5185
- else {
5186
- this.eventTimeElapsed.emit();
5187
- }
5188
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiBackCapture, TranslationUtils.FlowMoments.Finalized);
5189
- }
5190
- render() {
5191
- let cameraStyle;
5192
- let cameraStyleInner;
5193
- if (this.videoStarted) {
5194
- cameraStyle = { width: Math.round(this.cameraSize.width) + 'px', height: Math.round((this.cameraSize.width * 9) / 16) + 'px', overflow: 'hidden', borderRadius: '10px' };
5195
- cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
5196
- }
5197
- let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
5198
- //let videoClass = this.device.isMobile ? '' : 'video-demo';
5199
- let bgDemo = this.verified ? 'container' : 'container bg-black';
5200
- return (index.h("div", { class: bgDemo }, index.h("div", { class: "container-video" }, index.h("div", { hidden: this.showDemo == false }, index.h("video", { id: "howtoBack", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { hidden: this.showDemo }, index.h("div", { hidden: this.verified }, index.h("div", { class: "video-capture" }, index.h("div", { style: cameraStyle }, index.h("div", { style: cameraStyleInner }, index.h("camera-comp", { "capture-mode": "id" })))))), index.h("div", { class: "capture-title" }, index.h("h1", { class: titleClass }, this.titleMesage), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))));
5201
- }
5202
- get component() { return index.getElement(this); }
5203
- };
5204
- IdBackCapture.style = idBackCaptureCss;
5205
-
5206
5081
  const idCaptureCss = ".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)}";
5207
5082
 
5208
5083
  const IdCapture = class {
@@ -5212,8 +5087,7 @@ const IdCapture = class {
5212
5087
  this.eventPhotoCapture = index.createEvent(this, "photoIdCapture", 7);
5213
5088
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5214
5089
  this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
5215
- this.photoIsReady = photos => {
5216
- //this.closeCamera();
5090
+ this.photoIsReady = (photos) => {
5217
5091
  this.eventPhotoCapture.emit(photos);
5218
5092
  };
5219
5093
  this.videoStarted = undefined;
@@ -5227,7 +5101,6 @@ const IdCapture = class {
5227
5101
  this.verified = false;
5228
5102
  this.cameras = new Cameras();
5229
5103
  this.showDemo = true;
5230
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiFrontCapture);
5231
5104
  }
5232
5105
  eventVideoStarted(event) {
5233
5106
  this.videoStarted = true;
@@ -5235,138 +5108,41 @@ const IdCapture = class {
5235
5108
  }
5236
5109
  async componentWillLoad() {
5237
5110
  this.translations = await TranslationUtils.Translations.getValues();
5238
- this.titleMesage = this.translations.IdCaptureValues.Title;
5239
- //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
5240
5111
  if (!navigator.mediaDevices) {
5241
5112
  this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
5242
5113
  }
5114
+ this.baseComponent = new BaseComponent(this.flowStep);
5243
5115
  }
5244
- async componentDidLoad() {
5245
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiFrontCapture, TranslationUtils.FlowMoments.Initialized);
5246
- this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[IDPose.Straight];
5247
- this.demoVideo.play();
5248
- await delay(this.translations.GlobalValues.VideoLenght);
5249
- this.showDemo = false;
5250
- this.openCamera();
5251
- }
5252
- async openCamera() {
5253
- const constraints = this.cameras.GetConstraints(TranslationUtils.state.cameraId, TranslationUtils.state.device);
5254
- setTimeout(() => {
5255
- navigator.mediaDevices
5256
- .getUserMedia(constraints)
5257
- .then(stream => {
5258
- const superStream = Stream.getNewInstance(VerificationMode.Full);
5259
- superStream.initStream(stream);
5260
- })
5261
- .catch(e => {
5262
- this.closeCamera();
5263
- this.apiErrorEvent.emit(e);
5264
- });
5265
- }, 100);
5266
- }
5267
- closeCamera() {
5268
- if (Stream.instance) {
5269
- Stream.instance.dropStream();
5116
+ initVariables() {
5117
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
5118
+ this.pose = IDPose.Straight;
5119
+ this.flowStep = TranslationUtils.FlowSteps.CiFrontCapture;
5120
+ this.titleMesage = this.translations.IdCaptureValues.Title;
5121
+ this.verificationMode = VerificationMode.Full;
5270
5122
  }
5271
- }
5272
- disconnectedCallback() {
5273
- this.closeCamera();
5274
- Stream.instance = null;
5275
- IDML5Detector.instance = null;
5276
- FaceML5Detector.instance = null;
5277
- }
5278
- async takePhoto() {
5279
- if (this.captureTaken)
5280
- return;
5281
- this.captureTaken = true;
5282
- if (Stream.instance) {
5283
- let res = await Stream.instance.takePhoto();
5284
- this.photoIsReady(res);
5123
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
5124
+ this.pose = IDPose.BackStraight;
5125
+ this.flowStep = TranslationUtils.FlowSteps.CiBackCapture;
5126
+ this.titleMesage = this.translations.IdCaptureValues.TtileRotate;
5127
+ this.verificationMode = VerificationMode.Full;
5285
5128
  }
5286
- else {
5287
- this.eventTimeElapsed.emit();
5129
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDTILT) {
5130
+ this.titleMesage = this.translations.IdCaptureValues.IDPoseMapping;
5131
+ this.pose = IDPose.Tilted;
5132
+ this.flowStep = TranslationUtils.FlowSteps.CiTilt;
5133
+ this.verificationMode = VerificationMode.Tilt;
5288
5134
  }
5289
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiFrontCapture, TranslationUtils.FlowMoments.Finalized);
5290
5135
  }
5291
- async verificationFinished() {
5292
- if (this.verified)
5293
- return;
5294
- this.verified = true;
5295
- this.titleMesage = this.translations.IdCaptureValues.Loading;
5296
- this.closeCamera();
5297
- this.showDemo = true;
5298
- var loops = 0;
5299
- this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
5300
- this.demoVideo.loop = false;
5301
- while (loops < 7) {
5302
- loops++;
5136
+ async componentDidLoad() {
5137
+ await this.baseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Initialized);
5138
+ this.initVariables();
5139
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
5140
+ this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[IDPose.Rotate];
5303
5141
  this.demoVideo.play();
5304
5142
  await delay(this.translations.GlobalValues.VideoLenght);
5143
+ this.titleMesage = this.translations.IdCaptureValues.TitleBack;
5305
5144
  }
5306
- this.eventTimeElapsed.emit();
5307
- }
5308
- render() {
5309
- let cameraStyle;
5310
- let cameraStyleInner;
5311
- if (this.videoStarted) {
5312
- cameraStyle = {
5313
- width: Math.round(this.cameraSize.width) + 'px',
5314
- height: Math.round((this.cameraSize.width * 9) / 16) + 'px',
5315
- overflow: 'hidden',
5316
- borderRadius: '10px',
5317
- };
5318
- cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
5319
- }
5320
- let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
5321
- //let videoClass = this.device.isMobile ? '' : 'video-demo';
5322
- let bgDemo = this.verified ? 'container' : 'container bg-black';
5323
- return (index.h("div", { class: bgDemo }, index.h("div", { class: "container-video" }, index.h("div", { hidden: this.showDemo == false }, index.h("video", { id: "howtoFront", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { hidden: this.showDemo }, index.h("div", { hidden: this.verified }, index.h("div", { class: "video-capture" }, index.h("div", { style: cameraStyle }, index.h("div", { style: cameraStyleInner }, index.h("camera-comp", { "capture-mode": "id" })))))), index.h("div", { class: "capture-title" }, index.h("h1", { class: titleClass }, this.titleMesage), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))));
5324
- }
5325
- get component() { return index.getElement(this); }
5326
- };
5327
- IdCapture.style = idCaptureCss;
5328
-
5329
- const idTiltCss = ".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)}";
5330
-
5331
- const IdTilt = class {
5332
- // @State() private animationPath: string;
5333
- constructor(hostRef) {
5334
- index.registerInstance(this, hostRef);
5335
- this.eventPhotoCapture = index.createEvent(this, "photoTiltCapture", 7);
5336
- this.apiErrorEvent = index.createEvent(this, "apiError", 7);
5337
- this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
5338
- this.photoIsReady = photos => {
5339
- //this.closeCamera();
5340
- this.eventPhotoCapture.emit(photos);
5341
- };
5342
- this.videoStarted = undefined;
5343
- this.cameraSize = undefined;
5344
- this.captureTaken = undefined;
5345
- this.verified = undefined;
5346
- this.titleMesage = undefined;
5347
- this.showDemo = undefined;
5348
- this.demoVideo = undefined;
5349
- this.captureTaken = false;
5350
- this.verified = false;
5351
- this.cameras = new Cameras();
5352
- this.showDemo = true;
5353
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.CiTilt);
5354
- }
5355
- eventVideoStarted(event) {
5356
- this.videoStarted = true;
5357
- this.cameraSize = event.detail;
5358
- }
5359
- async componentWillLoad() {
5360
- this.translations = await TranslationUtils.Translations.getValues();
5361
- this.titleMesage = this.translations.IdCaptureValues.IDPoseMapping;
5362
- //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
5363
- if (!navigator.mediaDevices) {
5364
- this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
5365
- }
5366
- }
5367
- async componentDidLoad() {
5368
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiTilt, TranslationUtils.FlowMoments.Initialized);
5369
- this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[IDPose.Tilted];
5145
+ this.demoVideo.src = TranslationUtils.IdCaptureValues.IDPoseDemoMapping[this.pose];
5370
5146
  this.demoVideo.play();
5371
5147
  await delay(this.translations.GlobalValues.VideoLenght);
5372
5148
  this.showDemo = false;
@@ -5378,7 +5154,7 @@ const IdTilt = class {
5378
5154
  navigator.mediaDevices
5379
5155
  .getUserMedia(constraints)
5380
5156
  .then(stream => {
5381
- const superStream = Stream.getNewInstance(VerificationMode.Tilt);
5157
+ const superStream = Stream.getNewInstance(this.verificationMode);
5382
5158
  superStream.initStream(stream);
5383
5159
  })
5384
5160
  .catch(e => {
@@ -5409,7 +5185,7 @@ const IdTilt = class {
5409
5185
  else {
5410
5186
  this.eventTimeElapsed.emit();
5411
5187
  }
5412
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.CiTilt, TranslationUtils.FlowMoments.Finalized);
5188
+ await this.baseComponent.logStep(this.flowStep, TranslationUtils.FlowMoments.Finalized);
5413
5189
  }
5414
5190
  async verificationFinished() {
5415
5191
  if (this.verified)
@@ -5417,15 +5193,11 @@ const IdTilt = class {
5417
5193
  this.verified = true;
5418
5194
  this.titleMesage = this.translations.IdCaptureValues.Loading;
5419
5195
  this.closeCamera();
5420
- this.showDemo = true;
5421
- var loops = 0;
5422
5196
  this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
5423
- this.demoVideo.loop = false;
5424
- while (loops < 7) {
5425
- loops++;
5426
- this.demoVideo.play();
5427
- await delay(this.translations.GlobalValues.VideoLenght);
5428
- }
5197
+ this.demoVideo.loop = true;
5198
+ this.showDemo = true;
5199
+ this.demoVideo.play();
5200
+ await delay(10000);
5429
5201
  this.eventTimeElapsed.emit();
5430
5202
  }
5431
5203
  render() {
@@ -5441,13 +5213,12 @@ const IdTilt = class {
5441
5213
  cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
5442
5214
  }
5443
5215
  let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
5444
- //let videoClass = this.device.isMobile ? '' : 'video-demo';
5445
5216
  let bgDemo = this.verified ? 'container' : 'container bg-black';
5446
- return (index.h("div", { class: bgDemo }, index.h("div", { class: "container-video" }, index.h("div", { hidden: this.showDemo == false }, index.h("video", { id: "howtoFront", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { hidden: this.showDemo }, index.h("div", { hidden: this.verified }, index.h("div", { class: "video-capture" }, index.h("div", { style: cameraStyle }, index.h("div", { style: cameraStyleInner }, index.h("camera-comp", { "capture-mode": "tilt" })))))), index.h("div", { class: "capture-title" }, index.h("h1", { class: titleClass }, this.titleMesage), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))));
5217
+ return (index.h("div", { class: bgDemo }, index.h("div", { class: "container-video" }, index.h("div", { hidden: this.showDemo == false }, index.h("video", { id: "howTo", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { hidden: this.showDemo }, index.h("div", { hidden: this.verified }, index.h("div", { class: "video-capture" }, index.h("div", { style: cameraStyle }, index.h("div", { style: cameraStyleInner }, index.h("camera-comp", { "capture-mode": "id" })))))), index.h("div", { class: "capture-title" }, index.h("h1", { class: titleClass }, this.titleMesage), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))));
5447
5218
  }
5448
5219
  get component() { return index.getElement(this); }
5449
5220
  };
5450
- IdTilt.style = idTiltCss;
5221
+ IdCapture.style = idCaptureCss;
5451
5222
 
5452
5223
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
5453
5224
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -5515,7 +5286,7 @@ function v4(options, buf, offset) {
5515
5286
  }
5516
5287
 
5517
5288
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5518
- const version$1 = "3.6.40";
5289
+ const version$1 = "3.6.41";
5519
5290
  const description = "Person Identification Component";
5520
5291
  const main = "./dist/index.cjs.js";
5521
5292
  const module$1 = "./dist/index.js";
@@ -5637,6 +5408,7 @@ const IdentificationComponent = class {
5637
5408
  index.registerInstance(this, hostRef);
5638
5409
  this.logInit = {};
5639
5410
  this.flowStatusToSet = TranslationUtils.FlowStatus.NONE;
5411
+ this.initialised = false;
5640
5412
  this.token = undefined;
5641
5413
  this.order_id = undefined;
5642
5414
  this.api_url = undefined;
@@ -5644,7 +5416,6 @@ const IdentificationComponent = class {
5644
5416
  this.redirect_id = undefined;
5645
5417
  this.phone_number = undefined;
5646
5418
  this.lang_iso = undefined;
5647
- this.idSide = '';
5648
5419
  this.errorMessage = undefined;
5649
5420
  this.errorTitle = undefined;
5650
5421
  }
@@ -5679,33 +5450,14 @@ const IdentificationComponent = class {
5679
5450
  if (this.lang_iso && this.lang_iso != '') {
5680
5451
  TranslationUtils.state.langIso = this.lang_iso;
5681
5452
  }
5682
- var ini = sessionStorage.getItem(TranslationUtils.SessionKeys.InitialisedKey);
5683
- if (ini && ini.toLowerCase() == 'true') {
5684
- TranslationUtils.state.initialised = true;
5685
- }
5686
- var hasIdBk = sessionStorage.getItem(TranslationUtils.SessionKeys.HasIdBackKey);
5687
- if (hasIdBk && hasIdBk.toLowerCase() == 'true') {
5688
- TranslationUtils.state.hasIdBack = true;
5689
- }
5690
- var agrVal = sessionStorage.getItem(TranslationUtils.SessionKeys.AgreementValidationKey);
5691
- if (agrVal && agrVal.toLowerCase() == 'true') {
5692
- TranslationUtils.state.agreementsValidation = true;
5693
- }
5694
- var phoneVal = sessionStorage.getItem(TranslationUtils.SessionKeys.PhoneValidationKey);
5695
- if (phoneVal && phoneVal.toLowerCase() == 'true') {
5696
- TranslationUtils.state.phoneValidation = true;
5697
- }
5698
5453
  const savedRequest = sessionStorage.getItem(TranslationUtils.SessionKeys.RequestIdKey);
5454
+ if (savedRequest && savedRequest != '' && savedRequest != this.order_id && TranslationUtils.state.debug) {
5455
+ console.log('Session RequestId: ' + savedRequest + ' has different value than property one: ' + this.order_id);
5456
+ }
5699
5457
  if (this.order_id && this.order_id != '') {
5700
5458
  TranslationUtils.state.requestId = this.order_id;
5701
5459
  if (TranslationUtils.state.debug)
5702
5460
  console.log('Current RequestId has value: ' + this.order_id);
5703
- if (savedRequest && savedRequest != '' && savedRequest != this.order_id) {
5704
- if (TranslationUtils.state.debug)
5705
- console.log('Session RequestId: ' + savedRequest + ' has different value than property one: ' + this.order_id);
5706
- this.flowStatusToSet = TranslationUtils.FlowStatus.LANDING;
5707
- TranslationUtils.state.initialised = false;
5708
- }
5709
5461
  }
5710
5462
  else if (savedRequest) {
5711
5463
  if (TranslationUtils.state.debug)
@@ -5727,17 +5479,12 @@ const IdentificationComponent = class {
5727
5479
  await this.initializeRequest();
5728
5480
  TranslationUtils.state.flowStatus = this.flowStatusToSet;
5729
5481
  }
5730
- componentWillRender() {
5731
- if (this.idSide == '') {
5732
- this.idSide = TranslationUtils.state.hasIdBack ? 'front' : '';
5733
- }
5734
- }
5735
5482
  async initializeRequest() {
5736
- if (TranslationUtils.state.initialised) {
5483
+ if (this.initialised) {
5737
5484
  return;
5738
5485
  }
5486
+ this.initialised = true;
5739
5487
  if (TranslationUtils.state.environment == 'DEMO') {
5740
- TranslationUtils.state.initialised = true;
5741
5488
  return;
5742
5489
  }
5743
5490
  if (TranslationUtils.state.device.browser == Browser.Mi) {
@@ -5755,7 +5502,7 @@ const IdentificationComponent = class {
5755
5502
  this.redirect_id = TranslationUtils.state.redirectId;
5756
5503
  }
5757
5504
  if (TranslationUtils.state.token != '' && (TranslationUtils.state.requestId != '' || TranslationUtils.state.redirectId != '')) {
5758
- TranslationUtils.state.initialised = await this.baseComponent.apiCall.AddIdentificationRequest(TranslationUtils.state.device, packageJson.version);
5505
+ await this.baseComponent.apiCall.AddIdentificationRequest(TranslationUtils.state.device, packageJson.version);
5759
5506
  if (!this.order_id || this.order_id == '') {
5760
5507
  this.order_id = TranslationUtils.state.requestId;
5761
5508
  }
@@ -5771,19 +5518,17 @@ const IdentificationComponent = class {
5771
5518
  }
5772
5519
  render() {
5773
5520
  let currentBlock = (index.h("div", { class: "container" }, index.h("div", { class: "row" }, index.h("div", { class: "div-ci align-center" }, index.h("img", { src: loaderSvg })))));
5774
- if (TranslationUtils.state.device.isMobile || TranslationUtils.state.environment == 'DEMO') {
5775
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LANDING) {
5776
- currentBlock = index.h("landing-validation", null);
5777
- }
5521
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LANDING) {
5522
+ currentBlock = index.h("landing-validation", null);
5778
5523
  }
5779
- else if (TranslationUtils.state.flowStatus != TranslationUtils.FlowStatus.NONE) {
5524
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.MOBILE) {
5780
5525
  currentBlock = index.h("mobile-redirect", null);
5781
5526
  }
5782
5527
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.AGREEMENT) {
5783
5528
  currentBlock = index.h("agreement-info", null);
5784
5529
  }
5785
5530
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.PHONE) {
5786
- currentBlock = index.h("sms-code-validation", null);
5531
+ currentBlock = index.h("sms-send", null);
5787
5532
  }
5788
5533
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODE) {
5789
5534
  currentBlock = index.h("sms-code-validation", null);
@@ -5791,11 +5536,11 @@ const IdentificationComponent = class {
5791
5536
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODEERROR) {
5792
5537
  currentBlock = index.h("sms-code-validation", null);
5793
5538
  }
5794
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.ID) {
5539
+ if (TranslationUtils.state.flowStatus in [TranslationUtils.FlowStatus.IDFRONT, TranslationUtils.FlowStatus.IDBACK, TranslationUtils.FlowStatus.IDTILT]) {
5795
5540
  currentBlock = index.h("process-id", null);
5796
5541
  }
5797
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESS) {
5798
- currentBlock = index.h("user-liveness", { id: "camera" });
5542
+ if (TranslationUtils.state.flowStatus in [TranslationUtils.FlowStatus.LIVENESS, TranslationUtils.FlowStatus.LIVENESSGESTURE]) {
5543
+ currentBlock = index.h("user-liveness", null);
5799
5544
  }
5800
5545
  if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.COMPLETE) {
5801
5546
  currentBlock = index.h("end-redirect", null);
@@ -5846,33 +5591,25 @@ const LandingValidation = class {
5846
5591
  }
5847
5592
  }
5848
5593
  async initRequest() {
5849
- if (TranslationUtils.state.hasIdBack) {
5850
- this.warningText = this.translations.LandingValues.WarningMd;
5851
- }
5852
- else {
5853
- this.warningText = this.translations.LandingValues.Warning;
5854
- }
5594
+ this.warningText = this.translations.LandingValues.Warning;
5855
5595
  }
5856
5596
  async startFlow() {
5857
- if (TranslationUtils.state.initialised) {
5597
+ if (!this.buttonDisabled) {
5858
5598
  this.buttonDisabled = true;
5859
5599
  if (TranslationUtils.state.environment === 'DEMO') {
5860
5600
  TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.COMPLETE;
5861
5601
  return;
5862
5602
  }
5863
- if (!(await Cameras.InitCameras(TranslationUtils.state.device))) {
5603
+ var cameraIsAccessible = await Cameras.InitCameras(TranslationUtils.state.device);
5604
+ if (!cameraIsAccessible) {
5864
5605
  if (TranslationUtils.state.device.mobileOS == MobileOS.iOS)
5865
5606
  sessionStorage.setItem(TranslationUtils.SessionKeys.RefreshDoneKey, 'false');
5866
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.CAMERAERROR;
5867
5607
  }
5868
- else if (TranslationUtils.state.agreementsValidation) {
5869
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.AGREEMENT;
5608
+ try {
5609
+ TranslationUtils.state.flowStatus = await this.baseComponent.apiCall.LandingValidationStartFlow(cameraIsAccessible);
5870
5610
  }
5871
- else if (TranslationUtils.state.phoneValidation) {
5872
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.PHONE;
5873
- }
5874
- else {
5875
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.ID;
5611
+ catch (e) {
5612
+ this.apiErrorEvent.emit(e);
5876
5613
  }
5877
5614
  }
5878
5615
  }
@@ -5882,9 +5619,9 @@ const LandingValidation = class {
5882
5619
  async leaveFlow() {
5883
5620
  if (this.buttonDisabled)
5884
5621
  return;
5885
- TranslationUtils.state.initialised = false;
5886
5622
  try {
5887
- await this.baseComponent.apiCall.AbortRequest();
5623
+ let abortResult = await this.baseComponent.apiCall.AbortRequest();
5624
+ TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[abortResult.state];
5888
5625
  Events.flowAborted();
5889
5626
  }
5890
5627
  catch (e) {
@@ -5893,7 +5630,7 @@ const LandingValidation = class {
5893
5630
  }
5894
5631
  }
5895
5632
  render() {
5896
- return (index.h("div", { class: "container" }, index.h("div", { class: "row" }, index.h("div", null, index.h("h1", { class: "text-center" }, this.translations.LandingValues.Title), index.h("div", { class: "d-flex space-between align-center" }, index.h("p", { class: "main-text font-size-2" }, this.translations.LandingValues.Description), index.h("div", { class: "img-info" }, index.h("div", { class: "i-effect" }), index.h("img", { src: infoSvg })))), index.h("div", { class: "info-container" }, index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: idSvg })), index.h("h3", null, this.translations.LandingValues.IdInfo)), index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: deviceSvg })), index.h("h3", null, this.translations.LandingValues.DeviceInfo)), index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: validationSvg })), index.h("h3", null, this.translations.LandingValues.SmsInfo))), index.h("div", { class: "terms-container" }, index.h("h3", { class: "font-size-2 mb-1 text-center" }, this.warningText)), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { class: "main-button", type: "button", disabled: !TranslationUtils.state.initialised || this.buttonDisabled, onClick: () => this.startFlow() }, this.translations.LandingValues.Button), index.h("p", { class: "main-text font-size-2 link-text mb-0", onClick: () => this.leaveFlow() }, this.translations.LandingValues.ButtonLeave), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
5633
+ return (index.h("div", { class: "container" }, index.h("div", { class: "row" }, index.h("div", null, index.h("h1", { class: "text-center" }, this.translations.LandingValues.Title), index.h("div", { class: "d-flex space-between align-center" }, index.h("p", { class: "main-text font-size-2" }, this.translations.LandingValues.Description), index.h("div", { class: "img-info" }, index.h("div", { class: "i-effect" }), index.h("img", { src: infoSvg })))), index.h("div", { class: "info-container" }, index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: idSvg })), index.h("h3", null, this.translations.LandingValues.IdInfo)), index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: deviceSvg })), index.h("h3", null, this.translations.LandingValues.DeviceInfo)), index.h("div", { class: "img-text" }, index.h("div", { class: "bg-img" }, index.h("img", { src: validationSvg })), index.h("h3", null, this.translations.LandingValues.SmsInfo))), index.h("div", { class: "terms-container" }, index.h("h3", { class: "font-size-2 mb-1 text-center" }, this.warningText)), 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.startFlow() }, this.translations.LandingValues.Button), index.h("p", { class: "main-text font-size-2 link-text mb-0", onClick: () => this.leaveFlow() }, this.translations.LandingValues.ButtonLeave), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
5897
5634
  }
5898
5635
  };
5899
5636
  LandingValidation.style = landingValidationCss;
@@ -8797,7 +8534,7 @@ const MobileRedirect = class {
8797
8534
  this.infoTextTop = this.translations.MobileRedirectValues.InfoTop;
8798
8535
  this.infoTextBottom = this.translations.MobileRedirectValues.InfoBottom;
8799
8536
  let envUri = TranslationUtils.state.environment == 'QA' ? 'test' : 'ect';
8800
- let baseUri = TranslationUtils.state.hasIdBack ? 'https://onmd.id-kyc.com/' : 'https://onro.id-kyc.com/';
8537
+ let baseUri = TranslationUtils.state.apiBaseUrl.includes("apimd") ? 'https://onmd.id-kyc.com/' : 'https://onro.id-kyc.com/';
8801
8538
  this.redirectLink = baseUri + envUri + '/mobileredirect?redirectId=' + TranslationUtils.state.redirectId;
8802
8539
  if (TranslationUtils.state.phoneNumber && TranslationUtils.state.phoneNumber != '') {
8803
8540
  this.contact = TranslationUtils.state.phoneNumber;
@@ -8880,23 +8617,7 @@ var CaptureUploadTypes;
8880
8617
  CaptureUploadTypes["SelfieGestureVideo"] = "SelfieGestureVideo";
8881
8618
  CaptureUploadTypes["TiltVideo"] = "TiltVideo";
8882
8619
  CaptureUploadTypes["None"] = "None";
8883
- })(CaptureUploadTypes || (CaptureUploadTypes = {}));
8884
- var IdCaptureFlowStatus;
8885
- (function (IdCaptureFlowStatus) {
8886
- IdCaptureFlowStatus[IdCaptureFlowStatus["HowToFront"] = 0] = "HowToFront";
8887
- IdCaptureFlowStatus[IdCaptureFlowStatus["IdFront"] = 1] = "IdFront";
8888
- IdCaptureFlowStatus[IdCaptureFlowStatus["HowToBack"] = 2] = "HowToBack";
8889
- IdCaptureFlowStatus[IdCaptureFlowStatus["IdBack"] = 3] = "IdBack";
8890
- IdCaptureFlowStatus[IdCaptureFlowStatus["Tilt"] = 4] = "Tilt";
8891
- IdCaptureFlowStatus[IdCaptureFlowStatus["End"] = 5] = "End";
8892
- })(IdCaptureFlowStatus || (IdCaptureFlowStatus = {}));
8893
- var SelfieFlowStatus;
8894
- (function (SelfieFlowStatus) {
8895
- SelfieFlowStatus[SelfieFlowStatus["HowToSelfie"] = 0] = "HowToSelfie";
8896
- SelfieFlowStatus[SelfieFlowStatus["Selfie"] = 1] = "Selfie";
8897
- SelfieFlowStatus[SelfieFlowStatus["Gesture"] = 2] = "Gesture";
8898
- SelfieFlowStatus[SelfieFlowStatus["End"] = 3] = "End";
8899
- })(SelfieFlowStatus || (SelfieFlowStatus = {}));
8620
+ })(CaptureUploadTypes || (CaptureUploadTypes = {}));
8900
8621
 
8901
8622
  const processIdCss = "";
8902
8623
 
@@ -8905,7 +8626,6 @@ const ProcessId = class {
8905
8626
  index.registerInstance(this, hostRef);
8906
8627
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
8907
8628
  this.recordingResultCount = 0;
8908
- this.captureStep = undefined;
8909
8629
  this.showTimeout = undefined;
8910
8630
  this.showInvalid = undefined;
8911
8631
  this.flow = undefined;
@@ -8917,47 +8637,42 @@ const ProcessId = class {
8917
8637
  this.initFlow();
8918
8638
  }
8919
8639
  initFlow() {
8920
- this.flow = {
8921
- front: {
8922
- photoDone: false,
8923
- recordingDone: false,
8924
- fileName: 'idImage.png',
8925
- recName: 'idVideo.',
8926
- photoType: CaptureUploadTypes.IdFront,
8927
- recType: CaptureUploadTypes.IdFrontVideo,
8928
- },
8929
- back: null,
8930
- tilt: null,
8931
- };
8932
- if (TranslationUtils.state.hasIdBack) {
8933
- this.flow.back = {
8934
- photoDone: false,
8935
- recordingDone: false,
8936
- fileName: 'idBackImage.png',
8937
- recName: 'idBackVideo.',
8938
- photoType: CaptureUploadTypes.IdBack,
8939
- recType: CaptureUploadTypes.IdBackVideo,
8640
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDFRONT) {
8641
+ this.flow = {
8642
+ capture: {
8643
+ fileName: 'idImage.png',
8644
+ recName: 'idVideo.',
8645
+ photoType: CaptureUploadTypes.IdFront,
8646
+ recType: CaptureUploadTypes.IdFrontVideo,
8647
+ },
8648
+ howToDone: false,
8649
+ };
8650
+ }
8651
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDBACK) {
8652
+ this.flow = {
8653
+ capture: {
8654
+ fileName: 'idBackImage.png',
8655
+ recName: 'idBackVideo.',
8656
+ photoType: CaptureUploadTypes.IdBack,
8657
+ recType: CaptureUploadTypes.IdBackVideo,
8658
+ },
8659
+ howToDone: false,
8940
8660
  };
8941
8661
  }
8942
- if (TranslationUtils.state.hasIdTilt) {
8943
- this.flow.tilt = {
8944
- photoDone: true,
8945
- recordingDone: false,
8946
- fileName: 'idTiltImage.png',
8947
- recName: 'idTiltVideo.',
8948
- photoType: CaptureUploadTypes.None,
8949
- recType: CaptureUploadTypes.TiltVideo,
8662
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.IDTILT) {
8663
+ this.flow = {
8664
+ capture: {
8665
+ fileName: 'idTiltImage.png',
8666
+ recName: 'idTiltVideo.',
8667
+ photoType: CaptureUploadTypes.None,
8668
+ recType: CaptureUploadTypes.TiltVideo,
8669
+ },
8670
+ howToDone: false,
8950
8671
  };
8951
8672
  }
8952
- this.captureStep = IdCaptureFlowStatus.HowToFront;
8953
8673
  }
8954
8674
  howToDone() {
8955
- if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
8956
- this.captureStep = IdCaptureFlowStatus.IdFront;
8957
- }
8958
- if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
8959
- this.captureStep = IdCaptureFlowStatus.IdBack;
8960
- }
8675
+ this.flow.howToDone = true;
8961
8676
  }
8962
8677
  timeElapsed() {
8963
8678
  this.showTimeout = true;
@@ -8978,34 +8693,20 @@ const ProcessId = class {
8978
8693
  return;
8979
8694
  }
8980
8695
  try {
8981
- let frontCapture = new File([idPhoto], this.flow.front.fileName, { type: 'image/png' });
8982
- this.flow.front.photoDone = await this.uploadPhotos(this.flow.front.photoType, frontCapture);
8983
- await this.endFlow();
8696
+ let frontCapture = new File([idPhoto], this.flow.capture.fileName, { type: 'image/png' });
8697
+ let uploadPhotoDone = await this.uploadPhotos(this.flow.capture.photoType, frontCapture);
8698
+ if (!uploadPhotoDone) {
8699
+ this.triggerErrorFlow();
8700
+ }
8984
8701
  }
8985
8702
  catch (e) {
8986
8703
  this.apiErrorEvent.emit(e);
8987
8704
  }
8988
8705
  }
8989
- async captureIdBackImage(event) {
8990
- let idPhoto = event.detail;
8991
- if (idPhoto.size == 0) {
8992
- await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
8993
- this.triggerErrorFlow();
8994
- return;
8995
- }
8996
- try {
8997
- let backCapture = new File([idPhoto], this.flow.back.fileName, { type: 'image/png' });
8998
- this.flow.back.photoDone = await this.uploadPhotos(this.flow.back.photoType, backCapture);
8999
- await this.endFlow();
9000
- }
9001
- catch (e) {
9002
- this.apiErrorEvent.emit(e);
9003
- }
9004
- }
9005
- async capturedIdRecording(event) {
9006
- let idRecording = event.detail;
9007
- if (idRecording.size == 0 && this.recordingResultCount == 0) {
9008
- this.recordingResultCount++;
8706
+ async capturedIdRecording(event) {
8707
+ let idRecording = event.detail;
8708
+ if (idRecording.size == 0 && this.recordingResultCount == 0) {
8709
+ this.recordingResultCount++;
9009
8710
  return;
9010
8711
  }
9011
8712
  if (idRecording.size == 0) {
@@ -9014,22 +8715,11 @@ const ProcessId = class {
9014
8715
  return;
9015
8716
  }
9016
8717
  let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
9017
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
9018
- let frontRec = new File([idRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
9019
- this.flow.front.recordingDone = await this.uploadRecording(this.flow.front.recType, frontRec);
9020
- }
9021
- else if (this.captureStep == IdCaptureFlowStatus.IdBack) {
9022
- let backRec = new File([idRecording], this.flow.back.recName + mimeType.extension, { type: mimeType.type });
9023
- this.flow.back.recordingDone = await this.uploadRecording(this.flow.back.recType, backRec);
9024
- }
9025
- else if (this.captureStep == IdCaptureFlowStatus.Tilt) {
9026
- let tiltRec = new File([idRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
9027
- this.flow.tilt.recordingDone = await this.uploadRecording(this.flow.tilt.recType, tiltRec);
9028
- }
9029
- else {
9030
- this.triggerErrorFlow(true);
8718
+ let captureRec = new File([idRecording], this.flow.capture.recName + mimeType.extension, { type: mimeType.type });
8719
+ let recordingUploaded = await this.uploadRecording(this.flow.capture.recType, captureRec);
8720
+ if (!recordingUploaded) {
8721
+ this.triggerErrorFlow();
9031
8722
  }
9032
- await this.endFlow();
9033
8723
  this.recordingResultCount = 0;
9034
8724
  }
9035
8725
  async componentDidLoad() {
@@ -9062,72 +8752,9 @@ const ProcessId = class {
9062
8752
  }
9063
8753
  return false;
9064
8754
  }
9065
- triggerErrorFlow(restart = false) {
9066
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
9067
- restart = true;
9068
- }
9069
- if (restart) {
9070
- this.initFlow();
9071
- this.showInvalid = true;
9072
- return;
9073
- }
9074
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
9075
- this.flow.front.photoDone = false;
9076
- this.flow.front.recordingDone = false;
9077
- }
9078
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
9079
- this.flow.back.photoDone = false;
9080
- this.flow.back.recordingDone = false;
9081
- }
9082
- if (this.captureStep == IdCaptureFlowStatus.Tilt) {
9083
- this.flow.tilt.photoDone = true;
9084
- this.flow.tilt.recordingDone = false;
9085
- }
8755
+ triggerErrorFlow() {
9086
8756
  this.showInvalid = true;
9087
8757
  }
9088
- async endFlow() {
9089
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
9090
- if (this.flow.front.photoDone && this.flow.front.recordingDone) {
9091
- if (TranslationUtils.state.hasIdBack) {
9092
- this.captureStep = IdCaptureFlowStatus.IdBack;
9093
- }
9094
- else if (TranslationUtils.state.hasIdTilt) {
9095
- this.captureStep = IdCaptureFlowStatus.Tilt;
9096
- }
9097
- else {
9098
- this.captureStep = IdCaptureFlowStatus.End;
9099
- }
9100
- }
9101
- else {
9102
- return;
9103
- }
9104
- }
9105
- if (this.captureStep == IdCaptureFlowStatus.IdBack && TranslationUtils.state.hasIdBack) {
9106
- if (this.flow.back.photoDone && this.flow.back.recordingDone) {
9107
- if (TranslationUtils.state.hasIdTilt) {
9108
- this.captureStep = IdCaptureFlowStatus.Tilt;
9109
- }
9110
- else {
9111
- this.captureStep = IdCaptureFlowStatus.End;
9112
- }
9113
- }
9114
- else {
9115
- return;
9116
- }
9117
- }
9118
- if (this.captureStep == IdCaptureFlowStatus.Tilt && TranslationUtils.state.hasIdTilt) {
9119
- if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
9120
- this.captureStep = IdCaptureFlowStatus.End;
9121
- }
9122
- else {
9123
- return;
9124
- }
9125
- }
9126
- if (this.captureStep != IdCaptureFlowStatus.End) {
9127
- return;
9128
- }
9129
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.LIVENESS;
9130
- }
9131
8758
  async disconnectedCallback() {
9132
8759
  await this.baseComponent.finalize();
9133
8760
  }
@@ -9143,30 +8770,17 @@ const ProcessId = class {
9143
8770
  }
9144
8771
  render() {
9145
8772
  let error = index.h("capture-error", { type: "ID" });
9146
- let frontCapture = index.h("id-capture", null);
9147
- let secondCapture = index.h("id-back-capture", null);
9148
- let tiltCapture = index.h("id-tilt", null);
9149
- let howToFront = index.h("how-to-info", { idSide: "front" });
9150
- let howToBack = index.h("how-to-info", { idSide: "back" });
8773
+ let capture = index.h("id-capture", null);
8774
+ let howTo = index.h("how-to-info", null);
9151
8775
  if (this.showInvalid || this.showTimeout) {
9152
8776
  return error;
9153
8777
  }
9154
- if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
9155
- return howToFront;
9156
- }
9157
- if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
9158
- return howToBack;
9159
- }
9160
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
9161
- return frontCapture;
9162
- }
9163
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
9164
- return secondCapture;
8778
+ if (TranslationUtils.state.flowStatus != TranslationUtils.FlowStatus.IDTILT && this.flow.howToDone) {
8779
+ return howTo;
9165
8780
  }
9166
- if (this.captureStep == IdCaptureFlowStatus.Tilt) {
9167
- return tiltCapture;
8781
+ else {
8782
+ return capture;
9168
8783
  }
9169
- return index.h("div", null);
9170
8784
  }
9171
8785
  };
9172
8786
  ProcessId.style = processIdCss;
@@ -9174,31 +8788,23 @@ ProcessId.style = processIdCss;
9174
8788
  const selfieCaptureCss = "";
9175
8789
 
9176
8790
  const SelfieCapture = class {
9177
- // @State() private animationPath: string;
9178
8791
  constructor(hostRef) {
9179
8792
  index.registerInstance(this, hostRef);
9180
8793
  this.eventPhotoCapture = index.createEvent(this, "photoSelfieCapture", 7);
9181
8794
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
9182
8795
  this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
9183
- this.photoIsReady = photos => {
9184
- //this.closeCamera();
9185
- this.eventPhotoCapture.emit(photos);
9186
- };
9187
8796
  this.videoStarted = undefined;
9188
8797
  this.captureTaken = undefined;
9189
8798
  this.verified = undefined;
9190
8799
  this.titleMesage = undefined;
9191
8800
  this.demoEnded = undefined;
9192
8801
  this.demoVideo = undefined;
9193
- this.uploadingLink = undefined;
9194
8802
  this.captureHeight = undefined;
9195
8803
  this.captureWidth = undefined;
9196
8804
  this.captureTaken = false;
9197
8805
  this.verified = false;
9198
8806
  this.cameras = new Cameras();
9199
8807
  this.demoEnded = false;
9200
- this.uploadingLink = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
9201
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.SelfieCapture);
9202
8808
  }
9203
8809
  eventVideoStarted(event) {
9204
8810
  this.videoStarted = true;
@@ -9216,8 +8822,20 @@ const SelfieCapture = class {
9216
8822
  }
9217
8823
  }
9218
8824
  async componentDidLoad() {
9219
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.SelfieCapture, TranslationUtils.FlowMoments.Initialized);
9220
- this.demoVideo.src = TranslationUtils.SelfieCaptureValues.FacePoseDemoMapping[FacePose.Main];
8825
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESS) {
8826
+ this.verificationMode = VerificationMode.Full;
8827
+ this.currentStep = TranslationUtils.FlowSteps.SelfieCapture;
8828
+ this.mainStream = Stream.getNewInstance(this.verificationMode);
8829
+ this.demoVideo.src = TranslationUtils.SelfieCaptureValues.FacePoseDemoMapping[FacePose.Main];
8830
+ }
8831
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESSGESTURE) {
8832
+ this.verificationMode = VerificationMode.Tilt;
8833
+ this.currentStep = TranslationUtils.FlowSteps.SelfieTilt;
8834
+ this.mainStream = Stream.getNewInstance(this.verificationMode);
8835
+ this.demoVideo.src = TranslationUtils.SelfieCaptureValues.FacePoseDemoMapping[this.mainStream.facePose];
8836
+ }
8837
+ this.baseComponent = new BaseComponent(this.currentStep);
8838
+ await this.baseComponent.logStep(this.currentStep, TranslationUtils.FlowMoments.Initialized);
9221
8839
  this.demoVideo.play();
9222
8840
  await delay(this.translations.GlobalValues.VideoLenght);
9223
8841
  this.demoEnded = true;
@@ -9229,8 +8847,7 @@ const SelfieCapture = class {
9229
8847
  navigator.mediaDevices
9230
8848
  .getUserMedia(constraints)
9231
8849
  .then(stream => {
9232
- const superStream = Stream.getNewInstance(VerificationMode.Full);
9233
- superStream.initStream(stream);
8850
+ this.mainStream.initStream(stream);
9234
8851
  })
9235
8852
  .catch(e => {
9236
8853
  this.closeCamera();
@@ -9239,8 +8856,8 @@ const SelfieCapture = class {
9239
8856
  }, 100);
9240
8857
  }
9241
8858
  closeCamera() {
9242
- if (Stream.instance) {
9243
- Stream.instance.dropStream();
8859
+ if (this.mainStream) {
8860
+ this.mainStream.dropStream();
9244
8861
  }
9245
8862
  }
9246
8863
  disconnectedCallback() {
@@ -9252,14 +8869,14 @@ const SelfieCapture = class {
9252
8869
  if (this.captureTaken)
9253
8870
  return;
9254
8871
  this.captureTaken = true;
9255
- if (Stream.instance) {
9256
- let res = await Stream.instance.takePhoto();
9257
- this.photoIsReady(res);
8872
+ if (this.mainStream) {
8873
+ let res = await this.mainStream.takePhoto();
8874
+ this.eventPhotoCapture.emit(res);
9258
8875
  }
9259
8876
  else {
9260
8877
  this.eventTimeElapsed.emit();
9261
8878
  }
9262
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.SelfieCapture, TranslationUtils.FlowMoments.Finalized);
8879
+ await this.baseComponent.logStep(this.currentStep, TranslationUtils.FlowMoments.Finalized);
9263
8880
  }
9264
8881
  async verificationFinished() {
9265
8882
  if (this.verified)
@@ -9268,14 +8885,10 @@ const SelfieCapture = class {
9268
8885
  this.titleMesage = this.translations.SelfieCaptureValues.Loading;
9269
8886
  this.closeCamera();
9270
8887
  this.demoEnded = false;
9271
- var loops = 0;
9272
- this.demoVideo.src = this.uploadingLink;
9273
- this.demoVideo.loop = false;
9274
- while (loops < 7) {
9275
- loops++;
9276
- this.demoVideo.play();
9277
- await delay(this.translations.GlobalValues.VideoLenght);
9278
- }
8888
+ this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
8889
+ this.demoVideo.loop = true;
8890
+ this.demoVideo.play();
8891
+ await delay(10000);
9279
8892
  this.eventTimeElapsed.emit();
9280
8893
  }
9281
8894
  render() {
@@ -9299,169 +8912,79 @@ const SelfieCapture = class {
9299
8912
  };
9300
8913
  SelfieCapture.style = selfieCaptureCss;
9301
8914
 
9302
- const selfieTiltCss = "";
8915
+ const smsCodeValidationCss = "";
9303
8916
 
9304
- const SelfieTilt = class {
9305
- // @State() private animationPath: string;
8917
+ const SmsCodeValidation = class {
9306
8918
  constructor(hostRef) {
9307
8919
  index.registerInstance(this, hostRef);
9308
- this.eventPhotoCapture = index.createEvent(this, "photoSelfieTiltCapture", 7);
9309
8920
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
9310
- this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
9311
- this.photoIsReady = photos => {
9312
- //this.closeCamera();
9313
- this.eventPhotoCapture.emit(photos);
9314
- };
9315
- this.videoStarted = undefined;
9316
- this.captureTaken = undefined;
9317
- this.verified = undefined;
9318
- this.titleMesage = undefined;
9319
- this.demoEnded = undefined;
9320
- this.demoVideo = undefined;
9321
- this.uploadingLink = undefined;
9322
- this.captureHeight = undefined;
9323
- this.captureWidth = undefined;
9324
- this.captureTaken = false;
9325
- this.verified = false;
9326
- this.cameras = new Cameras();
9327
- this.demoEnded = false;
9328
- this.uploadingLink = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
9329
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.SelfieTilt);
9330
- }
9331
- eventVideoStarted(event) {
9332
- this.videoStarted = true;
9333
- var cameraSize = event.detail;
9334
- var height = Math.round((cameraSize.width * 16) / 9);
9335
- this.captureHeight = height - Math.round((window.screen.height - height) / 2);
9336
- this.captureWidth = Math.round((this.captureHeight * 9) / 16);
8921
+ this.title = undefined;
8922
+ this.details = undefined;
8923
+ this.buttonText = undefined;
8924
+ this.code = undefined;
8925
+ this.canSend = false;
8926
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.OtpCheck);
8927
+ this.baseComponent.setEventEmitter(this.apiErrorEvent);
9337
8928
  }
9338
- async componentWillLoad() {
9339
- this.translations = await TranslationUtils.Translations.getValues();
9340
- this.titleMesage = this.translations.SelfieCaptureValues.Title;
9341
- //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
9342
- if (!navigator.mediaDevices) {
9343
- this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
8929
+ async doAction() {
8930
+ try {
8931
+ this.canSend = false;
8932
+ var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(TranslationUtils.state.requestId, this.code);
8933
+ TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeChecked.status];
9344
8934
  }
9345
- }
9346
- async componentDidLoad() {
9347
- this.mainStream = Stream.getNewInstance(VerificationMode.Tilt);
9348
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.SelfieTilt, TranslationUtils.FlowMoments.Initialized);
9349
- this.titleMesage = this.translations.SelfieCaptureValues.FacePoseMapping[this.mainStream.facePose];
9350
- this.demoEnded = false;
9351
- this.demoVideo.src = TranslationUtils.SelfieCaptureValues.FacePoseDemoMapping[this.mainStream.facePose];
9352
- this.demoVideo.play();
9353
- await delay(this.translations.GlobalValues.VideoLenght);
9354
- this.demoEnded = true;
9355
- this.openCamera();
9356
- }
9357
- async openCamera() {
9358
- const constraints = this.cameras.GetConstraints('', TranslationUtils.state.device, true);
9359
- setTimeout(() => {
9360
- navigator.mediaDevices
9361
- .getUserMedia(constraints)
9362
- .then(stream => {
9363
- this.mainStream.initStream(stream);
9364
- })
9365
- .catch(e => {
9366
- this.closeCamera();
9367
- this.apiErrorEvent.emit(e);
9368
- });
9369
- }, 100);
9370
- }
9371
- closeCamera() {
9372
- if (this.mainStream) {
9373
- this.mainStream.dropStream();
8935
+ catch (e) {
8936
+ this.apiErrorEvent.emit(e);
9374
8937
  }
9375
8938
  }
9376
- disconnectedCallback() {
9377
- this.closeCamera();
9378
- Stream.instance = null;
9379
- FaceML5Detector.instance = null;
8939
+ async disconnectedCallback() {
8940
+ await this.baseComponent.finalize();
9380
8941
  }
9381
- async takePhoto() {
9382
- if (this.captureTaken)
9383
- return;
9384
- this.captureTaken = true;
9385
- let res = this.mainStream.takePhoto();
9386
- this.photoIsReady(res);
9387
- await this.baseComponent.logStep(TranslationUtils.FlowSteps.SelfieTilt, TranslationUtils.FlowMoments.Finalized);
8942
+ async componentWillRender() {
8943
+ this.translations = await TranslationUtils.Translations.getValues();
8944
+ this.title = this.translations.CodeValidationValues.Title;
8945
+ this.details = this.translations.CodeValidationValues.Description;
8946
+ this.buttonText = this.translations.CodeValidationValues.Button;
9388
8947
  }
9389
- async verificationFinished() {
9390
- if (this.verified)
9391
- return;
9392
- this.verified = true;
9393
- this.titleMesage = this.translations.SelfieCaptureValues.Loading;
9394
- this.closeCamera();
9395
- this.demoEnded = false;
9396
- var loops = 0;
9397
- this.demoVideo.src = this.uploadingLink;
9398
- this.demoVideo.loop = false;
9399
- while (loops < 7) {
9400
- loops++;
9401
- this.demoVideo.play();
9402
- await delay(this.translations.GlobalValues.VideoLenght);
9403
- }
9404
- this.eventTimeElapsed.emit();
8948
+ async componentDidLoad() {
8949
+ await this.baseComponent.initialize();
8950
+ }
8951
+ handleChangeCode(ev) {
8952
+ let value = ev.target ? ev.target.value : '';
8953
+ this.code = value;
8954
+ if (this.code.length > 4)
8955
+ this.code = this.code.substring(0, 4);
8956
+ this.canSend = this.code.length == 4;
8957
+ ev.target.value = this.code;
9405
8958
  }
9406
8959
  render() {
9407
- let cameraStyle;
9408
- if (TranslationUtils.state.device.isMobile && this.videoStarted) {
9409
- cameraStyle = {
9410
- 'width': this.captureWidth + 'px',
9411
- 'height': this.captureHeight + 'px',
9412
- 'overflow': 'hidden',
9413
- 'borderRadius': '10px',
9414
- 'text-align': 'center',
9415
- 'margin': 'auto',
9416
- };
8960
+ let errorBlock;
8961
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODEERROR) {
8962
+ errorBlock = index.h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, this.translations.CodeValidationValues.Error);
9417
8963
  }
9418
- let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
9419
- //let videoClass = this.device.isMobile ? '' : 'video-demo';
9420
- let bgDemo = this.verified ? 'container' : 'container bg-black';
9421
- return (index.h("div", { class: bgDemo }, index.h("div", { class: "container-video" }, index.h("div", { hidden: this.demoEnded }, index.h("video", { id: "howtoSelfie", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, index.h("source", { type: "video/mp4" }))), index.h("div", { hidden: this.demoEnded == false }, index.h("div", { hidden: this.verified }, index.h("div", { class: "video-capture" }, index.h("div", { style: cameraStyle }, index.h("camera-comp", { "capture-mode": "selfie" }))))), index.h("div", { class: "capture-title" }, index.h("h1", { class: titleClass }, this.titleMesage), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))));
8964
+ return (index.h("div", { class: "container" }, index.h("div", { class: "row row-validare" }, index.h("div", null, index.h("h1", { class: "text-center" }, this.title), errorBlock == null ? index.h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), index.h("div", { class: "input-container mb-15" }, index.h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
9422
8965
  }
9423
- get component() { return index.getElement(this); }
9424
8966
  };
9425
- SelfieTilt.style = selfieTiltCss;
8967
+ SmsCodeValidation.style = smsCodeValidationCss;
9426
8968
 
9427
- const smsCodeValidationCss = "";
8969
+ const smsSendCss = "";
9428
8970
 
9429
- const SmsCodeValidation = class {
8971
+ const SmsSend = class {
9430
8972
  constructor(hostRef) {
9431
8973
  index.registerInstance(this, hostRef);
9432
8974
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
9433
- this.title = undefined;
9434
- this.details = undefined;
9435
8975
  this.buttonText = undefined;
9436
8976
  this.phoneNumber = undefined;
9437
- this.code = undefined;
9438
8977
  this.prefilledPhone = false;
9439
8978
  this.canSend = false;
9440
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.PHONE) {
9441
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.OtpSend);
9442
- }
9443
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODE) {
9444
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.OtpCheck);
9445
- }
8979
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.OtpSend);
9446
8980
  this.baseComponent.setEventEmitter(this.apiErrorEvent);
9447
8981
  }
9448
8982
  async doAction() {
9449
8983
  try {
9450
8984
  this.canSend = false;
9451
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODE || TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODEERROR) {
9452
- var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(TranslationUtils.state.requestId, this.code);
9453
- if (codeChecked === true) {
9454
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.ID;
9455
- }
9456
- else {
9457
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.CODEERROR;
9458
- }
9459
- }
9460
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.PHONE) {
9461
- var codeSent = await this.baseComponent.apiCall.SendOTPCode(TranslationUtils.state.requestId, this.phoneNumber);
9462
- if (codeSent === true) {
9463
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.CODE;
9464
- }
8985
+ var codeSent = await this.baseComponent.apiCall.SendOTPCode(TranslationUtils.state.requestId, this.phoneNumber);
8986
+ if (codeSent.sent === true) {
8987
+ TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeSent.status];
9465
8988
  }
9466
8989
  }
9467
8990
  catch (e) {
@@ -9473,20 +8996,11 @@ const SmsCodeValidation = class {
9473
8996
  }
9474
8997
  async componentWillRender() {
9475
8998
  this.translations = await TranslationUtils.Translations.getValues();
9476
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.PHONE) {
9477
- this.title = this.translations.PhoneValidationValues.Title;
9478
- this.details = this.translations.PhoneValidationValues.Description;
9479
- this.buttonText = this.translations.PhoneValidationValues.Button;
9480
- if (TranslationUtils.state.phoneNumber && TranslationUtils.state.phoneNumber != '') {
9481
- this.phoneNumber = TranslationUtils.state.phoneNumber;
9482
- this.prefilledPhone = true;
9483
- this.canSend = true;
9484
- }
9485
- }
9486
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODE || TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODEERROR) {
9487
- this.title = this.translations.CodeValidationValues.Title;
9488
- this.details = this.translations.CodeValidationValues.Description;
9489
- this.buttonText = this.translations.CodeValidationValues.Button;
8999
+ this.buttonText = this.translations.PhoneValidationValues.Button;
9000
+ if (TranslationUtils.state.phoneNumber && TranslationUtils.state.phoneNumber != '') {
9001
+ this.phoneNumber = TranslationUtils.state.phoneNumber;
9002
+ this.prefilledPhone = true;
9003
+ this.canSend = true;
9490
9004
  }
9491
9005
  }
9492
9006
  async componentDidLoad() {
@@ -9500,30 +9014,11 @@ const SmsCodeValidation = class {
9500
9014
  this.canSend = this.phoneNumber.length == 10;
9501
9015
  ev.target.value = this.phoneNumber;
9502
9016
  }
9503
- handleChangeCode(ev) {
9504
- let value = ev.target ? ev.target.value : '';
9505
- this.code = value;
9506
- if (this.code.length > 4)
9507
- this.code = this.code.substring(0, 4);
9508
- this.canSend = this.code.length == 4;
9509
- ev.target.value = this.code;
9510
- }
9511
9017
  render() {
9512
- let inputBlock;
9513
- let errorBlock;
9514
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.CODEERROR) {
9515
- errorBlock = index.h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, this.translations.CodeValidationValues.Error);
9516
- }
9517
- if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.PHONE) {
9518
- inputBlock = (index.h("div", { class: "input-container mb-15" }, index.h("label", { class: "font-size-18 mb-1" }, index.h("b", null, this.translations.PhoneValidationValues.Label)), index.h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })));
9519
- }
9520
- else {
9521
- inputBlock = (index.h("div", { class: "input-container mb-15" }, index.h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })));
9522
- }
9523
- return (index.h("div", { class: "container" }, index.h("div", { class: "row row-validare" }, index.h("div", null, index.h("h1", { class: "text-center" }, this.title), errorBlock == null ? index.h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), inputBlock, index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
9018
+ return (index.h("div", { class: "container" }, index.h("div", { class: "row row-validare" }, index.h("div", { class: "input-container mb-15" }, index.h("label", { class: "font-size-18 mb-1" }, index.h("b", null, this.translations.PhoneValidationValues.Label)), index.h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })), index.h("div", { class: "pos-relative show-bottom" }, index.h("div", { class: "btn-buletin" }, index.h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), index.h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
9524
9019
  }
9525
9020
  };
9526
- SmsCodeValidation.style = smsCodeValidationCss;
9021
+ SmsSend.style = smsSendCss;
9527
9022
 
9528
9023
  const userLivenessCss = "";
9529
9024
 
@@ -9534,57 +9029,51 @@ const UserLiveness = class {
9534
9029
  this.recordingResultCount = 0;
9535
9030
  this.recordingRetryCount = 0;
9536
9031
  this.showError = undefined;
9537
- this.captureStep = undefined;
9538
9032
  this.flow = undefined;
9539
- this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.Selfie);
9540
- this.baseComponent.setEventEmitter(this.apiErrorEvent);
9033
+ this.howToDone = false;
9541
9034
  }
9542
9035
  async componentDidLoad() {
9543
9036
  await this.baseComponent.initialize();
9544
9037
  }
9545
9038
  componentWillLoad() {
9546
- this.flow = {
9547
- front: {
9548
- photoDone: false,
9549
- recordingDone: false,
9550
- fileName: 'selfie.png',
9551
- recName: 'selfieVideo.',
9552
- photoType: CaptureUploadTypes.Selfie,
9553
- recType: CaptureUploadTypes.SelfieVideo,
9554
- },
9555
- back: null,
9556
- tilt: null,
9557
- };
9558
- if (TranslationUtils.state.hasSelfieGesture) {
9559
- this.flow.tilt = {
9560
- photoDone: true,
9561
- recordingDone: false,
9562
- fileName: '',
9563
- recName: 'selfieTiltVideo.',
9564
- photoType: CaptureUploadTypes.None,
9565
- recType: CaptureUploadTypes.SelfieGestureVideo,
9039
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESS) {
9040
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.Selfie);
9041
+ this.flow = {
9042
+ capture: {
9043
+ fileName: 'selfie.png',
9044
+ recName: 'selfieVideo.',
9045
+ photoType: CaptureUploadTypes.Selfie,
9046
+ recType: CaptureUploadTypes.SelfieVideo,
9047
+ },
9048
+ howToDone: false,
9566
9049
  };
9567
9050
  }
9568
- this.captureStep = SelfieFlowStatus.HowToSelfie;
9051
+ else if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESSGESTURE) {
9052
+ this.baseComponent = new BaseComponent(TranslationUtils.FlowSteps.SelfieTilt);
9053
+ this.flow = {
9054
+ capture: {
9055
+ fileName: '',
9056
+ recName: 'selfieTiltVideo.',
9057
+ photoType: CaptureUploadTypes.None,
9058
+ recType: CaptureUploadTypes.SelfieGestureVideo,
9059
+ },
9060
+ howToDone: false,
9061
+ };
9062
+ }
9063
+ this.baseComponent.setEventEmitter(this.apiErrorEvent);
9569
9064
  }
9570
- howToDone() {
9571
- this.captureStep = SelfieFlowStatus.Selfie;
9065
+ howToDoneEvent() {
9066
+ this.howToDone = true;
9572
9067
  }
9573
9068
  timeElapsed() {
9574
9069
  this.showError = true;
9575
9070
  }
9576
9071
  captureErrorDone() {
9577
9072
  this.showError = false;
9578
- if (this.captureStep == SelfieFlowStatus.Selfie) {
9579
- this.flow.front.photoDone = false;
9580
- this.flow.front.recordingDone = false;
9581
- }
9582
- if (this.captureStep == SelfieFlowStatus.Gesture) {
9583
- this.flow.tilt.photoDone = false;
9584
- this.flow.tilt.recordingDone = false;
9585
- }
9586
9073
  }
9587
9074
  async captureSelfieImage(event) {
9075
+ if (TranslationUtils.state.flowStatus == TranslationUtils.FlowStatus.LIVENESSGESTURE)
9076
+ return;
9588
9077
  let selfiePhoto = event.detail;
9589
9078
  if (selfiePhoto.size == 0) {
9590
9079
  await this.baseComponent.apiCall.AddLog({ message: 'Empty selfie', blobData: selfiePhoto }, getLogMessage());
@@ -9592,8 +9081,11 @@ const UserLiveness = class {
9592
9081
  return;
9593
9082
  }
9594
9083
  try {
9595
- var uploadPhoto = new File([selfiePhoto], this.flow.front.fileName, { type: 'image/png' });
9596
- await this.uploadPhoto(uploadPhoto, this.flow.front.photoType);
9084
+ var uploadPhoto = new File([selfiePhoto], this.flow.capture.fileName, { type: 'image/png' });
9085
+ let photoUploaded = await this.baseComponent.apiCall.UploadFileForRequestB64(TranslationUtils.state.requestId, this.flow.capture.photoType, uploadPhoto);
9086
+ if (!photoUploaded) {
9087
+ this.triggerErrorFlow();
9088
+ }
9597
9089
  }
9598
9090
  catch (e) {
9599
9091
  this.apiErrorEvent.emit(e);
@@ -9613,18 +9105,11 @@ const UserLiveness = class {
9613
9105
  }
9614
9106
  let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
9615
9107
  try {
9616
- if (this.captureStep == SelfieFlowStatus.Selfie) {
9617
- let uploadRec = new File([selfieRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
9618
- this.flow.front.recordingDone = await this.uploadRecording(uploadRec, this.flow.front.recType);
9619
- }
9620
- else if (this.captureStep == SelfieFlowStatus.Gesture) {
9621
- let uploadRec = new File([selfieRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
9622
- this.flow.tilt.recordingDone = await this.uploadRecording(uploadRec, this.flow.tilt.recType);
9623
- }
9624
- else {
9108
+ let uploadRec = new File([selfieRecording], this.flow.capture.recName + mimeType.extension, { type: mimeType.type });
9109
+ let uplodDone = await this.baseComponent.apiCall.UploadFileForRequestB64(TranslationUtils.state.requestId, this.flow.capture.recType, uploadRec);
9110
+ if (!uplodDone) {
9625
9111
  this.triggerErrorFlow();
9626
9112
  }
9627
- this.endFlow();
9628
9113
  }
9629
9114
  catch (e) {
9630
9115
  if (this.recordingRetryCount < 3) {
@@ -9636,82 +9121,25 @@ const UserLiveness = class {
9636
9121
  }
9637
9122
  }
9638
9123
  }
9639
- async verificationFinished(_event) {
9640
- this.endFlow();
9641
- }
9642
9124
  async disconnectedCallback() {
9643
9125
  await this.baseComponent.finalize();
9644
9126
  }
9645
- async uploadPhoto(photoFile, photoType) {
9646
- if (this.flow.front.photoDone) {
9647
- return;
9648
- }
9649
- this.flow.front.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(TranslationUtils.state.requestId, photoType, photoFile);
9650
- if (this.flow.front.photoDone) {
9651
- this.endFlow();
9652
- }
9653
- else {
9654
- this.triggerErrorFlow();
9655
- }
9656
- }
9657
- async uploadRecording(uploadRec, recType) {
9658
- let uplodDone = await this.baseComponent.apiCall.UploadFileForRequestB64(TranslationUtils.state.requestId, recType, uploadRec);
9659
- if (uplodDone) {
9660
- return true;
9661
- }
9662
- else {
9663
- this.triggerErrorFlow();
9664
- }
9665
- return false;
9666
- }
9667
9127
  triggerErrorFlow() {
9668
9128
  this.showError = true;
9669
9129
  }
9670
- endFlow() {
9671
- if (this.captureStep == SelfieFlowStatus.Selfie) {
9672
- if (this.flow.front.photoDone && this.flow.front.recordingDone) {
9673
- if (TranslationUtils.state.hasSelfieGesture) {
9674
- this.captureStep = SelfieFlowStatus.Gesture;
9675
- }
9676
- else {
9677
- this.captureStep = SelfieFlowStatus.End;
9678
- }
9679
- }
9680
- else {
9681
- return;
9682
- }
9683
- }
9684
- if (this.captureStep == SelfieFlowStatus.Gesture) {
9685
- if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
9686
- this.captureStep = SelfieFlowStatus.End;
9687
- }
9688
- else {
9689
- return;
9690
- }
9691
- }
9692
- if (this.captureStep != SelfieFlowStatus.End) {
9693
- return;
9694
- }
9695
- TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus.COMPLETE;
9696
- }
9697
9130
  render() {
9698
- let howTo = index.h("how-to-info", { idSide: "" });
9699
- let capture = index.h("selfie-capture", { id: "camera" });
9700
- let tilt = index.h("selfie-tilt", { id: "camera" });
9131
+ let howTo = index.h("how-to-info", null);
9132
+ let capture = index.h("selfie-capture", null);
9701
9133
  let error = index.h("capture-error", { type: "LIVENESS" });
9702
9134
  if (this.showError) {
9703
9135
  return error;
9704
9136
  }
9705
- if (this.captureStep == SelfieFlowStatus.HowToSelfie) {
9706
- return howTo;
9707
- }
9708
- if (this.captureStep == SelfieFlowStatus.Selfie) {
9137
+ if (this.howToDone) {
9709
9138
  return capture;
9710
9139
  }
9711
- if (this.captureStep == SelfieFlowStatus.Gesture) {
9712
- return tilt;
9140
+ else {
9141
+ return howTo;
9713
9142
  }
9714
- return index.h("div", null);
9715
9143
  }
9716
9144
  };
9717
9145
  UserLiveness.style = userLivenessCss;
@@ -9724,14 +9152,12 @@ exports.capture_error = CaptureError;
9724
9152
  exports.end_redirect = EndRedirect;
9725
9153
  exports.error_end = ErrorEnd;
9726
9154
  exports.how_to_info = HowToInfo;
9727
- exports.id_back_capture = IdBackCapture;
9728
9155
  exports.id_capture = IdCapture;
9729
- exports.id_tilt = IdTilt;
9730
9156
  exports.identification_component = IdentificationComponent;
9731
9157
  exports.landing_validation = LandingValidation;
9732
9158
  exports.mobile_redirect = MobileRedirect;
9733
9159
  exports.process_id = ProcessId;
9734
9160
  exports.selfie_capture = SelfieCapture;
9735
- exports.selfie_tilt = SelfieTilt;
9736
9161
  exports.sms_code_validation = SmsCodeValidation;
9162
+ exports.sms_send = SmsSend;
9737
9163
  exports.user_liveness = UserLiveness;