@finos_sdk/sdk-ekyc 1.2.1 → 1.2.8

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.
Files changed (98) hide show
  1. package/LICENSE +13 -10
  2. package/README.md +41 -42
  3. package/android/build.gradle +53 -20
  4. package/android/gradle.properties +7 -1
  5. package/android/settings.gradle +53 -0
  6. package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +790 -82
  7. package/dist/EKYCModule.d.ts +72 -0
  8. package/dist/EKYCModule.js +650 -71
  9. package/dist/finos_sdk-sdk-ekyc-1.2.8.tgz +0 -0
  10. package/dist/index.d.ts +6 -1
  11. package/dist/index.js +5 -1
  12. package/dist/package.json +31 -21
  13. package/dist/src/modules/FinosEKYCModule.d.ts +147 -2
  14. package/dist/src/modules/FinosEKYCModule.js +476 -4
  15. package/dist/src/modules/FinosESignModule.d.ts +270 -0
  16. package/dist/src/modules/FinosESignModule.js +752 -0
  17. package/dist/src/types/ekycESignType.d.ts +67 -0
  18. package/dist/src/types/ekycESignType.js +2 -0
  19. package/dist/src/types/ekycLivenessType.d.ts +1 -0
  20. package/dist/src/types/ekycSmsOtpType.d.ts +52 -0
  21. package/dist/src/types/ekycSmsOtpType.js +2 -0
  22. package/package.json +31 -21
  23. package/src/modules/FinosEKYCModule.ts +563 -4
  24. package/src/modules/FinosESignModule.ts +919 -0
  25. package/src/modules/README.md +3 -3
  26. package/src/types/ekycESignType.ts +76 -0
  27. package/src/types/ekycLivenessType.ts +1 -0
  28. package/src/types/ekycSmsOtpType.ts +59 -0
  29. package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.0/c06-1.2.0-javadoc.jar +0 -0
  30. package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.0/c06-1.2.0-sources.jar +0 -0
  31. package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.0/c06-1.2.0.aar +0 -0
  32. package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.0/c06-1.2.0.module +0 -130
  33. package/android/SDKeKYC/finos/sdk/ekyc/c06/1.2.0/c06-1.2.0.pom +0 -37
  34. package/android/SDKeKYC/finos/sdk/ekyc/c06/maven-metadata-local.xml +0 -13
  35. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.0/ekyc-1.2.0-javadoc.jar +0 -0
  36. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.0/ekyc-1.2.0-sources.jar +0 -0
  37. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.0/ekyc-1.2.0.aar +0 -0
  38. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.0/ekyc-1.2.0.module +0 -221
  39. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/1.2.0/ekyc-1.2.0.pom +0 -73
  40. package/android/SDKeKYC/finos/sdk/ekyc/ekyc/maven-metadata-local.xml +0 -13
  41. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.0/ekycui-1.2.0-javadoc.jar +0 -0
  42. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.0/ekycui-1.2.0-sources.jar +0 -0
  43. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.0/ekycui-1.2.0.aar +0 -0
  44. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.0/ekycui-1.2.0.module +0 -151
  45. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/1.2.0/ekycui-1.2.0.pom +0 -43
  46. package/android/SDKeKYC/finos/sdk/ekyc/ekycui/maven-metadata-local.xml +0 -13
  47. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.0/faceservice-1.2.0-javadoc.jar +0 -0
  48. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.0/faceservice-1.2.0-sources.jar +0 -0
  49. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.0/faceservice-1.2.0.aar +0 -0
  50. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.0/faceservice-1.2.0.module +0 -130
  51. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/1.2.0/faceservice-1.2.0.pom +0 -37
  52. package/android/SDKeKYC/finos/sdk/ekyc/faceservice/maven-metadata-local.xml +0 -13
  53. package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.0/liveness-1.2.0-javadoc.jar +0 -0
  54. package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.0/liveness-1.2.0-sources.jar +0 -0
  55. package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.0/liveness-1.2.0.aar +0 -0
  56. package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.0/liveness-1.2.0.module +0 -158
  57. package/android/SDKeKYC/finos/sdk/ekyc/liveness/1.2.0/liveness-1.2.0.pom +0 -55
  58. package/android/SDKeKYC/finos/sdk/ekyc/liveness/maven-metadata-local.xml +0 -13
  59. package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.0/nfc-1.2.0-javadoc.jar +0 -0
  60. package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.0/nfc-1.2.0-sources.jar +0 -0
  61. package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.0/nfc-1.2.0.aar +0 -0
  62. package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.0/nfc-1.2.0.module +0 -151
  63. package/android/SDKeKYC/finos/sdk/ekyc/nfc/1.2.0/nfc-1.2.0.pom +0 -55
  64. package/android/SDKeKYC/finos/sdk/ekyc/nfc/maven-metadata-local.xml +0 -13
  65. package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.0/ocr-1.2.0-javadoc.jar +0 -0
  66. package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.0/ocr-1.2.0-sources.jar +0 -0
  67. package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.0/ocr-1.2.0.aar +0 -0
  68. package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.0/ocr-1.2.0.module +0 -144
  69. package/android/SDKeKYC/finos/sdk/ekyc/ocr/1.2.0/ocr-1.2.0.pom +0 -43
  70. package/android/SDKeKYC/finos/sdk/ekyc/ocr/maven-metadata-local.xml +0 -13
  71. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.0/qrcode-1.2.0-javadoc.jar +0 -0
  72. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.0/qrcode-1.2.0-sources.jar +0 -0
  73. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.0/qrcode-1.2.0.aar +0 -0
  74. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.0/qrcode-1.2.0.module +0 -158
  75. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/1.2.0/qrcode-1.2.0.pom +0 -55
  76. package/android/SDKeKYC/finos/sdk/ekyc/qrcode/maven-metadata-local.xml +0 -13
  77. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.0/sdkcore-1.2.0-javadoc.jar +0 -0
  78. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.0/sdkcore-1.2.0-sources.jar +0 -0
  79. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.0/sdkcore-1.2.0.aar +0 -0
  80. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.0/sdkcore-1.2.0.module +0 -361
  81. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/1.2.0/sdkcore-1.2.0.pom +0 -139
  82. package/android/SDKeKYC/finos/sdk/ekyc/sdkcore/maven-metadata-local.xml +0 -13
  83. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.0/sdkcorecamera-1.2.0-javadoc.jar +0 -0
  84. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.0/sdkcorecamera-1.2.0-sources.jar +0 -0
  85. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.0/sdkcorecamera-1.2.0.aar +0 -0
  86. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.0/sdkcorecamera-1.2.0.module +0 -221
  87. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/1.2.0/sdkcorecamera-1.2.0.pom +0 -85
  88. package/android/SDKeKYC/finos/sdk/ekyc/sdkcorecamera/maven-metadata-local.xml +0 -13
  89. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.0/sdkui-1.2.0-javadoc.jar +0 -0
  90. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.0/sdkui-1.2.0-sources.jar +0 -0
  91. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.0/sdkui-1.2.0.aar +0 -0
  92. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.0/sdkui-1.2.0.module +0 -228
  93. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/1.2.0/sdkui-1.2.0.pom +0 -103
  94. package/android/SDKeKYC/finos/sdk/ekyc/sdkui/maven-metadata-local.xml +0 -13
  95. package/android/src/main/AndroidManifest.xml +0 -22
  96. package/android/src/main/build.gradle +0 -31
  97. package/dist/App.d.ts +0 -3
  98. package/dist/App.js +0 -497
@@ -163,12 +163,15 @@ class FinosEKYCModule {
163
163
  }
164
164
  /**
165
165
  * Start liveness detection
166
- * @param config Liveness configuration
166
+ * @param config Liveness configuration (includes switchFrontCamera for camera control)
167
167
  */
168
168
  async startLiveness(config) {
169
169
  this.validateSDKReady();
170
170
  try {
171
171
  console.log('👁️ Starting liveness detection...');
172
+ if (config.switchFrontCamera !== undefined) {
173
+ console.log('📷 Front camera setting:', config.switchFrontCamera ? 'ON' : 'OFF');
174
+ }
172
175
  const result = await this.sdk.startLiveness(config);
173
176
  console.log('✅ Liveness detection completed:', result.event);
174
177
  return result;
@@ -307,14 +310,336 @@ class FinosEKYCModule {
307
310
  this.sdk.removeAllListeners();
308
311
  console.log('🧹 All event listeners removed');
309
312
  }
313
+ // ==================== SMS OTP Methods ====================
314
+ /**
315
+ * Send SMS OTP
316
+ * @param config SMS OTP configuration
317
+ */
318
+ async sendOtp(config) {
319
+ this.validateSDKReady();
320
+ try {
321
+ console.log('📱 Sending SMS OTP...');
322
+ const result = await this.sdk.sendOtp(config);
323
+ console.log('✅ SMS OTP sent successfully');
324
+ return result;
325
+ }
326
+ catch (error) {
327
+ console.error('❌ SMS OTP send failed:', error);
328
+ throw error;
329
+ }
330
+ }
331
+ /**
332
+ * Verify SMS OTP
333
+ * @param config SMS OTP configuration (must include requestId)
334
+ * @param otpCode OTP code from SMS
335
+ */
336
+ async verifyOtp(config, otpCode) {
337
+ this.validateSDKReady();
338
+ try {
339
+ console.log('🔐 Verifying SMS OTP...');
340
+ const result = await this.sdk.verifyOtp(config, otpCode);
341
+ console.log('✅ SMS OTP verified successfully');
342
+ return result;
343
+ }
344
+ catch (error) {
345
+ console.error('❌ SMS OTP verification failed:', error);
346
+ throw error;
347
+ }
348
+ }
349
+ /**
350
+ * Resend SMS OTP
351
+ * @param config SMS OTP configuration (must include requestId)
352
+ */
353
+ async resendOtp(config) {
354
+ this.validateSDKReady();
355
+ try {
356
+ console.log('📱 Resending SMS OTP...');
357
+ const result = await this.sdk.resendOtp(config);
358
+ console.log('✅ SMS OTP resent successfully');
359
+ return result;
360
+ }
361
+ catch (error) {
362
+ console.error('❌ SMS OTP resend failed:', error);
363
+ throw error;
364
+ }
365
+ }
366
+ // SMS OTP Event Listeners
367
+ onSmsOtpSendSuccess(callback) {
368
+ const listener = this.sdk.onSmsOtpSendSuccess(callback);
369
+ if (!listener) {
370
+ console.warn('⚠️ onSmsOtpSendSuccess: Event emitter not ready. Make sure SDK is initialized.');
371
+ }
372
+ return listener;
373
+ }
374
+ onSmsOtpVerifySuccess(callback) {
375
+ const listener = this.sdk.onSmsOtpVerifySuccess(callback);
376
+ if (!listener) {
377
+ console.warn('⚠️ onSmsOtpVerifySuccess: Event emitter not ready.');
378
+ }
379
+ return listener;
380
+ }
381
+ onSmsOtpResendSuccess(callback) {
382
+ const listener = this.sdk.onSmsOtpResendSuccess(callback);
383
+ if (!listener) {
384
+ console.warn('⚠️ onSmsOtpResendSuccess: Event emitter not ready.');
385
+ }
386
+ return listener;
387
+ }
388
+ onSmsOtpError(callback) {
389
+ const listener = this.sdk.onSmsOtpError(callback);
390
+ if (!listener) {
391
+ console.warn('⚠️ onSmsOtpError: Event emitter not ready.');
392
+ }
393
+ return listener;
394
+ }
395
+ // ==================== eSign Methods ====================
396
+ /**
397
+ * Initialize eSign SDK
398
+ */
399
+ async initializeESign() {
400
+ this.validateSDKReady();
401
+ try {
402
+ console.log('🔐 Initializing eSign SDK...');
403
+ const result = await this.sdk.initializeESign();
404
+ console.log('✅ eSign SDK initialized successfully');
405
+ return result;
406
+ }
407
+ catch (error) {
408
+ console.error('❌ eSign initialization failed:', error);
409
+ throw error;
410
+ }
411
+ }
412
+ /**
413
+ * Open eSign session
414
+ * @param accessToken JWT access token (optional if using userEsignModel)
415
+ * @param username Optional username
416
+ * @param rememberMe Remember session
417
+ * @param userEsignModel User info for auto token creation (optional if using accessToken)
418
+ * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
419
+ */
420
+ async openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath) {
421
+ this.validateSDKReady();
422
+ try {
423
+ console.log('🔓 Opening eSign session...');
424
+ const result = await this.sdk.openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath);
425
+ console.log('✅ eSign session opened successfully');
426
+ return result;
427
+ }
428
+ catch (error) {
429
+ console.error('❌ eSign session open failed:', error);
430
+ throw error;
431
+ }
432
+ }
433
+ /**
434
+ * Register device for eSign
435
+ * @param recoverCode 8-digit recovery code
436
+ * @param pinCode 6-digit PIN code
437
+ * @param fcmToken Optional FCM token
438
+ */
439
+ async registerDevice(recoverCode, pinCode, fcmToken) {
440
+ this.validateSDKReady();
441
+ try {
442
+ console.log('📱 Registering eSign device...');
443
+ const result = await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
444
+ console.log('✅ eSign device registered successfully');
445
+ return result;
446
+ }
447
+ catch (error) {
448
+ console.error('❌ eSign device registration failed:', error);
449
+ throw error;
450
+ }
451
+ }
452
+ /**
453
+ * List eSign certificates
454
+ * @param pageNumber Page number (default: 1)
455
+ * @param pageSize Page size (default: 10)
456
+ */
457
+ async listCerts(pageNumber = 1, pageSize = 10) {
458
+ this.validateSDKReady();
459
+ try {
460
+ console.log('📋 Listing eSign certificates...');
461
+ const result = await this.sdk.listCerts(pageNumber, pageSize);
462
+ console.log(`✅ Found ${result.certs.length} certificates`);
463
+ return result;
464
+ }
465
+ catch (error) {
466
+ console.error('❌ eSign list certificates failed:', error);
467
+ throw error;
468
+ }
469
+ }
470
+ /**
471
+ * Verify eSign certificate
472
+ * @param serial Certificate serial number
473
+ */
474
+ async verifyCert(serial) {
475
+ this.validateSDKReady();
476
+ try {
477
+ console.log('✅ Verifying eSign certificate...');
478
+ const result = await this.sdk.verifyCert(serial);
479
+ console.log('✅ eSign certificate verified successfully');
480
+ return result;
481
+ }
482
+ catch (error) {
483
+ console.error('❌ eSign certificate verification failed:', error);
484
+ throw error;
485
+ }
486
+ }
487
+ /**
488
+ * List eSign sign requests
489
+ * @param pageNumber Page number (default: 1)
490
+ * @param pageSize Page size (default: 10)
491
+ */
492
+ async listSignRequest(pageNumber = 1, pageSize = 10) {
493
+ this.validateSDKReady();
494
+ try {
495
+ console.log('📋 Listing eSign sign requests...');
496
+ const result = await this.sdk.listSignRequest(pageNumber, pageSize);
497
+ console.log(`✅ Found ${result.requests.length} sign requests`);
498
+ return result;
499
+ }
500
+ catch (error) {
501
+ console.error('❌ eSign list sign requests failed:', error);
502
+ throw error;
503
+ }
504
+ }
505
+ /**
506
+ * Confirm eSign signature
507
+ * @param signRequestId Sign request ID
508
+ * @param pinCode 6-digit PIN code
509
+ * @param authId Optional auth ID
510
+ * @param authData Optional auth data
511
+ * @param confirm Confirm the signature (default: true)
512
+ */
513
+ async confirmSign(signRequestId, pinCode, authId, authData, confirm = true) {
514
+ this.validateSDKReady();
515
+ try {
516
+ console.log('✍️ Confirming eSign signature...');
517
+ const result = await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
518
+ console.log('✅ eSign signature confirmed successfully');
519
+ return result;
520
+ }
521
+ catch (error) {
522
+ console.error('❌ eSign signature confirmation failed:', error);
523
+ throw error;
524
+ }
525
+ }
526
+ /**
527
+ * Authenticate with eSign
528
+ * @param username eSign username
529
+ * @param password eSign password
530
+ */
531
+ async authenticate(username, password) {
532
+ this.validateSDKReady();
533
+ try {
534
+ console.log('🔐 Authenticating with eSign...');
535
+ const result = await this.sdk.authenticate(username, password);
536
+ console.log('✅ eSign authentication successful');
537
+ return result;
538
+ }
539
+ catch (error) {
540
+ console.error('❌ eSign authentication failed:', error);
541
+ throw error;
542
+ }
543
+ }
544
+ /**
545
+ * Register remote signing certificate
546
+ * @param accessToken JWT access token
547
+ * @param requestJson JSON request body
548
+ */
549
+ async registerRemoteSigning(accessToken, requestJson) {
550
+ this.validateSDKReady();
551
+ try {
552
+ console.log('📝 Registering remote signing certificate...');
553
+ const result = await this.sdk.registerRemoteSigning(accessToken, requestJson);
554
+ console.log('✅ Remote signing certificate registered successfully');
555
+ return result;
556
+ }
557
+ catch (error) {
558
+ console.error('❌ Remote signing certificate registration failed:', error);
559
+ throw error;
560
+ }
561
+ }
562
+ /**
563
+ * Sign PDF document
564
+ * @param accessToken JWT access token
565
+ * @param requestJson JSON request body
566
+ */
567
+ async signPdf(accessToken, requestJson) {
568
+ this.validateSDKReady();
569
+ try {
570
+ console.log('📄 Signing PDF document...');
571
+ const result = await this.sdk.signPdf(accessToken, requestJson);
572
+ console.log('✅ PDF document signed successfully');
573
+ return result;
574
+ }
575
+ catch (error) {
576
+ console.error('❌ PDF document signing failed:', error);
577
+ throw error;
578
+ }
579
+ }
580
+ /**
581
+ * Send confirmation document
582
+ * @param accessToken JWT access token
583
+ * @param requestJson JSON string containing request data
584
+ */
585
+ async sendConfirmationDocument(accessToken, requestJson) {
586
+ this.validateSDKReady();
587
+ try {
588
+ console.log('📧 Sending confirmation document...');
589
+ const result = await this.sdk.sendConfirmationDocument(accessToken, requestJson);
590
+ console.log('✅ Confirmation document sent successfully');
591
+ return result;
592
+ }
593
+ catch (error) {
594
+ console.error('❌ Confirmation document sending failed:', error);
595
+ throw error;
596
+ }
597
+ }
598
+ // eSign Event Listeners
599
+ onESignInitSuccess(callback) {
600
+ return this.sdk.onESignInitSuccess(callback);
601
+ }
602
+ onESignOpenSessionSuccess(callback) {
603
+ return this.sdk.onESignOpenSessionSuccess(callback);
604
+ }
605
+ onESignRegisterDeviceSuccess(callback) {
606
+ return this.sdk.onESignRegisterDeviceSuccess(callback);
607
+ }
608
+ onESignListCertsSuccess(callback) {
609
+ return this.sdk.onESignListCertsSuccess(callback);
610
+ }
611
+ onESignVerifyCertSuccess(callback) {
612
+ return this.sdk.onESignVerifyCertSuccess(callback);
613
+ }
614
+ onESignListSignRequestSuccess(callback) {
615
+ return this.sdk.onESignListSignRequestSuccess(callback);
616
+ }
617
+ onESignConfirmSignSuccess(callback) {
618
+ return this.sdk.onESignConfirmSignSuccess(callback);
619
+ }
620
+ onESignAuthenticateSuccess(callback) {
621
+ return this.sdk.onESignAuthenticateSuccess(callback);
622
+ }
623
+ onESignRegisterRemoteSigningSuccess(callback) {
624
+ return this.sdk.onESignRegisterRemoteSigningSuccess(callback);
625
+ }
626
+ onESignSignPdfSuccess(callback) {
627
+ return this.sdk.onESignSignPdfSuccess(callback);
628
+ }
629
+ onESignSendConfirmationDocumentSuccess(callback) {
630
+ return this.sdk.onESignSendConfirmationDocumentSuccess(callback);
631
+ }
632
+ onESignError(callback) {
633
+ return this.sdk.onESignError(callback);
634
+ }
310
635
  /**
311
636
  * Start eKYC UI with flow (like MainActivity.kt)
312
637
  * @param appKey Main app key
313
638
  * @param flowSDK Array of SDK types
314
639
  * @param language Language code (vi/en)
315
640
  * @param transactionId Transaction ID
316
- * @param optionConfig Optional configuration settings
317
641
  * @param appKeyConfig Optional app key configuration
642
+ * @param optionConfig Optional configuration settings (includes switchFrontCamera for camera control)
318
643
  * @param styleConfig Optional style configuration
319
644
  */
320
645
  async startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig) {
@@ -322,6 +647,9 @@ class FinosEKYCModule {
322
647
  try {
323
648
  console.log('🚀 Starting eKYC UI with flow:', flowSDK);
324
649
  console.log('🔧 OptionConfig:', optionConfig);
650
+ if ((optionConfig === null || optionConfig === void 0 ? void 0 : optionConfig.switchFrontCamera) !== undefined) {
651
+ console.log('📷 Front camera setting:', optionConfig.switchFrontCamera ? 'ON' : 'OFF');
652
+ }
325
653
  console.log('🔑 AppKeyConfig:', appKeyConfig);
326
654
  console.log('🎨 StyleConfig:', styleConfig);
327
655
  const result = await this.sdk.startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig);
@@ -346,7 +674,151 @@ class FinosEKYCModule {
346
674
  }
347
675
  }
348
676
  exports.FinosEKYCModule = FinosEKYCModule;
349
- // Export singleton instance
350
- exports.FinosEKYC = FinosEKYCModule.getInstance();
677
+ // Export singleton instance - ensure it's always initialized
678
+ let _finosEKYCInstance = null;
679
+ const getFinosEKYCInstance = () => {
680
+ if (!_finosEKYCInstance) {
681
+ try {
682
+ _finosEKYCInstance = FinosEKYCModule.getInstance();
683
+ }
684
+ catch (error) {
685
+ console.error('Failed to initialize FinosEKYCModule:', error);
686
+ throw new Error('FinosEKYCModule initialization failed. Please check native module setup.');
687
+ }
688
+ }
689
+ return _finosEKYCInstance;
690
+ };
691
+ // Initialize immediately
692
+ try {
693
+ _finosEKYCInstance = FinosEKYCModule.getInstance();
694
+ }
695
+ catch (error) {
696
+ // Silent initialization - will be created on first access
697
+ }
698
+ // Helper to check if a property is a method on FinosEKYCModule
699
+ const isMethod = (prop) => {
700
+ if (typeof prop !== 'string')
701
+ return false;
702
+ // Check if it's a known method from the class
703
+ const prototype = FinosEKYCModule.prototype;
704
+ return typeof prototype[prop] === 'function' ||
705
+ prop.startsWith('on') ||
706
+ prop === 'initialize' ||
707
+ prop === 'startEkycUI' ||
708
+ prop === 'startNfcScan' ||
709
+ prop === 'checkC06' ||
710
+ prop === 'startOcr' ||
711
+ prop === 'startLiveness' ||
712
+ prop === 'startFaceCompare';
713
+ };
714
+ // Create a comprehensive stub object with all methods to prevent undefined errors
715
+ const createFinosEKYCStub = () => {
716
+ const stub = {};
717
+ // Add all event listener methods (on* methods)
718
+ const eventListenerMethods = [
719
+ 'onNfcScanStart', 'onNfcScanSuccess', 'onNfcError',
720
+ 'onC06Success', 'onC06Error',
721
+ 'onOCRSuccess', 'onOCRError',
722
+ 'onLivenessSuccess', 'onLivenessError',
723
+ 'onFaceCompareSuccess', 'onFaceCompareError',
724
+ 'onSmsOtpSendSuccess', 'onSmsOtpVerifySuccess', 'onSmsOtpResendSuccess', 'onSmsOtpError',
725
+ 'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
726
+ 'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
727
+ 'onESignConfirmSignSuccess', 'onESignAuthenticateSuccess', 'onESignRegisterRemoteSigningSuccess',
728
+ 'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError'
729
+ ];
730
+ eventListenerMethods.forEach(method => {
731
+ stub[method] = (callback) => {
732
+ console.warn(`⚠️ FinosEKYC.${method} called but module is not initialized`);
733
+ return null;
734
+ };
735
+ });
736
+ // Add all other methods
737
+ const otherMethods = [
738
+ 'initialize', 'startNfcScan', 'checkC06', 'startOCR', 'startLiveness', 'startFaceCompare',
739
+ 'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
740
+ 'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
741
+ 'authenticate', 'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
742
+ 'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
743
+ ];
744
+ otherMethods.forEach(method => {
745
+ stub[method] = async (...args) => {
746
+ console.warn(`⚠️ FinosEKYC.${method} called but module is not initialized`);
747
+ throw new Error(`FinosEKYC.${method} is not available. Module may not be initialized.`);
748
+ };
749
+ });
750
+ return stub;
751
+ };
752
+ // Create a safe wrapper using Proxy - ensure it's always an object
753
+ const createFinosEKYCProxy = () => {
754
+ try {
755
+ return new Proxy({}, {
756
+ get(_target, prop) {
757
+ try {
758
+ const instance = getFinosEKYCInstance();
759
+ const value = instance[prop];
760
+ if (typeof value === 'function') {
761
+ return value.bind(instance);
762
+ }
763
+ return value;
764
+ }
765
+ catch (error) {
766
+ console.warn(`⚠️ FinosEKYC.${String(prop)} is not available:`, error);
767
+ // Always return a function for methods to prevent "undefined" errors
768
+ if (isMethod(prop)) {
769
+ // For event listeners (on* methods), return a function that returns null
770
+ if (typeof prop === 'string' && prop.startsWith('on')) {
771
+ return (callback) => {
772
+ console.warn(`⚠️ FinosEKYC.${prop} called but module is not initialized`);
773
+ return null;
774
+ };
775
+ }
776
+ // For other methods, return a no-op async function
777
+ return async (...args) => {
778
+ console.warn(`⚠️ FinosEKYC.${String(prop)} called but module is not initialized`);
779
+ throw new Error(`FinosEKYC.${String(prop)} is not available. Module may not be initialized.`);
780
+ };
781
+ }
782
+ return undefined;
783
+ }
784
+ }
785
+ });
786
+ }
787
+ catch (error) {
788
+ console.error('❌ Failed to create FinosEKYC proxy:', error);
789
+ // Return a comprehensive stub object
790
+ return createFinosEKYCStub();
791
+ }
792
+ };
793
+ // Create a wrapper that always returns a valid object
794
+ // This ensures FinosEKYC is NEVER undefined and always has all methods
795
+ const createFinosEKYCWrapper = () => {
796
+ // Always start with stub to ensure all methods exist
797
+ const stub = createFinosEKYCStub();
798
+ const wrapper = Object.assign({}, stub);
799
+ // Try to get real instance and override methods
800
+ try {
801
+ const realInstance = getFinosEKYCInstance();
802
+ // Override with real instance methods
803
+ Object.getOwnPropertyNames(Object.getPrototypeOf(realInstance)).forEach(key => {
804
+ if (key !== 'constructor' && typeof realInstance[key] === 'function') {
805
+ wrapper[key] = (realInstance[key]).bind(realInstance);
806
+ }
807
+ });
808
+ // Also copy any own properties from real instance
809
+ Object.keys(realInstance).forEach(key => {
810
+ if (realInstance[key] !== undefined) {
811
+ wrapper[key] = realInstance[key];
812
+ }
813
+ });
814
+ }
815
+ catch (error) {
816
+ // If we can't get instance, wrapper already has all stub methods
817
+ // No need to do anything
818
+ }
819
+ return wrapper;
820
+ };
821
+ // Export - this ensures FinosEKYC is never undefined
822
+ exports.FinosEKYC = createFinosEKYCWrapper();
351
823
  // Default export
352
824
  exports.default = exports.FinosEKYC;