@finos_sdk/sdk-ekyc 1.5.1 → 1.5.3

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/dist/index.js CHANGED
@@ -32,14 +32,10 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.OCR_USE_NEW_ID_DOCUMENT_2 = exports.OCR_USE_NEW_ID_DOCUMENT_1 = exports.OCR_FAKE_MRZ = exports.OCR_INVALID_GENDER_CODE = exports.OCR_INVALID_ID_CARD = exports.OCR_GLARE_ID_CARD = exports.OCR_BLURRY_ID_CARD = exports.OCR_CUT_CORNER_ID_CARD = exports.OCR_CANNOT_RECOGNIZE_PORTRAIT = exports.OCR_ID_CARD_FROM_OTHER_DEVICE = exports.OCR_NOT_ORIGINAL_ID_CARD = exports.OCR_MISSING_ID_CARD_PART = exports.OCR_CANNOT_GET_ISSUE_PLACE = exports.OCR_CANNOT_GET_GENDER = exports.OCR_CANNOT_GET_HOMETOWN = exports.OCR_CANNOT_GET_RESIDENCE = exports.OCR_CANNOT_GET_ISSUE_DATE = exports.OCR_CANNOT_GET_EXPIRY_DATE = exports.OCR_CANNOT_GET_BIRTH_YEAR = exports.OCR_CANNOT_GET_NAME = exports.OCR_CANNOT_GET_ID_NUMBER = exports.OCR_WRONG_ID_CARD_SIDE = exports.OCR_UNRECOGNIZED_ID_CARD = exports.SDK_MISS_KEY = exports.ERROR_UNKNOWN = exports.SDK_START_ERROR = exports.SDK_START_FLOW_ERROR = exports.getMessage = exports.getErrorResultFromDetails = exports.createCustom = exports.fromCode = exports.getLocalizedMessage = exports.parseNfcResponse = exports.AuthorizationStatus = exports.AppIDType = exports.getEkycError = exports.EKYCErrorEvent = exports.EKYCEvent = exports.customActionsToStrings = exports.SDK_LIVENESS_ACTIONS = exports.SDKFaceDetectStatus = exports.flowToStrings = exports.SDK_FLOW_OPTIONS = exports.SDKFlowType = exports.FinosESignModule = exports.FinosESign = exports.FinosEKYCModule = exports.FinosEKYC = exports.SDKeKYC = exports.sdkEKYC = void 0;
40
- exports.ESIGN_INVALID_USER_ACCOUNT = exports.ESIGN_APP_LIMITED = exports.ESIGN_DEVICE_NOT_INIT = exports.ESIGN_INVALID_LICENSE_CONTENT = exports.ESIGN_INVALID_LICENSE = exports.ESIGN_DEVICE_ALREADY_INIT = exports.ESIGN_SESSION_INVALID = exports.FETCH_HISTORY_ERROR = exports.QRCODE_ERROR = exports.SMS_OTP_RATE_LIMIT = exports.SMS_OTP_NOT_FOUND = exports.SMS_OTP_MAX_ATTEMPTS = exports.SMS_OTP_INVALID_PHONE = exports.SMS_OTP_ERROR = exports.NFC_CHIP_AUTH_FAILED = exports.NFC_USER_CANCEL = exports.NFC_UNKNOWN_ERROR = exports.NFC_IO_ERROR = exports.NFC_INVALID_MRZ_KEY = exports.NFC_CONNECTION_LOST = exports.NFC_MUTUAL_AUTH_FAILED = exports.C06_ERROR = exports.SCAN_NFC_ENABLE = exports.SCAN_NFC_CHECK = exports.SCAN_NFC_ERROR = exports.HEAD_IS_TURNED_IN_SELFIE = exports.NUDITY_DETECTED_IN_SELFIE = exports.READING_GLASSES_DETECTED_IN_SELFIE = exports.EYEWEAR_DETECTED_IN_SELFIE = exports.FACE_OCCLUDED_IN_SELFIE = exports.FACE_IS_BLURRED = exports.MASK_PRESENT_IN_SELFIE = exports.EYES_CLOSED_IN_SELFIE = exports.MULTIPLE_FACES_IN_SELFIE = exports.LIVENESS_FAIL = exports.LIVENESS_ERROR = exports.FACE_ERROR = exports.FACE_HAT_ERROR = exports.OCR_ERROR = exports.OCR_FONT_BACK_NOT_MATCH = exports.OCR_PHOTOCOPY_ID_CARD = exports.OCR_FAKE_PORTRAIT_DETECTED = exports.OCR_FAKE_CHARACTERS_DETECTED_2 = exports.OCR_FAKE_CHARACTERS_DETECTED_1 = exports.OCR_UNKNOWN_ID_NUMBER_LENGTH = exports.OCR_MODIFIED_BIRTH_DATE_DETECTED_CMND = exports.OCR_MODIFIED_SYMBOL_DETECTED_CMND = exports.OCR_FAKE_BIRTH_DATE_DETECTED_CMND = exports.OCR_FAKE_PORTRAIT_DETECTED_CMND = exports.OCR_FAKE_CHARACTERS_DETECTED_CMND = void 0;
41
- exports.SDK_NAME = exports.SDK_VERSION = exports.USER_CANCEL = exports.ESIGN_INVALID_PIN_CODE = exports.ESIGN_INVALID_RECOVERY_CODE = exports.ESIGN_INVALID_LICENSE_CODE = exports.ESIGN_INVALID_CONTEXT = exports.ESIGN_MISSING_REQUEST_ID = exports.ESIGN_MISSING_SERIAL = exports.ESIGN_MISSING_IDENTITY = exports.ESIGN_MISSING_ACCESS_TOKEN = exports.ESIGN_NO_SESSION_ID = exports.ESIGN_MISSING_CONFIRMATION_DOC = exports.ESIGN_MISSING_REQUEST_JSON = exports.ESIGN_MISSING_CCCD = exports.ESIGN_MISSING_TOKEN = exports.ESIGN_ERROR_UNKNOWN = exports.ESIGN_AUTH_REQUEST_EXISTS = exports.ESIGN_INVALID_CERT_FOR_AUTH = exports.ESIGN_INVALID_SIGN_COUNT_OR_TIME = exports.ESIGN_AUTH_EXISTS = exports.ESIGN_SESSION_INVALID_LIST_CERT = exports.ESIGN_INVALID_RECOVERY_OR_PIN = exports.ESIGN_SESSION_INVALID_REGISTER = void 0;
42
- const react_native_1 = require("react-native");
36
+ exports.OCR_USE_NEW_ID_DOCUMENT_1 = exports.OCR_FAKE_MRZ = exports.OCR_INVALID_GENDER_CODE = exports.OCR_INVALID_ID_CARD = exports.OCR_GLARE_ID_CARD = exports.OCR_BLURRY_ID_CARD = exports.OCR_CUT_CORNER_ID_CARD = exports.OCR_CANNOT_RECOGNIZE_PORTRAIT = exports.OCR_ID_CARD_FROM_OTHER_DEVICE = exports.OCR_NOT_ORIGINAL_ID_CARD = exports.OCR_MISSING_ID_CARD_PART = exports.OCR_CANNOT_GET_ISSUE_PLACE = exports.OCR_CANNOT_GET_GENDER = exports.OCR_CANNOT_GET_HOMETOWN = exports.OCR_CANNOT_GET_RESIDENCE = exports.OCR_CANNOT_GET_ISSUE_DATE = exports.OCR_CANNOT_GET_EXPIRY_DATE = exports.OCR_CANNOT_GET_BIRTH_YEAR = exports.OCR_CANNOT_GET_NAME = exports.OCR_CANNOT_GET_ID_NUMBER = exports.OCR_WRONG_ID_CARD_SIDE = exports.OCR_UNRECOGNIZED_ID_CARD = exports.SDK_MISS_KEY = exports.ERROR_UNKNOWN = exports.SDK_START_ERROR = exports.SDK_START_FLOW_ERROR = exports.getMessage = exports.getErrorResultFromDetails = exports.createCustom = exports.fromCode = exports.getLocalizedMessage = exports.parseNfcResponse = exports.AuthorizationStatus = exports.ExitConfirmGradientOrientation = exports.AppIDType = exports.getEkycError = exports.EKYCErrorEvent = exports.EKYCEvent = exports.customActionsToStrings = exports.SDK_LIVENESS_ACTIONS = exports.SDKFaceDetectStatus = exports.flowToStrings = exports.SDK_FLOW_OPTIONS = exports.SDKFlowType = exports.FinosESignModule = exports.FinosESign = exports.FinosEKYCModule = exports.FinosEKYC = exports.SDKeKYC = exports.sdkEKYC = void 0;
37
+ exports.ESIGN_APP_LIMITED = exports.ESIGN_DEVICE_NOT_INIT = exports.ESIGN_INVALID_LICENSE_CONTENT = exports.ESIGN_INVALID_LICENSE = exports.ESIGN_DEVICE_ALREADY_INIT = exports.ESIGN_SESSION_INVALID = exports.FETCH_HISTORY_ERROR = exports.QRCODE_ERROR = exports.SMS_OTP_RATE_LIMIT = exports.SMS_OTP_NOT_FOUND = exports.SMS_OTP_MAX_ATTEMPTS = exports.SMS_OTP_INVALID_PHONE = exports.SMS_OTP_ERROR = exports.NFC_CHIP_AUTH_FAILED = exports.NFC_USER_CANCEL = exports.NFC_UNKNOWN_ERROR = exports.NFC_IO_ERROR = exports.NFC_INVALID_MRZ_KEY = exports.NFC_CONNECTION_LOST = exports.NFC_MUTUAL_AUTH_FAILED = exports.C06_ERROR = exports.SCAN_NFC_ENABLE = exports.SCAN_NFC_CHECK = exports.SCAN_NFC_ERROR = exports.HEAD_IS_TURNED_IN_SELFIE = exports.NUDITY_DETECTED_IN_SELFIE = exports.READING_GLASSES_DETECTED_IN_SELFIE = exports.EYEWEAR_DETECTED_IN_SELFIE = exports.FACE_OCCLUDED_IN_SELFIE = exports.FACE_IS_BLURRED = exports.MASK_PRESENT_IN_SELFIE = exports.EYES_CLOSED_IN_SELFIE = exports.MULTIPLE_FACES_IN_SELFIE = exports.LIVENESS_FAIL = exports.LIVENESS_ERROR = exports.FACE_ERROR = exports.FACE_HAT_ERROR = exports.OCR_ERROR = exports.OCR_FONT_BACK_NOT_MATCH = exports.OCR_PHOTOCOPY_ID_CARD = exports.OCR_FAKE_PORTRAIT_DETECTED = exports.OCR_FAKE_CHARACTERS_DETECTED_2 = exports.OCR_FAKE_CHARACTERS_DETECTED_1 = exports.OCR_UNKNOWN_ID_NUMBER_LENGTH = exports.OCR_MODIFIED_BIRTH_DATE_DETECTED_CMND = exports.OCR_MODIFIED_SYMBOL_DETECTED_CMND = exports.OCR_FAKE_BIRTH_DATE_DETECTED_CMND = exports.OCR_FAKE_PORTRAIT_DETECTED_CMND = exports.OCR_FAKE_CHARACTERS_DETECTED_CMND = exports.OCR_USE_NEW_ID_DOCUMENT_2 = void 0;
38
+ exports.SDK_NAME = exports.SDK_VERSION = exports.USER_CANCEL = exports.ESIGN_INVALID_PIN_CODE = exports.ESIGN_INVALID_RECOVERY_CODE = exports.ESIGN_INVALID_LICENSE_CODE = exports.ESIGN_INVALID_CONTEXT = exports.ESIGN_MISSING_REQUEST_ID = exports.ESIGN_MISSING_SERIAL = exports.ESIGN_MISSING_IDENTITY = exports.ESIGN_MISSING_ACCESS_TOKEN = exports.ESIGN_NO_SESSION_ID = exports.ESIGN_MISSING_CONFIRMATION_DOC = exports.ESIGN_MISSING_REQUEST_JSON = exports.ESIGN_MISSING_CCCD = exports.ESIGN_MISSING_TOKEN = exports.ESIGN_ERROR_UNKNOWN = exports.ESIGN_AUTH_REQUEST_EXISTS = exports.ESIGN_INVALID_CERT_FOR_AUTH = exports.ESIGN_INVALID_SIGN_COUNT_OR_TIME = exports.ESIGN_AUTH_EXISTS = exports.ESIGN_SESSION_INVALID_LIST_CERT = exports.ESIGN_INVALID_RECOVERY_OR_PIN = exports.ESIGN_SESSION_INVALID_REGISTER = exports.ESIGN_INVALID_USER_ACCOUNT = void 0;
43
39
  const EKYCModule_1 = __importStar(require("./EKYCModule"));
44
40
  exports.sdkEKYC = EKYCModule_1.default;
45
41
  Object.defineProperty(exports, "SDKeKYC", { enumerable: true, get: function () { return EKYCModule_1.SDKeKYC; } });
@@ -51,9 +47,6 @@ Object.defineProperty(exports, "FinosEKYCModule", { enumerable: true, get: funct
51
47
  const FinosESignModule_1 = require("./src/modules/FinosESignModule");
52
48
  Object.defineProperty(exports, "FinosESign", { enumerable: true, get: function () { return FinosESignModule_1.FinosESign; } });
53
49
  Object.defineProperty(exports, "FinosESignModule", { enumerable: true, get: function () { return FinosESignModule_1.FinosESignModule; } });
54
- const ExitSheetWrapper_1 = __importDefault(require("./src/components/ExitSheetWrapper"));
55
- // Auto-register exit sheet wrapper — khách hàng không cần khai báo AppRegistry
56
- react_native_1.AppRegistry.registerComponent('SDKExitSheetWrapper', () => ExitSheetWrapper_1.default);
57
50
  console.log('✅ SDK modules loaded successfully');
58
51
  // Export main SDK instance and class (legacy)
59
52
  exports.default = EKYCModule_1.default;
@@ -73,6 +66,8 @@ Object.defineProperty(exports, "EKYCErrorEvent", { enumerable: true, get: functi
73
66
  var ekycType_1 = require("./src/types/ekycType");
74
67
  Object.defineProperty(exports, "getEkycError", { enumerable: true, get: function () { return ekycType_1.getEkycError; } });
75
68
  Object.defineProperty(exports, "AppIDType", { enumerable: true, get: function () { return ekycType_1.AppIDType; } });
69
+ var ekycExitConfirmType_1 = require("./src/types/ekycExitConfirmType");
70
+ Object.defineProperty(exports, "ExitConfirmGradientOrientation", { enumerable: true, get: function () { return ekycExitConfirmType_1.ExitConfirmGradientOrientation; } });
76
71
  var ekycESignType_1 = require("./src/types/ekycESignType");
77
72
  Object.defineProperty(exports, "AuthorizationStatus", { enumerable: true, get: function () { return ekycESignType_1.AuthorizationStatus; } });
78
73
  // Export utility functions
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos_sdk/sdk-ekyc",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "React Native SDK for eKYC - Vietnamese CCCD NFC reading, OCR, Liveness detection, Face matching, and C06, eSign, SmsOTP residence verification",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { SDK_VERSION, SDK_NAME } from '../../EKYCModule';
3
2
  import { NfcConfig } from '../types/ekycNFCType';
4
3
  import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError, AppIDType } from '../types/ekycType';
@@ -6,9 +5,10 @@ import { C06Config } from '../types/ekycC06Type';
6
5
  import { OcrConfig } from '../types/ekycOCRType';
7
6
  import { LivenessConfig, SDKFaceDetectStatus, LivenessSuccessEvent } from '../types/ekycLivenessType';
8
7
  import { FaceServiceConfig, FaceCompareSuccessEvent } from '../types/ekycFaceType';
9
- import { SmsOtpConfig, SmsOtpResult } from '../types/ekycSmsOtpType';
8
+ import { SmsOtpConfig, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
10
9
  import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
11
10
  import { SDKFlowType } from '../types/ekycFlowType';
11
+ import { ExitConfirmConfig } from '../types/ekycExitConfirmType';
12
12
  /**
13
13
  * Finos eKYC SDK Module
14
14
  *
@@ -77,8 +77,9 @@ export declare class FinosEKYCModule {
77
77
  * @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay vì string
78
78
  * @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
79
79
  * @param config.switchFrontCamera - Use front camera (default: false)
80
+ * @param exitConfirmConfig - Optional config tuỳ chỉnh bottom sheet xác nhận thoát. null = mặc định SDK.
80
81
  */
81
- startLiveness(config: LivenessConfig): Promise<LivenessSuccessEvent>;
82
+ startLiveness(config: LivenessConfig, exitConfirmConfig?: ExitConfirmConfig): Promise<LivenessSuccessEvent>;
82
83
  /**
83
84
  * Start face comparison (Face Service)
84
85
  * @param config Face service configuration
@@ -101,51 +102,6 @@ export declare class FinosEKYCModule {
101
102
  * Handle new intent (Android)
102
103
  */
103
104
  handleNewIntent(): void;
104
- /**
105
- * Register a custom exit confirmation handler to show UI in React Native instead of using native bottom sheet.
106
- */
107
- registerExitHandler(): Promise<boolean>;
108
- /**
109
- * Resolve the custom exit confirmation.
110
- * @param action 'CONFIRM' (exit SDK), 'CANCEL' or 'CLOSE' (stay in SDK)
111
- */
112
- resolveExit(action: 'CONFIRM' | 'CANCEL' | 'CLOSE'): Promise<boolean>;
113
- /**
114
- * Set custom component to render inside the exit bottom sheet.
115
- * Thay thế ExitConfirmSheet mặc định bằng component tùy chỉnh.
116
- * Không cần AppRegistry — SDK tự lo phần registration.
117
- *
118
- * @param component React component để hiển thị, hoặc null để về default
119
- *
120
- * @example
121
- * FinosEKYC.setExitSheetComponent(WarningBottomSheet);
122
- */
123
- setExitSheetComponent(component: React.ComponentType<any> | null): void;
124
- /**
125
- * Show the exit bottom sheet on top of the current SDK screen.
126
- * Mặc định dùng 'SDKExitSheetWrapper' (đã register sẵn trong SDK).
127
- *
128
- * @param props Props truyền vào component (optional)
129
- *
130
- * @example
131
- * // Dùng default ExitConfirmSheet
132
- * FinosEKYC.showRNExitSheet();
133
- *
134
- * // Dùng custom component (set trước bằng setExitSheetComponent)
135
- * FinosEKYC.setExitSheetComponent(WarningBottomSheet);
136
- * FinosEKYC.showRNExitSheet();
137
- */
138
- showRNExitSheet(props?: any): Promise<boolean>;
139
- /**
140
- * Show a native alert dialog on top of the current activity (useful for SDK screens)
141
- * @param config Dialog configuration { title, message, confirmText, cancelText }
142
- */
143
- showNativeExitDialog(config: {
144
- title?: string;
145
- message?: string;
146
- confirmText?: string;
147
- cancelText?: string;
148
- }): Promise<'CONFIRM' | 'CANCEL'>;
149
105
  /**
150
106
  * Listen for NFC scan start events
151
107
  */
@@ -200,11 +156,6 @@ export declare class FinosEKYCModule {
200
156
  * Listen for eKYC UI error events
201
157
  */
202
158
  onEkycUIError(callback: (error: any) => void): import("react-native").EmitterSubscription | null;
203
- /**
204
- * Listen for exit confirm events triggered by the SDK.
205
- * Call resolveExit('CONFIRM' | 'CANCEL' | 'CLOSE') after user chooses an action.
206
- */
207
- onShowExitConfirm(callback: () => void): import("react-native").EmitterSubscription | null;
208
159
  /**
209
160
  * Remove all event listeners
210
161
  */
@@ -213,20 +164,20 @@ export declare class FinosEKYCModule {
213
164
  * Send SMS OTP
214
165
  * @param config SMS OTP configuration
215
166
  */
216
- sendOtp(config: SmsOtpConfig): Promise<SmsOtpResult>;
167
+ sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
217
168
  /**
218
169
  * Verify SMS OTP
219
170
  * @param config SMS OTP configuration (must include requestId)
220
171
  * @param otpCode OTP code from SMS
221
172
  */
222
- verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<SmsOtpResult>;
173
+ verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
223
174
  /**
224
175
  * Resend SMS OTP
225
176
  * @param config SMS OTP configuration (must include requestId)
226
177
  */
227
- resendOtp(config: SmsOtpConfig): Promise<SmsOtpResult>;
228
- onSmsOtpSendSuccess(callback: (data: SmsOtpResult) => void): import("react-native").EmitterSubscription | null;
229
- onSmsOtpResendSuccess(callback: (data: SmsOtpResult) => void): import("react-native").EmitterSubscription | null;
178
+ resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
179
+ onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): import("react-native").EmitterSubscription | null;
180
+ onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): import("react-native").EmitterSubscription | null;
230
181
  /** Payload là EKYCError: { event, code, message }. */
231
182
  onSmsOtpError(callback: (error: EKYCError) => void): import("react-native").EmitterSubscription | null;
232
183
  /**
@@ -347,6 +298,8 @@ export declare class FinosEKYCModule {
347
298
  * @param appKeyConfig Optional app key configuration
348
299
  * @param optionConfig Optional configuration settings (includes switchFrontCamera for camera control)
349
300
  * @param styleConfig Optional style configuration
301
+ * @param exitConfirmConfig Optional config tuỳ chỉnh bottom sheet xác nhận thoát (icon, title, content, buttons).
302
+ * null = giữ default SDK. Xem EXIT_CONFIRM_CONFIG.md.
350
303
  */
351
304
  startEkycUI(appKey: string, flowSDK: SDKFlowType[], language: string, transactionId: string, appKeyConfig: {
352
305
  appKey: string;
@@ -409,7 +362,7 @@ export declare class FinosEKYCModule {
409
362
  };
410
363
  captureButtonColor?: number;
411
364
  captureButtonDisabledColor?: number;
412
- }): Promise<any>;
365
+ }, exitConfirmConfig?: ExitConfirmConfig): Promise<any>;
413
366
  private validateSDKReady;
414
367
  private validatePlatform;
415
368
  }
@@ -422,7 +375,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
422
375
  export type { FaceServiceConfig, FaceCompareError } from '../types/ekycFaceType';
423
376
  export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError } from '../types/ekycType';
424
377
  export { getEkycError, AppIDType } from '../types/ekycType';
425
- export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
378
+ export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
426
379
  export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
427
380
  export { SDK_VERSION, SDK_NAME };
428
381
  export default FinosEKYC;
@@ -38,7 +38,6 @@ const react_native_1 = require("react-native");
38
38
  const EKYCModule_1 = __importStar(require("../../EKYCModule"));
39
39
  Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return EKYCModule_1.SDK_VERSION; } });
40
40
  Object.defineProperty(exports, "SDK_NAME", { enumerable: true, get: function () { return EKYCModule_1.SDK_NAME; } });
41
- const ExitSheetWrapper_1 = require("../components/ExitSheetWrapper");
42
41
  const ekycFlowType_1 = require("../types/ekycFlowType");
43
42
  /**
44
43
  * Finos eKYC SDK Module
@@ -199,8 +198,9 @@ class FinosEKYCModule {
199
198
  * @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay vì string
200
199
  * @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
201
200
  * @param config.switchFrontCamera - Use front camera (default: false)
201
+ * @param exitConfirmConfig - Optional config tuỳ chỉnh bottom sheet xác nhận thoát. null = mặc định SDK.
202
202
  */
203
- async startLiveness(config) {
203
+ async startLiveness(config, exitConfirmConfig) {
204
204
  this.validateSDKReady();
205
205
  try {
206
206
  console.log('👁️ Starting liveness detection...');
@@ -213,7 +213,10 @@ class FinosEKYCModule {
213
213
  else if (config.activeActionCount !== undefined) {
214
214
  console.log('🎲 Random actions count:', config.activeActionCount);
215
215
  }
216
- const result = await this.sdk.startLiveness(config);
216
+ if (exitConfirmConfig) {
217
+ console.log('🚪 ExitConfirmConfig:', exitConfirmConfig);
218
+ }
219
+ const result = await this.sdk.startLiveness(config, exitConfirmConfig);
217
220
  console.log('✅ Liveness detection completed:', result.event);
218
221
  react_native_1.DeviceEventEmitter.emit('onLivenessSuccess', {
219
222
  event: 'LIVENESS_SUCCESS',
@@ -283,87 +286,6 @@ class FinosEKYCModule {
283
286
  // Note: This method needs to be implemented in the native module
284
287
  console.log('📱 New intent handled');
285
288
  }
286
- // ==================== Exit Handler ====================
287
- /**
288
- * Register a custom exit confirmation handler to show UI in React Native instead of using native bottom sheet.
289
- */
290
- async registerExitHandler() {
291
- this.validateSDKReady();
292
- try {
293
- console.log('🔗 Registering custom exit handler...');
294
- return await this.sdk.registerExitHandler();
295
- }
296
- catch (error) {
297
- console.error('❌ Failed to register exit handler:', error);
298
- throw error;
299
- }
300
- }
301
- /**
302
- * Resolve the custom exit confirmation.
303
- * @param action 'CONFIRM' (exit SDK), 'CANCEL' or 'CLOSE' (stay in SDK)
304
- */
305
- async resolveExit(action) {
306
- this.validateSDKReady();
307
- try {
308
- console.log('🔙 Resolving exit action:', action);
309
- return await this.sdk.resolveExit(action);
310
- }
311
- catch (error) {
312
- console.error('❌ Failed to resolve exit:', error);
313
- throw error;
314
- }
315
- }
316
- /**
317
- * Set custom component to render inside the exit bottom sheet.
318
- * Thay thế ExitConfirmSheet mặc định bằng component tùy chỉnh.
319
- * Không cần AppRegistry — SDK tự lo phần registration.
320
- *
321
- * @param component React component để hiển thị, hoặc null để về default
322
- *
323
- * @example
324
- * FinosEKYC.setExitSheetComponent(WarningBottomSheet);
325
- */
326
- setExitSheetComponent(component) {
327
- (0, ExitSheetWrapper_1.setCustomExitComponent)(component);
328
- }
329
- /**
330
- * Show the exit bottom sheet on top of the current SDK screen.
331
- * Mặc định dùng 'SDKExitSheetWrapper' (đã register sẵn trong SDK).
332
- *
333
- * @param props Props truyền vào component (optional)
334
- *
335
- * @example
336
- * // Dùng default ExitConfirmSheet
337
- * FinosEKYC.showRNExitSheet();
338
- *
339
- * // Dùng custom component (set trước bằng setExitSheetComponent)
340
- * FinosEKYC.setExitSheetComponent(WarningBottomSheet);
341
- * FinosEKYC.showRNExitSheet();
342
- */
343
- async showRNExitSheet(props = {}) {
344
- this.validateSDKReady();
345
- try {
346
- return await this.sdk.showRNExitSheet('SDKExitSheetWrapper', props);
347
- }
348
- catch (error) {
349
- console.error('❌ Failed to show RN exit sheet:', error);
350
- throw error;
351
- }
352
- }
353
- /**
354
- * Show a native alert dialog on top of the current activity (useful for SDK screens)
355
- * @param config Dialog configuration { title, message, confirmText, cancelText }
356
- */
357
- async showNativeExitDialog(config) {
358
- this.validateSDKReady();
359
- try {
360
- return await this.sdk.showNativeExitDialog(config);
361
- }
362
- catch (error) {
363
- console.error('❌ Failed to show native exit dialog:', error);
364
- throw error;
365
- }
366
- }
367
289
  // ==================== Event Listeners ====================
368
290
  /**
369
291
  * Listen for NFC scan start events
@@ -445,13 +367,6 @@ class FinosEKYCModule {
445
367
  onEkycUIError(callback) {
446
368
  return this.sdk.onEkycUIError(callback);
447
369
  }
448
- /**
449
- * Listen for exit confirm events triggered by the SDK.
450
- * Call resolveExit('CONFIRM' | 'CANCEL' | 'CLOSE') after user chooses an action.
451
- */
452
- onShowExitConfirm(callback) {
453
- return this.sdk.onShowExitConfirm(callback);
454
- }
455
370
  /**
456
371
  * Remove all event listeners
457
372
  */
@@ -757,8 +672,10 @@ class FinosEKYCModule {
757
672
  * @param appKeyConfig Optional app key configuration
758
673
  * @param optionConfig Optional configuration settings (includes switchFrontCamera for camera control)
759
674
  * @param styleConfig Optional style configuration
675
+ * @param exitConfirmConfig Optional config tuỳ chỉnh bottom sheet xác nhận thoát (icon, title, content, buttons).
676
+ * null = giữ default SDK. Xem EXIT_CONFIRM_CONFIG.md.
760
677
  */
761
- async startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig) {
678
+ async startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig, exitConfirmConfig) {
762
679
  this.validateSDKReady();
763
680
  try {
764
681
  console.log('🚀 Starting eKYC UI with flow:', flowSDK);
@@ -768,7 +685,10 @@ class FinosEKYCModule {
768
685
  }
769
686
  console.log('🔑 AppKeyConfig:', appKeyConfig);
770
687
  console.log('🎨 StyleConfig:', styleConfig);
771
- const result = await this.sdk.startEkycUI(appKey, (0, ekycFlowType_1.flowToStrings)(flowSDK), language, transactionId, appKeyConfig, optionConfig, styleConfig);
688
+ if (exitConfirmConfig) {
689
+ console.log('🚪 ExitConfirmConfig:', exitConfirmConfig);
690
+ }
691
+ const result = await this.sdk.startEkycUI(appKey, (0, ekycFlowType_1.flowToStrings)(flowSDK), language, transactionId, appKeyConfig, optionConfig, styleConfig, exitConfirmConfig);
772
692
  console.log('✅ eKYC UI started successfully');
773
693
  return result;
774
694
  }
@@ -827,10 +747,7 @@ const isMethod = (prop) => {
827
747
  prop === 'startOcr' ||
828
748
  prop === 'startLiveness' ||
829
749
  prop === 'startFaceCompare' ||
830
- prop === 'registerExitHandler' ||
831
- prop === 'resolveExit' ||
832
- prop === 'showRNExitSheet' ||
833
- prop === 'setExitSheetComponent';
750
+ false;
834
751
  };
835
752
  // Create a comprehensive stub object with all methods to prevent undefined errors
836
753
  const createFinosEKYCStub = () => {
@@ -860,7 +777,6 @@ const createFinosEKYCStub = () => {
860
777
  'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
861
778
  'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
862
779
  'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
863
- 'registerExitHandler', 'resolveExit', 'showRNExitSheet', 'setExitSheetComponent',
864
780
  'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
865
781
  ];
866
782
  otherMethods.forEach(method => {
@@ -1,5 +1,5 @@
1
1
  import { SDK_VERSION, SDK_NAME } from '../../EKYCModule';
2
- import { SmsOtpConfig, SmsOtpResult } from '../types/ekycSmsOtpType';
2
+ import { SmsOtpConfig, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
3
3
  import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, AuthorizeInfo, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
4
4
  import { LivenessConfig, LivenessSuccessEvent } from '../types/ekycLivenessType';
5
5
  import { FaceServiceConfig, FaceCompareSuccessEvent } from '../types/ekycFaceType';
@@ -47,21 +47,21 @@ export declare class FinosESignModule {
47
47
  * Send SMS OTP
48
48
  * @param config SMS OTP configuration
49
49
  */
50
- sendOtp(config: SmsOtpConfig): Promise<SmsOtpResult>;
50
+ sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
51
51
  /**
52
52
  * Verify SMS OTP
53
53
  * @param config SMS OTP configuration (must include requestId)
54
54
  * @param otpCode OTP code from SMS
55
55
  */
56
- verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<SmsOtpResult>;
56
+ verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
57
57
  /**
58
58
  * Resend SMS OTP
59
59
  * @param config SMS OTP configuration (must include requestId)
60
60
  */
61
- resendOtp(config: SmsOtpConfig): Promise<SmsOtpResult>;
62
- onSmsOtpSendSuccess(callback: (data: SmsOtpResult) => void): import("react-native").EmitterSubscription | null;
63
- onSmsOtpVerifySuccess(callback: (data: SmsOtpResult) => void): import("react-native").EmitterSubscription | null;
64
- onSmsOtpResendSuccess(callback: (data: SmsOtpResult) => void): import("react-native").EmitterSubscription | null;
61
+ resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
62
+ onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): import("react-native").EmitterSubscription | null;
63
+ onSmsOtpVerifySuccess(callback: (data: VerifyOtpResponse) => void): import("react-native").EmitterSubscription | null;
64
+ onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): import("react-native").EmitterSubscription | null;
65
65
  /** Payload là EKYCError: { event, code, message }. */
66
66
  onSmsOtpError(callback: (error: EKYCError) => void): import("react-native").EmitterSubscription | null;
67
67
  /**
@@ -329,7 +329,7 @@ export declare class FinosESignModule {
329
329
  private validateSDKReady;
330
330
  }
331
331
  export declare const FinosESign: FinosESignModule;
332
- export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
332
+ export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
333
333
  export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult, AuthorizeInfo, ESignApiResponse } from '../types/ekycESignType';
334
334
  export type { LivenessConfig, LivenessError } from '../types/ekycLivenessType';
335
335
  export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
@@ -0,0 +1,115 @@
1
+ /**
2
+ * ExitConfirmConfig — bottom sheet xác nhận thoát khi user nhấn back trong liveness.
3
+ * Map 1-1 với native ExitConfirmConfig (sdkcore 1.5.2+).
4
+ *
5
+ * Mọi field đều optional — null/undefined = giữ giá trị mặc định của SDK.
6
+ * Xem EXIT_CONFIRM_CONFIG.md để biết chi tiết và giá trị mặc định.
7
+ */
8
+ /** Hướng gradient cho ViewStyle.backgroundGradient*. Map android.graphics.drawable.GradientDrawable.Orientation. */
9
+ export declare enum ExitConfirmGradientOrientation {
10
+ LEFT_RIGHT = "LEFT_RIGHT",
11
+ RIGHT_LEFT = "RIGHT_LEFT",
12
+ TOP_BOTTOM = "TOP_BOTTOM",
13
+ BOTTOM_TOP = "BOTTOM_TOP",
14
+ TL_BR = "TL_BR",
15
+ TR_BL = "TR_BL",
16
+ BL_TR = "BL_TR",
17
+ BR_TL = "BR_TL"
18
+ }
19
+ /** Text style cho title/content/button label. */
20
+ export interface ExitConfirmTextStyles {
21
+ /** Hex màu chữ, vd "#1A1A1A" hoặc "#FF1A1A1A". */
22
+ textColor?: string;
23
+ /** Cỡ chữ đơn vị sp. */
24
+ textSize?: number;
25
+ /** Tên font resource trong res/font/, vd "inter_medium". */
26
+ textFont?: string;
27
+ /** 0 Normal · 1 Bold · 2 Italic · 3 Bold+Italic. */
28
+ textStyle?: number;
29
+ /** android.view.Gravity flag, vd Gravity.CENTER = 17. */
30
+ textAlign?: number;
31
+ }
32
+ /** View style cho background, kích thước, margin, padding, bo góc của container/button. */
33
+ export interface ExitConfirmViewStyle {
34
+ /** Hex màu nền. Bị bỏ qua nếu set gradient. */
35
+ backgroundColor?: string;
36
+ /** Tối thiểu 2 màu hex cho gradient. */
37
+ backgroundGradientColors?: string[];
38
+ /**
39
+ * Vị trí [0.0–1.0] tương ứng từng màu (Android 10+).
40
+ * null = phân bổ đều. Bắt buộc cùng size với backgroundGradientColors.
41
+ */
42
+ backgroundGradientPositions?: number[];
43
+ /** Hướng gradient. Mặc định LEFT_RIGHT. */
44
+ backgroundGradientOrientation?: ExitConfirmGradientOrientation;
45
+ /** dp — null = giữ constraint layout. */
46
+ width?: number;
47
+ /** dp. */
48
+ height?: number;
49
+ marginTop?: number;
50
+ marginBottom?: number;
51
+ marginStart?: number;
52
+ marginEnd?: number;
53
+ paddingTop?: number;
54
+ paddingBottom?: number;
55
+ paddingStart?: number;
56
+ paddingEnd?: number;
57
+ /** android.view.Gravity flag cho nội dung bên trong. */
58
+ gravity?: number;
59
+ /** Bo góc dp. 100f = pill shape. */
60
+ cornerRadius?: number;
61
+ }
62
+ /**
63
+ * Icon phía trên bottom sheet.
64
+ * Native field `icon: Int?` là R.drawable resource ID — RN không truy cập trực tiếp được.
65
+ * Truyền `iconResName` (vd "ic_warning") để native resolve qua getIdentifier().
66
+ * Bỏ qua / null = dùng icon mặc định SDK (ic_bell).
67
+ */
68
+ export interface ExitConfirmIconProps {
69
+ /** Tên drawable resource trong res/drawable/. null/omitted = icon mặc định SDK. */
70
+ iconResName?: string;
71
+ iconViewStyle?: ExitConfirmViewStyle;
72
+ }
73
+ export interface ExitConfirmTitleProps {
74
+ title?: string;
75
+ titleStyles?: ExitConfirmTextStyles;
76
+ }
77
+ export interface ExitConfirmContentProps {
78
+ content?: string;
79
+ contentStyles?: ExitConfirmTextStyles;
80
+ }
81
+ export interface ExitConfirmButtonProps {
82
+ buttonTitle?: string;
83
+ buttonTextStyles?: ExitConfirmTextStyles;
84
+ buttonStyles?: ExitConfirmViewStyle;
85
+ }
86
+ /**
87
+ * Config bottom sheet xác nhận thoát. Truyền vào FinosEKYC.startEkycUI / startLiveness.
88
+ * Mọi field optional — null = SDK default.
89
+ *
90
+ * @example
91
+ * exitConfirmConfig: {
92
+ * titleProps: { title: "Thông báo" },
93
+ * contentProps: { content: "Quý khách muốn thoát?" },
94
+ * confirmButtonProps: {
95
+ * buttonTitle: "Có",
96
+ * buttonStyles: {
97
+ * backgroundGradientColors: ["#DA2128", "#F9A61C", "#FFDD00"],
98
+ * cornerRadius: 100,
99
+ * },
100
+ * },
101
+ * cancelButtonProps: {
102
+ * buttonTitle: "Không",
103
+ * buttonStyles: { backgroundColor: "#F3F4F6", cornerRadius: 100 },
104
+ * },
105
+ * }
106
+ */
107
+ export interface ExitConfirmConfig {
108
+ iconProps?: ExitConfirmIconProps;
109
+ titleProps?: ExitConfirmTitleProps;
110
+ contentProps?: ExitConfirmContentProps;
111
+ /** Nút xác nhận thoát (vd "Có") — chỉ nút này mới trigger callback thoát SDK. */
112
+ confirmButtonProps?: ExitConfirmButtonProps;
113
+ /** Nút huỷ (vd "Không") — đóng sheet, ở lại SDK. */
114
+ cancelButtonProps?: ExitConfirmButtonProps;
115
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * ExitConfirmConfig — bottom sheet xác nhận thoát khi user nhấn back trong liveness.
4
+ * Map 1-1 với native ExitConfirmConfig (sdkcore 1.5.2+).
5
+ *
6
+ * Mọi field đều optional — null/undefined = giữ giá trị mặc định của SDK.
7
+ * Xem EXIT_CONFIRM_CONFIG.md để biết chi tiết và giá trị mặc định.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ExitConfirmGradientOrientation = void 0;
11
+ /** Hướng gradient cho ViewStyle.backgroundGradient*. Map android.graphics.drawable.GradientDrawable.Orientation. */
12
+ var ExitConfirmGradientOrientation;
13
+ (function (ExitConfirmGradientOrientation) {
14
+ ExitConfirmGradientOrientation["LEFT_RIGHT"] = "LEFT_RIGHT";
15
+ ExitConfirmGradientOrientation["RIGHT_LEFT"] = "RIGHT_LEFT";
16
+ ExitConfirmGradientOrientation["TOP_BOTTOM"] = "TOP_BOTTOM";
17
+ ExitConfirmGradientOrientation["BOTTOM_TOP"] = "BOTTOM_TOP";
18
+ ExitConfirmGradientOrientation["TL_BR"] = "TL_BR";
19
+ ExitConfirmGradientOrientation["TR_BL"] = "TR_BL";
20
+ ExitConfirmGradientOrientation["BL_TR"] = "BL_TR";
21
+ ExitConfirmGradientOrientation["BR_TL"] = "BR_TL";
22
+ })(ExitConfirmGradientOrientation || (exports.ExitConfirmGradientOrientation = ExitConfirmGradientOrientation = {}));
@@ -26,16 +26,10 @@ export interface SmsOtpConfig {
26
26
  /** SMS OTP error – dùng chung EKYCError (event, code, message). */
27
27
  export type SmsOtpError = import('./ekycType').EKYCError;
28
28
  /**
29
- * SMS OTP Success Result
29
+ * @deprecated Use SendOtpResponse, VerifyOtpResponse, or ResendOtpResponse instead.
30
30
  */
31
31
  export interface SmsOtpResult {
32
- /**
33
- * Event type
34
- */
35
32
  event: string;
36
- /**
37
- * Response data
38
- */
39
33
  data?: {
40
34
  requestId?: string;
41
35
  expiresIn?: string;
@@ -43,3 +37,30 @@ export interface SmsOtpResult {
43
37
  [key: string]: any;
44
38
  };
45
39
  }
40
+ interface BaseOtpResponse {
41
+ success?: boolean;
42
+ requestId?: string;
43
+ expiresIn?: number;
44
+ resendAfter?: number;
45
+ error?: string;
46
+ }
47
+ export interface SendOtpResponse extends BaseOtpResponse {
48
+ }
49
+ export interface VerifyOtpResponse {
50
+ success?: boolean;
51
+ verified?: boolean;
52
+ verifiedAt?: string;
53
+ attemptsRemaining?: number;
54
+ error?: string;
55
+ }
56
+ export interface ResendOtpResponse extends BaseOtpResponse {
57
+ attemptsRemaining?: number;
58
+ statusCode?: number;
59
+ errorCode?: string;
60
+ message?: string;
61
+ retryAfter?: number;
62
+ retryAt?: string;
63
+ cooldownSeconds?: number;
64
+ elapsedSeconds?: number;
65
+ }
66
+ export {};
@@ -0,0 +1,2 @@
1
+ export NODE_BINARY=/opt/homebrew/bin/node
2
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos_sdk/sdk-ekyc",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "React Native SDK for eKYC - Vietnamese CCCD NFC reading, OCR, Liveness detection, Face matching, and C06, eSign, SmsOTP residence verification",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",