@credenza3/scanner-lib 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/README.md +9 -9
- package/dist/scanner.es.js +5 -15
- package/dist/scanner.umd.js +4 -4
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @credenza3/scanner-lib@0.1.
|
|
2
|
+
> @credenza3/scanner-lib@0.1.1 build /home/runner/work/scanner/scanner/packages/scanner-lib
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
Vite command: 'build', mode: 'production'
|
|
@@ -13,8 +13,8 @@ computing gzip size...
|
|
|
13
13
|
[vite:dts] Start rollup declaration files...
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.4.2
|
|
15
15
|
*** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
16
|
-
[vite:dts] Declaration files built in
|
|
16
|
+
[vite:dts] Declaration files built in 3221ms.
|
|
17
17
|
|
|
18
|
-
[2mdist/[22m[36mscanner.es.js [39m[1m[33m718.
|
|
19
|
-
[2mdist/[22m[36mscanner.umd.js [39m[1m[2m371.
|
|
20
|
-
[32m✓ built in
|
|
18
|
+
[2mdist/[22m[36mscanner.es.js [39m[1m[33m718.22 kB[39m[22m[2m │ gzip: 162.62 kB[22m
|
|
19
|
+
[2mdist/[22m[36mscanner.umd.js [39m[1m[2m371.67 kB[22m[1m[22m[2m │ gzip: 112.37 kB[22m
|
|
20
|
+
[32m✓ built in 6.98s[39m
|
package/README.md
CHANGED
|
@@ -48,12 +48,6 @@ const scanner = new Scanner({target: '.scanner-placeholder'}) // query selector
|
|
|
48
48
|
|
|
49
49
|
`Scanner.events` - list of events produced by scanner
|
|
50
50
|
|
|
51
|
-
### Get a list of available video input devices
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
await scanner.listVideoInputDevices()
|
|
55
|
-
```
|
|
56
|
-
|
|
57
51
|
### Scan
|
|
58
52
|
|
|
59
53
|
```
|
|
@@ -61,7 +55,7 @@ scanner.scan({
|
|
|
61
55
|
deviceId?: string,
|
|
62
56
|
isCloseButton?: boolean
|
|
63
57
|
maxScansPerSecond? number // 25
|
|
64
|
-
})
|
|
58
|
+
})
|
|
65
59
|
```
|
|
66
60
|
|
|
67
61
|
### Cancel
|
|
@@ -76,8 +70,14 @@ On capture
|
|
|
76
70
|
|
|
77
71
|
```
|
|
78
72
|
// 'capture'
|
|
79
|
-
scanner.on(Scanner.events.CAPTURE, ({ rawString, message, scanType,
|
|
80
|
-
|
|
73
|
+
scanner.on(Scanner.events.CAPTURE, ({ rawString, message, scanType, sub, format, raw }: { rawString: string, message: string, scanType?: string, sub?: string, format: string, raw?: string }) => {
|
|
74
|
+
|
|
75
|
+
// if format is JSON, then sub, aud, scanType are available
|
|
76
|
+
if (format === 'JSON') {
|
|
77
|
+
console.log('Scan completed', { rawString, message, sub, format, scanType });
|
|
78
|
+
} else { // if format is RAW_TEXT only rawString and raw are available
|
|
79
|
+
console.log('Scan completed', { rawString, format, raw });
|
|
80
|
+
}
|
|
81
81
|
})
|
|
82
82
|
```
|
|
83
83
|
|
package/dist/scanner.es.js
CHANGED
|
@@ -1424,21 +1424,11 @@ const Ws = (x) => {
|
|
|
1424
1424
|
const f = Rr.Buffer.from(x, "base64").toString("utf8"), u = Rr.Buffer.from(f, "binary").toString("base64");
|
|
1425
1425
|
return x === u ? f : x;
|
|
1426
1426
|
}, Hs = async (x) => {
|
|
1427
|
-
const f = Ws(x);
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
...u,
|
|
1433
|
-
format: "JSON"
|
|
1434
|
-
};
|
|
1435
|
-
} catch {
|
|
1436
|
-
return {
|
|
1437
|
-
message: f,
|
|
1438
|
-
raw: x,
|
|
1439
|
-
format: "RAW_TEXT"
|
|
1440
|
-
};
|
|
1441
|
-
}
|
|
1427
|
+
const f = Ws(x), u = JSON.parse(f);
|
|
1428
|
+
return {
|
|
1429
|
+
message: f,
|
|
1430
|
+
...u
|
|
1431
|
+
};
|
|
1442
1432
|
};
|
|
1443
1433
|
var j;
|
|
1444
1434
|
(function(x) {
|