@ekyc_qoobiss/qbs-ect-cmp 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/dist/assets/canvas-masks/face_green.svg +8 -0
  4. package/dist/assets/canvas-masks/face_white.svg +8 -0
  5. package/dist/assets/canvas-masks/id_green.svg +6 -0
  6. package/dist/assets/canvas-masks/id_white.svg +6 -0
  7. package/dist/assets/complete.svg +4 -0
  8. package/dist/assets/landing/device.svg +14 -0
  9. package/dist/assets/landing/id.svg +3 -0
  10. package/dist/assets/landing/info.svg +3 -0
  11. package/dist/assets/landing/validation.svg +16 -0
  12. package/dist/assets/ml5-preload.png +0 -0
  13. package/dist/cjs/agreement-check_17.cjs.entry.js +9549 -0
  14. package/dist/cjs/index-79f82518.js +1568 -0
  15. package/dist/cjs/index.cjs.js +2 -0
  16. package/dist/cjs/loader-dots.cjs.entry.js +19 -0
  17. package/dist/cjs/loader.cjs.js +22 -0
  18. package/dist/cjs/qbs-ect-cmp.cjs.js +23 -0
  19. package/dist/collection/assets/canvas-masks/face_green.svg +8 -0
  20. package/dist/collection/assets/canvas-masks/face_white.svg +8 -0
  21. package/dist/collection/assets/canvas-masks/id_green.svg +6 -0
  22. package/dist/collection/assets/canvas-masks/id_white.svg +6 -0
  23. package/dist/collection/assets/complete.svg +4 -0
  24. package/dist/collection/assets/landing/device.svg +14 -0
  25. package/dist/collection/assets/landing/id.svg +3 -0
  26. package/dist/collection/assets/landing/info.svg +3 -0
  27. package/dist/collection/assets/landing/validation.svg +16 -0
  28. package/dist/collection/collection-manifest.json +29 -0
  29. package/dist/collection/components/common/agreement-check/agreement-check.css +0 -0
  30. package/dist/collection/components/common/agreement-check/agreement-check.js +95 -0
  31. package/dist/collection/components/common/capture-error/capture-error.css +0 -0
  32. package/dist/collection/components/common/capture-error/capture-error.js +73 -0
  33. package/dist/collection/components/common/how-to-info/how-to-info.css +0 -0
  34. package/dist/collection/components/common/how-to-info/how-to-info.js +98 -0
  35. package/dist/collection/components/common/id-back-capture/id-back-capture.css +35 -0
  36. package/dist/collection/components/common/id-back-capture/id-back-capture.js +212 -0
  37. package/dist/collection/components/common/id-capture/id-capture.css +35 -0
  38. package/dist/collection/components/common/id-capture/id-capture.js +213 -0
  39. package/dist/collection/components/common/selfie-capture/selfie-capture.css +7 -0
  40. package/dist/collection/components/common/selfie-capture/selfie-capture.js +222 -0
  41. package/dist/collection/components/controls/camera/camera.css +47 -0
  42. package/dist/collection/components/controls/camera/camera.js +309 -0
  43. package/dist/collection/components/controls/loader-dots/loader-dots.css +61 -0
  44. package/dist/collection/components/controls/loader-dots/loader-dots.js +18 -0
  45. package/dist/collection/components/flow/agreement-info/agreement-info.css +0 -0
  46. package/dist/collection/components/flow/agreement-info/agreement-info.js +73 -0
  47. package/dist/collection/components/flow/end-redirect/end-redirect.css +128 -0
  48. package/dist/collection/components/flow/end-redirect/end-redirect.js +26 -0
  49. package/dist/collection/components/flow/error-end/error-end.css +0 -0
  50. package/dist/collection/components/flow/error-end/error-end.js +64 -0
  51. package/dist/collection/components/flow/id-double-side/id-double-side.css +0 -0
  52. package/dist/collection/components/flow/id-double-side/id-double-side.js +284 -0
  53. package/dist/collection/components/flow/id-single-side/id-single-side.css +0 -0
  54. package/dist/collection/components/flow/id-single-side/id-single-side.js +225 -0
  55. package/dist/collection/components/flow/landing-validation/landing-validation.css +0 -0
  56. package/dist/collection/components/flow/landing-validation/landing-validation.js +88 -0
  57. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +10 -0
  58. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +128 -0
  59. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.css +0 -0
  60. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +115 -0
  61. package/dist/collection/components/flow/user-liveness/user-liveness.css +0 -0
  62. package/dist/collection/components/flow/user-liveness/user-liveness.js +214 -0
  63. package/dist/collection/components/identification-component/identification-component.css +1043 -0
  64. package/dist/collection/components/identification-component/identification-component.js +355 -0
  65. package/dist/collection/global.js +0 -0
  66. package/dist/collection/helpers/ApiCall.js +113 -0
  67. package/dist/collection/helpers/Cameras.js +98 -0
  68. package/dist/collection/helpers/Events.js +39 -0
  69. package/dist/collection/helpers/ML5.js +35 -0
  70. package/dist/collection/helpers/Stream.js +223 -0
  71. package/dist/collection/helpers/canvas.js +10 -0
  72. package/dist/collection/helpers/index.js +54 -0
  73. package/dist/collection/helpers/security.js +25 -0
  74. package/dist/collection/helpers/store.js +39 -0
  75. package/dist/collection/helpers/textValues.js +128 -0
  76. package/dist/collection/index.js +1 -0
  77. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +227 -0
  78. package/dist/collection/libs/FaceML5Detector/FacePose.js +85 -0
  79. package/dist/collection/libs/IDML5Detector/IDML5Detector.js +101 -0
  80. package/dist/collection/libs/IDML5Detector/IDPose.js +8 -0
  81. package/dist/collection/models/FlowStatus.js +12 -0
  82. package/dist/collection/models/IAddRequest.js +1 -0
  83. package/dist/collection/models/IAgreement.js +1 -0
  84. package/dist/collection/models/ICamera.js +1 -0
  85. package/dist/collection/models/IConstraints.js +1 -0
  86. package/dist/collection/models/IDevice.js +1 -0
  87. package/dist/collection/models/IGeneration.js +1 -0
  88. package/dist/collection/models/ILinkSend.js +1 -0
  89. package/dist/collection/models/ILogResult.js +1 -0
  90. package/dist/collection/models/IOrderStatus.js +1 -0
  91. package/dist/collection/models/IOtpCheck.js +1 -0
  92. package/dist/collection/models/IOtpSend.js +1 -0
  93. package/dist/collection/models/IUploadFile.js +1 -0
  94. package/dist/collection/models/OrderStatuses.js +7 -0
  95. package/dist/collection/utils/utils.js +10 -0
  96. package/dist/esm/agreement-check_17.entry.js +9529 -0
  97. package/dist/esm/index-9d69e511.js +1538 -0
  98. package/dist/esm/index.js +1 -0
  99. package/dist/esm/loader-dots.entry.js +15 -0
  100. package/dist/esm/loader.js +18 -0
  101. package/dist/esm/polyfills/core-js.js +11 -0
  102. package/dist/esm/polyfills/css-shim.js +1 -0
  103. package/dist/esm/polyfills/dom.js +79 -0
  104. package/dist/esm/polyfills/es5-html-element.js +1 -0
  105. package/dist/esm/polyfills/index.js +34 -0
  106. package/dist/esm/polyfills/system.js +6 -0
  107. package/dist/esm/qbs-ect-cmp.js +18 -0
  108. package/dist/index.cjs.js +1 -0
  109. package/dist/index.js +1 -0
  110. package/dist/loader/cdn.js +3 -0
  111. package/dist/loader/index.cjs.js +3 -0
  112. package/dist/loader/index.d.ts +21 -0
  113. package/dist/loader/index.es2017.js +3 -0
  114. package/dist/loader/index.js +4 -0
  115. package/dist/loader/package.json +11 -0
  116. package/dist/qbs-ect-cmp/index.esm.js +0 -0
  117. package/dist/qbs-ect-cmp/p-06e42b28.js +2 -0
  118. package/dist/qbs-ect-cmp/p-4c8e922b.entry.js +1 -0
  119. package/dist/qbs-ect-cmp/p-b65cc797.entry.js +1373 -0
  120. package/dist/qbs-ect-cmp/qbs-ect-cmp.css +1 -0
  121. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -0
  122. package/dist/types/components/common/agreement-check/agreement-check.d.ts +12 -0
  123. package/dist/types/components/common/capture-error/capture-error.d.ts +10 -0
  124. package/dist/types/components/common/how-to-info/how-to-info.d.ts +12 -0
  125. package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +28 -0
  126. package/dist/types/components/common/id-capture/id-capture.d.ts +28 -0
  127. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +30 -0
  128. package/dist/types/components/controls/camera/camera.d.ts +33 -0
  129. package/dist/types/components/controls/loader-dots/loader-dots.d.ts +3 -0
  130. package/dist/types/components/flow/agreement-info/agreement-info.d.ts +13 -0
  131. package/dist/types/components/flow/end-redirect/end-redirect.d.ts +4 -0
  132. package/dist/types/components/flow/error-end/error-end.d.ts +6 -0
  133. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +27 -0
  134. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +23 -0
  135. package/dist/types/components/flow/landing-validation/landing-validation.d.ts +10 -0
  136. package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +22 -0
  137. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +16 -0
  138. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +22 -0
  139. package/dist/types/components/identification-component/identification-component.d.ts +24 -0
  140. package/dist/types/components.d.ts +370 -0
  141. package/dist/types/global.d.ts +0 -0
  142. package/dist/types/helpers/ApiCall.d.ts +19 -0
  143. package/dist/types/helpers/Cameras.d.ts +8 -0
  144. package/dist/types/helpers/Events.d.ts +8 -0
  145. package/dist/types/helpers/ML5.d.ts +10 -0
  146. package/dist/types/helpers/Stream.d.ts +70 -0
  147. package/dist/types/helpers/canvas.d.ts +2 -0
  148. package/dist/types/helpers/index.d.ts +4 -0
  149. package/dist/types/helpers/security.d.ts +4 -0
  150. package/dist/types/helpers/store.d.ts +16 -0
  151. package/dist/types/helpers/textValues.d.ts +107 -0
  152. package/dist/types/index.d.ts +1 -0
  153. package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +40 -0
  154. package/dist/types/libs/FaceML5Detector/FacePose.d.ts +36 -0
  155. package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +22 -0
  156. package/dist/types/libs/IDML5Detector/IDPose.d.ts +7 -0
  157. package/dist/types/models/FlowStatus.d.ts +11 -0
  158. package/dist/types/models/IAddRequest.d.ts +6 -0
  159. package/dist/types/models/IAgreement.d.ts +3 -0
  160. package/dist/types/models/ICamera.d.ts +10 -0
  161. package/dist/types/models/IConstraints.d.ts +21 -0
  162. package/dist/types/models/IDevice.d.ts +11 -0
  163. package/dist/types/models/IGeneration.d.ts +3 -0
  164. package/dist/types/models/ILinkSend.d.ts +3 -0
  165. package/dist/types/models/ILogResult.d.ts +3 -0
  166. package/dist/types/models/IOrderStatus.d.ts +4 -0
  167. package/dist/types/models/IOtpCheck.d.ts +3 -0
  168. package/dist/types/models/IOtpSend.d.ts +3 -0
  169. package/dist/types/models/IUploadFile.d.ts +4 -0
  170. package/dist/types/models/OrderStatuses.d.ts +6 -0
  171. package/dist/types/stencil-public-runtime.d.ts +1637 -0
  172. package/dist/types/utils/utils.d.ts +2 -0
  173. package/package.json +52 -0
@@ -0,0 +1,64 @@
1
+ import { h } from '@stencil/core';
2
+ import Events from '../../../helpers/Events';
3
+ export class ErrorEnd {
4
+ constructor() {
5
+ this.message = undefined;
6
+ this.errorTitle = undefined;
7
+ }
8
+ componentDidLoad() {
9
+ Events.init(window);
10
+ Events.flowError(this.errorTitle + ' ' + this.message);
11
+ }
12
+ render() {
13
+ return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "text-center" }, h("h1", null, this.errorTitle)), h("div", null, h("p", { class: "color-red font-weight-bold font-size-2 text-center mt-10" }, this.message)))));
14
+ }
15
+ static get is() { return "error-end"; }
16
+ static get originalStyleUrls() {
17
+ return {
18
+ "$": ["error-end.css"]
19
+ };
20
+ }
21
+ static get styleUrls() {
22
+ return {
23
+ "$": ["error-end.css"]
24
+ };
25
+ }
26
+ static get properties() {
27
+ return {
28
+ "message": {
29
+ "type": "string",
30
+ "mutable": false,
31
+ "complexType": {
32
+ "original": "string",
33
+ "resolved": "string",
34
+ "references": {}
35
+ },
36
+ "required": false,
37
+ "optional": false,
38
+ "docs": {
39
+ "tags": [],
40
+ "text": ""
41
+ },
42
+ "attribute": "message",
43
+ "reflect": false
44
+ },
45
+ "errorTitle": {
46
+ "type": "string",
47
+ "mutable": false,
48
+ "complexType": {
49
+ "original": "string",
50
+ "resolved": "string",
51
+ "references": {}
52
+ },
53
+ "required": false,
54
+ "optional": false,
55
+ "docs": {
56
+ "tags": [],
57
+ "text": ""
58
+ },
59
+ "attribute": "error-title",
60
+ "reflect": false
61
+ }
62
+ };
63
+ }
64
+ }
@@ -0,0 +1,284 @@
1
+ import { h /*getAssetPath*/ } from '@stencil/core';
2
+ import { ApiCall } from '../../../helpers/ApiCall';
3
+ import store from '../../../helpers/store';
4
+ import { Stream } from '../../../helpers/Stream';
5
+ import { FlowStatus } from '../../../models/FlowStatus';
6
+ // import { IDPose } from '../../libs/IDML5Detector/IDPose';
7
+ export class IdDoubleSide {
8
+ constructor() {
9
+ this.device = undefined;
10
+ this.showTimeout = undefined;
11
+ this.showInvalid = undefined;
12
+ this.showHowTo = undefined;
13
+ this.front = undefined;
14
+ this.flow = {
15
+ photoDone: false,
16
+ recordingDone: false,
17
+ verificationFinished: false,
18
+ photoFile: null,
19
+ photoFileName: '',
20
+ photoUploadType: '',
21
+ recordingFile: null,
22
+ recordingFileName: '',
23
+ recordingUploadType: '',
24
+ };
25
+ this.apiCall = new ApiCall();
26
+ }
27
+ componentWillLoad() {
28
+ this.captureRetryCount = 0;
29
+ this.showHowTo = true;
30
+ this.flow.photoFileName = 'idImage.png';
31
+ this.flow.recordingFileName = 'idVideo.';
32
+ this.flow.photoUploadType = 'IdFront';
33
+ this.flow.recordingUploadType = 'IdFrontVideo';
34
+ this.front = true;
35
+ }
36
+ howToDone() {
37
+ this.showHowTo = false;
38
+ }
39
+ timeElapsed() {
40
+ this.showTimeout = true;
41
+ }
42
+ captureErrorDone() {
43
+ if (this.showTimeout == true) {
44
+ this.showTimeout = false;
45
+ }
46
+ if (this.showInvalid == true) {
47
+ this.flow.photoFileName = 'idImage.png';
48
+ this.flow.recordingFileName = 'idVideo.';
49
+ this.flow.photoUploadType = 'IdFront';
50
+ this.flow.recordingUploadType = 'IdFrontVideo';
51
+ this.flow.photoFile = null;
52
+ this.flow.recordingFile = null;
53
+ this.flow.photoDone = false;
54
+ this.flow.recordingDone = false;
55
+ this.front = true;
56
+ this.showInvalid = false;
57
+ }
58
+ }
59
+ async captureIdImage(event) {
60
+ let idPhoto = event.detail;
61
+ if (idPhoto.length == 0 || idPhoto.size == 0) {
62
+ await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto });
63
+ return;
64
+ }
65
+ try {
66
+ this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
67
+ this.uploadPhoto();
68
+ }
69
+ catch (e) {
70
+ this.apiErrorEvent.emit(e);
71
+ }
72
+ }
73
+ async captureIdBackImage(event) {
74
+ let idPhoto = event.detail;
75
+ if (idPhoto.length == 0 || idPhoto.size == 0) {
76
+ await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto });
77
+ return;
78
+ }
79
+ try {
80
+ this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
81
+ this.uploadPhoto();
82
+ }
83
+ catch (e) {
84
+ this.apiErrorEvent.emit(e);
85
+ }
86
+ }
87
+ async capturedIdRecording(event) {
88
+ let idRecording = event.detail;
89
+ if (idRecording.length == 0 || idRecording.size == 0) {
90
+ await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording });
91
+ return;
92
+ }
93
+ let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
94
+ try {
95
+ this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + mimeType.extension, { type: mimeType.type });
96
+ this.uploadRecording();
97
+ }
98
+ catch (e) {
99
+ this.apiErrorEvent.emit(e);
100
+ }
101
+ }
102
+ async verificationFinished(_event) {
103
+ this.flow.verificationFinished = true;
104
+ this.endFlow();
105
+ }
106
+ async uploadPhoto() {
107
+ if (this.flow.photoFile == null || this.flow.photoDone) {
108
+ return;
109
+ }
110
+ this.flow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
111
+ if (this.flow.photoDone) {
112
+ this.endFlow();
113
+ }
114
+ else {
115
+ this.flow.photoFile = null;
116
+ this.flow.recordingFile = null;
117
+ this.switchCamera();
118
+ this.showInvalid = true;
119
+ }
120
+ }
121
+ async uploadRecording() {
122
+ if (this.flow.recordingFile == null || this.flow.recordingDone) {
123
+ return;
124
+ }
125
+ this.flow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
126
+ if (this.flow.recordingDone) {
127
+ this.endFlow();
128
+ }
129
+ else {
130
+ this.flow.photoFile = null;
131
+ this.flow.recordingFile = null;
132
+ this.showInvalid = true;
133
+ }
134
+ }
135
+ endFlow() {
136
+ if (!this.flow.photoDone) {
137
+ return;
138
+ }
139
+ if (!this.flow.recordingDone) {
140
+ return;
141
+ }
142
+ if (this.front) {
143
+ this.flow.photoFileName = 'idBackImage.png';
144
+ this.flow.recordingFileName = 'idBackVideo.';
145
+ this.flow.photoUploadType = 'IdBack';
146
+ this.flow.recordingUploadType = 'IdBackVideo';
147
+ this.flow.photoFile = null;
148
+ this.flow.recordingFile = null;
149
+ this.flow.photoDone = false;
150
+ this.flow.recordingDone = false;
151
+ this.front = false;
152
+ this.showHowTo = true;
153
+ return;
154
+ }
155
+ if (!this.flow.verificationFinished) {
156
+ return;
157
+ }
158
+ store.flowStatus = FlowStatus.LIVENESS;
159
+ }
160
+ switchCamera() {
161
+ if (this.captureRetryCount == 2) {
162
+ let camIndex = store.cameraIds.indexOf(store.cameraId);
163
+ store.cameraId = camIndex === store.cameraIds.length - 1 ? store.cameraIds[0] : store.cameraIds[camIndex + 1];
164
+ this.captureRetryCount = 0;
165
+ }
166
+ else {
167
+ this.captureRetryCount++;
168
+ }
169
+ }
170
+ render() {
171
+ let error = h("capture-error", { type: "ID" });
172
+ let frontCapture = h("id-capture", { id: "idFront", device: this.device });
173
+ let secondCapture = h("id-back-capture", { id: "idBack", device: this.device });
174
+ let howToInfo = h("how-to-info", { idSide: this.front ? 'front' : 'back' });
175
+ return this.showHowTo ? howToInfo : this.showInvalid || this.showTimeout ? error : this.front ? frontCapture : secondCapture;
176
+ }
177
+ static get is() { return "id-double-side"; }
178
+ static get originalStyleUrls() {
179
+ return {
180
+ "$": ["id-double-side.css"]
181
+ };
182
+ }
183
+ static get styleUrls() {
184
+ return {
185
+ "$": ["id-double-side.css"]
186
+ };
187
+ }
188
+ static get properties() {
189
+ return {
190
+ "device": {
191
+ "type": "unknown",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "Device",
195
+ "resolved": "Device",
196
+ "references": {
197
+ "Device": {
198
+ "location": "import",
199
+ "path": "../../../models/IDevice"
200
+ }
201
+ }
202
+ },
203
+ "required": false,
204
+ "optional": false,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": ""
208
+ }
209
+ }
210
+ };
211
+ }
212
+ static get states() {
213
+ return {
214
+ "showTimeout": {},
215
+ "showInvalid": {},
216
+ "showHowTo": {},
217
+ "front": {},
218
+ "flow": {}
219
+ };
220
+ }
221
+ static get events() {
222
+ return [{
223
+ "method": "apiErrorEvent",
224
+ "name": "apiError",
225
+ "bubbles": true,
226
+ "cancelable": true,
227
+ "composed": true,
228
+ "docs": {
229
+ "tags": [],
230
+ "text": ""
231
+ },
232
+ "complexType": {
233
+ "original": "any",
234
+ "resolved": "any",
235
+ "references": {}
236
+ }
237
+ }];
238
+ }
239
+ static get listeners() {
240
+ return [{
241
+ "name": "howToInfoDone",
242
+ "method": "howToDone",
243
+ "target": undefined,
244
+ "capture": false,
245
+ "passive": false
246
+ }, {
247
+ "name": "timeElapsed",
248
+ "method": "timeElapsed",
249
+ "target": undefined,
250
+ "capture": false,
251
+ "passive": false
252
+ }, {
253
+ "name": "captureErrorDone",
254
+ "method": "captureErrorDone",
255
+ "target": undefined,
256
+ "capture": false,
257
+ "passive": false
258
+ }, {
259
+ "name": "photoIdCapture",
260
+ "method": "captureIdImage",
261
+ "target": undefined,
262
+ "capture": false,
263
+ "passive": false
264
+ }, {
265
+ "name": "photoIdBackCapture",
266
+ "method": "captureIdBackImage",
267
+ "target": undefined,
268
+ "capture": false,
269
+ "passive": false
270
+ }, {
271
+ "name": "recordingIdCapture",
272
+ "method": "capturedIdRecording",
273
+ "target": undefined,
274
+ "capture": false,
275
+ "passive": false
276
+ }, {
277
+ "name": "verificationFinished",
278
+ "method": "verificationFinished",
279
+ "target": undefined,
280
+ "capture": false,
281
+ "passive": false
282
+ }];
283
+ }
284
+ }
@@ -0,0 +1,225 @@
1
+ import { h /*getAssetPath*/ } from '@stencil/core';
2
+ import { ApiCall } from '../../../helpers/ApiCall';
3
+ import store from '../../../helpers/store';
4
+ import { Stream } from '../../../helpers/Stream';
5
+ import { FlowStatus } from '../../../models/FlowStatus';
6
+ // import { IDPose } from '../../libs/IDML5Detector/IDPose';
7
+ export class IdSingleSide {
8
+ constructor() {
9
+ this.device = undefined;
10
+ this.showTimeout = undefined;
11
+ this.showHowTo = undefined;
12
+ this.idFlow = {
13
+ verificationFinished: false,
14
+ photoDone: false,
15
+ recordingDone: false,
16
+ photoFile: null,
17
+ recordingFile: null,
18
+ };
19
+ this.apiCall = new ApiCall();
20
+ this.captureRetryCount = 0;
21
+ this.showHowTo = true;
22
+ }
23
+ captureErrorDone() {
24
+ this.idFlow.photoFile = null;
25
+ this.idFlow.recordingFile = null;
26
+ this.showTimeout = false;
27
+ }
28
+ howToDone() {
29
+ this.showHowTo = false;
30
+ }
31
+ timeElapsed() {
32
+ this.showTimeout = true;
33
+ }
34
+ async captureIdImage(event) {
35
+ let idPhoto = event.detail;
36
+ if (idPhoto.length == 0 || idPhoto.size == 0) {
37
+ await this.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto });
38
+ return;
39
+ }
40
+ try {
41
+ this.idFlow.photoFile = new File([idPhoto], 'idImage.png', { type: 'image/png' });
42
+ await this.uploadPhoto();
43
+ }
44
+ catch (e) {
45
+ this.apiErrorEvent.emit(e);
46
+ }
47
+ }
48
+ async verificationFinished(_event) {
49
+ this.idFlow.verificationFinished = true;
50
+ this.endFlow();
51
+ }
52
+ async capturedIdRecording(event) {
53
+ let idRecording = event.detail;
54
+ if (idRecording.length == 0 || idRecording.size == 0) {
55
+ await this.apiCall.AddLog({ message: 'Empty recording', blobData: idRecording });
56
+ return;
57
+ }
58
+ let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
59
+ if (store.flowStatus == FlowStatus.ID) {
60
+ try {
61
+ this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + mimeType.extension, { type: mimeType.type });
62
+ await this.uploadRecording();
63
+ }
64
+ catch (e) {
65
+ this.apiErrorEvent.emit(e);
66
+ }
67
+ }
68
+ }
69
+ async uploadPhoto() {
70
+ if (this.idFlow.photoFile == null || this.idFlow.photoDone) {
71
+ return;
72
+ }
73
+ this.idFlow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFront', this.idFlow.photoFile);
74
+ if (this.idFlow.photoDone) {
75
+ this.endFlow();
76
+ }
77
+ else {
78
+ this.idFlow.photoFile = null;
79
+ this.idFlow.recordingFile = null;
80
+ this.switchCamera();
81
+ this.showTimeout = true;
82
+ }
83
+ }
84
+ async uploadRecording() {
85
+ if (this.idFlow.recordingFile == null || this.idFlow.recordingDone) {
86
+ return;
87
+ }
88
+ this.idFlow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
89
+ if (this.idFlow.recordingDone) {
90
+ this.endFlow();
91
+ }
92
+ else {
93
+ this.idFlow.photoFile = null;
94
+ this.idFlow.recordingFile = null;
95
+ this.showTimeout = true;
96
+ }
97
+ }
98
+ endFlow() {
99
+ if (!this.idFlow.photoDone) {
100
+ return;
101
+ }
102
+ if (!this.idFlow.recordingDone) {
103
+ return;
104
+ }
105
+ if (!this.idFlow.verificationFinished) {
106
+ return;
107
+ }
108
+ store.flowStatus = FlowStatus.LIVENESS;
109
+ }
110
+ switchCamera() {
111
+ if (this.captureRetryCount == 2) {
112
+ let camIndex = store.cameraIds.indexOf(store.cameraId);
113
+ store.cameraId = camIndex === store.cameraIds.length - 1 ? store.cameraIds[0] : store.cameraIds[camIndex + 1];
114
+ this.captureRetryCount = 0;
115
+ }
116
+ else {
117
+ this.captureRetryCount++;
118
+ }
119
+ }
120
+ render() {
121
+ let error = h("capture-error", { type: "ID" });
122
+ let capture = h("id-capture", { id: "idFront", device: this.device });
123
+ let howToInfo = h("how-to-info", { idSide: "front" });
124
+ return this.showHowTo ? howToInfo : this.showTimeout ? error : capture;
125
+ }
126
+ static get is() { return "id-single-side"; }
127
+ static get originalStyleUrls() {
128
+ return {
129
+ "$": ["id-single-side.css"]
130
+ };
131
+ }
132
+ static get styleUrls() {
133
+ return {
134
+ "$": ["id-single-side.css"]
135
+ };
136
+ }
137
+ static get properties() {
138
+ return {
139
+ "device": {
140
+ "type": "unknown",
141
+ "mutable": false,
142
+ "complexType": {
143
+ "original": "Device",
144
+ "resolved": "Device",
145
+ "references": {
146
+ "Device": {
147
+ "location": "import",
148
+ "path": "../../../models/IDevice"
149
+ }
150
+ }
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": ""
157
+ }
158
+ }
159
+ };
160
+ }
161
+ static get states() {
162
+ return {
163
+ "showTimeout": {},
164
+ "showHowTo": {},
165
+ "idFlow": {}
166
+ };
167
+ }
168
+ static get events() {
169
+ return [{
170
+ "method": "apiErrorEvent",
171
+ "name": "apiError",
172
+ "bubbles": true,
173
+ "cancelable": true,
174
+ "composed": true,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": ""
178
+ },
179
+ "complexType": {
180
+ "original": "any",
181
+ "resolved": "any",
182
+ "references": {}
183
+ }
184
+ }];
185
+ }
186
+ static get listeners() {
187
+ return [{
188
+ "name": "captureErrorDone",
189
+ "method": "captureErrorDone",
190
+ "target": undefined,
191
+ "capture": false,
192
+ "passive": false
193
+ }, {
194
+ "name": "howToInfoDone",
195
+ "method": "howToDone",
196
+ "target": undefined,
197
+ "capture": false,
198
+ "passive": false
199
+ }, {
200
+ "name": "timeElapsed",
201
+ "method": "timeElapsed",
202
+ "target": undefined,
203
+ "capture": false,
204
+ "passive": false
205
+ }, {
206
+ "name": "photoIdCapture",
207
+ "method": "captureIdImage",
208
+ "target": undefined,
209
+ "capture": false,
210
+ "passive": false
211
+ }, {
212
+ "name": "verificationFinished",
213
+ "method": "verificationFinished",
214
+ "target": undefined,
215
+ "capture": false,
216
+ "passive": false
217
+ }, {
218
+ "name": "recordingIdCapture",
219
+ "method": "capturedIdRecording",
220
+ "target": undefined,
221
+ "capture": false,
222
+ "passive": false
223
+ }];
224
+ }
225
+ }
@@ -0,0 +1,88 @@
1
+ import { h } from '@stencil/core';
2
+ import { LandingValues } 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
+ import store from '../../../helpers/store';
9
+ import Events from '../../../helpers/Events';
10
+ import { FlowStatus } from '../../../models/FlowStatus';
11
+ export class LandingValidation {
12
+ constructor() {
13
+ this.device = undefined;
14
+ this.warningText = undefined;
15
+ }
16
+ async componentWillLoad() {
17
+ await new Promise(f => setTimeout(f, 500));
18
+ await this.initRequest();
19
+ }
20
+ componentDidLoad() {
21
+ Events.init(window);
22
+ Events.flowStarted();
23
+ }
24
+ async initRequest() {
25
+ if (store.hasIdBack) {
26
+ this.warningText = LandingValues.WarningMd;
27
+ }
28
+ else {
29
+ this.warningText = LandingValues.Warning;
30
+ }
31
+ }
32
+ async startFlow() {
33
+ if (store.initialised) {
34
+ if (store.agreementsValidation) {
35
+ store.flowStatus = FlowStatus.AGREEMENT;
36
+ }
37
+ else if (store.phoneValidation) {
38
+ store.flowStatus = FlowStatus.PHONE;
39
+ }
40
+ else {
41
+ store.flowStatus = FlowStatus.ID;
42
+ }
43
+ }
44
+ }
45
+ render() {
46
+ return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", { class: "text-center" }, LandingValues.Title), h("div", { class: "d-flex space-between align-center" }, h("p", { class: "main-text font-size-2" }, LandingValues.Description), h("div", { class: "img-info" }, h("div", { class: "i-effect" }), h("img", { src: info })))), h("div", { class: "info-container" }, h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idSvg })), h("h3", null, LandingValues.IdInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idDevice })), h("h3", null, LandingValues.DeviceInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idValidation })), h("h3", null, LandingValues.SmsInfo))), h("div", { class: "terms-container" }, h("h3", { class: "font-size-2 mb-1 text-center" }, this.warningText)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", disabled: !store.initialised, onClick: () => this.startFlow() }, LandingValues.Button), h("p", { class: "main-text font-size-18 text-right mb-0" }, LandingValues.FooterText))))));
47
+ }
48
+ static get is() { return "landing-validation"; }
49
+ static get originalStyleUrls() {
50
+ return {
51
+ "$": ["landing-validation.css"]
52
+ };
53
+ }
54
+ static get styleUrls() {
55
+ return {
56
+ "$": ["landing-validation.css"]
57
+ };
58
+ }
59
+ static get properties() {
60
+ return {
61
+ "device": {
62
+ "type": "unknown",
63
+ "mutable": false,
64
+ "complexType": {
65
+ "original": "Device",
66
+ "resolved": "Device",
67
+ "references": {
68
+ "Device": {
69
+ "location": "import",
70
+ "path": "../../../models/IDevice"
71
+ }
72
+ }
73
+ },
74
+ "required": false,
75
+ "optional": false,
76
+ "docs": {
77
+ "tags": [],
78
+ "text": ""
79
+ }
80
+ }
81
+ };
82
+ }
83
+ static get states() {
84
+ return {
85
+ "warningText": {}
86
+ };
87
+ }
88
+ }
@@ -0,0 +1,10 @@
1
+ .qr-canvas {
2
+ max-height: 60vh;
3
+ max-width: 80vw;
4
+ text-align: center;
5
+ }
6
+
7
+ .qr-canvas > canvas {
8
+ width: 100%;
9
+ height: 100%;
10
+ }