@ekyc_qoobiss/qbs-ect-cmp 3.6.14 → 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 (50) hide show
  1. package/dist/cjs/{Stream-097bd1e9.js → agreement-check_19.cjs.entry.js} +5193 -91
  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 +28 -28
  13. package/dist/collection/components/flow/user-liveness/user-liveness.js +88 -40
  14. package/dist/collection/helpers/Stream.js +1 -1
  15. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +18 -15
  16. package/dist/collection/models/CaptureFlow.js +17 -9
  17. package/dist/collection/models/FlowSteps.js +3 -6
  18. package/dist/esm/{Stream-d1fb2210.js → agreement-check_19.entry.js} +5128 -24
  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-73a2e58b.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/flow/user-liveness/user-liveness.d.ts +4 -4
  31. package/dist/types/components.d.ts +20 -37
  32. package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +3 -2
  33. package/dist/types/models/CaptureFlow.d.ts +8 -1
  34. package/dist/types/models/FlowSteps.d.ts +3 -6
  35. package/package.json +1 -1
  36. package/dist/cjs/agreement-check_18.cjs.entry.js +0 -4971
  37. package/dist/cjs/id-double-side.cjs.entry.js +0 -208
  38. package/dist/cjs/id-single-side.cjs.entry.js +0 -147
  39. package/dist/collection/components/flow/id-double-side/id-double-side.css +0 -0
  40. package/dist/collection/components/flow/id-double-side/id-double-side.js +0 -285
  41. package/dist/collection/components/flow/id-single-side/id-single-side.css +0 -0
  42. package/dist/collection/components/flow/id-single-side/id-single-side.js +0 -216
  43. package/dist/esm/agreement-check_18.entry.js +0 -4950
  44. package/dist/esm/id-double-side.entry.js +0 -204
  45. package/dist/esm/id-single-side.entry.js +0 -143
  46. package/dist/qbs-ect-cmp/p-04e51eac.entry.js +0 -1
  47. package/dist/qbs-ect-cmp/p-deea462b.entry.js +0 -1
  48. package/dist/qbs-ect-cmp/p-f84883f8.entry.js +0 -1
  49. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +0 -29
  50. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +0 -24
@@ -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() {
@@ -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);
@@ -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
  }
@@ -4,17 +4,25 @@ export var CaptureUploadTypes;
4
4
  CaptureUploadTypes["IdBack"] = "IdBack";
5
5
  CaptureUploadTypes["IdFrontVideo"] = "IdFrontVideo";
6
6
  CaptureUploadTypes["IdBackVideo"] = "IdBackVideo";
7
+ CaptureUploadTypes["Selfie"] = "Selfie";
7
8
  CaptureUploadTypes["SelfieVideo"] = "SelfieVideo";
8
9
  CaptureUploadTypes["SelfieGestureVideo"] = "SelfieGestureVideo";
9
10
  CaptureUploadTypes["TiltVideo"] = "TiltVideo";
10
11
  CaptureUploadTypes["None"] = "None";
11
12
  })(CaptureUploadTypes || (CaptureUploadTypes = {}));
12
- export var CaptureFlowStatus;
13
- (function (CaptureFlowStatus) {
14
- CaptureFlowStatus[CaptureFlowStatus["HowToFront"] = 0] = "HowToFront";
15
- CaptureFlowStatus[CaptureFlowStatus["IdFront"] = 1] = "IdFront";
16
- CaptureFlowStatus[CaptureFlowStatus["HowToBack"] = 2] = "HowToBack";
17
- CaptureFlowStatus[CaptureFlowStatus["IdBack"] = 3] = "IdBack";
18
- CaptureFlowStatus[CaptureFlowStatus["Tilt"] = 4] = "Tilt";
19
- CaptureFlowStatus[CaptureFlowStatus["End"] = 5] = "End";
20
- })(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 = {}));