@regulaforensics/idv 3.2.26-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 +4 -4
- 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 +7 -7
- 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 +4 -4
- 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
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"start": "expo start"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/idv": "3.2.
|
|
12
|
-
"@regulaforensics/document-reader": "8.4.
|
|
13
|
-
"@regulaforensics/face-sdk": "
|
|
14
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "8.4.
|
|
11
|
+
"@regulaforensics/idv": "3.2.59-beta",
|
|
12
|
+
"@regulaforensics/document-reader": "8.4.341-beta",
|
|
13
|
+
"@regulaforensics/face-sdk": "8.1.506-beta",
|
|
14
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "8.4.325-beta",
|
|
15
15
|
"@regulaforensics/face-core-basic": "7.3.282-beta",
|
|
16
16
|
"@regulaforensics/idv-module-document-reader": "3.2.30-beta",
|
|
17
17
|
"@regulaforensics/idv-module-face": "3.2.31-beta",
|
|
@@ -7,3 +7,6 @@ expo prebuild
|
|
|
7
7
|
mkdir -p android/app/src/main/assets/Regula
|
|
8
8
|
mv android/app/src/main/res/raw/regula.license android/app/src/main/assets/Regula/
|
|
9
9
|
mv android/app/src/main/res/raw/db.dat android/app/src/main/assets/Regula/
|
|
10
|
+
|
|
11
|
+
sed -i '' '$a\
|
|
12
|
+
android { buildFeatures { dataBinding true } }' android/app/build.gradle
|
|
@@ -3,36 +3,15 @@
|
|
|
3
3
|
<span id="status">Loading...</span>
|
|
4
4
|
<div class="column divider"></div>
|
|
5
5
|
</div>
|
|
6
|
-
<div id="
|
|
7
|
-
<
|
|
8
|
-
|
|
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="
|
|
32
|
-
<
|
|
33
|
-
|
|
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="
|
|
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
|
}
|
package/ios/CVDIDV.swift
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
let channelID = "flutter_idv"
|
|
5
|
-
var eventSinks: [String: FlutterEventSink] = [:]
|
|
6
|
-
|
|
7
|
-
private var args: [Any?] = []
|
|
1
|
+
var eventCallbackIds: [String: String] = [:]
|
|
8
2
|
|
|
9
3
|
func sendEvent(_ event: String, _ data: Any? = nil) {
|
|
10
|
-
|
|
11
|
-
if let sink = eventSinks[event] {
|
|
12
|
-
sink(data.toSendable())
|
|
13
|
-
}
|
|
14
|
-
}
|
|
4
|
+
|
|
15
5
|
}
|
|
16
6
|
|
|
17
7
|
func args<T>(_ index: Int) -> T {
|
|
18
|
-
return
|
|
8
|
+
return index as! T
|
|
19
9
|
}
|
|
20
10
|
|
|
21
11
|
func argsNullable<T>(_ index: Int) -> T? {
|
|
22
|
-
|
|
23
|
-
return args[index] as! T?
|
|
12
|
+
return nil
|
|
24
13
|
}
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
func setupEventChannel(_ eventId: String) {
|
|
29
|
-
let channel = FlutterEventChannel(name: "\(channelID)/event/\(eventId)", binaryMessenger: registrar.messenger())
|
|
30
|
-
channel.setStreamHandler(GenericStreamHandler(eventId))
|
|
31
|
-
}
|
|
32
|
-
setupEventChannel(didStartSessionEvent);
|
|
33
|
-
setupEventChannel(didEndSessionEvent);
|
|
34
|
-
setupEventChannel(didStartRestoreSessionEvent);
|
|
35
|
-
setupEventChannel(didContinueRemoteSessionEvent);
|
|
15
|
+
class CVDIDV: CDVPlugin {
|
|
16
|
+
func exec(_ command: CDVInvokedUrlCommand) {
|
|
36
17
|
|
|
37
|
-
let channel = FlutterMethodChannel(name: "\(channelID)/method", binaryMessenger: registrar.messenger())
|
|
38
|
-
registrar.addMethodCallDelegate(FlutterIDVPlugin(), channel: channel)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
42
|
-
args = call.arguments as! [Any?]
|
|
43
|
-
methodCall(call.method, { data in result(data.toSendable()) })
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
class GenericStreamHandler: NSObject, FlutterStreamHandler {
|
|
48
|
-
private let eventId: String
|
|
49
|
-
|
|
50
|
-
public init(_ eventId: String) {
|
|
51
|
-
self.eventId = eventId
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public func onListen(withArguments arguments: Any?, eventSink: @escaping FlutterEventSink) -> FlutterError? {
|
|
55
|
-
eventSinks[eventId] = eventSink
|
|
56
|
-
return nil
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public func onCancel(withArguments arguments: Any?) -> FlutterError? {
|
|
60
|
-
eventSinks[eventId] = nil
|
|
61
|
-
return nil
|
|
62
18
|
}
|
|
63
19
|
}
|
|
64
20
|
|
package/ios/RNIDV.swift
CHANGED
|
@@ -1,65 +1,17 @@
|
|
|
1
|
-
import Flutter
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
let channelID = "flutter_idv"
|
|
5
|
-
var eventSinks: [String: FlutterEventSink] = [:]
|
|
6
|
-
|
|
7
|
-
private var args: [Any?] = []
|
|
8
|
-
|
|
9
1
|
func sendEvent(_ event: String, _ data: Any? = nil) {
|
|
10
|
-
|
|
11
|
-
if let sink = eventSinks[event] {
|
|
12
|
-
sink(data.toSendable())
|
|
13
|
-
}
|
|
14
|
-
}
|
|
2
|
+
|
|
15
3
|
}
|
|
16
4
|
|
|
17
5
|
func args<T>(_ index: Int) -> T {
|
|
18
|
-
return
|
|
6
|
+
return index as! T
|
|
19
7
|
}
|
|
20
8
|
|
|
21
9
|
func argsNullable<T>(_ index: Int) -> T? {
|
|
22
|
-
|
|
23
|
-
return args[index] as! T?
|
|
10
|
+
return nil
|
|
24
11
|
}
|
|
25
12
|
|
|
26
|
-
public class
|
|
27
|
-
public static func register(with registrar: FlutterPluginRegistrar) {
|
|
28
|
-
func setupEventChannel(_ eventId: String) {
|
|
29
|
-
let channel = FlutterEventChannel(name: "\(channelID)/event/\(eventId)", binaryMessenger: registrar.messenger())
|
|
30
|
-
channel.setStreamHandler(GenericStreamHandler(eventId))
|
|
31
|
-
}
|
|
32
|
-
setupEventChannel(didStartSessionEvent);
|
|
33
|
-
setupEventChannel(didEndSessionEvent);
|
|
34
|
-
setupEventChannel(didStartRestoreSessionEvent);
|
|
35
|
-
setupEventChannel(didContinueRemoteSessionEvent);
|
|
36
|
-
|
|
37
|
-
let channel = FlutterMethodChannel(name: "\(channelID)/method", binaryMessenger: registrar.messenger())
|
|
38
|
-
registrar.addMethodCallDelegate(FlutterIDVPlugin(), channel: channel)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
42
|
-
args = call.arguments as! [Any?]
|
|
43
|
-
methodCall(call.method, { data in result(data.toSendable()) })
|
|
44
|
-
}
|
|
45
|
-
}
|
|
13
|
+
public class RNIDVPlugin: NSObject {
|
|
46
14
|
|
|
47
|
-
class GenericStreamHandler: NSObject, FlutterStreamHandler {
|
|
48
|
-
private let eventId: String
|
|
49
|
-
|
|
50
|
-
public init(_ eventId: String) {
|
|
51
|
-
self.eventId = eventId
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public func onListen(withArguments arguments: Any?, eventSink: @escaping FlutterEventSink) -> FlutterError? {
|
|
55
|
-
eventSinks[eventId] = eventSink
|
|
56
|
-
return nil
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public func onCancel(withArguments arguments: Any?) -> FlutterError? {
|
|
60
|
-
eventSinks[eventId] = nil
|
|
61
|
-
return nil
|
|
62
|
-
}
|
|
63
15
|
}
|
|
64
16
|
|
|
65
17
|
let rootViewController: () -> UIViewController? = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/idv",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.59-beta",
|
|
4
4
|
"description": "This is an npm module for Regula IDV, which unifies access to all Regula products. This plugin makes possible to use it with react-native, cordova and capacitor applications. Supports Android and iOS.",
|
|
5
5
|
"main": "www/react-native/index.js",
|
|
6
6
|
"module": "www/capacitor/index.js",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@regulaforensics/idv" version="3.2.
|
|
2
|
+
<plugin id="@regulaforensics/idv" version="3.2.59-beta" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>IDV</name>
|
|
4
4
|
<description>Cordova plugin for Regula IDV</description>
|
|
5
5
|
<license>commercial</license>
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
<param name="ios-package" value="CVDIDV" />
|
|
16
16
|
</feature>
|
|
17
17
|
<preference name="deployment-target" value="14.0" />
|
|
18
|
+
<preference name="SwiftVersion" value="5" />
|
|
18
19
|
</config-file>
|
|
19
|
-
<
|
|
20
|
+
<source-file src="ios/CVDIDV.swift" />
|
|
20
21
|
<source-file src="ios/Main.swift" />
|
|
21
|
-
<
|
|
22
|
-
<
|
|
22
|
+
<source-file src="ios/JSONConstructor.swift" />
|
|
23
|
+
<source-file src="ios/Utils.swift" />
|
|
23
24
|
<podspec>
|
|
24
25
|
<config>
|
|
25
26
|
<source url="https://github.com/CocoaPods/Specs.git" />
|
package/test/json.tsx
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export var credentialsConnectionConfig = {
|
|
2
|
+
"baseUrl": "test3",
|
|
3
|
+
"userName": "test1",
|
|
4
|
+
"password": "test2",
|
|
5
|
+
"httpTimeoutMs": 1,
|
|
6
|
+
}
|
|
7
|
+
export var tokenConnectionConfig = {
|
|
8
|
+
"url": "test1",
|
|
9
|
+
}
|
|
10
|
+
export var apiKeyConnectionConfig = {
|
|
11
|
+
"baseUrl": "test1",
|
|
12
|
+
"apiKey": "test2",
|
|
13
|
+
"ttl": 1,
|
|
14
|
+
"httpTimeoutMs": 2,
|
|
15
|
+
}
|
|
16
|
+
export var prepareWorkflowConfig = {
|
|
17
|
+
"workflowId": "test1",
|
|
18
|
+
}
|
|
19
|
+
export var startWorkflowConfig = {
|
|
20
|
+
"locale": "test1",
|
|
21
|
+
"metadata": {
|
|
22
|
+
"test2": "test3",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export var workflow = {
|
|
27
|
+
"id": "test1",
|
|
28
|
+
"name": "test2",
|
|
29
|
+
"version": "test3",
|
|
30
|
+
"description": "test4",
|
|
31
|
+
"defaultLocale": "test5",
|
|
32
|
+
}
|
|
33
|
+
export var workflowStep = {
|
|
34
|
+
"id": "test1",
|
|
35
|
+
"name": "test2",
|
|
36
|
+
}
|
|
37
|
+
export var workflowResult = {
|
|
38
|
+
"sessionId": "test1",
|
|
39
|
+
"finalStep": workflowStep,
|
|
40
|
+
}
|
package/test/package-lock.json
CHANGED
package/test/test.tsx
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { compare } from './utils'
|
|
2
|
-
import { } from '@regulaforensics/idv'
|
|
3
|
-
import { } from './json'
|
|
2
|
+
import { CredentialsConnectionConfig, TokenConnectionConfig, ApiKeyConnectionConfig, PrepareWorkflowConfig, StartWorkflowConfig, Workflow, WorkflowStep, WorkflowResult } from '@regulaforensics/idv/www/capacitor'
|
|
3
|
+
import { apiKeyConnectionConfig, credentialsConnectionConfig, prepareWorkflowConfig, startWorkflowConfig, tokenConnectionConfig, workflow, workflowStep, workflowResult } from './json'
|
|
4
|
+
|
|
5
|
+
compare('credentialsConnectionConfig', credentialsConnectionConfig, CredentialsConnectionConfig.fromJson)
|
|
6
|
+
compare('tokenConnectionConfig', tokenConnectionConfig, TokenConnectionConfig.fromJson)
|
|
7
|
+
compare('apiKeyConnectionConfig', apiKeyConnectionConfig, ApiKeyConnectionConfig.fromJson)
|
|
8
|
+
compare('prepareWorkflowConfig', prepareWorkflowConfig, PrepareWorkflowConfig.fromJson)
|
|
9
|
+
compare('startWorkflowConfig', startWorkflowConfig, StartWorkflowConfig.fromJson)
|
|
10
|
+
|
|
11
|
+
compare('workflow', workflow, Workflow.fromJson);
|
|
12
|
+
compare('workflowStep', workflowStep, WorkflowStep.fromJson);
|
|
13
|
+
compare('workflowResult', workflowResult, WorkflowResult.fromJson);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ApiKeyConnectionConfig {
|
|
2
|
+
baseUrl
|
|
3
|
+
apiKey
|
|
4
|
+
ttl
|
|
5
|
+
httpTimeoutMs
|
|
6
|
+
|
|
7
|
+
constructor(params) {
|
|
8
|
+
this.baseUrl = params?.baseUrl
|
|
9
|
+
this.apiKey = params?.apiKey
|
|
10
|
+
this.ttl = params?.ttl
|
|
11
|
+
this.httpTimeoutMs = params?.httpTimeoutMs
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static fromJson(jsonObject) {
|
|
15
|
+
if (jsonObject == null) return null
|
|
16
|
+
const result = new ApiKeyConnectionConfig()
|
|
17
|
+
result.baseUrl = jsonObject["baseUrl"]
|
|
18
|
+
result.apiKey = jsonObject["apiKey"]
|
|
19
|
+
result.ttl = jsonObject["ttl"]
|
|
20
|
+
result.httpTimeoutMs = jsonObject["httpTimeoutMs"]
|
|
21
|
+
return result
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
toJson() {
|
|
25
|
+
return {
|
|
26
|
+
"baseUrl": this.baseUrl,
|
|
27
|
+
"apiKey": this.apiKey,
|
|
28
|
+
"ttl": this.ttl,
|
|
29
|
+
"httpTimeoutMs": this.httpTimeoutMs,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class CredentialsConnectionConfig {
|
|
2
|
+
baseUrl
|
|
3
|
+
userName
|
|
4
|
+
password
|
|
5
|
+
httpTimeoutMs
|
|
6
|
+
|
|
7
|
+
constructor(params) {
|
|
8
|
+
this.baseUrl = params?.baseUrl
|
|
9
|
+
this.userName = params?.userName
|
|
10
|
+
this.password = params?.password
|
|
11
|
+
this.httpTimeoutMs = params?.httpTimeoutMs
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static fromJson(jsonObject) {
|
|
15
|
+
if (jsonObject == null) return null
|
|
16
|
+
const result = new CredentialsConnectionConfig()
|
|
17
|
+
result.baseUrl = jsonObject["baseUrl"]
|
|
18
|
+
result.userName = jsonObject["userName"]
|
|
19
|
+
result.password = jsonObject["password"]
|
|
20
|
+
result.httpTimeoutMs = jsonObject["httpTimeoutMs"]
|
|
21
|
+
return result
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
toJson() {
|
|
25
|
+
return {
|
|
26
|
+
"baseUrl": this.baseUrl,
|
|
27
|
+
"userName": this.userName,
|
|
28
|
+
"password": this.password,
|
|
29
|
+
"httpTimeoutMs": this.httpTimeoutMs,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class PrepareWorkflowConfig {
|
|
2
|
+
workflowId
|
|
3
|
+
|
|
4
|
+
constructor(params) {
|
|
5
|
+
this.workflowId = params?.workflowId
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
static fromJson(jsonObject) {
|
|
9
|
+
if (jsonObject == null) return null
|
|
10
|
+
const result = new PrepareWorkflowConfig()
|
|
11
|
+
result.workflowId = jsonObject["workflowId"]
|
|
12
|
+
return result
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
toJson() {
|
|
16
|
+
return {
|
|
17
|
+
"workflowId": this.workflowId,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class StartWorkflowConfig {
|
|
2
|
+
locale
|
|
3
|
+
metadata
|
|
4
|
+
|
|
5
|
+
constructor(params) {
|
|
6
|
+
this.locale = params?.locale
|
|
7
|
+
this.metadata = params?.metadata
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static fromJson(jsonObject) {
|
|
11
|
+
if (jsonObject == null) return null
|
|
12
|
+
const result = new StartWorkflowConfig()
|
|
13
|
+
result.locale = jsonObject["locale"]
|
|
14
|
+
result.metadata = jsonObject["metadata"]
|
|
15
|
+
return result
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toJson() {
|
|
19
|
+
return {
|
|
20
|
+
"locale": this.locale,
|
|
21
|
+
"metadata": this.metadata,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class TokenConnectionConfig {
|
|
2
|
+
url
|
|
3
|
+
|
|
4
|
+
constructor(params) {
|
|
5
|
+
this.url = params?.url
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
static fromJson(jsonObject) {
|
|
9
|
+
if (jsonObject == null) return null
|
|
10
|
+
const result = new TokenConnectionConfig()
|
|
11
|
+
result.url = jsonObject["url"]
|
|
12
|
+
return result
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
toJson() {
|
|
16
|
+
return {
|
|
17
|
+
"url": this.url,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|