@ekyc_qoobiss/qbs-ect-cmp 3.6.40 → 3.6.42

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