@regulaforensics/document-reader 8.2.204-beta → 8.3.242-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.
Files changed (51) hide show
  1. package/RNDocumentReader.podspec +2 -2
  2. package/android/build.gradle +2 -2
  3. package/android/cordova.gradle +2 -2
  4. package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +3 -1
  5. package/examples/capacitor/README.md +10 -0
  6. package/examples/capacitor/index.html +2 -7
  7. package/examples/capacitor/index.tsx +39 -0
  8. package/examples/capacitor/package.json +3 -3
  9. package/examples/capacitor/scripts/setup.sh +4 -0
  10. package/examples/capacitor/src/extra/bt_device.tsx +7 -6
  11. package/examples/capacitor/src/main.css +4 -1
  12. package/examples/capacitor/src/main.html +1 -4
  13. package/examples/capacitor/src/main.tsx +48 -81
  14. package/examples/cordova/README.md +10 -0
  15. package/examples/cordova/config.xml +3 -0
  16. package/examples/cordova/package-lock.json +459 -1
  17. package/examples/cordova/package.json +5 -4
  18. package/examples/cordova/scripts/bundle.sh +4 -0
  19. package/examples/cordova/www/bootstrap.js +30 -0
  20. package/examples/cordova/www/index.html +1 -1
  21. package/examples/cordova/www/index.js +26 -36
  22. package/examples/cordova/www/src/extra/bt_device.js +7 -6
  23. package/examples/cordova/www/src/main.css +4 -1
  24. package/examples/cordova/www/src/main.html +1 -4
  25. package/examples/cordova/www/src/main.js +48 -77
  26. package/examples/ionic/README.md +10 -0
  27. package/examples/ionic/config.xml +2 -0
  28. package/examples/ionic/index.ts +40 -2
  29. package/examples/ionic/package.json +3 -3
  30. package/examples/ionic/src/extra/bt_device.ts +7 -6
  31. package/examples/ionic/src/main.css +4 -1
  32. package/examples/ionic/src/main.html +1 -4
  33. package/examples/ionic/src/main.ts +48 -87
  34. package/examples/react_native/README.md +10 -0
  35. package/examples/react_native/index.tsx +26 -4
  36. package/examples/react_native/package-lock.json +476 -421
  37. package/examples/react_native/package.json +10 -10
  38. package/examples/react_native/src/extra/bt_device.tsx +7 -6
  39. package/examples/react_native/src/main.css +4 -1
  40. package/examples/react_native/src/main.html +1 -4
  41. package/examples/react_native/src/main.tsx +48 -69
  42. package/ios/RGLWConfig.m +2 -0
  43. package/package.json +1 -1
  44. package/plugin.xml +2 -2
  45. package/www/capacitor/index.js +16 -16
  46. package/www/capacitor/params/process_params/ProcessParams.js +7 -0
  47. package/www/cordova.js +23 -16
  48. package/www/react-native/index.js +16 -16
  49. package/www/react-native/params/process_params/ProcessParams.js +7 -0
  50. package/www/types/index.d.ts +8 -8
  51. package/www/types/params/process_params/ProcessParams.d.ts +4 -0
@@ -5,7 +5,7 @@ source = File.join(__dir__, 'ios')
5
5
 
6
6
  Pod::Spec.new do |s|
7
7
  s.name = 'RNDocumentReader'
8
- s.version = '8.2.204-beta'
8
+ s.version = '8.3.242-beta'
9
9
  s.summary = package['description']
10
10
  s.license = package['license']
11
11
 
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
16
16
  s.ios.deployment_target = '13.0'
17
17
  s.source_files = 'ios/**/*.{h,m}'
18
18
  s.exclude_files = [ 'ios/CVDDocumentReader.h', 'ios/CVDDocumentReader.m' ]
19
- s.dependency 'DocumentReaderStage', '8.2.4879'
19
+ s.dependency 'DocumentReader', '8.2.4934'
20
20
  s.dependency 'React'
21
21
  end
@@ -20,7 +20,7 @@ android {
20
20
  rootProject.allprojects {
21
21
  repositories {
22
22
  maven {
23
- url "https://maven.regulaforensics.com/RegulaDocumentReader/Stage"
23
+ url "https://maven.regulaforensics.com/RegulaDocumentReader"
24
24
  }
25
25
  }
26
26
  }
@@ -29,7 +29,7 @@ dependencies {
29
29
  //noinspection GradleDynamicVersion
30
30
  implementation 'com.facebook.react:react-native:+'
31
31
  //noinspection GradleDependency
32
- implementation('com.regula.documentreader:api:8.2.11640'){
32
+ implementation('com.regula.documentreader:api:8.2.11679'){
33
33
  transitive = true
34
34
  }
35
35
  }
@@ -1,12 +1,12 @@
1
1
  repositories {
2
2
  maven {
3
- url "https://maven.regulaforensics.com/RegulaDocumentReader/Stage"
3
+ url "https://maven.regulaforensics.com/RegulaDocumentReader"
4
4
  }
5
5
  }
6
6
 
7
7
  dependencies {
8
8
  //noinspection GradleDependency
9
- implementation('com.regula.documentreader:api:8.2.11640'){
9
+ implementation('com.regula.documentreader:api:8.2.11679'){
10
10
  transitive = true
11
11
  }
12
12
  }
@@ -137,6 +137,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
137
137
  "generateDTCVC" -> processParams.generateDTCVC = v as Boolean
138
138
  "strictDLCategoryExpiry" -> processParams.strictDLCategoryExpiry = v as Boolean
139
139
  "generateAlpha2Codes" -> processParams.generateAlpha2Codes = v as Boolean
140
+ "disableAuthResolutionFilter" -> processParams.disableAuthResolutionFilter = v as Boolean
140
141
  "measureSystem" -> processParams.measureSystem = v.toInt()
141
142
  "barcodeParserType" -> processParams.barcodeParserType = v.toInt()
142
143
  "perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
@@ -221,6 +222,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
221
222
  "generateDTCVC" to processParams.generateDTCVC,
222
223
  "strictDLCategoryExpiry" to processParams.strictDLCategoryExpiry,
223
224
  "generateAlpha2Codes" to processParams.generateAlpha2Codes,
225
+ "disableAuthResolutionFilter" to processParams.disableAuthResolutionFilter,
224
226
  "measureSystem" to processParams.measureSystem,
225
227
  "barcodeParserType" to processParams.barcodeParserType,
226
228
  "perspectiveAngle" to processParams.perspectiveAngle,
@@ -316,7 +318,7 @@ fun setCustomization(customization: ParamsCustomization, opts: JSONObject) = opt
316
318
  "torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable())
317
319
  "torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable())
318
320
  "livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable())
319
- "multipageButtonImage" -> editor.setMultipageButtonDrawable(v.toDrawable())
321
+ "multipageButtonImage" -> editor.setMultipageButtonImage(v.toDrawable())
320
322
  "helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setHelpAnimationImageScaleType(ImageView.ScaleType.MATRIX)
321
323
  "multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationFrontImageScaleType(ImageView.ScaleType.MATRIX)
322
324
  "multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationBackImageScaleType(ImageView.ScaleType.MATRIX)
@@ -10,3 +10,13 @@
10
10
  * Android: `npm run android`.
11
11
 
12
12
  **Note**: this is just one way of running the app. You can also pass `-o` or `--open` argument to the command, and this will open Xcode/Android Studio, then run the app directly from the IDE. Overall, this is a more consistent way, so if you're having troubles running the app from terminal, try running it from the IDE.
13
+
14
+ ## Additional examples
15
+
16
+ ### Bluetooth device
17
+
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 you device. After running the app, click `Connect`.
19
+
20
+ ### RFID self hosted UI
21
+
22
+ This app also demonstraits how you can implement you own UI for the RFID reading process. To enable it, change the `useRfidSelfHostedUI` constant to true in `src/extra/custom_rfid`. Run the app and initiate RFID reading.
@@ -1,10 +1,5 @@
1
1
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
2
- <script type="module" src="/src/main.tsx"></script>
3
-
4
2
  <div id="content" style="height: 100%"></div>
5
3
 
6
- <script>
7
- fetch("main.html")
8
- .then(response => response.text())
9
- .then(html => document.getElementById("content").innerHTML = html)
10
- </script>
4
+ <script type="module" src="./index.tsx"></script>
5
+ <script type="module" src="/src/main.tsx"></script>
@@ -0,0 +1,39 @@
1
+ import '@ionic/react/css/core.css'
2
+ import '/src/main.css'
3
+ import { setupIonicReact } from '@ionic/react'
4
+ import { StatusBar, Style } from '@capacitor/status-bar'
5
+ import { File } from '@awesome-cordova-plugins/file'
6
+ import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
7
+ import { main } from './src/main'
8
+
9
+ document.addEventListener('deviceready', () => fetch("main.html")
10
+ .then(response => response.text())
11
+ .then(html => document.getElementById("content").innerHTML = html)
12
+ .then(_ => document.dispatchEvent(new Event('ready')))
13
+ )
14
+
15
+ export async function loadAsset(path: string): Promise<string> {
16
+ var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
17
+ var fileEntry = await File.getFile(dir, path, {})
18
+ var result = await new Promise<string>((resolve, _) => {
19
+ fileEntry.file(file => {
20
+ var reader = new FileReader()
21
+ reader.onloadend = (_) => resolve(reader.result as string)
22
+ reader.readAsDataURL(file)
23
+ })
24
+ })
25
+ return result
26
+ }
27
+
28
+ export async function pickImage(): Promise<string | null> {
29
+ return await Camera.getPicture({
30
+ destinationType: DestinationType.DATA_URL,
31
+ mediaType: MediaType.PICTURE,
32
+ sourceType: PictureSourceType.PHOTOLIBRARY
33
+ })
34
+ }
35
+
36
+ document.addEventListener('ready', main)
37
+
38
+ setupIonicReact()
39
+ StatusBar.setStyle({ style: Style.Light })
@@ -6,9 +6,9 @@
6
6
  "android": "scripts/android.sh"
7
7
  },
8
8
  "dependencies": {
9
- "@regulaforensics/document-reader": "8.2.204-beta",
10
- "@regulaforensics/document-reader-core-fullauthrfid": "8.2.8-beta",
11
- "@regulaforensics/document-reader-btdevice": "8.2.8-beta",
9
+ "@regulaforensics/document-reader": "8.3.242-beta",
10
+ "@regulaforensics/document-reader-core-fullauthrfid": "8.3.9-beta",
11
+ "@regulaforensics/document-reader-btdevice": "8.3.10-beta",
12
12
  "@awesome-cordova-plugins/file": "6.6.0",
13
13
  "@awesome-cordova-plugins/camera": "6.6.0",
14
14
  "@awesome-cordova-plugins/dialogs": "6.6.0",
@@ -4,3 +4,7 @@ set -e
4
4
  npm install
5
5
  cd ios/App
6
6
  pod install || pod update
7
+ cd ../../
8
+
9
+ cp public/assets/db.dat ios/App/App/
10
+ cp public/assets/db.dat android/app/src/main/assets/Regula/
@@ -1,26 +1,27 @@
1
1
  import { DocumentReader, InitConfig } from "@regulaforensics/document-reader"
2
- import { handleException, setStatus } from "../main"
2
+ import { handleException, init, setStatus } from "../main"
3
3
 
4
4
  export const useBtDevice = false
5
- const btDeviceName = "Regula 0000"
5
+ export const btDeviceName = "Regula 0000"
6
6
 
7
7
  export function setupBTDevice() {
8
- document.getElementById("bt-device").style.display = "flex"
9
- document.getElementById("connect").onclick = () => connect()
8
+ var connectButton = document.getElementById("connect")
9
+ connectButton.style.display = "flex"
10
+ connectButton.onclick = () => connect()
10
11
  setStatus("Connect to a bluetooth device")
11
12
  }
12
13
 
13
14
  async function connect() {
14
15
  setStatus("Searching for devices...")
15
16
  if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
16
- await initialize()
17
+ await init()
17
18
  DocumentReader.instance.functionality.useAuthenticator = true
18
19
  document.getElementById("bt-device").style.display = "none"
19
20
  } else
20
21
  setStatus("Failed to connect")
21
22
  }
22
23
 
23
- async function initialize() {
24
+ export async function initializeWithBTDevice() {
24
25
  setStatus("Initializing...")
25
26
 
26
27
  var initConfig = InitConfig.withBleDevice()
@@ -1,8 +1,10 @@
1
1
  html,
2
2
  body {
3
- width: 99%;
3
+ margin: 0;
4
+ width: 100%;
4
5
  height: 99vh;
5
6
  display: flex;
7
+ overflow: hidden;
6
8
  flex-direction: column;
7
9
  }
8
10
 
@@ -59,6 +61,7 @@ body {
59
61
  color: white;
60
62
  border: none;
61
63
  padding: 10px 20px;
64
+ justify-content: center;
62
65
  font-size: 16px;
63
66
  border-radius: 100px;
64
67
  cursor: pointer;
@@ -14,10 +14,6 @@
14
14
  <img id="document-image" src="images/document.png" height="160px" width="200px">
15
15
  </div>
16
16
  </div>
17
- <div id="bt-device" class="row" style="display: none;">
18
- <input type="text" placeholder="Regula 0000" />
19
- <button id="connect" class="button">Connect</button>
20
- </div>
21
17
  <div id="scenario-container" class="column no-scroll" style="margin-top: 15px; background-color: rgba(0, 0, 0, 0.03);">
22
18
  <div id="scenarios" class="scroll"></div>
23
19
  </div>
@@ -29,6 +25,7 @@
29
25
  <button id="scan" class="button">Scan document</button>
30
26
  <button id="recognize" class="button">Scan image</button>
31
27
  </div>
28
+ <button id="connect" class="button" style="width: 360px; display: none;">Connect</button>
32
29
  <div style="padding-top: 20px;"></div>
33
30
  </div>
34
31
  <div id="custom-rfid" class="column no-scroll" style="display: none;">
@@ -1,12 +1,6 @@
1
- import '@ionic/react/css/core.css'
2
- import './main.css'
3
- import { setupIonicReact } from '@ionic/react'
4
- import { StatusBar, Style } from '@capacitor/status-bar'
5
- import { File } from '@awesome-cordova-plugins/file'
6
- import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
7
-
8
1
  import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario } from '@regulaforensics/document-reader'
9
- import { setupBTDevice, useBtDevice } from './extra/bt_device'
2
+ import { loadAsset, pickImage } from '../index'
3
+ import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
10
4
  import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
11
5
 
12
6
  var documentReader = DocumentReader.instance
@@ -14,7 +8,7 @@ var selectedScenario
14
8
  var doRfid = false
15
9
  var isReadingRfid = false
16
10
 
17
- async function init() {
11
+ export async function init() {
18
12
  if (!await initialize()) return
19
13
  setScenarios(documentReader.availableScenarios)
20
14
  setCanRfid(await documentReader.isRFIDAvailableForUse())
@@ -77,7 +71,7 @@ function shouldRfid(results) {
77
71
  results != null && results.chipPage != 0
78
72
  }
79
73
 
80
- async function initialize() {
74
+ var initialize = async () => {
81
75
  setStatus("Initializing...")
82
76
 
83
77
  var license = await loadAsset("regula.license")
@@ -95,7 +89,26 @@ export function handleException(error) {
95
89
  }
96
90
  }
97
91
 
98
- // ui --------------------------------------------------------------------------------------------------------------------
92
+ // --------------------------------------------------------------------------------------------------------------------
93
+
94
+ var documentUIImage
95
+ var portraitUIImage
96
+ export function main() {
97
+ documentUIImage = document.getElementById("document-image")
98
+ portraitUIImage = document.getElementById("portrait-image")
99
+ document.getElementById("scan").onclick = () => scan()
100
+ document.getElementById("recognize").onclick = () => recognize()
101
+
102
+ // custom rfid
103
+ if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
104
+
105
+ // bt device
106
+ if (!useBtDevice) init()
107
+ else {
108
+ setupBTDevice()
109
+ initialize = initializeWithBTDevice
110
+ }
111
+ }
99
112
 
100
113
  export function setStatus(data) {
101
114
  if (data != null)
@@ -125,83 +138,37 @@ function setCanRfid(data) {
125
138
  if (data) {
126
139
  checkbox.disabled = false
127
140
  checkboxDescription.innerHTML = "Process rfid reading"
128
- checkboxDescription.onclick = () => {
141
+ var onclick = () => {
129
142
  doRfid = !doRfid
130
143
  checkbox.checked = doRfid
131
144
  }
145
+ checkbox.onclick = onclick
146
+ checkboxDescription.onclick = onclick
132
147
  }
133
148
  }
134
149
 
135
- // not equal --------------------------------------------------------------------------------------------------------------------
136
-
137
- async function loadAsset(path: string): Promise<string> {
138
- var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
139
- var fileEntry = await File.getFile(dir, path, {})
140
- var result = await new Promise<string>((resolve, _) => {
141
- fileEntry.file(file => {
142
- var reader = new FileReader()
143
- reader.onloadend = (_) => resolve(reader.result as string)
144
- reader.readAsDataURL(file)
145
- })
146
- })
147
- return result
148
- }
149
-
150
- async function pickImage(): Promise<string | null> {
151
- return await Camera.getPicture({
152
- destinationType: DestinationType.DATA_URL,
153
- mediaType: MediaType.PICTURE,
154
- sourceType: PictureSourceType.PHOTOLIBRARY
155
- })
156
- }
157
-
158
- var documentUIImage
159
- var portraitUIImage
160
- document.addEventListener('deviceready', () => {
161
- documentUIImage = document.getElementById("document-image")
162
- portraitUIImage = document.getElementById("portrait-image")
163
- document.getElementById("scan").onclick = () => scan()
164
- document.getElementById("recognize").onclick = () => recognize()
165
-
166
- // custom rfid
167
- if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
168
-
169
- // bt device
170
- if (!useBtDevice) init()
171
- else setupBTDevice()
172
- })
173
-
174
- // not resolved --------------------------------------------------------------------------------------------------------------------
175
-
176
150
  function setScenarios(data) {
177
151
  selectedScenario = Scenario.MRZ
178
- const scenariosContainer = document.getElementById("scenarios")
179
- data.forEach(scenario => scenariosContainer.appendChild(createScenarioElement(scenario)))
180
- }
181
-
182
- function createScenarioElement(scenario) {
183
- const div = document.createElement('div')
184
- div.className = 'row radio'
185
-
186
- const input = document.createElement('input')
187
- input.type = 'radio'
188
- input.name = 'scenario'
189
- input.value = scenario.name
190
- input.checked = scenario.name === selectedScenario
191
-
192
- const span = document.createElement('span')
193
- span.style.width = '200px'
194
- span.style.paddingLeft = '5px'
195
- span.textContent = scenario.caption
196
-
197
- input.onclick = () => selectedScenario = scenario.name
198
- span.onclick = () => input.click()
199
-
200
- div.appendChild(input)
201
- div.appendChild(span)
152
+ var scenariosContainer = document.getElementById("scenarios")
153
+
154
+ data.forEach(scenario => {
155
+ var checked = selectedScenario == scenario.name ? "checked" : ""
156
+ var scenarioElement = `<div class="row radio">
157
+ <input type="radio" name="scenario" id="${scenario.name}" value="${scenario.name}" ${checked}>
158
+ <span id="${scenario.name}-caption" style="width: 200px; padding-left: 5px;">${scenario.caption}</span>
159
+ </div>`
160
+ scenariosContainer.insertAdjacentHTML("beforeend", scenarioElement)
161
+ })
202
162
 
203
- return div
163
+ data.forEach(scenario => {
164
+ var element
165
+ element = document.getElementById(scenario.name)
166
+ var elementCaption = document.getElementById(scenario.name + "-caption")
167
+ var onclick = () => {
168
+ selectedScenario = scenario.name
169
+ element.checked = true
170
+ }
171
+ element.onclick = onclick
172
+ elementCaption.onclick = onclick
173
+ })
204
174
  }
205
-
206
- setupIonicReact()
207
- StatusBar.setStyle({ style: Style.Light })
@@ -10,3 +10,13 @@
10
10
  * Android: `npm run android`.
11
11
 
12
12
  **Note**: this is just one way of running the app. You can also pass `-o` or `--open` argument to the command, and this will open Xcode/Android Studio, then run the app directly from the IDE. Overall, this is a more consistent way, so if you're having troubles running the app from terminal, try running it from the IDE.
13
+
14
+ ## Additional examples
15
+
16
+ ### Bluetooth device
17
+
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 you device. After running the app, click `Connect`.
19
+
20
+ ### RFID self hosted UI
21
+
22
+ This app also demonstraits how you can implement you own UI for the RFID reading process. To enable it, change the `useRfidSelfHostedUI` constant to true in `src/extra/custom_rfid`. Run the app and initiate RFID reading.
@@ -1,7 +1,9 @@
1
1
  <widget android-packageName="com.regula.dr.fullauthrfid" ios-CFBundleIdentifier="regula.DocumentReader" version="1.0.0"
2
2
  xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>DocumentReader</name>
4
+ <hook type="before_prepare" src="scripts/bundle.sh" />
4
5
  <platform name="android">
6
+ <resource-file src="www/db.dat" target="app/src/main/assets/Regula/db.dat" />
5
7
  <preference name="orientation" value="portrait" />
6
8
  <preference name="android-minSdkVersion" value="24" />
7
9
  <preference name="android-targetSdkVersion" value="35" />
@@ -15,6 +17,7 @@
15
17
  </edit-config>
16
18
  </platform>
17
19
  <platform name="ios">
20
+ <resource-file src="www/db.dat" />
18
21
  <preference name="orientation" value="portrait" />
19
22
  <preference name="DisallowOverscroll" value="true" />
20
23
  <config-file target="*-Info.plist" parent="NSCameraUsageDescription">