@ekyc_qoobiss/qbs-ect-cmp 1.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/assets/animations/face/LookDown.gif +0 -0
- package/dist/assets/animations/face/LookLeft.gif +0 -0
- package/dist/assets/animations/face/LookRight.gif +0 -0
- package/dist/assets/animations/face/LookUp.gif +0 -0
- package/dist/assets/animations/face/TiltLeft.gif +0 -0
- package/dist/assets/animations/face/TiltRight.gif +0 -0
- package/dist/assets/animations/face/general.gif +0 -0
- package/dist/assets/animations/id/present-id.gif +0 -0
- package/dist/assets/animations/id/straighten-id.gif +0 -0
- package/dist/assets/animations/id/tilt-id.gif +0 -0
- package/dist/assets/buletin/metadata.json +1 -0
- package/dist/assets/buletin/model.json +1 -0
- package/dist/assets/buletin/weights.bin +0 -0
- package/dist/assets/buletin-v2/metadata.json +1 -0
- package/dist/assets/buletin-v2/model.json +1 -0
- package/dist/assets/buletin-v2/weights.bin +0 -0
- package/dist/assets/canvas-masks/face_green.svg +8 -0
- package/dist/assets/canvas-masks/face_white.svg +8 -0
- package/dist/assets/canvas-masks/id_green.svg +6 -0
- package/dist/assets/canvas-masks/id_white.svg +6 -0
- package/dist/assets/capture-error/idError.png +0 -0
- package/dist/assets/capture-error/idError.svg +8 -0
- package/dist/assets/capture-error/selfieError.png +0 -0
- package/dist/assets/capture-error/selfieError.svg +11 -0
- package/dist/assets/complete.svg +4 -0
- package/dist/assets/howtos/circle.svg +11 -0
- package/dist/assets/howtos/idscan.svg +293 -0
- package/dist/assets/howtos/liveness.svg +97 -0
- package/dist/assets/landing/device.svg +14 -0
- package/dist/assets/landing/id.svg +3 -0
- package/dist/assets/landing/info.svg +3 -0
- package/dist/assets/landing/validation.svg +16 -0
- package/dist/cjs/agreement-check_12.cjs.entry.js +6143 -0
- package/dist/cjs/index-9ebcada7.js +1487 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader-dots.cjs.entry.js +19 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/qbs-ect-cmp.cjs.js +19 -0
- package/dist/collection/assets/canvas-masks/face_green.svg +8 -0
- package/dist/collection/assets/canvas-masks/face_white.svg +8 -0
- package/dist/collection/assets/canvas-masks/id_green.svg +6 -0
- package/dist/collection/assets/canvas-masks/id_white.svg +6 -0
- package/dist/collection/assets/capture-error/idError.svg +8 -0
- package/dist/collection/assets/capture-error/selfieError.svg +11 -0
- package/dist/collection/assets/complete.svg +4 -0
- package/dist/collection/assets/howtos/circle.svg +11 -0
- package/dist/collection/assets/howtos/idscan.svg +293 -0
- package/dist/collection/assets/howtos/liveness.svg +97 -0
- package/dist/collection/assets/landing/device.svg +14 -0
- package/dist/collection/assets/landing/id.svg +3 -0
- package/dist/collection/assets/landing/info.svg +3 -0
- package/dist/collection/assets/landing/validation.svg +16 -0
- package/dist/collection/collection-manifest.json +24 -0
- package/dist/collection/components/agreement-check/agreement-check.css +0 -0
- package/dist/collection/components/agreement-check/agreement-check.js +75 -0
- package/dist/collection/components/agreement-info/agreement-info.css +0 -0
- package/dist/collection/components/agreement-info/agreement-info.js +72 -0
- package/dist/collection/components/capture-error/capture-error.css +0 -0
- package/dist/collection/components/capture-error/capture-error.js +107 -0
- package/dist/collection/components/controls/camera/camera.css +43 -0
- package/dist/collection/components/controls/camera/camera.js +306 -0
- package/dist/collection/components/controls/loader-dots/loader-dots.css +61 -0
- package/dist/collection/components/controls/loader-dots/loader-dots.js +18 -0
- package/dist/collection/components/end-redirect/end-redirect.css +128 -0
- package/dist/collection/components/end-redirect/end-redirect.js +25 -0
- package/dist/collection/components/how-to-info/how-to-info.css +0 -0
- package/dist/collection/components/how-to-info/how-to-info.js +105 -0
- package/dist/collection/components/id-back-capture/id-back-capture.css +35 -0
- package/dist/collection/components/id-back-capture/id-back-capture.js +201 -0
- package/dist/collection/components/id-capture/id-capture.css +35 -0
- package/dist/collection/components/id-capture/id-capture.js +201 -0
- package/dist/collection/components/identification-component/identification-component.css +999 -0
- package/dist/collection/components/identification-component/identification-component.js +397 -0
- package/dist/collection/components/landing-validation/landing-validation.css +0 -0
- package/dist/collection/components/landing-validation/landing-validation.js +78 -0
- package/dist/collection/components/selfie-capture/selfie-capture.css +22 -0
- package/dist/collection/components/selfie-capture/selfie-capture.js +198 -0
- package/dist/collection/components/sms-code-validation/sms-code-validation.css +0 -0
- package/dist/collection/components/sms-code-validation/sms-code-validation.js +91 -0
- package/dist/collection/global.js +0 -0
- package/dist/collection/helpers/ApiCall.js +153 -0
- package/dist/collection/helpers/Cameras.js +98 -0
- package/dist/collection/helpers/Events.js +79 -0
- package/dist/collection/helpers/ML5.js +20 -0
- package/dist/collection/helpers/Stream.js +223 -0
- package/dist/collection/helpers/canvas.js +10 -0
- package/dist/collection/helpers/index.js +54 -0
- package/dist/collection/helpers/security.js +25 -0
- package/dist/collection/helpers/store.js +15 -0
- package/dist/collection/helpers/textValues.js +82 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +206 -0
- package/dist/collection/libs/FaceML5Detector/FacePose.js +84 -0
- package/dist/collection/libs/IDML5Detector/IDML5Detector.js +110 -0
- package/dist/collection/libs/IDML5Detector/IDPose.js +5 -0
- package/dist/collection/models/ICamera.js +1 -0
- package/dist/collection/models/IConstraints.js +1 -0
- package/dist/collection/models/IDevice.js +1 -0
- package/dist/collection/utils/utils.js +10 -0
- package/dist/esm/agreement-check_12.entry.js +6128 -0
- package/dist/esm/index-3fe6775c.js +1457 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader-dots.entry.js +15 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qbs-ect-cmp.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/qbs-ect-cmp/index.esm.js +0 -0
- package/dist/qbs-ect-cmp/p-3ef0bad2.entry.js +1373 -0
- package/dist/qbs-ect-cmp/p-3fa495e4.js +2 -0
- package/dist/qbs-ect-cmp/p-a69bb428.entry.js +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.css +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -0
- package/dist/types/components/agreement-check/agreement-check.d.ts +11 -0
- package/dist/types/components/agreement-info/agreement-info.d.ts +13 -0
- package/dist/types/components/capture-error/capture-error.d.ts +11 -0
- package/dist/types/components/controls/camera/camera.d.ts +33 -0
- package/dist/types/components/controls/loader-dots/loader-dots.d.ts +3 -0
- package/dist/types/components/end-redirect/end-redirect.d.ts +4 -0
- package/dist/types/components/how-to-info/how-to-info.d.ts +13 -0
- package/dist/types/components/id-back-capture/id-back-capture.d.ts +26 -0
- package/dist/types/components/id-capture/id-capture.d.ts +26 -0
- package/dist/types/components/identification-component/identification-component.d.ts +31 -0
- package/dist/types/components/landing-validation/landing-validation.d.ts +11 -0
- package/dist/types/components/selfie-capture/selfie-capture.d.ts +26 -0
- package/dist/types/components/sms-code-validation/sms-code-validation.d.ts +14 -0
- package/dist/types/components.d.ts +262 -0
- package/dist/types/global.d.ts +0 -0
- package/dist/types/helpers/ApiCall.d.ts +12 -0
- package/dist/types/helpers/Cameras.d.ts +8 -0
- package/dist/types/helpers/Events.d.ts +12 -0
- package/dist/types/helpers/ML5.d.ts +8 -0
- package/dist/types/helpers/Stream.d.ts +58 -0
- package/dist/types/helpers/canvas.d.ts +2 -0
- package/dist/types/helpers/index.d.ts +4 -0
- package/dist/types/helpers/security.d.ts +4 -0
- package/dist/types/helpers/store.d.ts +10 -0
- package/dist/types/helpers/textValues.d.ts +78 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/libs/FaceML5Detector/FaceML5Detector.d.ts +43 -0
- package/dist/types/libs/FaceML5Detector/FacePose.d.ts +37 -0
- package/dist/types/libs/IDML5Detector/IDML5Detector.d.ts +22 -0
- package/dist/types/libs/IDML5Detector/IDPose.d.ts +4 -0
- package/dist/types/models/ICamera.d.ts +10 -0
- package/dist/types/models/IConstraints.d.ts +21 -0
- package/dist/types/models/IDevice.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/package.json +51 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { h, getAssetPath } 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
|
+
export class IdBackCapture {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.photoIsReady = photos => {
|
|
12
|
+
this.closeCamera();
|
|
13
|
+
this.eventPhotoCapture.emit(photos);
|
|
14
|
+
};
|
|
15
|
+
this.device = undefined;
|
|
16
|
+
this.videoStarted = undefined;
|
|
17
|
+
this.cameraSize = undefined;
|
|
18
|
+
this.stopAnimation = undefined;
|
|
19
|
+
this.captureTaken = undefined;
|
|
20
|
+
this.titleMesage = undefined;
|
|
21
|
+
this.animationPath = undefined;
|
|
22
|
+
this.captureTaken = false;
|
|
23
|
+
this.cameras = new Cameras();
|
|
24
|
+
}
|
|
25
|
+
eventChangeTitle(event) {
|
|
26
|
+
this.stopAnimation = false;
|
|
27
|
+
if (event.detail == IDPose.Tilted) {
|
|
28
|
+
this.animationPath = getAssetPath('../../assets/animations/id/tilt-id.gif');
|
|
29
|
+
}
|
|
30
|
+
if (event.detail == IDPose.Straight) {
|
|
31
|
+
this.animationPath = getAssetPath('../../assets/animations/id/straighten-id.gif');
|
|
32
|
+
}
|
|
33
|
+
this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
|
|
34
|
+
}
|
|
35
|
+
eventVideoStarted(event) {
|
|
36
|
+
this.videoStarted = true;
|
|
37
|
+
this.cameraSize = event.detail;
|
|
38
|
+
}
|
|
39
|
+
eventStopAnimation() {
|
|
40
|
+
this.stopAnimation = true;
|
|
41
|
+
}
|
|
42
|
+
async componentWillLoad() {
|
|
43
|
+
Events.init(this.component);
|
|
44
|
+
this.titleMesage = IdCaptureValues.Title;
|
|
45
|
+
if (!navigator.mediaDevices) {
|
|
46
|
+
Events.errorEvent('This browser does not support webRTC');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
componentDidLoad() {
|
|
50
|
+
this.openCamera();
|
|
51
|
+
this.animationPath = getAssetPath('../../assets/animations/id/present-id.gif');
|
|
52
|
+
}
|
|
53
|
+
async openCamera() {
|
|
54
|
+
let _cameras = await this.cameras.GetCameras(this.device);
|
|
55
|
+
var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
|
|
56
|
+
var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
navigator.mediaDevices
|
|
59
|
+
.getUserMedia(constraints)
|
|
60
|
+
.then(stream => {
|
|
61
|
+
const superStream = Stream.getInstance();
|
|
62
|
+
superStream.initStream(stream);
|
|
63
|
+
})
|
|
64
|
+
.catch(e => {
|
|
65
|
+
this.closeCamera();
|
|
66
|
+
Events.errorEvent(e);
|
|
67
|
+
});
|
|
68
|
+
}, 100);
|
|
69
|
+
}
|
|
70
|
+
closeCamera() {
|
|
71
|
+
if (Stream.instance) {
|
|
72
|
+
Events.closeEvent();
|
|
73
|
+
Stream.getInstance().dropStream();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
this.closeCamera();
|
|
78
|
+
Stream.instance = null;
|
|
79
|
+
IDML5Detector.instance = null;
|
|
80
|
+
FaceML5Detector.instance = null;
|
|
81
|
+
}
|
|
82
|
+
takePhoto() {
|
|
83
|
+
if (this.captureTaken)
|
|
84
|
+
return;
|
|
85
|
+
this.captureTaken = true;
|
|
86
|
+
this.titleMesage = IdCaptureValues.Loading;
|
|
87
|
+
Stream.getInstance()
|
|
88
|
+
.takePhoto()
|
|
89
|
+
.then(res => {
|
|
90
|
+
this.photoIsReady(res[0]);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
let loadingBlock;
|
|
95
|
+
if (this.captureTaken) {
|
|
96
|
+
loadingBlock = (h("div", { class: "pos-relative" }, h("div", { class: "dot-effect" }, h("div", { class: "snippet", "data-title": ".dot-shuttle" }, h("div", { class: "stage filter-contrast" }, h("div", { class: "dot-shuttle" }))))));
|
|
97
|
+
}
|
|
98
|
+
let animationBlock;
|
|
99
|
+
if (this.videoStarted && this.stopAnimation !== true) {
|
|
100
|
+
animationBlock = (h("img", { class: "animation", "data-src": this.animationPath, src: this.animationPath }));
|
|
101
|
+
}
|
|
102
|
+
let cameraStyle;
|
|
103
|
+
let cameraStyleInner;
|
|
104
|
+
if (this.videoStarted) {
|
|
105
|
+
cameraStyle = { width: Math.round(this.cameraSize.width) + 'px', height: Math.round(this.cameraSize.width * 9 / 16) + 'px', overflow: 'hidden', borderRadius: '10px' };
|
|
106
|
+
cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - this.cameraSize.width * 9 / 16) / 2) * -1 + 'px' };
|
|
107
|
+
}
|
|
108
|
+
return (h("div", { class: "container bg-black" }, h("div", { class: "row ctheight-100" }, h("div", null, h("h1", { class: "color-white" }, this.titleMesage)), h("div", { hidden: this.captureTaken, class: "chenar-buletin pos-relative" }, animationBlock, h("div", { style: cameraStyle }, h("div", { style: cameraStyleInner }, h("camera-comp", { device: this.device, "capture-mode": "id" })))), loadingBlock, h("div", { class: "pos-relative" }, h("p", { class: "main-text font-size-18 text-right mb-0" }, IdCaptureValues.FooterText)))));
|
|
109
|
+
}
|
|
110
|
+
static get is() { return "id-back-capture"; }
|
|
111
|
+
static get originalStyleUrls() {
|
|
112
|
+
return {
|
|
113
|
+
"$": ["id-back-capture.css"]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static get styleUrls() {
|
|
117
|
+
return {
|
|
118
|
+
"$": ["id-back-capture.css"]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
static get properties() {
|
|
122
|
+
return {
|
|
123
|
+
"device": {
|
|
124
|
+
"type": "unknown",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "Device",
|
|
128
|
+
"resolved": "Device",
|
|
129
|
+
"references": {
|
|
130
|
+
"Device": {
|
|
131
|
+
"location": "import",
|
|
132
|
+
"path": "../../models/IDevice"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": ""
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
static get states() {
|
|
146
|
+
return {
|
|
147
|
+
"videoStarted": {},
|
|
148
|
+
"cameraSize": {},
|
|
149
|
+
"stopAnimation": {},
|
|
150
|
+
"captureTaken": {},
|
|
151
|
+
"titleMesage": {},
|
|
152
|
+
"animationPath": {}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
static get events() {
|
|
156
|
+
return [{
|
|
157
|
+
"method": "eventPhotoCapture",
|
|
158
|
+
"name": "photoIdBackCapture",
|
|
159
|
+
"bubbles": true,
|
|
160
|
+
"cancelable": true,
|
|
161
|
+
"composed": true,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": ""
|
|
165
|
+
},
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "any",
|
|
168
|
+
"resolved": "any",
|
|
169
|
+
"references": {}
|
|
170
|
+
}
|
|
171
|
+
}];
|
|
172
|
+
}
|
|
173
|
+
static get elementRef() { return "component"; }
|
|
174
|
+
static get listeners() {
|
|
175
|
+
return [{
|
|
176
|
+
"name": "changeTitle",
|
|
177
|
+
"method": "eventChangeTitle",
|
|
178
|
+
"target": undefined,
|
|
179
|
+
"capture": false,
|
|
180
|
+
"passive": false
|
|
181
|
+
}, {
|
|
182
|
+
"name": "videoStarted",
|
|
183
|
+
"method": "eventVideoStarted",
|
|
184
|
+
"target": undefined,
|
|
185
|
+
"capture": false,
|
|
186
|
+
"passive": false
|
|
187
|
+
}, {
|
|
188
|
+
"name": "stopAnimation",
|
|
189
|
+
"method": "eventStopAnimation",
|
|
190
|
+
"target": undefined,
|
|
191
|
+
"capture": false,
|
|
192
|
+
"passive": false
|
|
193
|
+
}, {
|
|
194
|
+
"name": "takePhoto",
|
|
195
|
+
"method": "takePhoto",
|
|
196
|
+
"target": undefined,
|
|
197
|
+
"capture": false,
|
|
198
|
+
"passive": false
|
|
199
|
+
}];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -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,201 @@
|
|
|
1
|
+
import { h, getAssetPath } 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
|
+
export class IdCapture {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.photoIsReady = photos => {
|
|
12
|
+
this.closeCamera();
|
|
13
|
+
this.eventPhotoCapture.emit(photos);
|
|
14
|
+
};
|
|
15
|
+
this.device = undefined;
|
|
16
|
+
this.videoStarted = undefined;
|
|
17
|
+
this.cameraSize = undefined;
|
|
18
|
+
this.stopAnimation = undefined;
|
|
19
|
+
this.captureTaken = undefined;
|
|
20
|
+
this.titleMesage = undefined;
|
|
21
|
+
this.animationPath = undefined;
|
|
22
|
+
this.captureTaken = false;
|
|
23
|
+
this.cameras = new Cameras();
|
|
24
|
+
}
|
|
25
|
+
eventChangeTitle(event) {
|
|
26
|
+
this.stopAnimation = false;
|
|
27
|
+
if (event.detail == IDPose.Tilted) {
|
|
28
|
+
this.animationPath = getAssetPath('../../assets/animations/id/tilt-id.gif');
|
|
29
|
+
}
|
|
30
|
+
if (event.detail == IDPose.Straight) {
|
|
31
|
+
this.animationPath = getAssetPath('../../assets/animations/id/straighten-id.gif');
|
|
32
|
+
}
|
|
33
|
+
this.titleMesage = IdCaptureValues.IDPoseMapping[event.detail];
|
|
34
|
+
}
|
|
35
|
+
eventVideoStarted(event) {
|
|
36
|
+
this.videoStarted = true;
|
|
37
|
+
this.cameraSize = event.detail;
|
|
38
|
+
}
|
|
39
|
+
eventStopAnimation() {
|
|
40
|
+
this.stopAnimation = true;
|
|
41
|
+
}
|
|
42
|
+
async componentWillLoad() {
|
|
43
|
+
Events.init(this.component);
|
|
44
|
+
this.titleMesage = IdCaptureValues.Title;
|
|
45
|
+
if (!navigator.mediaDevices) {
|
|
46
|
+
Events.errorEvent('This browser does not support webRTC');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
componentDidLoad() {
|
|
50
|
+
this.openCamera();
|
|
51
|
+
this.animationPath = getAssetPath('../../assets/animations/id/present-id.gif');
|
|
52
|
+
}
|
|
53
|
+
async openCamera() {
|
|
54
|
+
let _cameras = await this.cameras.GetCameras(this.device);
|
|
55
|
+
var recommCamera = this.cameras.GetRecommendedCamera(_cameras);
|
|
56
|
+
var constraints = this.cameras.GetConstraints(recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId, this.device);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
navigator.mediaDevices
|
|
59
|
+
.getUserMedia(constraints)
|
|
60
|
+
.then(stream => {
|
|
61
|
+
const superStream = Stream.getInstance();
|
|
62
|
+
superStream.initStream(stream);
|
|
63
|
+
})
|
|
64
|
+
.catch(e => {
|
|
65
|
+
this.closeCamera();
|
|
66
|
+
Events.errorEvent(e);
|
|
67
|
+
});
|
|
68
|
+
}, 100);
|
|
69
|
+
}
|
|
70
|
+
closeCamera() {
|
|
71
|
+
if (Stream.instance) {
|
|
72
|
+
Events.closeEvent();
|
|
73
|
+
Stream.getInstance().dropStream();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
this.closeCamera();
|
|
78
|
+
Stream.instance = null;
|
|
79
|
+
IDML5Detector.instance = null;
|
|
80
|
+
FaceML5Detector.instance = null;
|
|
81
|
+
}
|
|
82
|
+
takePhoto() {
|
|
83
|
+
if (this.captureTaken)
|
|
84
|
+
return;
|
|
85
|
+
this.captureTaken = true;
|
|
86
|
+
this.titleMesage = IdCaptureValues.Loading;
|
|
87
|
+
Stream.getInstance()
|
|
88
|
+
.takePhoto()
|
|
89
|
+
.then(res => {
|
|
90
|
+
this.photoIsReady(res[0]);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
let loadingBlock;
|
|
95
|
+
if (this.captureTaken) {
|
|
96
|
+
loadingBlock = (h("div", { class: "pos-relative" }, h("div", { class: "dot-effect" }, h("div", { class: "snippet", "data-title": ".dot-shuttle" }, h("div", { class: "stage filter-contrast" }, h("div", { class: "dot-shuttle" }))))));
|
|
97
|
+
}
|
|
98
|
+
let animationBlock;
|
|
99
|
+
if (this.videoStarted && this.stopAnimation !== true) {
|
|
100
|
+
animationBlock = (h("img", { class: "animation", "data-src": this.animationPath, src: this.animationPath }));
|
|
101
|
+
}
|
|
102
|
+
let cameraStyle;
|
|
103
|
+
let cameraStyleInner;
|
|
104
|
+
if (this.videoStarted) {
|
|
105
|
+
cameraStyle = { width: Math.round(this.cameraSize.width) + 'px', height: Math.round(this.cameraSize.width * 9 / 16) + 'px', overflow: 'hidden', borderRadius: '10px' };
|
|
106
|
+
cameraStyleInner = { marginTop: Math.round((this.cameraSize.height - this.cameraSize.width * 9 / 16) / 2) * -1 + 'px' };
|
|
107
|
+
}
|
|
108
|
+
return (h("div", { class: "container bg-black" }, h("div", { class: "row ctheight-100" }, h("div", null, h("h1", { class: "color-white" }, this.titleMesage)), h("div", { hidden: this.captureTaken, class: "chenar-buletin pos-relative" }, animationBlock, h("div", { style: cameraStyle }, h("div", { style: cameraStyleInner }, h("camera-comp", { device: this.device, "capture-mode": "id" })))), loadingBlock, h("div", { class: "pos-relative" }, h("p", { class: "main-text font-size-18 text-right mb-0" }, IdCaptureValues.FooterText)))));
|
|
109
|
+
}
|
|
110
|
+
static get is() { return "id-capture"; }
|
|
111
|
+
static get originalStyleUrls() {
|
|
112
|
+
return {
|
|
113
|
+
"$": ["id-capture.css"]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static get styleUrls() {
|
|
117
|
+
return {
|
|
118
|
+
"$": ["id-capture.css"]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
static get properties() {
|
|
122
|
+
return {
|
|
123
|
+
"device": {
|
|
124
|
+
"type": "unknown",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "Device",
|
|
128
|
+
"resolved": "Device",
|
|
129
|
+
"references": {
|
|
130
|
+
"Device": {
|
|
131
|
+
"location": "import",
|
|
132
|
+
"path": "../../models/IDevice"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": ""
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
static get states() {
|
|
146
|
+
return {
|
|
147
|
+
"videoStarted": {},
|
|
148
|
+
"cameraSize": {},
|
|
149
|
+
"stopAnimation": {},
|
|
150
|
+
"captureTaken": {},
|
|
151
|
+
"titleMesage": {},
|
|
152
|
+
"animationPath": {}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
static get events() {
|
|
156
|
+
return [{
|
|
157
|
+
"method": "eventPhotoCapture",
|
|
158
|
+
"name": "photoIdCapture",
|
|
159
|
+
"bubbles": true,
|
|
160
|
+
"cancelable": true,
|
|
161
|
+
"composed": true,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": ""
|
|
165
|
+
},
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "any",
|
|
168
|
+
"resolved": "any",
|
|
169
|
+
"references": {}
|
|
170
|
+
}
|
|
171
|
+
}];
|
|
172
|
+
}
|
|
173
|
+
static get elementRef() { return "component"; }
|
|
174
|
+
static get listeners() {
|
|
175
|
+
return [{
|
|
176
|
+
"name": "changeTitle",
|
|
177
|
+
"method": "eventChangeTitle",
|
|
178
|
+
"target": undefined,
|
|
179
|
+
"capture": false,
|
|
180
|
+
"passive": false
|
|
181
|
+
}, {
|
|
182
|
+
"name": "videoStarted",
|
|
183
|
+
"method": "eventVideoStarted",
|
|
184
|
+
"target": undefined,
|
|
185
|
+
"capture": false,
|
|
186
|
+
"passive": false
|
|
187
|
+
}, {
|
|
188
|
+
"name": "stopAnimation",
|
|
189
|
+
"method": "eventStopAnimation",
|
|
190
|
+
"target": undefined,
|
|
191
|
+
"capture": false,
|
|
192
|
+
"passive": false
|
|
193
|
+
}, {
|
|
194
|
+
"name": "takePhoto",
|
|
195
|
+
"method": "takePhoto",
|
|
196
|
+
"target": undefined,
|
|
197
|
+
"capture": false,
|
|
198
|
+
"passive": false
|
|
199
|
+
}];
|
|
200
|
+
}
|
|
201
|
+
}
|