@ekyc_qoobiss/qbs-ect-cmp 2.1.2 → 2.1.3
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/agreement-check_17.cjs.entry.js +137 -48
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
- package/dist/collection/components/common/agreement-check/agreement-check.js +6 -2
- package/dist/collection/components/common/capture-error/capture-error.js +29 -6
- package/dist/collection/components/common/how-to-info/how-to-info.js +6 -2
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +4 -4
- package/dist/collection/components/common/id-capture/id-capture.js +3 -3
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +3 -3
- package/dist/collection/components/flow/error-end/error-end.js +2 -1
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +3 -3
- package/dist/collection/components/identification-component/identification-component.css +3 -0
- package/dist/collection/components/identification-component/identification-component.js +2 -1
- package/dist/collection/helpers/ApiCall.js +2 -1
- package/dist/collection/helpers/textValues.js +8 -2
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +5 -7
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +4 -6
- package/dist/collection/utils/utils.js +1 -0
- package/dist/esm/agreement-check_17.entry.js +137 -48
- package/dist/esm/loader.js +1 -1
- package/dist/esm/qbs-ect-cmp.js +1 -1
- package/dist/qbs-ect-cmp/{p-1db86731.entry.js → p-d131bb84.entry.js} +2 -2
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/common/agreement-check/agreement-check.d.ts +1 -0
- package/dist/types/components/common/capture-error/capture-error.d.ts +8 -3
- package/dist/types/components/common/how-to-info/how-to-info.d.ts +1 -0
- 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/selfie-capture/selfie-capture.d.ts +0 -1
- package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +0 -1
- package/dist/types/helpers/ApiCall.d.ts +1 -1
- package/dist/types/helpers/textValues.d.ts +8 -2
- package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +0 -1
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { IdCaptureValues, SelfieCaptureValues } from '../../../helpers/textValues';
|
|
3
|
+
import { delay } from '../../../utils/utils';
|
|
3
4
|
export class CaptureError {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.type = undefined;
|
|
7
|
+
this.buttonEnabled = undefined;
|
|
8
|
+
this.buttonText = undefined;
|
|
6
9
|
}
|
|
7
|
-
componentWillRender() {
|
|
10
|
+
async componentWillRender() {
|
|
11
|
+
this.buttonEnabled = false;
|
|
8
12
|
if (this.type == 'ID') {
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
13
|
+
this.titleR1 = IdCaptureValues.ErrorTitleR1;
|
|
14
|
+
this.titleR2 = IdCaptureValues.ErrorTitleR2;
|
|
15
|
+
this.descriptionR1 = IdCaptureValues.ErrorR1;
|
|
16
|
+
this.descriptionR2 = IdCaptureValues.ErrorR2;
|
|
11
17
|
}
|
|
12
18
|
if (this.type == 'LIVENESS') {
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
19
|
+
this.titleR1 = SelfieCaptureValues.ErrorTitleR1;
|
|
20
|
+
this.titleR2 = SelfieCaptureValues.ErrorTitleR2;
|
|
21
|
+
this.descriptionR1 = SelfieCaptureValues.ErrorR1;
|
|
22
|
+
this.descriptionR2 = SelfieCaptureValues.ErrorR2;
|
|
15
23
|
}
|
|
16
24
|
}
|
|
25
|
+
async componentDidLoad() {
|
|
26
|
+
for (let i = 1; i <= 5; i++) {
|
|
27
|
+
this.buttonText = i.toString();
|
|
28
|
+
await delay(1000);
|
|
29
|
+
}
|
|
30
|
+
this.buttonText = IdCaptureValues.Button;
|
|
31
|
+
this.buttonEnabled = true;
|
|
32
|
+
}
|
|
17
33
|
buttonClick() {
|
|
34
|
+
this.buttonEnabled = false;
|
|
18
35
|
this.eventCaptureErrorDone.emit();
|
|
19
36
|
}
|
|
20
37
|
render() {
|
|
21
|
-
return (h("div", { class: "container" }, h("div", { class: "row" }, h("
|
|
38
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("h1", { class: "color-red" }, this.titleR1), h("h1", { class: "color-red" }, this.titleR2), h("div", null, h("p", { class: "color-red font-weight-bold font-size-3 mt-5" }, this.descriptionR1), h("p", { class: "color-red font-weight-bold font-size-3 mt-5" }, this.descriptionR2)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, IdCaptureValues.FooterText))))));
|
|
22
39
|
}
|
|
23
40
|
static get is() { return "capture-error"; }
|
|
24
41
|
static get originalStyleUrls() {
|
|
@@ -52,6 +69,12 @@ export class CaptureError {
|
|
|
52
69
|
}
|
|
53
70
|
};
|
|
54
71
|
}
|
|
72
|
+
static get states() {
|
|
73
|
+
return {
|
|
74
|
+
"buttonEnabled": {},
|
|
75
|
+
"buttonText": {}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
55
78
|
static get events() {
|
|
56
79
|
return [{
|
|
57
80
|
"method": "eventCaptureErrorDone",
|
|
@@ -9,12 +9,15 @@ export class HowToInfo {
|
|
|
9
9
|
this.subTitle = undefined;
|
|
10
10
|
this.imagePath = undefined;
|
|
11
11
|
this.buttonText = undefined;
|
|
12
|
+
this.buttonEnabled = undefined;
|
|
12
13
|
}
|
|
13
14
|
buttonClick() {
|
|
15
|
+
this.buttonEnabled = false;
|
|
14
16
|
this.eventHowToInfoDone.emit();
|
|
15
17
|
}
|
|
16
18
|
componentWillLoad() {
|
|
17
19
|
this.subTitle = '';
|
|
20
|
+
this.buttonEnabled = true;
|
|
18
21
|
if (store.flowStatus == FlowStatus.ID) {
|
|
19
22
|
this.topTitle = HowToValues.IdTitile;
|
|
20
23
|
this.imagePath = 'https://ekyc.blob.core.windows.net/$web/howto_id.png';
|
|
@@ -35,7 +38,7 @@ export class HowToInfo {
|
|
|
35
38
|
}
|
|
36
39
|
render() {
|
|
37
40
|
let sub = this.subTitle != '' ? h("p", { class: "font-size-2" }, this.subTitle) : null;
|
|
38
|
-
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "div-ci align-center" }, h("img", { src: this.imagePath })), h("div", { class: "text-center" }, h("h1", null, this.topTitle), sub), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, HowToValues.FooterText))))));
|
|
41
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "div-ci align-center" }, h("img", { src: this.imagePath })), h("div", { class: "text-center" }, h("h1", null, this.topTitle), sub), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, HowToValues.FooterText))))));
|
|
39
42
|
}
|
|
40
43
|
static get is() { return "how-to-info"; }
|
|
41
44
|
static get originalStyleUrls() {
|
|
@@ -74,7 +77,8 @@ export class HowToInfo {
|
|
|
74
77
|
"topTitle": {},
|
|
75
78
|
"subTitle": {},
|
|
76
79
|
"imagePath": {},
|
|
77
|
-
"buttonText": {}
|
|
80
|
+
"buttonText": {},
|
|
81
|
+
"buttonEnabled": {}
|
|
78
82
|
};
|
|
79
83
|
}
|
|
80
84
|
static get events() {
|
|
@@ -6,11 +6,11 @@ import { IdCaptureValues } from '../../../helpers/textValues';
|
|
|
6
6
|
import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
|
|
7
7
|
import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
|
|
8
8
|
import { IDPose } from '../../../libs/IDML5Detector/IDPose';
|
|
9
|
+
import { delay } from '../../../utils/utils';
|
|
9
10
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
10
11
|
export class IdBackCapture {
|
|
11
12
|
// @State() private animationPath: string;
|
|
12
13
|
constructor() {
|
|
13
|
-
this.delay = ms => new Promise(res => setTimeout(res, ms));
|
|
14
14
|
this.photoIsReady = photos => {
|
|
15
15
|
//this.closeCamera();
|
|
16
16
|
this.eventPhotoCapture.emit(photos);
|
|
@@ -33,7 +33,7 @@ export class IdBackCapture {
|
|
|
33
33
|
this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
|
|
34
34
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.BackTilted];
|
|
35
35
|
this.demoVideo.play();
|
|
36
|
-
await
|
|
36
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
37
37
|
this.showDemo = false;
|
|
38
38
|
}
|
|
39
39
|
eventVideoStarted(event) {
|
|
@@ -51,11 +51,11 @@ export class IdBackCapture {
|
|
|
51
51
|
this.titleMesage = IdCaptureValues.TtileRotate;
|
|
52
52
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Rotate];
|
|
53
53
|
this.demoVideo.play();
|
|
54
|
-
await
|
|
54
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
55
55
|
this.titleMesage = IdCaptureValues.TitleBack;
|
|
56
56
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.BackStraight];
|
|
57
57
|
this.demoVideo.play();
|
|
58
|
-
await
|
|
58
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
59
59
|
this.showDemo = false;
|
|
60
60
|
this.openCamera();
|
|
61
61
|
}
|
|
@@ -6,11 +6,11 @@ import { IdCaptureValues } from '../../../helpers/textValues';
|
|
|
6
6
|
import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
|
|
7
7
|
import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
|
|
8
8
|
import { IDPose } from '../../../libs/IDML5Detector/IDPose';
|
|
9
|
+
import { delay } from '../../../utils/utils';
|
|
9
10
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
10
11
|
export class IdCapture {
|
|
11
12
|
// @State() private animationPath: string;
|
|
12
13
|
constructor() {
|
|
13
|
-
this.delay = ms => new Promise(res => setTimeout(res, ms));
|
|
14
14
|
this.photoIsReady = photos => {
|
|
15
15
|
//this.closeCamera();
|
|
16
16
|
this.eventPhotoCapture.emit(photos);
|
|
@@ -33,7 +33,7 @@ export class IdCapture {
|
|
|
33
33
|
this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
|
|
34
34
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Tilted];
|
|
35
35
|
this.demoVideo.play();
|
|
36
|
-
await
|
|
36
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
37
37
|
this.showDemo = false;
|
|
38
38
|
}
|
|
39
39
|
eventVideoStarted(event) {
|
|
@@ -51,7 +51,7 @@ export class IdCapture {
|
|
|
51
51
|
async componentDidLoad() {
|
|
52
52
|
this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Straight];
|
|
53
53
|
this.demoVideo.play();
|
|
54
|
-
await
|
|
54
|
+
await delay(IdCaptureValues.VideoLenght);
|
|
55
55
|
this.showDemo = false;
|
|
56
56
|
this.openCamera();
|
|
57
57
|
}
|
|
@@ -5,10 +5,10 @@ import { Stream } from '../../../helpers/Stream';
|
|
|
5
5
|
import { SelfieCaptureValues } from '../../../helpers/textValues';
|
|
6
6
|
import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
|
|
7
7
|
import { FacePose } from '../../../libs/FaceML5Detector/FacePose';
|
|
8
|
+
import { delay } from '../../../utils/utils';
|
|
8
9
|
export class SelfieCapture {
|
|
9
10
|
// @State() private animationPath: string;
|
|
10
11
|
constructor() {
|
|
11
|
-
this.delay = ms => new Promise(res => setTimeout(res, ms));
|
|
12
12
|
this.photoIsReady = photos => {
|
|
13
13
|
//this.closeCamera();
|
|
14
14
|
this.eventPhotoCapture.emit(photos);
|
|
@@ -39,7 +39,7 @@ export class SelfieCapture {
|
|
|
39
39
|
this.demoEnded = false;
|
|
40
40
|
this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[event.detail];
|
|
41
41
|
this.demoVideo.play();
|
|
42
|
-
await
|
|
42
|
+
await delay(SelfieCaptureValues.VideoLenght);
|
|
43
43
|
this.demoEnded = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -61,7 +61,7 @@ export class SelfieCapture {
|
|
|
61
61
|
async componentDidLoad() {
|
|
62
62
|
this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[FacePose.Main];
|
|
63
63
|
this.demoVideo.play();
|
|
64
|
-
await
|
|
64
|
+
await delay(SelfieCaptureValues.VideoLenght);
|
|
65
65
|
this.demoEnded = true;
|
|
66
66
|
this.openCamera();
|
|
67
67
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import Events from '../../../helpers/Events';
|
|
3
|
+
import store from '../../../helpers/store';
|
|
3
4
|
export class ErrorEnd {
|
|
4
5
|
constructor() {
|
|
5
6
|
this.message = undefined;
|
|
@@ -10,7 +11,7 @@ export class ErrorEnd {
|
|
|
10
11
|
Events.flowError(this.errorTitle + ' ' + this.message);
|
|
11
12
|
}
|
|
12
13
|
render() {
|
|
13
|
-
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "text-center" }, h("h1", null, this.errorTitle)), h("div", null, h("p", { class: "color-red font-weight-bold font-size-2 text-center mt-10" }, this.message)))));
|
|
14
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "text-center" }, h("h1", null, this.errorTitle)), h("div", { class: "text-center" }, h("p", null, store.requestId)), h("div", null, h("p", { class: "color-red font-weight-bold font-size-2 text-center mt-10" }, this.message)))));
|
|
14
15
|
}
|
|
15
16
|
static get is() { return "error-end"; }
|
|
16
17
|
static get originalStyleUrls() {
|
|
@@ -7,9 +7,9 @@ import Events from '../../../helpers/Events';
|
|
|
7
7
|
import { OrderStatuses } from '../../../models/OrderStatuses';
|
|
8
8
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
9
9
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
10
|
+
import { delay } from '../../../utils/utils';
|
|
10
11
|
export class MobileRedirect {
|
|
11
12
|
constructor() {
|
|
12
|
-
this.delay = ms => new Promise(res => setTimeout(res, ms));
|
|
13
13
|
this.infoTextTop = undefined;
|
|
14
14
|
this.infoTextBottom = undefined;
|
|
15
15
|
this.contact = undefined;
|
|
@@ -50,11 +50,11 @@ export class MobileRedirect {
|
|
|
50
50
|
catch (e) {
|
|
51
51
|
this.apiErrorEvent.emit(e);
|
|
52
52
|
}
|
|
53
|
-
await
|
|
53
|
+
await delay(5000);
|
|
54
54
|
await this.checkStatus();
|
|
55
55
|
while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
|
|
56
56
|
await this.checkStatus();
|
|
57
|
-
await
|
|
57
|
+
await delay(5000);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
async checkStatus() {
|
|
@@ -7,6 +7,7 @@ import { ML5 } from '../../helpers/ML5';
|
|
|
7
7
|
import { FlowStatus } from '../../models/FlowStatus';
|
|
8
8
|
import Events from '../../helpers/Events';
|
|
9
9
|
import * as uuid from 'uuid';
|
|
10
|
+
import packageJson from '../../../package.json';
|
|
10
11
|
export class IdentificationComponent {
|
|
11
12
|
async onTokenChange(newValue, _oldValue) {
|
|
12
13
|
if (store.debug)
|
|
@@ -206,7 +207,7 @@ export class IdentificationComponent {
|
|
|
206
207
|
this.redirect_id = store.redirectId;
|
|
207
208
|
}
|
|
208
209
|
if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
|
|
209
|
-
store.initialised = await this.apiCall.AddIdentificationRequest(this.device);
|
|
210
|
+
store.initialised = await this.apiCall.AddIdentificationRequest(this.device, packageJson.version);
|
|
210
211
|
if (!this.order_id || this.order_id == '') {
|
|
211
212
|
this.order_id = store.requestId;
|
|
212
213
|
}
|
|
@@ -55,7 +55,7 @@ export class ApiCall {
|
|
|
55
55
|
let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
|
|
56
56
|
return jsonResp.valid;
|
|
57
57
|
}
|
|
58
|
-
async AddIdentificationRequest(deviceInfo) {
|
|
58
|
+
async AddIdentificationRequest(deviceInfo, version) {
|
|
59
59
|
if (store.debug)
|
|
60
60
|
console.log('Calling identity request with store:' + JSON.stringify(store));
|
|
61
61
|
let data = {
|
|
@@ -63,6 +63,7 @@ export class ApiCall {
|
|
|
63
63
|
clientDeviceInfo: JSON.stringify(deviceInfo),
|
|
64
64
|
redirectId: store.redirectId,
|
|
65
65
|
phoneNumber: store.phoneNumber,
|
|
66
|
+
version: version,
|
|
66
67
|
};
|
|
67
68
|
let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
|
|
68
69
|
if (store.requestId == '') {
|
|
@@ -56,7 +56,10 @@ IdCaptureValues.Button = 'Încerc din nou';
|
|
|
56
56
|
IdCaptureValues.Title = 'Încadrează actul de identitate în chenarul de pe ecran.';
|
|
57
57
|
IdCaptureValues.TitleBack = 'Încadrează spatele actului de identitate în chenarul de pe ecran.';
|
|
58
58
|
IdCaptureValues.TtileRotate = 'Întoarce actul de identitate.';
|
|
59
|
-
IdCaptureValues.
|
|
59
|
+
IdCaptureValues.ErrorTitleR1 = 'Nu am putut colecta informațiile din actul de identitate!';
|
|
60
|
+
IdCaptureValues.ErrorTitleR2 = 'Te rugăm să mai încerci o dată!';
|
|
61
|
+
IdCaptureValues.ErrorR1 = 'Încadrează actul de identitate în așa fel încât chenarul să se potrivească perfect pe colțurile actului de identitate. Trebuie să fie vizibilă întreaga suprafață a actului de identitate. ';
|
|
62
|
+
IdCaptureValues.ErrorR2 = 'Ai grijă să te afli într-o zonă cu suficientă lumină și să nu acoperi părți ale actului de identitate cu degetele. Ai grijă de asemenea să nu se formeze reflexii de lumină pe suprafața acestuia.';
|
|
60
63
|
IdCaptureValues.IDPoseMapping = {
|
|
61
64
|
0: '',
|
|
62
65
|
1: 'Înclină actul de identitate spre spate.',
|
|
@@ -76,7 +79,10 @@ export class SelfieCaptureValues extends GlobalValues {
|
|
|
76
79
|
}
|
|
77
80
|
SelfieCaptureValues.Title = 'Încadrează fața în chenarul de pe ecran.';
|
|
78
81
|
SelfieCaptureValues.FinalTitle = 'Îndreaptă capul și încadrează fața în chenarul de pe ecran.';
|
|
79
|
-
SelfieCaptureValues.
|
|
82
|
+
SelfieCaptureValues.ErrorTitleR1 = 'Procesul a eșuat!';
|
|
83
|
+
SelfieCaptureValues.ErrorTitleR2 = 'Te rugăm să mai încerci o dată!';
|
|
84
|
+
SelfieCaptureValues.ErrorR1 = 'Încadrează fața în așa fel încât chenarul să se suprapună peste linia bărbiei și a frunții, exact așa cum vezi în animația de pe ecran. ';
|
|
85
|
+
SelfieCaptureValues.ErrorR2 = 'Rămâi cu fața încadrată în chenar și execută gestul solicitat după ce animația cu explicația a dispărut de pe ecran.';
|
|
80
86
|
SelfieCaptureValues.Loading = 'Transferăm datele. Asteptați...';
|
|
81
87
|
SelfieCaptureValues.FacePoseMapping = {
|
|
82
88
|
0: 'Întoarce capul spre stânga.',
|
|
@@ -8,6 +8,7 @@ import face_white_svg from '../../assets/canvas-masks/face_white.svg';
|
|
|
8
8
|
import face_green_svg from '../../assets/canvas-masks/face_green.svg';
|
|
9
9
|
import { GlobalValues } from '../../helpers/textValues';
|
|
10
10
|
import store from '../../helpers/store';
|
|
11
|
+
import { delay } from '../../utils/utils';
|
|
11
12
|
export class FaceML5Detector {
|
|
12
13
|
static getInstance(stream, isMobile) {
|
|
13
14
|
if (!FaceML5Detector.instance) {
|
|
@@ -49,7 +50,7 @@ export class FaceML5Detector {
|
|
|
49
50
|
this.height = this.videoElement.videoHeight;
|
|
50
51
|
// this.videoRatio = getVideoRatio(this.videoElement);
|
|
51
52
|
this.drawFrame('white');
|
|
52
|
-
|
|
53
|
+
delay(2000).then(() => this.detectFaces());
|
|
53
54
|
}
|
|
54
55
|
detectFaces() {
|
|
55
56
|
if (this.validFaceFoundAgain) {
|
|
@@ -85,7 +86,7 @@ export class FaceML5Detector {
|
|
|
85
86
|
// this.frontFace = new FaceLandmarks(results[0], this.width, this.height);
|
|
86
87
|
await this.drawFrame('green');
|
|
87
88
|
this.requestedFacePose = this.stream.requestFacePose();
|
|
88
|
-
await
|
|
89
|
+
await delay(GlobalValues.VideoLenght);
|
|
89
90
|
}
|
|
90
91
|
else if (this.validFaceFound && !this.validFaceFoundAgain) {
|
|
91
92
|
await this.checkFacePose(results);
|
|
@@ -114,16 +115,13 @@ export class FaceML5Detector {
|
|
|
114
115
|
const centerShift_y = (canvas.height - img.height * ratio) / 2;
|
|
115
116
|
canvasContext.drawImage(img, 0, 0, img.width, img.height, centerShift_x + paddingX, centerShift_y + paddingY, img.width * ratio - paddingX * 2, img.height * ratio - paddingY * 2);
|
|
116
117
|
if (color != 'white' && !persistent) {
|
|
117
|
-
await
|
|
118
|
+
await delay(1000);
|
|
118
119
|
this.drawFrame('white');
|
|
119
120
|
}
|
|
120
121
|
resolve();
|
|
121
122
|
};
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
|
-
delay(time) {
|
|
125
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
|
126
|
-
}
|
|
127
125
|
isSingleFace(results) {
|
|
128
126
|
return results.length == this.MAX_NUMBER_FACES;
|
|
129
127
|
}
|
|
@@ -210,7 +208,7 @@ export class FaceML5Detector {
|
|
|
210
208
|
// //this.stream.changeFacePose();
|
|
211
209
|
// }
|
|
212
210
|
if (this.requestedFacePose) {
|
|
213
|
-
await
|
|
211
|
+
await delay(3000);
|
|
214
212
|
this.validFacePose = true;
|
|
215
213
|
this.validFaceFoundAgain = true;
|
|
216
214
|
await this.drawFrame('green', true);
|
|
@@ -5,6 +5,7 @@ import { GlobalValues } from '../../helpers/textValues';
|
|
|
5
5
|
import id_white_svg from '../../assets/canvas-masks/id_white.svg';
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import id_green_svg from '../../assets/canvas-masks/id_green.svg';
|
|
8
|
+
import { delay } from '../../utils/utils';
|
|
8
9
|
export class IDML5Detector {
|
|
9
10
|
static getInstance(stream, isMobile) {
|
|
10
11
|
if (!IDML5Detector.instance) {
|
|
@@ -32,7 +33,7 @@ export class IDML5Detector {
|
|
|
32
33
|
// this.width = this.videoElement.videoWidth;
|
|
33
34
|
// this.height = this.videoElement.videoHeight;
|
|
34
35
|
this.drawFrame('white');
|
|
35
|
-
|
|
36
|
+
delay(2000).then(() => this.classifyVideo());
|
|
36
37
|
}
|
|
37
38
|
classifyVideo() {
|
|
38
39
|
if (this.full == 1 && this.tilted == 1) {
|
|
@@ -61,7 +62,7 @@ export class IDML5Detector {
|
|
|
61
62
|
this.stream.autoCapturing();
|
|
62
63
|
await this.drawFrame('green');
|
|
63
64
|
this.stream.changeIDPose(IDPose.Tilted);
|
|
64
|
-
await
|
|
65
|
+
await delay(GlobalValues.VideoLenght);
|
|
65
66
|
}
|
|
66
67
|
if (results[0].label == 'tilted' && results[0].confidence > 0.8 && this.full == 1 && this.tilted == 0) {
|
|
67
68
|
this.tilted = 1;
|
|
@@ -88,14 +89,11 @@ export class IDML5Detector {
|
|
|
88
89
|
const centerShift_y = (canvas.height - img.height * ratio) / 2;
|
|
89
90
|
canvasContext.drawImage(img, 0, 0, img.width, img.height, centerShift_x + paddingX, centerShift_y + paddingY, img.width * ratio - paddingX * 2, img.height * ratio - paddingY * 2);
|
|
90
91
|
if (color != 'white' && !persistent) {
|
|
91
|
-
await
|
|
92
|
+
await delay(1000);
|
|
92
93
|
this.drawFrame('white');
|
|
93
94
|
}
|
|
94
95
|
resolve();
|
|
95
96
|
};
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
|
-
delay(time) {
|
|
99
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
|
100
|
-
}
|
|
101
99
|
}
|