@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.
- package/dist/cjs/{Stream-3b222f7c.js → agreement-check_19.cjs.entry.js} +5197 -96
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -2
- package/dist/collection/components/common/capture-error/capture-error.js +6 -1
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +2 -4
- package/dist/collection/components/common/id-capture/id-capture.js +2 -4
- package/dist/collection/components/common/id-tilt/id-tilt.js +3 -5
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +3 -27
- package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +7 -0
- package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +212 -0
- package/dist/collection/components/flow/process-id/process-id.js +53 -91
- package/dist/collection/components/flow/user-liveness/user-liveness.js +88 -40
- package/dist/collection/helpers/Stream.js +5 -6
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +18 -15
- package/dist/collection/models/CaptureFlow.js +21 -9
- package/dist/collection/models/FlowSteps.js +3 -6
- package/dist/esm/{Stream-57643e4d.js → agreement-check_19.entry.js} +5132 -29
- package/dist/esm/{index-5d6f9123.js → index-9d69e511.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-aacd7024.js → p-06e42b28.js} +1 -1
- package/dist/qbs-ect-cmp/{p-7c33dd41.entry.js → p-4c8e922b.entry.js} +1 -1
- package/dist/qbs-ect-cmp/{p-ed7ad79f.js → p-a85dd6fc.entry.js} +26 -26
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/common/capture-error/capture-error.d.ts +3 -1
- package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +0 -1
- package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +30 -0
- package/dist/types/components/controls/camera/camera.d.ts +2 -3
- package/dist/types/components/flow/process-id/process-id.d.ts +0 -1
- package/dist/types/components/flow/user-liveness/user-liveness.d.ts +4 -4
- package/dist/types/components.d.ts +20 -37
- package/dist/types/helpers/Stream.d.ts +1 -2
- package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +3 -2
- package/dist/types/models/CaptureFlow.d.ts +15 -6
- package/dist/types/models/FlowSteps.d.ts +3 -6
- package/package.json +1 -1
- package/dist/cjs/agreement-check_18.cjs.entry.js +0 -5005
- package/dist/cjs/id-double-side.cjs.entry.js +0 -208
- package/dist/cjs/id-single-side.cjs.entry.js +0 -147
- package/dist/collection/components/flow/id-double-side/id-double-side.css +0 -0
- package/dist/collection/components/flow/id-double-side/id-double-side.js +0 -285
- package/dist/collection/components/flow/id-single-side/id-single-side.css +0 -0
- package/dist/collection/components/flow/id-single-side/id-single-side.js +0 -216
- package/dist/collection/models/IRecordingCallback.js +0 -1
- package/dist/esm/agreement-check_18.entry.js +0 -4984
- package/dist/esm/id-double-side.entry.js +0 -204
- package/dist/esm/id-single-side.entry.js +0 -143
- package/dist/qbs-ect-cmp/p-4934666e.entry.js +0 -1
- package/dist/qbs-ect-cmp/p-65eb59af.entry.js +0 -1
- package/dist/qbs-ect-cmp/p-878f427a.entry.js +0 -1
- package/dist/types/components/flow/id-double-side/id-double-side.d.ts +0 -29
- package/dist/types/components/flow/id-single-side/id-single-side.d.ts +0 -24
- package/dist/types/models/IRecordingCallback.d.ts +0 -4
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-79f82518.js');
|
|
6
|
-
const Stream = require('./Stream-3b222f7c.js');
|
|
7
|
-
|
|
8
|
-
const idDoubleSideCss = "";
|
|
9
|
-
|
|
10
|
-
const IdDoubleSide = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.apiErrorEvent = index.createEvent(this, "apiError", 7);
|
|
14
|
-
this.recordingResultCount = 0;
|
|
15
|
-
this.showTimeout = undefined;
|
|
16
|
-
this.showInvalid = undefined;
|
|
17
|
-
this.showHowTo = undefined;
|
|
18
|
-
this.front = undefined;
|
|
19
|
-
this.flow = {
|
|
20
|
-
photoDone: false,
|
|
21
|
-
recordingDone: false,
|
|
22
|
-
verificationFinished: false,
|
|
23
|
-
photoFile: null,
|
|
24
|
-
photoFileName: '',
|
|
25
|
-
photoUploadType: '',
|
|
26
|
-
recordingFile: null,
|
|
27
|
-
recordingFileName: '',
|
|
28
|
-
recordingUploadType: '',
|
|
29
|
-
};
|
|
30
|
-
this.baseComponent = new Stream.BaseComponent(Stream.FlowSteps.CiBack);
|
|
31
|
-
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
32
|
-
}
|
|
33
|
-
componentWillLoad() {
|
|
34
|
-
this.captureRetryCount = 0;
|
|
35
|
-
this.showHowTo = true;
|
|
36
|
-
this.flow.photoFileName = 'idImage.png';
|
|
37
|
-
this.flow.recordingFileName = 'idVideo.';
|
|
38
|
-
this.flow.photoUploadType = 'IdFront';
|
|
39
|
-
this.flow.recordingUploadType = 'IdFrontVideo';
|
|
40
|
-
this.front = true;
|
|
41
|
-
}
|
|
42
|
-
howToDone() {
|
|
43
|
-
this.showHowTo = false;
|
|
44
|
-
}
|
|
45
|
-
timeElapsed() {
|
|
46
|
-
this.showTimeout = true;
|
|
47
|
-
}
|
|
48
|
-
captureErrorDone() {
|
|
49
|
-
if (this.showTimeout == true) {
|
|
50
|
-
this.showTimeout = false;
|
|
51
|
-
}
|
|
52
|
-
if (this.showInvalid == true) {
|
|
53
|
-
this.flow.photoFileName = 'idImage.png';
|
|
54
|
-
this.flow.recordingFileName = 'idVideo.';
|
|
55
|
-
this.flow.photoUploadType = 'IdFront';
|
|
56
|
-
this.flow.recordingUploadType = 'IdFrontVideo';
|
|
57
|
-
this.flow.photoFile = null;
|
|
58
|
-
this.flow.recordingFile = null;
|
|
59
|
-
this.flow.photoDone = false;
|
|
60
|
-
this.flow.recordingDone = false;
|
|
61
|
-
this.front = true;
|
|
62
|
-
this.showInvalid = false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async captureIdImage(event) {
|
|
66
|
-
let idPhoto = event.detail;
|
|
67
|
-
if (idPhoto.size == 0) {
|
|
68
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, Stream.getLogMessage());
|
|
69
|
-
this.triggerErrorFlow();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
|
|
74
|
-
this.uploadPhoto();
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
this.apiErrorEvent.emit(e);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async captureIdBackImage(event) {
|
|
81
|
-
let idPhoto = event.detail;
|
|
82
|
-
if (idPhoto.size == 0) {
|
|
83
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, Stream.getLogMessage());
|
|
84
|
-
this.triggerErrorFlow();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
|
|
89
|
-
this.uploadPhoto();
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
this.apiErrorEvent.emit(e);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async capturedIdRecording(event) {
|
|
96
|
-
let idRecording = event.detail;
|
|
97
|
-
if (idRecording.size == 0 && this.recordingResultCount == 0) {
|
|
98
|
-
this.recordingResultCount++;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (idRecording.size == 0) {
|
|
102
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, Stream.getLogMessage());
|
|
103
|
-
this.triggerErrorFlow();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
this.recordingResultCount = 0;
|
|
107
|
-
let mimeType = idRecording.type == Stream.Stream.mp4MimeType.type ? Stream.Stream.mp4MimeType : Stream.Stream.webmMimeType;
|
|
108
|
-
try {
|
|
109
|
-
this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + mimeType.extension, { type: mimeType.type });
|
|
110
|
-
this.uploadRecording();
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
if (Stream.state.recordingRetryCount < 3) {
|
|
114
|
-
Stream.state.recordingRetryCount++;
|
|
115
|
-
this.triggerErrorFlow();
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.apiErrorEvent.emit(e);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async verificationFinished(_event) {
|
|
123
|
-
this.flow.verificationFinished = true;
|
|
124
|
-
await this.endFlow();
|
|
125
|
-
}
|
|
126
|
-
async componentDidLoad() {
|
|
127
|
-
await this.baseComponent.initialize();
|
|
128
|
-
}
|
|
129
|
-
async uploadPhoto() {
|
|
130
|
-
if (this.flow.photoFile == null || this.flow.photoDone) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.flow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(Stream.state.requestId, this.flow.photoUploadType, this.flow.photoFile);
|
|
134
|
-
if (this.flow.photoDone) {
|
|
135
|
-
await this.endFlow();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
this.switchCamera();
|
|
139
|
-
this.triggerErrorFlow();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async uploadRecording() {
|
|
143
|
-
if (this.flow.recordingFile == null || this.flow.recordingDone) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.flow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(Stream.state.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
|
|
147
|
-
if (this.flow.recordingDone) {
|
|
148
|
-
await this.endFlow();
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
this.triggerErrorFlow();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
triggerErrorFlow() {
|
|
155
|
-
this.flow.photoFile = null;
|
|
156
|
-
this.flow.recordingFile = null;
|
|
157
|
-
this.showInvalid = true;
|
|
158
|
-
}
|
|
159
|
-
async endFlow() {
|
|
160
|
-
if (!this.flow.photoDone) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (!this.flow.recordingDone) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (this.front) {
|
|
167
|
-
this.flow.photoFileName = 'idBackImage.png';
|
|
168
|
-
this.flow.recordingFileName = 'idBackVideo.';
|
|
169
|
-
this.flow.photoUploadType = 'IdBack';
|
|
170
|
-
this.flow.recordingUploadType = 'IdBackVideo';
|
|
171
|
-
this.flow.photoFile = null;
|
|
172
|
-
this.flow.recordingFile = null;
|
|
173
|
-
this.flow.photoDone = false;
|
|
174
|
-
this.flow.recordingDone = false;
|
|
175
|
-
this.front = false;
|
|
176
|
-
this.showHowTo = true;
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (!this.flow.verificationFinished) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
Stream.state.recordingRetryCount = 0;
|
|
183
|
-
Stream.state.flowStatus = Stream.FlowStatus.LIVENESS;
|
|
184
|
-
}
|
|
185
|
-
async disconnectedCallback() {
|
|
186
|
-
await this.baseComponent.finalize();
|
|
187
|
-
}
|
|
188
|
-
switchCamera() {
|
|
189
|
-
if (this.captureRetryCount == 1) {
|
|
190
|
-
let camIndex = Stream.state.cameraIds.indexOf(Stream.state.cameraId);
|
|
191
|
-
Stream.state.cameraId = camIndex === Stream.state.cameraIds.length - 1 ? Stream.state.cameraIds[0] : Stream.state.cameraIds[camIndex + 1];
|
|
192
|
-
this.captureRetryCount = 0;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
this.captureRetryCount++;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
render() {
|
|
199
|
-
let error = index.h("capture-error", { type: "ID" });
|
|
200
|
-
let frontCapture = index.h("id-capture", { id: "idFront" });
|
|
201
|
-
let secondCapture = index.h("id-back-capture", { id: "idBack" });
|
|
202
|
-
let howToInfo = index.h("how-to-info", { idSide: this.front ? 'front' : 'back' });
|
|
203
|
-
return this.showHowTo ? howToInfo : this.showInvalid || this.showTimeout ? error : this.front ? frontCapture : secondCapture;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
IdDoubleSide.style = idDoubleSideCss;
|
|
207
|
-
|
|
208
|
-
exports.id_double_side = IdDoubleSide;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-79f82518.js');
|
|
6
|
-
const Stream = require('./Stream-3b222f7c.js');
|
|
7
|
-
|
|
8
|
-
const idSingleSideCss = "";
|
|
9
|
-
|
|
10
|
-
const IdSingleSide = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.apiErrorEvent = index.createEvent(this, "apiError", 7);
|
|
14
|
-
this.recordingResultCount = 0;
|
|
15
|
-
this.showTimeout = undefined;
|
|
16
|
-
this.showHowTo = undefined;
|
|
17
|
-
this.idFlow = {
|
|
18
|
-
verificationFinished: false,
|
|
19
|
-
photoDone: false,
|
|
20
|
-
recordingDone: false,
|
|
21
|
-
photoFile: null,
|
|
22
|
-
recordingFile: null,
|
|
23
|
-
};
|
|
24
|
-
this.baseComponent = new Stream.BaseComponent(Stream.FlowSteps.CiFront);
|
|
25
|
-
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
26
|
-
this.captureRetryCount = 0;
|
|
27
|
-
this.showHowTo = true;
|
|
28
|
-
}
|
|
29
|
-
captureErrorDone() {
|
|
30
|
-
this.idFlow.photoFile = null;
|
|
31
|
-
this.idFlow.recordingFile = null;
|
|
32
|
-
this.showTimeout = false;
|
|
33
|
-
}
|
|
34
|
-
howToDone() {
|
|
35
|
-
this.showHowTo = false;
|
|
36
|
-
}
|
|
37
|
-
timeElapsed() {
|
|
38
|
-
this.showTimeout = true;
|
|
39
|
-
}
|
|
40
|
-
async captureIdImage(event) {
|
|
41
|
-
let idPhoto = event.detail;
|
|
42
|
-
if (idPhoto.size == 0) {
|
|
43
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, Stream.getLogMessage());
|
|
44
|
-
this.showTimeout = true;
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
this.idFlow.photoFile = new File([idPhoto], 'idImage.png', { type: 'image/png' });
|
|
49
|
-
await this.uploadPhoto();
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
this.apiErrorEvent.emit(e);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async verificationFinished(_event) {
|
|
56
|
-
this.idFlow.verificationFinished = true;
|
|
57
|
-
await this.endFlow();
|
|
58
|
-
}
|
|
59
|
-
async capturedIdRecording(event) {
|
|
60
|
-
let idRecording = event.detail;
|
|
61
|
-
if (idRecording.size == 0 && this.recordingResultCount == 0) {
|
|
62
|
-
this.recordingResultCount++;
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (idRecording.size == 0) {
|
|
66
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty ID recording', blobData: idRecording }, Stream.getLogMessage());
|
|
67
|
-
this.showTimeout = true;
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
let mimeType = idRecording.type == Stream.Stream.mp4MimeType.type ? Stream.Stream.mp4MimeType : Stream.Stream.webmMimeType;
|
|
71
|
-
if (Stream.state.flowStatus == Stream.FlowStatus.ID) {
|
|
72
|
-
try {
|
|
73
|
-
this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + mimeType.extension, { type: mimeType.type });
|
|
74
|
-
await this.uploadRecording();
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
this.apiErrorEvent.emit(e);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async componentDidLoad() {
|
|
82
|
-
await this.baseComponent.initialize();
|
|
83
|
-
}
|
|
84
|
-
async uploadPhoto() {
|
|
85
|
-
if (this.idFlow.photoFile == null || this.idFlow.photoDone) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
this.idFlow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(Stream.state.requestId, 'IdFront', this.idFlow.photoFile);
|
|
89
|
-
if (this.idFlow.photoDone) {
|
|
90
|
-
await this.endFlow();
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.idFlow.photoFile = null;
|
|
94
|
-
this.idFlow.recordingFile = null;
|
|
95
|
-
this.switchCamera();
|
|
96
|
-
this.showTimeout = true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async uploadRecording() {
|
|
100
|
-
if (this.idFlow.recordingFile == null || this.idFlow.recordingDone) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
this.idFlow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(Stream.state.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
|
|
104
|
-
if (this.idFlow.recordingDone) {
|
|
105
|
-
await this.endFlow();
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.idFlow.photoFile = null;
|
|
109
|
-
this.idFlow.recordingFile = null;
|
|
110
|
-
this.showTimeout = true;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async endFlow() {
|
|
114
|
-
if (!this.idFlow.photoDone) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (!this.idFlow.recordingDone) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (!this.idFlow.verificationFinished) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
Stream.state.flowStatus = Stream.FlowStatus.LIVENESS;
|
|
124
|
-
}
|
|
125
|
-
async disconnectedCallback() {
|
|
126
|
-
await this.baseComponent.finalize();
|
|
127
|
-
}
|
|
128
|
-
switchCamera() {
|
|
129
|
-
if (this.captureRetryCount == 1) {
|
|
130
|
-
let camIndex = Stream.state.cameraIds.indexOf(Stream.state.cameraId);
|
|
131
|
-
Stream.state.cameraId = camIndex === Stream.state.cameraIds.length - 1 ? Stream.state.cameraIds[0] : Stream.state.cameraIds[camIndex + 1];
|
|
132
|
-
this.captureRetryCount = 0;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.captureRetryCount++;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
render() {
|
|
139
|
-
let error = index.h("capture-error", { type: "ID" });
|
|
140
|
-
let capture = index.h("id-capture", { id: "idFront" });
|
|
141
|
-
let howToInfo = index.h("how-to-info", { idSide: "front" });
|
|
142
|
-
return this.showHowTo ? howToInfo : this.showTimeout ? error : capture;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
IdSingleSide.style = idSingleSideCss;
|
|
146
|
-
|
|
147
|
-
exports.id_single_side = IdSingleSide;
|
|
File without changes
|
|
@@ -1,285 +0,0 @@
|
|
|
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 { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
9
|
-
export class IdDoubleSide {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.recordingResultCount = 0;
|
|
12
|
-
this.showTimeout = undefined;
|
|
13
|
-
this.showInvalid = undefined;
|
|
14
|
-
this.showHowTo = undefined;
|
|
15
|
-
this.front = undefined;
|
|
16
|
-
this.flow = {
|
|
17
|
-
photoDone: false,
|
|
18
|
-
recordingDone: false,
|
|
19
|
-
verificationFinished: false,
|
|
20
|
-
photoFile: null,
|
|
21
|
-
photoFileName: '',
|
|
22
|
-
photoUploadType: '',
|
|
23
|
-
recordingFile: null,
|
|
24
|
-
recordingFileName: '',
|
|
25
|
-
recordingUploadType: '',
|
|
26
|
-
};
|
|
27
|
-
this.baseComponent = new BaseComponent(FlowSteps.CiBack);
|
|
28
|
-
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
29
|
-
}
|
|
30
|
-
componentWillLoad() {
|
|
31
|
-
this.captureRetryCount = 0;
|
|
32
|
-
this.showHowTo = true;
|
|
33
|
-
this.flow.photoFileName = 'idImage.png';
|
|
34
|
-
this.flow.recordingFileName = 'idVideo.';
|
|
35
|
-
this.flow.photoUploadType = 'IdFront';
|
|
36
|
-
this.flow.recordingUploadType = 'IdFrontVideo';
|
|
37
|
-
this.front = true;
|
|
38
|
-
}
|
|
39
|
-
howToDone() {
|
|
40
|
-
this.showHowTo = false;
|
|
41
|
-
}
|
|
42
|
-
timeElapsed() {
|
|
43
|
-
this.showTimeout = true;
|
|
44
|
-
}
|
|
45
|
-
captureErrorDone() {
|
|
46
|
-
if (this.showTimeout == true) {
|
|
47
|
-
this.showTimeout = false;
|
|
48
|
-
}
|
|
49
|
-
if (this.showInvalid == true) {
|
|
50
|
-
this.flow.photoFileName = 'idImage.png';
|
|
51
|
-
this.flow.recordingFileName = 'idVideo.';
|
|
52
|
-
this.flow.photoUploadType = 'IdFront';
|
|
53
|
-
this.flow.recordingUploadType = 'IdFrontVideo';
|
|
54
|
-
this.flow.photoFile = null;
|
|
55
|
-
this.flow.recordingFile = null;
|
|
56
|
-
this.flow.photoDone = false;
|
|
57
|
-
this.flow.recordingDone = false;
|
|
58
|
-
this.front = true;
|
|
59
|
-
this.showInvalid = false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async captureIdImage(event) {
|
|
63
|
-
let idPhoto = event.detail;
|
|
64
|
-
if (idPhoto.size == 0) {
|
|
65
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
66
|
-
this.triggerErrorFlow();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
|
|
71
|
-
this.uploadPhoto();
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
this.apiErrorEvent.emit(e);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async captureIdBackImage(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.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
|
|
86
|
-
this.uploadPhoto();
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
this.apiErrorEvent.emit(e);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async capturedIdRecording(event) {
|
|
93
|
-
let idRecording = event.detail;
|
|
94
|
-
if (idRecording.size == 0 && this.recordingResultCount == 0) {
|
|
95
|
-
this.recordingResultCount++;
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (idRecording.size == 0) {
|
|
99
|
-
await this.baseComponent.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
|
|
100
|
-
this.triggerErrorFlow();
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
this.recordingResultCount = 0;
|
|
104
|
-
let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
105
|
-
try {
|
|
106
|
-
this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + mimeType.extension, { type: mimeType.type });
|
|
107
|
-
this.uploadRecording();
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
if (store.recordingRetryCount < 3) {
|
|
111
|
-
store.recordingRetryCount++;
|
|
112
|
-
this.triggerErrorFlow();
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
this.apiErrorEvent.emit(e);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async verificationFinished(_event) {
|
|
120
|
-
this.flow.verificationFinished = true;
|
|
121
|
-
await this.endFlow();
|
|
122
|
-
}
|
|
123
|
-
async componentDidLoad() {
|
|
124
|
-
await this.baseComponent.initialize();
|
|
125
|
-
}
|
|
126
|
-
async uploadPhoto() {
|
|
127
|
-
if (this.flow.photoFile == null || this.flow.photoDone) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
this.flow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
|
|
131
|
-
if (this.flow.photoDone) {
|
|
132
|
-
await this.endFlow();
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.switchCamera();
|
|
136
|
-
this.triggerErrorFlow();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async uploadRecording() {
|
|
140
|
-
if (this.flow.recordingFile == null || this.flow.recordingDone) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
this.flow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
|
|
144
|
-
if (this.flow.recordingDone) {
|
|
145
|
-
await this.endFlow();
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
this.triggerErrorFlow();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
triggerErrorFlow() {
|
|
152
|
-
this.flow.photoFile = null;
|
|
153
|
-
this.flow.recordingFile = null;
|
|
154
|
-
this.showInvalid = true;
|
|
155
|
-
}
|
|
156
|
-
async endFlow() {
|
|
157
|
-
if (!this.flow.photoDone) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (!this.flow.recordingDone) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (this.front) {
|
|
164
|
-
this.flow.photoFileName = 'idBackImage.png';
|
|
165
|
-
this.flow.recordingFileName = 'idBackVideo.';
|
|
166
|
-
this.flow.photoUploadType = 'IdBack';
|
|
167
|
-
this.flow.recordingUploadType = 'IdBackVideo';
|
|
168
|
-
this.flow.photoFile = null;
|
|
169
|
-
this.flow.recordingFile = null;
|
|
170
|
-
this.flow.photoDone = false;
|
|
171
|
-
this.flow.recordingDone = false;
|
|
172
|
-
this.front = false;
|
|
173
|
-
this.showHowTo = true;
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (!this.flow.verificationFinished) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
store.recordingRetryCount = 0;
|
|
180
|
-
store.flowStatus = FlowStatus.LIVENESS;
|
|
181
|
-
}
|
|
182
|
-
async disconnectedCallback() {
|
|
183
|
-
await this.baseComponent.finalize();
|
|
184
|
-
}
|
|
185
|
-
switchCamera() {
|
|
186
|
-
if (this.captureRetryCount == 1) {
|
|
187
|
-
let camIndex = store.cameraIds.indexOf(store.cameraId);
|
|
188
|
-
store.cameraId = camIndex === store.cameraIds.length - 1 ? store.cameraIds[0] : store.cameraIds[camIndex + 1];
|
|
189
|
-
this.captureRetryCount = 0;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.captureRetryCount++;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
render() {
|
|
196
|
-
let error = h("capture-error", { type: "ID" });
|
|
197
|
-
let frontCapture = h("id-capture", { id: "idFront" });
|
|
198
|
-
let secondCapture = h("id-back-capture", { id: "idBack" });
|
|
199
|
-
let howToInfo = h("how-to-info", { idSide: this.front ? 'front' : 'back' });
|
|
200
|
-
return this.showHowTo ? howToInfo : this.showInvalid || this.showTimeout ? error : this.front ? frontCapture : secondCapture;
|
|
201
|
-
}
|
|
202
|
-
static get is() { return "id-double-side"; }
|
|
203
|
-
static get originalStyleUrls() {
|
|
204
|
-
return {
|
|
205
|
-
"$": ["id-double-side.css"]
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
static get styleUrls() {
|
|
209
|
-
return {
|
|
210
|
-
"$": ["id-double-side.css"]
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
static get states() {
|
|
214
|
-
return {
|
|
215
|
-
"showTimeout": {},
|
|
216
|
-
"showInvalid": {},
|
|
217
|
-
"showHowTo": {},
|
|
218
|
-
"front": {},
|
|
219
|
-
"flow": {}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
static get events() {
|
|
223
|
-
return [{
|
|
224
|
-
"method": "apiErrorEvent",
|
|
225
|
-
"name": "apiError",
|
|
226
|
-
"bubbles": true,
|
|
227
|
-
"cancelable": true,
|
|
228
|
-
"composed": true,
|
|
229
|
-
"docs": {
|
|
230
|
-
"tags": [],
|
|
231
|
-
"text": ""
|
|
232
|
-
},
|
|
233
|
-
"complexType": {
|
|
234
|
-
"original": "any",
|
|
235
|
-
"resolved": "any",
|
|
236
|
-
"references": {}
|
|
237
|
-
}
|
|
238
|
-
}];
|
|
239
|
-
}
|
|
240
|
-
static get listeners() {
|
|
241
|
-
return [{
|
|
242
|
-
"name": "howToInfoDone",
|
|
243
|
-
"method": "howToDone",
|
|
244
|
-
"target": undefined,
|
|
245
|
-
"capture": false,
|
|
246
|
-
"passive": false
|
|
247
|
-
}, {
|
|
248
|
-
"name": "timeElapsed",
|
|
249
|
-
"method": "timeElapsed",
|
|
250
|
-
"target": undefined,
|
|
251
|
-
"capture": false,
|
|
252
|
-
"passive": false
|
|
253
|
-
}, {
|
|
254
|
-
"name": "captureErrorDone",
|
|
255
|
-
"method": "captureErrorDone",
|
|
256
|
-
"target": undefined,
|
|
257
|
-
"capture": false,
|
|
258
|
-
"passive": false
|
|
259
|
-
}, {
|
|
260
|
-
"name": "photoIdCapture",
|
|
261
|
-
"method": "captureIdImage",
|
|
262
|
-
"target": undefined,
|
|
263
|
-
"capture": false,
|
|
264
|
-
"passive": false
|
|
265
|
-
}, {
|
|
266
|
-
"name": "photoIdBackCapture",
|
|
267
|
-
"method": "captureIdBackImage",
|
|
268
|
-
"target": undefined,
|
|
269
|
-
"capture": false,
|
|
270
|
-
"passive": false
|
|
271
|
-
}, {
|
|
272
|
-
"name": "recordingIdCapture",
|
|
273
|
-
"method": "capturedIdRecording",
|
|
274
|
-
"target": undefined,
|
|
275
|
-
"capture": false,
|
|
276
|
-
"passive": false
|
|
277
|
-
}, {
|
|
278
|
-
"name": "verificationFinished",
|
|
279
|
-
"method": "verificationFinished",
|
|
280
|
-
"target": undefined,
|
|
281
|
-
"capture": false,
|
|
282
|
-
"passive": false
|
|
283
|
-
}];
|
|
284
|
-
}
|
|
285
|
-
}
|
|
File without changes
|