@ekyc_qoobiss/qbs-ect-cmp 1.2.0
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 +49 -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/complete.svg +4 -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/assets/ml5-preload.png +0 -0
- package/dist/cjs/agreement-check_17.cjs.entry.js +9549 -0
- package/dist/cjs/index-79f82518.js +1568 -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 +22 -0
- package/dist/cjs/qbs-ect-cmp.cjs.js +23 -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/complete.svg +4 -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 +29 -0
- package/dist/collection/components/common/agreement-check/agreement-check.css +0 -0
- package/dist/collection/components/common/agreement-check/agreement-check.js +95 -0
- package/dist/collection/components/common/capture-error/capture-error.css +0 -0
- package/dist/collection/components/common/capture-error/capture-error.js +73 -0
- package/dist/collection/components/common/how-to-info/how-to-info.css +0 -0
- package/dist/collection/components/common/how-to-info/how-to-info.js +98 -0
- package/dist/collection/components/common/id-back-capture/id-back-capture.css +35 -0
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +212 -0
- package/dist/collection/components/common/id-capture/id-capture.css +35 -0
- package/dist/collection/components/common/id-capture/id-capture.js +213 -0
- package/dist/collection/components/common/selfie-capture/selfie-capture.css +7 -0
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +222 -0
- package/dist/collection/components/controls/camera/camera.css +47 -0
- package/dist/collection/components/controls/camera/camera.js +309 -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/flow/agreement-info/agreement-info.css +0 -0
- package/dist/collection/components/flow/agreement-info/agreement-info.js +73 -0
- package/dist/collection/components/flow/end-redirect/end-redirect.css +128 -0
- package/dist/collection/components/flow/end-redirect/end-redirect.js +26 -0
- package/dist/collection/components/flow/error-end/error-end.css +0 -0
- package/dist/collection/components/flow/error-end/error-end.js +64 -0
- 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 +284 -0
- 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 +225 -0
- package/dist/collection/components/flow/landing-validation/landing-validation.css +0 -0
- package/dist/collection/components/flow/landing-validation/landing-validation.js +88 -0
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +10 -0
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +128 -0
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.css +0 -0
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +115 -0
- package/dist/collection/components/flow/user-liveness/user-liveness.css +0 -0
- package/dist/collection/components/flow/user-liveness/user-liveness.js +214 -0
- package/dist/collection/components/identification-component/identification-component.css +1043 -0
- package/dist/collection/components/identification-component/identification-component.js +355 -0
- package/dist/collection/global.js +0 -0
- package/dist/collection/helpers/ApiCall.js +113 -0
- package/dist/collection/helpers/Cameras.js +98 -0
- package/dist/collection/helpers/Events.js +39 -0
- package/dist/collection/helpers/ML5.js +35 -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 +39 -0
- package/dist/collection/helpers/textValues.js +128 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +227 -0
- package/dist/collection/libs/FaceML5Detector/FacePose.js +85 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +101 -0
- package/dist/collection/libs/IDML5Detector/IDPose.js +8 -0
- package/dist/collection/models/FlowStatus.js +12 -0
- package/dist/collection/models/IAddRequest.js +1 -0
- package/dist/collection/models/IAgreement.js +1 -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/models/IGeneration.js +1 -0
- package/dist/collection/models/ILinkSend.js +1 -0
- package/dist/collection/models/ILogResult.js +1 -0
- package/dist/collection/models/IOrderStatus.js +1 -0
- package/dist/collection/models/IOtpCheck.js +1 -0
- package/dist/collection/models/IOtpSend.js +1 -0
- package/dist/collection/models/IUploadFile.js +1 -0
- package/dist/collection/models/OrderStatuses.js +7 -0
- package/dist/collection/utils/utils.js +10 -0
- package/dist/esm/agreement-check_17.entry.js +9529 -0
- package/dist/esm/index-9d69e511.js +1538 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader-dots.entry.js +15 -0
- package/dist/esm/loader.js +18 -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 +18 -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 +21 -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-06e42b28.js +2 -0
- package/dist/qbs-ect-cmp/p-4c8e922b.entry.js +1 -0
- package/dist/qbs-ect-cmp/p-b65cc797.entry.js +1373 -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/common/agreement-check/agreement-check.d.ts +12 -0
- package/dist/types/components/common/capture-error/capture-error.d.ts +10 -0
- package/dist/types/components/common/how-to-info/how-to-info.d.ts +12 -0
- package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +28 -0
- package/dist/types/components/common/id-capture/id-capture.d.ts +28 -0
- package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +30 -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/flow/agreement-info/agreement-info.d.ts +13 -0
- package/dist/types/components/flow/end-redirect/end-redirect.d.ts +4 -0
- package/dist/types/components/flow/error-end/error-end.d.ts +6 -0
- package/dist/types/components/flow/id-double-side/id-double-side.d.ts +27 -0
- package/dist/types/components/flow/id-single-side/id-single-side.d.ts +23 -0
- package/dist/types/components/flow/landing-validation/landing-validation.d.ts +10 -0
- package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +22 -0
- package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +16 -0
- package/dist/types/components/flow/user-liveness/user-liveness.d.ts +22 -0
- package/dist/types/components/identification-component/identification-component.d.ts +24 -0
- package/dist/types/components.d.ts +370 -0
- package/dist/types/global.d.ts +0 -0
- package/dist/types/helpers/ApiCall.d.ts +19 -0
- package/dist/types/helpers/Cameras.d.ts +8 -0
- package/dist/types/helpers/Events.d.ts +8 -0
- package/dist/types/helpers/ML5.d.ts +10 -0
- package/dist/types/helpers/Stream.d.ts +70 -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 +16 -0
- package/dist/types/helpers/textValues.d.ts +107 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +40 -0
- package/dist/types/libs/FaceML5Detector/FacePose.d.ts +36 -0
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +22 -0
- package/dist/types/libs/IDML5Detector/IDPose.d.ts +7 -0
- package/dist/types/models/FlowStatus.d.ts +11 -0
- package/dist/types/models/IAddRequest.d.ts +6 -0
- package/dist/types/models/IAgreement.d.ts +3 -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/models/IGeneration.d.ts +3 -0
- package/dist/types/models/ILinkSend.d.ts +3 -0
- package/dist/types/models/ILogResult.d.ts +3 -0
- package/dist/types/models/IOrderStatus.d.ts +4 -0
- package/dist/types/models/IOtpCheck.d.ts +3 -0
- package/dist/types/models/IOtpSend.d.ts +3 -0
- package/dist/types/models/IUploadFile.d.ts +4 -0
- package/dist/types/models/OrderStatuses.d.ts +6 -0
- package/dist/types/stencil-public-runtime.d.ts +1637 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/package.json +52 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { MobileRedirectValues } from '../../../helpers/textValues';
|
|
3
|
+
import QRCode from 'qrcode';
|
|
4
|
+
import store from '../../../helpers/store';
|
|
5
|
+
import { ApiCall } from '../../../helpers/ApiCall';
|
|
6
|
+
import { OrderStatuses } from '../../../models/OrderStatuses';
|
|
7
|
+
import { FlowStatus } from '../../../models/FlowStatus';
|
|
8
|
+
export class MobileRedirect {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.delay = ms => new Promise(res => setTimeout(res, ms));
|
|
11
|
+
this.infoTextTop = undefined;
|
|
12
|
+
this.infoTextBottom = undefined;
|
|
13
|
+
this.contact = undefined;
|
|
14
|
+
this.invalidValue = undefined;
|
|
15
|
+
this.waitingMobile = undefined;
|
|
16
|
+
this.orderStatus = undefined;
|
|
17
|
+
this.redirectLink = undefined;
|
|
18
|
+
this.qrCode = undefined;
|
|
19
|
+
this.apiCall = new ApiCall();
|
|
20
|
+
this.invalidValue = false;
|
|
21
|
+
this.waitingMobile = false;
|
|
22
|
+
}
|
|
23
|
+
async componentWillLoad() {
|
|
24
|
+
this.infoTextTop = MobileRedirectValues.InfoTop;
|
|
25
|
+
this.infoTextBottom = MobileRedirectValues.InfoBottom;
|
|
26
|
+
let envUri = store.environment == 'PROD' ? 'ect' : 'test';
|
|
27
|
+
let baseUri = store.hasIdBack ? 'https://onmd.id-kyc.com/' : 'https://onro.id-kyc.com/';
|
|
28
|
+
this.redirectLink = baseUri + envUri + '?redirectId=' + store.redirectId;
|
|
29
|
+
var self = this;
|
|
30
|
+
QRCode.toDataURL(this.redirectLink, { type: 'image/png', errorCorrectionLevel: 'M', scale: 6 }, function (error, url) {
|
|
31
|
+
if (error)
|
|
32
|
+
console.error(error);
|
|
33
|
+
self.qrCode = url;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
componentWillRender() { }
|
|
37
|
+
async componentDidLoad() {
|
|
38
|
+
await this.delay(5000);
|
|
39
|
+
await this.checkStatus();
|
|
40
|
+
while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
|
|
41
|
+
await this.checkStatus();
|
|
42
|
+
await this.delay(5000);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async checkStatus() {
|
|
46
|
+
this.orderStatus = await this.apiCall.GetStatus(store.requestId);
|
|
47
|
+
if (this.orderStatus == OrderStatuses.FinishedCapturing) {
|
|
48
|
+
this.waitingMobile = false;
|
|
49
|
+
store.flowStatus = FlowStatus.COMPLETE;
|
|
50
|
+
}
|
|
51
|
+
if (this.orderStatus == OrderStatuses.NotFound) {
|
|
52
|
+
this.apiErrorEvent.emit({ message: 'No order was started for this process.' });
|
|
53
|
+
}
|
|
54
|
+
if (this.orderStatus == OrderStatuses.Capturing) {
|
|
55
|
+
this.infoTextTop = MobileRedirectValues.InfoWaiting;
|
|
56
|
+
this.waitingMobile = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async buttonClick() {
|
|
60
|
+
if (this.contact == '' || this.contact.length != 10) {
|
|
61
|
+
this.invalidValue == true;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.waitingMobile = true;
|
|
65
|
+
this.infoTextTop = MobileRedirectValues.InfoWaiting;
|
|
66
|
+
try {
|
|
67
|
+
await this.apiCall.SendLink(this.redirectLink, this.contact);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
this.apiErrorEvent.emit(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
handleChangeContact(ev) {
|
|
74
|
+
let value = ev.target ? ev.target.value : '';
|
|
75
|
+
this.contact = value.replace(/\D/g, '');
|
|
76
|
+
if (this.contact.length > 10) {
|
|
77
|
+
this.contact = this.contact.substring(0, 10);
|
|
78
|
+
}
|
|
79
|
+
else if (this.contact.length == 10) {
|
|
80
|
+
this.invalidValue = false;
|
|
81
|
+
}
|
|
82
|
+
ev.target.value = this.contact;
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { hidden: this.waitingMobile }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop)), h("div", { class: "qr-canvas align-center" }, h("img", { src: this.qrCode })), h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextBottom)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1 color-red", hidden: this.invalidValue == false }, h("b", null, MobileRedirectValues.Validation)), h("input", { type: "text", id: "codeInput", class: "main-input", value: this.contact, onInput: ev => this.handleChangeContact(ev) })), h("div", { class: "pos-relative" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, "Trimite"), h("p", { class: "main-text font-size-18 text-right mb-0" }, MobileRedirectValues.FooterText)))), h("div", { hidden: this.waitingMobile == false }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop))))));
|
|
86
|
+
}
|
|
87
|
+
static get is() { return "mobile-redirect"; }
|
|
88
|
+
static get originalStyleUrls() {
|
|
89
|
+
return {
|
|
90
|
+
"$": ["mobile-redirect.css"]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static get styleUrls() {
|
|
94
|
+
return {
|
|
95
|
+
"$": ["mobile-redirect.css"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get states() {
|
|
99
|
+
return {
|
|
100
|
+
"infoTextTop": {},
|
|
101
|
+
"infoTextBottom": {},
|
|
102
|
+
"contact": {},
|
|
103
|
+
"invalidValue": {},
|
|
104
|
+
"waitingMobile": {},
|
|
105
|
+
"orderStatus": {},
|
|
106
|
+
"redirectLink": {},
|
|
107
|
+
"qrCode": {}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static get events() {
|
|
111
|
+
return [{
|
|
112
|
+
"method": "apiErrorEvent",
|
|
113
|
+
"name": "apiError",
|
|
114
|
+
"bubbles": true,
|
|
115
|
+
"cancelable": true,
|
|
116
|
+
"composed": true,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": ""
|
|
120
|
+
},
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "any",
|
|
123
|
+
"resolved": "any",
|
|
124
|
+
"references": {}
|
|
125
|
+
}
|
|
126
|
+
}];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
|
+
import store from '../../../helpers/store';
|
|
4
|
+
import { PhoneValidationValues, CodeValidationValues } from '../../../helpers/textValues';
|
|
5
|
+
import { FlowStatus } from '../../../models/FlowStatus';
|
|
6
|
+
export class SmsCodeValidation {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.title = undefined;
|
|
9
|
+
this.details = undefined;
|
|
10
|
+
this.buttonText = undefined;
|
|
11
|
+
this.phoneNumber = undefined;
|
|
12
|
+
this.code = undefined;
|
|
13
|
+
this.apiCall = new ApiCall();
|
|
14
|
+
}
|
|
15
|
+
async doAction() {
|
|
16
|
+
try {
|
|
17
|
+
if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
|
|
18
|
+
var codeChecked = await this.apiCall.CheckOTPCode(store.requestId, this.code);
|
|
19
|
+
if (codeChecked === true) {
|
|
20
|
+
store.flowStatus = FlowStatus.ID;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
store.flowStatus = FlowStatus.CODEERROR;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (store.flowStatus == FlowStatus.PHONE) {
|
|
27
|
+
var codeSent = await this.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
|
|
28
|
+
if (codeSent === true) {
|
|
29
|
+
store.flowStatus = FlowStatus.CODE;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
this.apiErrorEvent.emit(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
componentWillRender() {
|
|
38
|
+
if (store.flowStatus == FlowStatus.PHONE) {
|
|
39
|
+
this.title = PhoneValidationValues.Title;
|
|
40
|
+
this.details = PhoneValidationValues.Description;
|
|
41
|
+
this.buttonText = PhoneValidationValues.Button;
|
|
42
|
+
}
|
|
43
|
+
if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
|
|
44
|
+
this.title = CodeValidationValues.Title;
|
|
45
|
+
this.details = CodeValidationValues.Description;
|
|
46
|
+
this.buttonText = CodeValidationValues.Button;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
handleChangePhone(ev) {
|
|
50
|
+
let value = ev.target ? ev.target.value : '';
|
|
51
|
+
this.phoneNumber = value.replace(/\D/g, '');
|
|
52
|
+
if (this.phoneNumber.length > 10)
|
|
53
|
+
this.phoneNumber = this.phoneNumber.substring(0, 10);
|
|
54
|
+
ev.target.value = this.phoneNumber;
|
|
55
|
+
}
|
|
56
|
+
handleChangeCode(ev) {
|
|
57
|
+
let value = ev.target ? ev.target.value : '';
|
|
58
|
+
this.code = value;
|
|
59
|
+
if (this.code.length > 4)
|
|
60
|
+
this.code = this.code.substring(0, 4);
|
|
61
|
+
ev.target.value = this.code;
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
let inputBlock;
|
|
65
|
+
let errorBlock;
|
|
66
|
+
if (store.flowStatus == FlowStatus.CODEERROR) {
|
|
67
|
+
errorBlock = h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, CodeValidationValues.Error);
|
|
68
|
+
}
|
|
69
|
+
if (store.flowStatus == FlowStatus.PHONE) {
|
|
70
|
+
inputBlock = (h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
inputBlock = (h("div", { class: "input-container mb-15" }, h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })));
|
|
74
|
+
}
|
|
75
|
+
return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), errorBlock == null ? h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), inputBlock, h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, PhoneValidationValues.FooterText))))));
|
|
76
|
+
}
|
|
77
|
+
static get is() { return "sms-code-validation"; }
|
|
78
|
+
static get originalStyleUrls() {
|
|
79
|
+
return {
|
|
80
|
+
"$": ["sms-code-validation.css"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static get styleUrls() {
|
|
84
|
+
return {
|
|
85
|
+
"$": ["sms-code-validation.css"]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
static get states() {
|
|
89
|
+
return {
|
|
90
|
+
"title": {},
|
|
91
|
+
"details": {},
|
|
92
|
+
"buttonText": {},
|
|
93
|
+
"phoneNumber": {},
|
|
94
|
+
"code": {}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
static get events() {
|
|
98
|
+
return [{
|
|
99
|
+
"method": "apiErrorEvent",
|
|
100
|
+
"name": "apiError",
|
|
101
|
+
"bubbles": true,
|
|
102
|
+
"cancelable": true,
|
|
103
|
+
"composed": true,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "any",
|
|
110
|
+
"resolved": "any",
|
|
111
|
+
"references": {}
|
|
112
|
+
}
|
|
113
|
+
}];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
|
+
import store from '../../../helpers/store';
|
|
4
|
+
import { Stream } from '../../../helpers/Stream';
|
|
5
|
+
import { FlowStatus } from '../../../models/FlowStatus';
|
|
6
|
+
export class UserLiveness {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.device = undefined;
|
|
9
|
+
this.showError = undefined;
|
|
10
|
+
this.showHowTo = undefined;
|
|
11
|
+
this.selfieFlow = {
|
|
12
|
+
photoDone: false,
|
|
13
|
+
recordingDone: false,
|
|
14
|
+
verificationFinished: false,
|
|
15
|
+
photoFile: null,
|
|
16
|
+
recordingFile: null,
|
|
17
|
+
};
|
|
18
|
+
this.apiCall = new ApiCall();
|
|
19
|
+
}
|
|
20
|
+
componentWillLoad() {
|
|
21
|
+
this.showHowTo = true;
|
|
22
|
+
}
|
|
23
|
+
howToDone() {
|
|
24
|
+
this.showHowTo = false;
|
|
25
|
+
}
|
|
26
|
+
timeElapsed() {
|
|
27
|
+
this.showError = true;
|
|
28
|
+
}
|
|
29
|
+
captureErrorDone() {
|
|
30
|
+
this.showError = false;
|
|
31
|
+
this.selfieFlow.photoDone = false;
|
|
32
|
+
this.selfieFlow.recordingDone = false;
|
|
33
|
+
this.selfieFlow.photoFile = null;
|
|
34
|
+
this.selfieFlow.recordingFile = null;
|
|
35
|
+
}
|
|
36
|
+
async captureSelfieImage(event) {
|
|
37
|
+
let selfiePhoto = event.detail;
|
|
38
|
+
if (selfiePhoto.length == 0 || selfiePhoto.size == 0) {
|
|
39
|
+
await this.apiCall.AddLog({ message: 'Empty selfie', blobData: selfiePhoto });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
this.selfieFlow.photoFile = new File([selfiePhoto], 'selfie.png', { type: 'image/png' });
|
|
44
|
+
await this.uploadPhoto();
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
this.apiErrorEvent.emit(e);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async capturedSelfieRecording(event) {
|
|
51
|
+
let selfieRecording = event.detail;
|
|
52
|
+
if (selfieRecording.length == 0 || selfieRecording.size == 0) {
|
|
53
|
+
await this.apiCall.AddLog({ message: 'Empty recording', blobData: selfieRecording });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
57
|
+
try {
|
|
58
|
+
this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + mimeType.extension, { type: mimeType.type });
|
|
59
|
+
await this.uploadRecording();
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
this.apiErrorEvent.emit(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async verificationFinished(_event) {
|
|
66
|
+
this.selfieFlow.verificationFinished = true;
|
|
67
|
+
this.endFlow();
|
|
68
|
+
}
|
|
69
|
+
async uploadPhoto() {
|
|
70
|
+
if (this.selfieFlow.photoFile == null || this.selfieFlow.photoDone) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.selfieFlow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'Selfie', this.selfieFlow.photoFile);
|
|
74
|
+
if (this.selfieFlow.photoDone) {
|
|
75
|
+
this.endFlow();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.selfieFlow.photoFile = null;
|
|
79
|
+
this.selfieFlow.recordingFile = null;
|
|
80
|
+
this.showError = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async uploadRecording() {
|
|
84
|
+
if (this.selfieFlow.recordingFile == null || this.selfieFlow.recordingDone) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.selfieFlow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
|
|
88
|
+
if (this.selfieFlow.recordingDone) {
|
|
89
|
+
this.endFlow();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.selfieFlow.photoFile = null;
|
|
93
|
+
this.selfieFlow.recordingFile = null;
|
|
94
|
+
this.showError = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
endFlow() {
|
|
98
|
+
if (!this.selfieFlow.photoDone) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!this.selfieFlow.recordingDone) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!this.selfieFlow.verificationFinished) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
store.flowStatus = FlowStatus.COMPLETE;
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
let howTo = h("how-to-info", { idSide: "" });
|
|
111
|
+
let capture = h("selfie-capture", { device: this.device, id: "camera" });
|
|
112
|
+
let error = h("capture-error", { type: "LIVENESS" });
|
|
113
|
+
return this.showHowTo ? howTo : this.showError ? error : capture;
|
|
114
|
+
}
|
|
115
|
+
static get is() { return "user-liveness"; }
|
|
116
|
+
static get originalStyleUrls() {
|
|
117
|
+
return {
|
|
118
|
+
"$": ["user-liveness.css"]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
static get styleUrls() {
|
|
122
|
+
return {
|
|
123
|
+
"$": ["user-liveness.css"]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
static get properties() {
|
|
127
|
+
return {
|
|
128
|
+
"device": {
|
|
129
|
+
"type": "unknown",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "Device",
|
|
133
|
+
"resolved": "Device",
|
|
134
|
+
"references": {
|
|
135
|
+
"Device": {
|
|
136
|
+
"location": "import",
|
|
137
|
+
"path": "../../../models/IDevice"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": ""
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
static get states() {
|
|
151
|
+
return {
|
|
152
|
+
"showError": {},
|
|
153
|
+
"showHowTo": {},
|
|
154
|
+
"selfieFlow": {}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
static get events() {
|
|
158
|
+
return [{
|
|
159
|
+
"method": "apiErrorEvent",
|
|
160
|
+
"name": "apiError",
|
|
161
|
+
"bubbles": true,
|
|
162
|
+
"cancelable": true,
|
|
163
|
+
"composed": true,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": ""
|
|
167
|
+
},
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "any",
|
|
170
|
+
"resolved": "any",
|
|
171
|
+
"references": {}
|
|
172
|
+
}
|
|
173
|
+
}];
|
|
174
|
+
}
|
|
175
|
+
static get listeners() {
|
|
176
|
+
return [{
|
|
177
|
+
"name": "howToInfoDone",
|
|
178
|
+
"method": "howToDone",
|
|
179
|
+
"target": undefined,
|
|
180
|
+
"capture": false,
|
|
181
|
+
"passive": false
|
|
182
|
+
}, {
|
|
183
|
+
"name": "timeElapsed",
|
|
184
|
+
"method": "timeElapsed",
|
|
185
|
+
"target": undefined,
|
|
186
|
+
"capture": false,
|
|
187
|
+
"passive": false
|
|
188
|
+
}, {
|
|
189
|
+
"name": "captureErrorDone",
|
|
190
|
+
"method": "captureErrorDone",
|
|
191
|
+
"target": undefined,
|
|
192
|
+
"capture": false,
|
|
193
|
+
"passive": false
|
|
194
|
+
}, {
|
|
195
|
+
"name": "photoSelfieCapture",
|
|
196
|
+
"method": "captureSelfieImage",
|
|
197
|
+
"target": undefined,
|
|
198
|
+
"capture": false,
|
|
199
|
+
"passive": false
|
|
200
|
+
}, {
|
|
201
|
+
"name": "recordingSelfieCapture",
|
|
202
|
+
"method": "capturedSelfieRecording",
|
|
203
|
+
"target": undefined,
|
|
204
|
+
"capture": false,
|
|
205
|
+
"passive": false
|
|
206
|
+
}, {
|
|
207
|
+
"name": "verificationFinished",
|
|
208
|
+
"method": "verificationFinished",
|
|
209
|
+
"target": undefined,
|
|
210
|
+
"capture": false,
|
|
211
|
+
"passive": false
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
}
|