veryfi-lens-wasm 2.6.1 → 3.0.0-beta.2
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 +235 -241
- package/components/anydocPageControls.js +17 -155
- package/components/blueprintsModal.js +5 -7
- package/components/blurModal.js +17 -140
- package/components/bottleCapOverlay.js +52 -254
- package/components/captureButton.js +5 -0
- package/components/cardDataButton.js +5 -0
- package/components/checkCaptureModal.js +16 -148
- package/components/checkImages.js +7 -1
- package/components/checkOverlay.js +58 -261
- package/components/codeStripsOverlay.js +62 -258
- package/components/createFileUpload.js +35 -154
- package/components/croppedImage.js +52 -171
- package/components/croppedImageLayouts.js +123 -0
- package/components/documentModal.js +17 -151
- package/components/exitButton.js +5 -0
- package/components/frame.js +1 -1
- package/components/gallery.js +136 -0
- package/components/greenBox.js +1 -1
- package/components/lcdModal.js +17 -157
- package/components/longPreview.js +5 -0
- package/components/modalBase.js +233 -0
- package/components/overlayBase.js +124 -0
- package/components/overlayContainer.js +14 -3
- package/components/shared-styles.js +30 -0
- package/components/spinner.js +5 -9
- package/components/stitchingButton.js +5 -0
- package/components/submitButton.js +5 -0
- package/components/torchButton.js +6 -1
- package/components/uploadDropZone.js +65 -0
- package/components/uploadPreview.js +83 -0
- package/components/video.js +1 -1
- package/components/videoOverlay.js +5 -0
- package/components/watermark.js +5 -3
- package/components/wrongSideModal.js +19 -109
- package/core/api.js +189 -0
- package/core/camera.js +202 -0
- package/core/capture/anydoc.js +102 -0
- package/core/capture/checks.js +360 -0
- package/core/capture/document.js +268 -0
- package/core/capture/index.js +3 -0
- package/core/capture/specialty.js +109 -0
- package/core/constants.js +64 -0
- package/core/device.js +185 -0
- package/core/drawing.js +178 -0
- package/core/lifecycle.js +237 -0
- package/core/logger.js +13 -0
- package/core/overlay-controls.js +55 -0
- package/core/state.js +334 -0
- package/core/ui-core.js +79 -0
- package/core/ui-renderer.js +292 -0
- package/core/utils.js +111 -0
- package/core/validation.js +55 -0
- package/core/wasm-processing.js +449 -0
- package/flavors/anydocs.js +75 -0
- package/flavors/caps.js +10 -0
- package/flavors/checks.js +20 -0
- package/flavors/code_strips.js +10 -0
- package/flavors/credit_card.js +11 -0
- package/flavors/document.js +17 -0
- package/flavors/long_document.js +21 -0
- package/flavors/upload.js +42 -0
- package/package.json +6 -12
- package/veryfi-lens.js +243 -3822
- package/wasm/wasm.js +92 -66
- package/setup.sh +0 -3
- package/wasm/nonsimd/veryfi-wasm.js +0 -21
- package/wasm/nonsimd/veryfi-wasm.wasm +0 -0
- package/wasm/nonsimd/veryfi-wasm.worker.js +0 -1
- package/wasm/simd/veryfi-wasm.js +0 -21
- package/wasm/simd/veryfi-wasm.wasm +0 -0
- package/wasm/simd/veryfi-wasm.worker.js +0 -1
- package/wasm/tfsimd/veryfi-wasm.js +0 -21
- package/wasm/tfsimd/veryfi-wasm.wasm +0 -0
- package/wasm/tfsimd/veryfi-wasm.worker.js +0 -1
package/README.md
CHANGED
|
@@ -1,268 +1,262 @@
|
|
|
1
|
-
<img
|
|
1
|
+
<img src="https://user-images.githubusercontent.com/30125790/212157461-58bdc714-2f89-44c2-8e4d-d42bee74854e.png#gh-dark-mode-only" width="200">
|
|
2
2
|
|
|
3
|
-
<img
|
|
3
|
+
<img src="https://user-images.githubusercontent.com/30125790/212157486-bfd08c5d-9337-4b78-be6f-230dc63838ba.png#gh-light-mode-only" width="200">
|
|
4
4
|
|
|
5
|
-
# Veryfi Lens for Web
|
|
5
|
+
# Veryfi Lens for Web SDK (v3)
|
|
6
6
|
|
|
7
|
-
Veryfi Lens for Web
|
|
7
|
+
Veryfi Lens for Web is a browser SDK that gives your web app document capture superpowers in minutes. It uses WebAssembly for fast, on-device document detection, blur/lcd detection and cropping .
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Supported Flavors
|
|
10
10
|
|
|
11
|
+
| Flavor | Description |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `document` | Standard document/receipt capture with auto-detection |
|
|
14
|
+
| `anydocs` | Multi-page document capture with optional blueprints selection |
|
|
15
|
+
| `long_document` | Long receipt stitching from video stream |
|
|
16
|
+
| `checks` | Check capture with optional front/back detection and manual mode |
|
|
17
|
+
| `credit_card` | Credit card scanning (name, number, date, CVV) |
|
|
18
|
+
| `caps` | Bottle cap capture with circular guide overlay |
|
|
19
|
+
| `code_strips` | Code strip capture with rectangular guide overlay |
|
|
20
|
+
| `upload` | File upload with crop and submit (no camera) |
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
1. WebSocket (Only usual receipts, easy to install, slower than WASM)
|
|
14
|
-
2. WASM (Usual and Long Receipts, very fast, some devices are not supported)
|
|
22
|
+
## Installation
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
or `const lens = require('veryfi-lens-wasm').default` inside `useEffect` for next.js
|
|
19
|
-
2. Add `id='veryfi-container'` to a div you want lens to appear (it should have full height and hidden overflow)
|
|
20
|
-
|
|
21
|
-
For usual receipt (Next.Js example)
|
|
22
|
-
```
|
|
23
|
-
const [veryfiLens, setVeryfiLens] = useState<VeryfiLens | null>(null);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
let intervalRef: number | undefined;
|
|
27
|
-
if (typeof window !== 'undefined') {
|
|
28
|
-
const startLens = async () => {
|
|
29
|
-
const lens = require('../../utils/lens-web-sdk/veryfi-lens').default;
|
|
30
|
-
lens.init(sessionToken);
|
|
31
|
-
setVeryfiLens(lens);
|
|
32
|
-
intervalRef = window.setInterval(() => {
|
|
33
|
-
setSocketStatusColor(lens.getSocketStatusColor());
|
|
34
|
-
}, SOCKET_STATUS_UPDATE_INTERVAL);
|
|
35
|
-
}
|
|
36
|
-
startLens();
|
|
37
|
-
}
|
|
38
|
-
return () => {
|
|
39
|
-
clearInterval(intervalRef);
|
|
40
|
-
};
|
|
41
|
-
}, [sessionToken]);
|
|
42
|
-
|
|
43
|
-
const takePhoto = () => {
|
|
44
|
-
if (veryfiLens) {
|
|
45
|
-
veryfiLens.capture(setImage, setIsEditing)
|
|
46
|
-
} else {
|
|
47
|
-
setError('veryfiLens is not initialized');
|
|
48
|
-
}
|
|
49
|
-
};
|
|
24
|
+
```bash
|
|
25
|
+
npm install veryfi-lens-wasm
|
|
50
26
|
```
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
**_You can skip first step and copy wasm folder from package directory manually if you want to do so_.**
|
|
28
|
+
## Quick Start
|
|
54
29
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
2. Import package `import VeryfiLens from 'veryfi-lens-wasm'`
|
|
58
|
-
or `const lens = require('veryfi-lens-wasm').default` inside `useEffect` for next.js
|
|
59
|
-
3. Add `id='veryfi-container'` to a div you want lens to appear (it should have full height and hidden overflow)
|
|
30
|
+
```javascript
|
|
31
|
+
import VeryfiLens from 'veryfi-lens-wasm';
|
|
60
32
|
|
|
61
|
-
|
|
33
|
+
// 1. Register event handlers
|
|
34
|
+
VeryfiLens.onSuccess((result) => {
|
|
35
|
+
console.log('Capture result:', result);
|
|
36
|
+
});
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
initWasm: (arg0: string) => void;
|
|
67
|
-
startCameraWasm: () => void;
|
|
68
|
-
captureWasm: (
|
|
69
|
-
arg0: React.Dispatch<React.SetStateAction<string>>,
|
|
70
|
-
arg1: React.Dispatch<React.SetStateAction<boolean>>
|
|
71
|
-
) => void;
|
|
72
|
-
} | null>(null);
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
const startWasm = async () => {
|
|
76
|
-
if (typeof window !== 'undefined') {
|
|
77
|
-
const lens = require('veryfi-lens-wasm').default;
|
|
78
|
-
lens.setUserAgent(navigator.userAgent);
|
|
79
|
-
await lens.initWasm(sessionToken);
|
|
80
|
-
setVeryfiLens(lens);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
startWasm()
|
|
84
|
-
}, []);
|
|
85
|
-
|
|
86
|
-
const takePhoto = () => {
|
|
87
|
-
if (veryfiLens) {
|
|
88
|
-
veryfiLens.captureWasm(setImage, setIsEditing)
|
|
89
|
-
} else {
|
|
90
|
-
console.log('veryfiLens is not initialized')
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
// setImage is cropped image setter(for example react's useState hook), returns string
|
|
94
|
-
// setIsEditing returns `true` if image was succesfully cropped (we use it to change screens)
|
|
95
|
-
```
|
|
38
|
+
VeryfiLens.onUpdate((update) => {
|
|
39
|
+
console.log('Status update:', update);
|
|
40
|
+
});
|
|
96
41
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<div id="preview-container"
|
|
101
|
-
className="absolute top-[100px] left-[10px] md:left-[40px] w-[22vw] md:w-[18vw] h-[70vh] rounded-md z-40 overflow-y-hidden border-[1px] border-solid border-green-300"
|
|
102
|
-
></div>
|
|
103
|
-
```
|
|
104
|
-
```
|
|
105
|
-
const [veryfiLens, setVeryfiLens] = useState<{
|
|
106
|
-
startStitching(): void;
|
|
107
|
-
setUserAgent: (arg0: string) => void;
|
|
108
|
-
initWasmLong: (arg0: string) => void;
|
|
109
|
-
startCameraWasm: () => void;
|
|
110
|
-
captureLong: (
|
|
111
|
-
arg0: React.Dispatch<React.SetStateAction<string>>,
|
|
112
|
-
arg1: React.Dispatch<React.SetStateAction<boolean>>
|
|
113
|
-
) => void;
|
|
114
|
-
} | null>(null);
|
|
115
|
-
const [isStitching, setIsStitching] = useState(false)
|
|
116
|
-
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
const startWasm = async () => {
|
|
119
|
-
if (typeof window !== 'undefined') {
|
|
120
|
-
const lens = require('veryfi-lens-wasm').default;
|
|
121
|
-
lens.setUserAgent(navigator.userAgent);
|
|
122
|
-
await lens.initWasmLong(sessionToken);
|
|
123
|
-
setVeryfiLens(lens);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
startWasm()
|
|
127
|
-
}, []);
|
|
128
|
-
|
|
129
|
-
// Start button
|
|
130
|
-
const startStitching = () => {
|
|
131
|
-
if (veryfiLens) {
|
|
132
|
-
veryfiLens.startStitching();
|
|
133
|
-
setIsStitching(true);
|
|
134
|
-
} else {
|
|
135
|
-
console.log("veryfiLens is not initialized");
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// Stop button
|
|
140
|
-
const stopStitching = () => {
|
|
141
|
-
if (veryfiLens) {
|
|
142
|
-
veryfiLens.captureLong(setImage, setIsEditing);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
```
|
|
42
|
+
VeryfiLens.onFailure((error) => {
|
|
43
|
+
console.error('Error:', error);
|
|
44
|
+
});
|
|
146
45
|
|
|
147
|
-
|
|
148
|
-
|
|
46
|
+
// 2. Initialize with your client ID and config
|
|
47
|
+
await VeryfiLens.init('your-client-id', {
|
|
48
|
+
lensFlavor: 'document',
|
|
49
|
+
});
|
|
149
50
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
source: '/(.*)',
|
|
155
|
-
headers: [
|
|
156
|
-
{
|
|
157
|
-
key: 'Cross-Origin-Opener-Policy',
|
|
158
|
-
value: 'same-origin'
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: 'Cross-Origin-Embedder-Policy',
|
|
162
|
-
value: 'require-corp'
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
webpack: (config) => {
|
|
170
|
-
config.resolve.fallback = { fs: false, path:false, "crypto": false };
|
|
171
|
-
return config;
|
|
172
|
-
},
|
|
51
|
+
// 3. Show the camera UI
|
|
52
|
+
await VeryfiLens.showCamera((result) => {
|
|
53
|
+
console.log('Captured image:', result);
|
|
54
|
+
});
|
|
173
55
|
```
|
|
174
56
|
|
|
175
|
-
|
|
176
|
-
1. install serve `npm i serve`
|
|
177
|
-
2. Add following to your vite config
|
|
178
|
-
```
|
|
179
|
-
server: {
|
|
180
|
-
https: {
|
|
181
|
-
key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')), //path to your cert
|
|
182
|
-
cert: fs.readFileSync(path.resolve(__dirname, 'localhost.pem')),},
|
|
183
|
-
proxy: {},
|
|
184
|
-
hmr: {
|
|
185
|
-
protocol: 'wss',
|
|
186
|
-
timeout: 30000,
|
|
187
|
-
},
|
|
188
|
-
watch: {},
|
|
189
|
-
open: true,
|
|
190
|
-
host: true,
|
|
191
|
-
strictPort: false,
|
|
192
|
-
force: false,
|
|
193
|
-
cors: true,
|
|
194
|
-
headers: {
|
|
195
|
-
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
196
|
-
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
57
|
+
## API Reference
|
|
200
58
|
|
|
201
|
-
|
|
59
|
+
### `VeryfiLens.init(clientId, config)`
|
|
202
60
|
|
|
203
|
-
|
|
61
|
+
Initialize the SDK. Must be called before `showCamera`.
|
|
204
62
|
|
|
205
|
-
|
|
63
|
+
- `clientId` — Your Veryfi client ID
|
|
64
|
+
- `config` — Configuration object (see [Configuration](#configuration))
|
|
206
65
|
|
|
207
|
-
|
|
208
|
-
"assets": [
|
|
209
|
-
"src/favicon.ico",
|
|
210
|
-
"src/assets",
|
|
211
|
-
"src/wasm"
|
|
212
|
-
],
|
|
213
|
-
```
|
|
66
|
+
### `VeryfiLens.showCamera(setter?)`
|
|
214
67
|
|
|
215
|
-
|
|
68
|
+
Start the camera and display the capture UI. Shows a loading spinner while WASM models are loaded and the camera initializes.
|
|
216
69
|
|
|
217
|
-
|
|
218
|
-
const http = require("http");
|
|
219
|
-
const fs = require("fs").promises;
|
|
220
|
-
const host = "localhost";
|
|
221
|
-
const port = 3000;
|
|
222
|
-
const typeMap = {
|
|
223
|
-
html: "text/html",
|
|
224
|
-
css: "text/css",
|
|
225
|
-
js: "text/javascript",
|
|
226
|
-
wasm: "application/wasm",
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const requestListener = function (req, res) {
|
|
230
|
-
let url = req.url;
|
|
231
|
-
if (url === "/") url = "/index.html";
|
|
232
|
-
for (const [key, value] of Object.entries(typeMap)) {
|
|
233
|
-
if (url.endsWith(key)) res.setHeader("Content-Type", value);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
fs.readFile(__dirname + url)
|
|
237
|
-
.then((contents) => {
|
|
238
|
-
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
|
239
|
-
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
|
240
|
-
res.writeHead(200);
|
|
241
|
-
res.end(contents);
|
|
242
|
-
})
|
|
243
|
-
.catch((err) => {
|
|
244
|
-
console.log("error: ", url);
|
|
245
|
-
console.log("Error", err.stack);
|
|
246
|
-
console.log("Error", err.name);
|
|
247
|
-
console.log("Error", err.message);
|
|
248
|
-
res.writeHead(500);
|
|
249
|
-
return;
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const server = http.createServer(requestListener);
|
|
254
|
-
server.listen(port, host, () => {
|
|
255
|
-
console.log(`Server is running on http://${host}:${port}`);
|
|
256
|
-
});
|
|
257
|
-
```
|
|
70
|
+
- `setter` (optional) — Callback that receives captured image data
|
|
258
71
|
|
|
259
|
-
|
|
260
|
-
2.`npx local-ssl-proxy --key localhost-key.pem --cert localhost.pem --source 3001 --target 3000` (You will need local certificate, possible to make with `mkcert`)
|
|
261
|
-
3. Go to `https://localhost:3001`
|
|
72
|
+
### `VeryfiLens.stop()`
|
|
262
73
|
|
|
263
|
-
|
|
74
|
+
Stop the camera, release resources, and remove the UI.
|
|
264
75
|
|
|
76
|
+
### `VeryfiLens.configureLens(config)`
|
|
77
|
+
|
|
78
|
+
Update configuration at runtime. Cannot change `lensFlavor` or `container`.
|
|
79
|
+
|
|
80
|
+
### `VeryfiLens.getCardData()`
|
|
81
|
+
|
|
82
|
+
Returns the scanned credit card data object (`credit_card` flavor).
|
|
83
|
+
|
|
84
|
+
### `VeryfiLens.getDeviceData()`
|
|
85
|
+
|
|
86
|
+
Returns device fingerprint and browser data for the current session.
|
|
87
|
+
|
|
88
|
+
### `VeryfiLens.setCustomSubmitHandler(handler)`
|
|
89
|
+
|
|
90
|
+
Override the default submit behavior with a custom function.
|
|
91
|
+
|
|
92
|
+
### `VeryfiLens.setCustomData(data)` / `VeryfiLens.getCustomData()`
|
|
93
|
+
|
|
94
|
+
Set or get custom key-value data included with submissions.
|
|
95
|
+
|
|
96
|
+
### Event Handlers
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
VeryfiLens.onSuccess((result) => { /* capture succeeded */ });
|
|
100
|
+
VeryfiLens.onUpdate((update) => { /* status/progress update */ });
|
|
101
|
+
VeryfiLens.onFailure((error) => { /* error occurred */ });
|
|
265
102
|
```
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
### Core Settings
|
|
107
|
+
|
|
108
|
+
| Option | Type | Default | Description |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| `lensFlavor` | `string` | — | **Required.** Capture mode (see [Supported Flavors](#supported-flavors)) |
|
|
111
|
+
| `container` | `string` | — | ID of an HTML element to render into. If omitted, creates a fullscreen overlay |
|
|
112
|
+
| `enableSubmit` | `boolean` | `true` | Show submit button after capture |
|
|
113
|
+
| `enableFullScreen` | `boolean` | `false` | Enable fullscreen mode |
|
|
114
|
+
| `debug_mode` | `boolean` | `false` | Enable console logging |
|
|
115
|
+
|
|
116
|
+
### UI Controls
|
|
117
|
+
|
|
118
|
+
| Option | Type | Default | Description |
|
|
119
|
+
|---|---|---|---|
|
|
120
|
+
| `torchButton` | `boolean` | `true` | Show torch/flashlight toggle |
|
|
121
|
+
| `torchOnStart` | `boolean` | `true` | Turn torch on when camera starts |
|
|
122
|
+
| `exitButton` | `boolean` | `false` | Show exit/close button |
|
|
123
|
+
| `onClose` | `function` | — | Callback when lens is closed |
|
|
124
|
+
| `onCloseRedirectUrl` | `string` | — | URL to redirect to on close |
|
|
125
|
+
| `boxColor` | `string` | `"rgba(84, 192, 139, 0.6)"` | Document detection bounding box color |
|
|
126
|
+
|
|
127
|
+
### Detection Settings
|
|
128
|
+
|
|
129
|
+
| Option | Type | Default | Description |
|
|
130
|
+
|---|---|---|---|
|
|
131
|
+
| `detectBlur` | `boolean` | `true` | Enable blur detection |
|
|
132
|
+
| `isBlurModal` | `boolean` | `true` | Show modal when blur detected |
|
|
133
|
+
| `isDocumentModal` | `boolean` | `true` | Show modal when no document detected |
|
|
134
|
+
| `isLcdModal` | `boolean` | `true` | Show modal when LCD/screen capture detected |
|
|
135
|
+
| `enforceDocumentDetection` | `boolean` | `false` | Block submission if no document detected |
|
|
136
|
+
| `enforceBlurDetection` | `boolean` | `false` | Block submission if image is blurry |
|
|
137
|
+
| `enforceLcdDetection` | `boolean` | `false` | Block submission if screen capture detected |
|
|
138
|
+
| `blurThreshold` | `number` | `0.7` | Blur detection threshold (0-1, higher = stricter) |
|
|
139
|
+
| `lcdThreshold` | `number` | `0.4` | LCD detection threshold (0-1) |
|
|
140
|
+
|
|
141
|
+
### LCD Detection
|
|
142
|
+
|
|
143
|
+
| Option | Type | Default | Description |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| `lcdDetectionForDocuments` | `boolean` | `false` | Enable LCD detection for documents |
|
|
146
|
+
| `lcdDetectionForChecks` | `boolean` | `false` | Enable LCD detection for checks |
|
|
147
|
+
| `lcdDetectionForCards` | `boolean` | `false` | Enable LCD detection for credit cards |
|
|
148
|
+
|
|
149
|
+
### Auto Document Capture
|
|
150
|
+
|
|
151
|
+
| Option | Type | Default | Description |
|
|
152
|
+
|---|---|---|---|
|
|
153
|
+
| `autoDocumentCapture` | `boolean` | `false` | Enable hands-free automatic capture |
|
|
154
|
+
|
|
155
|
+
### Check Capture Settings
|
|
156
|
+
|
|
157
|
+
| Option | Type | Default | Description |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| `captureBackOfCheck` | `boolean` | `false` | Enable back side capture |
|
|
160
|
+
| `enforceBothSides` | `boolean` | `false` | Require both sides |
|
|
161
|
+
| `enforceAndSkipBothSides` | `boolean` | `false` | Auto-proceed to back capture without prompt |
|
|
162
|
+
| `delayBetweenCaptures` | `number` | `0` | Delay (ms) between front and back capture |
|
|
163
|
+
| `frontBackDetectionForChecks` | `boolean` | `false` | Enable front/back side detection |
|
|
164
|
+
| `checksEnableManualMode` | `boolean` | `true` | Enable manual capture mode with guide overlay |
|
|
165
|
+
| `checksManualModeTimeout` | `number` | `3000` | Timeout (ms) before switching to manual mode |
|
|
166
|
+
| `checksCropMargin` | `number` | `0.1` | Margin around check crop (0.0-1.0) |
|
|
167
|
+
| `cropMargin` | `number` | `0.0` | Margin around crop for all document types |
|
|
168
|
+
| `persistManualModeOnRetake` | `boolean` | `true` | Keep manual mode when retaking front side |
|
|
169
|
+
| `forceLandscapeCheckPreview` | `boolean` | `true` | Force horizontal display of check previews |
|
|
170
|
+
|
|
171
|
+
### Check Crop Layout Appearance
|
|
172
|
+
|
|
173
|
+
| Option | Type | Default | Description |
|
|
174
|
+
|---|---|---|---|
|
|
175
|
+
| `cropLayoutAspectRatio` | `number` | `0.0` | Aspect ratio (0.0 = use default) |
|
|
176
|
+
| `cropLayoutBorderColor` | `string` | `"#54C08B"` | Guide border color |
|
|
177
|
+
| `cropLayoutStroke` | `number` | `2` | Guide border width (px) |
|
|
178
|
+
| `cropLayoutOverlayAlpha` | `number` | `0.6` | Overlay transparency (0-1) |
|
|
179
|
+
| `cropLayoutCornerRadius` | `number` | `0` | Guide corner radius (px) |
|
|
180
|
+
| `cropLayoutTipMessage` | `string` | `"Position check inside rectangle"` | Instruction text |
|
|
181
|
+
| `cropLayoutTipPosition` | `string` | `"right"` | Tip text position: `"top"`, `"bottom"`, `"left"`, `"right"` |
|
|
182
|
+
| `cropLayoutGuideTopPosition` | `string` | `"40%"` | Vertical position of guide |
|
|
183
|
+
| `cropLayoutGuideLeftPosition` | `string` | `"50%"` | Horizontal position of guide |
|
|
184
|
+
| `cropLayoutGuideWidthScale` | `number` | `0.90` | Guide width relative to video (0-1) |
|
|
185
|
+
| `cropLayoutGuideMaxHeightScale` | `number` | `0.70` | Guide max height relative to video (0-1) |
|
|
186
|
+
|
|
187
|
+
### Long Document Settings
|
|
188
|
+
|
|
189
|
+
| Option | Type | Default | Description |
|
|
190
|
+
|---|---|---|---|
|
|
191
|
+
| `enableLongReceiptPreview` | `boolean` | `false` | Show stitching preview panel |
|
|
192
|
+
|
|
193
|
+
### Anydocs Multi-Page Settings
|
|
194
|
+
|
|
195
|
+
| Option | Type | Default | Description |
|
|
196
|
+
|---|---|---|---|
|
|
197
|
+
| `enableBlueprintsModal` | `boolean` | `false` | Show blueprints selection modal |
|
|
198
|
+
| `selectedBlueprint` | `string` | — | Pre-selected blueprint (skips modal) |
|
|
199
|
+
| `anydocMaxPages` | `number\|null` | `null` | Max pages (`null` = unlimited) |
|
|
200
|
+
| `anydocAddPageText` | `string` | `"Add Page"` | Add page button text |
|
|
201
|
+
| `anydocSubmitText` | `string` | `"Submit"` | Submit button text |
|
|
202
|
+
| `anydocShowFlipMessage` | `boolean` | `false` | Show flip document message between pages |
|
|
203
|
+
| `anydocFlipMessageText` | `string` | `"Please flip the document..."` | Flip message text |
|
|
204
|
+
| `anydocFlipContinueText` | `string` | `"Continue"` | Continue button text |
|
|
205
|
+
|
|
206
|
+
### Bottle Cap Settings (`caps` flavor)
|
|
207
|
+
|
|
208
|
+
| Option | Type | Default | Description |
|
|
209
|
+
|---|---|---|---|
|
|
210
|
+
| `capCircleRadius` | `number` | `0.7` | Capture circle radius (0-1 relative to viewport) |
|
|
211
|
+
| `bottleCapText` | `string` | `"Position bottle cap in circle"` | Instruction text |
|
|
212
|
+
|
|
213
|
+
### Code Strip Settings (`code_strips` flavor)
|
|
214
|
+
|
|
215
|
+
| Option | Type | Default | Description |
|
|
216
|
+
|---|---|---|---|
|
|
217
|
+
| `rectWidth` | `number` | `0.7` | Capture rectangle width (0-1) |
|
|
218
|
+
| `rectHeight` | `number` | `0.08` | Capture rectangle height (0-1) |
|
|
219
|
+
| `codeStripsText` | `string` | `"Position code strip in rectangle"` | Instruction text |
|
|
220
|
+
|
|
221
|
+
### Upload Settings (`upload` flavor)
|
|
222
|
+
|
|
223
|
+
| Option | Type | Default | Description |
|
|
224
|
+
|---|---|---|---|
|
|
225
|
+
| `cropButtonText` | `string` | `"Crop"` | Crop button text |
|
|
226
|
+
| `resetButtonText` | `string` | `"Reset"` | Reset button text |
|
|
227
|
+
| `dropZoneText` | `string` | `"Click or drag and drop to upload an image"` | Drop zone text |
|
|
228
|
+
|
|
229
|
+
### Customizable Modal Messages
|
|
230
|
+
|
|
231
|
+
| Option | Type | Default |
|
|
232
|
+
|---|---|---|
|
|
233
|
+
| `documentModalMessage` | `string` | `"Oops, There appears to be no document on your image"` |
|
|
234
|
+
| `blurModalMessage` | `string` | `"Oops, The image is too blurry to process"` |
|
|
235
|
+
| `lcdModalMessage` | `string` | `"LCD screen detected. Please capture a printed document instead"` |
|
|
236
|
+
| `submitButtonText` | `string` | `"Submit Anyway"` |
|
|
237
|
+
| `retakeButtonText` | `string` | `"Retake a picture"` |
|
|
238
|
+
| `checkEnforcedModalMessage` | `string` | `"Please flip the check and capture the back side"` |
|
|
239
|
+
| `checkOptionalModalMessage` | `string` | `"Do you want to capture the back side of the check?"` |
|
|
240
|
+
| `wrongSideFrontMessage` | `string` | `"This looks like the back of the check..."` |
|
|
241
|
+
| `wrongSideBackMessage` | `string` | `"This looks like the front of the check..."` |
|
|
242
|
+
|
|
243
|
+
### Fingerprint Settings
|
|
244
|
+
|
|
245
|
+
| Option | Type | Default | Description |
|
|
246
|
+
|---|---|---|---|
|
|
247
|
+
| `enforceFingerprint` | `boolean` | `false` | Fail if fingerprint cannot be generated |
|
|
248
|
+
| `disableFingerprint` | `boolean` | `false` | Disable fingerprinting entirely |
|
|
249
|
+
|
|
250
|
+
### Custom Data
|
|
251
|
+
|
|
252
|
+
| Option | Type | Default | Description |
|
|
253
|
+
|---|---|---|---|
|
|
254
|
+
| `customData` | `object` | `{}` | Key-value data included with submissions |
|
|
255
|
+
|
|
256
|
+
## CSS Customization
|
|
257
|
+
|
|
258
|
+
All UI components support CSS variable overrides for styling. Use the `--spinner-*`, `--cropped-image-*`, `--anydoc-*`, `--gallery-*`, `--file-upload-*`, and `--modal-*` CSS variable families to customize appearance without modifying SDK code.
|
|
259
|
+
|
|
260
|
+
## TypeScript
|
|
261
|
+
|
|
262
|
+
Type definitions are included in `veryfi-lens.d.ts`.
|