@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.
- package/README.md +2 -8
- package/RNIDV.podspec +2 -2
- package/android/build.gradle +1 -10
- package/android/cordova.gradle +1 -1
- package/examples/capacitor/android/build.gradle +1 -1
- package/examples/capacitor/package-lock.json +3350 -0
- package/examples/capacitor/package.json +7 -7
- package/examples/capacitor/src/main.html +8 -29
- package/examples/capacitor/src/main.tsx +115 -1
- package/examples/ionic/README.md +2 -2
- package/examples/ionic/config.xml +1 -0
- package/examples/ionic/package-lock.json +14261 -0
- package/examples/ionic/package.json +10 -10
- package/examples/ionic/src/main.html +8 -29
- package/examples/ionic/src/main.tsx +115 -1
- package/examples/react_native/README.md +2 -2
- package/examples/react_native/package-lock.json +8996 -0
- package/examples/react_native/package.json +7 -7
- package/examples/react_native/scripts/setup.sh +3 -0
- package/examples/react_native/src/main.html +8 -29
- package/examples/react_native/src/main.tsx +115 -1
- package/ios/CVDIDV.swift +6 -50
- package/ios/RNIDV.swift +4 -52
- package/package.json +1 -1
- package/plugin.xml +5 -4
- package/test/json.tsx +40 -0
- package/test/package-lock.json +1 -1
- package/test/test.tsx +12 -2
- package/www/capacitor/config/api_key_connection_config.js +32 -0
- package/www/capacitor/config/credentials_connection_config.js +32 -0
- package/www/capacitor/config/prepare_workflow_config.js +20 -0
- package/www/capacitor/config/start_workflow_config.js +24 -0
- package/www/capacitor/config/token_connection_config.js +20 -0
- package/www/capacitor/index.js +105 -1
- package/www/capacitor/internal/bridge.js +19 -8
- package/www/capacitor/model/workflow.js +28 -0
- package/www/capacitor/model/workflow_result.js +21 -0
- package/www/capacitor/model/workflow_step.js +19 -0
- package/www/cordova.js +455 -10
- package/www/react-native/config/api_key_connection_config.js +32 -0
- package/www/react-native/config/credentials_connection_config.js +32 -0
- package/www/react-native/config/prepare_workflow_config.js +20 -0
- package/www/react-native/config/start_workflow_config.js +24 -0
- package/www/react-native/config/token_connection_config.js +20 -0
- package/www/react-native/index.js +105 -1
- package/www/react-native/internal/bridge.js +19 -8
- package/www/react-native/model/workflow.js +28 -0
- package/www/react-native/model/workflow_result.js +21 -0
- package/www/react-native/model/workflow_step.js +19 -0
- package/www/types/config/api_key_connection_config.d.ts +6 -0
- package/www/types/config/credentials_connection_config.d.ts +6 -0
- package/www/types/config/prepare_workflow_config.d.ts +3 -0
- package/www/types/config/start_workflow_config.d.ts +4 -0
- package/www/types/config/token_connection_config.d.ts +3 -0
- package/www/types/index.d.ts +50 -0
- package/www/types/model/workflow.d.ts +9 -0
- package/www/types/model/workflow_result.d.ts +8 -0
- package/www/types/model/workflow_step.d.ts +6 -0
- package/ios/FlutterIDVPlugin.swift +0 -72
package/www/capacitor/index.js
CHANGED
|
@@ -1,6 +1,110 @@
|
|
|
1
|
-
import { exec } from './internal/bridge'
|
|
1
|
+
import { exec, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
|
|
2
|
+
|
|
3
|
+
import { TokenConnectionConfig } from './config/token_connection_config'
|
|
4
|
+
import { CredentialsConnectionConfig } from './config/credentials_connection_config'
|
|
5
|
+
import { ApiKeyConnectionConfig } from './config/api_key_connection_config'
|
|
6
|
+
import { PrepareWorkflowConfig } from './config/prepare_workflow_config'
|
|
7
|
+
import { StartWorkflowConfig } from './config/start_workflow_config'
|
|
8
|
+
import { Workflow } from './model/workflow'
|
|
9
|
+
import { WorkflowResult } from './model/workflow_result'
|
|
10
|
+
|
|
11
|
+
export { TokenConnectionConfig }
|
|
12
|
+
export { CredentialsConnectionConfig }
|
|
13
|
+
export { ApiKeyConnectionConfig }
|
|
14
|
+
export { PrepareWorkflowConfig }
|
|
15
|
+
export { StartWorkflowConfig }
|
|
16
|
+
export { Workflow }
|
|
17
|
+
export { WorkflowResult }
|
|
18
|
+
export { WorkflowStep } from './model/workflow_step'
|
|
2
19
|
|
|
3
20
|
export class IDV {
|
|
4
21
|
static get instance() { return IDV._instance }
|
|
5
22
|
static _instance = new IDV()
|
|
23
|
+
|
|
24
|
+
setListener(options) {
|
|
25
|
+
const value = options ?? {}
|
|
26
|
+
setDidStartSessionCompletion(value.didStartSession)
|
|
27
|
+
setDidEndSessionCompletion(value.didEndSession)
|
|
28
|
+
setDidStartRestoreSessionCompletion(value.didStartRestoreSession)
|
|
29
|
+
setDidContinueRemoteSessionCompletion(value.didContinueRemoteSession)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set sessionRestoreMode(val) {
|
|
33
|
+
exec('setSessionRestoreMode', [val])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async getCurrentSessionId() {
|
|
37
|
+
return await exec('getCurrentSessionId', [])
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async initialize() {
|
|
41
|
+
const response = await exec('initialize', [])
|
|
42
|
+
return completionFromResponse(response)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async deinitialize() {
|
|
46
|
+
const response = await exec('deinitialize', [])
|
|
47
|
+
return completionFromResponse(response)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async configureWithToken(config) {
|
|
51
|
+
config = ensureInstance(config, TokenConnectionConfig)
|
|
52
|
+
const response = await exec('configureWithToken', [config?.toJson()])
|
|
53
|
+
return completionFromResponse(response, success => success?.map(item => String(item)))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async configureWithCredentials(config) {
|
|
57
|
+
config = ensureInstance(config, CredentialsConnectionConfig)
|
|
58
|
+
const response = await exec('configureWithCredentials', [config?.toJson()])
|
|
59
|
+
return completionFromResponse(response)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async configureWithApiKey(config) {
|
|
63
|
+
config = ensureInstance(config, ApiKeyConnectionConfig)
|
|
64
|
+
const response = await exec('configureWithApiKey', [config?.toJson()])
|
|
65
|
+
return completionFromResponse(response)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async prepareWorkflow(config) {
|
|
69
|
+
config = ensureInstance(config, PrepareWorkflowConfig)
|
|
70
|
+
const response = await exec('prepareWorkflow', [config?.toJson()])
|
|
71
|
+
return completionFromResponse(response, json => Workflow.fromJson(json))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async startWorkflow(config) {
|
|
75
|
+
config = ensureInstance(config, StartWorkflowConfig)
|
|
76
|
+
const response = await exec('startWorkflow', [config?.toJson()])
|
|
77
|
+
return completionFromResponse(response, json => WorkflowResult.fromJson(json))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async getWorkflows() {
|
|
81
|
+
const response = await exec('getWorkflows', [])
|
|
82
|
+
return completionFromResponse(response, json => {
|
|
83
|
+
const result = []
|
|
84
|
+
if (json != null) for (const item of json) {
|
|
85
|
+
const workflow = Workflow.fromJson(item)
|
|
86
|
+
if (workflow != null) result.push(workflow)
|
|
87
|
+
}
|
|
88
|
+
return result
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const SessionRestoreMode = {
|
|
94
|
+
ENABLED: 0,
|
|
95
|
+
DISABLED: 1,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function completionFromResponse(response, transform) {
|
|
99
|
+
const jsonObject = JSON.parse(response)
|
|
100
|
+
let success = jsonObject['success']
|
|
101
|
+
const error = jsonObject['error']
|
|
102
|
+
if (transform != null && success != null) success = transform(success)
|
|
103
|
+
return [success, error]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function ensureInstance(value, ctor) {
|
|
107
|
+
if (value == null) return null
|
|
108
|
+
if (value instanceof ctor) return value
|
|
109
|
+
return new ctor(value)
|
|
6
110
|
}
|
|
@@ -7,13 +7,24 @@ export async function exec(name, params) {
|
|
|
7
7
|
return RNIDV.exec(name, params)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function setEvent(id, completion, transform) {
|
|
11
11
|
eventManager.removeAllListeners(id)
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
if (transform === undefined) transform = func => func
|
|
13
|
+
if (completion !== undefined) eventManager.addListener(id, transform(completion))
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function setDidStartSessionCompletion(completion) {
|
|
17
|
+
setEvent('didStartSessionEvent', completion)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function setDidEndSessionCompletion(completion) {
|
|
21
|
+
setEvent('didEndSessionEvent', completion)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function setDidStartRestoreSessionCompletion(completion) {
|
|
25
|
+
setEvent('didStartRestoreSessionEvent', completion)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function setDidContinueRemoteSessionCompletion(completion) {
|
|
29
|
+
setEvent('didContinueRemoteSessionEvent', completion)
|
|
19
30
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class Workflow {
|
|
2
|
+
id
|
|
3
|
+
name
|
|
4
|
+
description
|
|
5
|
+
version
|
|
6
|
+
defaultLocale
|
|
7
|
+
|
|
8
|
+
static fromJson(jsonObject) {
|
|
9
|
+
if (jsonObject == null) return null
|
|
10
|
+
const result = new Workflow()
|
|
11
|
+
result.id = jsonObject["id"]
|
|
12
|
+
result.name = jsonObject["name"]
|
|
13
|
+
result.description = jsonObject["description"]
|
|
14
|
+
result.version = jsonObject["version"]
|
|
15
|
+
result.defaultLocale = jsonObject["defaultLocale"]
|
|
16
|
+
return result
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toJson() {
|
|
20
|
+
return {
|
|
21
|
+
"id": this.id,
|
|
22
|
+
"name": this.name,
|
|
23
|
+
"description": this.description,
|
|
24
|
+
"version": this.version,
|
|
25
|
+
"defaultLocale": this.defaultLocale,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkflowStep } from './workflow_step'
|
|
2
|
+
|
|
3
|
+
export class WorkflowResult {
|
|
4
|
+
sessionId
|
|
5
|
+
finalStep
|
|
6
|
+
|
|
7
|
+
static fromJson(jsonObject) {
|
|
8
|
+
if (jsonObject == null) return null
|
|
9
|
+
const result = new WorkflowResult()
|
|
10
|
+
result.sessionId = jsonObject["sessionId"]
|
|
11
|
+
result.finalStep = WorkflowStep.fromJson(jsonObject["finalStep"])
|
|
12
|
+
return result
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
toJson() {
|
|
16
|
+
return {
|
|
17
|
+
"sessionId": this.sessionId,
|
|
18
|
+
"finalStep": this.finalStep?.toJson(),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class WorkflowStep {
|
|
2
|
+
id
|
|
3
|
+
name
|
|
4
|
+
|
|
5
|
+
static fromJson(jsonObject) {
|
|
6
|
+
if (jsonObject == null) return null
|
|
7
|
+
const result = new WorkflowStep()
|
|
8
|
+
result.id = jsonObject["id"]
|
|
9
|
+
result.name = jsonObject["name"]
|
|
10
|
+
return result
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
toJson() {
|
|
14
|
+
return {
|
|
15
|
+
"id": this.id,
|
|
16
|
+
"name": this.name,
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|