@ekyc_qoobiss/qbs-ect-cmp 3.6.13 → 3.6.15

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 (55) hide show
  1. package/dist/cjs/{Stream-3b222f7c.js → agreement-check_19.cjs.entry.js} +5197 -96
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +1 -2
  5. package/dist/collection/components/common/capture-error/capture-error.js +6 -1
  6. package/dist/collection/components/common/id-back-capture/id-back-capture.js +2 -4
  7. package/dist/collection/components/common/id-capture/id-capture.js +2 -4
  8. package/dist/collection/components/common/id-tilt/id-tilt.js +3 -5
  9. package/dist/collection/components/common/selfie-capture/selfie-capture.js +3 -27
  10. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +7 -0
  11. package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +212 -0
  12. package/dist/collection/components/flow/process-id/process-id.js +53 -91
  13. package/dist/collection/components/flow/user-liveness/user-liveness.js +88 -40
  14. package/dist/collection/helpers/Stream.js +5 -6
  15. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +18 -15
  16. package/dist/collection/models/CaptureFlow.js +21 -9
  17. package/dist/collection/models/FlowSteps.js +3 -6
  18. package/dist/esm/{Stream-57643e4d.js → agreement-check_19.entry.js} +5132 -29
  19. package/dist/esm/{index-5d6f9123.js → index-9d69e511.js} +1 -1
  20. package/dist/esm/loader-dots.entry.js +1 -1
  21. package/dist/esm/loader.js +3 -3
  22. package/dist/esm/qbs-ect-cmp.js +3 -3
  23. package/dist/qbs-ect-cmp/{p-aacd7024.js → p-06e42b28.js} +1 -1
  24. package/dist/qbs-ect-cmp/{p-7c33dd41.entry.js → p-4c8e922b.entry.js} +1 -1
  25. package/dist/qbs-ect-cmp/{p-ed7ad79f.js → p-a85dd6fc.entry.js} +26 -26
  26. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  27. package/dist/types/components/common/capture-error/capture-error.d.ts +3 -1
  28. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +0 -1
  29. package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +30 -0
  30. package/dist/types/components/controls/camera/camera.d.ts +2 -3
  31. package/dist/types/components/flow/process-id/process-id.d.ts +0 -1
  32. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +4 -4
  33. package/dist/types/components.d.ts +20 -37
  34. package/dist/types/helpers/Stream.d.ts +1 -2
  35. package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +3 -2
  36. package/dist/types/models/CaptureFlow.d.ts +15 -6
  37. package/dist/types/models/FlowSteps.d.ts +3 -6
  38. package/package.json +1 -1
  39. package/dist/cjs/agreement-check_18.cjs.entry.js +0 -5005
  40. package/dist/cjs/id-double-side.cjs.entry.js +0 -208
  41. package/dist/cjs/id-single-side.cjs.entry.js +0 -147
  42. package/dist/collection/components/flow/id-double-side/id-double-side.css +0 -0
  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/collection/models/IRecordingCallback.js +0 -1
  47. package/dist/esm/agreement-check_18.entry.js +0 -4984
  48. package/dist/esm/id-double-side.entry.js +0 -204
  49. package/dist/esm/id-single-side.entry.js +0 -143
  50. package/dist/qbs-ect-cmp/p-4934666e.entry.js +0 -1
  51. package/dist/qbs-ect-cmp/p-65eb59af.entry.js +0 -1
  52. package/dist/qbs-ect-cmp/p-878f427a.entry.js +0 -1
  53. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +0 -29
  54. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +0 -24
  55. package/dist/types/models/IRecordingCallback.d.ts +0 -4
@@ -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() {
@@ -24,23 +24,21 @@ export class ProcessId {
24
24
  photoDone: false,
25
25
  recordingDone: false,
26
26
  fileName: 'idImage.png',
27
- file: null,
28
- recoding: null,
29
- uploadType: CaptureUploadTypes.IdFront,
27
+ recName: 'idVideo.',
28
+ photoType: CaptureUploadTypes.IdFront,
29
+ recType: CaptureUploadTypes.IdFrontVideo,
30
30
  },
31
31
  back: null,
32
32
  tilt: null,
33
- recordingData: [],
34
- mimeType: '',
35
33
  };
36
34
  if (store.hasIdBack) {
37
35
  this.flow.back = {
38
36
  photoDone: false,
39
37
  recordingDone: false,
40
38
  fileName: 'idBackImage.png',
41
- file: null,
42
- recoding: null,
43
- uploadType: CaptureUploadTypes.IdBack,
39
+ recName: 'idBackVideo.',
40
+ photoType: CaptureUploadTypes.IdBack,
41
+ recType: CaptureUploadTypes.IdBackVideo,
44
42
  };
45
43
  }
46
44
  if (store.hasIdTilt) {
@@ -48,19 +46,19 @@ export class ProcessId {
48
46
  photoDone: true,
49
47
  recordingDone: false,
50
48
  fileName: 'idTiltImage.png',
51
- file: null,
52
- recoding: null,
53
- uploadType: CaptureUploadTypes.None,
49
+ recName: 'idTiltVideo.',
50
+ photoType: CaptureUploadTypes.None,
51
+ recType: CaptureUploadTypes.TiltVideo,
54
52
  };
55
53
  }
56
- this.captureStep = CaptureFlowStatus.HowToFront;
54
+ this.captureStep = IdCaptureFlowStatus.HowToFront;
57
55
  }
58
56
  howToDone() {
59
- if (this.captureStep == CaptureFlowStatus.HowToFront) {
60
- this.captureStep = CaptureFlowStatus.IdFront;
57
+ if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
58
+ this.captureStep = IdCaptureFlowStatus.IdFront;
61
59
  }
62
- if (this.captureStep == CaptureFlowStatus.HowToBack) {
63
- this.captureStep = CaptureFlowStatus.IdBack;
60
+ if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
61
+ this.captureStep = IdCaptureFlowStatus.IdBack;
64
62
  }
65
63
  }
66
64
  timeElapsed() {
@@ -82,8 +80,8 @@ export class ProcessId {
82
80
  return;
83
81
  }
84
82
  try {
85
- this.flow.front.file = new File([idPhoto], this.flow.front.fileName, { type: 'image/png' });
86
- this.flow.front.photoDone = await this.uploadPhotos(this.flow.front.uploadType, this.flow.front.file);
83
+ let frontCapture = new File([idPhoto], this.flow.front.fileName, { type: 'image/png' });
84
+ this.flow.front.photoDone = await this.uploadPhotos(this.flow.front.photoType, frontCapture);
87
85
  await this.endFlow();
88
86
  }
89
87
  catch (e) {
@@ -98,8 +96,8 @@ export class ProcessId {
98
96
  return;
99
97
  }
100
98
  try {
101
- this.flow.back.file = new File([idPhoto], this.flow.back.fileName, { type: 'image/png' });
102
- this.flow.back.photoDone = await this.uploadPhotos(this.flow.back.uploadType, this.flow.back.file);
99
+ let backCapture = new File([idPhoto], this.flow.back.fileName, { type: 'image/png' });
100
+ this.flow.back.photoDone = await this.uploadPhotos(this.flow.back.photoType, backCapture);
103
101
  await this.endFlow();
104
102
  }
105
103
  catch (e) {
@@ -107,56 +105,32 @@ export class ProcessId {
107
105
  }
108
106
  }
109
107
  async capturedIdRecording(event) {
110
- var recResults = event.detail;
111
- if (recResults.RecordingChunks.length == 0 && this.recordingResultCount == 0) {
108
+ let idRecording = event.detail;
109
+ if (idRecording.size == 0 && this.recordingResultCount == 0) {
112
110
  this.recordingResultCount++;
113
111
  return;
114
112
  }
115
- if (recResults.RecordingChunks.length == 0) {
116
- await this.baseComponent.apiCall.AddLog({ message: 'Empty recording for ' + this.captureStep, blobData: recResults.RecordingChunks }, getLogMessage());
117
- this.triggerErrorFlow();
113
+ if (idRecording.size == 0) {
114
+ await this.baseComponent.apiCall.AddLog({ message: 'Empty ID recording', blobData: idRecording }, getLogMessage());
115
+ this.showTimeout = true;
118
116
  return;
119
117
  }
120
- this.flow.mimeType = event.detail.MimeType;
121
- if (this.captureStep == CaptureFlowStatus.IdFront) {
122
- this.flow.front.recoding = recResults.RecordingChunks;
123
- this.flow.front.recordingDone = true;
118
+ let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
119
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
120
+ let frontRec = new File([idRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
121
+ this.flow.front.recordingDone = await this.uploadRecording(this.flow.front.recType, frontRec);
124
122
  }
125
- if (this.captureStep == CaptureFlowStatus.IdBack) {
126
- this.flow.back.recoding = recResults.RecordingChunks;
127
- this.flow.back.recordingDone = true;
123
+ if (this.captureStep == IdCaptureFlowStatus.IdBack) {
124
+ let backRec = new File([idRecording], this.flow.back.recName + mimeType.extension, { type: mimeType.type });
125
+ this.flow.back.recordingDone = await this.uploadRecording(this.flow.back.recType, backRec);
128
126
  }
129
- if (this.captureStep == CaptureFlowStatus.Tilt) {
130
- this.flow.tilt.recoding = recResults.RecordingChunks;
131
- this.flow.tilt.recordingDone = true;
127
+ if (this.captureStep == IdCaptureFlowStatus.Tilt) {
128
+ let tiltRec = new File([idRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
129
+ this.flow.tilt.recordingDone = await this.uploadRecording(this.flow.tilt.recType, tiltRec);
132
130
  }
133
131
  await this.endFlow();
134
132
  this.recordingResultCount = 0;
135
133
  }
136
- async getRecordingFile() {
137
- let idRecording = new Blob(this.flow.recordingData, {
138
- type: this.flow.mimeType,
139
- });
140
- if (idRecording.size == 0) {
141
- await this.baseComponent.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
142
- this.triggerErrorFlow(true);
143
- return;
144
- }
145
- let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
146
- try {
147
- var file = new File([idRecording], 'idVideo.' + mimeType.extension, { type: mimeType.type });
148
- var uploadResult = this.uploadRecording('IdFrontVideo', file);
149
- if (uploadResult) {
150
- return true;
151
- }
152
- else {
153
- this.triggerErrorFlow(true);
154
- }
155
- }
156
- catch (e) {
157
- this.triggerErrorFlow(true);
158
- }
159
- }
160
134
  async componentDidLoad() {
161
135
  await this.baseComponent.initialize();
162
136
  }
@@ -189,73 +163,61 @@ export class ProcessId {
189
163
  }
190
164
  triggerErrorFlow(restart = false) {
191
165
  if (restart) {
192
- this.captureStep = CaptureFlowStatus.IdFront;
193
- this.flow.recordingData = [];
166
+ this.captureStep = IdCaptureFlowStatus.IdFront;
194
167
  }
195
- if (this.captureStep == CaptureFlowStatus.IdFront || restart) {
196
- this.flow.front.file = null;
168
+ if (this.captureStep == IdCaptureFlowStatus.IdFront || restart) {
197
169
  this.flow.front.photoDone = false;
198
170
  this.flow.front.recordingDone = false;
199
- this.flow.front.recoding = null;
200
171
  }
201
- if (this.captureStep == CaptureFlowStatus.IdBack || restart) {
202
- this.flow.back.file = null;
172
+ if (this.captureStep == IdCaptureFlowStatus.IdBack || restart) {
203
173
  this.flow.back.photoDone = false;
204
174
  this.flow.back.recordingDone = false;
205
- this.flow.back.recoding = null;
206
175
  }
207
- if (this.captureStep == CaptureFlowStatus.Tilt || restart) {
176
+ if (this.captureStep == IdCaptureFlowStatus.Tilt || restart) {
208
177
  this.flow.tilt.photoDone = true;
209
178
  this.flow.tilt.recordingDone = false;
210
- this.flow.tilt.recoding = null;
211
179
  }
212
180
  this.showInvalid = true;
213
181
  }
214
182
  async endFlow() {
215
- if (this.captureStep == CaptureFlowStatus.IdFront) {
183
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
216
184
  if (this.flow.front.photoDone && this.flow.front.recordingDone) {
217
- this.flow.recordingData.push(...this.flow.front.recoding);
218
185
  if (store.hasIdBack) {
219
- this.captureStep = CaptureFlowStatus.IdBack;
186
+ this.captureStep = IdCaptureFlowStatus.IdBack;
220
187
  }
221
188
  else if (store.hasIdTilt) {
222
- this.captureStep = CaptureFlowStatus.Tilt;
189
+ this.captureStep = IdCaptureFlowStatus.Tilt;
223
190
  }
224
191
  else {
225
- this.captureStep = CaptureFlowStatus.End;
192
+ this.captureStep = IdCaptureFlowStatus.End;
226
193
  }
227
194
  }
228
195
  else {
229
196
  return;
230
197
  }
231
198
  }
232
- if (this.captureStep == CaptureFlowStatus.IdBack && store.hasIdBack) {
199
+ if (this.captureStep == IdCaptureFlowStatus.IdBack && store.hasIdBack) {
233
200
  if (this.flow.back.photoDone && this.flow.back.recordingDone) {
234
- this.flow.recordingData.push(...this.flow.back.recoding);
235
201
  if (store.hasIdTilt) {
236
- this.captureStep = CaptureFlowStatus.Tilt;
202
+ this.captureStep = IdCaptureFlowStatus.Tilt;
237
203
  }
238
204
  else {
239
- this.captureStep = CaptureFlowStatus.End;
205
+ this.captureStep = IdCaptureFlowStatus.End;
240
206
  }
241
207
  }
242
208
  else {
243
209
  return;
244
210
  }
245
211
  }
246
- if (this.captureStep == CaptureFlowStatus.Tilt && store.hasIdTilt) {
212
+ if (this.captureStep == IdCaptureFlowStatus.Tilt && store.hasIdTilt) {
247
213
  if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
248
- this.flow.recordingData.push(...this.flow.tilt.recoding);
214
+ this.captureStep = IdCaptureFlowStatus.End;
249
215
  }
250
216
  else {
251
217
  return;
252
218
  }
253
219
  }
254
- var recDone = await this.getRecordingFile();
255
- if (recDone) {
256
- this.captureStep = CaptureFlowStatus.End;
257
- }
258
- if (this.captureStep != CaptureFlowStatus.End) {
220
+ if (this.captureStep != IdCaptureFlowStatus.End) {
259
221
  return;
260
222
  }
261
223
  store.flowStatus = FlowStatus.LIVENESS;
@@ -283,19 +245,19 @@ export class ProcessId {
283
245
  if (this.showInvalid || this.showTimeout) {
284
246
  return error;
285
247
  }
286
- if (this.captureStep == CaptureFlowStatus.HowToFront) {
248
+ if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
287
249
  return howToFront;
288
250
  }
289
- if (this.captureStep == CaptureFlowStatus.HowToBack) {
251
+ if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
290
252
  return howToBack;
291
253
  }
292
- if (this.captureStep == CaptureFlowStatus.IdFront) {
254
+ if (this.captureStep == IdCaptureFlowStatus.IdFront) {
293
255
  return frontCapture;
294
256
  }
295
- if (this.captureStep == CaptureFlowStatus.IdBack) {
257
+ if (this.captureStep == IdCaptureFlowStatus.IdBack) {
296
258
  return secondCapture;
297
259
  }
298
- if (this.captureStep == CaptureFlowStatus.Tilt) {
260
+ if (this.captureStep == IdCaptureFlowStatus.Tilt) {
299
261
  return tiltCapture;
300
262
  }
301
263
  }
@@ -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);
52
73
  }
53
74
  catch (e) {
54
75
  this.apiErrorEvent.emit(e);
@@ -66,9 +87,17 @@ export class UserLiveness {
66
87
  return;
67
88
  }
68
89
  let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
90
+ let currentFlow;
91
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
92
+ currentFlow = this.flow.front;
93
+ }
94
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
95
+ currentFlow = this.flow.tilt;
96
+ }
69
97
  try {
70
- this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + mimeType.extension, { type: mimeType.type });
71
- await this.uploadRecording();
98
+ let uploadRec = new File([selfieRecording], currentFlow.recName + mimeType.extension, { type: mimeType.type });
99
+ currentFlow.recordingDone = await this.uploadRecording(uploadRec);
100
+ await this.endFlow();
72
101
  }
73
102
  catch (e) {
74
103
  if (store.recordingRetryCount < 3) {
@@ -81,49 +110,55 @@ export class UserLiveness {
81
110
  }
82
111
  }
83
112
  async verificationFinished(_event) {
84
- this.selfieFlow.verificationFinished = true;
113
+ this.captureStep = SelfieFlowStatus.End;
85
114
  await this.endFlow();
86
115
  }
87
116
  async disconnectedCallback() {
88
117
  await this.baseComponent.finalize();
89
118
  }
90
- async uploadPhoto() {
91
- if (this.selfieFlow.photoFile == null || this.selfieFlow.photoDone) {
119
+ async uploadPhoto(photoFile) {
120
+ if (this.flow.front.photoDone) {
92
121
  return;
93
122
  }
94
- this.selfieFlow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'Selfie', this.selfieFlow.photoFile);
95
- if (this.selfieFlow.photoDone) {
123
+ this.flow.front.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'Selfie', photoFile);
124
+ if (this.flow.front.photoDone) {
96
125
  await this.endFlow();
97
126
  }
98
127
  else {
99
128
  this.triggerErrorFlow();
100
129
  }
101
130
  }
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();
131
+ async uploadRecording(uploadRec) {
132
+ let uplodDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'SelfieVideo', uploadRec);
133
+ if (uplodDone) {
134
+ return true;
109
135
  }
110
136
  else {
111
137
  this.triggerErrorFlow();
112
138
  }
139
+ return false;
113
140
  }
114
141
  triggerErrorFlow() {
115
- this.selfieFlow.photoFile = null;
116
- this.selfieFlow.recordingFile = null;
117
142
  this.showError = true;
118
143
  }
119
144
  async endFlow() {
120
- if (!this.selfieFlow.photoDone) {
121
- return;
145
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
146
+ if (this.flow.front.photoDone && this.flow.front.recordingDone) {
147
+ this.captureStep = SelfieFlowStatus.Gesture;
148
+ }
149
+ else {
150
+ return;
151
+ }
122
152
  }
123
- if (!this.selfieFlow.recordingDone) {
124
- return;
153
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
154
+ if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
155
+ this.captureStep = SelfieFlowStatus.End;
156
+ }
157
+ else {
158
+ return;
159
+ }
125
160
  }
126
- if (!this.selfieFlow.verificationFinished) {
161
+ if (this.captureStep != SelfieFlowStatus.End) {
127
162
  return;
128
163
  }
129
164
  store.recordingRetryCount = 0;
@@ -132,8 +167,21 @@ export class UserLiveness {
132
167
  render() {
133
168
  let howTo = h("how-to-info", { idSide: "" });
134
169
  let capture = h("selfie-capture", { id: "camera" });
170
+ let tilt = h("selfie-tilt", { id: "camera" });
135
171
  let error = h("capture-error", { type: "LIVENESS" });
136
- return this.showHowTo ? howTo : this.showError ? error : capture;
172
+ if (this.showError) {
173
+ return error;
174
+ }
175
+ if (this.captureStep == SelfieFlowStatus.HowToSelfie) {
176
+ return howTo;
177
+ }
178
+ if (this.captureStep == SelfieFlowStatus.Selfie) {
179
+ return capture;
180
+ }
181
+ if (this.captureStep == SelfieFlowStatus.Gesture) {
182
+ return tilt;
183
+ }
184
+ return capture;
137
185
  }
138
186
  static get is() { return "user-liveness"; }
139
187
  static get originalStyleUrls() {
@@ -149,8 +197,8 @@ export class UserLiveness {
149
197
  static get states() {
150
198
  return {
151
199
  "showError": {},
152
- "showHowTo": {},
153
- "selfieFlow": {}
200
+ "captureStep": {},
201
+ "flow": {}
154
202
  };
155
203
  }
156
204
  static get events() {
@@ -135,11 +135,10 @@ export class Stream {
135
135
  this.recordedChunks.push(event.data);
136
136
  };
137
137
  this.mediaRecorder.onstop = _e => {
138
- var resp = {
139
- RecordingChunks: this.recordedChunks,
140
- MimeType: options.mimeType,
141
- };
142
- this.callbackRecordingReady(resp);
138
+ var rec = new Blob(this.recordedChunks, {
139
+ type: options.mimeType.split(';')[0],
140
+ });
141
+ this.callbackRecordingReady(rec);
143
142
  };
144
143
  this.mediaRecorder.start(); // Start recording, and dump data every second
145
144
  }
@@ -203,7 +202,7 @@ export class Stream {
203
202
  async startFaceDetection() {
204
203
  if (this.streamPaused)
205
204
  return;
206
- this.faceML5Detector.initDetector();
205
+ this.faceML5Detector.initDetector(this.verificationMode);
207
206
  }
208
207
  requestFacePose() {
209
208
  var pose = FacePosePick.randomEnum(FacePose);
@@ -9,6 +9,7 @@ import face_green_svg from '../../assets/canvas-masks/face_green.svg';
9
9
  import { GlobalValues } from '../../helpers/textValues';
10
10
  import store from '../../helpers/store';
11
11
  import { delay } from '../../utils/utils';
12
+ import { VerificationMode } from '../../models/IVerificationMode';
12
13
  export class FaceML5Detector {
13
14
  static getInstance(stream, isMobile) {
14
15
  if (!FaceML5Detector.instance) {
@@ -25,7 +26,7 @@ export class FaceML5Detector {
25
26
  this.requestedFacePose = null;
26
27
  this.presentedFacePose = null;
27
28
  this.validFacePose = false;
28
- this.validFaceFoundAgain = false;
29
+ this.checkPose = false;
29
30
  this.MAX_NUMBER_FACES = 1;
30
31
  this.MIN_FACE_SCORE = 0.65;
31
32
  // private readonly MIN_FACE_SIZE_FOR_MOBILE = 200;
@@ -43,9 +44,10 @@ export class FaceML5Detector {
43
44
  this.canvasElement = canvasElement;
44
45
  // this.component = component;
45
46
  }
46
- initDetector() {
47
+ initDetector(mode) {
47
48
  this.initTime = Date.now();
48
49
  this.continue = true;
50
+ this.checkPose = mode == VerificationMode.Tilt;
49
51
  this.width = this.videoElement.videoWidth;
50
52
  this.height = this.videoElement.videoHeight;
51
53
  // this.videoRatio = getVideoRatio(this.videoElement);
@@ -53,7 +55,7 @@ export class FaceML5Detector {
53
55
  delay(2000).then(() => this.detectFaces());
54
56
  }
55
57
  detectFaces() {
56
- if (this.validFaceFoundAgain) {
58
+ if (this.validFaceFound) {
57
59
  if (this.start == null)
58
60
  this.start = Date.now();
59
61
  if (Date.now() > this.start + 3000) {
@@ -79,17 +81,19 @@ export class FaceML5Detector {
79
81
  return;
80
82
  }
81
83
  if (results.length > 0) {
82
- if (this.isSingleFace(results) && this.checkProbability(results) && this.checkFaceSize(results) && this.checkFaceIndent(results)) {
83
- if (!this.validFaceFound) {
84
- this.validFaceFound = true;
85
- this.stream.autoCapturing();
86
- // this.frontFace = new FaceLandmarks(results[0], this.width, this.height);
87
- await this.drawFrame('green');
88
- this.requestedFacePose = this.stream.requestFacePose();
89
- await delay(GlobalValues.VideoLenght);
90
- }
91
- else if (this.validFaceFound && !this.validFaceFoundAgain) {
92
- await this.checkFacePose(results);
84
+ if (this.checkPose) {
85
+ this.requestedFacePose = this.stream.requestFacePose();
86
+ await this.checkFacePose(results);
87
+ }
88
+ else {
89
+ if (this.isSingleFace(results) && this.checkProbability(results) && this.checkFaceSize(results) && this.checkFaceIndent(results)) {
90
+ if (!this.validFaceFound) {
91
+ this.validFaceFound = true;
92
+ this.stream.autoCapturing();
93
+ // this.frontFace = new FaceLandmarks(results[0], this.width, this.height);
94
+ await this.drawFrame('green');
95
+ await delay(GlobalValues.VideoLenght);
96
+ }
93
97
  }
94
98
  }
95
99
  }
@@ -210,7 +214,6 @@ export class FaceML5Detector {
210
214
  if (this.requestedFacePose !== null) {
211
215
  await delay(3000);
212
216
  this.validFacePose = true;
213
- this.validFaceFoundAgain = true;
214
217
  await this.drawFrame('green', true);
215
218
  }
216
219
  }
@@ -3,14 +3,26 @@ export var CaptureUploadTypes;
3
3
  CaptureUploadTypes["IdFront"] = "IdFront";
4
4
  CaptureUploadTypes["IdBack"] = "IdBack";
5
5
  CaptureUploadTypes["IdFrontVideo"] = "IdFrontVideo";
6
+ CaptureUploadTypes["IdBackVideo"] = "IdBackVideo";
7
+ CaptureUploadTypes["Selfie"] = "Selfie";
8
+ CaptureUploadTypes["SelfieVideo"] = "SelfieVideo";
9
+ CaptureUploadTypes["SelfieGestureVideo"] = "SelfieGestureVideo";
10
+ CaptureUploadTypes["TiltVideo"] = "TiltVideo";
6
11
  CaptureUploadTypes["None"] = "None";
7
12
  })(CaptureUploadTypes || (CaptureUploadTypes = {}));
8
- export var CaptureFlowStatus;
9
- (function (CaptureFlowStatus) {
10
- CaptureFlowStatus[CaptureFlowStatus["HowToFront"] = 0] = "HowToFront";
11
- CaptureFlowStatus[CaptureFlowStatus["IdFront"] = 1] = "IdFront";
12
- CaptureFlowStatus[CaptureFlowStatus["HowToBack"] = 2] = "HowToBack";
13
- CaptureFlowStatus[CaptureFlowStatus["IdBack"] = 3] = "IdBack";
14
- CaptureFlowStatus[CaptureFlowStatus["Tilt"] = 4] = "Tilt";
15
- CaptureFlowStatus[CaptureFlowStatus["End"] = 5] = "End";
16
- })(CaptureFlowStatus || (CaptureFlowStatus = {}));
13
+ export var IdCaptureFlowStatus;
14
+ (function (IdCaptureFlowStatus) {
15
+ IdCaptureFlowStatus[IdCaptureFlowStatus["HowToFront"] = 0] = "HowToFront";
16
+ IdCaptureFlowStatus[IdCaptureFlowStatus["IdFront"] = 1] = "IdFront";
17
+ IdCaptureFlowStatus[IdCaptureFlowStatus["HowToBack"] = 2] = "HowToBack";
18
+ IdCaptureFlowStatus[IdCaptureFlowStatus["IdBack"] = 3] = "IdBack";
19
+ IdCaptureFlowStatus[IdCaptureFlowStatus["Tilt"] = 4] = "Tilt";
20
+ IdCaptureFlowStatus[IdCaptureFlowStatus["End"] = 5] = "End";
21
+ })(IdCaptureFlowStatus || (IdCaptureFlowStatus = {}));
22
+ export var SelfieFlowStatus;
23
+ (function (SelfieFlowStatus) {
24
+ SelfieFlowStatus[SelfieFlowStatus["HowToSelfie"] = 0] = "HowToSelfie";
25
+ SelfieFlowStatus[SelfieFlowStatus["Selfie"] = 1] = "Selfie";
26
+ SelfieFlowStatus[SelfieFlowStatus["Gesture"] = 2] = "Gesture";
27
+ SelfieFlowStatus[SelfieFlowStatus["End"] = 3] = "End";
28
+ })(SelfieFlowStatus || (SelfieFlowStatus = {}));
@@ -8,20 +8,17 @@ export var FlowSteps;
8
8
  FlowSteps[FlowSteps["OtpCheck"] = 'otp-check'] = "OtpCheck";
9
9
  FlowSteps[FlowSteps["CiFront"] = 'ci-front'] = "CiFront";
10
10
  FlowSteps[FlowSteps["CiFrontHowTo"] = 'ci-front-how-to'] = "CiFrontHowTo";
11
- FlowSteps[FlowSteps["CiFrontHoldAnimation"] = 'ci-front-hold-animation'] = "CiFrontHoldAnimation";
12
- FlowSteps[FlowSteps["CiFrontTiltAnimation"] = 'ci-front-tilt-animation'] = "CiFrontTiltAnimation";
13
11
  FlowSteps[FlowSteps["CiFrontCapture"] = 'ci-front-capture'] = "CiFrontCapture";
14
12
  FlowSteps[FlowSteps["CiBack"] = 'ci-back'] = "CiBack";
15
13
  FlowSteps[FlowSteps["CiBackHowTo"] = 'ci-back-how-to'] = "CiBackHowTo";
16
- FlowSteps[FlowSteps["CiBackHoldAnimation"] = 'ci-back-hold-animation'] = "CiBackHoldAnimation";
17
- FlowSteps[FlowSteps["CiBackTiltAnimation"] = 'ci-back-tilt-animation'] = "CiBackTiltAnimation";
18
14
  FlowSteps[FlowSteps["CiBackCapture"] = 'ci-back-capture'] = "CiBackCapture";
19
15
  FlowSteps[FlowSteps["CiTilt"] = 'ci-tilt'] = "CiTilt";
16
+ FlowSteps[FlowSteps["CiError"] = 'ci-error'] = "CiError";
20
17
  FlowSteps[FlowSteps["SelfieHowTo"] = 'selfie-how-to'] = "SelfieHowTo";
21
- FlowSteps[FlowSteps["SelfieHoldAnimation"] = 'selfie-hold-animation'] = "SelfieHoldAnimation";
22
- FlowSteps[FlowSteps["SelfieTiltAnimation"] = 'selfie-tilt-animation'] = "SelfieTiltAnimation";
18
+ FlowSteps[FlowSteps["SelfieTilt"] = 'selfie-tilt'] = "SelfieTilt";
23
19
  FlowSteps[FlowSteps["SelfieCapture"] = 'selfie-capture'] = "SelfieCapture";
24
20
  FlowSteps[FlowSteps["Selfie"] = 'selfie'] = "Selfie";
21
+ FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
25
22
  FlowSteps[FlowSteps["End"] = 'end'] = "End";
26
23
  FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
27
24
  })(FlowSteps || (FlowSteps = {}));