@idscan/idvc2 2.1.6 → 2.2.1
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/README.md +14 -0
- package/dist/css/idvc.css +1 -1
- package/dist/idvc.js +2 -0
- package/dist/{js/idvc.js.LICENSE.txt → idvc.js.LICENSE.txt} +15 -32
- package/dist/index.html +16 -16
- package/dist/js/environment/langs.ts +12 -6
- package/dist/js/environment/networkNames.json +9 -14
- package/dist/js/environment/stepsDescription.ts +3 -3
- package/dist/js/geometry.d.ts +8 -0
- package/dist/js/index.d.ts +3 -0
- package/dist/js/loop.d.ts +21 -0
- package/dist/networks/130.0b466182.js +1 -0
- package/dist/networks/215.bf164218.js +1 -0
- package/dist/networks/400.8e839581.js +1 -0
- package/dist/networks/716.7c63165d.js +1 -0
- package/dist/networks/Face.728ec3c6.js +1 -0
- package/dist/networks/MRZ.16515b82.js +1 -0
- package/dist/networks/PDF.04105754.js +1 -0
- package/dist/networks/ZXing.d5fea691.js +1 -0
- package/dist/networks/asyncLoader.52c5ed04.js +1 -0
- package/dist/networks/cdnLoader.2caa8b83.js +1 -0
- package/dist/networks/detectormodel20220817.bin +0 -0
- package/dist/networks/detectormodel20220817.json +1 -0
- package/dist/networks/landmarkmodel20220817.bin +0 -0
- package/dist/networks/landmarkmodel20220817.json +1 -0
- package/package.json +52 -49
- package/dist/js/idvc.js +0 -2
- package/dist/modules/libheif2.js +0 -433
- package/dist/networks/blazeface20210831.bin +0 -0
- package/dist/networks/blazeface20210831.json +0 -1
|
@@ -11,23 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
/*!mobile-detect v1.4.5 2021-03-13*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
* =============================================================================
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
14
|
/**
|
|
32
15
|
* @license
|
|
33
16
|
* Copyright 2017 Google LLC. All Rights Reserved.
|
|
@@ -217,20 +200,20 @@
|
|
|
217
200
|
*/
|
|
218
201
|
|
|
219
202
|
/**
|
|
220
|
-
* @license
|
|
221
|
-
* Copyright
|
|
222
|
-
* Licensed under the Apache License, Version 2.0 (the
|
|
223
|
-
* you may not use this file except in compliance with the License.
|
|
224
|
-
* You may obtain a copy of the License at
|
|
225
|
-
*
|
|
226
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
227
|
-
*
|
|
228
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
229
|
-
* distributed under the License is distributed on an
|
|
230
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
231
|
-
* See the License for the specific language governing permissions and
|
|
232
|
-
* limitations under the License.
|
|
233
|
-
* =============================================================================
|
|
234
|
-
*/
|
|
203
|
+
* @license
|
|
204
|
+
* Copyright 2022 Google LLC. All Rights Reserved.
|
|
205
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
206
|
+
* you may not use this file except in compliance with the License.
|
|
207
|
+
* You may obtain a copy of the License at
|
|
208
|
+
*
|
|
209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
210
|
+
*
|
|
211
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
212
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
|
+
* See the License for the specific language governing permissions and
|
|
215
|
+
* limitations under the License.
|
|
216
|
+
* =============================================================================
|
|
217
|
+
*/
|
|
235
218
|
|
|
236
219
|
/** @license See the LICENSE file. */
|
package/dist/index.html
CHANGED
|
@@ -5,28 +5,30 @@
|
|
|
5
5
|
.container {
|
|
6
6
|
max-width: 480px;
|
|
7
7
|
margin: 0 auto;
|
|
8
|
-
}</style></head><body><div class="container"><div id="videoCapturingEl"></div></div><button id="btn">Show Spinner</button> <button id="btn-reload">Reload component</button> <button id="btn-change-en">En</button> <button id="btn-change-es">Es</button><script src="
|
|
8
|
+
}</style></head><body><div class="container"><div id="videoCapturingEl"></div></div><button id="btn">Show Spinner</button> <button id="btn-reload">Reload component</button> <button id="btn-change-en">En</button> <button id="btn-change-es">Es</button><script src="idvc.js"></script><script type="module">import IDVC from './idvc.js'
|
|
9
|
+
// LESHA: 'eyJwZGY0MTdrZXkiOiJRZmw3UlhrM2tocHlVQXY3SUFCVUF1L1lkUkpvYW9HRGpZQ3RFN3NlSUFXc0dFT3FpeFpiN1dzMDdsSmtzTVorZk5PNVYvTDZXZEhBRy9RTW94SkEzOE5aUUk4WnJ5dTdrOUpySWg3Y2J4K25wV0JzZXZzVkJFNm9FaHlCUUhsdGhYM2h2UWJ1TXkzNlQySlo2Sm8yeklOZ1Y5Q2ZVU1hVMjN3WDJGbGtIRGc9IiwiaW1hZ2VQcm9jZXNzaW5nS2V5IjoidHVJbStyQThKb0pUeHlFU3FRbCt4RjRweWI1ZXkwSllXNWhhQWpjcjBnWHpaVHU2NFJBYlpMQjRWaVNCWlpGVmhISElybFp0NFlRUFVCRElWNmU0OG95RndkWnVLRllINFNuUlZKSEpBaDB6Y0lONzZXTDBVMWZRdkJNK1lQL293dFQreWxpK2NkUk9jOXRVVHR5U2NsbTZPblFlNU4yK1FDdDdBTmx6NmEwPSIsInRyYWNrU3RyaW5nUGFyc2VyS2V5IjoiQ1ZGOThTdHFqVXU2R09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FlNU4yK1FDdDdBTmx6NmEwPSIsInRyYWNrU3RyaW5nUGFyc2VyS2V5IjoiQ1ZGOThTdHFqVXU2R09GejNVQUF4KzY2VzhaUWhGQzRMUnJodDU0K3ZDMFdtbUo1Qi91QlpLSEhWdWo4VnYvdnB2ajBybUdES3RIQmtERlY1Y1JhbE5PZkNvZFNZU0lSOTVoTnJNYXhqRU12eVpDcmNXblovSmtmSnoxS3lYNDBqa1Ryb3NrYWpQbTQrRnpDd3Vwa0dYUlRkMXVDSTkvSGE3T1E5YitTN3BzPSIsImNvbW1vbkxpY2Vuc2VLZXkiOiJ3U0s1NU5NVW1UMzRnRDltNE1DL25EK2tEdlE5Vi9SWUp2YXl5WlFOYXVYMjk0VGVMek5qaE44OTlKNElscW9ZNFIrenh2SWhkM2dCQVRXaFB0WEt6NWFJbWdWN1phNWVPZFFwcVVRN3ZBaGxSZ3dnZFVCdnhyTUdkc29RT0lDMnBaR0NiYmowWnZNZXdCYmVYVmhRUWdua0k4N0hXMFVCUzBBVHROTkNoR0k9In0=',
|
|
14
|
+
autoContinue: true,
|
|
14
15
|
fixFrontOrientAfterUpload: false,
|
|
15
16
|
parsePDF: true,
|
|
16
|
-
realFaceMode: '
|
|
17
|
-
useCDN:
|
|
17
|
+
realFaceMode: 'all', // none, auto, all
|
|
18
|
+
useCDN: true,
|
|
18
19
|
useHeic: false,
|
|
19
20
|
isSubmitMetaData: true,
|
|
20
21
|
resizeUploadedImage: 2000,
|
|
21
22
|
isShowDocumentTypeSelect: false,
|
|
23
|
+
isShowGuidelinesButton: true,
|
|
22
24
|
language: 'en',
|
|
23
25
|
documentTypes: [
|
|
24
26
|
{
|
|
25
27
|
type: 'ID',
|
|
26
28
|
steps:[
|
|
27
29
|
{ type: 'front', name: 'Document Front', mode: { uploader: true, video: true } },
|
|
28
|
-
{ type: 'pdf', name: 'Document PDF417 Barcode', mode: { uploader: true, video:
|
|
29
|
-
{ type: 'face', name: 'Face', mode: { uploader: true, video:
|
|
30
|
+
{ type: 'pdf', name: 'Document PDF417 Barcode', mode: { uploader: true, video: true } },
|
|
31
|
+
{ type: 'face', name: 'Face', mode: { uploader: true, video: true } },
|
|
30
32
|
// { type: 'mrz', name: 'Document MRZ', mode: { uploader: true, video: true } },
|
|
31
33
|
],
|
|
32
34
|
},
|
|
@@ -43,12 +45,12 @@
|
|
|
43
45
|
// ],
|
|
44
46
|
// },
|
|
45
47
|
// {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
// type: 'Passport',
|
|
49
|
+
// steps:[
|
|
50
|
+
// { type: 'front', name: 'Document Front' },
|
|
51
|
+
// { type: 'mrz', name: 'Passport Front', mode: { uploader: true, video: true } },
|
|
52
|
+
// { type: 'face', name: 'Face', mode: { uploader: false, video: true } }
|
|
53
|
+
// ],
|
|
52
54
|
// },
|
|
53
55
|
],
|
|
54
56
|
clickGuidlines () {
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
console.log('onMounted');
|
|
77
79
|
},
|
|
78
80
|
};
|
|
79
|
-
const videoCapturingComponent = new IDVC
|
|
81
|
+
const videoCapturingComponent = new IDVC(config);
|
|
80
82
|
let k = false
|
|
81
83
|
document.getElementById('btn').addEventListener('click', () => {
|
|
82
84
|
k = !k
|
|
@@ -87,10 +89,8 @@
|
|
|
87
89
|
videoCapturingComponent.reloadComponent(config);
|
|
88
90
|
})
|
|
89
91
|
document.getElementById('btn-change-en').addEventListener('click', () => {
|
|
90
|
-
|
|
91
92
|
videoCapturingComponent.changeLanguage('en');
|
|
92
93
|
})
|
|
93
94
|
document.getElementById('btn-change-es').addEventListener('click', () => {
|
|
94
|
-
|
|
95
95
|
videoCapturingComponent.changeLanguage('es');
|
|
96
96
|
})</script></body></html>
|
|
@@ -44,8 +44,10 @@ interface IHintTexts {
|
|
|
44
44
|
hold: string,
|
|
45
45
|
dontSee: string,
|
|
46
46
|
dontMove: string,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
turnFaceLeft: string,
|
|
48
|
+
turnFaceRight: string,
|
|
49
|
+
turnFaceUp: string,
|
|
50
|
+
turnFaceDown: string,
|
|
49
51
|
faceCam: string,
|
|
50
52
|
camAway: string,
|
|
51
53
|
moveCenter: string,
|
|
@@ -134,8 +136,10 @@ const labels: AllLabels = {
|
|
|
134
136
|
hold: 'Sostener el **placeholder** lado del documento <br> dentro de la caja',
|
|
135
137
|
dontSee: 'No te veo',
|
|
136
138
|
dontMove: 'No te muevas',
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
turnFaceLeft: 'Gira la cara a la izquierda',
|
|
140
|
+
turnFaceRight: 'Gira la cara a la derecha',
|
|
141
|
+
turnFaceUp: 'Levanta tu cara',
|
|
142
|
+
turnFaceDown: 'Bajar la cara',
|
|
139
143
|
faceCam: 'Enfréntate a la cámara',
|
|
140
144
|
camAway: 'Mover la cámara más lejos',
|
|
141
145
|
moveCenter: 'Mover al centro',
|
|
@@ -215,8 +219,10 @@ const labels: AllLabels = {
|
|
|
215
219
|
hold: 'Hold the **placeholder** side of the document <br> inside the box',
|
|
216
220
|
dontSee: 'I don\'t see you',
|
|
217
221
|
dontMove: 'Don\'t move',
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
turnFaceLeft: 'Turn your face left',
|
|
223
|
+
turnFaceRight: 'Turn your face right',
|
|
224
|
+
turnFaceUp: 'Turn your face up',
|
|
225
|
+
turnFaceDown: 'Turn your face down',
|
|
220
226
|
faceCam: 'Face the camera',
|
|
221
227
|
camAway: 'Move camera further away',
|
|
222
228
|
moveCenter: 'Move to the center',
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"neurons": {
|
|
3
3
|
"angles": "angles20210831.json",
|
|
4
|
-
"blazeface": "blazeface20210831.json",
|
|
5
|
-
"facemesh": "facemesh20210831.json",
|
|
6
4
|
"mrz": "mrz20220531.json",
|
|
7
|
-
"classLocalModel": "classLocal20220112.json"
|
|
5
|
+
"classLocalModel": "classLocal20220112.json",
|
|
6
|
+
"landmarkmodel": "landmarkmodel20220817.json",
|
|
7
|
+
"detectormodel": "detectormodel20220817.json"
|
|
8
8
|
},
|
|
9
9
|
"modules": {
|
|
10
10
|
"MRZModule": "MRZModule20220606.js",
|
|
11
|
-
"PDF417MODULE": "
|
|
12
|
-
"SimpleFaceModule": "
|
|
13
|
-
"
|
|
14
|
-
"MeshFaceModule": "MeshFaceModule20220718.js",
|
|
11
|
+
"PDF417MODULE": "PDF417MODULE20220728.js",
|
|
12
|
+
"SimpleFaceModule": "SimpleFaceModule20220728.js",
|
|
13
|
+
"MeshFaceModule": "MeshFaceModule20221026.js",
|
|
15
14
|
"BarcodeModule": "BarcodeModule20220324.js",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"PDF417": "PDF41720220324.js",
|
|
15
|
+
"PICO": "PICO20220811.js",
|
|
16
|
+
"PDF417": "PDF41720220729.js",
|
|
19
17
|
"MRZCore": "MRZCore20220718.js",
|
|
20
|
-
"ZXingReader": "ZXingReader20220324.js"
|
|
21
|
-
"blur": "blur20220718.js",
|
|
22
|
-
"TFBlazeFace": "blazeface.js",
|
|
23
|
-
"FaceLandmarksDetector": "face-landmarks-detection.js"
|
|
18
|
+
"ZXingReader": "ZXingReader20220324.js"
|
|
24
19
|
}
|
|
25
20
|
}
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
time: 5,
|
|
9
9
|
max: 0.15,
|
|
10
10
|
core: [
|
|
11
|
-
'tf', 'mrz',
|
|
11
|
+
'tf', 'mrz',
|
|
12
12
|
],
|
|
13
13
|
description: 'capture of a document with the following analysis of the document type. In case if a document requires the back side, the step for the back side of a document will be added automatically. Use the step 'front' if you use the component for the document validation.',
|
|
14
14
|
},
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
time: 5,
|
|
30
30
|
max: 0.15,
|
|
31
31
|
core: [
|
|
32
|
-
'tf',
|
|
32
|
+
'tf',
|
|
33
33
|
],
|
|
34
34
|
description: 'capture front of a document without analysis.',
|
|
35
35
|
},
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
time: 10,
|
|
61
61
|
max: 0.33,
|
|
62
62
|
core: [
|
|
63
|
-
'face',
|
|
63
|
+
'face',
|
|
64
64
|
],
|
|
65
65
|
description: 'detection and capture of a face using the front camera.',
|
|
66
66
|
},
|
package/dist/js/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StepType } from '../environment/stepsDescription';
|
|
2
|
+
|
|
3
|
+
export interface StepResultError {
|
|
4
|
+
errorType: string,
|
|
5
|
+
errorVal: 0 | 1,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface StepFunctionResult {
|
|
9
|
+
type: StepType | 'VolumeFace',
|
|
10
|
+
cancel: boolean;
|
|
11
|
+
image: null | ImageData;
|
|
12
|
+
touch: boolean;
|
|
13
|
+
status: boolean
|
|
14
|
+
error?: StepResultError,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Cancel = (
|
|
18
|
+
topImage: ImageData,
|
|
19
|
+
cancelPredict?: boolean,
|
|
20
|
+
byTouch?: boolean,
|
|
21
|
+
) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
onmessage=({data:e})=>{Object.keys(e).forEach(((t,n)=>{fetch(e[t]).then((e=>e.body)).then((e=>{const t=e.getReader();return new ReadableStream({start(e){!function n(){t.read().then((({done:t,value:s})=>{t?e.close():(e.enqueue(s),n())}))}()}})})).then((e=>new Response(e,{headers:{"Content-Type":"text/javascript"}}).text())).then((t=>{const s=`executedScript${n}`,a="scriptExecuted";let c=t;c+=`\n const event = new Event('${a}');\n document.getElementById('${s}').dispatchEvent(event);\n `,Object.keys(e).length,postMessage({value:c,id:s,event:a})}))}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=(t,e)=>t-e,e=(t,e)=>t+e,r=(t,e)=>t%e>1?t-1:-1,n=(t,e)=>(t+1)%e>=0?t+1:-1,s=(e,n)=>r(t(e,n),n),a=(e,r)=>n(t(e,r),r),o=(t,n)=>r(e(t,n),n),c=(t,r)=>n(e(t,r),r),h=(h,i)=>[s,t,a,n,c,e,o,r].map((t=>t(h,i))),i=(t,e)=>{const r=[],n=[],s=t.length;let a,o=0;const c=()=>{const a=e=>e>0&&0!==t[e]&&e<s;for(;r.length;){const s=r.pop();if(!s)break;t[s]=0,n[o].add(s),h(s,e).forEach((t=>{a(t)&&r.push(t)}))}};for(a=0;a<s;a+=1)0!==t[a]&&(n[o]=new Set,r.push(a),c(),o+=1);return n},l=(t,e)=>Math.floor(t/e),d=(t,e)=>{return[(r=t,n=e,r%n),l(t,e)];var r,n},u=t=>null!=t,g=(t,e,r)=>{const n=((t,e=120)=>{const r=t.width*t.height,n=new Array(r).fill(0);let s,a=0,o=0,c=0,h=0;for(s=0;s<r;s+=1){const r=s<<2;a=t.data[r+0],o=t.data[r+1],c=t.data[r+2],h=.299*a+.587*o+.114*c,h<e&&(n[s]=1)}return n})(t);return(({segments:t,width:e,scaleWidth:r,scaleHeight:n})=>t.map((t=>{let s=Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MIN_VALUE,c=Number.MIN_VALUE;for(const r of t){const t=d(r,e);t[0]<s&&(s=t[0]),t[1]<a&&(a=t[1]),t[0]>o&&(o=t[0]),t[1]>c&&(c=t[1])}const h=(o-s)*(c-a);return h>5&&h<500?{perimeter:h,x1:Math.trunc(s/.3/r),y1:Math.trunc(a/.3/n),x2:Math.trunc(o/.3/r),y2:Math.trunc(c/.3/n)}:null})).filter(u))({segments:i(n,t.width),width:t.width,scaleWidth:e,scaleHeight:r})};onmessage=({data:t})=>{const e=g(t.iData,t.resizedToBorderScaleWidth,t.resizedToBorderScaleHeight);postMessage({segments:e})};
|