@finos_sdk/sdk-ekyc 1.2.2 → 1.2.9
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/LICENSE +13 -10
- package/README.md +41 -42
- package/android/build.gradle +42 -11
- package/android/gradle.properties +7 -1
- package/android/settings.gradle +53 -0
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +791 -81
- package/dist/EKYCModule.d.ts +73 -0
- package/dist/EKYCModule.js +663 -71
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -1
- package/dist/package.json +31 -21
- package/dist/src/modules/FinosEKYCModule.d.ts +149 -0
- package/dist/src/modules/FinosEKYCModule.js +485 -2
- package/dist/src/modules/FinosESignModule.d.ts +270 -0
- package/dist/src/modules/FinosESignModule.js +752 -0
- package/dist/src/types/ekycESignType.d.ts +67 -0
- package/dist/src/types/ekycESignType.js +2 -0
- package/dist/src/types/ekycSmsOtpType.d.ts +52 -0
- package/dist/src/types/ekycSmsOtpType.js +2 -0
- package/package.json +31 -21
- package/src/modules/FinosEKYCModule.ts +572 -2
- package/src/modules/FinosESignModule.ts +919 -0
- package/src/modules/README.md +3 -3
- package/src/types/ekycESignType.ts +76 -0
- package/src/types/ekycSmsOtpType.ts +59 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.module +0 -110
- package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.2/c06-1.2.2.pom +0 -37
- package/android/SDKeKYC/finos/sdk/ekyc/c06/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.module +0 -201
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.2/ekyc-1.2.2.pom +0 -73
- package/android/SDKeKYC/finos/sdk/ekyc/ekyc/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.module +0 -131
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.2/ekycui-1.2.2.pom +0 -43
- package/android/SDKeKYC/finos/sdk/ekyc/ekycui/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.module +0 -110
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.2/faceservice-1.2.2.pom +0 -37
- package/android/SDKeKYC/finos/sdk/ekyc/faceservice/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.module +0 -138
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.2/liveness-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/liveness/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.module +0 -131
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.2/nfc-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/nfc/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.module +0 -124
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.2/ocr-1.2.2.pom +0 -43
- package/android/SDKeKYC/finos/sdk/ekyc/ocr/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.module +0 -138
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.2/qrcode-1.2.2.pom +0 -55
- package/android/SDKeKYC/finos/sdk/ekyc/qrcode/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.module +0 -341
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.2/sdkcore-1.2.2.pom +0 -139
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.module +0 -201
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.2/sdkcorecamera-1.2.2.pom +0 -85
- package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/maven-metadata-local.xml +0 -13
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2-sources.jar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.aar +0 -0
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.module +0 -208
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.2/sdkui-1.2.2.pom +0 -103
- package/android/SDKeKYC/finos/sdk/ekyc/sdkui/maven-metadata-local.xml +0 -13
- package/android/src/main/AndroidManifest.xml +0 -22
- package/android/src/main/build.gradle +0 -31
- package/dist/App.d.ts +0 -3
- package/dist/App.js +0 -497
- package/dist/finos_sdk-sdk-ekyc-1.2.2.tgz +0 -0
package/dist/EKYCModule.js
CHANGED
|
@@ -9,10 +9,10 @@ const react_native_1 = require("react-native");
|
|
|
9
9
|
const package_json_1 = __importDefault(require("./package.json"));
|
|
10
10
|
exports.SDK_VERSION = package_json_1.default.version;
|
|
11
11
|
exports.SDK_NAME = package_json_1.default.name;
|
|
12
|
-
const EKYCNativeModule = react_native_1.NativeModules.EKYCModule;
|
|
13
|
-
// Validate that the module is available
|
|
12
|
+
const EKYCNativeModule = react_native_1.NativeModules.EKYCModule || null;
|
|
13
|
+
// Validate that the module is available - but don't throw, just warn
|
|
14
14
|
if (!EKYCNativeModule) {
|
|
15
|
-
|
|
15
|
+
console.error('❌ EKYCModule is not available. This is likely an autolinking issue.\n' +
|
|
16
16
|
'Please try:\n' +
|
|
17
17
|
'1. Clean and rebuild your app:\n' +
|
|
18
18
|
' - rm -rf android/app/build android/build\n' +
|
|
@@ -21,35 +21,62 @@ if (!EKYCNativeModule) {
|
|
|
21
21
|
'2. If using manual linking, remove it and rely on autolinking\n' +
|
|
22
22
|
'3. Ensure you have the latest version: npm install @finos_sdk/sdk-ekyc@latest');
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
24
|
+
else {
|
|
25
|
+
console.log('✅ Native module loaded');
|
|
26
|
+
// Initialize the module with Koin error handling
|
|
27
|
+
try {
|
|
28
|
+
EKYCNativeModule.initSdkEkyc()
|
|
29
|
+
.then(() => {
|
|
30
|
+
console.log("✅ SDK initialized");
|
|
31
|
+
})
|
|
32
|
+
.catch(e => {
|
|
33
|
+
if (e && e.toString().includes('Koin Application has already been started')) {
|
|
34
|
+
console.log("✅ SDK already initialized");
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.warn("❌ Failed to initialize SDK:", e);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
29
42
|
if (e && e.toString().includes('Koin Application has already been started')) {
|
|
30
|
-
console.log("✅ SDK already initialized
|
|
43
|
+
console.log("✅ SDK already initialized");
|
|
31
44
|
}
|
|
32
45
|
else {
|
|
33
|
-
console.warn("❌
|
|
46
|
+
console.warn("❌ Exception when initializing SDK:", e);
|
|
34
47
|
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
if (e && e.toString().includes('Koin Application has already been started')) {
|
|
39
|
-
console.log("✅ SDK already initialized (Koin Application started)");
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
console.warn("❌ Exception when calling initSdkEkyc:", e);
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
class SDKeKYC {
|
|
46
51
|
constructor() {
|
|
52
|
+
this.eventEmitter = null;
|
|
47
53
|
this.listeners = [];
|
|
48
54
|
this.isInitialized = false;
|
|
49
|
-
|
|
55
|
+
// Lazy initialization of event emitter to ensure native module is ready
|
|
56
|
+
}
|
|
57
|
+
// Ensure event emitter is initialized
|
|
58
|
+
ensureEventEmitter() {
|
|
59
|
+
if (!this.eventEmitter) {
|
|
60
|
+
if (!EKYCNativeModule) {
|
|
61
|
+
console.error('❌ EKYCModule native module is not available');
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
this.eventEmitter = new react_native_1.NativeEventEmitter(EKYCNativeModule);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('❌ Failed to create NativeEventEmitter:', error);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return this.eventEmitter;
|
|
50
73
|
}
|
|
51
74
|
// SDK Information methods
|
|
52
75
|
async getVersion() {
|
|
76
|
+
if (!EKYCNativeModule) {
|
|
77
|
+
console.warn('⚠️ EKYCModule not available, returning fallback version');
|
|
78
|
+
return exports.SDK_VERSION;
|
|
79
|
+
}
|
|
53
80
|
try {
|
|
54
81
|
return await EKYCNativeModule.getVersion();
|
|
55
82
|
}
|
|
@@ -59,6 +86,14 @@ class SDKeKYC {
|
|
|
59
86
|
}
|
|
60
87
|
}
|
|
61
88
|
async getSDKInfo() {
|
|
89
|
+
if (!EKYCNativeModule) {
|
|
90
|
+
console.warn('⚠️ EKYCModule not available, returning fallback info');
|
|
91
|
+
return {
|
|
92
|
+
name: exports.SDK_NAME,
|
|
93
|
+
version: exports.SDK_VERSION,
|
|
94
|
+
buildNumber: '1'
|
|
95
|
+
};
|
|
96
|
+
}
|
|
62
97
|
try {
|
|
63
98
|
return await EKYCNativeModule.getSDKInfo();
|
|
64
99
|
}
|
|
@@ -73,6 +108,11 @@ class SDKeKYC {
|
|
|
73
108
|
}
|
|
74
109
|
// Initialize SDK with better error handling
|
|
75
110
|
async initSdkEkyc() {
|
|
111
|
+
if (!EKYCNativeModule) {
|
|
112
|
+
const error = 'EKYCModule native module is not available. Please check autolinking.';
|
|
113
|
+
console.error('❌', error);
|
|
114
|
+
throw new Error(error);
|
|
115
|
+
}
|
|
76
116
|
try {
|
|
77
117
|
const result = await EKYCNativeModule.initSdkEkyc();
|
|
78
118
|
this.isInitialized = true;
|
|
@@ -90,12 +130,33 @@ class SDKeKYC {
|
|
|
90
130
|
throw error;
|
|
91
131
|
}
|
|
92
132
|
}
|
|
133
|
+
// Set transaction ID
|
|
134
|
+
async setTransactionId(transactionId) {
|
|
135
|
+
const nativeModule = this.ensureNativeModule();
|
|
136
|
+
try {
|
|
137
|
+
const result = await nativeModule.setTransactionId(transactionId);
|
|
138
|
+
console.log('✅ Transaction ID set successfully:', transactionId);
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error('❌ Failed to set transaction ID:', error);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
93
146
|
// Check if SDK is initialized
|
|
94
147
|
isSDKInitialized() {
|
|
95
148
|
return this.isInitialized;
|
|
96
149
|
}
|
|
150
|
+
// Validate native module is available
|
|
151
|
+
ensureNativeModule() {
|
|
152
|
+
if (!EKYCNativeModule) {
|
|
153
|
+
throw new Error('EKYCModule native module is not available. Please check autolinking.');
|
|
154
|
+
}
|
|
155
|
+
return EKYCNativeModule;
|
|
156
|
+
}
|
|
97
157
|
// Validate configuration before calling native methods
|
|
98
158
|
validateConfig(config, requiredFields) {
|
|
159
|
+
this.ensureNativeModule(); // Check native module first
|
|
99
160
|
if (!this.isInitialized) {
|
|
100
161
|
throw new Error('SDK is not initialized. Please call initSdkEkyc() first.');
|
|
101
162
|
}
|
|
@@ -108,8 +169,9 @@ class SDKeKYC {
|
|
|
108
169
|
async startOcr(config) {
|
|
109
170
|
var _a;
|
|
110
171
|
this.validateConfig(config, ['appKey', 'idImagePath', 'expectedDocumentSide', 'transactionId']);
|
|
172
|
+
const nativeModule = this.ensureNativeModule();
|
|
111
173
|
try {
|
|
112
|
-
return await
|
|
174
|
+
return await nativeModule.startOcr(config.appKey, config.idImagePath, config.expectedDocumentSide, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '');
|
|
113
175
|
}
|
|
114
176
|
catch (error) {
|
|
115
177
|
console.error('OCR Error:', error);
|
|
@@ -119,8 +181,9 @@ class SDKeKYC {
|
|
|
119
181
|
// Start NFC scanning
|
|
120
182
|
async startNfcScan(config) {
|
|
121
183
|
this.validateConfig(config, ['appKey', 'documentNumber', 'birthDate', 'expireDate']);
|
|
184
|
+
const nativeModule = this.ensureNativeModule();
|
|
122
185
|
try {
|
|
123
|
-
return await
|
|
186
|
+
return await nativeModule.startNfcScan(config.appKey, config.documentNumber, config.birthDate, config.expireDate, config.transactionId, config.facePathStorage);
|
|
124
187
|
}
|
|
125
188
|
catch (error) {
|
|
126
189
|
console.error('NFC Scan Error:', error);
|
|
@@ -131,8 +194,9 @@ class SDKeKYC {
|
|
|
131
194
|
async checkC06(config) {
|
|
132
195
|
var _a, _b;
|
|
133
196
|
this.validateConfig(config, ['appKey', 'sod', 'idCardNumber', 'recentLocation']);
|
|
197
|
+
const nativeModule = this.ensureNativeModule();
|
|
134
198
|
try {
|
|
135
|
-
return await
|
|
199
|
+
return await nativeModule.checkC06(config.appKey, config.sod, config.idCardNumber, (_a = config.recentLocation) !== null && _a !== void 0 ? _a : '', (_b = config.transactionId) !== null && _b !== void 0 ? _b : '');
|
|
136
200
|
}
|
|
137
201
|
catch (error) {
|
|
138
202
|
console.error('C06 Check Error:', error);
|
|
@@ -142,8 +206,9 @@ class SDKeKYC {
|
|
|
142
206
|
async startLiveness(config) {
|
|
143
207
|
var _a;
|
|
144
208
|
this.validateConfig(config, ['appKey', 'selfieImage', 'transactionId']);
|
|
209
|
+
const nativeModule = this.ensureNativeModule();
|
|
145
210
|
try {
|
|
146
|
-
return await
|
|
211
|
+
return await nativeModule.startLiveness(config.appKey, config.selfieImage, config.usingRandomAction, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '', config.isStraight, config.switchFrontCamera !== undefined ? config.switchFrontCamera : false);
|
|
147
212
|
}
|
|
148
213
|
catch (error) {
|
|
149
214
|
console.error('Liveness Error:', error);
|
|
@@ -153,8 +218,9 @@ class SDKeKYC {
|
|
|
153
218
|
async startFaceCompare(config) {
|
|
154
219
|
var _a;
|
|
155
220
|
this.validateConfig(config, ['appKey', 'selfieImage', 'idImage']);
|
|
221
|
+
const nativeModule = this.ensureNativeModule();
|
|
156
222
|
try {
|
|
157
|
-
return await
|
|
223
|
+
return await nativeModule.startFaceCompare(config.appKey, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '', config.selfieImage, config.idImage);
|
|
158
224
|
}
|
|
159
225
|
catch (error) {
|
|
160
226
|
console.error('Face Compare Error:', error);
|
|
@@ -163,94 +229,619 @@ class SDKeKYC {
|
|
|
163
229
|
}
|
|
164
230
|
// Lifecycle methods
|
|
165
231
|
onResume() {
|
|
166
|
-
|
|
232
|
+
const nativeModule = this.ensureNativeModule();
|
|
233
|
+
nativeModule.onResume();
|
|
167
234
|
}
|
|
168
235
|
onPause() {
|
|
169
|
-
|
|
236
|
+
const nativeModule = this.ensureNativeModule();
|
|
237
|
+
nativeModule.onPause();
|
|
170
238
|
}
|
|
171
239
|
// Event listeners
|
|
172
240
|
onNfcScanStart(callback) {
|
|
173
|
-
|
|
241
|
+
try {
|
|
242
|
+
const emitter = this.ensureEventEmitter();
|
|
243
|
+
if (!emitter) {
|
|
244
|
+
console.error('❌ Event emitter not available for onNfcScanStart');
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
const listener = emitter.addListener('onNfcScanStart', callback);
|
|
248
|
+
this.listeners.push(listener);
|
|
249
|
+
return listener;
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
console.error('Failed to add onNfcScanStart listener:', error);
|
|
174
253
|
return null;
|
|
175
|
-
|
|
176
|
-
this.listeners.push(listener);
|
|
177
|
-
return listener;
|
|
254
|
+
}
|
|
178
255
|
}
|
|
179
256
|
onNfcScanSuccess(callback) {
|
|
180
|
-
|
|
257
|
+
try {
|
|
258
|
+
const emitter = this.ensureEventEmitter();
|
|
259
|
+
if (!emitter) {
|
|
260
|
+
console.error('❌ Event emitter not available for onNfcScanSuccess');
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
const listener = emitter.addListener('onNfcScanSuccess', callback);
|
|
264
|
+
this.listeners.push(listener);
|
|
265
|
+
return listener;
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
console.error('Failed to add onNfcScanSuccess listener:', error);
|
|
181
269
|
return null;
|
|
182
|
-
|
|
183
|
-
this.listeners.push(listener);
|
|
184
|
-
return listener;
|
|
270
|
+
}
|
|
185
271
|
}
|
|
186
272
|
onNfcError(callback) {
|
|
187
|
-
|
|
273
|
+
try {
|
|
274
|
+
const emitter = this.ensureEventEmitter();
|
|
275
|
+
if (!emitter) {
|
|
276
|
+
console.error('❌ Event emitter not available for onNfcError');
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
const listener = emitter.addListener('onNfcError', callback);
|
|
280
|
+
this.listeners.push(listener);
|
|
281
|
+
return listener;
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
console.error('Failed to add onNfcError listener:', error);
|
|
188
285
|
return null;
|
|
189
|
-
|
|
190
|
-
this.listeners.push(listener);
|
|
191
|
-
return listener;
|
|
286
|
+
}
|
|
192
287
|
}
|
|
193
288
|
onC06Success(callback) {
|
|
194
|
-
|
|
289
|
+
try {
|
|
290
|
+
const emitter = this.ensureEventEmitter();
|
|
291
|
+
if (!emitter) {
|
|
292
|
+
console.error('❌ Event emitter not available for onC06Success');
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
const listener = emitter.addListener('onC06Success', callback);
|
|
296
|
+
this.listeners.push(listener);
|
|
297
|
+
return listener;
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
console.error('Failed to add onC06Success listener:', error);
|
|
195
301
|
return null;
|
|
196
|
-
|
|
197
|
-
this.listeners.push(listener);
|
|
198
|
-
return listener;
|
|
302
|
+
}
|
|
199
303
|
}
|
|
200
304
|
onC06Error(callback) {
|
|
201
|
-
|
|
305
|
+
try {
|
|
306
|
+
const emitter = this.ensureEventEmitter();
|
|
307
|
+
if (!emitter) {
|
|
308
|
+
console.error('❌ Event emitter not available for onC06Error');
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
const listener = emitter.addListener('onC06Error', callback);
|
|
312
|
+
this.listeners.push(listener);
|
|
313
|
+
return listener;
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
console.error('Failed to add onC06Error listener:', error);
|
|
202
317
|
return null;
|
|
203
|
-
|
|
204
|
-
this.listeners.push(listener);
|
|
205
|
-
return listener;
|
|
318
|
+
}
|
|
206
319
|
}
|
|
207
320
|
// Additional listeners (native emits these):
|
|
208
321
|
onOcrSuccess(callback) {
|
|
209
|
-
|
|
322
|
+
try {
|
|
323
|
+
const emitter = this.ensureEventEmitter();
|
|
324
|
+
if (!emitter) {
|
|
325
|
+
console.error('❌ Event emitter not available for onOcrSuccess');
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
const listener = emitter.addListener('onOcrSuccess', callback);
|
|
329
|
+
this.listeners.push(listener);
|
|
330
|
+
return listener;
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
console.error('Failed to add onOcrSuccess listener:', error);
|
|
210
334
|
return null;
|
|
211
|
-
|
|
212
|
-
this.listeners.push(listener);
|
|
213
|
-
return listener;
|
|
335
|
+
}
|
|
214
336
|
}
|
|
215
337
|
onOcrError(callback) {
|
|
216
|
-
|
|
338
|
+
try {
|
|
339
|
+
const emitter = this.ensureEventEmitter();
|
|
340
|
+
if (!emitter) {
|
|
341
|
+
console.error('❌ Event emitter not available for onOcrError');
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
const listener = emitter.addListener('onOcrError', callback);
|
|
345
|
+
this.listeners.push(listener);
|
|
346
|
+
return listener;
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
console.error('Failed to add onOcrError listener:', error);
|
|
217
350
|
return null;
|
|
218
|
-
|
|
219
|
-
this.listeners.push(listener);
|
|
220
|
-
return listener;
|
|
351
|
+
}
|
|
221
352
|
}
|
|
222
353
|
onLivenessSuccess(callback) {
|
|
223
|
-
|
|
354
|
+
try {
|
|
355
|
+
const emitter = this.ensureEventEmitter();
|
|
356
|
+
if (!emitter) {
|
|
357
|
+
console.error('❌ Event emitter not available for onLivenessSuccess');
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
const listener = emitter.addListener('onLivenessSuccess', callback);
|
|
361
|
+
this.listeners.push(listener);
|
|
362
|
+
return listener;
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
console.error('Failed to add onLivenessSuccess listener:', error);
|
|
224
366
|
return null;
|
|
225
|
-
|
|
226
|
-
this.listeners.push(listener);
|
|
227
|
-
return listener;
|
|
367
|
+
}
|
|
228
368
|
}
|
|
229
369
|
onLivenessError(callback) {
|
|
230
|
-
|
|
370
|
+
try {
|
|
371
|
+
const emitter = this.ensureEventEmitter();
|
|
372
|
+
if (!emitter) {
|
|
373
|
+
console.error('❌ Event emitter not available for onLivenessError');
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
const listener = emitter.addListener('onLivenessError', callback);
|
|
377
|
+
this.listeners.push(listener);
|
|
378
|
+
return listener;
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
console.error('Failed to add onLivenessError listener:', error);
|
|
231
382
|
return null;
|
|
232
|
-
|
|
233
|
-
this.listeners.push(listener);
|
|
234
|
-
return listener;
|
|
383
|
+
}
|
|
235
384
|
}
|
|
236
385
|
onFaceCompareSuccess(callback) {
|
|
237
|
-
|
|
386
|
+
try {
|
|
387
|
+
const emitter = this.ensureEventEmitter();
|
|
388
|
+
if (!emitter) {
|
|
389
|
+
console.error('❌ Event emitter not available for onFaceCompareSuccess');
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
const listener = emitter.addListener('onFaceCompareSuccess', callback);
|
|
393
|
+
this.listeners.push(listener);
|
|
394
|
+
return listener;
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
console.error('Failed to add onFaceCompareSuccess listener:', error);
|
|
238
398
|
return null;
|
|
239
|
-
|
|
240
|
-
this.listeners.push(listener);
|
|
241
|
-
return listener;
|
|
399
|
+
}
|
|
242
400
|
}
|
|
243
401
|
onFaceCompareError(callback) {
|
|
244
|
-
|
|
402
|
+
try {
|
|
403
|
+
const emitter = this.ensureEventEmitter();
|
|
404
|
+
if (!emitter) {
|
|
405
|
+
console.error('❌ Event emitter not available for onFaceCompareError');
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
const listener = emitter.addListener('onFaceCompareError', callback);
|
|
409
|
+
this.listeners.push(listener);
|
|
410
|
+
return listener;
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
console.error('Failed to add onFaceCompareError listener:', error);
|
|
245
414
|
return null;
|
|
246
|
-
|
|
247
|
-
this.listeners.push(listener);
|
|
248
|
-
return listener;
|
|
415
|
+
}
|
|
249
416
|
}
|
|
250
417
|
removeAllListeners() {
|
|
251
418
|
this.listeners.forEach(listener => listener.remove());
|
|
252
419
|
this.listeners = [];
|
|
253
420
|
}
|
|
421
|
+
// ==================== SMS OTP Methods ====================
|
|
422
|
+
async sendOtp(config) {
|
|
423
|
+
this.validateConfig(config, ['phoneNumber', 'referenceId']);
|
|
424
|
+
const nativeModule = this.ensureNativeModule();
|
|
425
|
+
try {
|
|
426
|
+
const result = await nativeModule.sendOtp(config.phoneNumber, config.purpose || null, config.referenceId);
|
|
427
|
+
return result;
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
console.error('SMS OTP Send Error:', error);
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
async verifyOtp(config, otpCode) {
|
|
435
|
+
if (!config.requestId) {
|
|
436
|
+
throw new Error('requestId is required for verifyOtp');
|
|
437
|
+
}
|
|
438
|
+
this.validateConfig(config, ['phoneNumber', 'referenceId', 'requestId']);
|
|
439
|
+
const nativeModule = this.ensureNativeModule();
|
|
440
|
+
try {
|
|
441
|
+
const result = await nativeModule.verifyOtp(config.phoneNumber, config.purpose || null, config.referenceId, config.requestId, otpCode);
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
console.error('SMS OTP Verify Error:', error);
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
async resendOtp(config) {
|
|
450
|
+
if (!config.requestId) {
|
|
451
|
+
throw new Error('requestId is required for resendOtp');
|
|
452
|
+
}
|
|
453
|
+
this.validateConfig(config, ['phoneNumber', 'referenceId', 'requestId']);
|
|
454
|
+
const nativeModule = this.ensureNativeModule();
|
|
455
|
+
try {
|
|
456
|
+
const result = await nativeModule.resendOtp(config.phoneNumber, config.purpose || null, config.referenceId, config.requestId);
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
console.error('SMS OTP Resend Error:', error);
|
|
461
|
+
throw error;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// SMS OTP Event Listeners
|
|
465
|
+
onSmsOtpSendSuccess(callback) {
|
|
466
|
+
try {
|
|
467
|
+
const emitter = this.ensureEventEmitter();
|
|
468
|
+
if (!emitter) {
|
|
469
|
+
console.error('❌ Event emitter not available for onSmsOtpSendSuccess');
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
const listener = emitter.addListener('onSmsOtpSendSuccess', callback);
|
|
473
|
+
this.listeners.push(listener);
|
|
474
|
+
return listener;
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
console.error('Failed to add onSmsOtpSendSuccess listener:', error);
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
onSmsOtpVerifySuccess(callback) {
|
|
482
|
+
try {
|
|
483
|
+
const emitter = this.ensureEventEmitter();
|
|
484
|
+
if (!emitter) {
|
|
485
|
+
console.error('❌ Event emitter not available for onSmsOtpVerifySuccess');
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
const listener = emitter.addListener('onSmsOtpVerifySuccess', callback);
|
|
489
|
+
this.listeners.push(listener);
|
|
490
|
+
return listener;
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
console.error('Failed to add onSmsOtpVerifySuccess listener:', error);
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
onSmsOtpResendSuccess(callback) {
|
|
498
|
+
try {
|
|
499
|
+
const emitter = this.ensureEventEmitter();
|
|
500
|
+
if (!emitter) {
|
|
501
|
+
console.error('❌ Event emitter not available for onSmsOtpResendSuccess');
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
const listener = emitter.addListener('onSmsOtpResendSuccess', callback);
|
|
505
|
+
this.listeners.push(listener);
|
|
506
|
+
return listener;
|
|
507
|
+
}
|
|
508
|
+
catch (error) {
|
|
509
|
+
console.error('Failed to add onSmsOtpResendSuccess listener:', error);
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
onSmsOtpError(callback) {
|
|
514
|
+
try {
|
|
515
|
+
const emitter = this.ensureEventEmitter();
|
|
516
|
+
if (!emitter) {
|
|
517
|
+
console.error('❌ Event emitter not available for onSmsOtpError');
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
const listener = emitter.addListener('onSmsOtpError', callback);
|
|
521
|
+
this.listeners.push(listener);
|
|
522
|
+
return listener;
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
console.error('Failed to add onSmsOtpError listener:', error);
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
// ==================== eSign Methods ====================
|
|
530
|
+
async initializeESign() {
|
|
531
|
+
const nativeModule = this.ensureNativeModule();
|
|
532
|
+
try {
|
|
533
|
+
const result = await nativeModule.initializeESign();
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
console.error('eSign Initialize Error:', error);
|
|
538
|
+
throw error;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
async openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath) {
|
|
542
|
+
const nativeModule = this.ensureNativeModule();
|
|
543
|
+
try {
|
|
544
|
+
const userEsignModelJson = userEsignModel ? JSON.stringify(userEsignModel) : null;
|
|
545
|
+
const result = await nativeModule.openSessionId(accessToken || null, username || null, rememberMe !== undefined ? rememberMe : false, userEsignModelJson, privateKeyFilePath || null);
|
|
546
|
+
return result;
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
console.error('eSign Open Session Error:', error);
|
|
550
|
+
throw error;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
async registerDevice(recoverCode, pinCode, fcmToken) {
|
|
554
|
+
const nativeModule = this.ensureNativeModule();
|
|
555
|
+
try {
|
|
556
|
+
const result = await nativeModule.registerDevice(recoverCode, pinCode, fcmToken || null);
|
|
557
|
+
return result;
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
console.error('eSign Register Device Error:', error);
|
|
561
|
+
throw error;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
async listCerts(pageNumber = 1, pageSize = 10) {
|
|
565
|
+
const nativeModule = this.ensureNativeModule();
|
|
566
|
+
try {
|
|
567
|
+
const result = await nativeModule.listCerts(pageNumber, pageSize);
|
|
568
|
+
return result;
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
console.error('eSign List Certs Error:', error);
|
|
572
|
+
throw error;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
async verifyCert(serial) {
|
|
576
|
+
const nativeModule = this.ensureNativeModule();
|
|
577
|
+
try {
|
|
578
|
+
const result = await nativeModule.verifyCert(serial);
|
|
579
|
+
return result;
|
|
580
|
+
}
|
|
581
|
+
catch (error) {
|
|
582
|
+
console.error('eSign Verify Cert Error:', error);
|
|
583
|
+
throw error;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
async listSignRequest(pageNumber = 1, pageSize = 10) {
|
|
587
|
+
const nativeModule = this.ensureNativeModule();
|
|
588
|
+
try {
|
|
589
|
+
const result = await nativeModule.listSignRequest(pageNumber, pageSize);
|
|
590
|
+
return result;
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
console.error('eSign List Sign Request Error:', error);
|
|
594
|
+
throw error;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
async confirmSign(signRequestId, pinCode, authId, authData, confirm = true) {
|
|
598
|
+
const nativeModule = this.ensureNativeModule();
|
|
599
|
+
try {
|
|
600
|
+
const result = await nativeModule.confirmSign(signRequestId, pinCode, authId || null, authData || null, confirm !== undefined ? confirm : true);
|
|
601
|
+
return result;
|
|
602
|
+
}
|
|
603
|
+
catch (error) {
|
|
604
|
+
console.error('eSign Confirm Sign Error:', error);
|
|
605
|
+
throw error;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
async authenticate(username, password) {
|
|
609
|
+
const nativeModule = this.ensureNativeModule();
|
|
610
|
+
try {
|
|
611
|
+
const result = await nativeModule.authenticate(username, password);
|
|
612
|
+
return result;
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
console.error('eSign Authenticate Error:', error);
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
async registerRemoteSigning(accessToken, requestJson) {
|
|
620
|
+
const nativeModule = this.ensureNativeModule();
|
|
621
|
+
try {
|
|
622
|
+
const result = await nativeModule.registerRemoteSigning(accessToken, requestJson);
|
|
623
|
+
return result;
|
|
624
|
+
}
|
|
625
|
+
catch (error) {
|
|
626
|
+
console.error('eSign Register Remote Signing Error:', error);
|
|
627
|
+
throw error;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
async signPdf(accessToken, requestJson) {
|
|
631
|
+
const nativeModule = this.ensureNativeModule();
|
|
632
|
+
try {
|
|
633
|
+
const result = await nativeModule.signPdf(accessToken, requestJson);
|
|
634
|
+
return result;
|
|
635
|
+
}
|
|
636
|
+
catch (error) {
|
|
637
|
+
console.error('eSign Sign PDF Error:', error);
|
|
638
|
+
throw error;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
async sendConfirmationDocument(accessToken, requestJson) {
|
|
642
|
+
const nativeModule = this.ensureNativeModule();
|
|
643
|
+
try {
|
|
644
|
+
const result = await nativeModule.sendConfirmationDocument(accessToken, requestJson);
|
|
645
|
+
return result;
|
|
646
|
+
}
|
|
647
|
+
catch (error) {
|
|
648
|
+
console.error('eSign Send Confirmation Document Error:', error);
|
|
649
|
+
throw error;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
// eSign Event Listeners
|
|
653
|
+
onESignInitSuccess(callback) {
|
|
654
|
+
try {
|
|
655
|
+
const emitter = this.ensureEventEmitter();
|
|
656
|
+
if (!emitter) {
|
|
657
|
+
console.error('❌ Event emitter not available for onESignInitSuccess');
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
const listener = emitter.addListener('onESignInitSuccess', callback);
|
|
661
|
+
this.listeners.push(listener);
|
|
662
|
+
return listener;
|
|
663
|
+
}
|
|
664
|
+
catch (error) {
|
|
665
|
+
console.error('Failed to add onESignInitSuccess listener:', error);
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
onESignOpenSessionSuccess(callback) {
|
|
670
|
+
try {
|
|
671
|
+
const emitter = this.ensureEventEmitter();
|
|
672
|
+
if (!emitter) {
|
|
673
|
+
console.error('❌ Event emitter not available for onESignOpenSessionSuccess');
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
const listener = emitter.addListener('onESignOpenSessionSuccess', callback);
|
|
677
|
+
this.listeners.push(listener);
|
|
678
|
+
return listener;
|
|
679
|
+
}
|
|
680
|
+
catch (error) {
|
|
681
|
+
console.error('Failed to add onESignOpenSessionSuccess listener:', error);
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
onESignRegisterDeviceSuccess(callback) {
|
|
686
|
+
try {
|
|
687
|
+
const emitter = this.ensureEventEmitter();
|
|
688
|
+
if (!emitter) {
|
|
689
|
+
console.error('❌ Event emitter not available for onESignRegisterDeviceSuccess');
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
const listener = emitter.addListener('onESignRegisterDeviceSuccess', callback);
|
|
693
|
+
this.listeners.push(listener);
|
|
694
|
+
return listener;
|
|
695
|
+
}
|
|
696
|
+
catch (error) {
|
|
697
|
+
console.error('Failed to add onESignRegisterDeviceSuccess listener:', error);
|
|
698
|
+
return null;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
onESignListCertsSuccess(callback) {
|
|
702
|
+
try {
|
|
703
|
+
const emitter = this.ensureEventEmitter();
|
|
704
|
+
if (!emitter) {
|
|
705
|
+
console.error('❌ Event emitter not available for onESignListCertsSuccess');
|
|
706
|
+
return null;
|
|
707
|
+
}
|
|
708
|
+
const listener = emitter.addListener('onESignListCertsSuccess', callback);
|
|
709
|
+
this.listeners.push(listener);
|
|
710
|
+
return listener;
|
|
711
|
+
}
|
|
712
|
+
catch (error) {
|
|
713
|
+
console.error('Failed to add onESignListCertsSuccess listener:', error);
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
onESignVerifyCertSuccess(callback) {
|
|
718
|
+
try {
|
|
719
|
+
const emitter = this.ensureEventEmitter();
|
|
720
|
+
if (!emitter) {
|
|
721
|
+
console.error('❌ Event emitter not available for onESignVerifyCertSuccess');
|
|
722
|
+
return null;
|
|
723
|
+
}
|
|
724
|
+
const listener = emitter.addListener('onESignVerifyCertSuccess', callback);
|
|
725
|
+
this.listeners.push(listener);
|
|
726
|
+
return listener;
|
|
727
|
+
}
|
|
728
|
+
catch (error) {
|
|
729
|
+
console.error('Failed to add onESignVerifyCertSuccess listener:', error);
|
|
730
|
+
return null;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
onESignListSignRequestSuccess(callback) {
|
|
734
|
+
try {
|
|
735
|
+
const emitter = this.ensureEventEmitter();
|
|
736
|
+
if (!emitter) {
|
|
737
|
+
console.error('❌ Event emitter not available for onESignListSignRequestSuccess');
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
const listener = emitter.addListener('onESignListSignRequestSuccess', callback);
|
|
741
|
+
this.listeners.push(listener);
|
|
742
|
+
return listener;
|
|
743
|
+
}
|
|
744
|
+
catch (error) {
|
|
745
|
+
console.error('Failed to add onESignListSignRequestSuccess listener:', error);
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
onESignConfirmSignSuccess(callback) {
|
|
750
|
+
try {
|
|
751
|
+
const emitter = this.ensureEventEmitter();
|
|
752
|
+
if (!emitter) {
|
|
753
|
+
console.error('❌ Event emitter not available for onESignConfirmSignSuccess');
|
|
754
|
+
return null;
|
|
755
|
+
}
|
|
756
|
+
const listener = emitter.addListener('onESignConfirmSignSuccess', callback);
|
|
757
|
+
this.listeners.push(listener);
|
|
758
|
+
return listener;
|
|
759
|
+
}
|
|
760
|
+
catch (error) {
|
|
761
|
+
console.error('Failed to add onESignConfirmSignSuccess listener:', error);
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
onESignAuthenticateSuccess(callback) {
|
|
766
|
+
try {
|
|
767
|
+
const emitter = this.ensureEventEmitter();
|
|
768
|
+
if (!emitter) {
|
|
769
|
+
console.error('❌ Event emitter not available for onESignAuthenticateSuccess');
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
const listener = emitter.addListener('onESignAuthenticateSuccess', callback);
|
|
773
|
+
this.listeners.push(listener);
|
|
774
|
+
return listener;
|
|
775
|
+
}
|
|
776
|
+
catch (error) {
|
|
777
|
+
console.error('Failed to add onESignAuthenticateSuccess listener:', error);
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
onESignRegisterRemoteSigningSuccess(callback) {
|
|
782
|
+
try {
|
|
783
|
+
const emitter = this.ensureEventEmitter();
|
|
784
|
+
if (!emitter) {
|
|
785
|
+
console.error('❌ Event emitter not available for onESignRegisterRemoteSigningSuccess');
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
const listener = emitter.addListener('onESignRegisterRemoteSigningSuccess', callback);
|
|
789
|
+
this.listeners.push(listener);
|
|
790
|
+
return listener;
|
|
791
|
+
}
|
|
792
|
+
catch (error) {
|
|
793
|
+
console.error('Failed to add onESignRegisterRemoteSigningSuccess listener:', error);
|
|
794
|
+
return null;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
onESignSignPdfSuccess(callback) {
|
|
798
|
+
try {
|
|
799
|
+
const emitter = this.ensureEventEmitter();
|
|
800
|
+
if (!emitter) {
|
|
801
|
+
console.error('❌ Event emitter not available for onESignSignPdfSuccess');
|
|
802
|
+
return null;
|
|
803
|
+
}
|
|
804
|
+
const listener = emitter.addListener('onESignSignPdfSuccess', callback);
|
|
805
|
+
this.listeners.push(listener);
|
|
806
|
+
return listener;
|
|
807
|
+
}
|
|
808
|
+
catch (error) {
|
|
809
|
+
console.error('Failed to add onESignSignPdfSuccess listener:', error);
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
onESignSendConfirmationDocumentSuccess(callback) {
|
|
814
|
+
try {
|
|
815
|
+
const emitter = this.ensureEventEmitter();
|
|
816
|
+
if (!emitter) {
|
|
817
|
+
console.error('❌ Event emitter not available for onESignSendConfirmationDocumentSuccess');
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
const listener = emitter.addListener('onESignSendConfirmationDocumentSuccess', callback);
|
|
821
|
+
this.listeners.push(listener);
|
|
822
|
+
return listener;
|
|
823
|
+
}
|
|
824
|
+
catch (error) {
|
|
825
|
+
console.error('Failed to add onESignSendConfirmationDocumentSuccess listener:', error);
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
onESignError(callback) {
|
|
830
|
+
try {
|
|
831
|
+
const emitter = this.ensureEventEmitter();
|
|
832
|
+
if (!emitter) {
|
|
833
|
+
console.error('❌ Event emitter not available for onESignError');
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
const listener = emitter.addListener('onESignError', callback);
|
|
837
|
+
this.listeners.push(listener);
|
|
838
|
+
return listener;
|
|
839
|
+
}
|
|
840
|
+
catch (error) {
|
|
841
|
+
console.error('Failed to add onESignError listener:', error);
|
|
842
|
+
return null;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
254
845
|
// SdkEkycUI method
|
|
255
846
|
async startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig) {
|
|
256
847
|
if (!this.isInitialized) {
|
|
@@ -265,7 +856,8 @@ class SDKeKYC {
|
|
|
265
856
|
const optionConfigJson = optionConfig ? JSON.stringify(optionConfig) : '{}';
|
|
266
857
|
const appKeyConfigJson = JSON.stringify(appKeyConfig);
|
|
267
858
|
const styleConfigJson = styleConfig ? JSON.stringify(styleConfig) : '{}';
|
|
268
|
-
const
|
|
859
|
+
const nativeModule = this.ensureNativeModule();
|
|
860
|
+
const result = await nativeModule.startEkycUI(appKey, flowSDKJson, language, transactionId, optionConfigJson, appKeyConfigJson, styleConfigJson);
|
|
269
861
|
console.log('✅ SdkEkycUI started successfully');
|
|
270
862
|
return result;
|
|
271
863
|
}
|