@ekyc_qoobiss/qbs-ect-cmp 3.6.14 → 3.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/{Stream-097bd1e9.js → agreement-check_19.cjs.entry.js} +5238 -529
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  4. package/dist/cjs/random-actions.cjs.entry.js +22 -0
  5. package/dist/cjs/store-ab631a7a.js +415 -0
  6. package/dist/collection/collection-manifest.json +2 -2
  7. package/dist/collection/components/common/capture-error/capture-error.js +6 -1
  8. package/dist/collection/components/common/id-back-capture/id-back-capture.js +2 -4
  9. package/dist/collection/components/common/id-capture/id-capture.js +2 -4
  10. package/dist/collection/components/common/id-tilt/id-tilt.js +3 -5
  11. package/dist/collection/components/common/random-actions/random-actions.js +20 -0
  12. package/dist/collection/components/common/selfie-capture/selfie-capture.js +3 -27
  13. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +7 -0
  14. package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +212 -0
  15. package/dist/collection/components/flow/process-id/process-id.js +31 -28
  16. package/dist/collection/components/flow/user-liveness/user-liveness.js +87 -40
  17. package/dist/collection/helpers/Stream.js +1 -1
  18. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +18 -15
  19. package/dist/collection/models/CaptureFlow.js +17 -9
  20. package/dist/collection/models/FlowSteps.js +3 -6
  21. package/dist/esm/{Stream-d1fb2210.js → agreement-check_19.entry.js} +5131 -420
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/qbs-ect-cmp.js +1 -1
  24. package/dist/esm/random-actions.entry.js +18 -0
  25. package/dist/esm/store-b5192087.js +399 -0
  26. package/dist/qbs-ect-cmp/{p-73a2e58b.js → p-094ad8f3.entry.js} +26 -26
  27. package/dist/qbs-ect-cmp/p-927cd530.entry.js +1 -0
  28. package/dist/qbs-ect-cmp/p-a6506178.js +1 -0
  29. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  30. package/dist/types/components/common/capture-error/capture-error.d.ts +3 -1
  31. package/dist/types/components/common/random-actions/random-actions.d.ts +7 -0
  32. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +0 -1
  33. package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +30 -0
  34. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +4 -4
  35. package/dist/types/components.d.ts +33 -37
  36. package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +3 -2
  37. package/dist/types/models/CaptureFlow.d.ts +8 -1
  38. package/dist/types/models/FlowSteps.d.ts +3 -6
  39. package/package.json +1 -1
  40. package/dist/cjs/agreement-check_18.cjs.entry.js +0 -4971
  41. package/dist/cjs/id-double-side.cjs.entry.js +0 -208
  42. package/dist/cjs/id-single-side.cjs.entry.js +0 -147
  43. package/dist/collection/components/flow/id-double-side/id-double-side.js +0 -285
  44. package/dist/collection/components/flow/id-single-side/id-single-side.css +0 -0
  45. package/dist/collection/components/flow/id-single-side/id-single-side.js +0 -216
  46. package/dist/esm/agreement-check_18.entry.js +0 -4950
  47. package/dist/esm/id-double-side.entry.js +0 -204
  48. package/dist/esm/id-single-side.entry.js +0 -143
  49. package/dist/qbs-ect-cmp/p-04e51eac.entry.js +0 -1
  50. package/dist/qbs-ect-cmp/p-deea462b.entry.js +0 -1
  51. package/dist/qbs-ect-cmp/p-f84883f8.entry.js +0 -1
  52. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +0 -29
  53. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +0 -24
  54. /package/dist/collection/components/{flow/id-double-side/id-double-side.css → common/random-actions/random-actions.css} +0 -0
@@ -0,0 +1,20 @@
1
+ import { h } from '@stencil/core';
2
+ import { HowToValues } from '../../../helpers/textValues';
3
+ export class RandomActions {
4
+ componentWillLoad() { }
5
+ buttonClick() { }
6
+ render() {
7
+ return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "text-center" }, h("h1", null, this.topTitle)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, HowToValues.FooterText))))));
8
+ }
9
+ static get is() { return "random-actions"; }
10
+ static get originalStyleUrls() {
11
+ return {
12
+ "$": ["random-actions.css"]
13
+ };
14
+ }
15
+ static get styleUrls() {
16
+ return {
17
+ "$": ["random-actions.css"]
18
+ };
19
+ }
20
+ }
@@ -30,23 +30,7 @@ export class SelfieCapture {
30
30
  this.cameras = new Cameras();
31
31
  this.demoEnded = false;
32
32
  this.uploadingLink = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
33
- this.baseComponent = new BaseComponent(FlowSteps.SelfieHoldAnimation);
34
- }
35
- async eventChangeTitle(event) {
36
- // this.stopAnimation = false;
37
- if (event.detail == null) {
38
- this.titleMesage = SelfieCaptureValues.FinalTitle;
39
- }
40
- else {
41
- await this.baseComponent.logStep(FlowSteps.SelfieTiltAnimation, FlowMoments.Initialized);
42
- this.titleMesage = SelfieCaptureValues.FacePoseMapping[event.detail];
43
- this.demoEnded = false;
44
- this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[event.detail];
45
- this.demoVideo.play();
46
- await delay(SelfieCaptureValues.VideoLenght);
47
- this.demoEnded = true;
48
- await this.baseComponent.logStep(FlowSteps.SelfieTiltAnimation, FlowMoments.Finalized);
49
- }
33
+ this.baseComponent = new BaseComponent(FlowSteps.SelfieCapture);
50
34
  }
51
35
  eventVideoStarted(event) {
52
36
  this.videoStarted = true;
@@ -63,16 +47,14 @@ export class SelfieCapture {
63
47
  }
64
48
  }
65
49
  async componentDidLoad() {
66
- await this.baseComponent.logStep(FlowSteps.SelfieHoldAnimation, FlowMoments.Initialized);
50
+ await this.baseComponent.logStep(FlowSteps.SelfieCapture, FlowMoments.Initialized);
67
51
  this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[FacePose.Main];
68
52
  this.demoVideo.play();
69
53
  await delay(SelfieCaptureValues.VideoLenght);
70
54
  this.demoEnded = true;
71
- await this.baseComponent.logStep(FlowSteps.SelfieHoldAnimation, FlowMoments.Finalized);
72
55
  this.openCamera();
73
56
  }
74
57
  async openCamera() {
75
- await this.baseComponent.logStep(FlowSteps.SelfieCapture, FlowMoments.Initialized);
76
58
  const constraints = this.cameras.GetConstraints('', store.device, true);
77
59
  setTimeout(() => {
78
60
  navigator.mediaDevices
@@ -103,7 +85,7 @@ export class SelfieCapture {
103
85
  this.captureTaken = true;
104
86
  let res = await Stream.getInstance(VerificationMode.Full).takePhoto();
105
87
  this.photoIsReady(res);
106
- await this.baseComponent.logStep(FlowSteps.SelfieHoldAnimation, FlowMoments.Finalized);
88
+ await this.baseComponent.logStep(FlowSteps.SelfieCapture, FlowMoments.Finalized);
107
89
  }
108
90
  verificationFinished() {
109
91
  if (this.verified)
@@ -193,12 +175,6 @@ export class SelfieCapture {
193
175
  static get elementRef() { return "component"; }
194
176
  static get listeners() {
195
177
  return [{
196
- "name": "changeTitle",
197
- "method": "eventChangeTitle",
198
- "target": undefined,
199
- "capture": false,
200
- "passive": false
201
- }, {
202
178
  "name": "videoStarted",
203
179
  "method": "eventVideoStarted",
204
180
  "target": undefined,
@@ -0,0 +1,7 @@
1
+ /* .cameraContainer {
2
+ width: 100%;
3
+ height: 100%;
4
+ z-index: 10;
5
+ position: relative;
6
+ overflow: hidden;
7
+ } */
@@ -0,0 +1,212 @@
1
+ import { h } from '@stencil/core';
2
+ import { Cameras } from '../../../helpers/Cameras';
3
+ import { Stream } from '../../../helpers/Stream';
4
+ import { SelfieCaptureValues } from '../../../helpers/textValues';
5
+ import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
6
+ import { delay } from '../../../utils/utils';
7
+ import store from '../../../helpers/store';
8
+ import { BaseComponent } from '../../base-component';
9
+ import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
10
+ import { VerificationMode } from '../../../models/IVerificationMode';
11
+ export class SelfieTilt {
12
+ // @State() private animationPath: string;
13
+ constructor() {
14
+ this.photoIsReady = photos => {
15
+ //this.closeCamera();
16
+ this.eventPhotoCapture.emit(photos);
17
+ };
18
+ this.videoStarted = undefined;
19
+ this.captureTaken = undefined;
20
+ this.verified = undefined;
21
+ this.titleMesage = undefined;
22
+ this.demoEnded = undefined;
23
+ this.demoVideo = undefined;
24
+ this.uploadingLink = undefined;
25
+ this.captureHeight = undefined;
26
+ this.captureWidth = undefined;
27
+ this.captureTaken = false;
28
+ this.verified = false;
29
+ this.cameras = new Cameras();
30
+ this.demoEnded = false;
31
+ this.uploadingLink = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
32
+ this.baseComponent = new BaseComponent(FlowSteps.SelfieTilt);
33
+ }
34
+ async eventChangeTitle(event) {
35
+ // this.stopAnimation = false;
36
+ if (event.detail == null) {
37
+ this.titleMesage = SelfieCaptureValues.FinalTitle;
38
+ }
39
+ else {
40
+ this.titleMesage = SelfieCaptureValues.FacePoseMapping[event.detail];
41
+ this.demoEnded = false;
42
+ this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[event.detail];
43
+ this.demoVideo.play();
44
+ await delay(SelfieCaptureValues.VideoLenght);
45
+ this.demoEnded = true;
46
+ }
47
+ }
48
+ eventVideoStarted(event) {
49
+ this.videoStarted = true;
50
+ var cameraSize = event.detail;
51
+ var height = Math.round((cameraSize.width * 16) / 9);
52
+ this.captureHeight = height - Math.round((window.screen.height - height) / 2);
53
+ this.captureWidth = Math.round((this.captureHeight * 9) / 16);
54
+ }
55
+ componentWillLoad() {
56
+ this.titleMesage = SelfieCaptureValues.Title;
57
+ //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
58
+ if (!navigator.mediaDevices) {
59
+ this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
60
+ }
61
+ }
62
+ async componentDidLoad() {
63
+ this.mainStream = Stream.getInstance(VerificationMode.Tilt);
64
+ await this.baseComponent.logStep(FlowSteps.SelfieTilt, FlowMoments.Initialized);
65
+ this.openCamera();
66
+ }
67
+ async openCamera() {
68
+ const constraints = this.cameras.GetConstraints('', store.device, true);
69
+ setTimeout(() => {
70
+ navigator.mediaDevices
71
+ .getUserMedia(constraints)
72
+ .then(stream => {
73
+ this.mainStream.initStream(stream);
74
+ })
75
+ .catch(e => {
76
+ this.closeCamera();
77
+ this.apiErrorEvent.emit(e);
78
+ });
79
+ }, 100);
80
+ }
81
+ closeCamera() {
82
+ if (this.mainStream) {
83
+ this.mainStream.dropStream();
84
+ }
85
+ }
86
+ disconnectedCallback() {
87
+ this.closeCamera();
88
+ Stream.instance = null;
89
+ FaceML5Detector.instance = null;
90
+ }
91
+ async takePhoto() {
92
+ if (this.captureTaken)
93
+ return;
94
+ this.captureTaken = true;
95
+ let res = this.mainStream.takePhoto();
96
+ this.photoIsReady(res);
97
+ await this.baseComponent.logStep(FlowSteps.SelfieCapture, FlowMoments.Finalized);
98
+ }
99
+ verificationFinished() {
100
+ if (this.verified)
101
+ return;
102
+ this.verified = true;
103
+ this.titleMesage = SelfieCaptureValues.Loading;
104
+ this.closeCamera();
105
+ this.demoEnded = false;
106
+ this.demoVideo.src = this.uploadingLink;
107
+ this.demoVideo.loop = true;
108
+ this.demoVideo.play();
109
+ }
110
+ render() {
111
+ let cameraStyle;
112
+ if (store.device.isMobile && this.videoStarted) {
113
+ cameraStyle = {
114
+ 'width': this.captureWidth + 'px',
115
+ 'height': this.captureHeight + 'px',
116
+ 'overflow': 'hidden',
117
+ 'borderRadius': '10px',
118
+ 'text-align': 'center',
119
+ 'margin': 'auto',
120
+ };
121
+ }
122
+ let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
123
+ //let videoClass = this.device.isMobile ? '' : 'video-demo';
124
+ let bgDemo = this.verified ? 'container' : 'container bg-black';
125
+ 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" }, SelfieCaptureValues.FooterText)))));
126
+ }
127
+ static get is() { return "selfie-tilt"; }
128
+ static get originalStyleUrls() {
129
+ return {
130
+ "$": ["selfie-tilt.css"]
131
+ };
132
+ }
133
+ static get styleUrls() {
134
+ return {
135
+ "$": ["selfie-tilt.css"]
136
+ };
137
+ }
138
+ static get states() {
139
+ return {
140
+ "videoStarted": {},
141
+ "captureTaken": {},
142
+ "verified": {},
143
+ "titleMesage": {},
144
+ "demoEnded": {},
145
+ "demoVideo": {},
146
+ "uploadingLink": {},
147
+ "captureHeight": {},
148
+ "captureWidth": {}
149
+ };
150
+ }
151
+ static get events() {
152
+ return [{
153
+ "method": "eventPhotoCapture",
154
+ "name": "photoSelfieTiltCapture",
155
+ "bubbles": true,
156
+ "cancelable": true,
157
+ "composed": true,
158
+ "docs": {
159
+ "tags": [],
160
+ "text": ""
161
+ },
162
+ "complexType": {
163
+ "original": "any",
164
+ "resolved": "any",
165
+ "references": {}
166
+ }
167
+ }, {
168
+ "method": "apiErrorEvent",
169
+ "name": "apiError",
170
+ "bubbles": true,
171
+ "cancelable": true,
172
+ "composed": true,
173
+ "docs": {
174
+ "tags": [],
175
+ "text": ""
176
+ },
177
+ "complexType": {
178
+ "original": "any",
179
+ "resolved": "any",
180
+ "references": {}
181
+ }
182
+ }];
183
+ }
184
+ static get elementRef() { return "component"; }
185
+ static get listeners() {
186
+ return [{
187
+ "name": "changeTitle",
188
+ "method": "eventChangeTitle",
189
+ "target": undefined,
190
+ "capture": false,
191
+ "passive": false
192
+ }, {
193
+ "name": "videoStarted",
194
+ "method": "eventVideoStarted",
195
+ "target": undefined,
196
+ "capture": false,
197
+ "passive": false
198
+ }, {
199
+ "name": "takePhoto",
200
+ "method": "takePhoto",
201
+ "target": undefined,
202
+ "capture": false,
203
+ "passive": false
204
+ }, {
205
+ "name": "verificationFinished",
206
+ "method": "verificationFinished",
207
+ "target": undefined,
208
+ "capture": false,
209
+ "passive": false
210
+ }];
211
+ }
212
+ }
@@ -5,7 +5,7 @@ import { FlowStatus } from '../../../models/FlowStatus';
5
5
  import { FlowSteps } from '../../../models/FlowSteps';
6
6
  import { getLogMessage } from '../../../utils/utils';
7
7
  import { BaseComponent } from '../../base-component';
8
- import { CaptureFlowStatus, CaptureUploadTypes } from '../../../models/CaptureFlow';
8
+ import { IdCaptureFlowStatus, CaptureUploadTypes } from '../../../models/CaptureFlow';
9
9
  // import { IDPose } from '../../libs/IDML5Detector/IDPose';
10
10
  export class ProcessId {
11
11
  constructor() {
@@ -51,14 +51,14 @@ export class ProcessId {
51
51
  recType: CaptureUploadTypes.TiltVideo,
52
52
  };
53
53
  }
54
- this.captureStep = CaptureFlowStatus.HowToFront;
54
+ this.captureStep = IdCaptureFlowStatus.HowToFront;
55
55
  }
56
56
  howToDone() {
57
- if (this.captureStep == CaptureFlowStatus.HowToFront) {
58
- this.captureStep = CaptureFlowStatus.IdFront;
57
+ if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
58
+ this.captureStep = IdCaptureFlowStatus.IdFront;
59
59
  }
60
- if (this.captureStep == CaptureFlowStatus.HowToBack) {
61
- this.captureStep = CaptureFlowStatus.IdBack;
60
+ if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
61
+ this.captureStep = IdCaptureFlowStatus.IdBack;
62
62
  }
63
63
  }
64
64
  timeElapsed() {
@@ -116,15 +116,15 @@ export class ProcessId {
116
116
  return;
117
117
  }
118
118
  let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
119
- if (this.captureStep == CaptureFlowStatus.IdFront) {
119
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
120
120
  let frontRec = new File([idRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
121
121
  this.flow.front.recordingDone = await this.uploadRecording(this.flow.front.recType, frontRec);
122
122
  }
123
- if (this.captureStep == CaptureFlowStatus.IdBack) {
123
+ if (this.captureStep == IdCaptureFlowStatus.IdBack) {
124
124
  let backRec = new File([idRecording], this.flow.back.recName + mimeType.extension, { type: mimeType.type });
125
125
  this.flow.back.recordingDone = await this.uploadRecording(this.flow.back.recType, backRec);
126
126
  }
127
- if (this.captureStep == CaptureFlowStatus.Tilt) {
127
+ if (this.captureStep == IdCaptureFlowStatus.Tilt) {
128
128
  let tiltRec = new File([idRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
129
129
  this.flow.tilt.recordingDone = await this.uploadRecording(this.flow.tilt.recType, tiltRec);
130
130
  }
@@ -162,62 +162,65 @@ export class ProcessId {
162
162
  return false;
163
163
  }
164
164
  triggerErrorFlow(restart = false) {
165
+ if (this.captureStep == IdCaptureFlowStatus.IdBack) {
166
+ restart = true;
167
+ }
165
168
  if (restart) {
166
- this.captureStep = CaptureFlowStatus.IdFront;
169
+ this.captureStep = IdCaptureFlowStatus.IdFront;
167
170
  }
168
- if (this.captureStep == CaptureFlowStatus.IdFront || restart) {
171
+ if (this.captureStep == IdCaptureFlowStatus.IdFront || restart) {
169
172
  this.flow.front.photoDone = false;
170
173
  this.flow.front.recordingDone = false;
171
174
  }
172
- if (this.captureStep == CaptureFlowStatus.IdBack || restart) {
175
+ if (this.captureStep == IdCaptureFlowStatus.IdBack || restart) {
173
176
  this.flow.back.photoDone = false;
174
177
  this.flow.back.recordingDone = false;
175
178
  }
176
- if (this.captureStep == CaptureFlowStatus.Tilt || restart) {
179
+ if (this.captureStep == IdCaptureFlowStatus.Tilt || restart) {
177
180
  this.flow.tilt.photoDone = true;
178
181
  this.flow.tilt.recordingDone = false;
179
182
  }
180
183
  this.showInvalid = true;
181
184
  }
182
185
  async endFlow() {
183
- if (this.captureStep == CaptureFlowStatus.IdFront) {
186
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
184
187
  if (this.flow.front.photoDone && this.flow.front.recordingDone) {
185
188
  if (store.hasIdBack) {
186
- this.captureStep = CaptureFlowStatus.IdBack;
189
+ this.captureStep = IdCaptureFlowStatus.IdBack;
187
190
  }
188
191
  else if (store.hasIdTilt) {
189
- this.captureStep = CaptureFlowStatus.Tilt;
192
+ this.captureStep = IdCaptureFlowStatus.Tilt;
190
193
  }
191
194
  else {
192
- this.captureStep = CaptureFlowStatus.End;
195
+ this.captureStep = IdCaptureFlowStatus.End;
193
196
  }
194
197
  }
195
198
  else {
196
199
  return;
197
200
  }
198
201
  }
199
- if (this.captureStep == CaptureFlowStatus.IdBack && store.hasIdBack) {
202
+ if (this.captureStep == IdCaptureFlowStatus.IdBack && store.hasIdBack) {
200
203
  if (this.flow.back.photoDone && this.flow.back.recordingDone) {
201
204
  if (store.hasIdTilt) {
202
- this.captureStep = CaptureFlowStatus.Tilt;
205
+ this.captureStep = IdCaptureFlowStatus.Tilt;
203
206
  }
204
207
  else {
205
- this.captureStep = CaptureFlowStatus.End;
208
+ this.captureStep = IdCaptureFlowStatus.End;
206
209
  }
207
210
  }
208
211
  else {
209
212
  return;
210
213
  }
211
214
  }
212
- if (this.captureStep == CaptureFlowStatus.Tilt && store.hasIdTilt) {
215
+ if (this.captureStep == IdCaptureFlowStatus.Tilt && store.hasIdTilt) {
213
216
  if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
214
- this.captureStep = CaptureFlowStatus.End;
217
+ this.captureStep = IdCaptureFlowStatus.End;
215
218
  }
216
219
  else {
217
220
  return;
218
221
  }
219
222
  }
220
- if (this.captureStep != CaptureFlowStatus.End) {
223
+ if (this.captureStep != IdCaptureFlowStatus.End) {
221
224
  return;
222
225
  }
223
226
  store.flowStatus = FlowStatus.LIVENESS;
@@ -245,19 +248,19 @@ export class ProcessId {
245
248
  if (this.showInvalid || this.showTimeout) {
246
249
  return error;
247
250
  }
248
- if (this.captureStep == CaptureFlowStatus.HowToFront) {
251
+ if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
249
252
  return howToFront;
250
253
  }
251
- if (this.captureStep == CaptureFlowStatus.HowToBack) {
254
+ if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
252
255
  return howToBack;
253
256
  }
254
- if (this.captureStep == CaptureFlowStatus.IdFront) {
257
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
255
258
  return frontCapture;
256
259
  }
257
- if (this.captureStep == CaptureFlowStatus.IdBack) {
260
+ if (this.captureStep == IdCaptureFlowStatus.IdBack) {
258
261
  return secondCapture;
259
262
  }
260
- if (this.captureStep == CaptureFlowStatus.Tilt) {
263
+ if (this.captureStep == IdCaptureFlowStatus.Tilt) {
261
264
  return tiltCapture;
262
265
  }
263
266
  }
@@ -5,18 +5,13 @@ import { FlowStatus } from '../../../models/FlowStatus';
5
5
  import { FlowSteps } from '../../../models/FlowSteps';
6
6
  import { getLogMessage } from '../../../utils/utils';
7
7
  import { BaseComponent } from '../../base-component';
8
+ import { CaptureUploadTypes, SelfieFlowStatus } from '../../../models/CaptureFlow';
8
9
  export class UserLiveness {
9
10
  constructor() {
10
11
  this.recordingResultCount = 0;
11
12
  this.showError = undefined;
12
- this.showHowTo = undefined;
13
- this.selfieFlow = {
14
- photoDone: false,
15
- recordingDone: false,
16
- verificationFinished: false,
17
- photoFile: null,
18
- recordingFile: null,
19
- };
13
+ this.captureStep = undefined;
14
+ this.flow = undefined;
20
15
  this.baseComponent = new BaseComponent(FlowSteps.Selfie);
21
16
  this.baseComponent.setEventEmitter(this.apiErrorEvent);
22
17
  }
@@ -24,20 +19,46 @@ export class UserLiveness {
24
19
  await this.baseComponent.initialize();
25
20
  }
26
21
  componentWillLoad() {
27
- this.showHowTo = true;
22
+ this.flow = {
23
+ front: {
24
+ photoDone: false,
25
+ recordingDone: false,
26
+ fileName: 'selfie.png',
27
+ recName: 'selfieVideo.',
28
+ photoType: CaptureUploadTypes.Selfie,
29
+ recType: CaptureUploadTypes.SelfieVideo,
30
+ },
31
+ back: null,
32
+ tilt: null,
33
+ };
34
+ if (store.hasSelfieGesture) {
35
+ this.flow.tilt = {
36
+ photoDone: true,
37
+ recordingDone: false,
38
+ fileName: '',
39
+ recName: 'selfieTiltVideo.',
40
+ photoType: CaptureUploadTypes.None,
41
+ recType: CaptureUploadTypes.SelfieGestureVideo,
42
+ };
43
+ }
44
+ this.captureStep = SelfieFlowStatus.HowToSelfie;
28
45
  }
29
46
  howToDone() {
30
- this.showHowTo = false;
47
+ this.captureStep = SelfieFlowStatus.Selfie;
31
48
  }
32
49
  timeElapsed() {
33
50
  this.showError = true;
34
51
  }
35
52
  captureErrorDone() {
36
53
  this.showError = false;
37
- this.selfieFlow.photoDone = false;
38
- this.selfieFlow.recordingDone = false;
39
- this.selfieFlow.photoFile = null;
40
- this.selfieFlow.recordingFile = null;
54
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
55
+ this.flow.front.photoDone = false;
56
+ this.flow.front.recordingDone = false;
57
+ }
58
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
59
+ this.flow.tilt.photoDone = false;
60
+ this.flow.tilt.recordingDone = false;
61
+ }
41
62
  }
42
63
  async captureSelfieImage(event) {
43
64
  let selfiePhoto = event.detail;
@@ -47,8 +68,8 @@ export class UserLiveness {
47
68
  return;
48
69
  }
49
70
  try {
50
- this.selfieFlow.photoFile = new File([selfiePhoto], 'selfie.png', { type: 'image/png' });
51
- await this.uploadPhoto();
71
+ var uploadPhoto = new File([selfiePhoto], this.flow.front.fileName, { type: 'image/png' });
72
+ await this.uploadPhoto(uploadPhoto, this.flow.front.photoType);
52
73
  }
53
74
  catch (e) {
54
75
  this.apiErrorEvent.emit(e);
@@ -67,8 +88,15 @@ export class UserLiveness {
67
88
  }
68
89
  let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
69
90
  try {
70
- this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + mimeType.extension, { type: mimeType.type });
71
- await this.uploadRecording();
91
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
92
+ let uploadRec = new File([selfieRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
93
+ this.flow.front.recordingDone = await this.uploadRecording(uploadRec, this.flow.front.recType);
94
+ }
95
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
96
+ let uploadRec = new File([selfieRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
97
+ this.flow.tilt.recordingDone = await this.uploadRecording(uploadRec, this.flow.tilt.recType);
98
+ }
99
+ await this.endFlow();
72
100
  }
73
101
  catch (e) {
74
102
  if (store.recordingRetryCount < 3) {
@@ -81,49 +109,55 @@ export class UserLiveness {
81
109
  }
82
110
  }
83
111
  async verificationFinished(_event) {
84
- this.selfieFlow.verificationFinished = true;
112
+ this.captureStep = SelfieFlowStatus.End;
85
113
  await this.endFlow();
86
114
  }
87
115
  async disconnectedCallback() {
88
116
  await this.baseComponent.finalize();
89
117
  }
90
- async uploadPhoto() {
91
- if (this.selfieFlow.photoFile == null || this.selfieFlow.photoDone) {
118
+ async uploadPhoto(photoFile, photoType) {
119
+ if (this.flow.front.photoDone) {
92
120
  return;
93
121
  }
94
- this.selfieFlow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'Selfie', this.selfieFlow.photoFile);
95
- if (this.selfieFlow.photoDone) {
122
+ this.flow.front.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, photoType, photoFile);
123
+ if (this.flow.front.photoDone) {
96
124
  await this.endFlow();
97
125
  }
98
126
  else {
99
127
  this.triggerErrorFlow();
100
128
  }
101
129
  }
102
- async uploadRecording() {
103
- if (this.selfieFlow.recordingFile == null || this.selfieFlow.recordingDone) {
104
- return;
105
- }
106
- this.selfieFlow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
107
- if (this.selfieFlow.recordingDone) {
108
- await this.endFlow();
130
+ async uploadRecording(uploadRec, recType) {
131
+ let uplodDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, recType, uploadRec);
132
+ if (uplodDone) {
133
+ return true;
109
134
  }
110
135
  else {
111
136
  this.triggerErrorFlow();
112
137
  }
138
+ return false;
113
139
  }
114
140
  triggerErrorFlow() {
115
- this.selfieFlow.photoFile = null;
116
- this.selfieFlow.recordingFile = null;
117
141
  this.showError = true;
118
142
  }
119
143
  async endFlow() {
120
- if (!this.selfieFlow.photoDone) {
121
- return;
144
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
145
+ if (this.flow.front.photoDone && this.flow.front.recordingDone) {
146
+ this.captureStep = SelfieFlowStatus.Gesture;
147
+ }
148
+ else {
149
+ return;
150
+ }
122
151
  }
123
- if (!this.selfieFlow.recordingDone) {
124
- return;
152
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
153
+ if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
154
+ this.captureStep = SelfieFlowStatus.End;
155
+ }
156
+ else {
157
+ return;
158
+ }
125
159
  }
126
- if (!this.selfieFlow.verificationFinished) {
160
+ if (this.captureStep != SelfieFlowStatus.End) {
127
161
  return;
128
162
  }
129
163
  store.recordingRetryCount = 0;
@@ -132,8 +166,21 @@ export class UserLiveness {
132
166
  render() {
133
167
  let howTo = h("how-to-info", { idSide: "" });
134
168
  let capture = h("selfie-capture", { id: "camera" });
169
+ let tilt = h("selfie-tilt", { id: "camera" });
135
170
  let error = h("capture-error", { type: "LIVENESS" });
136
- return this.showHowTo ? howTo : this.showError ? error : capture;
171
+ if (this.showError) {
172
+ return error;
173
+ }
174
+ if (this.captureStep == SelfieFlowStatus.HowToSelfie) {
175
+ return howTo;
176
+ }
177
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
178
+ return capture;
179
+ }
180
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
181
+ return tilt;
182
+ }
183
+ return capture;
137
184
  }
138
185
  static get is() { return "user-liveness"; }
139
186
  static get originalStyleUrls() {
@@ -149,8 +196,8 @@ export class UserLiveness {
149
196
  static get states() {
150
197
  return {
151
198
  "showError": {},
152
- "showHowTo": {},
153
- "selfieFlow": {}
199
+ "captureStep": {},
200
+ "flow": {}
154
201
  };
155
202
  }
156
203
  static get events() {
@@ -202,7 +202,7 @@ export class Stream {
202
202
  async startFaceDetection() {
203
203
  if (this.streamPaused)
204
204
  return;
205
- this.faceML5Detector.initDetector();
205
+ this.faceML5Detector.initDetector(this.verificationMode);
206
206
  }
207
207
  requestFacePose() {
208
208
  var pose = FacePosePick.randomEnum(FacePose);