@ekyc_qoobiss/qbs-ect-cmp 3.2.1 → 3.2.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_18.cjs.entry.js +379 -267
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
- package/dist/collection/components/base-component.js +48 -0
- package/dist/collection/components/common/camera-error/camera-error.js +9 -36
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +2 -27
- package/dist/collection/components/common/id-capture/id-capture.js +2 -27
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +4 -28
- package/dist/collection/components/controls/camera/camera.js +3 -23
- package/dist/collection/components/flow/agreement-info/agreement-info.js +6 -9
- package/dist/collection/components/flow/end-redirect/end-redirect.js +4 -9
- package/dist/collection/components/flow/id-double-side/id-double-side.js +31 -51
- package/dist/collection/components/flow/id-single-side/id-single-side.js +14 -42
- package/dist/collection/components/flow/landing-validation/landing-validation.js +19 -40
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +7 -10
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +12 -15
- package/dist/collection/components/flow/user-liveness/user-liveness.js +29 -49
- package/dist/collection/components/identification-component/identification-component.js +14 -15
- package/dist/collection/helpers/ApiCall.js +3 -3
- package/dist/collection/helpers/Cameras.js +3 -2
- package/dist/collection/helpers/DeviceDetection.js +83 -0
- package/dist/collection/helpers/Events.js +9 -0
- package/dist/collection/helpers/Stream.js +9 -8
- package/dist/collection/helpers/index.js +0 -33
- package/dist/collection/helpers/store.js +2 -0
- package/dist/collection/models/FlowSteps.js +19 -13
- package/dist/collection/models/IDevice.js +22 -1
- package/dist/collection/models/IEctStore.js +1 -0
- package/dist/esm/agreement-check_18.entry.js +379 -267
- package/dist/esm/loader.js +1 -1
- package/dist/esm/qbs-ect-cmp.js +1 -1
- package/dist/qbs-ect-cmp/{p-92eaaff9.entry.js → p-f242dbd4.entry.js} +2 -2
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/base-component.d.ts +14 -0
- package/dist/types/components/common/camera-error/camera-error.d.ts +1 -3
- package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +0 -2
- package/dist/types/components/common/id-capture/id-capture.d.ts +0 -2
- package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +0 -2
- package/dist/types/components/controls/camera/camera.d.ts +0 -2
- package/dist/types/components/flow/agreement-info/agreement-info.d.ts +3 -3
- package/dist/types/components/flow/end-redirect/end-redirect.d.ts +1 -1
- package/dist/types/components/flow/id-double-side/id-double-side.d.ts +4 -5
- package/dist/types/components/flow/id-single-side/id-single-side.d.ts +3 -5
- package/dist/types/components/flow/landing-validation/landing-validation.d.ts +2 -3
- package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +1 -1
- package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +2 -2
- package/dist/types/components/flow/user-liveness/user-liveness.d.ts +3 -4
- package/dist/types/components/identification-component/identification-component.d.ts +1 -2
- package/dist/types/components.d.ts +0 -19
- package/dist/types/helpers/ApiCall.d.ts +4 -4
- package/dist/types/helpers/Cameras.d.ts +4 -4
- package/dist/types/helpers/DeviceDetection.d.ts +18 -0
- package/dist/types/helpers/Events.d.ts +2 -0
- package/dist/types/helpers/Stream.d.ts +1 -3
- package/dist/types/helpers/index.d.ts +0 -2
- package/dist/types/helpers/store.d.ts +2 -17
- package/dist/types/models/FlowSteps.d.ts +18 -13
- package/dist/types/models/IDevice.d.ts +32 -9
- package/dist/types/models/IEctStore.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { h /*getAssetPath*/ } from '@stencil/core';
|
|
2
|
-
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
2
|
import store from '../../../helpers/store';
|
|
4
3
|
import { Stream } from '../../../helpers/Stream';
|
|
5
4
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
6
5
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
7
6
|
import { getLogMessage } from '../../../utils/utils';
|
|
7
|
+
import { BaseComponent } from '../../base-component';
|
|
8
8
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
9
9
|
export class IdDoubleSide {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.device = undefined;
|
|
12
11
|
this.showTimeout = undefined;
|
|
13
12
|
this.showInvalid = undefined;
|
|
14
13
|
this.showHowTo = undefined;
|
|
@@ -24,7 +23,8 @@ export class IdDoubleSide {
|
|
|
24
23
|
recordingFileName: '',
|
|
25
24
|
recordingUploadType: '',
|
|
26
25
|
};
|
|
27
|
-
this.
|
|
26
|
+
this.baseComponent = new BaseComponent(FlowSteps.CiBack);
|
|
27
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
28
28
|
}
|
|
29
29
|
componentWillLoad() {
|
|
30
30
|
this.captureRetryCount = 0;
|
|
@@ -61,7 +61,7 @@ export class IdDoubleSide {
|
|
|
61
61
|
async captureIdImage(event) {
|
|
62
62
|
let idPhoto = event.detail;
|
|
63
63
|
if (idPhoto.length == 0 || idPhoto.size == 0) {
|
|
64
|
-
await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
64
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
@@ -75,7 +75,7 @@ export class IdDoubleSide {
|
|
|
75
75
|
async captureIdBackImage(event) {
|
|
76
76
|
let idPhoto = event.detail;
|
|
77
77
|
if (idPhoto.length == 0 || idPhoto.size == 0) {
|
|
78
|
-
await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
78
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
try {
|
|
@@ -89,7 +89,7 @@ export class IdDoubleSide {
|
|
|
89
89
|
async capturedIdRecording(event) {
|
|
90
90
|
let idRecording = event.detail;
|
|
91
91
|
if (idRecording.length == 0 || idRecording.size == 0) {
|
|
92
|
-
await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
|
|
92
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
@@ -98,51 +98,53 @@ export class IdDoubleSide {
|
|
|
98
98
|
this.uploadRecording();
|
|
99
99
|
}
|
|
100
100
|
catch (e) {
|
|
101
|
-
|
|
101
|
+
if (store.recordingRetryCount < 3) {
|
|
102
|
+
store.recordingRetryCount++;
|
|
103
|
+
this.triggerErrorFlow();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.apiErrorEvent.emit(e);
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
async verificationFinished(_event) {
|
|
105
111
|
this.flow.verificationFinished = true;
|
|
106
|
-
this.endFlow();
|
|
112
|
+
await this.endFlow();
|
|
107
113
|
}
|
|
108
114
|
async componentDidLoad() {
|
|
109
|
-
|
|
110
|
-
await this.apiCall.AddStep(FlowSteps.CiBack);
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
this.apiErrorEvent.emit(e);
|
|
114
|
-
}
|
|
115
|
+
await this.baseComponent.initialize();
|
|
115
116
|
}
|
|
116
117
|
async uploadPhoto() {
|
|
117
118
|
if (this.flow.photoFile == null || this.flow.photoDone) {
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
this.flow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
|
|
121
|
+
this.flow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
|
|
121
122
|
if (this.flow.photoDone) {
|
|
122
|
-
this.endFlow();
|
|
123
|
+
await this.endFlow();
|
|
123
124
|
}
|
|
124
125
|
else {
|
|
125
|
-
this.flow.photoFile = null;
|
|
126
|
-
this.flow.recordingFile = null;
|
|
127
126
|
this.switchCamera();
|
|
128
|
-
this.
|
|
127
|
+
this.triggerErrorFlow();
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
async uploadRecording() {
|
|
132
131
|
if (this.flow.recordingFile == null || this.flow.recordingDone) {
|
|
133
132
|
return;
|
|
134
133
|
}
|
|
135
|
-
this.flow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
|
|
134
|
+
this.flow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
|
|
136
135
|
if (this.flow.recordingDone) {
|
|
137
|
-
this.endFlow();
|
|
136
|
+
await this.endFlow();
|
|
138
137
|
}
|
|
139
138
|
else {
|
|
140
|
-
this.
|
|
141
|
-
this.flow.recordingFile = null;
|
|
142
|
-
this.showInvalid = true;
|
|
139
|
+
this.triggerErrorFlow();
|
|
143
140
|
}
|
|
144
141
|
}
|
|
145
|
-
|
|
142
|
+
triggerErrorFlow() {
|
|
143
|
+
this.flow.photoFile = null;
|
|
144
|
+
this.flow.recordingFile = null;
|
|
145
|
+
this.showInvalid = true;
|
|
146
|
+
}
|
|
147
|
+
async endFlow() {
|
|
146
148
|
if (!this.flow.photoDone) {
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
@@ -165,6 +167,8 @@ export class IdDoubleSide {
|
|
|
165
167
|
if (!this.flow.verificationFinished) {
|
|
166
168
|
return;
|
|
167
169
|
}
|
|
170
|
+
store.recordingRetryCount = 0;
|
|
171
|
+
await this.baseComponent.finalize();
|
|
168
172
|
store.flowStatus = FlowStatus.LIVENESS;
|
|
169
173
|
}
|
|
170
174
|
switchCamera() {
|
|
@@ -179,8 +183,8 @@ export class IdDoubleSide {
|
|
|
179
183
|
}
|
|
180
184
|
render() {
|
|
181
185
|
let error = h("capture-error", { type: "ID" });
|
|
182
|
-
let frontCapture = h("id-capture", { id: "idFront"
|
|
183
|
-
let secondCapture = h("id-back-capture", { id: "idBack"
|
|
186
|
+
let frontCapture = h("id-capture", { id: "idFront" });
|
|
187
|
+
let secondCapture = h("id-back-capture", { id: "idBack" });
|
|
184
188
|
let howToInfo = h("how-to-info", { idSide: this.front ? 'front' : 'back' });
|
|
185
189
|
return this.showHowTo ? howToInfo : this.showInvalid || this.showTimeout ? error : this.front ? frontCapture : secondCapture;
|
|
186
190
|
}
|
|
@@ -195,30 +199,6 @@ export class IdDoubleSide {
|
|
|
195
199
|
"$": ["id-double-side.css"]
|
|
196
200
|
};
|
|
197
201
|
}
|
|
198
|
-
static get properties() {
|
|
199
|
-
return {
|
|
200
|
-
"device": {
|
|
201
|
-
"type": "unknown",
|
|
202
|
-
"mutable": false,
|
|
203
|
-
"complexType": {
|
|
204
|
-
"original": "Device",
|
|
205
|
-
"resolved": "Device",
|
|
206
|
-
"references": {
|
|
207
|
-
"Device": {
|
|
208
|
-
"location": "import",
|
|
209
|
-
"path": "../../../models/IDevice"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
"required": false,
|
|
214
|
-
"optional": false,
|
|
215
|
-
"docs": {
|
|
216
|
-
"tags": [],
|
|
217
|
-
"text": ""
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
202
|
static get states() {
|
|
223
203
|
return {
|
|
224
204
|
"showTimeout": {},
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { h /*getAssetPath*/ } from '@stencil/core';
|
|
2
|
-
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
2
|
import store from '../../../helpers/store';
|
|
4
3
|
import { Stream } from '../../../helpers/Stream';
|
|
5
4
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
6
5
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
7
6
|
import { getLogMessage } from '../../../utils/utils';
|
|
7
|
+
import { BaseComponent } from '../../base-component';
|
|
8
8
|
// import { IDPose } from '../../libs/IDML5Detector/IDPose';
|
|
9
9
|
export class IdSingleSide {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.device = undefined;
|
|
12
11
|
this.showTimeout = undefined;
|
|
13
12
|
this.showHowTo = undefined;
|
|
14
13
|
this.idFlow = {
|
|
@@ -18,7 +17,8 @@ export class IdSingleSide {
|
|
|
18
17
|
photoFile: null,
|
|
19
18
|
recordingFile: null,
|
|
20
19
|
};
|
|
21
|
-
this.
|
|
20
|
+
this.baseComponent = new BaseComponent(FlowSteps.CiFront);
|
|
21
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
22
22
|
this.captureRetryCount = 0;
|
|
23
23
|
this.showHowTo = true;
|
|
24
24
|
}
|
|
@@ -36,7 +36,7 @@ export class IdSingleSide {
|
|
|
36
36
|
async captureIdImage(event) {
|
|
37
37
|
let idPhoto = event.detail;
|
|
38
38
|
if (idPhoto.length == 0 || idPhoto.size == 0) {
|
|
39
|
-
await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
39
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
@@ -49,12 +49,12 @@ export class IdSingleSide {
|
|
|
49
49
|
}
|
|
50
50
|
async verificationFinished(_event) {
|
|
51
51
|
this.idFlow.verificationFinished = true;
|
|
52
|
-
this.endFlow();
|
|
52
|
+
await this.endFlow();
|
|
53
53
|
}
|
|
54
54
|
async capturedIdRecording(event) {
|
|
55
55
|
let idRecording = event.detail;
|
|
56
56
|
if (idRecording.length == 0 || idRecording.size == 0) {
|
|
57
|
-
await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
|
|
57
|
+
await this.baseComponent.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording }, getLogMessage());
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
|
|
@@ -69,20 +69,15 @@ export class IdSingleSide {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
async componentDidLoad() {
|
|
72
|
-
|
|
73
|
-
await this.apiCall.AddStep(FlowSteps.CiFront);
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
this.apiErrorEvent.emit(e);
|
|
77
|
-
}
|
|
72
|
+
await this.baseComponent.initialize();
|
|
78
73
|
}
|
|
79
74
|
async uploadPhoto() {
|
|
80
75
|
if (this.idFlow.photoFile == null || this.idFlow.photoDone) {
|
|
81
76
|
return;
|
|
82
77
|
}
|
|
83
|
-
this.idFlow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFront', this.idFlow.photoFile);
|
|
78
|
+
this.idFlow.photoDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'IdFront', this.idFlow.photoFile);
|
|
84
79
|
if (this.idFlow.photoDone) {
|
|
85
|
-
this.endFlow();
|
|
80
|
+
await this.endFlow();
|
|
86
81
|
}
|
|
87
82
|
else {
|
|
88
83
|
this.idFlow.photoFile = null;
|
|
@@ -95,9 +90,9 @@ export class IdSingleSide {
|
|
|
95
90
|
if (this.idFlow.recordingFile == null || this.idFlow.recordingDone) {
|
|
96
91
|
return;
|
|
97
92
|
}
|
|
98
|
-
this.idFlow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
|
|
93
|
+
this.idFlow.recordingDone = await this.baseComponent.apiCall.UploadFileForRequestB64(store.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
|
|
99
94
|
if (this.idFlow.recordingDone) {
|
|
100
|
-
this.endFlow();
|
|
95
|
+
await this.endFlow();
|
|
101
96
|
}
|
|
102
97
|
else {
|
|
103
98
|
this.idFlow.photoFile = null;
|
|
@@ -105,7 +100,7 @@ export class IdSingleSide {
|
|
|
105
100
|
this.showTimeout = true;
|
|
106
101
|
}
|
|
107
102
|
}
|
|
108
|
-
endFlow() {
|
|
103
|
+
async endFlow() {
|
|
109
104
|
if (!this.idFlow.photoDone) {
|
|
110
105
|
return;
|
|
111
106
|
}
|
|
@@ -115,6 +110,7 @@ export class IdSingleSide {
|
|
|
115
110
|
if (!this.idFlow.verificationFinished) {
|
|
116
111
|
return;
|
|
117
112
|
}
|
|
113
|
+
await this.baseComponent.finalize();
|
|
118
114
|
store.flowStatus = FlowStatus.LIVENESS;
|
|
119
115
|
}
|
|
120
116
|
switchCamera() {
|
|
@@ -129,7 +125,7 @@ export class IdSingleSide {
|
|
|
129
125
|
}
|
|
130
126
|
render() {
|
|
131
127
|
let error = h("capture-error", { type: "ID" });
|
|
132
|
-
let capture = h("id-capture", { id: "idFront"
|
|
128
|
+
let capture = h("id-capture", { id: "idFront" });
|
|
133
129
|
let howToInfo = h("how-to-info", { idSide: "front" });
|
|
134
130
|
return this.showHowTo ? howToInfo : this.showTimeout ? error : capture;
|
|
135
131
|
}
|
|
@@ -144,30 +140,6 @@ export class IdSingleSide {
|
|
|
144
140
|
"$": ["id-single-side.css"]
|
|
145
141
|
};
|
|
146
142
|
}
|
|
147
|
-
static get properties() {
|
|
148
|
-
return {
|
|
149
|
-
"device": {
|
|
150
|
-
"type": "unknown",
|
|
151
|
-
"mutable": false,
|
|
152
|
-
"complexType": {
|
|
153
|
-
"original": "Device",
|
|
154
|
-
"resolved": "Device",
|
|
155
|
-
"references": {
|
|
156
|
-
"Device": {
|
|
157
|
-
"location": "import",
|
|
158
|
-
"path": "../../../models/IDevice"
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"required": false,
|
|
163
|
-
"optional": false,
|
|
164
|
-
"docs": {
|
|
165
|
-
"tags": [],
|
|
166
|
-
"text": ""
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
143
|
static get states() {
|
|
172
144
|
return {
|
|
173
145
|
"showTimeout": {},
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { LandingValues, SessionKeys } from '../../../helpers/textValues';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import info from '../../../assets/landing/info.svg';
|
|
5
|
-
import idSvg from '../../../assets/landing/id.svg';
|
|
6
|
-
import idDevice from '../../../assets/landing/device.svg';
|
|
7
|
-
import idValidation from '../../../assets/landing/validation.svg';
|
|
8
3
|
import store from '../../../helpers/store';
|
|
9
4
|
import Events from '../../../helpers/Events';
|
|
10
5
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
11
6
|
import { ApiCall } from '../../../helpers/ApiCall';
|
|
12
7
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
13
8
|
import { Cameras } from '../../../helpers/Cameras';
|
|
9
|
+
import { BaseComponent } from '../../base-component';
|
|
10
|
+
import { MobileOS } from '../../../models/IDevice';
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import info from '../../../assets/landing/info.svg';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import idSvg from '../../../assets/landing/id.svg';
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
import idValidation from '../../../assets/landing/validation.svg';
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
import idDevice from '../../../assets/landing/device.svg';
|
|
14
19
|
export class LandingValidation {
|
|
15
20
|
constructor() {
|
|
16
|
-
this.device = undefined;
|
|
17
21
|
this.warningText = undefined;
|
|
18
22
|
this.buttonDisabled = undefined;
|
|
23
|
+
this.baseComponent = new BaseComponent(FlowSteps.Landing);
|
|
24
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
19
25
|
}
|
|
20
26
|
async componentWillLoad() {
|
|
21
|
-
this.apiCall = new ApiCall();
|
|
27
|
+
this.baseComponent.apiCall = new ApiCall();
|
|
22
28
|
this.buttonDisabled = false;
|
|
23
29
|
await this.initRequest();
|
|
24
30
|
}
|
|
@@ -26,12 +32,7 @@ export class LandingValidation {
|
|
|
26
32
|
Events.init(window);
|
|
27
33
|
Events.flowStarted();
|
|
28
34
|
if (store.environment !== 'DEMO') {
|
|
29
|
-
|
|
30
|
-
await this.apiCall.AddStep(FlowSteps.Landing);
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
this.apiErrorEvent.emit(e);
|
|
34
|
-
}
|
|
35
|
+
await this.baseComponent.initialize();
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
async initRequest() {
|
|
@@ -49,8 +50,9 @@ export class LandingValidation {
|
|
|
49
50
|
store.flowStatus = FlowStatus.COMPLETE;
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
await this.baseComponent.finalize();
|
|
54
|
+
if (!(await Cameras.InitCameras(store.device))) {
|
|
55
|
+
if (store.device.mobileOS == MobileOS.iOS)
|
|
54
56
|
sessionStorage.setItem(SessionKeys.RefreshDoneKey, 'false');
|
|
55
57
|
store.flowStatus = FlowStatus.CAMERAERROR;
|
|
56
58
|
}
|
|
@@ -70,7 +72,8 @@ export class LandingValidation {
|
|
|
70
72
|
return;
|
|
71
73
|
store.initialised = false;
|
|
72
74
|
try {
|
|
73
|
-
await this.apiCall.AbortRequest();
|
|
75
|
+
await this.baseComponent.apiCall.AbortRequest();
|
|
76
|
+
await this.baseComponent.finalize();
|
|
74
77
|
Events.flowAborted();
|
|
75
78
|
}
|
|
76
79
|
catch (e) {
|
|
@@ -92,30 +95,6 @@ export class LandingValidation {
|
|
|
92
95
|
"$": ["landing-validation.css"]
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
|
-
static get properties() {
|
|
96
|
-
return {
|
|
97
|
-
"device": {
|
|
98
|
-
"type": "unknown",
|
|
99
|
-
"mutable": false,
|
|
100
|
-
"complexType": {
|
|
101
|
-
"original": "Device",
|
|
102
|
-
"resolved": "Device",
|
|
103
|
-
"references": {
|
|
104
|
-
"Device": {
|
|
105
|
-
"location": "import",
|
|
106
|
-
"path": "../../../models/IDevice"
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
"required": false,
|
|
111
|
-
"optional": false,
|
|
112
|
-
"docs": {
|
|
113
|
-
"tags": [],
|
|
114
|
-
"text": ""
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
98
|
static get states() {
|
|
120
99
|
return {
|
|
121
100
|
"warningText": {},
|
|
@@ -2,12 +2,12 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
import { MobileRedirectValues } from '../../../helpers/textValues';
|
|
3
3
|
import QRCode from 'qrcode';
|
|
4
4
|
import store from '../../../helpers/store';
|
|
5
|
-
import { ApiCall } from '../../../helpers/ApiCall';
|
|
6
5
|
import Events from '../../../helpers/Events';
|
|
7
6
|
import { OrderStatuses } from '../../../models/OrderStatuses';
|
|
8
7
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
9
8
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
10
9
|
import { delay } from '../../../utils/utils';
|
|
10
|
+
import { BaseComponent } from '../../base-component';
|
|
11
11
|
export class MobileRedirect {
|
|
12
12
|
constructor() {
|
|
13
13
|
this.infoTextTop = undefined;
|
|
@@ -19,7 +19,8 @@ export class MobileRedirect {
|
|
|
19
19
|
this.redirectLink = undefined;
|
|
20
20
|
this.qrCode = undefined;
|
|
21
21
|
this.prefilledPhone = false;
|
|
22
|
-
this.
|
|
22
|
+
this.baseComponent = new BaseComponent(FlowSteps.MobileRedirect);
|
|
23
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
23
24
|
this.invalidValue = false;
|
|
24
25
|
this.waitingMobile = false;
|
|
25
26
|
}
|
|
@@ -43,12 +44,7 @@ export class MobileRedirect {
|
|
|
43
44
|
async componentDidLoad() {
|
|
44
45
|
Events.init(window);
|
|
45
46
|
Events.flowStarted();
|
|
46
|
-
|
|
47
|
-
await this.apiCall.AddStep(FlowSteps.MobileRedirect);
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
this.apiErrorEvent.emit(e);
|
|
51
|
-
}
|
|
47
|
+
await this.baseComponent.initialize();
|
|
52
48
|
await delay(5000);
|
|
53
49
|
await this.checkStatus();
|
|
54
50
|
while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
|
|
@@ -57,9 +53,10 @@ export class MobileRedirect {
|
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
async checkStatus() {
|
|
60
|
-
this.orderStatus = await this.apiCall.GetStatus(store.requestId);
|
|
56
|
+
this.orderStatus = await this.baseComponent.apiCall.GetStatus(store.requestId);
|
|
61
57
|
if (this.orderStatus == OrderStatuses.FinishedCapturing) {
|
|
62
58
|
this.waitingMobile = false;
|
|
59
|
+
await this.baseComponent.finalize();
|
|
63
60
|
store.flowStatus = FlowStatus.COMPLETE;
|
|
64
61
|
}
|
|
65
62
|
if (this.orderStatus == OrderStatuses.NotFound) {
|
|
@@ -83,7 +80,7 @@ export class MobileRedirect {
|
|
|
83
80
|
this.waitingMobile = true;
|
|
84
81
|
this.infoTextTop = MobileRedirectValues.InfoWaiting;
|
|
85
82
|
try {
|
|
86
|
-
await this.apiCall.SendLink(this.redirectLink, this.contact);
|
|
83
|
+
await this.baseComponent.apiCall.SendLink(this.redirectLink, this.contact);
|
|
87
84
|
}
|
|
88
85
|
catch (e) {
|
|
89
86
|
this.apiErrorEvent.emit(e);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
-
import { ApiCall } from '../../../helpers/ApiCall';
|
|
3
2
|
import store from '../../../helpers/store';
|
|
4
3
|
import { PhoneValidationValues, CodeValidationValues } from '../../../helpers/textValues';
|
|
5
4
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
6
5
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
6
|
+
import { BaseComponent } from '../../base-component';
|
|
7
7
|
export class SmsCodeValidation {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.title = undefined;
|
|
@@ -13,13 +13,20 @@ export class SmsCodeValidation {
|
|
|
13
13
|
this.code = undefined;
|
|
14
14
|
this.prefilledPhone = false;
|
|
15
15
|
this.canSend = false;
|
|
16
|
-
|
|
16
|
+
if (store.flowStatus == FlowStatus.PHONE) {
|
|
17
|
+
this.baseComponent = new BaseComponent(FlowSteps.OtpSend);
|
|
18
|
+
}
|
|
19
|
+
if (store.flowStatus == FlowStatus.CODE) {
|
|
20
|
+
this.baseComponent = new BaseComponent(FlowSteps.OtpCheck);
|
|
21
|
+
}
|
|
22
|
+
this.baseComponent.setEventEmitter(this.apiErrorEvent);
|
|
17
23
|
}
|
|
18
24
|
async doAction() {
|
|
19
25
|
try {
|
|
20
26
|
this.canSend = false;
|
|
27
|
+
await this.baseComponent.finalize();
|
|
21
28
|
if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
|
|
22
|
-
var codeChecked = await this.apiCall.CheckOTPCode(store.requestId, this.code);
|
|
29
|
+
var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(store.requestId, this.code);
|
|
23
30
|
if (codeChecked === true) {
|
|
24
31
|
store.flowStatus = FlowStatus.ID;
|
|
25
32
|
}
|
|
@@ -28,7 +35,7 @@ export class SmsCodeValidation {
|
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
if (store.flowStatus == FlowStatus.PHONE) {
|
|
31
|
-
var codeSent = await this.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
|
|
38
|
+
var codeSent = await this.baseComponent.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
|
|
32
39
|
if (codeSent === true) {
|
|
33
40
|
store.flowStatus = FlowStatus.CODE;
|
|
34
41
|
}
|
|
@@ -56,17 +63,7 @@ export class SmsCodeValidation {
|
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
async componentDidLoad() {
|
|
59
|
-
|
|
60
|
-
if (store.flowStatus == FlowStatus.PHONE) {
|
|
61
|
-
await this.apiCall.AddStep(FlowSteps.OtpSend);
|
|
62
|
-
}
|
|
63
|
-
if (store.flowStatus == FlowStatus.CODE) {
|
|
64
|
-
await this.apiCall.AddStep(FlowSteps.OtpCheck);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
this.apiErrorEvent.emit(e);
|
|
69
|
-
}
|
|
66
|
+
await this.baseComponent.initialize();
|
|
70
67
|
}
|
|
71
68
|
handleChangePhone(ev) {
|
|
72
69
|
let value = ev.target ? ev.target.value : '';
|