vesant-sdk 1.7.2-dev.617dd44 → 1.7.2

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 CHANGED
@@ -355,6 +355,10 @@ interface ComplianceClientConfig {
355
355
  | `listKycRequests(filters)` | List KYC requests |
356
356
  | `getPreferences()` | Get KYC preferences |
357
357
  | `listAlerts(filters)` | List KYC alerts |
358
+ | `createEventBasedFaceVerificationSession(request)` | Start a face re-verification session (backend) |
359
+ | `submitEventBasedFaceVerificationSession(request)` | Submit a face capture for a session |
360
+ | `getEventBasedFaceVerificationSessionStatus(token)` | Look up a session's current result |
361
+ | `retryEventBasedFaceVerificationJourney(token)` | Mint the next hosted journey after a decline |
358
362
 
359
363
  ## Documentation
360
364
 
package/dist/index.d.mts CHANGED
@@ -9,7 +9,7 @@ export { RiskProfileClient } from './risk-profile/index.mjs';
9
9
  export { a as CreateCustomerProfileRequest, a as CreateProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse, E as EmploymentType, L as LegalForm, c as ProfileDetailsResponse, P as ProfileFilters, b as ProfileListResponse, R as RiskCategory, d as RiskConfiguration, e as RiskDashboardMetrics, f as RiskFactor, g as RiskFactorType, h as RiskHistory, S as ScreeningStatus, U as UpdateProfileRequest } from './types-BOFaMQxI.mjs';
10
10
  export { sdkReasons } from './compliance/index.mjs';
11
11
  export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from './client-D23KhWeh.mjs';
12
- export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycHandoffSession, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
12
+ export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycTriggerEvent, KycVerificationTriggers, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent } from './kyc/index.mjs';
13
13
  export { CTPFormStatus, CTPTINStatus, ComplianceStats, ComplianceStatsFilters, CustomerTaxProfileDocuments, CustomerTaxProfileRecord, CustomerType, DocumentRequestBreakdown, EmailSendingMethod, EnableWithholdingInput, EnableWithholdingResponse, GlobalTaxRule, ReRequestTaxFormInput, RemindersRunResult, TINCheckResult, TINStatusBreakdown, TaxClient, TaxClientConfig, TaxRuleApprovalStatus, TaxRuleVersion, TaxRules, TransactionAction, TreatyCountry, TreatyCountryListResponse, UpdateTaxRulesInput, WFormCountBreakdown, WFormStatusBreakdown } from './tax/index.mjs';
14
14
 
15
15
  /**
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { RiskProfileClient } from './risk-profile/index.js';
9
9
  export { a as CreateCustomerProfileRequest, a as CreateProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse, E as EmploymentType, L as LegalForm, c as ProfileDetailsResponse, P as ProfileFilters, b as ProfileListResponse, R as RiskCategory, d as RiskConfiguration, e as RiskDashboardMetrics, f as RiskFactor, g as RiskFactorType, h as RiskHistory, S as ScreeningStatus, U as UpdateProfileRequest } from './types-UGyDl1fd.js';
10
10
  export { sdkReasons } from './compliance/index.js';
11
11
  export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from './client-B3DCAHlg.js';
12
- export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycHandoffSession, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
12
+ export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycTriggerEvent, KycVerificationTriggers, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent } from './kyc/index.js';
13
13
  export { CTPFormStatus, CTPTINStatus, ComplianceStats, ComplianceStatsFilters, CustomerTaxProfileDocuments, CustomerTaxProfileRecord, CustomerType, DocumentRequestBreakdown, EmailSendingMethod, EnableWithholdingInput, EnableWithholdingResponse, GlobalTaxRule, ReRequestTaxFormInput, RemindersRunResult, TINCheckResult, TINStatusBreakdown, TaxClient, TaxClientConfig, TaxRuleApprovalStatus, TaxRuleVersion, TaxRules, TransactionAction, TreatyCountry, TreatyCountryListResponse, UpdateTaxRulesInput, WFormCountBreakdown, WFormStatusBreakdown } from './tax/index.js';
14
14
 
15
15
  /**
package/dist/index.js CHANGED
@@ -2923,19 +2923,27 @@ var KycClient = class extends BaseClient {
2923
2923
  *
2924
2924
  * Generates a link that the user can visit to submit their KYC documents.
2925
2925
  *
2926
+ * Pass the `trigger_event` that matches the user action so the tenant's
2927
+ * trigger preferences decide whether verification is required; inspect
2928
+ * `kyc_required` and `reason` on the response before redirecting.
2929
+ *
2926
2930
  * Optionally pass the customer's registered identity data as
2927
2931
  * `customer_data` (same shape as the geolocation `customer_data` block).
2928
2932
  * It seeds the customer's risk profile so document verification can
2929
2933
  * cross-check the submitted document against trusted reference data;
2930
2934
  * fields never overwrite data already on the profile.
2931
2935
  *
2932
- * @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
2933
- * @returns Response containing the redirect link and KYC ID
2936
+ * The call is made once and is not retried: each request creates a new
2937
+ * KYC record and link, so a retry after a timeout would leave duplicates.
2938
+ *
2939
+ * @param request - Request containing the user ID, trigger event, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
2940
+ * @returns Response containing the redirect link, KYC ID, `kyc_required`, `can_skip` and `reason`
2934
2941
  *
2935
2942
  * @example
2936
2943
  * ```typescript
2937
2944
  * const result = await client.requestKycSubmitLink({
2938
2945
  * user_id: "user_123",
2946
+ * trigger_event: "onboarding",
2939
2947
  * redirect_url: "https://merchant.com/kyc-complete", // optional
2940
2948
  * callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
2941
2949
  * customer_data: { // optional - seeds the risk profile for document cross-checks
@@ -2948,25 +2956,25 @@ var KycClient = class extends BaseClient {
2948
2956
  * }
2949
2957
  * });
2950
2958
  *
2959
+ * if (!result.kyc_required) return proceed();
2951
2960
  * console.log(`Redirect user to: ${result.link}`);
2952
2961
  * console.log(`KYC ID: ${result.kyc_id}`);
2953
2962
  * ```
2954
2963
  */
2955
2964
  async requestKycSubmitLink(request, requestOptions) {
2956
- return this.requestWithRetry("/api/v1/kyc/request", {
2965
+ return this.request("/api/v1/kyc/request", {
2957
2966
  method: "POST",
2958
2967
  body: JSON.stringify(request),
2959
2968
  headers: this.getUserHeaders()
2960
- }, void 0, void 0, requestOptions);
2969
+ }, void 0, requestOptions);
2961
2970
  }
2962
2971
  /**
2963
2972
  * Create a Event-Based Face Verification session.
2964
2973
  *
2965
2974
  * Inspect the response before showing UI:
2966
- * - `is_required === false` → skip face capture; `reason` explains why.
2967
- * - `device_type === 'desktop'` render `qr_payload` as a QR; the
2968
- * mobile device picks up the session via the connect endpoint.
2969
- * - `device_type === 'mobile'` → open the face capture modal directly.
2975
+ * - `is_required === false` → skip face verification; `reason` explains why.
2976
+ * - `verification_url` presentembed the hosted journey and poll status.
2977
+ * - `verification_url` absent → use the local camera / QR fallback.
2970
2978
  *
2971
2979
  * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
2972
2980
  */
@@ -2980,9 +2988,9 @@ var KycClient = class extends BaseClient {
2980
2988
  /**
2981
2989
  * Submit a real-time face capture for an active Event-Based Face Verification session.
2982
2990
  *
2983
- * **Mobile-only.** The server rejects desktop User-Agents with HTTP
2984
- * 400 (`face capture must be completed on a mobile device`). Use the
2985
- * QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
2991
+ * Works from any device: the platform does not inspect the User-Agent.
2992
+ * `FaceCaptureModal` decides between direct capture and the QR handoff
2993
+ * on the client; custom UIs may submit from desktop or mobile alike.
2986
2994
  *
2987
2995
  * The `data` field on the response carries `retries_remaining`,
2988
2996
  * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
@@ -3013,11 +3021,28 @@ var KycClient = class extends BaseClient {
3013
3021
  headers: this.getUserHeaders()
3014
3022
  });
3015
3023
  }
3024
+ /**
3025
+ * Mint a fresh hosted verification journey for the next attempt on an
3026
+ * active session whose previous hosted-journey attempt was declined.
3027
+ * Only valid while the session is active and attempts remain; the
3028
+ * response carries the new `verification_url` to embed. Used internally
3029
+ * by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
3030
+ *
3031
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
3032
+ */
3033
+ async retryEventBasedFaceVerificationJourney(token) {
3034
+ return this.request("/api/v1/kyc/face/onsite/journey", {
3035
+ method: "POST",
3036
+ body: JSON.stringify({ token }),
3037
+ headers: this.getUserHeaders()
3038
+ });
3039
+ }
3016
3040
  /**
3017
3041
  * Fetch the Redis-backed handoff session for a token. Same backing
3018
- * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
3019
- * callers poll `mobile_connected` to detect when a mobile device has
3020
- * scanned the QR and attached.
3042
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
3043
+ * Event-Based Face Verification database session still expires after
3044
+ * 10 minutes. Desktop callers poll `mobile_connected` to detect when a
3045
+ * mobile device has scanned the QR and attached.
3021
3046
  *
3022
3047
  * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
3023
3048
  */
@@ -3046,25 +3071,30 @@ var KycClient = class extends BaseClient {
3046
3071
  * Check KYC status for a user
3047
3072
  *
3048
3073
  * Returns the current KYC status:
3049
- * - "complete" → KYC verified, show "Continue to Login"
3050
- * - "processing" → Under review, show "Continue to Login"
3051
- * - "failed" / "declined" Show error + retry option
3052
- * - "pending" / "in_progress" Keep polling
3074
+ * - "accepted" / "review.pending" → verified (limited access while under review)
3075
+ * - "pending" → documents submitted, verification running: keep polling
3076
+ * - "awaiting_kyc" nothing submitted yet; check `link_expired` before
3077
+ * re-surfacing or re-requesting the link. Never treat as in progress.
3078
+ * - "declined" → show `additional_data.declined_reasons` (fallback
3079
+ * `declined_reason`) with a retry option
3053
3080
  *
3054
- * @param request - Request containing user_id and token
3055
- * @returns Response with kyc_status and message (reason)
3081
+ * @param request - Request containing user_id and kyc_id
3082
+ * @returns Response with status, verification flags and, once terminal, the full record in `additional_data`
3056
3083
  *
3057
3084
  * @example
3058
3085
  * ```typescript
3059
3086
  * const result = await client.checkKycStatus({
3060
3087
  * user_id: "user_123",
3061
- * token: "auth_token_xyz"
3088
+ * kyc_id: "550e8400-e29b-41d4-a716-446655440000"
3062
3089
  * });
3063
3090
  *
3064
- * if (result.kyc_status === 'complete') {
3065
- * // Show "Continue to Login"
3066
- * } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {
3091
+ * if (result.status === 'accepted' || result.status === 'review.pending') {
3092
+ * // Grant access
3093
+ * } else if (result.status === 'declined') {
3094
+ * const reasons = result.additional_data?.declined_reasons;
3067
3095
  * // Show error + retry option
3096
+ * } else if (result.status === 'awaiting_kyc') {
3097
+ * // Prompt to verify; request a new link when result.link_expired is true
3068
3098
  * } else {
3069
3099
  * // Keep polling
3070
3100
  * }
@@ -3086,7 +3116,9 @@ var KycClient = class extends BaseClient {
3086
3116
  /**
3087
3117
  * Submit a document verification request with OCR
3088
3118
  *
3089
- * Uses requestWithRetry() for automatic retry on transient failures.
3119
+ * The call is made once and is not retried: every submission is processed
3120
+ * and billed, and the platform does not replay this route from an
3121
+ * idempotency key. Retry explicitly if the request fails.
3090
3122
  *
3091
3123
  * @param request - Document verification request with documents and customer info
3092
3124
  * @returns Verification response with status and reference
@@ -3112,11 +3144,11 @@ var KycClient = class extends BaseClient {
3112
3144
  * ```
3113
3145
  */
3114
3146
  async submitVerification(request, requestOptions) {
3115
- return this.requestWithRetry("/api/v1/kyc/submit", {
3147
+ return this.request("/api/v1/kyc/submit", {
3116
3148
  method: "POST",
3117
3149
  body: JSON.stringify(request),
3118
3150
  headers: this.getUserHeaders()
3119
- }, void 0, void 0, requestOptions);
3151
+ }, void 0, requestOptions);
3120
3152
  }
3121
3153
  /**
3122
3154
  * Get a KYC request by ID
@@ -3173,14 +3205,14 @@ var KycClient = class extends BaseClient {
3173
3205
  * ```typescript
3174
3206
  * // Accept a KYC request
3175
3207
  * await client.updateKycStatus({
3176
- * reference: "shufti_ref_123",
3208
+ * reference: "kyc-ref-123",
3177
3209
  * status: "accepted",
3178
3210
  * reason: "All documents verified successfully"
3179
3211
  * });
3180
3212
  *
3181
3213
  * // Decline a KYC request
3182
3214
  * await client.updateKycStatus({
3183
- * reference: "shufti_ref_456",
3215
+ * reference: "kyc-ref-456",
3184
3216
  * status: "declined",
3185
3217
  * reason: "Document expired"
3186
3218
  * });
@@ -3196,6 +3228,10 @@ var KycClient = class extends BaseClient {
3196
3228
  /**
3197
3229
  * Request additional documents from customer
3198
3230
  *
3231
+ * @deprecated The platform does not expose this operation; the call always
3232
+ * fails. Request additional documents from the Vesant console instead.
3233
+ * This method will be removed in a future release.
3234
+ *
3199
3235
  * @param request - Request with KYC ID and document types needed
3200
3236
  *
3201
3237
  * @example
@@ -3368,6 +3404,11 @@ var KycClient = class extends BaseClient {
3368
3404
  /**
3369
3405
  * Update KYC preferences for the tenant
3370
3406
  *
3407
+ * @deprecated KYC preferences are managed in the Vesant console; the
3408
+ * platform exposes no update operation to the SDK, so this call always
3409
+ * fails. Use `getPreferences()` to read them. This method will be removed
3410
+ * in a future release.
3411
+ *
3371
3412
  * @param update - Fields to update
3372
3413
  * @returns Updated preferences
3373
3414
  *
@@ -3526,6 +3567,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
3526
3567
  KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
3527
3568
  KYC_DECLINED: "Identity verification was declined"
3528
3569
  };
3570
+ function isKycDocumentExpiredCallbackEvent(value) {
3571
+ return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
3572
+ }
3529
3573
 
3530
3574
  // src/tax/client.ts
3531
3575
  var TaxClient = class extends BaseClient {
@@ -3851,6 +3895,7 @@ exports.decodeCipherText = decodeCipherText;
3851
3895
  exports.generateCipherText = generateCipherText;
3852
3896
  exports.gpsIntegrityInputFromPosition = gpsIntegrityInputFromPosition;
3853
3897
  exports.isCipherTextExpired = isCipherTextExpired;
3898
+ exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
3854
3899
  exports.noopLogger = noopLogger;
3855
3900
  exports.paginate = paginate;
3856
3901
  exports.probeGeolocationPermission = probeGeolocationPermission;