@regulaforensics/idv 3.10.230-beta → 3.10.239-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.
@@ -7,11 +7,11 @@
7
7
  "postinstall": "patch-package"
8
8
  },
9
9
  "dependencies": {
10
- "@regulaforensics/idv": "3.10.230-beta",
11
- "@regulaforensics/idv-module-document-reader": "3.10.294-beta",
12
- "@regulaforensics/idv-module-face": "3.10.295-beta",
13
- "@regulaforensics/document-reader-core-fullauthrfid": "9.9.3183-beta",
14
- "@regulaforensics/face-core-basic": "8.4.854-beta",
10
+ "@regulaforensics/idv": "3.10.239-rc",
11
+ "@regulaforensics/idv-module-document-reader": "3.10.288-rc",
12
+ "@regulaforensics/idv-module-face": "3.10.289-rc",
13
+ "@regulaforensics/document-reader-core-fullauthrfid": "9.9.3273-rc",
14
+ "@regulaforensics/face-core-basic": "8.4.877-rc",
15
15
  "@angular-devkit/build-angular": "^22.1.8",
16
16
  "@angular/cli": "^22.1.8",
17
17
  "@angular/common": "^22.1.7",
@@ -9,29 +9,65 @@ 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" : ""
@@ -7,11 +7,11 @@ Requires Node.js 22+, Xcode 26+, CocoaPods, Android Studio with JDK 17 and Andro
7
7
  2. Put `regula.license` file at `assets/` (you can get a trial license [here](https://client.regulaforensics.com)).
8
8
  3. Put `db.dat` file at `assets/` (you can get a trial database [here](https://client.regulaforensics.com/customer/databases))
9
9
  4. Execute `npm run setup` within this directory.
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`.
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).
11
11
  6. Run the app:
12
12
  * IOS: `npm run ios`.
13
13
  * Android: `npm run android`.
14
- 7. After initialization choose **General KYC - AP** from workflows list and click **Start Workflow** button.
14
+ 7. After initialization click the **Start Workflow** button.
15
15
  8. Complete workflow and get your session id.
16
16
 
17
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. Just don't forget to make sure that Metro Bundler is running(`npm start`).