@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,223 @@
1
+ import { IDML5Detector } from '../libs/IDML5Detector/IDML5Detector';
2
+ import { FaceML5Detector } from '../libs/FaceML5Detector/FaceML5Detector';
3
+ import { FacePose } from '../libs/FaceML5Detector/FacePose';
4
+ import { FacePosePick } from '../libs/FaceML5Detector/FacePose';
5
+ import { addExifInImg } from './security';
6
+ var ImageFormat;
7
+ (function (ImageFormat) {
8
+ ImageFormat["JPEG"] = "image/jpeg";
9
+ ImageFormat["PNG"] = "image/png";
10
+ })(ImageFormat || (ImageFormat = {}));
11
+ export class Stream {
12
+ setFaceDetection(val) {
13
+ this.faceDetection = val;
14
+ this.idDetection = !val;
15
+ }
16
+ setIdDetection(val) {
17
+ this.idDetection = val;
18
+ this.faceDetection = !val;
19
+ }
20
+ // public setProbabilityThreshold(val: number): void {
21
+ // Detector.getInstance().setProbabilityThreshold(val);
22
+ // }
23
+ setCallbackChangeTitle(fun) {
24
+ this.callbackChangeTitle = fun;
25
+ }
26
+ setCallbackVideoStarted(fun) {
27
+ this.callbackVideoStarted = fun;
28
+ }
29
+ setCallbackErrors(fun) {
30
+ this.callbackErrors = fun;
31
+ }
32
+ setCallbackAutoCapturing(fun) {
33
+ this.callbackAutoCapturing = fun;
34
+ }
35
+ // public setCallbackFaceDetectionErrors(fun: (e: PipelineResult) => void): void {
36
+ // this.callbackFaceDetectionErrors = fun;
37
+ // }
38
+ setCallbackRecordingReady(fun) {
39
+ this.callbackRecordingReady = fun;
40
+ }
41
+ setCallbackTimeElapsed(fun) {
42
+ this.callbackTimeElapsed = fun;
43
+ }
44
+ setVerificationFinished(fun) {
45
+ this.verificationFinished = fun;
46
+ }
47
+ constructor(device, _modelPath) {
48
+ this.streamPaused = false;
49
+ this.recordedChunks = [];
50
+ this.videoSize = { width: 0, height: 0 };
51
+ this.pauseStream = () => {
52
+ this.streamPaused = true;
53
+ this.mediaRecorder.pause();
54
+ this.videoElement.pause();
55
+ // this.dropMask();
56
+ // if (this.faceDetection) Detector.getInstance().stopDetector();
57
+ };
58
+ this.device = device;
59
+ this.idML5Detector = IDML5Detector.getInstance(this, device.isMobile);
60
+ this.faceML5Detector = FaceML5Detector.getInstance(this, device.isMobile);
61
+ }
62
+ static getInstance(device, modelPath) {
63
+ if (!Stream.instance) {
64
+ Stream.instance = new Stream(device, modelPath);
65
+ }
66
+ return Stream.instance;
67
+ }
68
+ // public returnErrors(errors: PipelineResult) {
69
+ // this.callbackFaceDetectionErrors(errors);
70
+ // }
71
+ autoCapturing() {
72
+ this.callbackAutoCapturing();
73
+ }
74
+ timeElapsed() {
75
+ this.callbackTimeElapsed();
76
+ }
77
+ verificationReady() {
78
+ this.verificationFinished();
79
+ }
80
+ updateHtmlElements(videoElement, canvasElement, component) {
81
+ this.videoElement = videoElement;
82
+ this.canvasElement = canvasElement;
83
+ this.idML5Detector.updateHtmlElements(this.videoElement, this.canvasElement, component);
84
+ this.faceML5Detector.updateHtmlElements(this.videoElement, this.canvasElement, component);
85
+ }
86
+ static orientationChange() { }
87
+ startStream(stream) {
88
+ if (this.stream)
89
+ this.stream.getTracks().forEach((track) => track.stop());
90
+ this.stream = stream;
91
+ if ('srcObject' in this.videoElement) {
92
+ this.videoElement.srcObject = stream;
93
+ }
94
+ else {
95
+ // @ts-ignore
96
+ this.videoElement.src = window.URL.createObjectURL(stream);
97
+ }
98
+ this.videoElement.addEventListener('loadedmetadata', async (_e) => {
99
+ this.videoElement.play().then(() => {
100
+ this.streamPaused = false;
101
+ this.updateCanvasSize(this.canvasElement);
102
+ this.updateVideoSize(this.videoElement);
103
+ this.callbackVideoStarted();
104
+ if (this.idDetection)
105
+ this.startIdDetection();
106
+ if (this.faceDetection)
107
+ this.startFaceDetection();
108
+ });
109
+ }, false);
110
+ }
111
+ async initStream(stream) {
112
+ this.startStream(stream);
113
+ this.recordStream();
114
+ }
115
+ async resumeStream() {
116
+ this.streamPaused = false;
117
+ this.mediaRecorder.resume();
118
+ await this.videoElement.play();
119
+ // this.drawMask();
120
+ // if (this.faceDetection) await Detector.getInstance().startDetector();
121
+ }
122
+ recordStream() {
123
+ var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
124
+ if (!MediaRecorder.isTypeSupported(options.mimeType)) {
125
+ if (this.device.isIos || this.device.isSafari)
126
+ options.mimeType = Stream.mp4MimeType.mime;
127
+ }
128
+ this.recordedChunks = [];
129
+ this.mediaRecorder = new MediaRecorder(this.stream, options);
130
+ this.mediaRecorder.ondataavailable = event => {
131
+ this.recordedChunks.push(event.data);
132
+ };
133
+ this.mediaRecorder.onstop = _e => {
134
+ this.saveVideoRecording(this.recordedChunks, options.mimeType);
135
+ this.recordedChunks = [];
136
+ };
137
+ this.mediaRecorder.start(); // Start recording, and dump data every second
138
+ }
139
+ async saveVideoRecording(videoTosave, mimeType) {
140
+ var blob = new Blob(videoTosave, {
141
+ type: mimeType.split(';')[0],
142
+ });
143
+ this.callbackRecordingReady(blob);
144
+ }
145
+ updateCanvasSize(canvas) {
146
+ this.videoSize = { width: this.videoElement.videoWidth, height: this.videoElement.videoHeight };
147
+ canvas.width = this.videoSize.width;
148
+ canvas.height = this.videoSize.height;
149
+ }
150
+ updateVideoSize(video) {
151
+ this.videoSize = { width: this.videoElement.videoWidth, height: this.videoElement.videoHeight };
152
+ video.width = this.videoSize.width;
153
+ video.height = this.videoSize.height;
154
+ }
155
+ dropStream() {
156
+ if (!this.streamStopped()) {
157
+ this.stream.getTracks().forEach((track) => track.stop());
158
+ this.videoElement.srcObject = null;
159
+ }
160
+ if (this.mediaRecorder && this.mediaRecorder.state != 'inactive') {
161
+ this.mediaRecorder.stop();
162
+ }
163
+ // if (this.faceDetection) Detector.getInstance().stopDetector();
164
+ }
165
+ streamStopped() {
166
+ return !(this.stream && this.stream.getTracks && this.stream.getTracks().length > 0);
167
+ }
168
+ async takePhoto() {
169
+ const canvas = document.createElement('canvas');
170
+ canvas.style.visibility = 'hidden';
171
+ canvas.width = this.videoElement.videoWidth;
172
+ canvas.height = this.videoElement.videoHeight;
173
+ return await this.getFrame(canvas);
174
+ }
175
+ getFrame(canvas) {
176
+ return new Promise(resolve => {
177
+ const context = canvas.getContext('2d');
178
+ context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
179
+ canvas.toBlob((frame) => {
180
+ if (frame.type === ImageFormat.JPEG && !this.device.isIos) {
181
+ try {
182
+ addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
183
+ }
184
+ catch (e) {
185
+ resolve(frame);
186
+ this.callbackErrors(e, false);
187
+ }
188
+ }
189
+ else {
190
+ resolve(frame);
191
+ }
192
+ }, ImageFormat.PNG, 1);
193
+ //let outCanvContext = this.canvasElement.getContext('2d');
194
+ //outCanvContext.drawImage(this.videoElement, 0, 0, this.canvasElement.width, this.canvasElement.height);
195
+ });
196
+ }
197
+ async startIdDetection() {
198
+ if (this.streamPaused)
199
+ return;
200
+ this.idML5Detector.initDetector();
201
+ }
202
+ async startFaceDetection() {
203
+ if (this.streamPaused)
204
+ return;
205
+ this.faceML5Detector.initDetector();
206
+ }
207
+ requestFacePose() {
208
+ var pose = FacePosePick.randomEnum(FacePose);
209
+ // var pose = FacePose.TiltLeft;
210
+ this.callbackChangeTitle(pose);
211
+ return pose;
212
+ }
213
+ changeFacePose() {
214
+ this.callbackChangeTitle(null);
215
+ }
216
+ changeIDPose(pose) {
217
+ this.callbackChangeTitle(pose);
218
+ }
219
+ }
220
+ Stream.mp4MimeType = { type: 'video/mp4', codec: 'codecs:h264', extension: 'mp4', mime: 'video/mp4;codecs:h264' };
221
+ Stream.webmMimeType = { type: 'video/webm', codec: 'codecs=vp8', extension: 'webm', mime: 'video/webm;codecs=vp8' };
222
+ window.addEventListener('resize', Stream.orientationChange, false);
223
+ window.addEventListener('orientationchange', Stream.orientationChange, false);
@@ -0,0 +1,10 @@
1
+ export function videoRatio(videoElement) {
2
+ const hRatio = videoElement.clientWidth / videoElement.videoWidth;
3
+ const vRatio = videoElement.clientHeight / videoElement.videoHeight;
4
+ return Math.min(hRatio, vRatio);
5
+ }
6
+ export function getVideoRatio(videoElement) {
7
+ const hRatio = videoElement.clientWidth / videoElement.videoWidth;
8
+ const vRatio = videoElement.clientHeight / videoElement.videoHeight;
9
+ return Math.min(hRatio, vRatio);
10
+ }
@@ -0,0 +1,54 @@
1
+ export const initDevice = () => {
2
+ let device = {
3
+ isMobile: false,
4
+ isAndroid: false,
5
+ isLinux: false,
6
+ isMac: false,
7
+ isWin: false,
8
+ isChrome: false,
9
+ isFirefox: false,
10
+ isSafari: false,
11
+ isIos: false,
12
+ };
13
+ device.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
14
+ device.isAndroid = /Android/i.test(navigator.userAgent);
15
+ device.isIos = /iPhone|iPad|iPod/i.test(navigator.userAgent);
16
+ device.isLinux = /linux/i.test(navigator.platform);
17
+ device.isMac = /mac/i.test(navigator.platform);
18
+ device.isWin = /win/i.test(navigator.platform);
19
+ device.isChrome = /chrome/i.test(navigator.userAgent);
20
+ device.isFirefox = /firefox/i.test(navigator.userAgent);
21
+ device.isSafari = !device.isChrome ? /safari/i.test(navigator.userAgent) : false;
22
+ device.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
23
+ device.isAndroid = /Android/i.test(navigator.userAgent);
24
+ device.isIos = /iPhone|iPad|iPod/i.test(navigator.userAgent);
25
+ if (!device.isIos) {
26
+ const isIPad = navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2;
27
+ if (isIPad) {
28
+ device.isIos = true;
29
+ device.isMobile = true;
30
+ }
31
+ }
32
+ return device;
33
+ };
34
+ export const convertToDataUrl = async (file) => {
35
+ return new Promise(async (resolve) => {
36
+ let arr = [];
37
+ for (let i = 0; i < file.length; i++) {
38
+ const fr = new FileReader();
39
+ fr.onload = () => {
40
+ arr.push(fr.result);
41
+ if (arr.length === file.length)
42
+ resolve(arr);
43
+ };
44
+ fr.readAsDataURL(file[i]);
45
+ }
46
+ });
47
+ };
48
+ export const blobToBase64 = (blob) => {
49
+ return new Promise((resolve, _) => {
50
+ const reader = new FileReader();
51
+ reader.onloadend = () => resolve(reader.result);
52
+ reader.readAsDataURL(blob);
53
+ });
54
+ };
@@ -0,0 +1,25 @@
1
+ import { blobToBase64 } from '../utils/utils';
2
+ import * as piexif from 'piexifjs';
3
+ export const addExifInImg = async (blob, track, videoSize) => {
4
+ const base64 = await blobToBase64(blob);
5
+ const exif = piexif.load(base64);
6
+ const devices = await navigator.mediaDevices.enumerateDevices();
7
+ const cameraNames = devices.filter(device => device.kind === 'videoinput').map(device => device.label);
8
+ const json = {
9
+ width: videoSize.width,
10
+ height: videoSize.height,
11
+ usedCamera: track.label,
12
+ camerasOnDevice: cameraNames,
13
+ };
14
+ const newExif = {
15
+ '0th': Object.assign(Object.assign({}, exif['0th']), { [piexif.ImageIFD.Model]: json.usedCamera, [piexif.ImageIFD.ImageWidth]: json.width, [piexif.ImageIFD.ImageLength]: json.height }),
16
+ 'Exif': Object.assign(Object.assign({}, exif['Exif']), { [piexif.ExifIFD.UserComment]: JSON.stringify(json) }),
17
+ 'GPS': Object.assign({}, exif['GPS']),
18
+ 'Interop': Object.assign({}, exif['Interop']),
19
+ '1st': Object.assign({}, exif['1st']),
20
+ 'thumbnail': exif['thumbnail'],
21
+ };
22
+ const newExifBinary = piexif.dump(newExif);
23
+ const newPhotoData = piexif.insert(newExifBinary, base64);
24
+ return await fetch(newPhotoData).then(res => res.blob());
25
+ };
@@ -0,0 +1,39 @@
1
+ import { createStore } from '@stencil/store';
2
+ import { FlowStatus } from '../models/FlowStatus';
3
+ import { SessionKeys } from './textValues';
4
+ const { state, onChange } = createStore({
5
+ flowStatus: FlowStatus.LANDING,
6
+ environment: 'PROD',
7
+ requestId: '',
8
+ redirectId: '',
9
+ initialised: false,
10
+ token: '',
11
+ cameraIds: [],
12
+ cameraId: '',
13
+ hasIdBack: false,
14
+ agreementsValidation: true,
15
+ phoneValidation: true,
16
+ apiBaseUrl: 'https://apiro.id-kyc.com',
17
+ });
18
+ onChange('flowStatus', value => {
19
+ sessionStorage.setItem(SessionKeys.FlowStatusKey, FlowStatus[value]);
20
+ });
21
+ onChange('token', value => {
22
+ sessionStorage.setItem(SessionKeys.TokenKey, value);
23
+ });
24
+ onChange('requestId', value => {
25
+ sessionStorage.setItem(SessionKeys.RequestIdKey, value);
26
+ });
27
+ onChange('initialised', value => {
28
+ sessionStorage.setItem(SessionKeys.InitialisedKey, String(value));
29
+ });
30
+ onChange('hasIdBack', value => {
31
+ sessionStorage.setItem(SessionKeys.HasIdBackKey, String(value));
32
+ });
33
+ onChange('agreementsValidation', value => {
34
+ sessionStorage.setItem(SessionKeys.AgreementValidationKey, String(value));
35
+ });
36
+ onChange('phoneValidation', value => {
37
+ sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
38
+ });
39
+ export default state;
@@ -0,0 +1,128 @@
1
+ import store from './store';
2
+ export class GlobalValues {
3
+ }
4
+ GlobalValues.FooterText = 'Qoobiss eKYC';
5
+ GlobalValues.VideoLenght = 3100;
6
+ export class HowToValues extends GlobalValues {
7
+ }
8
+ HowToValues.IdTitile = 'Prezintă actul tău de identitate';
9
+ HowToValues.IdSubTitileFace = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
10
+ HowToValues.IdSubTitileBack = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
11
+ HowToValues.IdButton = 'Sunt gata!';
12
+ HowToValues.SelfieTitile = 'Validare video';
13
+ HowToValues.SelfieSubTitile = 'Este necesară realizarea unei înregistrări video. Respectă intrucțiunile ce vor fi afișate pe ecran.';
14
+ HowToValues.SelfieButton = 'Sunt gata!';
15
+ export class LandingValues extends GlobalValues {
16
+ }
17
+ LandingValues.Title = 'Validarea identității la distanță este o procedură simplă și rapidă';
18
+ LandingValues.Description = 'Asigură-te că ai:';
19
+ LandingValues.IdInfo = 'Actul de identitate, în original';
20
+ LandingValues.DeviceInfo = 'Un telefon mobil sau un calculator cu camera web';
21
+ LandingValues.SmsInfo = 'Acces la un telefon mobil ce permite primirea de mesaje SMS';
22
+ LandingValues.Warning = 'ATENȚIE! În cadrul acestui proces se poate utiliza doar cartea de identitate Românească.';
23
+ LandingValues.WarningMd = 'ATENȚIE! In cadrul acestui proces se pot utiliza doar buletinele de identitate din Republica Moldova.';
24
+ LandingValues.Terms = 'Prin continuarea procesului, confirmi că ai citit termenii de utilizare și ești de acord cu aceștia.';
25
+ LandingValues.Button = 'Am înțeles';
26
+ export class PhoneValidationValues extends GlobalValues {
27
+ }
28
+ PhoneValidationValues.Title = 'Este necesar să validăm numărul tău de telefon';
29
+ PhoneValidationValues.Description = 'Introdu mai jos numarul tau de telefon:';
30
+ PhoneValidationValues.Button = 'Trimite SMS de verificare';
31
+ PhoneValidationValues.Label = 'Numarul tau de telefon';
32
+ export class CodeValidationValues extends GlobalValues {
33
+ }
34
+ CodeValidationValues.Title = 'Introdu codul de validare primit prin sms:';
35
+ CodeValidationValues.Description = ' ';
36
+ CodeValidationValues.Button = 'Validează';
37
+ CodeValidationValues.Error = 'Codul introdus nu este valid. Asigură-te că îl introduci corect';
38
+ export class CompleteValues extends GlobalValues {
39
+ }
40
+ CompleteValues.Title = 'Procesul a fost finalizat.';
41
+ CompleteValues.Description = 'Vei fi redirecționat în câteva momente.';
42
+ CompleteValues.Message = 'Îți mulțumim!';
43
+ export class SessionKeys {
44
+ }
45
+ SessionKeys.FlowStatusKey = 'qbs-ect-flowstatus';
46
+ SessionKeys.RequestIdKey = 'qbs-ect-requestid';
47
+ SessionKeys.TokenKey = 'qbs-ect-token';
48
+ SessionKeys.InitialisedKey = 'qbs-ect-initialised';
49
+ SessionKeys.HasIdBackKey = 'qbs-ect-has-id-back';
50
+ SessionKeys.AgreementValidationKey = 'qbs-ect-agreement-validation';
51
+ SessionKeys.PhoneValidationKey = 'qbs-ect-phone-validation';
52
+ export class IdCaptureValues extends GlobalValues {
53
+ }
54
+ IdCaptureValues.Button = 'Încerc din nou';
55
+ IdCaptureValues.Title = 'Încadrează actul de identitate în chenarul de pe ecran.';
56
+ IdCaptureValues.TitleBack = 'Încadrează spatele actului de identitate în chenarul de pe ecran.';
57
+ IdCaptureValues.TtileRotate = 'Întoarce actul de identitate.';
58
+ IdCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran. Ai grijă să încadrezi integral actul în chenraul de pe ecran și să nu apară reflexii de lumină pe suprafața acestuia.';
59
+ IdCaptureValues.IDPoseMapping = {
60
+ 0: '',
61
+ 1: 'Înclină actul de identitate spre spate.',
62
+ 2: '',
63
+ 3: '',
64
+ 4: '',
65
+ };
66
+ IdCaptureValues.IDPoseDemoMapping = {
67
+ 0: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4',
68
+ 1: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4',
69
+ 2: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4',
70
+ 3: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4',
71
+ 4: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4',
72
+ };
73
+ IdCaptureValues.Loading = 'Transferăm datele. Asteptați...';
74
+ export class SelfieCaptureValues extends GlobalValues {
75
+ }
76
+ SelfieCaptureValues.Title = 'Încadrează fața în chenarul de pe ecran.';
77
+ SelfieCaptureValues.FinalTitle = 'Îndreaptă capul și încadrează fața în chenarul de pe ecran.';
78
+ SelfieCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran.';
79
+ SelfieCaptureValues.Loading = 'Transferăm datele. Asteptați...';
80
+ SelfieCaptureValues.FacePoseMapping = {
81
+ 0: 'Întoarce capul spre stânga.',
82
+ 1: 'Întoarce capul spre dreapta.',
83
+ 2: 'Înclină capul spre spate.',
84
+ 3: 'Înclină capul în față.',
85
+ // 4: 'Înclină capul spre stânga.',
86
+ // 5: 'Înclină capul spre dreapta.',
87
+ 4: '',
88
+ };
89
+ SelfieCaptureValues.FacePoseDemoMapping = {
90
+ 0: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4',
91
+ 1: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4',
92
+ 2: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4',
93
+ 3: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4',
94
+ // 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_left.mp4',
95
+ // 5: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_right.mp4',
96
+ 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4',
97
+ };
98
+ export class AgreementInfoValues extends GlobalValues {
99
+ }
100
+ AgreementInfoValues.Title = 'Pentru începerea identificării avem nevoie de acordurile tale:';
101
+ AgreementInfoValues.Button = 'Încep identificarea';
102
+ AgreementInfoValues.Terms = 'Am luat la cunoștință și sunt de acord cu Termenii și condițiile generale de utilizare';
103
+ AgreementInfoValues.Agreement = 'Îmi exprim acordul pentru prelucrarea datelor cu caracter personal';
104
+ export class AgreementCheckValues extends GlobalValues {
105
+ }
106
+ AgreementCheckValues.ButtonYes = 'Sunt de acord';
107
+ AgreementCheckValues.ButtonNo = 'Nu sunt de acord';
108
+ export class ApiUrls {
109
+ constructor() {
110
+ this.uriEnv = '/';
111
+ this.uriEnv = store.environment == 'QA' ? '/dev_' : '/';
112
+ this.OtpSend = this.uriEnv + 'validation/otp/send';
113
+ this.OtpCheck = this.uriEnv + 'validation/otp/check';
114
+ this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
115
+ this.UploadCapture = this.uriEnv + 'validation/upload/capture';
116
+ this.GetAgreement = this.uriEnv + 'validation/agreement/content';
117
+ this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
118
+ this.SendLink = this.uriEnv + 'validation/otp/sendlink';
119
+ this.GetStatus = this.uriEnv + 'validation/identity/status';
120
+ this.AddLog = this.uriEnv + 'validation/logs/add';
121
+ }
122
+ }
123
+ export class MobileRedirectValues extends GlobalValues {
124
+ }
125
+ MobileRedirectValues.InfoTop = 'Pentru a continua scanați codul de mai jos cu un smartphone.';
126
+ MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru a primi link-ul pe smartphone.';
127
+ MobileRedirectValues.Validation = 'Număr de telefon invalid!';
128
+ MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
@@ -0,0 +1 @@
1
+ export {};