@ekyc_qoobiss/qbs-ect-cmp 3.6.27 → 3.6.28
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_19.cjs.entry.js +9498 -0
- package/dist/cjs/base-component-aa9e52bf.js +832 -0
- package/dist/cjs/index-41696e0e.js +1573 -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/cjs/random-actions.cjs.entry.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/assets/loader.svg +29 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/base-component.js +63 -0
- package/dist/collection/components/common/agreement-check/agreement-check.css +0 -0
- package/dist/collection/components/common/agreement-check/agreement-check.js +104 -0
- package/dist/collection/components/common/camera-error/camera-error.css +0 -0
- package/dist/{qbs-ect-cmp/camera-error.entry.js → collection/components/common/camera-error/camera-error.js} +52 -20
- package/dist/collection/components/common/capture-error/capture-error.css +0 -0
- package/dist/{qbs-ect-cmp/capture-error.entry.js → collection/components/common/capture-error/capture-error.js} +63 -16
- 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 +121 -0
- package/dist/collection/components/common/id-back-capture/id-back-capture.css +35 -0
- package/dist/{qbs-ect-cmp/id-back-capture.entry.js → collection/components/common/id-back-capture/id-back-capture.js} +94 -24
- package/dist/collection/components/common/id-capture/id-capture.css +35 -0
- package/dist/{qbs-ect-cmp/id-capture.entry.js → collection/components/common/id-capture/id-capture.js} +94 -24
- package/dist/collection/components/common/id-tilt/id-tilt.css +35 -0
- package/dist/{qbs-ect-cmp/id-tilt.entry.js → collection/components/common/id-tilt/id-tilt.js} +94 -24
- package/dist/collection/components/common/random-actions/random-actions.css +0 -0
- package/dist/collection/components/common/random-actions/random-actions.js +24 -0
- package/dist/collection/components/common/selfie-capture/selfie-capture.css +7 -0
- package/dist/{qbs-ect-cmp/selfie-capture.entry.js → collection/components/common/selfie-capture/selfie-capture.js} +95 -24
- package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +7 -0
- package/dist/{qbs-ect-cmp/selfie-tilt.entry.js → collection/components/common/selfie-tilt/selfie-tilt.js} +95 -24
- package/dist/collection/components/controls/camera/camera.css +47 -0
- package/dist/collection/components/controls/camera/camera.js +289 -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/{qbs-ect-cmp/agreement-info.entry.js → collection/components/flow/agreement-info/agreement-info.js} +57 -18
- package/dist/collection/components/flow/end-redirect/end-redirect.css +128 -0
- package/dist/collection/components/flow/end-redirect/end-redirect.js +47 -0
- package/dist/collection/components/flow/error-end/error-end.css +0 -0
- package/dist/collection/components/flow/error-end/error-end.js +61 -0
- package/dist/collection/components/flow/landing-validation/landing-validation.css +0 -0
- package/dist/collection/components/flow/landing-validation/landing-validation.js +122 -0
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +10 -0
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +143 -0
- package/dist/collection/components/flow/process-id/process-id.css +0 -0
- package/dist/{qbs-ect-cmp/process-id.entry.js → collection/components/flow/process-id/process-id.js} +100 -32
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.css +0 -0
- package/dist/{qbs-ect-cmp/sms-code-validation.entry.js → collection/components/flow/sms-code-validation/sms-code-validation.js} +63 -30
- package/dist/collection/components/flow/user-liveness/user-liveness.css +0 -0
- package/dist/{qbs-ect-cmp/user-liveness.entry.js → collection/components/flow/user-liveness/user-liveness.js} +91 -25
- package/dist/collection/components/identification-component/identification-component.css +991 -0
- package/dist/collection/components/identification-component/identification-component.js +408 -0
- package/dist/collection/global.js +0 -0
- package/dist/collection/helpers/ApiCall.js +223 -0
- package/dist/{qbs-ect-cmp/Cameras-dfbebc29.js → collection/helpers/Cameras.js} +6 -9
- package/dist/collection/helpers/DeviceDetection.js +85 -0
- package/dist/collection/helpers/Events.js +58 -0
- package/dist/collection/helpers/ML5.js +38 -0
- package/dist/collection/helpers/Stream.js +229 -0
- package/dist/collection/helpers/TranslationUtils.js +37 -0
- package/dist/collection/helpers/canvas.js +10 -0
- package/dist/collection/helpers/index.js +21 -0
- package/dist/collection/helpers/security.js +25 -0
- package/dist/collection/helpers/store.js +48 -0
- package/dist/collection/helpers/textValues.js +48 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +182 -0
- package/dist/collection/libs/FaceML5Detector/FacePose.js +85 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +99 -0
- package/dist/{qbs-ect-cmp/IDPose-181bcb25.js → collection/libs/IDML5Detector/IDPose.js} +2 -4
- package/dist/{qbs-ect-cmp/CaptureFlow-db5d90a4.js → collection/models/CaptureFlow.js} +4 -6
- package/dist/collection/models/FlowStatus.js +14 -0
- package/dist/collection/models/FlowSteps.js +30 -0
- package/dist/collection/models/IAbortResult.js +1 -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/{qbs-ect-cmp/IDevice-15ecfdeb.js → collection/models/IDevice.js} +4 -6
- package/dist/collection/models/IEctStore.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/ITranslationValues.js +1 -0
- package/dist/collection/models/IUploadFile.js +1 -0
- package/dist/collection/models/IVerificationMode.js +5 -0
- package/dist/collection/models/OrderStatuses.js +8 -0
- package/dist/{qbs-ect-cmp/utils-8225f0b7.js → collection/utils/utils.js} +8 -10
- package/dist/esm/agreement-check_19.entry.js +9476 -0
- package/dist/{qbs-ect-cmp/base-component-2e490fd9.js → esm/base-component-b7f50d31.js} +384 -62
- package/dist/esm/index-cf54a432.js +1543 -0
- package/dist/esm/index.js +1 -0
- package/dist/{qbs-ect-cmp → esm}/loader-dots.entry.js +1 -1
- 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/{qbs-ect-cmp → esm}/random-actions.entry.js +2 -4
- 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 -1
- package/dist/qbs-ect-cmp/p-054dc5b3.entry.js +1 -0
- package/dist/qbs-ect-cmp/p-215a7e76.entry.js +1 -0
- package/dist/qbs-ect-cmp/p-7bedffaa.js +1 -0
- package/dist/qbs-ect-cmp/p-8942656c.js +2 -0
- package/dist/qbs-ect-cmp/p-c32a782a.entry.js +1373 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.css +1 -320
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -148
- package/package.json +1 -1
- package/dist/qbs-ect-cmp/ML5-657ef934.js +0 -1370
- package/dist/qbs-ect-cmp/Stream-b867a2be.js +0 -3104
- package/dist/qbs-ect-cmp/_commonjsHelpers-321aa363.js +0 -44
- package/dist/qbs-ect-cmp/agreement-check.entry.js +0 -41
- package/dist/qbs-ect-cmp/app-globals-0f993ce5.js +0 -3
- package/dist/qbs-ect-cmp/camera-comp.entry.js +0 -103
- package/dist/qbs-ect-cmp/css-shim-b7d3d95f.js +0 -4
- package/dist/qbs-ect-cmp/dom-64053c71.js +0 -73
- package/dist/qbs-ect-cmp/end-redirect.entry.js +0 -25
- package/dist/qbs-ect-cmp/error-end.entry.js +0 -19
- package/dist/qbs-ect-cmp/how-to-info.entry.js +0 -52
- package/dist/qbs-ect-cmp/identification-component.entry.js +0 -909
- package/dist/qbs-ect-cmp/index-78a05b9e.js +0 -3371
- package/dist/qbs-ect-cmp/landing-validation.entry.js +0 -90
- package/dist/qbs-ect-cmp/mobile-redirect.entry.js +0 -2984
- package/dist/qbs-ect-cmp/shadow-css-98135883.js +0 -387
- package/dist/qbs-ect-cmp/textValues-6bcc85dd.js +0 -302
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { SessionKeys } from '../../helpers/textValues';
|
|
3
|
+
import store from '../../helpers/store';
|
|
4
|
+
import { ML5 } from '../../helpers/ML5';
|
|
5
|
+
import { FlowStatus } from '../../models/FlowStatus';
|
|
6
|
+
import Events from '../../helpers/Events';
|
|
7
|
+
import * as uuid from 'uuid';
|
|
8
|
+
import packageJson from '../../../package.json';
|
|
9
|
+
import { getLogMessage } from '../../utils/utils';
|
|
10
|
+
import { BaseComponent } from '../base-component';
|
|
11
|
+
import { Browser } from '../../models/IDevice';
|
|
12
|
+
import { FlowMoments, FlowSteps } from '../../models/FlowSteps';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import loaderImg from '../../assets/loader.svg';
|
|
15
|
+
export class IdentificationComponent {
|
|
16
|
+
async onTokenChange(newValue, _oldValue) {
|
|
17
|
+
if (store.debug)
|
|
18
|
+
console.log('Token change called with value: ' + newValue);
|
|
19
|
+
if (newValue == '') {
|
|
20
|
+
newValue = store.token;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (store.token !== newValue) {
|
|
24
|
+
store.token = newValue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
agreementAcceptanceEmitted(data) {
|
|
28
|
+
try {
|
|
29
|
+
this.baseComponent.apiCall.GenerateAgreement(data.detail.agreementType);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
this.apiErrorEmitter(e, 'Agreement Acceptance');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async apiErrorEmitter(data, zone) {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f;
|
|
37
|
+
if (data.detail) {
|
|
38
|
+
this.errorTitle = (_b = (_a = data.detail.message) !== null && _a !== void 0 ? _a : data.detail.status) !== null && _b !== void 0 ? _b : '';
|
|
39
|
+
this.errorMessage = (_d = (_c = data.detail.stack) !== null && _c !== void 0 ? _c : data.detail.statusText) !== null && _d !== void 0 ? _d : '';
|
|
40
|
+
}
|
|
41
|
+
else if (data.message) {
|
|
42
|
+
this.errorTitle = data.message;
|
|
43
|
+
}
|
|
44
|
+
else if (data.status) {
|
|
45
|
+
this.errorTitle = (_e = data.status) !== null && _e !== void 0 ? _e : '';
|
|
46
|
+
this.errorMessage = (_f = data.statusText) !== null && _f !== void 0 ? _f : '';
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.errorTitle = data;
|
|
50
|
+
}
|
|
51
|
+
let apiLogData = { message: this.errorTitle, stack: this.errorMessage, zone };
|
|
52
|
+
try {
|
|
53
|
+
await this.baseComponent.apiCall.AddLog(apiLogData, getLogMessage(this.order_id, this.redirect_id, this.token));
|
|
54
|
+
}
|
|
55
|
+
catch (_g) { }
|
|
56
|
+
Events.flowError(this.errorTitle);
|
|
57
|
+
store.flowStatus = FlowStatus.ERROREND;
|
|
58
|
+
}
|
|
59
|
+
handleScroll(ev) {
|
|
60
|
+
if (ev.target.offsetHeight + ev.target.scrollTop >= ev.target.scrollHeight) {
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
constructor() {
|
|
66
|
+
this.logInit = {};
|
|
67
|
+
this.flowStatusToSet = FlowStatus.NONE;
|
|
68
|
+
this.token = undefined;
|
|
69
|
+
this.order_id = undefined;
|
|
70
|
+
this.api_url = undefined;
|
|
71
|
+
this.env = undefined;
|
|
72
|
+
this.redirect_id = undefined;
|
|
73
|
+
this.phone_number = undefined;
|
|
74
|
+
this.lang_iso = undefined;
|
|
75
|
+
this.idSide = '';
|
|
76
|
+
this.errorMessage = undefined;
|
|
77
|
+
this.errorTitle = undefined;
|
|
78
|
+
}
|
|
79
|
+
async componentWillLoad() {
|
|
80
|
+
Events.init(window);
|
|
81
|
+
Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Initialized);
|
|
82
|
+
store.apiBaseUrl = this.api_url;
|
|
83
|
+
if (this.env && this.env != '') {
|
|
84
|
+
store.environment = this.env;
|
|
85
|
+
}
|
|
86
|
+
this.baseComponent = new BaseComponent(FlowSteps.ComponentLoaded);
|
|
87
|
+
this.baseComponent.setErrorCallback(this.apiErrorEmitter);
|
|
88
|
+
if (store.debug)
|
|
89
|
+
this.logInit = getLogMessage(this.order_id, this.redirect_id, this.token);
|
|
90
|
+
if (this.token) {
|
|
91
|
+
if (store.debug)
|
|
92
|
+
console.log('Store Token set with property value: ' + this.token);
|
|
93
|
+
store.token = this.token;
|
|
94
|
+
}
|
|
95
|
+
else if (store.token == '') {
|
|
96
|
+
store.token = sessionStorage.getItem(SessionKeys.TokenKey);
|
|
97
|
+
this.token = store.token;
|
|
98
|
+
if (store.debug)
|
|
99
|
+
console.log('Store Token set with session value: ' + store.token);
|
|
100
|
+
}
|
|
101
|
+
if (this.redirect_id) {
|
|
102
|
+
store.redirectId = this.redirect_id;
|
|
103
|
+
}
|
|
104
|
+
if (this.phone_number && this.phone_number != '') {
|
|
105
|
+
store.phoneNumber = this.phone_number;
|
|
106
|
+
}
|
|
107
|
+
if (this.lang_iso && this.lang_iso != '') {
|
|
108
|
+
store.langIso = this.lang_iso;
|
|
109
|
+
}
|
|
110
|
+
var ini = sessionStorage.getItem(SessionKeys.InitialisedKey);
|
|
111
|
+
if (ini && ini.toLowerCase() == 'true') {
|
|
112
|
+
store.initialised = true;
|
|
113
|
+
}
|
|
114
|
+
var hasIdBk = sessionStorage.getItem(SessionKeys.HasIdBackKey);
|
|
115
|
+
if (hasIdBk && hasIdBk.toLowerCase() == 'true') {
|
|
116
|
+
store.hasIdBack = true;
|
|
117
|
+
}
|
|
118
|
+
var agrVal = sessionStorage.getItem(SessionKeys.AgreementValidationKey);
|
|
119
|
+
if (agrVal && agrVal.toLowerCase() == 'true') {
|
|
120
|
+
store.agreementsValidation = true;
|
|
121
|
+
}
|
|
122
|
+
var phoneVal = sessionStorage.getItem(SessionKeys.PhoneValidationKey);
|
|
123
|
+
if (phoneVal && phoneVal.toLowerCase() == 'true') {
|
|
124
|
+
store.phoneValidation = true;
|
|
125
|
+
}
|
|
126
|
+
const savedRequest = sessionStorage.getItem(SessionKeys.RequestIdKey);
|
|
127
|
+
if (this.order_id && this.order_id != '') {
|
|
128
|
+
store.requestId = this.order_id;
|
|
129
|
+
if (store.debug)
|
|
130
|
+
console.log('Current RequestId has value: ' + this.order_id);
|
|
131
|
+
if (savedRequest && savedRequest != '' && savedRequest != this.order_id) {
|
|
132
|
+
if (store.debug)
|
|
133
|
+
console.log('Session RequestId: ' + savedRequest + ' has different value than property one: ' + this.order_id);
|
|
134
|
+
this.flowStatusToSet = FlowStatus.LANDING;
|
|
135
|
+
store.initialised = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else if (savedRequest) {
|
|
139
|
+
if (store.debug)
|
|
140
|
+
console.log('Current RequestId has no value, setting with session value: ' + savedRequest);
|
|
141
|
+
store.requestId = savedRequest;
|
|
142
|
+
this.order_id = savedRequest;
|
|
143
|
+
}
|
|
144
|
+
if (this.flowStatusToSet == FlowStatus.NONE) {
|
|
145
|
+
var flowSt = sessionStorage.getItem(SessionKeys.FlowStatusKey);
|
|
146
|
+
if (flowSt) {
|
|
147
|
+
this.flowStatusToSet = FlowStatus[flowSt];
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.flowStatusToSet = FlowStatus.LANDING;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async componentDidLoad() {
|
|
155
|
+
await this.initializeRequest();
|
|
156
|
+
store.flowStatus = this.flowStatusToSet;
|
|
157
|
+
}
|
|
158
|
+
componentWillRender() {
|
|
159
|
+
if (this.idSide == '') {
|
|
160
|
+
this.idSide = store.hasIdBack ? 'front' : '';
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async initializeRequest() {
|
|
164
|
+
if (store.initialised) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (store.environment == 'DEMO') {
|
|
168
|
+
store.initialised = true;
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (store.device.browser == Browser.Mi) {
|
|
172
|
+
this.apiErrorEmitter('Mi Browser nu este acceptat. Va rugam utilizati Chrome.', 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
if (store.debug)
|
|
177
|
+
this.baseComponent.apiCall.AddLog({ phase: 'debug mode' }, this.logInit);
|
|
178
|
+
}
|
|
179
|
+
catch (_a) { }
|
|
180
|
+
try {
|
|
181
|
+
if (!store.device.isMobile && store.redirectId == '') {
|
|
182
|
+
store.redirectId = uuid.v4();
|
|
183
|
+
this.redirect_id = store.redirectId;
|
|
184
|
+
}
|
|
185
|
+
if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
|
|
186
|
+
store.initialised = await this.baseComponent.apiCall.AddIdentificationRequest(store.device, packageJson.version);
|
|
187
|
+
if (!this.order_id || this.order_id == '') {
|
|
188
|
+
this.order_id = store.requestId;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
this.apiErrorEmitter(e, 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
|
|
194
|
+
}
|
|
195
|
+
ML5.getInstance();
|
|
196
|
+
}
|
|
197
|
+
disconnectedCallback() {
|
|
198
|
+
Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Finalized);
|
|
199
|
+
}
|
|
200
|
+
render() {
|
|
201
|
+
let currentBlock = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "div-ci align-center" }, h("img", { src: loaderImg })))));
|
|
202
|
+
if (store.device.isMobile || store.environment == 'DEMO') {
|
|
203
|
+
if (store.flowStatus == FlowStatus.LANDING) {
|
|
204
|
+
currentBlock = h("landing-validation", null);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (store.flowStatus != FlowStatus.NONE) {
|
|
208
|
+
currentBlock = h("mobile-redirect", null);
|
|
209
|
+
}
|
|
210
|
+
if (store.flowStatus == FlowStatus.AGREEMENT) {
|
|
211
|
+
currentBlock = h("agreement-info", null);
|
|
212
|
+
}
|
|
213
|
+
if (store.flowStatus == FlowStatus.PHONE) {
|
|
214
|
+
currentBlock = h("sms-code-validation", null);
|
|
215
|
+
}
|
|
216
|
+
if (store.flowStatus == FlowStatus.CODE) {
|
|
217
|
+
currentBlock = h("sms-code-validation", null);
|
|
218
|
+
}
|
|
219
|
+
if (store.flowStatus == FlowStatus.CODEERROR) {
|
|
220
|
+
currentBlock = h("sms-code-validation", null);
|
|
221
|
+
}
|
|
222
|
+
if (store.flowStatus == FlowStatus.ID) {
|
|
223
|
+
currentBlock = h("process-id", null);
|
|
224
|
+
}
|
|
225
|
+
if (store.flowStatus == FlowStatus.LIVENESS) {
|
|
226
|
+
currentBlock = h("user-liveness", { id: "camera" });
|
|
227
|
+
}
|
|
228
|
+
if (store.flowStatus == FlowStatus.COMPLETE) {
|
|
229
|
+
currentBlock = h("end-redirect", null);
|
|
230
|
+
}
|
|
231
|
+
if (store.flowStatus == FlowStatus.ERROREND) {
|
|
232
|
+
currentBlock = h("error-end", { errorTitle: this.errorTitle, message: this.errorMessage });
|
|
233
|
+
}
|
|
234
|
+
if (store.flowStatus == FlowStatus.CAMERAERROR) {
|
|
235
|
+
currentBlock = h("camera-error", null);
|
|
236
|
+
}
|
|
237
|
+
return h("div", null, currentBlock);
|
|
238
|
+
}
|
|
239
|
+
static get is() { return "identification-component"; }
|
|
240
|
+
static get encapsulation() { return "shadow"; }
|
|
241
|
+
static get originalStyleUrls() {
|
|
242
|
+
return {
|
|
243
|
+
"$": ["identification-component.css"]
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
static get styleUrls() {
|
|
247
|
+
return {
|
|
248
|
+
"$": ["identification-component.css"]
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
static get properties() {
|
|
252
|
+
return {
|
|
253
|
+
"token": {
|
|
254
|
+
"type": "string",
|
|
255
|
+
"mutable": true,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "string",
|
|
258
|
+
"resolved": "string",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": ""
|
|
266
|
+
},
|
|
267
|
+
"attribute": "token",
|
|
268
|
+
"reflect": true
|
|
269
|
+
},
|
|
270
|
+
"order_id": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"mutable": true,
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "string",
|
|
275
|
+
"resolved": "string",
|
|
276
|
+
"references": {}
|
|
277
|
+
},
|
|
278
|
+
"required": false,
|
|
279
|
+
"optional": false,
|
|
280
|
+
"docs": {
|
|
281
|
+
"tags": [],
|
|
282
|
+
"text": ""
|
|
283
|
+
},
|
|
284
|
+
"attribute": "order_id",
|
|
285
|
+
"reflect": true
|
|
286
|
+
},
|
|
287
|
+
"api_url": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"mutable": true,
|
|
290
|
+
"complexType": {
|
|
291
|
+
"original": "string",
|
|
292
|
+
"resolved": "string",
|
|
293
|
+
"references": {}
|
|
294
|
+
},
|
|
295
|
+
"required": false,
|
|
296
|
+
"optional": false,
|
|
297
|
+
"docs": {
|
|
298
|
+
"tags": [],
|
|
299
|
+
"text": ""
|
|
300
|
+
},
|
|
301
|
+
"attribute": "api_url",
|
|
302
|
+
"reflect": true
|
|
303
|
+
},
|
|
304
|
+
"env": {
|
|
305
|
+
"type": "string",
|
|
306
|
+
"mutable": true,
|
|
307
|
+
"complexType": {
|
|
308
|
+
"original": "string",
|
|
309
|
+
"resolved": "string",
|
|
310
|
+
"references": {}
|
|
311
|
+
},
|
|
312
|
+
"required": false,
|
|
313
|
+
"optional": false,
|
|
314
|
+
"docs": {
|
|
315
|
+
"tags": [],
|
|
316
|
+
"text": ""
|
|
317
|
+
},
|
|
318
|
+
"attribute": "env",
|
|
319
|
+
"reflect": true
|
|
320
|
+
},
|
|
321
|
+
"redirect_id": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"mutable": true,
|
|
324
|
+
"complexType": {
|
|
325
|
+
"original": "string",
|
|
326
|
+
"resolved": "string",
|
|
327
|
+
"references": {}
|
|
328
|
+
},
|
|
329
|
+
"required": false,
|
|
330
|
+
"optional": false,
|
|
331
|
+
"docs": {
|
|
332
|
+
"tags": [],
|
|
333
|
+
"text": ""
|
|
334
|
+
},
|
|
335
|
+
"attribute": "redirect_id",
|
|
336
|
+
"reflect": true
|
|
337
|
+
},
|
|
338
|
+
"phone_number": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"mutable": true,
|
|
341
|
+
"complexType": {
|
|
342
|
+
"original": "string",
|
|
343
|
+
"resolved": "string",
|
|
344
|
+
"references": {}
|
|
345
|
+
},
|
|
346
|
+
"required": false,
|
|
347
|
+
"optional": false,
|
|
348
|
+
"docs": {
|
|
349
|
+
"tags": [],
|
|
350
|
+
"text": ""
|
|
351
|
+
},
|
|
352
|
+
"attribute": "phone_number",
|
|
353
|
+
"reflect": true
|
|
354
|
+
},
|
|
355
|
+
"lang_iso": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"mutable": true,
|
|
358
|
+
"complexType": {
|
|
359
|
+
"original": "string",
|
|
360
|
+
"resolved": "string",
|
|
361
|
+
"references": {}
|
|
362
|
+
},
|
|
363
|
+
"required": false,
|
|
364
|
+
"optional": false,
|
|
365
|
+
"docs": {
|
|
366
|
+
"tags": [],
|
|
367
|
+
"text": ""
|
|
368
|
+
},
|
|
369
|
+
"attribute": "lang_iso",
|
|
370
|
+
"reflect": true
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
static get states() {
|
|
375
|
+
return {
|
|
376
|
+
"idSide": {},
|
|
377
|
+
"errorMessage": {},
|
|
378
|
+
"errorTitle": {}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
static get watchers() {
|
|
382
|
+
return [{
|
|
383
|
+
"propName": "token",
|
|
384
|
+
"methodName": "onTokenChange"
|
|
385
|
+
}];
|
|
386
|
+
}
|
|
387
|
+
static get listeners() {
|
|
388
|
+
return [{
|
|
389
|
+
"name": "agreementAcceptance",
|
|
390
|
+
"method": "agreementAcceptanceEmitted",
|
|
391
|
+
"target": undefined,
|
|
392
|
+
"capture": false,
|
|
393
|
+
"passive": false
|
|
394
|
+
}, {
|
|
395
|
+
"name": "apiError",
|
|
396
|
+
"method": "apiErrorEmitter",
|
|
397
|
+
"target": undefined,
|
|
398
|
+
"capture": false,
|
|
399
|
+
"passive": false
|
|
400
|
+
}, {
|
|
401
|
+
"name": "scroll",
|
|
402
|
+
"method": "handleScroll",
|
|
403
|
+
"target": "window",
|
|
404
|
+
"capture": false,
|
|
405
|
+
"passive": true
|
|
406
|
+
}];
|
|
407
|
+
}
|
|
408
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { OrderStatuses } from '../models/OrderStatuses';
|
|
2
|
+
import store from './store';
|
|
3
|
+
import { ApiUrls } from './textValues';
|
|
4
|
+
import { FlowStatus } from '../models/FlowStatus';
|
|
5
|
+
import { FlowMoments, FlowSteps } from '../models/FlowSteps';
|
|
6
|
+
export class ApiCall {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
|
|
9
|
+
this.toBase64 = (file) => new Promise((resolve, reject) => {
|
|
10
|
+
const reader = new FileReader();
|
|
11
|
+
reader.readAsDataURL(file);
|
|
12
|
+
reader.onload = () => resolve(reader.result);
|
|
13
|
+
reader.onerror = error => reject(error);
|
|
14
|
+
});
|
|
15
|
+
this.urls = new ApiUrls();
|
|
16
|
+
}
|
|
17
|
+
// private async http2<T>(method: string, url: string, data: string): Promise<T> {
|
|
18
|
+
// return new Promise((resolve, reject) => {
|
|
19
|
+
// var xhr = new XMLHttpRequest();
|
|
20
|
+
// xhr.open(method, url);
|
|
21
|
+
// xhr.onload = function () {
|
|
22
|
+
// if (xhr.status >= 200 && xhr.status < 300) {
|
|
23
|
+
// resolve(xhr.response);
|
|
24
|
+
// } else {
|
|
25
|
+
// reject({
|
|
26
|
+
// status: xhr.status,
|
|
27
|
+
// statusText: xhr.statusText,
|
|
28
|
+
// });
|
|
29
|
+
// }
|
|
30
|
+
// };
|
|
31
|
+
// xhr.onerror = function () {
|
|
32
|
+
// reject({
|
|
33
|
+
// status: xhr.status,
|
|
34
|
+
// statusText: xhr.statusText,
|
|
35
|
+
// });
|
|
36
|
+
// };
|
|
37
|
+
// xhr.send(data);
|
|
38
|
+
// });
|
|
39
|
+
// }
|
|
40
|
+
async http(request) {
|
|
41
|
+
const response = await fetch(request);
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
throw new Error(response.statusText);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
// may error if there is no body
|
|
47
|
+
return await response.json();
|
|
48
|
+
}
|
|
49
|
+
catch (ex) {
|
|
50
|
+
throw new Error('No json found in response ' + ex);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async post(url, data, withRetry = true) {
|
|
54
|
+
var request = new Request(store.apiBaseUrl + url, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
body: data,
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/json',
|
|
59
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
return await this.http(request);
|
|
64
|
+
}
|
|
65
|
+
catch (ex) {
|
|
66
|
+
if (!withRetry || this.serviceErrors.includes(ex.message)) {
|
|
67
|
+
throw ex;
|
|
68
|
+
}
|
|
69
|
+
this.AddLog('Error in post ', ex);
|
|
70
|
+
try {
|
|
71
|
+
var request2 = new Request(store.apiBaseUrl + url, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
body: data,
|
|
74
|
+
headers: {
|
|
75
|
+
'Content-Type': 'application/json',
|
|
76
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return await this.http(request2);
|
|
80
|
+
}
|
|
81
|
+
catch (ex2) {
|
|
82
|
+
this.AddLog('Error in post ', ex2);
|
|
83
|
+
var request3 = new Request(store.apiBaseUrl + url, {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
body: data,
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
return await this.http(request3);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async get(url, withRetry = true) {
|
|
96
|
+
var request = new Request(store.apiBaseUrl + url, {
|
|
97
|
+
method: 'GET',
|
|
98
|
+
headers: {
|
|
99
|
+
'Content-Type': 'application/json',
|
|
100
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
return await this.http(request);
|
|
105
|
+
}
|
|
106
|
+
catch (ex) {
|
|
107
|
+
if (!withRetry || this.serviceErrors.includes(ex.message)) {
|
|
108
|
+
throw ex;
|
|
109
|
+
}
|
|
110
|
+
this.AddLog('Error in get ', ex);
|
|
111
|
+
try {
|
|
112
|
+
var request2 = new Request(store.apiBaseUrl + url, {
|
|
113
|
+
method: 'GET',
|
|
114
|
+
headers: {
|
|
115
|
+
'Content-Type': 'application/json',
|
|
116
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
return await this.http(request2);
|
|
120
|
+
}
|
|
121
|
+
catch (ex2) {
|
|
122
|
+
this.AddLog('Error in get ', ex2);
|
|
123
|
+
var request3 = new Request(store.apiBaseUrl + url, {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
headers: {
|
|
126
|
+
'Content-Type': 'application/json',
|
|
127
|
+
'Authorization': 'IDKYC-TOKEN ' + store.token,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
return await this.http(request3);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async SendOTPCode(requestId, phoneNumber) {
|
|
135
|
+
let data = { requestId: requestId, phone: phoneNumber };
|
|
136
|
+
let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
|
|
137
|
+
return jsonResp.sent;
|
|
138
|
+
}
|
|
139
|
+
async CheckOTPCode(requestId, otpCode) {
|
|
140
|
+
let data = { requestId: requestId, otp: otpCode };
|
|
141
|
+
let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
|
|
142
|
+
return jsonResp.valid;
|
|
143
|
+
}
|
|
144
|
+
async AddIdentificationRequest(deviceInfo, version) {
|
|
145
|
+
if (store.debug)
|
|
146
|
+
console.log('Calling identity request with store:' + JSON.stringify(store));
|
|
147
|
+
let data = {
|
|
148
|
+
requestId: store.requestId,
|
|
149
|
+
clientDeviceInfo: JSON.stringify(deviceInfo),
|
|
150
|
+
redirectId: store.redirectId,
|
|
151
|
+
phoneNumber: store.phoneNumber,
|
|
152
|
+
version: version,
|
|
153
|
+
};
|
|
154
|
+
let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
|
|
155
|
+
if (store.requestId == '') {
|
|
156
|
+
store.requestId = jsonResp.requestId;
|
|
157
|
+
}
|
|
158
|
+
store.hasIdBack = jsonResp.hasIdBack;
|
|
159
|
+
store.hasIdTilt = jsonResp.hasIdTilt;
|
|
160
|
+
store.hasSelfieGesture = jsonResp.hasSelfieGesture;
|
|
161
|
+
store.agreementsValidation = jsonResp.agreementsValidation;
|
|
162
|
+
store.phoneValidation = jsonResp.phoneValidation;
|
|
163
|
+
store.phoneNumber = jsonResp.phoneNumber;
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
async UploadFileForRequestB64(requestId, type, file) {
|
|
167
|
+
let data = {
|
|
168
|
+
requestId: requestId,
|
|
169
|
+
type: type,
|
|
170
|
+
data: await this.toBase64(file),
|
|
171
|
+
};
|
|
172
|
+
let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
|
|
173
|
+
if (!store.hasIdBack && type == 'IdFront') {
|
|
174
|
+
return respJson.isValid;
|
|
175
|
+
}
|
|
176
|
+
if (store.hasIdBack && type == 'IdBack') {
|
|
177
|
+
return respJson.isValid;
|
|
178
|
+
}
|
|
179
|
+
if (type == 'Selfie') {
|
|
180
|
+
return respJson.isValid;
|
|
181
|
+
}
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
async GetAgreement(agreementType) {
|
|
185
|
+
let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + store.requestId);
|
|
186
|
+
return resp.htmlText;
|
|
187
|
+
}
|
|
188
|
+
async GenerateAgreement(agreementType) {
|
|
189
|
+
let data = { requestId: store.requestId, documentType: agreementType };
|
|
190
|
+
let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
|
|
191
|
+
return resp.generation;
|
|
192
|
+
}
|
|
193
|
+
async GetStatus(requestId) {
|
|
194
|
+
let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
|
|
195
|
+
return OrderStatuses[resp.status];
|
|
196
|
+
}
|
|
197
|
+
async SendLink(link, phoneNumber) {
|
|
198
|
+
let data = { requestId: store.requestId, link: link, phoneNumber: phoneNumber };
|
|
199
|
+
let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
|
|
200
|
+
return resp.sent;
|
|
201
|
+
}
|
|
202
|
+
async AddLog(error, context) {
|
|
203
|
+
try {
|
|
204
|
+
let data = {
|
|
205
|
+
requestId: store.requestId,
|
|
206
|
+
action: FlowStatus[store.flowStatus],
|
|
207
|
+
message: JSON.stringify({ error, context }),
|
|
208
|
+
};
|
|
209
|
+
let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
|
|
210
|
+
return result.saved;
|
|
211
|
+
}
|
|
212
|
+
catch (_a) { }
|
|
213
|
+
}
|
|
214
|
+
async AddStep(step, moment) {
|
|
215
|
+
let data = { requestId: store.requestId, redirectId: store.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
|
|
216
|
+
let result = await this.post(this.urls.AddStep, JSON.stringify(data));
|
|
217
|
+
return result.saved;
|
|
218
|
+
}
|
|
219
|
+
async AbortRequest() {
|
|
220
|
+
let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: store.requestId }));
|
|
221
|
+
return result.saved;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
class Cameras {
|
|
1
|
+
import { Browser } from '../models/IDevice';
|
|
2
|
+
import store from './store';
|
|
3
|
+
export class Cameras {
|
|
5
4
|
async GetCameras(deviceInfo) {
|
|
6
5
|
var allDevices = [];
|
|
7
6
|
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -115,8 +114,8 @@ class Cameras {
|
|
|
115
114
|
let cam = new Cameras();
|
|
116
115
|
let cameras = (await cam.GetCameras(device)).filter(c => c.facingMode == 'environment');
|
|
117
116
|
var recommCamera = cam.GetRecommendedCamera(cameras);
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
store.cameraIds = cameras.map(camera => camera.deviceId);
|
|
118
|
+
store.cameraId = recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId;
|
|
120
119
|
return true;
|
|
121
120
|
}
|
|
122
121
|
catch (e) {
|
|
@@ -127,6 +126,4 @@ class Cameras {
|
|
|
127
126
|
throw e;
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { Cameras as C };
|
|
129
|
+
}
|