@ekyc_qoobiss/qbs-ect-cmp 3.6.6 → 3.6.10
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.
- package/dist/cjs/Stream-1b0beea8.js +5349 -0
- package/dist/cjs/agreement-check_18.cjs.entry.js +763 -6009
- package/dist/cjs/id-double-side.cjs.entry.js +208 -0
- package/dist/cjs/id-single-side.cjs.entry.js +147 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +4 -19
- package/dist/collection/components/common/id-capture/id-capture.js +4 -19
- package/dist/collection/components/common/id-tilt/id-tilt.css +35 -0
- package/dist/collection/components/common/id-tilt/id-tilt.js +194 -0
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +4 -3
- package/dist/collection/components/controls/camera/camera.js +3 -1
- package/dist/collection/components/flow/process-id/process-id.css +0 -0
- package/dist/collection/components/flow/process-id/process-id.js +375 -0
- package/dist/collection/components/identification-component/identification-component.js +2 -5
- package/dist/collection/helpers/Stream.js +10 -8
- package/dist/collection/helpers/store.js +1 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +12 -12
- package/dist/collection/models/CaptureFlow.js +16 -0
- package/dist/collection/models/FlowSteps.js +1 -0
- package/dist/collection/models/IRecordingCallback.js +1 -0
- package/dist/collection/models/IVerificationMode.js +5 -0
- package/dist/esm/Stream-0935dac1.js +5325 -0
- package/dist/esm/agreement-check_18.entry.js +446 -5692
- package/dist/esm/id-double-side.entry.js +204 -0
- package/dist/esm/id-single-side.entry.js +143 -0
- package/dist/esm/{index-9d69e511.js → index-5d6f9123.js} +1 -1
- package/dist/esm/loader-dots.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/qbs-ect-cmp.js +3 -3
- package/dist/qbs-ect-cmp/{p-4c8e922b.entry.js → p-7c33dd41.entry.js} +1 -1
- package/dist/qbs-ect-cmp/p-933b4d66.entry.js +1 -0
- package/dist/qbs-ect-cmp/{p-06e42b28.js → p-aacd7024.js} +1 -1
- package/dist/qbs-ect-cmp/{p-fef8280d.entry.js → p-c8a04b87.js} +26 -26
- package/dist/qbs-ect-cmp/p-d95265e0.entry.js +1 -0
- package/dist/qbs-ect-cmp/p-e5c2d08c.entry.js +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +0 -1
- package/dist/types/components/common/id-capture/id-capture.d.ts +0 -1
- package/dist/types/components/common/id-tilt/id-tilt.d.ts +26 -0
- package/dist/types/components/controls/camera/camera.d.ts +3 -2
- package/dist/types/components/flow/process-id/process-id.d.ts +28 -0
- package/dist/types/components.d.ts +37 -0
- package/dist/types/helpers/Stream.d.ts +5 -2
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +4 -3
- package/dist/types/models/CaptureFlow.d.ts +29 -0
- package/dist/types/models/FlowSteps.d.ts +1 -0
- package/dist/types/models/IEctStore.d.ts +1 -0
- package/dist/types/models/IRecordingCallback.d.ts +4 -0
- package/dist/types/models/IVerificationMode.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { Cameras } from '../../../helpers/Cameras';
|
|
3
|
+
import { Stream } from '../../../helpers/Stream';
|
|
4
|
+
import { IdCaptureValues } from '../../../helpers/textValues';
|
|
5
|
+
import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
|
|
6
|
+
import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
|
|
7
|
+
import { IDPose } from '../../../libs/IDML5Detector/IDPose';
|
|
8
|
+
import { delay } from '../../../utils/utils';
|
|
9
|
+
import store from '../../../helpers/store';
|
|
10
|
+
import { BaseComponent } from '../../base-component';
|
|
11
|
+
import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
|
|
12
|
+
import { VerificationMode } from '../../../models/IVerificationMode';
|
|
13
|
+
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
14
|
+
export class IdTilt {
|
|
15
|
+
// @State() private animationPath: string;
|
|
16
|
+
constructor() {
|
|
17
|
+
this.photoIsReady = photos => {
|
|
18
|
+
//this.closeCamera();
|
|
19
|
+
this.eventPhotoCapture.emit(photos);
|
|
20
|
+
};
|
|
21
|
+
this.videoStarted = undefined;
|
|
22
|
+
this.cameraSize = undefined;
|
|
23
|
+
this.captureTaken = undefined;
|
|
24
|
+
this.verified = undefined;
|
|
25
|
+
this.titleMesage = undefined;
|
|
26
|
+
this.showDemo = undefined;
|
|
27
|
+
this.demoVideo = undefined;
|
|
28
|
+
this.captureTaken = false;
|
|
29
|
+
this.verified = false;
|
|
30
|
+
this.cameras = new Cameras();
|
|
31
|
+
this.showDemo = true;
|
|
32
|
+
this.baseComponent = new BaseComponent(FlowSteps.CiFrontHoldAnimation);
|
|
33
|
+
}
|
|
34
|
+
eventVideoStarted(event) {
|
|
35
|
+
this.videoStarted = true;
|
|
36
|
+
this.cameraSize = event.detail;
|
|
37
|
+
}
|
|
38
|
+
async componentWillLoad() {
|
|
39
|
+
this.titleMesage = IdCaptureValues.IDPoseMapping[1];
|
|
40
|
+
//this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
|
|
41
|
+
if (!navigator.mediaDevices) {
|
|
42
|
+
this.apiErrorEvent.emit({ message: 'This browser does not support webRTC' });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async componentDidLoad() {
|
|
46
|
+
await this.baseComponent.logStep(FlowSteps.CiFrontTiltAnimation, FlowMoments.Initialized);
|
|
47
|
+
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Tilted];
|
|
48
|
+
this.demoVideo.play();
|
|
49
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
50
|
+
this.showDemo = false;
|
|
51
|
+
await this.baseComponent.logStep(FlowSteps.CiFrontTiltAnimation, FlowMoments.Finalized);
|
|
52
|
+
this.openCamera();
|
|
53
|
+
}
|
|
54
|
+
async openCamera() {
|
|
55
|
+
await this.baseComponent.logStep(FlowSteps.CiTilt, FlowMoments.Initialized);
|
|
56
|
+
const constraints = this.cameras.GetConstraints(store.cameraId, store.device);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
navigator.mediaDevices
|
|
59
|
+
.getUserMedia(constraints)
|
|
60
|
+
.then(stream => {
|
|
61
|
+
const superStream = Stream.getInstance(VerificationMode.Full);
|
|
62
|
+
superStream.initStream(stream);
|
|
63
|
+
})
|
|
64
|
+
.catch(e => {
|
|
65
|
+
this.closeCamera();
|
|
66
|
+
this.apiErrorEvent.emit(e);
|
|
67
|
+
});
|
|
68
|
+
}, 100);
|
|
69
|
+
}
|
|
70
|
+
closeCamera() {
|
|
71
|
+
if (Stream.instance) {
|
|
72
|
+
Stream.getInstance(VerificationMode.Full).dropStream();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this.closeCamera();
|
|
77
|
+
Stream.instance = null;
|
|
78
|
+
IDML5Detector.instance = null;
|
|
79
|
+
FaceML5Detector.instance = null;
|
|
80
|
+
}
|
|
81
|
+
async takePhoto() {
|
|
82
|
+
if (this.captureTaken)
|
|
83
|
+
return;
|
|
84
|
+
this.captureTaken = true;
|
|
85
|
+
let res = await Stream.getInstance(VerificationMode.Full).takePhoto();
|
|
86
|
+
this.photoIsReady(res);
|
|
87
|
+
await this.baseComponent.logStep(FlowSteps.CiTilt, FlowMoments.Finalized);
|
|
88
|
+
}
|
|
89
|
+
async verificationFinished() {
|
|
90
|
+
if (this.verified)
|
|
91
|
+
return;
|
|
92
|
+
this.verified = true;
|
|
93
|
+
this.titleMesage = IdCaptureValues.Loading;
|
|
94
|
+
this.closeCamera();
|
|
95
|
+
this.showDemo = true;
|
|
96
|
+
this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
|
|
97
|
+
this.demoVideo.loop = true;
|
|
98
|
+
this.demoVideo.play();
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
let cameraStyle;
|
|
102
|
+
let cameraStyleInner;
|
|
103
|
+
if (this.videoStarted) {
|
|
104
|
+
cameraStyle = {
|
|
105
|
+
width: Math.round(this.cameraSize.width) + 'px',
|
|
106
|
+
height: Math.round((this.cameraSize.width * 9) / 16) + 'px',
|
|
107
|
+
overflow: 'hidden',
|
|
108
|
+
borderRadius: '10px',
|
|
109
|
+
};
|
|
110
|
+
cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
|
|
111
|
+
}
|
|
112
|
+
let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
|
|
113
|
+
//let videoClass = this.device.isMobile ? '' : 'video-demo';
|
|
114
|
+
let bgDemo = this.verified ? 'container' : 'container bg-black';
|
|
115
|
+
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" }, IdCaptureValues.FooterText)))));
|
|
116
|
+
}
|
|
117
|
+
static get is() { return "id-tilt"; }
|
|
118
|
+
static get originalStyleUrls() {
|
|
119
|
+
return {
|
|
120
|
+
"$": ["id-tilt.css"]
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
static get styleUrls() {
|
|
124
|
+
return {
|
|
125
|
+
"$": ["id-tilt.css"]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
static get states() {
|
|
129
|
+
return {
|
|
130
|
+
"videoStarted": {},
|
|
131
|
+
"cameraSize": {},
|
|
132
|
+
"captureTaken": {},
|
|
133
|
+
"verified": {},
|
|
134
|
+
"titleMesage": {},
|
|
135
|
+
"showDemo": {},
|
|
136
|
+
"demoVideo": {}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
static get events() {
|
|
140
|
+
return [{
|
|
141
|
+
"method": "eventPhotoCapture",
|
|
142
|
+
"name": "photoIdCapture",
|
|
143
|
+
"bubbles": true,
|
|
144
|
+
"cancelable": true,
|
|
145
|
+
"composed": true,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "any",
|
|
152
|
+
"resolved": "any",
|
|
153
|
+
"references": {}
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
"method": "apiErrorEvent",
|
|
157
|
+
"name": "apiError",
|
|
158
|
+
"bubbles": true,
|
|
159
|
+
"cancelable": true,
|
|
160
|
+
"composed": true,
|
|
161
|
+
"docs": {
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": ""
|
|
164
|
+
},
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "any",
|
|
167
|
+
"resolved": "any",
|
|
168
|
+
"references": {}
|
|
169
|
+
}
|
|
170
|
+
}];
|
|
171
|
+
}
|
|
172
|
+
static get elementRef() { return "component"; }
|
|
173
|
+
static get listeners() {
|
|
174
|
+
return [{
|
|
175
|
+
"name": "videoStarted",
|
|
176
|
+
"method": "eventVideoStarted",
|
|
177
|
+
"target": undefined,
|
|
178
|
+
"capture": false,
|
|
179
|
+
"passive": false
|
|
180
|
+
}, {
|
|
181
|
+
"name": "takePhoto",
|
|
182
|
+
"method": "takePhoto",
|
|
183
|
+
"target": undefined,
|
|
184
|
+
"capture": false,
|
|
185
|
+
"passive": false
|
|
186
|
+
}, {
|
|
187
|
+
"name": "verificationFinished",
|
|
188
|
+
"method": "verificationFinished",
|
|
189
|
+
"target": undefined,
|
|
190
|
+
"capture": false,
|
|
191
|
+
"passive": false
|
|
192
|
+
}];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -8,6 +8,7 @@ import { delay } from '../../../utils/utils';
|
|
|
8
8
|
import store from '../../../helpers/store';
|
|
9
9
|
import { BaseComponent } from '../../base-component';
|
|
10
10
|
import { FlowMoments, FlowSteps } from '../../../models/FlowSteps';
|
|
11
|
+
import { VerificationMode } from '../../../models/IVerificationMode';
|
|
11
12
|
export class SelfieCapture {
|
|
12
13
|
// @State() private animationPath: string;
|
|
13
14
|
constructor() {
|
|
@@ -77,7 +78,7 @@ export class SelfieCapture {
|
|
|
77
78
|
navigator.mediaDevices
|
|
78
79
|
.getUserMedia(constraints)
|
|
79
80
|
.then(stream => {
|
|
80
|
-
const superStream = Stream.getInstance();
|
|
81
|
+
const superStream = Stream.getInstance(VerificationMode.Full);
|
|
81
82
|
superStream.initStream(stream);
|
|
82
83
|
})
|
|
83
84
|
.catch(e => {
|
|
@@ -88,7 +89,7 @@ export class SelfieCapture {
|
|
|
88
89
|
}
|
|
89
90
|
closeCamera() {
|
|
90
91
|
if (Stream.instance) {
|
|
91
|
-
Stream.getInstance().dropStream();
|
|
92
|
+
Stream.getInstance(VerificationMode.Full).dropStream();
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
disconnectedCallback() {
|
|
@@ -100,7 +101,7 @@ export class SelfieCapture {
|
|
|
100
101
|
if (this.captureTaken)
|
|
101
102
|
return;
|
|
102
103
|
this.captureTaken = true;
|
|
103
|
-
let res = await Stream.getInstance().takePhoto();
|
|
104
|
+
let res = await Stream.getInstance(VerificationMode.Full).takePhoto();
|
|
104
105
|
this.photoIsReady(res);
|
|
105
106
|
await this.baseComponent.logStep(FlowSteps.SelfieHoldAnimation, FlowMoments.Finalized);
|
|
106
107
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Stream } from '../../../helpers/Stream';
|
|
2
2
|
import { h } from '@stencil/core';
|
|
3
3
|
import store from '../../../helpers/store';
|
|
4
|
+
import { VerificationMode } from '../../../models/IVerificationMode';
|
|
4
5
|
// import { PipelineResult } from '../../../libs/FaceDetector/PipelineResult';
|
|
5
6
|
export class Camera {
|
|
6
7
|
constructor() {
|
|
@@ -58,7 +59,8 @@ export class Camera {
|
|
|
58
59
|
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) })));
|
|
59
60
|
}
|
|
60
61
|
startStream() {
|
|
61
|
-
|
|
62
|
+
var captureMode = this.captureMode == 'tilt' ? VerificationMode.Tilt : VerificationMode.Full;
|
|
63
|
+
const stream = Stream.getInstance(captureMode);
|
|
62
64
|
stream.updateHtmlElements(this.cameraVideo, this.cameraCanvas, this.component);
|
|
63
65
|
if (this.captureMode == 'selfie') {
|
|
64
66
|
stream.setFaceDetection(true);
|
|
File without changes
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { h /*getAssetPath*/ } from '@stencil/core';
|
|
2
|
+
import store from '../../../helpers/store';
|
|
3
|
+
import { Stream } from '../../../helpers/Stream';
|
|
4
|
+
import { FlowStatus } from '../../../models/FlowStatus';
|
|
5
|
+
import { FlowSteps } from '../../../models/FlowSteps';
|
|
6
|
+
import { getLogMessage } from '../../../utils/utils';
|
|
7
|
+
import { BaseComponent } from '../../base-component';
|
|
8
|
+
import { CaptureFlowStatus, CaptureUploadTypes } from '../../../models/CaptureFlow';
|
|
9
|
+
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
10
|
+
export class ProcessId {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.recordingResultCount = 0;
|
|
13
|
+
this.captureStep = undefined;
|
|
14
|
+
this.showTimeout = undefined;
|
|
15
|
+
this.showInvalid = undefined;
|
|
16
|
+
this.flow = undefined;
|
|
17
|
+
this.baseComponent = new BaseComponent(FlowSteps.CiBack);
|
|
18
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
19
|
+
}
|
|
20
|
+
componentWillLoad() {
|
|
21
|
+
this.captureRetryCount = 0;
|
|
22
|
+
this.flow = {
|
|
23
|
+
front: {
|
|
24
|
+
photoDone: false,
|
|
25
|
+
recordingDone: false,
|
|
26
|
+
fileName: 'idImage.png',
|
|
27
|
+
file: null,
|
|
28
|
+
recoding: null,
|
|
29
|
+
uploadType: CaptureUploadTypes.IdFront,
|
|
30
|
+
},
|
|
31
|
+
back: null,
|
|
32
|
+
tilt: null,
|
|
33
|
+
recordingData: [],
|
|
34
|
+
mimeType: '',
|
|
35
|
+
};
|
|
36
|
+
if (store.hasIdBack) {
|
|
37
|
+
this.flow.back = {
|
|
38
|
+
photoDone: false,
|
|
39
|
+
recordingDone: false,
|
|
40
|
+
fileName: 'idBackImage.png',
|
|
41
|
+
file: null,
|
|
42
|
+
recoding: null,
|
|
43
|
+
uploadType: CaptureUploadTypes.IdBack,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (store.idTiltCheck) {
|
|
47
|
+
this.flow.tilt = {
|
|
48
|
+
photoDone: true,
|
|
49
|
+
recordingDone: false,
|
|
50
|
+
fileName: 'idTiltImage.png',
|
|
51
|
+
file: null,
|
|
52
|
+
recoding: null,
|
|
53
|
+
uploadType: CaptureUploadTypes.None,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
this.captureStep = CaptureFlowStatus.HowToFront;
|
|
57
|
+
}
|
|
58
|
+
howToDone() {
|
|
59
|
+
if (this.captureStep == CaptureFlowStatus.HowToFront) {
|
|
60
|
+
this.captureStep = CaptureFlowStatus.IdFront;
|
|
61
|
+
}
|
|
62
|
+
if (this.captureStep == CaptureFlowStatus.HowToBack) {
|
|
63
|
+
this.captureStep = CaptureFlowStatus.IdBack;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
timeElapsed() {
|
|
67
|
+
this.showTimeout = true;
|
|
68
|
+
}
|
|
69
|
+
captureErrorDone() {
|
|
70
|
+
if (this.showTimeout == true) {
|
|
71
|
+
this.showTimeout = false;
|
|
72
|
+
}
|
|
73
|
+
if (this.showInvalid == true) {
|
|
74
|
+
this.showInvalid = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async captureIdImage(event) {
|
|
78
|
+
let idPhoto = event.detail;
|
|
79
|
+
if (idPhoto.size == 0) {
|
|
80
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
81
|
+
this.triggerErrorFlow();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
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);
|
|
87
|
+
await this.endFlow();
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
this.apiErrorEvent.emit(e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async captureIdBackImage(event) {
|
|
94
|
+
let idPhoto = event.detail;
|
|
95
|
+
if (idPhoto.size == 0) {
|
|
96
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
97
|
+
this.triggerErrorFlow();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
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);
|
|
103
|
+
await this.endFlow();
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
this.apiErrorEvent.emit(e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async capturedIdRecording(event) {
|
|
110
|
+
var recResults = event.detail;
|
|
111
|
+
if (recResults.RecordingChunks.length == 0 && this.recordingResultCount == 0) {
|
|
112
|
+
this.recordingResultCount++;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
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();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
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;
|
|
124
|
+
}
|
|
125
|
+
if (this.captureStep == CaptureFlowStatus.IdBack) {
|
|
126
|
+
this.flow.back.recoding = recResults.RecordingChunks;
|
|
127
|
+
this.flow.back.recordingDone = true;
|
|
128
|
+
}
|
|
129
|
+
if (this.captureStep == CaptureFlowStatus.Tilt) {
|
|
130
|
+
this.flow.tilt.recoding = recResults.RecordingChunks;
|
|
131
|
+
this.flow.tilt.recordingDone = true;
|
|
132
|
+
}
|
|
133
|
+
await this.endFlow();
|
|
134
|
+
this.recordingResultCount = 0;
|
|
135
|
+
}
|
|
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
|
+
async componentDidLoad() {
|
|
161
|
+
await this.baseComponent.initialize();
|
|
162
|
+
}
|
|
163
|
+
async uploadPhotos(uploadType, photoFile) {
|
|
164
|
+
if (photoFile == null || uploadType == '') {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
var uploadResult = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, uploadType, photoFile);
|
|
168
|
+
if (uploadResult) {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.switchCamera();
|
|
173
|
+
this.triggerErrorFlow();
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
async uploadRecording(uploadType, recordingFile) {
|
|
178
|
+
if (recordingFile == null) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
var uploadResult = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, uploadType, recordingFile);
|
|
182
|
+
if (uploadResult) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
this.triggerErrorFlow();
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
triggerErrorFlow(restart = false) {
|
|
191
|
+
if (restart) {
|
|
192
|
+
this.captureStep = CaptureFlowStatus.IdFront;
|
|
193
|
+
}
|
|
194
|
+
if (this.captureStep == CaptureFlowStatus.IdFront || restart) {
|
|
195
|
+
this.flow.front.file = null;
|
|
196
|
+
this.flow.front.photoDone = false;
|
|
197
|
+
this.flow.front.recordingDone = false;
|
|
198
|
+
this.flow.front.recoding = null;
|
|
199
|
+
}
|
|
200
|
+
if (this.captureStep == CaptureFlowStatus.IdBack || restart) {
|
|
201
|
+
this.flow.back.file = null;
|
|
202
|
+
this.flow.back.photoDone = false;
|
|
203
|
+
this.flow.back.recordingDone = false;
|
|
204
|
+
this.flow.back.recoding = null;
|
|
205
|
+
}
|
|
206
|
+
if (this.captureStep == CaptureFlowStatus.Tilt || restart) {
|
|
207
|
+
this.flow.tilt.photoDone = true;
|
|
208
|
+
this.flow.tilt.recordingDone = false;
|
|
209
|
+
this.flow.tilt.recoding = null;
|
|
210
|
+
}
|
|
211
|
+
this.showInvalid = true;
|
|
212
|
+
}
|
|
213
|
+
async endFlow() {
|
|
214
|
+
if (this.captureStep == CaptureFlowStatus.IdFront) {
|
|
215
|
+
if (this.flow.front.photoDone && this.flow.front.recordingDone) {
|
|
216
|
+
if (store.hasIdBack) {
|
|
217
|
+
this.captureStep = CaptureFlowStatus.IdBack;
|
|
218
|
+
}
|
|
219
|
+
else if (store.idTiltCheck) {
|
|
220
|
+
this.captureStep = CaptureFlowStatus.Tilt;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
this.captureStep = CaptureFlowStatus.End;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (this.captureStep == CaptureFlowStatus.IdBack && store.hasIdBack) {
|
|
231
|
+
if (this.flow.back.photoDone && this.flow.back.recordingDone) {
|
|
232
|
+
if (store.idTiltCheck) {
|
|
233
|
+
this.captureStep = CaptureFlowStatus.Tilt;
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
this.captureStep = CaptureFlowStatus.End;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (this.captureStep == CaptureFlowStatus.Tilt && store.idTiltCheck) {
|
|
244
|
+
if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
|
|
245
|
+
this.flow.recordingData.push(...this.flow.front.recoding);
|
|
246
|
+
this.flow.recordingData.push(...this.flow.back.recoding);
|
|
247
|
+
this.flow.recordingData.push(...this.flow.tilt.recoding);
|
|
248
|
+
await this.getRecordingFile();
|
|
249
|
+
this.captureStep = CaptureFlowStatus.End;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (this.captureStep != CaptureFlowStatus.End) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
store.flowStatus = FlowStatus.LIVENESS;
|
|
259
|
+
}
|
|
260
|
+
async disconnectedCallback() {
|
|
261
|
+
await this.baseComponent.finalize();
|
|
262
|
+
}
|
|
263
|
+
switchCamera() {
|
|
264
|
+
if (this.captureRetryCount == 1) {
|
|
265
|
+
let camIndex = store.cameraIds.indexOf(store.cameraId);
|
|
266
|
+
store.cameraId = camIndex === store.cameraIds.length - 1 ? store.cameraIds[0] : store.cameraIds[camIndex + 1];
|
|
267
|
+
this.captureRetryCount = 0;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
this.captureRetryCount++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
render() {
|
|
274
|
+
let error = h("capture-error", { type: "ID" });
|
|
275
|
+
let frontCapture = h("id-capture", null);
|
|
276
|
+
let secondCapture = h("id-back-capture", null);
|
|
277
|
+
let tiltCapture = h("id-tilt", null);
|
|
278
|
+
let howToFront = h("how-to-info", { idSide: "front" });
|
|
279
|
+
let howToBack = h("how-to-info", { idSide: "back" });
|
|
280
|
+
if (this.showInvalid || this.showTimeout) {
|
|
281
|
+
return error;
|
|
282
|
+
}
|
|
283
|
+
if (this.captureStep == CaptureFlowStatus.HowToFront) {
|
|
284
|
+
return howToFront;
|
|
285
|
+
}
|
|
286
|
+
if (this.captureStep == CaptureFlowStatus.HowToBack) {
|
|
287
|
+
return howToBack;
|
|
288
|
+
}
|
|
289
|
+
if (this.captureStep == CaptureFlowStatus.IdFront) {
|
|
290
|
+
return frontCapture;
|
|
291
|
+
}
|
|
292
|
+
if (this.captureStep == CaptureFlowStatus.IdBack) {
|
|
293
|
+
return secondCapture;
|
|
294
|
+
}
|
|
295
|
+
if (this.captureStep == CaptureFlowStatus.Tilt) {
|
|
296
|
+
return tiltCapture;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
static get is() { return "process-id"; }
|
|
300
|
+
static get originalStyleUrls() {
|
|
301
|
+
return {
|
|
302
|
+
"$": ["process-id.css"]
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
static get styleUrls() {
|
|
306
|
+
return {
|
|
307
|
+
"$": ["process-id.css"]
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
static get states() {
|
|
311
|
+
return {
|
|
312
|
+
"captureStep": {},
|
|
313
|
+
"showTimeout": {},
|
|
314
|
+
"showInvalid": {},
|
|
315
|
+
"flow": {}
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
static get events() {
|
|
319
|
+
return [{
|
|
320
|
+
"method": "apiErrorEvent",
|
|
321
|
+
"name": "apiError",
|
|
322
|
+
"bubbles": true,
|
|
323
|
+
"cancelable": true,
|
|
324
|
+
"composed": true,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": ""
|
|
328
|
+
},
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "any",
|
|
331
|
+
"resolved": "any",
|
|
332
|
+
"references": {}
|
|
333
|
+
}
|
|
334
|
+
}];
|
|
335
|
+
}
|
|
336
|
+
static get listeners() {
|
|
337
|
+
return [{
|
|
338
|
+
"name": "howToInfoDone",
|
|
339
|
+
"method": "howToDone",
|
|
340
|
+
"target": undefined,
|
|
341
|
+
"capture": false,
|
|
342
|
+
"passive": false
|
|
343
|
+
}, {
|
|
344
|
+
"name": "timeElapsed",
|
|
345
|
+
"method": "timeElapsed",
|
|
346
|
+
"target": undefined,
|
|
347
|
+
"capture": false,
|
|
348
|
+
"passive": false
|
|
349
|
+
}, {
|
|
350
|
+
"name": "captureErrorDone",
|
|
351
|
+
"method": "captureErrorDone",
|
|
352
|
+
"target": undefined,
|
|
353
|
+
"capture": false,
|
|
354
|
+
"passive": false
|
|
355
|
+
}, {
|
|
356
|
+
"name": "photoIdCapture",
|
|
357
|
+
"method": "captureIdImage",
|
|
358
|
+
"target": undefined,
|
|
359
|
+
"capture": false,
|
|
360
|
+
"passive": false
|
|
361
|
+
}, {
|
|
362
|
+
"name": "photoIdBackCapture",
|
|
363
|
+
"method": "captureIdBackImage",
|
|
364
|
+
"target": undefined,
|
|
365
|
+
"capture": false,
|
|
366
|
+
"passive": false
|
|
367
|
+
}, {
|
|
368
|
+
"name": "recordingIdCapture",
|
|
369
|
+
"method": "capturedIdRecording",
|
|
370
|
+
"target": undefined,
|
|
371
|
+
"capture": false,
|
|
372
|
+
"passive": false
|
|
373
|
+
}];
|
|
374
|
+
}
|
|
375
|
+
}
|
|
@@ -261,11 +261,8 @@ export class IdentificationComponent {
|
|
|
261
261
|
if (store.flowStatus == FlowStatus.CODEERROR) {
|
|
262
262
|
currentBlock = h("sms-code-validation", null);
|
|
263
263
|
}
|
|
264
|
-
if (store.flowStatus == FlowStatus.ID
|
|
265
|
-
currentBlock = h("id
|
|
266
|
-
}
|
|
267
|
-
if (store.flowStatus == FlowStatus.ID && store.hasIdBack) {
|
|
268
|
-
currentBlock = h("id-double-side", { id: "idFront" });
|
|
264
|
+
if (store.flowStatus == FlowStatus.ID) {
|
|
265
|
+
currentBlock = h("process-id", null);
|
|
269
266
|
}
|
|
270
267
|
if (store.flowStatus == FlowStatus.LIVENESS) {
|
|
271
268
|
currentBlock = h("user-liveness", { id: "camera" });
|
|
@@ -46,7 +46,7 @@ export class Stream {
|
|
|
46
46
|
setVerificationFinished(fun) {
|
|
47
47
|
this.verificationFinished = fun;
|
|
48
48
|
}
|
|
49
|
-
constructor() {
|
|
49
|
+
constructor(mode) {
|
|
50
50
|
this.streamPaused = false;
|
|
51
51
|
this.recordedChunks = [];
|
|
52
52
|
this.videoSize = { width: 0, height: 0 };
|
|
@@ -59,10 +59,11 @@ export class Stream {
|
|
|
59
59
|
};
|
|
60
60
|
this.idML5Detector = IDML5Detector.getInstance(this, store.device.isMobile);
|
|
61
61
|
this.faceML5Detector = FaceML5Detector.getInstance(this, store.device.isMobile);
|
|
62
|
+
this.verificationMode = mode;
|
|
62
63
|
}
|
|
63
|
-
static getInstance() {
|
|
64
|
+
static getInstance(mode) {
|
|
64
65
|
if (!Stream.instance) {
|
|
65
|
-
Stream.instance = new Stream();
|
|
66
|
+
Stream.instance = new Stream(mode);
|
|
66
67
|
}
|
|
67
68
|
return Stream.instance;
|
|
68
69
|
}
|
|
@@ -134,10 +135,11 @@ export class Stream {
|
|
|
134
135
|
this.recordedChunks.push(event.data);
|
|
135
136
|
};
|
|
136
137
|
this.mediaRecorder.onstop = _e => {
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
var resp = {
|
|
139
|
+
RecordingChunks: this.recordedChunks,
|
|
140
|
+
MimeType: options.mimeType,
|
|
141
|
+
};
|
|
142
|
+
this.callbackRecordingReady(resp);
|
|
141
143
|
};
|
|
142
144
|
this.mediaRecorder.start(); // Start recording, and dump data every second
|
|
143
145
|
}
|
|
@@ -196,7 +198,7 @@ export class Stream {
|
|
|
196
198
|
async startIdDetection() {
|
|
197
199
|
if (this.streamPaused)
|
|
198
200
|
return;
|
|
199
|
-
this.idML5Detector.initDetector();
|
|
201
|
+
this.idML5Detector.initDetector(this.verificationMode);
|
|
200
202
|
}
|
|
201
203
|
async startFaceDetection() {
|
|
202
204
|
if (this.streamPaused)
|