veryfi-lens-wasm 3.0.3 → 3.0.5

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 CHANGED
@@ -120,6 +120,9 @@ VeryfiLens.onFailure((error) => { /* error occurred */ });
120
120
  |---|---|---|---|
121
121
  | `torchButton` | `boolean` | `true` | Show torch/flashlight toggle |
122
122
  | `torchOnStart` | `boolean` | `true` | Turn torch on when camera starts |
123
+ | `switchCameraButton` | `boolean` | `true` | Show switch camera (front/back) button |
124
+ | `mirrorButton` | `boolean` | `true` | Show mirror/flip video button |
125
+ | `mirrorOnDesktop` | `boolean` | `true` | Auto-mirror video on desktop (front-facing webcam) |
123
126
  | `exitButton` | `boolean` | `false` | Show exit/close button |
124
127
  | `onClose` | `function` | — | Callback when lens is closed |
125
128
  | `onCloseRedirectUrl` | `string` | — | URL to redirect to on close |
@@ -223,9 +226,16 @@ VeryfiLens.onFailure((error) => { /* error occurred */ });
223
226
 
224
227
  | Option | Type | Default | Description |
225
228
  |---|---|---|---|
226
- | `prescriptionLabelWidthRatio` | `number` | `0.55` | Label overlay width (0-1 relative to viewport) |
227
- | `prescriptionLabelHeightRatio` | `number` | `0.65` | Label overlay height (0-1 relative to viewport) |
229
+ | `prescriptionLabelShowOverlay` | `boolean` | `true` | Show the bottle cutout overlay guide |
230
+ | `prescriptionLabelWidthRatio` | `number` | `0.55` | Bottle overlay width (0-1 relative to viewport) |
231
+ | `prescriptionLabelHeightRatio` | `number` | `0.65` | Bottle overlay height (0-1 relative to viewport) |
228
232
  | `prescriptionLabelText` | `string` | `"Position prescription label in outline"` | Instruction text |
233
+ | `prescriptionLabelShowSquareOverlay` | `boolean` | `false` | Show a square/rectangular overlay guide |
234
+ | `prescriptionLabelSquareWidthRatio` | `number` | `0.8` | Square overlay width (0-1 relative to viewport) |
235
+ | `prescriptionLabelSquareHeightRatio` | `number` | `0.5` | Square overlay height (0-1 relative to viewport) |
236
+ | `prescriptionLabelShowGuide` | `boolean` | `false` | Show a semi-transparent guide explaining how to record the label. Auto-hides when recording starts and reappears on retake |
237
+ | `prescriptionLabelGuideText` | `string` | `"Position the bottle within the outline.\n\nPress the capture button to start recording, slowly rotate the bottle to capture the entire label and press the capture button again to stop recording."` | Guide text shown when the bottle outline overlay is active. Use `\n` for line breaks |
238
+ | `prescriptionLabelSquareGuideText` | `string` | `"Position the prescription label within the square.\n\nPress the capture button to start recording, press again to stop."` | Guide text shown when the square overlay is active. Use `\n` for line breaks |
229
239
 
230
240
  ### Upload Settings (`upload` flavor)
231
241
 
@@ -3,9 +3,7 @@ import { createOverlayBase } from './overlayBase.js';
3
3
  export const createCheckOverlay = (container, options = {}) => {
4
4
  const cropLayoutAspectRatio = options.cropLayoutAspectRatio !== undefined ? options.cropLayoutAspectRatio : 0.0;
5
5
  const cropMargin = options.cropMargin !== undefined ? options.cropMargin : 0.0;
6
- const instructionText = options.instructionText || "Position check inside rectangle";
7
- const borderColor = options.borderColor || "#54C08B";
8
- const borderWidth = options.borderWidth !== undefined ? options.borderWidth : 2;
6
+ const instructionText = options.instructionText || "We could not detect a check, hope this will make it easier";
9
7
  const overlayAlpha = options.overlayAlpha !== undefined ? options.overlayAlpha : 0.6;
10
8
  const cornerRadius = options.cornerRadius !== undefined ? options.cornerRadius : 0;
11
9
  const guideTopPosition = options.guideTopPosition || "40%";
@@ -33,38 +31,109 @@ export const createCheckOverlay = (container, options = {}) => {
33
31
 
34
32
  const rectGuide = document.createElement("div");
35
33
  rectGuide.id = "veryfi-check-guide";
36
- rectGuide.style.position = "absolute";
37
- rectGuide.style.top = guideTopPosition;
38
- rectGuide.style.left = guideLeftPosition;
39
- rectGuide.style.transform = "translate(-50%, -50%)";
40
- rectGuide.style.border = borderWidth > 0 ? `${borderWidth}px solid ${borderColor}` : "none";
41
- rectGuide.style.borderRadius = `${cornerRadius}px`;
42
- rectGuide.style.zIndex = "1003";
43
- rectGuide.style.pointerEvents = "none";
44
- rectGuide.style.boxSizing = "border-box";
34
+ Object.assign(rectGuide.style, {
35
+ position: "absolute",
36
+ top: guideTopPosition,
37
+ left: guideLeftPosition,
38
+ transform: "translate(-50%, -50%)",
39
+ border: "none",
40
+ borderRadius: `${cornerRadius}px`,
41
+ zIndex: "1003",
42
+ pointerEvents: "none",
43
+ boxSizing: "border-box",
44
+ overflow: "hidden",
45
+ });
46
+
47
+ const micrLine = document.createElement("div");
48
+ micrLine.id = "veryfi-check-micr";
49
+ Object.assign(micrLine.style, {
50
+ position: "absolute",
51
+ left: "5%",
52
+ top: "3%",
53
+ transform: "rotate(90deg)",
54
+ transformOrigin: "left bottom",
55
+ display: "flex",
56
+ alignItems: "center",
57
+ gap: "8px",
58
+ pointerEvents: "none",
59
+ whiteSpace: "nowrap",
60
+ });
61
+
62
+ const createMicrSegment = (text) => {
63
+ const span = document.createElement("span");
64
+ span.textContent = text;
65
+ Object.assign(span.style, {
66
+ color: "rgba(255, 255, 255, 0.5)",
67
+ fontFamily: "'Courier New', Courier, monospace",
68
+ fontSize: "14px",
69
+ fontWeight: "bold",
70
+ letterSpacing: "2px",
71
+ whiteSpace: "nowrap",
72
+ });
73
+ return span;
74
+ };
75
+
76
+ micrLine.appendChild(createMicrSegment("####"));
77
+ micrLine.appendChild(createMicrSegment("####"));
78
+ micrLine.appendChild(createMicrSegment("####"));
79
+
80
+ const micrLineBottom = document.createElement("div");
81
+ micrLineBottom.id = "veryfi-check-micr-bottom";
82
+ Object.assign(micrLineBottom.style, {
83
+ position: "absolute",
84
+ right: "15%",
85
+ bottom: "8%",
86
+ transform: "rotate(90deg)",
87
+ transformOrigin: "right bottom",
88
+ display: "flex",
89
+ alignItems: "center",
90
+ gap: "8px",
91
+ pointerEvents: "none",
92
+ whiteSpace: "nowrap",
93
+ });
94
+ micrLineBottom.appendChild(createMicrSegment("###"));
95
+
96
+ const separatorLine = document.createElement("div");
97
+ Object.assign(separatorLine.style, {
98
+ position: "absolute",
99
+ left: "15%",
100
+ top: "5%",
101
+ bottom: "5%",
102
+ width: "1px",
103
+ backgroundColor: "rgba(255, 255, 255, 0.35)",
104
+ pointerEvents: "none",
105
+ });
45
106
 
46
107
  const textLabel = document.createElement("div");
47
108
  textLabel.id = "veryfi-check-label";
48
109
  textLabel.textContent = instructionText;
49
- textLabel.style.position = "absolute";
50
- textLabel.style.width = "100%";
51
- textLabel.style.textAlign = "center";
52
- textLabel.style.color = tipColor;
53
- textLabel.style.fontFamily = tipFontFamily;
54
- textLabel.style.fontSize = tipFontSize;
55
- textLabel.style.fontWeight = tipFontWeight;
56
- textLabel.style.zIndex = "1004";
57
- textLabel.style.textShadow = tipTextShadow;
110
+ Object.assign(textLabel.style, {
111
+ position: "absolute",
112
+ color: tipColor,
113
+ fontFamily: tipFontFamily,
114
+ fontSize: tipFontSize,
115
+ fontWeight: tipFontWeight,
116
+ zIndex: "1004",
117
+ textShadow: tipTextShadow,
118
+ whiteSpace: "nowrap",
119
+ backgroundColor: "rgba(255, 255, 255, 0.85)",
120
+ color: "#333",
121
+ padding: "6px 14px",
122
+ borderRadius: "20px",
123
+ textShadow: "none",
124
+ });
58
125
 
59
126
  switch (tipPosition) {
60
127
  case "top":
61
128
  textLabel.style.bottom = "100%";
62
- textLabel.style.left = "0";
129
+ textLabel.style.left = "50%";
130
+ textLabel.style.transform = "translateX(-50%)";
63
131
  textLabel.style.marginBottom = tipOffset;
64
132
  break;
65
133
  case "bottom":
66
134
  textLabel.style.top = "100%";
67
- textLabel.style.left = "0";
135
+ textLabel.style.left = "50%";
136
+ textLabel.style.transform = "translateX(-50%)";
68
137
  textLabel.style.marginTop = tipOffset;
69
138
  break;
70
139
  case "left":
@@ -99,6 +168,9 @@ export const createCheckOverlay = (container, options = {}) => {
99
168
  buildContent: (overlay) => {
100
169
  overlay.appendChild(rectHole);
101
170
  overlay.appendChild(rectGuide);
171
+ rectGuide.appendChild(micrLine);
172
+ rectGuide.appendChild(micrLineBottom);
173
+ rectGuide.appendChild(separatorLine);
102
174
  rectGuide.appendChild(textLabel);
103
175
 
104
176
  return (videoRect) => {
@@ -8,7 +8,7 @@ export const createExitButton = (container, options, removeOverlay) => {
8
8
  const defaultStyles = {
9
9
  position: 'absolute',
10
10
  bottom: '50px',
11
- left: '100px',
11
+ left: '115px',
12
12
  backgroundColor: 'rgba(255, 255, 255, 0.15)',
13
13
  color: 'white',
14
14
  fontWeight: 'bold',
@@ -0,0 +1,68 @@
1
+ export const createMirrorButton = (container, toggleCallback) => {
2
+ const button = document.createElement('button');
3
+ button.id = 'veryfi-mirror-button';
4
+
5
+ const defaultStyles = {
6
+ width: '40px',
7
+ height: '40px',
8
+ backgroundColor: 'rgba(255, 255, 255, 0.15)',
9
+ color: '#FFFFFF',
10
+ borderRadius: '50%',
11
+ position: 'absolute',
12
+ bottom: '50px',
13
+ left: '50px',
14
+ zIndex: '1000',
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ padding: '0',
19
+ cursor: 'pointer',
20
+ pointerEvents: 'auto',
21
+ border: '1px solid rgba(255, 255, 255, 0.4)',
22
+ outline: 'none',
23
+ boxSizing: 'border-box',
24
+ margin: '0',
25
+ minWidth: '40px',
26
+ minHeight: '40px',
27
+ maxWidth: '40px',
28
+ maxHeight: '40px',
29
+ backdropFilter: 'blur(8px)',
30
+ WebkitBackdropFilter: 'blur(8px)',
31
+ };
32
+
33
+ Object.entries(defaultStyles).forEach(([key, value]) => {
34
+ button.style[key] = value;
35
+ });
36
+
37
+ button.addEventListener('mouseover', () => {
38
+ button.style.backgroundColor = 'rgba(255, 255, 255, 0.25)';
39
+ });
40
+ button.addEventListener('mouseout', () => {
41
+ button.style.backgroundColor = 'rgba(255, 255, 255, 0.15)';
42
+ });
43
+
44
+ button.addEventListener('click', toggleCallback);
45
+
46
+ button.innerHTML = `
47
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width: 20px; height: 20px;">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"/>
49
+ </svg>
50
+ `;
51
+
52
+ container.appendChild(button);
53
+
54
+ return {
55
+ show: () => {
56
+ button.style.display = 'flex';
57
+ },
58
+ hide: () => {
59
+ button.style.display = 'none';
60
+ },
61
+ remove: () => {
62
+ if (button.parentNode) {
63
+ button.parentNode.removeChild(button);
64
+ }
65
+ },
66
+ button: button,
67
+ };
68
+ };
@@ -0,0 +1,76 @@
1
+ export const createPrescriptionLabelGuide = (container, options = {}) => {
2
+ const text = options.text || '';
3
+
4
+ const guide = document.createElement('div');
5
+ guide.id = 'veryfi-prescription-label-guide';
6
+
7
+ Object.assign(guide.style, {
8
+ position: 'absolute',
9
+ top: 'calc(50% - 120px)',
10
+ left: '50%',
11
+ transform: 'translateX(-50%)',
12
+ width: '240px',
13
+ height: '240px',
14
+ padding: '14px 36px 14px 20px',
15
+ backgroundColor: 'rgba(0, 0, 0, 0.6)',
16
+ color: 'white',
17
+ borderRadius: '12px',
18
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
19
+ fontSize: '14px',
20
+ lineHeight: '1.5',
21
+ textAlign: 'left',
22
+ whiteSpace: 'pre-line',
23
+ zIndex: '1003',
24
+ pointerEvents: 'auto',
25
+ backdropFilter: 'blur(8px)',
26
+ WebkitBackdropFilter: 'blur(8px)',
27
+ border: '1px solid rgba(255, 255, 255, 0.2)',
28
+ boxSizing: 'border-box',
29
+ });
30
+
31
+ const textEl = document.createElement('div');
32
+ textEl.textContent = text;
33
+ guide.appendChild(textEl);
34
+
35
+ const closeButton = document.createElement('button');
36
+ closeButton.id = 'veryfi-prescription-label-guide-close';
37
+ closeButton.setAttribute('aria-label', 'Close guide');
38
+ closeButton.textContent = '\u00D7';
39
+ Object.assign(closeButton.style, {
40
+ position: 'absolute',
41
+ top: '6px',
42
+ right: '6px',
43
+ width: '24px',
44
+ height: '24px',
45
+ padding: '0',
46
+ border: 'none',
47
+ background: 'transparent',
48
+ color: 'white',
49
+ fontSize: '20px',
50
+ lineHeight: '24px',
51
+ fontFamily: 'sans-serif',
52
+ cursor: 'pointer',
53
+ opacity: '0.8',
54
+ pointerEvents: 'auto',
55
+ outline: 'none',
56
+ });
57
+
58
+ closeButton.addEventListener('mouseenter', () => { closeButton.style.opacity = '1'; });
59
+ closeButton.addEventListener('mouseleave', () => { closeButton.style.opacity = '0.8'; });
60
+ closeButton.addEventListener('click', (e) => {
61
+ e.stopPropagation();
62
+ guide.style.display = 'none';
63
+ });
64
+
65
+ guide.appendChild(closeButton);
66
+ container.appendChild(guide);
67
+
68
+ return {
69
+ element: guide,
70
+ show: () => { guide.style.display = 'block'; },
71
+ hide: () => { guide.style.display = 'none'; },
72
+ remove: () => {
73
+ if (guide.parentNode) guide.parentNode.removeChild(guide);
74
+ },
75
+ };
76
+ };
@@ -0,0 +1,126 @@
1
+ import { createOverlayBase, createLoadingSpinner } from './overlayBase.js';
2
+
3
+ const buildSquarePath = (vw, vh, widthRatio, heightRatio) => {
4
+ const w = vw * widthRatio;
5
+ const h = vh * heightRatio;
6
+ const r = Math.min(w, h) * 0.02;
7
+
8
+ const cx = vw / 2;
9
+ const cy = vh * 0.46;
10
+
11
+ const x1 = cx - w / 2;
12
+ const x2 = cx + w / 2;
13
+ const y1 = cy - h / 2;
14
+ const y2 = cy + h / 2;
15
+
16
+ return [
17
+ `M ${x1 + r} ${y1}`,
18
+ `H ${x2 - r}`,
19
+ `A ${r} ${r} 0 0 1 ${x2} ${y1 + r}`,
20
+ `V ${y2 - r}`,
21
+ `A ${r} ${r} 0 0 1 ${x2 - r} ${y2}`,
22
+ `H ${x1 + r}`,
23
+ `A ${r} ${r} 0 0 1 ${x1} ${y2 - r}`,
24
+ `V ${y1 + r}`,
25
+ `A ${r} ${r} 0 0 1 ${x1 + r} ${y1}`,
26
+ `Z`
27
+ ].join(' ');
28
+ };
29
+
30
+ const NS = 'http://www.w3.org/2000/svg';
31
+
32
+ let traceStyleEl = null;
33
+
34
+ const setTraceAnimation = (totalLen) => {
35
+ if (traceStyleEl) traceStyleEl.remove();
36
+ traceStyleEl = document.createElement('style');
37
+ traceStyleEl.id = 'veryfi-square-trace-keyframes';
38
+ traceStyleEl.textContent = `
39
+ @keyframes veryfi-square-trace {
40
+ 0% { stroke-dashoffset: 0; }
41
+ 100% { stroke-dashoffset: ${-totalLen}; }
42
+ }
43
+ `;
44
+ document.head.appendChild(traceStyleEl);
45
+ };
46
+
47
+ export const createPrescriptionSquareOverlay = (container, options = {}) => {
48
+ const widthRatio = options.squareWidthRatio !== undefined ? options.squareWidthRatio : 0.8;
49
+ const heightRatio = options.squareHeightRatio !== undefined ? options.squareHeightRatio : 0.5;
50
+
51
+ const svg = document.createElementNS(NS, 'svg');
52
+ svg.style.position = 'absolute';
53
+ svg.style.top = '0';
54
+ svg.style.left = '0';
55
+ svg.style.width = '100%';
56
+ svg.style.height = '100%';
57
+ svg.style.zIndex = '1002';
58
+ svg.style.pointerEvents = 'none';
59
+
60
+ const maskPath = document.createElementNS(NS, 'path');
61
+ maskPath.setAttribute('fill', 'rgba(0, 0, 0, 0.6)');
62
+ maskPath.setAttribute('fill-rule', 'evenodd');
63
+ svg.appendChild(maskPath);
64
+
65
+ const guidePath = document.createElementNS(NS, 'path');
66
+ guidePath.setAttribute('fill', 'none');
67
+ guidePath.setAttribute('stroke', '#00AA00');
68
+ guidePath.setAttribute('stroke-width', '3');
69
+ guidePath.setAttribute('stroke-linecap', 'round');
70
+ svg.appendChild(guidePath);
71
+
72
+ const loadingIndicator = createLoadingSpinner('veryfi-prescription-square-loading');
73
+
74
+ let dashInitialized = false;
75
+
76
+ const base = createOverlayBase(container, {
77
+ id: 'veryfi-prescription-square-overlay',
78
+ hasSpinner: true,
79
+ buildContent: (overlay) => {
80
+ overlay.appendChild(svg);
81
+ overlay.appendChild(loadingIndicator);
82
+
83
+ return (videoRect, videoElement) => {
84
+ const vw = videoRect.width;
85
+ const vh = videoRect.height;
86
+
87
+ if (vw <= 0 || vh <= 0) return;
88
+
89
+ svg.setAttribute('viewBox', `0 0 ${vw} ${vh}`);
90
+
91
+ const outerRect = `M 0 0 H ${vw} V ${vh} H 0 Z`;
92
+ const square = buildSquarePath(vw, vh, widthRatio, heightRatio);
93
+
94
+ maskPath.setAttribute('d', `${outerRect} ${square}`);
95
+ guidePath.setAttribute('d', square);
96
+
97
+ if (!dashInitialized) {
98
+ const totalLen = guidePath.getTotalLength();
99
+ const dashLen = totalLen * 0.15;
100
+ const gapLen = totalLen - dashLen;
101
+
102
+ guidePath.setAttribute('stroke-dasharray', `${dashLen} ${gapLen}`);
103
+ setTraceAnimation(totalLen);
104
+ guidePath.style.animation = 'veryfi-square-trace 3s linear infinite';
105
+ dashInitialized = true;
106
+ }
107
+
108
+ if (videoElement.readyState >= 2) {
109
+ loadingIndicator.style.display = 'none';
110
+ }
111
+ };
112
+ },
113
+ cropFn: null,
114
+ });
115
+
116
+ return {
117
+ ...base,
118
+ cleanup: () => {
119
+ base.cleanup();
120
+ if (traceStyleEl) {
121
+ traceStyleEl.remove();
122
+ traceStyleEl = null;
123
+ }
124
+ },
125
+ };
126
+ };
@@ -0,0 +1,68 @@
1
+ export const createSwitchCameraButton = (container, toggleCallback) => {
2
+ const button = document.createElement('button');
3
+ button.id = 'veryfi-switch-camera-button';
4
+
5
+ const defaultStyles = {
6
+ width: '40px',
7
+ height: '40px',
8
+ backgroundColor: 'rgba(255, 255, 255, 0.15)',
9
+ color: '#FFFFFF',
10
+ borderRadius: '50%',
11
+ position: 'absolute',
12
+ bottom: '50px',
13
+ right: '50px',
14
+ zIndex: '1000',
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ padding: '0',
19
+ cursor: 'pointer',
20
+ pointerEvents: 'auto',
21
+ border: '1px solid rgba(255, 255, 255, 0.4)',
22
+ outline: 'none',
23
+ boxSizing: 'border-box',
24
+ margin: '0',
25
+ minWidth: '40px',
26
+ minHeight: '40px',
27
+ maxWidth: '40px',
28
+ maxHeight: '40px',
29
+ backdropFilter: 'blur(8px)',
30
+ WebkitBackdropFilter: 'blur(8px)',
31
+ };
32
+
33
+ Object.entries(defaultStyles).forEach(([key, value]) => {
34
+ button.style[key] = value;
35
+ });
36
+
37
+ button.addEventListener('mouseover', () => {
38
+ button.style.backgroundColor = 'rgba(255, 255, 255, 0.25)';
39
+ });
40
+ button.addEventListener('mouseout', () => {
41
+ button.style.backgroundColor = 'rgba(255, 255, 255, 0.15)';
42
+ });
43
+
44
+ button.addEventListener('click', toggleCallback);
45
+
46
+ button.innerHTML = `
47
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width: 20px; height: 20px;">
48
+ <path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.992 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182M20.015 4.356v4.992"/>
49
+ </svg>
50
+ `;
51
+
52
+ container.appendChild(button);
53
+
54
+ return {
55
+ show: () => {
56
+ button.style.display = 'flex';
57
+ },
58
+ hide: () => {
59
+ button.style.display = 'none';
60
+ },
61
+ remove: () => {
62
+ if (button.parentNode) {
63
+ button.parentNode.removeChild(button);
64
+ }
65
+ },
66
+ button: button,
67
+ };
68
+ };
@@ -10,7 +10,7 @@ export const createTorchButton = (container, toggleCallback, lensFlavor) => {
10
10
  borderRadius: '50%',
11
11
  position: 'absolute',
12
12
  bottom: '50px',
13
- right: '100px',
13
+ right: '115px',
14
14
  zIndex: '1000',
15
15
  display: 'flex',
16
16
  alignItems: 'center',
package/core/camera.js CHANGED
@@ -69,6 +69,16 @@ export const getVideo = async (lensFlavor) => {
69
69
 
70
70
  state.videoRef.addEventListener('loadedmetadata', () => {
71
71
  state.videoRef.style.opacity = '1';
72
+
73
+ if (state.mirrorOnDesktop) {
74
+ const isMobile = window.innerWidth <= 768 || window.innerHeight <= 768;
75
+ if (!isMobile && !state.isMirrored) {
76
+ state.isMirrored = true;
77
+ state.videoRef.style.transform = 'scaleX(-1)';
78
+ if (state.boxRef) state.boxRef.style.transform = 'scaleX(-1)';
79
+ state.debug_mode && console.log('Auto-mirrored video on desktop');
80
+ }
81
+ }
72
82
  }, { once: true });
73
83
 
74
84
  state.videoRef.style.width = '100vw';
@@ -179,6 +189,66 @@ export const getChecksVideo = async () => {
179
189
  }
180
190
  };
181
191
 
192
+ export const mirrorVideo = () => {
193
+ if (!state.videoRef) return;
194
+ state.isMirrored = !state.isMirrored;
195
+ const mirrorTransform = state.isMirrored ? 'scaleX(-1)' : '';
196
+ state.videoRef.style.transform = mirrorTransform;
197
+ if (state.boxRef) state.boxRef.style.transform = mirrorTransform;
198
+ state.debug_mode && console.log('Video mirrored:', state.isMirrored);
199
+ };
200
+
201
+ export const switchCamera = async () => {
202
+ if (!state.videoRef) return;
203
+
204
+ const currentFacing = state.cameraFacingMode || 'environment';
205
+ const newFacing = currentFacing === 'environment' ? 'user' : 'environment';
206
+
207
+ if (state.videoRef.srcObject) {
208
+ state.videoRef.srcObject.getTracks().forEach((track) => track.stop());
209
+ }
210
+
211
+ const videoConfig = {
212
+ width: { ideal: 3840 },
213
+ height: { ideal: 2160 },
214
+ facingMode: newFacing,
215
+ };
216
+
217
+ try {
218
+ state.updateHandler?.({ status: 'camera_switching' });
219
+ const stream = await navigator.mediaDevices.getUserMedia({
220
+ audio: false,
221
+ video: videoConfig,
222
+ });
223
+
224
+ state.videoRef.srcObject = stream;
225
+ state.cameraFacingMode = newFacing;
226
+
227
+ const videoTracks = stream.getVideoTracks();
228
+ if (videoTracks.length > 0) {
229
+ const track = videoTracks[0];
230
+ state.torchTrack = track;
231
+ const capabilities = track.getCapabilities();
232
+ state.torchEnabled = !!capabilities.torch;
233
+
234
+ if (state.torchButtonRef) {
235
+ if (state.torchEnabled) {
236
+ state.torchButtonRef.show();
237
+ } else {
238
+ state.torchButtonRef.hide();
239
+ }
240
+ }
241
+ }
242
+
243
+ state.updateHandler?.({ status: 'camera_ready' });
244
+ state.debug_mode && console.log('Switched camera to:', newFacing);
245
+ } catch (err) {
246
+ console.error('Error switching camera:', err);
247
+ state.updateHandler?.({ status: 'camera_switch_failed', error: err.message });
248
+ state.failureHandler?.(err);
249
+ }
250
+ };
251
+
182
252
  export const toggleTorchLight = async () => {
183
253
  if (!state.torchTrack) {
184
254
  state.debug_mode && console.log("Camera not initialized");
@@ -13,6 +13,8 @@ let videoPreviewEl = null;
13
13
  let retakeButtonEl = null;
14
14
  let playPauseButtonEl = null;
15
15
  let lastVideoBlob = null;
16
+ let cropCanvas = null;
17
+ let cropAnimationFrameId = null;
16
18
 
17
19
  const ensurePulseKeyframes = () => {
18
20
  if (pulseStyleEl) return;
@@ -127,6 +129,96 @@ const getRecorderMimeType = () => {
127
129
  return '';
128
130
  };
129
131
 
132
+ const computeOverlayCropRect = (vw, vh) => {
133
+ if (state.prescriptionLabelShowSquareOverlay) {
134
+ const w = vw * state.prescriptionLabelSquareWidthRatio;
135
+ const h = vh * state.prescriptionLabelSquareHeightRatio;
136
+ const cx = vw / 2;
137
+ const cy = vh * 0.46;
138
+ return { x: cx - w / 2, y: cy - h / 2, width: w, height: h };
139
+ }
140
+
141
+ if (state.prescriptionLabelShowOverlay) {
142
+ const bodyW = vw * state.prescriptionLabelWidthRatio;
143
+ const totalH = vh * state.prescriptionLabelHeightRatio;
144
+ const cx = vw / 2;
145
+ const cy = vh * 0.46;
146
+ return { x: cx - bodyW / 2, y: cy - totalH / 2, width: bodyW, height: totalH };
147
+ }
148
+
149
+ return null;
150
+ };
151
+
152
+ const computeSourceCropRegion = (videoElement) => {
153
+ const videoRect = videoElement.getBoundingClientRect();
154
+ const vw = videoRect.width;
155
+ const vh = videoRect.height;
156
+ const sw = videoElement.videoWidth;
157
+ const sh = videoElement.videoHeight;
158
+
159
+ if (vw <= 0 || vh <= 0 || sw <= 0 || sh <= 0) return null;
160
+
161
+ const overlayRect = computeOverlayCropRect(vw, vh);
162
+ if (!overlayRect) return null;
163
+
164
+ // Map from displayed video rect (object-fit: cover) to source pixels.
165
+ const scale = Math.max(vw / sw, vh / sh);
166
+ const visibleSrcW = vw / scale;
167
+ const visibleSrcH = vh / scale;
168
+ const offsetX = (sw - visibleSrcW) / 2;
169
+ const offsetY = (sh - visibleSrcH) / 2;
170
+
171
+ let srcX = overlayRect.x / scale + offsetX;
172
+ let srcY = overlayRect.y / scale + offsetY;
173
+ let srcW = overlayRect.width / scale;
174
+ let srcH = overlayRect.height / scale;
175
+
176
+ srcX = Math.max(0, Math.min(srcX, sw));
177
+ srcY = Math.max(0, Math.min(srcY, sh));
178
+ srcW = Math.max(1, Math.min(srcW, sw - srcX));
179
+ srcH = Math.max(1, Math.min(srcH, sh - srcY));
180
+
181
+ return { srcX, srcY, srcW, srcH };
182
+ };
183
+
184
+ const startCroppedDrawLoop = (videoElement, region) => {
185
+ // Even dimensions are required by some video codecs (e.g. H.264).
186
+ const outW = Math.max(2, Math.floor(region.srcW / 2) * 2);
187
+ const outH = Math.max(2, Math.floor(region.srcH / 2) * 2);
188
+
189
+ cropCanvas = document.createElement('canvas');
190
+ cropCanvas.width = outW;
191
+ cropCanvas.height = outH;
192
+ const ctx = cropCanvas.getContext('2d');
193
+
194
+ const draw = () => {
195
+ if (!cropCanvas) return;
196
+ if (videoElement.readyState >= 2 && !videoElement.paused && !videoElement.ended) {
197
+ try {
198
+ ctx.drawImage(
199
+ videoElement,
200
+ region.srcX, region.srcY, region.srcW, region.srcH,
201
+ 0, 0, outW, outH
202
+ );
203
+ } catch (e) {
204
+ // ignore transient draw errors (video not ready, etc.)
205
+ }
206
+ }
207
+ cropAnimationFrameId = requestAnimationFrame(draw);
208
+ };
209
+ draw();
210
+
211
+ return cropCanvas.captureStream(30);
212
+ };
213
+
214
+ const stopCroppedDrawLoop = () => {
215
+ if (cropAnimationFrameId !== null) {
216
+ cancelAnimationFrame(cropAnimationFrameId);
217
+ cropAnimationFrameId = null;
218
+ }
219
+ cropCanvas = null;
220
+ };
221
+
130
222
  const startRecording = () => {
131
223
  const stream = state.videoRef?.srcObject;
132
224
  if (!stream) {
@@ -140,8 +232,21 @@ const startRecording = () => {
140
232
  const recorderOptions = mimeType ? { mimeType } : {};
141
233
  console.log(`[prescription_label] MediaRecorder options:`, recorderOptions);
142
234
 
235
+ let recordingStream = stream;
236
+ const region = computeSourceCropRegion(state.videoRef);
237
+ if (region) {
238
+ try {
239
+ recordingStream = startCroppedDrawLoop(state.videoRef, region);
240
+ state.debug_mode && console.log(`[prescription_label] Cropping video to ${cropCanvas.width}x${cropCanvas.height} (source region ${Math.round(region.srcW)}x${Math.round(region.srcH)} at ${Math.round(region.srcX)},${Math.round(region.srcY)})`);
241
+ } catch (e) {
242
+ console.warn('[prescription_label] Failed to set up cropped recording stream, falling back to full video:', e);
243
+ stopCroppedDrawLoop();
244
+ recordingStream = stream;
245
+ }
246
+ }
247
+
143
248
  try {
144
- mediaRecorder = new MediaRecorder(stream, recorderOptions);
249
+ mediaRecorder = new MediaRecorder(recordingStream, recorderOptions);
145
250
  } catch (e) {
146
251
  console.error('Failed to create MediaRecorder:', e);
147
252
  state.failureHandler?.(e);
@@ -157,6 +262,7 @@ const startRecording = () => {
157
262
  mediaRecorder.start(200);
158
263
  isRecording = true;
159
264
  updateRecordingUI(true);
265
+ state.prescriptionLabelGuide?.hide?.();
160
266
  state.updateHandler?.({ status: 'recording_started' });
161
267
  state.debug_mode && console.log('[EVENT] prescription label recording started');
162
268
  };
@@ -174,6 +280,7 @@ const stopRecording = () => {
174
280
  const blob = new Blob(recordedChunks, { type: mediaRecorder.mimeType });
175
281
  recordedChunks = [];
176
282
  mediaRecorder = null;
283
+ stopCroppedDrawLoop();
177
284
  state.updateHandler?.({ status: 'recording_stopped' });
178
285
  state.debug_mode && console.log('[EVENT] prescription label recording stopped, blob size:', blob.size);
179
286
  resolve(blob);
@@ -230,7 +337,7 @@ const showVideoPreview = (videoBlob) => {
230
337
  height: '100vh',
231
338
  maxWidth: 'none',
232
339
  transform: 'none',
233
- objectFit: 'cover',
340
+ objectFit: 'contain',
234
341
  zIndex: '900',
235
342
  background: '#000',
236
343
  });
@@ -241,7 +348,7 @@ const showVideoPreview = (videoBlob) => {
241
348
  height: 'auto',
242
349
  maxWidth: '500px',
243
350
  transform: 'none',
244
- objectFit: 'cover',
351
+ objectFit: 'contain',
245
352
  zIndex: '900',
246
353
  background: '#000',
247
354
  });
@@ -318,6 +425,7 @@ const showVideoPreview = (videoBlob) => {
318
425
  state.submitButton = null;
319
426
  }
320
427
  showVideoOverlay();
428
+ state.prescriptionLabelGuide?.show?.();
321
429
  await newStartLens();
322
430
  });
323
431
  containerEl.appendChild(retakeButtonEl);
@@ -364,6 +472,7 @@ export const capturePrescriptionLabel = async () => {
364
472
  }
365
473
 
366
474
  hideVideoOverlay();
475
+ state.exitButtonRef?.hide?.();
367
476
 
368
477
  if (state.videoRef?.srcObject) {
369
478
  state.videoRef.srcObject.getTracks().forEach((track) => track.stop());
@@ -387,6 +496,7 @@ export const capturePrescriptionLabel = async () => {
387
496
  submitBtnEl.style.padding = '12px 0';
388
497
  submitBtnEl.style.textAlign = 'center';
389
498
  submitBtnEl.style.boxSizing = 'border-box';
499
+ submitBtnEl.style.border = '1px solid transparent';
390
500
  }
391
501
  state.submitButton.show();
392
502
 
@@ -413,5 +523,6 @@ export const cleanupPrescriptionLabelRecording = () => {
413
523
  recordedChunks = [];
414
524
  isRecording = false;
415
525
  updateRecordingUI(false);
526
+ stopCroppedDrawLoop();
416
527
  cleanupPreview();
417
528
  };
package/core/constants.js CHANGED
@@ -12,7 +12,7 @@ export const API_URLS = {
12
12
  };
13
13
 
14
14
  export const DEFAULTS = {
15
- SDK_VERSION: '3.0.3',
15
+ SDK_VERSION: '3.0.5',
16
16
  BLUR_THRESHOLD: 0.7,
17
17
  LCD_THRESHOLD: 0.5,
18
18
  BOX_COLOR: 'rgba(84, 192, 139, 0.6)',
@@ -29,6 +29,8 @@ export const DEFAULTS = {
29
29
  RECT_HEIGHT: 0.08,
30
30
  PRESCRIPTION_LABEL_WIDTH: 0.55,
31
31
  PRESCRIPTION_LABEL_HEIGHT: 0.65,
32
+ PRESCRIPTION_SQUARE_WIDTH: 0.8,
33
+ PRESCRIPTION_SQUARE_HEIGHT: 0.5,
32
34
  EXPAND_FACTOR: 1.02,
33
35
  CROP_LAYOUT_OVERLAY_ALPHA: 0.6,
34
36
  CROP_LAYOUT_STROKE: 2,
@@ -56,8 +58,10 @@ export const MESSAGES = {
56
58
  WRONG_SIDE_BACK: 'This looks like the front of the check. Please flip and capture the back side.',
57
59
  BOTTLE_CAP: 'Position bottle cap in circle',
58
60
  PRESCRIPTION_LABEL: 'Position prescription label in outline',
61
+ PRESCRIPTION_LABEL_GUIDE: 'Position the bottle within the outline.\n\nPress the capture button to start recording, slowly rotate the bottle to capture the entire label and press the capture button again to stop recording.',
62
+ PRESCRIPTION_SQUARE_GUIDE: 'Position the prescription label within the square.\n\nPress the capture button to start recording, press again to stop.',
59
63
  CODE_STRIPS: 'Position code strip in rectangle',
60
- CHECK_POSITION: 'Position check inside rectangle',
64
+ CHECK_POSITION: 'We could not detect a check, hope this will make it easier',
61
65
  ANYDOC_ADD_PAGE: 'Add Page',
62
66
  ANYDOC_SUBMIT: 'Submit',
63
67
  ANYDOC_FLIP: 'Please flip the document and capture the other side',
@@ -17,6 +17,14 @@ export const hideVideoOverlay = () => {
17
17
  state.torchButtonRef.button.style.display = 'none';
18
18
  }
19
19
 
20
+ if (typeof state.mirrorButtonRef?.hide === 'function') {
21
+ state.mirrorButtonRef.hide();
22
+ }
23
+
24
+ if (typeof state.switchCameraButtonRef?.hide === 'function') {
25
+ state.switchCameraButtonRef.hide();
26
+ }
27
+
20
28
  if (state.submitButton) {
21
29
  state.submitButton.hide();
22
30
  }
@@ -49,6 +57,14 @@ export const showVideoOverlay = () => {
49
57
  state.exitButtonRef.show();
50
58
  }
51
59
 
60
+ if (typeof state.mirrorButtonRef?.show === 'function') {
61
+ state.mirrorButtonRef.show();
62
+ }
63
+
64
+ if (typeof state.switchCameraButtonRef?.show === 'function') {
65
+ state.switchCameraButtonRef.show();
66
+ }
67
+
52
68
  if (state.isManualCheckCapture && state.checkOverlay) {
53
69
  state.checkOverlay.show();
54
70
  }
package/core/state.js CHANGED
@@ -19,6 +19,9 @@ export const state = {
19
19
  hasInit: false,
20
20
  torchEnabled: true,
21
21
  torchOnStart: true,
22
+ isMirrored: false,
23
+ mirrorOnDesktop: true,
24
+ cameraFacingMode: 'environment',
22
25
  shouldProcessCC: true,
23
26
 
24
27
  // Document state
@@ -74,6 +77,8 @@ export const state = {
74
77
 
75
78
  // UI Configuration
76
79
  torchButton: true,
80
+ switchCameraButton: true,
81
+ mirrorButton: true,
77
82
  detectBlur: true,
78
83
  isBlurModal: true,
79
84
  isDocumentModal: true,
@@ -146,6 +151,8 @@ export const state = {
146
151
  documentModal: null,
147
152
  lcdModal: null,
148
153
  torchButtonRef: null,
154
+ mirrorButtonRef: null,
155
+ switchCameraButtonRef: null,
149
156
  uploadContainer: null,
150
157
  fileUpload: null,
151
158
  croppedImage: null,
@@ -182,9 +189,18 @@ export const state = {
182
189
  bottleCapOverlay: null,
183
190
 
184
191
  prescriptionLabelOverlay: null,
192
+ prescriptionLabelShowOverlay: true,
185
193
  prescriptionLabelWidthRatio: DEFAULTS.PRESCRIPTION_LABEL_WIDTH,
186
194
  prescriptionLabelHeightRatio: DEFAULTS.PRESCRIPTION_LABEL_HEIGHT,
187
195
  prescriptionLabelText: MESSAGES.PRESCRIPTION_LABEL,
196
+ prescriptionSquareOverlay: null,
197
+ prescriptionLabelShowSquareOverlay: false,
198
+ prescriptionLabelSquareWidthRatio: DEFAULTS.PRESCRIPTION_SQUARE_WIDTH,
199
+ prescriptionLabelSquareHeightRatio: DEFAULTS.PRESCRIPTION_SQUARE_HEIGHT,
200
+ prescriptionLabelShowGuide: false,
201
+ prescriptionLabelGuideText: MESSAGES.PRESCRIPTION_LABEL_GUIDE,
202
+ prescriptionLabelSquareGuideText: MESSAGES.PRESCRIPTION_SQUARE_GUIDE,
203
+ prescriptionLabelGuide: null,
188
204
  preferredVideoFormat: null,
189
205
 
190
206
  codeStripsOverlay: null,
@@ -286,6 +302,10 @@ export const resetState = () => {
286
302
  state.videoRef = null;
287
303
  state.boxRef = null;
288
304
  state.torchButtonRef = null;
305
+ state.mirrorButtonRef = null;
306
+ state.switchCameraButtonRef = null;
307
+ state.isMirrored = false;
308
+ state.cameraFacingMode = 'environment';
289
309
  state.captureButton = null;
290
310
  state.submitButton = null;
291
311
  state.exitButtonRef = null;
@@ -294,6 +314,8 @@ export const resetState = () => {
294
314
  state.checkImagesComponent = null;
295
315
  state.bottleCapOverlay = null;
296
316
  state.prescriptionLabelOverlay = null;
317
+ state.prescriptionSquareOverlay = null;
318
+ state.prescriptionLabelGuide = null;
297
319
  state.codeStripsOverlay = null;
298
320
  state.checkOverlay = null;
299
321
  state.isManualCheckCapture = false;
@@ -1,6 +1,6 @@
1
1
  import { state, refs, actions } from './state.js';
2
2
  import { hideVideoOverlay, showVideoOverlay } from './overlay-controls.js';
3
- import { toggleTorchLight } from './camera.js';
3
+ import { toggleTorchLight, mirrorVideo, switchCamera } from './camera.js';
4
4
  import { createVideo } from '../components/video.js';
5
5
  import { createBlurModal } from '../components/blurModal.js';
6
6
  import { createDocumentModal } from '../components/documentModal.js';
@@ -17,6 +17,10 @@ import { createCardDataButton } from '../components/cardDataButton.js';
17
17
  import { createBottleCapOverlay } from '../components/bottleCapOverlay.js';
18
18
  import { createCodeStripsOverlay } from '../components/codeStripsOverlay.js';
19
19
  import { createPrescriptionLabelOverlay } from '../components/prescriptionLabelOverlay.js';
20
+ import { createPrescriptionSquareOverlay } from '../components/prescriptionSquareOverlay.js';
21
+ import { createPrescriptionLabelGuide } from '../components/prescriptionLabelGuide.js';
22
+ import { createMirrorButton } from '../components/mirrorButton.js';
23
+ import { createSwitchCameraButton } from '../components/switchCameraButton.js';
20
24
 
21
25
  export const renderWatermarkIfNeeded = () => {
22
26
  if (state.clientData?.show_watermark) {
@@ -49,6 +53,18 @@ const setupVideoOverlayControls = (captureAction) => {
49
53
  }, state.lensFlavor);
50
54
  }
51
55
 
56
+ if (state.switchCameraButton) {
57
+ state.switchCameraButtonRef = createSwitchCameraButton(state.videoOverlay.overlay, () => {
58
+ switchCamera();
59
+ });
60
+ }
61
+
62
+ if (state.mirrorButton) {
63
+ state.mirrorButtonRef = createMirrorButton(state.videoOverlay.overlay, () => {
64
+ mirrorVideo();
65
+ });
66
+ }
67
+
52
68
  renderWatermarkIfNeeded();
53
69
  };
54
70
 
@@ -127,6 +143,18 @@ export const renderVideoOverlayIfNeeded = () => {
127
143
  }, state.lensFlavor);
128
144
  }
129
145
 
146
+ if (state.switchCameraButton) {
147
+ state.switchCameraButtonRef = createSwitchCameraButton(state.videoOverlay.overlay, () => {
148
+ switchCamera();
149
+ });
150
+ }
151
+
152
+ if (state.mirrorButton) {
153
+ state.mirrorButtonRef = createMirrorButton(state.videoOverlay.overlay, () => {
154
+ mirrorVideo();
155
+ });
156
+ }
157
+
130
158
  renderWatermarkIfNeeded();
131
159
  };
132
160
 
@@ -261,11 +289,30 @@ export const renderPrescriptionLabelOverlayIfNeeded = () => {
261
289
  state.debug_mode && console.log("Rendering prescription label overlay");
262
290
  setupVideoOverlayControls(() => actions.capturePrescriptionLabel());
263
291
 
264
- createSpecialtyOverlayOnReady('prescriptionLabelOverlay', createPrescriptionLabelOverlay, {
265
- bottleWidthRatio: state.prescriptionLabelWidthRatio,
266
- bottleHeightRatio: state.prescriptionLabelHeightRatio,
267
- instructionText: state.prescriptionLabelText
268
- });
292
+ if (state.prescriptionLabelShowOverlay) {
293
+ createSpecialtyOverlayOnReady('prescriptionLabelOverlay', createPrescriptionLabelOverlay, {
294
+ bottleWidthRatio: state.prescriptionLabelWidthRatio,
295
+ bottleHeightRatio: state.prescriptionLabelHeightRatio,
296
+ instructionText: state.prescriptionLabelText
297
+ });
298
+ }
299
+
300
+ if (state.prescriptionLabelShowSquareOverlay) {
301
+ createSpecialtyOverlayOnReady('prescriptionSquareOverlay', createPrescriptionSquareOverlay, {
302
+ squareWidthRatio: state.prescriptionLabelSquareWidthRatio,
303
+ squareHeightRatio: state.prescriptionLabelSquareHeightRatio,
304
+ });
305
+ }
306
+
307
+ if (state.prescriptionLabelShowGuide && !state.prescriptionLabelGuide) {
308
+ const guideText = state.prescriptionLabelShowSquareOverlay
309
+ ? state.prescriptionLabelSquareGuideText
310
+ : state.prescriptionLabelGuideText;
311
+ state.prescriptionLabelGuide = createPrescriptionLabelGuide(
312
+ state.videoOverlay?.overlay || state.container,
313
+ { text: guideText }
314
+ );
315
+ }
269
316
  };
270
317
 
271
318
  export const renderCodeStripsOverlayIfNeeded = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfi-lens-wasm",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Lens For Web SDK with WASM",
5
5
  "main": "veryfi-lens.js",
6
6
  "type": "module",
package/veryfi-lens.js CHANGED
@@ -2,7 +2,7 @@ import { state, refs, actions } from './core/state.js';
2
2
  import { DEFAULTS } from './core/constants.js';
3
3
  import { flattenObject, parseUA, getBrowserData } from './core/utils.js';
4
4
  import { generateDeviceIDifNeeded, setLCDDetectionSettings, setFrontBackDetectionSettings, getDocumentLcdStatus } from './core/device.js';
5
- import { toggleTorchLight } from './core/camera.js';
5
+ import { toggleTorchLight, mirrorVideo, switchCamera } from './core/camera.js';
6
6
  import { checkIfDocumentOnCapture } from './core/validation.js';
7
7
  import { validatePartner } from './core/api.js';
8
8
  import { initializeWasmWrapper } from './core/wasm-processing.js';
@@ -15,6 +15,8 @@ import { createSpinner } from './components/spinner.js';
15
15
  actions.newStartLens = newStartLens;
16
16
  actions.removeOverlay = removeOverlay;
17
17
  actions.toggleTorchLight = toggleTorchLight;
18
+ actions.mirrorVideo = mirrorVideo;
19
+ actions.switchCamera = switchCamera;
18
20
  actions.checkIfDocumentOnCapture = checkIfDocumentOnCapture;
19
21
 
20
22
  const VeryfiLens = {