@regulaforensics/idv 3.4.84-beta → 3.6.96-nightly
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/RNIDV.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/java/com/regula/plugin/idv/Main.kt +8 -0
- package/android/src/main/java/com/regula/plugin/idv/Utils.kt +7 -0
- package/examples/capacitor/package-lock.json +128 -128
- package/examples/capacitor/package.json +5 -7
- package/examples/ionic/package-lock.json +2615 -1519
- package/examples/ionic/package.json +15 -9
- package/examples/react_native/package-lock.json +81 -69
- package/examples/react_native/package.json +5 -7
- package/ios/CDVIDV.swift +18 -26
- package/ios/Main.swift +9 -1
- package/ios/RNIDV.m +1 -1
- package/ios/RNIDV.swift +15 -24
- package/ios/Utils.swift +10 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/test/package-lock.json +1 -1
- package/www/capacitor/index.js +20 -21
- package/www/capacitor/internal/bridge.js +15 -0
- package/www/cordova.js +43 -26
- package/www/react-native/index.js +20 -21
- package/www/react-native/internal/bridge.js +15 -0
- package/www/types/index.d.ts +13 -0
package/www/capacitor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { exec, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
|
|
1
|
+
import { exec, serializeInterface, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
|
|
2
2
|
|
|
3
3
|
import { TokenConnectionConfig } from './config/token_connection_config'
|
|
4
4
|
import { CredentialsConnectionConfig } from './config/credentials_connection_config'
|
|
@@ -23,12 +23,17 @@ export class IDV {
|
|
|
23
23
|
setDidEndSessionCompletion(value.didEndSession)
|
|
24
24
|
setDidStartRestoreSessionCompletion(value.didStartRestoreSession)
|
|
25
25
|
setDidContinueRemoteSessionCompletion(value.didContinueRemoteSession)
|
|
26
|
+
setDidReceiveLogEventCompletion(value.didReceiveLogEvent)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
set sessionRestoreMode(val) {
|
|
29
30
|
exec('setSessionRestoreMode', [val])
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
set logLevel(val) {
|
|
34
|
+
exec('setLogLevel', [val])
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
async getCurrentSessionId() {
|
|
33
38
|
return await exec('getCurrentSessionId', [])
|
|
34
39
|
}
|
|
@@ -44,32 +49,27 @@ export class IDV {
|
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
async configureWithToken(config) {
|
|
47
|
-
|
|
48
|
-
const response = await exec('configureWithToken', [config?.toJson()])
|
|
52
|
+
const response = await exec('configureWithToken', [serializeInterface(config, TokenConnectionConfig)])
|
|
49
53
|
return completionFromResponse(response, success => success?.map(item => String(item)))
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
async configureWithCredentials(config) {
|
|
53
|
-
|
|
54
|
-
const response = await exec('configureWithCredentials', [config?.toJson()])
|
|
57
|
+
const response = await exec('configureWithCredentials', [serializeInterface(config, CredentialsConnectionConfig)])
|
|
55
58
|
return completionFromResponse(response)
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
async configureWithApiKey(config) {
|
|
59
|
-
|
|
60
|
-
const response = await exec('configureWithApiKey', [config?.toJson()])
|
|
62
|
+
const response = await exec('configureWithApiKey', [serializeInterface(config, ApiKeyConnectionConfig)])
|
|
61
63
|
return completionFromResponse(response)
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
async prepareWorkflow(config) {
|
|
65
|
-
|
|
66
|
-
const response = await exec('prepareWorkflow', [config?.toJson()])
|
|
67
|
+
const response = await exec('prepareWorkflow', [serializeInterface(config, PrepareWorkflowConfig)])
|
|
67
68
|
return completionFromResponse(response, json => Workflow.fromJson(json))
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
async startWorkflow(config) {
|
|
71
|
-
|
|
72
|
-
const response = await exec('startWorkflow', [config?.toJson()])
|
|
72
|
+
const response = await exec('startWorkflow', [serializeInterface(config, StartWorkflowConfig)])
|
|
73
73
|
return completionFromResponse(response, json => WorkflowResult.fromJson(json))
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -86,14 +86,12 @@ export class IDV {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
async startSession(config) {
|
|
89
|
-
|
|
90
|
-
const response = await exec('startSession', [config.toJson()])
|
|
89
|
+
const response = await exec('startSession', [serializeInterface(config, StartSessionConfig)])
|
|
91
90
|
return completionFromResponse(response)
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
async sendData(config) {
|
|
95
|
-
|
|
96
|
-
const response = await exec('sendData', [config.toJson()])
|
|
94
|
+
const response = await exec('sendData', [serializeInterface(config, SendDataConfig)])
|
|
97
95
|
return completionFromResponse(response)
|
|
98
96
|
}
|
|
99
97
|
}
|
|
@@ -103,6 +101,13 @@ export const SessionRestoreMode = {
|
|
|
103
101
|
DISABLED: 1,
|
|
104
102
|
}
|
|
105
103
|
|
|
104
|
+
export const IdvLogLevel = {
|
|
105
|
+
DEBUG: 0,
|
|
106
|
+
INFO: 1,
|
|
107
|
+
WARNING: 2,
|
|
108
|
+
ERROR: 3,
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
function completionFromResponse(response, transform) {
|
|
107
112
|
const jsonObject = JSON.parse(response)
|
|
108
113
|
let success = jsonObject['success']
|
|
@@ -110,9 +115,3 @@ function completionFromResponse(response, transform) {
|
|
|
110
115
|
if (transform != null && success != null) success = transform(success)
|
|
111
116
|
return [success, error]
|
|
112
117
|
}
|
|
113
|
-
|
|
114
|
-
function ensureInstance(value, ctor) {
|
|
115
|
-
if (value == null) return null
|
|
116
|
-
if (value instanceof ctor) return value
|
|
117
|
-
return new ctor(value)
|
|
118
|
-
}
|
|
@@ -7,6 +7,12 @@ export async function exec(name, params) {
|
|
|
7
7
|
return RNIDV.exec(name, params)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export function serializeInterface(value, ctor) {
|
|
11
|
+
if (value == null) return null
|
|
12
|
+
if (value instanceof ctor) return value.toJson()
|
|
13
|
+
return (new ctor(value)).toJson()
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
function setEvent(id, completion, transform) {
|
|
11
17
|
eventManager.removeAllListeners(id)
|
|
12
18
|
if (transform === undefined) transform = func => func
|
|
@@ -28,3 +34,12 @@ export function setDidStartRestoreSessionCompletion(completion) {
|
|
|
28
34
|
export function setDidContinueRemoteSessionCompletion(completion) {
|
|
29
35
|
setEvent('didContinueRemoteSessionEvent', completion)
|
|
30
36
|
}
|
|
37
|
+
|
|
38
|
+
export function setDidReceiveLogEventCompletion(completion) {
|
|
39
|
+
setEvent('didReceiveLogEventEvent', completion, json => {
|
|
40
|
+
var jsonObject = JSON.parse(json)
|
|
41
|
+
var level = jsonObject["level"];
|
|
42
|
+
var message = jsonObject["message"];
|
|
43
|
+
return [level, message]
|
|
44
|
+
})
|
|
45
|
+
}
|
package/www/cordova.js
CHANGED
|
@@ -289,8 +289,10 @@ class TokenConnectionConfig {
|
|
|
289
289
|
__webpack_require__.r(__webpack_exports__);
|
|
290
290
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
291
291
|
/* harmony export */ exec: () => (/* binding */ exec),
|
|
292
|
+
/* harmony export */ serializeInterface: () => (/* binding */ serializeInterface),
|
|
292
293
|
/* harmony export */ setDidContinueRemoteSessionCompletion: () => (/* binding */ setDidContinueRemoteSessionCompletion),
|
|
293
294
|
/* harmony export */ setDidEndSessionCompletion: () => (/* binding */ setDidEndSessionCompletion),
|
|
295
|
+
/* harmony export */ setDidReceiveLogEventCompletion: () => (/* binding */ setDidReceiveLogEventCompletion),
|
|
294
296
|
/* harmony export */ setDidStartRestoreSessionCompletion: () => (/* binding */ setDidStartRestoreSessionCompletion),
|
|
295
297
|
/* harmony export */ setDidStartSessionCompletion: () => (/* binding */ setDidStartSessionCompletion)
|
|
296
298
|
/* harmony export */ });
|
|
@@ -304,6 +306,12 @@ async function exec(name, params) {
|
|
|
304
306
|
return RNIDV.exec(name, params)
|
|
305
307
|
}
|
|
306
308
|
|
|
309
|
+
function serializeInterface(value, ctor) {
|
|
310
|
+
if (value == null) return null
|
|
311
|
+
if (value instanceof ctor) return value.toJson()
|
|
312
|
+
return (new ctor(value)).toJson()
|
|
313
|
+
}
|
|
314
|
+
|
|
307
315
|
function setEvent(id, completion, transform) {
|
|
308
316
|
eventManager.removeAllListeners(id)
|
|
309
317
|
if (transform === undefined) transform = func => func
|
|
@@ -326,6 +334,15 @@ function setDidContinueRemoteSessionCompletion(completion) {
|
|
|
326
334
|
setEvent('didContinueRemoteSessionEvent', completion)
|
|
327
335
|
}
|
|
328
336
|
|
|
337
|
+
function setDidReceiveLogEventCompletion(completion) {
|
|
338
|
+
setEvent('didReceiveLogEventEvent', completion, json => {
|
|
339
|
+
var jsonObject = JSON.parse(json)
|
|
340
|
+
var level = jsonObject["level"];
|
|
341
|
+
var message = jsonObject["message"];
|
|
342
|
+
return [level, message]
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
|
|
329
346
|
|
|
330
347
|
/***/ },
|
|
331
348
|
|
|
@@ -483,12 +500,6 @@ class WorkflowStep {
|
|
|
483
500
|
/******/ if (cachedModule !== undefined) {
|
|
484
501
|
/******/ return cachedModule.exports;
|
|
485
502
|
/******/ }
|
|
486
|
-
/******/ // Check if module exists (development only)
|
|
487
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
488
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
489
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
490
|
-
/******/ throw e;
|
|
491
|
-
/******/ }
|
|
492
503
|
/******/ // Create a new module (and put it into the cache)
|
|
493
504
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
494
505
|
/******/ // no module.id needed
|
|
@@ -497,6 +508,12 @@ class WorkflowStep {
|
|
|
497
508
|
/******/ };
|
|
498
509
|
/******/
|
|
499
510
|
/******/ // Execute the module function
|
|
511
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
512
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
513
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
514
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
515
|
+
/******/ throw e;
|
|
516
|
+
/******/ }
|
|
500
517
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
501
518
|
/******/
|
|
502
519
|
/******/ // Return the exports of the module
|
|
@@ -544,6 +561,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
544
561
|
/* harmony export */ ApiKeyConnectionConfig: () => (/* reexport safe */ _config_api_key_connection_config__WEBPACK_IMPORTED_MODULE_3__.ApiKeyConnectionConfig),
|
|
545
562
|
/* harmony export */ CredentialsConnectionConfig: () => (/* reexport safe */ _config_credentials_connection_config__WEBPACK_IMPORTED_MODULE_2__.CredentialsConnectionConfig),
|
|
546
563
|
/* harmony export */ IDV: () => (/* binding */ IDV),
|
|
564
|
+
/* harmony export */ IdvLogLevel: () => (/* binding */ IdvLogLevel),
|
|
547
565
|
/* harmony export */ PrepareWorkflowConfig: () => (/* reexport safe */ _config_prepare_workflow_config__WEBPACK_IMPORTED_MODULE_4__.PrepareWorkflowConfig),
|
|
548
566
|
/* harmony export */ SendDataConfig: () => (/* reexport safe */ _config_send_data_config__WEBPACK_IMPORTED_MODULE_7__.SendDataConfig),
|
|
549
567
|
/* harmony export */ SessionRestoreMode: () => (/* binding */ SessionRestoreMode),
|
|
@@ -590,12 +608,17 @@ class IDV {
|
|
|
590
608
|
;(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.setDidEndSessionCompletion)(value.didEndSession)
|
|
591
609
|
;(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.setDidStartRestoreSessionCompletion)(value.didStartRestoreSession)
|
|
592
610
|
;(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.setDidContinueRemoteSessionCompletion)(value.didContinueRemoteSession)
|
|
611
|
+
setDidReceiveLogEventCompletion(value.didReceiveLogEvent)
|
|
593
612
|
}
|
|
594
613
|
|
|
595
614
|
set sessionRestoreMode(val) {
|
|
596
615
|
(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('setSessionRestoreMode', [val])
|
|
597
616
|
}
|
|
598
617
|
|
|
618
|
+
set logLevel(val) {
|
|
619
|
+
(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('setLogLevel', [val])
|
|
620
|
+
}
|
|
621
|
+
|
|
599
622
|
async getCurrentSessionId() {
|
|
600
623
|
return await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('getCurrentSessionId', [])
|
|
601
624
|
}
|
|
@@ -611,32 +634,27 @@ class IDV {
|
|
|
611
634
|
}
|
|
612
635
|
|
|
613
636
|
async configureWithToken(config) {
|
|
614
|
-
|
|
615
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithToken', [config?.toJson()])
|
|
637
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithToken', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_token_connection_config__WEBPACK_IMPORTED_MODULE_1__.TokenConnectionConfig)])
|
|
616
638
|
return completionFromResponse(response, success => success?.map(item => String(item)))
|
|
617
639
|
}
|
|
618
640
|
|
|
619
641
|
async configureWithCredentials(config) {
|
|
620
|
-
|
|
621
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithCredentials', [config?.toJson()])
|
|
642
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithCredentials', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_credentials_connection_config__WEBPACK_IMPORTED_MODULE_2__.CredentialsConnectionConfig)])
|
|
622
643
|
return completionFromResponse(response)
|
|
623
644
|
}
|
|
624
645
|
|
|
625
646
|
async configureWithApiKey(config) {
|
|
626
|
-
|
|
627
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithApiKey', [config?.toJson()])
|
|
647
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('configureWithApiKey', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_api_key_connection_config__WEBPACK_IMPORTED_MODULE_3__.ApiKeyConnectionConfig)])
|
|
628
648
|
return completionFromResponse(response)
|
|
629
649
|
}
|
|
630
650
|
|
|
631
651
|
async prepareWorkflow(config) {
|
|
632
|
-
|
|
633
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('prepareWorkflow', [config?.toJson()])
|
|
652
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('prepareWorkflow', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_prepare_workflow_config__WEBPACK_IMPORTED_MODULE_4__.PrepareWorkflowConfig)])
|
|
634
653
|
return completionFromResponse(response, json => _model_workflow__WEBPACK_IMPORTED_MODULE_8__.Workflow.fromJson(json))
|
|
635
654
|
}
|
|
636
655
|
|
|
637
656
|
async startWorkflow(config) {
|
|
638
|
-
|
|
639
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('startWorkflow', [config?.toJson()])
|
|
657
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('startWorkflow', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_start_workflow_config__WEBPACK_IMPORTED_MODULE_5__.StartWorkflowConfig)])
|
|
640
658
|
return completionFromResponse(response, json => _model_workflow_result__WEBPACK_IMPORTED_MODULE_9__.WorkflowResult.fromJson(json))
|
|
641
659
|
}
|
|
642
660
|
|
|
@@ -653,14 +671,12 @@ class IDV {
|
|
|
653
671
|
}
|
|
654
672
|
|
|
655
673
|
async startSession(config) {
|
|
656
|
-
|
|
657
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('startSession', [config.toJson()])
|
|
674
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('startSession', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_start_session_config__WEBPACK_IMPORTED_MODULE_6__.StartSessionConfig)])
|
|
658
675
|
return completionFromResponse(response)
|
|
659
676
|
}
|
|
660
677
|
|
|
661
678
|
async sendData(config) {
|
|
662
|
-
|
|
663
|
-
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('sendData', [config.toJson()])
|
|
679
|
+
const response = await (0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.exec)('sendData', [(0,_internal_bridge__WEBPACK_IMPORTED_MODULE_0__.serializeInterface)(config, _config_send_data_config__WEBPACK_IMPORTED_MODULE_7__.SendDataConfig)])
|
|
664
680
|
return completionFromResponse(response)
|
|
665
681
|
}
|
|
666
682
|
}
|
|
@@ -670,6 +686,13 @@ const SessionRestoreMode = {
|
|
|
670
686
|
DISABLED: 1,
|
|
671
687
|
}
|
|
672
688
|
|
|
689
|
+
const IdvLogLevel = {
|
|
690
|
+
DEBUG: 0,
|
|
691
|
+
INFO: 1,
|
|
692
|
+
WARNING: 2,
|
|
693
|
+
ERROR: 3,
|
|
694
|
+
}
|
|
695
|
+
|
|
673
696
|
function completionFromResponse(response, transform) {
|
|
674
697
|
const jsonObject = JSON.parse(response)
|
|
675
698
|
let success = jsonObject['success']
|
|
@@ -678,12 +701,6 @@ function completionFromResponse(response, transform) {
|
|
|
678
701
|
return [success, error]
|
|
679
702
|
}
|
|
680
703
|
|
|
681
|
-
function ensureInstance(value, ctor) {
|
|
682
|
-
if (value == null) return null
|
|
683
|
-
if (value instanceof ctor) return value
|
|
684
|
-
return new ctor(value)
|
|
685
|
-
}
|
|
686
|
-
|
|
687
704
|
})();
|
|
688
705
|
|
|
689
706
|
var __webpack_export_target__ = exports;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { exec, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
|
|
1
|
+
import { exec, serializeInterface, setDidStartSessionCompletion, setDidEndSessionCompletion, setDidStartRestoreSessionCompletion, setDidContinueRemoteSessionCompletion } from './internal/bridge'
|
|
2
2
|
|
|
3
3
|
import { TokenConnectionConfig } from './config/token_connection_config'
|
|
4
4
|
import { CredentialsConnectionConfig } from './config/credentials_connection_config'
|
|
@@ -23,12 +23,17 @@ export class IDV {
|
|
|
23
23
|
setDidEndSessionCompletion(value.didEndSession)
|
|
24
24
|
setDidStartRestoreSessionCompletion(value.didStartRestoreSession)
|
|
25
25
|
setDidContinueRemoteSessionCompletion(value.didContinueRemoteSession)
|
|
26
|
+
setDidReceiveLogEventCompletion(value.didReceiveLogEvent)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
set sessionRestoreMode(val) {
|
|
29
30
|
exec('setSessionRestoreMode', [val])
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
set logLevel(val) {
|
|
34
|
+
exec('setLogLevel', [val])
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
async getCurrentSessionId() {
|
|
33
38
|
return await exec('getCurrentSessionId', [])
|
|
34
39
|
}
|
|
@@ -44,32 +49,27 @@ export class IDV {
|
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
async configureWithToken(config) {
|
|
47
|
-
|
|
48
|
-
const response = await exec('configureWithToken', [config?.toJson()])
|
|
52
|
+
const response = await exec('configureWithToken', [serializeInterface(config, TokenConnectionConfig)])
|
|
49
53
|
return completionFromResponse(response, success => success?.map(item => String(item)))
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
async configureWithCredentials(config) {
|
|
53
|
-
|
|
54
|
-
const response = await exec('configureWithCredentials', [config?.toJson()])
|
|
57
|
+
const response = await exec('configureWithCredentials', [serializeInterface(config, CredentialsConnectionConfig)])
|
|
55
58
|
return completionFromResponse(response)
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
async configureWithApiKey(config) {
|
|
59
|
-
|
|
60
|
-
const response = await exec('configureWithApiKey', [config?.toJson()])
|
|
62
|
+
const response = await exec('configureWithApiKey', [serializeInterface(config, ApiKeyConnectionConfig)])
|
|
61
63
|
return completionFromResponse(response)
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
async prepareWorkflow(config) {
|
|
65
|
-
|
|
66
|
-
const response = await exec('prepareWorkflow', [config?.toJson()])
|
|
67
|
+
const response = await exec('prepareWorkflow', [serializeInterface(config, PrepareWorkflowConfig)])
|
|
67
68
|
return completionFromResponse(response, json => Workflow.fromJson(json))
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
async startWorkflow(config) {
|
|
71
|
-
|
|
72
|
-
const response = await exec('startWorkflow', [config?.toJson()])
|
|
72
|
+
const response = await exec('startWorkflow', [serializeInterface(config, StartWorkflowConfig)])
|
|
73
73
|
return completionFromResponse(response, json => WorkflowResult.fromJson(json))
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -86,14 +86,12 @@ export class IDV {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
async startSession(config) {
|
|
89
|
-
|
|
90
|
-
const response = await exec('startSession', [config.toJson()])
|
|
89
|
+
const response = await exec('startSession', [serializeInterface(config, StartSessionConfig)])
|
|
91
90
|
return completionFromResponse(response)
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
async sendData(config) {
|
|
95
|
-
|
|
96
|
-
const response = await exec('sendData', [config.toJson()])
|
|
94
|
+
const response = await exec('sendData', [serializeInterface(config, SendDataConfig)])
|
|
97
95
|
return completionFromResponse(response)
|
|
98
96
|
}
|
|
99
97
|
}
|
|
@@ -103,6 +101,13 @@ export const SessionRestoreMode = {
|
|
|
103
101
|
DISABLED: 1,
|
|
104
102
|
}
|
|
105
103
|
|
|
104
|
+
export const IdvLogLevel = {
|
|
105
|
+
DEBUG: 0,
|
|
106
|
+
INFO: 1,
|
|
107
|
+
WARNING: 2,
|
|
108
|
+
ERROR: 3,
|
|
109
|
+
}
|
|
110
|
+
|
|
106
111
|
function completionFromResponse(response, transform) {
|
|
107
112
|
const jsonObject = JSON.parse(response)
|
|
108
113
|
let success = jsonObject['success']
|
|
@@ -110,9 +115,3 @@ function completionFromResponse(response, transform) {
|
|
|
110
115
|
if (transform != null && success != null) success = transform(success)
|
|
111
116
|
return [success, error]
|
|
112
117
|
}
|
|
113
|
-
|
|
114
|
-
function ensureInstance(value, ctor) {
|
|
115
|
-
if (value == null) return null
|
|
116
|
-
if (value instanceof ctor) return value
|
|
117
|
-
return new ctor(value)
|
|
118
|
-
}
|
|
@@ -7,6 +7,12 @@ export async function exec(name, params) {
|
|
|
7
7
|
return RNIDV.exec(name, params)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export function serializeInterface(value, ctor) {
|
|
11
|
+
if (value == null) return null
|
|
12
|
+
if (value instanceof ctor) return value.toJson()
|
|
13
|
+
return (new ctor(value)).toJson()
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
function setEvent(id, completion, transform) {
|
|
11
17
|
eventManager.removeAllListeners(id)
|
|
12
18
|
if (transform === undefined) transform = func => func
|
|
@@ -28,3 +34,12 @@ export function setDidStartRestoreSessionCompletion(completion) {
|
|
|
28
34
|
export function setDidContinueRemoteSessionCompletion(completion) {
|
|
29
35
|
setEvent('didContinueRemoteSessionEvent', completion)
|
|
30
36
|
}
|
|
37
|
+
|
|
38
|
+
export function setDidReceiveLogEventCompletion(completion) {
|
|
39
|
+
setEvent('didReceiveLogEventEvent', completion, json => {
|
|
40
|
+
var jsonObject = JSON.parse(json)
|
|
41
|
+
var level = jsonObject["level"];
|
|
42
|
+
var message = jsonObject["message"];
|
|
43
|
+
return [level, message]
|
|
44
|
+
})
|
|
45
|
+
}
|
package/www/types/index.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export class IDV {
|
|
|
25
25
|
|
|
26
26
|
set sessionRestoreMode(value: SessionRestoreMode)
|
|
27
27
|
|
|
28
|
+
/** Default: empty set. */
|
|
29
|
+
set logLevel(value: Set<IdvLogLevel>)
|
|
30
|
+
|
|
28
31
|
getCurrentSessionId(): Promise<string | null>
|
|
29
32
|
|
|
30
33
|
initialize(): Promise<[boolean, string | null]>
|
|
@@ -58,4 +61,14 @@ export interface IDVListenerOptions {
|
|
|
58
61
|
didEndSession?: () => void
|
|
59
62
|
didStartRestoreSession?: () => void
|
|
60
63
|
didContinueRemoteSession?: () => void
|
|
64
|
+
didReceiveLogEvent?: IdvLogEventCompletion
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type IdvLogEventCompletion = (level: IdvLogLevel, message: string) => void;
|
|
68
|
+
|
|
69
|
+
export enum IdvLogLevel {
|
|
70
|
+
DEBUG = 0,
|
|
71
|
+
INFO = 1,
|
|
72
|
+
WARNING = 2,
|
|
73
|
+
ERROR = 3,
|
|
61
74
|
}
|