@regulaforensics/document-reader 9.9.1123-beta → 9.9.1134-rc
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/RNDocumentReader.podspec +21 -0
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/app.plugin.js +2 -3
- package/examples/capacitor/package.json +1 -1
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/index.tsx +3 -8
- package/examples/{ionic-cocoapods → ionic}/package-lock.json +2335 -2277
- package/examples/ionic/package.json +31 -22
- package/examples/ionic/tsconfig.json +1 -0
- package/examples/react_native/app.config.ts +2 -1
- package/examples/react_native/package-lock.json +9185 -0
- package/examples/react_native/package.json +17 -12
- package/examples/react_native/vendor/image-size-metro-compat/index.cjs +16 -0
- package/examples/react_native/vendor/image-size-metro-compat/package.json +8 -0
- package/package.json +1 -1
- package/plugin.xml +11 -11
- package/test/package-lock.json +1 -1
- package/Package.swift +0 -27
- package/examples/ionic-cocoapods/README.md +0 -22
- package/examples/ionic-cocoapods/angular.json +0 -39
- package/examples/ionic-cocoapods/assets/.gitkeep +0 -0
- package/examples/ionic-cocoapods/config.xml +0 -63
- package/examples/ionic-cocoapods/images/document.png +0 -0
- package/examples/ionic-cocoapods/images/icon.png +0 -0
- package/examples/ionic-cocoapods/images/portrait.png +0 -0
- package/examples/ionic-cocoapods/index.html +0 -19
- package/examples/ionic-cocoapods/index.tsx +0 -58
- package/examples/ionic-cocoapods/ionic.config.json +0 -7
- package/examples/ionic-cocoapods/package.json +0 -58
- package/examples/ionic-cocoapods/scripts/android.sh +0 -8
- package/examples/ionic-cocoapods/scripts/ios.sh +0 -8
- package/examples/ionic-cocoapods/scripts/setup.sh +0 -8
- package/examples/ionic-cocoapods/src/extra/bt_device.tsx +0 -33
- package/examples/ionic-cocoapods/src/extra/custom_rfid.tsx +0 -61
- package/examples/ionic-cocoapods/src/main.css +0 -148
- package/examples/ionic-cocoapods/src/main.html +0 -38
- package/examples/ionic-cocoapods/src/main.tsx +0 -172
- package/examples/ionic-cocoapods/tsconfig.json +0 -14
- package/react-native-document-reader.podspec +0 -14
- /package/{Sources/document-reader/include/document-reader → ios}/CVDDocumentReader.h +0 -0
- /package/{Sources/document-reader → ios}/CVDDocumentReader.m +0 -0
- /package/{Sources/document-reader/include/document-reader → ios}/RGLWConfig.h +0 -0
- /package/{Sources/document-reader → ios}/RGLWConfig.m +0 -0
- /package/{Sources/document-reader/include/document-reader → ios}/RGLWJSONConstructor.h +0 -0
- /package/{Sources/document-reader → ios}/RGLWJSONConstructor.m +0 -0
- /package/{Sources/document-reader/include/document-reader → ios}/RGLWMain.h +0 -0
- /package/{Sources/document-reader → ios}/RGLWMain.m +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
html,
|
|
2
|
-
body {
|
|
3
|
-
margin: 0;
|
|
4
|
-
width: 100%;
|
|
5
|
-
height: 99vh;
|
|
6
|
-
display: flex;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
}
|
|
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
|
-
.column {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
width: 100%;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.row {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: row;
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.header {
|
|
35
|
-
text-align: center;
|
|
36
|
-
padding-top: 80px;
|
|
37
|
-
margin-top: -10px;
|
|
38
|
-
background-color: rgba(0, 0, 0, 0.03);
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
font-size: 18px;
|
|
41
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.sub-header {
|
|
45
|
-
background-color: rgba(0, 0, 0, 0.03);
|
|
46
|
-
width: 100%;
|
|
47
|
-
padding-top: 13px;
|
|
48
|
-
text-align: center;
|
|
49
|
-
font-weight: 550;
|
|
50
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.divider {
|
|
54
|
-
height: 1px;
|
|
55
|
-
background-color: rgba(0, 0, 0, 0.075);
|
|
56
|
-
margin-top: 13px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.scroll {
|
|
60
|
-
flex-grow: 1;
|
|
61
|
-
overflow-y: auto;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.no-scroll {
|
|
65
|
-
flex-grow: 1;
|
|
66
|
-
overflow-y: hidden;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.button {
|
|
70
|
-
width: 175px;
|
|
71
|
-
height: 40px;
|
|
72
|
-
margin: 5px;
|
|
73
|
-
margin-top: 10px;
|
|
74
|
-
background-color: #4285F4;
|
|
75
|
-
color: white;
|
|
76
|
-
border: none;
|
|
77
|
-
padding: 10px 20px;
|
|
78
|
-
justify-content: center;
|
|
79
|
-
font-size: 16px;
|
|
80
|
-
border-radius: 100px;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
transition: all 0.3s ease;
|
|
83
|
-
user-select: none;
|
|
84
|
-
-webkit-user-select: none;
|
|
85
|
-
-moz-user-select: none;
|
|
86
|
-
-ms-user-select: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.button:active {
|
|
90
|
-
position: relative;
|
|
91
|
-
top: 1px;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.text-button {
|
|
95
|
-
background: none;
|
|
96
|
-
border: none;
|
|
97
|
-
color: #2196f3;
|
|
98
|
-
font-size: 20px;
|
|
99
|
-
font-weight: bold;
|
|
100
|
-
padding: 5px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.text-button:active {
|
|
104
|
-
position: relative;
|
|
105
|
-
top: 1px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.radio {
|
|
109
|
-
align-items: baseline;
|
|
110
|
-
padding: 15px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
input[type="checkbox"] {
|
|
114
|
-
width: 20px;
|
|
115
|
-
height: 20px;
|
|
116
|
-
border: 2px solid black;
|
|
117
|
-
background-color: white;
|
|
118
|
-
display: inline-block;
|
|
119
|
-
position: relative;
|
|
120
|
-
cursor: pointer;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
input[type="text"] {
|
|
124
|
-
width: 173px;
|
|
125
|
-
height: 40px;
|
|
126
|
-
font-size: 15px;
|
|
127
|
-
margin: 5px;
|
|
128
|
-
border-radius: 100px;
|
|
129
|
-
padding-left: 10px;
|
|
130
|
-
padding-right: 10px;
|
|
131
|
-
margin-top: 10px;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.progress-bar {
|
|
135
|
-
width: 75%;
|
|
136
|
-
padding: 3px;
|
|
137
|
-
margin-top: 40px;
|
|
138
|
-
background-color: #eee;
|
|
139
|
-
border-radius: 8px;
|
|
140
|
-
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
#progress {
|
|
144
|
-
width: 0%;
|
|
145
|
-
height: 20px;
|
|
146
|
-
background-color: #4285F4;
|
|
147
|
-
border-radius: 5px;
|
|
148
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<div class="column" style="height: 100%">
|
|
2
|
-
<div class="column header">
|
|
3
|
-
<span id="status">Loading...</span>
|
|
4
|
-
<div class="column divider"></div>
|
|
5
|
-
</div>
|
|
6
|
-
<div id="main" class="column no-scroll">
|
|
7
|
-
<div class="row">
|
|
8
|
-
<div class="column" style="padding: 5px;">
|
|
9
|
-
<p>Portrait</p>
|
|
10
|
-
<img id="portrait-image" src="images/portrait.png" height="160px" width="120px">
|
|
11
|
-
</div>
|
|
12
|
-
<div class="column" style="padding: 5px;">
|
|
13
|
-
<p>Document image</p>
|
|
14
|
-
<img id="document-image" src="images/document.png" height="160px" width="200px">
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
<div id="scenario-container" class="column no-scroll" style="margin-top: 15px; background-color: rgba(0, 0, 0, 0.03);">
|
|
18
|
-
<div id="scenarios" class="scroll"></div>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="row" style="width: 360px; padding-top: 15px;">
|
|
21
|
-
<span id="rfid-checkbox-description" style="font-size: 18px;width: 100%;">Process rfid reading(unavailable)</span>
|
|
22
|
-
<input id="rfid-checkbox" type="checkbox" style="margin-left: auto;" disabled />
|
|
23
|
-
</div>
|
|
24
|
-
<div class="row">
|
|
25
|
-
<button id="scan" class="button">Scan document</button>
|
|
26
|
-
<button id="recognize" class="button">Scan image</button>
|
|
27
|
-
</div>
|
|
28
|
-
<button id="connect" class="button" style="width: 360px; display: none;">Connect</button>
|
|
29
|
-
<div style="padding-top: 20px;"></div>
|
|
30
|
-
</div>
|
|
31
|
-
<div id="custom-rfid" class="column no-scroll" style="display: none;">
|
|
32
|
-
<span id="rfid-description" style="font-size: 22px">Place your phone on top of the NFC tag</span>
|
|
33
|
-
<div class="progress-bar">
|
|
34
|
-
<div id="progress"></div>
|
|
35
|
-
</div>
|
|
36
|
-
<button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario, Results, DocReaderException, DocReaderScenario } from '@regulaforensics/document-reader'
|
|
2
|
-
import { loadAsset, pickImage } from '../index'
|
|
3
|
-
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
4
|
-
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
5
|
-
|
|
6
|
-
var documentReader = DocumentReader.instance
|
|
7
|
-
var selectedScenario = Scenario.MRZ
|
|
8
|
-
var doRfid = false
|
|
9
|
-
var isReadingRfid = false
|
|
10
|
-
|
|
11
|
-
export async function init() {
|
|
12
|
-
if (!await initialize()) return
|
|
13
|
-
setScenarios(documentReader.availableScenarios)
|
|
14
|
-
setCanRfid(await documentReader.isRFIDAvailableForUse())
|
|
15
|
-
setStatus("Ready")
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function scan() {
|
|
19
|
-
if (!await documentReader.isReady()) return
|
|
20
|
-
clearResults()
|
|
21
|
-
documentReader.startScanner(
|
|
22
|
-
ScannerConfig.withScenario(selectedScenario),
|
|
23
|
-
handleCompletion,
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function recognize() {
|
|
28
|
-
if (!await documentReader.isReady()) return
|
|
29
|
-
var image = await pickImage()
|
|
30
|
-
if (image == null) return
|
|
31
|
-
|
|
32
|
-
clearResults()
|
|
33
|
-
documentReader.recognize(
|
|
34
|
-
RecognizeConfig.withScenario(selectedScenario, { image: image }),
|
|
35
|
-
handleCompletion,
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function handleCompletion(action: DocReaderAction, results: Results | null, error: DocReaderException | null) {
|
|
40
|
-
handleException(error)
|
|
41
|
-
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
42
|
-
displayResults(results)
|
|
43
|
-
} else if (DocReaderAction.finished(action) && shouldRfid(results)) {
|
|
44
|
-
isReadingRfid = true
|
|
45
|
-
readRfid()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export async function displayResults(results: Results | null) {
|
|
50
|
-
isReadingRfid = false
|
|
51
|
-
clearResults()
|
|
52
|
-
if (results == null) return
|
|
53
|
-
|
|
54
|
-
var name = await results.textFieldValueByType(FieldType.SURNAME_AND_GIVEN_NAMES)
|
|
55
|
-
var docImage = await results.graphicFieldImageByType(GraphicFieldType.DOCUMENT_IMAGE)
|
|
56
|
-
var portrait = await results.graphicFieldImageByType(GraphicFieldType.PORTRAIT)
|
|
57
|
-
portrait = await results.graphicFieldImageByTypeSource(GraphicFieldType.PORTRAIT, ResultType.RFID_IMAGE_DATA) ?? portrait
|
|
58
|
-
|
|
59
|
-
setStatus(name)
|
|
60
|
-
setPortrait(portrait)
|
|
61
|
-
setDocImage(docImage)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var readRfid = () => {
|
|
65
|
-
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function shouldRfid(results: Results | null) {
|
|
69
|
-
return doRfid &&
|
|
70
|
-
!isReadingRfid &&
|
|
71
|
-
results != null && results.chipPage != 0
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var initialize = async () => {
|
|
75
|
-
setStatus("Initializing...")
|
|
76
|
-
|
|
77
|
-
var license = await loadAsset("regula.license")
|
|
78
|
-
var initConfig = new InitConfig(license)
|
|
79
|
-
initConfig.delayedNNLoad = true
|
|
80
|
-
var [success, error] = await documentReader.initialize(initConfig)
|
|
81
|
-
|
|
82
|
-
handleException(error)
|
|
83
|
-
return success
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function handleException(error: DocReaderException | null) {
|
|
87
|
-
if (error != null) {
|
|
88
|
-
setStatus(error.message)
|
|
89
|
-
console.log(error.code + ": " + error.message)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// --------------------------------------------------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
export function main() {
|
|
96
|
-
documentUIImage = document.getElementById("document-image") as HTMLImageElement
|
|
97
|
-
portraitUIImage = document.getElementById("portrait-image") as HTMLImageElement
|
|
98
|
-
document.getElementById("scan")!.onclick = () => scan()
|
|
99
|
-
document.getElementById("recognize")!.onclick = () => recognize()
|
|
100
|
-
|
|
101
|
-
// custom rfid
|
|
102
|
-
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
103
|
-
|
|
104
|
-
// bt device
|
|
105
|
-
if (!useBtDevice) init()
|
|
106
|
-
else {
|
|
107
|
-
setupBTDevice()
|
|
108
|
-
initialize = initializeWithBTDevice
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function setStatus(data: string | null) {
|
|
113
|
-
if (data != null)
|
|
114
|
-
document.getElementById("status")!.innerHTML = data
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var portraitUIImage: HTMLImageElement
|
|
118
|
-
function setPortrait(data: string | null) {
|
|
119
|
-
if (data != null)
|
|
120
|
-
portraitUIImage.src = "data:image/png;base64," + data
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
var documentUIImage: HTMLImageElement
|
|
124
|
-
function setDocImage(data: string | null) {
|
|
125
|
-
if (data != null)
|
|
126
|
-
documentUIImage.src = "data:image/png;base64," + data
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function clearResults() {
|
|
130
|
-
setStatus("Ready")
|
|
131
|
-
portraitUIImage.src = "images/portrait.png"
|
|
132
|
-
documentUIImage.src = "images/document.png"
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function setCanRfid(data: boolean) {
|
|
136
|
-
var checkbox = document.getElementById('rfid-checkbox') as HTMLInputElement
|
|
137
|
-
var checkboxDescription = document.getElementById("rfid-checkbox-description")!
|
|
138
|
-
if (data) {
|
|
139
|
-
checkbox.disabled = false
|
|
140
|
-
checkboxDescription.innerHTML = "Process rfid reading"
|
|
141
|
-
var onclick = () => {
|
|
142
|
-
doRfid = !doRfid
|
|
143
|
-
checkbox.checked = doRfid
|
|
144
|
-
}
|
|
145
|
-
checkbox.onclick = onclick
|
|
146
|
-
checkboxDescription.onclick = onclick
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function setScenarios(data: DocReaderScenario[]) {
|
|
151
|
-
var scenariosContainer = document.getElementById("scenarios")!
|
|
152
|
-
|
|
153
|
-
data.forEach(scenario => {
|
|
154
|
-
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
155
|
-
var scenarioElement = `<div class="row radio">
|
|
156
|
-
<input type="radio" name="scenario" id="${scenario.name}" value="${scenario.name}" ${checked}>
|
|
157
|
-
<span id="${scenario.name}-caption" style="width: 200px; padding-left: 5px;">${scenario.caption}</span>
|
|
158
|
-
</div>`
|
|
159
|
-
scenariosContainer.insertAdjacentHTML("beforeend", scenarioElement)
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
data.forEach(scenario => {
|
|
163
|
-
var element = document.getElementById(scenario.name) as HTMLInputElement
|
|
164
|
-
var elementCaption = document.getElementById(scenario.name + "-caption")!
|
|
165
|
-
var onclick = () => {
|
|
166
|
-
selectedScenario = scenario.name as Scenario
|
|
167
|
-
element.checked = true
|
|
168
|
-
}
|
|
169
|
-
element.onclick = onclick
|
|
170
|
-
elementCaption.onclick = onclick
|
|
171
|
-
})
|
|
172
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": [
|
|
3
|
-
"*.tsx"
|
|
4
|
-
],
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"types": [],
|
|
7
|
-
"module": "esnext",
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"target": "es2022",
|
|
11
|
-
"jsx": "react-jsx",
|
|
12
|
-
"skipLibCheck": true, // Temp fix for https://github.com/ionic-team/ionic-framework/issues/30650
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Pod::Spec.new do |s|
|
|
2
|
-
s.name = 'react-native-document-reader'
|
|
3
|
-
s.version = '9.9.1123-beta'
|
|
4
|
-
s.summary = 'Regula React Native plugin.'
|
|
5
|
-
s.license = 'commercial'
|
|
6
|
-
s.authors = { 'RegulaForensics' => 'support@regulaforensics.com' }
|
|
7
|
-
s.homepage = 'https://regulaforensics.com'
|
|
8
|
-
s.source = { :path => '.' }
|
|
9
|
-
s.ios.deployment_target = '15.0'
|
|
10
|
-
s.source_files = [ 'ios/**/*.{h,m}', 'Sources/document-reader/**/*.{h,m}' ]
|
|
11
|
-
s.exclude_files = [ 'Sources/document-reader/include/document-reader/CVDDocumentReader.h', 'Sources/document-reader/CVDDocumentReader.m' ]
|
|
12
|
-
s.dependency 'DocumentReader', '9.8.6944'
|
|
13
|
-
s.dependency 'React'
|
|
14
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|