@ekyc_qoobiss/qbs-ect-cmp 1.12.2 → 1.12.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_16.cjs.entry.js → agreement-check_17.cjs.entry.js} +3332 -228
- 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 -0
- package/dist/collection/components/flow/id-double-side/id-double-side.js +7 -3
- package/dist/collection/components/flow/id-single-side/id-single-side.js +7 -3
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +10 -0
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +123 -0
- package/dist/collection/components/flow/user-liveness/user-liveness.js +7 -3
- package/dist/collection/components/identification-component/identification-component.js +63 -12
- package/dist/collection/helpers/ApiCall.js +30 -3
- package/dist/collection/helpers/Stream.js +5 -3
- package/dist/collection/helpers/store.js +1 -0
- package/dist/collection/helpers/textValues.js +9 -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/OrderStatuses.js +7 -0
- package/dist/esm/{agreement-check_16.entry.js → agreement-check_17.entry.js} +3332 -229
- package/dist/esm/loader.js +1 -1
- package/dist/esm/qbs-ect-cmp.js +1 -1
- package/dist/qbs-ect-cmp/{p-9d630ead.entry.js → p-be0b3da9.entry.js} +24 -24
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +22 -0
- package/dist/types/components/identification-component/identification-component.d.ts +3 -1
- package/dist/types/components.d.ts +20 -0
- package/dist/types/helpers/ApiCall.d.ts +6 -1
- package/dist/types/helpers/Stream.d.ts +12 -0
- package/dist/types/helpers/store.d.ts +1 -0
- package/dist/types/helpers/textValues.d.ts +9 -0
- package/dist/types/models/IAddRequest.d.ts +1 -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/OrderStatuses.d.ts +6 -0
- package/package.json +4 -2
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-
|
|
17
|
+
return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_17.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-
|
|
20
|
+
return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_17.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32],"selfieFlow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./components/flow/id-double-side/id-double-side.js",
|
|
15
15
|
"./components/flow/id-single-side/id-single-side.js",
|
|
16
16
|
"./components/flow/landing-validation/landing-validation.js",
|
|
17
|
+
"./components/flow/mobile-redirect/mobile-redirect.js",
|
|
17
18
|
"./components/flow/sms-code-validation/sms-code-validation.js",
|
|
18
19
|
"./components/flow/user-liveness/user-liveness.js",
|
|
19
20
|
"./components/identification-component/identification-component.js"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h /*getAssetPath*/ } from '@stencil/core';
|
|
2
2
|
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
3
|
import store from '../../../helpers/store';
|
|
4
|
+
import { Stream } from '../../../helpers/Stream';
|
|
4
5
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
5
6
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
6
7
|
export class IdDoubleSide {
|
|
@@ -77,10 +78,13 @@ export class IdDoubleSide {
|
|
|
77
78
|
}
|
|
78
79
|
async capturedIdRecording(event) {
|
|
79
80
|
let idRecording = event.detail;
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
if (idRecording.length == 0 || idRecording.size == 0) {
|
|
82
|
+
await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
82
86
|
try {
|
|
83
|
-
this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + extension, { type: mimeType });
|
|
87
|
+
this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + mimeType.extension, { type: mimeType.type });
|
|
84
88
|
this.uploadRecording();
|
|
85
89
|
}
|
|
86
90
|
catch (e) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h /*getAssetPath*/ } from '@stencil/core';
|
|
2
2
|
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
3
|
import store from '../../../helpers/store';
|
|
4
|
+
import { Stream } from '../../../helpers/Stream';
|
|
4
5
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
5
6
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
6
7
|
export class IdSingleSide {
|
|
@@ -46,11 +47,14 @@ export class IdSingleSide {
|
|
|
46
47
|
}
|
|
47
48
|
async capturedIdRecording(event) {
|
|
48
49
|
let idRecording = event.detail;
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (idRecording.length == 0 || idRecording.size == 0) {
|
|
51
|
+
await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
51
55
|
if (store.flowStatus == FlowStatus.ID) {
|
|
52
56
|
try {
|
|
53
|
-
this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + extension, { type: mimeType });
|
|
57
|
+
this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + mimeType.extension, { type: mimeType.type });
|
|
54
58
|
await this.uploadRecording();
|
|
55
59
|
}
|
|
56
60
|
catch (e) {
|
|
@@ -0,0 +1,123 @@
|
|
|
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('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
|
+
await this.apiCall.SendLink(this.redirectLink, this.contact);
|
|
67
|
+
}
|
|
68
|
+
handleChangeContact(ev) {
|
|
69
|
+
let value = ev.target ? ev.target.value : '';
|
|
70
|
+
this.contact = value.replace(/\D/g, '');
|
|
71
|
+
if (this.contact.length > 10) {
|
|
72
|
+
this.contact = this.contact.substring(0, 10);
|
|
73
|
+
}
|
|
74
|
+
else if (this.contact.length == 10) {
|
|
75
|
+
this.invalidValue = false;
|
|
76
|
+
}
|
|
77
|
+
ev.target.value = this.contact;
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
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))))));
|
|
81
|
+
}
|
|
82
|
+
static get is() { return "mobile-redirect"; }
|
|
83
|
+
static get originalStyleUrls() {
|
|
84
|
+
return {
|
|
85
|
+
"$": ["mobile-redirect.css"]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
static get styleUrls() {
|
|
89
|
+
return {
|
|
90
|
+
"$": ["mobile-redirect.css"]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static get states() {
|
|
94
|
+
return {
|
|
95
|
+
"infoTextTop": {},
|
|
96
|
+
"infoTextBottom": {},
|
|
97
|
+
"contact": {},
|
|
98
|
+
"invalidValue": {},
|
|
99
|
+
"waitingMobile": {},
|
|
100
|
+
"orderStatus": {},
|
|
101
|
+
"redirectLink": {},
|
|
102
|
+
"qrCode": {}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static get events() {
|
|
106
|
+
return [{
|
|
107
|
+
"method": "apiErrorEvent",
|
|
108
|
+
"name": "apiError",
|
|
109
|
+
"bubbles": true,
|
|
110
|
+
"cancelable": true,
|
|
111
|
+
"composed": true,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": ""
|
|
115
|
+
},
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "any",
|
|
118
|
+
"resolved": "any",
|
|
119
|
+
"references": {}
|
|
120
|
+
}
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
3
|
import store from '../../../helpers/store';
|
|
4
|
+
import { Stream } from '../../../helpers/Stream';
|
|
4
5
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
5
6
|
export class UserLiveness {
|
|
6
7
|
constructor() {
|
|
@@ -40,10 +41,13 @@ export class UserLiveness {
|
|
|
40
41
|
}
|
|
41
42
|
async capturedSelfieRecording(event) {
|
|
42
43
|
let selfieRecording = event.detail;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (selfieRecording.length == 0 || selfieRecording.size == 0) {
|
|
45
|
+
await this.apiCall.AddLog({ message: 'Empty recording', blobData: selfieRecording });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
45
49
|
try {
|
|
46
|
-
this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + extension, { type: mimeType });
|
|
50
|
+
this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + mimeType.extension, { type: mimeType.type });
|
|
47
51
|
await this.uploadRecording();
|
|
48
52
|
}
|
|
49
53
|
catch (e) {
|
|
@@ -6,6 +6,7 @@ import store from '../../helpers/store';
|
|
|
6
6
|
import { ML5 } from '../../helpers/ML5';
|
|
7
7
|
import { FlowStatus } from '../../models/FlowStatus';
|
|
8
8
|
import Events from '../../helpers/Events';
|
|
9
|
+
import * as uuid from 'uuid';
|
|
9
10
|
export class IdentificationComponent {
|
|
10
11
|
async onTokenChange(newValue, _oldValue) {
|
|
11
12
|
if (newValue == '') {
|
|
@@ -48,6 +49,16 @@ export class IdentificationComponent {
|
|
|
48
49
|
store.environment = newValue;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
async onRedirectIdChange(newValue, _oldValue) {
|
|
53
|
+
if (store.redirectId != '') {
|
|
54
|
+
newValue = store.redirectId;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (store.redirectId !== newValue) {
|
|
58
|
+
store.redirectId = newValue;
|
|
59
|
+
}
|
|
60
|
+
await this.initializeRequest();
|
|
61
|
+
}
|
|
51
62
|
agreementAcceptanceEmitted(data) {
|
|
52
63
|
try {
|
|
53
64
|
this.apiCall.GenerateAgreement(data.detail.agreementType);
|
|
@@ -56,19 +67,23 @@ export class IdentificationComponent {
|
|
|
56
67
|
this.apiErrorEmitter(e);
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
|
-
apiErrorEmitter(data) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
async apiErrorEmitter(data) {
|
|
71
|
+
let apiLogData = { message: '', stack: '' };
|
|
72
|
+
if (data.detail) {
|
|
73
|
+
if (data.detail.message) {
|
|
74
|
+
this.errorMessage = data.detail.message;
|
|
75
|
+
}
|
|
76
|
+
apiLogData.message = data.detail.message;
|
|
77
|
+
apiLogData.stack = data.detail.stack;
|
|
65
78
|
}
|
|
66
|
-
else if (data.
|
|
67
|
-
this.errorMessage = data.
|
|
79
|
+
else if (data.message) {
|
|
80
|
+
this.errorMessage = data.message;
|
|
81
|
+
apiLogData.message = data.message;
|
|
68
82
|
}
|
|
69
83
|
else {
|
|
70
84
|
this.errorMessage = data;
|
|
71
85
|
}
|
|
86
|
+
await this.apiCall.AddLog(apiLogData);
|
|
72
87
|
Events.flowError(data);
|
|
73
88
|
store.flowStatus = FlowStatus.ERROREND;
|
|
74
89
|
}
|
|
@@ -77,6 +92,7 @@ export class IdentificationComponent {
|
|
|
77
92
|
this.order_id = undefined;
|
|
78
93
|
this.api_url = undefined;
|
|
79
94
|
this.env = undefined;
|
|
95
|
+
this.redirect_id = undefined;
|
|
80
96
|
this.idSide = '';
|
|
81
97
|
this.errorMessage = undefined;
|
|
82
98
|
ML5.getInstance();
|
|
@@ -91,6 +107,9 @@ export class IdentificationComponent {
|
|
|
91
107
|
store.requestId = this.order_id;
|
|
92
108
|
sessionStorage.setItem(SessionKeys.RequestIdKey, store.requestId);
|
|
93
109
|
}
|
|
110
|
+
if (this.redirect_id) {
|
|
111
|
+
store.redirectId = this.redirect_id;
|
|
112
|
+
}
|
|
94
113
|
store.apiBaseUrl = this.api_url;
|
|
95
114
|
store.environment = this.env;
|
|
96
115
|
this.apiCall = new ApiCall();
|
|
@@ -111,8 +130,15 @@ export class IdentificationComponent {
|
|
|
111
130
|
return;
|
|
112
131
|
}
|
|
113
132
|
try {
|
|
114
|
-
if (
|
|
115
|
-
store.
|
|
133
|
+
if (!this.device.isMobile && store.redirectId == '') {
|
|
134
|
+
store.redirectId = uuid.v4();
|
|
135
|
+
this.redirect_id = store.redirectId;
|
|
136
|
+
}
|
|
137
|
+
if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
|
|
138
|
+
store.initialised = await this.apiCall.AddIdentificationRequest(this.device);
|
|
139
|
+
if (!this.order_id || this.order_id == '') {
|
|
140
|
+
this.order_id = store.requestId;
|
|
141
|
+
}
|
|
116
142
|
}
|
|
117
143
|
}
|
|
118
144
|
catch (e) {
|
|
@@ -121,8 +147,13 @@ export class IdentificationComponent {
|
|
|
121
147
|
}
|
|
122
148
|
render() {
|
|
123
149
|
let currentBlock = h("div", null);
|
|
124
|
-
if (
|
|
125
|
-
|
|
150
|
+
if (this.device.isMobile) {
|
|
151
|
+
if (store.flowStatus == FlowStatus.LANDING) {
|
|
152
|
+
currentBlock = h("landing-validation", { device: this.device });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
currentBlock = h("mobile-redirect", null);
|
|
126
157
|
}
|
|
127
158
|
if (store.flowStatus == FlowStatus.AGREEMENT) {
|
|
128
159
|
currentBlock = h("agreement-info", null);
|
|
@@ -234,6 +265,23 @@ export class IdentificationComponent {
|
|
|
234
265
|
},
|
|
235
266
|
"attribute": "env",
|
|
236
267
|
"reflect": true
|
|
268
|
+
},
|
|
269
|
+
"redirect_id": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"mutable": true,
|
|
272
|
+
"complexType": {
|
|
273
|
+
"original": "string",
|
|
274
|
+
"resolved": "string",
|
|
275
|
+
"references": {}
|
|
276
|
+
},
|
|
277
|
+
"required": false,
|
|
278
|
+
"optional": false,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [],
|
|
281
|
+
"text": ""
|
|
282
|
+
},
|
|
283
|
+
"attribute": "redirect_id",
|
|
284
|
+
"reflect": true
|
|
237
285
|
}
|
|
238
286
|
};
|
|
239
287
|
}
|
|
@@ -256,6 +304,9 @@ export class IdentificationComponent {
|
|
|
256
304
|
}, {
|
|
257
305
|
"propName": "env",
|
|
258
306
|
"methodName": "onEnvChange"
|
|
307
|
+
}, {
|
|
308
|
+
"propName": "redirect_id",
|
|
309
|
+
"methodName": "onRedirectIdChange"
|
|
259
310
|
}];
|
|
260
311
|
}
|
|
261
312
|
static get listeners() {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { OrderStatuses } from '../models/OrderStatuses';
|
|
1
2
|
import store from './store';
|
|
2
|
-
import { ApiUrls } from './textValues';
|
|
3
|
+
import { ApiUrls, SessionKeys } from './textValues';
|
|
4
|
+
import { FlowStatus } from '../models/FlowStatus';
|
|
3
5
|
export class ApiCall {
|
|
4
6
|
constructor() {
|
|
5
7
|
this.toBase64 = (file) => new Promise((resolve, reject) => {
|
|
@@ -52,9 +54,17 @@ export class ApiCall {
|
|
|
52
54
|
let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
|
|
53
55
|
return jsonResp.valid;
|
|
54
56
|
}
|
|
55
|
-
async AddIdentificationRequest(
|
|
56
|
-
let data = {
|
|
57
|
+
async AddIdentificationRequest(deviceInfo) {
|
|
58
|
+
let data = {
|
|
59
|
+
requestId: store.requestId,
|
|
60
|
+
clientDeviceInfo: JSON.stringify(deviceInfo),
|
|
61
|
+
redirectId: store.redirectId,
|
|
62
|
+
};
|
|
57
63
|
let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
|
|
64
|
+
if (store.requestId == '') {
|
|
65
|
+
store.requestId = jsonResp.requestId;
|
|
66
|
+
sessionStorage.setItem(SessionKeys.RequestIdKey, jsonResp.requestId);
|
|
67
|
+
}
|
|
58
68
|
store.hasIdBack = jsonResp.hasIdBack;
|
|
59
69
|
store.agreementsValidation = jsonResp.agreementsValidation;
|
|
60
70
|
store.phoneValidation = jsonResp.phoneValidation;
|
|
@@ -84,4 +94,21 @@ export class ApiCall {
|
|
|
84
94
|
let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
|
|
85
95
|
return resp.generation;
|
|
86
96
|
}
|
|
97
|
+
async GetStatus(requestId) {
|
|
98
|
+
let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
|
|
99
|
+
return OrderStatuses[resp.status];
|
|
100
|
+
}
|
|
101
|
+
async SendLink(link, phoneNumber) {
|
|
102
|
+
let data = { link: link, phoneNumber: phoneNumber };
|
|
103
|
+
let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
|
|
104
|
+
return resp.sent;
|
|
105
|
+
}
|
|
106
|
+
async AddLog(error) {
|
|
107
|
+
try {
|
|
108
|
+
let data = { requestId: store.requestId, action: FlowStatus[store.flowStatus], message: JSON.stringify(error !== null && error !== void 0 ? error : 'no error data') };
|
|
109
|
+
let result = await this.post(this.urls.AddLog, JSON.stringify(data));
|
|
110
|
+
return result.saved;
|
|
111
|
+
}
|
|
112
|
+
catch (_a) { }
|
|
113
|
+
}
|
|
87
114
|
}
|
|
@@ -120,17 +120,17 @@ export class Stream {
|
|
|
120
120
|
// if (this.faceDetection) await Detector.getInstance().startDetector();
|
|
121
121
|
}
|
|
122
122
|
recordStream() {
|
|
123
|
-
var options = { mimeType:
|
|
123
|
+
var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
|
|
124
124
|
if (!MediaRecorder.isTypeSupported(options.mimeType)) {
|
|
125
125
|
if (this.device.isIos || this.device.isSafari)
|
|
126
|
-
options.mimeType =
|
|
126
|
+
options.mimeType = Stream.mp4MimeType.mime;
|
|
127
127
|
}
|
|
128
128
|
this.recordedChunks = [];
|
|
129
129
|
this.mediaRecorder = new MediaRecorder(this.stream, options);
|
|
130
130
|
this.mediaRecorder.ondataavailable = event => {
|
|
131
131
|
this.recordedChunks.push(event.data);
|
|
132
132
|
};
|
|
133
|
-
this.mediaRecorder.onstop =
|
|
133
|
+
this.mediaRecorder.onstop = _e => {
|
|
134
134
|
this.saveVideoRecording(this.recordedChunks, options.mimeType);
|
|
135
135
|
this.recordedChunks = [];
|
|
136
136
|
};
|
|
@@ -217,5 +217,7 @@ export class Stream {
|
|
|
217
217
|
this.callbackChangeTitle(pose);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
Stream.mp4MimeType = { type: 'video/mp4', codec: 'codecs:h264', extension: 'mp4', mime: 'video/mp4;codecs:h264' };
|
|
221
|
+
Stream.webmMimeType = { type: 'video/webm', codec: 'codecs=vp8', extension: 'webm', mime: 'video/webm;codecs=vp8' };
|
|
220
222
|
window.addEventListener('resize', Stream.orientationChange, false);
|
|
221
223
|
window.addEventListener('orientationchange', Stream.orientationChange, false);
|
|
@@ -111,5 +111,14 @@ export class ApiUrls {
|
|
|
111
111
|
this.UploadCapture = this.uriEnv + 'validation/upload/capture';
|
|
112
112
|
this.GetAgreement = this.uriEnv + 'validation/agreement/content';
|
|
113
113
|
this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
|
|
114
|
+
this.SendLink = this.uriEnv + 'validation/otp/sendlink';
|
|
115
|
+
this.GetStatus = this.uriEnv + 'validation/identity/status';
|
|
116
|
+
this.AddLog = this.uriEnv + 'validation/logs/add';
|
|
114
117
|
}
|
|
115
118
|
}
|
|
119
|
+
export class MobileRedirectValues extends GlobalValues {
|
|
120
|
+
}
|
|
121
|
+
MobileRedirectValues.InfoTop = 'Pentru a continua scanați codul de mai jos cu un smartphone.';
|
|
122
|
+
MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru a primi link-ul pe smartphone.';
|
|
123
|
+
MobileRedirectValues.Validation = 'Număr de telefon invalid!';
|
|
124
|
+
MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var OrderStatuses;
|
|
2
|
+
(function (OrderStatuses) {
|
|
3
|
+
OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
|
|
4
|
+
OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
|
|
5
|
+
OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
|
|
6
|
+
OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
|
|
7
|
+
})(OrderStatuses || (OrderStatuses = {}));
|