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