veryfi-lens-wasm 1.2.7 → 1.2.8
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 +11 -44
- package/package.json +2 -2
- package/veryfi-lens.js +115 -553
- package/wasm/parser-wrapper.js +2 -0
- package/wasm/opencv.js +0 -5
- /package/wasm/{ua-parser.cjs → ua-parser.js} +0 -0
package/README.md
CHANGED
|
@@ -2,54 +2,17 @@
|
|
|
2
2
|
|
|
3
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
|
-
#
|
|
6
|
-
|
|
7
|
-
Veryfi Lens for Web SDK is a framework for your web app to give it document capture superpowers in minutes.
|
|
8
|
-
|
|
9
|
-
Lens follows a client-server architecture where the server is for validating your client and getting session key and the client side is for displaying and showing Lens components for capturing documents.
|
|
5
|
+
# Lens for Browser socket version has been moved to a separate package
|
|
10
6
|
|
|
7
|
+
<https://github.com/veryfi/veryfi-lens-socket>
|
|
8
|
+
<https://www.npmjs.com/package/veryfi-lens-socket>
|
|
11
9
|
|
|
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)
|
|
10
|
+
# Veryfi Lens for Browser WASM SDK
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
1. Import package `import VeryfiLens from 'veryfi-lens-wasm'`
|
|
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]);
|
|
12
|
+
Veryfi Lens for Web SDK is a framework for your web app to give it document capture superpowers in minutes.
|
|
42
13
|
|
|
43
|
-
|
|
44
|
-
if (veryfiLens) {
|
|
45
|
-
veryfiLens.capture(setImage, setIsEditing)
|
|
46
|
-
} else {
|
|
47
|
-
setError('veryfiLens is not initialized');
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
```
|
|
14
|
+
Lens follows a client-server architecture where the server is for validating your client and getting session key and the client side is for displaying and showing Lens components for capturing documents.
|
|
51
15
|
|
|
52
|
-
# WASM
|
|
53
16
|
**_You can skip first step and copy wasm folder from package directory manually if you want to do so_.**
|
|
54
17
|
|
|
55
18
|
1. run `npm exec veryfi-lens-wasm-setup` and provide it with path to directory where
|
|
@@ -96,11 +59,13 @@ For usual receipt (Next.Js example)
|
|
|
96
59
|
|
|
97
60
|
For Long receipt (Next.Js example)
|
|
98
61
|
Add container with id="preview-container" to see stitching preview
|
|
62
|
+
|
|
99
63
|
```
|
|
100
64
|
<div id="preview-container"
|
|
101
65
|
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
66
|
></div>
|
|
103
67
|
```
|
|
68
|
+
|
|
104
69
|
```
|
|
105
70
|
const [veryfiLens, setVeryfiLens] = useState<{
|
|
106
71
|
startStitching(): void;
|
|
@@ -173,8 +138,10 @@ webpack: (config) => {
|
|
|
173
138
|
```
|
|
174
139
|
|
|
175
140
|
If using Vite and Vue:
|
|
141
|
+
|
|
176
142
|
1. install serve `npm i serve`
|
|
177
143
|
2. Add following to your vite config
|
|
144
|
+
|
|
178
145
|
```
|
|
179
146
|
server: {
|
|
180
147
|
https: {
|
|
@@ -198,7 +165,7 @@ If using Vite and Vue:
|
|
|
198
165
|
}
|
|
199
166
|
```
|
|
200
167
|
|
|
201
|
-
|
|
168
|
+
1. `serve -s dist -p 3000`
|
|
202
169
|
|
|
203
170
|
If using Angular:
|
|
204
171
|
|