vesant-sdk 1.8.0-dev.32e3a40 → 1.8.0-dev.394d6eb
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 +0 -2
- package/dist/{client-4oLoc31v.d.ts → client-BPALLldd.d.ts} +1 -1
- package/dist/{client-CJI8VO1i.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 +7 -6
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +7 -6
- 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 +12 -179
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -180
- 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 +12 -179
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +12 -180
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +69 -228
- package/dist/kyc/index.d.ts +69 -228
- package/dist/kyc/index.js +12 -179
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +12 -180
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +6 -122
- package/dist/react.d.ts +6 -122
- package/dist/react.js +0 -185
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -183
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +2 -2
- package/dist/risk-profile/index.d.ts +2 -2
- package/dist/risk-profile/index.js +7 -6
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +7 -6
- 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.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-DfbnIaW_.d.mts → types-DbvVph_0.d.mts} +1 -1
- package/dist/{types-1kI4SsKB.d.ts → types-qXamJr2q.d.ts} +1 -1
- package/package.json +1 -1
package/dist/kyc/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CustomerProfile, P as ProfileFilters, b as ProfileListResponse, a as CreateProfileRequest } from '../types-qXamJr2q.js';
|
|
2
2
|
import { c as Reason, R as RiskLevel, P as PaginationParams } from '../types-CBQRNL-l.js';
|
|
3
3
|
import { B as BaseClient, R as RequestOptions } from '../client-q9fN8Hhf.js';
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ type KycStatus =
|
|
|
15
15
|
/** Submit link issued but the customer has not submitted documents yet — not "in progress". */
|
|
16
16
|
'awaiting_kyc'
|
|
17
17
|
/** Documents submitted, verification in progress. */
|
|
18
|
-
| 'pending' | 'accepted' | 'declined' | 'review.pending'
|
|
18
|
+
| 'pending' | 'accepted' | 'declined' | 'review.pending';
|
|
19
19
|
type KycDeclinedCode = 'KYC_DOCUMENT_EXPIRED' | 'KYC_DOCUMENT_INVALID' | 'KYC_FACE_MISMATCH' | 'KYC_AGE_REQUIREMENT' | 'KYC_DUPLICATE_IDENTITY' | 'KYC_ADDRESS_MISMATCH' | 'KYC_NAME_MISMATCH' | 'KYC_PROVIDER_REJECTED' | 'KYC_DECLINED';
|
|
20
20
|
declare const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string>;
|
|
21
21
|
type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
|
|
@@ -111,7 +111,8 @@ interface KycRequest {
|
|
|
111
111
|
block_reason?: string;
|
|
112
112
|
proofs?: Proof[];
|
|
113
113
|
alerts?: KycAlert[];
|
|
114
|
-
|
|
114
|
+
/** The customer's risk profile (`risk_category`, `risk_score`, `kyc_status`, ...). */
|
|
115
|
+
risk_profile?: CustomerProfile;
|
|
115
116
|
created_at: string;
|
|
116
117
|
updated_at: string;
|
|
117
118
|
}
|
|
@@ -136,21 +137,17 @@ interface ProofDownloadURL {
|
|
|
136
137
|
/** Not sent by the platform; the link itself is short-lived. */
|
|
137
138
|
expires_at?: string;
|
|
138
139
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
sanctions_status?: boolean;
|
|
151
|
-
created_at: string;
|
|
152
|
-
updated_at: string;
|
|
153
|
-
}
|
|
140
|
+
/**
|
|
141
|
+
* The customer's risk profile as embedded on a KYC record
|
|
142
|
+
* (`additional_data.risk_profile`). The platform preloads the full
|
|
143
|
+
* `customer_profiles` row, so this is the same shape as
|
|
144
|
+
* {@link CustomerProfile}: read `risk_category` / `risk_score`, `kyc_status`,
|
|
145
|
+
* `is_pep`, `has_sanctions`. There is no `risk_level` field on the wire.
|
|
146
|
+
*
|
|
147
|
+
* @deprecated Use {@link CustomerProfile}; this alias is kept for existing
|
|
148
|
+
* imports and will be removed in a future major.
|
|
149
|
+
*/
|
|
150
|
+
type KycCustomerProfile = CustomerProfile;
|
|
154
151
|
interface KycAlert {
|
|
155
152
|
id: string;
|
|
156
153
|
kyc_id: string;
|
|
@@ -180,12 +177,6 @@ interface KycAlertListResponse {
|
|
|
180
177
|
alerts: KycAlert[];
|
|
181
178
|
pagination: KycPagination;
|
|
182
179
|
}
|
|
183
|
-
interface UpdateKycAlertRequest {
|
|
184
|
-
assigned_for?: string;
|
|
185
|
-
reason?: string;
|
|
186
|
-
alert_type?: KycAlertType;
|
|
187
|
-
status?: KycAlertStatus;
|
|
188
|
-
}
|
|
189
180
|
/**
|
|
190
181
|
* Threshold-gated trigger for transaction events. Each rule is
|
|
191
182
|
* self-contained — there is no umbrella flag.
|
|
@@ -436,16 +427,6 @@ interface DocumentVerificationResponse {
|
|
|
436
427
|
verification_url?: string;
|
|
437
428
|
message?: string;
|
|
438
429
|
}
|
|
439
|
-
interface UpdateKycStatusRequest {
|
|
440
|
-
/** Provider reference or KYC ID */
|
|
441
|
-
reference: string;
|
|
442
|
-
/** Target status */
|
|
443
|
-
status: KycStatus;
|
|
444
|
-
/** Acceptance/decline reason */
|
|
445
|
-
reason?: string;
|
|
446
|
-
/** Provider warnings data */
|
|
447
|
-
warnings?: Record<string, Record<string, string>>;
|
|
448
|
-
}
|
|
449
430
|
/**
|
|
450
431
|
* Events that can trigger a KYC request. Each maps to a per-event toggle in
|
|
451
432
|
* the tenant's KYC verification trigger preferences (`manual` to the Manual
|
|
@@ -664,9 +645,9 @@ interface RequestKycSubmitLinkResponse {
|
|
|
664
645
|
* is the only signal for it — nothing the customer does triggers it. Delivered
|
|
665
646
|
* once per customer, when the document first becomes expired.
|
|
666
647
|
*
|
|
667
|
-
* It is sent
|
|
668
|
-
*
|
|
669
|
-
*
|
|
648
|
+
* It is sent only while the tenant's auto-trigger-on-ID-expiration setting is
|
|
649
|
+
* enabled; with the setting off the document is still flagged as expired, but
|
|
650
|
+
* no webhook is sent.
|
|
670
651
|
*/
|
|
671
652
|
interface KycDocumentExpiredCallbackEvent {
|
|
672
653
|
/** Always `"kyc_document_expired"` — dispatch on this. */
|
|
@@ -708,10 +689,49 @@ interface KycCallbackReactions {
|
|
|
708
689
|
trigger_alert: boolean;
|
|
709
690
|
block: boolean;
|
|
710
691
|
freeze_account: boolean;
|
|
711
|
-
/** Set when `freeze_account` is true: the tenant
|
|
692
|
+
/** Set when `freeze_account` is true: the freeze window the tenant set for the rules that fired. */
|
|
712
693
|
freeze_duration_minutes?: number;
|
|
713
694
|
enforce_logout: boolean;
|
|
714
695
|
}
|
|
696
|
+
/**
|
|
697
|
+
* Body POSTed to your KYC `callback_url` whenever a document verification
|
|
698
|
+
* reaches an outcome (`accepted`, `declined`, `review.pending`). This is a flat
|
|
699
|
+
* callback, not a platform event envelope: there is no `event_type`, `id` or
|
|
700
|
+
* `timestamp`, so it cannot go through `WebhookHandler`. Verify it with
|
|
701
|
+
* `verifyWebhookSignature`, narrow it with {@link isKycStatusCallbackEvent},
|
|
702
|
+
* and deduplicate on `resource_id` + `status` yourself.
|
|
703
|
+
*/
|
|
704
|
+
interface KycStatusCallbackEvent {
|
|
705
|
+
/** Always `"kyc"` — dispatch on this. */
|
|
706
|
+
event: 'kyc';
|
|
707
|
+
/** The verification reference (your customer identifier). */
|
|
708
|
+
reference: string;
|
|
709
|
+
/** Vesant KYC record ID (`kyc_id`). */
|
|
710
|
+
resource_id: string;
|
|
711
|
+
/** Verification outcome. `awaiting_kyc` / `pending` are never sent. */
|
|
712
|
+
status: 'accepted' | 'declined' | 'review.pending';
|
|
713
|
+
/**
|
|
714
|
+
* `true` when your app should block the triggering action. Set when a
|
|
715
|
+
* failed verification matched a per-event alert rule with the `block`
|
|
716
|
+
* reaction. Sticky once set on the record. Omitted when `false`.
|
|
717
|
+
*/
|
|
718
|
+
block?: boolean;
|
|
719
|
+
/** The event that triggered the block; omitted when not blocked. */
|
|
720
|
+
block_reason?: string;
|
|
721
|
+
/** Comma-joined decline text; the structured list is `data.declined_reasons`. */
|
|
722
|
+
declined_reason?: string;
|
|
723
|
+
/** @deprecated Legacy category → message map; use `data.warning_reasons`. */
|
|
724
|
+
warnings?: Record<string, Record<string, string>>;
|
|
725
|
+
/** Present only when a rule with reactions matched (On Account Sensitive Action). */
|
|
726
|
+
reactions?: KycCallbackReactions;
|
|
727
|
+
/** The full KYC record, with `risk_profile` and proof download links. */
|
|
728
|
+
data: KycRequest;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Type guard for the KYC status callback. Narrows an already
|
|
732
|
+
* signature-verified, parsed payload to {@link KycStatusCallbackEvent}.
|
|
733
|
+
*/
|
|
734
|
+
declare function isKycStatusCallbackEvent(value: unknown): value is KycStatusCallbackEvent;
|
|
715
735
|
/**
|
|
716
736
|
* Body POSTed to your `callback_url` when a held sensitive profile change is
|
|
717
737
|
* settled. Signed with `X-Webhook-Signature: sha256=<hex>` (HMAC-SHA256 of the
|
|
@@ -819,7 +839,11 @@ interface EventBasedFaceVerificationReactionResult {
|
|
|
819
839
|
/** Tenant app should block the action/account when true. */
|
|
820
840
|
block: boolean;
|
|
821
841
|
freeze_duration_minutes: number;
|
|
822
|
-
/**
|
|
842
|
+
/**
|
|
843
|
+
* Reserved. The dashboard alert is raised after the submit response and
|
|
844
|
+
* the webhook have been built, so neither carries the alert id today;
|
|
845
|
+
* read it from `listAlerts()` / the console instead.
|
|
846
|
+
*/
|
|
823
847
|
alert_id?: string;
|
|
824
848
|
}
|
|
825
849
|
/**
|
|
@@ -833,12 +857,12 @@ interface EventBasedFaceVerificationCallback {
|
|
|
833
857
|
resource_id: string;
|
|
834
858
|
status: KycStatus;
|
|
835
859
|
/**
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
*
|
|
860
|
+
* Reserved and not populated on face verification callbacks: the block
|
|
861
|
+
* decision is `data.block`. Only the document-KYC `kyc` callback sets a
|
|
862
|
+
* top-level `block`.
|
|
839
863
|
*/
|
|
840
864
|
block?: boolean;
|
|
841
|
-
/**
|
|
865
|
+
/** Reserved and not populated; see `data.block`. */
|
|
842
866
|
block_reason?: string;
|
|
843
867
|
/**
|
|
844
868
|
* Structured decline reasons. Returned by
|
|
@@ -944,38 +968,12 @@ interface RequestAdditionalDocumentsRequest {
|
|
|
944
968
|
/** Message to customer */
|
|
945
969
|
message?: string;
|
|
946
970
|
}
|
|
947
|
-
interface KycOverview {
|
|
948
|
-
total: number;
|
|
949
|
-
pending: number;
|
|
950
|
-
approved: number;
|
|
951
|
-
high_risk: number;
|
|
952
|
-
rejected: number;
|
|
953
|
-
id_verified: number;
|
|
954
|
-
address_verified: number;
|
|
955
|
-
face_verified: number;
|
|
956
|
-
rejections: number;
|
|
957
|
-
total_alerts: number;
|
|
958
|
-
pending_alerts: number;
|
|
959
|
-
resolved_alerts: number;
|
|
960
|
-
}
|
|
961
|
-
interface KycRequestFilters {
|
|
962
|
-
status?: KycStatus | KycStatus[];
|
|
963
|
-
search?: string;
|
|
964
|
-
fromDate?: string;
|
|
965
|
-
toDate?: string;
|
|
966
|
-
sortBy?: string;
|
|
967
|
-
order?: 'ASC' | 'DESC';
|
|
968
|
-
}
|
|
969
971
|
interface KycPagination {
|
|
970
972
|
limit: number;
|
|
971
973
|
page: number;
|
|
972
974
|
total: number;
|
|
973
975
|
totalPages: number;
|
|
974
976
|
}
|
|
975
|
-
interface KycRequestListResponse {
|
|
976
|
-
data: KycRequest[];
|
|
977
|
-
pagination: KycPagination;
|
|
978
|
-
}
|
|
979
977
|
|
|
980
978
|
interface KycClientConfig {
|
|
981
979
|
/** Base URL of the KYC Service API (e.g., "http://localhost:8088") */
|
|
@@ -1024,36 +1022,11 @@ interface UseKycSubmissionResult extends BaseHookState {
|
|
|
1024
1022
|
submission: DocumentVerificationResponse | null;
|
|
1025
1023
|
reset: () => void;
|
|
1026
1024
|
}
|
|
1027
|
-
type UseKycRequestsOptions = BaseListOptions<KycRequestFilters>;
|
|
1028
|
-
interface UseKycRequestsResult extends BaseHookState {
|
|
1029
|
-
requests: KycRequest[];
|
|
1030
|
-
pagination: KycPagination | null;
|
|
1031
|
-
fetchRequests: (filters?: KycRequestFilters, pagination?: PaginationParams) => Promise<void>;
|
|
1032
|
-
getRequest: (id: string) => Promise<KycRequest>;
|
|
1033
|
-
updateStatus: (reference: string, status: KycStatus, reason?: string) => Promise<void>;
|
|
1034
|
-
refresh: () => Promise<void>;
|
|
1035
|
-
}
|
|
1036
1025
|
type UseKycAlertsOptions = BaseListOptions<KycAlertFilters>;
|
|
1037
1026
|
interface UseKycAlertsResult extends BaseHookState {
|
|
1038
1027
|
alerts: KycAlert[];
|
|
1039
1028
|
pagination: KycPagination | null;
|
|
1040
1029
|
fetchAlerts: (filters?: KycAlertFilters, pagination?: PaginationParams) => Promise<void>;
|
|
1041
|
-
getAlert: (id: string) => Promise<KycAlert>;
|
|
1042
|
-
updateAlert: (id: string, update: UpdateKycAlertRequest) => Promise<void>;
|
|
1043
|
-
refresh: () => Promise<void>;
|
|
1044
|
-
}
|
|
1045
|
-
interface UseKycOverviewOptions extends BaseAutoFetchOptions {
|
|
1046
|
-
fromDate?: string;
|
|
1047
|
-
toDate?: string;
|
|
1048
|
-
}
|
|
1049
|
-
interface UseKycOverviewResult extends BaseHookState {
|
|
1050
|
-
overview: KycOverview | null;
|
|
1051
|
-
refresh: (fromDate?: string, toDate?: string) => Promise<void>;
|
|
1052
|
-
}
|
|
1053
|
-
interface UseKycPreferencesResult extends BaseHookState {
|
|
1054
|
-
preferences: KycPreferences | null;
|
|
1055
|
-
/** @deprecated The platform exposes no preference-update operation; this call always fails. */
|
|
1056
|
-
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
1057
1030
|
refresh: () => Promise<void>;
|
|
1058
1031
|
}
|
|
1059
1032
|
|
|
@@ -1285,54 +1258,6 @@ declare class KycClient extends BaseClient {
|
|
|
1285
1258
|
* ```
|
|
1286
1259
|
*/
|
|
1287
1260
|
getKycRequest(id: string): Promise<KycRequest>;
|
|
1288
|
-
/**
|
|
1289
|
-
* List KYC requests with filters and pagination
|
|
1290
|
-
*
|
|
1291
|
-
* @param filters - Optional filters (status, search, date range)
|
|
1292
|
-
* @param pagination - Optional pagination (page, page_size)
|
|
1293
|
-
* @returns Paginated list of KYC requests
|
|
1294
|
-
*
|
|
1295
|
-
* @example
|
|
1296
|
-
* ```typescript
|
|
1297
|
-
* const requests = await client.listKycRequests(
|
|
1298
|
-
* { status: "pending", search: "john" },
|
|
1299
|
-
* { page: 1, page_size: 20 }
|
|
1300
|
-
* );
|
|
1301
|
-
* console.log(`Found ${requests.total} pending requests`);
|
|
1302
|
-
* ```
|
|
1303
|
-
*
|
|
1304
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1305
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1306
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1307
|
-
*/
|
|
1308
|
-
listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
|
|
1309
|
-
/**
|
|
1310
|
-
* Update KYC request status (accept/decline)
|
|
1311
|
-
*
|
|
1312
|
-
* @param request - Status update request with reference, status, and reason
|
|
1313
|
-
*
|
|
1314
|
-
* @example
|
|
1315
|
-
* ```typescript
|
|
1316
|
-
* // Accept a KYC request
|
|
1317
|
-
* await client.updateKycStatus({
|
|
1318
|
-
* reference: "kyc-ref-123",
|
|
1319
|
-
* status: "accepted",
|
|
1320
|
-
* reason: "All documents verified successfully"
|
|
1321
|
-
* });
|
|
1322
|
-
*
|
|
1323
|
-
* // Decline a KYC request
|
|
1324
|
-
* await client.updateKycStatus({
|
|
1325
|
-
* reference: "kyc-ref-456",
|
|
1326
|
-
* status: "declined",
|
|
1327
|
-
* reason: "Document expired"
|
|
1328
|
-
* });
|
|
1329
|
-
* ```
|
|
1330
|
-
*
|
|
1331
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1332
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1333
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1334
|
-
*/
|
|
1335
|
-
updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
|
|
1336
1261
|
/**
|
|
1337
1262
|
* Request additional documents from customer
|
|
1338
1263
|
*
|
|
@@ -1371,39 +1296,6 @@ declare class KycClient extends BaseClient {
|
|
|
1371
1296
|
* ```
|
|
1372
1297
|
*/
|
|
1373
1298
|
getProofDownloadURLs(kycId: string): Promise<ProofDownloadURL[]>;
|
|
1374
|
-
/**
|
|
1375
|
-
* Get KYC overview statistics
|
|
1376
|
-
*
|
|
1377
|
-
* @param fromDate - Optional start date (ISO 8601)
|
|
1378
|
-
* @param toDate - Optional end date (ISO 8601)
|
|
1379
|
-
* @returns KYC statistics including counts by status
|
|
1380
|
-
*
|
|
1381
|
-
* @example
|
|
1382
|
-
* ```typescript
|
|
1383
|
-
* const overview = await client.getOverview(
|
|
1384
|
-
* "2024-01-01T00:00:00Z",
|
|
1385
|
-
* "2024-12-31T23:59:59Z"
|
|
1386
|
-
* );
|
|
1387
|
-
* console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
|
|
1388
|
-
* console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
|
|
1389
|
-
* ```
|
|
1390
|
-
*
|
|
1391
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1392
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1393
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1394
|
-
*/
|
|
1395
|
-
getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
|
|
1396
|
-
/**
|
|
1397
|
-
* Get a KYC alert by ID
|
|
1398
|
-
*
|
|
1399
|
-
* @param alertId - Alert ID
|
|
1400
|
-
* @returns Alert details
|
|
1401
|
-
*
|
|
1402
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1403
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1404
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1405
|
-
*/
|
|
1406
|
-
getAlert(alertId: string): Promise<KycAlert>;
|
|
1407
1299
|
/**
|
|
1408
1300
|
* List KYC alerts with filters and pagination
|
|
1409
1301
|
*
|
|
@@ -1429,63 +1321,12 @@ declare class KycClient extends BaseClient {
|
|
|
1429
1321
|
* fails with `AuthenticationError` or a permission error.
|
|
1430
1322
|
*/
|
|
1431
1323
|
listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
|
|
1432
|
-
/**
|
|
1433
|
-
* Update a KYC alert
|
|
1434
|
-
*
|
|
1435
|
-
* @param alertId - Alert ID
|
|
1436
|
-
* @param update - Fields to update (status, assigned_for, reason, alert_type)
|
|
1437
|
-
*
|
|
1438
|
-
* @example
|
|
1439
|
-
* ```typescript
|
|
1440
|
-
* // Assign an alert
|
|
1441
|
-
* await client.updateAlert("alert_123", {
|
|
1442
|
-
* assigned_for: "analyst_user_id",
|
|
1443
|
-
* status: "in_progress"
|
|
1444
|
-
* });
|
|
1445
|
-
*
|
|
1446
|
-
* // Resolve an alert
|
|
1447
|
-
* await client.updateAlert("alert_123", {
|
|
1448
|
-
* status: "resolved",
|
|
1449
|
-
* reason: "Customer verified via phone call"
|
|
1450
|
-
* });
|
|
1451
|
-
*
|
|
1452
|
-
* // Escalate an alert
|
|
1453
|
-
* await client.updateAlert("alert_123", {
|
|
1454
|
-
* status: "escalated",
|
|
1455
|
-
* assigned_for: "manager_user_id",
|
|
1456
|
-
* reason: "Requires senior review - suspicious documents"
|
|
1457
|
-
* });
|
|
1458
|
-
* ```
|
|
1459
|
-
*
|
|
1460
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1461
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1462
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1463
|
-
*/
|
|
1464
|
-
updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Get KYC preferences for the tenant
|
|
1467
|
-
*
|
|
1468
|
-
* @returns KYC preferences configuration
|
|
1469
|
-
*
|
|
1470
|
-
* @example
|
|
1471
|
-
* ```typescript
|
|
1472
|
-
* const prefs = await client.getPreferences();
|
|
1473
|
-
* console.log(`Face verification required: ${prefs.is_face_verification_required}`);
|
|
1474
|
-
* console.log(`Required documents: ${prefs.required_document_count}`);
|
|
1475
|
-
* ```
|
|
1476
|
-
*
|
|
1477
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1478
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1479
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1480
|
-
*/
|
|
1481
|
-
getPreferences(): Promise<KycPreferences>;
|
|
1482
1324
|
/**
|
|
1483
1325
|
* Update KYC preferences for the tenant
|
|
1484
1326
|
*
|
|
1485
1327
|
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1486
1328
|
* platform exposes no update operation to the SDK, so this call always
|
|
1487
|
-
* fails.
|
|
1488
|
-
* in a future release.
|
|
1329
|
+
* fails. This method will be removed in a future release.
|
|
1489
1330
|
*
|
|
1490
1331
|
* @param update - Fields to update
|
|
1491
1332
|
* @returns Updated preferences
|
|
@@ -1575,4 +1416,4 @@ declare class KycClient extends BaseClient {
|
|
|
1575
1416
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
1576
1417
|
}
|
|
1577
1418
|
|
|
1578
|
-
export { type AccountSensitiveActionTrigger, type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, type KycCallbackReactions, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDisclosureConsent, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOtherReason, type
|
|
1419
|
+
export { type AccountSensitiveActionTrigger, type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, type KycCallbackReactions, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDisclosureConsent, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOtherReason, type KycPagination, type KycPreferences, type KycRequest, type KycRequestReason, type KycRequestReasonCode, type KycSkipOptions, type KycStatus, type KycStatusCallbackEvent, type KycTriggerEvent, type KycVerificationTriggers, type Name, PaginationParams, type ProfileChangeCallbackEvent, type ProfileChangeField, type ProfileChangeStatus, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, type SupportedAddressDocumentType, type SupportedDocumentType, type UpdateKycPreferencesRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent };
|
package/dist/kyc/index.js
CHANGED
|
@@ -507,19 +507,20 @@ var BaseClient = class {
|
|
|
507
507
|
* Handle error responses from API
|
|
508
508
|
*/
|
|
509
509
|
handleErrorResponse(status, data, requestId) {
|
|
510
|
-
const
|
|
510
|
+
const structured = data.error && typeof data.error === "object" && !Array.isArray(data.error) ? data.error : void 0;
|
|
511
|
+
const message = typeof data.error === "string" && data.error || typeof structured?.message === "string" && structured.message || typeof data.message === "string" && data.message || `HTTP ${status}`;
|
|
511
512
|
const createError = () => {
|
|
512
513
|
switch (status) {
|
|
513
514
|
case 400:
|
|
514
|
-
return new VesantError(message, "BAD_REQUEST", 400);
|
|
515
|
+
return new VesantError(message, "BAD_REQUEST", 400, structured);
|
|
515
516
|
case 401:
|
|
516
517
|
return new AuthenticationError(message);
|
|
517
518
|
case 403:
|
|
518
|
-
return new VesantError(message, "FORBIDDEN", 403);
|
|
519
|
+
return new VesantError(message, "FORBIDDEN", 403, structured);
|
|
519
520
|
case 404:
|
|
520
|
-
return new VesantError(message, "NOT_FOUND", 404);
|
|
521
|
+
return new VesantError(message, "NOT_FOUND", 404, structured);
|
|
521
522
|
case 409:
|
|
522
|
-
return new VesantError(message, "DUPLICATE_PROFILE", 409);
|
|
523
|
+
return new VesantError(message, "DUPLICATE_PROFILE", 409, structured);
|
|
523
524
|
case 429: {
|
|
524
525
|
const retryAfter = data.retry_after || data.retryAfter;
|
|
525
526
|
return new RateLimitError(retryAfter);
|
|
@@ -530,7 +531,7 @@ var BaseClient = class {
|
|
|
530
531
|
case 504:
|
|
531
532
|
return new ServiceUnavailableError(message);
|
|
532
533
|
default:
|
|
533
|
-
return new VesantError(message, "UNKNOWN_ERROR", status);
|
|
534
|
+
return new VesantError(message, "UNKNOWN_ERROR", status, structured);
|
|
534
535
|
}
|
|
535
536
|
};
|
|
536
537
|
const error = createError();
|
|
@@ -913,74 +914,6 @@ var KycClient = class extends BaseClient {
|
|
|
913
914
|
headers: this.getUserHeaders()
|
|
914
915
|
});
|
|
915
916
|
}
|
|
916
|
-
/**
|
|
917
|
-
* List KYC requests with filters and pagination
|
|
918
|
-
*
|
|
919
|
-
* @param filters - Optional filters (status, search, date range)
|
|
920
|
-
* @param pagination - Optional pagination (page, page_size)
|
|
921
|
-
* @returns Paginated list of KYC requests
|
|
922
|
-
*
|
|
923
|
-
* @example
|
|
924
|
-
* ```typescript
|
|
925
|
-
* const requests = await client.listKycRequests(
|
|
926
|
-
* { status: "pending", search: "john" },
|
|
927
|
-
* { page: 1, page_size: 20 }
|
|
928
|
-
* );
|
|
929
|
-
* console.log(`Found ${requests.total} pending requests`);
|
|
930
|
-
* ```
|
|
931
|
-
*
|
|
932
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
933
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
934
|
-
* fails with `AuthenticationError` or a permission error.
|
|
935
|
-
*/
|
|
936
|
-
async listKycRequests(filters, pagination) {
|
|
937
|
-
const params = {};
|
|
938
|
-
if (filters) {
|
|
939
|
-
addFilterParam(params, "status", filters.status);
|
|
940
|
-
addSimpleParams(params, filters, ["search", "fromDate", "toDate", "sortBy", "order"]);
|
|
941
|
-
}
|
|
942
|
-
if (pagination) {
|
|
943
|
-
if (pagination.page) params.page = pagination.page;
|
|
944
|
-
if (pagination.page_size) params.limit = pagination.page_size;
|
|
945
|
-
}
|
|
946
|
-
return this.request(
|
|
947
|
-
`/api/v1/kyc/requests${this.buildQueryString(params)}`,
|
|
948
|
-
{ headers: this.getUserHeaders() }
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Update KYC request status (accept/decline)
|
|
953
|
-
*
|
|
954
|
-
* @param request - Status update request with reference, status, and reason
|
|
955
|
-
*
|
|
956
|
-
* @example
|
|
957
|
-
* ```typescript
|
|
958
|
-
* // Accept a KYC request
|
|
959
|
-
* await client.updateKycStatus({
|
|
960
|
-
* reference: "kyc-ref-123",
|
|
961
|
-
* status: "accepted",
|
|
962
|
-
* reason: "All documents verified successfully"
|
|
963
|
-
* });
|
|
964
|
-
*
|
|
965
|
-
* // Decline a KYC request
|
|
966
|
-
* await client.updateKycStatus({
|
|
967
|
-
* reference: "kyc-ref-456",
|
|
968
|
-
* status: "declined",
|
|
969
|
-
* reason: "Document expired"
|
|
970
|
-
* });
|
|
971
|
-
* ```
|
|
972
|
-
*
|
|
973
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
974
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
975
|
-
* fails with `AuthenticationError` or a permission error.
|
|
976
|
-
*/
|
|
977
|
-
async updateKycStatus(request) {
|
|
978
|
-
await this.request("/api/v1/kyc/status", {
|
|
979
|
-
method: "PUT",
|
|
980
|
-
body: JSON.stringify(request),
|
|
981
|
-
headers: this.getUserHeaders()
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
917
|
/**
|
|
985
918
|
* Request additional documents from customer
|
|
986
919
|
*
|
|
@@ -1029,53 +962,8 @@ var KycClient = class extends BaseClient {
|
|
|
1029
962
|
return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
|
|
1030
963
|
}
|
|
1031
964
|
// ============================================================================
|
|
1032
|
-
// KYC Overview & Statistics
|
|
1033
|
-
// ============================================================================
|
|
1034
|
-
/**
|
|
1035
|
-
* Get KYC overview statistics
|
|
1036
|
-
*
|
|
1037
|
-
* @param fromDate - Optional start date (ISO 8601)
|
|
1038
|
-
* @param toDate - Optional end date (ISO 8601)
|
|
1039
|
-
* @returns KYC statistics including counts by status
|
|
1040
|
-
*
|
|
1041
|
-
* @example
|
|
1042
|
-
* ```typescript
|
|
1043
|
-
* const overview = await client.getOverview(
|
|
1044
|
-
* "2024-01-01T00:00:00Z",
|
|
1045
|
-
* "2024-12-31T23:59:59Z"
|
|
1046
|
-
* );
|
|
1047
|
-
* console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
|
|
1048
|
-
* console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
|
|
1049
|
-
* ```
|
|
1050
|
-
*
|
|
1051
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1052
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1053
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1054
|
-
*/
|
|
1055
|
-
async getOverview(fromDate, toDate) {
|
|
1056
|
-
const params = {};
|
|
1057
|
-
if (fromDate) params.fromDate = fromDate;
|
|
1058
|
-
if (toDate) params.toDate = toDate;
|
|
1059
|
-
return this.request(
|
|
1060
|
-
`/api/v1/kyc/overview${this.buildQueryString(params)}`
|
|
1061
|
-
);
|
|
1062
|
-
}
|
|
1063
|
-
// ============================================================================
|
|
1064
965
|
// Alert Management
|
|
1065
966
|
// ============================================================================
|
|
1066
|
-
/**
|
|
1067
|
-
* Get a KYC alert by ID
|
|
1068
|
-
*
|
|
1069
|
-
* @param alertId - Alert ID
|
|
1070
|
-
* @returns Alert details
|
|
1071
|
-
*
|
|
1072
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1073
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1074
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1075
|
-
*/
|
|
1076
|
-
async getAlert(alertId) {
|
|
1077
|
-
return this.request(`/api/v1/kyc/alerts/${alertId}`);
|
|
1078
|
-
}
|
|
1079
967
|
/**
|
|
1080
968
|
* List KYC alerts with filters and pagination
|
|
1081
969
|
*
|
|
@@ -1118,74 +1006,15 @@ var KycClient = class extends BaseClient {
|
|
|
1118
1006
|
`/api/v1/kyc/alerts${this.buildQueryString(params)}`
|
|
1119
1007
|
);
|
|
1120
1008
|
}
|
|
1121
|
-
/**
|
|
1122
|
-
* Update a KYC alert
|
|
1123
|
-
*
|
|
1124
|
-
* @param alertId - Alert ID
|
|
1125
|
-
* @param update - Fields to update (status, assigned_for, reason, alert_type)
|
|
1126
|
-
*
|
|
1127
|
-
* @example
|
|
1128
|
-
* ```typescript
|
|
1129
|
-
* // Assign an alert
|
|
1130
|
-
* await client.updateAlert("alert_123", {
|
|
1131
|
-
* assigned_for: "analyst_user_id",
|
|
1132
|
-
* status: "in_progress"
|
|
1133
|
-
* });
|
|
1134
|
-
*
|
|
1135
|
-
* // Resolve an alert
|
|
1136
|
-
* await client.updateAlert("alert_123", {
|
|
1137
|
-
* status: "resolved",
|
|
1138
|
-
* reason: "Customer verified via phone call"
|
|
1139
|
-
* });
|
|
1140
|
-
*
|
|
1141
|
-
* // Escalate an alert
|
|
1142
|
-
* await client.updateAlert("alert_123", {
|
|
1143
|
-
* status: "escalated",
|
|
1144
|
-
* assigned_for: "manager_user_id",
|
|
1145
|
-
* reason: "Requires senior review - suspicious documents"
|
|
1146
|
-
* });
|
|
1147
|
-
* ```
|
|
1148
|
-
*
|
|
1149
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1150
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1151
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1152
|
-
*/
|
|
1153
|
-
async updateAlert(alertId, update) {
|
|
1154
|
-
await this.request(`/api/v1/kyc/alerts/${alertId}`, {
|
|
1155
|
-
method: "PUT",
|
|
1156
|
-
body: JSON.stringify(update),
|
|
1157
|
-
headers: this.getUserHeaders()
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
1009
|
// ============================================================================
|
|
1161
1010
|
// KYC Preferences
|
|
1162
1011
|
// ============================================================================
|
|
1163
|
-
/**
|
|
1164
|
-
* Get KYC preferences for the tenant
|
|
1165
|
-
*
|
|
1166
|
-
* @returns KYC preferences configuration
|
|
1167
|
-
*
|
|
1168
|
-
* @example
|
|
1169
|
-
* ```typescript
|
|
1170
|
-
* const prefs = await client.getPreferences();
|
|
1171
|
-
* console.log(`Face verification required: ${prefs.is_face_verification_required}`);
|
|
1172
|
-
* console.log(`Required documents: ${prefs.required_document_count}`);
|
|
1173
|
-
* ```
|
|
1174
|
-
*
|
|
1175
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1176
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1177
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1178
|
-
*/
|
|
1179
|
-
async getPreferences() {
|
|
1180
|
-
return this.request("/api/v1/kyc/preferences");
|
|
1181
|
-
}
|
|
1182
1012
|
/**
|
|
1183
1013
|
* Update KYC preferences for the tenant
|
|
1184
1014
|
*
|
|
1185
1015
|
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1186
1016
|
* platform exposes no update operation to the SDK, so this call always
|
|
1187
|
-
* fails.
|
|
1188
|
-
* in a future release.
|
|
1017
|
+
* fails. This method will be removed in a future release.
|
|
1189
1018
|
*
|
|
1190
1019
|
* @param update - Fields to update
|
|
1191
1020
|
* @returns Updated preferences
|
|
@@ -1348,6 +1177,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
|
|
|
1348
1177
|
function isKycDocumentExpiredCallbackEvent(value) {
|
|
1349
1178
|
return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
|
|
1350
1179
|
}
|
|
1180
|
+
function isKycStatusCallbackEvent(value) {
|
|
1181
|
+
return typeof value === "object" && value !== null && value.event === "kyc";
|
|
1182
|
+
}
|
|
1351
1183
|
function isProfileChangeCallbackEvent(value) {
|
|
1352
1184
|
return typeof value === "object" && value !== null && value.event === "profile_change";
|
|
1353
1185
|
}
|
|
@@ -1355,6 +1187,7 @@ function isProfileChangeCallbackEvent(value) {
|
|
|
1355
1187
|
exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
|
|
1356
1188
|
exports.KycClient = KycClient;
|
|
1357
1189
|
exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
|
|
1190
|
+
exports.isKycStatusCallbackEvent = isKycStatusCallbackEvent;
|
|
1358
1191
|
exports.isProfileChangeCallbackEvent = isProfileChangeCallbackEvent;
|
|
1359
1192
|
//# sourceMappingURL=index.js.map
|
|
1360
1193
|
//# sourceMappingURL=index.js.map
|