@regulaforensics/idv 4.0.169-nightly → 4.0.290-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 (82) hide show
  1. package/Package.swift +27 -0
  2. package/README.md +3 -0
  3. package/android/CDVIDV.kt +5 -3
  4. package/android/build.gradle.kts +41 -0
  5. package/android/cordova.gradle.kts +20 -0
  6. package/android/src/main/{java → kotlin}/com/regula/plugin/idv/RNIDVModule.kt +3 -2
  7. package/app.plugin.js +10 -7
  8. package/examples/capacitor/README.md +4 -2
  9. package/examples/capacitor/android/app/build.gradle +2 -10
  10. package/examples/capacitor/android/build.gradle +12 -3
  11. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  12. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  13. package/examples/capacitor/android/gradle.properties +4 -0
  14. package/examples/capacitor/android/gradlew +4 -7
  15. package/examples/capacitor/android/gradlew.bat +82 -94
  16. package/examples/capacitor/android/variables.gradle +13 -9
  17. package/examples/capacitor/capacitor.config.json +15 -0
  18. package/examples/capacitor/index.tsx +2 -7
  19. package/examples/capacitor/ios/App/App/AppDelegate.swift +5 -40
  20. package/examples/capacitor/ios/App/App/Info.plist +18 -2
  21. package/examples/capacitor/ios/App/App/SceneDelegate.swift +23 -0
  22. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +25 -69
  23. package/examples/capacitor/ios/App/CapApp-SPM/Sources/CapApp-SPM/CapApp-SPM.swift +1 -0
  24. package/examples/capacitor/package-lock.json +392 -1493
  25. package/examples/capacitor/package.json +17 -18
  26. package/examples/capacitor/scripts/android.sh +5 -8
  27. package/examples/capacitor/scripts/ios.sh +5 -7
  28. package/examples/capacitor/scripts/setup.sh +2 -7
  29. package/examples/capacitor/src/main.css +5 -1
  30. package/examples/capacitor/src/main.tsx +51 -29
  31. package/examples/capacitor/vite.config.ts +0 -12
  32. package/examples/ionic/README.md +4 -2
  33. package/examples/ionic/config.xml +1 -1
  34. package/examples/ionic/index.tsx +8 -3
  35. package/examples/ionic/package-lock.json +8732 -7327
  36. package/examples/ionic/package.json +28 -25
  37. package/examples/ionic/scripts/android.sh +1 -3
  38. package/examples/ionic/scripts/ios.sh +3 -3
  39. package/examples/ionic/scripts/setup.sh +0 -2
  40. package/examples/ionic/src/main.tsx +51 -29
  41. package/examples/ionic/tsconfig.json +0 -1
  42. package/examples/react_native/README.md +5 -3
  43. package/examples/react_native/app.config.ts +4 -2
  44. package/examples/react_native/index.tsx +37 -7
  45. package/examples/react_native/metro.config.js +1 -3
  46. package/examples/react_native/package-lock.json +2074 -1328
  47. package/examples/react_native/package.json +19 -20
  48. package/examples/react_native/scripts/android.sh +1 -6
  49. package/examples/react_native/scripts/ios.sh +3 -9
  50. package/examples/react_native/scripts/setup.sh +2 -3
  51. package/examples/react_native/scripts/withoutMetroServer.js +86 -0
  52. package/examples/react_native/src/main.tsx +51 -29
  53. package/ios/CDVIDV.swift +23 -6
  54. package/ios/{Main.swift → Implementation.swift} +4 -4
  55. package/ios/RNIDV.swift +9 -3
  56. package/ios/Utils.swift +2 -0
  57. package/package.json +1 -1
  58. package/plugin.xml +10 -10
  59. package/react-native-idv.podspec +14 -0
  60. package/test/test.tsx +26 -2
  61. package/www/capacitor/index.js +21 -3
  62. package/www/capacitor/internal/bridge.js +2 -1
  63. package/www/capacitor/internal/cordova.js +2 -2
  64. package/www/cordova.js +17 -40
  65. package/www/react-native/index.js +21 -3
  66. package/www/react-native/internal/bridge.js +2 -1
  67. package/www/types/index.d.ts +13 -2
  68. package/RNIDV.podspec +0 -21
  69. package/android/build.gradle +0 -32
  70. package/android/cordova.gradle +0 -20
  71. package/examples/capacitor/android/app/capacitor.build.gradle +0 -19
  72. package/examples/capacitor/android/capacitor.settings.gradle +0 -9
  73. package/examples/capacitor/ionic.config.json +0 -7
  74. package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +0 -19
  75. package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +0 -10
  76. package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  77. package/examples/capacitor/ios/App/Podfile +0 -29
  78. package/examples/capacitor/ios/App/Podfile.lock +0 -52
  79. package/examples/react_native/index.html +0 -12
  80. /package/android/src/main/{java/com/regula/plugin/idv/Main.kt → kotlin/com/regula/plugin/idv/Implementation.kt} +0 -0
  81. /package/android/src/main/{java → kotlin}/com/regula/plugin/idv/JSONConstructor.kt +0 -0
  82. /package/android/src/main/{java → kotlin}/com/regula/plugin/idv/Utils.kt +0 -0
@@ -7,35 +7,38 @@
7
7
  "postinstall": "patch-package"
8
8
  },
9
9
  "dependencies": {
10
- "@regulaforensics/idv": "4.0.169-nightly",
11
- "@regulaforensics/idv-module-document-reader": "4.0.184-nightly",
12
- "@regulaforensics/idv-module-face": "4.0.185-nightly",
13
- "@regulaforensics/document-reader-core-fullauthrfid": "9.8.2742-nightly",
14
- "@regulaforensics/face-core-basic": "8.3.689-nightly",
15
- "@angular-devkit/build-angular": "^22.0.5",
16
- "@angular/cli": "^22.0.5",
17
- "@angular/common": "^22.0.5",
18
- "@angular/compiler-cli": "^22.0.5",
19
- "@angular/core": "^22.0.5",
20
- "@angular/forms": "^22.0.5",
21
- "@angular/platform-browser-dynamic": "^22.0.5",
22
- "@angular/router": "^22.0.5",
23
- "@ionic/angular": "^8.8.13",
24
- "@ionic/cordova-builders": "^12.3.0",
25
- "cordova-android": "^15.0.0",
10
+ "@regulaforensics/idv": "4.0.290-rc",
11
+ "@regulaforensics/idv-module-document-reader": "4.0.438-rc",
12
+ "@regulaforensics/idv-module-face": "4.0.439-rc",
13
+ "@regulaforensics/document-reader-core-fullauthrfid": "9.10.3518-rc",
14
+ "@regulaforensics/face-core-basic": "8.5.909-rc",
15
+ "@angular-devkit/build-angular": "^22.1.8",
16
+ "@angular/cli": "^22.1.8",
17
+ "@angular/common": "^22.1.7",
18
+ "@angular/compiler-cli": "^22.1.7",
19
+ "@angular/core": "^22.1.7",
20
+ "@angular/forms": "^22.1.7",
21
+ "@angular/platform-browser-dynamic": "^22.1.7",
22
+ "@angular/router": "^22.1.7",
23
+ "@ionic/cli": "^7.2.1",
24
+ "@ionic/angular": "^9.0.4",
25
+ "@ionic/cordova-builders": "^13.0.0",
26
+ "cordova": "^13.0.0",
27
+ "cordova-android": "^15.1.0",
26
28
  "cordova-ios": "^8.1.1",
27
29
  "cordova-plugin-ionic-webview": "^5.0.1",
28
- "patch-package": "^8.0.1"
30
+ "native-run": "^2.0.3",
31
+ "patch-package": "^8.0.1",
32
+ "@angular/compiler": "^22.1.7",
33
+ "@angular/platform-browser": "^22.1.7",
34
+ "zone.js": "~0.16.3",
35
+ "typescript": "~6.0.3"
29
36
  },
30
37
  "overrides": {
31
- "@babel/core": "^7.29.0",
32
- "ajv": "^8.18.0",
33
- "esbuild": "^0.28.1",
34
- "http-proxy-middleware": "^3.0.7",
35
- "picomatch": "^4.0.4",
36
- "serialize-javascript": "^7.0.4",
37
- "uuid": "^14.0.0",
38
- "webpack-dev-server": "^5.2.4"
38
+ "serialize-javascript": "^7.1.2",
39
+ "uuid": "^11.1.1",
40
+ "source-map-js": "^1.2.2",
41
+ "shell-quote": "^1.11.0"
39
42
  },
40
43
  "cordova": {
41
44
  "plugins": {
@@ -2,10 +2,8 @@
2
2
  set -e
3
3
 
4
4
  if [[ " $* " == *" --open "* ]] || [[ " $* " == *" -o "* ]]; then
5
- ionic cordova build android
5
+ ionic cordova prepare android
6
6
  open -a 'Android Studio' platforms/android
7
7
  else
8
8
  ionic cordova run android
9
9
  fi
10
-
11
- exit 0
@@ -5,7 +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/IDV.app --device
9
11
  fi
10
-
11
- exit 0
@@ -6,5 +6,3 @@ ionic cordova prepare || {
6
6
  pod repo update
7
7
  ionic cordova prepare
8
8
  }
9
-
10
- exit 0
@@ -3,35 +3,71 @@ import { IDV, Workflow } from '@regulaforensics/idv'
3
3
  enum Configuration { credentials, token, apiKey }
4
4
 
5
5
  const loginType: Configuration = Configuration.credentials
6
- const baseUrl = "https://idv.regula.app"
6
+ const baseUrl = "https://app.idv-platform.com"
7
7
  const username = "username_placeholder"
8
8
  const password = "password_placeholder"
9
9
  const tokenUrl = "token_placeholder"
10
10
  const apiKey = "api_key_placeholder"
11
11
 
12
- var idv = IDV.instance
13
12
  var selectedWorkflow = ""
14
- var workflowIds: string[] = []
13
+
14
+ var idv = IDV.instance
15
+ var workflowFilter: string[] = []
15
16
 
16
17
  async function init() {
18
+ setStatus("Initializing...")
17
19
  var [_, iError] = await idv.initialize()
18
20
  if (handleException(iError, "initialize")) return
19
21
 
20
- var success = ({
22
+ var login = ({
21
23
  [Configuration.credentials]: async () => await configureWithCredentials(),
22
24
  [Configuration.token]: async () => await configureWithToken(),
23
25
  [Configuration.apiKey]: async () => await configureApiKey(),
24
26
  })[loginType]!
25
- if (!await success()) return
27
+ if (!await login()) return
28
+
29
+ if (selectedWorkflow.length > 0) {
30
+ workflowFilter = [] // Reset the filter in case both workflow and filter are specified.
31
+ // Show a list of 1 element just to show the workflow name.
32
+ var workflow = await prepareSelectedWorkflow()
33
+ if (workflow != null) setWorkflows([workflow])
34
+ return
35
+ }
36
+ if (workflowFilter.length > 0) {
37
+ showWorkflowList()
38
+ return
39
+ }
40
+ setStatus("No workflow selected!")
41
+ setDescription("Manually set `selectedWorkflow` to your workflow ID")
42
+ }
26
43
 
27
- var [wfs, error] = await idv.getWorkflows()
44
+ async function showWorkflowList() {
45
+ setStatus("Fetching workflows...")
46
+ let [wfs, error] = await idv.getWorkflows()
28
47
  if (handleException(error, "getWorkflows")) return
29
- if (loginType == Configuration.token) {
30
- wfs = wfs!.filter((wf: any) => workflowIds.includes(wf.id))
48
+ wfs = workflowFilter.flatMap(id => wfs!.filter(wf => wf.id === id))
49
+ if (wfs.length > 0) {
50
+ setWorkflows(wfs)
51
+ return
31
52
  }
53
+ setStatus("Empty workflow list!")
54
+ setDescription("No workflows remain after filtration")
55
+ }
32
56
 
33
- setWorkflows(wfs!)
34
- setStatus("Ready")
57
+ async function prepareSelectedWorkflow() {
58
+ setStatus("Preparing Workflow...")
59
+ const [workflow, prepareError] = await idv.prepareWorkflow({ workflowId: selectedWorkflow })
60
+ handleException(prepareError, "prepareWorkflow")
61
+ return workflow
62
+ }
63
+
64
+ async function startWorkflow(): Promise<void> {
65
+ // If workflow is chosen from the list then it's not prepared yet.
66
+ if (workflowFilter.length > 0 && await prepareSelectedWorkflow() == null) return
67
+ var [result, error] = await idv.startWorkflow()
68
+ if (handleException(error, "startWorkflow")) return
69
+ setStatus("Success")
70
+ setDescription(`SessionID: ${result?.sessionId}`)
35
71
  }
36
72
 
37
73
  async function configureWithCredentials(): Promise<boolean> {
@@ -45,9 +81,10 @@ async function configureWithCredentials(): Promise<boolean> {
45
81
  }
46
82
 
47
83
  async function configureWithToken(): Promise<boolean> {
48
- var [wfIds, error] = await idv.configureWithToken({ url: tokenUrl })
84
+ var [workflowIds, error] = await idv.configureWithToken({ url: tokenUrl })
49
85
  if (handleException(error, "configureWithToken")) return false
50
- workflowIds = wfIds!
86
+ // Filter the IDs to the ones allowed by the token.
87
+ workflowFilter = workflowFilter.filter(wf => workflowIds!.includes(wf))
51
88
  return true
52
89
  }
53
90
 
@@ -57,20 +94,6 @@ async function configureApiKey(): Promise<boolean> {
57
94
  return success
58
95
  }
59
96
 
60
- async function startWorkflow(): Promise<void> {
61
- if (selectedWorkflow.length == 0) return
62
- setStatus("Preparing Workflow...")
63
-
64
- var [_, prepareError] = await idv.prepareWorkflow({ workflowId: selectedWorkflow })
65
- if (handleException(prepareError, "prepareWorkflow")) return
66
-
67
- var [result, error] = await idv.startWorkflow()
68
- if (handleException(error, "startWorkflow")) return
69
-
70
- setStatus("Success")
71
- setDescription(`SessionID: ${result?.sessionId}`)
72
- }
73
-
74
97
  function handleException(error?: string | null, tag?: string): boolean {
75
98
  if (error == null) return false
76
99
  setStatus(`Error - IDV.${tag}()`)
@@ -97,9 +120,8 @@ var workflows: Workflow[] = []
97
120
  function setWorkflows(data: Workflow[]) {
98
121
  var radioGroup = document.getElementById("radio-group")!
99
122
  workflows = data
100
- if (workflows.length != 0) {
101
- selectedWorkflow = workflows[0].id
102
- }
123
+ selectedWorkflow = workflows[0].id
124
+ setStatus("Ready")
103
125
 
104
126
  data.forEach(item => {
105
127
  var checked = selectedWorkflow == item.id ? "checked" : ""
@@ -9,6 +9,5 @@
9
9
  "experimentalDecorators": true,
10
10
  "target": "es2022",
11
11
  "jsx": "react-jsx",
12
- "skipLibCheck": true, // Temp fix for https://github.com/ionic-team/ionic-framework/issues/30650
13
12
  }
14
13
  }
@@ -1,15 +1,17 @@
1
1
  # Regula IDV React Native demo application
2
2
 
3
+ Requires Node.js 22+, Xcode 26+, CocoaPods, Android Studio with JDK 17 and Android SDK 37.
4
+
3
5
  ## How to build demo application
4
6
  1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-idv.git`.
5
7
  2. Put `regula.license` file at `assets/` (you can get a trial license [here](https://client.regulaforensics.com)).
6
8
  3. Put `db.dat` file at `assets/` (you can get a trial database [here](https://client.regulaforensics.com/customer/databases))
7
9
  4. Execute `npm run setup` within this directory.
8
- 5. In `src/main.tsx` choose prefered login configuration(`loginType` variable) and provide your login data according to it: username and password for `credentials`, tokenUrl for `token`, apiKey for `apiKey`.
10
+ 5. In `src/main.tsx` choose prefered login configuration(`loginType` variable) and provide your login data according to it: username and password for `credentials`, tokenUrl for `token`, apiKey for `apiKey`. Then set your workflow ID(`selectedWorkflow` variable).
9
11
  6. Run the app:
10
12
  * IOS: `npm run ios`.
11
13
  * Android: `npm run android`.
12
- 7. After initialization choose **General KYC - AP** from workflows list and click **Start Workflow** button.
14
+ 7. After initialization click the **Start Workflow** button.
13
15
  8. Complete workflow and get your session id.
14
16
 
15
- **Note**: `npm run ios`/`npm run android` 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`).
17
+ **Note**: `npm run ios`/`npm run android` 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.
@@ -36,17 +36,19 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
36
36
  },
37
37
  plugins: [
38
38
  '@regulaforensics/idv',
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' },
45
48
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader/Nightly' },
46
49
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader/Stage' }
47
50
  ]
48
- },
49
- ios: { networkInspector: false }
51
+ }
50
52
  }]
51
53
  ]
52
54
  })
@@ -1,6 +1,8 @@
1
1
  import { registerRootComponent } from 'expo'
2
2
  import WebView from 'react-native-webview'
3
3
  import React from 'react'
4
+ import * as RNFS from 'react-native-fs'
5
+ import { Platform } from 'react-native'
4
6
  import { main } from './src/main'
5
7
 
6
8
  var webViewRef: any
@@ -47,17 +49,45 @@ const document = {
47
49
  }
48
50
 
49
51
  function parseValue(value: any) {
50
- if (value !== true && value !== false) return `"${value}"`
51
- return value
52
+ const json = JSON.stringify(value)
53
+ return typeof value === 'string' ? `(window.webImages[${json}] ?? ${json})` : json
54
+ }
55
+
56
+ async function loadWebUI() {
57
+ const webRoot = Platform.OS === 'ios' ? RNFS.MainBundlePath + '/web/' : 'web/'
58
+ const readWebFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
59
+ const readWebDir = Platform.OS === 'ios' ? RNFS.readDir : RNFS.readDirAssets
60
+ const webImages: Record<string, string> = {}
61
+ const [styles, content] = await Promise.all(['src/main.css', 'src/main.html'].map(path => readWebFile(webRoot + path, 'utf8')))
62
+
63
+ for (const file of (await readWebDir(webRoot + 'images')).filter(file => file.isFile())) {
64
+ const extension = file.name.split('.').pop()!.toLowerCase()
65
+ const type = ({ jpg: 'jpeg', svg: 'svg+xml' } as Record<string, string>)[extension] ?? extension
66
+ webImages['images/' + file.name] = `data:image/${type};base64,${await readWebFile(file.path, 'base64')}`
67
+ }
68
+
69
+ const html = content.replace(/src="([^"]+)"/g, (match, path) => webImages[path] ? `src="${webImages[path]}"` : match)
70
+ return `<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
71
+ <style>${styles}</style>
72
+ <div id="content" style="height: 100%">${html}</div>
73
+ <script>
74
+ window.webImages = ${JSON.stringify(webImages)};
75
+ requestAnimationFrame(() => requestAnimationFrame(() => {
76
+ window.ReactNativeWebView.postMessage(JSON.stringify({ id: "ready" }))
77
+ }))
78
+ </script>`
52
79
  }
53
80
 
54
81
  (globalThis as any).document = document;
55
- registerRootComponent(() =>
56
- <WebView
82
+ registerRootComponent(() => {
83
+ const [html, setHtml] = React.useState('')
84
+ React.useEffect(() => { loadWebUI().then(setHtml).catch(console.error) }, [])
85
+ return html ? <WebView
57
86
  ref={ref => { webViewRef = ref }}
58
87
  onMessage={onMessage}
59
- source={require("./index.html")}
88
+ originWhitelist={['*']}
89
+ source={{ html }}
60
90
  scrollEnabled={false}
61
91
  overScrollMode={'content'}
62
- />
63
- )
92
+ /> : null
93
+ })
@@ -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