@ekyc_qoobiss/qbs-ect-cmp 1.5.11
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/assets/animations/face/LookDown.gif +0 -0
- package/dist/assets/animations/face/LookLeft.gif +0 -0
- package/dist/assets/animations/face/LookRight.gif +0 -0
- package/dist/assets/animations/face/LookUp.gif +0 -0
- package/dist/assets/animations/face/TiltLeft.gif +0 -0
- package/dist/assets/animations/face/TiltRight.gif +0 -0
- package/dist/assets/animations/face/general.gif +0 -0
- package/dist/assets/animations/id/present-id.gif +0 -0
- package/dist/assets/animations/id/straighten-id.gif +0 -0
- package/dist/assets/animations/id/tilt-id.gif +0 -0
- package/dist/assets/buletin/metadata.json +1 -0
- package/dist/assets/buletin/model.json +1 -0
- package/dist/assets/buletin/weights.bin +0 -0
- package/dist/assets/buletin-v2/metadata.json +1 -0
- package/dist/assets/buletin-v2/model.json +1 -0
- package/dist/assets/buletin-v2/weights.bin +0 -0
- package/dist/assets/canvas-masks/face_green.svg +8 -0
- package/dist/assets/canvas-masks/face_white.svg +8 -0
- package/dist/assets/canvas-masks/id_green.svg +6 -0
- package/dist/assets/canvas-masks/id_white.svg +6 -0
- package/dist/assets/capture-error/idError.png +0 -0
- package/dist/assets/capture-error/idError.svg +8 -0
- package/dist/assets/capture-error/selfieError.png +0 -0
- package/dist/assets/capture-error/selfieError.svg +11 -0
- package/dist/assets/complete.svg +4 -0
- package/dist/assets/howtos/circle.svg +11 -0
- package/dist/assets/howtos/idscan.svg +293 -0
- package/dist/assets/howtos/liveness.svg +97 -0
- package/dist/assets/landing/device.svg +14 -0
- package/dist/assets/landing/id.svg +3 -0
- package/dist/assets/landing/info.svg +3 -0
- package/dist/assets/landing/validation.svg +16 -0
- package/dist/cjs/agreement-check_12.cjs.entry.js +6143 -0
- package/dist/cjs/index-9ebcada7.js +1487 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader-dots.cjs.entry.js +19 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/qbs-ect-cmp.cjs.js +19 -0
- package/dist/collection/assets/canvas-masks/face_green.svg +8 -0
- package/dist/collection/assets/canvas-masks/face_white.svg +8 -0
- package/dist/collection/assets/canvas-masks/id_green.svg +6 -0
- package/dist/collection/assets/canvas-masks/id_white.svg +6 -0
- package/dist/collection/assets/capture-error/idError.svg +8 -0
- package/dist/collection/assets/capture-error/selfieError.svg +11 -0
- package/dist/collection/assets/complete.svg +4 -0
- package/dist/collection/assets/howtos/circle.svg +11 -0
- package/dist/collection/assets/howtos/idscan.svg +293 -0
- package/dist/collection/assets/howtos/liveness.svg +97 -0
- package/dist/collection/assets/landing/device.svg +14 -0
- package/dist/collection/assets/landing/id.svg +3 -0
- package/dist/collection/assets/landing/info.svg +3 -0
- package/dist/collection/assets/landing/validation.svg +16 -0
- package/dist/collection/collection-manifest.json +24 -0
- package/dist/collection/components/agreement-check/agreement-check.css +0 -0
- package/dist/collection/components/agreement-check/agreement-check.js +75 -0
- package/dist/collection/components/agreement-info/agreement-info.css +0 -0
- package/dist/collection/components/agreement-info/agreement-info.js +72 -0
- package/dist/collection/components/capture-error/capture-error.css +0 -0
- package/dist/collection/components/capture-error/capture-error.js +107 -0
- package/dist/collection/components/controls/camera/camera.css +43 -0
- package/dist/collection/components/controls/camera/camera.js +306 -0
- package/dist/collection/components/controls/loader-dots/loader-dots.css +61 -0
- package/dist/collection/components/controls/loader-dots/loader-dots.js +18 -0
- package/dist/collection/components/end-redirect/end-redirect.css +128 -0
- package/dist/collection/components/end-redirect/end-redirect.js +25 -0
- package/dist/collection/components/how-to-info/how-to-info.css +0 -0
- package/dist/collection/components/how-to-info/how-to-info.js +105 -0
- package/dist/collection/components/id-back-capture/id-back-capture.css +35 -0
- package/dist/collection/components/id-back-capture/id-back-capture.js +201 -0
- package/dist/collection/components/id-capture/id-capture.css +35 -0
- package/dist/collection/components/id-capture/id-capture.js +201 -0
- package/dist/collection/components/identification-component/identification-component.css +999 -0
- package/dist/collection/components/identification-component/identification-component.js +397 -0
- package/dist/collection/components/landing-validation/landing-validation.css +0 -0
- package/dist/collection/components/landing-validation/landing-validation.js +78 -0
- package/dist/collection/components/selfie-capture/selfie-capture.css +22 -0
- package/dist/collection/components/selfie-capture/selfie-capture.js +198 -0
- package/dist/collection/components/sms-code-validation/sms-code-validation.css +0 -0
- package/dist/collection/components/sms-code-validation/sms-code-validation.js +91 -0
- package/dist/collection/global.js +0 -0
- package/dist/collection/helpers/ApiCall.js +153 -0
- package/dist/collection/helpers/Cameras.js +98 -0
- package/dist/collection/helpers/Events.js +79 -0
- package/dist/collection/helpers/ML5.js +20 -0
- package/dist/collection/helpers/Stream.js +223 -0
- package/dist/collection/helpers/canvas.js +10 -0
- package/dist/collection/helpers/index.js +54 -0
- package/dist/collection/helpers/security.js +25 -0
- package/dist/collection/helpers/store.js +15 -0
- package/dist/collection/helpers/textValues.js +82 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +206 -0
- package/dist/collection/libs/FaceML5Detector/FacePose.js +84 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +110 -0
- package/dist/collection/libs/IDML5Detector/IDPose.js +5 -0
- package/dist/collection/models/ICamera.js +1 -0
- package/dist/collection/models/IConstraints.js +1 -0
- package/dist/collection/models/IDevice.js +1 -0
- package/dist/collection/utils/utils.js +10 -0
- package/dist/esm/agreement-check_12.entry.js +6128 -0
- package/dist/esm/index-3fe6775c.js +1457 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader-dots.entry.js +15 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qbs-ect-cmp.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/qbs-ect-cmp/index.esm.js +0 -0
- package/dist/qbs-ect-cmp/p-3ef0bad2.entry.js +1373 -0
- package/dist/qbs-ect-cmp/p-3fa495e4.js +2 -0
- package/dist/qbs-ect-cmp/p-a69bb428.entry.js +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.css +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -0
- package/dist/types/components/agreement-check/agreement-check.d.ts +11 -0
- package/dist/types/components/agreement-info/agreement-info.d.ts +13 -0
- package/dist/types/components/capture-error/capture-error.d.ts +11 -0
- package/dist/types/components/controls/camera/camera.d.ts +33 -0
- package/dist/types/components/controls/loader-dots/loader-dots.d.ts +3 -0
- package/dist/types/components/end-redirect/end-redirect.d.ts +4 -0
- package/dist/types/components/how-to-info/how-to-info.d.ts +13 -0
- package/dist/types/components/id-back-capture/id-back-capture.d.ts +26 -0
- package/dist/types/components/id-capture/id-capture.d.ts +26 -0
- package/dist/types/components/identification-component/identification-component.d.ts +31 -0
- package/dist/types/components/landing-validation/landing-validation.d.ts +11 -0
- package/dist/types/components/selfie-capture/selfie-capture.d.ts +26 -0
- package/dist/types/components/sms-code-validation/sms-code-validation.d.ts +14 -0
- package/dist/types/components.d.ts +262 -0
- package/dist/types/global.d.ts +0 -0
- package/dist/types/helpers/ApiCall.d.ts +12 -0
- package/dist/types/helpers/Cameras.d.ts +8 -0
- package/dist/types/helpers/Events.d.ts +12 -0
- package/dist/types/helpers/ML5.d.ts +8 -0
- package/dist/types/helpers/Stream.d.ts +58 -0
- package/dist/types/helpers/canvas.d.ts +2 -0
- package/dist/types/helpers/index.d.ts +4 -0
- package/dist/types/helpers/security.d.ts +4 -0
- package/dist/types/helpers/store.d.ts +10 -0
- package/dist/types/helpers/textValues.d.ts +78 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +43 -0
- package/dist/types/libs/FaceML5Detector/FacePose.d.ts +37 -0
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +22 -0
- package/dist/types/libs/IDML5Detector/IDPose.d.ts +4 -0
- package/dist/types/models/ICamera.d.ts +10 -0
- package/dist/types/models/IConstraints.d.ts +21 -0
- package/dist/types/models/IDevice.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/package.json +51 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { initDevice } from '../../helpers';
|
|
3
|
+
import { SessionKeys } from '../../helpers/textValues';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import { ApiCall } from '../../helpers/ApiCall';
|
|
6
|
+
import store from '../../helpers/store';
|
|
7
|
+
import { ML5 } from '../../helpers/ML5';
|
|
8
|
+
export class IdentificationComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.selfieFlow = {
|
|
11
|
+
done: false,
|
|
12
|
+
photoFile: null,
|
|
13
|
+
recordingFile: null,
|
|
14
|
+
};
|
|
15
|
+
this.token = undefined;
|
|
16
|
+
this.order_id = undefined;
|
|
17
|
+
this.api_url = undefined;
|
|
18
|
+
this.idErrorType = '';
|
|
19
|
+
this.idSide = '';
|
|
20
|
+
this.idFlow = {
|
|
21
|
+
done: false,
|
|
22
|
+
photoFile: null,
|
|
23
|
+
recordingFile: null,
|
|
24
|
+
};
|
|
25
|
+
this.idBackFlow = {
|
|
26
|
+
done: false,
|
|
27
|
+
photoFile: null,
|
|
28
|
+
recordingFile: null,
|
|
29
|
+
};
|
|
30
|
+
ML5.getInstance();
|
|
31
|
+
this.device = initDevice();
|
|
32
|
+
this.apiCall = new ApiCall();
|
|
33
|
+
this.captureRetryCount = 0;
|
|
34
|
+
}
|
|
35
|
+
onTokenChange(newValue, _oldValue) {
|
|
36
|
+
if (store.token !== newValue) {
|
|
37
|
+
store.token = newValue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
onOrderIdChange(newValue, _oldValue) {
|
|
41
|
+
if (store.requestId !== newValue) {
|
|
42
|
+
store.requestId = newValue;
|
|
43
|
+
sessionStorage.setItem(SessionKeys.RequestIdKey, store.requestId);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
onApiUrlChange(newValue, _oldValue) {
|
|
47
|
+
if (store.apiBaseUrl !== newValue) {
|
|
48
|
+
store.apiBaseUrl = newValue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
agreementAcceptanceEmitted(data) {
|
|
52
|
+
this.apiCall.GenerateAgreement(data.detail.agreementType);
|
|
53
|
+
}
|
|
54
|
+
async captureIdBackImage(event) {
|
|
55
|
+
let idPhoto = event.detail;
|
|
56
|
+
this.idBackFlow.photoFile = new File([idPhoto], 'idBackImage.png', { type: 'image/png' });
|
|
57
|
+
await this.runIdBackFlow();
|
|
58
|
+
}
|
|
59
|
+
async captureIdImage(event) {
|
|
60
|
+
let idPhoto = event.detail;
|
|
61
|
+
this.idFlow.photoFile = new File([idPhoto], 'idImage.png', { type: 'image/png' });
|
|
62
|
+
await this.runIdFlow();
|
|
63
|
+
}
|
|
64
|
+
async capturedIdRecording(event) {
|
|
65
|
+
let idRecording = event.detail;
|
|
66
|
+
let mimeType = idRecording.type.split(';')[0];
|
|
67
|
+
let extension = mimeType.split('/')[1];
|
|
68
|
+
if (store.flowStatus == 'ID') {
|
|
69
|
+
this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + extension, { type: mimeType });
|
|
70
|
+
await this.runIdFlow();
|
|
71
|
+
}
|
|
72
|
+
if (store.flowStatus == 'IDBACK') {
|
|
73
|
+
this.idBackFlow.recordingFile = new File([idRecording], 'idBackVideo.' + extension, { type: mimeType });
|
|
74
|
+
await this.runIdBackFlow();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async runIdFlow() {
|
|
78
|
+
if (this.idFlow.photoFile == null || this.idFlow.recordingFile == null || this.idFlow.done) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let uploadedPhoto = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFront', this.idFlow.photoFile);
|
|
82
|
+
if (uploadedPhoto === false) {
|
|
83
|
+
this.idFlow.done = false;
|
|
84
|
+
this.idFlow.photoFile = null;
|
|
85
|
+
this.idFlow.recordingFile = null;
|
|
86
|
+
this.switchCamera();
|
|
87
|
+
store.flowStatus = 'IDERROR';
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let uploadedRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
|
|
91
|
+
this.idFlow.done = uploadedRecording;
|
|
92
|
+
if (uploadedRecording === true) {
|
|
93
|
+
if (store.hasIdBack) {
|
|
94
|
+
this.idSide = 'back';
|
|
95
|
+
store.flowStatus = 'HOWTOID';
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
store.flowStatus = 'HOWTOLIVENESS';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.idFlow.photoFile = null;
|
|
103
|
+
this.idFlow.recordingFile = null;
|
|
104
|
+
store.flowStatus = 'IDERROR';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async runIdBackFlow() {
|
|
108
|
+
if (this.idBackFlow.photoFile == null || this.idBackFlow.recordingFile == null || this.idBackFlow.done) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
let uploadedPhoto = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdBack', this.idBackFlow.photoFile);
|
|
112
|
+
if (uploadedPhoto === false) {
|
|
113
|
+
this.idBackFlow.done = false;
|
|
114
|
+
this.idBackFlow.photoFile = null;
|
|
115
|
+
this.idBackFlow.recordingFile = null;
|
|
116
|
+
this.switchCamera();
|
|
117
|
+
this.idErrorType = 'invalid';
|
|
118
|
+
store.flowStatus = 'IDERROR';
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let uploadedRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdBackVideo', this.idBackFlow.recordingFile);
|
|
122
|
+
this.idBackFlow.done = uploadedRecording;
|
|
123
|
+
if (uploadedRecording === true) {
|
|
124
|
+
store.flowStatus = 'HOWTOLIVENESS';
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.idBackFlow.photoFile = null;
|
|
128
|
+
this.idBackFlow.recordingFile = null;
|
|
129
|
+
store.flowStatus = 'IDERROR';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async captureSelfieImage(event) {
|
|
133
|
+
let selfiePhoto = event.detail;
|
|
134
|
+
this.selfieFlow.photoFile = new File([selfiePhoto], 'selfie.png', { type: 'image/png' });
|
|
135
|
+
await this.runSelfieFlow();
|
|
136
|
+
}
|
|
137
|
+
async capturedSelfieRecording(event) {
|
|
138
|
+
let selfieRecording = event.detail;
|
|
139
|
+
let mimeType = selfieRecording.type.split(';')[0];
|
|
140
|
+
let extension = mimeType.split('/')[1];
|
|
141
|
+
this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + extension, { type: mimeType });
|
|
142
|
+
await this.runSelfieFlow();
|
|
143
|
+
}
|
|
144
|
+
async runSelfieFlow() {
|
|
145
|
+
if (this.selfieFlow.photoFile == null || this.selfieFlow.recordingFile == null || this.selfieFlow.done) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let uploadPhoto = await this.apiCall.UploadFileForRequestB64(store.requestId, 'Selfie', this.selfieFlow.photoFile);
|
|
149
|
+
if (uploadPhoto === false) {
|
|
150
|
+
this.selfieFlow.done = false;
|
|
151
|
+
this.selfieFlow.photoFile = null;
|
|
152
|
+
this.selfieFlow.recordingFile = null;
|
|
153
|
+
store.flowStatus = 'LIVENESSERROR';
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
let uploadRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
|
|
157
|
+
this.selfieFlow.done = uploadRecording;
|
|
158
|
+
if (uploadRecording == true) {
|
|
159
|
+
store.flowStatus = 'COMPLETE';
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.selfieFlow.photoFile = null;
|
|
163
|
+
this.selfieFlow.recordingFile = null;
|
|
164
|
+
store.flowStatus = 'LIVENESSERROR';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
timeElapsed() {
|
|
168
|
+
this.idErrorType = 'timeout';
|
|
169
|
+
if (store.flowStatus == 'ID') {
|
|
170
|
+
this.switchCamera();
|
|
171
|
+
if (!this.idFlow.done) {
|
|
172
|
+
store.flowStatus = 'IDERROR';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (store.flowStatus == 'IDBACK') {
|
|
176
|
+
this.switchCamera();
|
|
177
|
+
if (!this.idBackFlow.done) {
|
|
178
|
+
store.flowStatus = 'IDERROR';
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (store.flowStatus == 'LIVENESS') {
|
|
182
|
+
if (!this.selfieFlow.done) {
|
|
183
|
+
store.flowStatus = 'LIVENESSERROR';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
switchCamera() {
|
|
188
|
+
if (this.captureRetryCount == 2) {
|
|
189
|
+
let camIndex = store.cameraIds.indexOf(store.cameraId);
|
|
190
|
+
store.cameraId = camIndex === store.cameraIds.length - 1 ? store.cameraIds[0] : store.cameraIds[camIndex + 1];
|
|
191
|
+
this.captureRetryCount = 0;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.captureRetryCount++;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
componentWillLoad() {
|
|
198
|
+
store.token = this.token;
|
|
199
|
+
store.apiBaseUrl = this.api_url;
|
|
200
|
+
}
|
|
201
|
+
componentWillRender() {
|
|
202
|
+
store.requestId = sessionStorage.getItem(SessionKeys.RequestIdKey);
|
|
203
|
+
if (!store.requestId) {
|
|
204
|
+
if (!this.order_id) {
|
|
205
|
+
this.order_id = uuidv4();
|
|
206
|
+
}
|
|
207
|
+
store.requestId = this.order_id;
|
|
208
|
+
sessionStorage.setItem(SessionKeys.RequestIdKey, store.requestId);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.order_id = store.requestId;
|
|
212
|
+
}
|
|
213
|
+
store.flowStatus = sessionStorage.getItem(SessionKeys.FlowStatusKey);
|
|
214
|
+
if (!store.flowStatus) {
|
|
215
|
+
store.flowStatus = 'LANDING';
|
|
216
|
+
sessionStorage.setItem(SessionKeys.FlowStatusKey, store.flowStatus);
|
|
217
|
+
}
|
|
218
|
+
if (this.idSide == '') {
|
|
219
|
+
this.idSide = store.hasIdBack ? 'face' : '';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
let currentBlock = h("div", null);
|
|
224
|
+
if (store.flowStatus == 'LANDING') {
|
|
225
|
+
currentBlock = h("landing-validation", { device: this.device });
|
|
226
|
+
}
|
|
227
|
+
if (store.flowStatus == 'AGREEMENT') {
|
|
228
|
+
currentBlock = h("agreement-info", null);
|
|
229
|
+
}
|
|
230
|
+
if (store.flowStatus == 'PHONE') {
|
|
231
|
+
currentBlock = h("sms-code-validation", null);
|
|
232
|
+
}
|
|
233
|
+
if (store.flowStatus == 'CODE') {
|
|
234
|
+
currentBlock = h("sms-code-validation", null);
|
|
235
|
+
}
|
|
236
|
+
if (store.flowStatus == 'CODEERROR') {
|
|
237
|
+
currentBlock = h("sms-code-validation", null);
|
|
238
|
+
}
|
|
239
|
+
if (store.flowStatus == 'HOWTOID') {
|
|
240
|
+
currentBlock = h("how-to-info", { idSide: this.idSide });
|
|
241
|
+
}
|
|
242
|
+
if (store.flowStatus == 'ID') {
|
|
243
|
+
currentBlock = h("id-capture", { id: "idFront", device: this.device });
|
|
244
|
+
}
|
|
245
|
+
if (store.flowStatus == 'IDBACK') {
|
|
246
|
+
currentBlock = h("id-back-capture", { id: "idBack", device: this.device });
|
|
247
|
+
}
|
|
248
|
+
if (store.flowStatus == 'IDERROR') {
|
|
249
|
+
currentBlock = h("capture-error", { idSide: this.idSide, type: this.idErrorType });
|
|
250
|
+
}
|
|
251
|
+
if (store.flowStatus == 'HOWTOLIVENESS') {
|
|
252
|
+
currentBlock = h("how-to-info", { idSide: "" });
|
|
253
|
+
}
|
|
254
|
+
if (store.flowStatus == 'LIVENESS') {
|
|
255
|
+
currentBlock = h("selfie-capture", { device: this.device, id: "camera" });
|
|
256
|
+
}
|
|
257
|
+
if (store.flowStatus == 'LIVENESSERROR') {
|
|
258
|
+
currentBlock = h("capture-error", null);
|
|
259
|
+
}
|
|
260
|
+
if (store.flowStatus == 'COMPLETE') {
|
|
261
|
+
currentBlock = h("end-redirect", null);
|
|
262
|
+
}
|
|
263
|
+
return h("div", null, currentBlock);
|
|
264
|
+
}
|
|
265
|
+
static get is() { return "identification-component"; }
|
|
266
|
+
static get encapsulation() { return "shadow"; }
|
|
267
|
+
static get originalStyleUrls() {
|
|
268
|
+
return {
|
|
269
|
+
"$": ["identification-component.css"]
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
static get styleUrls() {
|
|
273
|
+
return {
|
|
274
|
+
"$": ["identification-component.css"]
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
static get properties() {
|
|
278
|
+
return {
|
|
279
|
+
"token": {
|
|
280
|
+
"type": "string",
|
|
281
|
+
"mutable": false,
|
|
282
|
+
"complexType": {
|
|
283
|
+
"original": "string",
|
|
284
|
+
"resolved": "string",
|
|
285
|
+
"references": {}
|
|
286
|
+
},
|
|
287
|
+
"required": false,
|
|
288
|
+
"optional": false,
|
|
289
|
+
"docs": {
|
|
290
|
+
"tags": [],
|
|
291
|
+
"text": ""
|
|
292
|
+
},
|
|
293
|
+
"attribute": "token",
|
|
294
|
+
"reflect": false
|
|
295
|
+
},
|
|
296
|
+
"order_id": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"mutable": true,
|
|
299
|
+
"complexType": {
|
|
300
|
+
"original": "string",
|
|
301
|
+
"resolved": "string",
|
|
302
|
+
"references": {}
|
|
303
|
+
},
|
|
304
|
+
"required": false,
|
|
305
|
+
"optional": false,
|
|
306
|
+
"docs": {
|
|
307
|
+
"tags": [],
|
|
308
|
+
"text": ""
|
|
309
|
+
},
|
|
310
|
+
"attribute": "order_id",
|
|
311
|
+
"reflect": true
|
|
312
|
+
},
|
|
313
|
+
"api_url": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"mutable": false,
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "string",
|
|
318
|
+
"resolved": "string",
|
|
319
|
+
"references": {}
|
|
320
|
+
},
|
|
321
|
+
"required": false,
|
|
322
|
+
"optional": false,
|
|
323
|
+
"docs": {
|
|
324
|
+
"tags": [],
|
|
325
|
+
"text": ""
|
|
326
|
+
},
|
|
327
|
+
"attribute": "api_url",
|
|
328
|
+
"reflect": false
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
static get states() {
|
|
333
|
+
return {
|
|
334
|
+
"idErrorType": {},
|
|
335
|
+
"idSide": {},
|
|
336
|
+
"idFlow": {},
|
|
337
|
+
"idBackFlow": {}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
static get watchers() {
|
|
341
|
+
return [{
|
|
342
|
+
"propName": "token",
|
|
343
|
+
"methodName": "onTokenChange"
|
|
344
|
+
}, {
|
|
345
|
+
"propName": "order_id",
|
|
346
|
+
"methodName": "onOrderIdChange"
|
|
347
|
+
}, {
|
|
348
|
+
"propName": "api_url",
|
|
349
|
+
"methodName": "onApiUrlChange"
|
|
350
|
+
}];
|
|
351
|
+
}
|
|
352
|
+
static get listeners() {
|
|
353
|
+
return [{
|
|
354
|
+
"name": "agreementAcceptance",
|
|
355
|
+
"method": "agreementAcceptanceEmitted",
|
|
356
|
+
"target": undefined,
|
|
357
|
+
"capture": false,
|
|
358
|
+
"passive": false
|
|
359
|
+
}, {
|
|
360
|
+
"name": "photoIdBackCapture",
|
|
361
|
+
"method": "captureIdBackImage",
|
|
362
|
+
"target": undefined,
|
|
363
|
+
"capture": false,
|
|
364
|
+
"passive": false
|
|
365
|
+
}, {
|
|
366
|
+
"name": "photoIdCapture",
|
|
367
|
+
"method": "captureIdImage",
|
|
368
|
+
"target": undefined,
|
|
369
|
+
"capture": false,
|
|
370
|
+
"passive": false
|
|
371
|
+
}, {
|
|
372
|
+
"name": "recordingIdCapture",
|
|
373
|
+
"method": "capturedIdRecording",
|
|
374
|
+
"target": undefined,
|
|
375
|
+
"capture": false,
|
|
376
|
+
"passive": false
|
|
377
|
+
}, {
|
|
378
|
+
"name": "photoSelfieCapture",
|
|
379
|
+
"method": "captureSelfieImage",
|
|
380
|
+
"target": undefined,
|
|
381
|
+
"capture": false,
|
|
382
|
+
"passive": false
|
|
383
|
+
}, {
|
|
384
|
+
"name": "recordingSelfieCapture",
|
|
385
|
+
"method": "capturedSelfieRecording",
|
|
386
|
+
"target": undefined,
|
|
387
|
+
"capture": false,
|
|
388
|
+
"passive": false
|
|
389
|
+
}, {
|
|
390
|
+
"name": "timeElapsed",
|
|
391
|
+
"method": "timeElapsed",
|
|
392
|
+
"target": undefined,
|
|
393
|
+
"capture": false,
|
|
394
|
+
"passive": false
|
|
395
|
+
}];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { LandingValues } from '../../helpers/textValues';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import info from '../../assets/landing/info.svg';
|
|
5
|
+
import idSvg from '../../assets/landing/id.svg';
|
|
6
|
+
import idDevice from '../../assets/landing/device.svg';
|
|
7
|
+
import idValidation from '../../assets/landing/validation.svg';
|
|
8
|
+
import store from '../../helpers/store';
|
|
9
|
+
import { ApiCall } from '../../helpers/ApiCall';
|
|
10
|
+
export class LandingValidation {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.device = undefined;
|
|
13
|
+
this.saved = undefined;
|
|
14
|
+
this.warningText = undefined;
|
|
15
|
+
this.apiCall = new ApiCall();
|
|
16
|
+
}
|
|
17
|
+
async componentWillLoad() {
|
|
18
|
+
this.saved = await this.apiCall.AddIdentificationRequest(store.requestId, JSON.stringify(this.device));
|
|
19
|
+
if (!this.saved) {
|
|
20
|
+
this.saved = await this.apiCall.AddIdentificationRequest(store.requestId, JSON.stringify(this.device));
|
|
21
|
+
}
|
|
22
|
+
if (store.hasIdBack) {
|
|
23
|
+
this.warningText = LandingValues.WarningMd;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.warningText = LandingValues.Warning;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async startFlow() {
|
|
30
|
+
if (this.saved) {
|
|
31
|
+
store.flowStatus = 'AGREEMENT';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", null, LandingValues.Title), h("div", { class: "d-flex space-between align-center" }, h("p", { class: "main-text font-size-2" }, LandingValues.Description), h("div", { class: "img-info" }, h("div", { class: "i-effect" }), h("img", { src: info })))), h("div", { class: "info-container" }, h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idSvg })), h("h3", null, LandingValues.IdInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idDevice })), h("h3", null, LandingValues.DeviceInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idValidation })), h("h3", null, LandingValues.SmsInfo))), h("div", { class: "terms-container" }, h("h3", { class: "font-size-2 mb-1" }, this.warningText)), h("div", { class: "pos-relative" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.startFlow() }, LandingValues.Button), h("p", { class: "main-text font-size-18 text-right mb-0" }, LandingValues.FooterText))))));
|
|
36
|
+
}
|
|
37
|
+
static get is() { return "landing-validation"; }
|
|
38
|
+
static get originalStyleUrls() {
|
|
39
|
+
return {
|
|
40
|
+
"$": ["landing-validation.css"]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
static get styleUrls() {
|
|
44
|
+
return {
|
|
45
|
+
"$": ["landing-validation.css"]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static get properties() {
|
|
49
|
+
return {
|
|
50
|
+
"device": {
|
|
51
|
+
"type": "unknown",
|
|
52
|
+
"mutable": false,
|
|
53
|
+
"complexType": {
|
|
54
|
+
"original": "Device",
|
|
55
|
+
"resolved": "Device",
|
|
56
|
+
"references": {
|
|
57
|
+
"Device": {
|
|
58
|
+
"location": "import",
|
|
59
|
+
"path": "../../models/IDevice"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": false,
|
|
64
|
+
"optional": false,
|
|
65
|
+
"docs": {
|
|
66
|
+
"tags": [],
|
|
67
|
+
"text": ""
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
static get states() {
|
|
73
|
+
return {
|
|
74
|
+
"saved": {},
|
|
75
|
+
"warningText": {}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* .cameraContainer {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
z-index: 10;
|
|
5
|
+
position: relative;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
} */
|
|
8
|
+
|
|
9
|
+
.block {
|
|
10
|
+
width: 60%;
|
|
11
|
+
margin-left: 20%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.canvas-on-video {
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
max-height: 100%;
|
|
17
|
+
position: absolute;
|
|
18
|
+
left: 50%;
|
|
19
|
+
top: 50%;
|
|
20
|
+
z-index: 2;
|
|
21
|
+
transform: scale(-1, 1);
|
|
22
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { h, getAssetPath } from '@stencil/core';
|
|
2
|
+
import Events from '../../helpers/Events';
|
|
3
|
+
import { Cameras } from '../../helpers/Cameras';
|
|
4
|
+
import { Stream } from '../../helpers/Stream';
|
|
5
|
+
import { FacePose } from '../../libs/FaceML5Detector/FacePose';
|
|
6
|
+
import { SelfieCaptureValues } from '../../helpers/textValues';
|
|
7
|
+
import { FaceML5Detector } from '../../libs/FaceML5Detector/FaceML5Detector';
|
|
8
|
+
export class SelfieCapture {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.photoIsReady = photos => {
|
|
11
|
+
this.closeCamera();
|
|
12
|
+
this.eventPhotoCapture.emit(photos);
|
|
13
|
+
};
|
|
14
|
+
this.device = undefined;
|
|
15
|
+
this.videoStarted = undefined;
|
|
16
|
+
this.cameraSize = undefined;
|
|
17
|
+
this.stopAnimation = undefined;
|
|
18
|
+
this.captureTaken = undefined;
|
|
19
|
+
this.titleMesage = undefined;
|
|
20
|
+
this.animationPath = undefined;
|
|
21
|
+
this.captureTaken = false;
|
|
22
|
+
this.cameras = new Cameras();
|
|
23
|
+
}
|
|
24
|
+
eventChangeTitle(event) {
|
|
25
|
+
this.stopAnimation = false;
|
|
26
|
+
if (event.detail == null) {
|
|
27
|
+
this.animationPath = getAssetPath('../../assets/animations/face/general.gif');
|
|
28
|
+
this.titleMesage = SelfieCaptureValues.FinalTitle;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.animationPath = getAssetPath('../../assets/animations/face/' + FacePose[event.detail] + '.gif');
|
|
32
|
+
this.titleMesage = SelfieCaptureValues.FacePoseMapping[event.detail];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
eventVideoStarted(event) {
|
|
36
|
+
this.videoStarted = true;
|
|
37
|
+
this.cameraSize = event.detail;
|
|
38
|
+
}
|
|
39
|
+
eventStopAnimation() {
|
|
40
|
+
this.stopAnimation = true;
|
|
41
|
+
}
|
|
42
|
+
componentWillLoad() {
|
|
43
|
+
Events.init(this.component);
|
|
44
|
+
this.titleMesage = SelfieCaptureValues.Title;
|
|
45
|
+
if (!navigator.mediaDevices) {
|
|
46
|
+
Events.errorEvent('This browser does not support webRTC');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async componentDidLoad() {
|
|
50
|
+
this.openCamera();
|
|
51
|
+
this.animationPath = getAssetPath('../../assets/animations/face/general.gif');
|
|
52
|
+
}
|
|
53
|
+
async openCamera() {
|
|
54
|
+
const constraints = this.cameras.GetConstraints('', this.device, true);
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
navigator.mediaDevices
|
|
57
|
+
.getUserMedia(constraints)
|
|
58
|
+
.then(stream => {
|
|
59
|
+
const superStream = Stream.getInstance();
|
|
60
|
+
superStream.initStream(stream);
|
|
61
|
+
})
|
|
62
|
+
.catch(e => {
|
|
63
|
+
this.closeCamera();
|
|
64
|
+
Events.errorEvent(e);
|
|
65
|
+
});
|
|
66
|
+
}, 100);
|
|
67
|
+
}
|
|
68
|
+
closeCamera() {
|
|
69
|
+
if (Stream.instance) {
|
|
70
|
+
Events.closeEvent();
|
|
71
|
+
Stream.getInstance().dropStream();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
this.closeCamera();
|
|
76
|
+
Stream.instance = null;
|
|
77
|
+
FaceML5Detector.instance = null;
|
|
78
|
+
}
|
|
79
|
+
takePhoto() {
|
|
80
|
+
if (this.captureTaken)
|
|
81
|
+
return;
|
|
82
|
+
this.captureTaken = true;
|
|
83
|
+
this.titleMesage = SelfieCaptureValues.Loading;
|
|
84
|
+
Stream.getInstance()
|
|
85
|
+
.takePhoto()
|
|
86
|
+
.then(res => {
|
|
87
|
+
this.photoIsReady(res[0]);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
let loadingBlock;
|
|
92
|
+
if (this.captureTaken) {
|
|
93
|
+
loadingBlock = (h("div", { class: "pos-relative" }, h("div", { class: "dot-effect" }, h("div", { class: "snippet", "data-title": ".dot-shuttle" }, h("div", { class: "stage filter-contrast" }, h("div", { class: "dot-shuttle" }))))));
|
|
94
|
+
}
|
|
95
|
+
let animationBlock;
|
|
96
|
+
if (this.videoStarted && this.stopAnimation !== true) {
|
|
97
|
+
let left = 0;
|
|
98
|
+
if (this.cameraSize.width > this.cameraSize.height)
|
|
99
|
+
left = (this.cameraSize.width) / 2 - (this.cameraSize.height / 1.77 / 2);
|
|
100
|
+
animationBlock = (h("img", { class: "animation", style: { left: left + 'px' }, "data-src": this.animationPath, src: this.animationPath }));
|
|
101
|
+
}
|
|
102
|
+
let divClass = "chenar-buletin pos-relative";
|
|
103
|
+
if (this.videoStarted && this.cameraSize.width < this.cameraSize.height)
|
|
104
|
+
divClass += " block";
|
|
105
|
+
return (h("div", { class: "container bg-black" }, h("div", { class: "row ctheight-100" }, h("div", null, h("h1", { class: "color-white" }, this.titleMesage)), h("div", { hidden: this.captureTaken, class: divClass }, animationBlock, h("camera-comp", { device: this.device, "capture-mode": "selfie" })), loadingBlock, h("div", { class: "pos-relative" }, h("p", { class: "main-text font-size-18 text-right mb-0" }, SelfieCaptureValues.FooterText)))));
|
|
106
|
+
}
|
|
107
|
+
static get is() { return "selfie-capture"; }
|
|
108
|
+
static get originalStyleUrls() {
|
|
109
|
+
return {
|
|
110
|
+
"$": ["selfie-capture.css"]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static get styleUrls() {
|
|
114
|
+
return {
|
|
115
|
+
"$": ["selfie-capture.css"]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
static get properties() {
|
|
119
|
+
return {
|
|
120
|
+
"device": {
|
|
121
|
+
"type": "unknown",
|
|
122
|
+
"mutable": false,
|
|
123
|
+
"complexType": {
|
|
124
|
+
"original": "Device",
|
|
125
|
+
"resolved": "Device",
|
|
126
|
+
"references": {
|
|
127
|
+
"Device": {
|
|
128
|
+
"location": "import",
|
|
129
|
+
"path": "../../models/IDevice"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
static get states() {
|
|
143
|
+
return {
|
|
144
|
+
"videoStarted": {},
|
|
145
|
+
"cameraSize": {},
|
|
146
|
+
"stopAnimation": {},
|
|
147
|
+
"captureTaken": {},
|
|
148
|
+
"titleMesage": {},
|
|
149
|
+
"animationPath": {}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
static get events() {
|
|
153
|
+
return [{
|
|
154
|
+
"method": "eventPhotoCapture",
|
|
155
|
+
"name": "photoSelfieCapture",
|
|
156
|
+
"bubbles": true,
|
|
157
|
+
"cancelable": true,
|
|
158
|
+
"composed": true,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": ""
|
|
162
|
+
},
|
|
163
|
+
"complexType": {
|
|
164
|
+
"original": "any",
|
|
165
|
+
"resolved": "any",
|
|
166
|
+
"references": {}
|
|
167
|
+
}
|
|
168
|
+
}];
|
|
169
|
+
}
|
|
170
|
+
static get elementRef() { return "component"; }
|
|
171
|
+
static get listeners() {
|
|
172
|
+
return [{
|
|
173
|
+
"name": "changeTitle",
|
|
174
|
+
"method": "eventChangeTitle",
|
|
175
|
+
"target": undefined,
|
|
176
|
+
"capture": false,
|
|
177
|
+
"passive": false
|
|
178
|
+
}, {
|
|
179
|
+
"name": "videoStarted",
|
|
180
|
+
"method": "eventVideoStarted",
|
|
181
|
+
"target": undefined,
|
|
182
|
+
"capture": false,
|
|
183
|
+
"passive": false
|
|
184
|
+
}, {
|
|
185
|
+
"name": "stopAnimation",
|
|
186
|
+
"method": "eventStopAnimation",
|
|
187
|
+
"target": undefined,
|
|
188
|
+
"capture": false,
|
|
189
|
+
"passive": false
|
|
190
|
+
}, {
|
|
191
|
+
"name": "takePhoto",
|
|
192
|
+
"method": "takePhoto",
|
|
193
|
+
"target": undefined,
|
|
194
|
+
"capture": false,
|
|
195
|
+
"passive": false
|
|
196
|
+
}];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
File without changes
|