@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,212 @@
1
+ import { h } from '@stencil/core';
2
+ import Events from '../../../helpers/Events';
3
+ import { Cameras } from '../../../helpers/Cameras';
4
+ import { Stream } from '../../../helpers/Stream';
5
+ import { IdCaptureValues } from '../../../helpers/textValues';
6
+ import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
7
+ import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
8
+ import { IDPose } from '../../../libs/IDML5Detector/IDPose';
9
+ // import { IDPose } from '../../libs/IDML5Detector/IDPose';
10
+ export class IdBackCapture {
11
+ // @State() private animationPath: string;
12
+ constructor() {
13
+ this.delay = ms => new Promise(res => setTimeout(res, ms));
14
+ this.photoIsReady = photos => {
15
+ //this.closeCamera();
16
+ this.eventPhotoCapture.emit(photos);
17
+ };
18
+ this.device = undefined;
19
+ this.videoStarted = undefined;
20
+ this.cameraSize = undefined;
21
+ this.captureTaken = undefined;
22
+ this.verified = undefined;
23
+ this.titleMesage = undefined;
24
+ this.showDemo = undefined;
25
+ this.demoVideo = undefined;
26
+ this.captureTaken = false;
27
+ this.verified = false;
28
+ this.cameras = new Cameras();
29
+ this.showDemo = true;
30
+ }
31
+ async eventChangeTitle(event) {
32
+ this.showDemo = true;
33
+ this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
34
+ this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.BackTilted];
35
+ this.demoVideo.play();
36
+ await this.delay(IdCaptureValues.VideoLenght);
37
+ this.showDemo = false;
38
+ }
39
+ eventVideoStarted(event) {
40
+ this.videoStarted = true;
41
+ this.cameraSize = event.detail;
42
+ }
43
+ async componentWillLoad() {
44
+ Events.init(this.component);
45
+ //this.videoDemoStyle = this.device.isMobile ? { width: window.screen.width + 'px', height: window.screen.height + 'px', 'object-fit': 'fill' } : {};
46
+ if (!navigator.mediaDevices) {
47
+ Events.flowError('This browser does not support webRTC');
48
+ }
49
+ }
50
+ async componentDidLoad() {
51
+ this.titleMesage = IdCaptureValues.TtileRotate;
52
+ this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Rotate];
53
+ this.demoVideo.play();
54
+ await this.delay(IdCaptureValues.VideoLenght);
55
+ this.titleMesage = IdCaptureValues.TitleBack;
56
+ this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.BackStraight];
57
+ this.demoVideo.play();
58
+ await this.delay(IdCaptureValues.VideoLenght);
59
+ this.showDemo = false;
60
+ this.openCamera();
61
+ }
62
+ async openCamera() {
63
+ let _cameras = await this.cameras.GetCameras(this.device);
64
+ var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
65
+ var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
66
+ setTimeout(() => {
67
+ navigator.mediaDevices
68
+ .getUserMedia(constraints)
69
+ .then(stream => {
70
+ const superStream = Stream.getInstance();
71
+ superStream.initStream(stream);
72
+ })
73
+ .catch(e => {
74
+ this.closeCamera();
75
+ Events.flowError(e);
76
+ });
77
+ }, 100);
78
+ }
79
+ closeCamera() {
80
+ if (Stream.instance) {
81
+ Stream.getInstance().dropStream();
82
+ }
83
+ }
84
+ disconnectedCallback() {
85
+ this.closeCamera();
86
+ Stream.instance = null;
87
+ IDML5Detector.instance = null;
88
+ FaceML5Detector.instance = null;
89
+ }
90
+ verificationFinished() {
91
+ if (this.verified)
92
+ return;
93
+ this.verified = true;
94
+ this.titleMesage = IdCaptureValues.Loading;
95
+ this.closeCamera();
96
+ this.showDemo = true;
97
+ this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
98
+ this.demoVideo.loop = true;
99
+ this.demoVideo.play();
100
+ }
101
+ async takePhoto() {
102
+ if (this.captureTaken)
103
+ return;
104
+ this.captureTaken = true;
105
+ let res = await Stream.getInstance().takePhoto();
106
+ this.photoIsReady(res);
107
+ }
108
+ render() {
109
+ let cameraStyle;
110
+ let cameraStyleInner;
111
+ if (this.videoStarted) {
112
+ cameraStyle = { width: Math.round(this.cameraSize.width) + 'px', height: Math.round((this.cameraSize.width * 9) / 16) + 'px', overflow: 'hidden', borderRadius: '10px' };
113
+ cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
114
+ }
115
+ let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
116
+ //let videoClass = this.device.isMobile ? '' : 'video-demo';
117
+ let bgDemo = this.verified ? 'container' : 'container bg-black';
118
+ return (h("div", { class: bgDemo }, h("div", { class: "container-video" }, h("div", { hidden: this.showDemo == false }, h("video", { id: "howtoBack", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { hidden: this.showDemo }, h("div", { hidden: this.verified }, h("div", { class: "video-capture" }, h("div", { style: cameraStyle }, h("div", { style: cameraStyleInner }, h("camera-comp", { device: this.device, "capture-mode": "id" })))))), h("div", { class: "capture-title" }, h("h1", { class: titleClass }, this.titleMesage), h("p", { class: "main-text font-size-18 text-right mb-0" }, IdCaptureValues.FooterText)))));
119
+ }
120
+ static get is() { return "id-back-capture"; }
121
+ static get originalStyleUrls() {
122
+ return {
123
+ "$": ["id-back-capture.css"]
124
+ };
125
+ }
126
+ static get styleUrls() {
127
+ return {
128
+ "$": ["id-back-capture.css"]
129
+ };
130
+ }
131
+ static get properties() {
132
+ return {
133
+ "device": {
134
+ "type": "unknown",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "Device",
138
+ "resolved": "Device",
139
+ "references": {
140
+ "Device": {
141
+ "location": "import",
142
+ "path": "../../../models/IDevice"
143
+ }
144
+ }
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": ""
151
+ }
152
+ }
153
+ };
154
+ }
155
+ static get states() {
156
+ return {
157
+ "videoStarted": {},
158
+ "cameraSize": {},
159
+ "captureTaken": {},
160
+ "verified": {},
161
+ "titleMesage": {},
162
+ "showDemo": {},
163
+ "demoVideo": {}
164
+ };
165
+ }
166
+ static get events() {
167
+ return [{
168
+ "method": "eventPhotoCapture",
169
+ "name": "photoIdBackCapture",
170
+ "bubbles": true,
171
+ "cancelable": true,
172
+ "composed": true,
173
+ "docs": {
174
+ "tags": [],
175
+ "text": ""
176
+ },
177
+ "complexType": {
178
+ "original": "any",
179
+ "resolved": "any",
180
+ "references": {}
181
+ }
182
+ }];
183
+ }
184
+ static get elementRef() { return "component"; }
185
+ static get listeners() {
186
+ return [{
187
+ "name": "changeTitle",
188
+ "method": "eventChangeTitle",
189
+ "target": undefined,
190
+ "capture": false,
191
+ "passive": false
192
+ }, {
193
+ "name": "videoStarted",
194
+ "method": "eventVideoStarted",
195
+ "target": undefined,
196
+ "capture": false,
197
+ "passive": false
198
+ }, {
199
+ "name": "verificationFinished",
200
+ "method": "verificationFinished",
201
+ "target": undefined,
202
+ "capture": false,
203
+ "passive": false
204
+ }, {
205
+ "name": "takePhoto",
206
+ "method": "takePhoto",
207
+ "target": undefined,
208
+ "capture": false,
209
+ "passive": false
210
+ }];
211
+ }
212
+ }
@@ -0,0 +1,35 @@
1
+ /* .cameraContainer {
2
+ width: 100%;
3
+ height: 100%;
4
+ z-index: 10;
5
+ position: relative;
6
+ overflow: hidden;
7
+ } */
8
+
9
+ .logo {
10
+ max-height: 450px;
11
+ max-width: 450px;
12
+ }
13
+
14
+ /* .block {
15
+ width: 90%;
16
+ padding-left: 5%;
17
+ padding-right: 5%;
18
+ margin-top: 5vh;
19
+ } */
20
+
21
+ .canvas-on-video {
22
+ max-width: 100%;
23
+ max-height: 100%;
24
+ position: absolute;
25
+ z-index: 2;
26
+ transform: scale(-1, 1);
27
+ }
28
+ /*
29
+ @media screen and (max-height: 414px) {
30
+ .logo {
31
+ background-size: 140px;
32
+ max-height: 140px;
33
+ max-width: 140px;
34
+ }
35
+ } */
@@ -0,0 +1,213 @@
1
+ import { h } from '@stencil/core';
2
+ import Events from '../../../helpers/Events';
3
+ import { Cameras } from '../../../helpers/Cameras';
4
+ import { Stream } from '../../../helpers/Stream';
5
+ import { IdCaptureValues } from '../../../helpers/textValues';
6
+ import { IDML5Detector } from '../../../libs/IDML5Detector/IDML5Detector';
7
+ import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
8
+ import { IDPose } from '../../../libs/IDML5Detector/IDPose';
9
+ // import { IDPose } from '../../libs/IDML5Detector/IDPose';
10
+ export class IdCapture {
11
+ // @State() private animationPath: string;
12
+ constructor() {
13
+ this.delay = ms => new Promise(res => setTimeout(res, ms));
14
+ this.photoIsReady = photos => {
15
+ //this.closeCamera();
16
+ this.eventPhotoCapture.emit(photos);
17
+ };
18
+ this.device = undefined;
19
+ this.videoStarted = undefined;
20
+ this.cameraSize = undefined;
21
+ this.captureTaken = undefined;
22
+ this.verified = undefined;
23
+ this.titleMesage = undefined;
24
+ this.showDemo = undefined;
25
+ this.demoVideo = undefined;
26
+ this.captureTaken = false;
27
+ this.verified = false;
28
+ this.cameras = new Cameras();
29
+ this.showDemo = true;
30
+ }
31
+ async eventChangeTitle(event) {
32
+ this.showDemo = true;
33
+ this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
34
+ this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Tilted];
35
+ this.demoVideo.play();
36
+ await this.delay(IdCaptureValues.VideoLenght);
37
+ this.showDemo = false;
38
+ }
39
+ eventVideoStarted(event) {
40
+ this.videoStarted = true;
41
+ this.cameraSize = event.detail;
42
+ }
43
+ async componentWillLoad() {
44
+ Events.init(this.component);
45
+ this.titleMesage = IdCaptureValues.Title;
46
+ //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
47
+ if (!navigator.mediaDevices) {
48
+ Events.flowError('This browser does not support webRTC');
49
+ }
50
+ }
51
+ async componentDidLoad() {
52
+ this.demoVideo.src = IdCaptureValues.IDPoseDemoMapping[IDPose.Straight];
53
+ this.demoVideo.play();
54
+ await this.delay(IdCaptureValues.VideoLenght);
55
+ this.showDemo = false;
56
+ this.openCamera();
57
+ }
58
+ async openCamera() {
59
+ let _cameras = await this.cameras.GetCameras(this.device);
60
+ var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
61
+ var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
62
+ setTimeout(() => {
63
+ navigator.mediaDevices
64
+ .getUserMedia(constraints)
65
+ .then(stream => {
66
+ const superStream = Stream.getInstance();
67
+ superStream.initStream(stream);
68
+ })
69
+ .catch(e => {
70
+ this.closeCamera();
71
+ Events.flowError(e);
72
+ });
73
+ }, 100);
74
+ }
75
+ closeCamera() {
76
+ if (Stream.instance) {
77
+ Stream.getInstance().dropStream();
78
+ }
79
+ }
80
+ disconnectedCallback() {
81
+ this.closeCamera();
82
+ Stream.instance = null;
83
+ IDML5Detector.instance = null;
84
+ FaceML5Detector.instance = null;
85
+ }
86
+ async takePhoto() {
87
+ if (this.captureTaken)
88
+ return;
89
+ this.captureTaken = true;
90
+ let res = await Stream.getInstance().takePhoto();
91
+ this.photoIsReady(res);
92
+ }
93
+ async verificationFinished() {
94
+ if (this.verified)
95
+ return;
96
+ this.verified = true;
97
+ this.titleMesage = IdCaptureValues.Loading;
98
+ this.closeCamera();
99
+ this.showDemo = true;
100
+ this.demoVideo.src = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_id.mp4';
101
+ this.demoVideo.loop = true;
102
+ this.demoVideo.play();
103
+ }
104
+ render() {
105
+ let cameraStyle;
106
+ let cameraStyleInner;
107
+ if (this.videoStarted) {
108
+ cameraStyle = {
109
+ width: Math.round(this.cameraSize.width) + 'px',
110
+ height: Math.round((this.cameraSize.width * 9) / 16) + 'px',
111
+ overflow: 'hidden',
112
+ borderRadius: '10px',
113
+ };
114
+ cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - (this.cameraSize.width * 9) / 16) / 2) * -1 + 'px' };
115
+ }
116
+ let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
117
+ //let videoClass = this.device.isMobile ? '' : 'video-demo';
118
+ let bgDemo = this.verified ? 'container' : 'container bg-black';
119
+ return (h("div", { class: bgDemo }, h("div", { class: "container-video" }, h("div", { hidden: this.showDemo == false }, h("video", { id: "howtoFront", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { hidden: this.showDemo }, h("div", { hidden: this.verified }, h("div", { class: "video-capture" }, h("div", { style: cameraStyle }, h("div", { style: cameraStyleInner }, h("camera-comp", { device: this.device, "capture-mode": "id" })))))), h("div", { class: "capture-title" }, h("h1", { class: titleClass }, this.titleMesage), h("p", { class: "main-text font-size-18 text-right mb-0" }, IdCaptureValues.FooterText)))));
120
+ }
121
+ static get is() { return "id-capture"; }
122
+ static get originalStyleUrls() {
123
+ return {
124
+ "$": ["id-capture.css"]
125
+ };
126
+ }
127
+ static get styleUrls() {
128
+ return {
129
+ "$": ["id-capture.css"]
130
+ };
131
+ }
132
+ static get properties() {
133
+ return {
134
+ "device": {
135
+ "type": "unknown",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "Device",
139
+ "resolved": "Device",
140
+ "references": {
141
+ "Device": {
142
+ "location": "import",
143
+ "path": "../../../models/IDevice"
144
+ }
145
+ }
146
+ },
147
+ "required": false,
148
+ "optional": false,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": ""
152
+ }
153
+ }
154
+ };
155
+ }
156
+ static get states() {
157
+ return {
158
+ "videoStarted": {},
159
+ "cameraSize": {},
160
+ "captureTaken": {},
161
+ "verified": {},
162
+ "titleMesage": {},
163
+ "showDemo": {},
164
+ "demoVideo": {}
165
+ };
166
+ }
167
+ static get events() {
168
+ return [{
169
+ "method": "eventPhotoCapture",
170
+ "name": "photoIdCapture",
171
+ "bubbles": true,
172
+ "cancelable": true,
173
+ "composed": true,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": ""
177
+ },
178
+ "complexType": {
179
+ "original": "any",
180
+ "resolved": "any",
181
+ "references": {}
182
+ }
183
+ }];
184
+ }
185
+ static get elementRef() { return "component"; }
186
+ static get listeners() {
187
+ return [{
188
+ "name": "changeTitle",
189
+ "method": "eventChangeTitle",
190
+ "target": undefined,
191
+ "capture": false,
192
+ "passive": false
193
+ }, {
194
+ "name": "videoStarted",
195
+ "method": "eventVideoStarted",
196
+ "target": undefined,
197
+ "capture": false,
198
+ "passive": false
199
+ }, {
200
+ "name": "takePhoto",
201
+ "method": "takePhoto",
202
+ "target": undefined,
203
+ "capture": false,
204
+ "passive": false
205
+ }, {
206
+ "name": "verificationFinished",
207
+ "method": "verificationFinished",
208
+ "target": undefined,
209
+ "capture": false,
210
+ "passive": false
211
+ }];
212
+ }
213
+ }
@@ -0,0 +1,7 @@
1
+ /* .cameraContainer {
2
+ width: 100%;
3
+ height: 100%;
4
+ z-index: 10;
5
+ position: relative;
6
+ overflow: hidden;
7
+ } */
@@ -0,0 +1,222 @@
1
+ import { h } from '@stencil/core';
2
+ import Events from '../../../helpers/Events';
3
+ import { Cameras } from '../../../helpers/Cameras';
4
+ import { Stream } from '../../../helpers/Stream';
5
+ import { SelfieCaptureValues } from '../../../helpers/textValues';
6
+ import { FaceML5Detector } from '../../../libs/FaceML5Detector/FaceML5Detector';
7
+ import { FacePose } from '../../../libs/FaceML5Detector/FacePose';
8
+ export class SelfieCapture {
9
+ // @State() private animationPath: string;
10
+ constructor() {
11
+ this.delay = ms => new Promise(res => setTimeout(res, ms));
12
+ this.photoIsReady = photos => {
13
+ //this.closeCamera();
14
+ this.eventPhotoCapture.emit(photos);
15
+ };
16
+ this.device = undefined;
17
+ this.videoStarted = undefined;
18
+ this.captureTaken = undefined;
19
+ this.verified = undefined;
20
+ this.titleMesage = undefined;
21
+ this.demoEnded = undefined;
22
+ this.demoVideo = undefined;
23
+ this.uploadingLink = undefined;
24
+ this.captureHeight = undefined;
25
+ this.captureWidth = undefined;
26
+ this.captureTaken = false;
27
+ this.verified = false;
28
+ this.cameras = new Cameras();
29
+ this.demoEnded = false;
30
+ this.uploadingLink = 'https://ekyc.blob.core.windows.net/$web/animations/uploading_selfie.mp4';
31
+ }
32
+ async eventChangeTitle(event) {
33
+ // this.stopAnimation = false;
34
+ if (event.detail == null) {
35
+ this.titleMesage = SelfieCaptureValues.FinalTitle;
36
+ }
37
+ else {
38
+ this.titleMesage = SelfieCaptureValues.FacePoseMapping[event.detail];
39
+ this.demoEnded = false;
40
+ this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[event.detail];
41
+ this.demoVideo.play();
42
+ await this.delay(SelfieCaptureValues.VideoLenght);
43
+ this.demoEnded = true;
44
+ }
45
+ }
46
+ eventVideoStarted(event) {
47
+ this.videoStarted = true;
48
+ var cameraSize = event.detail;
49
+ var height = Math.round((cameraSize.width * 16) / 9);
50
+ this.captureHeight = height - Math.round((window.screen.height - height) / 2);
51
+ this.captureWidth = Math.round((this.captureHeight * 9) / 16);
52
+ }
53
+ componentWillLoad() {
54
+ Events.init(this.component);
55
+ this.titleMesage = SelfieCaptureValues.Title;
56
+ //this.videoDemoStyle = this.device.isMobile ? { 'width': window.screen.width + 'px', 'height': window.screen.height + 'px', 'object-fit': 'fill' } : {};
57
+ if (!navigator.mediaDevices) {
58
+ Events.flowError('This browser does not support webRTC');
59
+ }
60
+ }
61
+ async componentDidLoad() {
62
+ this.demoVideo.src = SelfieCaptureValues.FacePoseDemoMapping[FacePose.Main];
63
+ this.demoVideo.play();
64
+ await this.delay(SelfieCaptureValues.VideoLenght);
65
+ this.demoEnded = true;
66
+ this.openCamera();
67
+ }
68
+ async openCamera() {
69
+ const constraints = this.cameras.GetConstraints('', this.device, true);
70
+ setTimeout(() => {
71
+ navigator.mediaDevices
72
+ .getUserMedia(constraints)
73
+ .then(stream => {
74
+ const superStream = Stream.getInstance();
75
+ superStream.initStream(stream);
76
+ })
77
+ .catch(e => {
78
+ this.closeCamera();
79
+ Events.flowError(e);
80
+ });
81
+ }, 100);
82
+ }
83
+ closeCamera() {
84
+ if (Stream.instance) {
85
+ Stream.getInstance().dropStream();
86
+ }
87
+ }
88
+ disconnectedCallback() {
89
+ this.closeCamera();
90
+ Stream.instance = null;
91
+ FaceML5Detector.instance = null;
92
+ }
93
+ async takePhoto() {
94
+ if (this.captureTaken)
95
+ return;
96
+ this.captureTaken = true;
97
+ let res = await Stream.getInstance().takePhoto();
98
+ this.photoIsReady(res);
99
+ }
100
+ verificationFinished() {
101
+ if (this.verified)
102
+ return;
103
+ this.verified = true;
104
+ this.titleMesage = SelfieCaptureValues.Loading;
105
+ this.closeCamera();
106
+ this.demoEnded = false;
107
+ this.demoVideo.src = this.uploadingLink;
108
+ this.demoVideo.loop = true;
109
+ this.demoVideo.play();
110
+ }
111
+ render() {
112
+ let cameraStyle;
113
+ if (this.device.isMobile && this.videoStarted) {
114
+ cameraStyle = {
115
+ 'width': this.captureWidth + 'px',
116
+ 'height': this.captureHeight + 'px',
117
+ 'overflow': 'hidden',
118
+ 'borderRadius': '10px',
119
+ 'text-align': 'center',
120
+ 'margin': 'auto',
121
+ };
122
+ }
123
+ let titleClass = this.verified ? 'color-black-2 text-center' : 'color-white text-center';
124
+ //let videoClass = this.device.isMobile ? '' : 'video-demo';
125
+ let bgDemo = this.verified ? 'container' : 'container bg-black';
126
+ return (h("div", { class: bgDemo }, h("div", { class: "container-video" }, h("div", { hidden: this.demoEnded }, h("video", { id: "howtoSelfie", class: "video-demo", playsinline: true, ref: el => (this.demoVideo = el) }, h("source", { type: "video/mp4" }))), h("div", { hidden: this.demoEnded == false }, h("div", { hidden: this.verified }, h("div", { class: "video-capture" }, h("div", { style: cameraStyle }, h("camera-comp", { device: this.device, "capture-mode": "selfie" }))))), h("div", { class: "capture-title" }, h("h1", { class: titleClass }, this.titleMesage), h("p", { class: "main-text font-size-18 text-right mb-0" }, SelfieCaptureValues.FooterText)))));
127
+ }
128
+ static get is() { return "selfie-capture"; }
129
+ static get originalStyleUrls() {
130
+ return {
131
+ "$": ["selfie-capture.css"]
132
+ };
133
+ }
134
+ static get styleUrls() {
135
+ return {
136
+ "$": ["selfie-capture.css"]
137
+ };
138
+ }
139
+ static get properties() {
140
+ return {
141
+ "device": {
142
+ "type": "unknown",
143
+ "mutable": false,
144
+ "complexType": {
145
+ "original": "Device",
146
+ "resolved": "Device",
147
+ "references": {
148
+ "Device": {
149
+ "location": "import",
150
+ "path": "../../../models/IDevice"
151
+ }
152
+ }
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": ""
159
+ }
160
+ }
161
+ };
162
+ }
163
+ static get states() {
164
+ return {
165
+ "videoStarted": {},
166
+ "captureTaken": {},
167
+ "verified": {},
168
+ "titleMesage": {},
169
+ "demoEnded": {},
170
+ "demoVideo": {},
171
+ "uploadingLink": {},
172
+ "captureHeight": {},
173
+ "captureWidth": {}
174
+ };
175
+ }
176
+ static get events() {
177
+ return [{
178
+ "method": "eventPhotoCapture",
179
+ "name": "photoSelfieCapture",
180
+ "bubbles": true,
181
+ "cancelable": true,
182
+ "composed": true,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": ""
186
+ },
187
+ "complexType": {
188
+ "original": "any",
189
+ "resolved": "any",
190
+ "references": {}
191
+ }
192
+ }];
193
+ }
194
+ static get elementRef() { return "component"; }
195
+ static get listeners() {
196
+ return [{
197
+ "name": "changeTitle",
198
+ "method": "eventChangeTitle",
199
+ "target": undefined,
200
+ "capture": false,
201
+ "passive": false
202
+ }, {
203
+ "name": "videoStarted",
204
+ "method": "eventVideoStarted",
205
+ "target": undefined,
206
+ "capture": false,
207
+ "passive": false
208
+ }, {
209
+ "name": "takePhoto",
210
+ "method": "takePhoto",
211
+ "target": undefined,
212
+ "capture": false,
213
+ "passive": false
214
+ }, {
215
+ "name": "verificationFinished",
216
+ "method": "verificationFinished",
217
+ "target": undefined,
218
+ "capture": false,
219
+ "passive": false
220
+ }];
221
+ }
222
+ }