@regulaforensics/document-reader 9.9.1223-rc → 9.9.1309-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.
Files changed (56) hide show
  1. package/Package.swift +2 -2
  2. package/android/build.gradle.kts +1 -1
  3. package/android/cordova.gradle.kts +1 -1
  4. package/android/src/main/kotlin/com/regula/plugin/document/reader/Config.kt +2 -0
  5. package/android/src/main/kotlin/com/regula/plugin/document/reader/JSONConstructor.kt +10 -18
  6. package/android/src/main/kotlin/com/regula/plugin/document/reader/Main.kt +14 -4
  7. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +4 -4
  8. package/examples/capacitor/package-lock.json +113 -661
  9. package/examples/capacitor/package.json +6 -5
  10. package/examples/ionic/config.xml +1 -1
  11. package/examples/ionic/package-lock.json +4315 -925
  12. package/examples/ionic/package.json +27 -5
  13. package/examples/ionic/scripts/ios.sh +3 -1
  14. package/examples/react_native/README.md +1 -1
  15. package/examples/react_native/app.config.ts +3 -0
  16. package/examples/react_native/index.tsx +52 -22
  17. package/examples/react_native/metro.config.js +1 -3
  18. package/examples/react_native/package-lock.json +1217 -1579
  19. package/examples/react_native/package.json +20 -19
  20. package/examples/react_native/scripts/android.sh +1 -8
  21. package/examples/react_native/scripts/ios.sh +3 -11
  22. package/examples/react_native/scripts/setup.sh +1 -5
  23. package/examples/react_native/scripts/withoutMetroServer.js +89 -0
  24. package/ios/RGLWConfig.m +2 -0
  25. package/ios/RGLWJSONConstructor.m +1 -0
  26. package/ios/RGLWMain.h +1 -0
  27. package/ios/RGLWMain.m +16 -0
  28. package/ios/RNDocumentReader.m +1 -0
  29. package/package.json +1 -1
  30. package/plugin.xml +3 -3
  31. package/react-native-document-reader.podspec +3 -3
  32. package/test/json.tsx +6 -6
  33. package/test/package-lock.json +2 -5
  34. package/test/test.tsx +259 -261
  35. package/www/capacitor/config/RFIDConfig.js +2 -0
  36. package/www/capacitor/index.js +2 -0
  37. package/www/capacitor/internal/bridge.js +8 -0
  38. package/www/capacitor/params/process_params/AuthenticityPropertiesParams.js +8 -0
  39. package/www/capacitor/results/authenticity/CheckDiagnose.js +2 -0
  40. package/www/capacitor/results/authenticity/SecurityFeatureType.js +1 -0
  41. package/www/capacitor/results/visual_results/FieldType.js +2 -0
  42. package/www/cordova.js +25 -0
  43. package/www/react-native/config/RFIDConfig.js +2 -0
  44. package/www/react-native/index.js +2 -0
  45. package/www/react-native/internal/bridge.js +8 -0
  46. package/www/react-native/params/process_params/AuthenticityPropertiesParams.js +8 -0
  47. package/www/react-native/results/authenticity/CheckDiagnose.js +2 -0
  48. package/www/react-native/results/authenticity/SecurityFeatureType.js +1 -0
  49. package/www/react-native/results/visual_results/FieldType.js +2 -0
  50. package/www/types/config/RFIDConfig.d.ts +15 -0
  51. package/www/types/config/RecognizeConfig.d.ts +2 -2
  52. package/www/types/params/process_params/AuthenticityPropertiesParams.d.ts +2 -0
  53. package/www/types/results/authenticity/CheckDiagnose.d.ts +2 -0
  54. package/www/types/results/authenticity/SecurityFeatureType.d.ts +1 -0
  55. package/www/types/results/visual_results/FieldType.d.ts +2 -0
  56. package/examples/react_native/index.html +0 -12
@@ -15,18 +15,21 @@
15
15
  "@angular/forms": "^22.1.7",
16
16
  "@angular/platform-browser-dynamic": "^22.1.7",
17
17
  "@angular/router": "^22.1.7",
18
+ "@ionic/cli": "^7.2.1",
18
19
  "@ionic/angular": "^9.0.4",
19
20
  "@ionic/cordova-builders": "^13.0.0",
20
21
  "@awesome-cordova-plugins/camera": "^9.6.0",
21
22
  "@awesome-cordova-plugins/file": "^9.6.0",
22
- "@regulaforensics/document-reader": "9.9.1223-rc",
23
- "@regulaforensics/document-reader-core-fullauthrfid": "9.9.3305",
24
- "@regulaforensics/document-reader-btdevice": "9.9.140",
23
+ "@regulaforensics/document-reader": "9.9.1309-rc",
24
+ "@regulaforensics/document-reader-core-fullauthrfid": "9.10.3627",
25
+ "@regulaforensics/document-reader-btdevice": "9.10.200",
26
+ "cordova": "^13.0.0",
25
27
  "cordova-android": "^15.1.0",
26
28
  "cordova-ios": "^8.1.1",
27
29
  "cordova-plugin-camera": "^8.0.0",
28
30
  "cordova-plugin-file": "^8.1.3",
29
31
  "cordova-plugin-ionic-webview": "^5.0.1",
32
+ "native-run": "^2.0.3",
30
33
  "patch-package": "^8.0.1",
31
34
  "@angular/compiler": "^22.1.7",
32
35
  "@angular/platform-browser": "^22.1.7",
@@ -34,8 +37,27 @@
34
37
  "typescript": "~6.0.3"
35
38
  },
36
39
  "overrides": {
37
- "serialize-javascript": "^7.1.1",
38
- "uuid": "^11.1.1"
40
+ "serialize-javascript": "^7.1.2",
41
+ "uuid": "^11.1.1",
42
+ "source-map-js": "^1.2.2",
43
+ "shell-quote": "^1.11.0",
44
+ "glob@^13.0.0": "^14.0.3",
45
+ "minimatch@^10.0.0": "^11.0.4",
46
+ "@ionic/cli": {
47
+ "tar": "^7.5.22"
48
+ },
49
+ "get-uri": {
50
+ "basic-ftp": "^6.2.5"
51
+ },
52
+ "tmp@<0.2.6": "^0.2.7",
53
+ "@regulaforensics/document-reader": {
54
+ "@expo/config-plugins": {
55
+ "glob": "^14.0.3"
56
+ }
57
+ },
58
+ "@ionic/cli-framework": {
59
+ "rimraf": "^6.1.4"
60
+ }
39
61
  },
40
62
  "cordova": {
41
63
  "plugins": {
@@ -5,5 +5,7 @@ if [[ " $* " == *" --open "* ]] || [[ " $* " == *" -o "* ]]; then
5
5
  ionic cordova prepare ios
6
6
  open platforms/ios/App.xcworkspace
7
7
  else
8
- ionic cordova run ios
8
+ ionic cordova build ios --device
9
+ # Use the .app directly to bypass Ionic's outdated IPA path and ZIP extraction.
10
+ native-run ios --app platforms/ios/App.xcarchive/Products/Applications/Document.app --device
9
11
  fi
@@ -11,7 +11,7 @@ Requires Node.js 22+, Xcode 26+, CocoaPods, Android Studio with JDK 17 and Andro
11
11
  * IOS: `npm run ios`.
12
12
  * Android: `npm run android`.
13
13
 
14
- **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. Just don't forget to make sure that Metro Bundler is running(`npm start`).
14
+ **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.
15
15
 
16
16
  ## Additional examples
17
17
 
@@ -36,9 +36,12 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
36
36
  },
37
37
  plugins: [
38
38
  '@regulaforensics/document-reader',
39
+ './scripts/withoutMetroServer',
39
40
  ['expo-custom-assets', { assetsPaths: ['./assets'] }],
40
41
  ['expo-build-properties', {
42
+ ios: { networkInspector: false },
41
43
  android: {
44
+ networkInspector: false,
42
45
  extraMavenRepos: [
43
46
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader' },
44
47
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader/Beta' },
@@ -6,6 +6,23 @@ import { Platform } from 'react-native'
6
6
  import { launchImageLibrary } from 'react-native-image-picker'
7
7
  import { main } from './src/main'
8
8
 
9
+ export async function loadAsset(path: string): Promise<string> {
10
+ if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
11
+ var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
12
+ return await readFile(path, 'base64')
13
+ }
14
+
15
+ export async function pickImage(): Promise<string | null> {
16
+ var response = await launchImageLibrary({
17
+ mediaType: 'photo',
18
+ selectionLimit: 1,
19
+ includeBase64: true
20
+ })
21
+ return response?.assets?.[0].base64!
22
+ }
23
+
24
+ // --------------------------------------------------------------------------------------------------------------------
25
+
9
26
  var webViewRef: any
10
27
  const onclicks: any = {}
11
28
  const onMessage = (json: any) => {
@@ -50,32 +67,45 @@ const document = {
50
67
  }
51
68
 
52
69
  function parseValue(value: any) {
53
- if (value !== true && value !== false) return `"${value}"`
54
- return value
70
+ const json = JSON.stringify(value)
71
+ return typeof value === 'string' ? `(window.webImages[${json}] ?? ${json})` : json
72
+ }
73
+
74
+ async function loadWebUI() {
75
+ const webRoot = Platform.OS === 'ios' ? RNFS.MainBundlePath + '/web/' : 'web/'
76
+ const readWebFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
77
+ const readWebDir = Platform.OS === 'ios' ? RNFS.readDir : RNFS.readDirAssets
78
+ const webImages: Record<string, string> = {}
79
+ const [styles, content] = await Promise.all(['src/main.css', 'src/main.html'].map(path => readWebFile(webRoot + path, 'utf8')))
80
+
81
+ for (const file of (await readWebDir(webRoot + 'images')).filter(file => file.isFile())) {
82
+ const extension = file.name.split('.').pop()!.toLowerCase()
83
+ const type = ({ jpg: 'jpeg', svg: 'svg+xml' } as Record<string, string>)[extension] ?? extension
84
+ webImages['images/' + file.name] = `data:image/${type};base64,${await readWebFile(file.path, 'base64')}`
85
+ }
86
+
87
+ const html = content.replace(/src="([^"]+)"/g, (match, path) => webImages[path] ? `src="${webImages[path]}"` : match)
88
+ return `<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
89
+ <style>${styles}</style>
90
+ <div id="content" style="height: 100%">${html}</div>
91
+ <script>
92
+ window.webImages = ${JSON.stringify(webImages)};
93
+ requestAnimationFrame(() => requestAnimationFrame(() => {
94
+ window.ReactNativeWebView.postMessage(JSON.stringify({ id: "ready" }))
95
+ }))
96
+ </script>`
55
97
  }
56
98
 
57
99
  (globalThis as any).document = document;
58
- registerRootComponent(() =>
59
- <WebView
100
+ registerRootComponent(() => {
101
+ const [html, setHtml] = React.useState('')
102
+ React.useEffect(() => { loadWebUI().then(setHtml).catch(console.error) }, [])
103
+ return html ? <WebView
60
104
  ref={ref => { webViewRef = ref }}
61
105
  onMessage={onMessage}
62
- source={require("./index.html")}
106
+ originWhitelist={['*']}
107
+ source={{ html }}
63
108
  scrollEnabled={false}
64
109
  overScrollMode={'content'}
65
- />
66
- )
67
-
68
- export async function loadAsset(path: string): Promise<string> {
69
- if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
70
- var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
71
- return await readFile(path, 'base64')
72
- }
73
-
74
- export async function pickImage(): Promise<string | null> {
75
- var response = await launchImageLibrary({
76
- mediaType: 'photo',
77
- selectionLimit: 1,
78
- includeBase64: true
79
- })
80
- return response?.assets?.[0].base64!
81
- }
110
+ /> : null
111
+ })
@@ -1,7 +1,5 @@
1
1
  const config = require('expo/metro-config').getDefaultConfig(__dirname)
2
2
  config.watchFolders = [
3
- __dirname + '/node_modules'
4
3
  ]
5
- config.resolver.nodeModulesPaths = config.watchFolders
6
- config.resolver.assetExts.push('css')
4
+ config.resolver.nodeModulesPaths = [__dirname + '/node_modules']
7
5
  module.exports = config