@regulaforensics/document-reader 8.3.242-beta → 8.3.272-beta
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 +2 -3
- package/RNDocumentReader.podspec +1 -1
- package/examples/capacitor/README.md +1 -3
- package/examples/capacitor/ios/App/App/App.entitlements +6 -1
- package/examples/capacitor/ios/App/App/Info.plist +60 -46
- package/examples/capacitor/package.json +3 -3
- package/examples/capacitor/src/extra/bt_device.tsx +2 -2
- package/examples/capacitor/src/extra/custom_rfid.tsx +8 -8
- package/examples/capacitor/src/main.css +14 -1
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +25 -27
- package/examples/ionic/README.md +1 -3
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +27 -3
- package/examples/ionic/package.json +3 -3
- package/examples/ionic/src/extra/{bt_device.ts → bt_device.tsx} +2 -2
- package/examples/ionic/src/extra/{custom_rfid.ts → custom_rfid.tsx} +8 -8
- package/examples/ionic/src/main.css +14 -1
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.ts → main.tsx} +25 -27
- package/examples/ionic/tsconfig.json +3 -2
- package/examples/react_native/README.md +1 -3
- package/examples/react_native/index.tsx +2 -1
- package/examples/react_native/package.json +3 -3
- package/examples/react_native/src/extra/bt_device.tsx +2 -3
- package/examples/react_native/src/extra/custom_rfid.tsx +8 -9
- package/examples/react_native/src/main.css +14 -1
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +25 -28
- package/ios/RGLWMain.m +2 -2
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/test/json.tsx +866 -0
- package/test/package-lock.json +584 -0
- package/test/package.json +12 -0
- package/test/test.tsx +93 -0
- package/test/utils.tsx +34 -0
- package/www/capacitor/config/InitConfig.js +27 -0
- package/www/capacitor/config/RFIDConfig.js +1 -1
- package/www/capacitor/index.js +4 -4
- package/www/capacitor/params/process_params/ProcessParams.js +1 -1
- package/www/capacitor/params/rfid_scenario/RFIDScenario.js +1 -1
- package/www/capacitor/results/DocumentType.js +19 -2
- package/www/cordova.js +60 -16
- package/www/react-native/config/InitConfig.js +27 -0
- package/www/react-native/config/RFIDConfig.js +1 -1
- package/www/react-native/index.js +4 -4
- package/www/react-native/params/process_params/ProcessParams.js +1 -1
- package/www/react-native/params/rfid_scenario/RFIDScenario.js +1 -1
- package/www/react-native/results/DocumentType.js +19 -2
- package/www/types/index.d.ts +6 -6
- package/www/types/params/process_params/ProcessParams.d.ts +1 -1
- package/www/types/params/rfid_scenario/RFIDScenario.d.ts +1 -1
- package/examples/cordova/.vscode/launch.json +0 -28
- package/examples/cordova/.vscode/typings/cordova/cordova.d.ts +0 -80
- package/examples/cordova/README.md +0 -22
- package/examples/cordova/config.xml +0 -33
- package/examples/cordova/package-lock.json +0 -1772
- package/examples/cordova/package.json +0 -33
- package/examples/cordova/scripts/android.sh +0 -8
- package/examples/cordova/scripts/bundle.sh +0 -4
- package/examples/cordova/scripts/ios.sh +0 -8
- package/examples/cordova/scripts/setup.sh +0 -8
- package/examples/cordova/www/bootstrap.js +0 -30
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +0 -6
- package/examples/cordova/www/index.js +0 -30
- package/examples/cordova/www/src/extra/bt_device.js +0 -32
- package/examples/cordova/www/src/extra/custom_rfid.js +0 -60
- package/examples/cordova/www/src/main.css +0 -134
- package/examples/cordova/www/src/main.html +0 -38
- package/examples/cordova/www/src/main.js +0 -173
- package/examples/ionic/src/images/document.png +0 -0
- package/examples/ionic/src/images/portrait.png +0 -0
- /package/examples/ionic/{src/assets → assets}/.gitkeep +0 -0
- /package/examples/{cordova/www → ionic}/images/document.png +0 -0
- /package/examples/ionic/{src/images → images}/icon.png +0 -0
- /package/examples/{cordova/www → ionic}/images/portrait.png +0 -0
- /package/examples/ionic/{index.ts → index.tsx} +0 -0
- /package/www/capacitor/params/rfid_scenario/{DTCDataGroups.js → DTCDataGroup.js} +0 -0
- /package/www/react-native/params/rfid_scenario/{DTCDataGroups.js → DTCDataGroup.js} +0 -0
- /package/www/types/params/rfid_scenario/{DTCDataGroups.d.ts → DTCDataGroup.d.ts} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario } from '@regulaforensics/document-reader'
|
|
1
|
+
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario, Results, DocReaderException, DocReaderScenario } from '@regulaforensics/document-reader'
|
|
2
2
|
import { loadAsset, pickImage } from '../index'
|
|
3
3
|
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
4
4
|
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
5
5
|
|
|
6
6
|
var documentReader = DocumentReader.instance
|
|
7
|
-
var selectedScenario
|
|
7
|
+
var selectedScenario = Scenario.MRZ
|
|
8
8
|
var doRfid = false
|
|
9
9
|
var isReadingRfid = false
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ async function recognize() {
|
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export function handleCompletion(action, results, error) {
|
|
39
|
+
export function handleCompletion(action: DocReaderAction, results: Results | null, error: DocReaderException | null) {
|
|
40
40
|
handleException(error)
|
|
41
41
|
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
42
42
|
displayResults(results)
|
|
@@ -46,7 +46,7 @@ export function handleCompletion(action, results, error) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export async function displayResults(results) {
|
|
49
|
+
export async function displayResults(results: Results | null) {
|
|
50
50
|
isReadingRfid = false
|
|
51
51
|
clearResults()
|
|
52
52
|
if (results == null) return
|
|
@@ -65,7 +65,7 @@ var readRfid = () => {
|
|
|
65
65
|
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function shouldRfid(results) {
|
|
68
|
+
function shouldRfid(results: Results | null) {
|
|
69
69
|
return doRfid &&
|
|
70
70
|
!isReadingRfid &&
|
|
71
71
|
results != null && results.chipPage != 0
|
|
@@ -76,13 +76,14 @@ var initialize = async () => {
|
|
|
76
76
|
|
|
77
77
|
var license = await loadAsset("regula.license")
|
|
78
78
|
var initConfig = new InitConfig(license)
|
|
79
|
+
initConfig.delayedNNLoad = true
|
|
79
80
|
var [success, error] = await documentReader.initialize(initConfig)
|
|
80
81
|
|
|
81
82
|
handleException(error)
|
|
82
83
|
return success
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export function handleException(error) {
|
|
86
|
+
export function handleException(error: DocReaderException | null) {
|
|
86
87
|
if (error != null) {
|
|
87
88
|
setStatus(error.message)
|
|
88
89
|
console.log(error.code + ": " + error.message)
|
|
@@ -91,13 +92,13 @@ export function handleException(error) {
|
|
|
91
92
|
|
|
92
93
|
// --------------------------------------------------------------------------------------------------------------------
|
|
93
94
|
|
|
94
|
-
var documentUIImage
|
|
95
|
-
var portraitUIImage
|
|
95
|
+
var documentUIImage: HTMLImageElement
|
|
96
|
+
var portraitUIImage: HTMLImageElement
|
|
96
97
|
export function main() {
|
|
97
|
-
documentUIImage = document.getElementById("document-image")
|
|
98
|
-
portraitUIImage = document.getElementById("portrait-image")
|
|
99
|
-
document.getElementById("scan")
|
|
100
|
-
document.getElementById("recognize")
|
|
98
|
+
documentUIImage = document.getElementById("document-image") as HTMLImageElement
|
|
99
|
+
portraitUIImage = document.getElementById("portrait-image") as HTMLImageElement
|
|
100
|
+
document.getElementById("scan")!.onclick = () => scan()
|
|
101
|
+
document.getElementById("recognize")!.onclick = () => recognize()
|
|
101
102
|
|
|
102
103
|
// custom rfid
|
|
103
104
|
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
@@ -110,17 +111,17 @@ export function main() {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
export function setStatus(data) {
|
|
114
|
+
export function setStatus(data: string | null) {
|
|
114
115
|
if (data != null)
|
|
115
|
-
document.getElementById("status")
|
|
116
|
+
document.getElementById("status")!.innerHTML = data
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
function setPortrait(data) {
|
|
119
|
+
function setPortrait(data: string | null) {
|
|
119
120
|
if (data != null)
|
|
120
121
|
portraitUIImage.src = "data:image/png;base64," + data
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
function setDocImage(data) {
|
|
124
|
+
function setDocImage(data: string | null) {
|
|
124
125
|
if (data != null)
|
|
125
126
|
documentUIImage.src = "data:image/png;base64," + data
|
|
126
127
|
}
|
|
@@ -131,10 +132,9 @@ function clearResults() {
|
|
|
131
132
|
documentUIImage.src = "images/document.png"
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
function setCanRfid(data) {
|
|
135
|
-
var checkbox
|
|
136
|
-
|
|
137
|
-
var checkboxDescription = document.getElementById("rfid-checkbox-description")
|
|
135
|
+
function setCanRfid(data: boolean) {
|
|
136
|
+
var checkbox = document.getElementById('rfid-checkbox') as HTMLInputElement
|
|
137
|
+
var checkboxDescription = document.getElementById("rfid-checkbox-description")!
|
|
138
138
|
if (data) {
|
|
139
139
|
checkbox.disabled = false
|
|
140
140
|
checkboxDescription.innerHTML = "Process rfid reading"
|
|
@@ -147,9 +147,8 @@ function setCanRfid(data) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
function setScenarios(data) {
|
|
151
|
-
|
|
152
|
-
var scenariosContainer = document.getElementById("scenarios")
|
|
150
|
+
function setScenarios(data: DocReaderScenario[]) {
|
|
151
|
+
var scenariosContainer = document.getElementById("scenarios")!
|
|
153
152
|
|
|
154
153
|
data.forEach(scenario => {
|
|
155
154
|
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
@@ -161,11 +160,10 @@ function setScenarios(data) {
|
|
|
161
160
|
})
|
|
162
161
|
|
|
163
162
|
data.forEach(scenario => {
|
|
164
|
-
var element
|
|
165
|
-
|
|
166
|
-
var elementCaption = document.getElementById(scenario.name + "-caption")
|
|
163
|
+
var element = document.getElementById(scenario.name) as HTMLInputElement
|
|
164
|
+
var elementCaption = document.getElementById(scenario.name + "-caption")!
|
|
167
165
|
var onclick = () => {
|
|
168
|
-
selectedScenario = scenario.name
|
|
166
|
+
selectedScenario = scenario.name as Scenario
|
|
169
167
|
element.checked = true
|
|
170
168
|
}
|
|
171
169
|
element.onclick = onclick
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## How to build demo application
|
|
4
4
|
1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-document-reader.git`.
|
|
5
|
-
|
|
6
5
|
2. Execute `npm run setup` within this directory.
|
|
7
|
-
|
|
8
6
|
3. Run the app:
|
|
9
7
|
* IOS: `npm run ios`.
|
|
10
8
|
* Android: `npm run android`.
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
|
|
16
14
|
### Bluetooth device
|
|
17
15
|
|
|
18
|
-
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of
|
|
16
|
+
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of your device. After running the app, click `Connect`.
|
|
19
17
|
|
|
20
18
|
### RFID self hosted UI
|
|
21
19
|
|
|
@@ -16,7 +16,7 @@ const onMessage = (json: any) => {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const document = {
|
|
20
20
|
getElementById(id: string): any {
|
|
21
21
|
return new Proxy({}, {
|
|
22
22
|
set(_, prop: string, value) {
|
|
@@ -54,6 +54,7 @@ function parseValue(value: any) {
|
|
|
54
54
|
return value
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
(globalThis as any).document = document;
|
|
57
58
|
registerRootComponent(() =>
|
|
58
59
|
<WebView
|
|
59
60
|
ref={ref => { webViewRef = ref }}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"start": "expo start"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/document-reader": "8.3.
|
|
12
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "8.
|
|
13
|
-
"@regulaforensics/document-reader-btdevice": "8.
|
|
11
|
+
"@regulaforensics/document-reader": "8.3.272-beta",
|
|
12
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "8.2.8-beta",
|
|
13
|
+
"@regulaforensics/document-reader-btdevice": "8.2.8-beta",
|
|
14
14
|
"react-native": "0.79.5",
|
|
15
15
|
"react-native-fs": "2.20.0",
|
|
16
16
|
"react-native-image-picker": "8.2.1",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { document } from '../../index'
|
|
2
1
|
import { DocumentReader, InitConfig } from "@regulaforensics/document-reader"
|
|
3
2
|
import { handleException, init, setStatus } from "../main"
|
|
4
3
|
|
|
@@ -6,7 +5,7 @@ export const useBtDevice = false
|
|
|
6
5
|
export const btDeviceName = "Regula 0000"
|
|
7
6
|
|
|
8
7
|
export function setupBTDevice() {
|
|
9
|
-
var connectButton = document.getElementById("connect")
|
|
8
|
+
var connectButton = document.getElementById("connect")!
|
|
10
9
|
connectButton.style.display = "flex"
|
|
11
10
|
connectButton.onclick = () => connect()
|
|
12
11
|
setStatus("Connect to a bluetooth device")
|
|
@@ -17,7 +16,7 @@ async function connect() {
|
|
|
17
16
|
if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
|
|
18
17
|
await init()
|
|
19
18
|
DocumentReader.instance.functionality.useAuthenticator = true
|
|
20
|
-
document.getElementById("
|
|
19
|
+
document.getElementById("connect")!.style.display = "none"
|
|
21
20
|
} else
|
|
22
21
|
setStatus("Failed to connect")
|
|
23
22
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { document } from '../../index'
|
|
2
1
|
import { DocReaderAction, DocumentReader, RFIDConfig, RFIDDataFileType, RFIDNotificationCodes } from "@regulaforensics/document-reader"
|
|
3
2
|
import { displayResults, setStatus } from "../main"
|
|
4
3
|
|
|
@@ -29,7 +28,7 @@ function setup() {
|
|
|
29
28
|
setProgress(-1)
|
|
30
29
|
currentProgress = -1
|
|
31
30
|
setShowing(true)
|
|
32
|
-
document.getElementById("cancel-rfid")
|
|
31
|
+
document.getElementById("cancel-rfid")!.onclick = () => stop()
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
function stop() {
|
|
@@ -38,13 +37,13 @@ function stop() {
|
|
|
38
37
|
setShowing(false)
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
function setDescription(data) {
|
|
42
|
-
document.getElementById("rfid-description")
|
|
40
|
+
function setDescription(data: string) {
|
|
41
|
+
document.getElementById("rfid-description")!.innerHTML = data
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
var currentProgress = -1
|
|
46
|
-
function setProgress(next) {
|
|
47
|
-
var progress = document.getElementById("progress")
|
|
45
|
+
function setProgress(next: number) {
|
|
46
|
+
var progress = document.getElementById("progress")!
|
|
48
47
|
// make progress bar look better
|
|
49
48
|
if (next == 0) return // ignore idle 0s, leave progress at 100 while its not moving
|
|
50
49
|
if (next < currentProgress) next = 0 // move to 0 if progress finaly started moving
|
|
@@ -56,7 +55,7 @@ function setProgress(next) {
|
|
|
56
55
|
currentProgress = next
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
function setShowing(data) {
|
|
60
|
-
document.getElementById("main")
|
|
61
|
-
document.getElementById("custom-rfid")
|
|
58
|
+
function setShowing(data: boolean) {
|
|
59
|
+
document.getElementById("main")!.style.display = data ? "none" : "flex"
|
|
60
|
+
document.getElementById("custom-rfid")!.style.display = data ? "flex" : "none"
|
|
62
61
|
}
|
|
@@ -8,6 +8,19 @@ body {
|
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/* Prevent text selection */
|
|
12
|
+
* {
|
|
13
|
+
user-select: none !important;
|
|
14
|
+
-webkit-user-select: none !important;
|
|
15
|
+
-webkit-user-drag: none !important;
|
|
16
|
+
-webkit-touch-callout: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Prevent image dragging */
|
|
20
|
+
img {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
.column {
|
|
12
25
|
display: flex;
|
|
13
26
|
flex-direction: column;
|
|
@@ -131,4 +144,4 @@ input[type="text"] {
|
|
|
131
144
|
height: 20px;
|
|
132
145
|
background-color: #4285F4;
|
|
133
146
|
border-radius: 5px;
|
|
134
|
-
}
|
|
147
|
+
}
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
<div class="progress-bar">
|
|
34
34
|
<div id="progress"></div>
|
|
35
35
|
</div>
|
|
36
|
-
<button id="cancel-rfid" class="text-button" style="margin-top: 50px;">X</button>
|
|
36
|
+
<button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario } from '@regulaforensics/document-reader'
|
|
1
|
+
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario, Results, DocReaderException, DocReaderScenario } from '@regulaforensics/document-reader'
|
|
3
2
|
import { loadAsset, pickImage } from '../index'
|
|
4
3
|
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
5
4
|
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
6
5
|
|
|
7
6
|
var documentReader = DocumentReader.instance
|
|
8
|
-
var selectedScenario
|
|
7
|
+
var selectedScenario = Scenario.MRZ
|
|
9
8
|
var doRfid = false
|
|
10
9
|
var isReadingRfid = false
|
|
11
10
|
|
|
@@ -37,7 +36,7 @@ async function recognize() {
|
|
|
37
36
|
)
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
export function handleCompletion(action, results, error) {
|
|
39
|
+
export function handleCompletion(action: DocReaderAction, results: Results | null, error: DocReaderException | null) {
|
|
41
40
|
handleException(error)
|
|
42
41
|
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
43
42
|
displayResults(results)
|
|
@@ -47,7 +46,7 @@ export function handleCompletion(action, results, error) {
|
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
export async function displayResults(results) {
|
|
49
|
+
export async function displayResults(results: Results | null) {
|
|
51
50
|
isReadingRfid = false
|
|
52
51
|
clearResults()
|
|
53
52
|
if (results == null) return
|
|
@@ -66,7 +65,7 @@ var readRfid = () => {
|
|
|
66
65
|
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
function shouldRfid(results) {
|
|
68
|
+
function shouldRfid(results: Results | null) {
|
|
70
69
|
return doRfid &&
|
|
71
70
|
!isReadingRfid &&
|
|
72
71
|
results != null && results.chipPage != 0
|
|
@@ -77,13 +76,14 @@ var initialize = async () => {
|
|
|
77
76
|
|
|
78
77
|
var license = await loadAsset("regula.license")
|
|
79
78
|
var initConfig = new InitConfig(license)
|
|
79
|
+
initConfig.delayedNNLoad = true
|
|
80
80
|
var [success, error] = await documentReader.initialize(initConfig)
|
|
81
81
|
|
|
82
82
|
handleException(error)
|
|
83
83
|
return success
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export function handleException(error) {
|
|
86
|
+
export function handleException(error: DocReaderException | null) {
|
|
87
87
|
if (error != null) {
|
|
88
88
|
setStatus(error.message)
|
|
89
89
|
console.log(error.code + ": " + error.message)
|
|
@@ -92,13 +92,13 @@ export function handleException(error) {
|
|
|
92
92
|
|
|
93
93
|
// --------------------------------------------------------------------------------------------------------------------
|
|
94
94
|
|
|
95
|
-
var documentUIImage
|
|
96
|
-
var portraitUIImage
|
|
95
|
+
var documentUIImage: HTMLImageElement
|
|
96
|
+
var portraitUIImage: HTMLImageElement
|
|
97
97
|
export function main() {
|
|
98
|
-
documentUIImage = document.getElementById("document-image")
|
|
99
|
-
portraitUIImage = document.getElementById("portrait-image")
|
|
100
|
-
document.getElementById("scan")
|
|
101
|
-
document.getElementById("recognize")
|
|
98
|
+
documentUIImage = document.getElementById("document-image") as HTMLImageElement
|
|
99
|
+
portraitUIImage = document.getElementById("portrait-image") as HTMLImageElement
|
|
100
|
+
document.getElementById("scan")!.onclick = () => scan()
|
|
101
|
+
document.getElementById("recognize")!.onclick = () => recognize()
|
|
102
102
|
|
|
103
103
|
// custom rfid
|
|
104
104
|
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
@@ -111,17 +111,17 @@ export function main() {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
export function setStatus(data) {
|
|
114
|
+
export function setStatus(data: string | null) {
|
|
115
115
|
if (data != null)
|
|
116
|
-
document.getElementById("status")
|
|
116
|
+
document.getElementById("status")!.innerHTML = data
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
function setPortrait(data) {
|
|
119
|
+
function setPortrait(data: string | null) {
|
|
120
120
|
if (data != null)
|
|
121
121
|
portraitUIImage.src = "data:image/png;base64," + data
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function setDocImage(data) {
|
|
124
|
+
function setDocImage(data: string | null) {
|
|
125
125
|
if (data != null)
|
|
126
126
|
documentUIImage.src = "data:image/png;base64," + data
|
|
127
127
|
}
|
|
@@ -132,10 +132,9 @@ function clearResults() {
|
|
|
132
132
|
documentUIImage.src = "images/document.png"
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function setCanRfid(data) {
|
|
136
|
-
var checkbox
|
|
137
|
-
|
|
138
|
-
var checkboxDescription = document.getElementById("rfid-checkbox-description")
|
|
135
|
+
function setCanRfid(data: boolean) {
|
|
136
|
+
var checkbox = document.getElementById('rfid-checkbox') as HTMLInputElement
|
|
137
|
+
var checkboxDescription = document.getElementById("rfid-checkbox-description")!
|
|
139
138
|
if (data) {
|
|
140
139
|
checkbox.disabled = false
|
|
141
140
|
checkboxDescription.innerHTML = "Process rfid reading"
|
|
@@ -148,9 +147,8 @@ function setCanRfid(data) {
|
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
function setScenarios(data) {
|
|
152
|
-
|
|
153
|
-
var scenariosContainer = document.getElementById("scenarios")
|
|
150
|
+
function setScenarios(data: DocReaderScenario[]) {
|
|
151
|
+
var scenariosContainer = document.getElementById("scenarios")!
|
|
154
152
|
|
|
155
153
|
data.forEach(scenario => {
|
|
156
154
|
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
@@ -162,11 +160,10 @@ function setScenarios(data) {
|
|
|
162
160
|
})
|
|
163
161
|
|
|
164
162
|
data.forEach(scenario => {
|
|
165
|
-
var element
|
|
166
|
-
|
|
167
|
-
var elementCaption = document.getElementById(scenario.name + "-caption")
|
|
163
|
+
var element = document.getElementById(scenario.name) as HTMLInputElement
|
|
164
|
+
var elementCaption = document.getElementById(scenario.name + "-caption")!
|
|
168
165
|
var onclick = () => {
|
|
169
|
-
selectedScenario = scenario.name
|
|
166
|
+
selectedScenario = scenario.name as Scenario
|
|
170
167
|
element.checked = true
|
|
171
168
|
}
|
|
172
169
|
element.onclick = onclick
|
package/ios/RGLWMain.m
CHANGED
|
@@ -339,12 +339,12 @@ RGLWCallback savedCallbackForBluetoothResult;
|
|
|
339
339
|
|
|
340
340
|
// set searching timeout
|
|
341
341
|
if (state == RGLBluetoothConnectionStateSearching)
|
|
342
|
-
[self performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
|
|
342
|
+
[[self class] performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
|
|
343
343
|
|
|
344
344
|
if (state == RGLBluetoothConnectionStateConnected) {
|
|
345
345
|
savedCallbackForBluetoothResult(@YES);
|
|
346
346
|
savedCallbackForBluetoothResult = nil;
|
|
347
|
-
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
|
|
347
|
+
[NSObject cancelPreviousPerformRequestsWithTarget:[self class] selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/document-reader",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.272-beta",
|
|
4
4
|
"description": "This is an npm module for Regula Document Reader SDK. It allows you to read various kinds of identification documents using your phone's camera.",
|
|
5
5
|
"main": "www/react-native/index.js",
|
|
6
6
|
"module": "www/capacitor/index.js",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@regulaforensics/document-reader" version="8.3.
|
|
2
|
+
<plugin id="@regulaforensics/document-reader" version="8.3.272-beta" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>DocumentReader</name>
|
|
4
4
|
<description>Cordova plugin for Regula Document Reader SDK</description>
|
|
5
5
|
<license>commercial</license>
|