@ekyc_qoobiss/qbs-ect-cmp 1.5.27 → 1.6.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 (66) hide show
  1. package/dist/cjs/ApiCall-ef8d0136.js +156 -0
  2. package/dist/cjs/Cameras-accbcbd2.js +102 -0
  3. package/dist/cjs/Events-68a316bc.js +99 -0
  4. package/dist/{esm/agreement-check_12.entry.js → cjs/ML5-1d163c71.js} +3 -4785
  5. package/dist/cjs/Stream-35ac31ee.js +3115 -0
  6. package/dist/cjs/agreement-check.cjs.entry.js +33 -0
  7. package/dist/cjs/agreement-info.cjs.entry.js +55 -0
  8. package/dist/cjs/camera-comp.cjs.entry.js +102 -0
  9. package/dist/cjs/capture-error.cjs.entry.js +56 -0
  10. package/dist/cjs/end-redirect.cjs.entry.js +30 -0
  11. package/dist/cjs/how-to-info.cjs.entry.js +73 -0
  12. package/dist/cjs/id-back-capture.cjs.entry.js +120 -0
  13. package/dist/cjs/id-capture.cjs.entry.js +120 -0
  14. package/dist/cjs/identification-component.cjs.entry.js +324 -0
  15. package/dist/cjs/landing-validation.cjs.entry.js +53 -0
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  18. package/dist/cjs/selfie-capture.cjs.entry.js +118 -0
  19. package/dist/cjs/sms-code-validation.cjs.entry.js +82 -0
  20. package/dist/cjs/store-fbfb5595.js +211 -0
  21. package/dist/cjs/textValues-b48ebbbe.js +95 -0
  22. package/dist/collection/collection-manifest.json +7 -1
  23. package/dist/collection/helpers/Cameras.js +1 -1
  24. package/dist/collection/libs/IDML5Detector/IDML5Detector.js +2 -2
  25. package/dist/esm/ApiCall-d8063d38.js +154 -0
  26. package/dist/esm/Cameras-13267674.js +100 -0
  27. package/dist/esm/Events-5ddf6f24.js +97 -0
  28. package/dist/{cjs/agreement-check_12.cjs.entry.js → esm/ML5-5eb1d543.js} +1 -4801
  29. package/dist/esm/Stream-becc460b.js +3111 -0
  30. package/dist/esm/agreement-check.entry.js +29 -0
  31. package/dist/esm/agreement-info.entry.js +51 -0
  32. package/dist/esm/camera-comp.entry.js +98 -0
  33. package/dist/esm/capture-error.entry.js +52 -0
  34. package/dist/esm/end-redirect.entry.js +26 -0
  35. package/dist/esm/how-to-info.entry.js +69 -0
  36. package/dist/esm/id-back-capture.entry.js +116 -0
  37. package/dist/esm/id-capture.entry.js +116 -0
  38. package/dist/esm/identification-component.entry.js +320 -0
  39. package/dist/esm/landing-validation.entry.js +49 -0
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/qbs-ect-cmp.js +1 -1
  42. package/dist/esm/selfie-capture.entry.js +114 -0
  43. package/dist/esm/sms-code-validation.entry.js +78 -0
  44. package/dist/esm/store-82f7e793.js +209 -0
  45. package/dist/esm/textValues-4943bd85.js +84 -0
  46. package/dist/qbs-ect-cmp/p-042071fd.entry.js +1 -0
  47. package/dist/qbs-ect-cmp/p-15026f19.entry.js +1 -0
  48. package/dist/qbs-ect-cmp/p-20933db2.entry.js +1 -0
  49. package/dist/qbs-ect-cmp/p-27f8e17c.entry.js +1 -0
  50. package/dist/qbs-ect-cmp/p-2d93d746.entry.js +1 -0
  51. package/dist/qbs-ect-cmp/p-396c0467.entry.js +1 -0
  52. package/dist/qbs-ect-cmp/p-3b02da36.js +1 -0
  53. package/dist/qbs-ect-cmp/p-49ae192f.js +1 -0
  54. package/dist/qbs-ect-cmp/p-4b905a8a.entry.js +1 -0
  55. package/dist/qbs-ect-cmp/p-6c1595e8.entry.js +1 -0
  56. package/dist/qbs-ect-cmp/p-732fb123.entry.js +1 -0
  57. package/dist/qbs-ect-cmp/p-85155e60.js +1 -0
  58. package/dist/qbs-ect-cmp/p-969b5e4c.entry.js +1 -0
  59. package/dist/qbs-ect-cmp/p-97230e9d.entry.js +1 -0
  60. package/dist/qbs-ect-cmp/p-bfe7cd0a.entry.js +1 -0
  61. package/dist/qbs-ect-cmp/p-d1dfb26d.js +1 -0
  62. package/dist/qbs-ect-cmp/p-e1731ac5.js +1 -0
  63. package/dist/qbs-ect-cmp/{p-320adf31.entry.js → p-e4ef0d02.js} +76 -76
  64. package/dist/qbs-ect-cmp/p-f996ad46.js +1 -0
  65. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,156 @@
1
+ 'use strict';
2
+
3
+ const store = require('./store-fbfb5595.js');
4
+
5
+ class ApiCall {
6
+ constructor() {
7
+ this.toBase64 = (file) => new Promise((resolve, reject) => {
8
+ const reader = new FileReader();
9
+ reader.readAsDataURL(file);
10
+ reader.onload = () => resolve(reader.result);
11
+ reader.onerror = error => reject(error);
12
+ });
13
+ }
14
+ async Post(url, data) {
15
+ try {
16
+ let resp = await fetch(store.state.apiBaseUrl + url, {
17
+ method: 'POST',
18
+ body: data,
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ 'Authorization': 'IDKYC-TOKEN ' + store.state.token
22
+ },
23
+ });
24
+ if (!resp.ok) {
25
+ return new Error(resp.statusText);
26
+ }
27
+ return await resp.json();
28
+ }
29
+ catch (err) {
30
+ console.log(err);
31
+ return err;
32
+ }
33
+ }
34
+ async Get(url) {
35
+ try {
36
+ let resp = await fetch(store.state.apiBaseUrl + url, {
37
+ method: 'GET',
38
+ headers: {
39
+ 'Content-Type': 'application/json',
40
+ 'Authorization': 'IDKYC-TOKEN ' + store.state.token
41
+ },
42
+ });
43
+ if (!resp.ok) {
44
+ return new Error(resp.statusText);
45
+ }
46
+ return await resp.json();
47
+ }
48
+ catch (err) {
49
+ console.log(err);
50
+ return err;
51
+ }
52
+ }
53
+ async SendOTPCode(requestId, phoneNumber) {
54
+ let data = { requestId: requestId, phone: phoneNumber };
55
+ let jsonResp = await this.Post('/validation/otp/send', JSON.stringify(data));
56
+ if (typeof jsonResp != 'boolean') {
57
+ return false;
58
+ }
59
+ return jsonResp;
60
+ }
61
+ async CheckOTPCode(requestId, otpCode) {
62
+ let data = { requestId: requestId, otp: otpCode };
63
+ let jsonResp = await this.Post('/validation/otp/check', JSON.stringify(data));
64
+ if (typeof jsonResp != 'boolean') {
65
+ return false;
66
+ }
67
+ return jsonResp;
68
+ }
69
+ async AddIdentificationRequest(requestId, deviceInfo) {
70
+ let data = { requestId: requestId, clientDeviceInfo: deviceInfo };
71
+ let jsonResp = await this.Post('/validation/identity/insert', JSON.stringify(data));
72
+ if (typeof jsonResp.hasIdBack == 'boolean') {
73
+ store.state.hasIdBack = jsonResp.hasIdBack;
74
+ return true;
75
+ }
76
+ else {
77
+ return false;
78
+ }
79
+ }
80
+ async UploadFileForRequestB64(requestId, type, file) {
81
+ let data = {
82
+ requestId: requestId,
83
+ type: type,
84
+ data: await this.toBase64(file),
85
+ };
86
+ let respJson = await this.Post('/validation/upload/capture', JSON.stringify(data));
87
+ if (respJson && respJson.file_path) {
88
+ if (type == 'IdFront') {
89
+ return respJson.isValid;
90
+ }
91
+ return true;
92
+ }
93
+ else {
94
+ return false;
95
+ }
96
+ }
97
+ async UploadFileForRequest(requestId, type, file) {
98
+ try {
99
+ let data = new FormData();
100
+ data.append('requestId', requestId);
101
+ data.append('type', type);
102
+ data.append('file', file);
103
+ let resp = await fetch(store.state.apiBaseUrl + '/validation/upload/file', {
104
+ method: 'POST',
105
+ body: data,
106
+ });
107
+ if (!resp.ok) {
108
+ console.log(resp.statusText);
109
+ return false;
110
+ }
111
+ let respJson = await resp.json();
112
+ if (respJson && respJson.file_path) {
113
+ if (type == 'IdFront') {
114
+ return respJson.isValid;
115
+ }
116
+ return true;
117
+ }
118
+ else {
119
+ return false;
120
+ }
121
+ }
122
+ catch (err) {
123
+ console.log(err);
124
+ return false;
125
+ }
126
+ }
127
+ async GetAgreement(agreementType) {
128
+ try {
129
+ let resp = await this.Get('/validation/agreement/content?type=' + agreementType + '&requestId=' + store.state.requestId);
130
+ if (resp) {
131
+ return resp.htmlText;
132
+ }
133
+ return '';
134
+ }
135
+ catch (err) {
136
+ console.log(err);
137
+ return '';
138
+ }
139
+ }
140
+ async GenerateAgreement(agreementType) {
141
+ try {
142
+ let data = { requestId: store.state.requestId, documentType: agreementType };
143
+ let resp = await this.Post('/validation/agreement/generate', JSON.stringify(data));
144
+ if (typeof resp != 'boolean') {
145
+ return false;
146
+ }
147
+ return resp;
148
+ }
149
+ catch (err) {
150
+ console.log(err);
151
+ return false;
152
+ }
153
+ }
154
+ }
155
+
156
+ exports.ApiCall = ApiCall;
@@ -0,0 +1,102 @@
1
+ 'use strict';
2
+
3
+ class Cameras {
4
+ async GetCameras(deviceInfo) {
5
+ var allDevices = [];
6
+ const devices = await navigator.mediaDevices.enumerateDevices();
7
+ const videoDevices = devices.filter(device => device.kind === 'videoinput');
8
+ for (const device of videoDevices) {
9
+ const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
10
+ const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
11
+ stream.getVideoTracks().forEach(track => {
12
+ if (deviceInfo.isFirefox) {
13
+ const settings = track.getSettings();
14
+ let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
15
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
16
+ allDevices.push({
17
+ deviceId: device.deviceId,
18
+ name: device.label,
19
+ height: settings.height,
20
+ width: settings.width,
21
+ frameRate: Number(settings.frameRate.max),
22
+ torch: false,
23
+ recommended: false,
24
+ facingMode: facingMode,
25
+ });
26
+ }
27
+ else {
28
+ const capabilities = track.getCapabilities();
29
+ let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
30
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
31
+ allDevices.push({
32
+ deviceId: device.deviceId,
33
+ name: device.label,
34
+ height: capabilities.height.max,
35
+ width: capabilities.width.max,
36
+ frameRate: Number(capabilities.frameRate.max),
37
+ torch: capabilities.torch,
38
+ recommended: false,
39
+ facingMode: facingMode,
40
+ });
41
+ }
42
+ });
43
+ stream.getTracks().forEach(track => {
44
+ track.stop();
45
+ });
46
+ }
47
+ if (allDevices.length > 0) {
48
+ allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
49
+ var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
50
+ if (firstOption) {
51
+ allDevices[allDevices.indexOf(firstOption)].recommended = true;
52
+ }
53
+ else {
54
+ var firstEnv = allDevices.find(i => i.facingMode === 'environment');
55
+ if (firstEnv) {
56
+ allDevices[allDevices.indexOf(firstEnv)].recommended = true;
57
+ }
58
+ }
59
+ }
60
+ return allDevices;
61
+ }
62
+ GetConstraints(selectedDeviceId, device, portrait = false) {
63
+ let constraints = {
64
+ audio: false,
65
+ video: {
66
+ frameRate: 30
67
+ }
68
+ };
69
+ if (selectedDeviceId) {
70
+ constraints.video.deviceId = {
71
+ exact: selectedDeviceId,
72
+ };
73
+ }
74
+ if (device.isWin) {
75
+ constraints.video.width = { ideal: 1280 };
76
+ }
77
+ else {
78
+ if (portrait) {
79
+ constraints.video.facingMode = 'user';
80
+ constraints.video.width = { ideal: 1280 };
81
+ constraints.video.height = { ideal: 720 };
82
+ }
83
+ else {
84
+ constraints.video.facingMode = 'environment';
85
+ constraints.video.width = { ideal: 1280 };
86
+ constraints.video.aspectRatio = 1;
87
+ }
88
+ }
89
+ return constraints;
90
+ }
91
+ GetRecommendedCamera(cameras) {
92
+ if (cameras && cameras.length > 0) {
93
+ var recommDevice = cameras.find(c => c.recommended);
94
+ if (recommDevice) {
95
+ return recommDevice;
96
+ }
97
+ }
98
+ return null;
99
+ }
100
+ }
101
+
102
+ exports.Cameras = Cameras;
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ class Events {
4
+ static init(element) {
5
+ this.cameraModule = element;
6
+ }
7
+ static flowStarted() {
8
+ this.cameraModule.dispatchEvent(new CustomEvent('ect-started', {
9
+ detail: {},
10
+ bubbles: true,
11
+ cancelable: true,
12
+ composed: true
13
+ }));
14
+ }
15
+ static flowCompleted() {
16
+ this.cameraModule.dispatchEvent(new CustomEvent('ect-completed', {
17
+ detail: {},
18
+ bubbles: true,
19
+ cancelable: true,
20
+ composed: true
21
+ }));
22
+ }
23
+ static captureEvent(photos) {
24
+ this.cameraModule.dispatchEvent(new CustomEvent('capture', {
25
+ detail: {
26
+ photos,
27
+ },
28
+ bubbles: true,
29
+ cancelable: true,
30
+ composed: true,
31
+ }));
32
+ }
33
+ static recordingAvailable(recording) {
34
+ this.cameraModule.dispatchEvent(new CustomEvent('recordingAvailable', {
35
+ detail: {
36
+ recording,
37
+ },
38
+ bubbles: true,
39
+ cancelable: true,
40
+ composed: true,
41
+ }));
42
+ }
43
+ static closeEvent() {
44
+ this.cameraModule.dispatchEvent(new CustomEvent('close', {
45
+ bubbles: false,
46
+ cancelable: true,
47
+ composed: true,
48
+ }));
49
+ }
50
+ static cameraReadyEvent() {
51
+ this.cameraModule.dispatchEvent(new CustomEvent('cameraReady', {
52
+ bubbles: false,
53
+ cancelable: true,
54
+ composed: true,
55
+ }));
56
+ }
57
+ static errorEvent(error) {
58
+ this.cameraModule.dispatchEvent(new CustomEvent('error', {
59
+ detail: {
60
+ error,
61
+ },
62
+ bubbles: true,
63
+ cancelable: true,
64
+ composed: true,
65
+ }));
66
+ }
67
+ static detectionError(error) {
68
+ this.cameraModule.dispatchEvent(new CustomEvent('detectionError', {
69
+ detail: {
70
+ error,
71
+ },
72
+ bubbles: true,
73
+ cancelable: true,
74
+ composed: true,
75
+ }));
76
+ }
77
+ static loadedModels(loadedModels) {
78
+ this.cameraModule.dispatchEvent(new CustomEvent('loadedModels', {
79
+ detail: {
80
+ loadedModels,
81
+ },
82
+ bubbles: true,
83
+ cancelable: true,
84
+ composed: true,
85
+ }));
86
+ }
87
+ static detectorInitialized(initializationTime) {
88
+ this.cameraModule.dispatchEvent(new CustomEvent('detectorInitialized', {
89
+ detail: {
90
+ initializationTime,
91
+ },
92
+ bubbles: true,
93
+ cancelable: true,
94
+ composed: true,
95
+ }));
96
+ }
97
+ }
98
+
99
+ exports.Events = Events;