@regulaforensics/idv 3.2.25-beta → 3.2.59-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 (59) hide show
  1. package/README.md +2 -8
  2. package/RNIDV.podspec +2 -2
  3. package/android/build.gradle +1 -10
  4. package/android/cordova.gradle +1 -1
  5. package/examples/capacitor/android/build.gradle +1 -1
  6. package/examples/capacitor/package-lock.json +3350 -0
  7. package/examples/capacitor/package.json +7 -7
  8. package/examples/capacitor/src/main.html +8 -29
  9. package/examples/capacitor/src/main.tsx +115 -1
  10. package/examples/ionic/README.md +2 -2
  11. package/examples/ionic/config.xml +1 -0
  12. package/examples/ionic/package-lock.json +14261 -0
  13. package/examples/ionic/package.json +10 -10
  14. package/examples/ionic/src/main.html +8 -29
  15. package/examples/ionic/src/main.tsx +115 -1
  16. package/examples/react_native/README.md +2 -2
  17. package/examples/react_native/package-lock.json +8996 -0
  18. package/examples/react_native/package.json +7 -7
  19. package/examples/react_native/scripts/setup.sh +3 -0
  20. package/examples/react_native/src/main.html +8 -29
  21. package/examples/react_native/src/main.tsx +115 -1
  22. package/ios/CVDIDV.swift +6 -50
  23. package/ios/RNIDV.swift +4 -52
  24. package/package.json +1 -1
  25. package/plugin.xml +5 -4
  26. package/test/json.tsx +40 -0
  27. package/test/package-lock.json +1 -1
  28. package/test/test.tsx +12 -2
  29. package/www/capacitor/config/api_key_connection_config.js +32 -0
  30. package/www/capacitor/config/credentials_connection_config.js +32 -0
  31. package/www/capacitor/config/prepare_workflow_config.js +20 -0
  32. package/www/capacitor/config/start_workflow_config.js +24 -0
  33. package/www/capacitor/config/token_connection_config.js +20 -0
  34. package/www/capacitor/index.js +105 -1
  35. package/www/capacitor/internal/bridge.js +19 -8
  36. package/www/capacitor/model/workflow.js +28 -0
  37. package/www/capacitor/model/workflow_result.js +21 -0
  38. package/www/capacitor/model/workflow_step.js +19 -0
  39. package/www/cordova.js +455 -10
  40. package/www/react-native/config/api_key_connection_config.js +32 -0
  41. package/www/react-native/config/credentials_connection_config.js +32 -0
  42. package/www/react-native/config/prepare_workflow_config.js +20 -0
  43. package/www/react-native/config/start_workflow_config.js +24 -0
  44. package/www/react-native/config/token_connection_config.js +20 -0
  45. package/www/react-native/index.js +105 -1
  46. package/www/react-native/internal/bridge.js +19 -8
  47. package/www/react-native/model/workflow.js +28 -0
  48. package/www/react-native/model/workflow_result.js +21 -0
  49. package/www/react-native/model/workflow_step.js +19 -0
  50. package/www/types/config/api_key_connection_config.d.ts +6 -0
  51. package/www/types/config/credentials_connection_config.d.ts +6 -0
  52. package/www/types/config/prepare_workflow_config.d.ts +3 -0
  53. package/www/types/config/start_workflow_config.d.ts +4 -0
  54. package/www/types/config/token_connection_config.d.ts +3 -0
  55. package/www/types/index.d.ts +50 -0
  56. package/www/types/model/workflow.d.ts +9 -0
  57. package/www/types/model/workflow_result.d.ts +8 -0
  58. package/www/types/model/workflow_step.d.ts +6 -0
  59. package/ios/FlutterIDVPlugin.swift +0 -72
@@ -6,13 +6,13 @@
6
6
  "android": "scripts/android.sh"
7
7
  },
8
8
  "dependencies": {
9
- "@regulaforensics/idv": "3.2.25-beta",
10
- "@regulaforensics/document-reader": "8.4.316-beta",
11
- "@regulaforensics/face-sdk": "7.3.480-beta",
12
- "@regulaforensics/document-reader-core-fullauthrfid": "8.4.271-beta",
13
- "@regulaforensics/face-core-basic": "7.3.280-beta",
14
- "@regulaforensics/idv-module-document-reader": "3.2.29-beta",
15
- "@regulaforensics/idv-module-face": "3.2.28-beta",
9
+ "@regulaforensics/idv": "3.2.59-beta",
10
+ "@regulaforensics/document-reader": "8.4.341-beta",
11
+ "@regulaforensics/face-sdk": "8.1.506-beta",
12
+ "@regulaforensics/document-reader-core-fullauthrfid": "8.4.325-beta",
13
+ "@regulaforensics/face-core-basic": "7.3.282-beta",
14
+ "@regulaforensics/idv-module-document-reader": "3.2.30-beta",
15
+ "@regulaforensics/idv-module-face": "3.2.31-beta",
16
16
  "@capacitor/cli": "7.0.1",
17
17
  "@capacitor/core": "7.0.1",
18
18
  "@capacitor/app": "7.0.0",
@@ -3,36 +3,15 @@
3
3
  <span id="status">Loading...</span>
4
4
  <div class="column divider"></div>
5
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>
6
+ <div id="sub-header" class="column sub-header" style="display: none;">
7
+ <span id="description"></span>
8
+ <div class="column divider"></div>
30
9
  </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>
10
+ <div id="main" class="column no-scroll">
11
+ <div class="column no-scroll" style="padding-top: 15px; background-color: rgba(0, 0, 0, 0.03);">
12
+ <div id="radio-group" class="scroll"></div>
35
13
  </div>
36
- <button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
14
+ <button id="start-workflow" class="button" style="width: 360px">Start Workflow</button>
15
+ <div style="padding-top: 30px"></div>
37
16
  </div>
38
17
  </div>
@@ -1,10 +1,124 @@
1
- import { IDV } from '@regulaforensics/idv'
1
+ import { IDV, Workflow } from '@regulaforensics/idv'
2
+
3
+ enum Configuration { credentials, token, apiKey }
4
+
5
+ const loginType: Configuration = Configuration.credentials
6
+ const baseUrl = "https://idv.regula.app"
7
+ const username = "username_placeholder"
8
+ const password = "password_placeholder"
9
+ const tokenUrl = "token_placeholder"
10
+ const apiKey = "api_key_placeholder"
2
11
 
3
12
  var idv = IDV.instance
13
+ var selectedWorkflow = ""
14
+ var workflowIds: string[] = []
15
+
16
+ async function init() {
17
+ var [_, iError] = await idv.initialize()
18
+ if (handleException(iError, "initialize")) return
19
+
20
+ var success = ({
21
+ [Configuration.credentials]: async () => await configureWithCredentials(),
22
+ [Configuration.token]: async () => await configureWithToken(),
23
+ [Configuration.apiKey]: async () => await configureApiKey(),
24
+ })[loginType]!
25
+ if (!await success()) return
26
+
27
+ var [wfs, error] = await idv.getWorkflows()
28
+ if (handleException(error, "getWorkflows")) return
29
+ if (loginType == Configuration.token) {
30
+ wfs = wfs!.filter((wf: any) => workflowIds.includes(wf.id))
31
+ }
32
+
33
+ setWorkflows(wfs!)
34
+ setStatus("Ready")
35
+ }
36
+
37
+ async function configureWithCredentials(): Promise<boolean> {
38
+ var [success, error] = await idv.configureWithCredentials({
39
+ baseUrl: baseUrl,
40
+ userName: username,
41
+ password: password
42
+ })
43
+ handleException(error, "configureWithCredentials")
44
+ return success
45
+ }
46
+
47
+ async function configureWithToken(): Promise<boolean> {
48
+ var [wfIds, error] = await idv.configureWithToken({ url: tokenUrl })
49
+ if (handleException(error, "configureWithToken")) return false
50
+ workflowIds = wfIds!
51
+ return true
52
+ }
53
+
54
+ async function configureApiKey(): Promise<boolean> {
55
+ var [success, error] = await idv.configureWithApiKey({ baseUrl, apiKey })
56
+ handleException(error, "configureWithApiKey")
57
+ return success
58
+ }
4
59
 
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
+ function handleException(error?: string, tag?: string): boolean {
75
+ if (error == null) return false
76
+ setStatus(`Error - IDV.${tag}()`)
77
+ setDescription(error)
78
+ console.error(error)
79
+ return true
80
+ }
5
81
 
6
82
  // --------------------------------------------------------------------------------------------------------------------
7
83
 
8
84
  export function main() {
85
+ document.getElementById("start-workflow")!.onclick = () => startWorkflow()
86
+
87
+ init()
88
+ }
89
+
90
+ var setStatus = (data: string) => document.getElementById("status")!.innerHTML = data
91
+ var setDescription = (data: string) => {
92
+ document.getElementById("description")!.innerHTML = data
93
+ document.getElementById("sub-header")!.style.display = data.length > 0 ? "block" : "none"
94
+ }
95
+
96
+ var workflows: Workflow[] = []
97
+ function setWorkflows(data: Workflow[]) {
98
+ var radioGroup = document.getElementById("radio-group")!
99
+ workflows = data
100
+ if (workflows.length != 0) {
101
+ selectedWorkflow = workflows[0].id
102
+ }
103
+
104
+ data.forEach(item => {
105
+ var checked = selectedWorkflow == item.id ? "checked" : ""
106
+ var radioElement = `
107
+ <div class="row radio">
108
+ <input type="radio" name="radio" id="${item.id}" value="${item.id}" ${checked}>
109
+ <span id="${item.id}-caption" style="width: 200px; padding-left: 5px;">${item.name}</span>
110
+ </div>`
111
+ radioGroup.insertAdjacentHTML("beforeend", radioElement)
112
+ })
9
113
 
114
+ data.forEach(item => {
115
+ var element = document.getElementById(item.id) as HTMLInputElement
116
+ var elementCaption = document.getElementById(item.id + "-caption")!
117
+ var onclick = () => {
118
+ selectedWorkflow = item.id
119
+ element.checked = true
120
+ }
121
+ element.onclick = onclick
122
+ elementCaption.onclick = onclick
123
+ })
10
124
  }
@@ -2,8 +2,8 @@
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-idv.git`.
5
- 2. Put `regula.license` file at `public/assets/` (you can get a trial license [here](https://client.regulaforensics.com)).
6
- 3. Put `db.dat` file at `public/assets/` (you can get a trial database [here](https://client.regulaforensics.com/customer/databases))
5
+ 2. Put `regula.license` file at `assets/` (you can get a trial license [here](https://client.regulaforensics.com)).
6
+ 3. Put `db.dat` file at `assets/` (you can get a trial database [here](https://client.regulaforensics.com/customer/databases))
7
7
  4. Execute `npm run setup` within this directory.
8
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`.
9
9
  6. Run the app:
@@ -11,6 +11,7 @@
11
11
  <preference name="android-minSdkVersion" value="24" />
12
12
  <preference name="android-targetSdkVersion" value="36" />
13
13
  <preference name="GradlePluginKotlinEnabled" value="true" />
14
+ <preference name="GradlePluginKotlinVersion" value="2.1.20" />
14
15
  <config-file parent="/*" target="AndroidManifest.xml">
15
16
  <uses-permission android:name="android.permission.NFC" />
16
17
  </config-file>