vesant-sdk 1.8.0-dev.2b9e28d → 1.8.0-dev.2d679f1
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/README.md +2 -2
- package/dist/{client-DUHC-68_.d.ts → client-BPALLldd.d.ts} +1 -1
- package/dist/{client-5q4whhGu.d.mts → client-_OhkfnyJ.d.mts} +1 -1
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +26 -9
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +26 -9
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +7 -6
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +7 -6
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +7 -6
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -6
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +57 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -168
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +37 -164
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +36 -165
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +218 -218
- package/dist/kyc/index.d.ts +218 -218
- package/dist/kyc/index.js +37 -164
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +36 -165
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +16 -114
- package/dist/react.d.ts +16 -114
- package/dist/react.js +8 -186
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +9 -184
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +16 -6
- package/dist/risk-profile/index.d.ts +16 -6
- package/dist/risk-profile/index.js +25 -8
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +25 -9
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +7 -6
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +7 -6
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +1 -1
- package/dist/tax/index.d.ts +1 -1
- package/dist/tax/index.js +7 -6
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +7 -6
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-BOFaMQxI.d.mts → types-DbvVph_0.d.mts} +45 -2
- package/dist/{types-UGyDl1fd.d.ts → types-qXamJr2q.d.ts} +45 -2
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-XDEhh9VN.mjs';
|
|
2
|
-
import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-
|
|
2
|
+
import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-_OhkfnyJ.mjs';
|
|
3
3
|
import { RiskProfileClient } from './risk-profile/index.mjs';
|
|
4
|
-
import { C as CustomerProfile } from './types-
|
|
5
|
-
import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult,
|
|
4
|
+
import { C as CustomerProfile, j as UpdateProfileResult } from './types-DbvVph_0.mjs';
|
|
5
|
+
import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
|
|
6
6
|
import React$1 from 'react';
|
|
7
7
|
import './client-q9fN8Hhf.mjs';
|
|
8
8
|
import './types-CBQRNL-l.mjs';
|
|
@@ -221,7 +221,13 @@ interface UseCustomerProfileResult {
|
|
|
221
221
|
loading: boolean;
|
|
222
222
|
error: Error | null;
|
|
223
223
|
fetchProfile: () => Promise<CustomerProfile>;
|
|
224
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Update the loaded profile. Resolves to the updated profile, or to a
|
|
226
|
+
* `ProfileUpdateHeldResponse` when the tenant holds a name / date of birth /
|
|
227
|
+
* address change behind KYC — narrow with `isProfileUpdateHeld`. The hook's
|
|
228
|
+
* `profile` state is updated either way (with the profile as stored).
|
|
229
|
+
*/
|
|
230
|
+
updateProfile: (updates: Partial<CustomerProfile>) => Promise<UpdateProfileResult>;
|
|
225
231
|
refresh: () => Promise<CustomerProfile>;
|
|
226
232
|
}
|
|
227
233
|
/**
|
|
@@ -300,45 +306,6 @@ declare function useCustomerProfile(client: RiskProfileClient, customerId: strin
|
|
|
300
306
|
* ```
|
|
301
307
|
*/
|
|
302
308
|
declare function useKycSubmission(client: KycClient, options?: UseKycSubmissionOptions): UseKycSubmissionResult;
|
|
303
|
-
/**
|
|
304
|
-
* React hook for managing KYC requests
|
|
305
|
-
*
|
|
306
|
-
* @param client - KycClient instance
|
|
307
|
-
* @param options - Hook options
|
|
308
|
-
* @returns KYC requests state and management methods
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```tsx
|
|
312
|
-
* function KycDashboard() {
|
|
313
|
-
* const {
|
|
314
|
-
* requests,
|
|
315
|
-
* total,
|
|
316
|
-
* loading,
|
|
317
|
-
* fetchRequests,
|
|
318
|
-
* updateStatus
|
|
319
|
-
* } = useKycRequests(client, {
|
|
320
|
-
* autoFetch: true,
|
|
321
|
-
* filters: { status: "pending" },
|
|
322
|
-
* pagination: { page: 1, page_size: 20 }
|
|
323
|
-
* });
|
|
324
|
-
*
|
|
325
|
-
* return (
|
|
326
|
-
* <div>
|
|
327
|
-
* <h2>{total} Pending KYC Requests</h2>
|
|
328
|
-
* {requests.map(req => (
|
|
329
|
-
* <KycCard
|
|
330
|
-
* key={req.id}
|
|
331
|
-
* request={req}
|
|
332
|
-
* onApprove={() => updateStatus(req.reference, "accepted", "Verified")}
|
|
333
|
-
* onReject={() => updateStatus(req.reference, "declined", "Invalid document")}
|
|
334
|
-
* />
|
|
335
|
-
* ))}
|
|
336
|
-
* </div>
|
|
337
|
-
* );
|
|
338
|
-
* }
|
|
339
|
-
* ```
|
|
340
|
-
*/
|
|
341
|
-
declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptions): UseKycRequestsResult;
|
|
342
309
|
/**
|
|
343
310
|
* React hook for managing KYC alerts
|
|
344
311
|
*
|
|
@@ -353,8 +320,7 @@ declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptio
|
|
|
353
320
|
* alerts,
|
|
354
321
|
* total,
|
|
355
322
|
* loading,
|
|
356
|
-
* fetchAlerts
|
|
357
|
-
* updateAlert
|
|
323
|
+
* fetchAlerts
|
|
358
324
|
* } = useKycAlerts(client, {
|
|
359
325
|
* autoFetch: true,
|
|
360
326
|
* filters: { status: ["pending", "in_progress"], risk: "critical" },
|
|
@@ -365,81 +331,17 @@ declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptio
|
|
|
365
331
|
* <div>
|
|
366
332
|
* <h2>{total} Critical Alerts</h2>
|
|
367
333
|
* {alerts.map(alert => (
|
|
368
|
-
* <AlertCard
|
|
369
|
-
* key={alert.id}
|
|
370
|
-
* alert={alert}
|
|
371
|
-
* onAssign={(userId) => updateAlert(alert.id, { assigned_for: userId, status: "in_progress" })}
|
|
372
|
-
* onResolve={() => updateAlert(alert.id, { status: "resolved", reason: "Verified" })}
|
|
373
|
-
* />
|
|
334
|
+
* <AlertCard key={alert.id} alert={alert} />
|
|
374
335
|
* ))}
|
|
375
336
|
* </div>
|
|
376
337
|
* );
|
|
377
338
|
* }
|
|
378
339
|
* ```
|
|
379
|
-
*/
|
|
380
|
-
declare function useKycAlerts(client: KycClient, options?: UseKycAlertsOptions): UseKycAlertsResult;
|
|
381
|
-
/**
|
|
382
|
-
* React hook for KYC overview statistics
|
|
383
|
-
*
|
|
384
|
-
* @param client - KycClient instance
|
|
385
|
-
* @param options - Hook options
|
|
386
|
-
* @returns KYC overview state
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* ```tsx
|
|
390
|
-
* function KycStats() {
|
|
391
|
-
* const { overview, loading, refresh } = useKycOverview(client, {
|
|
392
|
-
* autoFetch: true,
|
|
393
|
-
* fromDate: "2024-01-01T00:00:00Z",
|
|
394
|
-
* toDate: "2024-12-31T23:59:59Z"
|
|
395
|
-
* });
|
|
396
|
-
*
|
|
397
|
-
* if (loading) return <Spinner />;
|
|
398
|
-
*
|
|
399
|
-
* return (
|
|
400
|
-
* <div>
|
|
401
|
-
* <StatCard label="Total" value={overview?.total} />
|
|
402
|
-
* <StatCard label="Pending" value={overview?.pending} />
|
|
403
|
-
* <StatCard label="Approved" value={overview?.approved} />
|
|
404
|
-
* <StatCard label="Rejected" value={overview?.rejected} />
|
|
405
|
-
* <StatCard label="High Risk" value={overview?.high_risk} />
|
|
406
|
-
* </div>
|
|
407
|
-
* );
|
|
408
|
-
* }
|
|
409
|
-
* ```
|
|
410
|
-
*/
|
|
411
|
-
declare function useKycOverview(client: KycClient, options?: UseKycOverviewOptions): UseKycOverviewResult;
|
|
412
|
-
/**
|
|
413
|
-
* React hook for reading KYC preferences
|
|
414
|
-
*
|
|
415
|
-
* Preferences are managed in the Vesant console. The returned
|
|
416
|
-
* `updatePreferences` is deprecated: the platform exposes no update
|
|
417
|
-
* operation, so it always fails.
|
|
418
|
-
*
|
|
419
|
-
* @param client - KycClient instance
|
|
420
|
-
* @param autoFetch - Auto-fetch preferences on mount (default: true)
|
|
421
|
-
* @returns KYC preferences state and methods
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* ```tsx
|
|
425
|
-
* function PreferencesSummary() {
|
|
426
|
-
* const { preferences, loading, refresh } = useKycPreferences(client);
|
|
427
|
-
*
|
|
428
|
-
* if (loading) return <Spinner />;
|
|
429
340
|
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* <dt>Face verification required</dt>
|
|
433
|
-
* <dd>{String(preferences?.is_face_verification_required)}</dd>
|
|
434
|
-
* <dt>Required documents</dt>
|
|
435
|
-
* <dd>{preferences?.required_document_count}</dd>
|
|
436
|
-
* <button onClick={refresh}>Refresh</button>
|
|
437
|
-
* </dl>
|
|
438
|
-
* );
|
|
439
|
-
* }
|
|
440
|
-
* ```
|
|
341
|
+
* @remarks Console session only: the alert endpoints need a dashboard login
|
|
342
|
+
* token and fail with a tenant API key.
|
|
441
343
|
*/
|
|
442
|
-
declare function
|
|
344
|
+
declare function useKycAlerts(client: KycClient, options?: UseKycAlertsOptions): UseKycAlertsResult;
|
|
443
345
|
/**
|
|
444
346
|
* Convert a File to base64 string for document upload
|
|
445
347
|
*
|
|
@@ -632,4 +534,4 @@ interface FaceCaptureModalProps {
|
|
|
632
534
|
}
|
|
633
535
|
declare function FaceCaptureModal({ client, session, onComplete, onCancel, defaultDevice, renderQR, mediapipeAssetBasePath, }: Readonly<FaceCaptureModalProps>): React$1.ReactElement;
|
|
634
536
|
|
|
635
|
-
export { FaceCaptureModal, type FaceCaptureModalProps, type RunFlowResult, type UseCustomerProfileOptions, type UseCustomerProfileResult, UseGeolocationOptions, UseGeolocationResult, UseKycAlertsOptions, UseKycAlertsResult,
|
|
537
|
+
export { FaceCaptureModal, type FaceCaptureModalProps, type RunFlowResult, type UseCustomerProfileOptions, type UseCustomerProfileResult, UseGeolocationOptions, UseGeolocationResult, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult, UseLocationCaptureOptions, UseLocationCaptureResult, UseLocationRequestsOptions, UseLocationRequestsResult, type UseLoginVerificationOptions, type UseLoginVerificationResult, type UseRegistrationOptions, type UseRegistrationResult, type UseTransactionVerificationOptions, type UseTransactionVerificationResult, type VerifyFaceOptions, buildEventBasedFaceVerificationQrPayload, createDeviceFingerprint, fileToBase64, formatKycStatus, getBrowserInfo, getRiskColor, getStatusColor, isMobileDevice, isValidFileSize, isValidFileType, useCipherText, useCustomerProfile, useEventBasedFaceVerificationSubmission, useGeolocation, useKycAlerts, useKycSubmission, useLocationCapture, useLocationRequests, useLoginVerification, useRegistration, useTransactionVerification };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-BaUekQT8.js';
|
|
2
|
-
import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-
|
|
2
|
+
import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-BPALLldd.js';
|
|
3
3
|
import { RiskProfileClient } from './risk-profile/index.js';
|
|
4
|
-
import { C as CustomerProfile } from './types-
|
|
5
|
-
import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult,
|
|
4
|
+
import { C as CustomerProfile, j as UpdateProfileResult } from './types-qXamJr2q.js';
|
|
5
|
+
import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
|
|
6
6
|
import React$1 from 'react';
|
|
7
7
|
import './client-q9fN8Hhf.js';
|
|
8
8
|
import './types-CBQRNL-l.js';
|
|
@@ -221,7 +221,13 @@ interface UseCustomerProfileResult {
|
|
|
221
221
|
loading: boolean;
|
|
222
222
|
error: Error | null;
|
|
223
223
|
fetchProfile: () => Promise<CustomerProfile>;
|
|
224
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Update the loaded profile. Resolves to the updated profile, or to a
|
|
226
|
+
* `ProfileUpdateHeldResponse` when the tenant holds a name / date of birth /
|
|
227
|
+
* address change behind KYC — narrow with `isProfileUpdateHeld`. The hook's
|
|
228
|
+
* `profile` state is updated either way (with the profile as stored).
|
|
229
|
+
*/
|
|
230
|
+
updateProfile: (updates: Partial<CustomerProfile>) => Promise<UpdateProfileResult>;
|
|
225
231
|
refresh: () => Promise<CustomerProfile>;
|
|
226
232
|
}
|
|
227
233
|
/**
|
|
@@ -300,45 +306,6 @@ declare function useCustomerProfile(client: RiskProfileClient, customerId: strin
|
|
|
300
306
|
* ```
|
|
301
307
|
*/
|
|
302
308
|
declare function useKycSubmission(client: KycClient, options?: UseKycSubmissionOptions): UseKycSubmissionResult;
|
|
303
|
-
/**
|
|
304
|
-
* React hook for managing KYC requests
|
|
305
|
-
*
|
|
306
|
-
* @param client - KycClient instance
|
|
307
|
-
* @param options - Hook options
|
|
308
|
-
* @returns KYC requests state and management methods
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```tsx
|
|
312
|
-
* function KycDashboard() {
|
|
313
|
-
* const {
|
|
314
|
-
* requests,
|
|
315
|
-
* total,
|
|
316
|
-
* loading,
|
|
317
|
-
* fetchRequests,
|
|
318
|
-
* updateStatus
|
|
319
|
-
* } = useKycRequests(client, {
|
|
320
|
-
* autoFetch: true,
|
|
321
|
-
* filters: { status: "pending" },
|
|
322
|
-
* pagination: { page: 1, page_size: 20 }
|
|
323
|
-
* });
|
|
324
|
-
*
|
|
325
|
-
* return (
|
|
326
|
-
* <div>
|
|
327
|
-
* <h2>{total} Pending KYC Requests</h2>
|
|
328
|
-
* {requests.map(req => (
|
|
329
|
-
* <KycCard
|
|
330
|
-
* key={req.id}
|
|
331
|
-
* request={req}
|
|
332
|
-
* onApprove={() => updateStatus(req.reference, "accepted", "Verified")}
|
|
333
|
-
* onReject={() => updateStatus(req.reference, "declined", "Invalid document")}
|
|
334
|
-
* />
|
|
335
|
-
* ))}
|
|
336
|
-
* </div>
|
|
337
|
-
* );
|
|
338
|
-
* }
|
|
339
|
-
* ```
|
|
340
|
-
*/
|
|
341
|
-
declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptions): UseKycRequestsResult;
|
|
342
309
|
/**
|
|
343
310
|
* React hook for managing KYC alerts
|
|
344
311
|
*
|
|
@@ -353,8 +320,7 @@ declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptio
|
|
|
353
320
|
* alerts,
|
|
354
321
|
* total,
|
|
355
322
|
* loading,
|
|
356
|
-
* fetchAlerts
|
|
357
|
-
* updateAlert
|
|
323
|
+
* fetchAlerts
|
|
358
324
|
* } = useKycAlerts(client, {
|
|
359
325
|
* autoFetch: true,
|
|
360
326
|
* filters: { status: ["pending", "in_progress"], risk: "critical" },
|
|
@@ -365,81 +331,17 @@ declare function useKycRequests(client: KycClient, options?: UseKycRequestsOptio
|
|
|
365
331
|
* <div>
|
|
366
332
|
* <h2>{total} Critical Alerts</h2>
|
|
367
333
|
* {alerts.map(alert => (
|
|
368
|
-
* <AlertCard
|
|
369
|
-
* key={alert.id}
|
|
370
|
-
* alert={alert}
|
|
371
|
-
* onAssign={(userId) => updateAlert(alert.id, { assigned_for: userId, status: "in_progress" })}
|
|
372
|
-
* onResolve={() => updateAlert(alert.id, { status: "resolved", reason: "Verified" })}
|
|
373
|
-
* />
|
|
334
|
+
* <AlertCard key={alert.id} alert={alert} />
|
|
374
335
|
* ))}
|
|
375
336
|
* </div>
|
|
376
337
|
* );
|
|
377
338
|
* }
|
|
378
339
|
* ```
|
|
379
|
-
*/
|
|
380
|
-
declare function useKycAlerts(client: KycClient, options?: UseKycAlertsOptions): UseKycAlertsResult;
|
|
381
|
-
/**
|
|
382
|
-
* React hook for KYC overview statistics
|
|
383
|
-
*
|
|
384
|
-
* @param client - KycClient instance
|
|
385
|
-
* @param options - Hook options
|
|
386
|
-
* @returns KYC overview state
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* ```tsx
|
|
390
|
-
* function KycStats() {
|
|
391
|
-
* const { overview, loading, refresh } = useKycOverview(client, {
|
|
392
|
-
* autoFetch: true,
|
|
393
|
-
* fromDate: "2024-01-01T00:00:00Z",
|
|
394
|
-
* toDate: "2024-12-31T23:59:59Z"
|
|
395
|
-
* });
|
|
396
|
-
*
|
|
397
|
-
* if (loading) return <Spinner />;
|
|
398
|
-
*
|
|
399
|
-
* return (
|
|
400
|
-
* <div>
|
|
401
|
-
* <StatCard label="Total" value={overview?.total} />
|
|
402
|
-
* <StatCard label="Pending" value={overview?.pending} />
|
|
403
|
-
* <StatCard label="Approved" value={overview?.approved} />
|
|
404
|
-
* <StatCard label="Rejected" value={overview?.rejected} />
|
|
405
|
-
* <StatCard label="High Risk" value={overview?.high_risk} />
|
|
406
|
-
* </div>
|
|
407
|
-
* );
|
|
408
|
-
* }
|
|
409
|
-
* ```
|
|
410
|
-
*/
|
|
411
|
-
declare function useKycOverview(client: KycClient, options?: UseKycOverviewOptions): UseKycOverviewResult;
|
|
412
|
-
/**
|
|
413
|
-
* React hook for reading KYC preferences
|
|
414
|
-
*
|
|
415
|
-
* Preferences are managed in the Vesant console. The returned
|
|
416
|
-
* `updatePreferences` is deprecated: the platform exposes no update
|
|
417
|
-
* operation, so it always fails.
|
|
418
|
-
*
|
|
419
|
-
* @param client - KycClient instance
|
|
420
|
-
* @param autoFetch - Auto-fetch preferences on mount (default: true)
|
|
421
|
-
* @returns KYC preferences state and methods
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* ```tsx
|
|
425
|
-
* function PreferencesSummary() {
|
|
426
|
-
* const { preferences, loading, refresh } = useKycPreferences(client);
|
|
427
|
-
*
|
|
428
|
-
* if (loading) return <Spinner />;
|
|
429
340
|
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* <dt>Face verification required</dt>
|
|
433
|
-
* <dd>{String(preferences?.is_face_verification_required)}</dd>
|
|
434
|
-
* <dt>Required documents</dt>
|
|
435
|
-
* <dd>{preferences?.required_document_count}</dd>
|
|
436
|
-
* <button onClick={refresh}>Refresh</button>
|
|
437
|
-
* </dl>
|
|
438
|
-
* );
|
|
439
|
-
* }
|
|
440
|
-
* ```
|
|
341
|
+
* @remarks Console session only: the alert endpoints need a dashboard login
|
|
342
|
+
* token and fail with a tenant API key.
|
|
441
343
|
*/
|
|
442
|
-
declare function
|
|
344
|
+
declare function useKycAlerts(client: KycClient, options?: UseKycAlertsOptions): UseKycAlertsResult;
|
|
443
345
|
/**
|
|
444
346
|
* Convert a File to base64 string for document upload
|
|
445
347
|
*
|
|
@@ -632,4 +534,4 @@ interface FaceCaptureModalProps {
|
|
|
632
534
|
}
|
|
633
535
|
declare function FaceCaptureModal({ client, session, onComplete, onCancel, defaultDevice, renderQR, mediapipeAssetBasePath, }: Readonly<FaceCaptureModalProps>): React$1.ReactElement;
|
|
634
536
|
|
|
635
|
-
export { FaceCaptureModal, type FaceCaptureModalProps, type RunFlowResult, type UseCustomerProfileOptions, type UseCustomerProfileResult, UseGeolocationOptions, UseGeolocationResult, UseKycAlertsOptions, UseKycAlertsResult,
|
|
537
|
+
export { FaceCaptureModal, type FaceCaptureModalProps, type RunFlowResult, type UseCustomerProfileOptions, type UseCustomerProfileResult, UseGeolocationOptions, UseGeolocationResult, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult, UseLocationCaptureOptions, UseLocationCaptureResult, UseLocationRequestsOptions, UseLocationRequestsResult, type UseLoginVerificationOptions, type UseLoginVerificationResult, type UseRegistrationOptions, type UseRegistrationResult, type UseTransactionVerificationOptions, type UseTransactionVerificationResult, type VerifyFaceOptions, buildEventBasedFaceVerificationQrPayload, createDeviceFingerprint, fileToBase64, formatKycStatus, getBrowserInfo, getRiskColor, getStatusColor, isMobileDevice, isValidFileSize, isValidFileType, useCipherText, useCustomerProfile, useEventBasedFaceVerificationSubmission, useGeolocation, useKycAlerts, useKycSubmission, useLocationCapture, useLocationRequests, useLoginVerification, useRegistration, useTransactionVerification };
|
package/dist/react.js
CHANGED
|
@@ -871,6 +871,13 @@ function useTransactionVerification(client, options = {}) {
|
|
|
871
871
|
verifyTransaction
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
|
+
|
|
875
|
+
// src/risk-profile/types.ts
|
|
876
|
+
function isProfileUpdateHeld(result) {
|
|
877
|
+
return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/risk-profile/hooks.ts
|
|
874
881
|
function useCustomerProfile(client, customerId, options = {}) {
|
|
875
882
|
const [profile, setProfile] = React.useState(null);
|
|
876
883
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -899,7 +906,7 @@ function useCustomerProfile(client, customerId, options = {}) {
|
|
|
899
906
|
setError(null);
|
|
900
907
|
try {
|
|
901
908
|
const updated = await client.updateProfile(profileRef.current.id, updates);
|
|
902
|
-
setProfile(updated);
|
|
909
|
+
setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
|
|
903
910
|
return updated;
|
|
904
911
|
} catch (err) {
|
|
905
912
|
const error2 = err instanceof Error ? err : new Error("Failed to update profile");
|
|
@@ -2099,81 +2106,6 @@ function useKycSubmission(client, options = {}) {
|
|
|
2099
2106
|
reset
|
|
2100
2107
|
};
|
|
2101
2108
|
}
|
|
2102
|
-
function useKycRequests(client, options = {}) {
|
|
2103
|
-
const [requests, setRequests] = React.useState([]);
|
|
2104
|
-
const [pagination, setPagination] = React.useState(null);
|
|
2105
|
-
const [loading, setLoading] = React.useState(false);
|
|
2106
|
-
const [error, setError] = React.useState(null);
|
|
2107
|
-
const fetchRequests = React.useCallback(
|
|
2108
|
-
async (filters, paginationParams) => {
|
|
2109
|
-
setLoading(true);
|
|
2110
|
-
setError(null);
|
|
2111
|
-
try {
|
|
2112
|
-
const result = await client.listKycRequests(
|
|
2113
|
-
filters || options.filters,
|
|
2114
|
-
paginationParams || options.pagination
|
|
2115
|
-
);
|
|
2116
|
-
setRequests(result.data);
|
|
2117
|
-
setPagination(result.pagination);
|
|
2118
|
-
} catch (err) {
|
|
2119
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC requests");
|
|
2120
|
-
setError(error2);
|
|
2121
|
-
throw error2;
|
|
2122
|
-
} finally {
|
|
2123
|
-
setLoading(false);
|
|
2124
|
-
}
|
|
2125
|
-
},
|
|
2126
|
-
[client, options.filters, options.pagination]
|
|
2127
|
-
);
|
|
2128
|
-
const getRequest = React.useCallback(
|
|
2129
|
-
async (id) => {
|
|
2130
|
-
try {
|
|
2131
|
-
return await client.getKycRequest(id);
|
|
2132
|
-
} catch (err) {
|
|
2133
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC request");
|
|
2134
|
-
setError(error2);
|
|
2135
|
-
throw error2;
|
|
2136
|
-
}
|
|
2137
|
-
},
|
|
2138
|
-
[client]
|
|
2139
|
-
);
|
|
2140
|
-
const updateStatus = React.useCallback(
|
|
2141
|
-
async (reference, status, reason) => {
|
|
2142
|
-
try {
|
|
2143
|
-
await client.updateKycStatus({ reference, status, reason });
|
|
2144
|
-
setRequests(
|
|
2145
|
-
(prev) => prev.map(
|
|
2146
|
-
(req) => req.reference === reference ? {
|
|
2147
|
-
...req,
|
|
2148
|
-
status,
|
|
2149
|
-
...status === "accepted" ? { accepted_reason: reason } : { declined_reason: reason }
|
|
2150
|
-
} : req
|
|
2151
|
-
)
|
|
2152
|
-
);
|
|
2153
|
-
} catch (err) {
|
|
2154
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC status");
|
|
2155
|
-
setError(error2);
|
|
2156
|
-
throw error2;
|
|
2157
|
-
}
|
|
2158
|
-
},
|
|
2159
|
-
[client]
|
|
2160
|
-
);
|
|
2161
|
-
const refresh = React.useCallback(async () => {
|
|
2162
|
-
await fetchRequests();
|
|
2163
|
-
}, [fetchRequests]);
|
|
2164
|
-
useAutoFetch(options.autoFetch, fetchRequests);
|
|
2165
|
-
usePolling(options.pollInterval, fetchRequests);
|
|
2166
|
-
return {
|
|
2167
|
-
requests,
|
|
2168
|
-
pagination,
|
|
2169
|
-
loading,
|
|
2170
|
-
error,
|
|
2171
|
-
fetchRequests,
|
|
2172
|
-
getRequest,
|
|
2173
|
-
updateStatus,
|
|
2174
|
-
refresh
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
2177
2109
|
function useKycAlerts(client, options = {}) {
|
|
2178
2110
|
const [alerts, setAlerts] = React.useState([]);
|
|
2179
2111
|
const [pagination, setPagination] = React.useState(null);
|
|
@@ -2200,35 +2132,6 @@ function useKycAlerts(client, options = {}) {
|
|
|
2200
2132
|
},
|
|
2201
2133
|
[client, options.filters, options.pagination]
|
|
2202
2134
|
);
|
|
2203
|
-
const getAlert = React.useCallback(
|
|
2204
|
-
async (id) => {
|
|
2205
|
-
try {
|
|
2206
|
-
return await client.getAlert(id);
|
|
2207
|
-
} catch (err) {
|
|
2208
|
-
const error2 = err instanceof Error ? err : new Error("Failed to get KYC alert");
|
|
2209
|
-
setError(error2);
|
|
2210
|
-
throw error2;
|
|
2211
|
-
}
|
|
2212
|
-
},
|
|
2213
|
-
[client]
|
|
2214
|
-
);
|
|
2215
|
-
const updateAlert = React.useCallback(
|
|
2216
|
-
async (id, update) => {
|
|
2217
|
-
try {
|
|
2218
|
-
await client.updateAlert(id, update);
|
|
2219
|
-
setAlerts(
|
|
2220
|
-
(prev) => prev.map(
|
|
2221
|
-
(alert) => alert.id === id ? { ...alert, ...update } : alert
|
|
2222
|
-
)
|
|
2223
|
-
);
|
|
2224
|
-
} catch (err) {
|
|
2225
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC alert");
|
|
2226
|
-
setError(error2);
|
|
2227
|
-
throw error2;
|
|
2228
|
-
}
|
|
2229
|
-
},
|
|
2230
|
-
[client]
|
|
2231
|
-
);
|
|
2232
2135
|
const refresh = React.useCallback(async () => {
|
|
2233
2136
|
await fetchAlerts();
|
|
2234
2137
|
}, [fetchAlerts]);
|
|
@@ -2240,87 +2143,9 @@ function useKycAlerts(client, options = {}) {
|
|
|
2240
2143
|
loading,
|
|
2241
2144
|
error,
|
|
2242
2145
|
fetchAlerts,
|
|
2243
|
-
getAlert,
|
|
2244
|
-
updateAlert,
|
|
2245
2146
|
refresh
|
|
2246
2147
|
};
|
|
2247
2148
|
}
|
|
2248
|
-
function useKycOverview(client, options = {}) {
|
|
2249
|
-
const [overview, setOverview] = React.useState(null);
|
|
2250
|
-
const [loading, setLoading] = React.useState(false);
|
|
2251
|
-
const [error, setError] = React.useState(null);
|
|
2252
|
-
const fetchOverview = React.useCallback(
|
|
2253
|
-
async (fromDate, toDate) => {
|
|
2254
|
-
setLoading(true);
|
|
2255
|
-
setError(null);
|
|
2256
|
-
try {
|
|
2257
|
-
const result = await client.getOverview(
|
|
2258
|
-
fromDate || options.fromDate,
|
|
2259
|
-
toDate || options.toDate
|
|
2260
|
-
);
|
|
2261
|
-
setOverview(result);
|
|
2262
|
-
} catch (err) {
|
|
2263
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC overview");
|
|
2264
|
-
setError(error2);
|
|
2265
|
-
throw error2;
|
|
2266
|
-
} finally {
|
|
2267
|
-
setLoading(false);
|
|
2268
|
-
}
|
|
2269
|
-
},
|
|
2270
|
-
[client, options.fromDate, options.toDate]
|
|
2271
|
-
);
|
|
2272
|
-
useAutoFetch(options.autoFetch, fetchOverview);
|
|
2273
|
-
return {
|
|
2274
|
-
overview,
|
|
2275
|
-
loading,
|
|
2276
|
-
error,
|
|
2277
|
-
refresh: fetchOverview
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
|
-
function useKycPreferences(client, autoFetch = true) {
|
|
2281
|
-
const [preferences, setPreferences] = React.useState(null);
|
|
2282
|
-
const [loading, setLoading] = React.useState(false);
|
|
2283
|
-
const [error, setError] = React.useState(null);
|
|
2284
|
-
const fetchPreferences = React.useCallback(async () => {
|
|
2285
|
-
setLoading(true);
|
|
2286
|
-
setError(null);
|
|
2287
|
-
try {
|
|
2288
|
-
const result = await client.getPreferences();
|
|
2289
|
-
setPreferences(result);
|
|
2290
|
-
} catch (err) {
|
|
2291
|
-
const error2 = err instanceof Error ? err : new Error("Failed to fetch KYC preferences");
|
|
2292
|
-
setError(error2);
|
|
2293
|
-
throw error2;
|
|
2294
|
-
} finally {
|
|
2295
|
-
setLoading(false);
|
|
2296
|
-
}
|
|
2297
|
-
}, [client]);
|
|
2298
|
-
const updatePreferences = React.useCallback(
|
|
2299
|
-
async (update) => {
|
|
2300
|
-
setLoading(true);
|
|
2301
|
-
setError(null);
|
|
2302
|
-
try {
|
|
2303
|
-
const result = await client.updatePreferences(update);
|
|
2304
|
-
setPreferences(result);
|
|
2305
|
-
} catch (err) {
|
|
2306
|
-
const error2 = err instanceof Error ? err : new Error("Failed to update KYC preferences");
|
|
2307
|
-
setError(error2);
|
|
2308
|
-
throw error2;
|
|
2309
|
-
} finally {
|
|
2310
|
-
setLoading(false);
|
|
2311
|
-
}
|
|
2312
|
-
},
|
|
2313
|
-
[client]
|
|
2314
|
-
);
|
|
2315
|
-
useAutoFetch(autoFetch, fetchPreferences);
|
|
2316
|
-
return {
|
|
2317
|
-
preferences,
|
|
2318
|
-
loading,
|
|
2319
|
-
error,
|
|
2320
|
-
updatePreferences,
|
|
2321
|
-
refresh: fetchPreferences
|
|
2322
|
-
};
|
|
2323
|
-
}
|
|
2324
2149
|
function fileToBase64(file) {
|
|
2325
2150
|
return new Promise((resolve, reject) => {
|
|
2326
2151
|
const reader = new FileReader();
|
|
@@ -2450,9 +2275,6 @@ exports.useCustomerProfile = useCustomerProfile;
|
|
|
2450
2275
|
exports.useEventBasedFaceVerificationSubmission = useEventBasedFaceVerificationSubmission;
|
|
2451
2276
|
exports.useGeolocation = useGeolocation;
|
|
2452
2277
|
exports.useKycAlerts = useKycAlerts;
|
|
2453
|
-
exports.useKycOverview = useKycOverview;
|
|
2454
|
-
exports.useKycPreferences = useKycPreferences;
|
|
2455
|
-
exports.useKycRequests = useKycRequests;
|
|
2456
2278
|
exports.useKycSubmission = useKycSubmission;
|
|
2457
2279
|
exports.useLocationCapture = useLocationCapture;
|
|
2458
2280
|
exports.useLocationRequests = useLocationRequests;
|