veryfi-lens-wasm 2.0.2 → 2.0.4
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/components/createFileUpload.js +11 -0
- package/components/creditCard.js +3 -2
- package/components/croppedImage.js +38 -0
- package/components/exitButton.js +21 -5
- package/components/frame.js +15 -8
- package/components/greenBox.js +19 -9
- package/components/longPreview.js +2 -1
- package/components/stitchingButton.js +1 -1
- package/components/submitButton.js +16 -0
- package/components/torchButton.js +15 -7
- package/components/video.js +23 -9
- package/package.json +1 -1
- package/veryfi-lens.js +181 -165
- package/components/checksCapture.js +0 -71
|
@@ -12,6 +12,7 @@ export function createFileUpload(container, captureUploaded, onSubmit) {
|
|
|
12
12
|
alignItems: 'center',
|
|
13
13
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
14
14
|
imageContainerHeight: 'calc(100% - 120px)',
|
|
15
|
+
imageContainerTop: 'unset',
|
|
15
16
|
imagePreviewMaxWidth: '500px',
|
|
16
17
|
imagePreviewMaxHeight: '80vh',
|
|
17
18
|
imagePreviewObjectFit: 'contain',
|
|
@@ -44,6 +45,15 @@ export function createFileUpload(container, captureUploaded, onSubmit) {
|
|
|
44
45
|
fileUploadComponent.style.setProperty(cssVar, `var(${cssVar}, ${value})`);
|
|
45
46
|
});
|
|
46
47
|
|
|
48
|
+
const isLandscape = window.innerWidth > window.innerHeight;
|
|
49
|
+
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
50
|
+
if (isLandscape && isMobile) {
|
|
51
|
+
fileUploadComponent.style.position = 'fixed';
|
|
52
|
+
fileUploadComponent.style.bottom = '5px';
|
|
53
|
+
fileUploadComponent.style.zIndex = '9999';
|
|
54
|
+
fileUploadComponent.style.imageContainerTop = '0%';
|
|
55
|
+
}
|
|
56
|
+
|
|
47
57
|
fileUploadComponent.innerHTML = `
|
|
48
58
|
<div id="image-container" style="
|
|
49
59
|
width: 100%;
|
|
@@ -52,6 +62,7 @@ export function createFileUpload(container, captureUploaded, onSubmit) {
|
|
|
52
62
|
justify-content: center;
|
|
53
63
|
align-items: center;
|
|
54
64
|
overflow: hidden;
|
|
65
|
+
top: var(--file-upload-image-container-top, ${defaultStyles.imageContainerTop});
|
|
55
66
|
">
|
|
56
67
|
<img id="veryfi-image-preview" style="
|
|
57
68
|
max-width: var(--file-upload-image-preview-max-width, ${defaultStyles.imagePreviewMaxWidth});
|
package/components/creditCard.js
CHANGED
|
@@ -25,14 +25,14 @@ export const createCreditCardComponent = (container) => {
|
|
|
25
25
|
|
|
26
26
|
'--card-text-color': 'white',
|
|
27
27
|
'--card-number-font-size': '24px',
|
|
28
|
-
'--card-number-margin': '90px 0 10px
|
|
28
|
+
'--card-number-margin': '90px 0 10px 65px',
|
|
29
29
|
|
|
30
30
|
'--card-info-margin-left': '20px',
|
|
31
31
|
'--card-info-margin-right': '20px',
|
|
32
32
|
'--card-info-font-weight': 'bold',
|
|
33
33
|
|
|
34
34
|
'--flip-message-width': '300px',
|
|
35
|
-
'--flip-message-bottom': '
|
|
35
|
+
'--flip-message-bottom': '22%',
|
|
36
36
|
'--flip-message-font-size': '25px',
|
|
37
37
|
'--flip-message-z-index': '152',
|
|
38
38
|
};
|
|
@@ -118,6 +118,7 @@ export const createCreditCardComponent = (container) => {
|
|
|
118
118
|
flipMessage.style.cssText = `
|
|
119
119
|
position: absolute;
|
|
120
120
|
display: block;
|
|
121
|
+
text-transform: uppercase;
|
|
121
122
|
width: var(--flip-message-width);
|
|
122
123
|
bottom: var(--flip-message-bottom);
|
|
123
124
|
left: 50%;
|
|
@@ -15,8 +15,38 @@ export const createCroppedImage = (container) => {
|
|
|
15
15
|
cropImgCanvas.style[key] = value;
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
// Override the putImageData method to handle rotation automatically
|
|
19
|
+
const originalPutImageData = cropImgCanvas.getContext('2d').putImageData;
|
|
20
|
+
cropImgCanvas.getContext('2d').putImageData = function(imageData, dx, dy) {
|
|
21
|
+
// Check if we're in check capture mode
|
|
22
|
+
const isCheckCapture = container.querySelector('#check-images-container') !== null;
|
|
23
|
+
|
|
24
|
+
if (!isCheckCapture && imageData.width > imageData.height) { // Only rotate for non-check captures
|
|
25
|
+
const tempCanvas = document.createElement('canvas');
|
|
26
|
+
tempCanvas.width = imageData.width;
|
|
27
|
+
tempCanvas.height = imageData.height;
|
|
28
|
+
const tempCtx = tempCanvas.getContext('2d');
|
|
29
|
+
tempCtx.putImageData(imageData, 0, 0);
|
|
30
|
+
|
|
31
|
+
cropImgCanvas.width = imageData.height;
|
|
32
|
+
cropImgCanvas.height = imageData.width;
|
|
33
|
+
|
|
34
|
+
this.clearRect(0, 0, cropImgCanvas.width, cropImgCanvas.height);
|
|
35
|
+
this.save();
|
|
36
|
+
this.translate(cropImgCanvas.width, 0);
|
|
37
|
+
this.rotate(Math.PI/2);
|
|
38
|
+
this.drawImage(tempCanvas, 0, 0);
|
|
39
|
+
this.restore();
|
|
40
|
+
} else {
|
|
41
|
+
cropImgCanvas.width = imageData.width;
|
|
42
|
+
cropImgCanvas.height = imageData.height;
|
|
43
|
+
originalPutImageData.call(this, imageData, dx, dy);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
18
47
|
const handleResize = () => {
|
|
19
48
|
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
49
|
+
const isLandscape = window.innerWidth > window.innerHeight;
|
|
20
50
|
|
|
21
51
|
if (isMobile) {
|
|
22
52
|
cropImgCanvas.style.width = '370px';
|
|
@@ -25,6 +55,14 @@ export const createCroppedImage = (container) => {
|
|
|
25
55
|
cropImgCanvas.style.position = 'fixed';
|
|
26
56
|
cropImgCanvas.style.top = '';
|
|
27
57
|
cropImgCanvas.style.left = '';
|
|
58
|
+
if (isLandscape) {
|
|
59
|
+
cropImgCanvas.style.width = '170px';
|
|
60
|
+
cropImgCanvas.style.height = '85vh';
|
|
61
|
+
cropImgCanvas.style.maxWidth = '200px';
|
|
62
|
+
cropImgCanvas.style.position = 'fixed';
|
|
63
|
+
cropImgCanvas.style.top = '';
|
|
64
|
+
cropImgCanvas.style.left = '';
|
|
65
|
+
}
|
|
28
66
|
} else {
|
|
29
67
|
cropImgCanvas.style.width = '100%';
|
|
30
68
|
cropImgCanvas.style.height = '95%';
|
package/components/exitButton.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const createExitButton = (container, options, removeOverlay) => {
|
|
2
|
-
const { setter, redirectUrl } = options;
|
|
2
|
+
const { setter, redirectUrl, lensFlavor } = options;
|
|
3
3
|
|
|
4
4
|
const button = document.createElement('a');
|
|
5
5
|
button.id = 'veryfi-exit-button';
|
|
@@ -43,12 +43,28 @@ export const createExitButton = (container, options, removeOverlay) => {
|
|
|
43
43
|
const isLandscape = window.innerWidth > window.innerHeight;
|
|
44
44
|
|
|
45
45
|
if (isMobile && isLandscape) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (lensFlavor === 'credit_card') {
|
|
47
|
+
// Special positioning for credit card in landscape
|
|
48
|
+
button.style.position = 'fixed';
|
|
49
|
+
button.style.top = '20px';
|
|
50
|
+
button.style.right = '20px';
|
|
51
|
+
button.style.left = 'unset';
|
|
52
|
+
button.style.bottom = 'unset';
|
|
53
|
+
button.style.zIndex = '9999'; // Ensure it's above the card outline
|
|
54
|
+
} else {
|
|
55
|
+
// Default landscape positioning for other flavors
|
|
56
|
+
button.style.right = '50px';
|
|
57
|
+
button.style.top = 'calc(20vh - 20px)';
|
|
58
|
+
button.style.left = 'unset';
|
|
59
|
+
button.style.bottom = 'unset';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (lensFlavor === 'upload') {
|
|
64
|
+
button.style.right = '40px';
|
|
65
|
+
button.style.top = '40px';
|
|
48
66
|
button.style.left = 'unset';
|
|
49
67
|
button.style.bottom = 'unset';
|
|
50
|
-
} else {
|
|
51
|
-
// Apply default styles directly
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
button.addEventListener('mouseenter', () => {
|
package/components/frame.js
CHANGED
|
@@ -18,20 +18,27 @@ export const createFrame = (container) => {
|
|
|
18
18
|
const handleResize = () => {
|
|
19
19
|
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
20
20
|
|
|
21
|
-
if (isMobile) {
|
|
21
|
+
if (!isMobile) {
|
|
22
|
+
if (container.dataset.fullscreen === 'true') {
|
|
23
|
+
frameCanvas.style.position = 'fixed';
|
|
24
|
+
frameCanvas.style.width = '100vw';
|
|
25
|
+
frameCanvas.style.height = '100vh';
|
|
26
|
+
frameCanvas.style.maxWidth = 'none';
|
|
27
|
+
frameCanvas.style.top = '0';
|
|
28
|
+
frameCanvas.style.left = '0';
|
|
29
|
+
} else {
|
|
30
|
+
frameCanvas.style.width = '100%';
|
|
31
|
+
frameCanvas.style.height = 'auto';
|
|
32
|
+
frameCanvas.style.maxWidth = '500px';
|
|
33
|
+
frameCanvas.style.position = 'absolute';
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
22
36
|
frameCanvas.style.width = '100vw';
|
|
23
37
|
frameCanvas.style.height = '100vh';
|
|
24
38
|
frameCanvas.style.maxWidth = '100%';
|
|
25
39
|
frameCanvas.style.position = 'fixed';
|
|
26
40
|
frameCanvas.style.top = '0';
|
|
27
41
|
frameCanvas.style.left = '0';
|
|
28
|
-
} else {
|
|
29
|
-
frameCanvas.style.width = '100%';
|
|
30
|
-
frameCanvas.style.height = 'auto';
|
|
31
|
-
frameCanvas.style.maxWidth = '500px';
|
|
32
|
-
frameCanvas.style.position = 'absolute';
|
|
33
|
-
frameCanvas.style.top = '';
|
|
34
|
-
frameCanvas.style.left = '';
|
|
35
42
|
}
|
|
36
43
|
};
|
|
37
44
|
|
package/components/greenBox.js
CHANGED
|
@@ -16,8 +16,26 @@ export const createGreenBox = (container) => {
|
|
|
16
16
|
|
|
17
17
|
const handleResize = () => {
|
|
18
18
|
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
19
|
+
const isFullscreen = container.dataset.fullscreen === 'true';
|
|
19
20
|
|
|
20
|
-
if (isMobile) {
|
|
21
|
+
if (!isMobile) {
|
|
22
|
+
if (isFullscreen) {
|
|
23
|
+
boxCanvas.style.position = 'fixed';
|
|
24
|
+
boxCanvas.style.width = '100vw';
|
|
25
|
+
boxCanvas.style.height = '100vh';
|
|
26
|
+
boxCanvas.style.maxWidth = 'none';
|
|
27
|
+
boxCanvas.style.top = '0';
|
|
28
|
+
boxCanvas.style.left = '0';
|
|
29
|
+
} else {
|
|
30
|
+
boxCanvas.style.width = '100%';
|
|
31
|
+
boxCanvas.style.height = 'auto';
|
|
32
|
+
boxCanvas.style.maxWidth = '500px';
|
|
33
|
+
boxCanvas.style.position = 'absolute';
|
|
34
|
+
boxCanvas.style.objectFit = 'cover';
|
|
35
|
+
boxCanvas.style.top = '';
|
|
36
|
+
boxCanvas.style.left = '';
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
21
39
|
boxCanvas.style.width = '100vw';
|
|
22
40
|
boxCanvas.style.height = '100vh';
|
|
23
41
|
boxCanvas.style.maxWidth = '100%';
|
|
@@ -25,14 +43,6 @@ export const createGreenBox = (container) => {
|
|
|
25
43
|
boxCanvas.style.objectFit = 'cover';
|
|
26
44
|
boxCanvas.style.top = '0';
|
|
27
45
|
boxCanvas.style.left = '0';
|
|
28
|
-
} else {
|
|
29
|
-
boxCanvas.style.width = '100%';
|
|
30
|
-
boxCanvas.style.height = 'auto';
|
|
31
|
-
boxCanvas.style.maxWidth = '500px';
|
|
32
|
-
boxCanvas.style.position = 'absolute';
|
|
33
|
-
boxCanvas.style.objectFit = 'cover';
|
|
34
|
-
boxCanvas.style.top = '';
|
|
35
|
-
boxCanvas.style.left = '';
|
|
36
46
|
}
|
|
37
47
|
};
|
|
38
48
|
|
|
@@ -9,7 +9,7 @@ export const createLongPreview = (parentContainer) => {
|
|
|
9
9
|
width: '80px',
|
|
10
10
|
height: '70vh',
|
|
11
11
|
borderRadius: '4px',
|
|
12
|
-
zIndex: '
|
|
12
|
+
zIndex: '1000',
|
|
13
13
|
overflowY: 'hidden',
|
|
14
14
|
border: '1px solid #86efac',
|
|
15
15
|
};
|
|
@@ -20,6 +20,7 @@ export const createLongPreview = (parentContainer) => {
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
parentContainer.appendChild(container);
|
|
23
|
+
container.style.zIndex = '1000';
|
|
23
24
|
|
|
24
25
|
const updatePreview = (data, originalWidth, originalHeight) => {
|
|
25
26
|
while (container.firstChild) {
|
|
@@ -18,10 +18,26 @@ export const createSubmitButton = (container, onSubmit, removeOverlay) => {
|
|
|
18
18
|
display: 'none',
|
|
19
19
|
pointerEvents: 'auto'
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
23
|
+
const isLandscape = window.innerWidth > window.innerHeight;
|
|
24
|
+
console.log('isLandscape', isLandscape);
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
Object.entries(defaultStyles).forEach(([key, value]) => {
|
|
23
28
|
button.style[key] = value;
|
|
24
29
|
});
|
|
30
|
+
|
|
31
|
+
if (isLandscape && isMobile) {
|
|
32
|
+
button.style.position = 'fixed';
|
|
33
|
+
button.style.bottom = 'calc(50% - 20px)';
|
|
34
|
+
button.style.transform = 'rotate(270deg)';
|
|
35
|
+
button.style.right = '20px';
|
|
36
|
+
button.style.left = 'unset';
|
|
37
|
+
button.style.top = 'unset';
|
|
38
|
+
button.style.zIndex = '9999';
|
|
39
|
+
}
|
|
40
|
+
|
|
25
41
|
button.addEventListener('click', () => {
|
|
26
42
|
onSubmit();
|
|
27
43
|
removeOverlay();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const createTorchButton = (container, toggleCallback) => {
|
|
1
|
+
export const createTorchButton = (container, toggleCallback, lensFlavor) => {
|
|
2
2
|
const button = document.createElement("button");
|
|
3
3
|
button.id = "veryfi-torch-button";
|
|
4
4
|
|
|
@@ -40,13 +40,21 @@ export const createTorchButton = (container, toggleCallback) => {
|
|
|
40
40
|
!isMobile && (button.style.display = 'none');
|
|
41
41
|
|
|
42
42
|
if (isMobile && isLandscape) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
if (lensFlavor === 'credit_card') {
|
|
44
|
+
// Special positioning for credit card in landscape
|
|
45
|
+
button.style.position = 'fixed';
|
|
46
|
+
button.style.bottom = '20px';
|
|
47
|
+
button.style.right = '20px';
|
|
48
|
+
button.style.left = 'unset';
|
|
49
|
+
button.style.top = 'unset';
|
|
50
|
+
button.style.zIndex = '9999'; // Ensure it's above the card outline
|
|
51
|
+
} else {
|
|
52
|
+
button.style.right = '50px';
|
|
53
|
+
button.style.botom = 'calc(20vh - 20px)';
|
|
54
|
+
button.style.left = 'unset';
|
|
55
|
+
button.style.top = 'unset';
|
|
49
56
|
}
|
|
57
|
+
}
|
|
50
58
|
|
|
51
59
|
button.addEventListener('mouseover', () => {
|
|
52
60
|
button.style.backgroundColor = 'rgba(75, 85, 99, 0.8)';
|
package/components/video.js
CHANGED
|
@@ -18,28 +18,42 @@ export const createVideo = (container) => {
|
|
|
18
18
|
|
|
19
19
|
const handleResize = () => {
|
|
20
20
|
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
21
|
+
const isFullscreen = container.dataset.fullscreen === 'true';
|
|
22
|
+
const isLandscape = window.innerWidth > window.innerHeight;
|
|
21
23
|
|
|
22
24
|
if (!isMobile) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (isFullscreen) {
|
|
26
|
+
video.style.position = 'fixed';
|
|
27
|
+
video.style.width = '100vw';
|
|
28
|
+
video.style.height = '100vh';
|
|
29
|
+
video.style.maxWidth = 'none';
|
|
30
|
+
video.style.top = '0';
|
|
31
|
+
video.style.left = '0';
|
|
32
|
+
video.style.transform = isLandscape ? 'none' : 'scale(1.5)';
|
|
33
|
+
video.style.objectFit = isLandscape ? 'cover' : 'cover';
|
|
34
|
+
} else {
|
|
35
|
+
video.style.position = 'absolute';
|
|
36
|
+
video.style.width = '100%';
|
|
37
|
+
video.style.height = 'auto';
|
|
38
|
+
video.style.maxWidth = '500px';
|
|
39
|
+
video.style.top = '';
|
|
40
|
+
video.style.left = '';
|
|
41
|
+
video.style.transform = 'none';
|
|
42
|
+
video.style.objectFit = 'cover';
|
|
43
|
+
}
|
|
30
44
|
} else {
|
|
31
|
-
// console.log('mobile');
|
|
32
45
|
video.style.position = 'fixed';
|
|
33
46
|
video.style.top = '0';
|
|
34
47
|
video.style.left = '0';
|
|
35
48
|
video.style.width = '100vw';
|
|
36
49
|
video.style.height = '100vh';
|
|
37
50
|
video.style.maxWidth = 'none';
|
|
51
|
+
video.style.transform = 'none';
|
|
52
|
+
video.style.objectFit = 'cover';
|
|
38
53
|
}
|
|
39
54
|
};
|
|
40
55
|
|
|
41
56
|
handleResize();
|
|
42
|
-
|
|
43
57
|
window.addEventListener('resize', handleResize);
|
|
44
58
|
|
|
45
59
|
video.playsInline = true;
|
package/package.json
CHANGED
package/veryfi-lens.js
CHANGED
|
@@ -82,6 +82,7 @@ const VeryfiLens = (function () {
|
|
|
82
82
|
fpPromise: null,
|
|
83
83
|
debug_mode: false,
|
|
84
84
|
enableSubmit: true,
|
|
85
|
+
enableFullScreen: false,
|
|
85
86
|
|
|
86
87
|
// UI Configuration
|
|
87
88
|
docValidation: true,
|
|
@@ -175,12 +176,26 @@ const VeryfiLens = (function () {
|
|
|
175
176
|
}
|
|
176
177
|
const isDesktop = window.screen.width > window.screen.height;
|
|
177
178
|
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
179
|
+
const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
|
|
178
180
|
|
|
179
181
|
let videoConfig = {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
...(isMobile && lensFlavor === 'long_document' ? {
|
|
183
|
+
width: { ideal: 1920 },
|
|
184
|
+
height: { ideal: 1080 }
|
|
185
|
+
} : isMobile ? {
|
|
186
|
+
width: { ideal: 2440 }, // Also reduced for other mobile cases
|
|
187
|
+
height: { ideal: 1080 }
|
|
188
|
+
} : state.fullScreenEnabled ? {
|
|
189
|
+
width: { ideal: 1920 },
|
|
190
|
+
height: { ideal: 1080 }
|
|
191
|
+
} : {
|
|
192
|
+
width: { ideal: 3840 },
|
|
193
|
+
height: { ideal: 2160 }
|
|
194
|
+
}),
|
|
195
|
+
facingMode: "environment",
|
|
196
|
+
advanced: [{ torch: true }]
|
|
183
197
|
};
|
|
198
|
+
state.debug_mode && console.log("video config", videoConfig);
|
|
184
199
|
|
|
185
200
|
if (isAndroid) {
|
|
186
201
|
try {
|
|
@@ -189,15 +204,11 @@ const VeryfiLens = (function () {
|
|
|
189
204
|
const mainCameraDevice = videoDevices.find(device => device.label.includes("camera2 0"));
|
|
190
205
|
if (mainCameraDevice) {
|
|
191
206
|
videoConfig.deviceId = { exact: mainCameraDevice.deviceId };
|
|
192
|
-
|
|
193
|
-
videoConfig.facingMode = "environment";
|
|
207
|
+
console.log("mainCameraDevice", mainCameraDevice);
|
|
194
208
|
}
|
|
195
209
|
} catch (error) {
|
|
196
210
|
console.error("Error enumerating devices", error);
|
|
197
|
-
videoConfig.facingMode = "environment";
|
|
198
211
|
}
|
|
199
|
-
} else {
|
|
200
|
-
videoConfig.facingMode = "environment";
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
const constraints = {
|
|
@@ -388,6 +399,7 @@ const VeryfiLens = (function () {
|
|
|
388
399
|
createImageBitmap(state.fullSizeImage).then((bitmap) => {
|
|
389
400
|
if (wasmWrapper && typeof wasmWrapper.processDocument === 'function') {
|
|
390
401
|
wasmWrapper.processDocument(bitmap, mode);
|
|
402
|
+
|
|
391
403
|
rCorners = state.coordinates.map((corner) => corner);
|
|
392
404
|
if (
|
|
393
405
|
rCorners.length &&
|
|
@@ -406,6 +418,7 @@ const VeryfiLens = (function () {
|
|
|
406
418
|
state.image = imgString;
|
|
407
419
|
}
|
|
408
420
|
}
|
|
421
|
+
bitmap.close();
|
|
409
422
|
});
|
|
410
423
|
} catch (error) {
|
|
411
424
|
console.log(error);
|
|
@@ -496,26 +509,25 @@ const VeryfiLens = (function () {
|
|
|
496
509
|
let wasmOutput;
|
|
497
510
|
let imgString;
|
|
498
511
|
if (state.hasCoordinates) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
+
wasmOutput = await wasmWrapper.getStitchedImage();
|
|
513
|
+
const { data, blurLevel, outputHeight, outputWidth } = wasmOutput;
|
|
514
|
+
const width = outputWidth;
|
|
515
|
+
const height = outputHeight;
|
|
516
|
+
const cropImgCanvas = state.cropImgRef;
|
|
517
|
+
state.cropImgRef.height = height;
|
|
518
|
+
state.cropImgRef.width = width;
|
|
519
|
+
const ctx = cropImgCanvas.getContext("2d");
|
|
520
|
+
const imageData = new ImageData(data, width, height);
|
|
521
|
+
ctx.putImageData(imageData, 0, 0);
|
|
522
|
+
imgString = cropImgCanvas.toDataURL("image/jpeg");
|
|
523
|
+
state.image = cropImgCanvas;
|
|
524
|
+
state.isDocument = true;
|
|
512
525
|
} else {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
checkIfDocumentOnCapture();
|
|
527
|
+
imgString = state.image;
|
|
528
|
+
stopWasm();
|
|
529
|
+
return false;
|
|
517
530
|
}
|
|
518
|
-
// setBlurStatus(blurLevel); gives 0 all the time
|
|
519
531
|
stopWasm();
|
|
520
532
|
releaseCanvas(state.boxRef);
|
|
521
533
|
state.coordinates = [];
|
|
@@ -549,6 +561,7 @@ const VeryfiLens = (function () {
|
|
|
549
561
|
state.coordinates = corners.map((corner) => [corner.x, corner.y]);
|
|
550
562
|
state.previewData = preview;
|
|
551
563
|
state.shouldUpdatePreview = stitcherResult === 0;
|
|
564
|
+
state.isDocument = corners.length > 0 && stitcherResult === 0;
|
|
552
565
|
}
|
|
553
566
|
|
|
554
567
|
const logCard = (status, name, number, date, cvv) => {
|
|
@@ -866,6 +879,7 @@ const VeryfiLens = (function () {
|
|
|
866
879
|
state.exitButton = createExitButton(state.videoOverlay.overlay, {
|
|
867
880
|
setter: state.onClose,
|
|
868
881
|
redirectUrl: state.onCloseRedirectUrl,
|
|
882
|
+
lensFlavor: state.lensFlavor,
|
|
869
883
|
}, removeOverlay);
|
|
870
884
|
}
|
|
871
885
|
|
|
@@ -878,7 +892,7 @@ const VeryfiLens = (function () {
|
|
|
878
892
|
if (state.torchButton) {
|
|
879
893
|
state.torchButton = createTorchButton(state.videoOverlay.overlay, () => {
|
|
880
894
|
toggleTorchLight();
|
|
881
|
-
});
|
|
895
|
+
}, state.lensFlavor);
|
|
882
896
|
}
|
|
883
897
|
};
|
|
884
898
|
|
|
@@ -893,8 +907,14 @@ const VeryfiLens = (function () {
|
|
|
893
907
|
createExitButton(state.cardOverlay.element, {
|
|
894
908
|
setter: state.onClose,
|
|
895
909
|
redirectUrl: state.onCloseRedirectUrl,
|
|
910
|
+
lensFlavor: state.lensFlavor,
|
|
896
911
|
}, removeOverlay);
|
|
897
912
|
}
|
|
913
|
+
if (state.torchButton) {
|
|
914
|
+
state.torchButton = createTorchButton(state.cardOverlay.element, () => {
|
|
915
|
+
toggleTorchLight();
|
|
916
|
+
}, state.lensFlavor);
|
|
917
|
+
}
|
|
898
918
|
}
|
|
899
919
|
|
|
900
920
|
const renderModalsIfNeeded = () => {
|
|
@@ -939,10 +959,7 @@ const VeryfiLens = (function () {
|
|
|
939
959
|
try {
|
|
940
960
|
state.updateHandler && state.updateHandler({ status: 'validation_started' });
|
|
941
961
|
const response = await fetch(
|
|
942
|
-
|
|
943
|
-
// 'https://lens-dev.veryfi.com/rest/validate_partner',
|
|
944
|
-
'http://localhost:5050/rest/validate_partner',
|
|
945
|
-
|
|
962
|
+
'https://lens.veryfi.com/rest/validate_partner',
|
|
946
963
|
{
|
|
947
964
|
method: 'POST',
|
|
948
965
|
headers: {
|
|
@@ -1003,8 +1020,7 @@ const VeryfiLens = (function () {
|
|
|
1003
1020
|
};
|
|
1004
1021
|
|
|
1005
1022
|
const response = await fetch(
|
|
1006
|
-
|
|
1007
|
-
"http://localhost:5050/rest/send-cropped",
|
|
1023
|
+
"https://lens.veryfi.com/rest/send-cropped",
|
|
1008
1024
|
{
|
|
1009
1025
|
method: "POST",
|
|
1010
1026
|
headers: {
|
|
@@ -1039,8 +1055,7 @@ const VeryfiLens = (function () {
|
|
|
1039
1055
|
spinner.show();
|
|
1040
1056
|
state.updateHandler && state.updateHandler({ status: 'submission_started' });
|
|
1041
1057
|
|
|
1042
|
-
|
|
1043
|
-
const processDocumentUrl = "http://localhost:5050/api/document";
|
|
1058
|
+
const processDocumentUrl = "https://lens.veryfi.com/api/document";
|
|
1044
1059
|
const deviceData = await getDeviceData();
|
|
1045
1060
|
|
|
1046
1061
|
const requestBody = {
|
|
@@ -1361,148 +1376,137 @@ const VeryfiLens = (function () {
|
|
|
1361
1376
|
|
|
1362
1377
|
const captureChecks = async () => {
|
|
1363
1378
|
try {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1379
|
+
if (state.isCapturingFront) {
|
|
1380
|
+
state.frontImage = await cropWasm();
|
|
1381
|
+
state.finalImage = state.frontImage;
|
|
1382
|
+
|
|
1383
|
+
// Hide video and box elements temporarily
|
|
1384
|
+
if (state.videoRef) state.videoRef.style.display = 'none';
|
|
1385
|
+
if (state.boxRef) state.boxRef.style.display = 'none';
|
|
1386
|
+
if (state.frameRef) state.frameRef.style.display = 'none';
|
|
1387
|
+
|
|
1388
|
+
const isDocumentDetected = checkIfDocumentOnCapture();
|
|
1389
|
+
if (!isDocumentDetected) {
|
|
1390
|
+
showVideoOverlay();
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1375
1393
|
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1394
|
+
const isBlurry = checkIfBlurOnCapture();
|
|
1395
|
+
if (isBlurry) {
|
|
1396
|
+
showVideoOverlay();
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1381
1399
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1400
|
+
if (state.cropImgRef && typeof state.cropImgRef.showSuccessBorder === 'function') {
|
|
1401
|
+
state.cropImgRef.showSuccessBorder();
|
|
1402
|
+
}
|
|
1386
1403
|
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1404
|
+
if (state.captureBackOfCheck) {
|
|
1405
|
+
const checkCaptureModal = createCheckCaptureModal(
|
|
1406
|
+
state.container,
|
|
1407
|
+
state.finalImage,
|
|
1408
|
+
() => {
|
|
1409
|
+
// "Yes" click handler
|
|
1410
|
+
// Show video elements again
|
|
1411
|
+
if (state.videoRef) state.videoRef.style.display = 'block';
|
|
1412
|
+
if (state.boxRef) state.boxRef.style.display = 'block';
|
|
1413
|
+
if (state.frameRef) state.frameRef.style.display = 'block';
|
|
1414
|
+
|
|
1415
|
+
// Reset border and clear canvas
|
|
1416
|
+
if (state.cropImgRef) {
|
|
1417
|
+
state.cropImgRef.hideBorder();
|
|
1418
|
+
const ctx = state.cropImgRef.getContext("2d");
|
|
1419
|
+
if (ctx) {
|
|
1420
|
+
ctx.clearRect(0, 0, state.cropImgRef.width, state.cropImgRef.height);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
newStartLens(state.lensFlavor);
|
|
1424
|
+
},
|
|
1425
|
+
() => {
|
|
1426
|
+
// "No" click handler
|
|
1427
|
+
hideVideoOverlay();
|
|
1428
|
+
if (state.isDocument && !state.blurStatus) {
|
|
1429
|
+
state.submitButton = createSubmitButton(state.videoOverlay.overlay, () => {
|
|
1430
|
+
handleSubmit(state.frontImage);
|
|
1431
|
+
}, removeOverlay);
|
|
1432
|
+
state.enableSubmit && state.submitButton.show();
|
|
1433
|
+
}
|
|
1434
|
+
if (state.resultSetter && typeof state.resultSetter === 'function') {
|
|
1435
|
+
state.resultSetter({
|
|
1436
|
+
frontImage: state.frontImage
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
);
|
|
1441
|
+
checkCaptureModal.show();
|
|
1442
|
+
state.isCapturingFront = false;
|
|
1443
|
+
state.updateHandler && state.updateHandler({ status: 'capture_back_side' });
|
|
1417
1444
|
}
|
|
1418
|
-
);
|
|
1419
|
-
checkCaptureModal.show();
|
|
1420
|
-
state.isCapturingFront = false;
|
|
1421
|
-
state.updateHandler && state.updateHandler({ status: 'capture_back_side' });
|
|
1422
|
-
} else{
|
|
1423
|
-
hideVideoOverlay();
|
|
1424
|
-
if (state.isDocument && !state.blurStatus) {
|
|
1425
|
-
state.submitButton = createSubmitButton(state.videoOverlay.overlay, () => {
|
|
1426
|
-
handleSubmit(state.frontImage);
|
|
1427
|
-
}, removeOverlay);
|
|
1428
|
-
state.enableSubmit && state.submitButton.show();
|
|
1429
|
-
}
|
|
1430
|
-
// Call success handler with front image only
|
|
1431
|
-
if (state.resultSetter && typeof state.resultSetter === 'function') {
|
|
1432
|
-
state.resultSetter({
|
|
1433
|
-
frontImage: state.frontImage
|
|
1434
|
-
});
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
1445
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1446
|
+
} else {
|
|
1447
|
+
state.backImage = await cropWasm();
|
|
1440
1448
|
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1449
|
+
state.debug_mode && console.log("Back capture - Document detected:", state.isDocument);
|
|
1450
|
+
// Check for document first
|
|
1451
|
+
const isDocumentDetected = checkIfDocumentOnCapture();
|
|
1452
|
+
state.debug_mode && console.log("Back capture - Document check result:", isDocumentDetected);
|
|
1445
1453
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1454
|
+
if (!isDocumentDetected) {
|
|
1455
|
+
state.debug_mode && console.log("Back capture - No document detected, showing video overlay");
|
|
1456
|
+
showVideoOverlay();
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1451
1459
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1460
|
+
// Then check for blur
|
|
1461
|
+
const isBlurry = checkIfBlurOnCapture();
|
|
1462
|
+
if (isBlurry) {
|
|
1463
|
+
showVideoOverlay();
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1458
1466
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1467
|
+
// Both checks passed, show success border
|
|
1468
|
+
if (state.cropImgRef && typeof state.cropImgRef.showSuccessBorder === 'function') {
|
|
1469
|
+
state.cropImgRef.showSuccessBorder();
|
|
1470
|
+
}
|
|
1463
1471
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1472
|
+
// Only proceed with rendering if both checks pass
|
|
1473
|
+
hideVideoOverlay();
|
|
1466
1474
|
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1475
|
+
// Create new check images component for each capture instead of checking if it exists
|
|
1476
|
+
checkImagesComponent = createCheckImages(state.container);
|
|
1470
1477
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1478
|
+
try {
|
|
1479
|
+
const elements = await checkImagesComponent.renderCheckImages(state.frontImage, state.backImage, state.cropImgRef);
|
|
1480
|
+
if (state.isDocument && !state.blurStatus) {
|
|
1481
|
+
const zip = new JSZip();
|
|
1482
|
+
zip.file("front.jpg", state.frontImage, { base64: true });
|
|
1483
|
+
zip.file("back.jpg", state.backImage, { base64: true });
|
|
1484
|
+
const zipContent = await zip.generateAsync({ type: "base64" });
|
|
1485
|
+
state.submitButton = createSubmitButton(state.videoOverlay.overlay, () => {
|
|
1486
|
+
state.captureBackOfCheck ? handleSubmit(zipContent) : handleSubmit(state.frontImage);
|
|
1473
1487
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
const zip = new JSZip();
|
|
1478
|
-
zip.file("front.jpg", state.frontImage, { base64: true });
|
|
1479
|
-
zip.file("back.jpg", state.backImage, { base64: true });
|
|
1480
|
-
const zipContent = await zip.generateAsync({ type: "base64" });
|
|
1481
|
-
state.submitButton = createSubmitButton(state.videoOverlay.overlay, () => {
|
|
1482
|
-
state.captureBackOfCheck ? handleSubmit(zipContent) : handleSubmit(state.frontImage);
|
|
1483
|
-
|
|
1484
|
-
}, removeOverlay);
|
|
1485
|
-
state.enableSubmit && state.submitButton.show();
|
|
1486
|
-
}
|
|
1488
|
+
}, removeOverlay);
|
|
1489
|
+
state.enableSubmit && state.submitButton.show();
|
|
1490
|
+
}
|
|
1487
1491
|
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1492
|
+
// Call success handler with properly structured data
|
|
1493
|
+
if (state.resultSetter && typeof state.resultSetter === 'function') {
|
|
1494
|
+
state.resultSetter({
|
|
1495
|
+
frontImage: state.frontImage,
|
|
1496
|
+
backImage: state.backImage
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
} catch (error) {
|
|
1500
|
+
console.error('Error rendering check images:', error);
|
|
1501
|
+
showVideoOverlay();
|
|
1502
|
+
}
|
|
1498
1503
|
}
|
|
1499
|
-
}
|
|
1500
1504
|
} catch (error) {
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1505
|
+
console.error('Error in captureChecks:', error);
|
|
1506
|
+
if (state.failureHandler && typeof state.failureHandler === 'function') {
|
|
1507
|
+
state.failureHandler(error);
|
|
1508
|
+
}
|
|
1509
|
+
showVideoOverlay();
|
|
1506
1510
|
}
|
|
1507
1511
|
};
|
|
1508
1512
|
|
|
@@ -1638,6 +1642,11 @@ const VeryfiLens = (function () {
|
|
|
1638
1642
|
try {
|
|
1639
1643
|
// Wait a small amount of time to ensure DOM is ready
|
|
1640
1644
|
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1645
|
+
|
|
1646
|
+
// Set fullscreen attribute on container
|
|
1647
|
+
if (state.container) {
|
|
1648
|
+
state.container.dataset.fullscreen = state.enableFullScreen.toString();
|
|
1649
|
+
}
|
|
1641
1650
|
|
|
1642
1651
|
if (state.lensFlavor !== "credit_card" && state.lensFlavor !== "upload") {
|
|
1643
1652
|
// Create cropped image
|
|
@@ -1924,6 +1933,14 @@ const VeryfiLens = (function () {
|
|
|
1924
1933
|
switch (state.lensFlavor) {
|
|
1925
1934
|
case 'upload':
|
|
1926
1935
|
!state.fileUpload && (state.fileUpload = createFileUpload(state.container, captureUploaded, handleSubmit));
|
|
1936
|
+
// Add exit button for upload flavor
|
|
1937
|
+
if (state.exitButton) {
|
|
1938
|
+
createExitButton(state.container, {
|
|
1939
|
+
setter: state.onClose,
|
|
1940
|
+
redirectUrl: state.onCloseRedirectUrl,
|
|
1941
|
+
lensFlavor: state.lensFlavor,
|
|
1942
|
+
}, removeOverlay);
|
|
1943
|
+
}
|
|
1927
1944
|
break;
|
|
1928
1945
|
case 'credit_card':
|
|
1929
1946
|
renderCreditCardIfNeeded();
|
|
@@ -1980,13 +1997,12 @@ const VeryfiLens = (function () {
|
|
|
1980
1997
|
|
|
1981
1998
|
configureLens: (config) => {
|
|
1982
1999
|
Object.keys(config).forEach(key => {
|
|
1983
|
-
if (state.hasOwnProperty(key)
|
|
2000
|
+
if (state.hasOwnProperty(key) &&
|
|
2001
|
+
key !== 'lensFlavor' &&
|
|
2002
|
+
key !== 'container') {
|
|
1984
2003
|
state[key] = config[key];
|
|
1985
2004
|
}
|
|
1986
2005
|
});
|
|
1987
|
-
if (config.lensFlavor === 'long_document' && state.captureButton) {
|
|
1988
|
-
state.captureButton.setStitching(state.isStitching);
|
|
1989
|
-
}
|
|
1990
2006
|
},
|
|
1991
2007
|
|
|
1992
2008
|
stop: () => {
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export const createCheckCapture = (container, captureChecks, successHandler) => {
|
|
2
|
-
const defaultStyles = {
|
|
3
|
-
containerDisplay: 'flex',
|
|
4
|
-
containerFlexDirection: 'column',
|
|
5
|
-
containerJustifyContent: 'center',
|
|
6
|
-
containerAlignItems: 'center',
|
|
7
|
-
containerWidth: '100%',
|
|
8
|
-
containerHeight: '100%',
|
|
9
|
-
containerOverflow: 'auto',
|
|
10
|
-
imageMaxWidth: '48%',
|
|
11
|
-
imageMaxHeight: '96%',
|
|
12
|
-
imageObjectFit: 'contain',
|
|
13
|
-
imageMargin: '1%'
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const imagesContainer = document.createElement('div');
|
|
17
|
-
imagesContainer.id = 'check-images-container';
|
|
18
|
-
Object.entries(defaultStyles).forEach(([key, value]) => {
|
|
19
|
-
const cssVar = `--check-capture-${key.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)}`;
|
|
20
|
-
imagesContainer.style.setProperty(key, `var(${cssVar}, ${value})`);
|
|
21
|
-
});
|
|
22
|
-
container.appendChild(imagesContainer);
|
|
23
|
-
|
|
24
|
-
const createImageElement = (img, alt) => {
|
|
25
|
-
const imgElement = document.createElement('img');
|
|
26
|
-
imgElement.src = img.src;
|
|
27
|
-
imgElement.alt = alt;
|
|
28
|
-
imgElement.style.maxWidth = `var(--check-capture-image-max-width, ${defaultStyles.imageMaxWidth})`;
|
|
29
|
-
imgElement.style.maxHeight = `var(--check-capture-image-max-height, ${defaultStyles.imageMaxHeight})`;
|
|
30
|
-
imgElement.style.objectFit = `var(--check-capture-image-object-fit, ${defaultStyles.imageObjectFit})`;
|
|
31
|
-
imgElement.style.margin = `var(--check-capture-image-margin, ${defaultStyles.imageMargin})`;
|
|
32
|
-
return imgElement;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const displayImages = (frontImage, backImage) => {
|
|
36
|
-
imagesContainer.innerHTML = '';
|
|
37
|
-
const frontImg = new Image();
|
|
38
|
-
frontImg.onload = () => {
|
|
39
|
-
const backImg = new Image();
|
|
40
|
-
backImg.onload = () => {
|
|
41
|
-
const containerAspectRatio = container.clientWidth / container.clientHeight;
|
|
42
|
-
const frontAspectRatio = frontImg.width / frontImg.height;
|
|
43
|
-
const backAspectRatio = backImg.width / backImg.height;
|
|
44
|
-
|
|
45
|
-
const isPortrait = frontAspectRatio < containerAspectRatio && backAspectRatio < containerAspectRatio;
|
|
46
|
-
imagesContainer.style.flexDirection = isPortrait ? 'row' : 'column';
|
|
47
|
-
|
|
48
|
-
const frontImageElement = createImageElement(frontImg, 'Front of check');
|
|
49
|
-
const backImageElement = createImageElement(backImg, 'Back of check');
|
|
50
|
-
|
|
51
|
-
imagesContainer.appendChild(frontImageElement);
|
|
52
|
-
imagesContainer.appendChild(backImageElement);
|
|
53
|
-
|
|
54
|
-
successHandler({ frontImage, backImage });
|
|
55
|
-
};
|
|
56
|
-
backImg.src = `data:image/jpeg;base64,${backImage}`;
|
|
57
|
-
};
|
|
58
|
-
frontImg.src = `data:image/jpeg;base64,${frontImage}`;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
captureCheck: async (isCapturingFront, frontImage, backImage) => {
|
|
63
|
-
if (isCapturingFront) {
|
|
64
|
-
await captureChecks();
|
|
65
|
-
} else {
|
|
66
|
-
await captureChecks();
|
|
67
|
-
displayImages(frontImage, backImage);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
};
|